usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toddn...@apache.org
Subject [24/50] incubator-usergrid git commit: Removed task executor from tests to separate concerns.
Date Mon, 15 Dec 2014 18:32:08 GMT
Removed task executor from tests to separate concerns.


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

Branch: refs/heads/two-dot-o
Commit: 3294f00928c5b066caa5bd84dd1aec2d563c3468
Parents: e759a79
Author: grey <greyes@apigee.com>
Authored: Tue Nov 4 15:35:25 2014 -0800
Committer: grey <greyes@apigee.com>
Committed: Tue Nov 4 15:35:25 2014 -0800

----------------------------------------------------------------------
 .../impl/EntityVersionCleanupTaskTest.java      | 51 ++++++++++----------
 .../impl/EntityVersionCreatedTaskTest.java      | 34 +++++++------
 2 files changed, 45 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3294f009/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCleanupTaskTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCleanupTaskTest.java
b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCleanupTaskTest.java
index 0e86027..1c7d510 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCleanupTaskTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCleanupTaskTest.java
@@ -31,6 +31,7 @@ import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.collection.serialization.UniqueValueSerializationStrategy;
 import org.junit.AfterClass;
 import org.junit.Test;
+import org.junit.Assert;
 
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.event.EntityVersionDeleted;
@@ -156,11 +157,11 @@ public class EntityVersionCleanupTaskTest {
         when( ess.load( same( appScope ), same( entityId ), any(UUID.class), any(Integer.class)
) )
                 .thenReturn(mel.iterator() );
 
-        // start the task
-        ListenableFuture<Void> future = taskExecutor.submit( cleanupTask );
-
-        // wait for the task
-        future.get();
+        try {
+            cleanupTask.call();
+        }catch(Exception e){
+            Assert.fail( e.getMessage() );
+        }
 
         // verify it was run
         verify( entityBatch ).execute();
@@ -257,10 +258,11 @@ public class EntityVersionCleanupTaskTest {
                 .thenReturn(mel.iterator() );
 
         //start the task
-        ListenableFuture<Void> future = taskExecutor.submit( cleanupTask );
-
-        //wait for the task
-        future.get();
+        try {
+            cleanupTask.call();
+        }catch(Exception e){
+            Assert.fail( e.getMessage() );
+        }
 
 
         // These last two verify statements do not make sense. We cannot assert that the
entity
@@ -368,11 +370,11 @@ public class EntityVersionCleanupTaskTest {
                 .thenReturn(mel.iterator() );
 
 
-        //start the task
-        ListenableFuture<Void> future = taskExecutor.submit( cleanupTask );
-
-        //wait for the task
-        future.get();
+        try {
+            cleanupTask.call();
+        }catch(Exception e){
+            Assert.fail( e.getMessage() );
+        }
 
         //we deleted the version
         //verify it was run
@@ -480,12 +482,11 @@ public class EntityVersionCleanupTaskTest {
         when( ess.load( same( appScope ), same( entityId ), any(UUID.class), any(Integer.class)
) )
                 .thenReturn(mel.iterator() );
 
-        //start the task
-        ListenableFuture<Void> future = taskExecutor.submit( cleanupTask );
-
-        //wait for the task
-        future.get();
-
+        try {
+            cleanupTask.call();
+        }catch(Exception e){
+            Assert.fail( e.getMessage() );
+        }
         //we deleted the version
         //verify we deleted everything
         verify( entityBatch, times( 1 ) ).mergeShallow( any( MutationBatch.class ) );
@@ -740,11 +741,11 @@ public class EntityVersionCleanupTaskTest {
                 .thenReturn(mel.iterator() );
 
 
-        //start the task
-        ListenableFuture<Void> future = taskExecutor.submit( cleanupTask );
-
-        //wait for the task
-        future.get();
+        try {
+            cleanupTask.call();
+        }catch(Exception e){
+            Assert.fail(e.getMessage());
+        }
 
         //we deleted the version
         //verify it was run

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3294f009/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCreatedTaskTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCreatedTaskTest.java
b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCreatedTaskTest.java
index 24ea280..3ba8fe1 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCreatedTaskTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCreatedTaskTest.java
@@ -50,6 +50,7 @@ import org.apache.usergrid.persistence.model.entity.SimpleId;
 import org.apache.usergrid.persistence.model.util.UUIDGenerator;
 
 import org.junit.AfterClass;
+import org.junit.Assert;
 import org.junit.Test;
 
 import static org.mockito.Matchers.any;
@@ -98,10 +99,15 @@ public class EntityVersionCreatedTaskTest {
         EntityVersionCreatedTask entityVersionCreatedTask =
                 new EntityVersionCreatedTask( appScope, listeners, entity);
 
-        ListenableFuture<Void> future = taskExecutor.submit( entityVersionCreatedTask
);
+        try {
+            entityVersionCreatedTask.call();
+        }catch(Exception e){
+            Assert.fail(e.getMessage());
+        }
+
 
         // wait for the task
-        future.get();
+       // future.get();
 
         //mocked listener makes sure that the task is called
         verify( listeners ).size();
@@ -139,11 +145,12 @@ public class EntityVersionCreatedTaskTest {
         EntityVersionCreatedTask entityVersionCreatedTask =
             new EntityVersionCreatedTask( appScope, listeners, entity);
 
-        ListenableFuture<Void> future = taskExecutor.submit( entityVersionCreatedTask
);
-
-        // wait for the task
-        future.get();
+        try {
+            entityVersionCreatedTask.call();
+        }catch(Exception e){
 
+            Assert.fail(e.getMessage());
+        }
         //mocked listener makes sure that the task is called
         verify( listeners ).size();
         verify( listeners ).iterator();
@@ -184,15 +191,15 @@ public class EntityVersionCreatedTaskTest {
 
         when ( helper.next() ).thenReturn( listener1,listener2,listener3);
 
-        ListenableFuture<Void> future = taskExecutor.submit( entityVersionCreatedTask
);
-
-        //wait for the task
-        //intentionally fails due to difficulty mocking observable
         try {
-            future.get();
+            entityVersionCreatedTask.call();
         }catch(Exception e){
             ;
         }
+        //ListenableFuture<Void> future = taskExecutor.submit( entityVersionCreatedTask
);
+
+        //wait for the task
+        //intentionally fails due to difficulty mocking observable
 
         //mocked listener makes sure that the task is called
         verify( listeners ).size();
@@ -234,10 +241,7 @@ public class EntityVersionCreatedTaskTest {
         EntityVersionCreatedTask entityVersionCreatedTask =
                 new EntityVersionCreatedTask( appScope, listeners, entity);
 
-        ListenableFuture<Void> future = taskExecutor.submit( entityVersionCreatedTask
);
-
-        // wait for the task
-        future.get();
+        entityVersionCreatedTask.rejected();
 
         //mocked listener makes sure that the task is called
         verify( listeners ).size();


Mime
View raw message