usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [08/18] usergrid git commit: Cherry picking Akka/UV changes into release-2.1.1
Date Mon, 02 May 2016 21:42:20 GMT
Cherry picking Akka/UV changes into release-2.1.1


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

Branch: refs/heads/usergrid-1268-akka-211
Commit: 2c08979205ec0741d6fcf3983aa59f807121ae50
Parents: 11aa138
Author: Dave Johnson <snoopdave@apache.org>
Authored: Wed Apr 20 10:19:49 2016 -0400
Committer: Dave Johnson <snoopdave@apache.org>
Committed: Mon Apr 25 15:36:46 2016 -0400

----------------------------------------------------------------------
 .../usergrid/corepersistence/CoreModule.java    | 61 ++++----------------
 .../corepersistence/CpEntityManager.java        |  7 ++-
 .../corepersistence/index/IndexServiceImpl.java | 32 ++++------
 .../rest/applications/CollectionResource.java   | 13 ++++-
 .../collection/CollectionsResourceIT.java       | 40 +++++++++++++
 5 files changed, 78 insertions(+), 75 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/2c089792/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 933090d..ffdeaca 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
@@ -16,53 +16,19 @@
 package org.apache.usergrid.corepersistence;
 
 
-import org.apache.usergrid.corepersistence.index.CollectionSettingsCacheFactory;
-import org.apache.usergrid.corepersistence.index.IndexSchemaCacheFig;
-import org.apache.usergrid.locking.guice.LockModule;
-import org.apache.usergrid.persistence.cache.guice.CacheModule;
-import java.util.concurrent.ThreadPoolExecutor;
-
-import org.safehaus.guicyfig.GuicyFigModule;
-
-import org.apache.usergrid.corepersistence.asyncevents.AsyncEventService;
-import org.apache.usergrid.corepersistence.asyncevents.AsyncEventsSchedulerFig;
-import org.apache.usergrid.corepersistence.asyncevents.AsyncIndexProvider;
-import org.apache.usergrid.corepersistence.asyncevents.EventBuilder;
-import org.apache.usergrid.corepersistence.asyncevents.EventBuilderImpl;
-import org.apache.usergrid.corepersistence.asyncevents.EventExecutionScheduler;
-import org.apache.usergrid.corepersistence.index.ApplicationIndexBucketLocator;
-import org.apache.usergrid.corepersistence.index.CoreIndexFig;
-import org.apache.usergrid.corepersistence.index.IndexLocationStrategyFactory;
-import org.apache.usergrid.corepersistence.index.IndexLocationStrategyFactoryImpl;
-import org.apache.usergrid.corepersistence.index.IndexProcessorFig;
-import org.apache.usergrid.corepersistence.index.IndexService;
-import org.apache.usergrid.corepersistence.index.IndexServiceImpl;
-import org.apache.usergrid.corepersistence.index.ReIndexService;
-import org.apache.usergrid.corepersistence.index.ReIndexServiceImpl;
+import com.google.inject.*;
+import com.google.inject.assistedinject.FactoryModuleBuilder;
+import com.google.inject.multibindings.Multibinder;
+import org.apache.usergrid.corepersistence.asyncevents.*;
+import org.apache.usergrid.corepersistence.index.*;
 import org.apache.usergrid.corepersistence.migration.CoreMigration;
 import org.apache.usergrid.corepersistence.migration.CoreMigrationPlugin;
 import org.apache.usergrid.corepersistence.migration.DeDupConnectionDataMigration;
 import org.apache.usergrid.corepersistence.pipeline.PipelineModule;
