Added test and cleaned up imports that proves that the class cast issue will no longer occur.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/0f13650f Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/0f13650f Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/0f13650f Branch: refs/heads/release-2.1.1 Commit: 0f13650f500809b2d044568570dbf11f4a57f70c Parents: c46e1b6 Author: George Reyes <[email protected]> Authored: Thu May 5 09:29:03 2016 -0700 Committer: George Reyes <[email protected]> Committed: Fri May 6 15:38:34 2016 -0700 ---------------------------------------------------------------------- .../collection/CollectionsResourceIT.java | 82 +++++++++++++++----- 1 file changed, 64 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid/blob/0f13650f/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 db07c3f..7afc87a 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 @@ -17,12 +17,28 @@ package org.apache.usergrid.rest.applications.collection; -import com.fasterxml.jackson.databind.JsonNode; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +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; + +import org.junit.Ignore; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.commons.lang.RandomStringUtils; + import org.apache.usergrid.persistence.Schema; import org.apache.usergrid.persistence.entities.Application; - +import org.apache.usergrid.persistence.index.utils.UUIDUtils; import org.apache.usergrid.rest.test.resource.AbstractRestIT; import org.apache.usergrid.rest.test.resource.model.ApiResponse; import org.apache.usergrid.rest.test.resource.model.Collection; @@ -30,24 +46,16 @@ import org.apache.usergrid.rest.test.resource.model.Credentials; import org.apache.usergrid.rest.test.resource.model.Entity; import org.apache.usergrid.rest.test.resource.model.QueryParameters; import org.apache.usergrid.rest.test.resource.model.Token; -import org.apache.usergrid.services.ServiceParameter; - -import org.junit.Ignore; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.ws.rs.BadRequestException; -import javax.ws.rs.ClientErrorException; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.core.MediaType; - -import java.io.IOException; -import java.util.*; -import org.apache.commons.lang.NullArgumentException; +import com.fasterxml.jackson.databind.JsonNode; -import static org.junit.Assert.*; +import static junit.framework.TestCase.assertNotNull; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; /** @@ -1096,4 +1104,42 @@ public class CollectionsResourceIT extends AbstractRestIT { assertEquals( 0, connectionsByQuery.getNumOfEntities() ); } + @Test + public void testBeingAbleToRetreiveMigratedValues() throws Exception { + + + Entity notifier = new Entity().chainPut("name", "mynotifier").chainPut("provider", "noop"); + + ApiResponse notifierNode = this.pathResource(getOrgAppPath("notifier")).post(ApiResponse.class,notifier); + + UUID uuid = UUIDUtils.newTimeUUID(); + // create user + + Map payloads = new HashMap<>( ); + payloads.put( "mynotifier","hello world" ); + + Map statistics = new HashMap<>( ); + statistics.put( "sent",1 ); + statistics.put( "errors",0 ); + + Entity payload = new Entity(); + payload.put("debug", false); + payload.put( "expectedCount",0 ); + payload.put( "finished",1438279671229L); + payload.put( "payloads",payloads); + payload.put( "priority","normal"); + payload.put( "state","FINISHED"); + payload.put( "statistics",statistics); + + + + + ApiResponse user = this.app().collection("notifications/"+ UUIDUtils.newTimeUUID()).put(null,payload ); + this.refreshIndex(); + + Collection user2 = this.app().collection("notifications").get(); + + assertEquals(1,user2.getNumOfEntities()); + + } }
