You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2016/06/22 15:25:51 UTC

[5/8] usergrid git commit: Separate configs for JUnit test JVM and Tomcat JVM, and remove some unnecessary properties.

Separate configs for JUnit test JVM and Tomcat JVM, and remove some unnecessary properties.


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

Branch: refs/heads/usergrid-1268-akka-211
Commit: 343ac516cb498bfdec9f64a961197b7e1b0a4c41
Parents: 50312ba
Author: Dave Johnson <sn...@apache.org>
Authored: Tue Jun 21 13:26:20 2016 -0400
Committer: Dave Johnson <sn...@apache.org>
Committed: Tue Jun 21 13:26:20 2016 -0400

----------------------------------------------------------------------
 .../main/resources/usergrid-default.properties  |  7 ++--
 .../corepersistence/CpEntityManagerFactory.java | 15 ++++++++-
 .../persistence/actorsystem/ActorSystemFig.java |  8 -----
 .../actorsystem/ActorSystemManagerImpl.java     |  3 +-
 .../uniquevalues/UniqueValuesServiceTest.java   |  1 -
 .../resources/corepersistence-UNIT.properties   |  2 ++
 .../resources/usergrid-custom-test.properties   |  7 ++--
 .../resources/usergrid-rest-deploy-context.xml  | 34 +++++++++++++++++++-
 8 files changed, 56 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/343ac516/stack/config/src/main/resources/usergrid-default.properties
----------------------------------------------------------------------
diff --git a/stack/config/src/main/resources/usergrid-default.properties b/stack/config/src/main/resources/usergrid-default.properties
index ffe5fc1..bc5d8c9 100644
--- a/stack/config/src/main/resources/usergrid-default.properties
+++ b/stack/config/src/main/resources/usergrid-default.properties
@@ -430,15 +430,12 @@ collection.akka.enabled=false
 # host name of this machine
 collection.akka.hostname=localhost
 
-# port to use for Akka. In multi-region setup, each region MUST use its own unique port.
-collection.akka.port=2551
-
 # the region MUST be in the region list specified in the 'usergrid.queue.regionList' property
-collection.akka.region=us-east-1
+#collection.akka.region=us-east-1
 
 # Comma-separated lists of seeds each with format {region}:{hostname}:{port}.
 # Regions MUST be listed in the 'usergrid.queue.regionList'
-collection.akka.region.seeds=us-east-1:localhost:2551
+#collection.akka.region.seeds=
 
 # The number of unique value actors to start on each Usergrid instance.
 collection.akka.uniquevalue.actors=300

http://git-wip-us.apache.org/repos/asf/usergrid/blob/343ac516/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 99bf1e0..9bd589a 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
@@ -36,12 +36,14 @@ import org.apache.usergrid.exception.ConflictException;
 import org.apache.usergrid.locking.LockManager;
 import org.apache.usergrid.persistence.*;
 import org.apache.usergrid.persistence.actorsystem.ActorSystemFig;
+import org.apache.usergrid.persistence.actorsystem.ActorSystemManager;
 import org.apache.usergrid.persistence.cassandra.CassandraService;
 import org.apache.usergrid.persistence.cassandra.CounterUtils;
 import org.apache.usergrid.persistence.cassandra.Setup;
 import org.apache.usergrid.persistence.collection.EntityCollectionManager;
 import org.apache.usergrid.persistence.collection.exception.CollectionRuntimeException;
 import org.apache.usergrid.persistence.collection.serialization.impl.migration.EntityIdScope;
+import org.apache.usergrid.persistence.collection.uniquevalues.UniqueValueActor;
 import org.apache.usergrid.persistence.collection.uniquevalues.UniqueValuesService;
 import org.apache.usergrid.persistence.core.metrics.MetricsFactory;
 import org.apache.usergrid.persistence.core.migration.data.MigrationDataProvider;
@@ -110,6 +112,7 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
     private final ConnectionService connectionService;
     private final GraphManagerFactory graphManagerFactory;
     private final CollectionSettingsCacheFactory collectionSettingsCacheFactory;
+    private ActorSystemManager actorSystemManager;
     private UniqueValuesService uniqueValuesService;
     private final LockManager lockManager;
 
