From 96429d00c6ef75536b3893bbc9786281d2c644d6 Mon Sep 17 00:00:00 2001 From: Mattias Hellborg Arthursson Date: Thu, 12 Sep 2013 08:07:15 +0200 Subject: [PATCH] LDAP-262: Moved the stuff from the samples-utils project to plain-sample. --- samples/plain/build.gradle | 1 - .../samples/utils/HtmlRowLdapTreeVisitor.java | 20 +++++++++-- .../ldap/samples/utils/LdapTree.java | 20 +++++++++-- .../ldap/samples/utils/LdapTreeBuilder.java | 16 +++++++++ .../ldap/samples/utils/LdapTreeVisitor.java | 24 +++++++++++++ .../utils/LdapTreeBuilderIntegrationTest.java | 18 +++++++++- .../src/test/resources/config/testContext.xml | 4 +++ samples/samples-utils/.gitignore | 4 --- samples/samples-utils/.springBeans | 13 ------- samples/samples-utils/build.gradle | 11 ------ .../ldap/samples/utils/LdapTreeVisitor.java | 8 ----- .../test/resources/conf/commonTestContext.xml | 16 --------- .../src/test/resources/conf/ldap.properties | 4 --- .../src/test/resources/conf/testContext.xml | 27 -------------- .../src/test/resources/log4j.properties | 7 ---- .../src/test/resources/setup_data.ldif | 36 ------------------- settings.gradle | 1 - 17 files changed, 97 insertions(+), 133 deletions(-) rename samples/{samples-utils => plain}/src/main/java/org/springframework/ldap/samples/utils/HtmlRowLdapTreeVisitor.java (55%) rename samples/{samples-utils => plain}/src/main/java/org/springframework/ldap/samples/utils/LdapTree.java (60%) rename samples/{samples-utils => plain}/src/main/java/org/springframework/ldap/samples/utils/LdapTreeBuilder.java (64%) create mode 100644 samples/plain/src/main/java/org/springframework/ldap/samples/utils/LdapTreeVisitor.java rename samples/{samples-utils => plain}/src/test/java/org/springframework/ldap/samples/utils/LdapTreeBuilderIntegrationTest.java (72%) delete mode 100644 samples/samples-utils/.gitignore delete mode 100644 samples/samples-utils/.springBeans delete mode 100644 samples/samples-utils/build.gradle delete mode 100644 samples/samples-utils/src/main/java/org/springframework/ldap/samples/utils/LdapTreeVisitor.java delete mode 100644 samples/samples-utils/src/test/resources/conf/commonTestContext.xml delete mode 100644 samples/samples-utils/src/test/resources/conf/ldap.properties delete mode 100644 samples/samples-utils/src/test/resources/conf/testContext.xml delete mode 100644 samples/samples-utils/src/test/resources/log4j.properties delete mode 100644 samples/samples-utils/src/test/resources/setup_data.ldif diff --git a/samples/plain/build.gradle b/samples/plain/build.gradle index 7dc020bc..c3f27017 100644 --- a/samples/plain/build.gradle +++ b/samples/plain/build.gradle @@ -4,7 +4,6 @@ apply plugin: 'jetty' dependencies { compile project(':spring-ldap-test'), - project(':spring-ldap-samples-utils'), 'log4j:log4j:1.2.9', 'javax.servlet:jstl:1.2', "org.springframework:spring-context:$springVersion", diff --git a/samples/samples-utils/src/main/java/org/springframework/ldap/samples/utils/HtmlRowLdapTreeVisitor.java b/samples/plain/src/main/java/org/springframework/ldap/samples/utils/HtmlRowLdapTreeVisitor.java similarity index 55% rename from samples/samples-utils/src/main/java/org/springframework/ldap/samples/utils/HtmlRowLdapTreeVisitor.java rename to samples/plain/src/main/java/org/springframework/ldap/samples/utils/HtmlRowLdapTreeVisitor.java index 30c9c3d0..c98dd094 100644 --- a/samples/samples-utils/src/main/java/org/springframework/ldap/samples/utils/HtmlRowLdapTreeVisitor.java +++ b/samples/plain/src/main/java/org/springframework/ldap/samples/utils/HtmlRowLdapTreeVisitor.java @@ -1,10 +1,26 @@ +/* + * 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 + * + * 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.samples.utils; +import org.springframework.ldap.core.DirContextOperations; + import java.util.LinkedList; import java.util.List; -import org.springframework.ldap.core.DirContextOperations; - public class HtmlRowLdapTreeVisitor implements LdapTreeVisitor { private List rows = new LinkedList(); diff --git a/samples/samples-utils/src/main/java/org/springframework/ldap/samples/utils/LdapTree.java b/samples/plain/src/main/java/org/springframework/ldap/samples/utils/LdapTree.java similarity index 60% rename from samples/samples-utils/src/main/java/org/springframework/ldap/samples/utils/LdapTree.java rename to samples/plain/src/main/java/org/springframework/ldap/samples/utils/LdapTree.java index 2bbe7b44..0919b4da 100644 --- a/samples/samples-utils/src/main/java/org/springframework/ldap/samples/utils/LdapTree.java +++ b/samples/plain/src/main/java/org/springframework/ldap/samples/utils/LdapTree.java @@ -1,10 +1,26 @@ +/* + * 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 + * + * 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.samples.utils; +import org.springframework.ldap.core.DirContextOperations; + import java.util.LinkedList; import java.util.List; -import org.springframework.ldap.core.DirContextOperations; - public class LdapTree { private final DirContextOperations node; diff --git a/samples/samples-utils/src/main/java/org/springframework/ldap/samples/utils/LdapTreeBuilder.java b/samples/plain/src/main/java/org/springframework/ldap/samples/utils/LdapTreeBuilder.java similarity index 64% rename from samples/samples-utils/src/main/java/org/springframework/ldap/samples/utils/LdapTreeBuilder.java rename to samples/plain/src/main/java/org/springframework/ldap/samples/utils/LdapTreeBuilder.java index 87b1a80f..633c12e1 100644 --- a/samples/samples-utils/src/main/java/org/springframework/ldap/samples/utils/LdapTreeBuilder.java +++ b/samples/plain/src/main/java/org/springframework/ldap/samples/utils/LdapTreeBuilder.java @@ -1,3 +1,19 @@ +/* + * 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 + * + * 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.samples.utils; import org.springframework.ldap.core.DirContextOperations; diff --git a/samples/plain/src/main/java/org/springframework/ldap/samples/utils/LdapTreeVisitor.java b/samples/plain/src/main/java/org/springframework/ldap/samples/utils/LdapTreeVisitor.java new file mode 100644 index 00000000..5032f9a7 --- /dev/null +++ b/samples/plain/src/main/java/org/springframework/ldap/samples/utils/LdapTreeVisitor.java @@ -0,0 +1,24 @@ +/* + * 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 + * + * 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.samples.utils; + +import org.springframework.ldap.core.DirContextOperations; + +public interface LdapTreeVisitor { + + public void visit(DirContextOperations node, int currentDepth); +} diff --git a/samples/samples-utils/src/test/java/org/springframework/ldap/samples/utils/LdapTreeBuilderIntegrationTest.java b/samples/plain/src/test/java/org/springframework/ldap/samples/utils/LdapTreeBuilderIntegrationTest.java similarity index 72% rename from samples/samples-utils/src/test/java/org/springframework/ldap/samples/utils/LdapTreeBuilderIntegrationTest.java rename to samples/plain/src/test/java/org/springframework/ldap/samples/utils/LdapTreeBuilderIntegrationTest.java index 7d276d5c..e29ad216 100644 --- a/samples/samples-utils/src/test/java/org/springframework/ldap/samples/utils/LdapTreeBuilderIntegrationTest.java +++ b/samples/plain/src/test/java/org/springframework/ldap/samples/utils/LdapTreeBuilderIntegrationTest.java @@ -1,3 +1,19 @@ +/* + * 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 + * + * 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.samples.utils; import org.junit.Test; @@ -14,7 +30,7 @@ import java.util.Map; import static junit.framework.Assert.assertEquals; -@ContextConfiguration(locations = { "/conf/testContext.xml" }) +@ContextConfiguration(locations = { "/config/testContext.xml" }) public class LdapTreeBuilderIntegrationTest extends AbstractJUnit4SpringContextTests { @Autowired diff --git a/samples/plain/src/test/resources/config/testContext.xml b/samples/plain/src/test/resources/config/testContext.xml index 568d9f9d..7b38dc02 100644 --- a/samples/plain/src/test/resources/config/testContext.xml +++ b/samples/plain/src/test/resources/config/testContext.xml @@ -26,4 +26,8 @@ class="org.springframework.ldap.samples.plain.dao.PersonDaoImpl"> + + + + \ No newline at end of file diff --git a/samples/samples-utils/.gitignore b/samples/samples-utils/.gitignore deleted file mode 100644 index 73df60d8..00000000 --- a/samples/samples-utils/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -target -.classpath -.project -.settings diff --git a/samples/samples-utils/.springBeans b/samples/samples-utils/.springBeans deleted file mode 100644 index 34b281cf..00000000 --- a/samples/samples-utils/.springBeans +++ /dev/null @@ -1,13 +0,0 @@ - - - 1 - - - - - - - - - - diff --git a/samples/samples-utils/build.gradle b/samples/samples-utils/build.gradle deleted file mode 100644 index 5ee07cf9..00000000 --- a/samples/samples-utils/build.gradle +++ /dev/null @@ -1,11 +0,0 @@ -apply from: JAVA_SCRIPT - -dependencies { - compile project(':spring-ldap-core-tiger'), - project(':spring-ldap-test') - - testCompile "org.springframework:spring-test:$springVersion", - "junit:junit:$junitVersion" -} - -test.enabled = false // FIXME this needs to be enabled, but fails since no LDAP server is started \ No newline at end of file diff --git a/samples/samples-utils/src/main/java/org/springframework/ldap/samples/utils/LdapTreeVisitor.java b/samples/samples-utils/src/main/java/org/springframework/ldap/samples/utils/LdapTreeVisitor.java deleted file mode 100644 index 9d4457af..00000000 --- a/samples/samples-utils/src/main/java/org/springframework/ldap/samples/utils/LdapTreeVisitor.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.springframework.ldap.samples.utils; - -import org.springframework.ldap.core.DirContextOperations; - -public interface LdapTreeVisitor { - - public void visit(DirContextOperations node, int currentDepth); -} diff --git a/samples/samples-utils/src/test/resources/conf/commonTestContext.xml b/samples/samples-utils/src/test/resources/conf/commonTestContext.xml deleted file mode 100644 index a71c074e..00000000 --- a/samples/samples-utils/src/test/resources/conf/commonTestContext.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - diff --git a/samples/samples-utils/src/test/resources/conf/ldap.properties b/samples/samples-utils/src/test/resources/conf/ldap.properties deleted file mode 100644 index 992a6279..00000000 --- a/samples/samples-utils/src/test/resources/conf/ldap.properties +++ /dev/null @@ -1,4 +0,0 @@ -urls=ldap://127.0.0.1:18885 -userDn=uid=admin,ou=system -password=secret -base=dc=jayway,dc=se diff --git a/samples/samples-utils/src/test/resources/conf/testContext.xml b/samples/samples-utils/src/test/resources/conf/testContext.xml deleted file mode 100644 index 196da0b9..00000000 --- a/samples/samples-utils/src/test/resources/conf/testContext.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/samples-utils/src/test/resources/log4j.properties b/samples/samples-utils/src/test/resources/log4j.properties deleted file mode 100644 index 7620b40d..00000000 --- a/samples/samples-utils/src/test/resources/log4j.properties +++ /dev/null @@ -1,7 +0,0 @@ -log4j.rootCategory=INFO, 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 - -log4j.logger.org.apache.directory=ERROR diff --git a/samples/samples-utils/src/test/resources/setup_data.ldif b/samples/samples-utils/src/test/resources/setup_data.ldif deleted file mode 100644 index 0ce6455a..00000000 --- a/samples/samples-utils/src/test/resources/setup_data.ldif +++ /dev/null @@ -1,36 +0,0 @@ -dn: c=Sweden,dc=jayway,dc=se -objectclass: top -objectclass: country -c: Sweden -description: The country of Sweden - -dn: ou=company1,c=Sweden,dc=jayway,dc=se -objectclass: top -objectclass: organizationalUnit -ou: company1 -description: First company in Sweden - -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 - diff --git a/settings.gradle b/settings.gradle index 544260b7..1f1f8fa2 100644 --- a/settings.gradle +++ b/settings.gradle @@ -15,7 +15,6 @@ include 'test/integration-tests-openldap' include 'test/integration-tests-sunone' include 'test/integration-tests-ad' include 'samples/plain' -include 'samples/samples-utils' include 'samples/simple-odm' rootProject.children.each { p->