You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by gr...@apache.org on 2015/03/19 23:20:05 UTC
[15/50] [abbrv] incubator-usergrid git commit: Pushed migration tests
down to core tiers. WIP
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802dcdec/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerIT.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerIT.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerIT.java
index 69e0422..ef5d69d 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerIT.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerIT.java
@@ -29,6 +29,7 @@ import org.junit.Test;
import org.apache.usergrid.persistence.core.guice.MigrationManagerRule;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
import org.apache.usergrid.persistence.core.scope.ApplicationScopeImpl;
+import org.apache.usergrid.persistence.core.util.IdGenerator;
import org.apache.usergrid.persistence.graph.impl.SimpleSearchEdgeType;
import org.apache.usergrid.persistence.graph.impl.SimpleSearchIdType;
import org.apache.usergrid.persistence.model.entity.Id;
@@ -40,7 +41,7 @@ import rx.Observable;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createEdge;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createGetByEdge;
-import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createId;
+import static org.apache.usergrid.persistence.core.util.IdGenerator.createId;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createSearchByEdge;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createSearchByEdgeAndId;
import static org.junit.Assert.assertEquals;
@@ -73,7 +74,7 @@ public abstract class GraphManagerIT {
@Before
public void mockApp() {
- this.scope = new ApplicationScopeImpl(createId("application") );
+ this.scope = new ApplicationScopeImpl( IdGenerator.createId( "application" ) );
}
@@ -361,18 +362,18 @@ public abstract class GraphManagerIT {
public void testWriteReadEdgeTypePagingSource() throws TimeoutException, InterruptedException {
GraphManager gm = getHelper( emf.createEdgeManager( scope ) );
- final Id sourceId = createId( "source" );
+ final Id sourceId = IdGenerator.createId( "source" );
- Edge edge1 = createEdge( sourceId, "test", createId( "target" ) );
+ Edge edge1 = createEdge( sourceId, "test", IdGenerator.createId( "target" ) );
gm.writeEdge( edge1 ).toBlocking().last();
- Edge edge2 = createEdge( sourceId, "test", createId( "target" ) );
+ Edge edge2 = createEdge( sourceId, "test", IdGenerator.createId( "target" ) );
gm.writeEdge( edge2 ).toBlocking().last();
- Edge edge3 = createEdge( sourceId, "test", createId( "target" ) );
+ Edge edge3 = createEdge( sourceId, "test", IdGenerator.createId( "target" ) );
gm.writeEdge( edge3 ).toBlocking().last();
@@ -418,17 +419,17 @@ public abstract class GraphManagerIT {
GraphManager gm = getHelper( emf.createEdgeManager( scope ) );
- final Id targetId = createId( "target" );
+ final Id targetId = IdGenerator.createId( "target" );
- Edge edge1 = createEdge( createId( "source" ), "test", targetId );
+ Edge edge1 = createEdge( IdGenerator.createId( "source" ), "test", targetId );
gm.writeEdge( edge1 ).toBlocking().last();
- Edge edge2 = createEdge( createId( "source" ), "test", targetId );
+ Edge edge2 = createEdge( IdGenerator.createId( "source" ), "test", targetId );
gm.writeEdge( edge2 ).toBlocking().last();
- Edge edge3 = createEdge( createId( "source" ), "test", targetId );
+ Edge edge3 = createEdge( IdGenerator.createId( "source" ), "test", targetId );
gm.writeEdge( edge3 ).toBlocking().last();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802dcdec/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerLoadTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerLoadTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerLoadTest.java
index d3bf24e..976a6cc 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerLoadTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerLoadTest.java
@@ -44,6 +44,7 @@ import org.apache.usergrid.persistence.core.scope.ApplicationScope;
import org.apache.usergrid.persistence.core.scope.ApplicationScopeImpl;
import org.apache.usergrid.persistence.core.test.ITRunner;
import org.apache.usergrid.persistence.core.test.UseModules;
+import org.apache.usergrid.persistence.core.util.IdGenerator;
import org.apache.usergrid.persistence.graph.guice.TestGraphModule;
import org.apache.usergrid.persistence.graph.impl.SimpleSearchByEdgeType;
import org.apache.usergrid.persistence.model.entity.Id;
@@ -54,7 +55,7 @@ import rx.Observable;
import rx.Subscriber;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createEdge;
-import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createId;
+import static org.apache.usergrid.persistence.core.util.IdGenerator.createId;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
@@ -85,7 +86,7 @@ public class GraphManagerLoadTest {
//get the system property of the UUID to use. If one is not set, use the defualt
String uuidString = System.getProperty( "org.id", "80a42760-b699-11e3-a5e2-0800200c9a66" );
- scope = new ApplicationScopeImpl( createId( UUID.fromString( uuidString ), "test" ) );
+ scope = new ApplicationScopeImpl( IdGenerator.createId( UUID.fromString( uuidString ), "test" ) );
numWorkers = Integer.parseInt( System.getProperty( "numWorkers", "100" ) );
writeLimit = Integer.parseInt( System.getProperty( "writeLimit", "10000" ) );
@@ -98,12 +99,12 @@ public class GraphManagerLoadTest {
public void writeThousandsSingleSource() throws InterruptedException, ExecutionException {
EdgeGenerator generator = new EdgeGenerator() {
- private Id sourceId = createId( "source" );
+ private Id sourceId = IdGenerator.createId( "source" );
@Override
public Edge newEdge() {
- Edge edge = createEdge( sourceId, "test", createId( "target" ) );
+ Edge edge = createEdge( sourceId, "test", IdGenerator.createId( "target" ) );
return edge;
@@ -125,12 +126,12 @@ public class GraphManagerLoadTest {
public void writeThousandsSingleTarget() throws InterruptedException, ExecutionException {
EdgeGenerator generator = new EdgeGenerator() {
- private Id targetId = createId( "target" );
+ private Id targetId = IdGenerator.createId( "target" );
@Override
public Edge newEdge() {
- Edge edge = createEdge( createId( "source" ), "test", targetId );
+ Edge edge = createEdge( IdGenerator.createId( "source" ), "test", targetId );
return edge;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802dcdec/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerShardConsistencyIT.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerShardConsistencyIT.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerShardConsistencyIT.java
index 095f855..6d30d22 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerShardConsistencyIT.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerShardConsistencyIT.java
@@ -41,7 +41,6 @@ import javax.annotation.Nullable;
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -50,6 +49,7 @@ import org.apache.usergrid.persistence.core.migration.schema.MigrationException;
import org.apache.usergrid.persistence.core.migration.schema.MigrationManager;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
import org.apache.usergrid.persistence.core.scope.ApplicationScopeImpl;
+import org.apache.usergrid.persistence.core.util.IdGenerator;
import org.apache.usergrid.persistence.graph.guice.TestGraphModule;
import org.apache.usergrid.persistence.graph.impl.SimpleSearchByEdgeType;
import org.apache.usergrid.persistence.graph.serialization.impl.shard.DirectedEdgeMeta;
@@ -73,7 +73,7 @@ import rx.Observable;
import rx.functions.Action1;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createEdge;
-import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createId;
+import static org.apache.usergrid.persistence.core.util.IdGenerator.createId;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
@@ -129,7 +129,7 @@ public class GraphManagerShardConsistencyIT {
//get the system property of the UUID to use. If one is not set, use the defualt
String uuidString = System.getProperty( "org.id", "80a42760-b699-11e3-a5e2-0800200c9a66" );
- scope = new ApplicationScopeImpl( createId( UUID.fromString( uuidString ), "test" ) );
+ scope = new ApplicationScopeImpl( IdGenerator.createId( UUID.fromString( uuidString ), "test" ) );
reporter.start( 10, TimeUnit.SECONDS );
@@ -147,7 +147,7 @@ public class GraphManagerShardConsistencyIT {
public void writeThousandsSingleSource()
throws InterruptedException, ExecutionException, MigrationException, UnsupportedEncodingException {
- final Id sourceId = createId( "source" );
+ final Id sourceId = IdGenerator.createId( "source" );
final String edgeType = "test";
final EdgeGenerator generator = new EdgeGenerator() {
@@ -155,7 +155,7 @@ public class GraphManagerShardConsistencyIT {
@Override
public Edge newEdge() {
- Edge edge = createEdge( sourceId, edgeType, createId( "target" ) );
+ Edge edge = createEdge( sourceId, edgeType, IdGenerator.createId( "target" ) );
return edge;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802dcdec/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerShardingIT.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerShardingIT.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerShardingIT.java
index a9035d3..2951efe 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerShardingIT.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerShardingIT.java
@@ -34,6 +34,7 @@ import org.apache.usergrid.persistence.core.scope.ApplicationScope;
import org.apache.usergrid.persistence.core.scope.ApplicationScopeImpl;
import org.apache.usergrid.persistence.core.test.ITRunner;
import org.apache.usergrid.persistence.core.test.UseModules;
+import org.apache.usergrid.persistence.core.util.IdGenerator;
import org.apache.usergrid.persistence.graph.guice.TestGraphModule;
import org.apache.usergrid.persistence.graph.serialization.impl.shard.DirectedEdgeMeta;
import org.apache.usergrid.persistence.graph.serialization.impl.shard.NodeShardApproximation;
@@ -43,7 +44,7 @@ import org.apache.usergrid.persistence.model.entity.Id;
import com.google.inject.Inject;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createEdge;
-import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createId;
+import static org.apache.usergrid.persistence.core.util.IdGenerator.createId;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -76,7 +77,7 @@ public class GraphManagerShardingIT {
@Before
public void mockApp() {
- this.scope = new ApplicationScopeImpl(createId("application") );
+ this.scope = new ApplicationScopeImpl( IdGenerator.createId( "application" ) );
}
@@ -85,7 +86,7 @@ public class GraphManagerShardingIT {
GraphManager gm = emf.createEdgeManager( scope ) ;
- final Id sourceId = createId( "source" );
+ final Id sourceId = IdGenerator.createId( "source" );
final String edgeType = "test";
@@ -107,7 +108,7 @@ public class GraphManagerShardingIT {
Id targetId = null;
for(long i = 0; i < writeCount; i ++){
- targetId = createId("target") ;
+ targetId = IdGenerator.createId( "target" ) ;
final Edge edge = createEdge( sourceId, edgeType, targetId);
@@ -143,7 +144,7 @@ public class GraphManagerShardingIT {
GraphManager gm = emf.createEdgeManager( scope ) ;
- final Id targetId = createId( "target" );
+ final Id targetId = IdGenerator.createId( "target" );
final String edgeType = "test";
@@ -161,7 +162,7 @@ public class GraphManagerShardingIT {
Id sourceId = null;
for(long i = 0; i < writeCount; i ++){
- sourceId = createId("source") ;
+ sourceId = IdGenerator.createId( "source" ) ;
final Edge edge = createEdge( sourceId, edgeType, targetId);
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802dcdec/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerStressTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerStressTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerStressTest.java
index cc131d1..9380352 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerStressTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerStressTest.java
@@ -37,6 +37,7 @@ import org.apache.usergrid.persistence.core.guice.MigrationManagerRule;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
import org.apache.usergrid.persistence.core.test.ITRunner;
import org.apache.usergrid.persistence.core.test.UseModules;
+import org.apache.usergrid.persistence.core.util.IdGenerator;
import org.apache.usergrid.persistence.graph.guice.TestGraphModule;
import org.apache.usergrid.persistence.graph.impl.SimpleSearchByEdgeType;
import org.apache.usergrid.persistence.model.entity.Id;
@@ -48,7 +49,7 @@ import rx.Observable;
import rx.Subscriber;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createEdge;
-import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createId;
+import static org.apache.usergrid.persistence.core.util.IdGenerator.createId;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
@@ -179,12 +180,12 @@ public class GraphManagerStressTest {
public void writeThousandsSingleSource() throws InterruptedException {
EdgeGenerator generator = new EdgeGenerator() {
- private Id sourceId = createId( "source" );
+ private Id sourceId = IdGenerator.createId( "source" );
@Override
public Edge newEdge() {
- Edge edge = createEdge( sourceId, "test", createId( "target" ) );
+ Edge edge = createEdge( sourceId, "test", IdGenerator.createId( "target" ) );
return edge;
@@ -206,12 +207,12 @@ public class GraphManagerStressTest {
public void writeThousandsSingleTarget() throws InterruptedException {
EdgeGenerator generator = new EdgeGenerator() {
- private Id targetId = createId( "target" );
+ private Id targetId = IdGenerator.createId( "target" );
@Override
public Edge newEdge() {
- Edge edge = createEdge( createId( "source" ), "test", targetId );
+ Edge edge = createEdge( IdGenerator.createId( "source" ), "test", targetId );
return edge;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802dcdec/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/guice/TestGraphModule.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/guice/TestGraphModule.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/guice/TestGraphModule.java
index 7dd2254..3201a92 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/guice/TestGraphModule.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/guice/TestGraphModule.java
@@ -24,6 +24,7 @@ import org.apache.usergrid.persistence.core.guice.TestModule;
import org.apache.usergrid.persistence.core.migration.data.newimpls.MigrationDataProvider;
import org.apache.usergrid.persistence.core.migration.data.newimpls.TestMigrationDataProvider;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.graph.serialization.impl.migration.GraphNode;
import com.google.inject.TypeLiteral;
@@ -45,8 +46,8 @@ public class TestGraphModule extends TestModule {
public void configureMigrationProvider() {
//configure our migration data provider
- TestMigrationDataProvider<ApplicationScope> migrationDataProvider = new TestMigrationDataProvider<>();
- bind( new TypeLiteral<MigrationDataProvider<ApplicationScope>>() {} )
+ TestMigrationDataProvider<GraphNode> migrationDataProvider = new TestMigrationDataProvider<>();
+ bind( new TypeLiteral<MigrationDataProvider<GraphNode>>() {} )
.toInstance( migrationDataProvider );
}
} );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802dcdec/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/impl/EdgeDeleteListenerTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/impl/EdgeDeleteListenerTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/impl/EdgeDeleteListenerTest.java
index b8c5b3e..84783e5 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/impl/EdgeDeleteListenerTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/impl/EdgeDeleteListenerTest.java
@@ -36,6 +36,7 @@ import org.apache.usergrid.persistence.core.guice.ProxyImpl;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
import org.apache.usergrid.persistence.core.test.ITRunner;
import org.apache.usergrid.persistence.core.test.UseModules;
+import org.apache.usergrid.persistence.core.util.IdGenerator;
import org.apache.usergrid.persistence.graph.GraphFig;
import org.apache.usergrid.persistence.graph.GraphManagerFactory;
import org.apache.usergrid.persistence.graph.MarkedEdge;
@@ -50,7 +51,7 @@ import com.google.inject.Inject;
import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createGetByEdge;
-import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createId;
+import static org.apache.usergrid.persistence.core.util.IdGenerator.createId;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createMarkedEdge;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createSearchByEdge;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createSearchByEdgeAndId;
@@ -113,9 +114,9 @@ public class EdgeDeleteListenerTest {
//write several versions to the commit log
- final Id sourceId = createId( "source" );
+ final Id sourceId = IdGenerator.createId( "source" );
final String edgeType = "test";
- final Id targetId = createId( "target" );
+ final Id targetId = IdGenerator.createId( "target" );
final long edgeTimestamp = 1000l;
@@ -206,9 +207,9 @@ public class EdgeDeleteListenerTest {
//write several versions to the commit log
- final Id sourceId = createId( "source" );
+ final Id sourceId = IdGenerator.createId( "source" );
final String edgeType = "test";
- final Id targetId = createId( "target" );
+ final Id targetId = IdGenerator.createId( "target" );
final long timestamp = 1000l;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802dcdec/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/impl/NodeDeleteListenerTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/impl/NodeDeleteListenerTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/impl/NodeDeleteListenerTest.java
index d91bfc3..ad433e9 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/impl/NodeDeleteListenerTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/impl/NodeDeleteListenerTest.java
@@ -35,6 +35,7 @@ import org.apache.usergrid.persistence.core.guice.ProxyImpl;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
import org.apache.usergrid.persistence.core.test.ITRunner;
import org.apache.usergrid.persistence.core.test.UseModules;
+import org.apache.usergrid.persistence.core.util.IdGenerator;
import org.apache.usergrid.persistence.graph.Edge;
import org.apache.usergrid.persistence.graph.GraphFig;
import org.apache.usergrid.persistence.graph.GraphManager;
@@ -53,7 +54,7 @@ import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createEdge;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createGetByEdge;
-import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createId;
+import static org.apache.usergrid.persistence.core.util.IdGenerator.createId;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createSearchByEdge;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createSearchEdge;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createSearchIdType;
@@ -329,7 +330,7 @@ public class NodeDeleteListenerTest {
//create loads of edges to easily delete. We'll keep all the types of "test"
final int edgeCount = graphFig.getScanPageSize() * 2;
- Id toDelete = createId( "toDelete" );
+ Id toDelete = IdGenerator.createId( "toDelete" );
final String edgeType = "test";
int countSaved = 0;
@@ -342,11 +343,11 @@ public class NodeDeleteListenerTest {
//mix up source vs target, good for testing as well as create a lot of sub types to ensure they're removed
if ( i % 2 == 0 ) {
- edge = createEdge( toDelete, edgeType, createId( "target" + Math.random() ) );
+ edge = createEdge( toDelete, edgeType, IdGenerator.createId( "target" + Math.random() ) );
sourceCount++;
}
else {
- edge = createEdge( createId( "source" + Math.random() ), edgeType, toDelete );
+ edge = createEdge( IdGenerator.createId( "source" + Math.random() ), edgeType, toDelete );
targetCount++;
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802dcdec/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/impl/stage/EdgeDeleteRepairTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/impl/stage/EdgeDeleteRepairTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/impl/stage/EdgeDeleteRepairTest.java
index cdb284d..238daa0 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/impl/stage/EdgeDeleteRepairTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/impl/stage/EdgeDeleteRepairTest.java
@@ -33,6 +33,7 @@ import org.apache.usergrid.persistence.core.guice.MigrationManagerRule;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
import org.apache.usergrid.persistence.core.test.ITRunner;
import org.apache.usergrid.persistence.core.test.UseModules;
+import org.apache.usergrid.persistence.core.util.IdGenerator;
import org.apache.usergrid.persistence.graph.MarkedEdge;
import org.apache.usergrid.persistence.graph.SearchByEdgeType;
import org.apache.usergrid.persistence.graph.guice.TestGraphModule;
@@ -45,7 +46,7 @@ import com.google.inject.Inject;
import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createEdge;
-import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createId;
+import static org.apache.usergrid.persistence.core.util.IdGenerator.createId;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.mockito.Mockito.mock;
@@ -113,8 +114,8 @@ public class EdgeDeleteRepairTest {
public void commitLogTest() throws ConnectionException {
- final Id sourceId = createId( "source" );
- final Id targetId = createId( "target" );
+ final Id sourceId = IdGenerator.createId( "source" );
+ final Id targetId = IdGenerator.createId( "target" );
final String edgeType = "edge";
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802dcdec/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/impl/stage/EdgeMetaRepairTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/impl/stage/EdgeMetaRepairTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/impl/stage/EdgeMetaRepairTest.java
index 1b57c2d..f729f33 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/impl/stage/EdgeMetaRepairTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/impl/stage/EdgeMetaRepairTest.java
@@ -34,6 +34,7 @@ import org.apache.usergrid.persistence.core.guice.ProxyImpl;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
import org.apache.usergrid.persistence.core.test.ITRunner;
import org.apache.usergrid.persistence.core.test.UseModules;
+import org.apache.usergrid.persistence.core.util.IdGenerator;
import org.apache.usergrid.persistence.graph.GraphFig;
import org.apache.usergrid.persistence.graph.MarkedEdge;
import org.apache.usergrid.persistence.graph.guice.TestGraphModule;
@@ -48,7 +49,7 @@ import com.google.inject.Inject;
import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createEdge;
-import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createId;
+import static org.apache.usergrid.persistence.core.util.IdGenerator.createId;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.mockito.Mockito.mock;
@@ -102,7 +103,7 @@ public class EdgeMetaRepairTest {
public void cleanTargetNoEdgesNoMeta() {
//do no writes, then execute a cleanup with no meta data
- final Id targetId = createId( "target" );
+ final Id targetId = IdGenerator.createId( "target" );
final String test = "test";
final long version = System.currentTimeMillis();
@@ -152,22 +153,22 @@ public class EdgeMetaRepairTest {
@Test
public void cleanTargetMultipleEdge() throws ConnectionException {
- Id targetId = createId( "target" );
+ Id targetId = IdGenerator.createId( "target" );
- MarkedEdge edge1 = createEdge( createId( "source1" ), "test", targetId );
+ MarkedEdge edge1 = createEdge( IdGenerator.createId( "source1" ), "test", targetId );
storageEdgeSerialization.writeEdge( scope, edge1, UUIDGenerator.newTimeUUID() ).execute();
edgeMetadataSerialization.writeEdge( scope, edge1 ).execute();
- MarkedEdge edge2 = createEdge( createId( "source2" ), "test", targetId );
+ MarkedEdge edge2 = createEdge( IdGenerator.createId( "source2" ), "test", targetId );
storageEdgeSerialization.writeEdge( scope, edge2, UUIDGenerator.newTimeUUID() ).execute();
edgeMetadataSerialization.writeEdge( scope, edge2 ).execute();
- MarkedEdge edge3 = createEdge( createId( "source3" ), "test", targetId );
+ MarkedEdge edge3 = createEdge( IdGenerator.createId( "source3" ), "test", targetId );
storageEdgeSerialization.writeEdge( scope, edge3, UUIDGenerator.newTimeUUID() ).execute();
@@ -223,7 +224,7 @@ public class EdgeMetaRepairTest {
@Test
public void cleanTargetMultipleEdgeBuffer() throws ConnectionException {
- final Id targetId = createId( "target" );
+ final Id targetId = IdGenerator.createId( "target" );
final String edgeType = "test";
final int size = graphFig.getRepairConcurrentSize() * 2;
@@ -232,7 +233,7 @@ public class EdgeMetaRepairTest {
for ( int i = 0; i < size; i++ ) {
- MarkedEdge edge = createEdge( createId( "source" + i ), edgeType, targetId );
+ MarkedEdge edge = createEdge( IdGenerator.createId( "source" + i ), edgeType, targetId );
storageEdgeSerialization.writeEdge( scope, edge, UUIDGenerator.newTimeUUID() ).execute();
@@ -315,22 +316,22 @@ public class EdgeMetaRepairTest {
@Test
public void cleanSourceMultipleEdge() throws ConnectionException {
- Id sourceId = createId( "source" );
+ Id sourceId = IdGenerator.createId( "source" );
- MarkedEdge edge1 = createEdge( sourceId, "test", createId( "target1" ) );
+ MarkedEdge edge1 = createEdge( sourceId, "test", IdGenerator.createId( "target1" ) );
storageEdgeSerialization.writeEdge( scope, edge1, UUIDGenerator.newTimeUUID() ).execute();
edgeMetadataSerialization.writeEdge( scope, edge1 ).execute();
- MarkedEdge edge2 = createEdge( sourceId, "test", createId( "target2" ) );
+ MarkedEdge edge2 = createEdge( sourceId, "test", IdGenerator.createId( "target2" ) );
storageEdgeSerialization.writeEdge( scope, edge2, UUIDGenerator.newTimeUUID() ).execute();
edgeMetadataSerialization.writeEdge( scope, edge2).execute();
- MarkedEdge edge3 = createEdge( sourceId, "test", createId( "target3" ) );
+ MarkedEdge edge3 = createEdge( sourceId, "test", IdGenerator.createId( "target3" ) );
storageEdgeSerialization.writeEdge( scope, edge3, UUIDGenerator.newTimeUUID() ).execute();
@@ -386,7 +387,7 @@ public class EdgeMetaRepairTest {
@Test
public void cleanSourceMultipleEdgeBuffer() throws ConnectionException {
- Id sourceId = createId( "source" );
+ Id sourceId = IdGenerator.createId( "source" );
final String edgeType = "test";
@@ -396,7 +397,7 @@ public class EdgeMetaRepairTest {
for ( int i = 0; i < size; i++ ) {
- MarkedEdge edge = createEdge( sourceId, edgeType, createId( "target" + i ) );
+ MarkedEdge edge = createEdge( sourceId, edgeType, IdGenerator.createId( "target" + i ) );
storageEdgeSerialization.writeEdge( scope, edge, UUIDGenerator.newTimeUUID() ).execute();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802dcdec/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetadataSerializationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetadataSerializationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetadataSerializationTest.java
index 1ed1742..f5b8e89 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetadataSerializationTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetadataSerializationTest.java
@@ -29,6 +29,7 @@ import org.junit.Test;
import org.apache.usergrid.persistence.core.guice.MigrationManagerRule;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.core.util.IdGenerator;
import org.apache.usergrid.persistence.graph.Edge;
import org.apache.usergrid.persistence.model.entity.Id;
import org.apache.usergrid.persistence.model.util.UUIDGenerator;
@@ -44,7 +45,7 @@ import com.netflix.astyanax.model.ColumnFamily;
import com.netflix.astyanax.serializers.StringSerializer;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createEdge;
-import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createId;
+import static org.apache.usergrid.persistence.core.util.IdGenerator.createId;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createSearchEdge;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createSearchIdType;
import static org.junit.Assert.assertEquals;
@@ -98,9 +99,9 @@ public abstract class EdgeMetadataSerializationTest {
final Id sourceId = edge1.getSourceNode();
- final Edge edge2 = createEdge( sourceId, "edge", createId( "target2" ) );
+ final Edge edge2 = createEdge( sourceId, "edge", IdGenerator.createId( "target2" ) );
- final Edge edge3 = createEdge( sourceId, "edge2", createId( "target3" ) );
+ final Edge edge3 = createEdge( sourceId, "edge2", IdGenerator.createId( "target3" ) );
//set writing the edge
serialization.writeEdge( scope, edge1 ).execute();
@@ -132,9 +133,9 @@ public abstract class EdgeMetadataSerializationTest {
final Id targetId = edge1.getTargetNode();
- final Edge edge2 = createEdge( createId( "source" ), "edge", targetId );
+ final Edge edge2 = createEdge( IdGenerator.createId( "source" ), "edge", targetId );
- final Edge edge3 = createEdge( createId( "source2" ), "edge2", targetId );
+ final Edge edge3 = createEdge( IdGenerator.createId( "source2" ), "edge2", targetId );
//set writing the edge
serialization.writeEdge( scope, edge1 ).execute();
@@ -166,12 +167,12 @@ public abstract class EdgeMetadataSerializationTest {
final Id sourceId = edge1.getSourceNode();
- final Edge edge2 = createEdge( sourceId, "edge", createId( "target" ) );
+ final Edge edge2 = createEdge( sourceId, "edge", IdGenerator.createId( "target" ) );
- final Edge edge3 = createEdge( sourceId, "edge", createId( "target2" ) );
+ final Edge edge3 = createEdge( sourceId, "edge", IdGenerator.createId( "target2" ) );
//shouldn't be returned
- final Edge edge4 = createEdge( sourceId, "edge2", createId( "target3" ) );
+ final Edge edge4 = createEdge( sourceId, "edge2", IdGenerator.createId( "target3" ) );
//set writing the edge
serialization.writeEdge( scope, edge1 ).execute();
@@ -212,12 +213,12 @@ public abstract class EdgeMetadataSerializationTest {
final Id targetId = edge1.getTargetNode();
- final Edge edge2 = createEdge( createId( "source" ), "edge", targetId );
+ final Edge edge2 = createEdge( IdGenerator.createId( "source" ), "edge", targetId );
- final Edge edge3 = createEdge( createId( "source2" ), "edge", targetId );
+ final Edge edge3 = createEdge( IdGenerator.createId( "source2" ), "edge", targetId );
//shouldn't be returned
- final Edge edge4 = createEdge( createId( "source3" ), "edge2", targetId );
+ final Edge edge4 = createEdge( IdGenerator.createId( "source3" ), "edge2", targetId );
//set writing the edge
serialization.writeEdge( scope, edge1 ).execute();
@@ -259,9 +260,9 @@ public abstract class EdgeMetadataSerializationTest {
final Id sourceId = edge1.getSourceNode();
- final Edge edge2 = createEdge( sourceId, "edge", createId( "target2" ), timestamp + 1 );
+ final Edge edge2 = createEdge( sourceId, "edge", IdGenerator.createId( "target2" ), timestamp + 1 );
- final Edge edge3 = createEdge( sourceId, "edge2", createId( "target3" ), timestamp + 2 );
+ final Edge edge3 = createEdge( sourceId, "edge2", IdGenerator.createId( "target3" ), timestamp + 2 );
//set writing the edge
serialization.writeEdge( scope, edge1 ).execute();
@@ -312,9 +313,9 @@ public abstract class EdgeMetadataSerializationTest {
final Id targetId = edge1.getTargetNode();
- final Edge edge2 = createEdge( createId( "source" ), "edge", targetId );
+ final Edge edge2 = createEdge( IdGenerator.createId( "source" ), "edge", targetId );
- final Edge edge3 = createEdge( createId( "source2" ), "edge2", targetId );
+ final Edge edge3 = createEdge( IdGenerator.createId( "source2" ), "edge2", targetId );
//set writing the edge
serialization.writeEdge( scope, edge1 ).execute();
@@ -368,9 +369,9 @@ public abstract class EdgeMetadataSerializationTest {
final Id sourceId = edge1.getSourceNode();
- final Edge edge2 = createEdge( sourceId, "edge", createId( "target" ), timestamp + 1 );
+ final Edge edge2 = createEdge( sourceId, "edge", IdGenerator.createId( "target" ), timestamp + 1 );
- final Edge edge3 = createEdge( sourceId, "edge", createId( "target2" ), timestamp + 2 );
+ final Edge edge3 = createEdge( sourceId, "edge", IdGenerator.createId( "target2" ), timestamp + 2 );
//set writing the edge
serialization.writeEdge( scope, edge1 ).execute();
@@ -425,9 +426,9 @@ public abstract class EdgeMetadataSerializationTest {
final Id targetId = edge1.getTargetNode();
- final Edge edge2 = createEdge( createId( "source" ), "edge", targetId, timestamp + 1 );
+ final Edge edge2 = createEdge( IdGenerator.createId( "source" ), "edge", targetId, timestamp + 1 );
- final Edge edge3 = createEdge( createId( "source2" ), "edge", targetId, timestamp + 2 );
+ final Edge edge3 = createEdge( IdGenerator.createId( "source2" ), "edge", targetId, timestamp + 2 );
//set writing the edge
serialization.writeEdge( scope, edge1 ).execute();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802dcdec/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeSerializationChopTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeSerializationChopTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeSerializationChopTest.java
index b1bcf2d..1197a74 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeSerializationChopTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeSerializationChopTest.java
@@ -31,6 +31,7 @@ import org.apache.usergrid.persistence.core.guice.MigrationManagerRule;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
import org.apache.usergrid.persistence.core.test.ITRunner;
import org.apache.usergrid.persistence.core.test.UseModules;
+import org.apache.usergrid.persistence.core.util.IdGenerator;
import org.apache.usergrid.persistence.graph.MarkedEdge;
import org.apache.usergrid.persistence.graph.guice.TestGraphModule;
import org.apache.usergrid.persistence.model.entity.Id;
@@ -40,7 +41,7 @@ import com.google.inject.Inject;
import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createEdge;
-import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createId;
+import static org.apache.usergrid.persistence.core.util.IdGenerator.createId;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createSearchByEdge;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
@@ -100,8 +101,8 @@ public class EdgeSerializationChopTest {
public void mixedEdgeTypes() throws ConnectionException {
- final Id sourceId = createId( SOURCE_NODE_ID, "source" );
- final Id targetId = createId( "target" );
+ final Id sourceId = IdGenerator.createId( SOURCE_NODE_ID, "source" );
+ final Id targetId = IdGenerator.createId( "target" );
final MarkedEdge edge = createEdge( sourceId, "edge", targetId );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802dcdec/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeSerializationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeSerializationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeSerializationTest.java
index 34aea46..d875e83 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeSerializationTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeSerializationTest.java
@@ -34,6 +34,7 @@ import org.slf4j.LoggerFactory;
import org.apache.usergrid.persistence.core.guice.MigrationManagerRule;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.core.util.IdGenerator;
import org.apache.usergrid.persistence.graph.Edge;
import org.apache.usergrid.persistence.graph.GraphFig;
import org.apache.usergrid.persistence.graph.MarkedEdge;
@@ -54,7 +55,7 @@ import com.netflix.astyanax.serializers.StringSerializer;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createEdge;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createGetByEdge;
-import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createId;
+import static org.apache.usergrid.persistence.core.util.IdGenerator.createId;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createMarkedEdge;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createSearchByEdge;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createSearchByEdgeAndId;
@@ -226,7 +227,7 @@ public abstract class EdgeSerializationTest {
final MarkedEdge edgev2 = createEdge( sourceId, "edge1", targetId, timestamp + 1 );
//we shouldn't get this one back
- final MarkedEdge diffTarget = createEdge( sourceId, "edge1", createId( "newTarget" ) );
+ final MarkedEdge diffTarget = createEdge( sourceId, "edge1", IdGenerator.createId( "newTarget" ) );
assertTrue( "Edge version 1 has lower time uuid",
Long.compare( edgev1.getTimestamp(), edgev2.getTimestamp() ) < 0 );
@@ -275,7 +276,7 @@ public abstract class EdgeSerializationTest {
final Id targetId1 = edge1.getTargetNode();
- final MarkedEdge edge2 = createEdge( sourceId, "edge", createId( "target2" ) );
+ final MarkedEdge edge2 = createEdge( sourceId, "edge", IdGenerator.createId( "target2" ) );
final Id targetId2 = edge2.getTargetNode();
@@ -329,7 +330,7 @@ public abstract class EdgeSerializationTest {
final Id targetId1 = edge1.getTargetNode();
- final MarkedEdge edge2 = createEdge( sourceId, "edge", createId( "target" ), timestamp + 1 );
+ final MarkedEdge edge2 = createEdge( sourceId, "edge", IdGenerator.createId( "target" ), timestamp + 1 );
final Id targetId2 = edge2.getTargetNode();
@@ -390,7 +391,7 @@ public abstract class EdgeSerializationTest {
final Id targetId1 = edge1.getTargetNode();
- final MarkedEdge edge2 = createEdge( sourceId, "edge", createId( "target" ), timestamp );
+ final MarkedEdge edge2 = createEdge( sourceId, "edge", IdGenerator.createId( "target" ), timestamp );
final Id targetId2 = edge2.getTargetNode();
@@ -498,7 +499,7 @@ public abstract class EdgeSerializationTest {
final Id targetId1 = edge1.getTargetNode();
- final MarkedEdge edge2 = createEdge( sourceId, "edge", createId( "target" ), timestamp + 1 );
+ final MarkedEdge edge2 = createEdge( sourceId, "edge", IdGenerator.createId( "target" ), timestamp + 1 );
final Id targetId2 = edge2.getTargetNode();
@@ -654,7 +655,7 @@ public abstract class EdgeSerializationTest {
int size = graphFig.getScanPageSize() * 2;
- final Id sourceId = createId( "source" );
+ final Id sourceId = IdGenerator.createId( "source" );
final String type = "edge";
Set<Edge> edges = new HashSet<Edge>( size );
@@ -663,7 +664,7 @@ public abstract class EdgeSerializationTest {
long timestamp = 0;
for ( int i = 0; i < size; i++ ) {
- final MarkedEdge edge = createEdge( sourceId, type, createId( "target" ), timestamp );
+ final MarkedEdge edge = createEdge( sourceId, type, IdGenerator.createId( "target" ), timestamp );
serialization.writeEdge( scope, edge, UUIDGenerator.newTimeUUID() ).execute();
edges.add( edge );
@@ -693,9 +694,9 @@ public abstract class EdgeSerializationTest {
public void testIteratorPaging() throws ConnectionException {
- final Id sourceId = createId( "source" );
+ final Id sourceId = IdGenerator.createId( "source" );
final String edgeType = "edge";
- final Id targetId = createId( "target" );
+ final Id targetId = IdGenerator.createId( "target" );
int writeCount = graphFig.getScanPageSize() * 3;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802dcdec/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/NodeSerializationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/NodeSerializationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/NodeSerializationTest.java
index d74eb4e..0480b99 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/NodeSerializationTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/NodeSerializationTest.java
@@ -31,6 +31,7 @@ import org.apache.usergrid.persistence.core.guice.MigrationManagerRule;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
import org.apache.usergrid.persistence.core.test.ITRunner;
import org.apache.usergrid.persistence.core.test.UseModules;
+import org.apache.usergrid.persistence.core.util.IdGenerator;
import org.apache.usergrid.persistence.graph.guice.TestGraphModule;
import org.apache.usergrid.persistence.model.entity.Id;
import org.apache.usergrid.persistence.model.util.UUIDGenerator;
@@ -40,7 +41,7 @@ import com.google.inject.Inject;
import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createEdge;
-import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createId;
+import static org.apache.usergrid.persistence.core.util.IdGenerator.createId;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.mockito.Mockito.mock;
@@ -85,7 +86,7 @@ public class NodeSerializationTest {
@Test
public void writeReadDelete() throws ConnectionException {
- final Id nodeId = createId( "test" );
+ final Id nodeId = IdGenerator.createId( "test" );
final long version = System.currentTimeMillis();
serialization.mark( scope, nodeId, version ).execute();
@@ -111,7 +112,7 @@ public class NodeSerializationTest {
@Test
public void noDeleteVersion() {
- final Id nodeId = createId( "test" );
+ final Id nodeId = IdGenerator.createId( "test" );
Optional<Long> returned = serialization.getMaxVersion( scope, nodeId );
@@ -128,7 +129,7 @@ public class NodeSerializationTest {
@Test
public void oldVersionDiscarded() throws ConnectionException {
- final Id nodeId = createId( "test" );
+ final Id nodeId = IdGenerator.createId( "test" );
final long version1 = System.currentTimeMillis();
final long version2 = version1 + 1;
@@ -171,9 +172,9 @@ public class NodeSerializationTest {
@Test
public void multiGet() throws ConnectionException {
- final Id nodeId1 = createId( "test" );
- final Id nodeId2 = createId( "test" );
- final Id nodeId3 = createId( "test" );
+ final Id nodeId1 = IdGenerator.createId( "test" );
+ final Id nodeId2 = IdGenerator.createId( "test" );
+ final Id nodeId3 = IdGenerator.createId( "test" );
final long version = System.currentTimeMillis();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802dcdec/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/migration/EdgeDataMigrationImplTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/migration/EdgeDataMigrationImplTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/migration/EdgeDataMigrationImplTest.java
new file mode 100644
index 0000000..09259f1
--- /dev/null
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/migration/EdgeDataMigrationImplTest.java
@@ -0,0 +1,177 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.usergrid.persistence.graph.serialization.impl.migration;
+
+
+import java.util.List;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import org.apache.usergrid.persistence.core.guice.DataMigrationResetRule;
+import org.apache.usergrid.persistence.core.migration.data.DataMigrationManager;
+import org.apache.usergrid.persistence.core.migration.data.TestProgressObserver;
+import org.apache.usergrid.persistence.core.migration.data.newimpls.MigrationDataProvider;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.core.scope.ApplicationScopeImpl;
+import org.apache.usergrid.persistence.core.test.ITRunner;
+import org.apache.usergrid.persistence.core.test.UseModules;
+import org.apache.usergrid.persistence.core.util.IdGenerator;
+import org.apache.usergrid.persistence.graph.Edge;
+import org.apache.usergrid.persistence.graph.GraphManager;
+import org.apache.usergrid.persistence.graph.GraphManagerFactory;
+import org.apache.usergrid.persistence.graph.guice.TestGraphModule;
+import org.apache.usergrid.persistence.graph.impl.SimpleSearchEdgeType;
+import org.apache.usergrid.persistence.graph.serialization.impl.GraphDataVersions;
+import org.apache.usergrid.persistence.model.entity.Id;
+
+import com.google.inject.Inject;
+
+import net.jcip.annotations.NotThreadSafe;
+
+import rx.Observable;
+
+import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createEdge;
+import static org.apache.usergrid.persistence.core.util.IdGenerator.createId;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+
+@NotThreadSafe
+@RunWith(ITRunner.class)
+@UseModules({ TestGraphModule.class })
+public class EdgeDataMigrationImplTest implements DataMigrationResetRule.DataMigrationManagerProvider {
+
+
+ @Inject
+ public DataMigrationManager dataMigrationManager;
+
+ @Inject
+ public GraphManagerFactory graphManagerFactory;
+
+ @Inject
+ public EdgeDataMigrationImpl edgeDataMigrationImpl;
+
+ /**
+ * Rule to do the resets we need
+ */
+ @Rule
+ public DataMigrationResetRule migrationTestRule = new DataMigrationResetRule(this, GraphMigrationPlugin.PLUGIN_NAME, GraphDataVersions.INITIAL.getVersion());
+
+
+
+
+ @Test
+ public void testIdMapping() throws Throwable {
+
+ assertEquals( "version 0 expected", GraphDataVersions.INITIAL.getVersion(),
+ dataMigrationManager.getCurrentVersion( GraphMigrationPlugin.PLUGIN_NAME ) );
+
+
+ final ApplicationScope applicationScope = new ApplicationScopeImpl( IdGenerator.createId( "application" ) );
+
+
+ GraphManager gm = graphManagerFactory.createEdgeManager(applicationScope );
+
+
+ final Id sourceId1 = IdGenerator.createId( "source1" );
+
+ final Id sourceId2 = IdGenerator.createId( "source2" );
+
+
+ final Id target1 = IdGenerator.createId( "target1" );
+
+ final Id target2 = IdGenerator.createId( "target2" );
+
+
+ Edge s1t1 = createEdge(sourceId1, "test", target1 );
+
+ Edge s1t2 = createEdge( sourceId1, "baz", target2 );
+
+ Edge s2t1 = createEdge(sourceId2, "foo", target1);
+
+ Edge s2t2 = createEdge( sourceId2, "bar", target2 );
+
+
+
+
+ gm.writeEdge( s1t1 ).toBlocking().last();
+ gm.writeEdge( s1t2 ).toBlocking().last();
+ gm.writeEdge( s2t1 ).toBlocking().last();
+ gm.writeEdge( s2t2 ).toBlocking().last();
+
+
+ //walk from s1 and s2
+ final Observable<GraphNode> graphNodes = Observable.from( new GraphNode( applicationScope, sourceId1), new GraphNode(applicationScope, sourceId2 ) );
+
+ final MigrationDataProvider<GraphNode> testMigrationProvider = new MigrationDataProvider<GraphNode>() {
+ @Override
+ public Observable<GraphNode> getData() {
+ return graphNodes;
+ }
+ };
+
+
+ final TestProgressObserver progressObserver = new TestProgressObserver();
+
+
+
+ //read everything in previous version format and put it into our types.
+
+
+ final int returned = edgeDataMigrationImpl.migrate( GraphDataVersions.INITIAL.getVersion() , testMigrationProvider, progressObserver );
+ //perform the migration
+
+ assertEquals( "Correct version returned", returned, GraphDataVersions.META_SHARDING.getVersion() );
+ assertFalse( "Progress observer should not have failed", progressObserver.getFailed() );
+ assertTrue( "Progress observer should have update messages", progressObserver.getUpdates().size() > 0 );
+
+
+ //now check we can still read our data.
+
+ List<String> source1Edges =
+ gm.getEdgeTypesFromSource( new SimpleSearchEdgeType( sourceId1, null, null ) ).toList().toBlocking().last();
+
+ //now check both edge types are present
+
+ assertTrue( "Edge type present", source1Edges.contains( "test" ) );
+ assertTrue( "Edge type present", source1Edges.contains( "baz" ) );
+
+
+ List<String> source2Edges =
+ gm.getEdgeTypesFromSource( new SimpleSearchEdgeType( sourceId2, null, null ) ).toList().toBlocking().last();
+
+ //now check both edge types are present
+
+ assertTrue( "Edge type present", source2Edges.contains( "foo" ) );
+ assertTrue( "Edge type present", source2Edges.contains( "bar" ) );
+
+
+
+ }
+
+
+ @Override
+ public DataMigrationManager getDataMigrationManager() {
+ return dataMigrationManager;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802dcdec/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeShardSerializationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeShardSerializationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeShardSerializationTest.java
index 9a87bba..2641ed7 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeShardSerializationTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeShardSerializationTest.java
@@ -31,6 +31,7 @@ import org.apache.usergrid.persistence.core.guice.MigrationManagerRule;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
import org.apache.usergrid.persistence.core.test.ITRunner;
import org.apache.usergrid.persistence.core.test.UseModules;
+import org.apache.usergrid.persistence.core.util.IdGenerator;
import org.apache.usergrid.persistence.graph.guice.TestGraphModule;
import org.apache.usergrid.persistence.model.entity.Id;
import org.apache.usergrid.persistence.model.util.UUIDGenerator;
@@ -40,7 +41,7 @@ import com.google.inject.Inject;
import com.netflix.astyanax.MutationBatch;
import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
-import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createId;
+import static org.apache.usergrid.persistence.core.util.IdGenerator.createId;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.mockito.Mockito.mock;
@@ -79,7 +80,7 @@ public class EdgeShardSerializationTest {
@Test
public void saveReturn() throws ConnectionException {
- final Id now = createId( "test" );
+ final Id now = IdGenerator.createId( "test" );
final long timestamp = 10000l;
@@ -137,7 +138,7 @@ public class EdgeShardSerializationTest {
@Test
public void saveReturnDelete() throws ConnectionException {
- final Id now = createId( "test" );
+ final Id now = IdGenerator.createId( "test" );
final long timestamp = 10000l;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802dcdec/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java
index 4e572c0..ac965cd 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java
@@ -32,6 +32,7 @@ import org.mockito.ArgumentCaptor;
import org.apache.usergrid.persistence.core.consistency.TimeService;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.core.util.IdGenerator;
import org.apache.usergrid.persistence.graph.GraphFig;
import org.apache.usergrid.persistence.graph.MarkedEdge;
import org.apache.usergrid.persistence.graph.SearchByIdType;
@@ -46,7 +47,7 @@ import com.netflix.astyanax.MutationBatch;
import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
import static junit.framework.TestCase.assertTrue;
-import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createId;
+import static org.apache.usergrid.persistence.core.util.IdGenerator.createId;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.fail;
@@ -140,7 +141,7 @@ public class NodeShardAllocationTest {
new NodeShardAllocationImpl( edgeShardSerialization, edgeColumnFamilies, shardedEdgeSerialization,
nodeShardCounterSerialization, timeService, graphFig, shardGroupCompaction );
- final Id nodeId = createId( "test" );
+ final Id nodeId = IdGenerator.createId( "test" );
final String type = "type";
final String subType = "subType";
@@ -183,7 +184,7 @@ public class NodeShardAllocationTest {
new NodeShardAllocationImpl( edgeShardSerialization, edgeColumnFamilies, shardedEdgeSerialization,
nodeShardApproximation, timeService, graphFig, shardGroupCompaction );
- final Id nodeId = createId( "test" );
+ final Id nodeId = IdGenerator.createId( "test" );
final String type = "type";
final String subType = "subType";
@@ -231,7 +232,7 @@ public class NodeShardAllocationTest {
new NodeShardAllocationImpl( edgeShardSerialization, edgeColumnFamilies, shardedEdgeSerialization,
nodeShardApproximation, timeService, graphFig, shardGroupCompaction );
- final Id nodeId = createId( "test" );
+ final Id nodeId = IdGenerator.createId( "test" );
final String type = "type";
final String subType = "subType";
@@ -266,8 +267,8 @@ public class NodeShardAllocationTest {
* Just use 2 edges. It means that we won't generate a boatload of data and kill our test. We just want
* to check that the one we want to return is correct
*/
- SimpleMarkedEdge skipped = new SimpleMarkedEdge( nodeId, type, createId( subType ), 10000, false );
- SimpleMarkedEdge keep = new SimpleMarkedEdge( nodeId, type, createId( subType ), 20000, false );
+ SimpleMarkedEdge skipped = new SimpleMarkedEdge( nodeId, type, IdGenerator.createId( subType ), 10000, false );
+ SimpleMarkedEdge keep = new SimpleMarkedEdge( nodeId, type, IdGenerator.createId( subType ), 20000, false );
//allocate some extra to ensure we seek the right value
List<MarkedEdge> edges = new ArrayList( numToIterate + 100 );
@@ -346,7 +347,7 @@ public class NodeShardAllocationTest {
new NodeShardAllocationImpl( edgeShardSerialization, edgeColumnFamilies, shardedEdgeSerialization,
nodeShardApproximation, timeService, graphFig, shardGroupCompaction );
- final Id nodeId = createId( "test" );
+ final Id nodeId = IdGenerator.createId( "test" );
final String type = "type";
final String subType = "subType";
@@ -365,9 +366,9 @@ public class NodeShardAllocationTest {
final long shardCount = graphFig.getShardSize();
- final SimpleMarkedEdge skippedEdge = new SimpleMarkedEdge( nodeId, type, createId( "subType" ), 10000l, false );
+ final SimpleMarkedEdge skippedEdge = new SimpleMarkedEdge( nodeId, type, IdGenerator.createId( "subType" ), 10000l, false );
final SimpleMarkedEdge returnedEdge =
- new SimpleMarkedEdge( nodeId, type, createId( "subType" ), 10005l, false );
+ new SimpleMarkedEdge( nodeId, type, IdGenerator.createId( "subType" ), 10005l, false );
List<MarkedEdge> iteratedEdges = new ArrayList<>( ( int ) shardCount );
@@ -437,7 +438,7 @@ public class NodeShardAllocationTest {
new NodeShardAllocationImpl( edgeShardSerialization, edgeColumnFamilies, shardedEdgeSerialization,
nodeShardApproximation, timeService, graphFig, shardGroupCompaction );
- final Id nodeId = createId( "test" );
+ final Id nodeId = IdGenerator.createId( "test" );
final String type = "type";
final String subType = "subType";
@@ -467,7 +468,7 @@ public class NodeShardAllocationTest {
final SimpleMarkedEdge returnedEdge =
- new SimpleMarkedEdge( nodeId, type, createId( "subType" ), 10005l, false );
+ new SimpleMarkedEdge( nodeId, type, IdGenerator.createId( "subType" ), 10005l, false );
final Iterator<MarkedEdge> edgeIterator = Collections.singleton( ( MarkedEdge ) returnedEdge ).iterator();
@@ -504,7 +505,7 @@ public class NodeShardAllocationTest {
new NodeShardAllocationImpl( edgeShardSerialization, edgeColumnFamilies, shardedEdgeSerialization,
nodeShardApproximation, timeService, graphFig, shardGroupCompaction );
- final Id nodeId = createId( "test" );
+ final Id nodeId = IdGenerator.createId( "test" );
final String type = "type";
final String subType = "subType";
@@ -644,7 +645,7 @@ public class NodeShardAllocationTest {
new NodeShardAllocationImpl( edgeShardSerialization, edgeColumnFamilies, shardedEdgeSerialization,
nodeShardApproximation, timeService, graphFig, shardGroupCompaction );
- final Id nodeId = createId( "test" );
+ final Id nodeId = IdGenerator.createId( "test" );
final String type = "type";
final String subType = "subType";
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802dcdec/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCacheTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCacheTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCacheTest.java
index c9f87fd..3b717a4 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCacheTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCacheTest.java
@@ -29,6 +29,7 @@ import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.core.util.IdGenerator;
import org.apache.usergrid.persistence.graph.GraphFig;
import org.apache.usergrid.persistence.graph.serialization.impl.shard.impl.NodeShardCacheImpl;
import org.apache.usergrid.persistence.model.entity.Id;
@@ -37,7 +38,7 @@ import org.apache.usergrid.persistence.model.util.UUIDGenerator;
import com.google.common.base.Optional;
import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
-import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createId;
+import static org.apache.usergrid.persistence.core.util.IdGenerator.createId;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
@@ -76,7 +77,7 @@ public class NodeShardCacheTest {
final NodeShardAllocation allocation = mock( NodeShardAllocation.class );
- final Id id = createId( "test" );
+ final Id id = IdGenerator.createId( "test" );
final String edgeType = "edge";
@@ -151,7 +152,7 @@ public class NodeShardCacheTest {
final NodeShardAllocation allocation = mock( NodeShardAllocation.class );
- final Id id = createId( "test" );
+ final Id id = IdGenerator.createId( "test" );
final String edgeType = "edge";
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802dcdec/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardGroupCompactionTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardGroupCompactionTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardGroupCompactionTest.java
index 71b1f0d..68b6f8f 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardGroupCompactionTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardGroupCompactionTest.java
@@ -33,12 +33,13 @@ import org.apache.usergrid.persistence.core.consistency.TimeService;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
import org.apache.usergrid.persistence.core.scope.ApplicationScopeImpl;
import org.apache.usergrid.persistence.core.task.TaskExecutor;
+import org.apache.usergrid.persistence.core.util.IdGenerator;
import org.apache.usergrid.persistence.graph.GraphFig;
import org.apache.usergrid.persistence.graph.serialization.impl.shard.impl.ShardGroupCompactionImpl;
import com.netflix.astyanax.Keyspace;
-import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createId;
+import static org.apache.usergrid.persistence.core.util.IdGenerator.createId;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
@@ -59,7 +60,7 @@ public class ShardGroupCompactionTest {
when( graphFig.getShardAuditWorkerQueueSize() ).thenReturn( 1000 );
- this.scope = new ApplicationScopeImpl( createId( "application" ) );
+ this.scope = new ApplicationScopeImpl( IdGenerator.createId( "application" ) );
}
@@ -99,7 +100,7 @@ public class ShardGroupCompactionTest {
edgeColumnFamilies, keyspace, edgeShardSerialization, taskExecutor );
- DirectedEdgeMeta directedEdgeMeta = DirectedEdgeMeta.fromSourceNode( createId( "source" ), "test" );
+ DirectedEdgeMeta directedEdgeMeta = DirectedEdgeMeta.fromSourceNode( IdGenerator.createId( "source" ), "test" );
try {
compaction.compact( this.scope, directedEdgeMeta, group );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802dcdec/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java
index e08abd5..32a0cda 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java
@@ -46,6 +46,7 @@ import org.slf4j.LoggerFactory;
import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
import org.apache.usergrid.persistence.core.consistency.TimeService;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.core.util.IdGenerator;
import org.apache.usergrid.persistence.graph.GraphFig;
import org.apache.usergrid.persistence.graph.serialization.impl.shard.DirectedEdgeMeta;
import org.apache.usergrid.persistence.graph.serialization.impl.shard.NodeShardApproximation;
@@ -64,7 +65,7 @@ import com.netflix.astyanax.model.ColumnFamily;
import com.netflix.astyanax.model.ConsistencyLevel;
import com.netflix.astyanax.retry.RetryPolicy;
-import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createId;
+import static org.apache.usergrid.persistence.core.util.IdGenerator.createId;
import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
@@ -120,7 +121,7 @@ public class NodeShardApproximationTest {
new NodeShardApproximationImpl( graphFig, nodeShardCounterSerialization, timeService );
- final Id id = createId( "test" );
+ final Id id = IdGenerator.createId( "test" );
final Shard shard = new Shard( 0, 0, true );
final String type = "type";
final String type2 = "subType";
@@ -149,7 +150,7 @@ public class NodeShardApproximationTest {
final int increments = 1000000;
final int workers = Runtime.getRuntime().availableProcessors() * 2;
- final Id id = createId( "test" );
+ final Id id = IdGenerator.createId( "test" );
final String type = "type";
final String type2 = "subType";
@@ -216,7 +217,7 @@ public class NodeShardApproximationTest {
final int increments = 1000000;
final int workers = Runtime.getRuntime().availableProcessors() * 2;
- final Id id = createId( "test" );
+ final Id id = IdGenerator.createId( "test" );
final String type = "type";
final String type2 = "subType";
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802dcdec/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerializationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerializationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerializationTest.java
index f80f44d..86f2491 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerializationTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerializationTest.java
@@ -20,7 +20,6 @@ package org.apache.usergrid.persistence.graph.serialization.impl.shard.count;
import org.junit.Before;
-import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -31,6 +30,7 @@ import org.apache.usergrid.persistence.core.guice.MigrationManagerRule;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
import org.apache.usergrid.persistence.core.test.ITRunner;
import org.apache.usergrid.persistence.core.test.UseModules;
+import org.apache.usergrid.persistence.core.util.IdGenerator;
import org.apache.usergrid.persistence.graph.GraphFig;
import org.apache.usergrid.persistence.graph.guice.TestGraphModule;
import org.apache.usergrid.persistence.graph.serialization.EdgeSerialization;
@@ -43,7 +43,7 @@ import com.google.inject.Inject;
import com.netflix.astyanax.Keyspace;
import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
-import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createId;
+import static org.apache.usergrid.persistence.core.util.IdGenerator.createId;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -92,7 +92,7 @@ public class NodeShardCounterSerializationTest {
public void testWritesRead() throws ConnectionException {
- final Id id = createId( "test" );
+ final Id id = IdGenerator.createId( "test" );
ShardKey key1 = new ShardKey( scope, new Shard( 0, 0, false ), DirectedEdgeMeta.fromSourceNode( id, "type1" ) );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802dcdec/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardEntryGroupIteratorTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardEntryGroupIteratorTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardEntryGroupIteratorTest.java
index 9544865..0eccc3e 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardEntryGroupIteratorTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardEntryGroupIteratorTest.java
@@ -31,13 +31,14 @@ import org.junit.Test;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
import org.apache.usergrid.persistence.core.scope.ApplicationScopeImpl;
+import org.apache.usergrid.persistence.core.util.IdGenerator;
import org.apache.usergrid.persistence.graph.serialization.impl.shard.DirectedEdgeMeta;
import org.apache.usergrid.persistence.graph.serialization.impl.shard.Shard;
import org.apache.usergrid.persistence.graph.serialization.impl.shard.ShardEntryGroup;
import org.apache.usergrid.persistence.graph.serialization.impl.shard.ShardGroupCompaction;
import static junit.framework.TestCase.assertTrue;
-import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createId;
+import static org.apache.usergrid.persistence.core.util.IdGenerator.createId;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.mockito.Matchers.eq;
@@ -52,8 +53,8 @@ public class ShardEntryGroupIteratorTest {
@Test(expected = IllegalArgumentException.class)
public void noShards() {
- final ApplicationScope scope = new ApplicationScopeImpl( createId( "application" ) );
- final DirectedEdgeMeta directedEdgeMeta = DirectedEdgeMeta.fromSourceNode( createId( "source" ), "test" );
+ final ApplicationScope scope = new ApplicationScopeImpl( IdGenerator.createId( "application" ) );
+ final DirectedEdgeMeta directedEdgeMeta = DirectedEdgeMeta.fromSourceNode( IdGenerator.createId( "source" ), "test" );
final ShardGroupCompaction shardGroupCompaction = mock( ShardGroupCompaction.class );
final long delta = 10000;
final Iterator<Shard> noShards = Collections.<Shard>emptyList().iterator();
@@ -66,8 +67,8 @@ public class ShardEntryGroupIteratorTest {
@Test
public void existingSingleShard() {
- final ApplicationScope scope = new ApplicationScopeImpl( createId( "application" ) );
- final DirectedEdgeMeta directedEdgeMeta = DirectedEdgeMeta.fromSourceNode( createId( "source" ), "test" );
+ final ApplicationScope scope = new ApplicationScopeImpl( IdGenerator.createId( "application" ) );
+ final DirectedEdgeMeta directedEdgeMeta = DirectedEdgeMeta.fromSourceNode( IdGenerator.createId( "source" ), "test" );
final ShardGroupCompaction shardGroupCompaction = mock( ShardGroupCompaction.class );
@@ -119,8 +120,8 @@ public class ShardEntryGroupIteratorTest {
@Test
public void boundedShardSets() {
- final ApplicationScope scope = new ApplicationScopeImpl( createId( "application" ) );
- final DirectedEdgeMeta directedEdgeMeta = DirectedEdgeMeta.fromSourceNode( createId( "source" ), "test" );
+ final ApplicationScope scope = new ApplicationScopeImpl( IdGenerator.createId( "application" ) );
+ final DirectedEdgeMeta directedEdgeMeta = DirectedEdgeMeta.fromSourceNode( IdGenerator.createId( "source" ), "test" );
final ShardGroupCompaction shardGroupCompaction = mock( ShardGroupCompaction.class );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802dcdec/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/comparators/SourceDirectedEdgeDescendingComparatorTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/comparators/SourceDirectedEdgeDescendingComparatorTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/comparators/SourceDirectedEdgeDescendingComparatorTest.java
index bb9fd0d..1e18c67 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/comparators/SourceDirectedEdgeDescendingComparatorTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/comparators/SourceDirectedEdgeDescendingComparatorTest.java
@@ -26,11 +26,12 @@ import java.util.UUID;
import org.junit.Test;
+import org.apache.usergrid.persistence.core.util.IdGenerator;
import org.apache.usergrid.persistence.graph.impl.SimpleMarkedEdge;
import org.apache.usergrid.persistence.model.entity.Id;
import org.apache.usergrid.persistence.model.util.UUIDGenerator;
-import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createId;
+import static org.apache.usergrid.persistence.core.util.IdGenerator.createId;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -43,8 +44,8 @@ public class SourceDirectedEdgeDescendingComparatorTest {
@Test
public void sameEdges() {
- final Id sourceId = createId( "source" );
- final Id targetId = createId( "target" );
+ final Id sourceId = IdGenerator.createId( "source" );
+ final Id targetId = IdGenerator.createId( "target" );
final String type = "type";
final long timestamp = 10000;
@@ -65,8 +66,8 @@ public class SourceDirectedEdgeDescendingComparatorTest {
@Test
public void timestampDifferent() {
- final Id sourceId = createId( "source" );
- final Id targetId = createId( "target" );
+ final Id sourceId = IdGenerator.createId( "source" );
+ final Id targetId = IdGenerator.createId( "target" );
final String type = "type";
final long timestamp = 10000;
@@ -88,9 +89,9 @@ public class SourceDirectedEdgeDescendingComparatorTest {
@Test
public void uuidDifferent() {
- final Id sourceId1 = createId( "source" );
- final Id sourceId2 = createId( "source" );
- final Id targetId = createId( "target" );
+ final Id sourceId1 = IdGenerator.createId( "source" );
+ final Id sourceId2 = IdGenerator.createId( "source" );
+ final Id targetId = IdGenerator.createId( "target" );
final String type = "type";
final long timestamp = 10000;
@@ -114,9 +115,9 @@ public class SourceDirectedEdgeDescendingComparatorTest {
final UUID sourceId = UUIDGenerator.newTimeUUID();
- final Id sourceId1 = createId( sourceId, "source1" );
- final Id sourceId2 = createId( sourceId, "source2" );
- final Id targetId = createId( "target" );
+ final Id sourceId1 = IdGenerator.createId( sourceId, "source1" );
+ final Id sourceId2 = IdGenerator.createId( sourceId, "source2" );
+ final Id targetId = IdGenerator.createId( "target" );
final String type = "type";
final long timestamp = 10000;