You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by to...@apache.org on 2013/12/05 01:55:31 UTC
[5/6] Commit after refactor. Need to evaluate an event bus in guava
instead of using coupled stages
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/44072d59/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/write/Update.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/write/Update.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/write/Update.java
new file mode 100644
index 0000000..0175b42
--- /dev/null
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/write/Update.java
@@ -0,0 +1,70 @@
+package org.apache.usergrid.persistence.collection.mvcc.stage.impl.write;
+
+
+import java.util.UUID;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.usergrid.persistence.collection.mvcc.stage.ExecutionContext;
+import org.apache.usergrid.persistence.collection.mvcc.stage.ExecutionStage;
+import org.apache.usergrid.persistence.collection.service.TimeService;
+import org.apache.usergrid.persistence.collection.service.UUIDService;
+import org.apache.usergrid.persistence.model.entity.Entity;
+
+import com.google.common.base.Preconditions;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+
+
+/**
+ * This stage performs the initial commit log and write of an entity. It assumes the entity id and created has already
+ * been set correctly
+ */
+@Singleton
+public class Update implements ExecutionStage {
+
+ private static final Logger LOG = LoggerFactory.getLogger( Update.class );
+
+ private final TimeService timeService;
+ private final UUIDService uuidService;
+
+
+ @Inject
+ public Update( final TimeService timeService, final UUIDService uuidService ) {
+ Preconditions.checkNotNull( timeService, "timeService is required" );
+ Preconditions.checkNotNull( uuidService, "uuidService is required" );
+
+ this.timeService = timeService;
+ this.uuidService = uuidService;
+ }
+
+
+ /**
+ * Create the entity Id and inject it, as well as set the timestamp versions
+ *
+ * @param executionContext The context of the current write operation
+ */
+ @Override
+ public void performStage( final ExecutionContext executionContext ) {
+
+ final Entity entity = executionContext.getMessage( Entity.class );
+
+ Preconditions.checkNotNull( entity, "Entity is required in the new stage of the mvcc write" );
+
+ final UUID entityId = entity.getUuid();
+
+ Preconditions.checkNotNull( entityId, "The entity id is required to be set for an update operation" );
+
+
+ final UUID version = uuidService.newTimeUUID();
+ final long updated = timeService.getTime();
+
+
+ entity.setVersion( version );
+ entity.setUpdated( updated );
+
+ executionContext.setMessage( entity );
+ executionContext.proceed();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/44072d59/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/write/Verify.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/write/Verify.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/write/Verify.java
new file mode 100644
index 0000000..884c59b
--- /dev/null
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/write/Verify.java
@@ -0,0 +1,25 @@
+package org.apache.usergrid.persistence.collection.mvcc.stage.impl.write;
+
+
+import org.apache.usergrid.persistence.collection.mvcc.stage.ExecutionStage;
+import org.apache.usergrid.persistence.collection.mvcc.stage.ExecutionContext;
+
+import com.google.inject.Singleton;
+
+
+/** This phase should execute any verification on the MvccEntity */
+@Singleton
+public class Verify implements ExecutionStage {
+
+
+ public Verify() {
+ }
+
+
+ @Override
+ public void performStage( final ExecutionContext executionContext ) {
+ //TODO no op for now, just continue to the next stage. Verification logic goes in here
+
+ executionContext.proceed();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/44072d59/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/write/WriteContextCallback.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/write/WriteContextCallback.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/write/WriteContextCallback.java
new file mode 100644
index 0000000..87f7702
--- /dev/null
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/write/WriteContextCallback.java
@@ -0,0 +1,59 @@
+package org.apache.usergrid.persistence.collection.mvcc.stage.impl.write;
+
+
+import org.apache.usergrid.persistence.collection.exception.CollectionRuntimeException;
+import org.apache.usergrid.persistence.collection.mvcc.stage.ExecutionContext;
+
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.netflix.astyanax.connectionpool.OperationResult;
+
+
+/**
+ * Helper class to cause the async execution to continue
+ * Not used ATM, just here for demonstration purposes with async astynax invocation on phase proceed
+ *
+ * @author tnine
+ */
+public class WriteContextCallback implements FutureCallback<OperationResult<Void>> {
+
+ private final ExecutionContext context;
+
+
+ /** Create a new callback. The data will be passed to the next stage */
+ private WriteContextCallback( final ExecutionContext context ) {
+ this.context = context;
+ }
+
+
+ public void onSuccess( final OperationResult<Void> result ) {
+
+ /**
+ * Proceed to the next stage
+ */
+ context.proceed();
+ }
+
+
+ @Override
+ public void onFailure( final Throwable t ) {
+// context.stop();
+ throw new CollectionRuntimeException( "Failed to execute write", t );
+ }
+
+
+ /**
+ * This encapsulated type of Void in the listenable future is intentional. If you're not returning void in your
+ * future, you shouldn't be using this callback, you should be using a callback that will set the Response value
+ * into the next stage and invoke it
+ *
+ * @param future The listenable future returned by the Astyanax async op
+ * @param context The context to signal to continue in the callback
+ */
+ public static void createCallback( final ListenableFuture<OperationResult<Void>> future,
+ final ExecutionContext context ) {
+
+ Futures.addCallback( future, new WriteContextCallback( context ) );
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/44072d59/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/MvccEntitySerializationStrategy.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/MvccEntitySerializationStrategy.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/MvccEntitySerializationStrategy.java
index f3350ad..4aefbae 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/MvccEntitySerializationStrategy.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/MvccEntitySerializationStrategy.java
@@ -52,7 +52,7 @@ public interface MvccEntitySerializationStrategy
/**
- * Clear this version from the persistence store, but keep the version to mark that is has been cleared
+ * Delete this version from the persistence store, but keep the version to mark that is has been cleared
* This can be used in a mark+sweep system. The entity with the given version will exist in the context,
* but no data will be stored
*
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/44072d59/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/CollectionManagerTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/CollectionManagerTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/CollectionManagerTest.java
index 9028cbf..fed0663 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/CollectionManagerTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/CollectionManagerTest.java
@@ -6,8 +6,10 @@ import org.mockito.ArgumentCaptor;
import org.apache.usergrid.persistence.collection.impl.CollectionContextImpl;
import org.apache.usergrid.persistence.collection.impl.CollectionManagerImpl;
+import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
+import org.apache.usergrid.persistence.collection.mvcc.entity.impl.MvccEntityImpl;
import org.apache.usergrid.persistence.collection.mvcc.stage.ExecutionContext;
-import org.apache.usergrid.persistence.collection.mvcc.stage.Stage;
+import org.apache.usergrid.persistence.collection.mvcc.stage.ExecutionStage;
import org.apache.usergrid.persistence.collection.mvcc.stage.StagePipeline;
import org.apache.usergrid.persistence.model.entity.Entity;
import org.apache.usergrid.persistence.model.util.UUIDGenerator;
@@ -26,7 +28,7 @@ public class CollectionManagerTest {
@Test
public void create(){
- Stage mockStage = mock(Stage.class);
+ ExecutionStage mockExecutionStage = mock(ExecutionStage.class);
StagePipeline createPipeline = mock(StagePipeline.class);
StagePipeline updatePipeline = mock(StagePipeline.class);
@@ -36,7 +38,7 @@ public class CollectionManagerTest {
//mock up returning the first stage
- when(createPipeline.first()).thenReturn(mockStage);
+ when(createPipeline.first()).thenReturn( mockExecutionStage );
CollectionContext context = new CollectionContextImpl( UUIDGenerator.newTimeUUID(), UUIDGenerator.newTimeUUID(), "test" );
@@ -45,6 +47,9 @@ public class CollectionManagerTest {
Entity create = new Entity();
+ MvccEntity mvccEntity = mock(MvccEntity.class);
+
+
Entity returned = collectionManager.create( create );
//verify the first stage was asked for
@@ -53,7 +58,7 @@ public class CollectionManagerTest {
ArgumentCaptor<ExecutionContext> contextArg = ArgumentCaptor.forClass(ExecutionContext.class);
//verify the first perform stage was invoked
- verify(mockStage).performStage( contextArg.capture() );
+ verify( mockExecutionStage ).performStage( contextArg.capture() );
//verify we set the passed entity into the ExecutionContext
assertEquals("Entity should be present in the write context", create, contextArg.getValue().getMessage( Entity.class ));
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/44072d59/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/ExecutionContextTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/ExecutionContextTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/ExecutionContextTest.java
index 4b917e4..1730107 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/ExecutionContextTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/ExecutionContextTest.java
@@ -24,9 +24,9 @@ public class ExecutionContextTest {
StagePipeline pipeline = mock( StagePipeline.class );
- Stage stage = mock( Stage.class );
+ ExecutionStage executionStage = mock( ExecutionStage.class );
- when( pipeline.first() ).thenReturn( stage );
+ when( pipeline.first() ).thenReturn( executionStage );
ExecutionContext executionContext = new ExecutionContextImpl( pipeline, collectionContext );
@@ -37,8 +37,8 @@ public class ExecutionContextTest {
//verify we called first in the pipeline to get the first value
verify( pipeline ).first();
- //verify the first stage was invoked
- verify( stage ).performStage( same( executionContext ) );
+ //verify the first executionStage was invoked
+ verify( executionStage ).performStage( same( executionContext ) );
//verify the bean value was set
assertSame( test, executionContext.getMessage( Object.class ) );
@@ -127,14 +127,14 @@ public class ExecutionContextTest {
StagePipeline pipeline = mock( StagePipeline.class );
- Stage firstStage = mock( Stage.class );
+ ExecutionStage firstExecutionStage = mock( ExecutionStage.class );
- Stage secondStage = mock( Stage.class );
+ ExecutionStage secondExecutionStage = mock( ExecutionStage.class );
- when( pipeline.first() ).thenReturn( firstStage );
+ when( pipeline.first() ).thenReturn( firstExecutionStage );
- when( pipeline.nextStage( same( firstStage ) ) ).thenReturn( secondStage );
+ when( pipeline.nextStage( same( firstExecutionStage ) ) ).thenReturn( secondExecutionStage );
ExecutionContext executionContext = new ExecutionContextImpl( pipeline, collectionContext );
@@ -146,7 +146,7 @@ public class ExecutionContextTest {
//now proceed and validate we were called
executionContext.proceed();
- verify( secondStage ).performStage( same( executionContext ) );
+ verify( secondExecutionStage ).performStage( same( executionContext ) );
}
@@ -157,11 +157,11 @@ public class ExecutionContextTest {
StagePipeline pipeline = mock( StagePipeline.class );
- Stage firstStage = mock( Stage.class );
+ ExecutionStage firstExecutionStage = mock( ExecutionStage.class );
- when( pipeline.first() ).thenReturn( firstStage );
+ when( pipeline.first() ).thenReturn( firstExecutionStage );
- when( pipeline.nextStage( same( firstStage ) ) ).thenReturn( null );
+ when( pipeline.nextStage( same( firstExecutionStage ) ) ).thenReturn( null );
ExecutionContext executionContext = new ExecutionContextImpl( pipeline, collectionContext );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/44072d59/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/StagePipelineTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/StagePipelineTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/StagePipelineTest.java
index 6f0fa35..86a2a3a 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/StagePipelineTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/StagePipelineTest.java
@@ -15,13 +15,13 @@ public class StagePipelineTest {
@Test
public void oneStage() {
- Stage first = mock( Stage.class );
+ ExecutionStage first = mock( ExecutionStage.class );
StagePipeline pipeline = StagePipelineImpl.fromStages( first );
assertSame( "Correct stage returned", first, pipeline.first() );
- Stage next = pipeline.nextStage( first );
+ ExecutionStage next = pipeline.nextStage( first );
assertNull( "No next stage", next );
}
@@ -29,15 +29,15 @@ public class StagePipelineTest {
@Test
public void threeStages() {
- Stage first = mock( Stage.class );
- Stage second = mock( Stage.class );
- Stage third = mock( Stage.class );
+ ExecutionStage first = mock( ExecutionStage.class );
+ ExecutionStage second = mock( ExecutionStage.class );
+ ExecutionStage third = mock( ExecutionStage.class );
StagePipeline pipeline = StagePipelineImpl.fromStages( first, second, third );
assertSame( "Correct stage returned", first, pipeline.first() );
- Stage next = pipeline.nextStage( first );
+ ExecutionStage next = pipeline.nextStage( first );
assertSame( "Correct stage returned", second, next );
@@ -56,14 +56,14 @@ public class StagePipelineTest {
*/
@Test
public void stageSeek() {
- Stage first = mock( Stage.class );
- Stage second = mock( Stage.class );
- Stage third = mock( Stage.class );
+ ExecutionStage first = mock( ExecutionStage.class );
+ ExecutionStage second = mock( ExecutionStage.class );
+ ExecutionStage third = mock( ExecutionStage.class );
StagePipeline pipeline = StagePipelineImpl.fromStages( first, second, third );
- Stage next = pipeline.nextStage( second );
+ ExecutionStage next = pipeline.nextStage( second );
assertSame( "Correct stage returned", third, next );
@@ -75,7 +75,7 @@ public class StagePipelineTest {
@Test( expected = NullPointerException.class )
public void invalidStageInput() {
- Stage first = mock( Stage.class );
+ ExecutionStage first = mock( ExecutionStage.class );
StagePipeline pipeline = StagePipelineImpl.fromStages( first );
pipeline.nextStage( null );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/44072d59/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/CreateTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/CreateTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/CreateTest.java
deleted file mode 100644
index 4547c80..0000000
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/CreateTest.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package org.apache.usergrid.persistence.collection.mvcc.stage.impl;
-
-
-import java.util.UUID;
-import java.util.concurrent.ExecutionException;
-
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-
-import org.apache.usergrid.persistence.collection.mvcc.stage.ExecutionContext;
-import org.apache.usergrid.persistence.collection.service.TimeService;
-import org.apache.usergrid.persistence.collection.service.UUIDService;
-import org.apache.usergrid.persistence.model.entity.Entity;
-import org.apache.usergrid.persistence.model.util.UUIDGenerator;
-
-import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-
-/** @author tnine */
-public class CreateTest {
-
- /** Test the start stage for happy path */
- @Test
- public void testValidInput() throws ConnectionException, ExecutionException, InterruptedException {
-
- final ExecutionContext executionContext = mock( ExecutionContext.class );
-
-
- //set up the mock to return the entity from the start phase
- final Entity entity = new Entity();
-
- when( executionContext.getMessage( Entity.class ) ).thenReturn( entity );
-
-
- //mock returning the time
- final TimeService timeService = mock( TimeService.class );
-
- final long time = System.currentTimeMillis();
-
- when( timeService.getTime() ).thenReturn( time );
-
-
- //mock the uuid service
- final UUIDService uuidService = mock( UUIDService.class );
-
- final UUID newEntityId = UUIDGenerator.newTimeUUID();
- final UUID newVersion = newEntityId;
-
-
- //mock the uuid service
- when( uuidService.newTimeUUID() ).thenReturn( newEntityId );
-
-
- //perform the stage
- final Create create = new Create( timeService, uuidService );
-
- create.performStage( executionContext );
-
-
- //now verify our output was correct
- ArgumentCaptor<Entity> mvccEntity = ArgumentCaptor.forClass( Entity.class );
-
-
- verify( executionContext ).setMessage( mvccEntity.capture() );
-
- Entity created = mvccEntity.getValue();
-
- //verify uuid and version in both the MvccEntity and the entity itself
- assertEquals( "Entity re-set into context", entity, created );
- assertEquals( "entity id did not match generator", newEntityId, created.getUuid() );
- assertEquals( "version did not not match entityId", newVersion, created.getVersion() );
-
- //check the time
- assertEquals( "created time matches generator", time, created.getCreated() );
- assertEquals( "updated time matches generator", time, created.getUpdated() );
-
-
- //now verify the proceed was called
- verify( executionContext ).proceed();
- }
-
-
- /** Test the start stage for happy path */
- @Test(expected = NullPointerException.class)
- public void testInvalidInput() throws ConnectionException, ExecutionException, InterruptedException {
-
- final ExecutionContext executionContext = mock( ExecutionContext.class );
-
-
- when( executionContext.getMessage( Entity.class ) ).thenReturn( null );
-
-
- //mock returning the time
- final TimeService timeService = mock( TimeService.class );
-
-
- //mock the uuid service
- final UUIDService uuidService = mock( UUIDService.class );
-
-
- //perform the stage
- final Create create = new Create( timeService, uuidService );
-
- //should throw an NPE
- create.performStage( executionContext );
-
-
- }
-
-
- /** Test no time service */
- @Test(expected = NullPointerException.class)
- public void testNoTimeService() throws ConnectionException, ExecutionException, InterruptedException {
-
- final ExecutionContext executionContext = mock( ExecutionContext.class );
-
-
- when( executionContext.getMessage( Entity.class ) ).thenReturn( null );
-
-
- //mock the uuid service
- final UUIDService uuidService = mock( UUIDService.class );
-
-
- //perform the stage
- new Create( null, uuidService );
- }
-
-
- /** Test no time service */
- @Test(expected = NullPointerException.class)
- public void testNoUUIDService() throws ConnectionException, ExecutionException, InterruptedException {
-
- final ExecutionContext executionContext = mock( ExecutionContext.class );
-
-
- when( executionContext.getMessage( Entity.class ) ).thenReturn( null );
-
-
- //mock returning the time
- final TimeService timeService = mock( TimeService.class );
-
-
- //throw NPE
- new Create( timeService, null );
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/44072d59/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/StartWriteTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/StartWriteTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/StartWriteTest.java
deleted file mode 100644
index d7a6b46..0000000
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/StartWriteTest.java
+++ /dev/null
@@ -1,187 +0,0 @@
-package org.apache.usergrid.persistence.collection.mvcc.stage.impl;
-
-
-import java.util.UUID;
-
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-
-import org.apache.commons.lang3.reflect.FieldUtils;
-
-import org.apache.usergrid.persistence.collection.CollectionContext;
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccLogEntry;
-import org.apache.usergrid.persistence.collection.mvcc.entity.Stage;
-import org.apache.usergrid.persistence.collection.mvcc.stage.ExecutionContext;
-import org.apache.usergrid.persistence.collection.serialization.MvccLogEntrySerializationStrategy;
-import org.apache.usergrid.persistence.model.entity.Entity;
-import org.apache.usergrid.persistence.model.util.UUIDGenerator;
-
-import com.netflix.astyanax.MutationBatch;
-
-import static junit.framework.TestCase.assertSame;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.same;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-
-/** @author tnine */
-public class StartWriteTest {
-
- /** Standard flow */
- @Test
- public void testStartStage() throws Exception {
-
-
- final ExecutionContext executionContext = mock( ExecutionContext.class );
- final CollectionContext context = mock( CollectionContext.class );
-
-
- //mock returning the context
- when( executionContext.getCollectionContext() ).thenReturn( context );
-
-
- //set up the mock to return the entity from the start phase
- final Entity entity = generateEntity();
-
- //mock returning the entity from the write context
- when( executionContext.getMessage( Entity.class ) ).thenReturn( entity );
-
-
- //mock returning a mock mutation when we do a log entry write
- final MvccLogEntrySerializationStrategy logStrategy = mock( MvccLogEntrySerializationStrategy.class );
-
- final ArgumentCaptor<MvccLogEntry> logEntry = ArgumentCaptor.forClass( MvccLogEntry.class );
-
- final MutationBatch mutation = mock( MutationBatch.class );
-
- when( logStrategy.write( same( context ), logEntry.capture() ) ).thenReturn( mutation );
-
-
- //run the stage
- StartWrite newStage = new StartWrite( logStrategy );
-
- newStage.performStage( executionContext );
-
-
- //now verify our output was correct
- ArgumentCaptor<MvccEntity> mvccEntity = ArgumentCaptor.forClass( MvccEntity.class );
-
-
- //verify the log entry is correct
- MvccLogEntry entry = logEntry.getValue();
-
- assertEquals( "entity id did not match ", entity.getUuid(), entry.getEntityId() );
- assertEquals( "version did not not match entityId", entity.getVersion(), entry.getVersion() );
- assertEquals( "Stage is correct", Stage.ACTIVE, entry.getStage() );
-
-
- //now verify we set the message into the write context
- verify( executionContext ).setMessage( mvccEntity.capture() );
-
- MvccEntity created = mvccEntity.getValue();
-
- //verify uuid and version in both the MvccEntity and the entity itself
- assertEquals( "entity id did not match generator", entity.getUuid(), created.getUuid() );
- assertEquals( "version did not not match entityId", entity.getVersion(), created.getVersion() );
- assertSame( "Entity correct", entity, created.getEntity().get() );
-
-
- //now verify the proceed was called
- verify( executionContext ).proceed();
- }
-
-
- /** Test no entity in the pipeline */
- @Test( expected = NullPointerException.class )
- public void testNoEntity() throws Exception {
-
-
- final ExecutionContext executionContext = mock( ExecutionContext.class );
-
-
- //mock returning the entity from the write context
- when( executionContext.getMessage( Entity.class ) ).thenReturn( null );
-
-
- //mock returning a mock mutation when we do a log entry write
- final MvccLogEntrySerializationStrategy logStrategy = mock( MvccLogEntrySerializationStrategy.class );
-
- //run the stage
- StartWrite newStage = new StartWrite( logStrategy );
-
- newStage.performStage( executionContext );
- }
-
-
- /** Test no entity id on the entity */
- @Test( expected = NullPointerException.class )
- public void testNoEntityId() throws Exception {
-
-
- final ExecutionContext executionContext = mock( ExecutionContext.class );
-
-
- final Entity entity = new Entity();
- final UUID version = UUIDGenerator.newTimeUUID();
-
- entity.setVersion( version );
-
- //mock returning the entity from the write context
- when( executionContext.getMessage( Entity.class ) ).thenReturn( entity );
-
-
- //mock returning a mock mutation when we do a log entry write
- final MvccLogEntrySerializationStrategy logStrategy = mock( MvccLogEntrySerializationStrategy.class );
-
- //run the stage
- StartWrite newStage = new StartWrite( logStrategy );
-
- newStage.performStage( executionContext );
- }
-
-
- /** Test no entity id on the entity */
- @Test( expected = NullPointerException.class )
- public void testNoEntityVersion() throws Exception {
-
-
- final ExecutionContext executionContext = mock( ExecutionContext.class );
-
-
- final Entity entity = new Entity();
- final UUID entityId = UUIDGenerator.newTimeUUID();
-
-
- FieldUtils.writeDeclaredField( entity, "uuid", entityId, true );
-
-
- //mock returning the entity from the write context
- when( executionContext.getMessage( Entity.class ) ).thenReturn( entity );
-
-
- //mock returning a mock mutation when we do a log entry write
- final MvccLogEntrySerializationStrategy logStrategy = mock( MvccLogEntrySerializationStrategy.class );
-
- //run the stage
- StartWrite newStage = new StartWrite( logStrategy );
-
- newStage.performStage( executionContext );
- }
-
-
- private Entity generateEntity() throws IllegalAccessException {
- final Entity entity = new Entity();
- final UUID entityId = UUIDGenerator.newTimeUUID();
- final UUID version = UUIDGenerator.newTimeUUID();
-
- FieldUtils.writeDeclaredField( entity, "uuid", entityId, true );
- entity.setVersion( version );
-
- return entity;
- }
-}
-
-
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/44072d59/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/write/CreateTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/write/CreateTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/write/CreateTest.java
new file mode 100644
index 0000000..41152c1
--- /dev/null
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/write/CreateTest.java
@@ -0,0 +1,153 @@
+package org.apache.usergrid.persistence.collection.mvcc.stage.impl.write;
+
+
+import java.util.UUID;
+import java.util.concurrent.ExecutionException;
+
+import org.junit.Test;
+import org.mockito.ArgumentCaptor;
+
+import org.apache.usergrid.persistence.collection.mvcc.stage.ExecutionContext;
+import org.apache.usergrid.persistence.collection.mvcc.stage.impl.write.Create;
+import org.apache.usergrid.persistence.collection.service.TimeService;
+import org.apache.usergrid.persistence.collection.service.UUIDService;
+import org.apache.usergrid.persistence.model.entity.Entity;
+import org.apache.usergrid.persistence.model.util.UUIDGenerator;
+
+import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+
+/** @author tnine */
+public class CreateTest {
+
+ /** Test the start stage for happy path */
+ @Test
+ public void testValidInput() throws ConnectionException, ExecutionException, InterruptedException {
+
+ final ExecutionContext executionContext = mock( ExecutionContext.class );
+
+
+ //set up the mock to return the entity from the start phase
+ final Entity entity = new Entity();
+
+ when( executionContext.getMessage( Entity.class ) ).thenReturn( entity );
+
+
+ //mock returning the time
+ final TimeService timeService = mock( TimeService.class );
+
+ final long time = System.currentTimeMillis();
+
+ when( timeService.getTime() ).thenReturn( time );
+
+
+ //mock the uuid service
+ final UUIDService uuidService = mock( UUIDService.class );
+
+ final UUID newEntityId = UUIDGenerator.newTimeUUID();
+ final UUID newVersion = newEntityId;
+
+
+ //mock the uuid service
+ when( uuidService.newTimeUUID() ).thenReturn( newEntityId );
+
+
+ //perform the stage
+ final Create create = new Create( timeService, uuidService );
+
+ create.performStage( executionContext );
+
+
+ //now verify our output was correct
+ ArgumentCaptor<Entity> mvccEntity = ArgumentCaptor.forClass( Entity.class );
+
+
+ verify( executionContext ).setMessage( mvccEntity.capture() );
+
+ Entity created = mvccEntity.getValue();
+
+ //verify uuid and version in both the MvccEntity and the entity itself
+ assertEquals( "Entity re-set into context", entity, created );
+ assertEquals( "entity id did not match generator", newEntityId, created.getUuid() );
+ assertEquals( "version did not not match entityId", newVersion, created.getVersion() );
+
+ //check the time
+ assertEquals( "created time matches generator", time, created.getCreated() );
+ assertEquals( "updated time matches generator", time, created.getUpdated() );
+
+
+ //now verify the proceed was called
+ verify( executionContext ).proceed();
+ }
+
+
+ /** Test the start stage for happy path */
+ @Test(expected = NullPointerException.class)
+ public void testInvalidInput() throws ConnectionException, ExecutionException, InterruptedException {
+
+ final ExecutionContext executionContext = mock( ExecutionContext.class );
+
+
+ when( executionContext.getMessage( Entity.class ) ).thenReturn( null );
+
+
+ //mock returning the time
+ final TimeService timeService = mock( TimeService.class );
+
+
+ //mock the uuid service
+ final UUIDService uuidService = mock( UUIDService.class );
+
+
+ //perform the stage
+ final Create create = new Create( timeService, uuidService );
+
+ //should throw an NPE
+ create.performStage( executionContext );
+
+
+ }
+
+
+ /** Test no time service */
+ @Test(expected = NullPointerException.class)
+ public void testNoTimeService() throws ConnectionException, ExecutionException, InterruptedException {
+
+ final ExecutionContext executionContext = mock( ExecutionContext.class );
+
+
+ when( executionContext.getMessage( Entity.class ) ).thenReturn( null );
+
+
+ //mock the uuid service
+ final UUIDService uuidService = mock( UUIDService.class );
+
+
+ //perform the stage
+ new Create( null, uuidService );
+ }
+
+
+ /** Test no time service */
+ @Test(expected = NullPointerException.class)
+ public void testNoUUIDService() throws ConnectionException, ExecutionException, InterruptedException {
+
+ final ExecutionContext executionContext = mock( ExecutionContext.class );
+
+
+ when( executionContext.getMessage( Entity.class ) ).thenReturn( null );
+
+
+ //mock returning the time
+ final TimeService timeService = mock( TimeService.class );
+
+
+ //throw NPE
+ new Create( timeService, null );
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/44072d59/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/write/StartWriteTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/write/StartWriteTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/write/StartWriteTest.java
new file mode 100644
index 0000000..006dda9
--- /dev/null
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/write/StartWriteTest.java
@@ -0,0 +1,188 @@
+package org.apache.usergrid.persistence.collection.mvcc.stage.impl.write;
+
+
+import java.util.UUID;
+
+import org.junit.Test;
+import org.mockito.ArgumentCaptor;
+
+import org.apache.commons.lang3.reflect.FieldUtils;
+
+import org.apache.usergrid.persistence.collection.CollectionContext;
+import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
+import org.apache.usergrid.persistence.collection.mvcc.entity.MvccLogEntry;
+import org.apache.usergrid.persistence.collection.mvcc.entity.Stage;
+import org.apache.usergrid.persistence.collection.mvcc.stage.ExecutionContext;
+import org.apache.usergrid.persistence.collection.mvcc.stage.impl.write.StartWrite;
+import org.apache.usergrid.persistence.collection.serialization.MvccLogEntrySerializationStrategy;
+import org.apache.usergrid.persistence.model.entity.Entity;
+import org.apache.usergrid.persistence.model.util.UUIDGenerator;
+
+import com.netflix.astyanax.MutationBatch;
+
+import static junit.framework.TestCase.assertSame;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.same;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+
+/** @author tnine */
+public class StartWriteTest {
+
+ /** Standard flow */
+ @Test
+ public void testStartStage() throws Exception {
+
+
+ final ExecutionContext executionContext = mock( ExecutionContext.class );
+ final CollectionContext context = mock( CollectionContext.class );
+
+
+ //mock returning the context
+ when( executionContext.getCollectionContext() ).thenReturn( context );
+
+
+ //set up the mock to return the entity from the start phase
+ final Entity entity = generateEntity();
+
+ //mock returning the entity from the write context
+ when( executionContext.getMessage( Entity.class ) ).thenReturn( entity );
+
+
+ //mock returning a mock mutation when we do a log entry write
+ final MvccLogEntrySerializationStrategy logStrategy = mock( MvccLogEntrySerializationStrategy.class );
+
+ final ArgumentCaptor<MvccLogEntry> logEntry = ArgumentCaptor.forClass( MvccLogEntry.class );
+
+ final MutationBatch mutation = mock( MutationBatch.class );
+
+ when( logStrategy.write( same( context ), logEntry.capture() ) ).thenReturn( mutation );
+
+
+ //run the stage
+ StartWrite newStage = new StartWrite( logStrategy );
+
+ newStage.performStage( executionContext );
+
+
+ //now verify our output was correct
+ ArgumentCaptor<MvccEntity> mvccEntity = ArgumentCaptor.forClass( MvccEntity.class );
+
+
+ //verify the log entry is correct
+ MvccLogEntry entry = logEntry.getValue();
+
+ assertEquals( "entity id did not match ", entity.getUuid(), entry.getEntityId() );
+ assertEquals( "version did not not match entityId", entity.getVersion(), entry.getVersion() );
+ assertEquals( "ExecutionStage is correct", Stage.ACTIVE, entry.getStage() );
+
+
+ //now verify we set the message into the write context
+ verify( executionContext ).setMessage( mvccEntity.capture() );
+
+ MvccEntity created = mvccEntity.getValue();
+
+ //verify uuid and version in both the MvccEntity and the entity itself
+ assertEquals( "entity id did not match generator", entity.getUuid(), created.getUuid() );
+ assertEquals( "version did not not match entityId", entity.getVersion(), created.getVersion() );
+ assertSame( "Entity correct", entity, created.getEntity().get() );
+
+
+ //now verify the proceed was called
+ verify( executionContext ).proceed();
+ }
+
+
+ /** Test no entity in the pipeline */
+ @Test( expected = NullPointerException.class )
+ public void testNoEntity() throws Exception {
+
+
+ final ExecutionContext executionContext = mock( ExecutionContext.class );
+
+
+ //mock returning the entity from the write context
+ when( executionContext.getMessage( Entity.class ) ).thenReturn( null );
+
+
+ //mock returning a mock mutation when we do a log entry write
+ final MvccLogEntrySerializationStrategy logStrategy = mock( MvccLogEntrySerializationStrategy.class );
+
+ //run the stage
+ StartWrite newStage = new StartWrite( logStrategy );
+
+ newStage.performStage( executionContext );
+ }
+
+
+ /** Test no entity id on the entity */
+ @Test( expected = NullPointerException.class )
+ public void testNoEntityId() throws Exception {
+
+
+ final ExecutionContext executionContext = mock( ExecutionContext.class );
+
+
+ final Entity entity = new Entity();
+ final UUID version = UUIDGenerator.newTimeUUID();
+
+ entity.setVersion( version );
+
+ //mock returning the entity from the write context
+ when( executionContext.getMessage( Entity.class ) ).thenReturn( entity );
+
+
+ //mock returning a mock mutation when we do a log entry write
+ final MvccLogEntrySerializationStrategy logStrategy = mock( MvccLogEntrySerializationStrategy.class );
+
+ //run the stage
+ StartWrite newStage = new StartWrite( logStrategy );
+
+ newStage.performStage( executionContext );
+ }
+
+
+ /** Test no entity id on the entity */
+ @Test( expected = NullPointerException.class )
+ public void testNoEntityVersion() throws Exception {
+
+
+ final ExecutionContext executionContext = mock( ExecutionContext.class );
+
+
+ final Entity entity = new Entity();
+ final UUID entityId = UUIDGenerator.newTimeUUID();
+
+
+ FieldUtils.writeDeclaredField( entity, "uuid", entityId, true );
+
+
+ //mock returning the entity from the write context
+ when( executionContext.getMessage( Entity.class ) ).thenReturn( entity );
+
+
+ //mock returning a mock mutation when we do a log entry write
+ final MvccLogEntrySerializationStrategy logStrategy = mock( MvccLogEntrySerializationStrategy.class );
+
+ //run the stage
+ StartWrite newStage = new StartWrite( logStrategy );
+
+ newStage.performStage( executionContext );
+ }
+
+
+ private Entity generateEntity() throws IllegalAccessException {
+ final Entity entity = new Entity();
+ final UUID entityId = UUIDGenerator.newTimeUUID();
+ final UUID version = UUIDGenerator.newTimeUUID();
+
+ FieldUtils.writeDeclaredField( entity, "uuid", entityId, true );
+ entity.setVersion( version );
+
+ return entity;
+ }
+}
+
+
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/44072d59/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/write/UpdateTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/write/UpdateTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/write/UpdateTest.java
new file mode 100644
index 0000000..24ec265
--- /dev/null
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/write/UpdateTest.java
@@ -0,0 +1,189 @@
+package org.apache.usergrid.persistence.collection.mvcc.stage.impl.write;
+
+
+import java.util.UUID;
+import java.util.concurrent.ExecutionException;
+
+import org.junit.Test;
+import org.mockito.ArgumentCaptor;
+
+import org.apache.commons.lang3.reflect.FieldUtils;
+
+import org.apache.usergrid.persistence.collection.mvcc.stage.ExecutionContext;
+import org.apache.usergrid.persistence.collection.service.TimeService;
+import org.apache.usergrid.persistence.collection.service.UUIDService;
+import org.apache.usergrid.persistence.model.entity.Entity;
+import org.apache.usergrid.persistence.model.util.UUIDGenerator;
+
+import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+
+/** @author tnine */
+public class UpdateTest {
+
+
+ /** Test the start stage for happy path */
+ @Test
+ public void testValidInput() throws Exception {
+
+ final ExecutionContext executionContext = mock( ExecutionContext.class );
+
+
+ //set up the mock to return the entity from the start phase
+ final Entity entity = new Entity();
+ final UUID existingEntityId = UUIDGenerator.newTimeUUID();
+ final long createdTime = 100;
+
+ FieldUtils.writeDeclaredField( entity, "uuid", existingEntityId, true );
+ entity.setCreated( createdTime );
+
+
+ when( executionContext.getMessage( Entity.class ) ).thenReturn( entity );
+
+
+ //mock returning the time
+ final TimeService timeService = mock( TimeService.class );
+
+ final long updateTime = System.currentTimeMillis();
+
+ when( timeService.getTime() ).thenReturn( updateTime );
+
+
+ //mock the uuid service
+ final UUIDService uuidService = mock( UUIDService.class );
+
+
+ final UUID newVersion = UUIDGenerator.newTimeUUID();
+
+
+ //mock the uuid service
+ when( uuidService.newTimeUUID() ).thenReturn( newVersion );
+
+
+ //perform the stage
+ final Update create = new Update( timeService, uuidService );
+
+
+ create.performStage( executionContext );
+
+
+ //now verify our output was correct
+ ArgumentCaptor<Entity> mvccEntity = ArgumentCaptor.forClass( Entity.class );
+
+
+ verify( executionContext ).setMessage( mvccEntity.capture() );
+
+ Entity created = mvccEntity.getValue();
+
+ //verify uuid and version in both the MvccEntity and the entity itself
+ assertEquals( "Entity re-set into context", entity, created );
+ assertEquals( "entity id did not match generator", existingEntityId, created.getUuid() );
+ assertEquals( "version did not not match entityId", newVersion, created.getVersion() );
+
+ //check the time
+ assertEquals( "created time matches generator", createdTime, created.getCreated() );
+ assertEquals( "updated time matches generator", updateTime, created.getUpdated() );
+
+
+ //now verify the proceed was called
+ verify( executionContext ).proceed();
+ }
+
+
+ /** Test the start stage for happy path */
+ @Test(expected = NullPointerException.class)
+ public void testInvalidInput() throws ConnectionException, ExecutionException, InterruptedException {
+
+ final ExecutionContext executionContext = mock( ExecutionContext.class );
+
+
+ when( executionContext.getMessage( Entity.class ) ).thenReturn( null );
+
+
+ //mock returning the time
+ final TimeService timeService = mock( TimeService.class );
+
+
+ //mock the uuid service
+ final UUIDService uuidService = mock( UUIDService.class );
+
+
+ //perform the stage
+ final Update create = new Update( timeService, uuidService );
+
+ //should throw an NPE
+ create.performStage( executionContext );
+
+
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testInvalidInputNoId() throws ConnectionException, ExecutionException, InterruptedException {
+
+ final ExecutionContext executionContext = mock( ExecutionContext.class );
+
+
+ when( executionContext.getMessage( Entity.class ) ).thenReturn( new Entity( ) );
+
+
+ //mock returning the time
+ final TimeService timeService = mock( TimeService.class );
+
+
+ //mock the uuid service
+ final UUIDService uuidService = mock( UUIDService.class );
+
+
+ //perform the stage
+ final Update create = new Update( timeService, uuidService );
+
+ //should throw an NPE
+ create.performStage( executionContext );
+
+
+ }
+
+
+ /** Test no time service */
+ @Test(expected = NullPointerException.class)
+ public void testNoTimeService() throws ConnectionException, ExecutionException, InterruptedException {
+
+ final ExecutionContext executionContext = mock( ExecutionContext.class );
+
+
+ when( executionContext.getMessage( Entity.class ) ).thenReturn( null );
+
+
+ //mock the uuid service
+ final UUIDService uuidService = mock( UUIDService.class );
+
+
+ //perform the stage
+ new Update( null, uuidService );
+ }
+
+
+ /** Test no time service */
+ @Test(expected = NullPointerException.class)
+ public void testNoUUIDService() throws ConnectionException, ExecutionException, InterruptedException {
+
+ final ExecutionContext executionContext = mock( ExecutionContext.class );
+
+
+ when( executionContext.getMessage( Entity.class ) ).thenReturn( null );
+
+
+ //mock returning the time
+ final TimeService timeService = mock( TimeService.class );
+
+
+ //throw NPE
+ new Update( timeService, null );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/44072d59/stack/corepersistence/index/src/main/java/org/apache/usergrid/persistence/index/stage/Complete.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/index/src/main/java/org/apache/usergrid/persistence/index/stage/Complete.java b/stack/corepersistence/index/src/main/java/org/apache/usergrid/persistence/index/stage/Complete.java
index 2569c3a..5cc021c 100644
--- a/stack/corepersistence/index/src/main/java/org/apache/usergrid/persistence/index/stage/Complete.java
+++ b/stack/corepersistence/index/src/main/java/org/apache/usergrid/persistence/index/stage/Complete.java
@@ -2,7 +2,7 @@ package org.apache.usergrid.persistence.index.stage;
import org.apache.usergrid.persistence.collection.mvcc.stage.ExecutionContext;
-import org.apache.usergrid.persistence.collection.mvcc.stage.Stage;
+import org.apache.usergrid.persistence.collection.mvcc.stage.ExecutionStage;
/**
@@ -10,7 +10,7 @@ import org.apache.usergrid.persistence.collection.mvcc.stage.Stage;
* @author: tnine
*
*/
-public class Complete implements Stage
+public class Complete implements ExecutionStage
{
@Override
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/44072d59/stack/corepersistence/index/src/main/java/org/apache/usergrid/persistence/index/stage/Start.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/index/src/main/java/org/apache/usergrid/persistence/index/stage/Start.java b/stack/corepersistence/index/src/main/java/org/apache/usergrid/persistence/index/stage/Start.java
index 3809880..ddaa0f3 100644
--- a/stack/corepersistence/index/src/main/java/org/apache/usergrid/persistence/index/stage/Start.java
+++ b/stack/corepersistence/index/src/main/java/org/apache/usergrid/persistence/index/stage/Start.java
@@ -2,11 +2,11 @@ package org.apache.usergrid.persistence.index.stage;
import org.apache.usergrid.persistence.collection.mvcc.stage.ExecutionContext;
-import org.apache.usergrid.persistence.collection.mvcc.stage.Stage;
+import org.apache.usergrid.persistence.collection.mvcc.stage.ExecutionStage;
/** This state should signal an index update has started */
-public class Start implements Stage
+public class Start implements ExecutionStage
{
@Override
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/44072d59/stack/corepersistence/index/src/main/java/org/apache/usergrid/persistence/index/stage/Write.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/index/src/main/java/org/apache/usergrid/persistence/index/stage/Write.java b/stack/corepersistence/index/src/main/java/org/apache/usergrid/persistence/index/stage/Write.java
index b9433a6..252f5af 100644
--- a/stack/corepersistence/index/src/main/java/org/apache/usergrid/persistence/index/stage/Write.java
+++ b/stack/corepersistence/index/src/main/java/org/apache/usergrid/persistence/index/stage/Write.java
@@ -1,12 +1,12 @@
package org.apache.usergrid.persistence.index.stage;
-import org.apache.usergrid.persistence.collection.mvcc.stage.Stage;
+import org.apache.usergrid.persistence.collection.mvcc.stage.ExecutionStage;
import org.apache.usergrid.persistence.collection.mvcc.stage.ExecutionContext;
/** This state should perform an update of the index. */
-public class Write implements Stage
+public class Write implements ExecutionStage
{