Fix port settings for tests

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

Branch: refs/heads/datastax-cass-driver
Commit: 5ddb1cd7348b075fa16b66683cb626e11b4d0861
Parents: 1b4e117
Author: Dave Johnson <snoopd...@apache.org>
Authored: Fri Jul 1 15:17:27 2016 -0400
Committer: Dave Johnson <snoopd...@apache.org>
Committed: Fri Jul 1 15:17:27 2016 -0400

----------------------------------------------------------------------
 .../main/resources/usergrid-default.properties  |  3 ++
 .../actorsystem/ActorSystemManager.java         |  7 ++++
 .../actorsystem/ActorSystemManagerImpl.java     |  6 +++
 .../uniquevalues/UniqueValuesServiceImpl.java   | 22 ++++++++---
 .../collection/AbstractUniqueValueTest.java     |  2 +-
 .../collection/EntityCollectionManagerIT.java   |  2 +-
 .../EntityCollectionManagerStressTest.java      | 19 +++++++++-
 .../mvcc/stage/write/WriteUniqueVerifyIT.java   |  2 +-
 .../mvcc/stage/write/WriteUniqueVerifyTest.java |  2 +-
 .../uniquevalues/UniqueValuesServiceTest.java   |  2 +-
 .../src/test/resources/usergrid.properties      | 39 +++++++++++++-------
 11 files changed, 81 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/5ddb1cd7/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 fe70569..95b3e9b 100644
--- a/stack/config/src/main/resources/usergrid-default.properties
+++ b/stack/config/src/main/resources/usergrid-default.properties
@@ -431,6 +431,9 @@ usergrid.cluster.seeds=default:localhost
 # Port used for cluster communications.
 usergrid.cluster.port=2551
 
+# If unspecified then system will use InetAddress.getLocalHost().getHostName()
+usergrid.cluster.hostname=
+
 
 #########################  Usergrid Unique Values Validation ##################
 #

http://git-wip-us.apache.org/repos/asf/usergrid/blob/5ddb1cd7/stack/corepersistence/actorsystem/src/main/java/org/apache/usergrid/persistence/actorsystem/ActorSystemManager.java
----------------------------------------------------------------------
diff --git 
a/stack/corepersistence/actorsystem/src/main/java/org/apache/usergrid/persistence/actorsystem/ActorSystemManager.java
 
b/stack/corepersistence/actorsystem/src/main/java/org/apache/usergrid/persistence/actorsystem/ActorSystemManager.java
index cdb6caf..893afca 100644
--- 
a/stack/corepersistence/actorsystem/src/main/java/org/apache/usergrid/persistence/actorsystem/ActorSystemManager.java
+++ 
b/stack/corepersistence/actorsystem/src/main/java/org/apache/usergrid/persistence/actorsystem/ActorSystemManager.java
@@ -21,6 +21,8 @@ package org.apache.usergrid.persistence.actorsystem;
 
 import akka.actor.ActorRef;
 
