You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by gr...@apache.org on 2015/11/18 00:47:18 UTC

[03/21] usergrid git commit: Fix no-org-delete and test.

Fix no-org-delete and test.


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

Branch: refs/heads/master
Commit: 59d2a71c761e1419d143acafd02a08f80a3293eb
Parents: 1434dea
Author: Dave Johnson <sn...@apache.org>
Authored: Fri Nov 13 12:52:39 2015 -0500
Committer: Dave Johnson <sn...@apache.org>
Committed: Fri Nov 13 12:52:39 2015 -0500

----------------------------------------------------------------------
 .../management/organizations/OrganizationResource.java    |  9 +++++++++
 .../apache/usergrid/rest/management/OrganizationsIT.java  | 10 +++++-----
 2 files changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/59d2a71c/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 e1fde46..12fbc63 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
@@ -20,6 +20,7 @@ package org.apache.usergrid.rest.management.organizations;
 import com.fasterxml.jackson.jaxrs.json.annotation.JSONP;
 import org.apache.amber.oauth2.common.exception.OAuthSystemException;
 import org.apache.commons.lang.NullArgumentException;
+import org.apache.usergrid.exception.NotImplementedException;
 import org.apache.usergrid.management.ActivationState;
 import org.apache.usergrid.management.OrganizationConfig;
 import org.apache.usergrid.management.OrganizationInfo;
@@ -420,4 +421,12 @@ public class OrganizationResource extends AbstractContextResource {
         return response;
     }
 
+
+    /** Delete organization is not yet supported */
+    //@RequireSystemAccess
+    @DELETE
+    public ApiResponse deleteOrganization() throws Exception {
+        throw new NotImplementedException();
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/59d2a71c/stack/rest/src/test/java/org/apache/usergrid/rest/management/OrganizationsIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/OrganizationsIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/OrganizationsIT.java
index 72a2f8c..3acdfd5 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/OrganizationsIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/OrganizationsIT.java
@@ -31,6 +31,7 @@ import org.apache.usergrid.rest.test.resource.AbstractRestIT;
 import org.apache.usergrid.rest.test.resource.RestClient;
 
 import javax.ws.rs.ClientErrorException;
+import javax.ws.rs.ServerErrorException;
 import javax.ws.rs.core.Form;
 import javax.ws.rs.core.Response;
 
@@ -291,18 +292,17 @@ public class OrganizationsIT extends AbstractRestIT {
 
     /**
      * Returns error from unimplemented delete method by trying to call the delete organization endpoint
-     * @throws IOException
      */
-    @Ignore("It should return a 501, so when this is fixed the test can be run")
     @Test
     public void noOrgDelete() throws IOException {
 
         try {
-            //Delete default organization
+            // attempt to delete default organization
             clientSetup.getRestClient().management().orgs().org( clientSetup.getOrganizationName() ).delete();
             fail( "Delete is not implemented yet" );
-        }catch(ClientErrorException uie){
-            assertEquals( Response.Status.NOT_IMPLEMENTED ,uie.getResponse().getStatus());
+
+        } catch( ServerErrorException see ){
+            assertEquals( Response.Status.NOT_IMPLEMENTED.getStatusCode(), see.getResponse().getStatus());
         }
     }