From a9cffce3fbeb9cb737338ef60cb4ba70512f9cc9 Mon Sep 17 00:00:00 2001 From: Dennis Crissman Date: Thu, 26 Mar 2015 12:59:51 -0400 Subject: [PATCH 1/6] add info methods --- .../ldap/test/LdapServerExternalResource.java | 69 +++++++++++++------ 1 file changed, 48 insertions(+), 21 deletions(-) diff --git a/lightblue-ldap-test/src/main/java/com/redhat/lightblue/ldap/test/LdapServerExternalResource.java b/lightblue-ldap-test/src/main/java/com/redhat/lightblue/ldap/test/LdapServerExternalResource.java index 28fb723..f13f177 100644 --- a/lightblue-ldap-test/src/main/java/com/redhat/lightblue/ldap/test/LdapServerExternalResource.java +++ b/lightblue-ldap-test/src/main/java/com/redhat/lightblue/ldap/test/LdapServerExternalResource.java @@ -52,17 +52,19 @@ public class LdapServerExternalResource extends ExternalResource { * @return simple instance of {@link LdapServerExternalResource}. */ @SuppressWarnings("serial") - public static LdapServerExternalResource createDefaultInstance(){ - return new LdapServerExternalResource(null, new LinkedHashMap(){{ - put("dc=com", new Attribute[]{ - new Attribute("objectClass", "top"), - new Attribute("objectClass", "domain"), - new Attribute("dc", "com")}); - put("dc=example,dc=com", new Attribute[]{ - new Attribute("objectClass", "top"), - new Attribute("objectClass", "domain"), - new Attribute("dc", "example")}); - }}); + public static LdapServerExternalResource createDefaultInstance() { + return new LdapServerExternalResource(null, new LinkedHashMap() { + { + put("dc=com", new Attribute[]{ + new Attribute("objectClass", "top"), + new Attribute("objectClass", "domain"), + new Attribute("dc", "com")}); + put("dc=example,dc=com", new Attribute[]{ + new Attribute("objectClass", "top"), + new Attribute("objectClass", "domain"), + new Attribute("dc", "example")}); + } + }); } @Retention(RetentionPolicy.RUNTIME) @@ -71,8 +73,11 @@ public static LdapServerExternalResource createDefaultInstance(){ @Documented public @interface InMemoryLdapServer { String[] baseDns() default {DEFAULT_BASE_DN}; + BindCriteria[] bindCriteria() default {@BindCriteria()}; + String name() default "test"; + int port() default DEFAULT_PORT; } @@ -81,6 +86,7 @@ public static LdapServerExternalResource createDefaultInstance(){ @Documented public @interface BindCriteria { String bindableDn() default DEFAULT_BINDABLE_DN; + String password() default DEFAULT_PASSWORD; } @@ -89,23 +95,23 @@ public static LdapServerExternalResource createDefaultInstance(){ private final LinkedHashMap preloadDnData; private final Schema schema; - public LdapServerExternalResource(){ + public LdapServerExternalResource() { this(null, null); } - public LdapServerExternalResource(Schema schema, LinkedHashMap preload){ + public LdapServerExternalResource(Schema schema, LinkedHashMap preload) { this.schema = schema; this.preloadDnData = preload; } @Override - public Statement apply(Statement base, Description description){ + public Statement apply(Statement base, Description description) { imlsAnnotation = description.getAnnotation(InMemoryLdapServer.class); - if((imlsAnnotation == null) && description.isTest()){ + if ((imlsAnnotation == null) && description.isTest()) { imlsAnnotation = description.getTestClass().getAnnotation(InMemoryLdapServer.class); } - if(imlsAnnotation == null){ + if (imlsAnnotation == null) { throw new IllegalStateException("@InMemoryLdapServer must be set on suite or test level."); } @@ -116,7 +122,7 @@ public Statement apply(Statement base, Description description){ protected void before() throws Throwable { InMemoryDirectoryServerConfig config = new InMemoryDirectoryServerConfig(imlsAnnotation.baseDns()); - for(BindCriteria bindCriteria : imlsAnnotation.bindCriteria()){ + for (BindCriteria bindCriteria : imlsAnnotation.bindCriteria()) { config.addAdditionalBindCredentials(bindCriteria.bindableDn(), bindCriteria.password()); } @@ -128,8 +134,8 @@ protected void before() throws Throwable { server = new InMemoryDirectoryServer(config); server.startListening(); - if(preloadDnData != null){ - for(Entry entry : preloadDnData.entrySet()){ + if (preloadDnData != null) { + for (Entry entry : preloadDnData.entrySet()) { add(entry.getKey(), entry.getValue()); } } @@ -137,14 +143,35 @@ protected void before() throws Throwable { @Override protected void after() { - if(server != null){ + if (server != null) { server.shutDown(true); server = null; } } - public void add(String dn, Attribute... attributes) throws LDIFException, LDAPException{ + public void add(String dn, Attribute... attributes) throws LDIFException, LDAPException { server.add(dn, attributes); } + /** + * @return the actual name used by the ldap server. + */ + public String getName() { + return imlsAnnotation.name(); + } + + /** + * @return the actual port used by the ldap server. + */ + public int getPort() { + return imlsAnnotation.port(); + } + + /** + * @return the actual basedns used by the ldap server. + */ + public String[] getBaseDNs() { + return imlsAnnotation.baseDns(); + } + } From 45d4a214d23aa6c44c911535f8c276f3bb82845a Mon Sep 17 00:00:00 2001 From: Dennis Crissman Date: Tue, 7 Apr 2015 12:36:08 -0400 Subject: [PATCH 2/6] remove unused classes --- .../test/DefaultEquivalencyEvaluator.java | 40 ------------------- .../ldap/test/EquivalencyEvaluator.java | 37 ----------------- 2 files changed, 77 deletions(-) delete mode 100644 lightblue-ldap-test/src/main/java/com/redhat/lightblue/ldap/test/DefaultEquivalencyEvaluator.java delete mode 100644 lightblue-ldap-test/src/main/java/com/redhat/lightblue/ldap/test/EquivalencyEvaluator.java diff --git a/lightblue-ldap-test/src/main/java/com/redhat/lightblue/ldap/test/DefaultEquivalencyEvaluator.java b/lightblue-ldap-test/src/main/java/com/redhat/lightblue/ldap/test/DefaultEquivalencyEvaluator.java deleted file mode 100644 index c1709a7..0000000 --- a/lightblue-ldap-test/src/main/java/com/redhat/lightblue/ldap/test/DefaultEquivalencyEvaluator.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright 2015 Red Hat, Inc. and/or its affiliates. - - This file is part of lightblue. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - */ -package com.redhat.lightblue.ldap.test; - -/** - * Simple implementation that calls the equals method on the first object - * and passes in the second. - * - * @author dcrissman - */ -public class DefaultEquivalencyEvaluator implements EquivalencyEvaluator{ - - @Override - public boolean isEquivalent(Object obj1, Object obj2) { - if(obj1 == null){ - if(obj2 == null){ - return true; - } - return false; - } - return obj1.equals(obj2); - } - -} diff --git a/lightblue-ldap-test/src/main/java/com/redhat/lightblue/ldap/test/EquivalencyEvaluator.java b/lightblue-ldap-test/src/main/java/com/redhat/lightblue/ldap/test/EquivalencyEvaluator.java deleted file mode 100644 index 9b0b8f4..0000000 --- a/lightblue-ldap-test/src/main/java/com/redhat/lightblue/ldap/test/EquivalencyEvaluator.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright 2015 Red Hat, Inc. and/or its affiliates. - - This file is part of lightblue. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - */ -package com.redhat.lightblue.ldap.test; - -/** - * When two Objects can be equivalent for testing purposes, but the equals method was not overridden - * or does not provide the desired functionality. - * - * @author Dennis Crissman - */ -public interface EquivalencyEvaluator { - - /** - * Determines if the two passed in objects are equivalent as defined by the implementation. - * @param obj1 - * @param obj2 - * @return true if objects are evuivalent, otherwise false. - */ - boolean isEquivalent(Object obj1, Object obj2); - -} From 06b4c4875592a6f52ba1fa80e1fb93ed4778fffb Mon Sep 17 00:00:00 2001 From: Dennis Crissman Date: Thu, 26 Mar 2015 12:58:52 -0400 Subject: [PATCH 3/6] use mongo test controller --- lightblue-ldap-integration-test/pom.xml | 1 - .../ldap/ITCaseLdapCRUDControllerTest.java | 1 + ...TCaseLdapCRUDController_DataType_Test.java | 1 + ...apCRUDController_InvalidMetadata_Test.java | 1 + ...ITCaseLdapCRUDController_Objects_Test.java | 1 + ...dapCRUDController_WithProperties_Test.java | 3 ++- lightblue-ldap-test/pom.xml | 6 +++++ .../test}/AbstractLdapCRUDController.java | 27 ++++++++++++------- pom.xml | 8 ++++++ 9 files changed, 37 insertions(+), 12 deletions(-) rename {lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap => lightblue-ldap-test/src/main/java/com/redhat/lightblue/ldap/test}/AbstractLdapCRUDController.java (63%) diff --git a/lightblue-ldap-integration-test/pom.xml b/lightblue-ldap-integration-test/pom.xml index 584c9c8..5a76cf3 100644 --- a/lightblue-ldap-integration-test/pom.xml +++ b/lightblue-ldap-integration-test/pom.xml @@ -51,7 +51,6 @@ com.redhat.lightblue.mongo lightblue-mongo-test - 1.3.0-SNAPSHOT test diff --git a/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDControllerTest.java b/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDControllerTest.java index 2b5fec4..1c9eb50 100644 --- a/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDControllerTest.java +++ b/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDControllerTest.java @@ -38,6 +38,7 @@ import com.redhat.lightblue.Response; import com.redhat.lightblue.crud.FindRequest; import com.redhat.lightblue.crud.InsertionRequest; +import com.redhat.lightblue.ldap.test.AbstractLdapCRUDController; import com.redhat.lightblue.ldap.test.LdapServerExternalResource; import com.redhat.lightblue.mongo.test.MongoServerExternalResource; import com.redhat.lightblue.test.FakeClientIdentification; diff --git a/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_DataType_Test.java b/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_DataType_Test.java index b6eb078..451e7c7 100644 --- a/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_DataType_Test.java +++ b/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_DataType_Test.java @@ -41,6 +41,7 @@ import com.redhat.lightblue.Response; import com.redhat.lightblue.crud.FindRequest; import com.redhat.lightblue.crud.InsertionRequest; +import com.redhat.lightblue.ldap.test.AbstractLdapCRUDController; import com.redhat.lightblue.ldap.test.LdapServerExternalResource; import com.redhat.lightblue.metadata.types.DateType; import com.redhat.lightblue.mongo.test.MongoServerExternalResource; diff --git a/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_InvalidMetadata_Test.java b/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_InvalidMetadata_Test.java index d95621c..dd6071c 100644 --- a/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_InvalidMetadata_Test.java +++ b/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_InvalidMetadata_Test.java @@ -26,6 +26,7 @@ import org.junit.rules.ExpectedException; import com.fasterxml.jackson.databind.JsonNode; +import com.redhat.lightblue.ldap.test.AbstractLdapCRUDController; import com.redhat.lightblue.ldap.test.LdapServerExternalResource; import com.redhat.lightblue.metadata.EntityMetadata; import com.redhat.lightblue.metadata.Metadata; diff --git a/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_Objects_Test.java b/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_Objects_Test.java index d9316e6..e27460c 100644 --- a/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_Objects_Test.java +++ b/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_Objects_Test.java @@ -34,6 +34,7 @@ import com.redhat.lightblue.Response; import com.redhat.lightblue.crud.FindRequest; import com.redhat.lightblue.crud.InsertionRequest; +import com.redhat.lightblue.ldap.test.AbstractLdapCRUDController; import com.redhat.lightblue.ldap.test.LdapServerExternalResource; import com.redhat.lightblue.mongo.test.MongoServerExternalResource; import com.unboundid.ldap.sdk.Attribute; diff --git a/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_WithProperties_Test.java b/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_WithProperties_Test.java index 936f508..cdc56d9 100644 --- a/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_WithProperties_Test.java +++ b/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_WithProperties_Test.java @@ -34,6 +34,7 @@ import com.redhat.lightblue.Response; import com.redhat.lightblue.crud.FindRequest; import com.redhat.lightblue.crud.InsertionRequest; +import com.redhat.lightblue.ldap.test.AbstractLdapCRUDController; import com.redhat.lightblue.ldap.test.LdapServerExternalResource; import com.redhat.lightblue.mongo.test.MongoServerExternalResource; import com.unboundid.ldap.sdk.Attribute; @@ -111,7 +112,7 @@ public void test2FindCustomerWithProperties() throws Exception { + "\"cn\":\"Frodo Baggins\"," + "\"interfaces#\":4," + "\"interfaces\":[\"top\",\"person\",\"organizationalPerson\",\"inetOrgPerson\"]}]", - entityData.toString(), true); + entityData.toString(), true); } } diff --git a/lightblue-ldap-test/pom.xml b/lightblue-ldap-test/pom.xml index b118dce..5df6b11 100644 --- a/lightblue-ldap-test/pom.xml +++ b/lightblue-ldap-test/pom.xml @@ -43,5 +43,11 @@ junit compile + + com.redhat.lightblue.mongo + lightblue-mongo-test + compile + + diff --git a/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/AbstractLdapCRUDController.java b/lightblue-ldap-test/src/main/java/com/redhat/lightblue/ldap/test/AbstractLdapCRUDController.java similarity index 63% rename from lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/AbstractLdapCRUDController.java rename to lightblue-ldap-test/src/main/java/com/redhat/lightblue/ldap/test/AbstractLdapCRUDController.java index b55b3b7..461dd3b 100644 --- a/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/AbstractLdapCRUDController.java +++ b/lightblue-ldap-test/src/main/java/com/redhat/lightblue/ldap/test/AbstractLdapCRUDController.java @@ -16,26 +16,33 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -package com.redhat.lightblue.crud.ldap; +package com.redhat.lightblue.ldap.test; +import org.junit.BeforeClass; import org.junit.ClassRule; -import com.redhat.lightblue.ldap.test.LdapServerExternalResource; import com.redhat.lightblue.ldap.test.LdapServerExternalResource.InMemoryLdapServer; -import com.redhat.lightblue.mongo.test.MongoServerExternalResource; -import com.redhat.lightblue.mongo.test.MongoServerExternalResource.InMemoryMongoServer; -import com.redhat.lightblue.test.AbstractCRUDTestController; +import com.redhat.lightblue.mongo.test.AbstractMongoCRUDTestController; -@InMemoryMongoServer @InMemoryLdapServer -public abstract class AbstractLdapCRUDController extends AbstractCRUDTestController { - - @ClassRule - public static MongoServerExternalResource mongoServer = new MongoServerExternalResource(); +public abstract class AbstractLdapCRUDController extends AbstractMongoCRUDTestController { @ClassRule public static LdapServerExternalResource ldapServer = LdapServerExternalResource.createDefaultInstance(); + @BeforeClass + public static void prepareLdapDatasources() { + if (System.getProperty("ldap.host") == null) { + System.setProperty("ldap.host", "localhost"); + } + if (System.getProperty("ldap.port") == null) { + System.setProperty("ldap.port", String.valueOf(ldapServer.getPort())); + } + if (System.getProperty("ldap.database") == null) { + System.setProperty("ldap.database", "lightblue"); + } + } + public AbstractLdapCRUDController() throws Exception { super(); } diff --git a/pom.xml b/pom.xml index 329b0fe..4183b8a 100644 --- a/pom.xml +++ b/pom.xml @@ -164,6 +164,14 @@ test + + + com.redhat.lightblue.mongo + lightblue-mongo-test + 1.3.0-SNAPSHOT + test + + com.unboundid From 34cb2146bd2fc390cb9d35591c0f0b6a58908c83 Mon Sep 17 00:00:00 2001 From: Dennis Crissman Date: Tue, 7 Apr 2015 13:01:37 -0400 Subject: [PATCH 4/6] update pom to include dependency --- lightblue-ldap-test/pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lightblue-ldap-test/pom.xml b/lightblue-ldap-test/pom.xml index 5df6b11..0fa3785 100644 --- a/lightblue-ldap-test/pom.xml +++ b/lightblue-ldap-test/pom.xml @@ -43,6 +43,11 @@ junit compile + + com.redhat.lightblue + lightblue-core-test + compile + com.redhat.lightblue.mongo lightblue-mongo-test From 5ced0fd7435d8c9c834086e439742dda473a2d43 Mon Sep 17 00:00:00 2001 From: Dennis Crissman Date: Tue, 7 Apr 2015 13:14:12 -0400 Subject: [PATCH 5/6] add ldap custom config json files --- .../ldap/test/AbstractLdapCRUDController.java | 33 ++++++++++++++++++- .../src/main/resources/ldap-datasources.json | 4 +-- .../main/resources/ldap-lightblue-crud.json | 0 .../resources/ldap-lightblue-metadata.json | 2 +- 4 files changed, 35 insertions(+), 4 deletions(-) rename lightblue-ldap-integration-test/src/test/resources/datasources.json => lightblue-ldap-test/src/main/resources/ldap-datasources.json (93%) rename lightblue-ldap-integration-test/src/test/resources/lightblue-crud.json => lightblue-ldap-test/src/main/resources/ldap-lightblue-crud.json (100%) rename lightblue-ldap-integration-test/src/test/resources/lightblue-metadata.json => lightblue-ldap-test/src/main/resources/ldap-lightblue-metadata.json (91%) diff --git a/lightblue-ldap-test/src/main/java/com/redhat/lightblue/ldap/test/AbstractLdapCRUDController.java b/lightblue-ldap-test/src/main/java/com/redhat/lightblue/ldap/test/AbstractLdapCRUDController.java index 461dd3b..1234e3f 100644 --- a/lightblue-ldap-test/src/main/java/com/redhat/lightblue/ldap/test/AbstractLdapCRUDController.java +++ b/lightblue-ldap-test/src/main/java/com/redhat/lightblue/ldap/test/AbstractLdapCRUDController.java @@ -18,9 +18,14 @@ */ package com.redhat.lightblue.ldap.test; +import static com.redhat.lightblue.util.JsonUtils.json; + +import java.io.IOException; + import org.junit.BeforeClass; import org.junit.ClassRule; +import com.fasterxml.jackson.databind.JsonNode; import com.redhat.lightblue.ldap.test.LdapServerExternalResource.InMemoryLdapServer; import com.redhat.lightblue.mongo.test.AbstractMongoCRUDTestController; @@ -32,6 +37,9 @@ public abstract class AbstractLdapCRUDController extends AbstractMongoCRUDTestCo @BeforeClass public static void prepareLdapDatasources() { + if (System.getProperty("ldap.datasource") == null) { + System.setProperty("ldap.datasource", "myldapdatasource"); + } if (System.getProperty("ldap.host") == null) { System.setProperty("ldap.host", "localhost"); } @@ -39,7 +47,7 @@ public static void prepareLdapDatasources() { System.setProperty("ldap.port", String.valueOf(ldapServer.getPort())); } if (System.getProperty("ldap.database") == null) { - System.setProperty("ldap.database", "lightblue"); + System.setProperty("ldap.database", "test"); } } @@ -47,4 +55,27 @@ public AbstractLdapCRUDController() throws Exception { super(); } + @Override + protected JsonNode getLightblueCrudJson() throws Exception { + return json(loadResource("/ldap-lightblue-crud.json", true)); + } + + @Override + protected JsonNode getLightblueMetadataJson() throws Exception { + return json(loadResource("/ldap-lightblue-metadata.json", true)); + } + + @Override + protected JsonNode getDatasourcesJson() { + try { + if (getDatasourcesResourceName() == null) { + return json(loadResource("/ldap-datasources.json", true)); + } else { + return json(loadResource(getDatasourcesResourceName(), false)); + } + } catch (IOException e) { + throw new RuntimeException("Unable to load resource '" + getDatasourcesResourceName() + "'", e); + } + } + } diff --git a/lightblue-ldap-integration-test/src/test/resources/datasources.json b/lightblue-ldap-test/src/main/resources/ldap-datasources.json similarity index 93% rename from lightblue-ldap-integration-test/src/test/resources/datasources.json rename to lightblue-ldap-test/src/main/resources/ldap-datasources.json index 21f969e..1924c46 100644 --- a/lightblue-ldap-integration-test/src/test/resources/datasources.json +++ b/lightblue-ldap-test/src/main/resources/ldap-datasources.json @@ -1,5 +1,5 @@ { - "myldapserver": { + "${ldap.datasource}": { "type" : "com.redhat.lightblue.config.ldap.LdapDataSourceConfiguration", "database" : "${ldap.database}", @@ -14,7 +14,7 @@ } ] }, - "mongo" : { + "${mongo.datasource}" : { "type" : "com.redhat.lightblue.mongo.config.MongoConfiguration", "metadataBackendParser" : "com.redhat.lightblue.metadata.mongo.MongoBackendParser", "ssl" : false, diff --git a/lightblue-ldap-integration-test/src/test/resources/lightblue-crud.json b/lightblue-ldap-test/src/main/resources/ldap-lightblue-crud.json similarity index 100% rename from lightblue-ldap-integration-test/src/test/resources/lightblue-crud.json rename to lightblue-ldap-test/src/main/resources/ldap-lightblue-crud.json diff --git a/lightblue-ldap-integration-test/src/test/resources/lightblue-metadata.json b/lightblue-ldap-test/src/main/resources/ldap-lightblue-metadata.json similarity index 91% rename from lightblue-ldap-integration-test/src/test/resources/lightblue-metadata.json rename to lightblue-ldap-test/src/main/resources/ldap-lightblue-metadata.json index a1cb01b..c39084a 100644 --- a/lightblue-ldap-integration-test/src/test/resources/lightblue-metadata.json +++ b/lightblue-ldap-test/src/main/resources/ldap-lightblue-metadata.json @@ -1,6 +1,6 @@ { "type" : "com.redhat.lightblue.mongo.config.MongoMetadataConfiguration", - "dataSource" : "mongo", + "dataSource" : "${mongo.datasource}", "collection": "metadata", "backendParsers": [ { From 5887d2cbaac0bfd286d356b3d2611637aff5ee57 Mon Sep 17 00:00:00 2001 From: Dennis Crissman Date: Tue, 7 Apr 2015 13:15:53 -0400 Subject: [PATCH 6/6] remove no longer needed boiler plate setup --- .../crud/ldap/ITCaseLdapCRUDControllerTest.java | 11 +---------- .../ldap/ITCaseLdapCRUDController_DataType_Test.java | 9 --------- ...ITCaseLdapCRUDController_InvalidMetadata_Test.java | 9 --------- .../ldap/ITCaseLdapCRUDController_Objects_Test.java | 9 --------- .../ITCaseLdapCRUDController_WithProperties_Test.java | 9 --------- 5 files changed, 1 insertion(+), 46 deletions(-) diff --git a/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDControllerTest.java b/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDControllerTest.java index 1c9eb50..d08b095 100644 --- a/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDControllerTest.java +++ b/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDControllerTest.java @@ -25,6 +25,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import java.io.IOException; import java.util.Arrays; import org.apache.commons.lang.StringUtils; @@ -39,12 +40,9 @@ import com.redhat.lightblue.crud.FindRequest; import com.redhat.lightblue.crud.InsertionRequest; import com.redhat.lightblue.ldap.test.AbstractLdapCRUDController; -import com.redhat.lightblue.ldap.test.LdapServerExternalResource; -import com.redhat.lightblue.mongo.test.MongoServerExternalResource; import com.redhat.lightblue.test.FakeClientIdentification; import com.redhat.lightblue.util.test.AbstractJsonNodeTest; import com.unboundid.ldap.sdk.Attribute; -import java.io.IOException; /** * NOTE: This test suite is intended to be run in a certain order. Selectively running unit tests @@ -69,15 +67,8 @@ public static void beforeClass() throws Exception { new Attribute("objectClass", "organizationalUnit"), new Attribute("ou", "Departments")}); - System.setProperty("ldap.host", "localhost"); - System.setProperty("ldap.port", String.valueOf(LdapServerExternalResource.DEFAULT_PORT)); - System.setProperty("ldap.database", "test"); System.setProperty("ldap.person.basedn", BASEDB_USERS); System.setProperty("ldap.department.basedn", BASEDB_DEPARTMENTS); - - System.setProperty("mongo.host", "localhost"); - System.setProperty("mongo.port", String.valueOf(MongoServerExternalResource.DEFAULT_PORT)); - System.setProperty("mongo.database", "lightblue"); } public ITCaseLdapCRUDControllerTest() throws Exception { diff --git a/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_DataType_Test.java b/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_DataType_Test.java index 451e7c7..66180ed 100644 --- a/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_DataType_Test.java +++ b/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_DataType_Test.java @@ -42,9 +42,7 @@ import com.redhat.lightblue.crud.FindRequest; import com.redhat.lightblue.crud.InsertionRequest; import com.redhat.lightblue.ldap.test.AbstractLdapCRUDController; -import com.redhat.lightblue.ldap.test.LdapServerExternalResource; import com.redhat.lightblue.metadata.types.DateType; -import com.redhat.lightblue.mongo.test.MongoServerExternalResource; import com.redhat.lightblue.util.test.AbstractJsonNodeTest; @RunWith(value = Parameterized.class) @@ -60,14 +58,7 @@ public static Collection data() { @BeforeClass public static void beforeClass() throws Exception { - System.setProperty("ldap.host", "localhost"); - System.setProperty("ldap.port", String.valueOf(LdapServerExternalResource.DEFAULT_PORT)); - System.setProperty("ldap.database", "test"); System.setProperty("ldap.datatype.basedn", "dc=example,dc=com"); - - System.setProperty("mongo.host", "localhost"); - System.setProperty("mongo.port", String.valueOf(MongoServerExternalResource.DEFAULT_PORT)); - System.setProperty("mongo.database", "lightblue"); } private final String cn; diff --git a/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_InvalidMetadata_Test.java b/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_InvalidMetadata_Test.java index dd6071c..e081ebe 100644 --- a/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_InvalidMetadata_Test.java +++ b/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_InvalidMetadata_Test.java @@ -27,10 +27,8 @@ import com.fasterxml.jackson.databind.JsonNode; import com.redhat.lightblue.ldap.test.AbstractLdapCRUDController; -import com.redhat.lightblue.ldap.test.LdapServerExternalResource; import com.redhat.lightblue.metadata.EntityMetadata; import com.redhat.lightblue.metadata.Metadata; -import com.redhat.lightblue.mongo.test.MongoServerExternalResource; import com.redhat.lightblue.util.test.AbstractJsonNodeTest; import com.unboundid.ldap.sdk.Attribute; @@ -48,14 +46,7 @@ public static void beforeClass() throws Exception { new Attribute("objectClass", "organizationalUnit"), new Attribute("ou", "Users")}); - System.setProperty("ldap.host", "localhost"); - System.setProperty("ldap.port", String.valueOf(LdapServerExternalResource.DEFAULT_PORT)); - System.setProperty("ldap.database", "test"); System.setProperty("ldap.person.basedn", BASEDB_USERS); - - System.setProperty("mongo.host", "localhost"); - System.setProperty("mongo.port", String.valueOf(MongoServerExternalResource.DEFAULT_PORT)); - System.setProperty("mongo.database", "lightblue"); } public ITCaseLdapCRUDController_InvalidMetadata_Test() throws Exception { diff --git a/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_Objects_Test.java b/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_Objects_Test.java index e27460c..829c112 100644 --- a/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_Objects_Test.java +++ b/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_Objects_Test.java @@ -35,8 +35,6 @@ import com.redhat.lightblue.crud.FindRequest; import com.redhat.lightblue.crud.InsertionRequest; import com.redhat.lightblue.ldap.test.AbstractLdapCRUDController; -import com.redhat.lightblue.ldap.test.LdapServerExternalResource; -import com.redhat.lightblue.mongo.test.MongoServerExternalResource; import com.unboundid.ldap.sdk.Attribute; @FixMethodOrder(MethodSorters.NAME_ASCENDING) @@ -51,14 +49,7 @@ public static void beforeClass() throws Exception { new Attribute("objectClass", "organizationalUnit"), new Attribute("ou", "Users")}); - System.setProperty("ldap.host", "localhost"); - System.setProperty("ldap.port", String.valueOf(LdapServerExternalResource.DEFAULT_PORT)); - System.setProperty("ldap.database", "test"); System.setProperty("ldap.personWithAddress.basedn", BASEDB_USERS); - - System.setProperty("mongo.host", "localhost"); - System.setProperty("mongo.port", String.valueOf(MongoServerExternalResource.DEFAULT_PORT)); - System.setProperty("mongo.database", "lightblue"); } public ITCaseLdapCRUDController_Objects_Test() throws Exception { diff --git a/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_WithProperties_Test.java b/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_WithProperties_Test.java index cdc56d9..3da0be5 100644 --- a/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_WithProperties_Test.java +++ b/lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDController_WithProperties_Test.java @@ -35,8 +35,6 @@ import com.redhat.lightblue.crud.FindRequest; import com.redhat.lightblue.crud.InsertionRequest; import com.redhat.lightblue.ldap.test.AbstractLdapCRUDController; -import com.redhat.lightblue.ldap.test.LdapServerExternalResource; -import com.redhat.lightblue.mongo.test.MongoServerExternalResource; import com.unboundid.ldap.sdk.Attribute; /** @@ -56,14 +54,7 @@ public static void beforeClass() throws Exception { new Attribute("objectClass", "organizationalUnit"), new Attribute("ou", "Customers")}); - System.setProperty("ldap.host", "localhost"); - System.setProperty("ldap.port", String.valueOf(LdapServerExternalResource.DEFAULT_PORT)); - System.setProperty("ldap.database", "test"); System.setProperty("ldap.customer.basedn", BASEDB_CUSTOMERS); - - System.setProperty("mongo.host", "localhost"); - System.setProperty("mongo.port", String.valueOf(MongoServerExternalResource.DEFAULT_PORT)); - System.setProperty("mongo.database", "lightblue"); } public ITCaseLdapCRUDController_WithProperties_Test() throws Exception {