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/02 22:51:19 UTC
[1/3] git commit: More tests.
Updated Branches:
refs/heads/two-dot-o c5aadde3c -> 04b9497c9
More tests.
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/6a55ea39
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/6a55ea39
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/6a55ea39
Branch: refs/heads/two-dot-o
Commit: 6a55ea39564023c7d4e1a85f6318470ef163715b
Parents: a022fb1
Author: Todd Nine <to...@apache.org>
Authored: Wed Nov 27 17:46:53 2013 -0700
Committer: Todd Nine <to...@apache.org>
Committed: Wed Nov 27 17:46:53 2013 -0700
----------------------------------------------------------------------
.../collection/CollectionContext.java | 8 +-
.../collection/CollectionContextImpl.java | 1 +
.../collection/mvcc/entity/MvccEntityImpl.java | 10 +-
.../mvcc/entity/MvccLogEntryImpl.java | 9 ++
.../collection/CollectionContextImplTest.java | 53 ++++++++
.../mvcc/entity/MvccEntityImplTest.java | 132 +++++++++++++++++++
.../mvcc/entity/MvccLogEntryImplTest.java | 104 +++++++++++++++
7 files changed, 311 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/6a55ea39/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/CollectionContext.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/CollectionContext.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/CollectionContext.java
index dd30d3a..fc8c56f 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/CollectionContext.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/CollectionContext.java
@@ -8,8 +8,7 @@ import java.util.UUID;
* A context to use when creating the collection manager. Typically, this would be something like an application, or an
* organization. Some context that "owns" the collection
*/
-public interface CollectionContext
-{
+public interface CollectionContext {
/** @return The application that will contain this collection */
public UUID getApplication();
@@ -20,6 +19,9 @@ public interface CollectionContext
*/
public UUID getOwner();
- /** @return The name of the collection. This should be singular, NO PLURALIZATION!!!!!! */
+ /** @return The name of the collection. If you use pluralization for you names vs types,
+ * you must keep the consistent or you will be unable to load data
+ * @return
+ */
public String getName();
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/6a55ea39/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/CollectionContextImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/CollectionContextImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/CollectionContextImpl.java
index 2173c31..1aef1d3 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/CollectionContextImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/CollectionContextImpl.java
@@ -21,6 +21,7 @@ public class CollectionContextImpl implements CollectionContext {
Preconditions.checkNotNull( applicationId , "applicationId is required");
Preconditions.checkNotNull( ownerId , "ownerId is required");
Preconditions.checkNotNull( name , "name is required");
+ Preconditions.checkArgument( name.length() > 0, "name must have a length" );
this.applicationId = applicationId;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/6a55ea39/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/entity/MvccEntityImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/entity/MvccEntityImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/entity/MvccEntityImpl.java
index c560db4..b85b314 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/entity/MvccEntityImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/entity/MvccEntityImpl.java
@@ -10,9 +10,7 @@ import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
-/**
- * @author tnine
- */
+/** @author tnine */
public class MvccEntityImpl implements MvccEntity {
private final CollectionContext context;
@@ -22,6 +20,12 @@ public class MvccEntityImpl implements MvccEntity {
public MvccEntityImpl( final CollectionContext context, final UUID entityId, final UUID version,
+ final Entity entity ) {
+ this( context, entityId, version, Optional.of( entity ) );
+ }
+
+
+ public MvccEntityImpl( final CollectionContext context, final UUID entityId, final UUID version,
final Optional<Entity> entity ) {
Preconditions.checkNotNull( context, "context is required" );
Preconditions.checkNotNull( entityId, "entity id is required" );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/6a55ea39/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/entity/MvccLogEntryImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/entity/MvccLogEntryImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/entity/MvccLogEntryImpl.java
index 0d9d6fc..91e68ef 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/entity/MvccLogEntryImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/entity/MvccLogEntryImpl.java
@@ -5,6 +5,8 @@ import java.util.UUID;
import org.apache.usergrid.persistence.collection.CollectionContext;
+import com.google.common.base.Preconditions;
+
/**
* The simple implementation of a log entry
@@ -21,6 +23,13 @@ public class MvccLogEntryImpl implements MvccLogEntry {
public MvccLogEntryImpl( final CollectionContext context, final UUID entityId, final UUID version,
final Stage stage ) {
+
+ Preconditions.checkNotNull( context, "context is required" );
+ Preconditions.checkNotNull( entityId, "entity id is required" );
+ Preconditions.checkNotNull( version, "version id is required" );
+ Preconditions.checkNotNull( stage, "entity is required" );
+
+
this.context = context;
this.entityId = entityId;
this.version = version;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/6a55ea39/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/CollectionContextImplTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/CollectionContextImplTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/CollectionContextImplTest.java
new file mode 100644
index 0000000..ed0a17b
--- /dev/null
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/CollectionContextImplTest.java
@@ -0,0 +1,53 @@
+package org.apache.usergrid.persistence.collection;
+
+
+import java.util.UUID;
+
+import org.junit.Test;
+
+import org.apache.usergrid.persistence.model.util.UUIDGenerator;
+
+import static junit.framework.TestCase.assertEquals;
+
+
+/** @author tnine */
+public class CollectionContextImplTest {
+
+ @Test( expected = NullPointerException.class )
+ public void appIdRequired() {
+ new CollectionContextImpl( null, UUIDGenerator.newTimeUUID(), "test" );
+ }
+
+
+ @Test( expected = NullPointerException.class )
+ public void ownerIdRequired() {
+ new CollectionContextImpl( UUIDGenerator.newTimeUUID(), null, "test" );
+ }
+
+
+ @Test( expected = NullPointerException.class )
+ public void collectionRequired() {
+ new CollectionContextImpl( UUIDGenerator.newTimeUUID(), UUIDGenerator.newTimeUUID(), null );
+ }
+
+
+ @Test( expected = IllegalArgumentException.class )
+ public void collectionRequiredLength() {
+ new CollectionContextImpl( UUIDGenerator.newTimeUUID(), UUIDGenerator.newTimeUUID(), "" );
+ }
+
+
+ @Test
+ public void correctValues() {
+ final UUID appId = UUIDGenerator.newTimeUUID();
+ final UUID ownerId = UUIDGenerator.newTimeUUID();
+
+ final String collection = "tests";
+
+ CollectionContextImpl context = new CollectionContextImpl( appId, ownerId, collection );
+
+ assertEquals( appId, context.getApplication() );
+ assertEquals( ownerId, context.getOwner() );
+ assertEquals( collection, context.getName() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/6a55ea39/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/entity/MvccEntityImplTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/entity/MvccEntityImplTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/entity/MvccEntityImplTest.java
new file mode 100644
index 0000000..324c931
--- /dev/null
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/entity/MvccEntityImplTest.java
@@ -0,0 +1,132 @@
+package org.apache.usergrid.persistence.collection.mvcc.entity;
+
+
+import java.util.UUID;
+
+import org.junit.Test;
+
+import org.apache.usergrid.persistence.collection.CollectionContext;
+import org.apache.usergrid.persistence.collection.CollectionContextImpl;
+import org.apache.usergrid.persistence.model.entity.Entity;
+import org.apache.usergrid.persistence.model.util.UUIDGenerator;
+
+import com.google.common.base.Optional;
+
+import static org.junit.Assert.assertEquals;
+
+
+/** @author tnine */
+public class MvccEntityImplTest {
+
+ @Test( expected = NullPointerException.class )
+ public void contextRequired() {
+ new MvccEntityImpl( null, UUIDGenerator.newTimeUUID(), UUIDGenerator.newTimeUUID(),
+ Optional.of( new Entity() ) );
+ }
+
+
+ @Test( expected = NullPointerException.class )
+ public void entityIdRequired() {
+ final CollectionContext context =
+ new CollectionContextImpl( UUIDGenerator.newTimeUUID(), UUIDGenerator.newTimeUUID(), "test" );
+
+ new MvccEntityImpl( context, null, UUIDGenerator.newTimeUUID(), Optional.of( new Entity() ) );
+ }
+
+
+ @Test( expected = NullPointerException.class )
+ public void versionRequired() {
+ final CollectionContext context =
+ new CollectionContextImpl( UUIDGenerator.newTimeUUID(), UUIDGenerator.newTimeUUID(), "test" );
+
+ new MvccEntityImpl( context, UUIDGenerator.newTimeUUID(), null, Optional.of( new Entity() ) );
+ }
+
+
+ @Test( expected = NullPointerException.class )
+ public void entityRequired() {
+ final CollectionContext context =
+ new CollectionContextImpl( UUIDGenerator.newTimeUUID(), UUIDGenerator.newTimeUUID(), "test" );
+
+ new MvccEntityImpl( context, UUIDGenerator.newTimeUUID(), UUIDGenerator.newTimeUUID(), ( Entity ) null );
+ }
+
+
+ @Test( expected = NullPointerException.class )
+ public void optionalRequired() {
+ final CollectionContext context =
+ new CollectionContextImpl( UUIDGenerator.newTimeUUID(), UUIDGenerator.newTimeUUID(), "test" );
+
+ new MvccEntityImpl( context, UUIDGenerator.newTimeUUID(), UUIDGenerator.newTimeUUID(), ( Optional ) null );
+ }
+
+
+ @Test
+ public void correctValueEntity() {
+ final CollectionContext context =
+ new CollectionContextImpl( UUIDGenerator.newTimeUUID(), UUIDGenerator.newTimeUUID(), "test" );
+
+ final UUID entityId = UUIDGenerator.newTimeUUID();
+ final UUID version = UUIDGenerator.newTimeUUID();
+ final Entity entity = new Entity( entityId, "test" );
+
+ MvccEntityImpl logEntry = new MvccEntityImpl( context, entityId, version, entity );
+
+ assertEquals( context, logEntry.getContext() );
+ assertEquals( entityId, logEntry.getUuid() );
+ assertEquals( version, logEntry.getVersion() );
+ assertEquals( entity, logEntry.getEntity().get() );
+ }
+
+
+ @Test
+ public void correctValueOptional() {
+ final CollectionContext context =
+ new CollectionContextImpl( UUIDGenerator.newTimeUUID(), UUIDGenerator.newTimeUUID(), "test" );
+
+ final UUID entityId = UUIDGenerator.newTimeUUID();
+ final UUID version = UUIDGenerator.newTimeUUID();
+ final Entity entity = new Entity( entityId, "test" );
+
+ MvccEntityImpl logEntry = new MvccEntityImpl( context, entityId, version, Optional.of( entity ) );
+
+ assertEquals( context, logEntry.getContext() );
+ assertEquals( entityId, logEntry.getUuid() );
+ assertEquals( version, logEntry.getVersion() );
+ assertEquals( entity, logEntry.getEntity().get() );
+ }
+
+
+ @Test
+ public void equals() {
+ final CollectionContext context =
+ new CollectionContextImpl( UUIDGenerator.newTimeUUID(), UUIDGenerator.newTimeUUID(), "test" );
+
+ final UUID entityId = UUIDGenerator.newTimeUUID();
+ final UUID version = UUIDGenerator.newTimeUUID();
+ final Entity entity = new Entity( entityId, "test" );
+
+ MvccEntityImpl first = new MvccEntityImpl( context, entityId, version, Optional.of( entity ) );
+
+ MvccEntityImpl second = new MvccEntityImpl( context, entityId, version, Optional.of( entity ) );
+
+ assertEquals( first, second );
+ }
+
+
+ @Test
+ public void testHashCode() {
+ final CollectionContext context =
+ new CollectionContextImpl( UUIDGenerator.newTimeUUID(), UUIDGenerator.newTimeUUID(), "test" );
+
+ final UUID entityId = UUIDGenerator.newTimeUUID();
+ final UUID version = UUIDGenerator.newTimeUUID();
+ final Entity entity = new Entity( entityId, "test" );
+
+ MvccEntityImpl first = new MvccEntityImpl( context, entityId, version, Optional.of( entity ) );
+
+ MvccEntityImpl second = new MvccEntityImpl( context, entityId, version, Optional.of( entity ) );
+
+ assertEquals( first.hashCode(), second.hashCode() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/6a55ea39/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/entity/MvccLogEntryImplTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/entity/MvccLogEntryImplTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/entity/MvccLogEntryImplTest.java
new file mode 100644
index 0000000..918498f
--- /dev/null
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/entity/MvccLogEntryImplTest.java
@@ -0,0 +1,104 @@
+package org.apache.usergrid.persistence.collection.mvcc.entity;
+
+
+import java.util.UUID;
+
+import org.junit.Test;
+
+import org.apache.usergrid.persistence.collection.CollectionContext;
+import org.apache.usergrid.persistence.collection.CollectionContextImpl;
+import org.apache.usergrid.persistence.model.util.UUIDGenerator;
+
+import static org.junit.Assert.assertEquals;
+
+
+/** @author tnine */
+public class MvccLogEntryImplTest {
+
+ @Test( expected = NullPointerException.class )
+ public void contextRequired() {
+ new MvccLogEntryImpl( null, UUIDGenerator.newTimeUUID(), UUIDGenerator.newTimeUUID(), Stage.ACTIVE );
+ }
+
+
+ @Test( expected = NullPointerException.class )
+ public void entityIdRequired() {
+ final CollectionContext context =
+ new CollectionContextImpl( UUIDGenerator.newTimeUUID(), UUIDGenerator.newTimeUUID(), "test" );
+
+ new MvccLogEntryImpl( context, null, UUIDGenerator.newTimeUUID(), Stage.ACTIVE );
+ }
+
+
+ @Test( expected = NullPointerException.class )
+ public void versionRequired() {
+ final CollectionContext context =
+ new CollectionContextImpl( UUIDGenerator.newTimeUUID(), UUIDGenerator.newTimeUUID(), "test" );
+
+ new MvccLogEntryImpl( context, UUIDGenerator.newTimeUUID(), null, Stage.ACTIVE );
+ }
+
+
+ @Test( expected = NullPointerException.class )
+ public void stageRequired() {
+ final CollectionContext context =
+ new CollectionContextImpl( UUIDGenerator.newTimeUUID(), UUIDGenerator.newTimeUUID(), "test" );
+
+ new MvccLogEntryImpl( context, UUIDGenerator.newTimeUUID(), UUIDGenerator.newTimeUUID(), null );
+ }
+
+
+ @Test
+ public void correctValue() {
+ final CollectionContext context =
+ new CollectionContextImpl( UUIDGenerator.newTimeUUID(), UUIDGenerator.newTimeUUID(), "test" );
+
+ final UUID entityId = UUIDGenerator.newTimeUUID();
+ final UUID version = UUIDGenerator.newTimeUUID();
+ final Stage stage = Stage.COMPLETE;
+
+
+ MvccLogEntry logEntry = new MvccLogEntryImpl( context, entityId, version, stage );
+
+ assertEquals( context, logEntry.getContext() );
+ assertEquals( entityId, logEntry.getEntityId() );
+ assertEquals( version, logEntry.getVersion() );
+ assertEquals( stage, logEntry.getStage() );
+ }
+
+
+ @Test
+ public void equals() {
+ final CollectionContext context =
+ new CollectionContextImpl( UUIDGenerator.newTimeUUID(), UUIDGenerator.newTimeUUID(), "test" );
+
+ final UUID entityId = UUIDGenerator.newTimeUUID();
+ final UUID version = UUIDGenerator.newTimeUUID();
+ final Stage stage = Stage.COMPLETE;
+
+
+ MvccLogEntry first = new MvccLogEntryImpl( context, entityId, version, stage );
+
+ MvccLogEntry second = new MvccLogEntryImpl( context, entityId, version, stage );
+
+ assertEquals( first, second );
+ }
+
+
+ @Test
+ public void testHashCode() {
+ final CollectionContext context =
+ new CollectionContextImpl( UUIDGenerator.newTimeUUID(), UUIDGenerator.newTimeUUID(), "test" );
+
+ final UUID entityId = UUIDGenerator.newTimeUUID();
+ final UUID version = UUIDGenerator.newTimeUUID();
+ final Stage stage = Stage.COMPLETE;
+
+
+ MvccLogEntry first = new MvccLogEntryImpl( context, entityId, version, stage );
+
+ MvccLogEntry second = new MvccLogEntryImpl( context, entityId, version, stage );
+
+ assertEquals( first.hashCode(), second.hashCode() );
+ }
+}
[3/3] git commit: Merge branch 'two-dot-o' of
https://git-wip-us.apache.org/repos/asf/incubator-usergrid into two-dot-o
Posted by to...@apache.org.
Merge branch 'two-dot-o' of https://git-wip-us.apache.org/repos/asf/incubator-usergrid into two-dot-o
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/04b9497c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/04b9497c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/04b9497c
Branch: refs/heads/two-dot-o
Commit: 04b9497c96617d8fbde7c816c3e7868d1c454fac
Parents: f08f96c c5aadde
Author: Todd Nine <to...@apache.org>
Authored: Mon Dec 2 14:51:09 2013 -0700
Committer: Todd Nine <to...@apache.org>
Committed: Mon Dec 2 14:51:09 2013 -0700
----------------------------------------------------------------------
stack/corepersistence/perftest/pom.xml | 109 +++++++++--
.../org/apache/usergrid/perftest/CallStats.java | 117 +++++++++++
.../apache/usergrid/perftest/NoopPerftest.java | 6 +-
.../usergrid/perftest/PerftestModule.java | 7 +-
.../usergrid/perftest/PerftestRunner.java | 152 +++++++-------
.../usergrid/perftest/PerftestRunnerTest.java | 31 +++
.../apache/usergrid/perftest/ResultsLog.java | 51 +++++
.../usergrid/perftest/ResultsLogImpl.java | 133 +++++++++++++
.../perftest/amazon/AmazonS3Module.java | 15 ++
.../perftest/amazon/AmazonS3Service.java | 24 +++
.../perftest/amazon/AmazonS3ServiceImpl.java | 196 +++++++++++++++++++
.../apache/usergrid/perftest/logging/Log.java | 19 --
.../perftest/logging/Slf4jMembersInjector.java | 46 -----
.../perftest/logging/Slf4jTypeListener.java | 44 -----
.../usergrid/perfteststats/CallStats.java | 90 ---------
.../src/main/resources/config.properties | 11 +-
.../src/main/resources/log4j.properties | 18 +-
.../usergrid/perftest/ResultsLogImplTest.java | 82 ++++++++
.../perftest/amazon/AmazonS3ServiceTest.java | 39 ++++
.../src/test/resources/log4j-jetty.properties | 9 +
.../src/test/resources/log4j.properties | 9 +
21 files changed, 888 insertions(+), 320 deletions(-)
----------------------------------------------------------------------
[2/3] git commit: Temp upgrade. Need to upgrade to a pipeline type
architecture for stages
Posted by to...@apache.org.
Temp upgrade. Need to upgrade to a pipeline type architecture for stages
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/f08f96c1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/f08f96c1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/f08f96c1
Branch: refs/heads/two-dot-o
Commit: f08f96c175b5143b04e17c59e46a0407b50a4071
Parents: 6a55ea3
Author: Todd Nine <to...@apache.org>
Authored: Mon Dec 2 14:51:04 2013 -0700
Committer: Todd Nine <to...@apache.org>
Committed: Mon Dec 2 14:51:04 2013 -0700
----------------------------------------------------------------------
stack/corepersistence/collection/pom.xml | 7 +++
.../CollectionManagerFactoryImpl.java | 3 +-
.../collection/CollectionManagerImpl.java | 53 +++++++++++++++++++-
.../persistence/collection/TimeService.java | 12 +++++
.../astynax/AstynaxKeyspaceProvider.java | 36 +++++++------
.../collection/mvcc/stage/Commit.java | 8 ++-
.../collection/mvcc/stage/Start.java | 26 ++++++++--
.../collection/mvcc/stage/Write.java | 8 ++-
.../collection/mvcc/stage/WriteListener.java | 10 ++++
.../collection/mvcc/stage/WriteStage.java | 10 +++-
.../collection/mvcc/verify/AtomicUpdate.java | 26 ----------
.../MvccEntitySerializationStrategyImpl.java | 2 +-
.../collection/guice/TestCollectionModule.java | 3 ++
.../collection/mvcc/stage/StartTest.java | 51 +++++++++++++++++++
.../persistence/index/stage/Complete.java | 6 ++-
.../usergrid/persistence/index/stage/Start.java | 6 ++-
.../usergrid/persistence/index/stage/Write.java | 6 ++-
17 files changed, 216 insertions(+), 57 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f08f96c1/stack/corepersistence/collection/pom.xml
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/pom.xml b/stack/corepersistence/collection/pom.xml
index 47875bc..7e48ea4 100644
--- a/stack/corepersistence/collection/pom.xml
+++ b/stack/corepersistence/collection/pom.xml
@@ -43,6 +43,13 @@
<version>${astynax.version}</version>
</dependency>
+ <!-- bean utils for setting uuids etc -->
+ <dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils-core</artifactId>
+ <version>1.8.3</version>
+ </dependency>
+
<!-- Serialization libraries -->
<dependency>
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f08f96c1/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/CollectionManagerFactoryImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/CollectionManagerFactoryImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/CollectionManagerFactoryImpl.java
index a6631e6..3ce0e7b 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/CollectionManagerFactoryImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/CollectionManagerFactoryImpl.java
@@ -10,6 +10,7 @@ public class CollectionManagerFactoryImpl implements CollectionManagerFactory {
@Override
public CollectionManager createCollectionManager( final CollectionContext context ) {
- return new CollectionManagerImpl( context );
+// return new CollectionManagerImpl( context );
+ return null;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f08f96c1/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/CollectionManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/CollectionManagerImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/CollectionManagerImpl.java
index 15ef3ff..679a8cb 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/CollectionManagerImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/CollectionManagerImpl.java
@@ -1,9 +1,23 @@
package org.apache.usergrid.persistence.collection;
+import java.lang.reflect.InvocationTargetException;
import java.util.UUID;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.commons.beanutils.BeanUtils;
+
+import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntityImpl;
+import org.apache.usergrid.persistence.collection.mvcc.stage.Commit;
+import org.apache.usergrid.persistence.collection.mvcc.stage.Start;
+import org.apache.usergrid.persistence.collection.mvcc.stage.Write;
import org.apache.usergrid.persistence.model.entity.Entity;
+import org.apache.usergrid.persistence.model.util.UUIDGenerator;
+
+import com.google.inject.Inject;
+import com.netflix.astyanax.MutationBatch;
/**
@@ -12,17 +26,52 @@ import org.apache.usergrid.persistence.model.entity.Entity;
*/
public class CollectionManagerImpl implements CollectionManager {
+ private static final Logger logger = LoggerFactory.getLogger(CollectionManagerImpl.class);
+
private final CollectionContext context;
+ private final TimeService timeService;
+ private final Start startStage;
+ private final Write writeStage;
+ private final Commit commitStage;
- public CollectionManagerImpl( final CollectionContext context ) {
+ @Inject
+ public CollectionManagerImpl( final CollectionContext context, final TimeService timeService, final Start startStage, final Write writeStage,
+ final Commit commitStage ) {
this.context = context;
+ this.timeService = timeService;
+ this.startStage = startStage;
+ this.writeStage = writeStage;
+ this.commitStage = commitStage;
}
@Override
public void create( final Entity entity ) {
- //To change body of implemented methods use File | Settings | File Templates.
+
+ final UUID entityId = UUIDGenerator.newTimeUUID();
+ final UUID version = entityId;
+ final long created = timeService.getTime();
+
+
+ try {
+ BeanUtils.setProperty(entity, "uuid", entityId);
+ }
+ catch ( Throwable t ) {
+ logger.error( "Unable to set uuid. See nested exception", t );
+ throw new RuntimeException( "Unable to set uuid. See nested exception", t );
+ }
+
+ entity.setVersion( version );
+ entity.setCreated( created );
+ entity.setUpdated( created );
+
+ MvccEntityImpl mvccEntity = new MvccEntityImpl(context, entityId, version, entity );
+
+
+ MutationBatch mutation = startStage.performStage( mvccEntity );
+ writeStage.performStage( mvccEntity );
+ commitStage.performStage( mvccEntity );
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f08f96c1/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/TimeService.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/TimeService.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/TimeService.java
new file mode 100644
index 0000000..eea1e36
--- /dev/null
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/TimeService.java
@@ -0,0 +1,12 @@
+package org.apache.usergrid.persistence.collection;
+
+
+/** @author tnine */
+public interface TimeService {
+
+ /**
+ * Get the current time in milliseconds since epoch
+ * @return
+ */
+ long getTime();
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f08f96c1/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/astynax/AstynaxKeyspaceProvider.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/astynax/AstynaxKeyspaceProvider.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/astynax/AstynaxKeyspaceProvider.java
index 150f221..d03de09 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/astynax/AstynaxKeyspaceProvider.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/astynax/AstynaxKeyspaceProvider.java
@@ -16,40 +16,44 @@ import com.netflix.astyanax.thrift.ThriftFamilyFactory;
/**
- * TODO. Provide the ability to do a service hook for realtime tuning without the need of a JVM restart
- * This could be done with governator and service discovery
+ * TODO. Provide the ability to do a service hook for realtime tuning without the need of a JVM restart This could be
+ * done with governator and service discovery
+ *
* @author tnine
*/
public class AstynaxKeyspaceProvider implements Provider<Keyspace> {
- /**
- * The cassandra URL property
- */
+ /** The cassandra URL property */
public static final String CASSANDRA_HOSTS = "cassandra.hosts";
public static final String CASSANDRA_PORT = "cassandra.port";
public static final String CASSANDRA_CONNECTIONS = "cassandra.connections";
public static final String CASSANDRA_CLUSTER_NAME = "cassandra.cluster_name";
public static final String CASSANDRA_VERSION = "cassandra.version";
+ public static final String CASSANDRA_TIMEOUT = "cassandra.timeout";
public static final String COLLECTIONS_KEYSPACE_NAME = "collections.keyspace";
+
protected final String cassandraHosts;
protected final int cassandraPort;
protected final int cassandraConnections;
+ protected final int cassandraTimeout;
protected final String clusterName;
protected final String keyspaceName;
protected final String cassandraVersion;
@Inject
- public AstynaxKeyspaceProvider( @Named( CASSANDRA_HOSTS ) final String cassandraHosts,
- @Named( CASSANDRA_PORT ) final int cassandraPort,
- @Named( CASSANDRA_CONNECTIONS ) final int cassandraConnections,
- @Named( CASSANDRA_CLUSTER_NAME ) final String clusterName,
- @Named( CASSANDRA_VERSION ) final String cassandraVersion,
- @Named( COLLECTIONS_KEYSPACE_NAME ) final String keyspaceName ) {
+ public AstynaxKeyspaceProvider( @Named(CASSANDRA_HOSTS) final String cassandraHosts,
+ @Named(CASSANDRA_PORT) final int cassandraPort,
+ @Named(CASSANDRA_CONNECTIONS) final int cassandraConnections,
+ @Named(CASSANDRA_CLUSTER_NAME) final String clusterName,
+ @Named(CASSANDRA_VERSION) final String cassandraVersion,
+ @Named(COLLECTIONS_KEYSPACE_NAME) final String keyspaceName,
+ @Named( CASSANDRA_TIMEOUT ) final int cassandraTimeout ) {
this.cassandraHosts = cassandraHosts;
this.cassandraPort = cassandraPort;
this.cassandraConnections = cassandraConnections;
+ this.cassandraTimeout = cassandraTimeout;
this.clusterName = clusterName;
this.keyspaceName = keyspaceName;
this.cassandraVersion = cassandraVersion;
@@ -65,14 +69,16 @@ public class AstynaxKeyspaceProvider implements Provider<Keyspace> {
new ConnectionPoolConfigurationImpl( "UsergridConnectionPool" ).setPort( cassandraPort )
.setMaxConnsPerHost(
cassandraConnections )
- .setSeeds( cassandraHosts );
+ .setSeeds( cassandraHosts )
+ .setSocketTimeout( cassandraTimeout );
AstyanaxContext<Keyspace> context =
new AstyanaxContext.Builder().forCluster( clusterName ).forKeyspace( keyspaceName )
/**
*TODO tnine Filter this by adding a host supplier. We will get token discovery from cassandra
* but only connect
- * to nodes that have been specified. Good for real time updates of the cass system without adding
+ * to nodes that have been specified. Good for real time updates of the cass system without
+ * adding
* load to them during runtime
*/.withAstyanaxConfiguration( config )
.withConnectionPoolConfiguration( connectionPoolConfiguration )
@@ -87,8 +93,8 @@ public class AstynaxKeyspaceProvider implements Provider<Keyspace> {
/**
- * Get runtime options that can be overridden. TODO: Make this an interface and somehow hook it into Guice auotmagically
- * @return
+ * Get runtime options that can be overridden. TODO: Make this an interface and somehow hook it into Guice
+ * auotmagically
*/
public static String[] getRuntimeOptions() {
return new String[] {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f08f96c1/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/Commit.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/Commit.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/Commit.java
index 64d3c5d..019c497 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/Commit.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/Commit.java
@@ -3,6 +3,10 @@ package org.apache.usergrid.persistence.collection.mvcc.stage;
import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.netflix.astyanax.MutationBatch;
+import com.netflix.astyanax.connectionpool.OperationResult;
+
/**
* This phase should invoke any finalization, and mark the entity as committed in the data store before returning
@@ -12,7 +16,7 @@ public class Commit implements WriteStage {
@Override
- public MvccEntity performStage( final MvccEntity entity ) {
- return entity;
+ public MutationBatch performStage( final MvccEntity entity ) {
+ return null;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f08f96c1/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/Start.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/Start.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/Start.java
index d7f85ae..e66eb52 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/Start.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/Start.java
@@ -2,23 +2,43 @@ package org.apache.usergrid.persistence.collection.mvcc.stage;
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.MvccLogEntryImpl;
+import org.apache.usergrid.persistence.collection.mvcc.entity.Stage;
+import org.apache.usergrid.persistence.collection.serialization.MvccLogEntrySerializationStrategy;
+
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.netflix.astyanax.MutationBatch;
+import com.netflix.astyanax.connectionpool.OperationResult;
+import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
/**
* This is the first stage and should be invoked immediately when a write is started. It should persist the start of a
* new write in the data store for a checkpoint and recovery
*/
+@Singleton
public class Start implements WriteStage {
+ private final MvccLogEntrySerializationStrategy logStrategy;
/**
* Create a new stage with the current context
+ * @param logStrategy
*/
- protected Start( ){
+ @Inject
+ protected Start( final MvccLogEntrySerializationStrategy logStrategy ){
+ this.logStrategy = logStrategy;
}
@Override
- public MvccEntity performStage( final MvccEntity entity ) {
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ public MutationBatch performStage( final MvccEntity entity ) {
+ final MvccLogEntry startEntry = new MvccLogEntryImpl(entity.getContext(), entity.getUuid(), entity.getVersion(),Stage.ACTIVE);
+
+ MutationBatch write = logStrategy.write( startEntry );
+
+ return write;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f08f96c1/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/Write.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/Write.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/Write.java
index b67ca31..690416f 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/Write.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/Write.java
@@ -3,6 +3,10 @@ package org.apache.usergrid.persistence.collection.mvcc.stage;
import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.netflix.astyanax.MutationBatch;
+import com.netflix.astyanax.connectionpool.OperationResult;
+
/**
* This phase should execute the serialization to the data store.
@@ -17,9 +21,9 @@ public class Write implements WriteStage {
@Override
- public MvccEntity performStage( final MvccEntity entity) {
+ public MutationBatch performStage( final MvccEntity entity ) {
- return entity;
+ return null;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f08f96c1/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/WriteListener.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/WriteListener.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/WriteListener.java
new file mode 100644
index 0000000..4a78226
--- /dev/null
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/WriteListener.java
@@ -0,0 +1,10 @@
+package org.apache.usergrid.persistence.collection.mvcc.stage;
+
+
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.netflix.astyanax.connectionpool.OperationResult;
+
+
+/** @author tnine */
+public interface WriteListener extends ListenableFuture<OperationResult<Void>> {}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f08f96c1/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/WriteStage.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/WriteStage.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/WriteStage.java
index cda707f..1960fdb 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/WriteStage.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/WriteStage.java
@@ -3,6 +3,11 @@ package org.apache.usergrid.persistence.collection.mvcc.stage;
import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.netflix.astyanax.MutationBatch;
+import com.netflix.astyanax.connectionpool.OperationResult;
+import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
+
/**
* The possible stages in our write flow.
@@ -11,10 +16,11 @@ public interface WriteStage {
/**
* Run this stage. This will return the MvccEntity that should be returned or passed to the next stage
+ *
* @param entity The entity to use in this stage
*
- * @return The MvccEntity to use for the next sgage
+ * @return The asynchronous listener to signal success
*
*/
- public MvccEntity performStage( MvccEntity entity);
+ public MutationBatch performStage( MvccEntity entity ) throws ConnectionException;
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f08f96c1/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/verify/AtomicUpdate.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/verify/AtomicUpdate.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/verify/AtomicUpdate.java
deleted file mode 100644
index d844f3b..0000000
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/verify/AtomicUpdate.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.apache.usergrid.persistence.collection.mvcc.verify;
-
-
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
-
-
-/**
- * Interface to test if we can perform atomic operations
- * <p/>
- * Note This will probably require a new WriteStage that is after start, which is rollback
- */
-public interface AtomicUpdate
-{
-
- /** Signal that we are starting update */
- public void startUpdate( MvccEntity context );
-
- /**
- * Try the commit.
- *
- * @return true if we can proceed. False if we cannot
- */
- public boolean tryCommit( MvccEntity context );
-}
-
-
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f08f96c1/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/MvccEntitySerializationStrategyImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/MvccEntitySerializationStrategyImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/MvccEntitySerializationStrategyImpl.java
index 6030866..afec2f8 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/MvccEntitySerializationStrategyImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/MvccEntitySerializationStrategyImpl.java
@@ -173,7 +173,7 @@ public class MvccEntitySerializationStrategyImpl implements MvccEntitySerializat
private MutationBatch doWrite( UUID entityId, RowOp op ) {
final MutationBatch batch = keyspace.prepareMutationBatch();
- op.doOp( batch.withRow( CF_ENTITY_DATA, entityId ) );
+ op.doOp( batch.withRow( CF_ENTITY_DATA, entityId ) );
return batch;
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f08f96c1/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/guice/TestCollectionModule.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/guice/TestCollectionModule.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/guice/TestCollectionModule.java
index 3ea6e62..1d56a5d 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/guice/TestCollectionModule.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/guice/TestCollectionModule.java
@@ -53,6 +53,9 @@ public class TestCollectionModule extends AbstractModule {
configProperties.put( AstynaxKeyspaceProvider.CASSANDRA_HOSTS, "localhost" );
configProperties.put( AstynaxKeyspaceProvider.CASSANDRA_PORT, "" + CassandraRule.THRIFT_PORT );
configProperties.put( AstynaxKeyspaceProvider.CASSANDRA_CONNECTIONS, "10" );
+
+ //time out after 5 seconds
+ configProperties.put( AstynaxKeyspaceProvider.CASSANDRA_TIMEOUT, "5000" );
configProperties.put( AstynaxKeyspaceProvider.CASSANDRA_CLUSTER_NAME, "Usergrid" );
configProperties.put( AstynaxKeyspaceProvider.CASSANDRA_VERSION, "1.2" );
configProperties.put( AstynaxKeyspaceProvider.COLLECTIONS_KEYSPACE_NAME, "Usergrid_Collections" );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f08f96c1/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/StartTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/StartTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/StartTest.java
new file mode 100644
index 0000000..76d6326
--- /dev/null
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/StartTest.java
@@ -0,0 +1,51 @@
+package org.apache.usergrid.persistence.collection.mvcc.stage;
+
+
+import java.util.UUID;
+
+import org.junit.Test;
+
+import org.apache.usergrid.persistence.collection.CollectionContext;
+import org.apache.usergrid.persistence.collection.CollectionContextImpl;
+import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntityImpl;
+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 static org.mockito.Mockito.mock;
+
+
+/** @author tnine */
+public class StartTest {
+
+ @Test
+ public void testStartStage(){
+
+ final MvccLogEntrySerializationStrategy logStrategy = mock(MvccLogEntrySerializationStrategy.class);
+
+ Start start = new Start( logStrategy );
+
+ //set up the data
+
+ final UUID applicationId = UUIDGenerator.newTimeUUID();
+
+ final UUID ownerId = UUIDGenerator.newTimeUUID();
+
+ final UUID entityId = UUIDGenerator.newTimeUUID();
+
+ final UUID version = UUIDGenerator.newTimeUUID();
+
+ final String name = "tests";
+
+
+ CollectionContextImpl collection = new CollectionContextImpl( applicationId, ownerId, name );
+
+
+ Entity entity = new Entity();
+
+ MvccEntityImpl mvccEntity = new MvccEntityImpl(collection, entityId, version, entity );
+
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f08f96c1/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 da051b6..17903fe 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
@@ -4,6 +4,10 @@ package org.apache.usergrid.persistence.index.stage;
import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
import org.apache.usergrid.persistence.collection.mvcc.stage.WriteStage;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.netflix.astyanax.MutationBatch;
+import com.netflix.astyanax.connectionpool.OperationResult;
+
/**
*
@@ -14,7 +18,7 @@ public class Complete implements WriteStage
{
@Override
- public MvccEntity performStage( final MvccEntity entity ) {
+ public MutationBatch performStage( final MvccEntity entity ) {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f08f96c1/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 a89e2af..4270629 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
@@ -4,13 +4,17 @@ package org.apache.usergrid.persistence.index.stage;
import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
import org.apache.usergrid.persistence.collection.mvcc.stage.WriteStage;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.netflix.astyanax.MutationBatch;
+import com.netflix.astyanax.connectionpool.OperationResult;
+
/** This state should signal an index update has started */
public class Start implements WriteStage
{
@Override
- public MvccEntity performStage( final MvccEntity entity ) {
+ public MutationBatch performStage( final MvccEntity entity ) {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f08f96c1/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 8e75812..c5d857b 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
@@ -4,13 +4,17 @@ package org.apache.usergrid.persistence.index.stage;
import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
import org.apache.usergrid.persistence.collection.mvcc.stage.WriteStage;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.netflix.astyanax.MutationBatch;
+import com.netflix.astyanax.connectionpool.OperationResult;
+
/** This state should perform an update of the index. */
public class Write implements WriteStage
{
@Override
- public MvccEntity performStage( final MvccEntity entity ) {
+ public MutationBatch performStage( final MvccEntity entity ) {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
}