usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject [4/8] git commit: Fix to ES refresh index logic fixes one of the MUUserResourceIT tests (USERGRID-209).
Date Thu, 21 Aug 2014 03:31:22 GMT
Fix to ES refresh index logic fixes one of the MUUserResourceIT tests (USERGRID-209).


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

Branch: refs/heads/two-dot-o-push-notifications
Commit: 648becf6a1e89e061f7fd14a3ae45ad0333315fa
Parents: 25fbf0d
Author: Dave Johnson <dmjohnson@apigee.com>
Authored: Wed Aug 20 10:31:32 2014 -0400
Committer: Dave Johnson <dmjohnson@apigee.com>
Committed: Wed Aug 20 10:31:32 2014 -0400

----------------------------------------------------------------------
 .../corepersistence/CpEntityManager.java        |  7 +++---
 .../corepersistence/CpEntityManagerFactory.java | 19 ++++++++++++++--
 .../rest/management/users/MUUserResourceIT.java | 24 ++++++++++++--------
 3 files changed, 34 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/648becf6/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
index 7795550..b216294 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
@@ -2789,14 +2789,13 @@ public class CpEntityManager implements EntityManager {
     @Override
     public void refreshIndex() {
 
-        // refresh system indexes 
+        // refresh factory indexes
         emf.refreshIndex();
 
         // refresh this Entity Manager's application's index
         IndexScope indexScope = new IndexScopeImpl( 
-                appScope.getApplication(), 
-                appScope.getApplication(), 
-                "dummy" );
+                appScope.getApplication(), appScope.getApplication(), "dummy" );
+
         EntityIndex ei = managerCache.getEntityIndex( indexScope );
         ei.refresh();
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/648becf6/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 502d08c..2863842 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
@@ -537,9 +537,24 @@ public class CpEntityManagerFactory implements EntityManagerFactory,
Application
 
 
     public void refreshIndex() {
+
+        // refresh factory's indexes, will refresh all three index scopes
         managerCache.getEntityIndex( CpEntityManagerFactory.SYSTEM_APPS_INDEX_SCOPE ).refresh();
-        managerCache.getEntityIndex( CpEntityManagerFactory.SYSTEM_ORGS_INDEX_SCOPE ).refresh();
-        managerCache.getEntityIndex( CpEntityManagerFactory.SYSTEM_PROPS_INDEX_SCOPE ).refresh();
+
+        // these are unecessary because of above call
+        //managerCache.getEntityIndex( CpEntityManagerFactory.SYSTEM_ORGS_INDEX_SCOPE ).refresh();
+        //managerCache.getEntityIndex( CpEntityManagerFactory.SYSTEM_PROPS_INDEX_SCOPE ).refresh();
+
+        // refresh special indexes without calling EntityManager refresh because stack overflow

+        IndexScope mscope = new IndexScopeImpl( 
+                new SimpleId( getManagementAppId(), "application"), 
+                new SimpleId( getManagementAppId(), "application"), "dummy");
+        managerCache.getEntityIndex( mscope ).refresh();
+
+        IndexScope dscope = new IndexScopeImpl( 
+                new SimpleId( getDefaultAppId(), "application"), 
+                new SimpleId( getDefaultAppId(), "application"), "dummy");
+        managerCache.getEntityIndex( dscope ).refresh();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/648becf6/stack/rest/src/test/java/org/apache/usergrid/rest/management/users/MUUserResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/users/MUUserResourceIT.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/management/users/MUUserResourceIT.java
index bcf3b51..928e50f 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/users/MUUserResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/users/MUUserResourceIT.java
@@ -112,7 +112,7 @@ public class MUUserResourceIT extends AbstractRestIT {
 
 
     @Test
-    @Ignore // Because JSP is broken in test setup, possibly due to JSTL classloader issue
+    //@Ignore // Because JSP is broken in test setup, possibly due to JSTL classloader issue
     // see also: https://issues.apache.org/jira/browse/USERGRID-209 
     public void testUnconfirmedAdminLogin() throws Exception {
 
@@ -140,8 +140,8 @@ public class MUUserResourceIT extends AbstractRestIT {
             String passwd = "testpassword";
             OrganizationOwnerInfo orgOwner;
 
-            orgOwner = setup.getMgmtSvc()
-                            .createOwnerAndOrganization( orgName, userName, appName, email,
passwd, false, false );
+            orgOwner = setup.getMgmtSvc().createOwnerAndOrganization( 
+                    orgName, userName, appName, email, passwd, false, false );
             assertNotNull( orgOwner );
             String returnedUsername = orgOwner.getOwner().getUsername();
             assertEquals( userName, returnedUsername );
@@ -155,8 +155,10 @@ public class MUUserResourceIT extends AbstractRestIT {
             // -------------------------------------------
             JsonNode node;
             try {
-                node = mapper.readTree( resource().path( "/management/token" ).queryParam(
"grant_type", "password" )
-                        .queryParam( "username", userName ).queryParam( "password", passwd
)
+                node = mapper.readTree( resource().path( "/management/token" )
+                        .queryParam( "grant_type", "password" )
+                        .queryParam( "username", userName )
+                        .queryParam( "password", passwd )
                         .accept( MediaType.APPLICATION_JSON ).get( String.class ));
 
                 fail( "Unconfirmed users should not be authorized to authenticate." );
@@ -185,8 +187,8 @@ public class MUUserResourceIT extends AbstractRestIT {
             String token = getTokenFromMessage( confirmation );
             LOG.info( token );
 
-            ActivationState state =
-                    setup.getMgmtSvc().handleConfirmationTokenForAdminUser( orgOwner.getOwner().getUuid(),
token );
+            ActivationState state = setup.getMgmtSvc().handleConfirmationTokenForAdminUser(

+                    orgOwner.getOwner().getUuid(), token );
             assertEquals( ActivationState.ACTIVATED, state );
 
             Message activation = inbox.get( 1 );
@@ -195,13 +197,15 @@ public class MUUserResourceIT extends AbstractRestIT {
             client = new MockImapClient( "mockserver.com", "test-user-46", "somepassword"
);
             client.processMail();
 
-        refreshIndex(context.getOrgName(), context.getAppName());
+            refreshIndex(orgName, appName);
 
             // Attempt to authenticate again but this time should pass
             // -------------------------------------------
 
-            node = mapper.readTree( resource().path( "/management/token" ).queryParam( "grant_type",
"password" )
-                    .queryParam( "username", userName ).queryParam( "password", passwd )
+            node = mapper.readTree( resource().path( "/management/token" )
+                    .queryParam( "grant_type", "password" )
+                    .queryParam( "username", userName )
+                    .queryParam( "password", passwd )
                     .accept( MediaType.APPLICATION_JSON ).get( String.class ));
 
             assertNotNull( node );


Mime
View raw message