diff --git a/core/src/test/java/org/springframework/ldap/configuration/LdapNamespaceConfigPoolingTestSpecified.java b/core/src/test/java/org/springframework/ldap/configuration/LdapNamespaceConfigPoolingTestSpecified.java new file mode 100644 index 0000000000..9be9256c62 --- /dev/null +++ b/core/src/test/java/org/springframework/ldap/configuration/LdapNamespaceConfigPoolingTestSpecified.java @@ -0,0 +1,36 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import javax.naming.directory.SearchControls; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class LdapNamespaceConfigPoolingTestSpecified { + + + @Bean("searchControls") + public SearchControls searchControls() { + return new SearchControls(); + } + +} diff --git a/core/src/test/resources/ldap-namespace-config-pool2-configured-poolsize.xml b/core/src/test/resources/ldap-namespace-config-pool2-configured-poolsize.xml index 8947bcd453..bba4369c55 100644 --- a/core/src/test/resources/ldap-namespace-config-pool2-configured-poolsize.xml +++ b/core/src/test/resources/ldap-namespace-config-pool2-configured-poolsize.xml @@ -1,7 +1,11 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ldap="http://www.springframework.org/schema/ldap" + xsi:schemaLocation="http://www.springframework.org/schema/beans + https://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/ldap + https://www.springframework.org/schema/ldap/spring-ldap.xsd"> - - - - - - - - - - \ No newline at end of file + xsi:schemaLocation="http://www.springframework.org/schema/beans + https://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/ldap + https://www.springframework.org/schema/ldap/spring-ldap.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context.xsd" + xmlns:context="http://www.springframework.org/schema/context"> + + + + + + + diff --git a/ldif/ldif-batch/build.gradle b/ldif/ldif-batch/build.gradle index d2a90ad623..fe1e817796 100644 --- a/ldif/ldif-batch/build.gradle +++ b/ldif/ldif-batch/build.gradle @@ -9,9 +9,11 @@ dependencies { exclude group: "org.springframework", module: "spring-aop" } + testCompile "junit:junit:$junitVersion", "org.springframework:spring-context:$springVersion", "org.springframework:spring-aop:$springVersion", + "org.springframework:spring-orm:${springVersion}", "org.springframework:spring-test:$springVersion", "org.assertj:assertj-core:$assertjVersion" diff --git a/ldif/ldif-batch/src/test/java/org/springframework/ldap/configuration/Batch20ApplicationContextTest2.java b/ldif/ldif-batch/src/test/java/org/springframework/ldap/configuration/Batch20ApplicationContextTest2.java new file mode 100644 index 0000000000..7705990bbc --- /dev/null +++ b/ldif/ldif-batch/src/test/java/org/springframework/ldap/configuration/Batch20ApplicationContextTest2.java @@ -0,0 +1,99 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.batch.core.launch.support.SimpleJobLauncher; +import org.springframework.batch.core.repository.JobRepository; +import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean; +import org.springframework.batch.item.file.FlatFileItemWriter; +import org.springframework.batch.support.transaction.ResourcelessTransactionManager; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.FileSystemResource; +import org.springframework.core.task.SyncTaskExecutor; +import org.springframework.ldap.ldif.batch.LdifAggregator; +import org.springframework.ldap.ldif.batch.MappingLdifReader; +import org.springframework.ldap.ldif.batch.MyMapper; + + +/** + * Generated Java based configuration + */ +@Configuration +public class Batch20ApplicationContextTest2 { + + + @Bean("itemReader1") + public MappingLdifReader itemReader1(@Qualifier("recordMapper") + MyMapper recordMapper) { + MappingLdifReader bean = new MappingLdifReader(); + bean.setResource(new FileSystemResource("src/test/resources/test.ldif")); + bean.setRecordsToSkip(1); + bean.setRecordMapper(recordMapper); + return bean; + } + + @Bean("taskExecutor") + public SyncTaskExecutor taskExecutor() { + return new SyncTaskExecutor(); + } + + @Bean("jobLauncher") + public SimpleJobLauncher jobLauncher( + @Qualifier("jobRepository") + MapJobRepositoryFactoryBean jobRepository, + @Qualifier("taskExecutor") + SyncTaskExecutor taskExecutor) throws Exception { + SimpleJobLauncher bean = new SimpleJobLauncher(); + bean.setJobRepository((JobRepository) jobRepository.getObject()); + bean.setTaskExecutor(taskExecutor); + return bean; + } + + @Bean("itemReader2") + public MappingLdifReader itemReader2( + @Qualifier("recordMapper") + MyMapper recordMapper) { + MappingLdifReader bean = new MappingLdifReader(); + bean.setResource(new FileSystemResource("src/test/resources/missing.ldif")); + bean.setRecordsToSkip(1); + bean.setRecordMapper(recordMapper); + return bean; + } + + @Bean("itemWriter") + public FlatFileItemWriter itemWriter() { + FlatFileItemWriter bean = new FlatFileItemWriter(); + bean.setResource(new FileSystemResource("target/test-outputs/output.ldif")); + bean.setLineAggregator(new LdifAggregator()); + return bean; + } + + @Bean("jobRepository") + public MapJobRepositoryFactoryBean jobRepository( + @Qualifier("transactionManager") ResourcelessTransactionManager transactionManager) { + MapJobRepositoryFactoryBean bean = new MapJobRepositoryFactoryBean(); + bean.setTransactionManager(transactionManager); + return bean; + } + + @Bean("recordMapper") + public MyMapper recordMapper() { + return new MyMapper(); + } + +} diff --git a/ldif/ldif-batch/src/test/resources/batch20-applicationContext-test2.xml b/ldif/ldif-batch/src/test/resources/batch20-applicationContext-test2.xml index ef175e0278..108b4237f4 100644 --- a/ldif/ldif-batch/src/test/resources/batch20-applicationContext-test2.xml +++ b/ldif/ldif-batch/src/test/resources/batch20-applicationContext-test2.xml @@ -1,57 +1,33 @@ - - - - - - - - org.springframework.ldap.ldif.InvalidAttributeFormatException - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + org.springframework.ldap.ldif.InvalidAttributeFormatException + + + + + + + + + + + + + diff --git a/samples/odm/src/main/java/org/springframework/ldap/configuration/ApplicationContext.java b/samples/odm/src/main/java/org/springframework/ldap/configuration/ApplicationContext.java new file mode 100644 index 0000000000..e90e21e9fc --- /dev/null +++ b/samples/odm/src/main/java/org/springframework/ldap/configuration/ApplicationContext.java @@ -0,0 +1,50 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.ldap.core.LdapTemplate; +import org.springframework.ldap.samples.odm.dao.OdmPersonDaoImpl; +import org.springframework.ldap.samples.utils.LdapTreeBuilder; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class ApplicationContext { + + + @Bean("personDao") + public OdmPersonDaoImpl personDao( + @Qualifier("ldapTemplate") + LdapTemplate ldapTemplate) { + OdmPersonDaoImpl bean = new OdmPersonDaoImpl(); + bean.setLdapTemplate(ldapTemplate); + return bean; + } + + @Bean("ldapTreeBuilder") + public LdapTreeBuilder ldapTreeBuilder( + @Qualifier("ldapTemplate") + LdapTemplate ldapTemplate) { + return new LdapTreeBuilder(ldapTemplate); + } + +} diff --git a/samples/odm/src/main/resources/applicationContext.xml b/samples/odm/src/main/resources/applicationContext.xml index 002219b3a2..180518bffa 100644 --- a/samples/odm/src/main/resources/applicationContext.xml +++ b/samples/odm/src/main/resources/applicationContext.xml @@ -3,57 +3,46 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:ldap="http://www.springframework.org/schema/ldap" - xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/ldap https://www.springframework.org/schema/ldap/spring-ldap.xsd"> - - - + xsi:schemaLocation="http://www.springframework.org/schema/beans + https://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/context + https://www.springframework.org/schema/context/spring-context.xsd + http://www.springframework.org/schema/ldap + https://www.springframework.org/schema/ldap/spring-ldap.xsd"> + + + - + base="${sample.ldap.base}"/> - - - - - - - - - - - - - - - - - + + + + + + + - - - + - - + + - - - + - - - - - + + + + + diff --git a/samples/odm/src/main/webapp/WEB-INF/basic-servlet.xml b/samples/odm/src/main/webapp/WEB-INF/basic-servlet.xml index 8b8b1a71c7..73be38b247 100644 --- a/samples/odm/src/main/webapp/WEB-INF/basic-servlet.xml +++ b/samples/odm/src/main/webapp/WEB-INF/basic-servlet.xml @@ -1,17 +1,12 @@ - - - - - - - - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:context="http://www.springframework.org/schema/context" + xsi:schemaLocation="http://www.springframework.org/schema/beans + https://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/context + https://www.springframework.org/schema/context/spring-context.xsd"> + + + diff --git a/samples/odm/src/main/webapp/WEB-INF/org/springframework/ldap/configuration/BasicServlet.java b/samples/odm/src/main/webapp/WEB-INF/org/springframework/ldap/configuration/BasicServlet.java new file mode 100644 index 0000000000..6d4e250362 --- /dev/null +++ b/samples/odm/src/main/webapp/WEB-INF/org/springframework/ldap/configuration/BasicServlet.java @@ -0,0 +1,39 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.view.InternalResourceViewResolver; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class BasicServlet { + + + @Bean + public InternalResourceViewResolver internalResourceViewResolver() { + InternalResourceViewResolver bean = new InternalResourceViewResolver(); + bean.setPrefix("/WEB-INF/jsp/"); + bean.setSuffix(".jsp"); + return bean; + } + +} diff --git a/samples/odm/src/test/java/org/springframework/ldap/configuration/TestContext.java b/samples/odm/src/test/java/org/springframework/ldap/configuration/TestContext.java new file mode 100644 index 0000000000..c3485c0224 --- /dev/null +++ b/samples/odm/src/test/java/org/springframework/ldap/configuration/TestContext.java @@ -0,0 +1,40 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.ldap.core.LdapTemplate; +import org.springframework.ldap.samples.utils.LdapTreeBuilder; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class TestContext { + + + @Bean + public LdapTreeBuilder ldapTreeBuilder( + @Qualifier("ldapTemplate") + LdapTemplate ldapTemplate) { + return new LdapTreeBuilder(ldapTemplate); + } + +} diff --git a/samples/odm/src/test/resources/config/testContext.xml b/samples/odm/src/test/resources/config/testContext.xml index 25307086cf..7cd9461fe6 100644 --- a/samples/odm/src/test/resources/config/testContext.xml +++ b/samples/odm/src/test/resources/config/testContext.xml @@ -1,49 +1,44 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/plain/src/main/webapp/WEB-INF/basic-servlet.xml b/samples/plain/src/main/webapp/WEB-INF/basic-servlet.xml index 8b8b1a71c7..73be38b247 100644 --- a/samples/plain/src/main/webapp/WEB-INF/basic-servlet.xml +++ b/samples/plain/src/main/webapp/WEB-INF/basic-servlet.xml @@ -1,17 +1,12 @@ - - - - - - - - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:context="http://www.springframework.org/schema/context" + xsi:schemaLocation="http://www.springframework.org/schema/beans + https://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/context + https://www.springframework.org/schema/context/spring-context.xsd"> + + + diff --git a/samples/plain/src/main/webapp/WEB-INF/org/springframework/ldap/configuration/BasicServlet.java b/samples/plain/src/main/webapp/WEB-INF/org/springframework/ldap/configuration/BasicServlet.java new file mode 100644 index 0000000000..6d4e250362 --- /dev/null +++ b/samples/plain/src/main/webapp/WEB-INF/org/springframework/ldap/configuration/BasicServlet.java @@ -0,0 +1,39 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.view.InternalResourceViewResolver; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class BasicServlet { + + + @Bean + public InternalResourceViewResolver internalResourceViewResolver() { + InternalResourceViewResolver bean = new InternalResourceViewResolver(); + bean.setPrefix("/WEB-INF/jsp/"); + bean.setSuffix(".jsp"); + return bean; + } + +} diff --git a/samples/plain/src/test/java/org/springframework/ldap/configuration/TestContext.java b/samples/plain/src/test/java/org/springframework/ldap/configuration/TestContext.java new file mode 100644 index 0000000000..c3485c0224 --- /dev/null +++ b/samples/plain/src/test/java/org/springframework/ldap/configuration/TestContext.java @@ -0,0 +1,40 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.ldap.core.LdapTemplate; +import org.springframework.ldap.samples.utils.LdapTreeBuilder; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class TestContext { + + + @Bean + public LdapTreeBuilder ldapTreeBuilder( + @Qualifier("ldapTemplate") + LdapTemplate ldapTemplate) { + return new LdapTreeBuilder(ldapTemplate); + } + +} diff --git a/samples/plain/src/test/resources/config/testContext.xml b/samples/plain/src/test/resources/config/testContext.xml index a595b5af0f..d9df7284f0 100644 --- a/samples/plain/src/test/resources/config/testContext.xml +++ b/samples/plain/src/test/resources/config/testContext.xml @@ -1,48 +1,44 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/user-admin/src/main/java/org/springframework/ldap/configuration/ApplicationContext.java b/samples/user-admin/src/main/java/org/springframework/ldap/configuration/ApplicationContext.java new file mode 100644 index 0000000000..cf3b4e79a0 --- /dev/null +++ b/samples/user-admin/src/main/java/org/springframework/ldap/configuration/ApplicationContext.java @@ -0,0 +1,59 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.ldap.core.support.BaseLdapPathBeanPostProcessor; +import org.springframework.ldap.samples.useradmin.domain.impl.DepartmentRepoImpl; +import org.springframework.ldap.samples.useradmin.domain.impl.GroupRepoImpl; +import org.springframework.ldap.samples.useradmin.service.UserService; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class ApplicationContext { + + @Value("${sample.ldap.directory.type}") + private String sampleLdapDirectoryType; + + @Bean + public DepartmentRepoImpl departmentRepoImpl() { + return new DepartmentRepoImpl(); + } + + @Bean + public UserService userService() { + UserService bean = new UserService(); + bean.setDirectoryType(sampleLdapDirectoryType); + return bean; + } + + @Bean + public BaseLdapPathBeanPostProcessor baseLdapPathBeanPostProcessor() { + return new BaseLdapPathBeanPostProcessor(); + } + + @Bean + public GroupRepoImpl groupRepoImpl() { + return new GroupRepoImpl(); + } + +} diff --git a/samples/user-admin/src/main/resources/applicationContext.xml b/samples/user-admin/src/main/resources/applicationContext.xml index 02fc22cdb4..fc3eee67ed 100644 --- a/samples/user-admin/src/main/resources/applicationContext.xml +++ b/samples/user-admin/src/main/resources/applicationContext.xml @@ -1,89 +1,50 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + xsi:schemaLocation="http://www.springframework.org/schema/beans + https://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/context + https://www.springframework.org/schema/context/spring-context.xsd + http://www.springframework.org/schema/ldap + https://www.springframework.org/schema/ldap/spring-ldap.xsd"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/user-admin/src/main/webapp/WEB-INF/org/springframework/ldap/configuration/UserAdminServlet.java b/samples/user-admin/src/main/webapp/WEB-INF/org/springframework/ldap/configuration/UserAdminServlet.java new file mode 100644 index 0000000000..df5f3f9473 --- /dev/null +++ b/samples/user-admin/src/main/webapp/WEB-INF/org/springframework/ldap/configuration/UserAdminServlet.java @@ -0,0 +1,39 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.view.InternalResourceViewResolver; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class UserAdminServlet { + + + @Bean + public InternalResourceViewResolver internalResourceViewResolver() { + InternalResourceViewResolver bean = new InternalResourceViewResolver(); + bean.setPrefix("/WEB-INF/jsp/"); + bean.setSuffix(".jsp"); + return bean; + } + +} diff --git a/samples/user-admin/src/main/webapp/WEB-INF/user-admin-servlet.xml b/samples/user-admin/src/main/webapp/WEB-INF/user-admin-servlet.xml index 096643f7b5..64ff7f2deb 100644 --- a/samples/user-admin/src/main/webapp/WEB-INF/user-admin-servlet.xml +++ b/samples/user-admin/src/main/webapp/WEB-INF/user-admin-servlet.xml @@ -3,18 +3,15 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" - xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd - http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc https://www.springframework.org/schema/mvc/spring-mvc.xsd"> - - - - - - - - - - + xsi:schemaLocation="http://www.springframework.org/schema/beans + https://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/context + https://www.springframework.org/schema/context/spring-context.xsd + http://www.springframework.org/schema/mvc + https://www.springframework.org/schema/mvc/spring-mvc.xsd"> + + + + + diff --git a/test-support-unboundid/src/test/java/org/springframework/ldap/configuration/ApplicationContextLdifPopulator.java b/test-support-unboundid/src/test/java/org/springframework/ldap/configuration/ApplicationContextLdifPopulator.java new file mode 100644 index 0000000000..0f3a26fd7b --- /dev/null +++ b/test-support-unboundid/src/test/java/org/springframework/ldap/configuration/ApplicationContextLdifPopulator.java @@ -0,0 +1,51 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.DependsOn; +import org.springframework.core.io.ClassPathResource; +import org.springframework.ldap.core.support.LdapContextSource; +import org.springframework.ldap.test.unboundid.LdifPopulator; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class ApplicationContextLdifPopulator { + + + @Bean("ldifPopulator") + @DependsOn({ + "embeddedLdapServer" + }) + public LdifPopulator ldifPopulator( + @Qualifier("contextSource") + LdapContextSource contextSource) { + LdifPopulator bean = new LdifPopulator(); + bean.setContextSource(contextSource); + bean.setResource(new ClassPathResource("setup_data.ldif")); + bean.setClean(true); + bean.setBase("dc=jayway,dc=se"); + bean.setDefaultBase("dc=jayway,dc=se"); + return bean; + } + +} diff --git a/test-support-unboundid/src/test/resources/applicationContext-ldifPopulator.xml b/test-support-unboundid/src/test/resources/applicationContext-ldifPopulator.xml index b6da75b6ce..26c2003f0f 100644 --- a/test-support-unboundid/src/test/resources/applicationContext-ldifPopulator.xml +++ b/test-support-unboundid/src/test/resources/applicationContext-ldifPopulator.xml @@ -1,31 +1,28 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + xsi:schemaLocation="http://www.springframework.org/schema/beans + https://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context.xsd" + xmlns:context="http://www.springframework.org/schema/context"> + + + + + + + + + + + + + + + + diff --git a/test-support/src/main/java/org/springframework/ldap/test/EmbeddedLdapServer.java b/test-support/src/main/java/org/springframework/ldap/test/EmbeddedLdapServer.java index ebce212854..62d535afcf 100644 --- a/test-support/src/main/java/org/springframework/ldap/test/EmbeddedLdapServer.java +++ b/test-support/src/main/java/org/springframework/ldap/test/EmbeddedLdapServer.java @@ -47,7 +47,10 @@ private EmbeddedLdapServer(DirectoryService directoryService, public static EmbeddedLdapServer newEmbeddedServer(String defaultPartitionName, String defaultPartitionSuffix, int port) throws Exception{ workingDirectory = new File(System.getProperty("java.io.tmpdir") + "/apacheds-test1"); - FileUtils.deleteDirectory(workingDirectory); + + if (workingDirectory.exists()) { + FileUtils.deleteDirectory(workingDirectory); + } DefaultDirectoryService directoryService = new DefaultDirectoryService(); directoryService.setShutdownHookEnabled(true); diff --git a/test/integration-tests-ad/src/test/java/org/springframework/ldap/configuration/IncrementalAttributeMapperTest.java b/test/integration-tests-ad/src/test/java/org/springframework/ldap/configuration/IncrementalAttributeMapperTest.java new file mode 100644 index 0000000000..ffbb1a54ae --- /dev/null +++ b/test/integration-tests-ad/src/test/java/org/springframework/ldap/configuration/IncrementalAttributeMapperTest.java @@ -0,0 +1,42 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.ldap.core.support.LdapContextSource; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class IncrementalAttributeMapperTest { + + + @Bean("contextSourceTarget") + public LdapContextSource contextSourceTarget() { + LdapContextSource bean = new LdapContextSource(); + bean.setUrl("ldaps://127.0.0.1:13636"); + bean.setUserDn("CN=ldaptest,CN=Users,DC=261consulting,DC=local"); + bean.setPassword("Buc8xe6AZiewoh7"); + bean.setBase("DC=261consulting,DC=local"); + bean.setPooled(true); + return bean; + } + +} diff --git a/test/integration-tests-ad/src/test/resources/incrementalAttributeMapperTest.xml b/test/integration-tests-ad/src/test/resources/incrementalAttributeMapperTest.xml index 8c589c8bf6..f6171ab194 100644 --- a/test/integration-tests-ad/src/test/resources/incrementalAttributeMapperTest.xml +++ b/test/integration-tests-ad/src/test/resources/incrementalAttributeMapperTest.xml @@ -1,26 +1,22 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + xsi:schemaLocation="http://www.springframework.org/schema/beans + https://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context.xsd" + xmlns:context="http://www.springframework.org/schema/context"> + + + + + + + + + + + + diff --git a/test/integration-tests-openldap/src/test/java/org/springframework/ldap/configuration/LdapTemplateDigestMd5TestContext.java b/test/integration-tests-openldap/src/test/java/org/springframework/ldap/configuration/LdapTemplateDigestMd5TestContext.java new file mode 100644 index 0000000000..cc57a42de4 --- /dev/null +++ b/test/integration-tests-openldap/src/test/java/org/springframework/ldap/configuration/LdapTemplateDigestMd5TestContext.java @@ -0,0 +1,51 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.ldap.core.support.LdapContextSource; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class LdapTemplateDigestMd5TestContext { + + @Value("${itest.openldap.url}") + private String itestOpenldapUrl; + @Value("${itest.openldap.user.dn}") + private String itestOpenldapUserDn; + @Value("${itest.openldap.user.password}") + private String itestOpenldapUserPassword; + @Value("${itest.openldap.base}") + private String itestOpenldapBase; + + @Bean("populateContextSource") + public LdapContextSource populateContextSource() { + LdapContextSource bean = new LdapContextSource(); + bean.setUrl(itestOpenldapUrl); + bean.setUserDn(itestOpenldapUserDn); + bean.setPassword(itestOpenldapUserPassword); + bean.setBase(itestOpenldapBase); + bean.setPooled(false); + return bean; + } + +} diff --git a/test/integration-tests-openldap/src/test/java/org/springframework/ldap/configuration/PagedSearchTestContext.java b/test/integration-tests-openldap/src/test/java/org/springframework/ldap/configuration/PagedSearchTestContext.java new file mode 100644 index 0000000000..dc10d8136d --- /dev/null +++ b/test/integration-tests-openldap/src/test/java/org/springframework/ldap/configuration/PagedSearchTestContext.java @@ -0,0 +1,62 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.ldap.core.LdapTemplate; +import org.springframework.ldap.core.support.LdapContextSource; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class PagedSearchTestContext { + + @Value("${itest.openldap.url}") + private String itestOpenldapUrl; + @Value("${itest.openldap.user.dn}") + private String itestOpenldapUserDn; + @Value("${itest.openldap.user.password}") + private String itestOpenldapUserPassword; + @Value("${itest.openldap.base}") + private String itestOpenldapBase; + + @Bean("contextSource") + public LdapContextSource contextSource() { + LdapContextSource bean = new LdapContextSource(); + bean.setUrl(itestOpenldapUrl); + bean.setUserDn(itestOpenldapUserDn); + bean.setPassword(itestOpenldapUserPassword); + bean.setBase(itestOpenldapBase); + bean.setPooled(false); + return bean; + } + + @Bean + public LdapTemplate ldapTemplate( + @Qualifier("contextSource") + LdapContextSource contextSource) { + LdapTemplate bean = new LdapTemplate(); + bean.setContextSource(contextSource); + return bean; + } + +} diff --git a/test/integration-tests-openldap/src/test/resources/conf/ldapTemplateDigestMd5TestContext.xml b/test/integration-tests-openldap/src/test/resources/conf/ldapTemplateDigestMd5TestContext.xml index 47803ba848..fc7aea34b6 100644 --- a/test/integration-tests-openldap/src/test/resources/conf/ldapTemplateDigestMd5TestContext.xml +++ b/test/integration-tests-openldap/src/test/resources/conf/ldapTemplateDigestMd5TestContext.xml @@ -3,33 +3,26 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans - https://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd"> - - - - - - - - - - - - - - - - - - - - - - - - - + https://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/context + https://www.springframework.org/schema/context/spring-context.xsd"> + + + + + + + + + + + + + + + + diff --git a/test/integration-tests-openldap/src/test/resources/conf/pagedSearchTestContext.xml b/test/integration-tests-openldap/src/test/resources/conf/pagedSearchTestContext.xml index 824e3156a9..c77da6b8e4 100644 --- a/test/integration-tests-openldap/src/test/resources/conf/pagedSearchTestContext.xml +++ b/test/integration-tests-openldap/src/test/resources/conf/pagedSearchTestContext.xml @@ -2,22 +2,13 @@ - - - - - - - - - - - - - - - - \ No newline at end of file + xsi:schemaLocation="http://www.springframework.org/schema/beans + https://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/context + https://www.springframework.org/schema/context/spring-context.xsd"> + + + + diff --git a/test/integration-tests-sunone/src/test/java/org/springframework/ldap/configuration/LdapTemplateTestContext.java b/test/integration-tests-sunone/src/test/java/org/springframework/ldap/configuration/LdapTemplateTestContext.java new file mode 100644 index 0000000000..9d2e71a5d2 --- /dev/null +++ b/test/integration-tests-sunone/src/test/java/org/springframework/ldap/configuration/LdapTemplateTestContext.java @@ -0,0 +1,58 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.ClassPathResource; +import org.springframework.ldap.core.support.LdapContextSource; +import org.springframework.ldap.pool.factory.MutablePoolingContextSource; +import org.springframework.ldap.pool.validation.DefaultDirContextValidator; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class LdapTemplateTestContext { + + + @Bean("poolingContextSource") + public MutablePoolingContextSource poolingContextSource( + @Qualifier("contextSource") + LdapContextSource contextSource) { + MutablePoolingContextSource bean = new MutablePoolingContextSource(); + bean.setContextSource(contextSource); + bean.setMaxTotal(1); + bean.setDirContextValidator(new DefaultDirContextValidator()); + bean.setTestOnBorrow(true); + bean.setTestWhileIdle(true); + bean.setMaxActive(1); + return bean; + } + + @Bean + public PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() { + PropertyPlaceholderConfigurer bean = new PropertyPlaceholderConfigurer(); + bean.setLocation(new ClassPathResource("/conf/ldap.properties")); + bean.setSystemPropertiesModeName("SYSTEM_PROPERTIES_MODE_OVERRIDE"); + return bean; + } + +} diff --git a/test/integration-tests-sunone/src/test/resources/conf/ldapTemplateTestContext.xml b/test/integration-tests-sunone/src/test/resources/conf/ldapTemplateTestContext.xml index 8d938b9142..3d985f0417 100644 --- a/test/integration-tests-sunone/src/test/resources/conf/ldapTemplateTestContext.xml +++ b/test/integration-tests-sunone/src/test/resources/conf/ldapTemplateTestContext.xml @@ -1,40 +1,22 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.springframework.org/schema/beans + https://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context.xsd" + xmlns:context="http://www.springframework.org/schema/context"> + + + + + + + + + + + + diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/configuration/BaseLdapPathPostProcessorMultiContextSourceOneSpecTestContext.java b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/BaseLdapPathPostProcessorMultiContextSourceOneSpecTestContext.java new file mode 100644 index 0000000000..2e6f668ad6 --- /dev/null +++ b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/BaseLdapPathPostProcessorMultiContextSourceOneSpecTestContext.java @@ -0,0 +1,38 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.ldap.core.support.BaseLdapPathBeanPostProcessor; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class BaseLdapPathPostProcessorMultiContextSourceOneSpecTestContext { + + + @Bean + public BaseLdapPathBeanPostProcessor baseLdapPathBeanPostProcessor() { + BaseLdapPathBeanPostProcessor bean = new BaseLdapPathBeanPostProcessor(); + bean.setBaseLdapPathSourceName("contextSource2"); + return bean; + } + +} diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/configuration/BaseLdapPathPostProcessorMultiContextSourceTestContext.java b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/BaseLdapPathPostProcessorMultiContextSourceTestContext.java new file mode 100644 index 0000000000..431a185c1f --- /dev/null +++ b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/BaseLdapPathPostProcessorMultiContextSourceTestContext.java @@ -0,0 +1,36 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.ldap.core.support.BaseLdapPathBeanPostProcessor; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class BaseLdapPathPostProcessorMultiContextSourceTestContext { + + + @Bean + public BaseLdapPathBeanPostProcessor baseLdapPathBeanPostProcessor() { + return new BaseLdapPathBeanPostProcessor(); + } + +} diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/configuration/BaseLdapPathPostProcessorNamespaceTestContext.java b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/BaseLdapPathPostProcessorNamespaceTestContext.java new file mode 100644 index 0000000000..7c074d0640 --- /dev/null +++ b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/BaseLdapPathPostProcessorNamespaceTestContext.java @@ -0,0 +1,48 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.ldap.core.support.BaseLdapPathBeanPostProcessor; +import org.springframework.ldap.itest.core.support.DummyBaseLdapNameAware; +import org.springframework.ldap.itest.core.support.DummyBaseLdapPathAware; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class BaseLdapPathPostProcessorNamespaceTestContext { + + + @Bean + public DummyBaseLdapNameAware dummyBaseLdapNameAware() { + return new DummyBaseLdapNameAware(); + } + + @Bean("dummyBaseLdapPathAware") + public DummyBaseLdapPathAware dummyBaseLdapPathAware() { + return new DummyBaseLdapPathAware(); + } + + @Bean + public BaseLdapPathBeanPostProcessor baseLdapPathBeanPostProcessor() { + return new BaseLdapPathBeanPostProcessor(); + } + +} diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/configuration/BaseLdapPathPostProcessorNoContextSourceTestContext.java b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/BaseLdapPathPostProcessorNoContextSourceTestContext.java new file mode 100644 index 0000000000..f592884b4e --- /dev/null +++ b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/BaseLdapPathPostProcessorNoContextSourceTestContext.java @@ -0,0 +1,36 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.ldap.core.support.BaseLdapPathBeanPostProcessor; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class BaseLdapPathPostProcessorNoContextSourceTestContext { + + + @Bean + public BaseLdapPathBeanPostProcessor baseLdapPathBeanPostProcessor() { + return new BaseLdapPathBeanPostProcessor(); + } + +} diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/configuration/BaseLdapPathPostProcessorPoolingNamespaceTestContext.java b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/BaseLdapPathPostProcessorPoolingNamespaceTestContext.java new file mode 100644 index 0000000000..1550a53ef3 --- /dev/null +++ b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/BaseLdapPathPostProcessorPoolingNamespaceTestContext.java @@ -0,0 +1,42 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.ldap.core.support.BaseLdapPathBeanPostProcessor; +import org.springframework.ldap.itest.core.support.DummyBaseLdapNameAware; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class BaseLdapPathPostProcessorPoolingNamespaceTestContext { + + + @Bean + public DummyBaseLdapNameAware dummyBaseLdapNameAware() { + return new DummyBaseLdapNameAware(); + } + + @Bean + public BaseLdapPathBeanPostProcessor baseLdapPathBeanPostProcessor() { + return new BaseLdapPathBeanPostProcessor(); + } + +} diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/configuration/BaseLdapPathPostProcessorPropertyOverrideTestContext.java b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/BaseLdapPathPostProcessorPropertyOverrideTestContext.java new file mode 100644 index 0000000000..42fdd11de1 --- /dev/null +++ b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/BaseLdapPathPostProcessorPropertyOverrideTestContext.java @@ -0,0 +1,38 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.ldap.core.support.BaseLdapPathBeanPostProcessor; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class BaseLdapPathPostProcessorPropertyOverrideTestContext { + + + @Bean + public BaseLdapPathBeanPostProcessor baseLdapPathBeanPostProcessor() { + BaseLdapPathBeanPostProcessor bean = new BaseLdapPathBeanPostProcessor(); + bean.setBasePath("cn=john doe"); + return bean; + } + +} diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/configuration/BaseLdapPathPostProcessorTestContext.java b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/BaseLdapPathPostProcessorTestContext.java new file mode 100644 index 0000000000..e904e28060 --- /dev/null +++ b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/BaseLdapPathPostProcessorTestContext.java @@ -0,0 +1,42 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.ldap.core.support.BaseLdapPathBeanPostProcessor; +import org.springframework.ldap.itest.core.support.DummyBaseLdapNameAware; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class BaseLdapPathPostProcessorTestContext { + + + @Bean + public DummyBaseLdapNameAware dummyBaseLdapNameAware() { + return new DummyBaseLdapNameAware(); + } + + @Bean + public BaseLdapPathBeanPostProcessor baseLdapPathBeanPostProcessor() { + return new BaseLdapPathBeanPostProcessor(); + } + +} diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/configuration/BaseLdapPathPostProcessorTransactionTestContext.java b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/BaseLdapPathPostProcessorTransactionTestContext.java new file mode 100644 index 0000000000..d5cd5bedeb --- /dev/null +++ b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/BaseLdapPathPostProcessorTransactionTestContext.java @@ -0,0 +1,46 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.ldap.core.support.BaseLdapPathBeanPostProcessor; +import org.springframework.ldap.core.support.LdapContextSource; +import org.springframework.ldap.transaction.compensating.manager.TransactionAwareContextSourceProxy; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class BaseLdapPathPostProcessorTransactionTestContext { + + + @Bean("contextSourceProxy") + public TransactionAwareContextSourceProxy contextSourceProxy( + @Qualifier("contextSource") + LdapContextSource contextSource) { + return new TransactionAwareContextSourceProxy(contextSource); + } + + @Bean + public BaseLdapPathBeanPostProcessor baseLdapPathBeanPostProcessor() { + return new BaseLdapPathBeanPostProcessor(); + } + +} diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/configuration/DistinguishedNameEditorTestContext.java b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/DistinguishedNameEditorTestContext.java new file mode 100644 index 0000000000..bed29b27ef --- /dev/null +++ b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/DistinguishedNameEditorTestContext.java @@ -0,0 +1,39 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.ldap.core.DistinguishedName; +import org.springframework.ldap.itest.core.DummyDistinguishedNameConsumer; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class DistinguishedNameEditorTestContext { + + + @Bean("distinguishedNameConsumer") + public DummyDistinguishedNameConsumer distinguishedNameConsumer() { + DummyDistinguishedNameConsumer bean = new DummyDistinguishedNameConsumer(); + bean.setDistinguishedName(new DistinguishedName("dc=jayway, dc=se")); + return bean; + } + +} diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/configuration/HardcodedFilterTestContext.java b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/HardcodedFilterTestContext.java new file mode 100644 index 0000000000..84ee48a55f --- /dev/null +++ b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/HardcodedFilterTestContext.java @@ -0,0 +1,39 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.ldap.filter.HardcodedFilter; +import org.springframework.ldap.itest.filter.DummyFilterConsumer; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class HardcodedFilterTestContext { + + + @Bean + public DummyFilterConsumer dummyFilterConsumer() { + DummyFilterConsumer bean = new DummyFilterConsumer(); + bean.setFilter(new HardcodedFilter("(&(objectclass=person)(!(objectclass=computer))")); + return bean; + } + +} diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/configuration/Ldap247TestContext.java b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/Ldap247TestContext.java new file mode 100644 index 0000000000..375a2ab1e0 --- /dev/null +++ b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/Ldap247TestContext.java @@ -0,0 +1,53 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.ldap.core.support.BaseLdapPathBeanPostProcessor; +import org.springframework.ldap.itest.LdapGroupDao; +import org.springframework.ldap.itest.support.springsecurity.MethodSecurityExpressionHandler; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class Ldap247TestContext { + + + @Bean("accessExpressionHandler") + public MethodSecurityExpressionHandler accessExpressionHandler( + @Qualifier("groupDao") + LdapGroupDao groupDao) { + MethodSecurityExpressionHandler bean = new MethodSecurityExpressionHandler(); + bean.setGroupDao(groupDao); + return bean; + } + + @Bean("groupDao") + public LdapGroupDao groupDao() { + return new LdapGroupDao(); + } + + @Bean("baseLdapPathBeanPostProcessor") + public BaseLdapPathBeanPostProcessor baseLdapPathBeanPostProcessor() { + return new BaseLdapPathBeanPostProcessor(); + } + +} diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/configuration/Ldap321.java b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/Ldap321.java new file mode 100644 index 0000000000..5c0dd86621 --- /dev/null +++ b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/Ldap321.java @@ -0,0 +1,36 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.ldap.itest.ldap321.RoleRepo; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class Ldap321 { + + + @Bean + public RoleRepo roleRepo() { + return new RoleRepo(); + } + +} diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/configuration/LdapAndHibernateTransactionTestContext.java b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/LdapAndHibernateTransactionTestContext.java new file mode 100644 index 0000000000..a98ed22b13 --- /dev/null +++ b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/LdapAndHibernateTransactionTestContext.java @@ -0,0 +1,117 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import java.util.ArrayList; +import java.util.Properties; + +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.jdbc.datasource.DriverManagerDataSource; +import org.springframework.ldap.core.LdapTemplate; +import org.springframework.ldap.core.support.LdapContextSource; +import org.springframework.ldap.itest.transaction.compensating.manager.hibernate.DummyDaoLdapAndHibernateImpl; +import org.springframework.ldap.transaction.compensating.manager.ContextSourceAndHibernateTransactionManager; +import org.springframework.ldap.transaction.compensating.manager.TransactionAwareContextSourceProxy; +import org.springframework.ldap.transaction.compensating.support.DefaultTempEntryRenamingStrategy; +import org.springframework.orm.hibernate5.HibernateTemplate; +import org.springframework.orm.hibernate5.LocalSessionFactoryBean; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class LdapAndHibernateTransactionTestContext { + + + @Bean("transactionManager") + public ContextSourceAndHibernateTransactionManager transactionManager( + @Qualifier("sessionFactory") + LocalSessionFactoryBean sessionFactory, + @Qualifier("transactedContextSource") + TransactionAwareContextSourceProxy transactedContextSource) { + ContextSourceAndHibernateTransactionManager bean = new ContextSourceAndHibernateTransactionManager(); + bean.setSessionFactory(sessionFactory.getObject()); + bean.setContextSource(transactedContextSource); + bean.setRenamingStrategy(new DefaultTempEntryRenamingStrategy()); + return bean; + } + + @Bean("transactedContextSource") + public TransactionAwareContextSourceProxy transactedContextSource( + @Qualifier("contextSource") + LdapContextSource contextSource) { + return new TransactionAwareContextSourceProxy(contextSource); + } + + @Bean("dummyDao") + public DummyDaoLdapAndHibernateImpl dummyDao( + @Qualifier("ldapTemplate") + LdapTemplate ldapTemplate, + @Qualifier("sessionFactory") + LocalSessionFactoryBean sessionFactory) { + DummyDaoLdapAndHibernateImpl bean = new DummyDaoLdapAndHibernateImpl(); + bean.setLdapTemplate(ldapTemplate); + bean.setSessionFactory(sessionFactory.getObject()); + return bean; + } + + @Bean("hibernateTemplate") + public HibernateTemplate hibernateTemplate( + @Qualifier("sessionFactory") + LocalSessionFactoryBean sessionFactory) { + HibernateTemplate bean = new HibernateTemplate(); + bean.setSessionFactory(sessionFactory.getObject()); + return bean; + } + + @Bean("dataSource") + public DriverManagerDataSource dataSource() { + DriverManagerDataSource bean = new DriverManagerDataSource(); + bean.setDriverClassName("org.hsqldb.jdbcDriver"); + bean.setUrl("jdbc:hsqldb:mem:aname"); + bean.setUsername("sa"); + bean.setPassword(""); + return bean; + } + + @Bean("sessionFactory") + public LocalSessionFactoryBean sessionFactory( + @Qualifier("dataSource") + DriverManagerDataSource dataSource) { + LocalSessionFactoryBean bean = new LocalSessionFactoryBean(); + bean.setDataSource(dataSource); + ArrayList list0 = new ArrayList(); + list0 .add("conf/OrgPerson.hbm.xml"); + bean.setMappingResources(list0.toArray(new String[]{})); + Properties properties = new Properties(); + properties.put("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"); + properties.put("hibernate.hbm2ddl.auto", "create"); + bean.setHibernateProperties(properties); + return bean; + } + + @Bean("ldapTemplate") + public LdapTemplate ldapTemplate( + @Qualifier("transactedContextSource") + TransactionAwareContextSourceProxy transactedContextSource) { + return new LdapTemplate(transactedContextSource); + } + +} diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/configuration/LdapAndJdbcTransactionTestContext.java b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/LdapAndJdbcTransactionTestContext.java new file mode 100644 index 0000000000..aeaa00b720 --- /dev/null +++ b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/LdapAndJdbcTransactionTestContext.java @@ -0,0 +1,42 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.datasource.DriverManagerDataSource; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class LdapAndJdbcTransactionTestContext { + + + @Bean("jdbcTemplate") + public JdbcTemplate jdbcTemplate( + @Qualifier("dataSource") + DriverManagerDataSource dataSource) { + JdbcTemplate bean = new JdbcTemplate(); + bean.setDataSource(dataSource); + return bean; + } + +} diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/configuration/LdapContextSourceTestContext.java b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/LdapContextSourceTestContext.java new file mode 100644 index 0000000000..d38137aac7 --- /dev/null +++ b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/LdapContextSourceTestContext.java @@ -0,0 +1,39 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.ldap.core.support.LdapContextSource; + + +/** + * Generated Java based configuration + */ +@Configuration +public class LdapContextSourceTestContext { + + + @Bean("contextSource2") + public LdapContextSource contextSource2() { + LdapContextSource bean = new LdapContextSource(); + bean.setUrls(new String[]{"ldap://127.0.0.1:389", "ldap://127.0.0.2:389"}); + bean.setUserDn("cn=dummy"); + bean.setPassword("dummy"); + return bean; + } + +} diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/configuration/LdapTemplateTransactionSubtreeTestContext.java b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/LdapTemplateTransactionSubtreeTestContext.java new file mode 100644 index 0000000000..88edde9433 --- /dev/null +++ b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/LdapTemplateTransactionSubtreeTestContext.java @@ -0,0 +1,42 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.ldap.core.LdapTemplate; +import org.springframework.ldap.itest.transaction.compensating.manager.LdapDummyDaoImpl; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class LdapTemplateTransactionSubtreeTestContext { + + + @Bean("dummyDaoTarget") + public LdapDummyDaoImpl dummyDaoTarget( + @Qualifier("ldapTemplate") + LdapTemplate ldapTemplate) { + LdapDummyDaoImpl bean = new LdapDummyDaoImpl(); + bean.setLdapTemplate(ldapTemplate); + return bean; + } + +} diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/configuration/SimpleLdapTemplateTestContext.java b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/SimpleLdapTemplateTestContext.java new file mode 100644 index 0000000000..3594e0a23a --- /dev/null +++ b/test/integration-tests/src/test/java/org/springframework/ldap/configuration/SimpleLdapTemplateTestContext.java @@ -0,0 +1,40 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.configuration; + +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.ldap.core.simple.SimpleLdapTemplate; +import org.springframework.ldap.core.support.LdapContextSource; + + +/** + * Generated Java based configuration + * + */ +@Configuration +public class SimpleLdapTemplateTestContext { + + + @Bean("simpleLdapTemplate") + public SimpleLdapTemplate simpleLdapTemplate( + @Qualifier("contextSource") + LdapContextSource contextSource) { + return new SimpleLdapTemplate(contextSource); + } + +} diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/ldap473/Ldap473Test.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/ldap473/Ldap473Test.java index 88266c3f48..39825e53ca 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/ldap473/Ldap473Test.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/ldap473/Ldap473Test.java @@ -1,3 +1,18 @@ +/* + * Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.ldap.itest.ldap473; import javax.naming.directory.DirContext; diff --git a/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorMultiContextSourceOneSpecTestContext.xml b/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorMultiContextSourceOneSpecTestContext.xml index da15e33605..d4dc82aaf3 100644 --- a/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorMultiContextSourceOneSpecTestContext.xml +++ b/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorMultiContextSourceOneSpecTestContext.xml @@ -1,40 +1,35 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorMultiContextSourceTestContext.xml b/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorMultiContextSourceTestContext.xml index 2207888dc5..9ca8e2e74d 100644 --- a/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorMultiContextSourceTestContext.xml +++ b/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorMultiContextSourceTestContext.xml @@ -1,38 +1,35 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorNamespaceTestContext.xml b/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorNamespaceTestContext.xml index 2b0241eeb7..c583bc72b9 100644 --- a/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorNamespaceTestContext.xml +++ b/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorNamespaceTestContext.xml @@ -1,21 +1,19 @@ - - - - - - - - - - - - + + + + + + + diff --git a/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorNoContextSourceTestContext.xml b/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorNoContextSourceTestContext.xml index 6d808063a6..08abbc1b70 100644 --- a/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorNoContextSourceTestContext.xml +++ b/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorNoContextSourceTestContext.xml @@ -1,13 +1,14 @@ - - - - - - - - + + + + + + + diff --git a/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorPoolingNamespaceTestContext.xml b/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorPoolingNamespaceTestContext.xml index 726a67985e..5b6ce0f0f8 100644 --- a/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorPoolingNamespaceTestContext.xml +++ b/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorPoolingNamespaceTestContext.xml @@ -1,24 +1,23 @@ - - - - - - - - - - - - - - - + + + + + + + + + + diff --git a/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorPropertyOverrideTestContext.xml b/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorPropertyOverrideTestContext.xml index 194d9dd916..a887327587 100644 --- a/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorPropertyOverrideTestContext.xml +++ b/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorPropertyOverrideTestContext.xml @@ -1,30 +1,26 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorTestContext.xml b/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorTestContext.xml index 932b35a31e..b701c43507 100644 --- a/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorTestContext.xml +++ b/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorTestContext.xml @@ -1,30 +1,26 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorTransactionTestContext.xml b/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorTransactionTestContext.xml index 5a6f04a533..9f207fa550 100644 --- a/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorTransactionTestContext.xml +++ b/test/integration-tests/src/test/resources/conf/baseLdapPathPostProcessorTransactionTestContext.xml @@ -1,33 +1,26 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/test/integration-tests/src/test/resources/conf/commonContextSourceConfig.xml b/test/integration-tests/src/test/resources/conf/commonContextSourceConfig.xml index f7425fd860..1fee06b307 100644 --- a/test/integration-tests/src/test/resources/conf/commonContextSourceConfig.xml +++ b/test/integration-tests/src/test/resources/conf/commonContextSourceConfig.xml @@ -1,7 +1,11 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ldap="http://www.springframework.org/schema/ldap" + xsi:schemaLocation="http://www.springframework.org/schema/beans + https://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/ldap + https://www.springframework.org/schema/ldap/spring-ldap.xsd"> + https://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/context + https://www.springframework.org/schema/context/spring-context.xsd"> - - - - - - - - - - - \ No newline at end of file + xsi:schemaLocation="http://www.springframework.org/schema/beans + https://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/security + https://www.springframework.org/schema/security/spring-security.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context.xsd" + xmlns:context="http://www.springframework.org/schema/context"> + + + + + + + + + + + + diff --git a/test/integration-tests/src/test/resources/conf/ldapAndHibernateTransactionNamespaceTestContext.xml b/test/integration-tests/src/test/resources/conf/ldapAndHibernateTransactionNamespaceTestContext.xml index b7c100cbac..955fc3e9bc 100755 --- a/test/integration-tests/src/test/resources/conf/ldapAndHibernateTransactionNamespaceTestContext.xml +++ b/test/integration-tests/src/test/resources/conf/ldapAndHibernateTransactionNamespaceTestContext.xml @@ -1,9 +1,14 @@ + https://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/tx + https://www.springframework.org/schema/tx/spring-tx.xsd + http://www.springframework.org/schema/ldap + https://www.springframework.org/schema/ldap/spring-ldap.xsd"> diff --git a/test/integration-tests/src/test/resources/conf/ldapAndHibernateTransactionTestContext.xml b/test/integration-tests/src/test/resources/conf/ldapAndHibernateTransactionTestContext.xml index 4b0546ed6d..cddac293c1 100755 --- a/test/integration-tests/src/test/resources/conf/ldapAndHibernateTransactionTestContext.xml +++ b/test/integration-tests/src/test/resources/conf/ldapAndHibernateTransactionTestContext.xml @@ -1,63 +1,17 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - conf/OrgPerson.hbm.xml - - - - - hibernate.dialect=org.hibernate.dialect.HSQLDialect - hibernate.hbm2ddl.auto=create - - - - - - - - - - - - - - - - - - - + + + + + + + + diff --git a/test/integration-tests/src/test/resources/conf/ldapAndJdbcTransactionNamespaceTestContext.xml b/test/integration-tests/src/test/resources/conf/ldapAndJdbcTransactionNamespaceTestContext.xml index 4957f3e27f..934afef48e 100644 --- a/test/integration-tests/src/test/resources/conf/ldapAndJdbcTransactionNamespaceTestContext.xml +++ b/test/integration-tests/src/test/resources/conf/ldapAndJdbcTransactionNamespaceTestContext.xml @@ -16,10 +16,15 @@ --> + https://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/tx + https://www.springframework.org/schema/tx/spring-tx.xsd + http://www.springframework.org/schema/ldap + https://www.springframework.org/schema/ldap/spring-ldap.xsd"> diff --git a/test/integration-tests/src/test/resources/conf/ldapAndJdbcTransactionTestContext.xml b/test/integration-tests/src/test/resources/conf/ldapAndJdbcTransactionTestContext.xml index 80f105c43c..6ed38e6fa0 100644 --- a/test/integration-tests/src/test/resources/conf/ldapAndJdbcTransactionTestContext.xml +++ b/test/integration-tests/src/test/resources/conf/ldapAndJdbcTransactionTestContext.xml @@ -1,49 +1,44 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/integration-tests/src/test/resources/conf/ldapContextSourceTestContext.xml b/test/integration-tests/src/test/resources/conf/ldapContextSourceTestContext.xml index 68b41ebadf..32f7cf5b38 100644 --- a/test/integration-tests/src/test/resources/conf/ldapContextSourceTestContext.xml +++ b/test/integration-tests/src/test/resources/conf/ldapContextSourceTestContext.xml @@ -1,12 +1,11 @@ - - - - - - - - - + + + + + diff --git a/test/integration-tests/src/test/resources/conf/ldapTemplateNamespaceTransactionTestContext.xml b/test/integration-tests/src/test/resources/conf/ldapTemplateNamespaceTransactionTestContext.xml index 7f8f58dff7..0ba6298a04 100644 --- a/test/integration-tests/src/test/resources/conf/ldapTemplateNamespaceTransactionTestContext.xml +++ b/test/integration-tests/src/test/resources/conf/ldapTemplateNamespaceTransactionTestContext.xml @@ -1,9 +1,14 @@ + https://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/tx + https://www.springframework.org/schema/tx/spring-tx.xsd + http://www.springframework.org/schema/ldap + https://www.springframework.org/schema/ldap/spring-ldap.xsd"> diff --git a/test/integration-tests/src/test/resources/conf/ldapTemplateTransactionSubtreeTestContext.xml b/test/integration-tests/src/test/resources/conf/ldapTemplateTransactionSubtreeTestContext.xml index 482febd1a9..37908ac596 100644 --- a/test/integration-tests/src/test/resources/conf/ldapTemplateTransactionSubtreeTestContext.xml +++ b/test/integration-tests/src/test/resources/conf/ldapTemplateTransactionSubtreeTestContext.xml @@ -1,47 +1,39 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PROPAGATION_REQUIRES_NEW - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + PROPAGATION_REQUIRES_NEW + + + + diff --git a/test/integration-tests/src/test/resources/conf/ldapTemplateTransactionTestContext.xml b/test/integration-tests/src/test/resources/conf/ldapTemplateTransactionTestContext.xml index 6821c3c6ef..02290a7efe 100644 --- a/test/integration-tests/src/test/resources/conf/ldapTemplateTransactionTestContext.xml +++ b/test/integration-tests/src/test/resources/conf/ldapTemplateTransactionTestContext.xml @@ -1,8 +1,11 @@ + https://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/tx + https://www.springframework.org/schema/tx/spring-tx.xsd"> diff --git a/test/integration-tests/src/test/resources/conf/simpleLdapTemplateTestContext.xml b/test/integration-tests/src/test/resources/conf/simpleLdapTemplateTestContext.xml index 6147a7c4d6..1d7e830841 100644 --- a/test/integration-tests/src/test/resources/conf/simpleLdapTemplateTestContext.xml +++ b/test/integration-tests/src/test/resources/conf/simpleLdapTemplateTestContext.xml @@ -1,14 +1,22 @@ - - - - - - - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.springframework.org/schema/beans + https://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context.xsd" + xmlns:context="http://www.springframework.org/schema/context"> + + + + + + + + + + + diff --git a/test/integration-tests/src/test/resources/ldap321.xml b/test/integration-tests/src/test/resources/ldap321.xml index 45f708ee36..cc3cad2b13 100644 --- a/test/integration-tests/src/test/resources/ldap321.xml +++ b/test/integration-tests/src/test/resources/ldap321.xml @@ -1,26 +1,33 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:tx="http://www.springframework.org/schema/tx" + xmlns:ldap="http://www.springframework.org/schema/ldap" + xsi:schemaLocation="http://www.springframework.org/schema/ldap + https://www.springframework.org/schema/ldap/spring-ldap.xsd + http://www.springframework.org/schema/beans + https://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/tx + https://www.springframework.org/schema/tx/spring-tx-3.0.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context.xsd" + xmlns:context="http://www.springframework.org/schema/context"> + + + + + + + + + + + + + + +