From b9ec33efd6bbe693f51dd5fec12c5d5151415536 Mon Sep 17 00:00:00 2001 From: Mattias Arthursson Date: Mon, 9 Jun 2008 06:48:20 +0000 Subject: [PATCH] Removed old version of integration tests. --- .../core-integration-tests/pom.xml | 83 ---- .../java/org/springframework/ldap/Person.java | 64 --- .../ldap/PersonAttributesMapper.java | 47 --- .../ldap/PersonContextMapper.java | 39 -- .../compensating/manager/DummyDao.java | 44 --- .../compensating/manager/DummyException.java | 22 -- .../manager/DummyServiceImpl.java | 24 -- .../manager/LdapAndJdbcDummyDaoImpl.java | 178 --------- .../manager/LdapDummyDaoImpl.java | 163 -------- .../src/test/java/log4j.properties | 9 - .../AbstractLdapTemplateIntegrationTest.java | 27 -- .../LdapTemplateAttributesMapperITest.java | 83 ---- .../ldap/LdapTemplateBindUnbindITest.java | 119 ------ .../ldap/LdapTemplateContextExecutorTest.java | 61 --- .../ldap/LdapTemplateContextMapperITest.java | 79 ---- .../ldap/LdapTemplateListITest.java | 148 ------- .../ldap/LdapTemplateLookupITest.java | 245 ------------ .../ldap/LdapTemplateModifyITest.java | 253 ------------ .../ldap/LdapTemplateNoBaseSuffixITest.java | 98 ----- ...LdapTemplateObjectBindIntegrationTest.java | 145 ------- .../LdapTemplateRecursiveDeleteITest.java | 127 ------ .../ldap/LdapTemplateRenameITest.java | 100 ----- .../ldap/LdapTemplateSearchCountITest.xls | Bin 11776 -> 0 bytes .../ldap/LdapTemplateSearchResultITest.java | 181 --------- .../ldap/control/SupportedControlsITest.java | 70 ---- .../core/DistinguishedNameEditorITest.java | 43 -- .../ldap/core/DnParsePerformanceITest.java | 67 ---- .../core/DummyDistinguishedNameConsumer.java | 34 -- .../BaseLdapPathBeanPostprocessorITest.java | 97 ----- .../core/support/DummyBaseLdapPathAware.java | 37 -- .../core/support/LdapContextSourcelITest.java | 89 ----- .../LdapContextSourcelMultiServerITest.java | 46 --- ...urceTransactionManagerIntegrationTest.java | 371 ------------------ ...urceTransactionManagerIntegrationTest.java | 281 ------------- .../src/test/java/setup_data.ldif | 110 ------ .../src/test/java/teardown_data.ldif | 5 - .../test/resources/conf/apacheDsContext.xml | 89 ----- ...orMultiContextSourceOneSpecTestContext.xml | 40 -- ...ProcessorMultiContextSourceTestContext.xml | 38 -- ...ostProcessorNoContextSourceTestContext.xml | 13 - ...stProcessorPropertyOverrideTestContext.xml | 30 -- .../baseLdapPathPostProcessorTestContext.xml | 28 -- ...athPostProcessorTransactionTestContext.xml | 33 -- .../test/resources/conf/commonTestContext.xml | 16 - .../distinguishedNameEditorTestContext.xml | 11 - .../src/test/resources/conf/ldap.properties | 4 - .../ldapAndJdbcTransactionTestContext.xml | 66 ---- .../conf/ldapContextSourceTestContext.xml | 11 - .../conf/ldapTemplateAcegiTestContext.xml | 66 ---- .../ldapTemplateNoBaseSuffixTestContext.xml | 27 -- .../ldapTemplateObjectBindTestContext.xml | 24 -- .../conf/ldapTemplateTestContext.xml | 26 -- .../ldapTemplateTransactionTestContext.xml | 52 --- .../conf/rootContextSourceTestContext.xml | 25 -- .../src/test/resources/log4j.properties | 6 - .../src/test/resources/setup_data.ldif | 110 ------ 56 files changed, 4304 deletions(-) delete mode 100644 mvn-build/integration-tests/core-integration-tests/pom.xml delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/Person.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/PersonAttributesMapper.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/PersonContextMapper.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/transaction/compensating/manager/DummyDao.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/transaction/compensating/manager/DummyException.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/transaction/compensating/manager/DummyServiceImpl.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/transaction/compensating/manager/LdapAndJdbcDummyDaoImpl.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/transaction/compensating/manager/LdapDummyDaoImpl.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/log4j.properties delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/AbstractLdapTemplateIntegrationTest.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateAttributesMapperITest.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateBindUnbindITest.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateContextExecutorTest.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateContextMapperITest.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateListITest.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateLookupITest.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateModifyITest.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateNoBaseSuffixITest.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateObjectBindIntegrationTest.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateRecursiveDeleteITest.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateRenameITest.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateSearchCountITest.xls delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateSearchResultITest.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/control/SupportedControlsITest.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/DistinguishedNameEditorITest.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/DnParsePerformanceITest.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/DummyDistinguishedNameConsumer.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/support/BaseLdapPathBeanPostprocessorITest.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/support/DummyBaseLdapPathAware.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/support/LdapContextSourcelITest.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/support/LdapContextSourcelMultiServerITest.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceAndDataSourceTransactionManagerIntegrationTest.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceTransactionManagerIntegrationTest.java delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/setup_data.ldif delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/java/teardown_data.ldif delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/apacheDsContext.xml delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/baseLdapPathPostProcessorMultiContextSourceOneSpecTestContext.xml delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/baseLdapPathPostProcessorMultiContextSourceTestContext.xml delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/baseLdapPathPostProcessorNoContextSourceTestContext.xml delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/baseLdapPathPostProcessorPropertyOverrideTestContext.xml delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/baseLdapPathPostProcessorTestContext.xml delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/baseLdapPathPostProcessorTransactionTestContext.xml delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/commonTestContext.xml delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/distinguishedNameEditorTestContext.xml delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldap.properties delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapAndJdbcTransactionTestContext.xml delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapContextSourceTestContext.xml delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapTemplateAcegiTestContext.xml delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapTemplateNoBaseSuffixTestContext.xml delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapTemplateObjectBindTestContext.xml delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapTemplateTestContext.xml delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapTemplateTransactionTestContext.xml delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/rootContextSourceTestContext.xml delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/resources/log4j.properties delete mode 100644 mvn-build/integration-tests/core-integration-tests/src/test/resources/setup_data.ldif diff --git a/mvn-build/integration-tests/core-integration-tests/pom.xml b/mvn-build/integration-tests/core-integration-tests/pom.xml deleted file mode 100644 index 1cbdba87..00000000 --- a/mvn-build/integration-tests/core-integration-tests/pom.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - 4.0.0 - org.springframework.ldap - spring-ldap-core-integration-tests - Spring LDAP Core Integration Tests - 1.2.2-SNAPSHOT - - - org.springframework.ldap - master - 1.2.2-SNAPSHOT - - - - - - maven-compiler-plugin - - 1.5 - 1.5 - - - - - - - org.springframework.ldap - spring-ldap-test - 1.2.2-SNAPSHOT - - - commons-pool - commons-pool - 1.3 - provided - - - com.sun - ldapbp - 1.0 - system - ${basedir}/../../lib/ldapbp.jar - - - - org.springframework - spring-jdbc - ${spring.version} - provided - - - org.springframework - spring-aop - ${spring.version} - test - - - aspectj - aspectjrt - 1.5.3 - test - - - aspectj - aspectjweaver - 1.5.3 - test - - - gsbase - gsbase - 2.0.1 - test - - - hsqldb - hsqldb - 1.8.0.7 - test - - - diff --git a/mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/Person.java b/mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/Person.java deleted file mode 100644 index 50cae554..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/Person.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2005-2007 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 - * - * http://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; - -/** - * Dummy bean to be used in the LdapTemplate integration tests. - * - * @author Mattias Arthursson - */ -public class Person { - private String fullname; - - private String lastname; - - private String description; - - private String phone; - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getFullname() { - return fullname; - } - - public void setFullname(String fullname) { - this.fullname = fullname; - } - - public String getLastname() { - return lastname; - } - - public void setLastname(String lastname) { - this.lastname = lastname; - } - - public String getPhone() { - return phone; - } - - public void setPhone(String phone) { - this.phone = phone; - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/PersonAttributesMapper.java b/mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/PersonAttributesMapper.java deleted file mode 100644 index 6b0f0a4d..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/PersonAttributesMapper.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2005-2007 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 - * - * http://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; - -import javax.naming.NamingException; -import javax.naming.directory.Attributes; - -import org.springframework.ldap.core.AttributesMapper; - - -/** - * Dummy implementation of AttributesMapper for use in integration tests. - * - * @author Mattias Arthursson - * - */ -public class PersonAttributesMapper implements AttributesMapper { - - /** - * Maps the given attributes into a {@link Person} object. - * - * @see org.springframework.ldap.core.AttributesMapper#mapFromAttributes(javax.naming.directory.Attributes) - */ - public Object mapFromAttributes(Attributes attributes) - throws NamingException { - Person person = new Person(); - person.setFullname((String) attributes.get("cn").get()); - person.setLastname((String) attributes.get("sn").get()); - person.setPhone((String) attributes.get("telephoneNumber").get()); - person.setDescription((String) attributes.get("description").get()); - return person; - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/PersonContextMapper.java b/mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/PersonContextMapper.java deleted file mode 100644 index da560d01..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/PersonContextMapper.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2005-2007 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 - * - * http://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; - -import org.springframework.ldap.core.DirContextOperations; -import org.springframework.ldap.core.support.AbstractContextMapper; - -/** - * Dummy implemention of ContextMapper for use in the integration tests and for - * illustration purposes. - * - * @author Mattias Arthursson - */ -public class PersonContextMapper extends AbstractContextMapper { - - protected Object doMapFromContext(DirContextOperations ctx) { - Person person = new Person(); - person.setFullname(ctx.getStringAttribute("cn")); - person.setLastname(ctx.getStringAttribute("sn")); - person.setPhone(ctx.getStringAttribute("telephoneNumber")); - person.setDescription(ctx.getStringAttribute("description")); - - return person; - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/transaction/compensating/manager/DummyDao.java b/mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/transaction/compensating/manager/DummyDao.java deleted file mode 100644 index 7d6f0e78..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/transaction/compensating/manager/DummyDao.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2002-2007 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 - * - * http://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.transaction.compensating.manager; - -public interface DummyDao { - void createWithException(String country, String company, String fullname, - String lastname, String description); - - void create(String country, String company, String fullname, - String lastname, String description); - - void update(String dn, String fullname, String lastname, String description); - - void updateWithException(String dn, String fullname, String lastname, - String description); - - void updateAndRename(String dn, String newDn, String description); - - void updateAndRenameWithException(String dn, String newDn, - String description); - - void modifyAttributes(String dn, String lastName, String description); - - void modifyAttributesWithException(String dn, String lastName, - String description); - - void unbind(String dn, String fullname); - - void unbindWithException(String dn, String fullname); - -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/transaction/compensating/manager/DummyException.java b/mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/transaction/compensating/manager/DummyException.java deleted file mode 100644 index dacb7839..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/transaction/compensating/manager/DummyException.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2002-2007 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 - * - * http://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.transaction.compensating.manager; - -public class DummyException extends RuntimeException { - public DummyException(String message) { - super(message); - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/transaction/compensating/manager/DummyServiceImpl.java b/mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/transaction/compensating/manager/DummyServiceImpl.java deleted file mode 100644 index f023fea5..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/transaction/compensating/manager/DummyServiceImpl.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2002-2007 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 - * - * http://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.transaction.compensating.manager; - -public class DummyServiceImpl { - private DummyDao dummyDaoImpl; - - public void setDummyDaoImpl(DummyDao dummyDaoImpl) { - this.dummyDaoImpl = dummyDaoImpl; - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/transaction/compensating/manager/LdapAndJdbcDummyDaoImpl.java b/mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/transaction/compensating/manager/LdapAndJdbcDummyDaoImpl.java deleted file mode 100644 index ec0b43e6..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/transaction/compensating/manager/LdapAndJdbcDummyDaoImpl.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright 2002-2007 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 - * - * http://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.transaction.compensating.manager; - -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.ldap.core.DirContextAdapter; -import org.springframework.ldap.core.DistinguishedName; -import org.springframework.ldap.core.LdapTemplate; - -public class LdapAndJdbcDummyDaoImpl implements DummyDao { - private LdapTemplate ldapTemplate; - - private JdbcTemplate jdbcTemplate; - - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } - - public void setLdapTemplate(LdapTemplate ldapTemplate) { - this.ldapTemplate = ldapTemplate; - } - - /* - * (non-Javadoc) - * - * @see org.springframework.ldap.transaction.support.DummyDao#createWithException(java.lang.String, - * java.lang.String, java.lang.String, java.lang.String, - * java.lang.String) - */ - public void createWithException(String country, String company, - String fullname, String lastname, String description) { - create(country, company, fullname, lastname, description); - throw new DummyException("This method failed"); - } - - /* - * (non-Javadoc) - * - * @see org.springframework.ldap.transaction.support.DummyDao#create(java.lang.String, - * java.lang.String, java.lang.String, java.lang.String, - * java.lang.String) - */ - public void create(String country, String company, String fullname, - String lastname, String description) { - DistinguishedName dn = new DistinguishedName(); - dn.add("c", country); - dn.add("ou", company); - dn.add("cn", fullname); - - DirContextAdapter ctx = new DirContextAdapter(); - ctx.setAttributeValues("objectclass", new String[] { "top", "person" }); - ctx.setAttributeValue("cn", fullname); - ctx.setAttributeValue("sn", lastname); - ctx.setAttributeValue("description", description); - ldapTemplate.bind(dn, ctx, null); - jdbcTemplate.update("insert into PERSON values(?, ?, ?)", new Object[] { - fullname, lastname, description }); - } - - /* - * (non-Javadoc) - * - * @see org.springframework.ldap.transaction.support.DummyDao#update(java.lang.String, - * java.lang.String, java.lang.String) - */ - public void update(String dn, String fullname, String lastname, - String description) { - DirContextAdapter ctx = (DirContextAdapter) ldapTemplate.lookup(dn); - ctx.setAttributeValue("sn", lastname); - ctx.setAttributeValue("description", description); - ctx.update(); - - ldapTemplate.rebind(dn, ctx, null); - jdbcTemplate - .update( - "update PERSON set lastname=?, description = ? where fullname = ?", - new Object[] { lastname, description, fullname }); - } - - /* - * (non-Javadoc) - * - * @see org.springframework.ldap.transaction.support.DummyDao#updateWithException(java.lang.String, - * java.lang.String, java.lang.String) - */ - public void updateWithException(String dn, String fullname, - String lastname, String description) { - update(dn, fullname, lastname, description); - throw new DummyException("This method failed."); - } - - /* - * (non-Javadoc) - * - * @see org.springframework.ldap.transaction.support.DummyDao#updateAndRename(java.lang.String, - * java.lang.String, java.lang.String) - */ - public void updateAndRename(String dn, String newDn, String description) { - DirContextAdapter ctx = (DirContextAdapter) ldapTemplate.lookup(dn); - ctx.setAttributeValue("description", description); - ctx.update(); - - ldapTemplate.rebind(dn, ctx, null); - ldapTemplate.rename(dn, newDn); - } - - /* - * (non-Javadoc) - * - * @see org.springframework.ldap.transaction.support.DummyDao#updateAndRenameWithException(java.lang.String, - * java.lang.String, java.lang.String) - */ - public void updateAndRenameWithException(String dn, String newDn, - String description) { - updateAndRename(dn, newDn, description); - throw new DummyException("This method failed."); - } - - /* - * (non-Javadoc) - * - * @see org.springframework.ldap.transaction.support.DummyDao#modifyAttributes(java.lang.String, - * java.lang.String, java.lang.String) - */ - public void modifyAttributes(String dn, String lastName, String description) { - DirContextAdapter ctx = (DirContextAdapter) ldapTemplate.lookup(dn); - ctx.setAttributeValue("sn", lastName); - ctx.setAttributeValue("description", description); - - ldapTemplate.modifyAttributes(dn, ctx.getModificationItems()); - } - - /* - * (non-Javadoc) - * - * @see org.springframework.ldap.transaction.support.DummyDao#modifyAttributesWithException(java.lang.String, - * java.lang.String, java.lang.String) - */ - public void modifyAttributesWithException(String dn, String lastName, - String description) { - modifyAttributes(dn, lastName, description); - throw new DummyException("This method failed."); - } - - /* - * (non-Javadoc) - * - * @see org.springframework.ldap.transaction.support.DummyDao#unbind(java.lang.String) - */ - public void unbind(String dn, String fullname) { - ldapTemplate.unbind(dn); - jdbcTemplate.update("delete from PERSON where fullname=?", - new Object[] { fullname }); - } - - /* - * (non-Javadoc) - * - * @see org.springframework.ldap.transaction.support.DummyDao#unbindWithException(java.lang.String) - */ - public void unbindWithException(String dn, String fullname) { - unbind(dn, fullname); - throw new DummyException("This operation failed."); - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/transaction/compensating/manager/LdapDummyDaoImpl.java b/mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/transaction/compensating/manager/LdapDummyDaoImpl.java deleted file mode 100644 index 4db82c0a..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/main/java/org/springframework/ldap/transaction/compensating/manager/LdapDummyDaoImpl.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright 2002-2007 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 - * - * http://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.transaction.compensating.manager; - -import org.springframework.ldap.core.DirContextAdapter; -import org.springframework.ldap.core.DistinguishedName; -import org.springframework.ldap.core.LdapTemplate; - -public class LdapDummyDaoImpl implements DummyDao { - private LdapTemplate ldapTemplate; - - public void setLdapTemplate(LdapTemplate ldapTemplate) { - this.ldapTemplate = ldapTemplate; - } - - /* - * (non-Javadoc) - * - * @see org.springframework.ldap.transaction.support.DummyDao#createWithException(java.lang.String, - * java.lang.String, java.lang.String, java.lang.String, - * java.lang.String) - */ - public void createWithException(String country, String company, - String fullname, String lastname, String description) { - create(country, company, fullname, lastname, description); - throw new DummyException("This method failed"); - } - - /* - * (non-Javadoc) - * - * @see org.springframework.ldap.transaction.support.DummyDao#create(java.lang.String, - * java.lang.String, java.lang.String, java.lang.String, - * java.lang.String) - */ - public void create(String country, String company, String fullname, - String lastname, String description) { - DistinguishedName dn = new DistinguishedName(); - dn.add("c", country); - dn.add("ou", company); - dn.add("cn", fullname); - - DirContextAdapter ctx = new DirContextAdapter(); - ctx.setAttributeValues("objectclass", new String[] { "top", "person" }); - ctx.setAttributeValue("cn", fullname); - ctx.setAttributeValue("sn", lastname); - ctx.setAttributeValue("description", description); - ldapTemplate.bind(dn, ctx, null); - } - - /* - * (non-Javadoc) - * - * @see org.springframework.ldap.transaction.support.DummyDao#update(java.lang.String, - * java.lang.String, java.lang.String) - */ - public void update(String dn, String fullname, String lastname, - String description) { - DirContextAdapter ctx = (DirContextAdapter) ldapTemplate.lookup(dn); - ctx.setAttributeValue("sn", lastname); - ctx.setAttributeValue("description", description); - ctx.update(); - - ldapTemplate.rebind(dn, ctx, null); - } - - /* - * (non-Javadoc) - * - * @see org.springframework.ldap.transaction.support.DummyDao#updateWithException(java.lang.String, - * java.lang.String, java.lang.String) - */ - public void updateWithException(String dn, String fullname, - String lastname, String description) { - update(dn, fullname, lastname, description); - throw new DummyException("This method failed."); - } - - /* - * (non-Javadoc) - * - * @see org.springframework.ldap.transaction.support.DummyDao#updateAndRename(java.lang.String, - * java.lang.String, java.lang.String) - */ - public void updateAndRename(String dn, String newDn, String description) { - DirContextAdapter ctx = (DirContextAdapter) ldapTemplate.lookup(dn); - ctx.setAttributeValue("description", description); - ctx.update(); - - ldapTemplate.rebind(dn, ctx, null); - ldapTemplate.rename(dn, newDn); - } - - /* - * (non-Javadoc) - * - * @see org.springframework.ldap.transaction.support.DummyDao#updateAndRenameWithException(java.lang.String, - * java.lang.String, java.lang.String) - */ - public void updateAndRenameWithException(String dn, String newDn, - String description) { - updateAndRename(dn, newDn, description); - throw new DummyException("This method failed."); - } - - /* - * (non-Javadoc) - * - * @see org.springframework.ldap.transaction.support.DummyDao#modifyAttributes(java.lang.String, - * java.lang.String, java.lang.String) - */ - public void modifyAttributes(String dn, String lastName, String description) { - DirContextAdapter ctx = (DirContextAdapter) ldapTemplate.lookup(dn); - ctx.setAttributeValue("sn", lastName); - ctx.setAttributeValue("description", description); - - ldapTemplate.modifyAttributes(dn, ctx.getModificationItems()); - } - - /* - * (non-Javadoc) - * - * @see org.springframework.ldap.transaction.support.DummyDao#modifyAttributesWithException(java.lang.String, - * java.lang.String, java.lang.String) - */ - public void modifyAttributesWithException(String dn, String lastName, - String description) { - modifyAttributes(dn, lastName, description); - throw new DummyException("This method failed."); - } - - /* - * (non-Javadoc) - * - * @see org.springframework.ldap.transaction.support.DummyDao#unbind(java.lang.String) - */ - public void unbind(String dn, String fullname) { - ldapTemplate.unbind(dn); - } - - /* - * (non-Javadoc) - * - * @see org.springframework.ldap.transaction.support.DummyDao#unbindWithException(java.lang.String) - */ - public void unbindWithException(String dn, String fullname) { - unbind(dn, fullname); - throw new DummyException("This operation failed."); - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/log4j.properties b/mvn-build/integration-tests/core-integration-tests/src/test/java/log4j.properties deleted file mode 100644 index f57302e8..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/java/log4j.properties +++ /dev/null @@ -1,9 +0,0 @@ -log4j.rootCategory=WARN, stdout - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n - -#Enable debug logging -log4j.category.net.sf.ldaptemplate=INFO -log4j.category.net.sf.ldaptemplate.LdapTemplate=DEBUG diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/AbstractLdapTemplateIntegrationTest.java b/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/AbstractLdapTemplateIntegrationTest.java deleted file mode 100644 index e09c0e94..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/AbstractLdapTemplateIntegrationTest.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2005-2007 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 - * - * http://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; - -import org.springframework.test.AbstractDependencyInjectionSpringContextTests; - -public abstract class AbstractLdapTemplateIntegrationTest extends - AbstractDependencyInjectionSpringContextTests { - - - protected void onSetUp() throws Exception { - super.onSetUp(); - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateAttributesMapperITest.java b/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateAttributesMapperITest.java deleted file mode 100644 index 8acd316f..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateAttributesMapperITest.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2005-2007 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 - * - * http://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; - -import java.util.LinkedList; -import java.util.List; - -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; -import javax.naming.directory.Attributes; - -import org.springframework.ldap.core.AttributesMapper; -import org.springframework.ldap.core.LdapTemplate; - -/** - * Tests the attributes mapper search method. - * - * @author Mattias Arthursson - */ -public class LdapTemplateAttributesMapperITest extends - AbstractLdapTemplateIntegrationTest { - private LdapTemplate tested; - - protected String[] getConfigLocations() { - return new String[] { "/conf/ldapTemplateTestContext.xml" }; - } - - public void testSearch_AttributeMapper() throws Exception { - AttributesMapper mapper = new PersonAttributesMapper(); - List result = tested.search("ou=company1,c=Sweden", - "(&(objectclass=person)(sn=Person2))", mapper); - - assertEquals(1, result.size()); - Person person = (Person) result.get(0); - assertEquals("Some Person2", person.getFullname()); - assertEquals("Person2", person.getLastname()); - assertEquals("Sweden, Company1, Some Person2", person.getDescription()); - } - - /** - * Demonstrates how to retrieve all values of a multi-value attribute. - * - * @see LdapTemplateContextMapperITest#testSearch_ContextMapper_MultiValue() - */ - public void testSearch_AttributesMapper_MultiValue() throws Exception { - AttributesMapper mapper = new AttributesMapper() { - public Object mapFromAttributes(Attributes attributes) throws NamingException { - LinkedList list = new LinkedList(); - NamingEnumeration enumeration = attributes.get("uniqueMember").getAll(); - while (enumeration.hasMoreElements()) { - String value = (String) enumeration.nextElement(); - list.add(value); - } - String[] members = (String[]) list.toArray(new String[0]); - return members; - } - }; - List result = tested.search("ou=groups", - "(objectclass=groupOfUniqueNames)", mapper); - - assertEquals(2, result.size()); - assertEquals(1, ((String[]) result.get(0)).length); - assertEquals(5, ((String[]) result.get(1)).length); - } - - public void setTested(LdapTemplate tested) { - this.tested = tested; - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateBindUnbindITest.java b/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateBindUnbindITest.java deleted file mode 100644 index 42297c48..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateBindUnbindITest.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2005-2007 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 - * - * http://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; - -import javax.naming.directory.Attributes; -import javax.naming.directory.BasicAttribute; -import javax.naming.directory.BasicAttributes; - -import org.springframework.ldap.core.DirContextAdapter; -import org.springframework.ldap.core.DistinguishedName; -import org.springframework.ldap.core.LdapTemplate; - -/** - * Tests the bind and unbind methods of LdapTemplate. The test methods in this - * class tests a little too much, but we need to clean up after binding, so the - * most efficient way to test is to do it all in one test method. Also, the - * methods in this class relies on that the lookup method works as it should - - * that should be ok, since that is verified in a separate test class. NOTE: if - * any of the tests in this class fails, it may be necessary to run the cleanup - * script as described in README.txt under /src/iutest/. - * - * @author Mattias Arthursson - */ -public class LdapTemplateBindUnbindITest extends - AbstractLdapTemplateIntegrationTest { - private LdapTemplate tested; - - private static String DN = "cn=Some Person4,ou=company1,c=Sweden"; - - protected String[] getConfigLocations() { - return new String[] { "/conf/ldapTemplateTestContext.xml" }; - } - - public void testBindAndUnbind_Attributes_Plain() { - Attributes attributes = setupAttributes(); - tested.bind(DN, null, attributes); - verifyBoundCorrectData(); - tested.unbind(DN); - verifyCleanup(); - } - - public void testBindAndUnbind_Attributes_DIstinguishedName() { - Attributes attributes = setupAttributes(); - tested.bind(new DistinguishedName(DN), null, attributes); - verifyBoundCorrectData(); - tested.unbind(new DistinguishedName(DN)); - verifyCleanup(); - } - - public void testBindAndUnbind_DirContextAdapter_Plain() { - DirContextAdapter adapter = new DirContextAdapter(); - adapter.setAttributeValues("objectclass", new String[] { "top", - "person" }); - adapter.setAttributeValue("cn", "Some Person4"); - adapter.setAttributeValue("sn", "Person4"); - - tested.bind(DN, adapter, null); - verifyBoundCorrectData(); - tested.unbind(DN); - verifyCleanup(); - } - - public void testBindAndUnbind_DirContextAdapter_DIstinguishedName() { - DirContextAdapter adapter = new DirContextAdapter(); - adapter.setAttributeValues("objectclass", new String[] { "top", - "person" }); - adapter.setAttributeValue("cn", "Some Person4"); - adapter.setAttributeValue("sn", "Person4"); - - tested.bind(new DistinguishedName(DN), adapter, null); - verifyBoundCorrectData(); - tested.unbind(new DistinguishedName(DN)); - verifyCleanup(); - } - - private Attributes setupAttributes() { - Attributes attributes = new BasicAttributes(); - BasicAttribute ocattr = new BasicAttribute("objectclass"); - ocattr.add("top"); - ocattr.add("person"); - attributes.put(ocattr); - attributes.put("cn", "Some Person4"); - attributes.put("sn", "Person4"); - return attributes; - } - - private void verifyBoundCorrectData() { - DirContextAdapter result = (DirContextAdapter) tested.lookup(DN); - assertEquals("Some Person4", result.getStringAttribute("cn")); - assertEquals("Person4", result.getStringAttribute("sn")); - } - - private void verifyCleanup() { - try { - tested.lookup(DN); - fail("NameNotFoundException expected"); - } catch (NameNotFoundException expected) { - assertTrue(true); - } - } - - public void setTested(LdapTemplate tested) { - this.tested = tested; - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateContextExecutorTest.java b/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateContextExecutorTest.java deleted file mode 100644 index 8561d09d..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateContextExecutorTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2005-2007 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 - * - * http://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; - -import javax.naming.NamingException; -import javax.naming.directory.DirContext; - -import org.springframework.ldap.core.ContextExecutor; -import org.springframework.ldap.core.DirContextAdapter; -import org.springframework.ldap.core.LdapTemplate; - -/** - * Tests for LdapTemplate's context executor methods. - * - * @author Mattias Arthursson - */ -public class LdapTemplateContextExecutorTest extends - AbstractLdapTemplateIntegrationTest { - - private LdapTemplate tested; - - protected String[] getConfigLocations() { - return new String[] { "/conf/ldapTemplateTestContext.xml" }; - } - - protected void onSetUp() throws Exception { - super.onSetUp(); - } - - protected void onTearDown() throws Exception { - super.onTearDown(); - } - - public void testLookupLink() { - ContextExecutor executor = new ContextExecutor(){ - public Object executeWithContext(DirContext ctx) throws NamingException { - return ctx.lookupLink("cn=Some Person,ou=company1,c=Sweden"); - } - }; - - Object object = tested.executeReadOnly(executor); - assertTrue("Should be a DirContextAdapter", object instanceof DirContextAdapter); - } - - public void setTested(LdapTemplate tested) { - this.tested = tested; - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateContextMapperITest.java b/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateContextMapperITest.java deleted file mode 100644 index d2ca77b2..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateContextMapperITest.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2005-2007 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 - * - * http://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; - -import java.util.List; - -import org.springframework.ldap.core.ContextMapper; -import org.springframework.ldap.core.DirContextAdapter; -import org.springframework.ldap.core.LdapTemplate; - -/** - * Tests the ContextMapper search method. In its way this method also - * demonstrates the use of DirContextAdapter and the DirObjectFactory. - * - * @author Mattias Arthursson - */ -public class LdapTemplateContextMapperITest extends - AbstractLdapTemplateIntegrationTest { - private LdapTemplate tested; - - 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 testSearch_ContextMapper() { - ContextMapper mapper = new PersonContextMapper(); - List result = tested.search("ou=company1,c=Sweden", - "(&(objectclass=person)(sn=Person2))", mapper); - - assertEquals(1, result.size()); - Person person = (Person) result.get(0); - assertEquals("Some Person2", person.getFullname()); - assertEquals("Person2", person.getLastname()); - assertEquals("Sweden, Company1, Some Person2", person.getDescription()); - } - - /** - * Demonstrates how to retrieve all values of a multi-value attribute. - * - * @see LdapTemplateAttributesMapperITest#testSearch_AttributesMapper_MultiValue() - */ - public void testSearch_ContextMapper_MultiValue() throws Exception { - ContextMapper mapper = new ContextMapper() { - public Object mapFromContext(Object ctx) { - DirContextAdapter adapter = (DirContextAdapter) ctx; - String[] members = adapter.getStringAttributes("uniqueMember"); - return members; - } - }; - List result = tested.search("ou=groups", - "(objectclass=groupOfUniqueNames)", mapper); - - assertEquals(2, result.size()); - assertEquals(1, ((String[]) result.get(0)).length); - assertEquals(5, ((String[]) result.get(1)).length); - } - - public void setTested(LdapTemplate tested) { - this.tested = tested; - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateListITest.java b/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateListITest.java deleted file mode 100644 index 58d0e27c..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateListITest.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright 2005-2007 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 - * - * http://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; - -import java.util.List; - -import org.springframework.ldap.core.DistinguishedName; -import org.springframework.ldap.core.LdapTemplate; -import org.springframework.ldap.core.support.CountNameClassPairCallbackHandler; -import org.springframework.ldap.test.AttributeCheckContextMapper; - -/** - * Tests for LdapTemplate's list methods. - * - * @author Ulrik Sandberg - */ -public class LdapTemplateListITest extends - AbstractLdapTemplateIntegrationTest { - - private LdapTemplate tested; - - private AttributeCheckContextMapper contextMapper; - - private static final String BASE_STRING = ""; - - private static final DistinguishedName BASE_NAME = new DistinguishedName( - BASE_STRING); - - private static final String[] ALL_ATTRIBUTES = { "cn", "sn", "description", - "telephoneNumber" }; - - private static final String[] ALL_VALUES = { "Some Person", "Person", - "Sweden, Company2, Some Person", "+46 555-456321" }; - - protected String[] getConfigLocations() { - return new String[] { "/conf/ldapTemplateTestContext.xml" }; - } - - protected void onSetUp() throws Exception { - super.onSetUp(); - - contextMapper = new AttributeCheckContextMapper(); - } - - protected void onTearDown() throws Exception { - super.onTearDown(); - - contextMapper = null; - } - - public void testListBindings_ContextMapper() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.listBindings("ou=company2,c=Sweden" + BASE_STRING, - contextMapper); - assertEquals(1, list.size()); - } - - public void testListBindings_ContextMapper_Name() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - DistinguishedName dn = new DistinguishedName("ou=company2,c=Sweden"); - dn.append(BASE_NAME); - List list = tested.listBindings(dn, contextMapper); - assertEquals(1, list.size()); - } - - public void testListBindings_ContextMapper_MapToPersons() { - DistinguishedName dn = new DistinguishedName("ou=company1,c=Sweden"); - dn.append(BASE_NAME); - List list = tested.listBindings(dn, new PersonContextMapper()); - assertEquals(3, list.size()); - String personClass = "org.springframework.ldap.Person"; - assertEquals(personClass, list.get(0).getClass().getName()); - assertEquals(personClass, list.get(1).getClass().getName()); - assertEquals(personClass, list.get(2).getClass().getName()); - } - - public void testList() { - List list = tested.list(BASE_STRING); - assertEquals(3, list.size()); - assertTrue(list.contains("ou=groups")); - assertTrue(list.contains("c=Norway")); - assertTrue(list.contains("c=Sweden")); - } - - public void testList_Name() { - List list = tested.list(BASE_NAME); - assertEquals(3, list.size()); - assertTrue(list.contains("ou=groups")); - assertTrue(list.contains("c=Norway")); - assertTrue(list.contains("c=Sweden")); - } - - public void testList_Handler() throws Exception { - CountNameClassPairCallbackHandler handler = new CountNameClassPairCallbackHandler(); - tested.list(BASE_STRING, handler); - assertEquals(3, handler.getNoOfRows()); - } - - public void testList_Name_Handler() throws Exception { - CountNameClassPairCallbackHandler handler = new CountNameClassPairCallbackHandler(); - tested.list(BASE_NAME, handler); - assertEquals(3, handler.getNoOfRows()); - } - - public void testListBindings() { - List list = tested.listBindings(BASE_STRING); - assertEquals(3, list.size()); - assertTrue(list.contains("ou=groups")); - assertTrue(list.contains("c=Norway")); - assertTrue(list.contains("c=Sweden")); - } - - public void testListBindings_Name() { - List list = tested.listBindings(BASE_NAME); - assertEquals(3, list.size()); - } - - public void testListBindings_Handler() throws Exception { - CountNameClassPairCallbackHandler handler = new CountNameClassPairCallbackHandler(); - tested.listBindings(BASE_STRING, handler); - assertEquals(3, handler.getNoOfRows()); - } - - public void testListBindings_Name_Handler() throws Exception { - CountNameClassPairCallbackHandler handler = new CountNameClassPairCallbackHandler(); - tested.listBindings(BASE_NAME, handler); - assertEquals(3, handler.getNoOfRows()); - } - - public void setTested(LdapTemplate tested) { - this.tested = tested; - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateLookupITest.java b/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateLookupITest.java deleted file mode 100644 index cb479a9b..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateLookupITest.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright 2005-2007 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 - * - * http://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; - -import javax.naming.NamingException; -import javax.naming.directory.Attributes; - -import org.springframework.ldap.core.AttributesMapper; -import org.springframework.ldap.core.ContextMapper; -import org.springframework.ldap.core.DirContextAdapter; -import org.springframework.ldap.core.DistinguishedName; -import org.springframework.ldap.core.LdapTemplate; -import org.springframework.ldap.core.support.AbstractContextSource; - -/** - * Tests the lookup methods of LdapTemplate. - * - * @author Mattias Arthursson - * @author Ulrik Sandberg - */ -public class LdapTemplateLookupITest extends - AbstractLdapTemplateIntegrationTest { - - private LdapTemplate tested; - - 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 testLookup_Plain() { - DirContextAdapter result = (DirContextAdapter) tested - .lookup("cn=Some Person2, ou=company1,c=Sweden"); - - assertEquals("Some Person2", result.getStringAttribute("cn")); - assertEquals("Person2", result.getStringAttribute("sn")); - assertEquals("Sweden, Company1, Some Person2", result - .getStringAttribute("description")); - } - - public void testLookup_AttributesMapper() { - AttributesMapper mapper = new PersonAttributesMapper(); - Person person = (Person) tested.lookup( - "cn=Some Person2, ou=company1,c=Sweden", mapper); - - assertEquals("Some Person2", person.getFullname()); - assertEquals("Person2", person.getLastname()); - assertEquals("Sweden, Company1, Some Person2", person.getDescription()); - } - - public void testLookup_AttributesMapper_DistinguishedName() { - AttributesMapper mapper = new PersonAttributesMapper(); - Person person = (Person) tested.lookup(new DistinguishedName( - "cn=Some Person2, ou=company1,c=Sweden"), mapper); - - assertEquals("Some Person2", person.getFullname()); - assertEquals("Person2", person.getLastname()); - assertEquals("Sweden, Company1, Some Person2", person.getDescription()); - } - - /** - * An {@link AttributesMapper} that only maps a subset of the full - * attributes list. Used in tests where the return attributes list has been - * limited. - * - * @author Ulrik Sandberg - */ - private final class SubsetPersonAttributesMapper implements - AttributesMapper { - /** - * Maps the cn attribute into a {@link Person} object. - * Also verifies that the other attributes haven't been set. - * - * @see org.springframework.ldap.core.AttributesMapper#mapFromAttributes(javax.naming.directory.Attributes) - */ - public Object mapFromAttributes(Attributes attributes) - throws NamingException { - Person person = new Person(); - person.setFullname((String) attributes.get("cn").get()); - assertNull("sn should be null", attributes.get("sn")); - assertNull("description should be null", attributes - .get("description")); - return person; - } - } - - /** - * Verifies that only the subset is used when specifying a subset of the - * available attributes as return attributes. - */ - public void testLookup_ReturnAttributes_AttributesMapper() { - AttributesMapper mapper = new SubsetPersonAttributesMapper(); - - Person person = (Person) tested.lookup( - "cn=Some Person2, ou=company1,c=Sweden", new String[] { "cn" }, - mapper); - - assertEquals("Some Person2", person.getFullname()); - assertNull("lastName should not be set", person.getLastname()); - assertNull("description should not be set", person.getDescription()); - } - - /** - * Verifies that only the subset is used when specifying a subset of the - * available attributes as return attributes. Uses DistinguishedName instead - * of plain string as name. - */ - public void testLookup_ReturnAttributes_AttributesMapper_DistinguishedName() { - AttributesMapper mapper = new SubsetPersonAttributesMapper(); - Person person = (Person) tested.lookup(new DistinguishedName( - "cn=Some Person2, ou=company1,c=Sweden"), - new String[] { "cn" }, mapper); - - assertEquals("Some Person2", person.getFullname()); - assertNull("lastName should not be set", person.getLastname()); - assertNull("description should not be set", person.getDescription()); - } - - /** - * This method depends on a DirObjectFactory ({@link org.springframework.ldap.core.support.DefaultDirObjectFactory}) - * being set in the ContextSource. - */ - public void testLookup_ContextMapper() { - ContextMapper mapper = new PersonContextMapper(); - Person person = (Person) tested.lookup( - "cn=Some Person2, ou=company1,c=Sweden", mapper); - - assertEquals("Some Person2", person.getFullname()); - assertEquals("Person2", person.getLastname()); - assertEquals("Sweden, Company1, Some Person2", person.getDescription()); - } - - /** - * Verifies that only the subset is used when specifying a subset of the - * available attributes as return attributes. - */ - public void testLookup_ReturnAttributes_ContextMapper() { - ContextMapper mapper = new PersonContextMapper(); - - Person person = (Person) tested.lookup( - "cn=Some Person2, ou=company1,c=Sweden", new String[] { "cn" }, - mapper); - - assertEquals("Some Person2", person.getFullname()); - assertNull("lastName should not be set", person.getLastname()); - assertNull("description should not be set", person.getDescription()); - } - - /** - * Verifies that we can lookup an entry that has a multi-valued rdn, which - * means more than one attribute is part of the relative DN for the entry. - * - * TODO Enable test when ApacheDS supports multi-valued rdns. - */ - public void DISABLED_testLookup_MultiValuedRdn() { - AttributesMapper mapper = new PersonAttributesMapper(); - Person person = (Person) tested.lookup( - "cn=Some Person+sn=Person, ou=company1,c=Norway", mapper); - - assertEquals("Some Person", person.getFullname()); - assertEquals("Person", person.getLastname()); - assertEquals("Norway, Company1, Some Person2", person.getDescription()); - } - - /** - * Verifies that we can lookup an entry that has a multi-valued rdn, which - * means more than one attribute is part of the relative DN for the entry. - * - * TODO Enable test when ApacheDS supports multi-valued rdns. - */ - public void DISABLED_testLookup_MultiValuedRdn_DirContextAdapter() { - DirContextAdapter result = (DirContextAdapter) tested - .lookup("cn=Some Person+sn=Person, ou=company1,c=Norway"); - - assertEquals("Some Person", result.getStringAttribute("cn")); - assertEquals("Person", result.getStringAttribute("sn")); - assertEquals("Norway, Company1, Some Person", result - .getStringAttribute("description")); - } - - public void testLookup_GetNameInNamespace_Plain() { - DirContextAdapter result = (DirContextAdapter) tested - .lookup("cn=Some Person2, ou=company1,c=Sweden"); - - assertEquals("cn=Some Person2, ou=company1, c=Sweden", result.getDn() - .toString()); - assertEquals( - "cn=Some Person2, ou=company1, c=Sweden, dc=jayway, dc=se", - result.getNameInNamespace()); - } - - public void testLookup_GetNameInNamespace_MultiRdn() { - DirContextAdapter result = (DirContextAdapter) tested - .lookup("cn=Some Person+sn=Person, ou=company1,c=Norway"); - - assertEquals("cn=Some Person+sn=Person, ou=company1, c=Norway", result - .getDn().toString()); - assertEquals( - "cn=Some Person+sn=Person, ou=company1, c=Norway, dc=jayway, dc=se", - result.getNameInNamespace()); - } - - /** - * Tests bind and lookup with Java objects where the ContextSource already - * has a DirObjectFactory configured. - */ - public void testBindJavaObject() throws Exception { - AbstractContextSource contextSource = (AbstractContextSource) tested - .getContextSource(); - Class originalObjectFactory = contextSource.getDirObjectFactory(); - try { - contextSource.setDirObjectFactory(null); - contextSource.afterPropertiesSet(); - tested.bind("cn=myRandomInt", new Integer(54321), null); - Integer result = (Integer) tested.lookup("cn=myRandomInt"); - assertEquals(54321, result.intValue()); - } finally { - // reset the DirObjectFactory so as not to disturb other tests - tested.unbind("cn=myRandomInt"); - contextSource.setDirObjectFactory(originalObjectFactory); - contextSource.afterPropertiesSet(); - } - } - - public void setTested(LdapTemplate tested) { - this.tested = tested; - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateModifyITest.java b/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateModifyITest.java deleted file mode 100644 index bf5560c6..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateModifyITest.java +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright 2005-2007 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 - * - * http://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; - -import javax.naming.directory.Attributes; -import javax.naming.directory.BasicAttribute; -import javax.naming.directory.BasicAttributes; -import javax.naming.directory.DirContext; -import javax.naming.directory.ModificationItem; - -import org.springframework.ldap.core.DirContextAdapter; -import org.springframework.ldap.core.DistinguishedName; -import org.springframework.ldap.core.LdapTemplate; - -/** - * Tests the modification methods (rebind and modifyAttributes) of LdapTemplate. - * It also illustrates the use of DirContextAdapter as a means of getting - * ModificationItems, in order to avoid doing a full rebind and use - * modifyAttributes() instead. We rely on that the bind, unbind and lookup - * methods work as they should - that should be ok, since that is verified in a - * separate test class. NOTE: if any of the tests in this class fails, it may be - * necessary to run the cleanup script as described in README.txt under - * /src/iutest/. - * - * @author Mattias Arthursson - * @author Ulrik Sandberg - */ -public class LdapTemplateModifyITest extends - AbstractLdapTemplateIntegrationTest { - private LdapTemplate tested; - - private static String PERSON4_DN = "cn=Some Person4,ou=company1,c=Sweden"; - - private static String PERSON5_DN = "cn=Some Person5,ou=company1,c=Sweden"; - - protected String[] getConfigLocations() { - return new String[] { "/conf/ldapTemplateTestContext.xml" }; - } - - protected void onSetUp() throws Exception { - super.onSetUp(); - - DirContextAdapter adapter = new DirContextAdapter(); - adapter.setAttributeValues("objectclass", new String[] { "top", - "person" }); - adapter.setAttributeValue("cn", "Some Person4"); - adapter.setAttributeValue("sn", "Person4"); - adapter.setAttributeValue("description", "Some description"); - - tested.bind(PERSON4_DN, adapter, null); - - adapter = new DirContextAdapter(); - adapter.setAttributeValues("objectclass", new String[] { "top", - "person" }); - adapter.setAttributeValue("cn", "Some Person5"); - adapter.setAttributeValue("sn", "Person5"); - adapter.setAttributeValues("description", new String[] { "qwe", "123", - "rty", "uio" }); - - tested.bind(PERSON5_DN, adapter, null); - - } - - protected void onTearDown() throws Exception { - tested.unbind(PERSON4_DN); - tested.unbind(PERSON5_DN); - } - - public void testRebind_Attributes_Plain() { - Attributes attributes = setupAttributes(); - - tested.rebind(PERSON4_DN, null, attributes); - - verifyBoundCorrectData(); - } - - public void testRebind_Attributes_DistinguishedName() { - Attributes attributes = setupAttributes(); - - tested.rebind(new DistinguishedName(PERSON4_DN), null, attributes); - - verifyBoundCorrectData(); - } - - public void testModifyAttributes_MultiValueReplace() { - BasicAttribute attr = new BasicAttribute("description", - "Some other description"); - attr.add("Another description"); - ModificationItem[] mods = new ModificationItem[1]; - mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, attr); - - tested.modifyAttributes(PERSON4_DN, mods); - - DirContextAdapter result = (DirContextAdapter) tested - .lookup(PERSON4_DN); - String[] attributes = result.getStringAttributes("description"); - assertEquals(2, attributes.length); - assertEquals("Some other description", attributes[0]); - assertEquals("Another description", attributes[1]); - } - - public void testModifyAttributes_MultiValueAdd() { - BasicAttribute attr = new BasicAttribute("description", - "Some other description"); - attr.add("Another description"); - ModificationItem[] mods = new ModificationItem[1]; - mods[0] = new ModificationItem(DirContext.ADD_ATTRIBUTE, attr); - - tested.modifyAttributes(PERSON4_DN, mods); - - DirContextAdapter result = (DirContextAdapter) tested - .lookup(PERSON4_DN); - String[] attributes = result.getStringAttributes("description"); - assertEquals(3, attributes.length); - assertEquals("Some description", attributes[0]); - assertEquals("Some other description", attributes[1]); - assertEquals("Another description", attributes[2]); - } - - public void testModifyAttributes_MultiValueAddDuplicateToUnordered() { - BasicAttribute attr = new BasicAttribute("description", - "Some description"); - ModificationItem[] mods = new ModificationItem[1]; - mods[0] = new ModificationItem(DirContext.ADD_ATTRIBUTE, attr); - - try { - tested.modifyAttributes(PERSON4_DN, mods); - fail("AttributeInUseException expected"); - } catch (AttributeInUseException expected) { - // expected - } - } - - /** - * Test written originally to verify that duplicates are allowed on ordered - * attributes, but had to be changed since Apache DS seems to disallow - * duplicates even for ordered attributes. - */ - public void testModifyAttributes_MultiValueAddDuplicateToOrdered() { - BasicAttribute attr = new BasicAttribute("description", - "Some other description", true); // ordered - attr.add("Another description"); - // Commented out duplicate to make test work for Apache DS - // attr.add("Some description"); - ModificationItem[] mods = new ModificationItem[1]; - mods[0] = new ModificationItem(DirContext.ADD_ATTRIBUTE, attr); - - tested.modifyAttributes(PERSON4_DN, mods); - - DirContextAdapter result = (DirContextAdapter) tested - .lookup(PERSON4_DN); - String[] attributes = result.getStringAttributes("description"); - assertEquals(3, attributes.length); - assertEquals("Some description", attributes[0]); - assertEquals("Some other description", attributes[1]); - assertEquals("Another description", attributes[2]); - } - - public void testModifyAttributes_Plain() { - ModificationItem item = new ModificationItem( - DirContext.REPLACE_ATTRIBUTE, new BasicAttribute("description", - "Some other description")); - - tested.modifyAttributes(PERSON4_DN, new ModificationItem[] { item }); - - verifyBoundCorrectData(); - } - - public void testModifyAttributes_DistinguishedName() { - ModificationItem item = new ModificationItem( - DirContext.REPLACE_ATTRIBUTE, new BasicAttribute("description", - "Some other description")); - - tested.modifyAttributes(new DistinguishedName(PERSON4_DN), - new ModificationItem[] { item }); - - verifyBoundCorrectData(); - } - - public void testModifyAttributes_DirContextAdapter_MultiAttributes() { - DirContextAdapter adapter = (DirContextAdapter) tested - .lookup(PERSON5_DN); - adapter.setAttributeValues("description", new String[] { "qwe", "123", - "klytt", "kalle" }); - - tested.modifyAttributes(PERSON5_DN, adapter.getModificationItems()); - - // Verify - adapter = (DirContextAdapter) tested.lookup(PERSON5_DN); - String[] attributes = adapter.getStringAttributes("description"); - assertEquals(4, attributes.length); - assertEquals("qwe", attributes[0]); - assertEquals("123", attributes[1]); - assertEquals("klytt", attributes[2]); - assertEquals("kalle", attributes[3]); - } - - /** - * Demonstrates how the DirContextAdapter can be used to automatically keep - * track of changes of the attributes and deliver ModificationItems to use - * in moifyAttributes(). - */ - public void testModifyAttributes_DirContextAdapter() throws Exception { - DirContextAdapter adapter = (DirContextAdapter) tested - .lookup(PERSON4_DN); - - adapter.setAttributeValue("description", "Some other description"); - - ModificationItem[] modificationItems = adapter.getModificationItems(); - tested.modifyAttributes(PERSON4_DN, modificationItems); - - verifyBoundCorrectData(); - } - - private Attributes setupAttributes() { - Attributes attributes = new BasicAttributes(); - BasicAttribute ocattr = new BasicAttribute("objectclass"); - ocattr.add("top"); - ocattr.add("person"); - attributes.put(ocattr); - attributes.put("cn", "Some Person4"); - attributes.put("sn", "Person4"); - attributes.put("description", "Some other description"); - return attributes; - } - - private void verifyBoundCorrectData() { - DirContextAdapter result = (DirContextAdapter) tested - .lookup(PERSON4_DN); - assertEquals("Some Person4", result.getStringAttribute("cn")); - assertEquals("Person4", result.getStringAttribute("sn")); - assertEquals("Some other description", result - .getStringAttribute("description")); - } - - public void setTested(LdapTemplate tested) { - this.tested = tested; - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateNoBaseSuffixITest.java b/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateNoBaseSuffixITest.java deleted file mode 100644 index f82a2e6d..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateNoBaseSuffixITest.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2005-2007 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 - * - * http://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; - -import org.springframework.ldap.core.DirContextAdapter; -import org.springframework.ldap.core.LdapTemplate; -import org.springframework.ldap.core.support.CountNameClassPairCallbackHandler; - -/** - * Tests to verify that not setting a base suffix on the ContextSource (as - * defined in ldapTemplateNoBaseSuffixTestContext.xml) works as expected. - * - * NOTE: This test will not work under Java 1.4.1 or earlier. - * - * @author Mattias Arthursson - */ -public class LdapTemplateNoBaseSuffixITest extends - AbstractLdapTemplateIntegrationTest { - private LdapTemplate tested; - - protected String[] getConfigLocations() { - return new String[] { "/conf/ldapTemplateNoBaseSuffixTestContext.xml" }; - } - - /** - * This method depends on a DirObjectFactory ({@link org.springframework.ldap.core.support.DefaultDirObjectFactory}) - * being set in the ContextSource. - */ - public void testLookup_Plain() { - DirContextAdapter result = (DirContextAdapter) tested - .lookup("cn=Some Person2, ou=company1, c=Sweden, dc=jayway, dc=se"); - - assertEquals("Some Person2", result.getStringAttribute("cn")); - assertEquals("Person2", result.getStringAttribute("sn")); - assertEquals("Sweden, Company1, Some Person2", result - .getStringAttribute("description")); - assertEquals( - "cn=Some Person2, ou=company1, c=Sweden, dc=jayway, dc=se", - result.getDn().toString()); - assertEquals( - "cn=Some Person2, ou=company1, c=Sweden, dc=jayway, dc=se", - result.getNameInNamespace()); - } - - public void testSearch_Plain() { - CountNameClassPairCallbackHandler handler = new CountNameClassPairCallbackHandler(); - - tested.search("dc=jayway, dc=se", "(objectclass=person)", handler); - assertEquals(5, handler.getNoOfRows()); - } - - public void testBindAndUnbind_Plain() { - DirContextAdapter adapter = new DirContextAdapter(); - adapter.setAttributeValues("objectclass", new String[] { "top", - "person" }); - adapter.setAttributeValue("cn", "Some Person4"); - adapter.setAttributeValue("sn", "Person4"); - tested.bind("cn=Some Person4, ou=company1, c=Sweden, dc=jayway, dc=se", - adapter, null); - - DirContextAdapter result = (DirContextAdapter) tested - .lookup("cn=Some Person4, ou=company1, c=Sweden, dc=jayway, dc=se"); - - assertEquals("Some Person4", result.getStringAttribute("cn")); - assertEquals("Person4", result.getStringAttribute("sn")); - assertEquals( - "cn=Some Person4, ou=company1, c=Sweden, dc=jayway, dc=se", - result.getDn().toString()); - - tested - .unbind("cn=Some Person4, ou=company1, c=Sweden, dc=jayway, dc=se"); - try { - tested - .lookup("cn=Some Person4, ou=company1, c=Sweden, dc=jayway, dc=se"); - fail("NameNotFoundException expected"); - } catch (NameNotFoundException expected) { - assertTrue(true); - } - } - - public void setTested(LdapTemplate tested) { - this.tested = tested; - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateObjectBindIntegrationTest.java b/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateObjectBindIntegrationTest.java deleted file mode 100644 index f4b92d3d..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateObjectBindIntegrationTest.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright 2005-2007 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 - * - * http://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; - -import java.io.Serializable; -import java.util.LinkedList; - -import javax.naming.directory.DirContext; - -import org.springframework.ldap.core.LdapTemplate; -import org.springframework.ldap.core.support.AbstractContextSource; - -/** - * Tests bind and lookup with Java objects where the ContextSource has a - * null DirObjectFactory configured. - * - * @author Ulrik Sandberg - */ -public class LdapTemplateObjectBindIntegrationTest extends - AbstractLdapTemplateIntegrationTest { - - private LdapTemplate tested; - - protected String[] getConfigLocations() { - return new String[] { "/conf/ldapTemplateObjectBindTestContext.xml" }; - } - - public void testBindJavaObject() throws Exception { - String dn = "cn=myRandomInt"; - tested.bind(dn, new Integer(54321), null); - - Integer result = (Integer) tested.lookup(dn); - assertEquals(54321, result.intValue()); - tested.unbind(dn); - } - - public void testBindLinkedList() { - LinkedList list = new LinkedList(); - list.add(new Integer(54321)); - list.add(new Integer(67890)); - - String dn = "cn=myRandomList"; - tested.bind(dn, list, null); - - LinkedList result = (LinkedList) tested.lookup(dn); - assertEquals(2, result.size()); - assertEquals(54321, ((Integer) result.get(0)).intValue()); - assertEquals(67890, ((Integer) result.get(1)).intValue()); - tested.unbind(dn); - } - - public void testBindNonSerializableJavaObjectShouldFail() throws Exception { - NonSerializablePojo pojo = new NonSerializablePojo(); - pojo.setName("A Name"); - - try { - tested.bind("cn=myRandomObject", pojo, null); - fail("IllegalArgumentException expected"); - } catch (IllegalArgumentException expected) { - assertEquals( - "can only bind Referenceable, Serializable, DirContext", - expected.getMessage()); - } - } - - /** - * Custom non-serializable class used for demonstrating bind and lookup of - * Java objects. - */ - public static class NonSerializablePojo { - private String name; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - } - - public void testBindSerializableJavaObjectShouldSucceed() throws Exception { - SerializablePojo pojo = new SerializablePojo(); - pojo.setName("A Name"); - - tested.bind("cn=myRandomObject", pojo, null); - - SerializablePojo result = (SerializablePojo) tested - .lookup("cn=myRandomObject"); - assertEquals("A Name", result.getName()); - tested.unbind("cn=myRandomObject"); - } - - /** - * Custom serializable class used for demonstrating bind and lookup of Java - * objects. - */ - public static class SerializablePojo implements Serializable { - private static final long serialVersionUID = 3655768927093734908L; - - private String name; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - } - - /** - * This test demonstrates that it's fully possible to perform plain JNDI - * operations from Spring LDAP. - */ - public void testPlainJndiBindJavaObject() throws Exception { - AbstractContextSource contextSource = (AbstractContextSource) tested - .getContextSource(); - DirContext ctx = contextSource.getReadWriteContext(); - - ctx.bind("cn=myRandomInt", new Integer(28420)); - - Integer result = (Integer) ctx.lookup("cn=myRandomInt"); - assertEquals(28420, result.intValue()); - tested.unbind("cn=myRandomInt"); - } - - public void setTested(LdapTemplate tested) { - this.tested = tested; - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateRecursiveDeleteITest.java b/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateRecursiveDeleteITest.java deleted file mode 100644 index e43e14aa..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateRecursiveDeleteITest.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright 2005-2007 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 - * - * http://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; - -import javax.naming.Name; - -import org.springframework.ldap.core.DirContextAdapter; -import org.springframework.ldap.core.DistinguishedName; -import org.springframework.ldap.core.LdapTemplate; - -/** - * Tests the recursive modification methods (unbind and the protected delete - * methods) of LdapTemplate. - * - * @author Mattias Arthursson - * @author Ulrik Sandberg - */ -public class LdapTemplateRecursiveDeleteITest extends - AbstractLdapTemplateIntegrationTest { - private LdapTemplate tested; - - private static DistinguishedName DN = new DistinguishedName( - "cn=Some Person5,ou=company1,c=Sweden"); - - private DistinguishedName firstSubDn; - - private DistinguishedName secondSubDn; - - private DistinguishedName leafDn; - - protected String[] getConfigLocations() { - return new String[] { "/conf/ldapTemplateTestContext.xml" }; - } - - protected void onSetUp() throws Exception { - super.onSetUp(); - - DirContextAdapter adapter = new DirContextAdapter(); - adapter.setAttributeValues("objectclass", new String[] { "top", - "person" }); - adapter.setAttributeValue("cn", "Some Person5"); - adapter.setAttributeValue("sn", "Person5"); - adapter.setAttributeValue("description", "Some description"); - tested.bind(DN, adapter, null); - - firstSubDn = new DistinguishedName("cn=subPerson"); - firstSubDn.prepend(DN); - adapter = new DirContextAdapter(); - adapter.setAttributeValues("objectclass", new String[] { "top", - "person" }); - adapter.setAttributeValue("cn", "subPerson"); - adapter.setAttributeValue("sn", "subPerson"); - adapter.setAttributeValue("description", - "Should be recursively deleted"); - tested.bind(firstSubDn, adapter, null); - secondSubDn = new DistinguishedName("cn=subPerson2"); - secondSubDn.prepend(DN); - adapter = new DirContextAdapter(); - adapter.setAttributeValues("objectclass", new String[] { "top", - "person" }); - adapter.setAttributeValue("cn", "subPerson2"); - adapter.setAttributeValue("sn", "subPerson2"); - adapter.setAttributeValue("description", - "Should be recursively deleted"); - tested.bind(secondSubDn, adapter, null); - - leafDn = new DistinguishedName("cn=subSubPerson"); - leafDn.prepend(firstSubDn); - adapter = new DirContextAdapter(); - adapter.setAttributeValues("objectclass", new String[] { "top", - "person" }); - adapter.setAttributeValue("cn", "subSubPerson"); - adapter.setAttributeValue("sn", "subSubPerson"); - adapter.setAttributeValue("description", - "Should be recursively deleted"); - tested.bind(leafDn, adapter, null); - } - - protected void onTearDown() throws Exception { - try { - tested.unbind(DN, true); - } catch (NameNotFoundException ignore) { - // ignore - } - } - - public void testRecursiveUnbind() { - tested.unbind(DN, true); - - verifyDeleted(DN); - verifyDeleted(firstSubDn); - verifyDeleted(secondSubDn); - verifyDeleted(leafDn); - } - - public void testRecursiveUnbindOnLeaf() { - tested.unbind(leafDn, true); - verifyDeleted(leafDn); - } - - private void verifyDeleted(Name dn) { - try { - tested.lookup(dn); - fail("Expected entry '" + dn + "' to be non-existent"); - } catch (NameNotFoundException expected) { - // expected - } - } - - public void setTested(LdapTemplate tested) { - this.tested = tested; - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateRenameITest.java b/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateRenameITest.java deleted file mode 100644 index 64a78c51..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateRenameITest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2005-2007 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 - * - * http://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; - -import javax.naming.Name; - -import org.springframework.ldap.core.DirContextAdapter; -import org.springframework.ldap.core.DistinguishedName; -import org.springframework.ldap.core.LdapTemplate; - -/** - * Tests the rename methods of LdapTemplate. - * - * We rely on that the bind, unbind and lookup methods work as they should - - * that should be ok, since that is verified in a separate test class. * - * - * @author Ulrik Sandberg - */ -public class LdapTemplateRenameITest extends - AbstractLdapTemplateIntegrationTest { - private LdapTemplate tested; - - private static String DN = "cn=Some Person6,ou=company1,c=Sweden"; - - private static String NEWDN = "cn=Some Person6,ou=company2,c=Sweden"; - - protected String[] getConfigLocations() { - return new String[] { "/conf/ldapTemplateTestContext.xml" }; - } - - protected void onSetUp() throws Exception { - super.onSetUp(); - - DirContextAdapter adapter = new DirContextAdapter(); - adapter.setAttributeValues("objectclass", new String[] { "top", - "person" }); - adapter.setAttributeValue("cn", "Some Person6"); - adapter.setAttributeValue("sn", "Person6"); - adapter.setAttributeValue("description", "Some description"); - - tested.bind(DN, adapter, null); - } - - protected void onTearDown() throws Exception { - tested.unbind(NEWDN); - tested.unbind(DN); - } - - public void testRename() { - tested.rename(DN, NEWDN); - - verifyDeleted(new DistinguishedName(DN)); - verifyBoundCorrectData(); - } - - public void testRename_DistinguishedName() throws Exception { - Name oldDn = new DistinguishedName(DN); - Name newDn = new DistinguishedName(NEWDN); - tested.rename(oldDn, newDn); - - - verifyDeleted(oldDn); - verifyBoundCorrectData(); - } - - private void verifyDeleted(Name dn) { - try { - tested.lookup(dn); - fail("Expected entry '" + dn + "' to be non-existent"); - } catch (NameNotFoundException expected) { - // expected - } - } - - private void verifyBoundCorrectData() { - DirContextAdapter result = (DirContextAdapter) tested.lookup(NEWDN); - assertEquals("Some Person6", result.getStringAttribute("cn")); - assertEquals("Person6", result.getStringAttribute("sn")); - assertEquals("Some description", result - .getStringAttribute("description")); - } - - public void setTested(LdapTemplate tested) { - this.tested = tested; - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateSearchCountITest.xls b/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateSearchCountITest.xls deleted file mode 100644 index a7f7e40c0663e9e9ea892ec76fa2bd8b167de5e8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11776 zcmeHNdr(}}8UOCGkj(?wyo`@z-7d7S1dvD+6bYM$86BfC5RILXZU`&|AuIwJ%}m;? zDY1`$q zaD3z}-#Pbu=X;&+ob#P?&*j*QGf&+A>MP}iF^^cOt zq(+M1@pSqOdEi6XIv0bN1#knh0UYxw01sd)U>aaLUNyTn6W@Wy56nsk-Z2O_?o?vPm}L*9<#0%jME7ZOSHM`lSQU-4h5chJMCCt{>Vk z0jZ7$;gzW2}5$wkvGI8 z``w3;i@XVFk{+)4Yr1+nI{l5!-K`rUys%p4cdN<+D$hf1$N|Okn!+rSxpEXTlUw83 zJN4PJw6~+V>wn&0K*u4P?-EOg&pjVYX`V|W-#uQ+yD+$Y`RF>EzSf<%!*l?zly1EQQR?0$I>J*dG zlw2=HjFapOnDH~P69s&D2Kok)}zn8Kpv7aZEdDc(*!!d3v;@OmkH4Qx=%xWwTL9S|~rp>M#QGm_Hx| zSi1%IRY(nXkut;_C)Ve_Kz@P+GY0uuoJ=CpD(l8!tdgH%c8p>yhpzFo={BExsT{zx z8JBfp&6bde9E2hxoa$AH_-*|q-rnc2TAjQBB}wx!4+(Rhdz1VO>u+2|+8)i8cCk~P zoraWp7)Ya))=8aGR-bdWQRvg+jYtDh{H69O8at z5n&2B((jK1FRnmI-a<1&;o4HCF&qqbCk;oJNJ6&LoNs^^EmaWQ}@hnx&isz_u zcHFJXIq@mUJ8;y;Hjl)&nAbfya_#}nz(2?b|HzhiJOd(+{!QW}Xyr?PT;exejQ6{T zpd}`WL;^)j1_zTeSlI>{BQgRxZTKaDmp0T#_;v)7_~Rq8nEDY78sNdC_(s5=Ob*H* z>d8UyLT++oP%7J!QaLgLJg5nSfHsJ48+tMCh9^KU4zg^CeUn3CmWh1jKyyB|uI5R9k z925k@QO#OTV@tFrvP0Zb4poN@4*)&JE7%9J&j=~OYOFUj_eFBhnU1dhNH1w#+NYVPZ+?TPgEMZ1G|V=F5w!)x5?48w8CEB?w@9K|i& zwT;n@5r4gw5G)v%vah>V6P+KN4AtUb5RH%3|`-9h+gBH!S4sZV)a zc?vyuSX~mt$c$oNaTVxVTWYUw-h5;8=2ATMMR4@CR1z_&>8fb2No#K^6p3!CZHaE| zY3|;{iT_R5-Y^;rC{=T*RK`pO}&P4Ta}!6Th_59L0$Y7go$@Xi?6yW_oy_^Ds}1N2A( zRTr;@53%PW@L(AuxpR-)>d8GacudxH6w8_|2XBuB--7%EntXVM{N1mhevI}ER9$pP z*0tgJ-jh-f5~Q*DhuHLzDQ{pnIppOy$=YAKX)o)!znXn)psEJGr2L_s@Lv;n^6(r7 z)XTbSFBy2?nf0)N{Pjv7?1Rh%>KL>8yx?EV%c0!oE)B6AxCCTiz6`-XHyoip)RzHZ z=VhYDdMHktfx2U0??Wpv4&WP7{TaAt*9h%F8xH}-9>XY(OUoS9ULy^7UXRzmh_5`Cl`2J$thO-l#j^{sed{MqWdVZ0FHtzm2$_09S^mwZVHGg+iq~>o!2mHNj zJ?ivBf;31U$FJ7QK-CqPgG@zUHQpFI=!1Q`*ghZrifu(VP~StUfd>w}#S-;IrhQO( z7)>7FF<$qDNH?(ex9u!ZXMy^+t68dcbADKLyFB8MwgU<+c_?4wvmOsE-?**CGgn$T zR%YU5I@5P}Yp!qCypG$o=`L=oI(bo?jq0`7UUIn<5L#S#>B(2mGm&#c^2i7K{{GUH z8|v%A3SXk|3st^NVPfj8Ud#M4H-0%OH>2gSo4RPyw-oh&%J0Wn+kh5?BK%yq^E#?o z@t_Y3c7s<Nbj?mV#iaBqO8PNhed{5m$05^WQl6}18@-#az6|P`UFKAi(xYV3 z=V?2qDVemLc209pawO7}(-kFcC*^d9c8*V)k~4LlnggWd%HkMkpK;XEl)0eHSGJRq zD^XD@J2{qVN=z-(Xgeu+hfGS{cRtNiqQg;cJy zqn?>^REHCVR*wsyB#S-e0+`M|yWYlFic|q68)vqiDe}TOpLCpo!6$W`;oMVQfXyEp zXL77KBbAIZIcA)3Ni1K*A=QrcV#Xc#;&j|WEIPHgLu#(l({bku7kAj~4mQZ!?oPAm?dPRMbxPVdv2L!VMC9r~1FaqyI)bcDz;KcqQ$ zTG1z`mvOE7Fh*eqVrU*N!t!v*%-^Z*(v-;IoT^R}Z=-MNU0OAL$}*lPd9L6d!2jXl zS&}x>`}8MqT*WL;r_Y}UK1yQjr*RfI6EP>Y?|$d~tJ}Sg-tLiwMNhw40o*|V=LXwD z07k6K0GuoB0RB&448WLh4}k0MK>+Vo_X9ZByhXy#w){{oS9Y}YM*E^|{r=_A-kxZ0 zbALy)8+f*JB|HD=B#lq=U3ybXq)XWntGW4T+3U|3A@IrX&)T$X?(+uc^+ai+{=1I< z?)XsoIo><(M*mCSf1LgIpyOQQ?0-Fg(d0S+V@oT5F|-Rn+xr3R_Z9%(#&e%4VGRDT`^m(g!7^<#l}K^{D!Kl!?S`H9y9UA`aWGsbvPF(khMsHDA%( z)w#KALsxUFQkLOR1CfFE7F-$rjQ{<@%Z6=y)j0V()6y7Hs#jjVj2otEEN^U&MEc9C zQ9qqNArBa`9RGi|5&z+JHU0cG6^@W&QsK Dm!0&% diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateSearchResultITest.java b/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateSearchResultITest.java deleted file mode 100644 index f0f3f867..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/LdapTemplateSearchResultITest.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright 2005-2007 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 - * - * http://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; - -import java.util.List; - -import javax.naming.Name; -import javax.naming.directory.SearchControls; - -import org.springframework.ldap.core.DistinguishedName; -import org.springframework.ldap.core.LdapTemplate; -import org.springframework.ldap.test.AttributeCheckAttributesMapper; -import org.springframework.ldap.test.AttributeCheckContextMapper; -import org.springframework.test.AbstractDependencyInjectionSpringContextTests; - -/** - * Tests for LdapTemplate's search methods. This test class tests all the - * different versions of the search methods except the generic ones covered in - * other tests. - * - * @author Mattias Arthursson - */ -public class LdapTemplateSearchResultITest extends - AbstractDependencyInjectionSpringContextTests { - - private LdapTemplate tested; - - private AttributeCheckAttributesMapper attributesMapper; - - private AttributeCheckContextMapper contextMapper; - - private static final String[] ALL_ATTRIBUTES = { "cn", "sn", "description", - "telephoneNumber" }; - - private static final String[] CN_SN_ATTRS = { "cn", "sn" }; - - private static final String[] ABSENT_ATTRIBUTES = { "description", - "telephoneNumber" }; - - private static final String[] CN_SN_VALUES = { "Some Person2", "Person2" }; - - private static final String[] ALL_VALUES = { "Some Person2", "Person2", - "Sweden, Company1, Some Person2", "+46 555-654321" }; - - private static final String BASE_STRING = ""; - - private static final String FILTER_STRING = "(&(objectclass=person)(sn=Person2))"; - - private static final Name BASE_NAME = new DistinguishedName(BASE_STRING); - - protected String[] getConfigLocations() { - return new String[] { "/conf/ldapTemplateTestContext.xml" }; - } - - protected void onSetUp() throws Exception { - super.onSetUp(); - - attributesMapper = new AttributeCheckAttributesMapper(); - contextMapper = new AttributeCheckContextMapper(); - } - - protected void onTearDown() throws Exception { - super.onTearDown(); - - attributesMapper = null; - contextMapper = null; - } - - public void testSearch_AttributesMapper() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(BASE_STRING, FILTER_STRING, attributesMapper); - assertEquals(1, list.size()); - } - - public void testSearch_SearchScope_AttributesMapper() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(BASE_STRING, FILTER_STRING, - SearchControls.SUBTREE_SCOPE, attributesMapper); - assertEquals(1, list.size()); - } - - public void testSearch_SearchScope_LimitedAttrs_AttributesMapper() { - attributesMapper.setExpectedAttributes(CN_SN_ATTRS); - attributesMapper.setExpectedValues(CN_SN_VALUES); - attributesMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); - List list = tested.search(BASE_STRING, FILTER_STRING, - SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, attributesMapper); - assertEquals(1, list.size()); - } - - public void testSearch_AttributesMapper_Name() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(BASE_NAME, FILTER_STRING, attributesMapper); - assertEquals(1, list.size()); - } - - public void testSearch_SearchScope_AttributesMapper_Name() { - attributesMapper.setExpectedAttributes(ALL_ATTRIBUTES); - attributesMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(BASE_NAME, FILTER_STRING, - SearchControls.SUBTREE_SCOPE, attributesMapper); - assertEquals(1, list.size()); - } - - public void testSearch_SearchScope_LimitedAttrs_AttributesMapper_Name() { - attributesMapper.setExpectedAttributes(CN_SN_ATTRS); - attributesMapper.setExpectedValues(CN_SN_VALUES); - attributesMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); - List list = tested.search(BASE_NAME, FILTER_STRING, - SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, attributesMapper); - assertEquals(1, list.size()); - } - - public void testSearch_ContextMapper() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(BASE_STRING, FILTER_STRING, contextMapper); - assertEquals(1, list.size()); - } - - public void testSearch_SearchScope_ContextMapper() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(BASE_STRING, FILTER_STRING, - SearchControls.SUBTREE_SCOPE, contextMapper); - assertEquals(1, list.size()); - } - - public void testSearch_SearchScope_LimitedAttrs_ContextMapper() { - contextMapper.setExpectedAttributes(CN_SN_ATTRS); - contextMapper.setExpectedValues(CN_SN_VALUES); - contextMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); - List list = tested.search(BASE_STRING, FILTER_STRING, - SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, contextMapper); - assertEquals(1, list.size()); - } - - public void testSearch_ContextMapper_Name() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(BASE_NAME, FILTER_STRING, contextMapper); - assertEquals(1, list.size()); - } - - public void testSearch_SearchScope_ContextMapper_Name() { - contextMapper.setExpectedAttributes(ALL_ATTRIBUTES); - contextMapper.setExpectedValues(ALL_VALUES); - List list = tested.search(BASE_NAME, FILTER_STRING, - SearchControls.SUBTREE_SCOPE, contextMapper); - assertEquals(1, list.size()); - } - - public void testSearch_SearchScope_LimitedAttrs_ContextMapper_Name() { - contextMapper.setExpectedAttributes(CN_SN_ATTRS); - contextMapper.setExpectedValues(CN_SN_VALUES); - contextMapper.setAbsentAttributes(ABSENT_ATTRIBUTES); - List list = tested.search(BASE_NAME, FILTER_STRING, - SearchControls.SUBTREE_SCOPE, CN_SN_ATTRS, contextMapper); - assertEquals(1, list.size()); - } - - public void setTested(LdapTemplate tested) { - this.tested = tested; - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/control/SupportedControlsITest.java b/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/control/SupportedControlsITest.java deleted file mode 100644 index 58880164..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/control/SupportedControlsITest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2005-2007 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 - * - * http://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.control; - -import java.util.Arrays; - -import org.springframework.ldap.AbstractLdapTemplateIntegrationTest; -import org.springframework.ldap.core.ContextMapper; -import org.springframework.ldap.core.DirContextAdapter; -import org.springframework.ldap.core.LdapTemplate; - -/** - * Provides tests that verify that the server supports certain controls. - * - * @author Ulrik Sandberg - */ -public class SupportedControlsITest extends AbstractLdapTemplateIntegrationTest { - /** must use a context source that has no base set */ - private LdapTemplate tested; - - private static final String SUPPORTED_CONTROL = "supportedcontrol"; - - protected String[] getConfigLocations() { - return new String[] { "/conf/rootContextSourceTestContext.xml" }; - } - - public void testExpectedControlsSupported() throws Exception { - /** - * Maps the 'supportedcontrol' attribute to a string array. - */ - ContextMapper mapper = new ContextMapper() { - - public Object mapFromContext(Object ctx) { - DirContextAdapter adapter = (DirContextAdapter) ctx; - return adapter.getStringAttributes(SUPPORTED_CONTROL); - } - - }; - - String[] controls = (String[]) tested.lookup("", - new String[] { SUPPORTED_CONTROL }, mapper); - System.out.println(Arrays.toString(controls)); - assertEquals("Persistent Search LDAPv3 control,", - "2.16.840.1.113730.3.4.3", controls[0]); - assertEquals("Entry Change Notification LDAPv3 control,", - "2.16.840.1.113730.3.4.7", controls[1]); - assertEquals("Subentries Control,", "1.3.6.1.4.1.4203.1.10.1", - controls[2]); - assertEquals("Manage DSA IT LDAPv3 control,", - "2.16.840.1.113730.3.4.2", controls[3]); - } - - public void setTested(LdapTemplate tested) { - this.tested = tested; - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/DistinguishedNameEditorITest.java b/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/DistinguishedNameEditorITest.java deleted file mode 100644 index 4450e8f8..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/DistinguishedNameEditorITest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2005-2007 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 - * - * http://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.core; - -import org.springframework.test.AbstractDependencyInjectionSpringContextTests; - -/** - * Integration tests for {@link DistinguishedNameEditor}. - * - * @author Mattias Arthursson - */ -public class DistinguishedNameEditorITest extends AbstractDependencyInjectionSpringContextTests { - - private DummyDistinguishedNameConsumer distinguishedNameConsumer; - - protected String[] getConfigLocations() { - return new String[] { "classpath:conf/distinguishedNameEditorTestContext.xml" }; - } - - public void testDistinguishedNameEditor() throws Exception { - assertNotNull(distinguishedNameConsumer); - DistinguishedName name = distinguishedNameConsumer.getDistinguishedName(); - assertEquals(new DistinguishedName("dc=jayway, dc=se"), name); - } - - public void setDistinguishedNameConsumer(DummyDistinguishedNameConsumer distinguishedNameConsumer) { - this.distinguishedNameConsumer = distinguishedNameConsumer; - } - -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/DnParsePerformanceITest.java b/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/DnParsePerformanceITest.java deleted file mode 100644 index 6573942e..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/DnParsePerformanceITest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2005-2007 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 - * - * http://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.core; - -import org.springframework.ldap.core.DistinguishedName; - -import junit.framework.Test; -import junit.framework.TestCase; - -import com.clarkware.junitperf.LoadTest; - -/** - * Performance test for the {@link DistinguishedName} class. - * - * @author Ulrik Sandberg - */ -public class DnParsePerformanceITest extends TestCase { - - public DnParsePerformanceITest(String name) { - super(name); - } - - /** - * Tests parsing and toString. - */ - public void testContains() { - - DistinguishedName migpath = new DistinguishedName("OU=G,OU=I,OU=M"); - DistinguishedName path1 = new DistinguishedName( - "cn=john.doe, OU=Users,OU=SE,OU=G,OU=I,OU=M"); - DistinguishedName path2 = new DistinguishedName( - "cn=john.doe, OU=Users,OU=SE,ou=G,OU=i,OU=M, ou=foo"); - DistinguishedName path3 = new DistinguishedName( - "ou=G,OU=i,OU=M, ou=foo"); - DistinguishedName path4 = new DistinguishedName("ou=G,OU=i,ou=m"); - - DistinguishedName pathE1 = new DistinguishedName( - "cn=john.doe, OU=Users,OU=SE,ou=G,OU=L,OU=M, ou=foo"); - DistinguishedName pathE2 = new DistinguishedName( - "cn=john.doe, OU=Users,OU=SE"); - } - - public static Test suite() { - int users = 1800; - Test testCase = new DnParsePerformanceITest("testContains"); - Test loadTest = new LoadTest(testCase, users); - return loadTest; - } - - public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); - } -} \ No newline at end of file diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/DummyDistinguishedNameConsumer.java b/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/DummyDistinguishedNameConsumer.java deleted file mode 100644 index 0b9c800d..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/DummyDistinguishedNameConsumer.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2005-2007 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 - * - * http://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.core; - -/** - * Dummy implementation of a class that has a {@link DistinguishedName} setter, - * used for testing purposes. - * - * @author Mattias Arthursson - */ -public class DummyDistinguishedNameConsumer { - private DistinguishedName distinguishedName; - - public DistinguishedName getDistinguishedName() { - return distinguishedName; - } - - public void setDistinguishedName(DistinguishedName distinguishedName) { - this.distinguishedName = distinguishedName; - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/support/BaseLdapPathBeanPostprocessorITest.java b/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/support/BaseLdapPathBeanPostprocessorITest.java deleted file mode 100644 index ea001ef6..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/support/BaseLdapPathBeanPostprocessorITest.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2005-2007 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 - * - * http://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.core.support; - -import junit.framework.TestCase; - -import org.springframework.beans.factory.BeanCreationException; -import org.springframework.beans.factory.NoSuchBeanDefinitionException; -import org.springframework.context.support.ClassPathXmlApplicationContext; -import org.springframework.ldap.core.DistinguishedName; - -/** - * Integration tests for {@link BaseLdapPathBeanPostProcessor}. - * - * @author Mattias Arthursson - */ -public class BaseLdapPathBeanPostprocessorITest extends TestCase { - - protected String[] getConfigLocations() { - return new String[] { "/conf/baseLdapPathPostProcessorTestContext.xml" }; - } - - public void testPostProcessBeforeInitialization() throws Exception { - ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext( - "/conf/baseLdapPathPostProcessorTestContext.xml"); - DummyBaseLdapPathAware tested = (DummyBaseLdapPathAware) ctx.getBean("dummyBaseContextAware"); - - DistinguishedName base = tested.getBase(); - assertNotNull(base); - assertEquals(new DistinguishedName("dc=jayway,dc=se"), base); - } - - public void testPostProcessBeforeInitializationMultipleContextSources() throws Exception { - try { - new ClassPathXmlApplicationContext("/conf/baseLdapPathPostProcessorMultiContextSourceTestContext.xml"); - fail("BeanCreationException expected"); - } - catch (BeanCreationException expected) { - Throwable cause = expected.getCause(); - assertTrue(cause instanceof NoSuchBeanDefinitionException); - } - } - - public void testPostProcessBeforeInitializationMultipleContextSourcesOneSpecified() throws Exception { - ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext( - "/conf/baseLdapPathPostProcessorMultiContextSourceOneSpecTestContext.xml"); - DummyBaseLdapPathAware tested = (DummyBaseLdapPathAware) ctx.getBean("dummyBaseContextAware"); - - DistinguishedName base = tested.getBase(); - assertNotNull(base); - assertEquals(new DistinguishedName("cn=john doe,dc=jayway,dc=se"), base); - } - - public void testPostProcessBeforeInitializationNoContextSource() throws Exception { - try { - new ClassPathXmlApplicationContext("/conf/baseLdapPathPostProcessorNoContextSourceTestContext.xml"); - fail("BeanCreationException expected"); - } - catch (BeanCreationException expected) { - Throwable cause = expected.getCause(); - assertTrue(cause instanceof NoSuchBeanDefinitionException); - } - } - - public void testPostProcessBeforeInitializationBaseSetInProperty() throws Exception { - ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext( - "/conf/baseLdapPathPostProcessorPropertyOverrideTestContext.xml"); - DummyBaseLdapPathAware tested = (DummyBaseLdapPathAware) ctx.getBean("dummyBaseContextAware"); - - DistinguishedName base = tested.getBase(); - assertNotNull(base); - assertEquals(new DistinguishedName("cn=john doe"), base); - } - - public void testPostProcessBeforeInitializationTransactionProxy() throws Exception { - ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext( - "/conf/baseLdapPathPostProcessorTransactionTestContext.xml"); - DummyBaseLdapPathAware tested = (DummyBaseLdapPathAware) ctx.getBean("dummyBaseContextAware"); - - DistinguishedName base = tested.getBase(); - assertNotNull(base); - assertEquals(new DistinguishedName("dc=jayway,dc=se"), base); - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/support/DummyBaseLdapPathAware.java b/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/support/DummyBaseLdapPathAware.java deleted file mode 100644 index 443980b3..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/support/DummyBaseLdapPathAware.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2005-2007 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 - * - * http://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.core.support; - -import org.springframework.ldap.core.DistinguishedName; - -/** - * Dummy implementation of {@link BaseLdapPathAware}. - * - * @author Mattias Arthursson - */ -public class DummyBaseLdapPathAware implements BaseLdapPathAware { - - private DistinguishedName base; - - public void setBaseLdapPath(DistinguishedName baseLdapPath) { - this.base = baseLdapPath; - } - - public DistinguishedName getBase() { - return base; - } - -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/support/LdapContextSourcelITest.java b/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/support/LdapContextSourcelITest.java deleted file mode 100644 index d1f5df7c..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/support/LdapContextSourcelITest.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2005-2007 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 - * - * http://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.core.support; - -import java.util.Hashtable; - -import javax.naming.Context; -import javax.naming.NamingException; -import javax.naming.directory.DirContext; - -import org.springframework.ldap.core.ContextSource; -import org.springframework.test.AbstractDependencyInjectionSpringContextTests; - -/** - * Integration tests for ContextSourceImpl. - * - * @author Mattias Arthursson - */ -public class LdapContextSourcelITest extends - AbstractDependencyInjectionSpringContextTests { - - private ContextSource tested; - - protected String[] getConfigLocations() { - return new String[] { "/conf/ldapTemplateTestContext.xml" }; - } - - public void testGetReadOnlyContext() throws NamingException { - DirContext ctx = null; - - try { - ctx = tested.getReadOnlyContext(); - assertNotNull(ctx); - Hashtable environment = ctx.getEnvironment(); - assertTrue(environment - .containsKey(LdapContextSource.SUN_LDAP_POOLING_FLAG)); - assertTrue(environment.containsKey(Context.SECURITY_PRINCIPAL)); - assertTrue(environment.containsKey(Context.SECURITY_CREDENTIALS)); - } finally { - // Always clean up. - if (ctx != null) { - try { - ctx.close(); - } catch (Exception e) { - // Never mind this - } - } - } - } - - public void testGetReadWriteContext() throws NamingException { - DirContext ctx = null; - - try { - ctx = tested.getReadWriteContext(); - assertNotNull(ctx); - // Double check to see that we are authenticated. - Hashtable environment = ctx.getEnvironment(); - assertTrue(environment.containsKey(Context.SECURITY_PRINCIPAL)); - assertTrue(environment.containsKey(Context.SECURITY_CREDENTIALS)); - } finally { - // Always clean up. - if (ctx != null) { - try { - ctx.close(); - } catch (Exception e) { - // Never mind this - } - } - } - } - - public void setTested(ContextSource tested) { - this.tested = tested; - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/support/LdapContextSourcelMultiServerITest.java b/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/support/LdapContextSourcelMultiServerITest.java deleted file mode 100644 index caec3a68..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/core/support/LdapContextSourcelMultiServerITest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2005-2007 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 - * - * http://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.core.support; - -import javax.naming.NamingException; - -import org.springframework.test.AbstractDependencyInjectionSpringContextTests; - -/** - * Integration tests for ContextSourceImpl. - * - * @author Mattias Arthursson - */ -public class LdapContextSourcelMultiServerITest extends - AbstractDependencyInjectionSpringContextTests { - - private LdapContextSource tested; - - protected String[] getConfigLocations() { - return new String[] { "/conf/ldapContextSourceTestContext.xml" }; - } - - public void testUrls() throws NamingException { - String[] urls = tested.getUrls(); - String string = tested.assembleProviderUrlString(urls); - - assertEquals("ldap://127.0.0.1:389 ldap://127.0.0.2:389", string); - } - - public void setTested(LdapContextSource tested) { - this.tested = tested; - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceAndDataSourceTransactionManagerIntegrationTest.java b/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceAndDataSourceTransactionManagerIntegrationTest.java deleted file mode 100644 index ee844529..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceAndDataSourceTransactionManagerIntegrationTest.java +++ /dev/null @@ -1,371 +0,0 @@ -/* - * Copyright 2005-2007 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 - * - * http://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.transaction.compensating.manager; - -import java.sql.ResultSet; -import java.sql.SQLException; - -import javax.naming.NamingException; -import javax.naming.directory.Attributes; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.dao.EmptyResultDataAccessException; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.RowMapper; -import org.springframework.ldap.NameNotFoundException; -import org.springframework.ldap.core.AttributesMapper; -import org.springframework.ldap.core.LdapTemplate; -import org.springframework.test.AbstractDependencyInjectionSpringContextTests; -import org.springframework.transaction.support.TransactionSynchronizationManager; - -/** - * Integration tests for {@link ContextSourceAndDataSourceTransactionManager}. - * - * @author Mattias Arthursson - */ -public class ContextSourceAndDataSourceTransactionManagerIntegrationTest extends - AbstractDependencyInjectionSpringContextTests { - - private static Log log = LogFactory - .getLog(ContextSourceAndDataSourceTransactionManagerIntegrationTest.class); - - private DummyDao dummyDao; - - private LdapTemplate ldapTemplate; - - private JdbcTemplate jdbcTemplate; - - public ContextSourceAndDataSourceTransactionManagerIntegrationTest() { - setAutowireMode(AbstractDependencyInjectionSpringContextTests.AUTOWIRE_BY_NAME); - } - - public void setLdapTemplate(LdapTemplate ldapTemplate) { - this.ldapTemplate = ldapTemplate; - } - - public void setDummyDao(DummyDao dummyDaoImpl) { - this.dummyDao = dummyDaoImpl; - } - - protected String[] getConfigLocations() { - return new String[] { "conf/ldapAndJdbcTransactionTestContext.xml" }; - } - - protected void onSetUp() throws Exception { - if (TransactionSynchronizationManager.isSynchronizationActive()) { - TransactionSynchronizationManager.clearSynchronization(); - } - - jdbcTemplate - .execute("create table PERSON(fullname VARCHAR, lastname VARCHAR, description VARCHAR)"); - jdbcTemplate.update("insert into PERSON values(?, ?, ?)", new Object[] { - "Some Person", "Person", "Sweden, Company1, Some Person" }); - } - - protected void onTearDown() throws Exception { - jdbcTemplate.execute("drop table PERSON"); - } - - public void testCreateWithException() { - try { - dummyDao.createWithException("Sweden", "company1", - "some testperson", "testperson", "some description"); - fail("DummyException expected"); - } catch (DummyException expected) { - assertTrue(true); - } - - log.debug("Verifying result"); - - // Verify that no entry was created - try { - ldapTemplate.lookup("cn=some testperson, ou=company1, c=Sweden"); - fail("NameNotFoundException expected"); - } catch (NameNotFoundException expected) { - assertTrue(true); - } - - try { - jdbcTemplate.queryForObject( - "select * from PERSON where fullname='some testperson'", - new RowMapper() { - public Object mapRow(ResultSet rs, int rowNum) - throws SQLException { - return null; - } - }); - fail("EmptyResultDataAccessException expected"); - } catch (EmptyResultDataAccessException expected) { - assertTrue(true); - } - } - - public void testCreate() { - dummyDao.create("Sweden", "company1", "some testperson", "testperson", - "some description"); - - log.debug("Verifying result"); - Object ldapResult = ldapTemplate - .lookup("cn=some testperson, ou=company1, c=Sweden"); - Object dbResult = jdbcTemplate.queryForObject( - "select * from PERSON where fullname='some testperson'", - new RowMapper() { - public Object mapRow(ResultSet rs, int rowNum) - throws SQLException { - return new Object(); - } - }); - assertNotNull(ldapResult); - assertNotNull(dbResult); - - ldapTemplate.unbind("cn=some testperson, ou=company1, c=Sweden"); - } - - public void testUpdateWithException() { - String dn = "cn=Some Person,ou=company1,c=Sweden"; - try { - dummyDao.updateWithException(dn, "Some Person", "Updated Person", - "Updated description"); - fail("DummyException expected"); - } catch (DummyException expected) { - assertTrue(true); - } - - log.debug("Verifying result"); - - Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() { - public Object mapFromAttributes(Attributes attributes) - throws NamingException { - assertEquals("Person", attributes.get("sn").get()); - assertEquals("Sweden, Company1, Some Person", attributes.get( - "description").get()); - return new Object(); - } - }); - - Object jdbcResult = jdbcTemplate.queryForObject( - "select * from PERSON where fullname=?", - new Object[] { "Some Person" }, new RowMapper() { - public Object mapRow(ResultSet rs, int rowNum) - throws SQLException { - assertEquals("Person", rs.getString("lastname")); - assertEquals("Sweden, Company1, Some Person", rs - .getString("description")); - return new Object(); - } - }); - - assertNotNull(ldapResult); - assertNotNull(jdbcResult); - } - - public void testUpdate() { - String dn = "cn=Some Person,ou=company1,c=Sweden"; - dummyDao.update(dn, "Some Person", "Updated Person", - "Updated description"); - - log.debug("Verifying result"); - Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() { - public Object mapFromAttributes(Attributes attributes) - throws NamingException { - assertEquals("Updated Person", attributes.get("sn").get()); - assertEquals("Updated description", attributes.get( - "description").get()); - return new Object(); - } - }); - - Object jdbcResult = jdbcTemplate.queryForObject( - "select * from PERSON where fullname=?", - new Object[] { "Some Person" }, new RowMapper() { - public Object mapRow(ResultSet rs, int rowNum) - throws SQLException { - assertEquals("Updated Person", rs.getString("lastname")); - assertEquals("Updated description", rs - .getString("description")); - return new Object(); - } - }); - - assertNotNull(ldapResult); - assertNotNull(jdbcResult); - dummyDao.update(dn, "Some Person", "Person", - "Sweden, Company1, Some Person"); - } - - public void testUpdateAndRenameWithException() { - String dn = "cn=Some Person2,ou=company1,c=Sweden"; - String newDn = "cn=Some Person2,ou=company2,c=Sweden"; - try { - // Perform test - dummyDao.updateAndRenameWithException(dn, newDn, - "Updated description"); - fail("DummyException expected"); - } catch (DummyException expected) { - assertTrue(true); - } - - // Verify that entry was not moved. - try { - ldapTemplate.lookup(newDn); - fail("NameNotFoundException expected"); - } catch (NameNotFoundException expected) { - assertTrue(true); - } - - // Verify that original entry was not updated. - Object object = ldapTemplate.lookup(dn, new AttributesMapper() { - public Object mapFromAttributes(Attributes attributes) - throws NamingException { - assertEquals("Sweden, Company1, Some Person2", attributes.get( - "description").get()); - return new Object(); - } - }); - assertNotNull(object); - } - - public void testUpdateAndRename() { - String dn = "cn=Some Person2,ou=company1,c=Sweden"; - String newDn = "cn=Some Person2,ou=company2,c=Sweden"; - // Perform test - dummyDao.updateAndRename(dn, newDn, "Updated description"); - - // Verify that entry was moved and updated. - Object object = ldapTemplate.lookup(newDn, new AttributesMapper() { - public Object mapFromAttributes(Attributes attributes) - throws NamingException { - assertEquals("Updated description", attributes.get( - "description").get()); - return new Object(); - } - }); - - assertNotNull(object); - dummyDao.updateAndRename(newDn, dn, "Sweden, Company1, Some Person2"); - } - - public void testModifyAttributesWithException() { - String dn = "cn=Some Person,ou=company1,c=Sweden"; - try { - // Perform test - dummyDao.modifyAttributesWithException(dn, "Updated lastname", - "Updated description"); - fail("DummyException expected"); - } catch (DummyException expected) { - assertTrue(true); - } - - // Verify result - check that the operation was properly rolled back - Object result = ldapTemplate.lookup(dn, new AttributesMapper() { - public Object mapFromAttributes(Attributes attributes) - throws NamingException { - assertEquals("Person", attributes.get("sn").get()); - assertEquals("Sweden, Company1, Some Person", attributes.get( - "description").get()); - return new Object(); - } - }); - - assertNotNull(result); - } - - public void testModifyAttributes() { - String dn = "cn=Some Person,ou=company1,c=Sweden"; - // Perform test - dummyDao - .modifyAttributes(dn, "Updated lastname", "Updated description"); - - // Verify result - check that the operation was not rolled back - Object result = ldapTemplate.lookup(dn, new AttributesMapper() { - public Object mapFromAttributes(Attributes attributes) - throws NamingException { - assertEquals("Updated lastname", attributes.get("sn").get()); - assertEquals("Updated description", attributes.get( - "description").get()); - return new Object(); - } - }); - - assertNotNull(result); - } - - public void testUnbindWithException() { - String dn = "cn=Some Person,ou=company1,c=Sweden"; - try { - // Perform test - dummyDao.unbindWithException(dn, "Some Person"); - fail("DummyException expected"); - } catch (DummyException expected) { - assertTrue(true); - } - - // Verify result - check that the operation was properly rolled back - Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() { - public Object mapFromAttributes(Attributes attributes) - throws NamingException { - // Just verify that the entry still exists. - return new Object(); - } - }); - - Object jdbcResult = jdbcTemplate.queryForObject( - "select * from PERSON where fullname=?", - new Object[] { "Some Person" }, new RowMapper() { - public Object mapRow(ResultSet rs, int rowNum) - throws SQLException { - // Just verify that the entry still exists. - return new Object(); - } - }); - - assertNotNull(ldapResult); - assertNotNull(jdbcResult); - } - - public void testUnbind() { - String dn = "cn=Some Person,ou=company1,c=Sweden"; - // Perform test - dummyDao.unbind(dn, "Some Person"); - - try { - // Verify result - check that the operation was not rolled back - ldapTemplate.lookup(dn); - fail("NameNotFoundException expected"); - } catch (NameNotFoundException expected) { - assertTrue(true); - } - - try { - jdbcTemplate.queryForObject( - "select * from PERSON where fullname=?", - new Object[] { "Some Person" }, new RowMapper() { - public Object mapRow(ResultSet rs, int rowNum) - throws SQLException { - return null; - } - }); - fail("EmptyResultDataAccessException expected"); - } catch (EmptyResultDataAccessException expected) { - assertTrue(true); - } - } - - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceTransactionManagerIntegrationTest.java b/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceTransactionManagerIntegrationTest.java deleted file mode 100644 index aaf94e12..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceTransactionManagerIntegrationTest.java +++ /dev/null @@ -1,281 +0,0 @@ -/* - * Copyright 2005-2007 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 - * - * http://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.transaction.compensating.manager; - -import javax.naming.NamingException; -import javax.naming.directory.Attributes; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.ldap.NameNotFoundException; -import org.springframework.ldap.core.AttributesMapper; -import org.springframework.ldap.core.LdapTemplate; -import org.springframework.test.AbstractDependencyInjectionSpringContextTests; -import org.springframework.transaction.support.TransactionSynchronizationManager; - -/** - * Integration tests for {@link ContextSourceAndDataSourceTransactionManager}. - * - * @author Mattias Arthursson - */ -public class ContextSourceTransactionManagerIntegrationTest extends - AbstractDependencyInjectionSpringContextTests { - - private static Log log = LogFactory - .getLog(ContextSourceTransactionManagerIntegrationTest.class); - - public ContextSourceTransactionManagerIntegrationTest() { - setAutowireMode(AbstractDependencyInjectionSpringContextTests.AUTOWIRE_BY_NAME); - } - - private DummyDao dummyDao; - - private LdapTemplate ldapTemplate; - - public void setLdapTemplate(LdapTemplate ldapTemplate) { - this.ldapTemplate = ldapTemplate; - } - - public void setDummyDao(DummyDao dummyDaoImpl) { - this.dummyDao = dummyDaoImpl; - } - - protected String[] getConfigLocations() { - return new String[] { "conf/ldapTemplateTransactionTestContext.xml" }; - } - - protected void onSetUp() throws Exception { - if (TransactionSynchronizationManager.isSynchronizationActive()) { - TransactionSynchronizationManager.clearSynchronization(); - } - } - - protected void onTearDown() throws Exception { - } - - public void testCreateWithException() { - try { - dummyDao.createWithException("Sweden", "company1", - "some testperson", "testperson", "some description"); - fail("DummyException expected"); - } catch (DummyException expected) { - assertTrue(true); - } - - log.debug("Verifying result"); - - // Verify that no entry was created - try { - ldapTemplate.lookup("cn=some testperson, ou=company1, c=Sweden"); - fail("NameNotFoundException expected"); - } catch (NameNotFoundException expected) { - assertTrue(true); - } - } - - public void testCreate() { - dummyDao.create("Sweden", "company1", "some testperson", "testperson", - "some description"); - - log.debug("Verifying result"); - String expectedDn = "cn=some testperson, ou=company1, c=Sweden"; - Object ldapResult = ldapTemplate.lookup(expectedDn); - assertNotNull(ldapResult); - - ldapTemplate.unbind(expectedDn); - } - - public void testUpdateWithException() { - String dn = "cn=Some Person,ou=company1,c=Sweden"; - try { - dummyDao.updateWithException(dn, "Some Person", "Updated Person", - "Updated description"); - fail("DummyException expected"); - } catch (DummyException expected) { - assertTrue(true); - } - - log.debug("Verifying result"); - - Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() { - public Object mapFromAttributes(Attributes attributes) - throws NamingException { - assertEquals("Person", attributes.get("sn").get()); - assertEquals("Sweden, Company1, Some Person", attributes.get( - "description").get()); - return new Object(); - } - }); - - assertNotNull(ldapResult); - } - - public void testUpdate() { - String dn = "cn=Some Person,ou=company1,c=Sweden"; - dummyDao.update(dn, "Some Person", "Updated Person", - "Updated description"); - - log.debug("Verifying result"); - Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() { - public Object mapFromAttributes(Attributes attributes) - throws NamingException { - assertEquals("Updated Person", attributes.get("sn").get()); - assertEquals("Updated description", attributes.get( - "description").get()); - return new Object(); - } - }); - - assertNotNull(ldapResult); - - dummyDao.update(dn, "Some Person", "Person", - "Sweden, Company1, Some Person"); - } - - public void testUpdateAndRenameWithException() { - String dn = "cn=Some Person2,ou=company1,c=Sweden"; - String newDn = "cn=Some Person2,ou=company2,c=Sweden"; - try { - // Perform test - dummyDao.updateAndRenameWithException(dn, newDn, - "Updated description"); - fail("DummyException expected"); - } catch (DummyException expected) { - assertTrue(true); - } - - // Verify that entry was not moved. - try { - ldapTemplate.lookup(newDn); - fail("NameNotFoundException expected"); - } catch (NameNotFoundException expected) { - assertTrue(true); - } - - // Verify that original entry was not updated. - Object object = ldapTemplate.lookup(dn, new AttributesMapper() { - public Object mapFromAttributes(Attributes attributes) - throws NamingException { - assertEquals("Sweden, Company1, Some Person2", attributes.get( - "description").get()); - return new Object(); - } - }); - assertNotNull(object); - } - - public void testUpdateAndRename() { - String dn = "cn=Some Person2,ou=company1,c=Sweden"; - String newDn = "cn=Some Person2,ou=company2,c=Sweden"; - // Perform test - dummyDao.updateAndRename(dn, newDn, "Updated description"); - - // Verify that entry was moved and updated. - Object object = ldapTemplate.lookup(newDn, new AttributesMapper() { - public Object mapFromAttributes(Attributes attributes) - throws NamingException { - assertEquals("Updated description", attributes.get( - "description").get()); - return new Object(); - } - }); - - assertNotNull(object); - dummyDao.updateAndRename(newDn, dn, "Sweden, Company1, Some Person2"); - } - - public void testModifyAttributesWithException() { - String dn = "cn=Some Person,ou=company1,c=Sweden"; - try { - // Perform test - dummyDao.modifyAttributesWithException(dn, "Updated lastname", - "Updated description"); - fail("DummyException expected"); - } catch (DummyException expected) { - assertTrue(true); - } - - // Verify result - check that the operation was properly rolled back - Object result = ldapTemplate.lookup(dn, new AttributesMapper() { - public Object mapFromAttributes(Attributes attributes) - throws NamingException { - assertEquals("Person", attributes.get("sn").get()); - assertEquals("Sweden, Company1, Some Person", attributes.get( - "description").get()); - return new Object(); - } - }); - - assertNotNull(result); - } - - public void testModifyAttributes() { - String dn = "cn=Some Person,ou=company1,c=Sweden"; - // Perform test - dummyDao - .modifyAttributes(dn, "Updated lastname", "Updated description"); - - // Verify result - check that the operation was not rolled back - Object result = ldapTemplate.lookup(dn, new AttributesMapper() { - public Object mapFromAttributes(Attributes attributes) - throws NamingException { - assertEquals("Updated lastname", attributes.get("sn").get()); - assertEquals("Updated description", attributes.get( - "description").get()); - return new Object(); - } - }); - - assertNotNull(result); - } - - public void testUnbindWithException() { - String dn = "cn=Some Person,ou=company1,c=Sweden"; - try { - // Perform test - dummyDao.unbindWithException(dn, "Some Person"); - fail("DummyException expected"); - } catch (DummyException expected) { - assertTrue(true); - } - - // Verify result - check that the operation was properly rolled back - Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() { - public Object mapFromAttributes(Attributes attributes) - throws NamingException { - // Just verify that the entry still exists. - return new Object(); - } - }); - - assertNotNull(ldapResult); - } - - public void testUnbind() { - String dn = "cn=Some Person,ou=company1,c=Sweden"; - // Perform test - dummyDao.unbind(dn, "Some Person"); - - try { - // Verify result - check that the operation was not rolled back - ldapTemplate.lookup(dn); - fail("NameNotFoundException expected"); - } catch (NameNotFoundException expected) { - assertTrue(true); - } - - } -} diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/setup_data.ldif b/mvn-build/integration-tests/core-integration-tests/src/test/java/setup_data.ldif deleted file mode 100644 index 885a8ca4..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/java/setup_data.ldif +++ /dev/null @@ -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 diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/teardown_data.ldif b/mvn-build/integration-tests/core-integration-tests/src/test/java/teardown_data.ldif deleted file mode 100644 index f6ada1b2..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/java/teardown_data.ldif +++ /dev/null @@ -1,5 +0,0 @@ -ou=groups,dc=jayway,dc=se - -c=Sweden,dc=jayway,dc=se - -c=Norway,dc=jayway,dc=se diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/apacheDsContext.xml b/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/apacheDsContext.xml deleted file mode 100644 index 6620b80d..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/apacheDsContext.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - simple - - - ${userDn} - - - ${password} - - - - - - - - - - - - - - - - - - - - - objectClass: top - objectClass: domain - objectClass: extensibleObject - dc: jayway - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/baseLdapPathPostProcessorMultiContextSourceOneSpecTestContext.xml b/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/baseLdapPathPostProcessorMultiContextSourceOneSpecTestContext.xml deleted file mode 100644 index 2d312a68..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/baseLdapPathPostProcessorMultiContextSourceOneSpecTestContext.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/baseLdapPathPostProcessorMultiContextSourceTestContext.xml b/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/baseLdapPathPostProcessorMultiContextSourceTestContext.xml deleted file mode 100644 index 1a1d104c..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/baseLdapPathPostProcessorMultiContextSourceTestContext.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/baseLdapPathPostProcessorNoContextSourceTestContext.xml b/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/baseLdapPathPostProcessorNoContextSourceTestContext.xml deleted file mode 100644 index 52798e86..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/baseLdapPathPostProcessorNoContextSourceTestContext.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/baseLdapPathPostProcessorPropertyOverrideTestContext.xml b/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/baseLdapPathPostProcessorPropertyOverrideTestContext.xml deleted file mode 100644 index 8b42a613..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/baseLdapPathPostProcessorPropertyOverrideTestContext.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/baseLdapPathPostProcessorTestContext.xml b/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/baseLdapPathPostProcessorTestContext.xml deleted file mode 100644 index 49a67621..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/baseLdapPathPostProcessorTestContext.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/baseLdapPathPostProcessorTransactionTestContext.xml b/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/baseLdapPathPostProcessorTransactionTestContext.xml deleted file mode 100644 index 066e6a58..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/baseLdapPathPostProcessorTransactionTestContext.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/commonTestContext.xml b/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/commonTestContext.xml deleted file mode 100644 index a71c074e..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/commonTestContext.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/distinguishedNameEditorTestContext.xml b/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/distinguishedNameEditorTestContext.xml deleted file mode 100644 index 86f40c59..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/distinguishedNameEditorTestContext.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldap.properties b/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldap.properties deleted file mode 100644 index 8843f1f1..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldap.properties +++ /dev/null @@ -1,4 +0,0 @@ -urls=ldap://127.0.0.1:3900 -userDn=uid=admin,ou=system -password=secret -base=dc=jayway,dc=se diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapAndJdbcTransactionTestContext.xml b/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapAndJdbcTransactionTestContext.xml deleted file mode 100644 index abaaab86..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapAndJdbcTransactionTestContext.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PROPAGATION_REQUIRES_NEW - - - - diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapContextSourceTestContext.xml b/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapContextSourceTestContext.xml deleted file mode 100644 index 2adc5219..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapContextSourceTestContext.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapTemplateAcegiTestContext.xml b/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapTemplateAcegiTestContext.xml deleted file mode 100644 index a7ba9c2c..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapTemplateAcegiTestContext.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapTemplateNoBaseSuffixTestContext.xml b/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapTemplateNoBaseSuffixTestContext.xml deleted file mode 100644 index 312b761f..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapTemplateNoBaseSuffixTestContext.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapTemplateObjectBindTestContext.xml b/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapTemplateObjectBindTestContext.xml deleted file mode 100644 index f67e95d5..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapTemplateObjectBindTestContext.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapTemplateTestContext.xml b/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapTemplateTestContext.xml deleted file mode 100644 index 3c85161c..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapTemplateTestContext.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapTemplateTransactionTestContext.xml b/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapTemplateTransactionTestContext.xml deleted file mode 100644 index 8b111f02..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/ldapTemplateTransactionTestContext.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PROPAGATION_REQUIRES_NEW - - - - diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/rootContextSourceTestContext.xml b/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/rootContextSourceTestContext.xml deleted file mode 100644 index 13cc7894..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/resources/conf/rootContextSourceTestContext.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/resources/log4j.properties b/mvn-build/integration-tests/core-integration-tests/src/test/resources/log4j.properties deleted file mode 100644 index 12c4b1c8..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/resources/log4j.properties +++ /dev/null @@ -1,6 +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 - -log4j.logger.org.apache.directory.server.schema.registries.DefaultSyntaxRegistry=WARN \ No newline at end of file diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/resources/setup_data.ldif b/mvn-build/integration-tests/core-integration-tests/src/test/resources/setup_data.ldif deleted file mode 100644 index 885a8ca4..00000000 --- a/mvn-build/integration-tests/core-integration-tests/src/test/resources/setup_data.ldif +++ /dev/null @@ -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