You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by mr...@apache.org on 2016/07/11 15:35:58 UTC

[48/50] [abbrv] usergrid git commit: Increase test coverage of actorsystem module

Increase test coverage of actorsystem module


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

Branch: refs/heads/release-2.1.1
Commit: 31b20404da508f9fa35ae24d2f02381209944406
Parents: 47b7615
Author: Dave Johnson <sn...@apache.org>
Authored: Thu Jul 7 16:21:36 2016 -0400
Committer: Dave Johnson <sn...@apache.org>
Committed: Thu Jul 7 16:21:36 2016 -0400

----------------------------------------------------------------------
 stack/corepersistence/actorsystem/pom.xml       |  7 +++++
 .../actorsystem/ActorServiceServiceTest.java    | 33 +++++++++++++++-----
 2 files changed, 32 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/31b20404/stack/corepersistence/actorsystem/pom.xml
----------------------------------------------------------------------
diff --git a/stack/corepersistence/actorsystem/pom.xml b/stack/corepersistence/actorsystem/pom.xml
index 85c0d60..b77f90f 100644
--- a/stack/corepersistence/actorsystem/pom.xml
+++ b/stack/corepersistence/actorsystem/pom.xml
@@ -94,6 +94,13 @@
             <scope>test</scope>
         </dependency>
 
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+            <version>${mockito.version}</version>
+            <scope>test</scope>
+        </dependency>
+
     </dependencies>
 
 </project>

http://git-wip-us.apache.org/repos/asf/usergrid/blob/31b20404/stack/corepersistence/actorsystem/src/test/java/org/apache/usergrid/persistence/actorsystem/ActorServiceServiceTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/actorsystem/src/test/java/org/apache/usergrid/persistence/actorsystem/ActorServiceServiceTest.java b/stack/corepersistence/actorsystem/src/test/java/org/apache/usergrid/persistence/actorsystem/ActorServiceServiceTest.java
index a12c5e1..7ac7b12 100644
--- a/stack/corepersistence/actorsystem/src/test/java/org/apache/usergrid/persistence/actorsystem/ActorServiceServiceTest.java
+++ b/stack/corepersistence/actorsystem/src/test/java/org/apache/usergrid/persistence/actorsystem/ActorServiceServiceTest.java
@@ -24,11 +24,17 @@ import org.apache.usergrid.persistence.core.test.UseModules;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.mockito.Mockito;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.verify;
+
 
 @RunWith( ITRunner.class )
 @UseModules( ActorSystemModule.class )
@@ -38,20 +44,31 @@ public class ActorServiceServiceTest {
     @Inject
     ActorSystemFig actorSystemFig;
 
-    private static AtomicBoolean startedAkka = new AtomicBoolean( false );
+    @Inject
+    ActorSystemManager actorSystemManager;
 
 
-    @Before
-    public void initAkka() {
-        if ( !startedAkka.getAndSet( true ) ) {
-        }
-    }
+    private static AtomicBoolean startedAkka = new AtomicBoolean( false );
 
 
     @Test
     public void testBasicOperation() throws Exception {
-        initAkka();
-    }
 
+        RouterProducer routerProducer = Mockito.mock( RouterProducer.class );
+        actorSystemManager.registerRouterProducer( routerProducer );
+
+        actorSystemManager.registerMessageType( String.class, "/users/path" );
+        actorSystemManager.registerMessageType( Integer.class, "/users/path" );
+        actorSystemManager.registerMessageType( Long.class, "/users/path" );
+
+        actorSystemManager.start( "localhost", 2770, "us-east" );
+        actorSystemManager.waitForClientActor();
+
+        verify( routerProducer ).createClusterSingletonManager( any() );
+        verify( routerProducer ).createClusterSingletonProxy( any(), eq("io") );
+        verify( routerProducer ).createLocalSystemActors( any() );
+        verify( routerProducer ).addConfiguration( any() );
+
+    }
 
 }