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/10 21:06:18 UTC

[1/2] incubator-usergrid git commit: Updated maven config

Repository: incubator-usergrid
Updated Branches:
  refs/heads/USERGRID-273 bc93f693a -> cfff0cce4


Updated maven config

Remove suite classes


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

Branch: refs/heads/USERGRID-273
Commit: 5baf6cd87174d3303cc5b9a935dc19bc009f7de0
Parents: bc93f69
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 12:04:48 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 12:04:48 2014 -0700

----------------------------------------------------------------------
 stack/services/pom.xml                          | 268 ++++---------------
 .../usergrid/ConcurrentServiceITSuite.java      |  60 -----
 .../org/apache/usergrid/ServiceITSuite.java     |  64 -----
 .../apache/usergrid/management/EmailFlowIT.java |  15 +-
 .../usergrid/management/OrganizationIT.java     |  13 +-
 .../org/apache/usergrid/management/RoleIT.java  |  12 +-
 .../cassandra/ApplicationCreatorIT.java         |  12 +-
 .../management/cassandra/ExportServiceIT.java   |  10 +-
 .../cassandra/ManagementServiceIT.java          |  11 +-
 .../security/providers/FacebookProviderIT.java  |  14 +-
 .../providers/PingIdentityProviderIT.java       |  12 +-
 .../security/tokens/TokenServiceIT.java         |  15 +-
 .../usergrid/services/AbstractServiceIT.java    |  13 +-
 .../usergrid/services/ServiceRequestIT.java     |  14 +-
 14 files changed, 150 insertions(+), 383 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/pom.xml
----------------------------------------------------------------------
diff --git a/stack/services/pom.xml b/stack/services/pom.xml
index 0537613..dd94eb7 100644
--- a/stack/services/pom.xml
+++ b/stack/services/pom.xml
@@ -46,199 +46,7 @@
     </plugins>
   </reporting>
 
-  <profiles>
-    <profile>
-      <id>unit</id>
-      <activation>
-        <property>
-          <name>unit</name>
-          <value>true</value>
-        </property>
-      </activation>
-
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-surefire-plugin</artifactId>
-            <configuration>
-              <systemPropertyVariables>
-                <storage-config>${basedir}/src/test/conf</storage-config>
-                <target.directory>${project.build.directory}</target.directory>
-              </systemPropertyVariables>
-			<parallel>${services.it.parallel}</parallel>
-            <forkCount>${services.it.forkCount}</forkCount>
-            <reuseForks>${services.it.reuseForks}</reuseForks>
-              <!-- TODO: make this into a small configuration but based on settings.xml -->
-              <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar ${ug.argline}</argLine>
-
-              <includes>
-                <include>**/ServiceTestSuite.java</include>
-                <include>**/*Test.java</include>
-              </includes>
-              <excludes>
-                <exclude>**/*IT.java</exclude>
-                <exclude>**/*ITSuite.java</exclude>
-                <!-- TODO - add these suites too -->
-                <!-- <exclude>**/*Test.java</exclude> -->
-                <exclude>**/ConcurrentService*Suite.java</exclude>
-              </excludes>
-            </configuration>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-
-    <profile>
-      <id>default</id>
-      <activation>
-        <activeByDefault>true</activeByDefault>
-      </activation>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-surefire-plugin</artifactId>
-            <configuration>
-              <systemPropertyVariables>
-                <storage-config>${basedir}/src/test/conf</storage-config>
-                <target.directory>${project.build.directory}</target.directory>
-              </systemPropertyVariables>
-
-			<parallel>${services.it.parallel}</parallel>
-            <threadCount>${services.it.threadCount}</threadCount>
-            <forkCount>${services.it.forkCount}</forkCount>
-            <reuseForks>${services.it.reuseForks}</reuseForks>
 
