You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by gr...@apache.org on 2015/03/19 23:20:17 UTC
[27/50] [abbrv] incubator-usergrid git commit: Refactored packages
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cf32557a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/newimpls/MigrationDataProvider.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/newimpls/MigrationDataProvider.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/newimpls/MigrationDataProvider.java
deleted file mode 100644
index ffe8d9e..0000000
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/newimpls/MigrationDataProvider.java
+++ /dev/null
@@ -1,43 +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.migration.data.newimpls;
-
-
-import rx.Observable;
-
-
-/**
- * An interface for data providers to implement. The migration must take the migrationdata provider as an argument
- * @param <T>
- */
-public interface MigrationDataProvider<T> {
-
-
- /**
- * Get data that can be used in the migration
- * @return
- */
- public Observable<T> getData();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cf32557a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/newimpls/MigrationPlugin.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/newimpls/MigrationPlugin.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/newimpls/MigrationPlugin.java
deleted file mode 100644
index 50dc91b..0000000
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/newimpls/MigrationPlugin.java
+++ /dev/null
@@ -1,51 +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.migration.data.newimpls;
-
-
-
-/**
- * A simple interface to return migration plugins. All versions within this migration plugin should have a name
- */
-public interface MigrationPlugin {
-
-
- /**
- * Get the name of the plugin. Must be unique
- * @return
- */
- public String getName();
-
- /**
- * Run any migrations that may need to be run in this plugin
- */
- public void run(ProgressObserver observer);
-
-
- /**
- * Get the max version this plugin supports
- * @return
- */
- int getMaxVersion();
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cf32557a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/newimpls/MigrationRelationship.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/newimpls/MigrationRelationship.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/newimpls/MigrationRelationship.java
deleted file mode 100644
index 691d8c1..0000000
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/newimpls/MigrationRelationship.java
+++ /dev/null
@@ -1,100 +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.migration.data.newimpls;
-
-
-/**
- * Simple relationship that defines the current state of the source and destination data versions. Note that
- * ina current system, the from and then to will be the same instance
- */
-public class MigrationRelationship<T extends VersionedData> {
-
- //public so it's FAST. It's also immutable
-
-
- public final T from;
- public final T to;
-
- private final int fromVersion;
- private final int toVersion;
-
-
- public MigrationRelationship( T from, T to ) {
- this.from = from;
- this.to = to;
-
- fromVersion = from.getImplementationVersion();
- toVersion = to.getImplementationVersion();
- }
-
-
- /**
- * Returns true if we need to perform dual writes. IE. the from is not the same as the to
- * @return
- */
- public boolean needsMigration(){
- return fromVersion != toVersion;
- }
-
-
- /**
- * Return true if this is the migration relationship we should use. The version matches the from
- * and is <= the to
- * @param currentVersion
- * @return
- */
- public boolean correctRelationship(final int currentVersion){
- return currentVersion == fromVersion && currentVersion <= toVersion;
- }
-
-
- @Override
- public boolean equals( final Object o ) {
- if ( this == o ) {
- return true;
- }
- if ( !( o instanceof MigrationRelationship ) ) {
- return false;
- }
-
- final MigrationRelationship that = ( MigrationRelationship ) o;
-
- if ( !from.equals( that.from ) ) {
- return false;
- }
- if ( !to.equals( that.to ) ) {
- return false;
- }
-
- return true;
- }
-
-
- @Override
- public int hashCode() {
- int result = from.hashCode();
- result = 31 * result + to.hashCode();
- return result;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cf32557a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/newimpls/ProgressObserver.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/newimpls/ProgressObserver.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/newimpls/ProgressObserver.java
deleted file mode 100644
index 36c721a..0000000
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/newimpls/ProgressObserver.java
+++ /dev/null
@@ -1,50 +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.migration.data.newimpls;
-
-
-public interface ProgressObserver{
- /**
- * Mark the migration as failed
- * @param migrationVersion The migration version running during the failure
- * @param reason The reason to save
- */
- public void failed(final int migrationVersion, final String reason);
-
- /**
- * Mark the migration as failed with a stack trace
- * @param migrationVersion The migration version running during the failure
- * @param reason The error description to save
- * @param throwable The error that happened
- */
- public void failed(final int migrationVersion, final String reason, final Throwable throwable);
-
-
- /**
- * Update the status of the migration with the message
- *
- * @param message The message to save for the status
- */
- public void update(final int migrationVersion, final String message);
- }
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cf32557a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/newimpls/VersionedData.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/newimpls/VersionedData.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/newimpls/VersionedData.java
deleted file mode 100644
index 14d488b..0000000
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/newimpls/VersionedData.java
+++ /dev/null
@@ -1,38 +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.migration.data.newimpls;
-
-
-/**
- * Marker interface for implementations that may migrate their internal format
- */
-public interface VersionedData {
-
- /**
- * Get the version of the implementation
- * @return
- */
- public int getImplementationVersion();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cf32557a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/newimpls/VersionedMigrationSet.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/newimpls/VersionedMigrationSet.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/newimpls/VersionedMigrationSet.java
deleted file mode 100644
index f40f5d0..0000000
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/newimpls/VersionedMigrationSet.java
+++ /dev/null
@@ -1,153 +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.migration.data.newimpls;
-
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.google.common.base.Preconditions;
-
-
-/**
- * A set that represents a set of tuples that are used for
- * @param <T>
- */
-public class VersionedMigrationSet<T extends VersionedData> {
-
-
- /**
- * Cache so that after our initial lookup, it O(1) since this will be used heavily
- *
- */
- private Map<Integer, MigrationRelationship<T>> cacheVersion = new HashMap<>();
-
- private List<MigrationRelationship<T>> orderedVersions = new ArrayList<>();
-
-
- /**
- * Construct this set from a group of tuples. Imagine the following versions
- *
- * v1,
- * v2,
- * v3,
- * v4
- *
- * Migrations can jump from v1->v3, but not directly to v4 without an extraneous migration. This would have 2 relationships
- *
- * v1, v3
- * v2, v3
- * and
- * v3, v4
- *
- *
- * @param migrations
- */
- public VersionedMigrationSet( final MigrationRelationship<T>... migrations ){
- Preconditions.checkNotNull(migrations, "versions must not be null");
- Preconditions.checkArgument( migrations.length > 0, "You must specify at least 1 migrationrelationship" );
-
- orderedVersions.addAll( Arrays.asList(migrations ) );
-
- Collections.sort( orderedVersions, new VersionedDataComparator() );
-
- }
-
-
- /**
- * Get the migration relationship based on our current version. This will return a range that includes the current
- * system version as the source, and the highest version we can roll to in the to field
- * @param currentVersion
- * @return The MigrationRelationship. Note the from and the to could be the same version in a current system.
- */
- public MigrationRelationship<T> getMigrationRelationship( final int currentVersion ){
-
- final MigrationRelationship<T> relationship = cacheVersion.get( currentVersion );
-
- if(relationship != null){
- return relationship;
- }
-
- //not there, find it. Not the most efficient, but it happens once per version, which rarely changes, so not a big deal
-
-
- for(MigrationRelationship<T> current: orderedVersions){
-
- //not our instance, the from is too high
- //our from is this instance, so we support this tuple. Our future is >= as well, so we can perform this I/O
- if ( current.correctRelationship( currentVersion )) {
- cacheVersion.put( currentVersion, current );
- return current;
- }
-
- }
-
- //if we get here, something is wrong
- throw new IllegalArgumentException( "Could not find a migration version for version " + currentVersion + " min found was " + orderedVersions.get( orderedVersions.size()-1 ) );
-
-
- }
-
-
- /**
- * Given the current system version, return the maximum migration version we can move to
- * @param currentVersion
- * @return
- */
- public int getMaxVersion(final int currentVersion){
- return getMigrationRelationship( currentVersion ).to.getImplementationVersion();
- }
-
-
-
- /**
- * Orders from high to low
- */
- private final class VersionedDataComparator implements Comparator<MigrationRelationship<T>>
- {
-
- @Override
- public int compare( final MigrationRelationship<T> o1, final MigrationRelationship<T> o2 ) {
- //Put higher target version first, since that's what we want to match based on current state and source
-
- //order by the source. Put highest source first
- int compare = Integer.compare( o1.to.getImplementationVersion(), o2.to.getImplementationVersion() ) *-1;
-
-
- //put higher from first, if we fall within a range here we're good
- if(compare == 0){
- compare = Integer.compare( o1.from.getImplementationVersion(), o2.from.getImplementationVersion() ) *-1;
- }
-
- return compare;
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cf32557a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/DataMigrationManagerImplTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/DataMigrationManagerImplTest.java b/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/DataMigrationManagerImplTest.java
index a6d5717..5d516d4 100644
--- a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/DataMigrationManagerImplTest.java
+++ b/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/DataMigrationManagerImplTest.java
@@ -1,248 +1,148 @@
/*
+ * 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
*
- * * 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.
+ * 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.migration.data;
+import java.util.HashSet;
+import java.util.Set;
+
import org.junit.Test;
-import static org.junit.Assert.fail;
+import org.apache.usergrid.persistence.core.migration.schema.MigrationException;
+
+import static org.junit.Assert.*;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
-/**
- * Tests our data migration manager
- */
public class DataMigrationManagerImplTest {
- //TODO USERGRID-405 fix this
-//
-// AllEntitiesInSystemObservable allEntitiesInSystemObservable = new AllEntitiesInSystemObservable() {
-// @Override
-// public Observable<ApplicationEntityGroup> getAllEntitiesInSystem(int bufferSize) {
-//
-// return Observable.create(new Observable.OnSubscribe<ApplicationEntityGroup>() {
-// @Override
-// public void call(Subscriber<? super ApplicationEntityGroup> subscriber) {
-// ApplicationEntityGroup entityGroup = new ApplicationEntityGroup(mock(ApplicationScope.class),new ArrayList<EntityIdScope>());
-// subscriber.onNext(entityGroup);
-// subscriber.onCompleted();
-// }
-// });
-// }
-//
-// @Override
-// public Observable<ApplicationEntityGroup> getAllEntitiesInSystem(Observable appIdObservable, int bufferSize) {
-// return this.getAllEntitiesInSystem(bufferSize) ;
-// }
-// };
-//
-// ApplicationObservable allApplicationsObservable = new ApplicationObservable() {
-// @Override
-// public Observable<Id> getAllApplicationIds() {
-// return Observable.just( (Id)new SimpleId("application"));
-// }
-//
-// @Override
-// public Observable<ApplicationScope> getAllApplicationScopes() {
-// return Observable.just( (ApplicationScope)new ApplicationScopeImpl((Id)new SimpleId("application")));
-// }
-// };
-//
-// @Test
-// public void noMigrations() throws MigrationException {
-// final MigrationInfoSerialization serialization = mock( MigrationInfoSerialization.class );
-// when(serialization.getCurrentVersion()).thenReturn(1);
-//
-// Set<DataMigration> emptyMigration = new HashSet<>();
-//
-// DataMigrationManagerImpl migrationManager = new DataMigrationManagerImpl( serialization, emptyMigration, allEntitiesInSystemObservable,allApplicationsObservable );
-//
-// migrationManager.migrate();
-//
-// verify( serialization, never() ).setStatusMessage( any( String.class ) );
-// verify( serialization, never() ).setStatusCode( any( Integer.class ) );
-// verify( serialization, never() ).setVersion( any( Integer.class ) );
-// }
-//
-//
-// @Test
-// public void multipleMigrations() throws Throwable {
-// final MigrationInfoSerialization serialization = mock( MigrationInfoSerialization.class );
-// when(serialization.getCurrentVersion()).thenReturn(1);
-//
-//
-// final ApplicationDataMigration v1 = mock( ApplicationDataMigration.class );
-// when( v1.getVersion() ).thenReturn( 2 );
-// when( v1.migrate(any(Observable.class), any(DataMigration.ProgressObserver.class))).thenReturn(Observable.empty());
-//
-// final ApplicationDataMigration v2 = mock( ApplicationDataMigration.class );
-// when( v2.getVersion() ).thenReturn( 3 );
-// when(v2.migrate(any(Observable.class), any(DataMigration.ProgressObserver.class))).thenReturn(Observable.empty());
-//
-//
-// Set<DataMigration> migrations = new HashSet<>();
-// migrations.add( v1 );
-// migrations.add( v2 );
-//
-//
-//
-// DataMigrationManagerImpl migrationManager = new DataMigrationManagerImpl( serialization, migrations,allEntitiesInSystemObservable,allApplicationsObservable );
-//
-// migrationManager.migrate();
-//
-//
-// verify( v1 ).migrate(any(Observable.class), any( DataMigration.ProgressObserver.class ) );
-// verify( v2 ).migrate(any(Observable.class), any( DataMigration.ProgressObserver.class ) );
-//
-// //verify we set the running status
-// verify( serialization, times( 2 ) ).setStatusCode( DataMigrationManagerImpl.StatusCode.RUNNING.status );
-//
-// //set the status message
-// verify( serialization, times( 2 * 2 ) ).setStatusMessage( any( String.class ) );
-//
-// verify( serialization ).setStatusCode( DataMigrationManagerImpl.StatusCode.COMPLETE.status );
-//
-// //verify we set version 1
-// verify( serialization ).setVersion( 2 );
-//
-// //verify we set version 2
-// verify( serialization ).setVersion( 3 );
-// }
-//
-//
-// @Test
-// public void shortCircuitVersionFails() throws Throwable {
-// final MigrationInfoSerialization serialization = mock( MigrationInfoSerialization.class );
-// when(serialization.getCurrentVersion()).thenReturn(1);
-//
-//
-// final ApplicationDataMigration v1 = mock( ApplicationDataMigration.class,"mock1" );
-// when( v1.getVersion() ).thenReturn( 2 );
-// when( v1.getType() ).thenReturn(DataMigration.MigrationType.Entities);
-// when( v1.migrate(any(Observable.class), any(DataMigration.ProgressObserver.class))).thenReturn(Observable.empty());
-//
-// //throw an exception
-// when( v1.migrate(any(Observable.class),
-// any(DataMigration.ProgressObserver.class) )).thenThrow(new RuntimeException( "Something bad happened" ));
-//
-// final ApplicationDataMigration v2 = mock( ApplicationDataMigration.class,"mock2" );
-// when( v2.getType() ).thenReturn(DataMigration.MigrationType.Entities);
-// when( v2.getVersion() ).thenReturn( 3 );
-//
-// Set<DataMigration> migrations = new HashSet<>();
-// migrations.add( v1 );
-// migrations.add( v2 );
-//
-// DataMigrationManagerImpl migrationManager
-// = new DataMigrationManagerImpl( serialization, migrations,allEntitiesInSystemObservable,allApplicationsObservable );
-//
-// migrationManager.migrate();
-//
-//
-// verify( v1 ).migrate( any(Observable.class),any( DataMigration.ProgressObserver.class ) );
-//
-// //verify we don't run migration
-// verify( v2, never() ).migrate( any(Observable.class),any( DataMigration.ProgressObserver.class ) );
-//
-// //verify we set the running status
-// verify( serialization, times( 1 ) ).setStatusCode( DataMigrationManagerImpl.StatusCode.RUNNING.status );
-//
-// //set the status message
-// verify( serialization, times( 2 ) ).setStatusMessage( any( String.class ) );
-//
-// //verify we set an error
-// verify( serialization ).setStatusCode( DataMigrationManagerImpl.StatusCode.ERROR.status );
-//
-// //verify we never set version 1
-// verify( serialization, never() ).setVersion( 1 );
-//
-// //verify we never set version 2
-// verify( serialization, never() ).setVersion( 2 );
-// }
-//
-//
-// @Test
-// public void failStopsProgress() throws Throwable {
-// final MigrationInfoSerialization serialization = mock(MigrationInfoSerialization.class);
-// when(serialization.getCurrentVersion()).thenReturn(1);
-//
-// final CollectionDataMigration v1 = mock( CollectionDataMigration.class );
-// when( v1.getVersion() ).thenReturn( 2 );
-// when( v1.getType() ).thenReturn(DataMigration.MigrationType.Entities);
-// when( v1.migrate(any(Observable.class), any(DataMigration.ProgressObserver.class))).thenReturn(Observable.empty());
-//
-// final int returnedCode = 100;
-//
-// final String reason = "test reason";
-//
-// //mark as fail but don't
-// when(v1.migrate(any(Observable.class), any(DataMigration.ProgressObserver.class))).thenAnswer(
-// new Answer<Object>() {
-// @Override
-// public Object answer(final InvocationOnMock invocation) throws Throwable {
-// final DataMigration.ProgressObserver progressObserver =
-// (DataMigration.ProgressObserver) invocation.getArguments()[1];
-//
-// progressObserver.failed(returnedCode, reason);
-// return null;
-// }
-// }
-//
-// );
-//
-// final CollectionDataMigration v2 = mock( CollectionDataMigration.class );
-// when( v2.getVersion() ).thenReturn( 3 );
-// when( v2.getType() ).thenReturn(DataMigration.MigrationType.Entities);
-// when(v2.migrate(any(Observable.class), any(DataMigration.ProgressObserver.class))).thenReturn(Observable.empty());
-//
-// Set<DataMigration> applicationDataMigrations = new HashSet<>();
-// applicationDataMigrations.add( v1 );
-// applicationDataMigrations.add(v2);
-//
-//
-// DataMigrationManagerImpl migrationManager = new DataMigrationManagerImpl( serialization, applicationDataMigrations,allEntitiesInSystemObservable, allApplicationsObservable );
-//
-// migrationManager.migrate();
-//
-//
-// verify( v1 ).migrate(any(Observable.class), any( DataMigration.ProgressObserver.class ) );
-//
-// //verify we don't run migration
-// verify( v2, never() ).migrate( any(Observable.class),any( DataMigration.ProgressObserver.class ) );
-//
-// //verify we set the running status
-// verify( serialization, times( 1 ) ).setStatusCode( DataMigrationManagerImpl.StatusCode.RUNNING.status );
-//
-// //set the status message
-// verify( serialization ).setStatusMessage( "Migration version 2. Starting migration" );
-//
-// verify( serialization ).setStatusMessage( "Migration version 100. Failed to migrate, reason is appended. Error 'test reason'" );
-//
-// //verify we set an error
-// verify( serialization, times(2) ).setStatusCode( DataMigrationManagerImpl.StatusCode.ERROR.status );
-//
-// //verify we never set version 1
-// verify( serialization, never() ).setVersion( 1 );
-//
-// //verify we never set version 2
-// verify( serialization, never() ).setVersion( 2 );
-// }
+
+ @Test
+ public void testNoPlugins(){
+
+ final Set<MigrationPlugin> plugins = new HashSet<>( );
+
+ final MigrationInfoSerialization migrationInfoSerialization = mock(MigrationInfoSerialization.class);
+
+
+ DataMigrationManagerImpl migrationManager = new DataMigrationManagerImpl( plugins, migrationInfoSerialization );
+
+
+ Set<String> pluginNames = migrationManager.getPluginNames();
+
+ assertEquals(0, pluginNames.size());
+
+ }
+
+
+
+ @Test
+ public void test2Plugins() throws MigrationException {
+
+ final Set<MigrationPlugin> plugins = new HashSet<>( );
+
+ MigrationPlugin plugin1 = mock(MigrationPlugin.class);
+
+ when(plugin1.getName()).thenReturn("plugin1");
+
+ MigrationPlugin plugin2 = mock(MigrationPlugin.class);
+
+ when(plugin2.getName()).thenReturn("plugin2");
+
+ plugins.add( plugin1 );
+ plugins.add( plugin2 );
+
+
+
+ final MigrationInfoSerialization migrationInfoSerialization = mock(MigrationInfoSerialization.class);
+
+
+ DataMigrationManagerImpl migrationManager = new DataMigrationManagerImpl( plugins, migrationInfoSerialization );
+
+
+ Set<String> pluginNames = migrationManager.getPluginNames();
+
+ assertEquals(2, pluginNames.size());
+
+ assertTrue(pluginNames.contains( "plugin1"));
+
+ assertTrue(pluginNames.contains( "plugin2" ));
+
+ //now run them
+
+ migrationManager.migrate();
+
+ verify(plugin1).run( any(ProgressObserver.class) );
+
+ verify(plugin2).run( any(ProgressObserver.class) );
+
+ }
+
+
+
+
+ @Test
+ public void testRunning() throws MigrationException {
+
+ final Set<MigrationPlugin> plugins = new HashSet<>( );
+
+ MigrationPlugin plugin1 = mock(MigrationPlugin.class);
+
+ when(plugin1.getName()).thenReturn("plugin1");
+
+ plugins.add( plugin1 );
+
+
+
+ final MigrationInfoSerialization migrationInfoSerialization = mock(MigrationInfoSerialization.class);
+
+ when(migrationInfoSerialization.getStatusCode( "plugin1" )).thenReturn( DataMigrationManagerImpl.StatusCode.RUNNING.status );
+
+
+
+
+ DataMigrationManagerImpl migrationManager = new DataMigrationManagerImpl( plugins, migrationInfoSerialization );
+
+
+ boolean status = migrationManager.isRunning();
+
+ assertTrue("Status is set", status);
+
+
+ when(migrationInfoSerialization.getStatusCode( "plugin1" )).thenReturn( DataMigrationManagerImpl.StatusCode.COMPLETE.status );
+
+ status = migrationManager.isRunning();
+
+ assertFalse( "Status is not running", status );
+
+
+ when(migrationInfoSerialization.getStatusCode( "plugin1" )).thenReturn( DataMigrationManagerImpl.StatusCode.ERROR.status );
+
+ status = migrationManager.isRunning();
+
+ assertFalse("Status is not running", status);
+ }
+
+
+
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cf32557a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/MigrationInfoSerializationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/MigrationInfoSerializationTest.java b/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/MigrationInfoSerializationTest.java
index 7ac1fb2..1b6dd3f 100644
--- a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/MigrationInfoSerializationTest.java
+++ b/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/MigrationInfoSerializationTest.java
@@ -22,18 +22,16 @@
package org.apache.usergrid.persistence.core.migration.data;
-
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.apache.usergrid.persistence.core.migration.schema.MigrationException;
-import org.apache.usergrid.persistence.core.migration.schema.MigrationManager;
-import org.apache.usergrid.persistence.core.test.ITRunner;
import org.apache.usergrid.persistence.core.guice.MigrationManagerRule;
import org.apache.usergrid.persistence.core.guice.TestCommonModule;
+import org.apache.usergrid.persistence.core.migration.schema.MigrationException;
+import org.apache.usergrid.persistence.core.migration.schema.MigrationManager;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.core.test.ITRunner;
import org.apache.usergrid.persistence.core.test.UseModules;
import com.google.inject.Inject;
@@ -42,16 +40,12 @@ import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
@RunWith( ITRunner.class )
@UseModules( TestCommonModule.class )
-@Ignore()
public class MigrationInfoSerializationTest {
- //TODO USERGRID-405 fix this
-
@Inject
@Rule
public MigrationManagerRule migrationManagerRule;
@@ -68,53 +62,55 @@ public class MigrationInfoSerializationTest {
@Inject
protected MigrationInfoSerialization migrationInfoSerialization;
-//
-// @Test
-// public void basicTest() throws ConnectionException, MigrationException {
-//
-// //drop the column family, then run setup
-// keyspace.dropColumnFamily( MigrationInfoSerializationImpl.CF_MIGRATION_INFO.getName() );
-//
-// migrationManager.migrate();
-//
-// //test getting nothing works
-// final String emptyStatus = migrationInfoSerialization.getStatusMessage();
-//
-// assertNull(emptyStatus);
-//
-// final int unsavedVersion = migrationInfoSerialization.getVersion();
-//
-// assertEquals(0, unsavedVersion);
-//
-// final int statusCode = migrationInfoSerialization.getStatusCode();
-//
-// assertEquals(0, statusCode);
-//
-// //now update them
-//
-// final String savedStatus = "I'm a test status";
-//
-// migrationInfoSerialization.setStatusMessage( savedStatus );
-//
-// final String returnedStatus = migrationInfoSerialization.getStatusMessage();
-//
-// assertEquals("Correct status returned", savedStatus, returnedStatus);
-//
-//
-// final int savedVersion = 100;
-//
-// migrationInfoSerialization.setVersion( savedVersion );
-//
-// final int returnedVersion = migrationInfoSerialization.getVersion();
-//
-// assertEquals("Correct version returned", savedVersion, returnedVersion);
-//
-// final int savedStatusCode = 200;
-//
-// migrationInfoSerialization.setStatusCode( savedStatusCode );
-//
-// final int returnedStatusCode = migrationInfoSerialization.getStatusCode();
-//
-// assertEquals("Status code was set correctly", savedStatusCode, returnedStatusCode);
-// }
+
+ @Test
+ public void basicTest() throws ConnectionException, MigrationException {
+
+ final String migrationModule = "test";
+
+ //drop the column family, then run setup
+ keyspace.dropColumnFamily( MigrationInfoSerializationImpl.CF_MIGRATION_INFO.getName() );
+
+ migrationManager.migrate();
+
+ //test getting nothing works
+ final String emptyStatus = migrationInfoSerialization.getStatusMessage(migrationModule);
+
+ assertNull(emptyStatus);
+
+ final int unsavedVersion = migrationInfoSerialization.getVersion(migrationModule);
+
+ assertEquals(0, unsavedVersion);
+
+ final int statusCode = migrationInfoSerialization.getStatusCode(migrationModule);
+
+ assertEquals(0, statusCode);
+
+ //now update them
+
+ final String savedStatus = "I'm a test status";
+
+ migrationInfoSerialization.setStatusMessage(migrationModule, savedStatus );
+
+ final String returnedStatus = migrationInfoSerialization.getStatusMessage(migrationModule);
+
+ assertEquals("Correct status returned", savedStatus, returnedStatus);
+
+
+ final int savedVersion = 100;
+
+ migrationInfoSerialization.setVersion(migrationModule, savedVersion );
+
+ final int returnedVersion = migrationInfoSerialization.getVersion(migrationModule);
+
+ assertEquals("Correct version returned", savedVersion, returnedVersion);
+
+ final int savedStatusCode = 200;
+
+ migrationInfoSerialization.setStatusCode(migrationModule, savedStatusCode );
+
+ final int returnedStatusCode = migrationInfoSerialization.getStatusCode(migrationModule);
+
+ assertEquals("Status code was set correctly", savedStatusCode, returnedStatusCode);
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cf32557a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/TestMigrationDataProvider.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/TestMigrationDataProvider.java b/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/TestMigrationDataProvider.java
new file mode 100644
index 0000000..61e5207
--- /dev/null
+++ b/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/TestMigrationDataProvider.java
@@ -0,0 +1,61 @@
+/*
+ *
+ * *
+ * * 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.migration.data;
+
+
+import org.apache.usergrid.persistence.core.migration.data.MigrationDataProvider;
+
+import rx.Observable;
+
+
+/**
+ * A simple test class that will emit the provided test data when subscribed
+ * @param <T>
+ */
+public class TestMigrationDataProvider<T> implements MigrationDataProvider<T> {
+
+
+
+ //default to nothing so that we don't return null
+ private Observable<T> observable = Observable.empty();
+
+
+ public TestMigrationDataProvider( ) {}
+
+
+ @Override
+ public Observable<T> getData() {
+ return observable;
+ }
+
+
+ /**
+ * Set this observable to return when invoked
+ *
+ * @param observable
+ */
+ public void setObservable( final Observable<T> observable ) {
+ this.observable = observable;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cf32557a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/TestProgressObserver.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/TestProgressObserver.java b/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/TestProgressObserver.java
index 63fad42..1612779 100644
--- a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/TestProgressObserver.java
+++ b/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/TestProgressObserver.java
@@ -23,18 +23,30 @@ package org.apache.usergrid.persistence.core.migration.data;
import java.util.ArrayList;
import java.util.List;
-import org.apache.usergrid.persistence.core.migration.data.newimpls.ProgressObserver;
-
public class TestProgressObserver implements ProgressObserver {
private boolean failed = false;
+ private boolean started = false;
+
private List<String> updates = new ArrayList<>( 100 );
@Override
+ public void start() {
+ started = true;
+ }
+
+
+ @Override
+ public void stop() {
+ started = false;
+ }
+
+
+ @Override
public void failed( final int migrationVersion, final String reason ) {
failed = true;
}
@@ -56,11 +68,17 @@ public class TestProgressObserver implements ProgressObserver {
* Get if we failed
* @return
*/
- public boolean getFailed() {
+ public boolean isFailed() {
return failed;
}
+ public boolean isStarted() {
+ return started;
+ }
+
+
+
/**
* Get update messages
* @return
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cf32557a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/VersionedMigrationSetTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/VersionedMigrationSetTest.java b/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/VersionedMigrationSetTest.java
new file mode 100644
index 0000000..fc23cb4
--- /dev/null
+++ b/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/VersionedMigrationSetTest.java
@@ -0,0 +1,198 @@
+/*
+ *
+ * *
+ * * 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.migration.data;
+
+
+import org.junit.Test;
+
+import org.apache.usergrid.persistence.core.migration.data.MigrationRelationship;
+import org.apache.usergrid.persistence.core.migration.data.VersionedData;
+import org.apache.usergrid.persistence.core.migration.data.VersionedMigrationSet;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+
+public class VersionedMigrationSetTest {
+
+
+ /**
+ * a single version that goes from 1 to 3, and 2 to 3. then current as 3, 3. 1, 2 and 3, should have this in
+ * their range
+ */
+ @Test
+ public void singleVersion() {
+ //
+ final MigrationRelationship<TestVersionImpl> relationship1_3 =
+ new MigrationRelationship<>( new TestVersionImpl( 1 ), new TestVersionImpl( 3 ) );
+
+ final MigrationRelationship<TestVersionImpl> relationship2_3 =
+ new MigrationRelationship<>( new TestVersionImpl( 2 ), new TestVersionImpl( 3 ) );
+
+ //our current state, a necessity based on the data structure
+
+ final MigrationRelationship<TestVersionImpl> current =
+ new MigrationRelationship<>( new TestVersionImpl( 3 ), new TestVersionImpl( 3 ) );
+
+
+ final VersionedMigrationSet<TestVersionImpl> set =
+ new VersionedMigrationSet<>( relationship1_3, relationship2_3, current );
+
+
+ try {
+ set.getMigrationRelationship( 0 );
+ fail( "I should throw an exception" );
+ }
+ catch ( IllegalArgumentException iae ) {
+ //swallow, it's outside the range
+ }
+
+ MigrationRelationship<TestVersionImpl> migrationRelationship = set.getMigrationRelationship( 1 );
+
+ assertEquals( relationship1_3, migrationRelationship );
+
+
+ migrationRelationship = set.getMigrationRelationship( 2 );
+
+ assertEquals( relationship2_3, migrationRelationship );
+
+ migrationRelationship = set.getMigrationRelationship( 3 );
+
+ assertEquals( current, migrationRelationship );
+
+ try {
+ set.getMigrationRelationship( 4 );
+ fail( "I should throw an exception" );
+ }
+ catch ( IllegalArgumentException iae ) {
+ //swallow, it's outside the range
+ }
+ }
+
+
+ /**
+ * a single version that goes from 1 to 3. versions that go from 2 to 3, then a barrier migration that must be run.
+ * This can happen during a massive data change. From there we can move on from 3 forward, so we go from 3:6, 4:6,
+ * 5:6, and 6:6, This should mean an older system say on v2, can jump from v2 to v3, then from v3 directly to v6.
+ */
+ @Test
+ public void versionBounds() {
+ //
+ final MigrationRelationship<TestVersionImpl> relationship1_3 =
+ new MigrationRelationship<>( new TestVersionImpl( 1 ), new TestVersionImpl( 3 ) );
+
+ final MigrationRelationship<TestVersionImpl> relationship2_3 =
+ new MigrationRelationship<>( new TestVersionImpl( 2 ), new TestVersionImpl( 3 ) );
+
+ //our current state, a necessity based on the data structure
+ final MigrationRelationship<TestVersionImpl> relationship3_6 =
+ new MigrationRelationship<>( new TestVersionImpl( 3 ), new TestVersionImpl( 6 ) );
+
+
+ final MigrationRelationship<TestVersionImpl> relationship4_6 =
+ new MigrationRelationship<>( new TestVersionImpl( 4 ), new TestVersionImpl( 6 ) );
+
+
+ final MigrationRelationship<TestVersionImpl> relationship5_6 =
+ new MigrationRelationship<>( new TestVersionImpl( 5 ), new TestVersionImpl( 6 ) );
+
+
+ final MigrationRelationship<TestVersionImpl> current =
+ new MigrationRelationship<>( new TestVersionImpl( 6 ), new TestVersionImpl( 6 ) );
+
+
+ final VersionedMigrationSet<TestVersionImpl> set =
+ new VersionedMigrationSet<>( relationship1_3, relationship2_3, relationship3_6, relationship4_6,
+ relationship5_6, current );
+
+
+ try {
+ set.getMigrationRelationship( 0 );
+ fail( "I should throw an exception" );
+ }
+ catch ( IllegalArgumentException iae ) {
+ //swallow, it's outside the range
+ }
+
+ MigrationRelationship<TestVersionImpl> migrationRelationship = set.getMigrationRelationship( 1 );
+
+ assertEquals( relationship1_3, migrationRelationship );
+
+ migrationRelationship = set.getMigrationRelationship( 2 );
+
+ assertEquals( relationship2_3, migrationRelationship );
+
+
+ //now go from v3, we should get 3 to 6
+
+ migrationRelationship = set.getMigrationRelationship( 3 );
+
+ assertEquals( relationship3_6, migrationRelationship );
+
+ migrationRelationship = set.getMigrationRelationship( 4 );
+
+ assertEquals( relationship4_6, migrationRelationship );
+
+ migrationRelationship = set.getMigrationRelationship( 5 );
+
+ assertEquals( relationship5_6, migrationRelationship );
+
+ migrationRelationship = set.getMigrationRelationship( 6 );
+
+ assertEquals( current, migrationRelationship );
+
+
+ try {
+ set.getMigrationRelationship( 7 );
+ fail( "I should throw an exception" );
+ }
+ catch ( IllegalArgumentException iae ) {
+ //swallow, it's outside the range
+ }
+ }
+
+
+ @Test( expected = IllegalArgumentException.class )
+ public void testNoInput() {
+ new VersionedMigrationSet<TestVersionImpl>();
+ }
+
+
+ /**
+ * Create the test version impl. Just returns the version provided
+ */
+ private static final class TestVersionImpl implements VersionedData {
+
+ private final int version;
+
+
+ private TestVersionImpl( final int version ) {this.version = version;}
+
+
+ @Override
+ public int getImplementationVersion() {
+ return version;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cf32557a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/newimpls/TestMigrationDataProvider.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/newimpls/TestMigrationDataProvider.java b/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/newimpls/TestMigrationDataProvider.java
deleted file mode 100644
index 9e99c6f..0000000
--- a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/newimpls/TestMigrationDataProvider.java
+++ /dev/null
@@ -1,61 +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.migration.data.newimpls;
-
-
-import java.util.Collection;
-
-import rx.Observable;
-
-
-/**
- * A simple test class that will emit the provided test data when subscribed
- * @param <T>
- */
-public class TestMigrationDataProvider<T> implements MigrationDataProvider<T> {
-
-
-
- //default to nothing so that we don't return null
- private Observable<T> observable = Observable.empty();
-
-
- public TestMigrationDataProvider( ) {}
-
-
- @Override
- public Observable<T> getData() {
- return observable;
- }
-
-
- /**
- * Set this observable to return when invoked
- *
- * @param observable
- */
- public void setObservable( final Observable<T> observable ) {
- this.observable = observable;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cf32557a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/newimpls/VersionedMigrationSetTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/newimpls/VersionedMigrationSetTest.java b/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/newimpls/VersionedMigrationSetTest.java
deleted file mode 100644
index e35409a..0000000
--- a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/newimpls/VersionedMigrationSetTest.java
+++ /dev/null
@@ -1,194 +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.migration.data.newimpls;
-
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-
-public class VersionedMigrationSetTest {
-
-
- /**
- * a single version that goes from 1 to 3, and 2 to 3. then current as 3, 3. 1, 2 and 3, should have this in
- * their range
- */
- @Test
- public void singleVersion() {
- //
- final MigrationRelationship<TestVersionImpl> relationship1_3 =
- new MigrationRelationship<>( new TestVersionImpl( 1 ), new TestVersionImpl( 3 ) );
-
- final MigrationRelationship<TestVersionImpl> relationship2_3 =
- new MigrationRelationship<>( new TestVersionImpl( 2 ), new TestVersionImpl( 3 ) );
-
- //our current state, a necessity based on the data structure
-
- final MigrationRelationship<TestVersionImpl> current =
- new MigrationRelationship<>( new TestVersionImpl( 3 ), new TestVersionImpl( 3 ) );
-
-
- final VersionedMigrationSet<TestVersionImpl> set =
- new VersionedMigrationSet<>( relationship1_3, relationship2_3, current );
-
-
- try {
- set.getMigrationRelationship( 0 );
- fail( "I should throw an exception" );
- }
- catch ( IllegalArgumentException iae ) {
- //swallow, it's outside the range
- }
-
- MigrationRelationship<TestVersionImpl> migrationRelationship = set.getMigrationRelationship( 1 );
-
- assertEquals( relationship1_3, migrationRelationship );
-
-
- migrationRelationship = set.getMigrationRelationship( 2 );
-
- assertEquals( relationship2_3, migrationRelationship );
-
- migrationRelationship = set.getMigrationRelationship( 3 );
-
- assertEquals( current, migrationRelationship );
-
- try {
- set.getMigrationRelationship( 4 );
- fail( "I should throw an exception" );
- }
- catch ( IllegalArgumentException iae ) {
- //swallow, it's outside the range
- }
- }
-
-
- /**
- * a single version that goes from 1 to 3. versions that go from 2 to 3, then a barrier migration that must be run.
- * This can happen during a massive data change. From there we can move on from 3 forward, so we go from 3:6, 4:6,
- * 5:6, and 6:6, This should mean an older system say on v2, can jump from v2 to v3, then from v3 directly to v6.
- */
- @Test
- public void versionBounds() {
- //
- final MigrationRelationship<TestVersionImpl> relationship1_3 =
- new MigrationRelationship<>( new TestVersionImpl( 1 ), new TestVersionImpl( 3 ) );
-
- final MigrationRelationship<TestVersionImpl> relationship2_3 =
- new MigrationRelationship<>( new TestVersionImpl( 2 ), new TestVersionImpl( 3 ) );
-
- //our current state, a necessity based on the data structure
- final MigrationRelationship<TestVersionImpl> relationship3_6 =
- new MigrationRelationship<>( new TestVersionImpl( 3 ), new TestVersionImpl( 6 ) );
-
-
- final MigrationRelationship<TestVersionImpl> relationship4_6 =
- new MigrationRelationship<>( new TestVersionImpl( 4 ), new TestVersionImpl( 6 ) );
-
-
- final MigrationRelationship<TestVersionImpl> relationship5_6 =
- new MigrationRelationship<>( new TestVersionImpl( 5 ), new TestVersionImpl( 6 ) );
-
-
- final MigrationRelationship<TestVersionImpl> current =
- new MigrationRelationship<>( new TestVersionImpl( 6 ), new TestVersionImpl( 6 ) );
-
-
- final VersionedMigrationSet<TestVersionImpl> set =
- new VersionedMigrationSet<>( relationship1_3, relationship2_3, relationship3_6, relationship4_6,
- relationship5_6, current );
-
-
- try {
- set.getMigrationRelationship( 0 );
- fail( "I should throw an exception" );
- }
- catch ( IllegalArgumentException iae ) {
- //swallow, it's outside the range
- }
-
- MigrationRelationship<TestVersionImpl> migrationRelationship = set.getMigrationRelationship( 1 );
-
- assertEquals( relationship1_3, migrationRelationship );
-
- migrationRelationship = set.getMigrationRelationship( 2 );
-
- assertEquals( relationship2_3, migrationRelationship );
-
-
- //now go from v3, we should get 3 to 6
-
- migrationRelationship = set.getMigrationRelationship( 3 );
-
- assertEquals( relationship3_6, migrationRelationship );
-
- migrationRelationship = set.getMigrationRelationship( 4 );
-
- assertEquals( relationship4_6, migrationRelationship );
-
- migrationRelationship = set.getMigrationRelationship( 5 );
-
- assertEquals( relationship5_6, migrationRelationship );
-
- migrationRelationship = set.getMigrationRelationship( 6 );
-
- assertEquals( current, migrationRelationship );
-
-
- try {
- set.getMigrationRelationship( 7 );
- fail( "I should throw an exception" );
- }
- catch ( IllegalArgumentException iae ) {
- //swallow, it's outside the range
- }
- }
-
-
- @Test( expected = IllegalArgumentException.class )
- public void testNoInput() {
- new VersionedMigrationSet<TestVersionImpl>();
- }
-
-
- /**
- * Create the test version impl. Just returns the version provided
- */
- private static final class TestVersionImpl implements VersionedData {
-
- private final int version;
-
-
- private TestVersionImpl( final int version ) {this.version = version;}
-
-
- @Override
- public int getImplementationVersion() {
- return version;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cf32557a/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 d504e47..91a0b88 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
@@ -24,12 +24,11 @@ import org.safehaus.guicyfig.GuicyFigModule;
import org.apache.usergrid.persistence.core.consistency.TimeService;
import org.apache.usergrid.persistence.core.consistency.TimeServiceImpl;
import org.apache.usergrid.persistence.core.guice.ProxyImpl;
-import org.apache.usergrid.persistence.core.migration.data.newimpls.DataMigration2;
-import org.apache.usergrid.persistence.core.migration.data.newimpls.MigrationPlugin;
-import org.apache.usergrid.persistence.core.migration.data.newimpls.MigrationRelationship;
-import org.apache.usergrid.persistence.core.migration.data.newimpls.VersionedMigrationSet;
+import org.apache.usergrid.persistence.core.migration.data.DataMigration;
+import org.apache.usergrid.persistence.core.migration.data.MigrationPlugin;
+import org.apache.usergrid.persistence.core.migration.data.MigrationRelationship;
+import org.apache.usergrid.persistence.core.migration.data.VersionedMigrationSet;
import org.apache.usergrid.persistence.core.migration.schema.Migration;
-import org.apache.usergrid.persistence.core.scope.ApplicationScope;
import org.apache.usergrid.persistence.core.task.NamedTaskExecutorImpl;
import org.apache.usergrid.persistence.core.task.TaskExecutor;
import org.apache.usergrid.persistence.graph.GraphFig;
@@ -56,6 +55,7 @@ import org.apache.usergrid.persistence.graph.serialization.impl.EdgesObservableI
import org.apache.usergrid.persistence.graph.serialization.impl.GraphManagerFactoryImpl;
import org.apache.usergrid.persistence.graph.serialization.impl.NodeSerializationImpl;
import org.apache.usergrid.persistence.graph.serialization.impl.TargetIdObservableImpl;
+import org.apache.usergrid.persistence.graph.serialization.impl.migration.GraphMigration;
import org.apache.usergrid.persistence.graph.serialization.impl.migration.GraphMigrationPlugin;
import org.apache.usergrid.persistence.graph.serialization.impl.migration.GraphNode;
import org.apache.usergrid.persistence.graph.serialization.impl.shard.EdgeColumnFamilies;
@@ -131,8 +131,8 @@ public abstract class GraphModule extends AbstractModule {
//wire up the edg migration
- Multibinder<DataMigration2<GraphNode>> dataMigrationMultibinder =
- Multibinder.newSetBinder( binder(), new TypeLiteral<DataMigration2<GraphNode>>() {} );
+ Multibinder<DataMigration<GraphNode>> dataMigrationMultibinder =
+ Multibinder.newSetBinder( binder(), new TypeLiteral<DataMigration<GraphNode>>() {}, GraphMigration.class );
dataMigrationMultibinder.addBinding().to( EdgeDataMigrationImpl.class );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cf32557a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetadataSerialization.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetadataSerialization.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetadataSerialization.java
index a843b3c..614b4bf 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetadataSerialization.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetadataSerialization.java
@@ -22,7 +22,7 @@ package org.apache.usergrid.persistence.graph.serialization;
import java.util.Iterator;
-import org.apache.usergrid.persistence.core.migration.data.newimpls.VersionedData;
+import org.apache.usergrid.persistence.core.migration.data.VersionedData;
import org.apache.usergrid.persistence.core.migration.schema.Migration;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
import org.apache.usergrid.persistence.graph.Edge;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cf32557a/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
index 262d665..a3d48de 100644
--- 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
@@ -31,8 +31,8 @@ import org.slf4j.LoggerFactory;
import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
import org.apache.usergrid.persistence.core.migration.data.MigrationInfoCache;
-import org.apache.usergrid.persistence.core.migration.data.newimpls.MigrationRelationship;
-import org.apache.usergrid.persistence.core.migration.data.newimpls.VersionedMigrationSet;
+import org.apache.usergrid.persistence.core.migration.data.MigrationRelationship;
+import org.apache.usergrid.persistence.core.migration.data.VersionedMigrationSet;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
import org.apache.usergrid.persistence.graph.Edge;
import org.apache.usergrid.persistence.graph.SearchEdgeType;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cf32557a/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 af157a6..2d9b47f 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
@@ -23,11 +23,11 @@ import com.google.inject.Inject;
import com.netflix.astyanax.Keyspace;
import com.netflix.astyanax.MutationBatch;
import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
-import org.apache.usergrid.persistence.core.migration.data.newimpls.DataMigration2;
-import org.apache.usergrid.persistence.core.migration.data.newimpls.MigrationDataProvider;
-import org.apache.usergrid.persistence.core.migration.data.newimpls.MigrationRelationship;
-import org.apache.usergrid.persistence.core.migration.data.newimpls.ProgressObserver;
-import org.apache.usergrid.persistence.core.migration.data.newimpls.VersionedMigrationSet;
+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.MigrationRelationship;
+import org.apache.usergrid.persistence.core.migration.data.ProgressObserver;
+import org.apache.usergrid.persistence.core.migration.data.VersionedMigrationSet;
import org.apache.usergrid.persistence.graph.Edge;
import org.apache.usergrid.persistence.graph.GraphManager;
import org.apache.usergrid.persistence.graph.GraphManagerFactory;
@@ -50,7 +50,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 DataMigration2<GraphNode> {
+public class EdgeDataMigrationImpl implements DataMigration<GraphNode> {
private static final Logger logger = LoggerFactory.getLogger(EdgeDataMigrationImpl.class);
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cf32557a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/migration/GraphMigration.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/migration/GraphMigration.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/migration/GraphMigration.java
new file mode 100644
index 0000000..245506a
--- /dev/null
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/migration/GraphMigration.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.usergrid.persistence.graph.serialization.impl.migration;/*
+ * 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 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;
+
+
+@BindingAnnotation
+@Target({ FIELD, PARAMETER, METHOD }) @Retention(RUNTIME)
+public @interface GraphMigration {}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cf32557a/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 c989822..8da102d 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
@@ -27,9 +27,9 @@ package org.apache.usergrid.persistence.graph.serialization.impl.migration;
import java.util.Set;
import org.apache.usergrid.persistence.core.migration.data.MigrationInfoSerialization;
-import org.apache.usergrid.persistence.core.migration.data.newimpls.AbstractMigrationPlugin;
-import org.apache.usergrid.persistence.core.migration.data.newimpls.DataMigration2;
-import org.apache.usergrid.persistence.core.migration.data.newimpls.MigrationDataProvider;
+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 com.google.inject.Inject;
import com.google.inject.Singleton;
@@ -46,7 +46,8 @@ public class GraphMigrationPlugin extends AbstractMigrationPlugin<GraphNode> {
@Inject
- public GraphMigrationPlugin( final Set<DataMigration2<GraphNode>> entityDataMigrations,
+ public GraphMigrationPlugin(@GraphMigration
+ final Set<DataMigration<GraphNode>> entityDataMigrations,
final MigrationDataProvider<GraphNode> entityIdScopeDataMigrationProvider,
final MigrationInfoSerialization migrationInfoSerialization ) {
super( entityDataMigrations, entityIdScopeDataMigrationProvider, migrationInfoSerialization );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cf32557a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/guice/TestGraphModule.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/guice/TestGraphModule.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/guice/TestGraphModule.java
index 3201a92..42411d3 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/guice/TestGraphModule.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/guice/TestGraphModule.java
@@ -21,9 +21,8 @@ package org.apache.usergrid.persistence.graph.guice;
import org.apache.usergrid.persistence.core.guice.CommonModule;
import org.apache.usergrid.persistence.core.guice.TestModule;
-import org.apache.usergrid.persistence.core.migration.data.newimpls.MigrationDataProvider;
-import org.apache.usergrid.persistence.core.migration.data.newimpls.TestMigrationDataProvider;
-import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.core.migration.data.MigrationDataProvider;
+import org.apache.usergrid.persistence.core.migration.data.TestMigrationDataProvider;
import org.apache.usergrid.persistence.graph.serialization.impl.migration.GraphNode;
import com.google.inject.TypeLiteral;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cf32557a/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 09259f1..a269c15 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
@@ -29,7 +29,7 @@ import org.junit.runner.RunWith;
import org.apache.usergrid.persistence.core.guice.DataMigrationResetRule;
import org.apache.usergrid.persistence.core.migration.data.DataMigrationManager;
import org.apache.usergrid.persistence.core.migration.data.TestProgressObserver;
-import org.apache.usergrid.persistence.core.migration.data.newimpls.MigrationDataProvider;
+import org.apache.usergrid.persistence.core.migration.data.MigrationDataProvider;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
import org.apache.usergrid.persistence.core.scope.ApplicationScopeImpl;
import org.apache.usergrid.persistence.core.test.ITRunner;
@@ -142,7 +142,7 @@ public class EdgeDataMigrationImplTest implements DataMigrationResetRule.DataMig
//perform the migration
assertEquals( "Correct version returned", returned, GraphDataVersions.META_SHARDING.getVersion() );
- assertFalse( "Progress observer should not have failed", progressObserver.getFailed() );
+ assertFalse( "Progress observer should not have failed", progressObserver.isFailed() );
assertTrue( "Progress observer should have update messages", progressObserver.getUpdates().size() > 0 );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cf32557a/stack/rest/src/main/java/org/apache/usergrid/rest/MigrateResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/MigrateResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/MigrateResource.java
index 84b1085..9ab5dc3 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/MigrateResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/MigrateResource.java
@@ -77,13 +77,13 @@ public class MigrateResource extends AbstractContextResource {
@Override
public void run() {
- logger.info( "Rebuilding all indexes" );
+ logger.info( "Migrating Data " );
try {
emf.migrateData();
}
catch ( Exception e ) {
- logger.error( "Unable to rebuild indexes", e );
+ logger.error( "Unable to migrate data", e );
}
}
};