usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [42/50] [abbrv] incubator-usergrid git commit: Fixes EmailFlowIT and creates utilities for testing.
Date Fri, 12 Dec 2014 14:30:41 GMT
Fixes EmailFlowIT and creates utilities for testing.


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

Branch: refs/heads/no-source-in-es
Commit: bb05616aafd3023b096dd929a120d02e782f3124
Parents: f0a9870
Author: Todd Nine <tnine@apigee.com>
Authored: Wed Dec 10 16:14:28 2014 -0700
Committer: Todd Nine <tnine@apigee.com>
Committed: Wed Dec 10 16:20:52 2014 -0700

----------------------------------------------------------------------
 .../org/apache/usergrid/NewOrgAppAdminRule.java |   3 +-
 .../apache/usergrid/management/EmailFlowIT.java | 109 +++++++++++++------
 .../cassandra/ApplicationCreatorIT.java         |  23 ++--
 .../management/cassandra/ExportServiceIT.java   |  17 ++-
 .../cassandra/ManagementServiceIT.java          |  27 +++--
 .../java/org/apache/usergrid/TestHelper.java    |  75 +++++++++++++
 .../org/apache/usergrid/UUIDTestHelper.java     |  38 -------
 7 files changed, 189 insertions(+), 103 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/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
index 71a4740..ab7857e 100644
--- a/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java
+++ b/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java
@@ -32,9 +32,8 @@ 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;
+import static org.apache.usergrid.TestHelper.newUUIDString;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/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 719fd86..f831448 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
@@ -51,6 +51,11 @@ import org.apache.usergrid.persistence.entities.User;
 import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
 
 import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.apache.usergrid.TestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.uniqueApp;
+import static org.apache.usergrid.TestHelper.uniqueEmail;
+import static org.apache.usergrid.TestHelper.uniqueOrg;
+import static org.apache.usergrid.TestHelper.uniqueUsername;
 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;
