You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by mr...@apache.org on 2016/02/27 01:33:10 UTC
[1/5] usergrid git commit: Exceptions changed in later Jersey version.
Repository: usergrid
Updated Branches:
refs/heads/master 82dcfbaaa -> 3cfaff4ef
Exceptions changed in later Jersey version.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/2d111025
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/2d111025
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/2d111025
Branch: refs/heads/master
Commit: 2d1110250fd4f1d0180b10d3ed45285702094eef
Parents: ee356ec
Author: Michael Russo <mr...@apigee.com>
Authored: Thu Feb 25 12:33:19 2016 -0800
Committer: Michael Russo <mr...@apigee.com>
Committed: Thu Feb 25 12:34:07 2016 -0800
----------------------------------------------------------------------
.../java/org/apache/usergrid/rest/management/AdminUsersIT.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid/blob/2d111025/stack/rest/src/test/java/org/apache/usergrid/rest/management/AdminUsersIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/AdminUsersIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/AdminUsersIT.java
index e294556..07132cb 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/AdminUsersIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/AdminUsersIT.java
@@ -35,6 +35,7 @@ import javax.mail.internet.MimeMultipart;
import javax.ws.rs.BadRequestException;
import javax.ws.rs.ClientErrorException;
import javax.ws.rs.InternalServerErrorException;
+import javax.ws.rs.NotAuthorizedException;
import javax.ws.rs.core.Form;
import javax.ws.rs.core.Response;
import java.io.IOException;
@@ -356,7 +357,7 @@ public class AdminUsersIT extends AbstractRestIT {
try{
management().users().user( newOrg.getUsername() ).put( userProperty );
- } catch( UniformInterfaceException e ){
+ } catch( NotAuthorizedException e ){
int status = e.getResponse().getStatus();
assertEquals(401, status);
@@ -435,7 +436,7 @@ public class AdminUsersIT extends AbstractRestIT {
Entity userProperty = new Entity( ).chainPut( "company","usergrid" );
management().users().user( newOrg.getUsername() ).put( userProperty );
- } catch( UniformInterfaceException e ){
+ } catch( NotAuthorizedException e ){
int status = e.getResponse().getStatus();
assertEquals(401, status);
[2/5] usergrid git commit: Ensure that bootstrap is not resetting
versions and let each migration module be handled separately and versions set
backwards manually.
Posted by mr...@apache.org.
Ensure that bootstrap is not resetting versions and let each migration module be handled separately and versions set backwards manually.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/f69e4f6f
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/f69e4f6f
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/f69e4f6f
Branch: refs/heads/master
Commit: f69e4f6ff16527b9fea4f03f934417d0a6b6a3a7
Parents: 2d11102
Author: Michael Russo <mr...@apigee.com>
Authored: Fri Feb 26 09:29:01 2016 -0800
Committer: Michael Russo <mr...@apigee.com>
Committed: Fri Feb 26 09:29:01 2016 -0800
----------------------------------------------------------------------
.../usergrid/corepersistence/CoreModule.java | 2 -
.../corepersistence/CpEntityManager.java | 11 -
.../migration/MigrationModuleVersionPlugin.java | 137 ----------
.../MigrationModuleVersionPluginTest.java | 259 -------------------
.../applications/ApplicationResource.java | 8 -
5 files changed, 417 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid/blob/f69e4f6f/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 e2d845f..5ac7faf 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
@@ -40,7 +40,6 @@ import org.apache.usergrid.corepersistence.index.ReIndexServiceImpl;
import org.apache.usergrid.corepersistence.migration.CoreMigration;
import org.apache.usergrid.corepersistence.migration.CoreMigrationPlugin;
import org.apache.usergrid.corepersistence.migration.DeDupConnectionDataMigration;
-import org.apache.usergrid.corepersistence.migration.MigrationModuleVersionPlugin;
import org.apache.usergrid.corepersistence.pipeline.PipelineModule;
import org.apache.usergrid.corepersistence.rx.impl.AllApplicationsObservable;
import org.apache.usergrid.corepersistence.rx.impl.AllApplicationsObservableImpl;
@@ -144,7 +143,6 @@ public class CoreModule extends AbstractModule {
//wire up the collection migration plugin
final Multibinder<MigrationPlugin> plugins = Multibinder.newSetBinder( binder(), MigrationPlugin.class );
plugins.addBinding().to( CoreMigrationPlugin.class );
- plugins.addBinding().to( MigrationModuleVersionPlugin.class );
bind( AllApplicationsObservable.class ).to( AllApplicationsObservableImpl.class );
bind( AllEntityIdsObservable.class ).to( AllEntityIdsObservableImpl.class );
http://git-wip-us.apache.org/repos/asf/usergrid/blob/f69e4f6f/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
index 2cf8da6..3dbdb7d 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
@@ -747,17 +747,6 @@ public class CpEntityManager implements EntityManager {
Set<String> existingCollections = getRelationManager( getApplication() ).getCollections();
- //Handles reading custom collections.
-// Set<String> dynamic_collections = cast( getDictionaryAsSet( getApplicationRef(), Schema.DICTIONARY_COLLECTIONS ) );
-// if ( dynamic_collections != null ) {
-// for ( String collection : dynamic_collections ) {
-// if ( !Schema.isAssociatedEntityType( collection ) ) {
-// if(!existingCollections.contains( collection )) {
-// existingCollections.add( collection );
-// }
-// }
-// }
-// }
Set<String> system_collections = Schema.getDefaultSchema().getCollectionNames( Application.ENTITY_TYPE );
if ( system_collections != null ) {
for ( String collection : system_collections ) {
http://git-wip-us.apache.org/repos/asf/usergrid/blob/f69e4f6f/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
deleted file mode 100644
index 145e76f..0000000
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/MigrationModuleVersionPlugin.java
+++ /dev/null
@@ -1,137 +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.corepersistence.migration;
-
-
-import org.apache.usergrid.persistence.collection.serialization.impl.MvccEntitySerializationStrategyV2Impl;
-import org.apache.usergrid.persistence.collection.serialization.impl.migration.CollectionMigrationPlugin;
-import org.apache.usergrid.persistence.core.migration.data.MigrationInfoSerialization;
-import org.apache.usergrid.persistence.core.migration.data.MigrationPlugin;
-import org.apache.usergrid.persistence.core.migration.data.PluginPhase;
-import org.apache.usergrid.persistence.core.migration.data.ProgressObserver;
-import org.apache.usergrid.persistence.graph.serialization.impl.EdgeMetadataSerializationV2Impl;
-import org.apache.usergrid.persistence.graph.serialization.impl.migration.GraphMigrationPlugin;
-
-import com.google.inject.Inject;
-
-
-/**
- * Migration to set our module versions now that we've refactor for sub modules Keeps the EntityIdScope because it won't
- * subscribe to the data provider.
- */
-public class MigrationModuleVersionPlugin implements MigrationPlugin{
-
- public static final String NAME = "migration-system";
-
- private static final int INITIAL = 0;
- /**
- * The migration from 0 -> 1 that re-writes all the entity id's into the map module
- */
- private static final int ID_MIGRATION = 1;
-
- /**
- * The migration from 1-> 2 that shards our edge meta data
- */
- private static final int EDGE_SHARD_MIGRATION = 2;
-
- /**
- * The migration from 2-> 3 that fixed the short truncation bug
- */
- private static final int ENTITY_V2_MIGRATION = 3;
-
-
- /**
- * Get versions directly from impls so we know they're accurate
- */
- private final MigrationInfoSerialization migrationInfoSerialization;
-
- private final MvccEntitySerializationStrategyV2Impl serializationStrategyV2;
-
- private final EdgeMetadataSerializationV2Impl edgeMetadataSerializationV2;
-
-
- @Inject
- public MigrationModuleVersionPlugin( final MigrationInfoSerialization migrationInfoSerialization,
- final MvccEntitySerializationStrategyV2Impl serializationStrategyV2,
- final EdgeMetadataSerializationV2Impl edgeMetadataSerializationV2 ) {
- this.migrationInfoSerialization = migrationInfoSerialization;
- this.serializationStrategyV2 = serializationStrategyV2;
- this.edgeMetadataSerializationV2 = edgeMetadataSerializationV2;
- }
-
- @Override
- public void run( final ProgressObserver observer ) {
-
-
- observer.start();
-
- //we ignore our current version, since it will always be 0
- final int legacyVersion = migrationInfoSerialization.getSystemVersion();
-
-
-
- //now we store versions for each of our modules
-
- switch ( legacyVersion ) {
-
- //we need to set the version of the entity data, and our edge shard migration. The fall through (no break) is deliberate
- //if it's entity v2, set all, it's current
- case ENTITY_V2_MIGRATION:
- migrationInfoSerialization.setVersion(
- CollectionMigrationPlugin.PLUGIN_NAME, serializationStrategyV2.getImplementationVersion() );
-
- //if it's edge shard, we need to run the v2 migration
- case EDGE_SHARD_MIGRATION:
- //set our shard migration to the migrated version
- migrationInfoSerialization.setVersion(
- GraphMigrationPlugin.PLUGIN_NAME, edgeMetadataSerializationV2.getImplementationVersion() );
-
- case ID_MIGRATION:
- migrationInfoSerialization.setVersion(
- CoreMigrationPlugin.PLUGIN_NAME, CoreDataVersions.ID_MAP_FIX.getVersion() );
- }
-
- //save the version
- migrationInfoSerialization.setVersion( NAME, getMaxVersion() );
-
- observer.complete();
- }
-
-
-
- @Override
- public String getName() {
- return NAME;
- }
-
-
-
-
- @Override
- public int getMaxVersion() {
- return MigrationSystemVersions.LEGACY_ID_MAPPED.getVersion();
- }
-
-
- @Override
- public PluginPhase getPhase() {
- return PluginPhase.BOOTSTRAP;
- }
-}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/f69e4f6f/stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/MigrationModuleVersionPluginTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/MigrationModuleVersionPluginTest.java b/stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/MigrationModuleVersionPluginTest.java
deleted file mode 100644
index 339e6cf..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/MigrationModuleVersionPluginTest.java
+++ /dev/null
@@ -1,259 +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.corepersistence.migration;
-
-
-import org.junit.Test;
-
-import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
-import org.apache.usergrid.persistence.collection.serialization.impl.MvccEntitySerializationStrategyV2Impl;
-import org.apache.usergrid.persistence.collection.serialization.impl.migration.CollectionMigrationPlugin;
-import org.apache.usergrid.persistence.core.migration.data.MigrationInfoSerialization;
-import org.apache.usergrid.persistence.core.migration.data.TestProgressObserver;
-import org.apache.usergrid.persistence.graph.serialization.EdgeMetadataSerialization;
-import org.apache.usergrid.persistence.graph.serialization.impl.EdgeMetadataSerializationV2Impl;
-import org.apache.usergrid.persistence.graph.serialization.impl.migration.GraphMigrationPlugin;
-
-import com.google.inject.Inject;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-
-/**
- * Tests the system sets itself up as wxpected
- */
-public class MigrationModuleVersionPluginTest {
-
-
- @Test
- public void testNewSystem(){
-
- //mock up an initial system state
- final int systemState = 3;
-
- final MigrationInfoSerialization migrationInfoSerialization = mock(MigrationInfoSerialization.class);
-
- when(migrationInfoSerialization.getSystemVersion()).thenReturn( systemState );
-
-
-
-
- final int mvccVersion = 2;
-
- final MvccEntitySerializationStrategyV2Impl serializationStrategyV2 = mock(MvccEntitySerializationStrategyV2Impl.class);
- when(serializationStrategyV2.getImplementationVersion()).thenReturn( mvccVersion );
-
-
- final int edgeMetaVersion = 1;
-
- final EdgeMetadataSerializationV2Impl edgeMetadataSerializationV2 = mock(EdgeMetadataSerializationV2Impl.class);
- when(edgeMetadataSerializationV2.getImplementationVersion()).thenReturn(edgeMetaVersion);
-
-
- final MigrationModuleVersionPlugin plugin = new MigrationModuleVersionPlugin(migrationInfoSerialization, serializationStrategyV2, edgeMetadataSerializationV2 );
-
- final TestProgressObserver testProgressObserver = new TestProgressObserver();
-
- plugin.run( testProgressObserver );
-
-
-
- //first version that should be set
- verify(migrationInfoSerialization).setVersion( CoreMigrationPlugin.PLUGIN_NAME, CoreDataVersions.ID_MAP_FIX.getVersion() );
-
- //second version that should be set
-
- verify(migrationInfoSerialization).setVersion( GraphMigrationPlugin.PLUGIN_NAME, edgeMetaVersion );
-
- //last version that should be set
- verify(migrationInfoSerialization).setVersion( CollectionMigrationPlugin.PLUGIN_NAME, mvccVersion );
-
-
- //set this plugin as run
- verify(migrationInfoSerialization).setVersion( MigrationModuleVersionPlugin.NAME, MigrationSystemVersions.LEGACY_ID_MAPPED.getVersion() );
-
-
-
- }
-
-
-
- @Test
- public void testIdMapping(){
-
- //mock up an initial system state
- final int systemState = 1;
-
- final MigrationInfoSerialization migrationInfoSerialization = mock(MigrationInfoSerialization.class);
-
- when(migrationInfoSerialization.getSystemVersion()).thenReturn( systemState );
-
-
-
-
- final int mvccVersion = 2;
-
- final MvccEntitySerializationStrategyV2Impl serializationStrategyV2 = mock(MvccEntitySerializationStrategyV2Impl.class);
- when(serializationStrategyV2.getImplementationVersion()).thenReturn( mvccVersion );
-
-
- final int edgeMetaVersion = 1;
-
- final EdgeMetadataSerializationV2Impl edgeMetadataSerializationV2 = mock(EdgeMetadataSerializationV2Impl.class);
- when(edgeMetadataSerializationV2.getImplementationVersion()).thenReturn(edgeMetaVersion);
-
-
- final MigrationModuleVersionPlugin plugin = new MigrationModuleVersionPlugin(migrationInfoSerialization, serializationStrategyV2, edgeMetadataSerializationV2 );
-
- final TestProgressObserver testProgressObserver = new TestProgressObserver();
-
- plugin.run( testProgressObserver );
-
-
- //first version that should be set
- verify(migrationInfoSerialization).setVersion( CoreMigrationPlugin.PLUGIN_NAME, CoreDataVersions.ID_MAP_FIX.getVersion() );
-
- //second version that should be set
-
- verify(migrationInfoSerialization, never()).setVersion( GraphMigrationPlugin.PLUGIN_NAME, edgeMetaVersion );
-
- //last version that should be set
- verify(migrationInfoSerialization, never()).setVersion( CollectionMigrationPlugin.PLUGIN_NAME, mvccVersion );
-
-
- //set this plugin as run
- verify(migrationInfoSerialization).setVersion( MigrationModuleVersionPlugin.NAME, MigrationSystemVersions.LEGACY_ID_MAPPED.getVersion() );
-
-
-
-
- }
-
-
- @Test
- public void testEdgeMigration(){
-
- //mock up an initial system state
- final int systemState = 2;
-
- final MigrationInfoSerialization migrationInfoSerialization = mock(MigrationInfoSerialization.class);
-
- when(migrationInfoSerialization.getSystemVersion()).thenReturn( systemState );
-
-
-
-
- final int mvccVersion = 2;
-
- final MvccEntitySerializationStrategyV2Impl serializationStrategyV2 = mock(MvccEntitySerializationStrategyV2Impl.class);
- when(serializationStrategyV2.getImplementationVersion()).thenReturn( mvccVersion );
-
-
- final int edgeMetaVersion = 1;
-
- final EdgeMetadataSerializationV2Impl edgeMetadataSerializationV2 = mock(EdgeMetadataSerializationV2Impl.class);
- when(edgeMetadataSerializationV2.getImplementationVersion()).thenReturn(edgeMetaVersion);
-
-
- final MigrationModuleVersionPlugin plugin = new MigrationModuleVersionPlugin(migrationInfoSerialization, serializationStrategyV2, edgeMetadataSerializationV2 );
-
- final TestProgressObserver testProgressObserver = new TestProgressObserver();
-
- plugin.run( testProgressObserver );
-
-
- //first version that should be set
- verify(migrationInfoSerialization).setVersion( CoreMigrationPlugin.PLUGIN_NAME, CoreDataVersions.ID_MAP_FIX.getVersion() );
-
- //second version that should be set
-
- verify(migrationInfoSerialization).setVersion( GraphMigrationPlugin.PLUGIN_NAME, edgeMetaVersion );
-
- //last version that should be set
- verify(migrationInfoSerialization, never()).setVersion( CollectionMigrationPlugin.PLUGIN_NAME, mvccVersion );
-
-
- //set this plugin as run
- verify(migrationInfoSerialization).setVersion( MigrationModuleVersionPlugin.NAME, MigrationSystemVersions.LEGACY_ID_MAPPED.getVersion() );
-
-
-
-
- }
-
-
-
-
- @Test
- public void testEntityV2Migration(){
-
- //mock up an initial system state
- final int systemState = 3;
-
- final MigrationInfoSerialization migrationInfoSerialization = mock(MigrationInfoSerialization.class);
-
- when(migrationInfoSerialization.getSystemVersion()).thenReturn( systemState );
-
-
-
-
- final int mvccVersion = 2;
-
- final MvccEntitySerializationStrategyV2Impl serializationStrategyV2 = mock(MvccEntitySerializationStrategyV2Impl.class);
- when(serializationStrategyV2.getImplementationVersion()).thenReturn( mvccVersion );
-
-
- final int edgeMetaVersion = 1;
-
- final EdgeMetadataSerializationV2Impl edgeMetadataSerializationV2 = mock(EdgeMetadataSerializationV2Impl.class);
- when(edgeMetadataSerializationV2.getImplementationVersion()).thenReturn(edgeMetaVersion);
-
-
- final MigrationModuleVersionPlugin plugin = new MigrationModuleVersionPlugin(migrationInfoSerialization, serializationStrategyV2, edgeMetadataSerializationV2 );
-
- final TestProgressObserver testProgressObserver = new TestProgressObserver();
-
- plugin.run( testProgressObserver );
-
-
- //first version that should be set
- verify(migrationInfoSerialization).setVersion( CoreMigrationPlugin.PLUGIN_NAME, CoreDataVersions.ID_MAP_FIX.getVersion() );
-
- //second version that should be set
-
- verify(migrationInfoSerialization).setVersion( GraphMigrationPlugin.PLUGIN_NAME, edgeMetaVersion );
-
- //last version that should be set
- verify(migrationInfoSerialization).setVersion( CollectionMigrationPlugin.PLUGIN_NAME, mvccVersion );
-
-
- //set this plugin as run
- verify(migrationInfoSerialization).setVersion( MigrationModuleVersionPlugin.NAME, MigrationSystemVersions.LEGACY_ID_MAPPED.getVersion() );
-
-
-
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/f69e4f6f/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java
index 61a7e0a..c353959 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java
@@ -496,14 +496,6 @@ public class ApplicationResource extends AbstractContextResource {
"Cannot delete application without supplying correct application name");
}
-// Properties props = management.getProperties();
-//
-// //for now, only works in test mode
-// String testProp = ( String ) props.get( "usergrid.test" );
-// if ( testProp == null || !Boolean.parseBoolean( testProp ) ) {
-// throw new UnsupportedRestOperationException("Test props not not functioning correctly.");
-// }
-
if ( applicationId == null ) {
throw new IllegalArgumentException("Application ID not specified in request");
}
[5/5] usergrid git commit: Merge branch 'release-2.1.1'
Posted by mr...@apache.org.
Merge branch 'release-2.1.1'
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/3cfaff4e
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/3cfaff4e
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/3cfaff4e
Branch: refs/heads/master
Commit: 3cfaff4ef007faa79a52128b3dab7d7f5f957f12
Parents: 82dcfba 9c89446
Author: Michael Russo <mr...@apigee.com>
Authored: Fri Feb 26 16:32:59 2016 -0800
Committer: Michael Russo <mr...@apigee.com>
Committed: Fri Feb 26 16:32:59 2016 -0800
----------------------------------------------------------------------
.../usergrid/corepersistence/CoreModule.java | 2 -
.../corepersistence/CpEntityManager.java | 11 -
.../migration/MigrationModuleVersionPlugin.java | 137 ----------
.../MigrationModuleVersionPluginTest.java | 259 -------------------
.../applications/ApplicationResource.java | 8 -
.../services/notifications/TaskManager.java | 8 +-
.../impl/ApplicationQueueManagerImpl.java | 2 +-
.../test/notifications/notifications.js | 72 +++++-
.../test/queries/integerComparison.js | 31 ++-
tests/integration/test/setup.js | 4 +-
10 files changed, 86 insertions(+), 448 deletions(-)
----------------------------------------------------------------------
[3/5] usergrid git commit: Add some delay in node.js tests and fix
some NPEs around notifications.
Posted by mr...@apache.org.
Add some delay in node.js tests and fix some NPEs around notifications.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/0eda1b68
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/0eda1b68
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/0eda1b68
Branch: refs/heads/master
Commit: 0eda1b68315474f609421a3ad124b3423787754f
Parents: f69e4f6
Author: Michael Russo <mr...@apigee.com>
Authored: Fri Feb 26 16:31:32 2016 -0800
Committer: Michael Russo <mr...@apigee.com>
Committed: Fri Feb 26 16:31:32 2016 -0800
----------------------------------------------------------------------
.../apache/usergrid/services/notifications/TaskManager.java | 8 +++++++-
.../notifications/impl/ApplicationQueueManagerImpl.java | 2 +-
2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid/blob/0eda1b68/stack/services/src/main/java/org/apache/usergrid/services/notifications/TaskManager.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/notifications/TaskManager.java b/stack/services/src/main/java/org/apache/usergrid/services/notifications/TaskManager.java
index 950447a..3e78210 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/notifications/TaskManager.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/notifications/TaskManager.java
@@ -124,7 +124,13 @@ public class TaskManager {
* passed one w/ the UUID
*/
private void saveReceipt(EntityRef notification, EntityRef device, Receipt receipt, boolean hasError) throws Exception {
- if (this.notification.getDebug() || hasError) {
+
+ boolean debug = false;
+ if(this.notification != null){
+ debug = this.notification.getDebug();
+ }
+
+ if ( debug || hasError) {
if (receipt.getUuid() == null) {
Receipt savedReceipt = em.create(receipt);
receipt.setUuid(savedReceipt.getUuid());
http://git-wip-us.apache.org/repos/asf/usergrid/blob/0eda1b68/stack/services/src/main/java/org/apache/usergrid/services/notifications/impl/ApplicationQueueManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/notifications/impl/ApplicationQueueManagerImpl.java b/stack/services/src/main/java/org/apache/usergrid/services/notifications/impl/ApplicationQueueManagerImpl.java
index d0f8ca8..12a47b6 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/notifications/impl/ApplicationQueueManagerImpl.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/notifications/impl/ApplicationQueueManagerImpl.java
@@ -270,7 +270,7 @@ public class ApplicationQueueManagerImpl implements ApplicationQueueManager {
Notification notification = notificationMap.get(message.getNotificationId());
if (notification == null) {
notification = em.get(message.getNotificationId(), Notification.class);
- notificationMap.put(message.getNotificationId(), notification);
+ notificationMap.putIfAbsent(message.getNotificationId(), notification);
}
TaskManager taskManager = taskMap.get(message.getNotificationId());
if (taskManager == null) {
[4/5] usergrid git commit: Add some delay to node.js tests.
Posted by mr...@apache.org.
Add some delay to node.js tests.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/9c894465
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/9c894465
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/9c894465
Branch: refs/heads/master
Commit: 9c8944657b1168b9f0929050c294ff807bfbea88
Parents: 0eda1b6
Author: Michael Russo <mr...@apigee.com>
Authored: Fri Feb 26 16:32:31 2016 -0800
Committer: Michael Russo <mr...@apigee.com>
Committed: Fri Feb 26 16:32:31 2016 -0800
----------------------------------------------------------------------
.../test/notifications/notifications.js | 72 ++++++++++++++++----
.../test/queries/integerComparison.js | 31 +++++----
tests/integration/test/setup.js | 4 +-
3 files changed, 78 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid/blob/9c894465/tests/integration/test/notifications/notifications.js
----------------------------------------------------------------------
diff --git a/tests/integration/test/notifications/notifications.js b/tests/integration/test/notifications/notifications.js
index 07e7642..644510f 100644
--- a/tests/integration/test/notifications/notifications.js
+++ b/tests/integration/test/notifications/notifications.js
@@ -72,7 +72,9 @@ module.exports = {
payloads: {
gcm: "Usergrid Integration Push Test - GCM"
- }
+ },
+ debug: true,
+ priority: 'high'
};
@@ -97,8 +99,9 @@ module.exports = {
describe("users", function () {
it("should create some users", function (done) {
- this.slow(2000);
- async.each(usersArray, function (user, cb) {
+ this.slow(5000);
+
+ async.eachSeries(usersArray, function (user, cb) {
users.add(user, function (err, user) {
should(err).be.null;
user.should.not.be.null;
@@ -106,7 +109,13 @@ module.exports = {
});
}, function (err) {
- done();
+ setTimeout(function() {
+
+ // wait a second before proceeding
+ done();
+
+ }, 1000);
+
});
@@ -117,7 +126,7 @@ module.exports = {
describe("devices", function () {
it("should create some devices", function (done) {
- this.slow(2000);
+ this.slow(5000);
async.each(devicesArray, function (device, cb) {
devices.add(device, function (err, device) {
should(err).be.null;
@@ -127,7 +136,12 @@ module.exports = {
}, function (err) {
- done()
+ setTimeout(function() {
+
+ // wait a second before proceeding
+ done();
+
+ }, 1000);
});
@@ -149,7 +163,12 @@ module.exports = {
if (err) {
console.log("error adding users " + err);
}
- done();
+ setTimeout(function() {
+
+ // wait a second before proceeding
+ done();
+
+ }, 1000);
});
})
@@ -159,7 +178,7 @@ module.exports = {
describe("groups", function () {
it("should create some groups", function (done) {
- this.slow(2000);
+ this.slow(5000);
var group1 = {
path: "notificationgroup1"
};
@@ -191,7 +210,12 @@ module.exports = {
}
], function (err, results) {
- done();
+ setTimeout(function() {
+
+ // wait a second before proceeding
+ done();
+
+ }, 1000);
});
@@ -203,7 +227,7 @@ module.exports = {
describe("groups<->users", function () {
it("should connect users to groups", function (done) {
- this.slow(2000);
+ this.slow(5000);
async.each(usersArray, function (user, cb) {
async.series([
@@ -229,7 +253,12 @@ module.exports = {
});
}, function (err) {
- done();
+ setTimeout(function() {
+
+ // wait a second before proceeding
+ done();
+
+ }, 1000);
});
})
@@ -245,12 +274,17 @@ module.exports = {
this.slow(5000);
setTimeout(function () {
- notifications.send("users/" + usersArray[1].username, gcmNotification,
+ notifications.send("users/" + usersArray[0].username, gcmNotification,
function (err, notification) {
should(err).be.null;
notification.should.not.be.null;
notification.expectedCount.should.be.equal(1);
- done();
+ setTimeout(function() {
+
+ // wait a second before proceeding
+ done();
+
+ }, 1000);
});
@@ -273,7 +307,12 @@ module.exports = {
should(err).be.null;
notification.should.not.be.null;
notification.expectedCount.should.be.equal(1);
- done();
+ setTimeout(function() {
+
+ // wait a second before proceeding
+ done();
+
+ }, 1000);
});
@@ -298,8 +337,13 @@ module.exports = {
// we set up 2 groups of the same 5 users. if duplicate filtering is working,
// we'll only have 5 expected
notification.expectedCount.should.be.equal(5);
+ setTimeout(function() {
+
+ // wait a second before proceeding
done();
+ }, 1000);
+
});
}, 1000);
http://git-wip-us.apache.org/repos/asf/usergrid/blob/9c894465/tests/integration/test/queries/integerComparison.js
----------------------------------------------------------------------
diff --git a/tests/integration/test/queries/integerComparison.js b/tests/integration/test/queries/integerComparison.js
index f3036f1..372a00c 100644
--- a/tests/integration/test/queries/integerComparison.js
+++ b/tests/integration/test/queries/integerComparison.js
@@ -57,19 +57,24 @@ module.exports = {
var query3 = "select * where location within 10000 of 37.3236882,-121.9373442"; //San Jose Airport
describe("get horses " + query3, function() {
it('should return a subset of results ' + query3, function() {
- entities.getWithQuery('horses', query3, 10, function(err, body) {
- should(err).be.null;
- body.entities.should.be.an.instanceOf(Array);
- body.entities.length.should.be.greaterThan(0);
- if (body.entities.length > 0) {
- body.entities.length.should.be.greaterThan(0).and.lessThan(11);
- body.entities.forEach(function(entity) {
- // Apigee San Jose
- entity.location.latitude.should.be.equal(37.3338716);
- entity.location.longitude.should.be.equal(-121.894249);
- });
- }
- });
+ //add some delay
+ setTimeout(function(){
+ entities.getWithQuery('horses', query3, 10, function(err, body) {
+ should(err).be.null;
+ body.entities.should.be.an.instanceOf(Array);
+ body.entities.length.should.be.greaterThan(0);
+ if (body.entities.length > 0) {
+ body.entities.length.should.be.greaterThan(0).and.lessThan(11);
+ body.entities.forEach(function(entity) {
+ // Apigee San Jose
+ entity.location.latitude.should.be.equal(37.3338716);
+ entity.location.longitude.should.be.equal(-121.894249);
+ });
+ }
+ });
+
+ }, 2000);
+
});
});
http://git-wip-us.apache.org/repos/asf/usergrid/blob/9c894465/tests/integration/test/setup.js
----------------------------------------------------------------------
diff --git a/tests/integration/test/setup.js b/tests/integration/test/setup.js
index d254d8d..a31eef3 100644
--- a/tests/integration/test/setup.js
+++ b/tests/integration/test/setup.js
@@ -61,7 +61,7 @@ module.exports = {
email: id + "@uge2e.com"
});
}
- async.each(
+ async.eachSeries(
userArr,
function(user, cb) {
users.add(user, function(err, user) {
@@ -86,7 +86,7 @@ module.exports = {
longitude: -121.894249
}
};
- async.parallel([
+ async.series([
function(cb) {
entities.create('dogs', entity, numberOfRecords, function(err, body) {