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

[06/29] incubator-usergrid git commit: change app creation to create index

change app creation to create index


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

Branch: refs/heads/USERGRID-405
Commit: 65c20a119250cbf3586a286c9a3d79af42cd4b52
Parents: 89f2c2f
Author: Shawn Feldman <sf...@apache.org>
Authored: Wed Mar 18 16:38:16 2015 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Wed Mar 18 16:38:16 2015 -0600

----------------------------------------------------------------------
 .../corepersistence/CpEntityManagerFactory.java         | 12 +++++++-----
 .../test/java/org/apache/usergrid/CoreITSetupImpl.java  |  1 +
 2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/65c20a11/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 2bdb54c..41bcf62 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
@@ -141,16 +141,18 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
         EntityManager em = getEntityManager( CpNamingUtils.SYSTEM_APP_ID);
 
         try {
-            if ( em.getApplication() == null ) {
+            if (em.getApplication() == null) {
                 logger.info("Creating system application");
                 Map sysAppProps = new HashMap<String, Object>();
                 sysAppProps.put(PROPERTY_NAME, "systemapp");
                 em.create(CpNamingUtils.SYSTEM_APP_ID, TYPE_APPLICATION, sysAppProps);
                 em.getApplication();
-                em.createIndex();
-                em.refreshIndex();
             }
 
+            em.createIndex();
+            em.refreshIndex();
+
+
         } catch (Exception ex) {
             throw new RuntimeException("Fatal error creating system application", ex);
         }
@@ -289,9 +291,9 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
             properties = new TreeMap<String, Object>( CASE_INSENSITIVE_ORDER );
         }
         properties.put( PROPERTY_NAME, appName );
-        EntityManager appEm = getEntityManager( applicationId );
+        EntityManager appEm = getEntityManager( applicationId);
 
-        appEm.create( applicationId, TYPE_APPLICATION, properties );
+        appEm.create(applicationId, TYPE_APPLICATION, properties );
         appEm.resetRoles();
         appEm.refreshIndex();
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/65c20a11/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java b/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java
index d403a1e..d4e69bc 100644
--- a/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java
+++ b/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java
@@ -130,6 +130,7 @@ public class CoreITSetupImpl implements CoreITSetup {
     @Override
     public UUID createApplication( String organizationName, String applicationName ) throws Exception {
 
+        emf.setup();
         if ( USE_DEFAULT_APPLICATION ) {
             return emf.getDefaultAppId();
         }