usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mru...@apache.org
Subject [3/7] usergrid git commit: Fixed error with a PUT call actually sending a POST. Added additional assert to make sure that a POST will not encounter this issue as well.
Date Tue, 07 Jun 2016 16:32:34 GMT
Fixed error with a PUT call actually sending a POST.
Added additional assert to make sure that a POST will not encounter this issue as well.


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

Branch: refs/heads/release-2.1.1
Commit: 987ffdc01592b0b6e61b701720e04cfc8ba29331
Parents: 0f13650
Author: George Reyes <grey@apache.org>
Authored: Mon May 9 10:50:36 2016 -0700
Committer: George Reyes <grey@apache.org>
Committed: Mon May 9 10:50:36 2016 -0700

----------------------------------------------------------------------
 .../collection/CollectionsResourceIT.java       | 15 ++++++++----
 .../resource/endpoints/CollectionEndpoint.java  | 24 +++++++++++---------
 2 files changed, 23 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/987ffdc0/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
index 7afc87a..0908f5c 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
@@ -24,7 +24,6 @@ import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Set;
-import java.util.UUID;
 
 import javax.ws.rs.BadRequestException;
 import javax.ws.rs.ClientErrorException;
@@ -1112,7 +1111,6 @@ public class CollectionsResourceIT extends AbstractRestIT {
 
         ApiResponse notifierNode = this.pathResource(getOrgAppPath("notifier")).post(ApiResponse.class,notifier);
 
-        UUID uuid = UUIDUtils.newTimeUUID();
         // create user
 
         Map payloads = new HashMap<>(  );
@@ -1132,14 +1130,21 @@ public class CollectionsResourceIT extends AbstractRestIT {
         payload.put( "statistics",statistics);
 
 
-
-
-        ApiResponse user = this.app().collection("notifications/"+ UUIDUtils.newTimeUUID()).put(null,payload
);
+        this.app().collection("notifications/"+ UUIDUtils.newTimeUUID()).post(payload );
         this.refreshIndex();
 
         Collection user2 = this.app().collection("notifications").get();
 
         assertEquals(1,user2.getNumOfEntities());
 
+        this.app().collection("notifications/"+ UUIDUtils.newTimeUUID()).put(null,payload
);
+        this.refreshIndex();
+
+        user2 = this.app().collection("notifications").get();
+
+        assertEquals(2,user2.getNumOfEntities());
+
     }
+
+
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/987ffdc0/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/CollectionEndpoint.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/CollectionEndpoint.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/CollectionEndpoint.java
index ad5d9a6..d1c7ab4 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/CollectionEndpoint.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/CollectionEndpoint.java
@@ -16,22 +16,24 @@
  */
 package org.apache.usergrid.rest.test.resource.endpoints;
 
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.usergrid.rest.test.resource.model.Collection;
-import org.apache.usergrid.rest.test.resource.state.ClientContext;
-import org.apache.usergrid.utils.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.MediaType;
 import java.io.IOException;
 import java.io.StringReader;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
 
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.MediaType;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.usergrid.rest.test.resource.model.Collection;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+import org.apache.usergrid.utils.StringUtils;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
 
 /**
  * //myorg/myapp/mycollection
@@ -358,7 +360,7 @@ public class CollectionEndpoint extends NamedResource {
         // use string type so we can log actual response from server
         String responseString = resource.request()
             .accept(acceptHeader)
-            .post( javax.ws.rs.client.Entity.json( entity ), String.class);
+            .put( javax.ws.rs.client.Entity.json( entity ), String.class);
 
         if (logger.isDebugEnabled()) {
             logger.debug("Response from put: " + responseString);


Mime
View raw message