Reset unique value test to its original state.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/5c81a020 Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/5c81a020 Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/5c81a020 Branch: refs/heads/master Commit: 5c81a0207f873f6ca54b40043143e87f65c2ced2 Parents: 75d2254 Author: Michael Russo <[email protected]> Authored: Wed Jun 22 16:45:01 2016 -0700 Committer: Michael Russo <[email protected]> Committed: Wed Jun 22 16:45:01 2016 -0700 ---------------------------------------------------------------------- .../collection/EntityCollectionManagerIT.java | 58 ++++++-------------- 1 file changed, 18 insertions(+), 40 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid/blob/5c81a020/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 f828c65..0f3daa4 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 @@ -117,49 +117,27 @@ public class EntityCollectionManagerIT { EntityCollectionManager manager = factory.createCollectionManager( context ); - Entity entity = new Entity( new SimpleId( "test" ) ); - entity.setField( new IntegerField( "count", 5, true ) ); - - Observable<Entity> firstWrite = manager.write( entity ); - - Entity newEntity = null; - Entity firstReturned = null; - - for(int i=0; i<500; i++){ - - - firstReturned = firstWrite.toBlocking().lastOrDefault( null ); + { + Entity newEntity = new Entity( new SimpleId( "test" ) ); + newEntity.setField( new IntegerField( "count", 5, true ) ); + Observable<Entity> observable = manager.write( newEntity ); + Entity returned = observable.toBlocking().lastOrDefault( null ); } -// try { -// //newEntity = new Entity( new SimpleId( "test" ) ); -// //newEntity.setField( new IntegerField( "count", 5, true ) ); -// -// Observable<Entity> secondWrite = manager.write( entity ); -// secondReturned = secondWrite.toBlocking().lastOrDefault( null ); -// -// //fail( "Write should have thrown an exception" ); -// } -// catch ( Exception ex ) { -// WriteUniqueVerifyException e = ( WriteUniqueVerifyException ) ex; -// assertEquals( 1, e.getVioliations().size() ); -// } - - // try fetching the original one again - - assertEquals(entity.getId().getUuid(), firstReturned.getId().getUuid()); - assertEquals(entity.getVersion(), firstReturned.getVersion()); - - - //assertEquals(newEntity.getId().getUuid(), secondReturned.getId().getUuid()); - //assertEquals(newEntity.getVersion(), secondReturned.getVersion()); - - - - - - + { + try { + Entity newEntity = new Entity( new SimpleId( "test" ) ); + newEntity.setField( new IntegerField( "count", 5, true ) ); + + manager.write( newEntity ).toBlocking().last(); + fail( "Write should have thrown an exception" ); + } + catch ( Exception ex ) { + WriteUniqueVerifyException e = ( WriteUniqueVerifyException ) ex; + assertEquals( 1, e.getVioliations().size() ); + } + } }