-import org.apache.usergrid.corepersistence.rx.impl.AllApplicationsObservable;
-import org.apache.usergrid.corepersistence.rx.impl.AllApplicationsObservableImpl;
-import org.apache.usergrid.corepersistence.rx.impl.AllEntitiesInSystemImpl;
-import org.apache.usergrid.corepersistence.rx.impl.AllEntityIdsObservable;
-import org.apache.usergrid.corepersistence.rx.impl.AllEntityIdsObservableImpl;
-import org.apache.usergrid.corepersistence.rx.impl.AllNodesInGraphImpl;
-import org.apache.usergrid.corepersistence.rx.impl.AsyncRepair;
-import org.apache.usergrid.corepersistence.rx.impl.ResponseImportTasks;
-import org.apache.usergrid.corepersistence.service.AggregationService;
-import org.apache.usergrid.corepersistence.service.AggregationServiceFactory;
-import org.apache.usergrid.corepersistence.service.AggregationServiceImpl;
-import org.apache.usergrid.corepersistence.service.ApplicationService;
-import org.apache.usergrid.corepersistence.service.ApplicationServiceImpl;
-import org.apache.usergrid.corepersistence.service.CollectionService;
-import org.apache.usergrid.corepersistence.service.CollectionServiceImpl;
-import org.apache.usergrid.corepersistence.service.ConnectionService;
-import org.apache.usergrid.corepersistence.service.ConnectionServiceImpl;
-import org.apache.usergrid.corepersistence.service.ServiceSchedulerFig;
-import org.apache.usergrid.corepersistence.service.StatusService;
-import org.apache.usergrid.corepersistence.service.StatusServiceImpl;
+import org.apache.usergrid.corepersistence.rx.impl.*;
+import org.apache.usergrid.corepersistence.service.*;
+import org.apache.usergrid.locking.guice.LockModule;
+import org.apache.usergrid.persistence.cache.guice.CacheModule;
 import org.apache.usergrid.persistence.collection.guice.CollectionModule;
 import org.apache.usergrid.persistence.collection.serialization.impl.migration.EntityIdScope;
 import org.apache.usergrid.persistence.core.executor.TaskExecutorFactory;
@@ -76,14 +42,9 @@ import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.graph.guice.GraphModule;
 import org.apache.usergrid.persistence.graph.serialization.impl.migration.GraphNode;
 import org.apache.usergrid.persistence.index.guice.IndexModule;
+import org.safehaus.guicyfig.GuicyFigModule;
 
-import com.google.inject.AbstractModule;
-import com.google.inject.Inject;
-import com.google.inject.Provides;
-import com.google.inject.Singleton;
-import com.google.inject.TypeLiteral;
-import com.google.inject.assistedinject.FactoryModuleBuilder;
-import com.google.inject.multibindings.Multibinder;
+import java.util.concurrent.ThreadPoolExecutor;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/usergrid/blob/2c089792/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 fabe33b..06712c2 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
@@ -46,7 +46,10 @@ import org.apache.usergrid.persistence.collection.exception.WriteUniqueVerifyExc
 import org.apache.usergrid.persistence.core.metrics.MetricsFactory;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.entities.*;
-import org.apache.usergrid.persistence.exceptions.*;
+import org.apache.usergrid.persistence.exceptions.DuplicateUniquePropertyExistsException;
+import org.apache.usergrid.persistence.exceptions.EntityNotFoundException;
+import org.apache.usergrid.persistence.exceptions.RequiredPropertyNotFoundException;
+import org.apache.usergrid.persistence.exceptions.UnexpectedEntityTypeException;
 import org.apache.usergrid.persistence.graph.GraphManager;
 import org.apache.usergrid.persistence.graph.GraphManagerFactory;
 import org.apache.usergrid.persistence.graph.SearchEdgeType;
@@ -1794,7 +1797,7 @@ public class CpEntityManager implements EntityManager {
         }
     }
 
