usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdun...@apache.org
Subject [28/44] usergrid git commit: Refactored migrations to read their own data sets rather than be passed with an invocation
Date Sat, 26 Sep 2015 01:42:33 GMT
Refactored migrations to read their own data sets rather than be passed with an invocation


Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/d971ec50
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/d971ec50
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/d971ec50

Branch: refs/heads/USERGRID-933
Commit: d971ec509528fa24977a15501776ebb356e6e1c7
Parents: fb1cf2e
Author: Todd Nine <tnine@apigee.com>
Authored: Wed Sep 16 16:44:02 2015 -0600
Committer: Todd Nine <tnine@apigee.com>
Committed: Wed Sep 16 16:44:02 2015 -0600

----------------------------------------------------------------------
 .../usergrid/corepersistence/CoreModule.java    |  4 +-
 .../migration/CoreMigrationPlugin.java          |  9 +--
 .../migration/EntityTypeMappingMigration.java   |  4 +-
 .../migration/MigrationModuleVersionPlugin.java |  5 --
 .../migration/EntityTypeMappingMigrationIT.java |  2 +-
 .../serialization/impl/SerializationModule.java |  4 +-
 .../migration/CollectionMigrationPlugin.java    |  8 +--
 .../migration/MvccEntityDataMigrationImpl.java  | 10 ++--
 ...ctMvccEntityDataMigrationV1ToV3ImplTest.java |  9 +--
 .../migration/data/AbstractMigrationPlugin.java | 17 +++---
 .../core/migration/data/DataMigration.java      | 11 ++--
 .../migration/data/MigrationDataProvider.java   |  2 +-
 .../core/migration/data/MigrationPlugin.java    |  4 +-
 .../persistence/graph/guice/GraphModule.java    |  4 +-
 .../impl/migration/EdgeDataMigrationImpl.java   | 12 ++--
 .../impl/migration/GraphMigrationPlugin.java    |  8 +--
 .../migration/EdgeDataMigrationImplTest.java    | 59 +++++++++++---------
 .../persistence/index/guice/IndexModule.java    |  4 +-
 .../index/migration/EsIndexMigrationPlugin.java |  8 +--
 19 files changed, 86 insertions(+), 98 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/d971ec50/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
index e290cfe..7ed95e2 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
@@ -100,9 +100,9 @@ public class CoreModule  extends AbstractModule {
         /**
          * Create our migrations for within our core plugin
          */
-        Multibinder<DataMigration<EntityIdScope>> dataMigrationMultibinder =
+        Multibinder<DataMigration> dataMigrationMultibinder =
                     Multibinder.newSetBinder( binder(),
-                        new TypeLiteral<DataMigration<EntityIdScope>>() {}, CoreMigration.class
);
+                        new TypeLiteral<DataMigration>() {}, CoreMigration.class );
 
 
         dataMigrationMultibinder.addBinding().to( EntityTypeMappingMigration.class );

http://git-wip-us.apache.org/repos/asf/usergrid/blob/d971ec50/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/CoreMigrationPlugin.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/CoreMigrationPlugin.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/CoreMigrationPlugin.java
index 58233e0..810f9fb 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/CoreMigrationPlugin.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/CoreMigrationPlugin.java
@@ -22,11 +22,9 @@ package org.apache.usergrid.corepersistence.migration;
 
 import java.util.Set;
 
-import org.apache.usergrid.persistence.collection.serialization.impl.migration.EntityIdScope;
 import org.apache.usergrid.persistence.core.migration.data.MigrationInfoSerialization;
 import org.apache.usergrid.persistence.core.migration.data.AbstractMigrationPlugin;
 import org.apache.usergrid.persistence.core.migration.data.DataMigration;
-import org.apache.usergrid.persistence.core.migration.data.MigrationDataProvider;
 import org.apache.usergrid.persistence.core.migration.data.PluginPhase;
 
 import com.google.inject.Inject;
@@ -37,17 +35,16 @@ import com.google.inject.Singleton;
  * Migration plugin for the collection module
  */
 @Singleton
