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

[50/50] incubator-usergrid git commit: Fixes remnant bugs from merge errors

Fixes remnant bugs from merge errors


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

Branch: refs/heads/USERGRID-273
Commit: 4d5e5e6b94ca4c48245c80bb869f922aa6454dd5
Parents: c75b7a9
Author: Todd Nine <tn...@apigee.com>
Authored: Mon Feb 16 11:05:39 2015 -0800
Committer: Todd Nine <tn...@apigee.com>
Committed: Mon Feb 16 11:05:39 2015 -0800

----------------------------------------------------------------------
 .../usergrid/corepersistence/CoreModule.java    |  4 +--
 .../usergrid/corepersistence/GuiceFactory.java  |  2 +-
 .../corepersistence/StaleIndexCleanupTest.java  |  2 +-
 .../index/impl/EsEntityIndexBatchImpl.java      | 29 +++++++++--------
 stack/pom.xml                                   |  1 +
 .../management/export/ExportServiceIT.java      | 34 +++++++++-----------
 6 files changed, 36 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4d5e5e6b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
index 699dfec..8d99586 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
@@ -44,7 +44,7 @@ import org.springframework.context.ApplicationContext;
 /**
  * Guice Module that encapsulates Core Persistence.
  */
-public class GuiceModule  extends AbstractModule {
+public class CoreModule  extends AbstractModule {
 
     /**
      * TODO this is a circular dependency, and should be refactored
@@ -55,7 +55,7 @@ public class GuiceModule  extends AbstractModule {
 
 
 
-    public GuiceModule( final ApplicationContext context ) {
+    public CoreModule( final ApplicationContext context ) {
         this.lazyEntityManagerFactoryProvider = new LazyEntityManagerFactoryProvider( context );
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4d5e5e6b/stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceFactory.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceFactory.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceFactory.java
index edbb1c9..77831fe 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceFactory.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceFactory.java
@@ -134,7 +134,7 @@ public class GuiceFactory implements FactoryBean<Injector>, ApplicationContextAw
         }
 
         //this is seriously fugly, and needs removed
-        injector = Guice.createInjector( new GuiceModule( applicationContext ) );
+        injector = Guice.createInjector( new CoreModule( applicationContext ) );
 
         return injector;
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4d5e5e6b/stack/core/src/test/java/org/apache/usergrid/corepersistence/StaleIndexCleanupTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/corepersistence/StaleIndexCleanupTest.java b/stack/core/src/test/java/org/apache/usergrid/corepersistence/StaleIndexCleanupTest.java
index d356734..45d64a1 100644
--- a/stack/core/src/test/java/org/apache/usergrid/corepersistence/StaleIndexCleanupTest.java
+++ b/stack/core/src/test/java/org/apache/usergrid/corepersistence/StaleIndexCleanupTest.java
@@ -59,7 +59,7 @@ import com.google.inject.Injector;
 
 import net.jcip.annotations.NotThreadSafe;
 
-import static org.apache.usergrid.corepersistence.GuiceModule.EVENTS_DISABLED;
+import static org.apache.usergrid.corepersistence.CoreModule.EVENTS_DISABLED;
 import static org.apache.usergrid.corepersistence.util.CpNamingUtils.getCollectionScopeNameFromEntityType;
 import static org.apache.usergrid.persistence.Schema.TYPE_APPLICATION;
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4d5e5e6b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
index 20669b3..44dc692 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
@@ -98,7 +98,7 @@ public class EsEntityIndexBatchImpl implements EntityIndexBatch {
     private final AliasedEntityIndex entityIndex;
 
 
-    public EsEntityIndexBatchImpl( final ApplicationScope applicationScope, final Client client, 
+    public EsEntityIndexBatchImpl( final ApplicationScope applicationScope, final Client client,
             final IndexFig config, final int autoFlushSize, final FailureMonitor failureMonitor, final AliasedEntityIndex entityIndex ) {
 
         this.applicationScope = applicationScope;
@@ -118,6 +118,7 @@ public class EsEntityIndexBatchImpl implements EntityIndexBatch {
 
 
         IndexValidationUtils.validateIndexScope( indexScope );
+        ValidationUtils.verifyEntityWrite( entity );
 
         final String context = createContextName( indexScope );
         final String entityType = entity.getId().getType();
@@ -167,15 +168,15 @@ public class EsEntityIndexBatchImpl implements EntityIndexBatch {
 
 
         if ( log.isDebugEnabled() ) {
-            log.debug( "De-indexing entity {}:{} in scope\n   app {}\n   owner {}\n   " 
+            log.debug( "De-indexing entity {}:{} in scope\n   app {}\n   owner {}\n   "
                 + "name {} context{}, type {},",
                 new Object[] {
-                    id.getType(), 
-                    id.getUuid(), 
-                    applicationScope.getApplication(), 
+                    id.getType(),
+                    id.getUuid(),
+                    applicationScope.getApplication(),
                     indexScope.getOwner(),
-                    indexScope.getName(), 
-                    context, 
+                    indexScope.getName(),
+                    context,
                     entityType
                 } );
         }
@@ -257,7 +258,7 @@ public class EsEntityIndexBatchImpl implements EntityIndexBatch {
 
         for ( BulkItemResponse response : responses ) {
             if ( response.isFailed() ) {
-                throw new RuntimeException( "Unable to index documents.  Errors are :" 
+                throw new RuntimeException( "Unable to index documents.  Errors are :"
                         + response.getFailure().getMessage() );
             }
         }
@@ -294,7 +295,7 @@ public class EsEntityIndexBatchImpl implements EntityIndexBatch {
         //add the context for filtering later
         entityMap.put( ENTITY_CONTEXT_FIELDNAME, context );
 
-        //but the fieldname we have to prefix because we use query equality to seek this later.  
+        //but the fieldname we have to prefix because we use query equality to seek this later.
         // TODO see if we can make this more declarative
         entityMap.put( ENTITYID_ID_FIELDNAME, IndexingUtils.idString(entity.getId()).toLowerCase());
 
@@ -321,7 +322,7 @@ public class EsEntityIndexBatchImpl implements EntityIndexBatch {
 
             if ( f instanceof ListField ) {
                 List list = ( List ) field.getValue();
-                entityMap.put( field.getName().toLowerCase(), 
+                entityMap.put( field.getName().toLowerCase(),
                         new ArrayList( processCollectionForMap( list ) ) );
 
                 if ( !list.isEmpty() ) {
@@ -333,12 +334,12 @@ public class EsEntityIndexBatchImpl implements EntityIndexBatch {
             }
             else if ( f instanceof ArrayField ) {
                 List list = ( List ) field.getValue();
-                entityMap.put( field.getName().toLowerCase(), 
+                entityMap.put( field.getName().toLowerCase(),
                         new ArrayList( processCollectionForMap( list ) ) );
             }
             else if ( f instanceof SetField ) {
                 Set set = ( Set ) field.getValue();
-                entityMap.put( field.getName().toLowerCase(), 
+                entityMap.put( field.getName().toLowerCase(),
                         new ArrayList( processCollectionForMap( set ) ) );
             }
             else if ( f instanceof EntityObjectField ) {
@@ -362,8 +363,8 @@ public class EsEntityIndexBatchImpl implements EntityIndexBatch {
                 locMap.put( "lon", locField.getValue().getLongitude() );
                 entityMap.put( GEO_PREFIX + field.getName().toLowerCase(), locMap );
             }
-            else if (  f instanceof DoubleField 
-                    || f instanceof FloatField 
+            else if (  f instanceof DoubleField
+                    || f instanceof FloatField
                     || f instanceof IntegerField
                     || f instanceof LongField ) {
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4d5e5e6b/stack/pom.xml
----------------------------------------------------------------------
diff --git a/stack/pom.xml b/stack/pom.xml
index d567b6b..48b45e9 100644
--- a/stack/pom.xml
+++ b/stack/pom.xml
@@ -126,6 +126,7 @@
       <metrics.version>3.0.0</metrics.version>
       <rx.version>0.19.6</rx.version>
         <surefire.plugin.version>2.18.1</surefire.plugin.version>
+        <powermock.version>1.6.1</powermock.version>
     </properties>
 
   <licenses>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4d5e5e6b/stack/services/src/test/java/org/apache/usergrid/management/export/ExportServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/export/ExportServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/export/ExportServiceIT.java
index f329739..852f2d1 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/export/ExportServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/export/ExportServiceIT.java
@@ -54,6 +54,7 @@ import org.apache.usergrid.persistence.EntityManager;
 import org.apache.usergrid.persistence.SimpleEntityRef;
 import org.apache.usergrid.persistence.entities.JobData;
 import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
+import org.apache.usergrid.setup.ConcurrentProcessSingleton;
 
 import com.amazonaws.SDKGlobalConfiguration;
 import com.google.common.collect.ImmutableSet;
@@ -102,9 +103,10 @@ public class ExportServiceIT {
         logger.info("in setup");
 
         // start the scheduler after we're all set up
-        JobSchedulerService jobScheduler = ConcurrentSasdfasdf.getBean( JobSchedulerService.class );
+        JobSchedulerService jobScheduler = ConcurrentProcessSingleton.getInstance().getSpringResource().getBean( JobSchedulerService.class );
         if ( jobScheduler.state() != Service.State.RUNNING ) {
-            jobScheduler.startAndWait();
+            jobScheduler.startAsync();
+            jobScheduler.awaitRunning();
         }
 
         adminUser = newOrgAppAdminRule.getAdminInfo();
@@ -184,9 +186,8 @@ public class ExportServiceIT {
             entity[i] = em.create( "users", userProperties );
         }
         //creates connections
-        em.createConnection(
-                em.get( new SimpleEntityRef( "user", entity[0].getUuid()) ), "Vibrations",
-                em.get( new SimpleEntityRef( "user", entity[1].getUuid()) ) );
+        em.createConnection( em.get( new SimpleEntityRef( "user", entity[0].getUuid() ) ), "Vibrations",
+            em.get( new SimpleEntityRef( "user", entity[1].getUuid() ) ) );
         em.createConnection(
                 em.get( new SimpleEntityRef( "user", entity[1].getUuid()) ), "Vibrations",
                 em.get( new SimpleEntityRef( "user", entity[0].getUuid()) ) );
@@ -240,7 +241,7 @@ public class ExportServiceIT {
         ExportService exportService = setup.getExportService();
 
         String appName = newOrgAppAdminRule.getApplicationInfo().getName();
-        HashMap<String, Object> payload = payloadBuilder(appName);
+        HashMap<String, Object> payload = payloadBuilder( appName );
 
         payload.put( "organizationId", organization.getUuid() );
         payload.put( "applicationId", applicationId );
@@ -262,9 +263,8 @@ public class ExportServiceIT {
         }
         em.refreshIndex();
         //creates connections
-        em.createConnection(
-                em.get( new SimpleEntityRef( "user", entity[0].getUuid())), "Vibrations",
-                em.get( new SimpleEntityRef( "user", entity[1].getUuid())) );
+        em.createConnection( em.get( new SimpleEntityRef( "user", entity[0].getUuid() ) ), "Vibrations",
+            em.get( new SimpleEntityRef( "user", entity[1].getUuid() ) ) );
         em.createConnection(
                 em.get( new SimpleEntityRef( "user", entity[1].getUuid())), "Vibrations",
                 em.get( new SimpleEntityRef( "user", entity[0].getUuid())) );
@@ -685,7 +685,7 @@ public class ExportServiceIT {
         org.json.simple.JSONArray a = ( org.json.simple.JSONArray )
             parser.parse( new FileReader( exportedFile ) );
 
-        assertEquals(23, a.size());
+        assertEquals( 23, a.size() );
     }
 
 
@@ -1009,16 +1009,14 @@ public class ExportServiceIT {
         BlobStore blobStore = null;
 
         try {
-            final Iterable<? extends Module> MODULES = ImmutableSet.of(
-                new JavaUrlHttpCommandExecutorServiceModule(),
-                new Log4JLoggingModule(),
-                new NettyPayloadModule() );
+            final Iterable<? extends Module> MODULES = ImmutableSet.of( new JavaUrlHttpCommandExecutorServiceModule(),
+                new Log4JLoggingModule(), new NettyPayloadModule() );
 
             BlobStoreContext context = ContextBuilder.newBuilder( "s3" )
-                .credentials(accessId, secretKey )
-                .modules(MODULES )
-                .overrides(overrides )
-                .buildView(BlobStoreContext.class );
+                .credentials( accessId, secretKey )
+                .modules( MODULES )
+                .overrides( overrides )
+                .buildView( BlobStoreContext.class );
 
             String expectedFileName = ((ExportServiceImpl)exportService)
                 .prepareOutputFileName(organization.getName(), "applications");