+import java.util.Set;
+
 public interface ActorSystemManager {
 
     /**
@@ -71,6 +73,11 @@ public interface ActorSystemManager {
     String getCurrentRegion();
 
     /**
+     * Get all regions known to system.
+     */
+    public Set<String> getRegions();
+
+    /**
      * Publish message to all topic subscribers in all regions.
      */
     void publishToAllRegions( String topic, Object message, ActorRef sender );

http://git-wip-us.apache.org/repos/asf/usergrid/blob/5ddb1cd7/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 a79f447..099b875 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
@@ -67,12 +67,18 @@ public class ActorSystemManagerImpl implements 
ActorSystemManager {
     private ListMultimap<String, String> seedsByRegion;
 
 
+
     @Inject
     public ActorSystemManagerImpl( ActorSystemFig actorSystemFig ) {
         this.actorSystemFig = actorSystemFig;
     }
 
 
+    public Set<String> getRegions() {
+        return getSeedsByRegion().keySet();
+    }
+
+
     /**
      * Init Akka ActorSystems and wait for request actors to start.
      */

http://git-wip-us.apache.org/repos/asf/usergrid/blob/5ddb1cd7/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/uniquevalues/UniqueValuesServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/uniquevalues/UniqueValuesServiceImpl.java
 
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/uniquevalues/UniqueValuesServiceImpl.java
index 352c2e5..fcee8fa 100644
--- 
a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/uniquevalues/UniqueValuesServiceImpl.java
+++ 
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/uniquevalues/UniqueValuesServiceImpl.java
@@ -32,6 +32,7 @@ import akka.util.Timeout;
 import com.google.inject.Inject;
 import com.google.inject.Injector;
 import com.google.inject.Singleton;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.usergrid.persistence.actorsystem.ActorSystemManager;
 import org.apache.usergrid.persistence.actorsystem.GuiceActorProducer;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
@@ -92,9 +93,7 @@ public class UniqueValuesServiceImpl implements 
UniqueValuesService {
     public void reserveUniqueValues(
         ApplicationScope scope, Entity entity, UUID version, String region ) 
throws UniqueValueException {
 
-        if ( !actorSystemManager.isReady() ) {
-            throw new RuntimeException("Unique values service not initialized, 
no request actors ready");
-        }
+        ready();
 
         try {
             for (Field field : entity.getFields()) {
@@ -124,9 +123,7 @@ public class UniqueValuesServiceImpl implements 
UniqueValuesService {
     public void confirmUniqueValues(
         ApplicationScope scope, Entity entity, UUID version, String region ) 
throws UniqueValueException {
 
-        if ( !actorSystemManager.isReady() ) {
-            throw new RuntimeException("Unique values service not initialized, 
no request actors ready");
-        }
+        ready();
 
         try {
             for (Field field : entity.getFields()) {
@@ -202,6 +199,19 @@ public class UniqueValuesServiceImpl implements 
UniqueValuesService {
     }
 
 
+    private void ready() {
+        if ( !actorSystemManager.isReady() ) {
+            throw new RuntimeException("Unique values service not initialized, 
no request actors ready");
+        }
+
+        if ( !StringUtils.isEmpty( uniqueValuesFig.getAuthoritativeRegion() )) 
{
+            if ( !actorSystemManager.getRegions().contains( 
uniqueValuesFig.getAuthoritativeRegion() ) ) {
+                throw new RuntimeException( "Authoritative region not in 
region list" );
+            }
+        }
+    }
+
+
     private void sendUniqueValueRequest(
         Entity entity, String region, UniqueValueActor.Request request ) 
throws UniqueValueException {
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/5ddb1cd7/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/AbstractUniqueValueTest.java
----------------------------------------------------------------------
diff --git 
a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/AbstractUniqueValueTest.java
 
b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/AbstractUniqueValueTest.java
index e7b4450..3bfc48b 100644
--- 
a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/AbstractUniqueValueTest.java
+++ 
b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/AbstractUniqueValueTest.java
@@ -40,7 +40,7 @@ public class AbstractUniqueValueTest {
             actorSystemManager.registerMessageType( 
UniqueValueActor.Reservation.class, "/user/uvProxy" );
             actorSystemManager.registerMessageType( 
UniqueValueActor.Cancellation.class, "/user/uvProxy" );
             actorSystemManager.registerMessageType( 
UniqueValueActor.Confirmation.class, "/user/uvProxy" );
-            actorSystemManager.start( "127.0.0.1", port, "us-east" );
+            actorSystemManager.start( "localhost", port, "us-east" );
             actorSystemManager.waitForClientActor();
 
             startedAkka.put( port, true );

http://git-wip-us.apache.org/repos/asf/usergrid/blob/5ddb1cd7/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerIT.java
----------------------------------------------------------------------
diff --git 
a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerIT.java
 
b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerIT.java
index f8322c6..ceda1a8 100644
--- 
a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerIT.java
+++ 
b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerIT.java
@@ -89,7 +89,7 @@ public class EntityCollectionManagerIT extends 
AbstractUniqueValueTest {
 
     @Before
     public void initAkka() {
-        initAkka( 2555, actorSystemManager, uniqueValuesService );
+        initAkka( 2551, actorSystemManager, uniqueValuesService );
     }
 
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/5ddb1cd7/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerStressTest.java
----------------------------------------------------------------------
diff --git 
a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerStressTest.java
 
b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerStressTest.java
index 7904a42..562a5fc 100644
--- 
a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerStressTest.java
+++ 
b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerStressTest.java
@@ -22,6 +22,9 @@ import java.util.HashSet;
 import java.util.Set;
 
 import org.apache.usergrid.StressTest;
+import org.apache.usergrid.persistence.actorsystem.ActorSystemManager;
+import 
org.apache.usergrid.persistence.collection.uniquevalues.UniqueValuesService;
+import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -52,7 +55,7 @@ import static org.junit.Assert.assertNotNull;
 @RunWith(ITRunner.class)
 @UseModules(TestCollectionModule.class)
 @Category(StressTest.class)
-public class EntityCollectionManagerStressTest {
+public class EntityCollectionManagerStressTest extends AbstractUniqueValueTest 
{
     private static final Logger logger = LoggerFactory.getLogger(
             EntityCollectionManagerStressTest.class );
 
@@ -63,6 +66,20 @@ public class EntityCollectionManagerStressTest {
     @Rule
     public MigrationManagerRule migrationManagerRule;
 
+    @Inject
+    ActorSystemManager actorSystemManager;
+
+    @Inject
+    UniqueValuesService uniqueValuesService;
+
+
+    @Before
+    public void initAkka() {
+        // each test class needs unique port number
+        initAkka( 2552, actorSystemManager, uniqueValuesService );
+    }
+
+
     @Test
     public void writeThousands() {
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/5ddb1cd7/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerifyIT.java
----------------------------------------------------------------------
diff --git 
a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerifyIT.java
 
b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerifyIT.java
index 703d6c2..c70cd1a 100644
--- 
a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerifyIT.java
+++ 
b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerifyIT.java
@@ -85,7 +85,7 @@ public class WriteUniqueVerifyIT extends 
AbstractUniqueValueTest {
     @Before
     public void initAkka() {
         // each test class needs unique port number
-        initAkka( 2551, actorSystemManager, uniqueValuesService );
+        initAkka( 2553, actorSystemManager, uniqueValuesService );
     }
 
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/5ddb1cd7/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerifyTest.java
----------------------------------------------------------------------
diff --git 
a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerifyTest.java
 
b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerifyTest.java
index 46cfde1..7afba05 100644
--- 
a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerifyTest.java
+++ 
b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerifyTest.java
@@ -77,7 +77,7 @@ public class WriteUniqueVerifyTest extends 
AbstractUniqueValueTest {
     @Before
     public void initAkka() {
         // each test class needs unique port number
-        initAkka( 2552, actorSystemManager, uniqueValuesService );
+        initAkka( 2554, actorSystemManager, uniqueValuesService );
     }
 
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/5ddb1cd7/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 672e3bf..1788a88 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
@@ -86,7 +86,7 @@ public class UniqueValuesServiceTest extends 
AbstractUniqueValueTest {
     @Before
     public void initAkka() {
         // each test class needs unique port number
-        initAkka( 2553, actorSystemManager, uniqueValuesService );
+        initAkka( 2555, actorSystemManager, uniqueValuesService );
     }
 
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/5ddb1cd7/stack/corepersistence/collection/src/test/resources/usergrid.properties
----------------------------------------------------------------------
diff --git 
a/stack/corepersistence/collection/src/test/resources/usergrid.properties 
b/stack/corepersistence/collection/src/test/resources/usergrid.properties
index 759a3b3..8c999e2 100644
--- a/stack/corepersistence/collection/src/test/resources/usergrid.properties
+++ b/stack/corepersistence/collection/src/test/resources/usergrid.properties
@@ -1,17 +1,30 @@
-# This property is required to be set and cannot be defaulted anywhere
-usergrid.cluster_name=usergrid
 
-collection.akka.enabled=true
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
 
-collection.akka.hostname=localhost
-collection.akka.port=2551
-collection.akka.region=us-east
-usergrid.queue.regionList=us-east
-collection.akka.authoritative.region=us-east
-collection.akka.region.seeds=us-east\:localhost\:2551
+# This property is required to be set and cannot be defaulted anywhere
+usergrid.cluster_name=usergrid
 
-collection.akka.uniquevalue.actors=300
-collection.akka.uniquevalue.cache.ttl=10
-collection.akka.uniquevalue.reservation.ttl=10
+usergrid.cluster.hostname=localhost
+usergrid.cluster.enabled=true
+usergrid.cluster.region.local=us-east
+usergrid.cluster.region.list=us-east
+usergrid.cluster.seeds=us-east\:localhost
 
-collection.akka.uniquevalue.region.types
+collection.uniquevalues.actors=300
+collection.uniquevalues.authoritative.region=us-east

Reply via email to