You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2015/03/30 21:58:25 UTC

[21/50] incubator-usergrid git commit: Use emf.getManagementAppId() everywhere possible instead of static from CpNamingUtils.

Use emf.getManagementAppId() everywhere possible instead of static from CpNamingUtils.


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

Branch: refs/heads/two-dot-o-dev
Commit: 50cb3bf5eb28a20e5224555402bd901ce81841b9
Parents: 01d22ec
Author: Dave Johnson <dm...@apigee.com>
Authored: Fri Mar 13 08:34:20 2015 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Fri Mar 13 08:34:20 2015 -0400

----------------------------------------------------------------------
 .../corepersistence/ApplicationIdCacheImpl.java |  2 +-
 .../corepersistence/CpEntityManagerFactory.java | 32 ++++++++++----------
 .../cassandra/ManagementServiceImpl.java        |  2 +-
 .../management/importer/FileImportJob.java      |  4 +--
 .../management/importer/FileImportTracker.java  |  6 ++--
 .../usergrid/management/importer/ImportJob.java |  4 +--
 .../management/importer/ImportServiceImpl.java  | 16 +++++-----
 .../importer/FileImportTrackerTest.java         | 12 ++++----
 .../importer/ImportConnectionsTest.java         |  7 ++---
 9 files changed, 42 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/50cb3bf5/stack/core/src/main/java/org/apache/usergrid/corepersistence/ApplicationIdCacheImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/ApplicationIdCacheImpl.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/ApplicationIdCacheImpl.java
