You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by to...@apache.org on 2014/12/12 22:18:20 UTC

[1/2] incubator-usergrid git commit: Renamed CassandraResource to SpringResource, since it really initializes spring, not cassandra

Repository: incubator-usergrid
Updated Branches:
  refs/heads/USERGRID-273 938855f8b -> e916d6d6a


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/SpringResource.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/SpringResource.java b/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/SpringResource.java
new file mode 100644
index 0000000..77a28cf
--- /dev/null
+++ b/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/SpringResource.java
@@ -0,0 +1,310 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.usergrid.cassandra;
+
+
+import java.io.IOException;
+import java.util.Properties;
+
+import org.junit.rules.ExternalResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import org.apache.commons.lang.ArrayUtils;
+
+
+/**
+ * A JUnit {@link org.junit.rules.ExternalResource} designed to set our system properties then start spring so it connects to cassandra correctly
+ *
+ */
+public class SpringResource extends ExternalResource {
+    public static final Logger LOG = LoggerFactory.getLogger( SpringResource.class );
+    public static final int DEFAULT_RPC_PORT = 9160;
+    public static final int DEFAULT_STORAGE_PORT = 7000;
+    public static final int DEFAULT_SSL_STORAGE_PORT = 7001;
+    public static final int DEFAULT_NATIVE_TRANSPORT_PORT = 9042;
+    public static final String DEFAULT_HOST = "127.0.0.1";
+
+    public static final String PROPERTIES_FILE = "project.properties";
+
+    public static final String NATIVE_TRANSPORT_PORT_KEY = "native_transport_port";
+    public static final String RPC_PORT_KEY = "rpc_port";
+    public static final String STORAGE_PORT_KEY = "storage_port";
+    public static final String SSL_STORAGE_PORT_KEY = "ssl_storage_port";
+
+    private static final Object lock = new Object();
+
+    private boolean initialized = false;
+    private int rpcPort = DEFAULT_RPC_PORT;
+    private int storagePort = DEFAULT_STORAGE_PORT;
+    private int sslStoragePort = DEFAULT_SSL_STORAGE_PORT;
+    private int nativeTransportPort = DEFAULT_NATIVE_TRANSPORT_PORT;
+
+    private ConfigurableApplicationContext applicationContext;
+    private SchemaManager schemaManager;
+
+    private static SpringResource instance;
+
+    private static Properties properties = null;
+
+
+    /**
+     * Creates a Cassandra starting ExternalResource for JUnit test cases which uses the specified SchemaManager for
+     * Cassandra.
+     */
+    SpringResource( int rpcPort, int storagePort, int sslStoragePort, int nativeTransportPort ) {
+        LOG.info( "Creating CassandraResource using {} for the ClassLoader.",
+                Thread.currentThread().getContextClassLoader() );
+
+        this.rpcPort = rpcPort;
+        this.storagePort = storagePort;
+        this.sslStoragePort = sslStoragePort;
+        this.nativeTransportPort = nativeTransportPort;
+
+
+        try {
+            String[] locations = { "usergrid-properties-context.xml" };
+            ConfigurableApplicationContext appContext = new ClassPathXmlApplicationContext( locations );
+
+            Properties properties = ( Properties ) appContext.getBean( "properties" );
+            properties.putAll( ArrayUtils.toMap( this.getProjectProperties().entrySet().toArray( new Object[] { } ) ) );
+        }
+        catch ( Exception ex ) {
+            throw new RuntimeException( "Error getting properties", ex );
+        }
+    }
+
+
+    /**
+     * Gets the rpcPort for Cassandra.
+     *
+     * @return the rpc_port (in yaml file) used by Cassandra
+     */
+    public int getRpcPort() {
+        return rpcPort;
+    }
+
+
+
+
+    /**
+     * Gets a bean from the application context.
+     *
+     * @param requiredType the type of the bean
+     * @param <T> the type of the bean
+     *
+     * @return the bean
+     */
+    public <T> T getBean( String name, Class<T> requiredType ) {
+        protect();
+        return applicationContext.getBean( name, requiredType );
+    }
+
+
+    /**
+     * Gets a bean from the application context.
+     *
+     * @param requiredType the type of the bean
+     * @param <T> the type of the bean
+     *
+     * @return the bean
+     */
+    public <T> T getBean( Class<T> requiredType ) {
+        protect();
+        return applicationContext.getBean( requiredType );
+    }
+
+
+    /**
+     * Gets whether this resource is ready to use.
+     *
+     * @return true if ready to use, false otherwise
+     */
+    public boolean isReady() {
+        return initialized;
+    }
+
+
+
+
+    /**
+     * Protects against IDE or command line runs of a unit test which when starting the test outside of the Suite will
+     * not start the resource. This makes sure the resource is automatically started on a usage attempt.
+     */
+    private void protect() {
+        if ( !isReady() ) {
+            try {
+                before();
+            }
+            catch ( Throwable t ) {
+                LOG.error( "Failed to start up Cassandra.", t );
+                throw new RuntimeException( t );
+            }
+        }
+    }
+
+
+    /**
+     * Starts up Cassandra before TestSuite or test Class execution.
+     *
+     * @throws Throwable if we cannot start up Cassandra
+     */
+    @Override
+    protected void before() throws Throwable {
+        /*
+         * Note that the lock is static so it is JVM wide which prevents other
+         * instances of this class from making changes to the Cassandra system
+         * properties while we are initializing Cassandra with unique settings.
+         */
+
+        synchronized ( lock ) {
+            super.before();
+
+            if ( isReady() ) {
+                return;
+            }
+
+            startSpring();
+        }
+    }
+
+
+    private void startSpring() throws Throwable {
+        LOG.info( "-------------------------------------------------------------------" );
+        LOG.info( "Initializing External Cassandra" );
+        LOG.info( "-------------------------------------------------------------------" );
+        LOG.info( "before() test, setting system properties for ports : "
+                        + "[rpc, storage, sslStorage, native] = [{}, {}, {}, {}]",
+                new Object[] { rpcPort, storagePort, sslStoragePort, nativeTransportPort } );
+        String[] locations = { "usergrid-test-context.xml" };
+        applicationContext = new ClassPathXmlApplicationContext( locations );
+        applicationContext.refresh();
+        initialized = true;
+        lock.notifyAll();
+    }
+
+
+    /**
+     * Loads the specified {@link SchemaManager} or the default manager if the manager name that is provided is null.
+     *
+     *
+     */
+    private void loadSchemaManager() {
+        if ( !applicationContext.isActive() ) {
+            LOG.info( "Restarting context..." );
+            applicationContext.refresh();
+        }
+
+
+        LOG.info( "The SchemaManager is not specified - using the default SchemaManager impl" );
+        this.schemaManager = applicationContext.getBean( SchemaManager.class );
+
+        schemaManager.create();
+        schemaManager.populateBaseData();
+    }
+
+
+    public static SpringResource setAllocatedPorts() {
+        synchronized ( lock ) {
+
+            //don't keep re-initializing if it's already done
+            if(instance != null){
+                return instance;
+            }
+
+            Properties props = new Properties();
+            try {
+                props.load( ClassLoader.getSystemResourceAsStream( "project.properties" ) );
+            }
+            catch ( IOException e ) {
+                LOG.error( "Unable to load project properties: {}", e.getLocalizedMessage() );
+            }
+            int rpcPort = Integer.parseInt(
+                    props.getProperty( "cassandra.rpcPort", Integer.toString( SpringResource.DEFAULT_RPC_PORT ) ) );
+            int storagePort = Integer.parseInt( props.getProperty( "cassandra.storagePort",
+                    Integer.toString( SpringResource.DEFAULT_STORAGE_PORT ) ) );
+            int sslStoragePort = Integer.parseInt( props.getProperty( "cassandra.sslPort",
+                    Integer.toString( SpringResource.DEFAULT_SSL_STORAGE_PORT ) ) );
+            int nativeTransportPort = Integer.parseInt( props.getProperty( "cassandra.nativeTransportPort",
+                    Integer.toString( SpringResource.DEFAULT_NATIVE_TRANSPORT_PORT ) ) );
+            String host = props.getProperty( "cassandra.host", DEFAULT_HOST );
+
+            System.setProperty( "cassandra.url", host + ":" + Integer.toString( rpcPort ) );
+            System.setProperty( "cassandra.cluster", props.getProperty( "cassandra.cluster", "Usergrid" ) );
+            System.setProperty( "cassandra-foreground", "true" );
+            System.setProperty( "log4j.defaultInitOverride", "true" );
+            System.setProperty( "log4j.configuration", "log4j.properties" );
+            System.setProperty( "cassandra.ring_delay_ms", "100" );
+
+            System.setProperty( "cassandra." + RPC_PORT_KEY, Integer.toString( rpcPort ) );
+            System.setProperty( "cassandra." + STORAGE_PORT_KEY, Integer.toString( storagePort ) );
+            System.setProperty( "cassandra." + SSL_STORAGE_PORT_KEY, Integer.toString( sslStoragePort ) );
+            System.setProperty( "cassandra." + NATIVE_TRANSPORT_PORT_KEY, Integer.toString( nativeTransportPort ) );
+
+            LOG.info( "project.properties loaded properties for ports : "
+                            + "[rpc, storage, sslStorage, native] = [{}, {}, {}, {}]",
+                    new Object[] { rpcPort, storagePort, sslStoragePort, nativeTransportPort } );
+
+
+            instance = new SpringResource( rpcPort, storagePort, sslStoragePort, nativeTransportPort );
+
+            LOG.info( "Created a new instance of CassandraResource: {}", instance );
+            LOG.info( "Cassandra using ports {} and {}", storagePort, sslStoragePort );
+
+
+
+            return instance;
+        }
+    }
+
+
+    /**
+     * Creates a new instance of the CassandraResource with rpc and storage ports that may or may not be the default
+     * ports. If either port is taken, an alternative free port is found.
+     *
+     * @return a new CassandraResource with possibly non-default ports
+     */
+    public static SpringResource setPortsAndStartSpring() {
+        return setAllocatedPorts();
+    }
+
+
+
+    public static Properties getProjectProperties() throws IOException {
+        if ( properties == null ) {
+            properties = new Properties();
+            properties.load( ClassLoader.getSystemResourceAsStream( PROPERTIES_FILE ) );
+        }
+        return properties;
+    }
+
+
+    @Override
+    public String toString() {
+        return "CassandraResource{" +
+                "initialized=" + initialized +
+                ", rpcPort=" + rpcPort +
+                ", storagePort=" + storagePort +
+                ", sslStoragePort=" + sslStoragePort +
+                ", nativeTransportPort=" + nativeTransportPort +
+                ", applicationContext=" + applicationContext +
+                ", schemaManager=" + schemaManager +
+                "} " + super.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/AnotherCassandraResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/AnotherCassandraResourceIT.java b/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/AnotherCassandraResourceIT.java
index 16a1958..095179d 100644
--- a/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/AnotherCassandraResourceIT.java
+++ b/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/AnotherCassandraResourceIT.java
@@ -24,20 +24,20 @@ import org.slf4j.LoggerFactory;
 
 public class AnotherCassandraResourceIT {
     private static final Logger logger = LoggerFactory.getLogger( AnotherCassandraResourceIT.class );
-    private CassandraResource cassandraResource = CassandraResourceITSuite.cassandraResource;
+    private SpringResource springResource = CassandraResourceITSuite.springResource;
     private static final long WAIT = 200L;
 
 
     @Test
     public void testItAgain() throws Exception {
-        String testBean = cassandraResource.getBean( "testBean", String.class );
+        String testBean = springResource.getBean( "testBean", String.class );
         logger.info( "Got another testBean: {}", testBean );
     }
 
 
     @Test
     public void testItAgainAndAgain() throws Exception {
-        String testBean = cassandraResource.getBean( "testBean", String.class );
+        String testBean = springResource.getBean( "testBean", String.class );
         logger.info( "Got another testBean again: {}", testBean );
         Thread.sleep( WAIT );
     }
@@ -45,7 +45,7 @@ public class AnotherCassandraResourceIT {
 
     @Test
     public void testItAgainAndAgain2() throws Exception {
-        String testBean = cassandraResource.getBean( "testBean", String.class );
+        String testBean = springResource.getBean( "testBean", String.class );
         logger.info( "Got another testBean again: {}", testBean );
         Thread.sleep( WAIT );
     }
@@ -53,7 +53,7 @@ public class AnotherCassandraResourceIT {
 
     @Test
     public void testItAgainAndAgain3() throws Exception {
-        String testBean = cassandraResource.getBean( "testBean", String.class );
+        String testBean = springResource.getBean( "testBean", String.class );
         logger.info( "Got another testBean again: {}", testBean );
         Thread.sleep( WAIT );
     }
@@ -61,7 +61,7 @@ public class AnotherCassandraResourceIT {
 
     @Test
     public void testItAgainAndAgain4() throws Exception {
-        String testBean = cassandraResource.getBean( "testBean", String.class );
+        String testBean = springResource.getBean( "testBean", String.class );
         logger.info( "Got another testBean again: {}", testBean );
         Thread.sleep( WAIT );
     }
@@ -69,7 +69,7 @@ public class AnotherCassandraResourceIT {
 
     @Test
     public void testItAgainAndAgain5() throws Exception {
-        String testBean = cassandraResource.getBean( "testBean", String.class );
+        String testBean = springResource.getBean( "testBean", String.class );
         logger.info( "Got another testBean again: {}", testBean );
         Thread.sleep( WAIT );
     }
@@ -77,7 +77,7 @@ public class AnotherCassandraResourceIT {
 
     @Test
     public void testItAgainAndAgain6() throws Exception {
-        String testBean = cassandraResource.getBean( "testBean", String.class );
+        String testBean = springResource.getBean( "testBean", String.class );
         logger.info( "Got another testBean again: {}", testBean );
         Thread.sleep( WAIT );
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/CassandraResourceITSuite.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/CassandraResourceITSuite.java b/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/CassandraResourceITSuite.java
index 5bc256b..be8b0b5 100644
--- a/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/CassandraResourceITSuite.java
+++ b/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/CassandraResourceITSuite.java
@@ -29,7 +29,7 @@ import org.junit.runners.Suite;
  */
 @RunWith(ConcurrentSuite.class)
 @Suite.SuiteClasses({
-        CassandraResourceTest.class,           // <== itself fires up instances
+        SpringResourceTest.class,           // <== itself fires up instances
         AnotherCassandraResourceIT.class,      // <== uses the existing suite instance
         YetAnotherCassandraResourceIT.class,   // <== uses the existing suite instance
         OkThisIsTheLastIT.class                // <== uses the existing suite instance
@@ -37,5 +37,5 @@ import org.junit.runners.Suite;
 @Concurrent()
 public class CassandraResourceITSuite {
     @ClassRule
-    public static CassandraResource cassandraResource = CassandraResource.setPortsAndStartSpring();
+    public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/CassandraResourceTest.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/CassandraResourceTest.java b/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/CassandraResourceTest.java
deleted file mode 100644
index beefd46..0000000
--- a/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/CassandraResourceTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.apache.usergrid.cassandra;
-
-
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static junit.framework.Assert.assertTrue;
-
-
-/** This tests the CassandraResource. */
-@Concurrent()
-public class CassandraResourceTest {
-    public static final Logger LOG = LoggerFactory.getLogger( CassandraResourceTest.class );
-    public static final long WAIT = 200L;
-
-
-    /** Tests to make sure port overrides works properly. */
-    @Test
-    public void testPortOverride() throws Throwable {
-        int rpcPort;
-        int storagePort;
-        int sslStoragePort;
-        int nativeTransportPort;
-
-        do {
-            rpcPort = AvailablePortFinder.getNextAvailable( CassandraResource.DEFAULT_RPC_PORT + 1 );
-        }
-        while ( rpcPort == CassandraResource.DEFAULT_RPC_PORT );
-        LOG.info( "Setting rpc_port to {}", rpcPort );
-
-        do {
-            storagePort = AvailablePortFinder.getNextAvailable( CassandraResource.DEFAULT_STORAGE_PORT + 1 );
-        }
-        while ( storagePort == CassandraResource.DEFAULT_STORAGE_PORT || storagePort == rpcPort );
-        LOG.info( "Setting storage_port to {}", storagePort );
-
-        do {
-            sslStoragePort = AvailablePortFinder.getNextAvailable( CassandraResource.DEFAULT_SSL_STORAGE_PORT + 1 );
-        }
-        while ( sslStoragePort == CassandraResource.DEFAULT_SSL_STORAGE_PORT || storagePort == sslStoragePort );
-        LOG.info( "Setting ssl_storage_port to {}", sslStoragePort );
-
-        do {
-            nativeTransportPort =
-                    AvailablePortFinder.getNextAvailable( CassandraResource.DEFAULT_NATIVE_TRANSPORT_PORT + 1 );
-        }
-        while ( nativeTransportPort == CassandraResource.DEFAULT_NATIVE_TRANSPORT_PORT
-                || sslStoragePort == nativeTransportPort );
-        LOG.info( "Setting native_transport_port to {}", nativeTransportPort );
-
-        final CassandraResource cassandraResource =
-                new CassandraResource( rpcPort, storagePort, sslStoragePort, nativeTransportPort );
-
-        cassandraResource.before();
-
-        // test here to see if we can access cassandra's ports
-        // TODO - add some test code here using Hector
-
-        LOG.info( "Got the test bean: " );
-    }
-
-
-
-
-
-    /**
-     * Fires up two Cassandra instances on the same machine.
-     *
-     * @throws Exception if this don't work
-     */
-    @Test
-    public void testDoubleTrouble() throws Throwable {
-        CassandraResource c1 = CassandraResource.setPortsAndStartSpring();
-        LOG.info( "Starting up first Cassandra instance: {}", c1 );
-        c1.before();
-
-        LOG.debug( "Waiting for the new instance to come online." );
-        while ( !c1.isReady() ) {
-            Thread.sleep( WAIT );
-        }
-
-        CassandraResource c2 = CassandraResource.setPortsAndStartSpring();
-        LOG.debug( "Starting up second Cassandra instance: {}", c2 );
-        c2.before();
-
-        LOG.debug( "Waiting a few seconds for second instance to be ready before shutting down." );
-        while ( !c2.isReady() ) {
-            Thread.sleep( WAIT );
-        }
-
-        LOG.debug( "Shutting Cassandra instances down." );
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/OkThisIsTheLastIT.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/OkThisIsTheLastIT.java b/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/OkThisIsTheLastIT.java
index 51636e9..b0d7d88 100644
--- a/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/OkThisIsTheLastIT.java
+++ b/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/OkThisIsTheLastIT.java
@@ -26,18 +26,18 @@ import org.slf4j.LoggerFactory;
 
 @Concurrent()
 public class OkThisIsTheLastIT {
-    public static final Logger logger = LoggerFactory.getLogger( CassandraResource.class );
+    public static final Logger logger = LoggerFactory.getLogger( SpringResource.class );
     private static final long WAIT = 200L;
 
     @Rule
     public TestName name = new TestName();
 
-    private CassandraResource cassandraResource = CassandraResourceITSuite.cassandraResource;
+    private SpringResource springResource = CassandraResourceITSuite.springResource;
 
 
     @Test
     public void testUsage() throws Exception {
-        String testBean = cassandraResource.getBean( "testBean", String.class );
+        String testBean = springResource.getBean( "testBean", String.class );
         logger.info( "Got the test bean: " + testBean );
         logger.info( "Check it my test name is: {}", name.getMethodName() );
     }
@@ -45,7 +45,7 @@ public class OkThisIsTheLastIT {
 
     @Test
     public void testItAgainAndAgain() throws Exception {
-        String testBean = cassandraResource.getBean( "testBean", String.class );
+        String testBean = springResource.getBean( "testBean", String.class );
         logger.info( "Got another testBean again: {}", testBean );
         Thread.sleep( WAIT );
     }
@@ -53,7 +53,7 @@ public class OkThisIsTheLastIT {
 
     @Test
     public void testItAgainAndAgain2() throws Exception {
-        String testBean = cassandraResource.getBean( "testBean", String.class );
+        String testBean = springResource.getBean( "testBean", String.class );
         logger.info( "Got another testBean again: {}", testBean );
         Thread.sleep( WAIT );
     }
@@ -61,7 +61,7 @@ public class OkThisIsTheLastIT {
 
     @Test
     public void testItAgainAndAgain3() throws Exception {
-        String testBean = cassandraResource.getBean( "testBean", String.class );
+        String testBean = springResource.getBean( "testBean", String.class );
         logger.info( "Got another testBean again: {}", testBean );
         Thread.sleep( WAIT );
     }
@@ -69,7 +69,7 @@ public class OkThisIsTheLastIT {
 
     @Test
     public void testItAgainAndAgain4() throws Exception {
-        String testBean = cassandraResource.getBean( "testBean", String.class );
+        String testBean = springResource.getBean( "testBean", String.class );
         logger.info( "Got another testBean again: {}", testBean );
         Thread.sleep( WAIT );
     }
@@ -77,7 +77,7 @@ public class OkThisIsTheLastIT {
 
     @Test
     public void testItAgainAndAgain5() throws Exception {
-        String testBean = cassandraResource.getBean( "testBean", String.class );
+        String testBean = springResource.getBean( "testBean", String.class );
         logger.info( "Got another testBean again: {}", testBean );
         Thread.sleep( WAIT );
     }
@@ -85,7 +85,7 @@ public class OkThisIsTheLastIT {
 
     @Test
     public void testItAgainAndAgain6() throws Exception {
-        String testBean = cassandraResource.getBean( "testBean", String.class );
+        String testBean = springResource.getBean( "testBean", String.class );
         logger.info( "Got another testBean again: {}", testBean );
         Thread.sleep( WAIT );
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/SpringResourceTest.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/SpringResourceTest.java b/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/SpringResourceTest.java
new file mode 100644
index 0000000..ccf53a3
--- /dev/null
+++ b/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/SpringResourceTest.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.usergrid.cassandra;
+
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static junit.framework.Assert.assertTrue;
+
+
+/** This tests the CassandraResource. */
+@Concurrent()
+public class SpringResourceTest {
+    public static final Logger LOG = LoggerFactory.getLogger( SpringResourceTest.class );
+    public static final long WAIT = 200L;
+
+
+    /** Tests to make sure port overrides works properly. */
+    @Test
+    public void testPortOverride() throws Throwable {
+        int rpcPort;
+        int storagePort;
+        int sslStoragePort;
+        int nativeTransportPort;
+
+        do {
+            rpcPort = AvailablePortFinder.getNextAvailable( SpringResource.DEFAULT_RPC_PORT + 1 );
+        }
+        while ( rpcPort == SpringResource.DEFAULT_RPC_PORT );
+        LOG.info( "Setting rpc_port to {}", rpcPort );
+
+        do {
+            storagePort = AvailablePortFinder.getNextAvailable( SpringResource.DEFAULT_STORAGE_PORT + 1 );
+        }
+        while ( storagePort == SpringResource.DEFAULT_STORAGE_PORT || storagePort == rpcPort );
+        LOG.info( "Setting storage_port to {}", storagePort );
+
+        do {
+            sslStoragePort = AvailablePortFinder.getNextAvailable( SpringResource.DEFAULT_SSL_STORAGE_PORT + 1 );
+        }
+        while ( sslStoragePort == SpringResource.DEFAULT_SSL_STORAGE_PORT || storagePort == sslStoragePort );
+        LOG.info( "Setting ssl_storage_port to {}", sslStoragePort );
+
+        do {
+            nativeTransportPort =
+                    AvailablePortFinder.getNextAvailable( SpringResource.DEFAULT_NATIVE_TRANSPORT_PORT + 1 );
+        }
+        while ( nativeTransportPort == SpringResource.DEFAULT_NATIVE_TRANSPORT_PORT
+                || sslStoragePort == nativeTransportPort );
+        LOG.info( "Setting native_transport_port to {}", nativeTransportPort );
+
+        final SpringResource springResource =
+                new SpringResource( rpcPort, storagePort, sslStoragePort, nativeTransportPort );
+
+        springResource.before();
+
+        // test here to see if we can access cassandra's ports
+        // TODO - add some test code here using Hector
+
+        LOG.info( "Got the test bean: " );
+    }
+
+
+
+
+
+    /**
+     * Fires up two Cassandra instances on the same machine.
+     *
+     * @throws Exception if this don't work
+     */
+    @Test
+    public void testDoubleTrouble() throws Throwable {
+        SpringResource c1 = SpringResource.setPortsAndStartSpring();
+        LOG.info( "Starting up first Cassandra instance: {}", c1 );
+        c1.before();
+
+        LOG.debug( "Waiting for the new instance to come online." );
+        while ( !c1.isReady() ) {
+            Thread.sleep( WAIT );
+        }
+
+        SpringResource c2 = SpringResource.setPortsAndStartSpring();
+        LOG.debug( "Starting up second Cassandra instance: {}", c2 );
+        c2.before();
+
+        LOG.debug( "Waiting a few seconds for second instance to be ready before shutting down." );
+        while ( !c2.isReady() ) {
+            Thread.sleep( WAIT );
+        }
+
+        LOG.debug( "Shutting Cassandra instances down." );
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/YetAnotherCassandraResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/YetAnotherCassandraResourceIT.java b/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/YetAnotherCassandraResourceIT.java
index da8a43e..088e526 100644
--- a/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/YetAnotherCassandraResourceIT.java
+++ b/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/YetAnotherCassandraResourceIT.java
@@ -24,22 +24,22 @@ import org.slf4j.LoggerFactory;
 
 @Concurrent()
 public class YetAnotherCassandraResourceIT {
-    public static final Logger logger = LoggerFactory.getLogger( CassandraResource.class );
+    public static final Logger logger = LoggerFactory.getLogger( SpringResource.class );
     private static final long WAIT = 200L;
 
-    private CassandraResource cassandraResource = CassandraResourceITSuite.cassandraResource;
+    private SpringResource springResource = CassandraResourceITSuite.springResource;
 
 
     @Test
     public void testUsage() throws Exception {
-        String testBean = cassandraResource.getBean( "testBean", String.class );
+        String testBean = springResource.getBean( "testBean", String.class );
         logger.info( "Got the test bean: " + testBean );
     }
 
 
     @Test
     public void testItAgainAndAgain() throws Exception {
-        String testBean = cassandraResource.getBean( "testBean", String.class );
+        String testBean = springResource.getBean( "testBean", String.class );
         logger.info( "Got another testBean again: {}", testBean );
         Thread.sleep( WAIT );
     }
@@ -47,7 +47,7 @@ public class YetAnotherCassandraResourceIT {
 
     @Test
     public void testItAgainAndAgain2() throws Exception {
-        String testBean = cassandraResource.getBean( "testBean", String.class );
+        String testBean = springResource.getBean( "testBean", String.class );
         logger.info( "Got another testBean again: {}", testBean );
         Thread.sleep( WAIT );
     }
@@ -55,7 +55,7 @@ public class YetAnotherCassandraResourceIT {
 
     @Test
     public void testItAgainAndAgain3() throws Exception {
-        String testBean = cassandraResource.getBean( "testBean", String.class );
+        String testBean = springResource.getBean( "testBean", String.class );
         logger.info( "Got another testBean again: {}", testBean );
         Thread.sleep( WAIT );
     }
@@ -63,7 +63,7 @@ public class YetAnotherCassandraResourceIT {
 
     @Test
     public void testItAgainAndAgain4() throws Exception {
-        String testBean = cassandraResource.getBean( "testBean", String.class );
+        String testBean = springResource.getBean( "testBean", String.class );
         logger.info( "Got another testBean again: {}", testBean );
         Thread.sleep( WAIT );
     }
@@ -71,7 +71,7 @@ public class YetAnotherCassandraResourceIT {
 
     @Test
     public void testItAgainAndAgain5() throws Exception {
-        String testBean = cassandraResource.getBean( "testBean", String.class );
+        String testBean = springResource.getBean( "testBean", String.class );
         logger.info( "Got another testBean again: {}", testBean );
         Thread.sleep( WAIT );
     }
@@ -79,7 +79,7 @@ public class YetAnotherCassandraResourceIT {
 
     @Test
     public void testItAgainAndAgain6() throws Exception {
-        String testBean = cassandraResource.getBean( "testBean", String.class );
+        String testBean = springResource.getBean( "testBean", String.class );
         logger.info( "Got another testBean again: {}", testBean );
         Thread.sleep( WAIT );
     }


[2/2] incubator-usergrid git commit: Renamed CassandraResource to SpringResource, since it really initializes spring, not cassandra

Posted by to...@apache.org.
Renamed CassandraResource to SpringResource, since it really initializes spring, not cassandra


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/e916d6d6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/e916d6d6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/e916d6d6

Branch: refs/heads/USERGRID-273
Commit: e916d6d6aa228cd2b1dac882b305933a6b38a1d9
Parents: 938855f
Author: Todd Nine <tn...@apigee.com>
Authored: Fri Dec 12 14:18:16 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Fri Dec 12 14:18:16 2014 -0700

----------------------------------------------------------------------
 .../org/apache/usergrid/AbstractCoreIT.java     |   6 +-
 .../org/apache/usergrid/CoreITSetupImpl.java    |  18 +-
 .../batch/ConcurrentSchedulerITSuite.java       |   4 +-
 .../batch/job/AbstractSchedulerRuntimeIT.java   |  12 +-
 .../usergrid/batch/job/SchedulerRuntime1IT.java |   2 +-
 .../usergrid/batch/job/SchedulerRuntime2IT.java |   3 +-
 .../usergrid/batch/job/SchedulerRuntime3IT.java |   2 +-
 .../usergrid/batch/job/SchedulerRuntime4IT.java |   2 +-
 .../usergrid/batch/job/SchedulerRuntime5IT.java |   2 +-
 .../usergrid/batch/job/SchedulerRuntime6IT.java |   2 +-
 .../usergrid/batch/job/SchedulerRuntime7IT.java |   2 +-
 .../usergrid/batch/job/SchedulerRuntime8IT.java |   2 +-
 .../batch/job/SchedulerRuntimeIntervalIT.java   |   4 +-
 .../java/org/apache/usergrid/mq/MessagesIT.java |   2 +-
 .../apache/usergrid/persistence/CounterIT.java  |   5 +-
 .../apache/usergrid/persistence/IndexIT.java    |   2 +-
 .../cassandra/EntityManagerFactoryImplIT.java   |  10 +-
 .../query/AbstractIteratingQueryIT.java         |   6 +-
 .../system/UsergridSystemMonitorIT.java         |   6 +-
 .../usergrid/utils/ImmediateCounterRule.java    |   9 +-
 .../apache/usergrid/rest/AbstractRestIT.java    |   2 +-
 .../usergrid/rest/ConcurrentRestITSuite.java    |   4 +-
 .../java/org/apache/usergrid/rest/ITSetup.java  |  28 +-
 .../org/apache/usergrid/rest/RestITSuite.java   |   4 +-
 .../org/apache/usergrid/ServiceITSetupImpl.java |  24 +-
 .../apache/usergrid/management/EmailFlowIT.java |   6 +-
 .../usergrid/management/OrganizationIT.java     |   6 +-
 .../org/apache/usergrid/management/RoleIT.java  |   6 +-
 .../cassandra/ApplicationCreatorIT.java         |   6 +-
 .../management/cassandra/ExportServiceIT.java   |   6 +-
 .../cassandra/ManagementServiceIT.java          |   8 +-
 .../security/providers/FacebookProviderIT.java  |   8 +-
 .../providers/PingIdentityProviderIT.java       |   6 +-
 .../security/tokens/TokenServiceIT.java         |   6 +-
 .../usergrid/services/AbstractServiceIT.java    |   6 +-
 .../usergrid/services/ServiceRequestIT.java     |   6 +-
 .../usergrid/cassandra/CassandraMain.java       |  10 +-
 .../usergrid/cassandra/CassandraResource.java   | 310 -------------------
 .../usergrid/cassandra/SpringResource.java      | 310 +++++++++++++++++++
 .../cassandra/AnotherCassandraResourceIT.java   |  16 +-
 .../cassandra/CassandraResourceITSuite.java     |   4 +-
 .../cassandra/CassandraResourceTest.java        | 111 -------
 .../usergrid/cassandra/OkThisIsTheLastIT.java   |  18 +-
 .../usergrid/cassandra/SpringResourceTest.java  | 111 +++++++
 .../YetAnotherCassandraResourceIT.java          |  18 +-
 45 files changed, 567 insertions(+), 574 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java b/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java
index 3d41b75..e7fcee7 100644
--- a/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java
@@ -22,7 +22,7 @@ import org.junit.Rule;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.SpringResource;
 import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
 import org.apache.usergrid.utils.JsonUtils;
 
@@ -32,14 +32,14 @@ public abstract class AbstractCoreIT {
     private static final Logger LOG = LoggerFactory.getLogger( AbstractCoreIT.class );
 
     @ClassRule
-    public static CassandraResource cassandraResource = CassandraResource.setPortsAndStartSpring();
+    public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
 
     @ClassRule
     public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
 
 
     @ClassRule
-    public static CoreITSetup setup = new CoreITSetupImpl( cassandraResource, elasticSearchResource );
+    public static CoreITSetup setup = new CoreITSetupImpl( springResource, elasticSearchResource );
 
     @Rule
     public CoreApplication app = new CoreApplication( setup );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java b/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java
index a5f59ed..82b78e4 100644
--- a/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java
+++ b/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java
@@ -23,7 +23,7 @@ import org.junit.runner.Description;
 import org.junit.runners.model.Statement;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.SpringResource;
 import org.apache.usergrid.corepersistence.CpSetup;
 import org.apache.usergrid.mq.QueueManagerFactory;
 import org.apache.usergrid.persistence.EntityManagerFactory;
@@ -42,13 +42,13 @@ public class CoreITSetupImpl implements CoreITSetup {
     protected QueueManagerFactory qmf;
     protected IndexBucketLocator indexBucketLocator;
     protected CassandraService cassandraService;
-    protected CassandraResource cassandraResource;
+    protected SpringResource springResource;
     protected ElasticSearchResource elasticSearchResource;
     protected boolean enabled = false;
 
 
-    public CoreITSetupImpl( CassandraResource cassandraResource, ElasticSearchResource elasticSearchResource ) {
-        this.cassandraResource = cassandraResource;
+    public CoreITSetupImpl( SpringResource springResource, ElasticSearchResource elasticSearchResource ) {
+        this.springResource = springResource;
         this.elasticSearchResource = elasticSearchResource;
     }
 
@@ -89,10 +89,10 @@ public class CoreITSetupImpl implements CoreITSetup {
 
     private void initialize() {
         if ( !enabled ) {
-            cassandraService = cassandraResource.getBean( CassandraService.class );
-            emf = cassandraResource.getBean( EntityManagerFactory.class );
-            qmf = cassandraResource.getBean( QueueManagerFactory.class );
-            indexBucketLocator = cassandraResource.getBean( IndexBucketLocator.class );
+            cassandraService = springResource.getBean( CassandraService.class );
+            emf = springResource.getBean( EntityManagerFactory.class );
+            qmf = springResource.getBean( QueueManagerFactory.class );
+            indexBucketLocator = springResource.getBean( IndexBucketLocator.class );
 
             //run the migration
             try {
@@ -157,7 +157,7 @@ public class CoreITSetupImpl implements CoreITSetup {
     @Override
     public UUID createApplication( String organizationName, String applicationName ) throws Exception {
         if ( emf == null ) {
-            emf = cassandraResource.getBean( EntityManagerFactory.class );
+            emf = springResource.getBean( EntityManagerFactory.class );
         }
 
         if ( USE_DEFAULT_APPLICATION ) {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/core/src/test/java/org/apache/usergrid/batch/ConcurrentSchedulerITSuite.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/ConcurrentSchedulerITSuite.java b/stack/core/src/test/java/org/apache/usergrid/batch/ConcurrentSchedulerITSuite.java
index 154ddd2..ec05398 100644
--- a/stack/core/src/test/java/org/apache/usergrid/batch/ConcurrentSchedulerITSuite.java
+++ b/stack/core/src/test/java/org/apache/usergrid/batch/ConcurrentSchedulerITSuite.java
@@ -28,7 +28,7 @@ import org.apache.usergrid.batch.job.SchedulerRuntime5IT;
 import org.apache.usergrid.batch.job.SchedulerRuntime6IT;
 import org.apache.usergrid.batch.job.SchedulerRuntime7IT;
 import org.apache.usergrid.batch.job.SchedulerRuntime8IT;
-import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.SpringResource;
 import org.apache.usergrid.cassandra.Concurrent;
 import org.apache.usergrid.cassandra.ConcurrentSuite;
 
@@ -43,5 +43,5 @@ import org.apache.usergrid.cassandra.ConcurrentSuite;
 @Concurrent()
 public class ConcurrentSchedulerITSuite {
     @ClassRule
-    public static CassandraResource cassandraResource = CassandraResource.setPortsAndStartSpring();
+    public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/core/src/test/java/org/apache/usergrid/batch/job/AbstractSchedulerRuntimeIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/job/AbstractSchedulerRuntimeIT.java b/stack/core/src/test/java/org/apache/usergrid/batch/job/AbstractSchedulerRuntimeIT.java
index 89f8517..baaf76c 100644
--- a/stack/core/src/test/java/org/apache/usergrid/batch/job/AbstractSchedulerRuntimeIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/batch/job/AbstractSchedulerRuntimeIT.java
@@ -26,7 +26,7 @@ import org.junit.ClassRule;
 
 import org.apache.usergrid.batch.service.JobSchedulerService;
 import org.apache.usergrid.batch.service.SchedulerService;
-import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.SpringResource;
 import org.apache.usergrid.cassandra.SchemaManager;
 import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
 
@@ -46,7 +46,7 @@ public class AbstractSchedulerRuntimeIT {
 
 
     @ClassRule
-    public static CassandraResource cassandraResource = CassandraResource.setPortsAndStartSpring();
+    public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
 
 
     @ClassRule
@@ -67,7 +67,7 @@ public class AbstractSchedulerRuntimeIT {
 
 //        elasticSearchResource.before();
 
-        SchemaManager sm = cassandraResource.getBean("coreManager", SchemaManager.class);
+        SchemaManager sm = springResource.getBean("coreManager", SchemaManager.class);
         sm.create();
         sm.populateBaseData();
     }
@@ -82,15 +82,15 @@ public class AbstractSchedulerRuntimeIT {
     @SuppressWarnings( "all" )
     public void setup() {
 
-        props = cassandraResource.getBean( "properties", Properties.class );
-        scheduler = cassandraResource.getBean( SchedulerService.class );
+        props = springResource.getBean( "properties", Properties.class );
+        scheduler = springResource.getBean( SchedulerService.class );
 
         if ( System.getProperties().containsKey( COUNT_PROP ) ) {
             count = Integer.getInteger( System.getProperty( COUNT_PROP ) );
         }
 
         // start the scheduler after we're all set up
-        JobSchedulerService jobScheduler = cassandraResource.getBean( JobSchedulerService.class );
+        JobSchedulerService jobScheduler = springResource.getBean( JobSchedulerService.class );
         jobScheduler.setJobListener( listener );
         if ( jobScheduler.state() != State.RUNNING ) {
             jobScheduler.startAndWait();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime1IT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime1IT.java b/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime1IT.java
index 887d868..b7cea6d 100644
--- a/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime1IT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime1IT.java
@@ -41,7 +41,7 @@ public class SchedulerRuntime1IT extends AbstractSchedulerRuntimeIT {
     @Test
     public void basicScheduling() throws InterruptedException {
 
-        CountdownLatchJob counterJob = cassandraResource.getBean( CountdownLatchJob.class );
+        CountdownLatchJob counterJob = springResource.getBean( CountdownLatchJob.class );
 
         // set the counter job latch size
         counterJob.setLatch( getCount() );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime2IT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime2IT.java b/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime2IT.java
index 0f9fb75..a2f870c 100644
--- a/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime2IT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime2IT.java
@@ -19,7 +19,6 @@ package org.apache.usergrid.batch.job;
 
 
 import java.util.concurrent.TimeUnit;
-import static org.apache.usergrid.batch.job.AbstractSchedulerRuntimeIT.cassandraResource;
 
 import org.junit.Ignore;
 import org.junit.Test;
@@ -41,7 +40,7 @@ public class SchedulerRuntime2IT extends AbstractSchedulerRuntimeIT {
     /** Test the scheduler ramps up correctly when there are more jobs to be read after a pause */
     @Test
     public void schedulingWithNoJobs() throws InterruptedException {
-        CountdownLatchJob counterJob = cassandraResource.getBean( CountdownLatchJob.class );
+        CountdownLatchJob counterJob = springResource.getBean( CountdownLatchJob.class );
         // set the counter job latch size
         counterJob.setLatch( getCount() );
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime3IT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime3IT.java b/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime3IT.java
index 3002377..4eee2d9 100644
--- a/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime3IT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime3IT.java
@@ -45,7 +45,7 @@ public class SchedulerRuntime3IT extends AbstractSchedulerRuntimeIT {
         int failCount = Integer.parseInt( props.getProperty( FAIL_PROP ) );
         long sleepTime = Long.parseLong( props.getProperty( RUNLOOP_PROP ) );
 
-        FailureJobExecution job = cassandraResource.getBean( 
+        FailureJobExecution job = springResource.getBean(
                 "failureJobExceuction", FailureJobExecution.class );
 
         int totalAttempts = failCount + 1;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime4IT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime4IT.java b/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime4IT.java
index 7b97db4..8160535 100644
--- a/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime4IT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime4IT.java
@@ -46,7 +46,7 @@ public class SchedulerRuntime4IT extends AbstractSchedulerRuntimeIT {
 
         long customRetry = sleepTime * 2;
 
-        DelayExecution job = cassandraResource.getBean( "delayExecution", DelayExecution.class );
+        DelayExecution job = springResource.getBean( "delayExecution", DelayExecution.class );
 
         job.setTimeout( customRetry );
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime5IT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime5IT.java b/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime5IT.java
index eed8490..057268c 100644
--- a/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime5IT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime5IT.java
@@ -47,7 +47,7 @@ public class SchedulerRuntime5IT extends AbstractSchedulerRuntimeIT {
 
         long customRetry = sleepTime * 2;
 
-        DelayHeartbeat job = cassandraResource.getBean( "delayHeartbeat", DelayHeartbeat.class );
+        DelayHeartbeat job = springResource.getBean( "delayHeartbeat", DelayHeartbeat.class );
 
         job.setTimeout( customRetry );
         job.setLatch( heartbeatCount + 1 );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime6IT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime6IT.java b/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime6IT.java
index 4b9b232..5d7b48f 100644
--- a/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime6IT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime6IT.java
@@ -51,7 +51,7 @@ public class SchedulerRuntime6IT extends AbstractSchedulerRuntimeIT {
         long customRetry = sleepTime + 1000;
         int numberOfRuns = 1;
 
-        OnlyOnceExceution job = cassandraResource.getBean( "onlyOnceExceution", OnlyOnceExceution.class );
+        OnlyOnceExceution job = springResource.getBean( "onlyOnceExceution", OnlyOnceExceution.class );
 
         job.setTimeout( customRetry );
         job.setLatch( numberOfRuns );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime7IT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime7IT.java b/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime7IT.java
index b23cf78..c168d19 100644
--- a/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime7IT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime7IT.java
@@ -48,7 +48,7 @@ public class SchedulerRuntime7IT extends AbstractSchedulerRuntimeIT {
         int numberOfRuns = 2;
 
         OnlyOnceUnlockOnFailExceution job =
-                cassandraResource.getBean( "onlyOnceUnlockOnFailExceution", OnlyOnceUnlockOnFailExceution.class );
+                springResource.getBean( "onlyOnceUnlockOnFailExceution", OnlyOnceUnlockOnFailExceution.class );
 
         job.setTimeout( customRetry );
         job.setLatch( numberOfRuns );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime8IT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime8IT.java b/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime8IT.java
index 0eabace..d77fe6f 100644
--- a/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime8IT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntime8IT.java
@@ -46,7 +46,7 @@ public class SchedulerRuntime8IT extends AbstractSchedulerRuntimeIT {
     @Test
     public void queryAndDeleteJobs() throws Exception {
 
-        CountdownLatchJob job = cassandraResource.getBean( "countdownLatch", CountdownLatchJob.class );
+        CountdownLatchJob job = springResource.getBean( "countdownLatch", CountdownLatchJob.class );
 
         job.setLatch( 1 );
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntimeIntervalIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntimeIntervalIT.java b/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntimeIntervalIT.java
index 523f41d..f87d641 100644
--- a/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntimeIntervalIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntimeIntervalIT.java
@@ -58,7 +58,7 @@ public class SchedulerRuntimeIntervalIT extends AbstractSchedulerRuntimeIT {
         final int pollCount = 5;
         final int expectedInterval = 5000;
 
-        JobSchedulerService schedulerService = cassandraResource.getBean(JobSchedulerService.class);
+        JobSchedulerService schedulerService = springResource.getBean(JobSchedulerService.class);
 
         final long interval = schedulerService.getInterval();
         final int numberOfWorkers = schedulerService.getWorkerSize();
@@ -67,7 +67,7 @@ public class SchedulerRuntimeIntervalIT extends AbstractSchedulerRuntimeIT {
         assertEquals("Interval must be set to "+ expectedInterval 
                 + " for test to work properly", expectedInterval, interval);
 
-        CountdownLatchJob counterJob = cassandraResource.getBean( CountdownLatchJob.class );
+        CountdownLatchJob counterJob = springResource.getBean( CountdownLatchJob.class );
             // set the counter job latch size
         counterJob.setLatch( expectedExecutions );
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/core/src/test/java/org/apache/usergrid/mq/MessagesIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/mq/MessagesIT.java b/stack/core/src/test/java/org/apache/usergrid/mq/MessagesIT.java
index 5b2f320..1a57148 100644
--- a/stack/core/src/test/java/org/apache/usergrid/mq/MessagesIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/mq/MessagesIT.java
@@ -41,7 +41,7 @@ public class MessagesIT extends AbstractCoreIT {
     private static final Logger LOG = LoggerFactory.getLogger( MessagesIT.class );
 
     @Rule
-    public ImmediateCounterRule counterRule = new ImmediateCounterRule( cassandraResource );
+    public ImmediateCounterRule counterRule = new ImmediateCounterRule( springResource );
 
     public MessagesIT() {
         super();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java
index d6a3f16..88686bc 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java
@@ -23,8 +23,6 @@ import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.UUID;
 
-import org.junit.After;
-import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.slf4j.Logger;
@@ -34,7 +32,6 @@ import org.apache.commons.lang3.RandomStringUtils;
 
 import org.apache.usergrid.AbstractCoreIT;
 import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.count.SimpleBatcher;
 import org.apache.usergrid.persistence.entities.Event;
 import org.apache.usergrid.persistence.entities.Group;
 import org.apache.usergrid.persistence.entities.User;
@@ -54,7 +51,7 @@ public class CounterIT extends AbstractCoreIT {
     private static final Logger LOG = LoggerFactory.getLogger( CounterIT.class );
 
     @Rule
-    public ImmediateCounterRule counterRule = new ImmediateCounterRule( cassandraResource );
+    public ImmediateCounterRule counterRule = new ImmediateCounterRule( springResource );
 
     long ts = System.currentTimeMillis() - ( 24 * 60 * 60 * 1000 );
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
index dc6593b..a146d3a 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
@@ -448,7 +448,7 @@ public class IndexIT extends AbstractCoreIT {
 
             RelationManagerImpl impl = (RelationManagerImpl)rm;
 
-            CassandraService cass = cassandraResource.getBean( CassandraService.class );
+            CassandraService cass = springResource.getBean( CassandraService.class );
 
             ByteBufferSerializer buf = ByteBufferSerializer.get();
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImplIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImplIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImplIT.java
index 2c85823..175eb16 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImplIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImplIT.java
@@ -34,7 +34,7 @@ import org.slf4j.LoggerFactory;
 import org.apache.commons.lang3.RandomStringUtils;
 
 import org.apache.usergrid.AbstractCoreIT;
-import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.SpringResource;
 import org.apache.usergrid.cassandra.Concurrent;
 import org.apache.usergrid.persistence.Entity;
 import org.apache.usergrid.persistence.EntityManager;
@@ -62,14 +62,14 @@ public class EntityManagerFactoryImplIT extends AbstractCoreIT {
 
 
     @ClassRule
-    public static CassandraResource cassandraResource = CassandraResource.setPortsAndStartSpring();
+    public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
 
     @ClassRule
     public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
 
 
     public EntityManagerFactoryImplIT() {
-        emf = cassandraResource.getBean( EntityManagerFactory.class );
+        emf = springResource.getBean( EntityManagerFactory.class );
     }
 
 
@@ -100,9 +100,9 @@ public class EntityManagerFactoryImplIT extends AbstractCoreIT {
 
     @Before
     public void initTracing() {
-        traceTagManager = cassandraResource.getBean(
+        traceTagManager = springResource.getBean(
                 "traceTagManager", TraceTagManager.class );
-        traceTagReporter = cassandraResource.getBean(
+        traceTagReporter = springResource.getBean(
                 "traceTagReporter", TraceTagReporter.class );
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java
index 9a1503e..4b2ff7c 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java
@@ -33,7 +33,7 @@ import org.slf4j.LoggerFactory;
 import org.apache.usergrid.CoreApplication;
 import org.apache.usergrid.CoreITSetup;
 import org.apache.usergrid.CoreITSetupImpl;
-import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.SpringResource;
 import org.apache.usergrid.persistence.Entity;
 import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
 import org.apache.usergrid.persistence.index.query.Query;
@@ -51,14 +51,14 @@ public abstract class AbstractIteratingQueryIT {
 
 
     @ClassRule
-    public static CassandraResource cassandraResource = CassandraResource.setPortsAndStartSpring();
+    public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
 
     @ClassRule
     public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
 
 
     @ClassRule
-    public static CoreITSetup setup = new CoreITSetupImpl( cassandraResource, elasticSearchResource );
+    public static CoreITSetup setup = new CoreITSetupImpl( springResource, elasticSearchResource );
 
     @Rule
     public CoreApplication app = new CoreApplication( setup );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/core/src/test/java/org/apache/usergrid/system/UsergridSystemMonitorIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/system/UsergridSystemMonitorIT.java b/stack/core/src/test/java/org/apache/usergrid/system/UsergridSystemMonitorIT.java
index 6692eb2..5dc4379 100644
--- a/stack/core/src/test/java/org/apache/usergrid/system/UsergridSystemMonitorIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/system/UsergridSystemMonitorIT.java
@@ -25,7 +25,7 @@ import org.junit.Test;
 
 import org.apache.commons.lang.StringUtils;
 
-import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.SpringResource;
 import org.apache.usergrid.cassandra.Concurrent;
 import org.apache.usergrid.utils.MapUtils;
 
@@ -38,14 +38,14 @@ import static org.junit.Assert.assertTrue;
 public class UsergridSystemMonitorIT {
 
     @ClassRule
-    public static CassandraResource cassandraResource = CassandraResource.setPortsAndStartSpring();
+    public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
 
     private UsergridSystemMonitor usergridSystemMonitor;
 
 
     @Before
     public void setupLocal() {
-        usergridSystemMonitor = cassandraResource.getBean( UsergridSystemMonitor.class );
+        usergridSystemMonitor = springResource.getBean( UsergridSystemMonitor.class );
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/core/src/test/java/org/apache/usergrid/utils/ImmediateCounterRule.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/utils/ImmediateCounterRule.java b/stack/core/src/test/java/org/apache/usergrid/utils/ImmediateCounterRule.java
index 575ff2a..d2b8620 100644
--- a/stack/core/src/test/java/org/apache/usergrid/utils/ImmediateCounterRule.java
+++ b/stack/core/src/test/java/org/apache/usergrid/utils/ImmediateCounterRule.java
@@ -21,11 +21,8 @@ package org.apache.usergrid.utils;
 
 
 import org.junit.rules.ExternalResource;
-import org.junit.rules.TestRule;
-import org.junit.runner.Description;
-import org.junit.runners.model.Statement;
 
-import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.SpringResource;
 import org.apache.usergrid.count.SimpleBatcher;
 
 
@@ -37,8 +34,8 @@ public class ImmediateCounterRule extends ExternalResource {
     private final SimpleBatcher batcher;
 
 
-    public ImmediateCounterRule( final CassandraResource cassandraResource ) {
-        batcher = cassandraResource.getBean( SimpleBatcher.class );
+    public ImmediateCounterRule( final SpringResource springResource ) {
+        batcher = springResource.getBean( SimpleBatcher.class );
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/rest/src/test/java/org/apache/usergrid/rest/AbstractRestIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/AbstractRestIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/AbstractRestIT.java
index 6ccb923..3231cc6 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/AbstractRestIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/AbstractRestIT.java
@@ -72,7 +72,7 @@ public abstract class AbstractRestIT extends JerseyTest {
     protected static final AppDescriptor descriptor;
 
     @ClassRule
-    public static ITSetup setup = new ITSetup( RestITSuite.cassandraResource );
+    public static ITSetup setup = new ITSetup( RestITSuite.springResource );
 
     //private static final URI baseURI = setup.getBaseURI();
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/rest/src/test/java/org/apache/usergrid/rest/ConcurrentRestITSuite.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/ConcurrentRestITSuite.java b/stack/rest/src/test/java/org/apache/usergrid/rest/ConcurrentRestITSuite.java
index d1978b1..e9c46ce 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/ConcurrentRestITSuite.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/ConcurrentRestITSuite.java
@@ -19,7 +19,7 @@ package org.apache.usergrid.rest;
 import org.junit.ClassRule;
 import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
-import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.SpringResource;
 import org.apache.usergrid.cassandra.Concurrent;
 import org.apache.usergrid.cassandra.ConcurrentSuite;
 import org.apache.usergrid.rest.applications.events.ApplicationRequestCounterIT;
@@ -63,5 +63,5 @@ import org.apache.usergrid.rest.management.organizations.AdminEmailEncodingIT;
 public class ConcurrentRestITSuite {
 
     @ClassRule
-    public static CassandraResource cassandraResource = CassandraResource.setPortsAndStartSpring();
+    public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/rest/src/test/java/org/apache/usergrid/rest/ITSetup.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/ITSetup.java b/stack/rest/src/test/java/org/apache/usergrid/rest/ITSetup.java
index 112899e..9383558 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/ITSetup.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/ITSetup.java
@@ -25,7 +25,7 @@ import javax.ws.rs.core.UriBuilder;
 import org.junit.rules.ExternalResource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.SpringResource;
 import org.apache.usergrid.management.ApplicationCreator;
 import org.apache.usergrid.management.ManagementService;
 import org.apache.usergrid.persistence.EntityManagerFactory;
@@ -44,7 +44,7 @@ public class ITSetup extends ExternalResource {
 
     private static final Logger LOG = LoggerFactory.getLogger( ITSetup.class );
     private final ElasticSearchResource elasticSearchResource;
-    private final CassandraResource cassandraResource;
+    private final SpringResource springResource;
     private final TomcatResource tomcatResource;
 
     private ServiceManagerFactory smf;
@@ -60,7 +60,7 @@ public class ITSetup extends ExternalResource {
     private URI uri;
 
 
-    public ITSetup( CassandraResource cassandraResource) {
+    public ITSetup( SpringResource springResource ) {
         
         try {
             String[] locations = { "usergrid-properties-context.xml" };
@@ -73,7 +73,7 @@ public class ITSetup extends ExternalResource {
             throw new RuntimeException("Error getting properties", ex);
         }
 
-        this.cassandraResource = cassandraResource;
+        this.springResource = springResource;
 
         tomcatResource = TomcatResource.instance;
         tomcatResource.setWebAppsPath( "src/main/webapp" );
@@ -85,23 +85,23 @@ public class ITSetup extends ExternalResource {
     }
 
 
-    public ITSetup( CassandraResource cassandraResource, String webAppsPath ) {
-        this( cassandraResource );
+    public ITSetup( SpringResource springResource, String webAppsPath ) {
+        this( springResource );
         tomcatResource.setWebAppsPath(webAppsPath);
     }
 
 
     @Override
     protected void before() throws Throwable {
-        synchronized ( cassandraResource ) {
+        synchronized ( springResource ) {
             super.before();
 
 
-            emf =                cassandraResource.getBean( EntityManagerFactory.class );
-            smf =                cassandraResource.getBean( ServiceManagerFactory.class );
-            tokenService =       cassandraResource.getBean( TokenService.class );
-            providerFactory =    cassandraResource.getBean( SignInProviderFactory.class );
-            applicationCreator = cassandraResource.getBean( ApplicationCreator.class );
+            emf =                springResource.getBean( EntityManagerFactory.class );
+            smf =                springResource.getBean( ServiceManagerFactory.class );
+            tokenService =       springResource.getBean( TokenService.class );
+            providerFactory =    springResource.getBean( SignInProviderFactory.class );
+            applicationCreator = springResource.getBean( ApplicationCreator.class );
 //            managementService =  cassandraResource.getBean( ManagementService.class );
 
 //            if ( !setupCalled ) {
@@ -111,12 +111,12 @@ public class ITSetup extends ExternalResource {
 
             String esStartup = properties.getProperty("elasticsearch.startup");
             if ( "embedded".equals(esStartup)) {
-                tomcatResource.setCassandraPort( cassandraResource.getRpcPort() );
+                tomcatResource.setCassandraPort( springResource.getRpcPort() );
                 tomcatResource.setElasticSearchPort( 
                     Integer.parseInt( System.getProperty(LOCAL_ES_PORT_PROPNAME)) );
                 
             } else {
-                tomcatResource.setCassandraPort( cassandraResource.getRpcPort() );
+                tomcatResource.setCassandraPort( springResource.getRpcPort() );
                 tomcatResource.setElasticSearchPort(elasticSearchResource.getPort());
             }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/rest/src/test/java/org/apache/usergrid/rest/RestITSuite.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/RestITSuite.java b/stack/rest/src/test/java/org/apache/usergrid/rest/RestITSuite.java
index 5ba7067..116a6e3 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/RestITSuite.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/RestITSuite.java
@@ -19,7 +19,7 @@ package org.apache.usergrid.rest;
 import org.junit.ClassRule;
 import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
-import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.SpringResource;
 import org.apache.usergrid.cassandra.Concurrent;
 import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
 import org.apache.usergrid.rest.applications.events.ApplicationRequestCounterIT;
@@ -60,5 +60,5 @@ public class RestITSuite {
     public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
 
     @ClassRule
-    public static CassandraResource cassandraResource = CassandraResource.setPortsAndStartSpring();
+    public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/services/src/test/java/org/apache/usergrid/ServiceITSetupImpl.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/ServiceITSetupImpl.java b/stack/services/src/test/java/org/apache/usergrid/ServiceITSetupImpl.java
index 216e0a6..0f0d0a3 100644
--- a/stack/services/src/test/java/org/apache/usergrid/ServiceITSetupImpl.java
+++ b/stack/services/src/test/java/org/apache/usergrid/ServiceITSetupImpl.java
@@ -24,7 +24,7 @@ import org.junit.runners.model.Statement;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.config.PropertiesFactoryBean;
-import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.SpringResource;
 import org.apache.usergrid.management.ApplicationCreator;
 import org.apache.usergrid.management.ManagementService;
 import org.apache.usergrid.management.export.ExportService;
@@ -48,8 +48,8 @@ public class ServiceITSetupImpl extends CoreITSetupImpl implements ServiceITSetu
     private ExportService exportService;
 
 
-    public ServiceITSetupImpl( CassandraResource cassandraResource, ElasticSearchResource elasticSearchResource ) {
-        super( cassandraResource, elasticSearchResource );
+    public ServiceITSetupImpl( SpringResource springResource, ElasticSearchResource elasticSearchResource ) {
+        super( springResource, elasticSearchResource );
     }
 
 
@@ -61,13 +61,13 @@ public class ServiceITSetupImpl extends CoreITSetupImpl implements ServiceITSetu
 
     protected void before( Description description ) throws Throwable {
         super.before( description );
-        managementService = cassandraResource.getBean( ManagementService.class );
-        applicationCreator = cassandraResource.getBean( ApplicationCreator.class );
-        tokenService = cassandraResource.getBean( TokenService.class );
-        providerFactory = cassandraResource.getBean( SignInProviderFactory.class );
-        properties = cassandraResource.getBean( PropertiesFactoryBean.class ).getObject();
-        smf = cassandraResource.getBean( ServiceManagerFactory.class );
-        exportService = cassandraResource.getBean( ExportService.class );
+        managementService = springResource.getBean( ManagementService.class );
+        applicationCreator = springResource.getBean( ApplicationCreator.class );
+        tokenService = springResource.getBean( TokenService.class );
+        providerFactory = springResource.getBean( SignInProviderFactory.class );
+        properties = springResource.getBean( PropertiesFactoryBean.class ).getObject();
+        smf = springResource.getBean( ServiceManagerFactory.class );
+        exportService = springResource.getBean( ExportService.class );
 
         LOG.info( "Test setup complete..." );
     }
@@ -93,7 +93,7 @@ public class ServiceITSetupImpl extends CoreITSetupImpl implements ServiceITSetu
 
     @Override
     public CassandraService getCassSvc() {
-        return cassandraResource.getBean( CassandraService.class );
+        return springResource.getBean( CassandraService.class );
     }
 
 
@@ -108,7 +108,7 @@ public class ServiceITSetupImpl extends CoreITSetupImpl implements ServiceITSetu
 
     public ServiceManagerFactory getSmf() {
         if ( smf == null ) {
-            smf = cassandraResource.getBean( ServiceManagerFactory.class );
+            smf = springResource.getBean( ServiceManagerFactory.class );
         }
 
         return smf;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java b/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
index 3a0bf56..f8c2055 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
@@ -41,7 +41,7 @@ import org.apache.commons.lang.text.StrSubstitutor;
 
 import org.apache.usergrid.ServiceITSetup;
 import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.SpringResource;
 import org.apache.usergrid.cassandra.ClearShiroSubject;
 import org.apache.usergrid.management.cassandra.ManagementServiceImpl;
 import org.apache.usergrid.persistence.EntityManager;
@@ -93,7 +93,7 @@ public class EmailFlowIT {
     private static final Logger LOG = LoggerFactory.getLogger( EmailFlowIT.class );
 
     @ClassRule
-    public static CassandraResource cassandraResource = CassandraResource.setPortsAndStartSpring();
+    public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
 
     @ClassRule
     public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
@@ -102,7 +102,7 @@ public class EmailFlowIT {
     public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
 
     @ClassRule
-    public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
+    public static ServiceITSetup setup = new ServiceITSetupImpl( springResource, elasticSearchResource );
 
     @Rule
     public TestName name = new TestName();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java b/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
index 9f31b09..2821460 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
@@ -29,7 +29,7 @@ import org.junit.Test;
 import org.apache.usergrid.NewOrgAppAdminRule;
 import org.apache.usergrid.ServiceITSetup;
 import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.SpringResource;
 import org.apache.usergrid.cassandra.ClearShiroSubject;
 import org.apache.usergrid.cassandra.Concurrent;
 import org.apache.usergrid.management.cassandra.ManagementServiceImpl;
@@ -53,14 +53,14 @@ public class OrganizationIT {
     public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
 
     @ClassRule
-    public static CassandraResource cassandraResource = CassandraResource.setPortsAndStartSpring();
+    public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
 
     @ClassRule
     public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
 
 
     @ClassRule
-    public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
+    public static ServiceITSetup setup = new ServiceITSetupImpl( springResource, elasticSearchResource );
 
     @Rule
     public NewOrgAppAdminRule newOrgAppAdminRule = new NewOrgAppAdminRule( setup );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/services/src/test/java/org/apache/usergrid/management/RoleIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/RoleIT.java b/stack/services/src/test/java/org/apache/usergrid/management/RoleIT.java
index 24865de..b3dcbab 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/RoleIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/RoleIT.java
@@ -31,7 +31,7 @@ import org.apache.shiro.subject.Subject;
 
 import org.apache.usergrid.ServiceITSetup;
 import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.SpringResource;
 import org.apache.usergrid.cassandra.ClearShiroSubject;
 import org.apache.usergrid.cassandra.Concurrent;
 import org.apache.usergrid.persistence.EntityManager;
@@ -48,7 +48,7 @@ public class RoleIT {
     private static final Logger LOG = LoggerFactory.getLogger( RoleIT.class );
 
     @ClassRule
-    public static CassandraResource cassandraResource = CassandraResource.setPortsAndStartSpring();
+    public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
 
     @ClassRule
     public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
@@ -58,7 +58,7 @@ public class RoleIT {
     public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
 
     @ClassRule
-    public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
+    public static ServiceITSetup setup = new ServiceITSetupImpl( springResource, elasticSearchResource );
 
 
     @Test

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
index 6a3c752..db8f169 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
@@ -25,7 +25,7 @@ import org.junit.Test;
 
 import org.apache.usergrid.ServiceITSetup;
 import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.SpringResource;
 import org.apache.usergrid.cassandra.ClearShiroSubject;
 import org.apache.usergrid.cassandra.Concurrent;
 import org.apache.usergrid.management.ApplicationInfo;
@@ -45,7 +45,7 @@ import static org.junit.Assert.assertTrue;
 @Concurrent()
 public class ApplicationCreatorIT {
     @ClassRule
-    public static CassandraResource cassandraResource = CassandraResource.setPortsAndStartSpring();
+    public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
 
     @ClassRule
     public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
@@ -54,7 +54,7 @@ public class ApplicationCreatorIT {
     public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
 
     @Rule
-    public ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
+    public ServiceITSetup setup = new ServiceITSetupImpl( springResource, elasticSearchResource );
 
 
     @Test

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
index b19a0b3..777103b 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
@@ -47,7 +47,7 @@ import org.apache.usergrid.NewOrgAppAdminRule;
 import org.apache.usergrid.ServiceITSetup;
 import org.apache.usergrid.ServiceITSetupImpl;
 import org.apache.usergrid.batch.JobExecution;
-import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.SpringResource;
 import org.apache.usergrid.cassandra.ClearShiroSubject;
 import org.apache.usergrid.cassandra.Concurrent;
 import org.apache.usergrid.management.ApplicationInfo;
@@ -87,14 +87,14 @@ public class ExportServiceIT {
     private static final Logger LOG = LoggerFactory.getLogger( ExportServiceIT.class );
 
     @ClassRule
-    public static CassandraResource cassandraResource = CassandraResource.setPortsAndStartSpring();
+    public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
 
     @ClassRule
     public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
 
 
     @ClassRule
-    public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
+    public static final ServiceITSetup setup = new ServiceITSetupImpl( springResource, elasticSearchResource );
 
     @Rule
     public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
index ee04944..85c14c7 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
@@ -33,7 +33,7 @@ import org.slf4j.LoggerFactory;
 import org.apache.usergrid.NewOrgAppAdminRule;
 import org.apache.usergrid.ServiceITSetup;
 import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.SpringResource;
 import org.apache.usergrid.cassandra.ClearShiroSubject;
 import org.apache.usergrid.cassandra.Concurrent;
 import org.apache.usergrid.count.SimpleBatcher;
@@ -74,14 +74,14 @@ public class ManagementServiceIT {
 
 
     @ClassRule
-    public static CassandraResource cassandraResource = CassandraResource.setPortsAndStartSpring();
+    public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
 
 
     @ClassRule
     public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
 
     @ClassRule
-    public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
+    public static final ServiceITSetup setup = new ServiceITSetupImpl( springResource, elasticSearchResource );
 
 
     @Rule
@@ -151,7 +151,7 @@ public class ManagementServiceIT {
 
     @Test
     public void testCountAdminUserAction() throws Exception {
-        SimpleBatcher batcher = cassandraResource.getBean( SimpleBatcher.class );
+        SimpleBatcher batcher = springResource.getBean( SimpleBatcher.class );
 
         batcher.setBlockingSubmit( true );
         batcher.setBatchSize( 1 );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java b/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
index c0a7bb5..87684be 100644
--- a/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
@@ -28,7 +28,7 @@ import org.junit.Test;
 
 import org.apache.usergrid.ServiceITSetup;
 import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.SpringResource;
 import org.apache.usergrid.cassandra.ClearShiroSubject;
 import org.apache.usergrid.cassandra.Concurrent;
 import org.apache.usergrid.management.OrganizationInfo;
@@ -53,7 +53,7 @@ public class FacebookProviderIT {
     private static UUID applicationId;
 
     @ClassRule
-    public static CassandraResource cassandraResource = CassandraResource.setPortsAndStartSpring();
+    public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
 
     @ClassRule
     public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
@@ -62,12 +62,12 @@ public class FacebookProviderIT {
     public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
 
     @ClassRule
-    public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
+    public static ServiceITSetup setup = new ServiceITSetupImpl( springResource, elasticSearchResource );
 
 
     @BeforeClass
     public static void setup() throws Exception {
-        providerFactory = cassandraResource.getBean( SignInProviderFactory.class );
+        providerFactory = springResource.getBean( SignInProviderFactory.class );
         UserInfo adminUser = setup.getMgmtSvc()
                                   .createAdminUser( uniqueUsername(), "Facebook User", "user"+newUUIDString()+"@facebook.com", "test", false,
                                           false );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/services/src/test/java/org/apache/usergrid/security/providers/PingIdentityProviderIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/security/providers/PingIdentityProviderIT.java b/stack/services/src/test/java/org/apache/usergrid/security/providers/PingIdentityProviderIT.java
index ee39fb8..236a1c3 100644
--- a/stack/services/src/test/java/org/apache/usergrid/security/providers/PingIdentityProviderIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/security/providers/PingIdentityProviderIT.java
@@ -28,7 +28,7 @@ import org.junit.Test;
 
 import org.apache.usergrid.ServiceITSetup;
 import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.SpringResource;
 import org.apache.usergrid.cassandra.ClearShiroSubject;
 import org.apache.usergrid.cassandra.Concurrent;
 import org.apache.usergrid.management.OrganizationInfo;
@@ -50,7 +50,7 @@ public class PingIdentityProviderIT {
     private static UUID applicationId;
 
     @ClassRule
-    public static CassandraResource cassandraResource = CassandraResource.setPortsAndStartSpring();
+    public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
 
     @ClassRule
     public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
@@ -59,7 +59,7 @@ public class PingIdentityProviderIT {
     public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
 
     @ClassRule
-    public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
+    public static ServiceITSetup setup = new ServiceITSetupImpl( springResource, elasticSearchResource );
 
 
     @BeforeClass

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
index 80c9c1e..b5addd6 100644
--- a/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
@@ -30,7 +30,7 @@ import org.slf4j.LoggerFactory;
 import org.apache.usergrid.NewOrgAppAdminRule;
 import org.apache.usergrid.ServiceITSetup;
 import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.SpringResource;
 import org.apache.usergrid.cassandra.ClearShiroSubject;
 import org.apache.usergrid.cassandra.Concurrent;
 import org.apache.usergrid.management.ApplicationInfo;
@@ -63,13 +63,13 @@ public class TokenServiceIT {
     public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
 
     @ClassRule
-    public static CassandraResource cassandraResource = CassandraResource.setPortsAndStartSpring();
+    public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
 
     @ClassRule
     public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
 
     @ClassRule
-    public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
+    public static ServiceITSetup setup = new ServiceITSetupImpl( springResource, elasticSearchResource );
 
 
     @Rule

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/services/src/test/java/org/apache/usergrid/services/AbstractServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/AbstractServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/AbstractServiceIT.java
index 8773daf..6f36083 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/AbstractServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/AbstractServiceIT.java
@@ -23,7 +23,7 @@ import org.junit.Rule;
 import org.apache.usergrid.ServiceApplication;
 import org.apache.usergrid.ServiceITSetup;
 import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.SpringResource;
 import org.apache.usergrid.cassandra.ClearShiroSubject;
 import org.apache.usergrid.cassandra.Concurrent;
 import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
@@ -35,13 +35,13 @@ public abstract class AbstractServiceIT {
     public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
 
     @ClassRule
-    public static CassandraResource cassandraResource = CassandraResource.setPortsAndStartSpring();
+    public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
 
     @ClassRule
     public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
 
     @Rule
-    public ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
+    public ServiceITSetup setup = new ServiceITSetupImpl( springResource, elasticSearchResource );
 
     @Rule
     public ServiceApplication app = new ServiceApplication( setup );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/services/src/test/java/org/apache/usergrid/services/ServiceRequestIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/ServiceRequestIT.java b/stack/services/src/test/java/org/apache/usergrid/services/ServiceRequestIT.java
index a947028..bcff258 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/ServiceRequestIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/ServiceRequestIT.java
@@ -31,7 +31,7 @@ import org.slf4j.LoggerFactory;
 
 import org.apache.usergrid.ServiceITSetup;
 import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.SpringResource;
 import org.apache.usergrid.cassandra.ClearShiroSubject;
 import org.apache.usergrid.cassandra.Concurrent;
 import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
@@ -46,7 +46,7 @@ public class ServiceRequestIT {
     private static final Logger logger = LoggerFactory.getLogger( ServiceRequestIT.class );
 
     @ClassRule
-    public static CassandraResource cassandraResource = CassandraResource.setPortsAndStartSpring();
+    public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
 
     @ClassRule
     public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
@@ -55,7 +55,7 @@ public class ServiceRequestIT {
     public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
 
     @Rule
-    public ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
+    public ServiceITSetup setup = new ServiceITSetupImpl( springResource, elasticSearchResource );
 
 
     @Test

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraMain.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraMain.java b/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraMain.java
index 3ca6d20..8a8baa0 100644
--- a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraMain.java
+++ b/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraMain.java
@@ -16,11 +16,11 @@
 package org.apache.usergrid.cassandra;
 
 import org.apache.cassandra.service.CassandraDaemon;
-import static org.apache.usergrid.cassandra.CassandraResource.LOG;
-import static org.apache.usergrid.cassandra.CassandraResource.NATIVE_TRANSPORT_PORT_KEY;
-import static org.apache.usergrid.cassandra.CassandraResource.RPC_PORT_KEY;
-import static org.apache.usergrid.cassandra.CassandraResource.SSL_STORAGE_PORT_KEY;
-import static org.apache.usergrid.cassandra.CassandraResource.STORAGE_PORT_KEY;
+import static org.apache.usergrid.cassandra.SpringResource.LOG;
+import static org.apache.usergrid.cassandra.SpringResource.NATIVE_TRANSPORT_PORT_KEY;
+import static org.apache.usergrid.cassandra.SpringResource.RPC_PORT_KEY;
+import static org.apache.usergrid.cassandra.SpringResource.SSL_STORAGE_PORT_KEY;
+import static org.apache.usergrid.cassandra.SpringResource.STORAGE_PORT_KEY;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e916d6d6/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraResource.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraResource.java b/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraResource.java
deleted file mode 100644
index beeecb7..0000000
--- a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraResource.java
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.apache.usergrid.cassandra;
-
-
-import java.io.IOException;
-import java.util.Properties;
-
-import org.junit.rules.ExternalResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-import org.apache.commons.lang.ArrayUtils;
-
-
-/**
- * A JUnit {@link org.junit.rules.ExternalResource} designed to set our system properties then start spring so it connects to cassandra correctly
- *
- */
-public class CassandraResource extends ExternalResource {
-    public static final Logger LOG = LoggerFactory.getLogger( CassandraResource.class );
-    public static final int DEFAULT_RPC_PORT = 9160;
-    public static final int DEFAULT_STORAGE_PORT = 7000;
-    public static final int DEFAULT_SSL_STORAGE_PORT = 7001;
-    public static final int DEFAULT_NATIVE_TRANSPORT_PORT = 9042;
-    public static final String DEFAULT_HOST = "127.0.0.1";
-
-    public static final String PROPERTIES_FILE = "project.properties";
-
-    public static final String NATIVE_TRANSPORT_PORT_KEY = "native_transport_port";
-    public static final String RPC_PORT_KEY = "rpc_port";
-    public static final String STORAGE_PORT_KEY = "storage_port";
-    public static final String SSL_STORAGE_PORT_KEY = "ssl_storage_port";
-
-    private static final Object lock = new Object();
-
-    private boolean initialized = false;
-    private int rpcPort = DEFAULT_RPC_PORT;
-    private int storagePort = DEFAULT_STORAGE_PORT;
-    private int sslStoragePort = DEFAULT_SSL_STORAGE_PORT;
-    private int nativeTransportPort = DEFAULT_NATIVE_TRANSPORT_PORT;
-
-    private ConfigurableApplicationContext applicationContext;
-    private SchemaManager schemaManager;
-
-    private static CassandraResource instance;
-
-    private static Properties properties = null;
-
-
-    /**
-     * Creates a Cassandra starting ExternalResource for JUnit test cases which uses the specified SchemaManager for
-     * Cassandra.
-     */
-    CassandraResource( int rpcPort, int storagePort, int sslStoragePort, int nativeTransportPort ) {
-        LOG.info( "Creating CassandraResource using {} for the ClassLoader.",
-                Thread.currentThread().getContextClassLoader() );
-
-        this.rpcPort = rpcPort;
-        this.storagePort = storagePort;
-        this.sslStoragePort = sslStoragePort;
-        this.nativeTransportPort = nativeTransportPort;
-
-
-        try {
-            String[] locations = { "usergrid-properties-context.xml" };
-            ConfigurableApplicationContext appContext = new ClassPathXmlApplicationContext( locations );
-
-            Properties properties = ( Properties ) appContext.getBean( "properties" );
-            properties.putAll( ArrayUtils.toMap( this.getProjectProperties().entrySet().toArray( new Object[] { } ) ) );
-        }
-        catch ( Exception ex ) {
-            throw new RuntimeException( "Error getting properties", ex );
-        }
-    }
-
-
-    /**
-     * Gets the rpcPort for Cassandra.
-     *
-     * @return the rpc_port (in yaml file) used by Cassandra
-     */
-    public int getRpcPort() {
-        return rpcPort;
-    }
-
-
-
-
-    /**
-     * Gets a bean from the application context.
-     *
-     * @param requiredType the type of the bean
-     * @param <T> the type of the bean
-     *
-     * @return the bean
-     */
-    public <T> T getBean( String name, Class<T> requiredType ) {
-        protect();
-        return applicationContext.getBean( name, requiredType );
-    }
-
-
-    /**
-     * Gets a bean from the application context.
-     *
-     * @param requiredType the type of the bean
-     * @param <T> the type of the bean
-     *
-     * @return the bean
-     */
-    public <T> T getBean( Class<T> requiredType ) {
-        protect();
-        return applicationContext.getBean( requiredType );
-    }
-
-
-    /**
-     * Gets whether this resource is ready to use.
-     *
-     * @return true if ready to use, false otherwise
-     */
-    public boolean isReady() {
-        return initialized;
-    }
-
-
-
-
-    /**
-     * Protects against IDE or command line runs of a unit test which when starting the test outside of the Suite will
-     * not start the resource. This makes sure the resource is automatically started on a usage attempt.
-     */
-    private void protect() {
-        if ( !isReady() ) {
-            try {
-                before();
-            }
-            catch ( Throwable t ) {
-                LOG.error( "Failed to start up Cassandra.", t );
-                throw new RuntimeException( t );
-            }
-        }
-    }
-
-
-    /**
-     * Starts up Cassandra before TestSuite or test Class execution.
-     *
-     * @throws Throwable if we cannot start up Cassandra
-     */
-    @Override
-    protected void before() throws Throwable {
-        /*
-         * Note that the lock is static so it is JVM wide which prevents other
-         * instances of this class from making changes to the Cassandra system
-         * properties while we are initializing Cassandra with unique settings.
-         */
-
-        synchronized ( lock ) {
-            super.before();
-
-            if ( isReady() ) {
-                return;
-            }
-
-            startSpring();
-        }
-    }
-
-
-    private void startSpring() throws Throwable {
-        LOG.info( "-------------------------------------------------------------------" );
-        LOG.info( "Initializing External Cassandra" );
-        LOG.info( "-------------------------------------------------------------------" );
-        LOG.info( "before() test, setting system properties for ports : "
-                        + "[rpc, storage, sslStorage, native] = [{}, {}, {}, {}]",
-                new Object[] { rpcPort, storagePort, sslStoragePort, nativeTransportPort } );
-        String[] locations = { "usergrid-test-context.xml" };
-        applicationContext = new ClassPathXmlApplicationContext( locations );
-        applicationContext.refresh();
-        initialized = true;
-        lock.notifyAll();
-    }
-
-
-    /**
-     * Loads the specified {@link SchemaManager} or the default manager if the manager name that is provided is null.
-     *
-     *
-     */
-    private void loadSchemaManager() {
-        if ( !applicationContext.isActive() ) {
-            LOG.info( "Restarting context..." );
-            applicationContext.refresh();
-        }
-
-
-        LOG.info( "The SchemaManager is not specified - using the default SchemaManager impl" );
-        this.schemaManager = applicationContext.getBean( SchemaManager.class );
-
-        schemaManager.create();
-        schemaManager.populateBaseData();
-    }
-
-
-    public static CassandraResource setAllocatedPorts() {
-        synchronized ( lock ) {
-
-            //don't keep re-initializing if it's already done
-            if(instance != null){
-                return instance;
-            }
-
-            Properties props = new Properties();
-            try {
-                props.load( ClassLoader.getSystemResourceAsStream( "project.properties" ) );
-            }
-            catch ( IOException e ) {
-                LOG.error( "Unable to load project properties: {}", e.getLocalizedMessage() );
-            }
-            int rpcPort = Integer.parseInt(
-                    props.getProperty( "cassandra.rpcPort", Integer.toString( CassandraResource.DEFAULT_RPC_PORT ) ) );
-            int storagePort = Integer.parseInt( props.getProperty( "cassandra.storagePort",
-                    Integer.toString( CassandraResource.DEFAULT_STORAGE_PORT ) ) );
-            int sslStoragePort = Integer.parseInt( props.getProperty( "cassandra.sslPort",
-                    Integer.toString( CassandraResource.DEFAULT_SSL_STORAGE_PORT ) ) );
-            int nativeTransportPort = Integer.parseInt( props.getProperty( "cassandra.nativeTransportPort",
-                    Integer.toString( CassandraResource.DEFAULT_NATIVE_TRANSPORT_PORT ) ) );
-            String host = props.getProperty( "cassandra.host", DEFAULT_HOST );
-
-            System.setProperty( "cassandra.url", host + ":" + Integer.toString( rpcPort ) );
-            System.setProperty( "cassandra.cluster", props.getProperty( "cassandra.cluster", "Usergrid" ) );
-            System.setProperty( "cassandra-foreground", "true" );
-            System.setProperty( "log4j.defaultInitOverride", "true" );
-            System.setProperty( "log4j.configuration", "log4j.properties" );
-            System.setProperty( "cassandra.ring_delay_ms", "100" );
-
-            System.setProperty( "cassandra." + RPC_PORT_KEY, Integer.toString( rpcPort ) );
-            System.setProperty( "cassandra." + STORAGE_PORT_KEY, Integer.toString( storagePort ) );
-            System.setProperty( "cassandra." + SSL_STORAGE_PORT_KEY, Integer.toString( sslStoragePort ) );
-            System.setProperty( "cassandra." + NATIVE_TRANSPORT_PORT_KEY, Integer.toString( nativeTransportPort ) );
-
-            LOG.info( "project.properties loaded properties for ports : "
-                            + "[rpc, storage, sslStorage, native] = [{}, {}, {}, {}]",
-                    new Object[] { rpcPort, storagePort, sslStoragePort, nativeTransportPort } );
-
-
-            instance = new CassandraResource( rpcPort, storagePort, sslStoragePort, nativeTransportPort );
-
-            LOG.info( "Created a new instance of CassandraResource: {}", instance );
-            LOG.info( "Cassandra using ports {} and {}", storagePort, sslStoragePort );
-
-
-
-            return instance;
-        }
-    }
-
-
-    /**
-     * Creates a new instance of the CassandraResource with rpc and storage ports that may or may not be the default
-     * ports. If either port is taken, an alternative free port is found.
-     *
-     * @return a new CassandraResource with possibly non-default ports
-     */
-    public static CassandraResource setPortsAndStartSpring() {
-        return setAllocatedPorts();
-    }
-
-
-
-    public static Properties getProjectProperties() throws IOException {
-        if ( properties == null ) {
-            properties = new Properties();
-            properties.load( ClassLoader.getSystemResourceAsStream( PROPERTIES_FILE ) );
-        }
-        return properties;
-    }
-
-
-    @Override
-    public String toString() {
-        return "CassandraResource{" +
-                "initialized=" + initialized +
-                ", rpcPort=" + rpcPort +
-                ", storagePort=" + storagePort +
-                ", sslStoragePort=" + sslStoragePort +
-                ", nativeTransportPort=" + nativeTransportPort +
-                ", applicationContext=" + applicationContext +
-                ", schemaManager=" + schemaManager +
-                "} " + super.toString();
-    }
-}