-              <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 ${ug.argline}</argLine>
-              <argLine>
-                <!-- -javaagent:${settings.localRepository}/org/powermock/powermock-module-javaagent/1.5.1/powermock-module-javaagent-1.5.1.jar -->
-                -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar
-              </argLine>
-
-              <includes>
-                <include>**/ServiceITSuite.java</include>
-                <include>**/ServiceTestSuite.java</include>
-                <include>**/*IT.java</include>
-                <include>**/*Test.java</include>
-              </includes>
-              <excludes>
-                <exclude>**/*Concurrent*Suite.java</exclude>
-                <exclude>**/ExportServiceIT.java</exclude>
-                <exclude>**/ActivitiesServiceIT.java</exclude>
-                <exclude>**/ApplicationCreatorIT.java</exclude>
-                <exclude>**/ApplicationsServiceIT.java</exclude>
-                <exclude>**/CollectionServiceIT.java</exclude>
-                <exclude>**/ConnectionsServiceIT.java</exclude>
-                <exclude>**/ManagementServiceIT.java</exclude>
-                <exclude>**/EmailFlowIT.java</exclude>
-                <exclude>**/FacebookProviderIT.java</exclude>
-                <exclude>**/GroupServiceIT.java</exclude>
-                <exclude>**/OrganizationIT.java</exclude>
-                <exclude>**/PingIdentityProviderIT.java</exclude>
-                <exclude>**/RoleIT.java</exclude>
-                <exclude>**/RolesServiceIT.java</exclude>
-                <exclude>**/ServiceRequestIT.java</exclude>
-                <exclude>**/ServiceFactoryIT.java</exclude>
-                <exclude>**/ServiceInvocationIT.java</exclude>
-                <exclude>**/UsersServiceIT.class</exclude>
-              </excludes>
-            </configuration>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-
-    <profile>
-      <id>unit-concurrent</id>
-      <activation>
-        <property>
-          <name>unit-concurrent</name>
-          <value>true</value>
-        </property>
-      </activation>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-surefire-plugin</artifactId>
-            <configuration>
-              <accessKey>${aws.s3.key}</accessKey>
-              <secretKey>${aws.s3.secret}</secretKey>
-              <bucketName>${aws.s3.bucket}</bucketName>
-              <systemPropertyVariables>
-                <storage-config>${basedir}/src/test/conf</storage-config>
-                <target.directory>${project.build.directory}</target.directory>
-              </systemPropertyVariables>
-			<parallel>${services.it.parallel}</parallel>
-            <forkCount>${services.it.forkCount}</forkCount>
-            <reuseForks>${services.it.reuseForks}</reuseForks>
-              <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 ${ug.argline}</argLine>
-              <argLine>
-               <!--  -javaagent:${settings.localRepository}/org/powermock/powermock-module-javaagent/1.5.1/powermock-module-javaagent-1.5.1.jar-->
-			   -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar
-              </argLine>
-
-              <includes>
-                <include>**/ConcurrentServiceTestSuite.java</include>
-              </includes>
-              <excludes>
-                <exclude>**/*IT.java</exclude>
-                <exclude>**/*Test.java</exclude>
-                <exclude>**/ServiceITSuite.java</exclude>
-                <exclude>**/ServiceTestSuite.java</exclude>
-                <exclude>**/ConcurrentServiceITSuite.java</exclude>
-              </excludes>
-            </configuration>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-
-
-    <profile>
-      <id>integ-concurrent</id>
-      <activation>
-        <property>
-          <name>integ-concurrent</name>
-          <value>true</value>
-        </property>
-      </activation>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-surefire-plugin</artifactId>
-            <configuration>
-              <systemPropertyVariables>
-                <storage-config>${basedir}/src/test/conf</storage-config>
-                <target.directory>${project.build.directory}</target.directory>
-              </systemPropertyVariables>
-			<parallel>${services.it.parallel}</parallel>
-            <forkCount>${services.it.forkCount}</forkCount>
-            <reuseForks>${services.it.reuseForks}</reuseForks>
-              <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 ${ug.argline}</argLine>
-              <argLine>
-                <!-- -javaagent:${settings.localRepository}/org/powermock/powermock-module-javaagent/1.5.1/powermock-module-javaagent-1.5.1.jar -->
-				-javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar
-              </argLine>
-
-              <includes>
-                <include>**/ConcurrentServiceITSuite.java</include>
-                <include>**/TokenServiceIT.java</include>
-              </includes>
-              <excludes>
-                <exclude>**/*IT.java</exclude>
-                <exclude>**/*Test.java</exclude>
-                <exclude>**/ServiceITSuite.java</exclude>
-                <exclude>**/ServiceTestSuite.java</exclude>
-              </excludes>
-            </configuration>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-  </profiles>
 
   <!-- PROFILES -->
 
@@ -270,38 +78,52 @@
         <directory>src/main/python</directory>
       </testResource>
     </testResources>
+
     <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <systemPropertyVariables>
