usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject [02/11] incubator-usergrid git commit: Filled out test that should prove the issue.
Date Mon, 16 Mar 2015 00:24:57 GMT
Filled out test that should prove the issue.


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

Branch: refs/heads/two-dot-o
Commit: 5411fef0e80d848639fc140e3b6e48383cb05163
Parents: 1bdfd10
Author: GERey <greyes@apigee.com>
Authored: Mon Mar 9 13:09:49 2015 -0700
Committer: GERey <greyes@apigee.com>
Committed: Mon Mar 9 13:09:49 2015 -0700

----------------------------------------------------------------------
 .../collection/EntityCollectionManagerIT.java   | 55 +++++++++++++-------
 1 file changed, 35 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5411fef0/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 f33b3d0..a52a9bb 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
@@ -25,6 +25,7 @@ import java.util.UUID;
 
 import org.apache.usergrid.persistence.collection.mvcc.MvccEntitySerializationStrategy;
 import org.apache.usergrid.persistence.collection.serialization.UniqueValueSerializationStrategy;
+import org.apache.usergrid.persistence.collection.serialization.UniqueValueSet;
 import org.apache.usergrid.persistence.core.guice.ProxyImpl;
 import org.junit.Rule;
 import org.junit.Test;
@@ -51,6 +52,7 @@ import org.apache.usergrid.persistence.model.field.StringField;
 
 import com.fasterxml.uuid.UUIDComparator;
 import com.google.inject.Inject;
+import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
 
 import rx.Observable;
 
@@ -422,7 +424,7 @@ public class EntityCollectionManagerIT {
     @Test
     public void updateVersioning() {
 
-        // create entity 
+        // create entity
         Entity origEntity = new Entity( new SimpleId( "testUpdate" ) );
         origEntity.setField( new StringField( "testField", "value" ) );
 
@@ -431,7 +433,7 @@ public class EntityCollectionManagerIT {
         EntityCollectionManager manager = factory.createCollectionManager( context );
         Entity returned = manager.write( origEntity ).toBlocking().lastOrDefault( null );
 
-        // note its version 
+        // note its version
         UUID oldVersion = returned.getVersion();
 
         // partial update entity but with new entity that has version = null
@@ -754,16 +756,16 @@ public class EntityCollectionManagerIT {
         //override our default
         SetConfigTestBypass.setValueByPass( serializationFig, "getMaxEntitySize", currentMaxSize
+ "" );
     }
-    
+
     @Test
     public void invalidNameRepair() {
-        
+
         //write an entity with a unique field
-        CollectionScope context = 
+        CollectionScope context =
                 new CollectionScopeImpl( new SimpleId( "organization" ), new SimpleId( "test"
), "test" );
 
         Entity newEntity = new Entity( new SimpleId( "test" ) );
-        
+
         newEntity.setField( new IntegerField( "count", 5, true ) );
         newEntity.setField( new StringField( "yes", "fred", true ) );
 
@@ -777,28 +779,41 @@ public class EntityCollectionManagerIT {
         assertNotNull( "Id was assigned", createReturned.getId() );
         assertNotNull( "Version was assigned", createReturned.getVersion() );
 
-
+        //load an entity by it's unique field
         Observable<Entity> loadObservable = manager.load( createReturned.getId() );
 
         Entity loadReturned = loadObservable.toBlocking().lastOrDefault( null );
 
-        assertEquals( "Same value", createReturned, loadReturned );
-        //load an entity by it's unique field
-        
         //verify the entity is correct.
-        
+        assertEquals( "Same value", createReturned, loadReturned );
+
+
         //use the entity serializationStrategy to remove the entity data.
-        
+        try {
+            entitySerializationStrategy.delete( context,loadReturned.getId(),loadReturned.getVersion()
).execute();
+        }
+        catch ( ConnectionException e ) {
+            e.printStackTrace();
+            fail("Shouldn't have had trouble deleting entity");
+        }
+
+
         //try to load via the unique field
-        
+        loadObservable = manager.load( createReturned.getId() );
+
+        loadReturned = loadObservable.toBlocking().lastOrDefault( null );
+
         //verify no entity returned
-        
-        //user the unique serialization to verify it's been deleted from cassandra
-        
+        assertNull( loadReturned );
 
-        
-                
-                
-                
+        //user the unique serialization to verify it's been deleted from cassandra
+        try {
+            UniqueValueSet uniqueValues = uniqueValueSerializationStrategy.load( context,
loadReturned.getFields() );
+            assertNull( uniqueValues );
+        }
+        catch ( ConnectionException e ) {
+            e.printStackTrace();
+            fail("Shouldn't have been able to load the unique entity");
+        }
     }
 }


Mime
View raw message