Guest User

Untitled

a guest
Apr 11th, 2018
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. main
  2. java
  3. com.test.ldap
  4. Application.java
  5. Person.java
  6. PersonRepository.java
  7. resources
  8. application.yml
  9. schema.ldif
  10.  
  11. test
  12. java
  13. Tests.java
  14. resources
  15. test.yml
  16. test_schema.ldif
  17.  
  18. import com.test.ldap.Person;
  19. import com.test.ldap.PersonRepository;
  20. import org.junit.Test;
  21. import org.junit.runner.RunWith;
  22. import org.springframework.beans.factory.annotation.Autowired;
  23. import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
  24. import org.springframework.boot.test.context.SpringBootTest;
  25. import org.springframework.test.context.TestPropertySource;
  26. import org.springframework.test.context.junit4.SpringRunner;
  27.  
  28. import java.util.List;
  29.  
  30. @RunWith(SpringRunner.class)
  31. @SpringBootTest(classes = {PersonRepository.class})
  32. @TestPropertySource(locations = "classpath:test.yml")
  33. @EnableAutoConfiguration
  34. public class Tests {
  35.  
  36. @Autowired
  37. private PersonRepository personRepository;
  38.  
  39. @Test
  40. public void testGetPersonByLastName() {
  41. List<Person> names = personRepository.getPersonNamesByLastName("Bachman");
  42. assert(names.size() > 0);
  43. }
  44.  
  45. }
  46.  
  47. # Spring LDAP Mapping Attributes to POJO with AttributesMapper configuration application.yml
  48.  
  49. spring:
  50. ldap:
  51.  
  52. # Spring LDAP
  53. #
  54. # In this example we use an embedded ldap server. When using a real one,
  55. # you can configure the settings here.
  56. #
  57. # urls: ldap://localhost:12345
  58. # base: dc=memorynotfound,dc=com
  59. # username: uid=admin
  60. # password: secret
  61.  
  62. # Embedded Spring LDAP
  63. embedded:
  64. base-dn: dc=test,dc=com
  65. credential:
  66. username: uid=admin
  67. password: secret
  68. ldif: classpath:test_schema.ldif
  69. port: 12345
  70. validation:
  71. enabled: false
Add Comment
Please, Sign In to add comment