Fixing breakage in CassandraRule in CHOP environment and making sure we're loading the usergrid properties cascaded in a test. Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/a5bae707 Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/a5bae707 Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/a5bae707 Branch: refs/pull/18/merge Commit: a5bae70715a21e0a4cd8fd0aa3c72b96fe68b41a Parents: 0456561 Author: Alex Karasulu Authored: Tue Jan 14 22:42:37 2014 +0200 Committer: Alex Karasulu Committed: Tue Jan 14 22:42:37 2014 +0200 ---------------------------------------------------------------------- stack/corepersistence/collection/pom.xml | 2 +- .../src/main/resources/usergrid.properties | 1 + .../collection/cassandra/CassandraRule.java | 11 +++++----- ...MvccEntitySerializationStrategyImplTest.java | 22 +++++++++++++++++--- .../src/test/resources/usergrid-CHOP.properties | 18 ++++++++++++++++ .../src/test/resources/usergrid-UNIT.properties | 1 + 6 files changed, 46 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a5bae707/stack/corepersistence/collection/pom.xml ---------------------------------------------------------------------- diff --git a/stack/corepersistence/collection/pom.xml b/stack/corepersistence/collection/pom.xml index d061204..bc62409 100644 --- a/stack/corepersistence/collection/pom.xml +++ b/stack/corepersistence/collection/pom.xml @@ -12,7 +12,7 @@ 3.0 - 3.2 + 3.3-SNAPSHOT 1.7.2 1.2.17 1.0-SNAPSHOT http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a5bae707/stack/corepersistence/collection/src/main/resources/usergrid.properties ---------------------------------------------------------------------- diff --git a/stack/corepersistence/collection/src/main/resources/usergrid.properties b/stack/corepersistence/collection/src/main/resources/usergrid.properties new file mode 100644 index 0000000..37a8fa8 --- /dev/null +++ b/stack/corepersistence/collection/src/main/resources/usergrid.properties @@ -0,0 +1 @@ +# Keep nothing but production defaults in here \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a5bae707/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/cassandra/CassandraRule.java ---------------------------------------------------------------------- diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/cassandra/CassandraRule.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/cassandra/CassandraRule.java index bd37c1f..ab94574 100644 --- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/cassandra/CassandraRule.java +++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/cassandra/CassandraRule.java @@ -43,11 +43,6 @@ public class CassandraRule extends EnvironResource { Injector injector = Guice.createInjector( new GuicyFigModule( CassandraFig.class ) ); cassandraFig = injector.getInstance( CassandraFig.class ); - cassandraFig.override( "getPort", THRIFT_PORT_STR ); - cassandraFig.override( "getConnections", "20" ); - cassandraFig.override( "getHosts", "localhost" ); - cassandraFig.override( "getClusterName", "Usergrid" ); - cassandraFig.override( "getKeyspaceName", "Usergrid_Collections" ); } @@ -58,6 +53,12 @@ public class CassandraRule extends EnvironResource { @Override protected void before() throws Throwable { + cassandraFig.override( "getPort", THRIFT_PORT_STR ); + cassandraFig.override( "getConnections", "20" ); + cassandraFig.override( "getHosts", "localhost" ); + cassandraFig.override( "getClusterName", "Usergrid" ); + cassandraFig.override( "getKeyspaceName", "Usergrid_Collections" ); + if ( started ) { return; } http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a5bae707/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImplTest.java ---------------------------------------------------------------------- diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImplTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImplTest.java index 061023e..97dc803 100644 --- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImplTest.java +++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImplTest.java @@ -1,12 +1,12 @@ package org.apache.usergrid.persistence.collection.serialization.impl; +import java.io.IOException; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.UUID; -import org.jukito.JukitoModule; import org.jukito.JukitoRunner; import org.jukito.UseModules; import org.junit.Before; @@ -47,6 +47,7 @@ import org.apache.usergrid.persistence.model.util.UUIDGenerator; import com.google.common.base.Optional; import com.google.inject.Inject; import com.netflix.astyanax.connectionpool.exceptions.ConnectionException; +import com.netflix.config.ConfigurationManager; import static junit.framework.TestCase.assertEquals; import static junit.framework.TestCase.assertNotNull; @@ -58,13 +59,28 @@ import static org.mockito.Mockito.mock; /** @author tnine */ -@IterationChop( iterations = 1000, runners = 6, threads = 9 ) +@IterationChop( iterations = 1000, threads = 9 ) @RunWith( JukitoRunner.class ) @UseModules( CollectionModule.class ) public class MvccEntitySerializationStrategyImplTest { /** Our RX I/O threads and this should have the same value */ private static final String CONNECTION_COUNT = "20"; + static { + /* + * -------------------------------------------------------------------- + * Archaius Configuration Settings + * -------------------------------------------------------------------- + */ + + try { + ConfigurationManager.loadCascadedPropertiesFromResources( "usergrid" ); + } + catch ( IOException e ) { + throw new RuntimeException( "Cannot do much without properly loading our configuration.", e ); + } + } + @Inject private MvccEntitySerializationStrategy serializationStrategy; @@ -90,6 +106,7 @@ public class MvccEntitySerializationStrategyImplTest { @Inject @Overrides( name = "unit-test", + environments = Env.UNIT, options = { @Option( method = "getMaxThreadCount", override = CONNECTION_COUNT ) } @@ -105,7 +122,6 @@ public class MvccEntitySerializationStrategyImplTest { @Before public void setupClass() { -// GuicyFigModule.injectMembers( this ); assertNotNull( cassandraFig ); cassandraFig.bypass( "getPort", CassandraRule.THRIFT_PORT_STR ); http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a5bae707/stack/corepersistence/collection/src/test/resources/usergrid-CHOP.properties ---------------------------------------------------------------------- diff --git a/stack/corepersistence/collection/src/test/resources/usergrid-CHOP.properties b/stack/corepersistence/collection/src/test/resources/usergrid-CHOP.properties new file mode 100644 index 0000000..e05f487 --- /dev/null +++ b/stack/corepersistence/collection/src/test/resources/usergrid-CHOP.properties @@ -0,0 +1,18 @@ +# These are for CHOP environment settings + +#cassandra.connections=${cassandra.connections} +#cassandra.port=9160 +#cassandra.version=1.2 +#cassandra.hosts=${cassandra.hosts} +#cassandra.cluster_name=Usergrid +#collections.keyspace=Usergrid_Collections +#cassandra.timeout=5000 + + +cassandra.connections=10 +cassandra.port=9160 +cassandra.version=1.2 +cassandra.hosts=54.224.205.239, 107.21.155.136, 54.205.144.212, 23.22.49.179, 23.22.49.179, 54.242.63.170 +cassandra.cluster_name=Usergrid +collections.keyspace=Usergrid_Collections +cassandra.timeout=5000 http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a5bae707/stack/corepersistence/collection/src/test/resources/usergrid-UNIT.properties ---------------------------------------------------------------------- diff --git a/stack/corepersistence/collection/src/test/resources/usergrid-UNIT.properties b/stack/corepersistence/collection/src/test/resources/usergrid-UNIT.properties new file mode 100644 index 0000000..6a5013c --- /dev/null +++ b/stack/corepersistence/collection/src/test/resources/usergrid-UNIT.properties @@ -0,0 +1 @@ +# Keep nothing but overriding test defaults in here \ No newline at end of file