usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toddn...@apache.org
Subject incubator-usergrid git commit: Completed compilation fixes.
Date Mon, 13 Apr 2015 17:38:00 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/USERGRID-536 99f480dd0 -> 2eac3be13


Completed compilation fixes.


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

Branch: refs/heads/USERGRID-536
Commit: 2eac3be133ada49d331171bcb2386c2635fa136e
Parents: 99f480d
Author: Todd Nine <tnine@apigee.com>
Authored: Mon Apr 13 11:37:58 2015 -0600
Committer: Todd Nine <tnine@apigee.com>
Committed: Mon Apr 13 11:37:58 2015 -0600

----------------------------------------------------------------------
 .../org/apache/usergrid/persistence/Query.java  | 17 ++++++
 .../usergrid/persistence/CollectionIT.java      |  7 ++-
 stack/pom.xml                                   |  4 +-
 .../notifiers/NotifiersResource.java            | 11 ++--
 .../rest/applications/users/UsersResource.java  |  4 +-
 .../organizations/OrganizationResource.java     |  2 +-
 .../events/ApplicationRequestCounterIT.java     |  2 +-
 .../applications/queries/BasicGeoTests.java     | 21 ++-----
 .../applications/queries/GeoPagingTest.java     | 58 ++++++++++++--------
 .../security/providers/FacebookProvider.java    |  4 +-
 .../security/providers/FoursquareProvider.java  |  4 +-
 .../services/AbstractCollectionService.java     | 11 +---
 .../notifications/InactiveDeviceManager.java    |  6 +-
 .../notifications/NotificationsService.java     |  2 +-
 .../apns/NotificationsServiceIT.java            | 24 +++-----
 15 files changed, 90 insertions(+), 87 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2eac3be1/stack/core/src/main/java/org/apache/usergrid/persistence/Query.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/Query.java b/stack/core/src/main/java/org/apache/usergrid/persistence/Query.java
index e6fe6d6..56a8616 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/Query.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/Query.java
@@ -161,6 +161,17 @@ public class Query {
     }
 
 
