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 2014/10/28 19:09:39 UTC
[3/3] git commit: Both V1 and V2 impl correct.
Both V1 and V2 impl correct.
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/ca943fed
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/ca943fed
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/ca943fed
Branch: refs/heads/key-row-sharding
Commit: ca943fed740d0c75db5cf34f1c9906e99df99710
Parents: 21d399e
Author: Todd Nine <tn...@apigee.com>
Authored: Tue Oct 28 12:09:33 2014 -0600
Committer: Todd Nine <tn...@apigee.com>
Committed: Tue Oct 28 12:09:33 2014 -0600
----------------------------------------------------------------------
portal/config.js | 3 +-
.../persistence/core/guice/CurrentImpl.java | 42 +++++
.../persistence/core/guice/CurrentVersion.java | 42 -----
.../persistence/core/guice/PreviousImpl.java | 42 +++++
.../persistence/core/guice/PreviousVersion.java | 42 -----
.../persistence/core/guice/ProxyImpl.java | 42 +++++
.../persistence/core/guice/ProxyVersion.java | 42 -----
.../persistence/graph/guice/GraphModule.java | 50 ++++-
.../graph/impl/GraphManagerImpl.java | 4 +-
.../graph/impl/stage/EdgeMetaRepairImpl.java | 3 +-
.../impl/stage/NodeDeleteListenerImpl.java | 3 +-
.../EdgeMetadataSerializationProxyImpl.java | 147 +++++++++++++++
.../impl/EdgeMetadataSerializationV2Impl.java | 18 +-
.../impl/shard/impl/EdgeSearcher.java | 10 +-
.../impl/shard/impl/ShardsColumnIterator.java | 15 +-
.../graph/GraphManagerShardConsistencyIT.java | 1 -
.../EdgeMetaDataSerializationBridgeTest.java | 58 ------
.../EdgeMetaDataSerializationProxyV1Test.java | 58 ++++++
.../EdgeMetaDataSerializationProxyV2Test.java | 57 ++++++
.../EdgeMetaDataSerializationV1Test.java | 19 +-
.../EdgeMetaDataSerializationV2Test.java | 40 ++--
.../EdgeMetadataSerializationTest.java | 24 +--
.../serialization/EdgeSerializationTest.java | 46 +++--
.../serialization/NodeSerializationTest.java | 6 +-
.../PermanentSerializationTest.java | 5 +-
.../graph/serialization/TestCount.java | 52 +++---
.../impl/shard/EdgeShardSerializationTest.java | 31 ++--
.../impl/shard/NodeShardAllocationTest.java | 15 +-
.../impl/shard/NodeShardCacheTest.java | 118 +++++-------
.../impl/shard/ShardEntryGroupTest.java | 57 +++---
.../impl/shard/ShardGroupCompactionTest.java | 181 +++++++++----------
.../shard/count/NodeShardApproximationTest.java | 18 +-
.../NodeShardCounterSerializationTest.java | 6 +-
.../shard/impl/ShardEntryGroupIteratorTest.java | 9 +-
...rceDirectedEdgeDescendingComparatorTest.java | 4 +-
35 files changed, 754 insertions(+), 556 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/portal/config.js
----------------------------------------------------------------------
diff --git a/portal/config.js b/portal/config.js
index c65de7e..70138f4 100644
--- a/portal/config.js
+++ b/portal/config.js
@@ -24,7 +24,8 @@ Usergrid.showNotifcations = true;
// used only if hostname does not match a real server name
-Usergrid.overrideUrl = 'https://api.usergrid.com/';
+Usergrid.overrideUrl = 'http://localhost:8080/';
+//Usergrid.overrideUrl = 'https://api.usergrid.com/';
Usergrid.options = {
client:{
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/CurrentImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/CurrentImpl.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/CurrentImpl.java
new file mode 100644
index 0000000..a071edf
--- /dev/null
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/CurrentImpl.java
@@ -0,0 +1,42 @@
+/*
+ *
+ * * 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.core.guice;
+
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import com.google.inject.BindingAnnotation;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+
+/**
+ * Represents 2 versions of an impl. Generally used for online migration. This represents the version that is the
+ * current version of the implementation. I.E the "new" version.
+ */
+@BindingAnnotation
+@Target({ FIELD, PARAMETER, METHOD }) @Retention(RUNTIME)
+public @interface CurrentImpl {}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/CurrentVersion.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/CurrentVersion.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/CurrentVersion.java
deleted file mode 100644
index c375df3..0000000
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/CurrentVersion.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *
- * * 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.core.guice;
-
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import com.google.inject.BindingAnnotation;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-
-/**
- * Represents 2 versions of an impl. Generally used for online migration. This represents the version that is the
- * current version of the implementation. I.E the "new" version.
- */
-@BindingAnnotation
-@Target({ FIELD, PARAMETER, METHOD }) @Retention(RUNTIME)
-public @interface CurrentVersion {}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/PreviousImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/PreviousImpl.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/PreviousImpl.java
new file mode 100644
index 0000000..9d5e359
--- /dev/null
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/PreviousImpl.java
@@ -0,0 +1,42 @@
+/*
+ *
+ * * 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.core.guice;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import com.google.inject.BindingAnnotation;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+
+
+/**
+ * Represents 2 versions of an impl. Generally used for online migration. This represents the version that is the
+ * previous version of the implementation. I.E the "old" version.
+ */
+@BindingAnnotation
+@Target({ FIELD, PARAMETER, METHOD }) @Retention(RUNTIME)
+public @interface PreviousImpl {}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/PreviousVersion.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/PreviousVersion.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/PreviousVersion.java
deleted file mode 100644
index edda25a..0000000
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/PreviousVersion.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *
- * * 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.core.guice;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import com.google.inject.BindingAnnotation;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-
-
-/**
- * Represents 2 versions of an impl. Generally used for online migration. This represents the version that is the
- * previous version of the implementation. I.E the "old" version.
- */
-@BindingAnnotation
-@Target({ FIELD, PARAMETER, METHOD }) @Retention(RUNTIME)
-public @interface PreviousVersion {}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/ProxyImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/ProxyImpl.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/ProxyImpl.java
new file mode 100644
index 0000000..0bebd6c
--- /dev/null
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/ProxyImpl.java
@@ -0,0 +1,42 @@
+/*
+ *
+ * * 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.core.guice;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import com.google.inject.BindingAnnotation;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+
+
+/**
+ * Represents 2 versions of an impl. Generally used for online migration. This represents the version of the impl
+ * that is responsible for bridging the versions from previous to current during the migration.
+ */
+@BindingAnnotation
+@Target({ FIELD, PARAMETER, METHOD }) @Retention(RUNTIME)
+public @interface ProxyImpl {}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/ProxyVersion.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/ProxyVersion.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/ProxyVersion.java
deleted file mode 100644
index 5209882..0000000
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/ProxyVersion.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *
- * * 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.core.guice;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import com.google.inject.BindingAnnotation;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-
-
-/**
- * Represents 2 versions of an impl. Generally used for online migration. This represents the version of the impl
- * that is responsible for bridging the versions from previous to current during the migration.
- */
-@BindingAnnotation
-@Target({ FIELD, PARAMETER, METHOD }) @Retention(RUNTIME)
-public @interface ProxyVersion {}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java
index 41a66c5..2cbc5e8 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java
@@ -21,8 +21,12 @@ package org.apache.usergrid.persistence.graph.guice;
import org.safehaus.guicyfig.GuicyFigModule;
+import org.apache.usergrid.persistence.core.astyanax.CassandraConfig;
import org.apache.usergrid.persistence.core.consistency.TimeService;
import org.apache.usergrid.persistence.core.consistency.TimeServiceImpl;
+import org.apache.usergrid.persistence.core.guice.CurrentImpl;
+import org.apache.usergrid.persistence.core.guice.PreviousImpl;
+import org.apache.usergrid.persistence.core.guice.ProxyImpl;
import org.apache.usergrid.persistence.core.migration.Migration;
import org.apache.usergrid.persistence.core.task.NamedTaskExecutorImpl;
import org.apache.usergrid.persistence.core.task.TaskExecutor;
@@ -41,7 +45,9 @@ import org.apache.usergrid.persistence.graph.impl.stage.NodeDeleteListenerImpl;
import org.apache.usergrid.persistence.graph.serialization.EdgeMetadataSerialization;
import org.apache.usergrid.persistence.graph.serialization.EdgeSerialization;
import org.apache.usergrid.persistence.graph.serialization.NodeSerialization;
+import org.apache.usergrid.persistence.graph.serialization.impl.EdgeMetadataSerializationProxyImpl;
import org.apache.usergrid.persistence.graph.serialization.impl.EdgeMetadataSerializationV1Impl;
+import org.apache.usergrid.persistence.graph.serialization.impl.EdgeMetadataSerializationV2Impl;
import org.apache.usergrid.persistence.graph.serialization.impl.EdgeSerializationImpl;
import org.apache.usergrid.persistence.graph.serialization.impl.NodeSerializationImpl;
import org.apache.usergrid.persistence.graph.serialization.impl.shard.EdgeColumnFamilies;
@@ -70,6 +76,7 @@ import com.google.inject.Provides;
import com.google.inject.Singleton;
import com.google.inject.assistedinject.FactoryModuleBuilder;
import com.google.inject.multibindings.Multibinder;
+import com.netflix.astyanax.Keyspace;
public class GraphModule extends AbstractModule {
@@ -81,7 +88,6 @@ public class GraphModule extends AbstractModule {
install( new GuicyFigModule( GraphFig.class ) );
- bind( EdgeMetadataSerialization.class ).to( EdgeMetadataSerializationV1Impl.class );
bind( NodeSerialization.class ).to( NodeSerializationImpl.class );
bind( TimeService.class ).to( TimeServiceImpl.class );
@@ -126,7 +132,7 @@ public class GraphModule extends AbstractModule {
bind( EdgeColumnFamilies.class ).to( SizebasedEdgeColumnFamilies.class );
- bind( ShardGroupCompaction.class).to( ShardGroupCompactionImpl.class);
+ bind( ShardGroupCompaction.class ).to( ShardGroupCompactionImpl.class );
/**
@@ -141,13 +147,16 @@ public class GraphModule extends AbstractModule {
//do multibindings for migrations
Multibinder<Migration> migrationBinding = Multibinder.newSetBinder( binder(), Migration.class );
migrationBinding.addBinding().to( Key.get( NodeSerialization.class ) );
- migrationBinding.addBinding().to( Key.get( EdgeMetadataSerialization.class ) );
//bind each singleton to the multi set. Otherwise we won't migrate properly
migrationBinding.addBinding().to( Key.get( EdgeColumnFamilies.class ) );
migrationBinding.addBinding().to( Key.get( EdgeShardSerialization.class ) );
migrationBinding.addBinding().to( Key.get( NodeShardCounterSerialization.class ) );
+
+ //Get the old version and the new one
+ migrationBinding.addBinding().to( Key.get( EdgeMetadataSerialization.class, PreviousImpl.class) );
+ migrationBinding.addBinding().to( Key.get( EdgeMetadataSerialization.class, CurrentImpl.class ) );
}
@@ -155,11 +164,42 @@ public class GraphModule extends AbstractModule {
@Singleton
@Provides
@GraphTaskExecutor
- public TaskExecutor graphTaskExecutor(final GraphFig graphFig){
- return new NamedTaskExecutorImpl( "graphTaskExecutor", graphFig.getShardAuditWorkerCount(), graphFig.getShardAuditWorkerQueueSize() );
+ public TaskExecutor graphTaskExecutor( final GraphFig graphFig ) {
+ return new NamedTaskExecutorImpl( "graphTaskExecutor", graphFig.getShardAuditWorkerCount(),
+ graphFig.getShardAuditWorkerQueueSize() );
}
+ @Inject
+ @Singleton
+ @Provides
+ @PreviousImpl
+ public EdgeMetadataSerialization getPreviousEdgeMetaSerialization( final Keyspace keyspace,
+ final CassandraConfig cassandraConfig,
+ final GraphFig graphFig ) {
+ return new EdgeMetadataSerializationV1Impl( keyspace, cassandraConfig, graphFig );
+ }
+
+
+ @Inject
+ @Singleton
+ @Provides
+ @CurrentImpl
+ public EdgeMetadataSerialization getCurrentEdgeMetaSerialization( final Keyspace keyspace,
+ final CassandraConfig cassandraConfig,
+ final GraphFig graphFig ) {
+ return new EdgeMetadataSerializationV2Impl( keyspace, cassandraConfig, graphFig );
+ }
+
+
+ @Inject
+ @Singleton
+ @Provides
+ @ProxyImpl
+ public EdgeMetadataSerialization getCurrentEdgeMetaSerialization( @PreviousImpl final EdgeMetadataSerialization previous,
+ @CurrentImpl final EdgeMetadataSerialization current ) {
+ return new EdgeMetadataSerializationProxyImpl( previous, current );
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/GraphManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/GraphManagerImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/GraphManagerImpl.java
index 8b8a3ee..564dc5b 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/GraphManagerImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/GraphManagerImpl.java
@@ -28,6 +28,7 @@ import java.util.UUID;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.usergrid.persistence.core.guice.ProxyImpl;
import org.apache.usergrid.persistence.core.hystrix.HystrixCassandra;
import org.apache.usergrid.persistence.core.rx.ObservableIterator;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
@@ -54,7 +55,6 @@ import com.google.common.base.Preconditions;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
import com.netflix.astyanax.MutationBatch;
-import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
import rx.Observable;
import rx.Observer;
@@ -90,7 +90,7 @@ public class GraphManagerImpl implements GraphManager {
@Inject
- public GraphManagerImpl( final EdgeMetadataSerialization edgeMetadataSerialization,
+ public GraphManagerImpl( @ProxyImpl final EdgeMetadataSerialization edgeMetadataSerialization,
final EdgeSerialization storageEdgeSerialization,
final NodeSerialization nodeSerialization, final GraphFig graphFig,
@Assisted final ApplicationScope scope, final EdgeDeleteListener edgeDeleteListener,
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/stage/EdgeMetaRepairImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/stage/EdgeMetaRepairImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/stage/EdgeMetaRepairImpl.java
index 7e09eca..0e1c4e2 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/stage/EdgeMetaRepairImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/stage/EdgeMetaRepairImpl.java
@@ -27,6 +27,7 @@ import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.usergrid.persistence.core.guice.ProxyImpl;
import org.apache.usergrid.persistence.core.hystrix.HystrixCassandra;
import org.apache.usergrid.persistence.core.rx.ObservableIterator;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
@@ -70,7 +71,7 @@ public class EdgeMetaRepairImpl implements EdgeMetaRepair {
@Inject
- public EdgeMetaRepairImpl( final EdgeMetadataSerialization edgeMetadataSerialization, final Keyspace keyspace,
+ public EdgeMetaRepairImpl( @ProxyImpl final EdgeMetadataSerialization edgeMetadataSerialization, final Keyspace keyspace,
final GraphFig graphFig, final EdgeSerialization storageEdgeSerialization ) {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/stage/NodeDeleteListenerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/stage/NodeDeleteListenerImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/stage/NodeDeleteListenerImpl.java
index 2be6c55..f167f0c 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/stage/NodeDeleteListenerImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/stage/NodeDeleteListenerImpl.java
@@ -28,6 +28,7 @@ import java.util.UUID;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.usergrid.persistence.core.guice.ProxyImpl;
import org.apache.usergrid.persistence.core.hystrix.HystrixCassandra;
import org.apache.usergrid.persistence.core.rx.ObservableIterator;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
@@ -74,7 +75,7 @@ public class NodeDeleteListenerImpl implements NodeDeleteListener {
*/
@Inject
public NodeDeleteListenerImpl( final NodeSerialization nodeSerialization,
- final EdgeMetadataSerialization edgeMetadataSerialization,
+ @ProxyImpl final EdgeMetadataSerialization edgeMetadataSerialization,
final EdgeMetaRepair edgeMetaRepair, final GraphFig graphFig,
final EdgeSerialization storageSerialization,
final Keyspace keyspace ) {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationProxyImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationProxyImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationProxyImpl.java
new file mode 100644
index 0000000..4fbe801
--- /dev/null
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationProxyImpl.java
@@ -0,0 +1,147 @@
+/*
+ *
+ * * 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;
+
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
+import org.apache.usergrid.persistence.core.guice.CurrentImpl;
+import org.apache.usergrid.persistence.core.guice.PreviousImpl;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.graph.Edge;
+import org.apache.usergrid.persistence.graph.SearchEdgeType;
+import org.apache.usergrid.persistence.graph.SearchIdType;
+import org.apache.usergrid.persistence.graph.serialization.EdgeMetadataSerialization;
+import org.apache.usergrid.persistence.model.entity.Id;
+
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.netflix.astyanax.MutationBatch;
+
+
+@Singleton
+public class EdgeMetadataSerializationProxyImpl implements EdgeMetadataSerialization {
+
+ private EdgeMetadataSerialization previous;
+ private EdgeMetadataSerialization current;
+
+
+ /**
+ * TODO fin
+ */
+ @Inject
+ public EdgeMetadataSerializationProxyImpl( @PreviousImpl final EdgeMetadataSerialization previous,
+ @CurrentImpl final EdgeMetadataSerialization current ) {
+ this.previous = previous;
+ this.current = current;
+ }
+
+
+ @Override
+ public MutationBatch writeEdge( final ApplicationScope scope, final Edge edge ) {
+ return null;
+ }
+
+
+ @Override
+ public MutationBatch removeEdgeTypeFromSource( final ApplicationScope scope, final Edge edge ) {
+ return null;
+ }
+
+
+ @Override
+ public MutationBatch removeEdgeTypeFromSource( final ApplicationScope scope, final Id sourceNode, final String type,
+ final long timestamp ) {
+ return null;
+ }
+
+
+ @Override
+ public MutationBatch removeIdTypeFromSource( final ApplicationScope scope, final Edge edge ) {
+ return null;
+ }
+
+
+ @Override
+ public MutationBatch removeIdTypeFromSource( final ApplicationScope scope, final Id sourceNode, final String type,
+ final String idType, final long timestamp ) {
+ return null;
+ }
+
+
+ @Override
+ public MutationBatch removeEdgeTypeToTarget( final ApplicationScope scope, final Edge edge ) {
+ return null;
+ }
+
+
+ @Override
+ public MutationBatch removeEdgeTypeToTarget( final ApplicationScope scope, final Id targetNode, final String type,
+ final long timestamp ) {
+ return null;
+ }
+
+
+ @Override
+ public MutationBatch removeIdTypeToTarget( final ApplicationScope scope, final Edge edge ) {
+ return null;
+ }
+
+
+ @Override
+ public MutationBatch removeIdTypeToTarget( final ApplicationScope scope, final Id targetNode, final String type,
+ final String idType, final long timestamp ) {
+ return null;
+ }
+
+
+ @Override
+ public Iterator<String> getEdgeTypesFromSource( final ApplicationScope scope, final SearchEdgeType search ) {
+ return null;
+ }
+
+
+ @Override
+ public Iterator<String> getIdTypesFromSource( final ApplicationScope scope, final SearchIdType search ) {
+ return null;
+ }
+
+
+ @Override
+ public Iterator<String> getEdgeTypesToTarget( final ApplicationScope scope, final SearchEdgeType search ) {
+ return null;
+ }
+
+
+ @Override
+ public Iterator<String> getIdTypesToTarget( final ApplicationScope scope, final SearchIdType search ) {
+ return null;
+ }
+
+
+ @Override
+ public Collection<MultiTennantColumnFamilyDefinition> getColumnFamilies() {
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationV2Impl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationV2Impl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationV2Impl.java
index d7ffeea..0c3a04a 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationV2Impl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationV2Impl.java
@@ -55,6 +55,7 @@ import org.apache.usergrid.persistence.graph.serialization.EdgeMetadataSerializa
import org.apache.usergrid.persistence.graph.serialization.util.GraphValidation;
import org.apache.usergrid.persistence.model.entity.Id;
+import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.hash.Funnel;
import com.google.common.hash.PrimitiveSink;
@@ -451,8 +452,8 @@ public class EdgeMetadataSerializationV2Impl implements EdgeMetadataSerializatio
final int[] bucketIds = edgeTypeExpandingShardLocator.getAllBuckets( edgeIdTypeKey );
//no generics is intentional here
- final List<BucketScopedRowKey<Id>> buckets =
- BucketScopedRowKey.fromRange( applicationId, searchNode, bucketIds );
+ final List<BucketScopedRowKey<EdgeIdTypeKey>> buckets =
+ BucketScopedRowKey.fromRange( applicationId, edgeIdTypeKey, bucketIds );
final ColumnSearch<String> columnSearch = createSearch( search );
@@ -518,6 +519,19 @@ public class EdgeMetadataSerializationV2Impl implements EdgeMetadataSerializatio
public void buildRange( final RangeBuilder rangeBuilder ) {
buildRange( rangeBuilder, null );
}
+
+
+ @Override
+ public boolean skipFirst( final String first ) {
+
+ final Optional<String> last = search.getLast();
+
+ if(!last.isPresent()){
+ return false;
+ }
+
+ return last.get().equals( first );
+ }
};
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeSearcher.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeSearcher.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeSearcher.java
index e1800c0..57c5814 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeSearcher.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeSearcher.java
@@ -71,11 +71,13 @@ public abstract class EdgeSearcher<R, C, T> implements ColumnParser<C, T>, Colum
}
+ @Override
+ public boolean skipFirst( final T first ) {
+ if(last == null){
+ return false;
+ }
-
-
- public boolean hasPage() {
- return last.isPresent();
+ return last.equals( first );
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardsColumnIterator.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardsColumnIterator.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardsColumnIterator.java
index 0020f8c..e35107c 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardsColumnIterator.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardsColumnIterator.java
@@ -105,20 +105,7 @@ public class ShardsColumnIterator<R, C, T> implements Iterator<T> {
*/
final List<ScopedRowKey<R>> rowKeys = searcher.getRowKeys();
-
- if(rowKeys.size() == 1){
-
- final RowQuery<ScopedRowKey<R>, C> query =
- keyspace.prepareQuery( cf ).setConsistencyLevel( consistencyLevel ).getKey( rowKeys.get( 0 ) )
- .autoPaginate( true ).withColumnRange( rangeBuilder.build() );
-
- currentColumnIterator = new ColumnNameIterator<>( query, searcher, searcher.hasPage() );
- }
-
- else{
-
- currentColumnIterator = new MultiRowColumnIterator<>( keyspace, cf, consistencyLevel, searcher, searcher, searcher.getComparator(), rowKeys, pageSize);
- }
+ currentColumnIterator = new MultiRowColumnIterator<>( keyspace, cf, consistencyLevel, searcher, searcher, searcher.getComparator(), rowKeys, pageSize);
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/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 41248fc..ec3fb29 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
@@ -31,7 +31,6 @@ import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationBridgeTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationBridgeTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationBridgeTest.java
deleted file mode 100644
index 96b3a07..0000000
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationBridgeTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *
- * * 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;/*
- * 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.
- */
-
-
-import org.apache.usergrid.persistence.core.guice.CurrentVersion;
-
-import com.google.inject.Inject;
-
-
-public class EdgeMetaDataSerializationBridgeTest extends EdgeMetadataSerializationTest {
-
-
- @Inject
- @CurrentVersion
- protected EdgeMetadataSerialization serialization;
-
- @Override
- protected EdgeMetadataSerialization getSerializationImpl() {
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationProxyV1Test.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationProxyV1Test.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationProxyV1Test.java
new file mode 100644
index 0000000..663a43f
--- /dev/null
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationProxyV1Test.java
@@ -0,0 +1,58 @@
+/*
+ *
+ * * 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;
+
+
+import org.jukito.UseModules;
+import org.junit.runner.RunWith;
+
+import org.apache.usergrid.persistence.core.cassandra.ITRunner;
+import org.apache.usergrid.persistence.core.guice.ProxyImpl;
+import org.apache.usergrid.persistence.graph.guice.TestGraphModule;
+import org.apache.usergrid.persistence.graph.serialization.impl.EdgeMetadataSerializationProxyImpl;
+
+import com.google.inject.Inject;
+
+import static org.junit.Assert.assertTrue;
+
+
+/**
+ * Test for when V1 is the current version during migration
+ */
+@RunWith( ITRunner.class )
+@UseModules( { TestGraphModule.class } )
+public class EdgeMetaDataSerializationProxyV1Test extends EdgeMetadataSerializationTest {
+
+
+ @Inject
+ @ProxyImpl
+ protected EdgeMetadataSerialization serialization;
+
+
+ @Override
+ protected EdgeMetadataSerialization getSerializationImpl() {
+
+ assertTrue(serialization instanceof EdgeMetadataSerializationProxyImpl );
+
+ return serialization;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationProxyV2Test.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationProxyV2Test.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationProxyV2Test.java
new file mode 100644
index 0000000..e3402e8
--- /dev/null
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationProxyV2Test.java
@@ -0,0 +1,57 @@
+/*
+ *
+ * * 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;
+
+
+import org.jukito.UseModules;
+import org.junit.runner.RunWith;
+
+import org.apache.usergrid.persistence.core.cassandra.ITRunner;
+import org.apache.usergrid.persistence.core.guice.ProxyImpl;
+import org.apache.usergrid.persistence.graph.guice.TestGraphModule;
+import org.apache.usergrid.persistence.graph.serialization.impl.EdgeMetadataSerializationProxyImpl;
+
+import com.google.inject.Inject;
+
+import static org.junit.Assert.assertTrue;
+
+
+/**
+ * Test for when V2 is the current version
+ */
+@RunWith( ITRunner.class )
+@UseModules( { TestGraphModule.class } )
+public class EdgeMetaDataSerializationProxyV2Test extends EdgeMetadataSerializationTest {
+
+
+ @Inject
+ @ProxyImpl
+ protected EdgeMetadataSerialization serialization;
+
+
+ @Override
+ protected EdgeMetadataSerialization getSerializationImpl() {
+ assertTrue(serialization instanceof EdgeMetadataSerializationProxyImpl );
+
+ return serialization;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationV1Test.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationV1Test.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationV1Test.java
index 00453d4..9645ad4 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationV1Test.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationV1Test.java
@@ -39,20 +39,31 @@ package org.apache.usergrid.persistence.graph.serialization;/*
*/
-import org.apache.usergrid.persistence.core.guice.PreviousVersion;
+import org.jukito.UseModules;
+import org.junit.runner.RunWith;
+
+import org.apache.usergrid.persistence.core.cassandra.ITRunner;
+import org.apache.usergrid.persistence.core.guice.PreviousImpl;
+import org.apache.usergrid.persistence.graph.guice.TestGraphModule;
+import org.apache.usergrid.persistence.graph.serialization.impl.EdgeMetadataSerializationV1Impl;
import com.google.inject.Inject;
+import static org.junit.Assert.assertTrue;
-public class EdgeMetaDataSerializationV1Test extends EdgeMetadataSerializationTest {
+@RunWith( ITRunner.class )
+@UseModules( { TestGraphModule.class } )
+public class EdgeMetaDataSerializationV1Test extends EdgeMetadataSerializationTest {
@Inject
- @PreviousVersion
+ @PreviousImpl
protected EdgeMetadataSerialization serialization;
+
@Override
protected EdgeMetadataSerialization getSerializationImpl() {
- return null;
+ assertTrue(serialization instanceof EdgeMetadataSerializationV1Impl );
+ return serialization;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationV2Test.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationV2Test.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationV2Test.java
index 522368b..de9148f 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationV2Test.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationV2Test.java
@@ -19,42 +19,34 @@
*
*/
-package org.apache.usergrid.persistence.graph.serialization;/*
- * 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;
+
+import org.jukito.UseModules;
+import org.junit.runner.RunWith;
-import org.apache.usergrid.persistence.core.guice.CurrentVersion;
-import org.apache.usergrid.persistence.core.guice.PreviousVersion;
-import org.apache.usergrid.persistence.core.guice.ProxyVersion;
+import org.apache.usergrid.persistence.core.cassandra.ITRunner;
+import org.apache.usergrid.persistence.core.guice.CurrentImpl;
+import org.apache.usergrid.persistence.graph.guice.TestGraphModule;
+import org.apache.usergrid.persistence.graph.serialization.impl.EdgeMetadataSerializationV2Impl;
import com.google.inject.Inject;
+import static org.junit.Assert.assertTrue;
-public class EdgeMetaDataSerializationV2Test extends EdgeMetadataSerializationTest {
+@RunWith( ITRunner.class )
+@UseModules( { TestGraphModule.class } )
+public class EdgeMetaDataSerializationV2Test extends EdgeMetadataSerializationTest {
@Inject
- @ProxyVersion
+ @CurrentImpl
protected EdgeMetadataSerialization serialization;
+
@Override
protected EdgeMetadataSerialization getSerializationImpl() {
- return null;
+ assertTrue(serialization instanceof EdgeMetadataSerializationV2Impl );
+ return serialization;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/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 02f18c9..e166194 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
@@ -23,17 +23,13 @@ package org.apache.usergrid.persistence.graph.serialization;
import java.util.Iterator;
import java.util.UUID;
-import org.jukito.UseModules;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-import org.junit.runner.RunWith;
import org.apache.usergrid.persistence.collection.guice.MigrationManagerRule;
-import org.apache.usergrid.persistence.core.cassandra.ITRunner;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
import org.apache.usergrid.persistence.graph.Edge;
-import org.apache.usergrid.persistence.graph.guice.TestGraphModule;
import org.apache.usergrid.persistence.model.entity.Id;
import org.apache.usergrid.persistence.model.util.UUIDGenerator;
@@ -59,19 +55,16 @@ import static org.mockito.Mockito.when;
/**
- *
- *
+ * Made abstract to allow subclasses to perform the wiring required for the functional testing.
*/
-@RunWith(ITRunner.class)
-@UseModules({ TestGraphModule.class })
public abstract class EdgeMetadataSerializationTest {
+
+
@Inject
@Rule
public MigrationManagerRule migrationManagerRule;
-
-
@Inject
protected Keyspace keyspace;
@@ -80,6 +73,7 @@ public abstract class EdgeMetadataSerializationTest {
protected EdgeMetadataSerialization serialization;
+
@Before
public void setup() {
scope = mock( ApplicationScope.class );
@@ -431,9 +425,9 @@ public abstract class EdgeMetadataSerializationTest {
final Id targetId = edge1.getTargetNode();
- final Edge edge2 = createEdge( createId( "source" ), "edge", targetId, timestamp+1 );
+ final Edge edge2 = createEdge( createId( "source" ), "edge", targetId, timestamp + 1 );
- final Edge edge3 = createEdge( createId( "source2" ), "edge", targetId, timestamp+2 );
+ final Edge edge3 = createEdge( createId( "source2" ), "edge", targetId, timestamp + 2 );
//set writing the edge
serialization.writeEdge( scope, edge1 ).execute();
@@ -484,16 +478,13 @@ public abstract class EdgeMetadataSerializationTest {
final StringSerializer STR_SER = StringSerializer.get();
-
ColumnFamily<String, String> testCf = new ColumnFamily<String, String>( CF_NAME, STR_SER, STR_SER );
- if(keyspace.describeKeyspace().getColumnFamily( CF_NAME ) == null){
+ if ( keyspace.describeKeyspace().getColumnFamily( CF_NAME ) == null ) {
keyspace.createColumnFamily( testCf, null );
}
-
-
final String key = "key";
final String colname = "name";
final String colvalue = "value";
@@ -577,5 +568,6 @@ public abstract class EdgeMetadataSerializationTest {
assertTrue( deleted );
}
+
protected abstract EdgeMetadataSerialization getSerializationImpl();
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/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 57391de..6e5d324 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
@@ -172,7 +172,7 @@ public abstract class EdgeSerializationTest {
@Test
public void testPaging() throws ConnectionException {
- final MarkedEdge edge1 = createEdge( "source", "edge", "target", 0);
+ final MarkedEdge edge1 = createEdge( "source", "edge", "target", 0 );
final Id sourceId = edge1.getSourceNode();
final Id targetId = edge1.getTargetNode();
@@ -190,10 +190,6 @@ public abstract class EdgeSerializationTest {
//get our edges out by name
-
-
-
-
Iterator<MarkedEdge> results =
serialization.getEdgesFromSource( scope, createSearchByEdge( sourceId, "edge", now, edge2 ) );
@@ -232,7 +228,7 @@ public abstract class EdgeSerializationTest {
final Id targetId = edgev1.getTargetNode();
- final MarkedEdge edgev2 = createEdge( sourceId, "edge1", targetId, timestamp+1 );
+ final MarkedEdge edgev2 = createEdge( sourceId, "edge1", targetId, timestamp + 1 );
//we shouldn't get this one back
final MarkedEdge diffTarget = createEdge( sourceId, "edge1", createId( "newTarget" ) );
@@ -244,7 +240,6 @@ public abstract class EdgeSerializationTest {
final MarkedEdge edgeType2V1 = createEdge( sourceId, "edge2", targetId );
-
serialization.writeEdge( scope, edgev1, UUIDGenerator.newTimeUUID() ).execute();
serialization.writeEdge( scope, edgev2, UUIDGenerator.newTimeUUID() ).execute();
serialization.writeEdge( scope, edgeType2V1, UUIDGenerator.newTimeUUID() ).execute();
@@ -339,7 +334,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", createId( "target" ), timestamp + 1 );
final Id targetId2 = edge2.getTargetNode();
@@ -402,8 +397,8 @@ public abstract class EdgeSerializationTest {
final Id targetId2 = edge2.getTargetNode();
- serialization.writeEdge( scope, edge1, UUIDGenerator.newTimeUUID() ).execute();
- serialization.writeEdge( scope, edge2, UUIDGenerator.newTimeUUID() ).execute();
+ serialization.writeEdge( scope, edge1, UUIDGenerator.newTimeUUID() ).execute();
+ serialization.writeEdge( scope, edge2, UUIDGenerator.newTimeUUID() ).execute();
long now = System.currentTimeMillis();
@@ -506,13 +501,13 @@ 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", createId( "target" ), timestamp + 1 );
final Id targetId2 = edge2.getTargetNode();
- serialization.writeEdge( scope, edge1, UUIDGenerator.newTimeUUID() ).execute();
- serialization.writeEdge( scope, edge2, UUIDGenerator.newTimeUUID() ).execute();
+ serialization.writeEdge( scope, edge1, UUIDGenerator.newTimeUUID() ).execute();
+ serialization.writeEdge( scope, edge2, UUIDGenerator.newTimeUUID() ).execute();
long now = System.currentTimeMillis();
@@ -668,7 +663,7 @@ public abstract class EdgeSerializationTest {
Set<Edge> edges = new HashSet<Edge>( size );
- long timestamp = 0;
+ long timestamp = 0;
for ( int i = 0; i < size; i++ ) {
final MarkedEdge edge = createEdge( sourceId, type, createId( "target" ), timestamp );
@@ -719,7 +714,8 @@ public abstract class EdgeSerializationTest {
batch.mergeShallow( serialization.writeEdge( scope, edge, UUIDGenerator.newTimeUUID() ) );
- //increment timestamp (not done inline on purpose) If we do System.currentMillis we get the same edge on fast systems
+ //increment timestamp (not done inline on purpose) If we do System.currentMillis we get the same edge on
+ // fast systems
timestamp++;
}
@@ -727,8 +723,8 @@ public abstract class EdgeSerializationTest {
batch.execute();
- Iterator<MarkedEdge> results =
- serialization.getEdgeVersions( scope, createGetByEdge( sourceId, edgeType, targetId, timestamp, null ) );
+ Iterator<MarkedEdge> results = serialization
+ .getEdgeVersions( scope, createGetByEdge( sourceId, edgeType, targetId, timestamp, null ) );
verify( results, writeCount );
@@ -879,8 +875,8 @@ public abstract class EdgeSerializationTest {
assertFalse( results.hasNext() );
- Iterator<MarkedEdge> versions = serialization
- .getEdgeVersions( scope, createGetByEdge( edge1.getSourceNode(), "edge", edge1.getTargetNode(), now, null ) );
+ Iterator<MarkedEdge> versions = serialization.getEdgeVersions( scope,
+ createGetByEdge( edge1.getSourceNode(), "edge", edge1.getTargetNode(), now, null ) );
assertEquals( edge1, versions.next() );
@@ -896,8 +892,8 @@ public abstract class EdgeSerializationTest {
assertFalse( results.hasNext() );
- versions = serialization
- .getEdgeVersions( scope, createGetByEdge( edge1.getSourceNode(), "edge", edge1.getTargetNode(), now, null ) );
+ versions = serialization.getEdgeVersions( scope,
+ createGetByEdge( edge1.getSourceNode(), "edge", edge1.getTargetNode(), now, null ) );
assertEquals( edge1, versions.next() );
@@ -914,8 +910,8 @@ public abstract class EdgeSerializationTest {
assertFalse( results.hasNext() );
- versions = serialization
- .getEdgeVersions( scope, createGetByEdge( edge1.getSourceNode(), "edge", edge1.getTargetNode(), now, null ) );
+ versions = serialization.getEdgeVersions( scope,
+ createGetByEdge( edge1.getSourceNode(), "edge", edge1.getTargetNode(), now, null ) );
assertFalse( versions.hasNext() );
@@ -929,8 +925,8 @@ public abstract class EdgeSerializationTest {
assertFalse( results.hasNext() );
- versions = serialization
- .getEdgeVersions( scope, createGetByEdge( edge1.getSourceNode(), "edge", edge1.getTargetNode(), now, null ) );
+ versions = serialization.getEdgeVersions( scope,
+ createGetByEdge( edge1.getSourceNode(), "edge", edge1.getTargetNode(), now, null ) );
assertEquals( edge1, versions.next() );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/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 935808c..e874c15 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
@@ -113,7 +113,7 @@ public class NodeSerializationTest {
final Id nodeId = createId( "test" );
- Optional<Long>returned = serialization.getMaxVersion( scope, nodeId );
+ Optional<Long> returned = serialization.getMaxVersion( scope, nodeId );
/**
* Verifies we didnt' get anything back when nothing has been marked
@@ -130,11 +130,11 @@ public class NodeSerializationTest {
final Id nodeId = createId( "test" );
final long version1 = System.currentTimeMillis();
- final long version2 = version1+1;
+ final long version2 = version1 + 1;
serialization.mark( scope, nodeId, version2 ).execute();
- Optional<Long>returned = serialization.getMaxVersion( scope, nodeId );
+ Optional<Long> returned = serialization.getMaxVersion( scope, nodeId );
assertEquals( version2, returned.get().longValue() );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/PermanentSerializationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/PermanentSerializationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/PermanentSerializationTest.java
index caf1833..42eca95 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/PermanentSerializationTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/PermanentSerializationTest.java
@@ -29,13 +29,14 @@ import org.apache.usergrid.persistence.graph.guice.TestGraphModule;
import com.google.inject.Inject;
-@RunWith( ITRunner.class )
-@UseModules( { TestGraphModule.class } )
+@RunWith(ITRunner.class)
+@UseModules({ TestGraphModule.class })
public class PermanentSerializationTest extends EdgeSerializationTest {
@Inject
protected EdgeSerialization edgeSerialization;
+
@Override
protected EdgeSerialization getSerialization() {
return edgeSerialization;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/TestCount.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/TestCount.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/TestCount.java
index a3bc3b9..0c09e81 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/TestCount.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/TestCount.java
@@ -40,10 +40,11 @@ import static org.junit.Assert.assertEquals;
*/
public class TestCount {
- private static final Logger log = LoggerFactory.getLogger(TestCount.class);
+ private static final Logger log = LoggerFactory.getLogger( TestCount.class );
+
@Test
- public void mergeTest(){
+ public void mergeTest() {
final int sizePerObservable = 2000;
@@ -62,40 +63,39 @@ public class TestCount {
}
} );
- int returned = Observable.merge(input1, input2).buffer( 1000 ).flatMap(
- new Func1<List<Integer>, Observable<Integer>>() {
- @Override
- public Observable<Integer> call( final List<Integer> integers ) {
+ int returned = Observable.merge( input1, input2 ).buffer( 1000 )
+ .flatMap( new Func1<List<Integer>, Observable<Integer>>() {
+ @Override
+ public Observable<Integer> call( final List<Integer> integers ) {
- //simulates batching a network operation from buffer, then re-emitting the values passed
+ //simulates batching a network operation from buffer,
+ // then re-emitting the values passed
- try {
- Thread.sleep( 100 );
- }
- catch ( InterruptedException e ) {
- throw new RuntimeException( e );
- }
+ try {
+ Thread.sleep( 100 );
+ }
+ catch ( InterruptedException e ) {
+ throw new RuntimeException( e );
+ }
- return Observable.from( integers );
- }
- } ).count().defaultIfEmpty( 0 ).toBlocking().last();
+ return Observable.from( integers );
+ }
+ } ).count().defaultIfEmpty( 0 ).toBlocking().last();
- assertEquals("Count was correct", sizePerObservable*2*100, returned);
+ assertEquals( "Count was correct", sizePerObservable * 2 * 100, returned );
}
/**
* Get observables from the sets
- * @param size
- * @return
*/
- private Observable<Integer> getObservables( int size ){
+ private Observable<Integer> getObservables( int size ) {
- final List<Integer> values = new ArrayList<Integer>(size);
+ final List<Integer> values = new ArrayList<Integer>( size );
- for(int i = 0; i <size; i ++ ) {
+ for ( int i = 0; i < size; i++ ) {
values.add( i );
}
@@ -109,11 +109,10 @@ public class TestCount {
final int size = values.size();
- for(int i = 0; i < size; i ++){
-
+ for ( int i = 0; i < size; i++ ) {
- if(i%1000 == 0){
+ if ( i % 1000 == 0 ) {
//simulate network fetch
try {
Thread.sleep( 250 );
@@ -126,7 +125,7 @@ public class TestCount {
final Integer value = values.get( i );
- log.info( "Emitting {}", value );
+ log.info( "Emitting {}", value );
subscriber.onNext( value );
@@ -137,6 +136,5 @@ public class TestCount {
//purposefully no error handling here
}
} ).subscribeOn( Schedulers.io() );
-
}
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/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 da57b0a..c966605 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
@@ -94,9 +94,9 @@ public class EdgeShardSerializationTest {
final Shard shard3 = new Shard( shard2.getShardIndex() * 2, timestamp, false );
- final DirectedEdgeMeta sourceEdgeMeta = DirectedEdgeMeta.fromSourceNodeTargetType(now, "edgeType", "subType" );
+ final DirectedEdgeMeta sourceEdgeMeta = DirectedEdgeMeta.fromSourceNodeTargetType( now, "edgeType", "subType" );
- MutationBatch batch = edgeShardSerialization.writeShardMeta( scope, shard1, sourceEdgeMeta );
+ MutationBatch batch = edgeShardSerialization.writeShardMeta( scope, shard1, sourceEdgeMeta );
batch.mergeShallow( edgeShardSerialization.writeShardMeta( scope, shard2, sourceEdgeMeta ) );
@@ -118,11 +118,10 @@ public class EdgeShardSerializationTest {
assertFalse( results.hasNext() );
- final DirectedEdgeMeta targetEdgeMeta = DirectedEdgeMeta.fromTargetNodeSourceType( now, "edgeType", "subType" );
+ final DirectedEdgeMeta targetEdgeMeta = DirectedEdgeMeta.fromTargetNodeSourceType( now, "edgeType", "subType" );
//test we get nothing with the other node type
- results =
- edgeShardSerialization.getShardMetaData( scope, Optional.<Shard>absent(), targetEdgeMeta );
+ results = edgeShardSerialization.getShardMetaData( scope, Optional.<Shard>absent(), targetEdgeMeta );
assertFalse( results.hasNext() );
@@ -155,17 +154,14 @@ public class EdgeShardSerializationTest {
final Shard shard3 = new Shard( shard2.getShardIndex() * 2, timestamp, false );
- final DirectedEdgeMeta sourceEdgeMeta = DirectedEdgeMeta.fromSourceNodeTargetType(now, "edgeType", "subType" );
+ final DirectedEdgeMeta sourceEdgeMeta = DirectedEdgeMeta.fromSourceNodeTargetType( now, "edgeType", "subType" );
- MutationBatch batch =
- edgeShardSerialization.writeShardMeta( scope, shard1, sourceEdgeMeta );
+ MutationBatch batch = edgeShardSerialization.writeShardMeta( scope, shard1, sourceEdgeMeta );
- batch.mergeShallow(
- edgeShardSerialization.writeShardMeta( scope, shard2, sourceEdgeMeta ) );
+ batch.mergeShallow( edgeShardSerialization.writeShardMeta( scope, shard2, sourceEdgeMeta ) );
- batch.mergeShallow(
- edgeShardSerialization.writeShardMeta( scope, shard3, sourceEdgeMeta ) );
+ batch.mergeShallow( edgeShardSerialization.writeShardMeta( scope, shard3, sourceEdgeMeta ) );
batch.execute();
@@ -183,10 +179,9 @@ public class EdgeShardSerializationTest {
//test nothing with other type
- final DirectedEdgeMeta targetEdgeMeta = DirectedEdgeMeta.fromTargetNodeSourceType( now, "edgeType", "subType" );
+ final DirectedEdgeMeta targetEdgeMeta = DirectedEdgeMeta.fromTargetNodeSourceType( now, "edgeType", "subType" );
- results =
- edgeShardSerialization.getShardMetaData( scope, Optional.<Shard>absent(), targetEdgeMeta );
+ results = edgeShardSerialization.getShardMetaData( scope, Optional.<Shard>absent(), targetEdgeMeta );
assertFalse( results.hasNext() );
@@ -194,8 +189,7 @@ public class EdgeShardSerializationTest {
//test paging and size
edgeShardSerialization.removeShardMeta( scope, shard1, sourceEdgeMeta ).execute();
- results =
- edgeShardSerialization.getShardMetaData( scope, Optional.<Shard>absent(), sourceEdgeMeta );
+ results = edgeShardSerialization.getShardMetaData( scope, Optional.<Shard>absent(), sourceEdgeMeta );
assertEquals( shard3, results.next() );
@@ -208,8 +202,7 @@ public class EdgeShardSerializationTest {
edgeShardSerialization.removeShardMeta( scope, shard3, sourceEdgeMeta ).execute();
- results =
- edgeShardSerialization.getShardMetaData( scope, Optional.<Shard>absent(), sourceEdgeMeta );
+ results = edgeShardSerialization.getShardMetaData( scope, Optional.<Shard>absent(), sourceEdgeMeta );
assertFalse( results.hasNext() );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/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 b8be5d2..4e572c0 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
@@ -251,7 +251,7 @@ public class NodeShardAllocationTest {
/**
* Allocate 2.5x what this shard should have. We should ultimately have a split at 2x
*/
- final long shardCount = ( long ) (graphFig.getShardSize() * 2.5);
+ final long shardCount = ( long ) ( graphFig.getShardSize() * 2.5 );
//return a shard size equal to our max
@@ -259,7 +259,7 @@ public class NodeShardAllocationTest {
//this is how many we should be iterating and should set the value of the last shard we keep
- final int numToIterate = ( int ) (graphFig.getShardSize() *2);
+ final int numToIterate = ( int ) ( graphFig.getShardSize() * 2 );
/**
@@ -282,7 +282,7 @@ public class NodeShardAllocationTest {
edges.add( keep );
i++;
- for ( ; i < shardCount; i++ ) {
+ for (; i < shardCount; i++ ) {
edges.add( skipped );
}
@@ -365,14 +365,14 @@ 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, createId( "subType" ), 10000l, false );
final SimpleMarkedEdge returnedEdge =
new SimpleMarkedEdge( nodeId, type, createId( "subType" ), 10005l, false );
List<MarkedEdge> iteratedEdges = new ArrayList<>( ( int ) shardCount );
- for(long i = 0; i < shardCount-1; i ++){
- iteratedEdges.add( skippedEdge);
+ for ( long i = 0; i < shardCount - 1; i++ ) {
+ iteratedEdges.add( skippedEdge );
}
iteratedEdges.add( returnedEdge );
@@ -388,7 +388,6 @@ public class NodeShardAllocationTest {
.thenReturn( mock( MutationBatch.class ) );
-
final Iterator<MarkedEdge> edgeIterator = iteratedEdges.iterator();
//mock up returning the value
@@ -635,7 +634,7 @@ public class NodeShardAllocationTest {
final TimeService timeService = mock( TimeService.class );
- final long returnTime = System.currentTimeMillis()+graphFig.getShardCacheTimeout()*2 ;
+ final long returnTime = System.currentTimeMillis() + graphFig.getShardCacheTimeout() * 2;
when( timeService.getCurrentTime() ).thenReturn( returnTime );