http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d6bcf4bf/stack/services/src/test/java/org/apache/usergrid/management/export/ExportServiceIT.java ---------------------------------------------------------------------- diff --git a/stack/services/src/test/java/org/apache/usergrid/management/export/ExportServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/export/ExportServiceIT.java index 3a6d8f9..a85ec53 100644 --- a/stack/services/src/test/java/org/apache/usergrid/management/export/ExportServiceIT.java +++ b/stack/services/src/test/java/org/apache/usergrid/management/export/ExportServiceIT.java @@ -116,7 +116,7 @@ public class ExportServiceIT { organization = newOrgAppAdminRule.getOrganizationInfo(); applicationId = newOrgAppAdminRule.getApplicationInfo().getId(); - setup.getEmf().refreshIndex(); + setup.getEntityIndex().refresh(); } @@ -270,7 +270,7 @@ public class ExportServiceIT { entity[i] = em.create( "users", userProperties ); } - em.refreshIndex(); + setup.getEntityIndex().refresh(); //creates connections em.createConnection( em.get( new SimpleEntityRef( "user", entity[0].getUuid() ) ), "Vibrations", em.get( new SimpleEntityRef( "user", entity[1].getUuid() ) ) ); @@ -502,7 +502,7 @@ public class ExportServiceIT { JobExecution jobExecution = mock( JobExecution.class ); when( jobExecution.getJobData() ).thenReturn( jobData ); - em.refreshIndex(); + setup.getEntityIndex().refresh(); exportService.doExport( jobExecution ); @@ -573,7 +573,7 @@ public class ExportServiceIT { JobExecution jobExecution = mock( JobExecution.class ); when( jobExecution.getJobData() ).thenReturn( jobData ); - em.refreshIndex(); + setup.getEntityIndex().refresh(); exportService.doExport( jobExecution ); @@ -608,7 +608,7 @@ public class ExportServiceIT { EntityManager em = setup.getEmf().getEntityManager( applicationId ); em.createApplicationCollection( "baconators" ); - em.refreshIndex(); + setup.getEntityIndex().refresh(); //initialize user object to be posted Map<String, Object> userProperties = null; @@ -641,7 +641,7 @@ public class ExportServiceIT { JobExecution jobExecution = mock( JobExecution.class ); when( jobExecution.getJobData() ).thenReturn( jobData ); - em.refreshIndex(); + setup.getEntityIndex().refresh(); exportService.doExport( jobExecution );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d6bcf4bf/stack/services/src/test/java/org/apache/usergrid/management/importer/ImportCollectionIT.java ---------------------------------------------------------------------- diff --git a/stack/services/src/test/java/org/apache/usergrid/management/importer/ImportCollectionIT.java b/stack/services/src/test/java/org/apache/usergrid/management/importer/ImportCollectionIT.java index d8e104d..8dbc042 100644 --- a/stack/services/src/test/java/org/apache/usergrid/management/importer/ImportCollectionIT.java +++ b/stack/services/src/test/java/org/apache/usergrid/management/importer/ImportCollectionIT.java @@ -239,8 +239,8 @@ public class ImportCollectionIT { for ( Entity importedThing : importedThings ) { emApp1.delete( importedThing ); } - emApp1.refreshIndex(); - emApp2.refreshIndex(); + setup.getEntityIndex().refresh(); + importedThings = emApp2.getCollection( appId2, "things", null, Level.ALL_PROPERTIES).getEntities(); @@ -533,7 +533,8 @@ public class ImportCollectionIT { if ( retries >= maxRetries ) { throw new RuntimeException("Max retries reached"); } - em.refreshIndex(); + setup.getEntityIndex().refresh(); + return importEntity.getUuid(); } @@ -547,8 +548,8 @@ public class ImportCollectionIT { logger.debug("\n\nExporting {} collection from application {}\n", collectionName, em.getApplication().getName() ); + setup.getEntityIndex().refresh(); - em.refreshIndex(); ExportService exportService = setup.getExportService(); UUID exportUUID = exportService.schedule( new HashMap<String, Object>() {{ @@ -591,7 +592,8 @@ public class ImportCollectionIT { logger.debug("\n\nCreating new {} collection in application {}\n", type, em.getApplication().getName()); - em.refreshIndex(); + setup.getEntityIndex().refresh(); + List<Entity> created = new ArrayList<>(); for (int i = 0; i < 10; i++) { @@ -612,7 +614,8 @@ public class ImportCollectionIT { em.createConnection(new SimpleEntityRef(type, created.get(1).getUuid()), "related", new SimpleEntityRef(type, created.get(0).getUuid())); - em.refreshIndex(); + setup.getEntityIndex().refresh(); + } http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d6bcf4bf/stack/services/src/test/java/org/apache/usergrid/services/ConnectionsServiceIT.java ---------------------------------------------------------------------- diff --git a/stack/services/src/test/java/org/apache/usergrid/services/ConnectionsServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/ConnectionsServiceIT.java index eb8e2dd..57853a6 100644 --- a/stack/services/src/test/java/org/apache/usergrid/services/ConnectionsServiceIT.java +++ b/stack/services/src/test/java/org/apache/usergrid/services/ConnectionsServiceIT.java @@ -98,14 +98,16 @@ public class ConnectionsServiceIT extends AbstractServiceIT { Entity bar = app.testRequest( ServiceAction.POST, 1, "bars" ).getEntity(); assertNotNull( bar ); - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); - //POST users/conn-user1/user2/UUID + + //POST users/conn-user1/user2/UUID app.testRequest( ServiceAction.POST, 1, "foos", "foo", "bars", bar.getUuid() ); // should succeed - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); + - try { + try { //POST users/conn-user1/user2/bar app.testRequest( ServiceAction.POST, 1, "foos", "foo", "bars", "bar" ); Assert.fail(); http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d6bcf4bf/stack/services/src/test/java/org/apache/usergrid/services/GroupServiceIT.java ---------------------------------------------------------------------- diff --git a/stack/services/src/test/java/org/apache/usergrid/services/GroupServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/GroupServiceIT.java index 49ce433..8fd5da3 100644 --- a/stack/services/src/test/java/org/apache/usergrid/services/GroupServiceIT.java +++ b/stack/services/src/test/java/org/apache/usergrid/services/GroupServiceIT.java @@ -68,13 +68,13 @@ public class GroupServiceIT extends AbstractServiceIT { app.createGroupRole( group.getUuid(), "admin", 0 ); app.createGroupRole( group.getUuid(), "author", 0 ); - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); + app.grantGroupRolePermission( group.getUuid(), "admin", "users:access:*" ); app.grantGroupRolePermission( group.getUuid(), "admin", "groups:access:*" ); app.grantGroupRolePermission( group.getUuid(), "author", "assets:access:*" ); - - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); app.testDataRequest( ServiceAction.GET, "groups", group.getUuid(), "rolenames" ); app.testDataRequest( ServiceAction.GET, "groups", group.getUuid(), "roles", "admin", "permissions" ); http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d6bcf4bf/stack/services/src/test/java/org/apache/usergrid/services/RolesServiceIT.java ---------------------------------------------------------------------- diff --git a/stack/services/src/test/java/org/apache/usergrid/services/RolesServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/RolesServiceIT.java index 46731d6..f686bb5 100644 --- a/stack/services/src/test/java/org/apache/usergrid/services/RolesServiceIT.java +++ b/stack/services/src/test/java/org/apache/usergrid/services/RolesServiceIT.java @@ -199,7 +199,7 @@ public class RolesServiceIT extends AbstractServiceIT { ServiceResults results = app.invokeService( ServiceAction.DELETE, "roles", "manager" ); assertEquals( 1, results.size() ); - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); // check role is gone Role role = app.get( app.getAlias( "role", "manager" ), Role.class ); http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d6bcf4bf/stack/services/src/test/java/org/apache/usergrid/services/UsersServiceIT.java ---------------------------------------------------------------------- diff --git a/stack/services/src/test/java/org/apache/usergrid/services/UsersServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/UsersServiceIT.java index 261d3d2..94271ce 100644 --- a/stack/services/src/test/java/org/apache/usergrid/services/UsersServiceIT.java +++ b/stack/services/src/test/java/org/apache/usergrid/services/UsersServiceIT.java @@ -37,8 +37,8 @@ public class UsersServiceIT extends AbstractServiceIT { Entity user = app.create( "user" ); assertNotNull( user ); + setup.getEntityIndex().refresh(); - app.getEntityManager().refreshIndex(); app.testRequest( ServiceAction.POST, 1, "users", user.getUuid(), "roles", "admin" ); app.testRequest( ServiceAction.POST, 1, "users", user.getUuid(), "roles", "manager" ); http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d6bcf4bf/stack/services/src/test/java/org/apache/usergrid/services/notifications/AbstractServiceNotificationIT.java ---------------------------------------------------------------------- diff --git a/stack/services/src/test/java/org/apache/usergrid/services/notifications/AbstractServiceNotificationIT.java b/stack/services/src/test/java/org/apache/usergrid/services/notifications/AbstractServiceNotificationIT.java index 55bb91f..d02d104 100644 --- a/stack/services/src/test/java/org/apache/usergrid/services/notifications/AbstractServiceNotificationIT.java +++ b/stack/services/src/test/java/org/apache/usergrid/services/notifications/AbstractServiceNotificationIT.java @@ -52,7 +52,7 @@ public abstract class AbstractServiceNotificationIT extends AbstractServiceIT { long timeout = System.currentTimeMillis() + 60000; while (System.currentTimeMillis() < timeout) { Thread.sleep(200); - app.getEntityManager().refreshIndex(); + app.refreshIndex(); notification = app.getEntityManager().get(notification.getUuid(), Notification.class); if (notification.getFinished() != null) { return notification; http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d6bcf4bf/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java ---------------------------------------------------------------------- diff --git a/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java index 95418ee..dec7295 100644 --- a/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java +++ b/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java @@ -103,7 +103,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT { device2 = app.getEntityManager().get(e.getUuid(), Device.class); Map<String, Object> props = app.getEntityManager().getProperties(e); assertEquals(device2.getProperty(notifierKey), PUSH_TOKEN); - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); // create User user1 = new User(); @@ -122,7 +122,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT { DefaultQueueManager qm = new DefaultQueueManager(); ns.TEST_QUEUE_MANAGER = qm; - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); listener = new QueueListener(ns.getServiceManagerFactory(),ns.getEntityManagerFactory(), new Properties()); listener.TEST_QUEUE_MANAGER = qm; @@ -143,7 +143,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT { // create push notification // - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); // give queue manager a query for loading 100 devices from an application (why?) app.clear(); @@ -179,7 +179,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT { notification = scheduleNotificationAndWait(notification); - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); // verify Query for FINISHED state query = new Query(); @@ -287,7 +287,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT { .getEntity(); app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid()); - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); Notification notification = app.getEntityManager().get(e.getUuid(), Notification.class); @@ -308,7 +308,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT { Entity entity = results.getEntitiesMap().get(notification.getUuid()); assertNotNull(entity); - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); try { e = app.testRequest(ServiceAction.DELETE, 1, "notifications", @@ -469,7 +469,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT { Entity e = app.testRequest(ServiceAction.POST, 1, "notifiers") .getEntity(); - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); app.testRequest(ServiceAction.GET, 1, "notifiers", "apNs2"); @@ -484,7 +484,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT { device2.setProperty(key2, PUSH_TOKEN); app.getEntityManager().update(device2); - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); // create push notification // @@ -500,7 +500,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT { e = app.testRequest(ServiceAction.POST, 1, "devices","notifications").getEntity(); app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid()); - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); Notification notification = app.getEntityManager().get(e.getUuid(), Notification.class); assertEquals(notification.getPayloads().get(notifierName), payload); @@ -508,7 +508,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT { // perform push // notification = scheduleNotificationAndWait(notification); - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); checkReceipts(notification, 2); //the second notifier isn't associated correctly so its 3 instead of 4 } @@ -533,7 +533,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT { Entity e = app.testRequest(ServiceAction.POST, 1, "notifiers").getEntity(); app.testRequest(ServiceAction.GET, 1, "notifiers", nameValue); - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); Notifier notifier2 = app.getEntityManager().get(e.getUuid(), Notifier.class); assertEquals(notifier2.getName(), nameValue); @@ -544,7 +544,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT { device1.setProperty(key2, PUSH_TOKEN); app.getEntityManager().update(device1); - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); // create push notification // @@ -560,7 +560,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT { e = app.testRequest(ServiceAction.POST, 1,"devices",device1.getUuid(), "notifications").getEntity(); app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid()); - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); Notification notification = app.getEntityManager().get(e.getUuid(), Notification.class); @@ -570,12 +570,12 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT { ns.addDevice(notification, device1); - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); // perform push // notification = scheduleNotificationAndWait(notification); - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); checkReceipts(notification, 2); } @@ -718,7 +718,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT { assertEquals(user1Devices.size(),2); // create push notification // - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); // give queue manager a query for loading 100 devices from an application (why?) app.clear(); @@ -754,7 +754,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT { notification = scheduleNotificationAndWait(notification); - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); // verify Query for FINISHED state query = new Query(); @@ -784,7 +784,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT { Entity entity = app.testRequest(ServiceAction.POST, 1, "notifiers").getEntity(); Notifier notifier = app.getEntityManager().get(entity.getUuid(), Notifier.class); final String notifierKey = notifier.getName() + NOTIFIER_ID_POSTFIX; - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); // create a bunch of devices and add them to the notification @@ -793,7 +793,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT { app.put(notifierKey, PUSH_TOKEN); app.put("name", "device"+i*10); app.testRequest(ServiceAction.POST, 1, "devices").getEntity(); - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); } @@ -808,7 +808,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT { // create a notification entity = app.testRequest(ServiceAction.POST, 1, "devices","notifications").getEntity(); app.testRequest(ServiceAction.GET, 1, "notifications", entity.getUuid()); - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); final Notification notification = (Notification) entity.toTypedEntity(); http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d6bcf4bf/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java ---------------------------------------------------------------------- diff --git a/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java index ee00c88..c0c86ad 100644 --- a/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java +++ b/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java @@ -196,13 +196,13 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT { Entity e = app.testRequest(ServiceAction.POST, 1,"users",user.getUuid(), "notifications").getEntity(); app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid()); - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); // perform push // Notification notification = app.getEntityManager().get(e.getUuid(), Notification.class); notification = scheduleNotificationAndWait(notification); - app.getEntityManager().refreshIndex(); + setup.getEntityIndex().refresh(); checkReceipts(notification, 1); }
