usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toddn...@apache.org
Subject [01/14] incubator-usergrid git commit: 432: modify cores and add before shiro condition
Date Wed, 04 Mar 2015 17:25:10 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/two-dot-o ebf6e1322 -> 39c732b6a


432: modify cores and add before shiro condition

432: working with multithreaded builds

432: fix deleteasync


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

Branch: refs/heads/two-dot-o
Commit: 497ac057432227f9cb5642383df5cd8ea5c53b55
Parents: 80cd97e
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Fri Feb 27 10:59:52 2015 -0700
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Fri Feb 27 13:07:45 2015 -0700

----------------------------------------------------------------------
 .../corepersistence/CpEntityManager.java         |  7 +++++--
 .../corepersistence/CpEntityManagerFactory.java  | 18 +++++++++++-------
 .../usergrid/corepersistence/CpWalker.java       |  6 ++++--
 stack/pom.xml                                    | 18 +++++++++---------
 .../usergrid/cassandra/ClearShiroSubject.java    | 19 ++++++++-----------
 5 files changed, 37 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/497ac057/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 8f432a2..bc227d8 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
@@ -565,6 +565,9 @@ public class CpEntityManager implements EntityManager {
 
     private Observable deleteAsync( EntityRef entityRef ) throws Exception {
 
+        if(applicationScope == null || entityRef == null){
+            return Observable.empty();
+        }
         CollectionScope collectionScope = getCollectionScopeNameFromEntityType(
                 applicationScope.getApplication(), entityRef.getType()  );
 
@@ -2750,7 +2753,7 @@ public class CpEntityManager implements EntityManager {
         CpWalker walker = new CpWalker( );
 
         walker.walkCollections(
-            this, application, collectionName, reverse, new CpVisitor() {
+            this, getApplication(), collectionName, reverse, new CpVisitor() {
 
             @Override
             public void visitCollectionEntry( EntityManager em, String collName, Entity entity
) {
@@ -2779,7 +2782,7 @@ public class CpEntityManager implements EntityManager {
 
         CpWalker walker = new CpWalker( );
 
-        walker.walkCollections( this, application, null, false, new CpVisitor() {
+        walker.walkCollections( this, getApplication(), null, false, new CpVisitor() {
 
             @Override
             public void visitCollectionEntry( EntityManager em, String collName, Entity entity
) {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/497ac057/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 3c63bd6..8272d7d 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
@@ -317,12 +317,12 @@ public class CpEntityManagerFactory implements EntityManagerFactory,
Application
         Query q = Query.fromQL(String.format("select * where applicationUuid = '%s'", applicationId.toString()));
         Results results = em.searchCollection( em.getApplicationRef(), "appinfos", q);
         Entity appToDelete = results.getEntity();
-        em.delete( appToDelete );
-
-        // create new Entity in deleted_appinfos collection, with same UUID and properties
as deleted appinfo
-        em.create( "deleted_appinfo", appToDelete.getProperties() );
-
-        em.refreshIndex();
+        if(appToDelete != null) {
+            em.delete(appToDelete);
+            // create new Entity in deleted_appinfos collection, with same UUID and properties
as deleted appinfo
+            em.create("deleted_appinfo", appToDelete.getProperties());
+            em.refreshIndex();
+        }
 
         // delete the application's index
         EntityIndex ei = managerCache.getEntityIndex(new ApplicationScopeImpl(
@@ -767,7 +767,11 @@ public class CpEntityManagerFactory implements EntityManagerFactory,
Application
 
         em.reindex( po );
 
-        logger.info("\n\nRebuilt index for application {} id {}\n", app.getName(), appId
);
+        if(app!=null) {
+            logger.info("\n\nRebuilt index for application {} id {}\n", app.getName(), appId);
+        }else{
+            logger.info("\n\nDid not rebuild index for application id {}\n",  appId);
+        }
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/497ac057/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpWalker.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpWalker.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpWalker.java
index fab7e16..928b210 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpWalker.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpWalker.java
@@ -58,8 +58,10 @@ public class CpWalker {
     public void walkCollections(final CpEntityManager em, final EntityRef start,
         String collectionName, boolean reverse, final CpVisitor visitor) throws Exception
{
 
-        doWalkCollections(
-            em, collectionName, reverse, new SimpleId( start.getUuid(), start.getType() ),
visitor );
+        if(start != null) {
+            doWalkCollections(
+                em, collectionName, reverse, new SimpleId(start.getUuid(), start.getType()),
visitor);
+        }
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/497ac057/stack/pom.xml
----------------------------------------------------------------------
diff --git a/stack/pom.xml b/stack/pom.xml
index 167ef14..513d3bb 100644
--- a/stack/pom.xml
+++ b/stack/pom.xml
@@ -122,8 +122,8 @@
       <!-- only use half the cores on the machine for testing -->
       <usergrid.it.parallel>methods</usergrid.it.parallel>
       <usergrid.it.reuseForks>true</usergrid.it.reuseForks>
-      <usergrid.it.forkCount>1</usergrid.it.forkCount>
-      <usergrid.it.threads>2</usergrid.it.threads>
+      <usergrid.it.forkCount>4</usergrid.it.forkCount>
+      <usergrid.it.threads>8</usergrid.it.threads>
 
       <metrics.version>3.0.0</metrics.version>
       <rx.version>0.19.6</rx.version>
@@ -1510,13 +1510,13 @@
                       <!-- TODO, we may need an exclusion.  Appears to be a classloader
bug
                       http://stackoverflow.com/questions/27225140/intermittent-noclassdeffounderror-when-running-a-maven-surefire-build-in-jenkins
                       -->
-                      <!--<dependencies>-->
-                          <!--<dependency>-->
-                              <!--<groupId>org.apache.maven.surefire</groupId>-->
-                              <!--<artifactId>surefire-junit47</artifactId>-->
-                              <!--<version>${surefire.plugin.version}</version>-->
-                          <!--</dependency>-->
-                      <!--</dependencies>-->
+                      <dependencies>
+                          <dependency>
+                              <groupId>org.apache.maven.surefire</groupId>
+                              <artifactId>surefire-junit47</artifactId>
+                              <version>${surefire.plugin.version}</version>
+                          </dependency>
+                      </dependencies>
                   </plugin>
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/497ac057/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/ClearShiroSubject.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/ClearShiroSubject.java
b/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/ClearShiroSubject.java
index 50d01c8..4010b04 100644
--- a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/ClearShiroSubject.java
+++ b/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/ClearShiroSubject.java
@@ -33,20 +33,17 @@ public class ClearShiroSubject extends ExternalResource {
     private static final Logger LOG = LoggerFactory.getLogger( ClearShiroSubject.class );
 
 
+
+    @Override
+    protected void before() throws Throwable {
+        super.before();
+        clear();
+    }
+
     @Override
     protected void after() {
         super.after();
-        Subject subject = SecurityUtils.getSubject();
-
-        if ( subject == null ) {
-
-            LOG.info( "Shiro Subject was null. No need to clear." );
-            return;
-        }
-
-        new SubjectThreadState( subject ).clear();
-
-        LOG.info( "Shiro Subject was NOT null. Subject has been cleared." );
+        clear();
     }
 
     public void clear(){


Mime
View raw message