-        @Override
+    @Override
     public void grantRolePermission( String roleName, String permission ) throws Exception
{
         roleName = roleName.toLowerCase();
         permission = permission.toLowerCase();

http://git-wip-us.apache.org/repos/asf/usergrid/blob/2c089792/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexServiceImpl.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexServiceImpl.java
index 7b93abc..ab2caa3 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexServiceImpl.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexServiceImpl.java
@@ -20,11 +20,10 @@
 package org.apache.usergrid.corepersistence.index;
 
 
-import java.util.*;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
+import com.codahale.metrics.Timer;
+import com.google.common.base.Optional;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
 import org.apache.usergrid.corepersistence.util.CpNamingUtils;
 import org.apache.usergrid.persistence.Schema;
 import org.apache.usergrid.persistence.core.metrics.MetricsFactory;
@@ -35,14 +34,7 @@ import org.apache.usergrid.persistence.graph.GraphManager;
 import org.apache.usergrid.persistence.graph.GraphManagerFactory;
 import org.apache.usergrid.persistence.graph.impl.SimpleEdge;
 import org.apache.usergrid.persistence.graph.serialization.EdgesObservable;
-import org.apache.usergrid.persistence.index.CandidateResult;
-import org.apache.usergrid.persistence.index.CandidateResults;
-import org.apache.usergrid.persistence.index.EntityIndex;
-import org.apache.usergrid.persistence.index.EntityIndexBatch;
-import org.apache.usergrid.persistence.index.EntityIndexFactory;
-import org.apache.usergrid.persistence.index.IndexEdge;
-import org.apache.usergrid.persistence.index.IndexFig;
-import org.apache.usergrid.persistence.index.SearchEdge;
+import org.apache.usergrid.persistence.index.*;
 import org.apache.usergrid.persistence.index.impl.IndexOperationMessage;
 import org.apache.usergrid.persistence.map.MapManager;
 import org.apache.usergrid.persistence.map.MapManagerFactory;
@@ -52,17 +44,13 @@ import org.apache.usergrid.persistence.model.entity.Id;
 import org.apache.usergrid.persistence.model.entity.SimpleId;
 import org.apache.usergrid.utils.InflectionUtils;
 import org.apache.usergrid.utils.UUIDUtils;
-
-import com.codahale.metrics.Timer;
-import com.google.common.base.Optional;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import rx.Observable;
 
-import static org.apache.usergrid.corepersistence.util.CpNamingUtils.createSearchEdgeFromSource;
-import static org.apache.usergrid.corepersistence.util.CpNamingUtils.generateScopeFromSource;
-import static org.apache.usergrid.corepersistence.util.CpNamingUtils.generateScopeFromTarget;
+import java.util.*;
+
+import static org.apache.usergrid.corepersistence.util.CpNamingUtils.*;
 import static org.apache.usergrid.persistence.Schema.TYPE_APPLICATION;
 
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/2c089792/stack/rest/src/main/java/org/apache/usergrid/rest/applications/CollectionResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/CollectionResource.java
b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/CollectionResource.java
index 9373b4d..ba7aef0 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/CollectionResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/CollectionResource.java
@@ -86,7 +86,7 @@ public class CollectionResource extends ServiceResource {
      * POST settings for a collection.
      *
      * Expects a JSON object which may include:
-     * - fields: (array or string) either an array of field names to be indexed, or 'all'
or 'none'
+     * - fields: (array) field names to be indexed, '*' for all and 'none' for no indexing
      * - region: (string) name of the authoritative region for this collection
      */
     @POST
@@ -123,6 +123,17 @@ public class CollectionResource extends ServiceResource {
 
         executeServicePostRequestForSettings( ui,response, ServiceAction.POST, payload );
 
+        if(payload.getProperty( "fields" )==null){
+            throw new NullArgumentException( "fields" );
+        }
+
+        if(! (payload.getProperty( "fields" ) instanceof ArrayList)){
+            throw new NullArgumentException( "fields must be of json array type" );
+        }
+
+
+        executeServicePostRequestForSettings( ui,response, ServiceAction.POST,payload );
+
         return response;
     }
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/2c089792/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
index 500ce98..98a5fb2 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
@@ -235,6 +235,46 @@ public class CollectionsResourceIT extends AbstractRestIT {
 
     }
 
+    @Test
+    public void verifyThatFieldsIsRequiredForCollectionSchema() throws Exception {
+        ArrayList<String> indexingArray = new ArrayList<>(  );
+
+        //field "fields" is required.
+        Entity payload = new Entity();
+        payload.put( "fieldWeirdnessNotFields", indexingArray);
+
+        //Post index to the collection metadata
+        try {
+            this.app().collection( "testCollections" ).collection( "_settings" ).post( payload
);
+            fail();
+        }catch(BadRequestException bre){
+            //this is expected.
+        }
+
+        //ensure that it has to be an arraylist passed in.
+        Map indexingMap = new HashMap<>(  );
+        indexingMap.put( "exludeStuff","randomtext" );
+
+        payload = new Entity();
+        payload.put( "fields", indexingMap);
+
+        try {
+            this.app().collection( "testCollections" ).collection( "_settings" ).post( payload
);
+            fail();
+        }catch(BadRequestException bre){
+            //this is expected.
+        }
+
+        payload = new Entity();
+        payload.put( "fields", indexingArray);
+
+        try {
+            this.app().collection( "testCollections" ).collection( "_settings" ).post( payload
);
+        }catch(BadRequestException bre){
+            fail( "This shouldn't fail" );
+        }
+
+    }
 
     @Test
     public void postCollectionSchemaWithWildcardIndexAll() throws Exception {


Mime
View raw message