@@ -142,8 +145,18 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
         if ( actorSystemFig.getAkkaEnabled() ) {
             try {
                 logger.info("Akka cluster starting...");
+
                 this.uniqueValuesService = injector.getInstance( UniqueValuesService.class );
-                // TODO: this.uniqueValuesService.start();
+                this.actorSystemManager = injector.getInstance( ActorSystemManager.class );
+
+                actorSystemManager.registerRouterProducer( uniqueValuesService );
+                actorSystemManager.registerMessageType( UniqueValueActor.Request.class, "/user/uvProxy" );
+                actorSystemManager.registerMessageType( UniqueValueActor.Reservation.class, "/user/uvProxy" );
+                actorSystemManager.registerMessageType( UniqueValueActor.Cancellation.class, "/user/uvProxy" );
+                actorSystemManager.registerMessageType( UniqueValueActor.Confirmation.class, "/user/uvProxy" );
+                actorSystemManager.start();
+                actorSystemManager.waitForRequestActors();
+
             } catch (Throwable t) {
                 logger.error("Error starting Akka", t);
                 throw t;

http://git-wip-us.apache.org/repos/asf/usergrid/blob/343ac516/stack/corepersistence/actorsystem/src/main/java/org/apache/usergrid/persistence/actorsystem/ActorSystemFig.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/actorsystem/src/main/java/org/apache/usergrid/persistence/actorsystem/ActorSystemFig.java b/stack/corepersistence/actorsystem/src/main/java/org/apache/usergrid/persistence/actorsystem/ActorSystemFig.java
index 7af510c..50e860b 100644
--- a/stack/corepersistence/actorsystem/src/main/java/org/apache/usergrid/persistence/actorsystem/ActorSystemFig.java
+++ b/stack/corepersistence/actorsystem/src/main/java/org/apache/usergrid/persistence/actorsystem/ActorSystemFig.java
@@ -33,8 +33,6 @@ public interface ActorSystemFig extends GuicyFig, Serializable {
 
     String AKKA_HOSTNAME = "collection.akka.hostname";
 
-    String AKKA_PORT = "collection.akka.port";
-
     String AKKA_REGION = "collection.akka.region";
 
     String AKKA_REGION_LIST = "usergrid.queue.regionList"; // same region list used by queues
@@ -63,12 +61,6 @@ public interface ActorSystemFig extends GuicyFig, Serializable {
     String getHostname();
 
     /**
-     * local port to be used in Akka configuration.
-     */
-    @Key(AKKA_PORT)
-    int getPort();
-
-    /**
      * Local region to be used in Akka configuration.
      */
     @Key(AKKA_REGION)

http://git-wip-us.apache.org/repos/asf/usergrid/blob/343ac516/stack/corepersistence/actorsystem/src/main/java/org/apache/usergrid/persistence/actorsystem/ActorSystemManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/actorsystem/src/main/java/org/apache/usergrid/persistence/actorsystem/ActorSystemManagerImpl.java b/stack/corepersistence/actorsystem/src/main/java/org/apache/usergrid/persistence/actorsystem/ActorSystemManagerImpl.java
index 0622b1b..b3af978 100644
--- a/stack/corepersistence/actorsystem/src/main/java/org/apache/usergrid/persistence/actorsystem/ActorSystemManagerImpl.java
+++ b/stack/corepersistence/actorsystem/src/main/java/org/apache/usergrid/persistence/actorsystem/ActorSystemManagerImpl.java
@@ -239,7 +239,6 @@ public class ActorSystemManagerImpl implements ActorSystemManager {
                 logger.info( "Config for region {} is:\n" +
                         "   Akka Hostname {}\n" +
                         "   Akka Seeds {}\n" +
-                        "   Akka Port {}\n" +
                         "   Akka UniqueValueActors per node {}\n" +
                         "   Akka Authoritative Region {}",
                     region, hostname, seeds, port, numInstancesPerNode, actorSystemFig.getAkkaAuthoritativeRegion() );
@@ -262,6 +261,8 @@ public class ActorSystemManagerImpl implements ActorSystemManager {
                                 }
                             }} );
                         }} );
