You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2014/12/09 17:38:59 UTC
[03/15] incubator-usergrid git commit: Minor formatting changes only.
Minor formatting changes only.
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/e71a68fb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/e71a68fb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/e71a68fb
Branch: refs/heads/delete_from_all_indexes
Commit: e71a68fbfa4c267930837551fce19196df822289
Parents: 2677444
Author: Dave Johnson <dm...@apigee.com>
Authored: Fri Dec 5 16:46:21 2014 -0500
Committer: Dave Johnson <dm...@apigee.com>
Committed: Fri Dec 5 16:46:21 2014 -0500
----------------------------------------------------------------------
.../migration/EntityDataMigrationIT.java | 137 ++++++++++---------
.../usergrid/persistence/PathQueryIT.java | 9 +-
2 files changed, 76 insertions(+), 70 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e71a68fb/stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/EntityDataMigrationIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/EntityDataMigrationIT.java b/stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/EntityDataMigrationIT.java
index d5f2fe1..b9b7d24 100644
--- a/stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/EntityDataMigrationIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/EntityDataMigrationIT.java
@@ -79,7 +79,8 @@ public class EntityDataMigrationIT extends AbstractCoreIT {
* Rule to do the resets we need
*/
@Rule
- public MigrationTestRule migrationTestRule = new MigrationTestRule( app, CpSetup.getInjector() ,EntityDataMigration.class );
+ public MigrationTestRule migrationTestRule =
+ new MigrationTestRule( app, CpSetup.getInjector() ,EntityDataMigration.class );
@Before
public void setup() {
@@ -129,36 +130,36 @@ public class EntityDataMigrationIT extends AbstractCoreIT {
//using a test system, and it's not a huge amount of data, otherwise we'll overflow.
AllEntitiesInSystemObservable.getAllEntitiesInSystem( managerCache, 1000 )
- .doOnNext( new Action1<AllEntitiesInSystemObservable.ApplicationEntityGroup>() {
- @Override
- public void call(
- final AllEntitiesInSystemObservable.ApplicationEntityGroup entity ) {
+ .doOnNext( new Action1<AllEntitiesInSystemObservable.ApplicationEntityGroup>() {
+ @Override
+ public void call(
+ final AllEntitiesInSystemObservable.ApplicationEntityGroup entity ) {
- //add all versions from history to our comparison
- for ( final Id id : entity.entityIds ) {
+ //add all versions from history to our comparison
+ for ( final Id id : entity.entityIds ) {
- CollectionScope scope = CpNamingUtils
- .getCollectionScopeNameFromEntityType(
- entity.applicationScope.getApplication(),
- id.getType() );
+ CollectionScope scope = CpNamingUtils
+ .getCollectionScopeNameFromEntityType(
+ entity.applicationScope.getApplication(),
+ id.getType() );
- final Iterator<MvccEntity> versions = v1Strategy
- .loadDescendingHistory( scope, id, UUIDGenerator.newTimeUUID(),
- 100 );
+ final Iterator<MvccEntity> versions = v1Strategy
+ .loadDescendingHistory( scope, id, UUIDGenerator.newTimeUUID(),
+ 100 );
- while ( versions.hasNext() ) {
+ while ( versions.hasNext() ) {
- final MvccEntity mvccEntity = versions.next();
+ final MvccEntity mvccEntity = versions.next();
- savedEntities.add( mvccEntity );
+ savedEntities.add( mvccEntity );
- createdEntityIds.remove( mvccEntity.getId() );
+ createdEntityIds.remove( mvccEntity.getId() );
- entityIds.add( id );
- }
- }
- }
- } ).toBlocking().lastOrDefault( null );
+ entityIds.add( id );
+ }
+ }
+ }
+ } ).toBlocking().lastOrDefault( null );
assertEquals( "Newly saved entities encountered", 0, createdEntityIds.size() );
assertTrue( "Saved new entities", savedEntities.size() > 0 );
@@ -181,70 +182,72 @@ public class EntityDataMigrationIT extends AbstractCoreIT {
//now visit all entities in the system again, load them from v2, and ensure they're the same
AllEntitiesInSystemObservable.getAllEntitiesInSystem( managerCache, 1000 )
- .doOnNext( new Action1<AllEntitiesInSystemObservable.ApplicationEntityGroup>() {
- @Override
- public void call(
- final AllEntitiesInSystemObservable
- .ApplicationEntityGroup entity ) {
- //add all versions from history to our comparison
- for ( final Id id : entity.entityIds ) {
+ .doOnNext( new Action1<AllEntitiesInSystemObservable.ApplicationEntityGroup>() {
+ @Override
+ public void call(
+ final AllEntitiesInSystemObservable
+ .ApplicationEntityGroup entity ) {
+ //add all versions from history to our comparison
+ for ( final Id id : entity.entityIds ) {
- CollectionScope scope = CpNamingUtils
- .getCollectionScopeNameFromEntityType(
- entity.applicationScope.getApplication(),
- id.getType() );
+ CollectionScope scope = CpNamingUtils
+ .getCollectionScopeNameFromEntityType(
+ entity.applicationScope.getApplication(),
+ id.getType() );
- final Iterator<MvccEntity> versions = v2Strategy
- .loadDescendingHistory( scope, id,
- UUIDGenerator.newTimeUUID(), 100 );
+ final Iterator<MvccEntity> versions = v2Strategy
+ .loadDescendingHistory( scope, id,
+ UUIDGenerator.newTimeUUID(), 100 );
- while ( versions.hasNext() ) {
+ while ( versions.hasNext() ) {
- final MvccEntity mvccEntity = versions.next();
+ final MvccEntity mvccEntity = versions.next();
- savedEntities.remove( mvccEntity );
- }
- }
- }
- }
+ savedEntities.remove( mvccEntity );
+ }
+ }
+ }
+ }
- ).toBlocking().lastOrDefault( null );
+ ).toBlocking().lastOrDefault( null );
assertEquals( "All entities migrated", 0, savedEntities.size() );
- //now visit all entities in the system again, and load them from the EM, ensure we see everything we did in the v1 traversal
+ //now visit all entities in the system again, and load them from the EM,
+ // ensure we see everything we did in the v1 traversal
AllEntitiesInSystemObservable.getAllEntitiesInSystem( managerCache, 1000 )
- .doOnNext( new Action1<AllEntitiesInSystemObservable.ApplicationEntityGroup>() {
- @Override
- public void call(
- final AllEntitiesInSystemObservable
- .ApplicationEntityGroup entity ) {
+ .doOnNext( new Action1<AllEntitiesInSystemObservable.ApplicationEntityGroup>() {
+ @Override
+ public void call(
+ final AllEntitiesInSystemObservable
+ .ApplicationEntityGroup entity ) {
- final EntityManager em = emf.getEntityManager( entity.applicationScope.getApplication().getUuid() );
+ final EntityManager em = emf.getEntityManager(
+ entity.applicationScope.getApplication().getUuid() );
- //add all versions from history to our comparison
- for ( final Id id : entity.entityIds ) {
+ //add all versions from history to our comparison
+ for ( final Id id : entity.entityIds ) {
- try {
- final Entity emEntity = em.get( SimpleEntityRef.fromId( id ) );
+ try {
+ final Entity emEntity = em.get( SimpleEntityRef.fromId( id ) );
- if(emEntity != null){
- entityIds.remove( id );
- }
- }
- catch ( Exception e ) {
- throw new RuntimeException("Error loading entity", e);
- }
- }
- }
- }
+ if(emEntity != null){
+ entityIds.remove( id );
+ }
+ }
+ catch ( Exception e ) {
+ throw new RuntimeException("Error loading entity", e);
+ }
+ }
+ }
+ }
- ).toBlocking().lastOrDefault( null );
+ ).toBlocking().lastOrDefault( null );
assertEquals("All entities could be loaded by the entity manager", 0, entityIds.size());
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e71a68fb/stack/core/src/test/java/org/apache/usergrid/persistence/PathQueryIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/PathQueryIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/PathQueryIT.java
index e5256f3..61ac16f 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/PathQueryIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/PathQueryIT.java
@@ -38,7 +38,8 @@ public class PathQueryIT extends AbstractCoreIT {
@Test
public void testUserDevicePathQuery() throws Exception {
- UUID applicationId = setup.createApplication( "testOrganization", "testUserDevicePathQuery" + RandomStringUtils.randomAlphabetic(20) );
+ UUID applicationId = setup.createApplication(
+ "testOrganization", "testUserDevicePathQuery" + RandomStringUtils.randomAlphabetic(20) );
EntityManager em = setup.getEmf().getEntityManager( applicationId );
List<Entity> users = new ArrayList<Entity>();
@@ -93,7 +94,8 @@ public class PathQueryIT extends AbstractCoreIT {
deviceQuery.addFilter( "index >= 2" );
int expectedDeviceQuerySize = 3;
- PathQuery<EntityRef> usersPQ = new PathQuery<EntityRef>( new SimpleEntityRef( em.getApplicationRef()), userQuery );
+ PathQuery<EntityRef> usersPQ = new PathQuery<EntityRef>(
+ new SimpleEntityRef( em.getApplicationRef()), userQuery );
PathQuery<Entity> devicesPQ = usersPQ.chain( deviceQuery );
HashSet set = new HashSet( expectedUserQuerySize * expectedDeviceQuerySize );
Iterator<Entity> i = devicesPQ.iterator( em );
@@ -107,7 +109,8 @@ public class PathQueryIT extends AbstractCoreIT {
@Test
public void testGroupUserDevicePathQuery() throws Exception {
- UUID applicationId = setup.createApplication( "testOrganization", "testGroupUserDevicePathQuery" + RandomStringUtils.randomAlphabetic(20) );
+ UUID applicationId = setup.createApplication(
+ "testOrganization", "testGroupUserDevicePathQuery" + RandomStringUtils.randomAlphabetic(20) );
EntityManager em = setup.getEmf().getEntityManager( applicationId );
List<Entity> groups = new ArrayList<Entity>();