+    /**
+     * Create a query from a property equals
+     * @param propertyName
+     * @param value
+     * @return
+     */
+    public static Query fromEquals(final String propertyName, final String value){
+        return fromQL( propertyName + " = '" + value + "'" );
+    }
+
+
     private static Query newQueryIfNull( Query query ) {
         if ( query == null ) {
             query = new Query();
@@ -840,6 +851,12 @@ public class Query {
 
     // may be null
     public String getQl() {
+
+        //if a query exists, but with no ql, we select all
+        if(ql == null){
+            return "select *";
+        }
+
         return ql;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2eac3be1/stack/core/src/test/java/org/apache/usergrid/persistence/CollectionIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/CollectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/CollectionIT.java
index e6d8875..669c380 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/CollectionIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/CollectionIT.java
@@ -528,11 +528,12 @@ public class CollectionIT extends AbstractCoreIT {
 
         Entity returned = r.getEntities().get( 0 );
 
-        assertEquals( user.getUuid(), returned.getUuid() );
+        assertEquals( user2.getUuid(), returned.getUuid() );
 
         returned = r.getEntities().get( 1 );
 
-        assertEquals( user2.getUuid(), returned.getUuid() );
+        assertEquals( user.getUuid(), returned.getUuid() );
+
     }
 
 
@@ -1064,7 +1065,7 @@ public class CollectionIT extends AbstractCoreIT {
 
         app.refreshIndex();
 
-        Query query = Query.fromQL("select * where index >= " + size / 2 + " + sort by
index asc");
+        Query query = Query.fromQL("select * where index >= " + size / 2 + " sort by index
asc");
         query.setLimit( pageSize );
 
         Results r = null;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2eac3be1/stack/pom.xml
----------------------------------------------------------------------
diff --git a/stack/pom.xml b/stack/pom.xml
index 96faee0..39b6ecb 100644
--- a/stack/pom.xml
+++ b/stack/pom.xml
@@ -218,7 +218,9 @@
     https://issues.apache.org/jira/browse/USERGRID-224
     <module>launcher</module>
     -->
-    <module>mongo-emulator</module>
+    <!--
+    Not supported in 2.0 ATM.  We will re-visit after our refactor work
+    <module>mongo-emulator</module>-->
     <!--
     Re-enable when query-validator updated to work with Core Persistence.
     https://issues.apache.org/jira/browse/USERGRID-221

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2eac3be1/stack/rest/src/main/java/org/apache/usergrid/rest/applications/notifiers/NotifiersResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/notifiers/NotifiersResource.java
b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/notifiers/NotifiersResource.java
index cfbbb45..1787be5 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/notifiers/NotifiersResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/notifiers/NotifiersResource.java
@@ -21,8 +21,9 @@ import com.sun.jersey.multipart.FormDataMultiPart;
 import java.io.InputStream;
 import java.util.HashMap;
 import org.apache.commons.io.IOUtils;
+
+import org.apache.usergrid.persistence.Query;
 import org.apache.usergrid.persistence.index.query.Identifier;
-import org.apache.usergrid.persistence.index.query.Query;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.context.annotation.Scope;
@@ -113,10 +114,10 @@ public class NotifiersResource extends ServiceResource {
 
         logger.debug("ServiceResource.uploadData");
 
-        String name =         getValueOrNull(multiPart, "name"); 
-        String provider =     getValueOrNull(multiPart, "provider"); 
-        String environment =  getValueOrNull(multiPart, "environment"); 
-        String certPassword = getValueOrNull(multiPart, "certificatePassword"); 
+        String name =         getValueOrNull(multiPart, "name");
+        String provider =     getValueOrNull(multiPart, "provider");
+        String environment =  getValueOrNull(multiPart, "environment");
+        String certPassword = getValueOrNull(multiPart, "certificatePassword");
 
         InputStream is = null;
         if (multiPart.getField("p12Certificate") != null) {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2eac3be1/stack/rest/src/main/java/org/apache/usergrid/rest/applications/users/UsersResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/users/UsersResource.java
b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/users/UsersResource.java
index 0ae3421..2993b8f 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/users/UsersResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/users/UsersResource.java
@@ -44,7 +44,7 @@ import static org.apache.commons.lang.StringUtils.isNotBlank;
 import org.apache.usergrid.persistence.Entity;
 import org.apache.usergrid.persistence.entities.User;
 import org.apache.usergrid.persistence.index.query.Identifier;
-import org.apache.usergrid.persistence.index.query.Query;
+import org.apache.usergrid.persistence.Query;
 import org.apache.usergrid.rest.AbstractContextResource;
 import org.apache.usergrid.rest.ApiResponse;
 import org.apache.usergrid.rest.RootResource;
@@ -219,7 +219,7 @@ public class UsersResource extends ServiceResource {
         String password = null;
         String pin = null;
 
-        Boolean confRequred = (Boolean)this.getServices().getEntityManager().getProperty(

+        Boolean confRequred = (Boolean)this.getServices().getEntityManager().getProperty(
             this.getServices().getApplicationRef(), "registration_requires_email_confirmation"
);
 
         boolean activated = !( ( confRequred != null ) && confRequred );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2eac3be1/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationResource.java
b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationResource.java
index 9f32f03..afd4d26 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationResource.java
@@ -63,7 +63,7 @@ import java.util.UUID;
 import static javax.servlet.http.HttpServletResponse.*;
 import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
 import org.apache.usergrid.persistence.Entity;
-import org.apache.usergrid.persistence.index.query.Query.Level;
+import org.apache.usergrid.persistence.Query.Level;
 
 
 @Component("org.apache.usergrid.rest.management.organizations.OrganizationResource")

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2eac3be1/stack/rest/src/test/java/org/apache/usergrid/rest/applications/events/ApplicationRequestCounterIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/events/ApplicationRequestCounterIT.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/events/ApplicationRequestCounterIT.java
index 61b313c..655d2e6 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/events/ApplicationRequestCounterIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/events/ApplicationRequestCounterIT.java
@@ -28,7 +28,7 @@ import org.slf4j.LoggerFactory;
 
 import org.apache.usergrid.persistence.EntityManager;
 import org.apache.usergrid.persistence.EntityManagerFactory;
-import org.apache.usergrid.persistence.index.query.Query;
+import org.apache.usergrid.persistence.Query;
 import org.apache.usergrid.persistence.Results;
 import org.apache.usergrid.persistence.index.query.CounterResolution;
 import org.apache.usergrid.rest.AbstractRestIT;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2eac3be1/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BasicGeoTests.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BasicGeoTests.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BasicGeoTests.java
index 3e9bd85..d2343a1 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BasicGeoTests.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BasicGeoTests.java
@@ -17,30 +17,21 @@
 package org.apache.usergrid.rest.applications.queries;
 
 
-import java.util.*;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.sun.jersey.api.client.UniformInterfaceException;
-
 import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
 
-import org.apache.usergrid.persistence.Entity;
-import org.apache.usergrid.persistence.EntityManager;
-import org.apache.usergrid.persistence.Results;
-
-import org.jclouds.json.Json;
 import org.junit.Rule;
 import org.junit.Test;
 
-import org.apache.usergrid.persistence.geo.model.Point;
-import org.apache.usergrid.persistence.index.query.Query;
-import org.apache.usergrid.persistence.index.utils.UUIDUtils;
 import org.apache.usergrid.rest.AbstractRestIT;
 import org.apache.usergrid.rest.TestContextSetup;
-import org.apache.usergrid.rest.test.resource.CustomCollection;
 
-import static org.junit.Assert.assertEquals;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.sun.jersey.api.client.UniformInterfaceException;
+
 import static org.apache.usergrid.utils.MapUtils.hashMap;
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2eac3be1/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/GeoPagingTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/GeoPagingTest.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/GeoPagingTest.java
index f9fe5b3..d83bee4 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/GeoPagingTest.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/GeoPagingTest.java
@@ -17,21 +17,27 @@
 package org.apache.usergrid.rest.applications.queries;
 
 
-import org.apache.usergrid.persistence.geo.model.Point;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import org.apache.usergrid.persistence.index.utils.UUIDUtils;
 import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
 import org.apache.usergrid.rest.test.resource2point0.model.Collection;
 import org.apache.usergrid.rest.test.resource2point0.model.Entity;
 import org.apache.usergrid.rest.test.resource2point0.model.QueryParameters;
 import org.apache.usergrid.utils.MapUtils;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.*;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
 
 
 /**
@@ -120,11 +126,14 @@ public class GeoPagingTest extends AbstractRestIT {
   @Test
   public void testFarAwayLocationFromCenter() throws IOException {
     String collectionType = "testFarAwayLocation" + UUIDUtils.newTimeUUID();
-    Point center = new Point(37.776753, -122.407846);
+
+      final double lat = 37.776753;
+      final double lon =  -122.407846;
+
     QueryParameters queryClose = new QueryParameters();
-    queryClose.setQuery("select * where location within 20000 of " + String.valueOf(center.getLat())
+ ", " + String.valueOf(center.getLon()) + "");
+    queryClose.setQuery("select * where location within 20000 of " + String.valueOf(lat)
+ ", " + String.valueOf(lon) + "");
     QueryParameters queryFar = new QueryParameters();
-    queryFar.setQuery("select * where location within " + Integer.MAX_VALUE + " of " + String.valueOf(center.getLat())
+ ", " + String.valueOf(center.getLon()) + "");
+    queryFar.setQuery("select * where location within " + Integer.MAX_VALUE + " of " + String.valueOf(lat)
+ ", " + String.valueOf(lon) + "");
     // 1. Create 2 entities
     Entity props = new Entity();
     props.put("name", "usergrid");
@@ -208,12 +217,13 @@ public class GeoPagingTest extends AbstractRestIT {
   @Test
   public void testFarAwayLocationWithOneResultCloser() throws IOException {
     String collectionType = "testFarAwayLocationWithOneResultCloser" + UUIDUtils.newTimeUUID();
-    Point center = new Point(-33.746369, 150.952183);
+    final double lat = -33.746369;
+      final double lon =  150.952183;
 
     QueryParameters queryClose = new QueryParameters();
-    queryClose.setQuery("select * where location within 10000 of " + String.valueOf(center.getLat())
+ ", " + String.valueOf(center.getLon()) + "");
+    queryClose.setQuery("select * where location within 10000 of " + String.valueOf(lat)
+ ", " + String.valueOf(lon) + "");
     QueryParameters queryFar = new QueryParameters();
-    queryFar.setQuery("select * where location within " + Integer.MAX_VALUE + " of " + String.valueOf(center.getLat())
+ ", " + String.valueOf(center.getLon()) + "");
+    queryFar.setQuery("select * where location within " + Integer.MAX_VALUE + " of " + String.valueOf(lat)
+ ", " + String.valueOf(lon) + "");
     // 1. Create 2 entities
     Entity props = new Entity();
     props.put("name", "usergrid");
@@ -270,19 +280,19 @@ public class GeoPagingTest extends AbstractRestIT {
 
     this.refreshIndex();
     // 2. Create a list of geo points
-    List<Point> points = new ArrayList<Point>();
-    points.add(new Point(33.746369, -89));//Woodland, MS
-    points.add(new Point(33.746369, -91));//Beulah, MS
-    points.add(new Point(-1.000000, 102.000000));//Somewhere in Indonesia
-    points.add(new Point(-90.000000, 90.000000));//Antarctica
-    points.add(new Point(90, 90));//Santa's house
+    List<double[]> points = new ArrayList<>();
+    points.add(new double []{33.746369, -89});//Woodland, MS
+    points.add(new double []{33.746369, -91});//Beulah, MS
+    points.add(new double []{-1.000000, 102.000000});//Somewhere in Indonesia
+    points.add(new double []{-90.000000, 90.000000});//Antarctica
+    points.add(new double []{90, 90});//Santa's house
 
     // 3. Test each to ensure it is not within 10000 meters of our users
-    Iterator<Point> pointIterator = points.iterator();
-    for (Point p = pointIterator.next(); pointIterator.hasNext(); p = pointIterator.next())
{
+    Iterator<double[]> pointIterator = points.iterator();
+    for ( double[] p = pointIterator.next(); pointIterator.hasNext(); p = pointIterator.next())
{
+
 
-      Point center = new Point(p.getLat(), p.getLon());
-      String query = "select * where location within 10000 of " + center.getLat() + ", "
+ center.getLon();//locationQuery( 10000 ,center );
+      String query = "select * where location within 10000 of " + p[0] + ", " + p[1];//locationQuery(
10000 ,center );
       QueryParameters params = new QueryParameters();
       params.setQuery(query);
       Collection collection = this.app().collection("users").get(params);

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2eac3be1/stack/services/src/main/java/org/apache/usergrid/security/providers/FacebookProvider.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/security/providers/FacebookProvider.java
b/stack/services/src/main/java/org/apache/usergrid/security/providers/FacebookProvider.java
index 8a1f567..30a497e 100644
--- a/stack/services/src/main/java/org/apache/usergrid/security/providers/FacebookProvider.java
+++ b/stack/services/src/main/java/org/apache/usergrid/security/providers/FacebookProvider.java
@@ -117,8 +117,8 @@ public class FacebookProvider extends AbstractProvider {
 
             Results r = null;
             try {
-                r = entityManager.searchCollection( entityManager.getApplicationRef(), "users",
-                        Query.findForProperty( "facebook.id", fb_user_id ) );
+                final Query query = Query.fromEquals( "facebook.id",  fb_user_id );
+                r = entityManager.searchCollection( entityManager.getApplicationRef(), "users",
query );
             }
             catch ( Exception ex ) {
                 throw new BadTokenException( "Could not lookup user for that Facebook ID",
ex );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2eac3be1/stack/services/src/main/java/org/apache/usergrid/security/providers/FoursquareProvider.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/security/providers/FoursquareProvider.java
b/stack/services/src/main/java/org/apache/usergrid/security/providers/FoursquareProvider.java
index 8e68edc..d7b136e 100644
--- a/stack/services/src/main/java/org/apache/usergrid/security/providers/FoursquareProvider.java
+++ b/stack/services/src/main/java/org/apache/usergrid/security/providers/FoursquareProvider.java
@@ -125,8 +125,8 @@ public class FoursquareProvider extends AbstractProvider {
         try {
             if ( ( fq_user != null ) && !anyNull( fq_user_id, fq_user_name ) ) {
 
-                Results r = entityManager.searchCollection( entityManager.getApplicationRef(),
"users",
-                        Query.findForProperty( "foursquare.id", fq_user_id ) );
+                final Query query = Query.fromEquals(  "foursquare.id" ,   fq_user_id );
+                Results r = entityManager.searchCollection( entityManager.getApplicationRef(),
"users", query );
 
                 if ( r.size() > 1 ) {
                     logger.error( "Multiple users for FQ ID: " + fq_user_id );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2eac3be1/stack/services/src/main/java/org/apache/usergrid/services/AbstractCollectionService.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/AbstractCollectionService.java
b/stack/services/src/main/java/org/apache/usergrid/services/AbstractCollectionService.java
index 326696a..05cccb5 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/AbstractCollectionService.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/AbstractCollectionService.java
@@ -206,9 +206,7 @@ public class AbstractCollectionService extends AbstractService {
             query.setReversed( isCollectionReversed( context ) );
         }
 
-        if ( !query.isSortSet() ) {
-            query.addSort( getCollectionSort( context ) );
-        }
+
     /*
      * if (count > 0) { query.setMaxResults(count); }
      */
@@ -324,9 +322,6 @@ public class AbstractCollectionService extends AbstractService {
         if ( !query.isReversedSet() ) {
             query.setReversed( isCollectionReversed( context ) );
         }
-        if ( !query.isSortSet() ) {
-            query.addSort( getCollectionSort( context ) );
-        }
 
         Results r = em.searchCollection( context.getOwner(), context.getCollectionName(),
query );
         if ( r.isEmpty() ) {
@@ -518,10 +513,6 @@ public class AbstractCollectionService extends AbstractService {
             query.setReversed( isCollectionReversed( context ) );
         }
 
-        if ( !query.isSortSet() ) {
-            query.addSort( getCollectionSort( context ) );
-        }
-
 
         Results r = em.searchCollection( context.getOwner(), context.getCollectionName(),
query );
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2eac3be1/stack/services/src/main/java/org/apache/usergrid/services/notifications/InactiveDeviceManager.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/notifications/InactiveDeviceManager.java
b/stack/services/src/main/java/org/apache/usergrid/services/notifications/InactiveDeviceManager.java
index c2ac11f..9a6d67e 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/notifications/InactiveDeviceManager.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/notifications/InactiveDeviceManager.java
@@ -57,15 +57,13 @@ public class InactiveDeviceManager {
             for (Map.Entry<String, Date> entry : inactiveDeviceMap.entrySet()) {
                 try {
                     // name
-                    Query query = new Query();
-                    query.addEqualityFilter(notifier.getName() + notfierPostFix, entry.getKey());
+                    Query query = Query.fromQL( notifier.getName() + notfierPostFix  + "
= '" + entry.getKey() + "'");
                     Results results = entityManager.searchCollection(entityManager.getApplication(),
"devices", query);
                     for (Entity e : results.getEntities()) {
                         entityManager.updateProperties(e, clearPushtokenMap);
                     }
                     // uuid
-                    query = new Query();
-                    query.addEqualityFilter(notifier.getUuid() + notfierPostFix, entry.getKey());
+                    query = Query.fromQL( notifier.getName() + notfierPostFix  + " = " +
entry.getKey() + "");
                     results = entityManager.searchCollection(entityManager.getApplication(),
 "devices", query);
                     for (Entity e : results.getEntities()) {
                         entityManager.updateProperties(e, clearPushtokenMap);

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2eac3be1/stack/services/src/main/java/org/apache/usergrid/services/notifications/NotificationsService.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/notifications/NotificationsService.java
b/stack/services/src/main/java/org/apache/usergrid/services/notifications/NotificationsService.java
index 716f72b..9fd0683 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/notifications/NotificationsService.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/notifications/NotificationsService.java
@@ -176,7 +176,7 @@ public class NotificationsService extends AbstractCollectionService {
         for (int i = 0; i < parameters.size() - 1; i += 2) {
             String collection = pluralize(parameters.get(i).getName());
             ServiceParameter sp = parameters.get(i + 1);
-            org.apache.usergrid.persistence.index.query.Query query = sp.getQuery();
+            Query query = sp.getQuery();
             if (query == null) {
                 query = new Query();
                 if(collection.equals("devices") && sp.isName() && sp.getName().equals("notifications"))
{

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2eac3be1/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 c99034f..8f1ae04 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
@@ -168,8 +168,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT
{
                 payload);
 
         // verify Query for CREATED state
-        Query query = new Query();
-        query.addEqualityFilter("state", Notification.State.STARTED.toString());
+        Query query =  Query.fromEquals( "state", Notification.State.STARTED.toString() );
         Results results = app.getEntityManager().searchCollection(
                 app.getEntityManager().getApplicationRef(), "notifications", query);
         Entity entity = results.getEntitiesMap().get(notification.getUuid());
@@ -182,8 +181,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT
{
                 setup.getEntityIndex().refresh();
 
         // verify Query for FINISHED state
-        query = new Query();
-        query.addEqualityFilter("state", Notification.State.FINISHED.toString());
+        query = Query.fromEquals("state", Notification.State.FINISHED.toString());
         results = app.getEntityManager().searchCollection(app.getEntityManager().getApplicationRef(),
                 "notifications", query);
         entity = results.getEntitiesMap().get(notification.getUuid());
@@ -244,8 +242,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT
{
 
 
         // verify Query for CREATED state
-        Query query = new Query();
-        query.addEqualityFilter("state", Notification.State.FINISHED.toString());
+        Query query =  Query.fromEquals( "state", Notification.State.FINISHED.toString()
);
         Results results = app.getEntityManager().searchCollection(app.getEntityManager().getApplicationRef(),
"notifications", query);
         Entity entity = results.getEntitiesMap().get(notification.getUuid());
         assertNotNull(entity);
@@ -258,8 +255,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT
{
         notification = app.getEntityManager().get(e.getUuid(), Notification.class);
 
         // verify Query for FINISHED state
-        query = new Query();
-        query.addEqualityFilter("state", Notification.State.FINISHED.toString());
+        query = Query.fromEquals("state", Notification.State.FINISHED.toString());
         results = app.getEntityManager().searchCollection(app.getEntityManager().getApplicationRef(),
                 "notifications", query);
         entity = results.getEntitiesMap().get(notification.getUuid());
@@ -300,8 +296,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT
{
         Thread.sleep(500);
 
         // verify Query for SCHEDULED state
-        Query query = new Query();
-        query.addEqualityFilter("state",
+        Query query = Query.fromEquals("state",
                 Notification.State.SCHEDULED.toString());
         Results results = app.getEntityManager().searchCollection(
                 app.getEntityManager().getApplicationRef(), "notifications", query);
@@ -646,8 +641,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT
{
         }
 
         // verify Query for FAILED state
-        Query query = new Query();
-        query.addEqualityFilter("state", Notification.State.FAILED.toString());
+        Query query = Query.fromEquals("state", Notification.State.FAILED.toString());
         Results results = app.getEntityManager().searchCollection(
                 app.getEntityManager().getApplicationRef(), "notifications", query);
         Entity entity = results.getEntitiesMap().get(notification.getUuid());
@@ -743,8 +737,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT
{
                 payload);
 
         // verify Query for CREATED state
-        Query query = new Query();
-        query.addEqualityFilter("state", Notification.State.STARTED.toString());
+        Query query = Query.fromEquals("state", Notification.State.STARTED.toString());
         Results results = app.getEntityManager().searchCollection(
                 app.getEntityManager().getApplicationRef(), "notifications", query);
         Entity entity = results.getEntitiesMap().get(notification.getUuid());
@@ -757,8 +750,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT
{
                 setup.getEntityIndex().refresh();
 
         // verify Query for FINISHED state
-        query = new Query();
-        query.addEqualityFilter("state", Notification.State.FINISHED.toString());
+        query = Query.fromEquals("state", Notification.State.FINISHED.toString());
         results = app.getEntityManager().searchCollection(app.getEntityManager().getApplicationRef(),
                 "notifications", query);
         entity = results.getEntitiesMap().get(notification.getUuid());


Mime
View raw message