@@ -87,8 +92,6 @@ import static org.junit.Assert.assertTrue;
  */
 public class EmailFlowIT {
     private static final Logger LOG = LoggerFactory.getLogger( EmailFlowIT.class );
-    private static final String ORGANIZATION_NAME = "email-test-org-1";
-    public static final String ORGANIZATION_NAME_2 = "email-test-org-2";
 
     @ClassRule
     public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts(
);
@@ -114,12 +117,17 @@ public class EmailFlowIT {
         setup.set( PROPERTIES_SYSADMIN_EMAIL, "sysadmin-1@mockserver.com" );
         setup.set( PROPERTIES_NOTIFY_ADMIN_OF_ACTIVATION, "true" );
 
+        final String orgName = uniqueOrg();
+        final String userName = uniqueUsername();
+        final String email = uniqueEmail();
+
         OrganizationOwnerInfo org_owner =
-                createOwnerAndOrganization( ORGANIZATION_NAME, "test-user-1", "Test User",
"test-user-1@mockserver.com",
-                        "testpassword", false, false );
+                createOwnerAndOrganization( orgName, userName, "Test User", email, "testpassword",
false, false );
+
+
         assertNotNull( org_owner );
 
-        List<Message> inbox = Mailbox.get( "test-user-1@mockserver.com" );
+        List<Message> inbox = Mailbox.get( email );
 
         assertFalse( inbox.isEmpty() );
 
@@ -127,7 +135,7 @@ public class EmailFlowIT {
         client.processMail();
 
         Message confirmation = inbox.get( 0 );
-        assertEquals( "User Account Confirmation: test-user-1@mockserver.com", confirmation.getSubject()
);
+        assertEquals( "User Account Confirmation: " + email, confirmation.getSubject() );
 
         String token = getTokenFromMessage( confirmation );
         LOG.info( token );
@@ -151,16 +159,23 @@ public class EmailFlowIT {
         setup.set( PROPERTIES_ADMIN_USERS_REQUIRE_CONFIRMATION, "true" );
         setup.set( PROPERTIES_SYSADMIN_EMAIL, "sysadmin-2@mockserver.com" );
 
-        OrganizationOwnerInfo org_owner = createOwnerAndOrganization( ORGANIZATION_NAME_2,
"test-user-2", "Test User",
-                "test-user-2@mockserver.com", "testpassword", false, false );
+        final String orgName = uniqueOrg();
+        final String userName = uniqueUsername();
+        final String email = uniqueEmail();
+
+        OrganizationOwnerInfo org_owner =
+                        createOwnerAndOrganization( orgName, userName, "Test User", email,
+                                "testpassword", false, false );
+
         assertNotNull( org_owner );
 
-        List<Message> user_inbox = Mailbox.get( "test-user-2@mockserver.com" );
+
+        List<Message> user_inbox = Mailbox.get( email );
 
         assertFalse( user_inbox.isEmpty() );
 
         Message confirmation = user_inbox.get( 0 );
-        assertEquals( "User Account Confirmation: test-user-2@mockserver.com", confirmation.getSubject()
);
+        assertEquals( "User Account Confirmation: "+email, confirmation.getSubject() );
 
         String token = getTokenFromMessage( confirmation );
         LOG.info( token );
@@ -181,7 +196,7 @@ public class EmailFlowIT {
         assertFalse( sysadmin_inbox.isEmpty() );
 
         Message activation = sysadmin_inbox.get( 0 );
-        assertEquals( "Request For Admin User Account Activation test-user-2@mockserver.com",
activation.getSubject() );
+        assertEquals( "Request For Admin User Account Activation "+email, activation.getSubject()
);
 
         token = getTokenFromMessage( activation );
         LOG.info( token );
@@ -204,10 +219,14 @@ public class EmailFlowIT {
         setup.set( PROPERTIES_SYSADMIN_APPROVES_ADMIN_USERS, "false" );
         setup.set( PROPERTIES_ADMIN_USERS_REQUIRE_CONFIRMATION, "false" );
 
+
+        final String orgName = uniqueOrg();
+        final String userName = uniqueUsername();
+        final String email = uniqueEmail();
+
         OrganizationOwnerInfo ooi = setup.getMgmtSvc()
-                                         .createOwnerAndOrganization( "org-skipallemailtest",
"user-skipallemailtest",
-                                                 "name-skipallemailtest", "nate+skipallemailtest@apigee.com",
-                                                 "password" );
+                                         .createOwnerAndOrganization(orgName, userName, "Test
User", email,
+                                                                         "testpassword");
 
         EntityManager em = setup.getEmf().getEntityManager( setup.getEmf().getManagementAppId()
);
         User user = em.get( ooi.getOwner().getUuid(), User.class );
@@ -234,23 +253,36 @@ public class EmailFlowIT {
     }
 
 
+    /**
+     * Tests that when a user is added to an app and activation on that app is required,
the org admin is emailed
+     * @throws Exception
+     *
+     * TODO, I'm not convinced this worked correctly.  IT can't find users collection in
the orgs.  Therefore,
+     * I think this is a legitimate bug that was just found from fixing the tests to be unique
admins orgs and emails
+     */
     @Test
     public void testAppUserActivationResetpwdMail() throws Exception {
-        String orgName = this.getClass().getName() + "1";
-        String appName = name.getMethodName();
-        String userName = "Test User";
-        String email = "test-user-4@mockserver.com";
-        String passwd = "testpassword";
-        OrganizationOwnerInfo orgOwner;
 
-        orgOwner = createOwnerAndOrganization( orgName, appName, userName, email, passwd,
false, false );
+        final String orgName = uniqueOrg();
+        final String appName = uniqueApp();
+        final String userName = uniqueUsername();
+        final String email = uniqueEmail();
+        final String passwd = "testpassword";
+
+        OrganizationOwnerInfo orgOwner = createOwnerAndOrganization( orgName, appName, userName,
email, passwd, false, false );
         assertNotNull( orgOwner );
 
         ApplicationInfo app = setup.getMgmtSvc().createApplication( orgOwner.getOrganization().getUuid(),
appName );
+
+        //turn on app admin approval for app users
         enableAdminApproval( app.getId() );
-        User user = setupAppUser( app.getId(), "testAppUserMailUrl", "testAppUserMailUrl@test.com",
false );
 
-        String subject = "Request For User Account Activation testAppUserMailUrl@test.com";
+        final String appUserUsername = uniqueUsername();
+        final String appUserEmail = uniqueEmail();
+
+        User user = setupAppUser( app.getId(), appUserUsername, appUserEmail, false );
+
+        String subject = "Request For User Account Activation " + email;
         String activation_url = String.format( setup.get( PROPERTIES_USER_ACTIVATION_URL
), orgName, appName,
                 user.getUuid().toString() );
 
@@ -261,7 +293,7 @@ public class EmailFlowIT {
 
         List<Message> inbox = Mailbox.get( email );
         assertFalse( inbox.isEmpty() );
-        MockImapClient client = new MockImapClient( "usergrid.com", "test", "somepassword"
);
+        MockImapClient client = new MockImapClient( "usergrid.com", userName, "somepassword"
);
         client.processMail();
 
         // subject ok
@@ -287,9 +319,9 @@ public class EmailFlowIT {
         // reset_pwd
         setup.getMgmtSvc().startAppUserPasswordResetFlow( app.getId(), user );
 
-        inbox = Mailbox.get( "testAppUserMailUrl@test.com" );
+        inbox = Mailbox.get( appUserEmail );
         assertFalse( inbox.isEmpty() );
-        client = new MockImapClient( "test.com", "testAppUserMailUrl", "somepassword" );
+        client = new MockImapClient( "test.com", appUserUsername, "somepassword" );
         client.processMail();
 
         // subject ok
@@ -315,11 +347,13 @@ public class EmailFlowIT {
     /** Tests to make sure a normal user must be activated by the admin after confirmation.
*/
     @Test
     public void testAppUserConfirmationMail() throws Exception {
-        String orgName = this.getClass().getName();
-        String appName = name.getMethodName();
-        String userName = "Test User";
-        String email = "test-user-45@mockserver.com";
-        String passwd = "testpassword";
+        final String orgName = uniqueOrg();
+        final String appName = uniqueApp();
+        final String userName = uniqueUsername();
+        final String email = uniqueEmail();
+        final String passwd = "testpassword";
+
+
         OrganizationOwnerInfo orgOwner;
 
         orgOwner = createOwnerAndOrganization( orgName, appName, userName, email, passwd,
false, false );
@@ -331,18 +365,23 @@ public class EmailFlowIT {
         assertNotNull( app );
         enableEmailConfirmation( app.getId() );
         enableAdminApproval( app.getId() );
-        User user = setupAppUser( app.getId(), "testAppUserConfMail", "testAppUserConfMail@test.com",
true );
 
-        String subject = "User Account Confirmation: testAppUserConfMail@test.com";
+
+        final String appUserEmail = uniqueEmail();
+        final String appUserUsername = uniqueUsername();
+
+        User user = setupAppUser( app.getId(), appUserUsername, appUserEmail, true );
+
+        String subject = "User Account Confirmation: "+appUserEmail;
         String urlProp = setup.get( PROPERTIES_USER_CONFIRMATION_URL );
         String confirmation_url = String.format( urlProp, orgName, appName, user.getUuid().toString()
);
 
         // request confirmation
         setup.getMgmtSvc().startAppUserActivationFlow( app.getId(), user );
 
-        List<Message> inbox = Mailbox.get( "testAppUserConfMail@test.com" );
+        List<Message> inbox = Mailbox.get( appUserEmail );
         assertFalse( inbox.isEmpty() );
-        MockImapClient client = new MockImapClient( "test.com", "testAppUserConfMail", "somepassword"
);
+        MockImapClient client = new MockImapClient( "test.com", appUserUsername, "somepassword"
);
         client.processMail();
 
         // subject ok

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/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 a3eaa08..0fbeb7d 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
@@ -22,8 +22,6 @@ 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;
@@ -34,7 +32,10 @@ import org.apache.usergrid.management.ApplicationInfo;
 import org.apache.usergrid.management.OrganizationOwnerInfo;
 import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
 
-import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.uniqueApp;
+import static org.apache.usergrid.TestHelper.uniqueEmail;
+import static org.apache.usergrid.TestHelper.uniqueOrg;
+import static org.apache.usergrid.TestHelper.uniqueUsername;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
@@ -59,13 +60,13 @@ public class ApplicationCreatorIT {
     @Test
     public void testCreateSampleApplication() throws Exception {
 
-        final String orgName = "appcreatortest" + newUUIDString();
-        final String appName = "nate-appcreatortest" + newUUIDString();
+        final String orgName = uniqueOrg();
+        final String appName = uniqueApp();
         final String expecteAppname = "sandbox";
         final String expectedName = orgName + "/" + expecteAppname;
 
-        OrganizationOwnerInfo orgOwner = setup.getMgmtSvc().createOwnerAndOrganization( orgName,
appName, "Nate",
-                "nate+appcreatortest" + newUUIDString() + "@apigee.com", "password", true,
false );
+        OrganizationOwnerInfo orgOwner = setup.getMgmtSvc().createOwnerAndOrganization( orgName,
appName, uniqueUsername(),
+                uniqueEmail(), "password", true, false );
 
         ApplicationInfo appInfo = setup.getAppCreator().createSampleFor( orgOwner.getOrganization()
);
         assertNotNull( appInfo );
@@ -80,13 +81,13 @@ public class ApplicationCreatorIT {
     @Test
     public void testCreateSampleApplicationAltName() throws Exception {
 
-        final String orgName = "appcreatortest" + newUUIDString();
-        final String appName = "nate-appcreatortest" + newUUIDString();
+        final String orgName = uniqueOrg();
+        final String appName = uniqueApp();
         final String sampleAppName =  "messagee" ;
         final String expectedName = orgName + "/" + sampleAppName;
 
-        OrganizationOwnerInfo orgOwner = setup.getMgmtSvc().createOwnerAndOrganization( orgName,
appName, "Nate",
-                "nate+appcreatortestcustom" + newUUIDString() + "@apigee.com", "password",
true, false );
+        OrganizationOwnerInfo orgOwner = setup.getMgmtSvc().createOwnerAndOrganization( orgName,
appName, uniqueUsername(),
+                uniqueEmail(), "password", true, false );
 
         ApplicationCreatorImpl customCreator = new ApplicationCreatorImpl( setup.getEmf(),
setup.getMgmtSvc() );
         customCreator.setSampleAppName(sampleAppName);

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/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 2c64836..53de224 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
@@ -66,7 +66,9 @@ 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.apache.usergrid.TestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.uniqueApp;
+import static org.apache.usergrid.TestHelper.uniqueOrg;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -345,9 +347,11 @@ public class ExportServiceIT {
     @Test
     public void testExportOneAppOnCollectionEndpoint() throws Exception {
 
+        final String orgName = uniqueOrg();
+        final String appName = uniqueApp();
+
+
         File f = null;
-        String orgName = "george-organization"+newUUIDString();
-        String appName = "testAppCollectionTestNotExported"+newUUIDString();
 
         try {
             f = new File( "exportOneApp.json" );
@@ -616,11 +620,14 @@ public class ExportServiceIT {
         HashMap<String, Object> payload = payloadBuilder();
 
         //creates 100s of organizations with some entities in each one to make sure we don't
actually apply it
+        final String uniqueOrg = uniqueOrg();
+        final String uniqueApp = uniqueApp();
+
         OrganizationInfo orgMade = null;
         ApplicationInfo appMade = null;
         for ( int i = 0; i < 10; i++ ) {
-            orgMade = setup.getMgmtSvc().createOrganization( "superboss"+ newUUIDString()
+ i, adminUser, true );
-            appMade = setup.getMgmtSvc().createApplication( orgMade.getUuid(), "superapp"
+newUUIDString() + i );
+            orgMade = setup.getMgmtSvc().createOrganization(uniqueOrg + i, adminUser, true
);
+            appMade = setup.getMgmtSvc().createApplication( orgMade.getUuid(), uniqueApp
+ i );
 
             EntityManager customMaker = setup.getEmf().getEntityManager( appMade.getId()
);
             customMaker.createApplicationCollection( "superappCol" + i );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/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 14a34b4..ddb2bbb 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
@@ -23,7 +23,6 @@ import java.util.Map;
 import java.util.UUID;
 
 import org.junit.Before;
-import org.junit.BeforeClass;
 import org.junit.ClassRule;
 import org.junit.Ignore;
 import org.junit.Rule;
@@ -54,7 +53,11 @@ 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.UUIDTestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.uniqueApp;
+import static org.apache.usergrid.TestHelper.uniqueEmail;
+import static org.apache.usergrid.TestHelper.uniqueOrg;
+import static org.apache.usergrid.TestHelper.uniqueUsername;
 import static org.apache.usergrid.persistence.Schema.DICTIONARY_CREDENTIALS;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -486,11 +489,11 @@ public class ManagementServiceIT {
     @Test
     public void authenticateAdmin() throws Exception {
 
-        String username = "tnine"+newUUIDString();
+        String username = uniqueUsername();
         String password = "test";
 
         UserInfo adminUser = setup.getMgmtSvc()
-                                  .createAdminUser( username, "Todd Nine", newUUIDString()
+ "@apigee.com", password,
+                                  .createAdminUser( username, "Todd Nine",uniqueEmail(),
password,
                                           false, false );
 
         EntityManager em = setup.getEmf().getEntityManager( setup.getSmf().getManagementAppId()
);
@@ -515,7 +518,7 @@ public class ManagementServiceIT {
      */
     @Test
     public void testAdminPasswordChangeShaType() throws Exception {
-        String username = "testAdminPasswordChangeShaType"+newUUIDString();
+        String username = uniqueUsername();
         String password = "test";
 
 
@@ -572,7 +575,7 @@ public class ManagementServiceIT {
      */
     @Test
     public void testAdminPasswordChangeMd5ShaType() throws Exception {
-        String username = "testAdminPasswordChangeMd5ShaType"+newUUIDString();
+        String username = uniqueUsername();
         String password = "test";
 
 
@@ -635,10 +638,10 @@ public class ManagementServiceIT {
     @Test
     public void authenticateUser() throws Exception {
 
-        String username = "tnine"+newUUIDString();
+        String username = uniqueUsername();
         String password = "test";
-        String orgName = "autneticateUser"+newUUIDString();
-        String appName = "authenticateUser"+newUUIDString();
+        String orgName = uniqueOrg();
+        String appName = uniqueApp();
 
         UUID appId = setup.getEmf().createApplication( orgName, appName );
 
@@ -738,10 +741,10 @@ public class ManagementServiceIT {
      */
     @Test
     public void testAppUserPasswordChangeMd5ShaType() throws Exception {
-        String username = "tnine"+newUUIDString();
+        String username = uniqueUsername();
         String password = "test";
-        String orgName = "testAppUserPasswordChangeMd5ShaType"+newUUIDString();
-        String appName = "testAppUserPasswordChangeMd5ShaType"+newUUIDString();
+        String orgName = uniqueOrg();
+        String appName = uniqueApp();
 
         UUID appId = setup.getEmf().createApplication( orgName, appName );
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/stack/test-utils/src/main/java/org/apache/usergrid/TestHelper.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/TestHelper.java b/stack/test-utils/src/main/java/org/apache/usergrid/TestHelper.java
new file mode 100644
index 0000000..cf476e2
--- /dev/null
+++ b/stack/test-utils/src/main/java/org/apache/usergrid/TestHelper.java
@@ -0,0 +1,75 @@
+/*
+ * 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 TestHelper {
+
+    /**
+     * Generate a unique name for an organization
+     * @return
+     */
+    public static String uniqueOrg(){
+        return "org" + newUUIDString();
+    }
+
+
+    /**
+     * Generate a unique name for an application
+     * @return
+     */
+    public static String uniqueApp(){
+        return "app" + newUUIDString();
+    }
+
+
+    /**
+     * Generate a unique username
+     * @return
+     */
+    public static String uniqueUsername(){
+        return "user" + newUUIDString();
+    }
+
+
+    /**
+     * Generate a unique email
+     * @return
+     */
+   public static String uniqueEmail(){
+       return "user" + newUUIDString() + "@apache.org";
+   }
+
+
+
+    /**
+     * Generate a new UUID, and remove all the '-' characters from the resulting string.
+     * @return
+     */
+    public static String newUUIDString() {
+        return UUIDGenerator.newTimeUUID().toString().replace( "-", "" );
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/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
deleted file mode 100644
index dffe826..0000000
--- a/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java
+++ /dev/null
@@ -1,38 +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.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( "-", "" );
-    }
-}


Mime
View raw message