-            <storage-config>${basedir}/src/test/conf</storage-config>
-            <target.directory>${project.build.directory}</target.directory>
-          </systemPropertyVariables>
-
-			<parallel>${services.it.parallel}</parallel>
-            <forkCount>${services.it.forkCount}</forkCount>
-            <reuseForks>${services.it.reuseForks}</reuseForks>
-
-          <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 ${ug.argline}</argLine>
-          <argLine>
-            <!-- -javaagent:${settings.localRepository}/org/powermock/powermock-module-javaagent/1.5.1/powermock-module-javaagent-1.5.1.jar-->
-			-javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar
-          </argLine>
-
-          <includes>
-            <include>**/ServiceITSuite.java</include>
-            <include>**/ServiceTestSuite.java</include>
-            <include>**/TokenServiceIT.java</include>
-            <include>**/*Test.java</include>
-          </includes>
-          <excludes>
-            <!-- <exclude>**/*Test.java</exclude> -->
-            <exclude>**/*Concurrent*Suite.java</exclude>
-          </excludes>
-        </configuration>
-      </plugin>
+    <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+              <systemPropertyVariables>
+                <storage-config>${basedir}/src/test/conf</storage-config>
+                <target.directory>${project.build.directory}</target.directory>
+              </systemPropertyVariables>
+              <parallel>classes</parallel>
+              <forkCount>${services.it.forkCount}</forkCount>
+              <reuseForks>${services.it.reuseForks}</reuseForks>
+              <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar ${ug.argline}</argLine>
+              <includes>
+                <include>**/*IT.java</include>
+                <include>**/*Test.java</include>
+              </includes>
+
+              <!-- exclude our serial tests -->
+              <excludes>
+                <exclude>**/*Scheduler*IT.java</exclude>
+                <exclude>**/*Notification*IT.java</exclude>
+              </excludes>
+            </configuration>
+
+            <!-- Serial execution -->
+            <executions>
+                   <execution>
+                       <id>single-thread-test</id>
+                       <phase>test</phase>
+                       <goals>
+                           <goal>test</goal>
+                       </goals>
+                       <configuration>
+                           <includes>
+                               <include>**/*Scheduler*IT.java</include>
+                               <include>**/*Notification*IT.java</include>
+                           </includes>
+                           <threadCount>1</threadCount>
+                       </configuration>
+                   </execution>
+               </executions>
+
+            <version>2.15</version>
+          </plugin>
     </plugins>
   </build>
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/ConcurrentServiceITSuite.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/ConcurrentServiceITSuite.java b/stack/services/src/test/java/org/apache/usergrid/ConcurrentServiceITSuite.java
deleted file mode 100644
index 2db2c48..0000000
--- a/stack/services/src/test/java/org/apache/usergrid/ConcurrentServiceITSuite.java
+++ /dev/null
@@ -1,60 +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;
-
-
-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.Concurrent;
-import org.apache.usergrid.cassandra.ConcurrentSuite;
-import org.apache.usergrid.management.EmailFlowIT;
-import org.apache.usergrid.management.OrganizationIT;
-import org.apache.usergrid.management.RoleIT;
-import org.apache.usergrid.management.cassandra.ApplicationCreatorIT;
-import org.apache.usergrid.management.cassandra.ExportServiceIT;
-import org.apache.usergrid.management.cassandra.ManagementServiceIT;
-import org.apache.usergrid.security.providers.FacebookProviderIT;
-import org.apache.usergrid.security.providers.PingIdentityProviderIT;
-import org.apache.usergrid.security.tokens.TokenServiceIT;
-import org.apache.usergrid.services.ActivitiesServiceIT;
-import org.apache.usergrid.services.ApplicationsServiceIT;
-import org.apache.usergrid.services.CollectionServiceIT;
-import org.apache.usergrid.services.ConnectionsServiceIT;
-import org.apache.usergrid.services.GroupServiceIT;
-import org.apache.usergrid.services.RolesServiceIT;
-import org.apache.usergrid.services.ServiceFactoryIT;
-import org.apache.usergrid.services.ServiceInvocationIT;
-import org.apache.usergrid.services.ServiceRequestIT;
-import org.apache.usergrid.services.UsersServiceIT;
-
-
-@RunWith(ConcurrentSuite.class)
-@Suite.SuiteClasses(
-        {
-                ActivitiesServiceIT.class, ApplicationCreatorIT.class, ApplicationsServiceIT.class,
-                CollectionServiceIT.class, ConnectionsServiceIT.class, ManagementServiceIT.class, ExportServiceIT.class ,EmailFlowIT.class,
-                FacebookProviderIT.class, GroupServiceIT.class, OrganizationIT.class, PingIdentityProviderIT.class,
-                RolesServiceIT.class, RoleIT.class, ServiceRequestIT.class, ServiceFactoryIT.class,
-                ServiceInvocationIT.class, TokenServiceIT.class, UsersServiceIT.class
-        })
-@Concurrent()
-public class ConcurrentServiceITSuite {
-    @ClassRule
-    public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/ServiceITSuite.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/ServiceITSuite.java b/stack/services/src/test/java/org/apache/usergrid/ServiceITSuite.java
deleted file mode 100644
index 5edc4579..0000000
--- a/stack/services/src/test/java/org/apache/usergrid/ServiceITSuite.java
+++ /dev/null
@@ -1,64 +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;
-
-
-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.Concurrent;
-import org.apache.usergrid.management.EmailFlowIT;
-import org.apache.usergrid.management.OrganizationIT;
-import org.apache.usergrid.management.RoleIT;
-import org.apache.usergrid.management.cassandra.ApplicationCreatorIT;
-import org.apache.usergrid.management.cassandra.ExportServiceIT;
-import org.apache.usergrid.management.cassandra.ManagementServiceIT;
-import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
-import org.apache.usergrid.security.providers.FacebookProviderIT;
-import org.apache.usergrid.security.providers.PingIdentityProviderIT;
-import org.apache.usergrid.services.ActivitiesServiceIT;
-import org.apache.usergrid.services.ApplicationsServiceIT;
-import org.apache.usergrid.services.CollectionServiceIT;
-import org.apache.usergrid.services.ConnectionsServiceIT;
-import org.apache.usergrid.services.GroupServiceIT;
-import org.apache.usergrid.services.RolesServiceIT;
-import org.apache.usergrid.services.ServiceFactoryIT;
-import org.apache.usergrid.services.ServiceInvocationIT;
-import org.apache.usergrid.services.ServiceRequestIT;
-import org.apache.usergrid.services.UsersServiceIT;
-
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses(
-        {
-                ActivitiesServiceIT.class, ApplicationCreatorIT.class, ApplicationsServiceIT.class,
-                CollectionServiceIT.class, ConnectionsServiceIT.class, ExportServiceIT.class,
-                ManagementServiceIT.class, EmailFlowIT.class,
-                FacebookProviderIT.class, GroupServiceIT.class, OrganizationIT.class, PingIdentityProviderIT.class,
-                RoleIT.class, RolesServiceIT.class, ServiceRequestIT.class, ServiceFactoryIT.class,
-                ServiceInvocationIT.class, UsersServiceIT.class
-        })
-@Concurrent()
-public class ServiceITSuite {
-
-    @ClassRule
-    public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
-    
-    @ClassRule
-    public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/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 1d5ff7b..719fd86 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
@@ -48,14 +48,9 @@ import org.apache.usergrid.persistence.EntityManager;
 import org.apache.usergrid.persistence.SimpleEntityRef;
 import org.apache.usergrid.persistence.entities.Application;
 import org.apache.usergrid.persistence.entities.User;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
 
 import static org.apache.commons.lang.StringUtils.isNotBlank;
-import org.apache.usergrid.ServiceITSuite;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertTrue;
 import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_ADMIN_USERS_REQUIRE_CONFIRMATION;
 import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_EMAIL_ADMIN_ACTIVATED;
 import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_EMAIL_ADMIN_CONFIRMATION;
@@ -95,13 +90,17 @@ public class EmailFlowIT {
     private static final String ORGANIZATION_NAME = "email-test-org-1";
     public static final String ORGANIZATION_NAME_2 = "email-test-org-2";
 
-    static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+    @ClassRule
+    public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts( );
+
+    @ClassRule
+    public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
 
     @Rule
     public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
 
     @ClassRule
-    public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, ServiceITSuite.elasticSearchResource );
+    public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
 
     @Rule
     public TestName name = new TestName();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/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 02db523..92bb448 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
@@ -25,13 +25,15 @@ import java.util.UUID;
 import org.junit.ClassRule;
 import org.junit.Rule;
 import org.junit.Test;
+
 import org.apache.usergrid.ServiceITSetup;
 import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
 import org.apache.usergrid.cassandra.ClearShiroSubject;
 import org.apache.usergrid.cassandra.Concurrent;
 import org.apache.usergrid.management.cassandra.ManagementServiceImpl;
 import org.apache.usergrid.management.exceptions.RecentlyUsedPasswordException;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
 import org.apache.usergrid.security.AuthPrincipalInfo;
 
 import static org.junit.Assert.assertEquals;
@@ -47,7 +49,14 @@ public class OrganizationIT {
     public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
 
     @ClassRule
-    public static ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+    public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+    @ClassRule
+    public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
+
+    @ClassRule
+    public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
 
 
     @Test

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/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 9c1c0b7..b88ab24 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,11 +31,12 @@ import org.apache.shiro.subject.Subject;
 
 import org.apache.usergrid.ServiceITSetup;
 import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
 import org.apache.usergrid.cassandra.ClearShiroSubject;
 import org.apache.usergrid.cassandra.Concurrent;
 import org.apache.usergrid.persistence.EntityManager;
 import org.apache.usergrid.persistence.entities.User;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
 import org.apache.usergrid.security.shiro.PrincipalCredentialsToken;
 import org.apache.usergrid.security.shiro.utils.SubjectUtils;
 
@@ -46,11 +47,18 @@ import static org.junit.Assert.assertFalse;
 public class RoleIT {
     private static final Logger LOG = LoggerFactory.getLogger( RoleIT.class );
 
+    @ClassRule
+    public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+    @ClassRule
+    public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
+
     @Rule
     public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
 
     @ClassRule
-    public static ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+    public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
 
 
     @Test

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/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 b1a7d19..6b3bb0b 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
@@ -19,18 +19,20 @@ package org.apache.usergrid.management.cassandra;
 
 import java.util.Set;
 
+import org.junit.ClassRule;
 import org.junit.Rule;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+
 import org.apache.usergrid.ServiceITSetup;
 import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
 import org.apache.usergrid.cassandra.CassandraResource;
 import org.apache.usergrid.cassandra.ClearShiroSubject;
 import org.apache.usergrid.cassandra.Concurrent;
 import org.apache.usergrid.management.ApplicationInfo;
 import org.apache.usergrid.management.OrganizationOwnerInfo;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -42,13 +44,17 @@ import static org.junit.Assert.assertTrue;
 public class ApplicationCreatorIT {
     private static final Logger LOG = LoggerFactory.getLogger( ApplicationCreatorIT.class );
 
-    private CassandraResource cassandraResource = ServiceITSuite.cassandraResource;
+    @ClassRule
+    public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+    @ClassRule
+    public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
 
     @Rule
     public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
 
     @Rule
-    public ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, ServiceITSuite.elasticSearchResource );
+    public ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
 
 
     @Test

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/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 f0c89d6..a5b499b 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
@@ -45,7 +45,6 @@ import org.slf4j.LoggerFactory;
 
 import org.apache.usergrid.ServiceITSetup;
 import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
 import org.apache.usergrid.batch.JobExecution;
 import org.apache.usergrid.cassandra.CassandraResource;
 import org.apache.usergrid.cassandra.ClearShiroSubject;
@@ -61,6 +60,7 @@ import org.apache.usergrid.persistence.Entity;
 import org.apache.usergrid.persistence.EntityManager;
 import org.apache.usergrid.persistence.SimpleEntityRef;
 import org.apache.usergrid.persistence.entities.JobData;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
 
 import com.google.common.collect.ImmutableSet;
 import com.google.inject.Module;
@@ -82,7 +82,11 @@ public class ExportServiceIT {
 
     private static final Logger LOG = LoggerFactory.getLogger( ExportServiceIT.class );
 
-    private static CassandraResource cassandraResource = ServiceITSuite.cassandraResource;
+    @ClassRule
+    public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+    @ClassRule
+    public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
 
     // app-level data generated only once
     private static UserInfo adminUser;
@@ -93,7 +97,7 @@ public class ExportServiceIT {
     public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
 
     @ClassRule
-    public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, ServiceITSuite.elasticSearchResource );
+    public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
 
 
     @BeforeClass

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/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 6eb2865..4288d99 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
@@ -32,7 +32,6 @@ import org.slf4j.LoggerFactory;
 
 import org.apache.usergrid.ServiceITSetup;
 import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
 import org.apache.usergrid.cassandra.CassandraResource;
 import org.apache.usergrid.cassandra.ClearShiroSubject;
 import org.apache.usergrid.cassandra.Concurrent;
@@ -43,6 +42,7 @@ import org.apache.usergrid.persistence.CredentialsInfo;
 import org.apache.usergrid.persistence.Entity;
 import org.apache.usergrid.persistence.EntityManager;
 import org.apache.usergrid.persistence.entities.User;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
 import org.apache.usergrid.security.AuthPrincipalType;
 import org.apache.usergrid.security.crypto.command.Md5HashCommand;
 import org.apache.usergrid.security.crypto.command.Sha1HashCommand;
@@ -52,7 +52,6 @@ import org.apache.usergrid.utils.JsonUtils;
 import org.apache.usergrid.utils.UUIDUtils;
 
 import static org.apache.commons.codec.binary.Base64.encodeBase64URLSafeString;
-import static org.apache.usergrid.management.EmailFlowIT.setup;
 import static org.apache.usergrid.persistence.Schema.DICTIONARY_CREDENTIALS;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -67,7 +66,11 @@ import static org.junit.Assert.assertTrue;
 public class ManagementServiceIT {
     private static final Logger LOG = LoggerFactory.getLogger( ManagementServiceIT.class );
 
-    private static CassandraResource cassandraResource = ServiceITSuite.cassandraResource;
+    @ClassRule
+    public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+    @ClassRule
+    public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
 
     // app-level data generated only once
     private static UserInfo adminUser;
@@ -78,7 +81,7 @@ public class ManagementServiceIT {
     public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
 
     @ClassRule
-    public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, ServiceITSuite.elasticSearchResource );
+    public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
 
 
     @BeforeClass

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/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 3ca4df5..c78e348 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
@@ -25,15 +25,17 @@ import org.junit.ClassRule;
 import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
+
 import org.apache.usergrid.ServiceITSetup;
 import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
 import org.apache.usergrid.cassandra.ClearShiroSubject;
 import org.apache.usergrid.cassandra.Concurrent;
 import org.apache.usergrid.management.OrganizationInfo;
 import org.apache.usergrid.management.UserInfo;
 import org.apache.usergrid.persistence.entities.Application;
 import org.apache.usergrid.persistence.entities.User;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
 import org.apache.usergrid.utils.MapUtils;
 
 import static org.junit.Assert.assertEquals;
@@ -47,16 +49,22 @@ public class FacebookProviderIT {
     private static SignInProviderFactory providerFactory;
     private static UUID applicationId;
 
+    @ClassRule
+    public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+    @ClassRule
+    public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
     @Rule
     public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
 
     @ClassRule
-    public static ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+    public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
 
 
     @BeforeClass
     public static void setup() throws Exception {
-        providerFactory = ServiceITSuite.cassandraResource.getBean( SignInProviderFactory.class );
+        providerFactory = cassandraResource.getBean( SignInProviderFactory.class );
         UserInfo adminUser = setup.getMgmtSvc()
                                   .createAdminUser( "fbuser", "Facebook User", "user@facebook.com", "test", false,
                                           false );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/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 ed03fb2..9fd9821 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
@@ -25,15 +25,17 @@ import org.junit.ClassRule;
 import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
+
 import org.apache.usergrid.ServiceITSetup;
 import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
 import org.apache.usergrid.cassandra.ClearShiroSubject;
 import org.apache.usergrid.cassandra.Concurrent;
 import org.apache.usergrid.management.OrganizationInfo;
 import org.apache.usergrid.management.UserInfo;
 import org.apache.usergrid.persistence.entities.Application;
 import org.apache.usergrid.persistence.entities.User;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
 import org.apache.usergrid.utils.MapUtils;
 
 import static junit.framework.Assert.assertNotNull;
@@ -47,11 +49,17 @@ public class PingIdentityProviderIT {
     private static OrganizationInfo organization;
     private static UUID applicationId;
 
+    @ClassRule
+    public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+    @ClassRule
+    public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
     @Rule
     public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
 
     @ClassRule
-    public static ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+    public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
 
 
     @BeforeClass

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/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 4e2a80c..49d939c 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
@@ -26,9 +26,10 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+
 import org.apache.usergrid.ServiceITSetup;
 import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
 import org.apache.usergrid.cassandra.ClearShiroSubject;
 import org.apache.usergrid.cassandra.Concurrent;
 import org.apache.usergrid.management.ApplicationInfo;
@@ -37,10 +38,10 @@ import org.apache.usergrid.management.OrganizationOwnerInfo;
 import org.apache.usergrid.management.UserInfo;
 import org.apache.usergrid.persistence.EntityManager;
 import org.apache.usergrid.persistence.entities.Application;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
 import org.apache.usergrid.security.AuthPrincipalInfo;
 import org.apache.usergrid.security.AuthPrincipalType;
-import org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl
-        ;
+import org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl;
 import org.apache.usergrid.security.tokens.exceptions.ExpiredTokenException;
 import org.apache.usergrid.security.tokens.exceptions.InvalidTokenException;
 import org.apache.usergrid.utils.UUIDUtils;
@@ -63,7 +64,13 @@ public class TokenServiceIT {
     public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
 
     @ClassRule
-    public static ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+    public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+    @ClassRule
+    public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
+    @ClassRule
+    public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
 
 
     @BeforeClass

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/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 30806ff..50262e9 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
@@ -17,13 +17,16 @@
 package org.apache.usergrid.services;
 
 
+import org.junit.ClassRule;
 import org.junit.Rule;
+
 import org.apache.usergrid.ServiceApplication;
 import org.apache.usergrid.ServiceITSetup;
 import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
 import org.apache.usergrid.cassandra.ClearShiroSubject;
 import org.apache.usergrid.cassandra.Concurrent;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
 
 
 @Concurrent()
@@ -31,8 +34,14 @@ public abstract class AbstractServiceIT {
     @Rule
     public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
 
+    @ClassRule
+    public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts( );
+
+    @ClassRule
+    public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
     @Rule
-    public ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+    public ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
 
     @Rule
     public ServiceApplication app = new ServiceApplication( setup );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/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 4ec0d43..5ff7c61 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
@@ -23,16 +23,18 @@ import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 
+import org.junit.ClassRule;
 import org.junit.Rule;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+
 import org.apache.usergrid.ServiceITSetup;
 import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
 import org.apache.usergrid.cassandra.ClearShiroSubject;
 import org.apache.usergrid.cassandra.Concurrent;
-import static org.apache.usergrid.management.EmailFlowIT.setup;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
 
 import static org.apache.usergrid.services.ServiceParameter.filter;
 import static org.apache.usergrid.services.ServiceParameter.parameters;
@@ -43,11 +45,17 @@ public class ServiceRequestIT {
 
     private static final Logger logger = LoggerFactory.getLogger( ServiceRequestIT.class );
 
+    @ClassRule
+    public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+    @ClassRule
+    public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
     @Rule
     public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
 
     @Rule
-    public ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+    public ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
 
 
     @Test


[2/2] incubator-usergrid git commit: Finished rule for use in tests and completed ExportServiceIT migration to the rule

Posted by to...@apache.org.
Finished rule for use in tests and completed ExportServiceIT migration to the rule


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

Branch: refs/heads/USERGRID-273
Commit: cfff0cce4faeeeee8dfbe3add8e622809db0c7bd
Parents: 5baf6cd
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 13:05:37 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 13:06:10 2014 -0700

----------------------------------------------------------------------
 .../org/apache/usergrid/NewOrgAppAdminRule.java | 160 +++++++++++++++++++
 .../management/cassandra/ExportServiceIT.java   |  48 +++---
 .../org/apache/usergrid/UUIDTestHelper.java     |  38 +++++
 3 files changed, 228 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cfff0cce/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java b/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java
new file mode 100644
index 0000000..71a4740
--- /dev/null
+++ b/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java
@@ -0,0 +1,160 @@
+/*
+ * 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;
+
+
+import java.util.UUID;
+
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.usergrid.management.ApplicationInfo;
+import org.apache.usergrid.management.OrganizationInfo;
+import org.apache.usergrid.management.OrganizationOwnerInfo;
+import org.apache.usergrid.management.UserInfo;
+import org.apache.usergrid.persistence.model.util.UUIDGenerator;
+
+import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
+
+
+/**
+ * Creates a new org and admin for every method in the class.  Also creates an application
+ */
+public class NewOrgAppAdminRule implements TestRule {
+
+    private final static Logger LOG = LoggerFactory.getLogger( CoreApplication.class );
+
+    public static final String ADMIN_NAME = "Test Admin";
+    public static final String ADMIN_PASSWORD = "password";
+
+    private final ServiceITSetup setup;
+
+    private OrganizationOwnerInfo organizationOwnerInfo;
+    private ApplicationInfo applicationInfo;
+
+
+    public NewOrgAppAdminRule( final ServiceITSetup setup ) {
+        this.setup = setup;
+    }
+
+
+    @Override
+    public Statement apply( final Statement base, final Description description ) {
+        return new Statement() {
+            @Override
+            public void evaluate() throws Throwable {
+                before( description );
+
+                try {
+                    base.evaluate();
+                }
+                finally {
+                    after( description );
+                }
+            }
+        };
+    }
+
+
+    protected void after( Description description ) {
+        LOG.info( "Test {}: finish with application", description.getDisplayName() );
+    }
+
+
+    /**
+     * Get the org and admin user info
+     * @return
+     */
+    public OrganizationOwnerInfo getOrganizationOwnerInfo() {
+        return organizationOwnerInfo;
+    }
+
+
+    /**
+     * Get the applicationInfo
+     * @return
+     */
+    public ApplicationInfo getApplicationInfo() {
+        return applicationInfo;
+    }
+
+
+    /**
+     * Get the organization info
+     * @return
+     */
+    public OrganizationInfo getOrganizationInfo(){
+        return getOrganizationOwnerInfo().getOrganization();
+    }
+
+
+    /**
+     * Get the admin info
+     * @return
+     */
+    public UserInfo getAdminInfo(){
+        return getOrganizationOwnerInfo().getOwner();
+    }
+
+
+    /**
+     * Create the org admin and application
+     */
+    protected void before( Description description ) throws Exception {
+        final String className = description.getClassName();
+        final String methodName = description.getMethodName();
+        final String uuidString = newUUIDString();
+
+        final String orgName = className + uuidString;
+        final String appName = methodName;
+        final String adminUsername = uuidString;
+        final String email = uuidString + "@apache.org";
+
+        organizationOwnerInfo = createOwnerAndOrganization( orgName, adminUsername, email, ADMIN_NAME, ADMIN_PASSWORD );
+        applicationInfo = createApplication( organizationOwnerInfo.getOrganization().getUuid(), appName );
+    }
+
+
+    /**
+     * Create the org and the admin that owns it
+     */
+    public OrganizationOwnerInfo createOwnerAndOrganization( final String orgName, final String adminUsername,
+                                                             final String adminEmail, final String adminName,
+                                                             final String adminPassword ) throws Exception {
+        return setup.getMgmtSvc()
+                    .createOwnerAndOrganization( orgName, adminUsername, adminName, adminEmail, adminPassword, false,
+                            false );
+    }
+
+
+    /**
+     * Create the new application
+     */
+    public ApplicationInfo createApplication( final UUID organizationId, final String applicationName )
+            throws Exception {
+        return setup.getMgmtSvc().createApplication( organizationId, applicationName );
+    }
+
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cfff0cce/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 a5b499b..2c64836 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
@@ -35,7 +35,7 @@ import org.jclouds.logging.log4j.config.Log4JLoggingModule;
 import org.jclouds.netty.config.NettyPayloadModule;
 import org.json.simple.JSONObject;
 import org.json.simple.parser.JSONParser;
-import org.junit.BeforeClass;
+import org.junit.Before;
 import org.junit.ClassRule;
 import org.junit.Ignore;
 import org.junit.Rule;
@@ -43,6 +43,7 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import org.apache.usergrid.NewOrgAppAdminRule;
 import org.apache.usergrid.ServiceITSetup;
 import org.apache.usergrid.ServiceITSetupImpl;
 import org.apache.usergrid.batch.JobExecution;
@@ -65,6 +66,7 @@ import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
 import com.google.common.collect.ImmutableSet;
 import com.google.inject.Module;
 
+import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -88,24 +90,33 @@ public class ExportServiceIT {
     @ClassRule
     public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
 
-    // app-level data generated only once
-    private static UserInfo adminUser;
-    private static OrganizationInfo organization;
-    private static UUID applicationId;
+
+    @ClassRule
+    public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
 
     @Rule
     public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
 
-    @ClassRule
-    public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
+
+    @Rule
+    public NewOrgAppAdminRule orgAppAdminRule = new NewOrgAppAdminRule( setup );
 
 
-    @BeforeClass
-    public static void setup() throws Exception {
+    // app-level data generated only once
+    private UserInfo adminUser;
+    private OrganizationInfo organization;
+    private UUID applicationId;
+
+
+
+    @Before
+    public void setup() throws Exception {
         LOG.info( "in setup" );
-        adminUser = setup.getMgmtSvc().createAdminUser( "grey", "George Reyes", "george@reyes.com", "test", false, false );
-        organization = setup.getMgmtSvc().createOrganization( "george-organization", adminUser, true );
-        applicationId = setup.getMgmtSvc().createApplication( organization.getUuid(), "george-application" ).getId();
+
+
+        adminUser = orgAppAdminRule.getAdminInfo();
+        organization = orgAppAdminRule.getOrganizationInfo();
+        applicationId = orgAppAdminRule.getApplicationInfo().getId();
 
         setup.getEmf().refreshIndex();
     }
@@ -288,8 +299,9 @@ public class ExportServiceIT {
         catch ( Exception e ) {
             //consumed because this checks to see if the file exists. If it doesn't then don't do anything and carry on.
         }
-        setup.getMgmtSvc()
-             .createOwnerAndOrganization( "noExport", "junkUserName", "junkRealName", "ugExport@usergrid.com",
+
+        //create another org to ensure we don't export it
+        orgAppAdminRule.createOwnerAndOrganization( "noExport"+newUUIDString(), "junkUserName"+newUUIDString(), "junkRealName"+newUUIDString(), newUUIDString()+"ugExport@usergrid.com",
                      "123456789" );
 
         S3Export s3Export = new MockS3ExportImpl("exportOneOrg.json");
@@ -334,8 +346,8 @@ public class ExportServiceIT {
     public void testExportOneAppOnCollectionEndpoint() throws Exception {
 
         File f = null;
-        String orgName = "george-organization";
-        String appName = "testAppCollectionTestNotExported";
+        String orgName = "george-organization"+newUUIDString();
+        String appName = "testAppCollectionTestNotExported"+newUUIDString();
 
         try {
             f = new File( "exportOneApp.json" );
@@ -607,8 +619,8 @@ public class ExportServiceIT {
         OrganizationInfo orgMade = null;
         ApplicationInfo appMade = null;
         for ( int i = 0; i < 10; i++ ) {
-            orgMade = setup.getMgmtSvc().createOrganization( "superboss" + i, adminUser, true );
-            appMade = setup.getMgmtSvc().createApplication( orgMade.getUuid(), "superapp" + i );
+            orgMade = setup.getMgmtSvc().createOrganization( "superboss"+ newUUIDString() + i, adminUser, true );
+            appMade = setup.getMgmtSvc().createApplication( orgMade.getUuid(), "superapp" +newUUIDString() + i );
 
             EntityManager customMaker = setup.getEmf().getEntityManager( appMade.getId() );
             customMaker.createApplicationCollection( "superappCol" + i );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cfff0cce/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java b/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java
new file mode 100644
index 0000000..dffe826
--- /dev/null
+++ b/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+
+import org.apache.usergrid.persistence.model.util.UUIDGenerator;
+
+
+/**
+ * Simple class to manipulate UUIDs into strings for unique strings when testing
+ */
+public class UUIDTestHelper {
+
+    /**
+     * Generate a new UUID, and remove all the '-' characters from the resulting string.
+     * @return
+     */
+    public static String newUUIDString() {
+        return UUIDGenerator.newTimeUUID().toString().replace( "-", "" );
+    }
+}