usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject usergrid git commit: change confirmation to app name
Date Fri, 04 Sep 2015 23:07:28 GMT
Repository: usergrid
Updated Branches:
  refs/heads/two-dot-o-dev ab5ace4ba -> bc3ce1b24


change confirmation to app name


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

Branch: refs/heads/two-dot-o-dev
Commit: bc3ce1b24bfde69d958a8fc7fec7d911bfc9e139
Parents: ab5ace4
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Fri Sep 4 16:49:29 2015 -0600
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Fri Sep 4 16:49:29 2015 -0600

----------------------------------------------------------------------
 .../corepersistence/CpEntityMapUtilsTest.java      |  4 +++-
 .../model/entity/EntityToMapConverter.java         |  5 ++++-
 .../apache/usergrid/rest/ApplicationsResource.java | 17 ++++++++++++-----
 .../org/apache/usergrid/rest/SystemResourceIT.java |  2 +-
 4 files changed, 20 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/bc3ce1b2/stack/core/src/test/java/org/apache/usergrid/corepersistence/CpEntityMapUtilsTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/corepersistence/CpEntityMapUtilsTest.java
b/stack/core/src/test/java/org/apache/usergrid/corepersistence/CpEntityMapUtilsTest.java
index 1656fa6..f9c6da6 100644
--- a/stack/core/src/test/java/org/apache/usergrid/corepersistence/CpEntityMapUtilsTest.java
+++ b/stack/core/src/test/java/org/apache/usergrid/corepersistence/CpEntityMapUtilsTest.java
@@ -96,7 +96,9 @@ public class CpEntityMapUtilsTest {
         }};
 
         Entity cpEntity = CpEntityMapUtils.fromMap( properties, "user", true );
-        assertUserWithBlocks( cpEntity );
+        assertUserWithBlocks(cpEntity);
+        Map<String,Object> map = CpEntityMapUtils.toMap(cpEntity);
+        cpEntity = CpEntityMapUtils.fromMap(map,"user", true);
     }
 
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/bc3ce1b2/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/entity/EntityToMapConverter.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/entity/EntityToMapConverter.java
b/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/entity/EntityToMapConverter.java
index 9eb50c7..a3c37e3 100644
--- a/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/entity/EntityToMapConverter.java
+++ b/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/entity/EntityToMapConverter.java
@@ -85,7 +85,10 @@ public class EntityToMapConverter {
                     o = objectMapper.readValue( serilizedObj, bf.getClassinfo() );
                 }
                 catch ( IOException e ) {
-                    throw new RuntimeException( "Can't deserialize object ", e );
+                    throw new RuntimeException( "Can't deserialize object from field:"
+                        + field.getName()+ " classinfo: " + bf.getClassinfo()
+                        + " byteArray of length:" + serilizedObj.length
+                        , e );
                 }
                 entityMap.put( bf.getName(), o );
             }else if (field instanceof SerializedObjectField) {

http://git-wip-us.apache.org/repos/asf/usergrid/blob/bc3ce1b2/stack/rest/src/main/java/org/apache/usergrid/rest/ApplicationsResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/ApplicationsResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/ApplicationsResource.java
index 4504387..86adbcc 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/ApplicationsResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/ApplicationsResource.java
@@ -20,6 +20,8 @@
 package org.apache.usergrid.rest;
 
 import com.sun.jersey.api.json.JSONWithPadding;
+import org.apache.usergrid.persistence.Entity;
+import org.apache.usergrid.persistence.EntityManager;
 import org.apache.usergrid.rest.security.annotations.RequireSystemAccess;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -61,19 +63,24 @@ public class ApplicationsResource extends AbstractContextResource {
     @Path( "{applicationId}" )
     public JSONWithPadding clearApplication( @Context UriInfo ui,
                                              @PathParam("applicationId") UUID applicationId,
-                                             @QueryParam( "confirmApplicationId" ) UUID confirmApplicationId,
+                                             @QueryParam( "confirmApplicationName" ) String
confirmApplicationName,
                                              @QueryParam( "callback" ) @DefaultValue( "callback"
) String callback )
         throws Exception {
 
-        if(confirmApplicationId == null || !confirmApplicationId.equals(applicationId)){
-            throw new IllegalArgumentException("please make confirmApplicationId equal to
applicationId");
+        if(confirmApplicationName == null){
+            throw new IllegalArgumentException("please make add a QueryString for confirmApplicationName");
         }
 
-        ApiResponse response = createApiResponse();
+        final EntityManager em =  emf.getEntityManager(applicationId);
+        final String name =  em.getApplication().getApplicationName();
+        if(!name.toLowerCase().equals(confirmApplicationName.toLowerCase())){
+            throw new IllegalArgumentException("confirmApplicationName: " + confirmApplicationName
+ " does not equal " + name);
+        }
+        final ApiResponse response = createApiResponse();
         response.setAction( "clear application" );
 
         logger.info( "clearing up application" );
-        AtomicInteger itemsDeleted = new AtomicInteger(0);
+        final AtomicInteger itemsDeleted = new AtomicInteger(0);
         try {
             management.deleteAllEntities(applicationId)
                 .count()

http://git-wip-us.apache.org/repos/asf/usergrid/blob/bc3ce1b2/stack/rest/src/test/java/org/apache/usergrid/rest/SystemResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/SystemResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/SystemResourceIT.java
index 93f8eca..83e29fa 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/SystemResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/SystemResourceIT.java
@@ -60,7 +60,7 @@ public class SystemResourceIT extends AbstractRestIT {
         this.refreshIndex();
         QueryParameters queryParameters = new QueryParameters();
         queryParameters.addParam( "access_token", clientSetup.getSuperuserToken().getAccessToken()
);
-        queryParameters.addParam("confirmApplicationId", this.clientSetup.getAppUuid());
+        queryParameters.addParam("confirmApplicationName", this.clientSetup.getAppName());
 
         org.apache.usergrid.rest.test.resource.model.ApiResponse result = clientSetup.getRestClient().system().applications(this.clientSetup.getAppUuid()).delete(
queryParameters);
 


Mime
View raw message