+
+                        // TODO: allow RouterProducers to add in router-specific stuff like this:
                         put( "actor", new HashMap<String, Object>() {{
                             put( "deployment", new HashMap<String, Object>() {{
                                 put( "/uvRouter/singleton/router", new HashMap<String, Object>() {{

http://git-wip-us.apache.org/repos/asf/usergrid/blob/343ac516/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/uniquevalues/UniqueValuesServiceTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/uniquevalues/UniqueValuesServiceTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/uniquevalues/UniqueValuesServiceTest.java
index 3cba9c8..672e3bf 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/uniquevalues/UniqueValuesServiceTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/uniquevalues/UniqueValuesServiceTest.java
@@ -50,7 +50,6 @@ import java.util.Collection;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/343ac516/stack/rest/src/test/resources/corepersistence-UNIT.properties
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/resources/corepersistence-UNIT.properties b/stack/rest/src/test/resources/corepersistence-UNIT.properties
index 2383813..724884e 100644
--- a/stack/rest/src/test/resources/corepersistence-UNIT.properties
+++ b/stack/rest/src/test/resources/corepersistence-UNIT.properties
@@ -20,3 +20,5 @@ usergrid.notifications.listener.run=false
 
 # This property is required to be set and cannot be defaulted anywhere
 usergrid.cluster_name=usergrid
+
+collection.akka.region.seeds=us-east\:localhost\:2552

http://git-wip-us.apache.org/repos/asf/usergrid/blob/343ac516/stack/rest/src/test/resources/usergrid-custom-test.properties
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/resources/usergrid-custom-test.properties b/stack/rest/src/test/resources/usergrid-custom-test.properties
index 5c587f4..d2cb8a3 100644
--- a/stack/rest/src/test/resources/usergrid-custom-test.properties
+++ b/stack/rest/src/test/resources/usergrid-custom-test.properties
@@ -10,6 +10,9 @@
 #   See the License for the specific language governing permissions and
 #   limitations under the License. See accompanying LICENSE file.
 
+
+# properties used by Usergrid running in JUnit test JVM
+
 # REST module test properties
 
 cassandra.startup=external
@@ -56,7 +59,6 @@ usergrid.graph.shard.repair.chance=1.0
 collection.akka.enabled=true
 
 collection.akka.hostname=localhost
-collection.akka.port=2551
 collection.akka.region=us-east
 usergrid.queue.regionList=us-east
 collection.akka.uniquevalue.authoritative.region=us-east
@@ -65,6 +67,3 @@ collection.akka.region.seeds=us-east\:localhost\:2551
 collection.akka.uniquevalue.actors=300
 collection.akka.uniquevalue.cache.ttl=10
 collection.akka.uniquevalue.reservation.ttl=10
-
-collection.akka.uniquevalue.region.types
-

http://git-wip-us.apache.org/repos/asf/usergrid/blob/343ac516/stack/rest/src/test/resources/usergrid-rest-deploy-context.xml
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/resources/usergrid-rest-deploy-context.xml b/stack/rest/src/test/resources/usergrid-rest-deploy-context.xml
index 06d5de4..9cc5ea6 100644
--- a/stack/rest/src/test/resources/usergrid-rest-deploy-context.xml
+++ b/stack/rest/src/test/resources/usergrid-rest-deploy-context.xml
@@ -21,6 +21,38 @@
 	http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd
 	http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
 
-    <import resource="classpath:/usergrid-test-context.xml" />
+    <bean id="properties"
+          class="org.springframework.beans.factory.config.PropertiesFactoryBean">
+        <property name="singleton" value="true" />
+        <property name="ignoreResourceNotFound" value="true" />
+        <property name="locations">
+            <list>
+                <value>classpath:/usergrid-default.properties</value>
+                <value>classpath:/usergrid-test.properties</value>
+                <value>classpath:/usergrid-custom-test-rest.properties</value>
+            </list>
+        </property>
+    </bean>
+
+
+    <import resource="usergrid-rest-context.xml"/>
+
+    <bean id="traceTagManager" class="org.apache.usergrid.persistence.cassandra.util.TraceTagManager">
+        <property name="reportUnattached" value="false"/>
+        <property name="traceEnabled" value="false"/>
+    </bean>
+
+    <bean id="setup" class="org.apache.usergrid.corepersistence.CpSetup">
+        <constructor-arg ref="entityManagerFactory"/>
+        <constructor-arg ref="cassandraService"/>
+        <constructor-arg ref="injector"/>
+    </bean>
+
+    <!-- refer to a named schemaManager from the DataControl annotation thusly -->
+    <bean id="coreManager" class="org.apache.usergrid.persistence.CoreSchemaManager">
+        <constructor-arg ref="setup"/>
+        <constructor-arg ref="cassandraCluster"/>
+        <constructor-arg ref="injector"/>
+    </bean>
 
 </beans>