-public class CoreMigrationPlugin extends AbstractMigrationPlugin<EntityIdScope> {
+public class CoreMigrationPlugin extends AbstractMigrationPlugin {
 
     public static final String PLUGIN_NAME = "core-data";
 
 
 
     @Inject
-    public CoreMigrationPlugin( @CoreMigration final Set<DataMigration<EntityIdScope>>
entityDataMigrations,
-                                final MigrationDataProvider<EntityIdScope> entityIdScopeDataMigrationProvider,
+    public CoreMigrationPlugin( @CoreMigration final Set<DataMigration> entityDataMigrations,
                                 final MigrationInfoSerialization migrationInfoSerialization
) {
-        super( entityDataMigrations, entityIdScopeDataMigrationProvider, migrationInfoSerialization
);
+        super( entityDataMigrations, migrationInfoSerialization );
     }
 
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/d971ec50/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/EntityTypeMappingMigration.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/EntityTypeMappingMigration.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/EntityTypeMappingMigration.java
index 47ad30a..ef65ff2 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/EntityTypeMappingMigration.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/EntityTypeMappingMigration.java
@@ -41,7 +41,7 @@ import rx.schedulers.Schedulers;
 /**
  * Migration to ensure that our entity id is written into our map data
  */
-public class EntityTypeMappingMigration implements DataMigration<EntityIdScope> {
+public class EntityTypeMappingMigration implements DataMigration {
 
     private final ManagerCache managerCache;
     private final MigrationDataProvider<EntityIdScope> allEntitiesInSystemObservable;
@@ -56,7 +56,7 @@ public class EntityTypeMappingMigration implements DataMigration<EntityIdScope>
 
 
     @Override
-    public int migrate( final int currentVersion, final MigrationDataProvider<EntityIdScope>
migrationDataProvider,
+    public int migrate( final int currentVersion,
                         final ProgressObserver observer ) {
 
         final AtomicLong atomicLong = new AtomicLong();

http://git-wip-us.apache.org/repos/asf/usergrid/blob/d971ec50/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/MigrationModuleVersionPlugin.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/MigrationModuleVersionPlugin.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/MigrationModuleVersionPlugin.java
index 2ffe335..145e76f 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/MigrationModuleVersionPlugin.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/MigrationModuleVersionPlugin.java
@@ -56,11 +56,6 @@ public class MigrationModuleVersionPlugin implements MigrationPlugin{
      */
     private static final int ENTITY_V2_MIGRATION = 3;
 
-    /**
-     * Appinfo to application_info migration.
-     */
-    private static final int APPINFO_MIGRATION = 4;
-
 
     /**
      * Get versions directly from impls so we know they're accurate

http://git-wip-us.apache.org/repos/asf/usergrid/blob/d971ec50/stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/EntityTypeMappingMigrationIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/EntityTypeMappingMigrationIT.java
b/stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/EntityTypeMappingMigrationIT.java
index 84215a1..7d22abe 100644
--- a/stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/EntityTypeMappingMigrationIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/EntityTypeMappingMigrationIT.java
@@ -101,7 +101,7 @@ public class EntityTypeMappingMigrationIT  {
 
         //run it
 
-        final int returnedVersion = migration.migrate(CoreDataVersions.INITIAL.getVersion(),
migrationDataProvider, progressObserver );
+        final int returnedVersion = migration.migrate(CoreDataVersions.INITIAL.getVersion(),
progressObserver );
 
 
         assertEquals(CoreDataVersions.ID_MAP_FIX.getVersion(), returnedVersion);

http://git-wip-us.apache.org/repos/asf/usergrid/blob/d971ec50/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/SerializationModule.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/SerializationModule.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/SerializationModule.java
index bd2728b..3a6fd14 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/SerializationModule.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/SerializationModule.java
@@ -96,8 +96,8 @@ public class SerializationModule extends AbstractModule {
 
         //migrations
         //we want to make sure our generics are retained, so we use a typeliteral
-        Multibinder<DataMigration<EntityIdScope>> dataMigrationMultibinder =
Multibinder
-            .newSetBinder( binder(), new TypeLiteral<DataMigration<EntityIdScope>>()
{}, CollectionMigration.class );
+        Multibinder<DataMigration> dataMigrationMultibinder = Multibinder
+            .newSetBinder( binder(), new TypeLiteral<DataMigration>() {}, CollectionMigration.class
);
 
 
         dataMigrationMultibinder.addBinding().to( MvccEntityDataMigrationImpl.class );

http://git-wip-us.apache.org/repos/asf/usergrid/blob/d971ec50/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/CollectionMigrationPlugin.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/CollectionMigrationPlugin.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/CollectionMigrationPlugin.java
index c757d28..4e92d3c 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/CollectionMigrationPlugin.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/CollectionMigrationPlugin.java
@@ -28,7 +28,6 @@ import java.util.Set;
 
 import org.apache.usergrid.persistence.core.migration.data.AbstractMigrationPlugin;
 import org.apache.usergrid.persistence.core.migration.data.DataMigration;
-import org.apache.usergrid.persistence.core.migration.data.MigrationDataProvider;
 import org.apache.usergrid.persistence.core.migration.data.MigrationInfoSerialization;
 import org.apache.usergrid.persistence.core.migration.data.PluginPhase;
 
@@ -40,7 +39,7 @@ import com.google.inject.Singleton;
  * Migration plugin for the collection module
  */
 @Singleton
-public class CollectionMigrationPlugin extends AbstractMigrationPlugin<EntityIdScope>
{
+public class CollectionMigrationPlugin extends AbstractMigrationPlugin {
 
     public static final String PLUGIN_NAME = "collections-entity-data";
 
@@ -48,10 +47,9 @@ public class CollectionMigrationPlugin extends AbstractMigrationPlugin<EntityIdS
 
     @Inject
     public CollectionMigrationPlugin( @CollectionMigration
-                                          final Set<DataMigration<EntityIdScope>>
entityDataMigrations,
-                                      final MigrationDataProvider<EntityIdScope> entityIdScopeDataMigrationProvider,
+                                          final Set<DataMigration> entityDataMigrations,
                                       final MigrationInfoSerialization migrationInfoSerialization
) {
-        super( entityDataMigrations, entityIdScopeDataMigrationProvider, migrationInfoSerialization
);
+        super( entityDataMigrations, migrationInfoSerialization );
     }
 
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/d971ec50/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/MvccEntityDataMigrationImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/MvccEntityDataMigrationImpl.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/MvccEntityDataMigrationImpl.java
index 86fd701..5143c49 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/MvccEntityDataMigrationImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/MvccEntityDataMigrationImpl.java
@@ -65,7 +65,7 @@ import rx.schedulers.Schedulers;
  * Data migration strategy for entities
  */
 @Singleton
-public class MvccEntityDataMigrationImpl implements DataMigration<EntityIdScope> {
+public class MvccEntityDataMigrationImpl implements DataMigration{
 
 
     private static final Logger LOGGER = LoggerFactory.getLogger( MvccEntityDataMigrationImpl.class
);
@@ -75,6 +75,7 @@ public class MvccEntityDataMigrationImpl implements DataMigration<EntityIdScope>
     private final MvccEntitySerializationStrategyV3Impl mvccEntitySerializationStrategyV3;
     private final UniqueValueSerializationStrategy uniqueValueSerializationStrategy;
     private final MvccLogEntrySerializationStrategy mvccLogEntrySerializationStrategy;
+    private final MigrationDataProvider<EntityIdScope> migrationDataProvider;
 
 
     @Inject
@@ -82,12 +83,14 @@ public class MvccEntityDataMigrationImpl implements DataMigration<EntityIdScope>
                                         final VersionedMigrationSet<MvccEntitySerializationStrategy>
allVersions,
                                         final MvccEntitySerializationStrategyV3Impl mvccEntitySerializationStrategyV3,
                                         final UniqueValueSerializationStrategy uniqueValueSerializationStrategy,
-                                        final MvccLogEntrySerializationStrategy mvccLogEntrySerializationStrategy
) {
+                                        final MvccLogEntrySerializationStrategy mvccLogEntrySerializationStrategy,
+                                        final MigrationDataProvider<EntityIdScope>
migrationDataProvider ) {
         this.keyspace = keyspace;
         this.allVersions = allVersions;
         this.mvccEntitySerializationStrategyV3 = mvccEntitySerializationStrategyV3;
         this.uniqueValueSerializationStrategy = uniqueValueSerializationStrategy;
         this.mvccLogEntrySerializationStrategy = mvccLogEntrySerializationStrategy;
+        this.migrationDataProvider = migrationDataProvider;
     }
 
 
@@ -105,8 +108,7 @@ public class MvccEntityDataMigrationImpl implements DataMigration<EntityIdScope>
 
 
     @Override
-    public int migrate( final int currentVersion, final MigrationDataProvider<EntityIdScope>
migrationDataProvider,
-                        final ProgressObserver observer ) {
+    public int migrate( final int currentVersion,  final ProgressObserver observer ) {
 
         final AtomicLong atomicLong = new AtomicLong();
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/d971ec50/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/AbstractMvccEntityDataMigrationV1ToV3ImplTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/AbstractMvccEntityDataMigrationV1ToV3ImplTest.java
b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/AbstractMvccEntityDataMigrationV1ToV3ImplTest.java
index 986b740..f51b339 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/AbstractMvccEntityDataMigrationV1ToV3ImplTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/AbstractMvccEntityDataMigrationV1ToV3ImplTest.java
@@ -121,13 +121,6 @@ public abstract class AbstractMvccEntityDataMigrationV1ToV3ImplTest implements
D
             Observable.just( new EntityIdScope( scope, entity1.getId() ), new EntityIdScope(
scope, entity2.getId() ) );
 
 
-        final MigrationDataProvider<EntityIdScope> migrationProvider = new MigrationDataProvider<EntityIdScope>()
{
-            @Override
-            public Observable<EntityIdScope> getData() {
-                return entityIdScope;
-            }
-        };
-
         final TestProgressObserver progressObserver = new TestProgressObserver();
 
         final CollectionDataVersions startVersion = getSourceVersion();
@@ -141,7 +134,7 @@ public abstract class AbstractMvccEntityDataMigrationV1ToV3ImplTest implements
D
 
         //now migration
         final int newVersion = mvccEntityDataMigrationImpl
-            .migrate( startVersion.getVersion(), migrationProvider, progressObserver );
+            .migrate( startVersion.getVersion(), progressObserver );
 
 
         final CollectionDataVersions expectedVersion = expectedTargetVersion();

http://git-wip-us.apache.org/repos/asf/usergrid/blob/d971ec50/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/AbstractMigrationPlugin.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/AbstractMigrationPlugin.java
b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/AbstractMigrationPlugin.java
index 0cd26d4..9671bc5 100644
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/AbstractMigrationPlugin.java
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/AbstractMigrationPlugin.java
@@ -34,23 +34,20 @@ import org.slf4j.LoggerFactory;
  * Standard implementation logic for plugins to extend
  * @param <T>
  */
-public abstract class AbstractMigrationPlugin<T> implements MigrationPlugin {
+public abstract class AbstractMigrationPlugin implements MigrationPlugin {
 
 
 
     private static final Logger LOG = LoggerFactory.getLogger( AbstractMigrationPlugin.class
);
 
 
-    private final Set<DataMigration<T>> entityDataMigrations;
-    private final MigrationDataProvider<T> entityIdScopeDataMigrationProvider;
+    private final Set<DataMigration> entityDataMigrations;
     private final MigrationInfoSerialization migrationInfoSerialization;
 
 
-    protected AbstractMigrationPlugin( final Set<DataMigration<T>> entityDataMigrations,
-                                       final MigrationDataProvider<T> entityIdScopeDataMigrationProvider,
+    protected AbstractMigrationPlugin( final Set<DataMigration>entityDataMigrations,
                                        final MigrationInfoSerialization migrationInfoSerialization
) {
         this.entityDataMigrations = entityDataMigrations;
-        this.entityIdScopeDataMigrationProvider = entityIdScopeDataMigrationProvider;
         this.migrationInfoSerialization = migrationInfoSerialization;
     }
 
@@ -71,7 +68,7 @@ public abstract class AbstractMigrationPlugin<T> implements MigrationPlugin
{
 
         int max = 0;
 
-        for(DataMigration<T> entityMigration: entityDataMigrations){
+        for(DataMigration entityMigration: entityDataMigrations){
             max = Math.max( max, entityMigration.getMaxVersion() );
         }
 
@@ -85,12 +82,12 @@ public abstract class AbstractMigrationPlugin<T> implements MigrationPlugin
{
      * @return True if we ran a migration
      */
     private boolean runMigration( final ProgressObserver po ) {
-        DataMigration<T> migrationToExecute = null;
+        DataMigration migrationToExecute = null;
 
 
         final int version = migrationInfoSerialization.getVersion( getName() );
 
-        for ( DataMigration<T> entityMigration : entityDataMigrations ) {
+        for ( DataMigration entityMigration : entityDataMigrations ) {
             if ( entityMigration.supports( version ) ) {
                 if ( migrationToExecute != null ) {
                     throw new DataMigrationException(
@@ -113,7 +110,7 @@ public abstract class AbstractMigrationPlugin<T> implements MigrationPlugin
{
 
 
         //run the migration
-        final int newSystemVersion = migrationToExecute.migrate( version, entityIdScopeDataMigrationProvider,
po );
+        final int newSystemVersion = migrationToExecute.migrate( version, po );
 
         //write the version
         migrationInfoSerialization.setVersion( getName(), newSystemVersion );

http://git-wip-us.apache.org/repos/asf/usergrid/blob/d971ec50/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/DataMigration.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/DataMigration.java
b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/DataMigration.java
index ce250cc..a3ee675 100644
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/DataMigration.java
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/DataMigration.java
@@ -27,32 +27,31 @@ package org.apache.usergrid.persistence.core.migration.data;
 /**
  * Data migration.  The internal version to migrate
  *
- * @param <T>
+ * @param
  */
-public interface DataMigration<T> {
+public interface DataMigration {
 
     /**
      * Perform the migration, returning an observable with a single emitted value
      * @param currentVersion the current version of the system
-     * @param migrationDataProvider
      * @param observer The observer to receive updates of the progress
      *
      * @return The version that the system is now running
      */
-    public int migrate(final int currentVersion, MigrationDataProvider<T> migrationDataProvider,
ProgressObserver observer);
+    int migrate( final int currentVersion, ProgressObserver observer );
 
     /**
      * Check if this version supports migration from the current system version.  If this
returns false,
      * migrate will not be invoked
      * @return
      */
-    public boolean supports(final int currentVersion);
+    boolean supports( final int currentVersion );
 
     /**
      * Get the max version this migration can migrate to
      * @return
      */
-    public int getMaxVersion();
+    int getMaxVersion();
 
 
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/d971ec50/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/MigrationDataProvider.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/MigrationDataProvider.java
b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/MigrationDataProvider.java
index e232d7b..1608742 100644
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/MigrationDataProvider.java
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/MigrationDataProvider.java
@@ -38,6 +38,6 @@ public interface MigrationDataProvider<T> {
      * Get data that can be used in the migration
      * @return
      */
-    public Observable<T> getData();
+    Observable<T> getData();
 
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/d971ec50/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/MigrationPlugin.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/MigrationPlugin.java
b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/MigrationPlugin.java
index 4953f25..cb9297d 100644
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/MigrationPlugin.java
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/MigrationPlugin.java
@@ -34,12 +34,12 @@ public interface MigrationPlugin {
      * Get the name of the plugin.  Must be unique
      * @return
      */
-    public String getName();
+    String getName();
 
     /**
      * Run any migrations that may need to be run in this plugin
      */
-    public void run(ProgressObserver observer);
+    void run( ProgressObserver observer );
 
 
     /**

http://git-wip-us.apache.org/repos/asf/usergrid/blob/d971ec50/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 4b628d1..6280c7c 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
@@ -128,8 +128,8 @@ public abstract class GraphModule extends AbstractModule {
 
 
         //wire up the edg migration
-        Multibinder<DataMigration<GraphNode>> dataMigrationMultibinder =
-                Multibinder.newSetBinder( binder(), new TypeLiteral<DataMigration<GraphNode>>()
{}, GraphMigration.class );
+        Multibinder<DataMigration> dataMigrationMultibinder =
+                Multibinder.newSetBinder( binder(), new TypeLiteral<DataMigration>()
{}, GraphMigration.class );
 
 
         dataMigrationMultibinder.addBinding().to( EdgeDataMigrationImpl.class );

http://git-wip-us.apache.org/repos/asf/usergrid/blob/d971ec50/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/migration/EdgeDataMigrationImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/migration/EdgeDataMigrationImpl.java
b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/migration/EdgeDataMigrationImpl.java
index d6c42e3..15ff337 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/migration/EdgeDataMigrationImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/migration/EdgeDataMigrationImpl.java
@@ -49,7 +49,7 @@ import java.util.concurrent.atomic.AtomicLong;
  * The migration data provider assumes that is will visit every node in the graph
  * all edges from these source node will then be re-indexed.
  */
-public class EdgeDataMigrationImpl implements DataMigration<GraphNode> {
+public class EdgeDataMigrationImpl implements DataMigration {
 
     private static final Logger logger = LoggerFactory.getLogger(EdgeDataMigrationImpl.class);
 
@@ -58,24 +58,26 @@ public class EdgeDataMigrationImpl implements DataMigration<GraphNode>
{
     private final EdgesObservable edgesFromSourceObservable;
     private final VersionedMigrationSet<EdgeMetadataSerialization> allVersions;
     private final EdgeMetadataSerializationV2Impl edgeMetadataSerializationV2;
+    private final MigrationDataProvider<GraphNode> migrationDataProvider;
 
     @Inject
-    public EdgeDataMigrationImpl( final Keyspace keyspace,
-                                  final GraphManagerFactory graphManagerFactory,
+    public EdgeDataMigrationImpl( final Keyspace keyspace, final GraphManagerFactory graphManagerFactory,
                                   final EdgesObservable edgesFromSourceObservable,
                                   final VersionedMigrationSet<EdgeMetadataSerialization>
allVersions,
-                                  final EdgeMetadataSerializationV2Impl edgeMetadataSerializationV2
) {
+                                  final EdgeMetadataSerializationV2Impl edgeMetadataSerializationV2,
+                                  final MigrationDataProvider<GraphNode> migrationDataProvider
) {
 
         this.keyspace = keyspace;
         this.graphManagerFactory = graphManagerFactory;
         this.edgesFromSourceObservable = edgesFromSourceObservable;
         this.allVersions = allVersions;
         this.edgeMetadataSerializationV2 = edgeMetadataSerializationV2;
+        this.migrationDataProvider = migrationDataProvider;
     }
 
 
     @Override
-    public int migrate( final int currentVersion, final MigrationDataProvider<GraphNode>
migrationDataProvider,
+    public int migrate( final int currentVersion,
                         final ProgressObserver observer ) {
 
         final AtomicLong counter = new AtomicLong();

http://git-wip-us.apache.org/repos/asf/usergrid/blob/d971ec50/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/migration/GraphMigrationPlugin.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/migration/GraphMigrationPlugin.java
b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/migration/GraphMigrationPlugin.java
index ed51c27..97edf3b 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/migration/GraphMigrationPlugin.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/migration/GraphMigrationPlugin.java
@@ -29,7 +29,6 @@ import java.util.Set;
 import org.apache.usergrid.persistence.core.migration.data.MigrationInfoSerialization;
 import org.apache.usergrid.persistence.core.migration.data.AbstractMigrationPlugin;
 import org.apache.usergrid.persistence.core.migration.data.DataMigration;
-import org.apache.usergrid.persistence.core.migration.data.MigrationDataProvider;
 import org.apache.usergrid.persistence.core.migration.data.PluginPhase;
 
 import com.google.inject.Inject;
@@ -41,7 +40,7 @@ import com.google.inject.Singleton;
  * Migration plugin for the collection module
  */
 @Singleton
-public class GraphMigrationPlugin extends AbstractMigrationPlugin<GraphNode> {
+public class GraphMigrationPlugin extends AbstractMigrationPlugin {
 
     public static final String PLUGIN_NAME = "graph-data";
 
@@ -49,10 +48,9 @@ public class GraphMigrationPlugin extends AbstractMigrationPlugin<GraphNode>
{
 
     @Inject
     public GraphMigrationPlugin(@GraphMigration
-                                    final Set<DataMigration<GraphNode>> entityDataMigrations,
-                                      final MigrationDataProvider<GraphNode> entityIdScopeDataMigrationProvider,
+                                    final Set<DataMigration> entityDataMigrations,
                                       final MigrationInfoSerialization migrationInfoSerialization
) {
-        super( entityDataMigrations, entityIdScopeDataMigrationProvider, migrationInfoSerialization
);
+        super( entityDataMigrations, migrationInfoSerialization );
     }
 
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/d971ec50/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
index 049c3d2..bc2afdc 100644
--- 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
@@ -28,8 +28,9 @@ 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.MigrationDataProvider;
+import org.apache.usergrid.persistence.core.migration.data.TestProgressObserver;
+import org.apache.usergrid.persistence.core.migration.data.VersionedMigrationSet;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.core.scope.ApplicationScopeImpl;
 import org.apache.usergrid.persistence.core.test.ITRunner;
@@ -40,25 +41,28 @@ 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.EdgeMetadataSerialization;
+import org.apache.usergrid.persistence.graph.serialization.EdgesObservable;
+import org.apache.usergrid.persistence.graph.serialization.impl.EdgeMetadataSerializationV2Impl;
 import org.apache.usergrid.persistence.graph.serialization.impl.GraphDataVersions;
 import org.apache.usergrid.persistence.model.entity.Id;
 
 import com.google.inject.Inject;
+import com.netflix.astyanax.Keyspace;
 
 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 })
+@RunWith( ITRunner.class )
+@UseModules( { TestGraphModule.class } )
 public class EdgeDataMigrationImplTest implements DataMigrationResetRule.DataMigrationManagerProvider
{
 
 
@@ -68,16 +72,26 @@ public class EdgeDataMigrationImplTest implements DataMigrationResetRule.DataMig
     @Inject
     public GraphManagerFactory graphManagerFactory;
 
+
+    @Inject
+    public Keyspace keyspace;
+
     @Inject
-    public EdgeDataMigrationImpl edgeDataMigrationImpl;
+    public EdgesObservable edgesFromSourceObservable;
+
+    @Inject
+    public VersionedMigrationSet<EdgeMetadataSerialization> allVersions;
+
+    @Inject
+    public EdgeMetadataSerializationV2Impl edgeMetadataSerializationV2;
+
 
     /**
      * Rule to do the resets we need
      */
     @Rule
-    public DataMigrationResetRule migrationTestRule = new DataMigrationResetRule(this, GraphMigrationPlugin.PLUGIN_NAME,
 GraphDataVersions.INITIAL.getVersion());
-
-
+    public DataMigrationResetRule migrationTestRule =
+        new DataMigrationResetRule( this, GraphMigrationPlugin.PLUGIN_NAME, GraphDataVersions.INITIAL.getVersion()
);
 
 
     @Test
@@ -90,7 +104,7 @@ public class EdgeDataMigrationImplTest implements DataMigrationResetRule.DataMig
         final ApplicationScope applicationScope = new ApplicationScopeImpl( IdGenerator.createId(
"application" ) );
 
 
-        GraphManager gm = graphManagerFactory.createEdgeManager(applicationScope );
+        GraphManager gm = graphManagerFactory.createEdgeManager( applicationScope );
 
 
         final Id sourceId1 = IdGenerator.createId( "source1" );
@@ -103,17 +117,15 @@ public class EdgeDataMigrationImplTest implements DataMigrationResetRule.DataMig
         final Id target2 = IdGenerator.createId( "target2" );
 
 
-        Edge s1t1 = createEdge(sourceId1, "test", target1 );
+        Edge s1t1 = createEdge( sourceId1, "test", target1 );
 
         Edge s1t2 = createEdge( sourceId1, "baz", target2 );
 
-        Edge s2t1 = createEdge(sourceId2, "foo", target1);
+        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();
@@ -121,24 +133,24 @@ public class EdgeDataMigrationImplTest implements DataMigrationResetRule.DataMig
 
 
         //walk from s1 and s2
-        final Observable<GraphNode> graphNodes = Observable.just( new GraphNode( applicationScope,
sourceId1), new GraphNode(applicationScope, sourceId2 ) );
+        final Observable<GraphNode> graphNodes = Observable
+            .just( new GraphNode( applicationScope, sourceId1 ), new GraphNode( applicationScope,
sourceId2 ) );
 
-        final MigrationDataProvider<GraphNode> testMigrationProvider = new MigrationDataProvider<GraphNode>()
{
-            @Override
-            public Observable<GraphNode> getData() {
-                return graphNodes;
-            }
-        };
+        final MigrationDataProvider<GraphNode> testMigrationProvider = () -> 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 );
+        EdgeDataMigrationImpl edgeDataMigrationImpl =
+            new EdgeDataMigrationImpl( keyspace, graphManagerFactory, edgesFromSourceObservable,
allVersions,
+                edgeMetadataSerializationV2, testMigrationProvider );
+
+
+        final int returned = edgeDataMigrationImpl.migrate( GraphDataVersions.INITIAL.getVersion(),
progressObserver );
         //perform the migration
 
         assertEquals( "Correct version returned", returned, GraphDataVersions.META_SHARDING.getVersion()
);
@@ -164,9 +176,6 @@ public class EdgeDataMigrationImplTest implements DataMigrationResetRule.DataMig
 
         assertTrue( "Edge type present", source2Edges.contains( "foo" ) );
         assertTrue( "Edge type present", source2Edges.contains( "bar" ) );
-
-
-
     }
 
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/d971ec50/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/guice/IndexModule.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/guice/IndexModule.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/guice/IndexModule.java
index d03bbf8..7279174 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/guice/IndexModule.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/guice/IndexModule.java
@@ -56,8 +56,8 @@ public abstract class IndexModule extends AbstractModule {
 
 
         //wire up the edg migration. A no-op ATM, but retained for future development
-        Multibinder<DataMigration<ApplicationScope>> dataMigrationMultibinder
=
-                Multibinder.newSetBinder( binder(), new TypeLiteral<DataMigration<ApplicationScope>>()
{}, IndexMigration.class );
+        Multibinder<DataMigration> dataMigrationMultibinder =
+                Multibinder.newSetBinder( binder(), new TypeLiteral<DataMigration>()
{}, IndexMigration.class );
 
 
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/d971ec50/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/migration/EsIndexMigrationPlugin.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/migration/EsIndexMigrationPlugin.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/migration/EsIndexMigrationPlugin.java
index a28c701..c8e353d 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/migration/EsIndexMigrationPlugin.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/migration/EsIndexMigrationPlugin.java
@@ -18,20 +18,18 @@ package org.apache.usergrid.persistence.index.migration;
 
 import com.google.inject.Inject;
 import org.apache.usergrid.persistence.core.migration.data.*;
-import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 
 import java.util.Set;
 
 /**
  * Classy class class.
  */
-public class EsIndexMigrationPlugin  extends AbstractMigrationPlugin<ApplicationScope>{
+public class EsIndexMigrationPlugin  extends AbstractMigrationPlugin {
 
     @Inject
-    public EsIndexMigrationPlugin(@IndexMigration final Set<DataMigration<ApplicationScope>>
entityDataMigrations,
-                                  final MigrationDataProvider<ApplicationScope> entityIdScopeDataMigrationProvider,
+    public EsIndexMigrationPlugin(@IndexMigration final Set<DataMigration> entityDataMigrations,
                                   final MigrationInfoSerialization migrationInfoSerialization
){
-        super(entityDataMigrations,entityIdScopeDataMigrationProvider,migrationInfoSerialization);
+        super(entityDataMigrations,migrationInfoSerialization);
     }
 
     @Override


Mime
View raw message