Remove Spring 2.0, 2.5, and 3.0 Tests
Closes gh-594
This commit is contained in:
@@ -7,7 +7,6 @@ targetCompatibility = '1.8'
|
||||
ext.apacheDsVersion = '1.5.5'
|
||||
ext.springVersion = '4.3.27.RELEASE'
|
||||
ext.springDataVersion = '1.13.23.RELEASE'
|
||||
ext.springDataSpring3Version = '1.10.2.RELEASE'
|
||||
ext.springBatchVersion = '2.0.4.RELEASE'
|
||||
ext.junitVersion = '4.12'
|
||||
ext.commonsIoVersion = '2.4'
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url "https://download.java.net/maven/2/" }
|
||||
}
|
||||
apply from: JAVA_SCRIPT
|
||||
|
||||
ext.spring20Version = '2.0.8'
|
||||
|
||||
dependencies {
|
||||
testCompile (project(":spring-ldap-test")) {
|
||||
exclude group: "org.springframework", module:"spring-core"
|
||||
exclude group: "org.springframework", module:"spring-beans"
|
||||
exclude group: "org.springframework", module:"spring-context"
|
||||
exclude group: "org.springframework", module:"spring-test"
|
||||
exclude group: "org.springframework", module:"spring-tx"
|
||||
}
|
||||
|
||||
testCompile "org.springframework:spring-mock:$spring20Version",
|
||||
"org.springframework:spring-context:$spring20Version",
|
||||
"org.springframework:spring-core:$spring20Version",
|
||||
"org.springframework:spring-dao:$spring20Version",
|
||||
"org.springframework:spring-beans:$spring20Version",
|
||||
"org.slf4j:slf4j-log4j12:$slf4jVersion",
|
||||
"org.assertj:assertj-core:$assertjVersion",
|
||||
apachedsDependencies
|
||||
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright 2005-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ldap.itest20;
|
||||
|
||||
import org.springframework.ldap.core.DirContextOperations;
|
||||
import org.springframework.ldap.core.LdapTemplate;
|
||||
import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests the lookup methods of LdapTemplate together with Spring 2.0.
|
||||
*
|
||||
* @author Mattias Hellborg Arthursson
|
||||
*/
|
||||
public class LdapTemplateLookup20ITest extends AbstractDependencyInjectionSpringContextTests {
|
||||
|
||||
private LdapTemplate tested;
|
||||
|
||||
public void setTested(LdapTemplate tested) {
|
||||
this.tested = tested;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getConfigLocations() {
|
||||
return new String[]{"/conf/ldapTemplateTestContext.xml"};
|
||||
}
|
||||
|
||||
/**
|
||||
* This method depends on a DirObjectFactory (
|
||||
* {@link org.springframework.ldap.core.support.DefaultDirObjectFactory})
|
||||
* being set in the ContextSource.
|
||||
*/
|
||||
public void testThatPlainLookupWorksWithSpring20() {
|
||||
DirContextOperations result = tested.lookupContext("cn=Some Person2, ou=company1,c=Sweden");
|
||||
|
||||
assertThat(result.getStringAttribute("cn")).isEqualTo("Some Person2");
|
||||
assertThat(result.getStringAttribute("sn")).isEqualTo("Person2");
|
||||
assertThat(result.getStringAttribute("description")).isEqualTo("Sweden, Company1, Some Person2");
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
|
||||
|
||||
<!--
|
||||
This context configuration file defines common beans,
|
||||
minimizing duplication in the various test context files.
|
||||
-->
|
||||
|
||||
<bean id="placeholderConfig"
|
||||
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
||||
<property name="location" value="classpath:/conf/ldap.properties" />
|
||||
</bean>
|
||||
</beans>
|
||||
@@ -1,4 +0,0 @@
|
||||
urls=ldap://127.0.0.1:1888
|
||||
userDn=uid=admin,ou=system
|
||||
password=secret
|
||||
base=dc=jayway,dc=se
|
||||
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
|
||||
<import resource="classpath:/conf/commonTestContext.xml" />
|
||||
|
||||
<bean id="contextSource"
|
||||
class="org.springframework.ldap.test.TestContextSourceFactoryBean">
|
||||
<property name="defaultPartitionSuffix" value="dc=jayway,dc=se" />
|
||||
<property name="defaultPartitionName" value="jayway" />
|
||||
<property name="principal" value="${userDn}" />
|
||||
<property name="password" value="${password}" />
|
||||
<property name="ldifFile" value="classpath:/setup_data.ldif" />
|
||||
<property name="port" value="1888" />
|
||||
</bean>
|
||||
|
||||
<bean id="ldapTemplate"
|
||||
class="org.springframework.ldap.core.LdapTemplate">
|
||||
<constructor-arg ref="contextSource" />
|
||||
</bean>
|
||||
</beans>
|
||||
@@ -1,12 +0,0 @@
|
||||
log4j.rootCategory=WARN, stdout
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.layout.ConversionPattern=%r [%t] %-5p\: %-15c{2} - %m%n
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
|
||||
# Enable info on Spring LDAP
|
||||
#log4j.logger.org.springframework.ldap=INFO
|
||||
|
||||
log4j.logger.org.apache.directory.server.schema.registries.DefaultSyntaxRegistry=WARN
|
||||
log4j.logger.org.apache.directory.server.core.schema.bootstrap=ERROR
|
||||
log4j.logger.org.apache.directory.server.core.partition.impl.btree=ERROR
|
||||
log4j.logger.org.apache.directory.shared.ldap.ldif=ERROR
|
||||
@@ -1,110 +0,0 @@
|
||||
dn: ou=groups,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: organizationalUnit
|
||||
ou: groups
|
||||
|
||||
dn: cn=ROLE_USER,ou=groups,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: groupOfUniqueNames
|
||||
cn: ROLE_USER
|
||||
uniqueMember: cn=Some Person,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
uniqueMember: cn=Some Person2,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
uniqueMember: cn=Some Person,ou=company1,c=Norway,dc=jayway,dc=se
|
||||
uniqueMember: cn=Some Person,ou=company2,c=Sweden,dc=jayway,dc=se
|
||||
uniqueMember: cn=Some Person3,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
|
||||
dn: cn=ROLE_ADMIN,ou=groups,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: groupOfUniqueNames
|
||||
cn: ROLE_ADMIN
|
||||
uniqueMember: cn=Some Person2,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
|
||||
dn: c=Sweden,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: country
|
||||
c: Sweden
|
||||
description: The country of Sweden
|
||||
|
||||
dn: c=Norway,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: country
|
||||
c: Norway
|
||||
description: The country of Norway
|
||||
|
||||
dn: ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: organizationalUnit
|
||||
ou: company1
|
||||
description: First company in Sweden
|
||||
|
||||
dn: ou=company2,c=Sweden,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: organizationalUnit
|
||||
ou: company2
|
||||
description: Second company in Sweden
|
||||
|
||||
dn: ou=company1,c=Norway,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: organizationalUnit
|
||||
ou: company1
|
||||
description: First company in Norway
|
||||
|
||||
dn: cn=Some Person,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: person
|
||||
objectclass: organizationalPerson
|
||||
objectclass: inetOrgPerson
|
||||
uid: some.person
|
||||
userPassword: password
|
||||
cn: Some Person
|
||||
sn: Person
|
||||
description: Sweden, Company1, Some Person
|
||||
telephoneNumber: +46 555-123456
|
||||
|
||||
dn: cn=Some Person2,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: person
|
||||
objectclass: organizationalPerson
|
||||
objectclass: inetOrgPerson
|
||||
uid: some.person2
|
||||
userPassword: password
|
||||
cn: Some Person2
|
||||
sn: Person2
|
||||
description: Sweden, Company1, Some Person2
|
||||
telephoneNumber: +46 555-654321
|
||||
|
||||
dn: cn=Some Person3,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: person
|
||||
objectclass: organizationalPerson
|
||||
objectclass: inetOrgPerson
|
||||
uid: some.person3
|
||||
userPassword: password
|
||||
cn: Some Person3
|
||||
sn: Person3
|
||||
description: Sweden, Company1, Some Person3
|
||||
telephoneNumber: +46 555-123654
|
||||
|
||||
dn: cn=Some Person,ou=company2,c=Sweden,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: person
|
||||
objectclass: organizationalPerson
|
||||
objectclass: inetOrgPerson
|
||||
uid: some.person4
|
||||
userPassword: password
|
||||
cn: Some Person
|
||||
sn: Person
|
||||
description: Sweden, Company2, Some Person
|
||||
telephoneNumber: +46 555-456321
|
||||
|
||||
dn: cn=Some Person+sn=Person,ou=company1,c=Norway,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: person
|
||||
objectclass: organizationalPerson
|
||||
objectclass: inetOrgPerson
|
||||
uid: some.norwegian
|
||||
userPassword: password
|
||||
cn: Some Person
|
||||
sn: Person
|
||||
description: Norway, Company1, Some Person+Person
|
||||
telephoneNumber: +45 555-654123
|
||||
@@ -1,37 +0,0 @@
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url "https://download.java.net/maven/2/" }
|
||||
}
|
||||
apply from: JAVA_SCRIPT
|
||||
|
||||
ext.spring25Version = '2.5.6.SEC03'
|
||||
|
||||
dependencies {
|
||||
testCompile (project(":spring-ldap-test")) {
|
||||
exclude group: "org.springframework", module:"spring-core"
|
||||
exclude group: "org.springframework", module:"spring-beans"
|
||||
exclude group: "org.springframework", module:"spring-context"
|
||||
exclude group: "org.springframework", module:"spring-test"
|
||||
exclude group: "org.springframework", module:"spring-tx"
|
||||
}
|
||||
|
||||
testCompile ("org.springframework:spring-test:$spring25Version") {
|
||||
exclude group: "junit", module:"junit"
|
||||
}
|
||||
|
||||
testCompile ("org.springframework.data:spring-data-commons:$springDataVersion") {
|
||||
exclude group: "org.springframework", module:"spring-core"
|
||||
exclude group: "org.springframework", module:"spring-beans"
|
||||
}
|
||||
|
||||
testCompile "org.springframework:spring-test:$spring25Version",
|
||||
"org.springframework:spring-context:$spring25Version",
|
||||
"org.springframework:spring-core:$spring25Version",
|
||||
"org.springframework:spring-tx:$spring25Version",
|
||||
"org.springframework:spring-beans:$spring25Version",
|
||||
"junit:junit:$junitVersion",
|
||||
"org.slf4j:slf4j-log4j12:$slf4jVersion",
|
||||
"org.assertj:assertj-core:$assertjVersion",
|
||||
apachedsDependencies
|
||||
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright 2005-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ldap.itest25;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.ldap.core.DirContextOperations;
|
||||
import org.springframework.ldap.core.LdapTemplate;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests the lookup methods of LdapTemplate together with Spring 2.5.
|
||||
*
|
||||
* @author Mattias Hellborg Arthursson
|
||||
*/
|
||||
public class LdapTemplateLookup25ITest {
|
||||
/**
|
||||
* This method depends on a DirObjectFactory (
|
||||
* {@link org.springframework.ldap.core.support.DefaultDirObjectFactory})
|
||||
* being set in the ContextSource.
|
||||
*/
|
||||
@Test
|
||||
public void testThatPlainLookupWorksWithSpring25() {
|
||||
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("/conf/ldapTemplateTestContext.xml");
|
||||
LdapTemplate tested = (LdapTemplate) ctx.getBean("ldapTemplate");
|
||||
|
||||
performTestAndShutdownContext(ctx, tested);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testThatNamespaceConfigurationWorksWithSpring25() {
|
||||
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("/conf/ldapTemplateNamespaceTestContext.xml");
|
||||
LdapTemplate tested = (LdapTemplate) ctx.getBean("ldapTemplate");
|
||||
|
||||
performTestAndShutdownContext(ctx, tested);
|
||||
}
|
||||
|
||||
private void performTestAndShutdownContext(ClassPathXmlApplicationContext ctx, LdapTemplate tested) {
|
||||
try {
|
||||
DirContextOperations result = tested.lookupContext("cn=Some Person2, ou=company1,c=Sweden");
|
||||
|
||||
assertThat(result.getStringAttribute("cn")).isEqualTo("Some Person2");
|
||||
assertThat(result.getStringAttribute("sn")).isEqualTo("Person2");
|
||||
assertThat(result.getStringAttribute("description")).isEqualTo("Sweden, Company1, Some Person2");
|
||||
} finally {
|
||||
ctx.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<!--
|
||||
This context configuration file defines common beans,
|
||||
minimizing duplication in the various test context files.
|
||||
-->
|
||||
|
||||
<bean id="placeholderConfig"
|
||||
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
||||
<property name="location" value="classpath:/conf/ldap.properties" />
|
||||
</bean>
|
||||
</beans>
|
||||
@@ -1,4 +0,0 @@
|
||||
urls=ldap://127.0.0.1:1888
|
||||
userDn=uid=admin,ou=system
|
||||
password=secret
|
||||
base=dc=jayway,dc=se
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ldap="http://www.springframework.org/schema/ldap"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/ldap https://www.springframework.org/schema/ldap/spring-ldap.xsd">
|
||||
<import resource="classpath:/conf/commonTestContext.xml" />
|
||||
|
||||
<ldap:context-source
|
||||
password="${password}"
|
||||
url="ldap://localhost:1888"
|
||||
username="${userDn}"
|
||||
base="dc=jayway,dc=se" />
|
||||
|
||||
<ldap:ldap-template />
|
||||
|
||||
<bean id="dummy" class="org.springframework.ldap.test.TestContextSourceFactoryBean">
|
||||
<property name="defaultPartitionSuffix" value="dc=jayway,dc=se" />
|
||||
<property name="defaultPartitionName" value="jayway" />
|
||||
<property name="ldifFile" value="classpath:/setup_data.ldif" />
|
||||
<property name="port" value="1888" />
|
||||
<property name="contextSource" ref="contextSource" />
|
||||
</bean>
|
||||
</beans>
|
||||
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
<import resource="classpath:/conf/commonTestContext.xml" />
|
||||
|
||||
<bean id="contextSource"
|
||||
class="org.springframework.ldap.test.TestContextSourceFactoryBean">
|
||||
<property name="defaultPartitionSuffix" value="dc=jayway,dc=se" />
|
||||
<property name="defaultPartitionName" value="jayway" />
|
||||
<property name="principal" value="${userDn}" />
|
||||
<property name="password" value="${password}" />
|
||||
<property name="ldifFile" value="classpath:/setup_data.ldif" />
|
||||
<property name="port" value="1888" />
|
||||
</bean>
|
||||
|
||||
<bean id="ldapTemplate"
|
||||
class="org.springframework.ldap.core.LdapTemplate">
|
||||
<constructor-arg ref="contextSource" />
|
||||
</bean>
|
||||
</beans>
|
||||
@@ -1,12 +0,0 @@
|
||||
log4j.rootCategory=WARN, stdout
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.layout.ConversionPattern=%r [%t] %-5p\: %-15c{2} - %m%n
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
|
||||
# Enable info on Spring LDAP
|
||||
#log4j.logger.org.springframework.ldap=INFO
|
||||
|
||||
log4j.logger.org.apache.directory.server.schema.registries.DefaultSyntaxRegistry=WARN
|
||||
log4j.logger.org.apache.directory.server.core.schema.bootstrap=ERROR
|
||||
log4j.logger.org.apache.directory.server.core.partition.impl.btree=ERROR
|
||||
log4j.logger.org.apache.directory.shared.ldap.ldif=ERROR
|
||||
@@ -1,110 +0,0 @@
|
||||
dn: ou=groups,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: organizationalUnit
|
||||
ou: groups
|
||||
|
||||
dn: cn=ROLE_USER,ou=groups,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: groupOfUniqueNames
|
||||
cn: ROLE_USER
|
||||
uniqueMember: cn=Some Person,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
uniqueMember: cn=Some Person2,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
uniqueMember: cn=Some Person,ou=company1,c=Norway,dc=jayway,dc=se
|
||||
uniqueMember: cn=Some Person,ou=company2,c=Sweden,dc=jayway,dc=se
|
||||
uniqueMember: cn=Some Person3,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
|
||||
dn: cn=ROLE_ADMIN,ou=groups,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: groupOfUniqueNames
|
||||
cn: ROLE_ADMIN
|
||||
uniqueMember: cn=Some Person2,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
|
||||
dn: c=Sweden,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: country
|
||||
c: Sweden
|
||||
description: The country of Sweden
|
||||
|
||||
dn: c=Norway,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: country
|
||||
c: Norway
|
||||
description: The country of Norway
|
||||
|
||||
dn: ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: organizationalUnit
|
||||
ou: company1
|
||||
description: First company in Sweden
|
||||
|
||||
dn: ou=company2,c=Sweden,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: organizationalUnit
|
||||
ou: company2
|
||||
description: Second company in Sweden
|
||||
|
||||
dn: ou=company1,c=Norway,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: organizationalUnit
|
||||
ou: company1
|
||||
description: First company in Norway
|
||||
|
||||
dn: cn=Some Person,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: person
|
||||
objectclass: organizationalPerson
|
||||
objectclass: inetOrgPerson
|
||||
uid: some.person
|
||||
userPassword: password
|
||||
cn: Some Person
|
||||
sn: Person
|
||||
description: Sweden, Company1, Some Person
|
||||
telephoneNumber: +46 555-123456
|
||||
|
||||
dn: cn=Some Person2,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: person
|
||||
objectclass: organizationalPerson
|
||||
objectclass: inetOrgPerson
|
||||
uid: some.person2
|
||||
userPassword: password
|
||||
cn: Some Person2
|
||||
sn: Person2
|
||||
description: Sweden, Company1, Some Person2
|
||||
telephoneNumber: +46 555-654321
|
||||
|
||||
dn: cn=Some Person3,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: person
|
||||
objectclass: organizationalPerson
|
||||
objectclass: inetOrgPerson
|
||||
uid: some.person3
|
||||
userPassword: password
|
||||
cn: Some Person3
|
||||
sn: Person3
|
||||
description: Sweden, Company1, Some Person3
|
||||
telephoneNumber: +46 555-123654
|
||||
|
||||
dn: cn=Some Person,ou=company2,c=Sweden,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: person
|
||||
objectclass: organizationalPerson
|
||||
objectclass: inetOrgPerson
|
||||
uid: some.person4
|
||||
userPassword: password
|
||||
cn: Some Person
|
||||
sn: Person
|
||||
description: Sweden, Company2, Some Person
|
||||
telephoneNumber: +46 555-456321
|
||||
|
||||
dn: cn=Some Person+sn=Person,ou=company1,c=Norway,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: person
|
||||
objectclass: organizationalPerson
|
||||
objectclass: inetOrgPerson
|
||||
uid: some.norwegian
|
||||
userPassword: password
|
||||
cn: Some Person
|
||||
sn: Person
|
||||
description: Norway, Company1, Some Person+Person
|
||||
telephoneNumber: +45 555-654123
|
||||
@@ -1,35 +0,0 @@
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url "https://download.java.net/maven/2/" }
|
||||
}
|
||||
apply from: JAVA_SCRIPT
|
||||
|
||||
ext.spring30Version = '3.0.7.RELEASE'
|
||||
|
||||
dependencies {
|
||||
testCompile (project(":spring-ldap-test")) {
|
||||
exclude group: "org.springframework", module:"spring-core"
|
||||
exclude group: "org.springframework", module:"spring-beans"
|
||||
exclude group: "org.springframework", module:"spring-context"
|
||||
exclude group: "org.springframework", module:"spring-test"
|
||||
exclude group: "org.springframework", module:"spring-tx"
|
||||
}
|
||||
|
||||
testCompile ("org.springframework:spring-test:$spring30Version") {
|
||||
exclude group: "junit", module:"junit"
|
||||
}
|
||||
|
||||
testCompile "org.springframework:spring-test:$spring30Version",
|
||||
"org.springframework:spring-context:$spring30Version",
|
||||
"org.springframework:spring-core:$spring30Version",
|
||||
"org.springframework:spring-tx:$spring30Version",
|
||||
"org.springframework:spring-beans:$spring30Version",
|
||||
"junit:junit:$junitVersion",
|
||||
"org.slf4j:slf4j-log4j12:$slf4jVersion",
|
||||
"org.assertj:assertj-core:$assertjVersion",
|
||||
apachedsDependencies
|
||||
|
||||
testCompile("org.springframework.data:spring-data-commons:$springDataVersion") {
|
||||
exclude group: "org.springframework"
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright 2005-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ldap.itest30;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.ldap.core.DirContextOperations;
|
||||
import org.springframework.ldap.core.LdapTemplate;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests the lookup methods of LdapTemplate together with Spring 3.0.
|
||||
*
|
||||
* @author Mattias Hellborg Arthursson
|
||||
*/
|
||||
@ContextConfiguration(locations = {"/conf/ldapTemplateTestContext.xml"})
|
||||
@DirtiesContext
|
||||
public class LdapTemplateLookup30ITest extends AbstractJUnit4SpringContextTests {
|
||||
|
||||
@Autowired
|
||||
private LdapTemplate tested;
|
||||
|
||||
/**
|
||||
* This method depends on a DirObjectFactory (
|
||||
* {@link org.springframework.ldap.core.support.DefaultDirObjectFactory})
|
||||
* being set in the ContextSource.
|
||||
*/
|
||||
@Test
|
||||
public void testThatPlainLookupWorksWithSpring30() {
|
||||
DirContextOperations result = tested.lookupContext("cn=Some Person2, ou=company1,c=Sweden");
|
||||
|
||||
assertThat(result.getStringAttribute("cn")).isEqualTo("Some Person2");
|
||||
assertThat(result.getStringAttribute("sn")).isEqualTo("Person2");
|
||||
assertThat(result.getStringAttribute("description")).isEqualTo("Sweden, Company1, Some Person2");
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright 2005-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ldap.itest30;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.ldap.core.DirContextOperations;
|
||||
import org.springframework.ldap.core.LdapTemplate;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests the lookup methods of LdapTemplate together with Spring 3.0.
|
||||
*
|
||||
* @author Mattias Hellborg Arthursson
|
||||
*/
|
||||
@ContextConfiguration(locations = {"/conf/ldapTemplateNamespaceTestContext.xml"})
|
||||
@DirtiesContext
|
||||
public class LdapTemplateNamespaceLookup30ITest extends AbstractJUnit4SpringContextTests {
|
||||
|
||||
@Autowired
|
||||
private LdapTemplate tested;
|
||||
|
||||
/**
|
||||
* This method depends on a DirObjectFactory (
|
||||
* {@link org.springframework.ldap.core.support.DefaultDirObjectFactory})
|
||||
* being set in the ContextSource.
|
||||
*/
|
||||
@Test
|
||||
public void testThatPlainLookupWorksWithSpring30() {
|
||||
DirContextOperations result = tested.lookupContext("cn=Some Person2, ou=company1,c=Sweden");
|
||||
|
||||
assertThat(result.getStringAttribute("cn")).isEqualTo("Some Person2");
|
||||
assertThat(result.getStringAttribute("sn")).isEqualTo("Person2");
|
||||
assertThat(result.getStringAttribute("description")).isEqualTo("Sweden, Company1, Some Person2");
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<!--
|
||||
This context configuration file defines common beans,
|
||||
minimizing duplication in the various test context files.
|
||||
-->
|
||||
|
||||
<bean id="placeholderConfig"
|
||||
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
||||
<property name="location" value="classpath:/conf/ldap.properties" />
|
||||
</bean>
|
||||
</beans>
|
||||
@@ -1,4 +0,0 @@
|
||||
urls=ldap://127.0.0.1:1888
|
||||
userDn=uid=admin,ou=system
|
||||
password=secret
|
||||
base=dc=jayway,dc=se
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ldap="http://www.springframework.org/schema/ldap"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/ldap https://www.springframework.org/schema/ldap/spring-ldap.xsd">
|
||||
<import resource="classpath:/conf/commonTestContext.xml" />
|
||||
|
||||
<ldap:context-source
|
||||
password="${password}"
|
||||
url="ldap://localhost:1888"
|
||||
username="${userDn}"
|
||||
base="dc=jayway,dc=se" />
|
||||
|
||||
<ldap:ldap-template />
|
||||
|
||||
<bean id="dummy" class="org.springframework.ldap.test.TestContextSourceFactoryBean">
|
||||
<property name="defaultPartitionSuffix" value="dc=jayway,dc=se" />
|
||||
<property name="defaultPartitionName" value="jayway" />
|
||||
<property name="ldifFile" value="classpath:/setup_data.ldif" />
|
||||
<property name="port" value="1888" />
|
||||
<property name="contextSource" ref="contextSource" />
|
||||
</bean>
|
||||
</beans>
|
||||
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
<import resource="classpath:/conf/commonTestContext.xml" />
|
||||
|
||||
<bean id="contextSource"
|
||||
class="org.springframework.ldap.test.TestContextSourceFactoryBean">
|
||||
<property name="defaultPartitionSuffix" value="dc=jayway,dc=se" />
|
||||
<property name="defaultPartitionName" value="jayway" />
|
||||
<property name="principal" value="${userDn}" />
|
||||
<property name="password" value="${password}" />
|
||||
<property name="ldifFile" value="classpath:/setup_data.ldif" />
|
||||
<property name="port" value="1888" />
|
||||
</bean>
|
||||
|
||||
<bean id="ldapTemplate"
|
||||
class="org.springframework.ldap.core.LdapTemplate">
|
||||
<constructor-arg ref="contextSource" />
|
||||
</bean>
|
||||
</beans>
|
||||
@@ -1,12 +0,0 @@
|
||||
log4j.rootCategory=WARN, stdout
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.layout.ConversionPattern=%r [%t] %-5p\: %-15c{2} - %m%n
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
|
||||
# Enable info on Spring LDAP
|
||||
#log4j.logger.org.springframework.ldap=INFO
|
||||
|
||||
log4j.logger.org.apache.directory.server.schema.registries.DefaultSyntaxRegistry=WARN
|
||||
log4j.logger.org.apache.directory.server.core.schema.bootstrap=ERROR
|
||||
log4j.logger.org.apache.directory.server.core.partition.impl.btree=ERROR
|
||||
log4j.logger.org.apache.directory.shared.ldap.ldif=ERROR
|
||||
@@ -1,110 +0,0 @@
|
||||
dn: ou=groups,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: organizationalUnit
|
||||
ou: groups
|
||||
|
||||
dn: cn=ROLE_USER,ou=groups,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: groupOfUniqueNames
|
||||
cn: ROLE_USER
|
||||
uniqueMember: cn=Some Person,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
uniqueMember: cn=Some Person2,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
uniqueMember: cn=Some Person,ou=company1,c=Norway,dc=jayway,dc=se
|
||||
uniqueMember: cn=Some Person,ou=company2,c=Sweden,dc=jayway,dc=se
|
||||
uniqueMember: cn=Some Person3,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
|
||||
dn: cn=ROLE_ADMIN,ou=groups,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: groupOfUniqueNames
|
||||
cn: ROLE_ADMIN
|
||||
uniqueMember: cn=Some Person2,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
|
||||
dn: c=Sweden,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: country
|
||||
c: Sweden
|
||||
description: The country of Sweden
|
||||
|
||||
dn: c=Norway,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: country
|
||||
c: Norway
|
||||
description: The country of Norway
|
||||
|
||||
dn: ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: organizationalUnit
|
||||
ou: company1
|
||||
description: First company in Sweden
|
||||
|
||||
dn: ou=company2,c=Sweden,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: organizationalUnit
|
||||
ou: company2
|
||||
description: Second company in Sweden
|
||||
|
||||
dn: ou=company1,c=Norway,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: organizationalUnit
|
||||
ou: company1
|
||||
description: First company in Norway
|
||||
|
||||
dn: cn=Some Person,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: person
|
||||
objectclass: organizationalPerson
|
||||
objectclass: inetOrgPerson
|
||||
uid: some.person
|
||||
userPassword: password
|
||||
cn: Some Person
|
||||
sn: Person
|
||||
description: Sweden, Company1, Some Person
|
||||
telephoneNumber: +46 555-123456
|
||||
|
||||
dn: cn=Some Person2,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: person
|
||||
objectclass: organizationalPerson
|
||||
objectclass: inetOrgPerson
|
||||
uid: some.person2
|
||||
userPassword: password
|
||||
cn: Some Person2
|
||||
sn: Person2
|
||||
description: Sweden, Company1, Some Person2
|
||||
telephoneNumber: +46 555-654321
|
||||
|
||||
dn: cn=Some Person3,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: person
|
||||
objectclass: organizationalPerson
|
||||
objectclass: inetOrgPerson
|
||||
uid: some.person3
|
||||
userPassword: password
|
||||
cn: Some Person3
|
||||
sn: Person3
|
||||
description: Sweden, Company1, Some Person3
|
||||
telephoneNumber: +46 555-123654
|
||||
|
||||
dn: cn=Some Person,ou=company2,c=Sweden,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: person
|
||||
objectclass: organizationalPerson
|
||||
objectclass: inetOrgPerson
|
||||
uid: some.person4
|
||||
userPassword: password
|
||||
cn: Some Person
|
||||
sn: Person
|
||||
description: Sweden, Company2, Some Person
|
||||
telephoneNumber: +46 555-456321
|
||||
|
||||
dn: cn=Some Person+sn=Person,ou=company1,c=Norway,dc=jayway,dc=se
|
||||
objectclass: top
|
||||
objectclass: person
|
||||
objectclass: organizationalPerson
|
||||
objectclass: inetOrgPerson
|
||||
uid: some.norwegian
|
||||
userPassword: password
|
||||
cn: Some Person
|
||||
sn: Person
|
||||
description: Norway, Company1, Some Person+Person
|
||||
telephoneNumber: +45 555-654123
|
||||
Reference in New Issue
Block a user