index b03f422..379f306 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/ApplicationIdCacheImpl.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/ApplicationIdCacheImpl.java
@@ -59,7 +59,7 @@ public class ApplicationIdCacheImpl implements ApplicationIdCache {
 
 
     public ApplicationIdCacheImpl(final EntityManagerFactory emf) {
-        this.rootEm = emf.getEntityManager( CpNamingUtils.MANAGEMENT_APPLICATION_ID);
+        this.rootEm = emf.getEntityManager( emf.getManagementAppId());
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/50cb3bf5/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
index 8e432e8..36bbd12 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
@@ -124,14 +124,14 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
 
     private void init() {
 
-        EntityManager em = getEntityManager( CpNamingUtils.MANAGEMENT_APPLICATION_ID);
+        EntityManager em = getEntityManager(getManagementAppId());
 
         try {
             if ( em.getApplication() == null ) {
                 logger.info("Creating management application");
                 Map mgmtAppProps = new HashMap<String, Object>();
                 mgmtAppProps.put(PROPERTY_NAME, "systemapp");
-                em.create(CpNamingUtils.MANAGEMENT_APPLICATION_ID, TYPE_APPLICATION, mgmtAppProps);
+                em.create( getManagementAppId(), TYPE_APPLICATION, mgmtAppProps);
                 em.getApplication();
                 em.createIndex();
                 em.refreshIndex();
@@ -222,7 +222,7 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
     public Entity initializeApplicationV2( String organizationName, final UUID applicationId, String name,
                                        Map<String, Object> properties ) throws Exception {
 
-        EntityManager em = getEntityManager( CpNamingUtils.MANAGEMENT_APPLICATION_ID);
+        EntityManager em = getEntityManager(getManagementAppId());
 
         final String appName = buildAppName( organizationName, name );
 
@@ -294,7 +294,7 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
         // ensure that there is not already a deleted app with the same name
 
         final EntityRef alias = em.getAlias(
-            CpNamingUtils.DELETED_APPLICATION_INFO, appInfoToDelete.getName() );
+            CpNamingUtils.DELETED_APPLICATION_INFO, appInfoToDelete.getName());
         if ( alias != null ) {
             throw new ConflictException("Cannot delete app with same name as already deleted app");
         }
@@ -368,7 +368,7 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
         this.rebuildApplicationIndexes(applicationId, new ProgressObserver() {
             @Override
             public void onProgress(EntityRef entity) {
-            logger.info( "Restored entity {}:{}", entity.getType(), entity.getUuid() );
+                logger.info("Restored entity {}:{}", entity.getType(), entity.getUuid());
             }
         });
 
@@ -386,7 +386,7 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
 
 
     public UUID lookupApplication( String orgAppName ) throws Exception {
-        return applicationIdCache.getApplicationId( orgAppName );
+        return applicationIdCache.getApplicationId(orgAppName);
     }
 
 
@@ -409,10 +409,10 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
 
         Map<String, UUID> appMap = new HashMap<String, UUID>();
 
-        ApplicationScope appScope = CpNamingUtils.getApplicationScope( CpNamingUtils.MANAGEMENT_APPLICATION_ID );
+        ApplicationScope appScope = CpNamingUtils.getApplicationScope(getManagementAppId());
         GraphManager gm = managerCache.getGraphManager(appScope);
 
-        EntityManager em = getEntityManager( CpNamingUtils.MANAGEMENT_APPLICATION_ID);
+        EntityManager em = getEntityManager(getManagementAppId());
         Application app = em.getApplication();
         Id fromEntityId = new SimpleId( app.getUuid(), app.getType() );
 
@@ -477,7 +477,7 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
 
         Map<String, String> props = new HashMap<String,String>();
 
-        EntityManager em = getEntityManager(CpNamingUtils.MANAGEMENT_APPLICATION_ID);
+        EntityManager em = getEntityManager(getManagementAppId());
         Query q = Query.fromQL("select *");
         Results results = null;
         try {
@@ -502,7 +502,7 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
     @Override
     public boolean updateServiceProperties(Map<String, String> properties) {
 
-        EntityManager em = getEntityManager( CpNamingUtils.MANAGEMENT_APPLICATION_ID);
+        EntityManager em = getEntityManager(getManagementAppId());
         Query q = Query.fromQL("select *");
         Results results = null;
         try {
@@ -551,7 +551,7 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
     @Override
     public boolean deleteServiceProperty(String name) {
 
-        EntityManager em = getEntityManager( CpNamingUtils.MANAGEMENT_APPLICATION_ID);
+        EntityManager em = getEntityManager(getManagementAppId());
 
 
         Query q = Query.fromQL("select *");
@@ -684,7 +684,7 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
 
     @Override
     public void rebuildInternalIndexes( ProgressObserver po ) throws Exception {
-        rebuildApplicationIndexes( CpNamingUtils.MANAGEMENT_APPLICATION_ID, po );
+        rebuildApplicationIndexes( getManagementAppId(), po );
     }
 
 
@@ -699,7 +699,7 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
 
         em.reindex( po );
 
-        logger.info("\n\nRebuilt index for applicationId {} \n", appId );
+        logger.info("\n\nRebuilt index for applicationId {} \n", appId);
     }
 
 
@@ -731,7 +731,7 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
         em.reindexCollection( po, collectionName, reverse );
 
         logger.info("\n\nRebuilt index for application {} id {} collection {}\n",
-            new Object[] { app.getName(), appId, collectionName } );
+            new Object[]{app.getName(), appId, collectionName});
     }
 
     @Override
@@ -746,8 +746,8 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
         // could use any collection scope here, does not matter
         EntityCollectionManager ecm = getManagerCache().getEntityCollectionManager(
             new CollectionScopeImpl(
-                new SimpleId( CpNamingUtils.MANAGEMENT_APPLICATION_ID, "application"),
-                new SimpleId( CpNamingUtils.MANAGEMENT_APPLICATION_ID, "application"),
+                new SimpleId( getManagementAppId(), "application"),
+                new SimpleId( getManagementAppId(), "application"),
                 "dummy"
         ));
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/50cb3bf5/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java b/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
index 2874ffc..ab70810 100644
--- a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
+++ b/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
@@ -1662,7 +1662,7 @@ public class ManagementServiceImpl implements ManagementService {
 
         // restore application_info entity
 
-        EntityManager em = emf.getEntityManager( CpNamingUtils.MANAGEMENT_APPLICATION_ID );
+        EntityManager em = emf.getEntityManager( emf.getManagementAppId() );
         Entity appInfo = emf.restoreApplication(applicationId);
 
         // restore token

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/50cb3bf5/stack/services/src/main/java/org/apache/usergrid/management/importer/FileImportJob.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/management/importer/FileImportJob.java b/stack/services/src/main/java/org/apache/usergrid/management/importer/FileImportJob.java
index bdfcb61..264c752 100644
--- a/stack/services/src/main/java/org/apache/usergrid/management/importer/FileImportJob.java
+++ b/stack/services/src/main/java/org/apache/usergrid/management/importer/FileImportJob.java
@@ -74,7 +74,7 @@ public class FileImportJob extends OnlyOnceJob {
 
             // update file import record
             UUID fileImportId = (UUID) jobExecution.getJobData().getProperty(FILE_IMPORT_ID);
-            EntityManager em = emf.getEntityManager(CpNamingUtils.MANAGEMENT_APPLICATION_ID);
+            EntityManager em = emf.getEntityManager(emf.getManagementAppId());
             FileImport fileImport = em.get(fileImportId, FileImport.class);
             fileImport.setState( FileImport.State.FAILED );
             em.update( fileImport );
@@ -103,7 +103,7 @@ public class FileImportJob extends OnlyOnceJob {
     public void dead( final JobExecution execution ) throws Exception {
 
         // Get the root entity manager
-        EntityManager rootEm = emf.getEntityManager( CpNamingUtils.MANAGEMENT_APPLICATION_ID);
+        EntityManager rootEm = emf.getEntityManager( emf.getManagementAppId() );
 
         // Mark the sub-job i.e. File Import Job as Failed
         FileImport fileImport = null;//importService.getFileImportEntity(execution);

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/50cb3bf5/stack/services/src/main/java/org/apache/usergrid/management/importer/FileImportTracker.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/management/importer/FileImportTracker.java b/stack/services/src/main/java/org/apache/usergrid/management/importer/FileImportTracker.java
index 62c01dc..e1170c3 100644
--- a/stack/services/src/main/java/org/apache/usergrid/management/importer/FileImportTracker.java
+++ b/stack/services/src/main/java/org/apache/usergrid/management/importer/FileImportTracker.java
@@ -105,7 +105,7 @@ public class FileImportTracker {
         failedImportEntity.setErrorMessage( message );
 
         try {
-            EntityManager entityManager = emf.getEntityManager(CpNamingUtils.MANAGEMENT_APPLICATION_ID);
+            EntityManager entityManager = emf.getEntityManager(emf.getManagementAppId());
             failedImportEntity = entityManager.create( failedImportEntity );
             entityManager.createConnection( fileImport, ERRORS_CONNECTION_NAME, failedImportEntity );
         }
@@ -136,7 +136,7 @@ public class FileImportTracker {
         failedImportConnection.setErrorMessage( message );
 
         try {
-            EntityManager entityManager = emf.getEntityManager(CpNamingUtils.MANAGEMENT_APPLICATION_ID);
+            EntityManager entityManager = emf.getEntityManager(emf.getManagementAppId());
             failedImportConnection = entityManager.create( failedImportConnection );
             entityManager.createConnection( fileImport, ERRORS_CONNECTION_NAME, failedImportConnection );
         }
@@ -309,7 +309,7 @@ public class FileImportTracker {
             fileImport.setState( state );
             fileImport.setErrorMessage( message );
 
-            EntityManager entityManager = emf.getEntityManager(CpNamingUtils.MANAGEMENT_APPLICATION_ID);
+            EntityManager entityManager = emf.getEntityManager(emf.getManagementAppId());
             entityManager.update( fileImport );
         }
         catch ( Exception e ) {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/50cb3bf5/stack/services/src/main/java/org/apache/usergrid/management/importer/ImportJob.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/management/importer/ImportJob.java b/stack/services/src/main/java/org/apache/usergrid/management/importer/ImportJob.java
index 995850c..4640681 100644
--- a/stack/services/src/main/java/org/apache/usergrid/management/importer/ImportJob.java
+++ b/stack/services/src/main/java/org/apache/usergrid/management/importer/ImportJob.java
@@ -73,7 +73,7 @@ public class ImportJob extends OnlyOnceJob {
 
             // update import job record
             UUID importId = (UUID) jobExecution.getJobData().getProperty(IMPORT_ID);
-            EntityManager mgmtApp = emf.getEntityManager(CpNamingUtils.MANAGEMENT_APPLICATION_ID);
+            EntityManager mgmtApp = emf.getEntityManager(emf.getManagementAppId());
             Import importEntity = mgmtApp.get(importId, Import.class);
             importEntity.setState(Import.State.FAILED);
             importEntity.setErrorMessage(t.getMessage());
@@ -104,7 +104,7 @@ public class ImportJob extends OnlyOnceJob {
     public void dead( final JobExecution execution ) throws Exception {
 
         // marks the job as failed as it will not be retried by the scheduler.
-        EntityManager rootEm = emf.getEntityManager( CpNamingUtils.MANAGEMENT_APPLICATION_ID);
+        EntityManager rootEm = emf.getEntityManager( emf.getManagementAppId());
         Import importUG = importService.getImportEntity(execution);
         importUG.setErrorMessage("The Job has been tried maximum times but still failed");
         importUG.setState(Import.State.FAILED);

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/50cb3bf5/stack/services/src/main/java/org/apache/usergrid/management/importer/ImportServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/management/importer/ImportServiceImpl.java b/stack/services/src/main/java/org/apache/usergrid/management/importer/ImportServiceImpl.java
index 120e76e..3c30b39 100644
--- a/stack/services/src/main/java/org/apache/usergrid/management/importer/ImportServiceImpl.java
+++ b/stack/services/src/main/java/org/apache/usergrid/management/importer/ImportServiceImpl.java
@@ -325,7 +325,7 @@ public class ImportServiceImpl implements ImportService {
         EntityManager rootEM;
 
         try {
-            rootEM = emf.getEntityManager(CpNamingUtils.MANAGEMENT_APPLICATION_ID);
+            rootEM = emf.getEntityManager(emf.getManagementAppId());
         } catch (Exception e) {
             logger.error("application doesn't exist within the current context");
             return null;
@@ -375,7 +375,7 @@ public class ImportServiceImpl implements ImportService {
 
         try {
 
-            EntityManager rootEM = emf.getEntityManager( CpNamingUtils.MANAGEMENT_APPLICATION_ID );
+            EntityManager rootEM = emf.getEntityManager( emf.getManagementAppId() );
             Query query = Query.fromQL( "select *" );
             query.setEntityType("file_import");
             query.setConnectionType( IMPORT_FILE_INCLUDES_CONNECTION );
@@ -424,7 +424,7 @@ public class ImportServiceImpl implements ImportService {
 
         Preconditions.checkNotNull( uuid, "uuid cannot be null" );
 
-        EntityManager rootEm = emf.getEntityManager(CpNamingUtils.MANAGEMENT_APPLICATION_ID);
+        EntityManager rootEm = emf.getEntityManager(emf.getManagementAppId());
 
         //retrieve the import entity.
         Import importUG = rootEm.get(uuid, Import.class);
@@ -450,7 +450,7 @@ public class ImportServiceImpl implements ImportService {
             return "UUID passed in cannot be null";
         }
 
-        EntityManager rootEm = emf.getEntityManager(CpNamingUtils.MANAGEMENT_APPLICATION_ID);
+        EntityManager rootEm = emf.getEntityManager(emf.getManagementAppId());
 
         //retrieve the import entity.
         Import importUG = rootEm.get(uuid, Import.class);
@@ -473,7 +473,7 @@ public class ImportServiceImpl implements ImportService {
     public Import getImportEntity(final JobExecution jobExecution) throws Exception {
 
         UUID importId = (UUID) jobExecution.getJobData().getProperty(IMPORT_ID);
-        EntityManager importManager = emf.getEntityManager(CpNamingUtils.MANAGEMENT_APPLICATION_ID);
+        EntityManager importManager = emf.getEntityManager(emf.getManagementAppId());
 
         return importManager.get(importId, Import.class);
     }
@@ -486,7 +486,7 @@ public class ImportServiceImpl implements ImportService {
     @Override
     public FileImport getFileImportEntity(final JobExecution jobExecution) throws Exception {
         UUID fileImportId = (UUID) jobExecution.getJobData().getProperty(FILE_IMPORT_ID);
-        EntityManager em = emf.getEntityManager(CpNamingUtils.MANAGEMENT_APPLICATION_ID);
+        EntityManager em = emf.getEntityManager(emf.getManagementAppId());
         return em.get(fileImportId, FileImport.class);
     }
 
@@ -545,7 +545,7 @@ public class ImportServiceImpl implements ImportService {
 
         // get Import Entity from the management app, update it to show that job has started
 
-        final EntityManager rootEM = emf.getEntityManager(CpNamingUtils.MANAGEMENT_APPLICATION_ID);
+        final EntityManager rootEM = emf.getEntityManager(emf.getManagementAppId());
         UUID importId = (UUID) jobExecution.getJobData().getProperty(IMPORT_ID);
         Import importEntity = rootEM.get(importId, Import.class);
 
@@ -679,7 +679,7 @@ public class ImportServiceImpl implements ImportService {
         String accessId = (String) storage_info.get( "s3_access_id");
         String secretKey = (String) storage_info.get( "s3_key" );
 
-        EntityManager rootEM = emf.getEntityManager( CpNamingUtils.MANAGEMENT_APPLICATION_ID );
+        EntityManager rootEM = emf.getEntityManager( emf.getManagementAppId() );
 
        // get the file import entity
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/50cb3bf5/stack/services/src/test/java/org/apache/usergrid/management/importer/FileImportTrackerTest.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/importer/FileImportTrackerTest.java b/stack/services/src/test/java/org/apache/usergrid/management/importer/FileImportTrackerTest.java
index 158f3b8..fab62ca 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/importer/FileImportTrackerTest.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/importer/FileImportTrackerTest.java
@@ -58,7 +58,7 @@ public class FileImportTrackerTest {
 
         final EntityManagerFactory emf = mock( EntityManagerFactory.class );
         final EntityManager em = mock( EntityManager.class );
-        when( emf.getEntityManager( CpNamingUtils.MANAGEMENT_APPLICATION_ID ) ).thenReturn( em );
+        when( emf.getEntityManager( emf.getManagementAppId() ) ).thenReturn( em );
 
         final UUID importFileId = UUIDGenerator.newTimeUUID();
 
@@ -101,7 +101,7 @@ public class FileImportTrackerTest {
 
         final EntityManagerFactory emf = mock( EntityManagerFactory.class );
         final EntityManager em = mock( EntityManager.class );
-        when( emf.getEntityManager( CpNamingUtils.MANAGEMENT_APPLICATION_ID ) ).thenReturn( em );
+        when( emf.getEntityManager( emf.getManagementAppId() ) ).thenReturn( em );
 
         // create tracker and call its entityWritten() and entityFailed() methods some number of times
 
@@ -171,7 +171,7 @@ public class FileImportTrackerTest {
 
         final EntityManagerFactory emf = mock( EntityManagerFactory.class );
         final EntityManager em = mock( EntityManager.class );
-        when( emf.getEntityManager( CpNamingUtils.MANAGEMENT_APPLICATION_ID ) ).thenReturn( em );
+        when( emf.getEntityManager( emf.getManagementAppId() ) ).thenReturn( em );
 
         final UUID importFileId = UUIDGenerator.newTimeUUID();
 
@@ -218,7 +218,7 @@ public class FileImportTrackerTest {
 
         final EntityManagerFactory emf = mock( EntityManagerFactory.class );
         final EntityManager em = mock( EntityManager.class );
-        when( emf.getEntityManager( CpNamingUtils.MANAGEMENT_APPLICATION_ID ) ).thenReturn( em );
+        when( emf.getEntityManager( emf.getManagementAppId() ) ).thenReturn( em );
 
         final UUID importFileId = UUIDGenerator.newTimeUUID();
 
@@ -333,7 +333,7 @@ public class FileImportTrackerTest {
 
         final EntityManagerFactory emf = mock( EntityManagerFactory.class );
         final EntityManager em = mock( EntityManager.class );
-        when( emf.getEntityManager( CpNamingUtils.MANAGEMENT_APPLICATION_ID ) ).thenReturn( em );
+        when( emf.getEntityManager( emf.getManagementAppId() ) ).thenReturn( em );
 
         final UUID importFileId = UUIDGenerator.newTimeUUID();
 
@@ -368,7 +368,7 @@ public class FileImportTrackerTest {
 
         final EntityManagerFactory emf = mock( EntityManagerFactory.class );
         final EntityManager em = mock( EntityManager.class );
-        when( emf.getEntityManager( CpNamingUtils.MANAGEMENT_APPLICATION_ID ) ).thenReturn( em );
+        when( emf.getEntityManager( emf.getManagementAppId() ) ).thenReturn( em );
 
         final UUID importFileId = UUIDGenerator.newTimeUUID();
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/50cb3bf5/stack/services/src/test/java/org/apache/usergrid/management/importer/ImportConnectionsTest.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/importer/ImportConnectionsTest.java b/stack/services/src/test/java/org/apache/usergrid/management/importer/ImportConnectionsTest.java
index 192e784..5e6651c 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/importer/ImportConnectionsTest.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/importer/ImportConnectionsTest.java
@@ -93,8 +93,7 @@ public class ImportConnectionsTest {
 
         final int connectionCount = 15;
 
-        EntityManager emMgmtApp = setup.getEmf()
-            .getEntityManager(CpNamingUtils.MANAGEMENT_APPLICATION_ID);
+        EntityManager emMgmtApp = setup.getEmf().getEntityManager(setup.getEmf().getManagementAppId());
 
         Import importEntity = new Import();
         importEntity = emMgmtApp.create( importEntity );
@@ -134,7 +133,7 @@ public class ImportConnectionsTest {
 
         try {
             EntityManager emMgmtApp = setup.getEmf()
-                .getEntityManager(CpNamingUtils.MANAGEMENT_APPLICATION_ID );
+                .getEntityManager(setup.getEmf().getManagementAppId() );
 
             Results entities = emMgmtApp.getConnectedEntities(
                 importRoot, "includes", null, Query.Level.ALL_PROPERTIES );
@@ -158,7 +157,7 @@ public class ImportConnectionsTest {
 
         try {
             EntityManager emMgmtApp = setup.getEmf()
-                .getEntityManager(CpNamingUtils.MANAGEMENT_APPLICATION_ID );
+                .getEntityManager(setup.getEmf().getManagementAppId() );
 
             Query query = Query.fromQL("select *");
             query.setEntityType("file_import");