Refactor Batch (#2439)
This commit is contained in:
parent
dc9ecc143d
commit
bcc122b724
@ -1,143 +1,143 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>spring-ldap</artifactId>
|
<artifactId>spring-ldap</artifactId>
|
||||||
<version>0.1-SNAPSHOT</version>
|
<version>0.1-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>parent-modules</artifactId>
|
<artifactId>parent-modules</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<spring-ldap.version>2.3.1.RELEASE</spring-ldap.version>
|
<spring-ldap.version>2.3.1.RELEASE</spring-ldap.version>
|
||||||
<spring-context.version>4.3.6.RELEASE</spring-context.version>
|
<spring-context.version>4.3.6.RELEASE</spring-context.version>
|
||||||
<apacheds.version>1.5.5</apacheds.version>
|
<apacheds.version>1.5.5</apacheds.version>
|
||||||
<shared-ldap.version>0.9.15</shared-ldap.version>
|
<shared-ldap.version>0.9.15</shared-ldap.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<finalName>spring-ldap</finalName>
|
<finalName>spring-ldap</finalName>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.ldap</groupId>
|
<groupId>org.springframework.ldap</groupId>
|
||||||
<artifactId>spring-ldap-core</artifactId>
|
<artifactId>spring-ldap-core</artifactId>
|
||||||
<version>${spring-ldap.version}</version>
|
<version>${spring-ldap.version}</version>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>commons-logging</groupId>
|
<groupId>commons-logging</groupId>
|
||||||
<artifactId>commons-logging</artifactId>
|
<artifactId>commons-logging</artifactId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-context</artifactId>
|
<artifactId>spring-context</artifactId>
|
||||||
<version>${spring-context.version}</version>
|
<version>${spring-context.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- spring ldap test -->
|
<!-- spring ldap test -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.ldap</groupId>
|
<groupId>org.springframework.ldap</groupId>
|
||||||
<artifactId>spring-ldap-test</artifactId>
|
<artifactId>spring-ldap-test</artifactId>
|
||||||
<version>${spring-ldap.version}</version>
|
<version>${spring-ldap.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<artifactId>commons-logging</artifactId>
|
<artifactId>commons-logging</artifactId>
|
||||||
<groupId>commons-logging</groupId>
|
<groupId>commons-logging</groupId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- apacheds for test -->
|
<!-- apacheds for test -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.directory.server</groupId>
|
<groupId>org.apache.directory.server</groupId>
|
||||||
<artifactId>apacheds-core</artifactId>
|
<artifactId>apacheds-core</artifactId>
|
||||||
<version>${apacheds.version}</version>
|
<version>${apacheds.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.directory.server</groupId>
|
<groupId>org.apache.directory.server</groupId>
|
||||||
<artifactId>apacheds-core-entry</artifactId>
|
<artifactId>apacheds-core-entry</artifactId>
|
||||||
<version>${apacheds.version}</version>
|
<version>${apacheds.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.directory.server</groupId>
|
<groupId>org.apache.directory.server</groupId>
|
||||||
<artifactId>apacheds-protocol-shared</artifactId>
|
<artifactId>apacheds-protocol-shared</artifactId>
|
||||||
<version>${apacheds.version}</version>
|
<version>${apacheds.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.directory.server</groupId>
|
<groupId>org.apache.directory.server</groupId>
|
||||||
<artifactId>apacheds-protocol-ldap</artifactId>
|
<artifactId>apacheds-protocol-ldap</artifactId>
|
||||||
<version>${apacheds.version}</version>
|
<version>${apacheds.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.directory.server</groupId>
|
<groupId>org.apache.directory.server</groupId>
|
||||||
<artifactId>apacheds-server-jndi</artifactId>
|
<artifactId>apacheds-server-jndi</artifactId>
|
||||||
<version>${apacheds.version}</version>
|
<version>${apacheds.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.directory.shared</groupId>
|
<groupId>org.apache.directory.shared</groupId>
|
||||||
<artifactId>shared-ldap</artifactId>
|
<artifactId>shared-ldap</artifactId>
|
||||||
<version>${shared-ldap.version}</version>
|
<version>${shared-ldap.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<!-- Spring Data LDAP -->
|
<!-- Spring Data LDAP -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.data</groupId>
|
<groupId>org.springframework.data</groupId>
|
||||||
<artifactId>spring-data-ldap</artifactId>
|
<artifactId>spring-data-ldap</artifactId>
|
||||||
<version>1.0.6.RELEASE</version>
|
<version>1.0.6.RELEASE</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.data</groupId>
|
<groupId>org.springframework.data</groupId>
|
||||||
<artifactId>spring-data-jpa</artifactId>
|
<artifactId>spring-data-jpa</artifactId>
|
||||||
<version>1.11.6.RELEASE</version>
|
<version>1.11.6.RELEASE</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<profiles>
|
<profiles>
|
||||||
<profile>
|
<profile>
|
||||||
<id>live</id>
|
<id>live</id>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>integration-test</phase>
|
<phase>integration-test</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>test</goal>
|
<goal>test</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<excludes>
|
<excludes>
|
||||||
<exclude>**/*IntegrationTest.java</exclude>
|
<exclude>**/*IntegrationTest.java</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
<includes>
|
<includes>
|
||||||
<include>**/*LiveTest.java</include>
|
<include>**/*LiveTest.java</include>
|
||||||
</includes>
|
</includes>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</profile>
|
</profile>
|
||||||
</profiles>
|
</profiles>
|
||||||
</project>
|
</project>
|
@ -8,10 +8,10 @@ import org.springframework.stereotype.Repository;
|
|||||||
@Repository
|
@Repository
|
||||||
public interface UserRepository extends LdapRepository<User> {
|
public interface UserRepository extends LdapRepository<User> {
|
||||||
|
|
||||||
public User findByUsername(String username);
|
User findByUsername(String username);
|
||||||
|
|
||||||
public User findByUsernameAndPassword(String username, String password);
|
User findByUsernameAndPassword(String username, String password);
|
||||||
|
|
||||||
public List<User> findByUsernameLikeIgnoreCase(String username);
|
List<User> findByUsernameLikeIgnoreCase(String username);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,11 @@ package com.baeldung.ldap.data.service;
|
|||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
import org.springframework.ldap.core.*;
|
import org.springframework.ldap.core.AttributesMapper;
|
||||||
|
import org.springframework.ldap.core.ContextSource;
|
||||||
|
import org.springframework.ldap.core.DirContextAdapter;
|
||||||
|
import org.springframework.ldap.core.DirContextOperations;
|
||||||
|
import org.springframework.ldap.core.LdapTemplate;
|
||||||
import org.springframework.ldap.support.LdapNameBuilder;
|
import org.springframework.ldap.support.LdapNameBuilder;
|
||||||
|
|
||||||
import javax.naming.Name;
|
import javax.naming.Name;
|
||||||
@ -31,8 +35,8 @@ public class LdapClient {
|
|||||||
"ou=users",
|
"ou=users",
|
||||||
"cn=" + username,
|
"cn=" + username,
|
||||||
(AttributesMapper<String>) attrs -> (String) attrs
|
(AttributesMapper<String>) attrs -> (String) attrs
|
||||||
.get("cn")
|
.get("cn")
|
||||||
.get());
|
.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void create(final String username, final String password) {
|
public void create(final String username, final String password) {
|
||||||
@ -43,7 +47,7 @@ public class LdapClient {
|
|||||||
.build();
|
.build();
|
||||||
DirContextAdapter context = new DirContextAdapter(dn);
|
DirContextAdapter context = new DirContextAdapter(dn);
|
||||||
|
|
||||||
context.setAttributeValues("objectclass", new String[] { "top", "person", "organizationalPerson", "inetOrgPerson" });
|
context.setAttributeValues("objectclass", new String[]{"top", "person", "organizationalPerson", "inetOrgPerson"});
|
||||||
context.setAttributeValue("cn", username);
|
context.setAttributeValue("cn", username);
|
||||||
context.setAttributeValue("sn", username);
|
context.setAttributeValue("sn", username);
|
||||||
context.setAttributeValue("userPassword", digestSHA(password));
|
context.setAttributeValue("userPassword", digestSHA(password));
|
||||||
@ -59,7 +63,7 @@ public class LdapClient {
|
|||||||
.build();
|
.build();
|
||||||
DirContextOperations context = ldapTemplate.lookupContext(dn);
|
DirContextOperations context = ldapTemplate.lookupContext(dn);
|
||||||
|
|
||||||
context.setAttributeValues("objectclass", new String[] { "top", "person", "organizationalPerson", "inetOrgPerson" });
|
context.setAttributeValues("objectclass", new String[]{"top", "person", "organizationalPerson", "inetOrgPerson"});
|
||||||
context.setAttributeValue("cn", username);
|
context.setAttributeValue("cn", username);
|
||||||
context.setAttributeValue("sn", username);
|
context.setAttributeValue("sn", username);
|
||||||
context.setAttributeValue("userPassword", digestSHA(password));
|
context.setAttributeValue("userPassword", digestSHA(password));
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
package com.baeldung.ldap.data.service;
|
package com.baeldung.ldap.data.service;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import com.baeldung.ldap.data.repository.User;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import com.baeldung.ldap.data.repository.UserRepository;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Base64;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.ldap.support.LdapUtils;
|
import org.springframework.ldap.support.LdapUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.baeldung.ldap.data.repository.User;
|
import java.security.MessageDigest;
|
||||||
import com.baeldung.ldap.data.repository.UserRepository;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.util.Base64;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class UserService {
|
public class UserService {
|
||||||
@ -21,20 +21,18 @@ public class UserService {
|
|||||||
|
|
||||||
public Boolean authenticate(final String username, final String password) {
|
public Boolean authenticate(final String username, final String password) {
|
||||||
User user = userRepository.findByUsernameAndPassword(username, password);
|
User user = userRepository.findByUsernameAndPassword(username, password);
|
||||||
return user != null ? true : false;
|
return user != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> search(final String username) {
|
public List<String> search(final String username) {
|
||||||
List<User> userList = userRepository.findByUsernameLikeIgnoreCase(username);
|
List<User> userList = userRepository.findByUsernameLikeIgnoreCase(username);
|
||||||
List<String> users = null;
|
if (userList == null) {
|
||||||
if (null != userList) {
|
return Collections.emptyList();
|
||||||
users = new ArrayList<String>();
|
|
||||||
for (User user : userList) {
|
|
||||||
users.add(user.getUsername());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return users;
|
|
||||||
|
|
||||||
|
return userList.stream()
|
||||||
|
.map(User::getUsername)
|
||||||
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void create(final String username, final String password) {
|
public void create(final String username, final String password) {
|
||||||
@ -48,7 +46,6 @@ public class UserService {
|
|||||||
User user = userRepository.findByUsername(username);
|
User user = userRepository.findByUsername(username);
|
||||||
user.setPassword(password);
|
user.setPassword(password);
|
||||||
userRepository.save(user);
|
userRepository.save(user);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String digestSHA(final String password) {
|
private String digestSHA(final String password) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.baeldung.ldap.javaconfig;
|
package com.baeldung.ldap.javaconfig;
|
||||||
|
|
||||||
|
import com.baeldung.ldap.client.LdapClient;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
@ -11,13 +12,11 @@ import org.springframework.data.ldap.repository.config.EnableLdapRepositories;
|
|||||||
import org.springframework.ldap.core.LdapTemplate;
|
import org.springframework.ldap.core.LdapTemplate;
|
||||||
import org.springframework.ldap.core.support.LdapContextSource;
|
import org.springframework.ldap.core.support.LdapContextSource;
|
||||||
|
|
||||||
import com.baeldung.ldap.client.LdapClient;
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@PropertySource("classpath:application.properties")
|
@PropertySource("classpath:application.properties")
|
||||||
@ComponentScan(basePackages = { "com.baeldung.ldap.*" })
|
@ComponentScan(basePackages = {"com.baeldung.ldap.*"})
|
||||||
@Profile("default")
|
@Profile("default")
|
||||||
@EnableLdapRepositories(basePackages="com.baeldung.ldap.**")
|
@EnableLdapRepositories(basePackages = "com.baeldung.ldap.**")
|
||||||
public class AppConfig {
|
public class AppConfig {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -7,13 +7,13 @@
|
|||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<logger name="org.springframework" level="WARN" />
|
<logger name="org.springframework" level="WARN"/>
|
||||||
<logger name="org.springframework.transaction" level="WARN" />
|
<logger name="org.springframework.transaction" level="WARN"/>
|
||||||
|
|
||||||
<!-- in order to debug some marshalling issues, this needs to be TRACE -->
|
<!-- in order to debug some marshalling issues, this needs to be TRACE -->
|
||||||
<logger name="org.springframework.web.servlet.mvc" level="WARN" />
|
<logger name="org.springframework.web.servlet.mvc" level="WARN"/>
|
||||||
|
|
||||||
<root level="INFO">
|
<root level="INFO">
|
||||||
<appender-ref ref="STDOUT" />
|
<appender-ref ref="STDOUT"/>
|
||||||
</root>
|
</root>
|
||||||
</configuration>
|
</configuration>
|
@ -1,7 +1,6 @@
|
|||||||
package com.baeldung.ldap.client;
|
package com.baeldung.ldap.client;
|
||||||
|
|
||||||
import java.util.List;
|
import com.baeldung.ldap.javaconfig.TestConfig;
|
||||||
|
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -13,11 +12,11 @@ import org.springframework.test.context.ContextConfiguration;
|
|||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
import org.springframework.test.context.support.AnnotationConfigContextLoader;
|
import org.springframework.test.context.support.AnnotationConfigContextLoader;
|
||||||
|
|
||||||
import com.baeldung.ldap.javaconfig.TestConfig;
|
import java.util.List;
|
||||||
|
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
@ActiveProfiles("testlive")
|
@ActiveProfiles("testlive")
|
||||||
@ContextConfiguration(classes = { TestConfig.class }, loader = AnnotationConfigContextLoader.class)
|
@ContextConfiguration(classes = {TestConfig.class}, loader = AnnotationConfigContextLoader.class)
|
||||||
public class LdapClientLiveTest {
|
public class LdapClientLiveTest {
|
||||||
|
|
||||||
private static final String USER2 = "TEST02";
|
private static final String USER2 = "TEST02";
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
package com.baeldung.ldap.client;
|
package com.baeldung.ldap.client;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import com.baeldung.ldap.data.service.UserService;
|
||||||
import static org.junit.Assert.assertThat;
|
import com.baeldung.ldap.javaconfig.TestConfig;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@ -14,12 +11,14 @@ import org.springframework.test.context.ContextConfiguration;
|
|||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
import org.springframework.test.context.support.AnnotationConfigContextLoader;
|
import org.springframework.test.context.support.AnnotationConfigContextLoader;
|
||||||
|
|
||||||
import com.baeldung.ldap.data.service.UserService;
|
import java.util.List;
|
||||||
import com.baeldung.ldap.javaconfig.TestConfig;
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
@ActiveProfiles("testlive")
|
@ActiveProfiles("testlive")
|
||||||
@ContextConfiguration(classes = { TestConfig.class }, loader = AnnotationConfigContextLoader.class)
|
@ContextConfiguration(classes = {TestConfig.class}, loader = AnnotationConfigContextLoader.class)
|
||||||
public class LdapDataRepositoryTest {
|
public class LdapDataRepositoryTest {
|
||||||
|
|
||||||
private static final String USER2 = "TEST02";
|
private static final String USER2 = "TEST02";
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.baeldung.ldap.javaconfig;
|
package com.baeldung.ldap.javaconfig;
|
||||||
|
|
||||||
|
import com.baeldung.ldap.client.LdapClient;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
@ -13,12 +14,10 @@ import org.springframework.ldap.core.LdapTemplate;
|
|||||||
import org.springframework.ldap.core.support.LdapContextSource;
|
import org.springframework.ldap.core.support.LdapContextSource;
|
||||||
import org.springframework.ldap.test.TestContextSourceFactoryBean;
|
import org.springframework.ldap.test.TestContextSourceFactoryBean;
|
||||||
|
|
||||||
import com.baeldung.ldap.client.LdapClient;
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@PropertySource("classpath:test_application.properties")
|
@PropertySource("classpath:test_application.properties")
|
||||||
@ComponentScan(basePackages = { "com.baeldung.ldap.*" })
|
@ComponentScan(basePackages = {"com.baeldung.ldap.*"})
|
||||||
@EnableLdapRepositories(basePackages="com.baeldung.ldap.**")
|
@EnableLdapRepositories(basePackages = "com.baeldung.ldap.**")
|
||||||
@Profile("testlive")
|
@Profile("testlive")
|
||||||
public class TestConfig {
|
public class TestConfig {
|
||||||
@Autowired
|
@Autowired
|
||||||
|
Loading…
x
Reference in New Issue
Block a user