usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject incubator-usergrid git commit: change org owner to Organization
Date Mon, 15 Dec 2014 18:35:46 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/UG-rest-test-framework-overhaul 2582aa334 -> 2983fe5e4


change org owner to Organization


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

Branch: refs/heads/UG-rest-test-framework-overhaul
Commit: 2983fe5e4665dc91ad3573af394567a22fb853a0
Parents: 2582aa3
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Mon Dec 15 11:35:37 2014 -0700
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Mon Dec 15 11:35:37 2014 -0700

----------------------------------------------------------------------
 .../rest/management/OrganizationsIT.java        |  2 +-
 .../rest/test/resource2point0/ClientSetup.java  |  2 +-
 .../endpoints/ApplicationResource.java          | 65 ++++++++++++++++++--
 .../endpoints/mgmt/OrgResource.java             | 24 +++++++-
 .../resource2point0/model/Organization.java     |  9 +++
 5 files changed, 92 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2983fe5e/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 ae6a396..4adc6ef 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
@@ -84,7 +84,7 @@ public class OrganizationsIT extends AbstractRestIT {
         //TODO:seperate entity properties from organization properties.
         //organization.addProperty( "" ).addProperty(  )
 
-        OrgOwner orgOwner = clientSetup.getRestClient().management().orgs().post( organization
);
+        Organization orgOwner = clientSetup.getRestClient().management().orgs().post( organization
);
 
         assertNotNull( orgOwner );
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2983fe5e/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/ClientSetup.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/ClientSetup.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/ClientSetup.java
index fa0afdd..7beb083 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/ClientSetup.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/ClientSetup.java
@@ -82,7 +82,7 @@ public class ClientSetup implements TestRule {
 //TODO: also create a new application
         Organization organization = new Organization( username,username,username+"@usergrid.com",username,username,null
 );
 
-        OrgOwner orgOwner = restClient.management().orgs().post( organization );
+        Organization orgOwner = restClient.management().orgs().post( organization );
         //ApiResponse response = restClient.management().orgs().post( mapOrganization(username,username,username+"@usergrid.com",username,username
) );
         System.out.println();
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2983fe5e/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/ApplicationResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/ApplicationResource.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/ApplicationResource.java
index f4ab4d9..d075df1 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/ApplicationResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/ApplicationResource.java
@@ -37,20 +37,73 @@ public class ApplicationResource extends NamedResource {
     }
 
 
+
+
+    public Application post(Application application){
+        ApiResponse response = getResource().type( MediaType.APPLICATION_JSON_TYPE ).accept(
MediaType.APPLICATION_JSON )
+                .post( ApiResponse.class, application );
+
+        return new Application(response);
+
+    }
+
+    public Application put(Application application){
+        ApiResponse response = getResource().type( MediaType.APPLICATION_JSON_TYPE ).accept(
MediaType.APPLICATION_JSON )
+                .put( ApiResponse.class, application );
+
+        return new Application(response);
+
+    }
+
+
+    public Application get(){
+        ApiResponse response = getResource().type( MediaType.APPLICATION_JSON_TYPE ).accept(
MediaType.APPLICATION_JSON )
+                .get(ApiResponse.class);
+
+        return new Application(response);
+
+    }
+
+    public void delete(Application application){
+        ApiResponse response = getResource().type( MediaType.APPLICATION_JSON_TYPE ).accept(
MediaType.APPLICATION_JSON )
+                .delete( ApiResponse.class );
+    }
+
+
     /**
      * Currently hardcoded to users, this is because we expect to create and chain different
cases of collections.
      * The pattern should look like: orgs.apps.users , orgs.apps.groups and so on...
      * @return
      */
     public Collection users(){
-           return new Collection("users", context , this);
-        }
+        return new Collection("users", context , this);
+    }
 
-    public Application post(Application application){
-        ApiResponse response = getResource().type( MediaType.APPLICATION_JSON_TYPE ).accept(
MediaType.APPLICATION_JSON )
-                .post( ApiResponse.class, application );
+    /**
+     * Currently hardcoded to users, this is because we expect to create and chain different
cases of collections.
+     * The pattern should look like: orgs.apps.users , orgs.apps.groups and so on...
+     * @return
+     */
+    public Collection roles(){
+        return new Collection("roles", context , this);
+    }
 
-        return new Application(response);
+    /**
+     * Currently hardcoded to users, this is because we expect to create and chain different
cases of collections.
+     * The pattern should look like: orgs.apps.users , orgs.apps.groups and so on...
+     * @return
+     */
+    public Collection permissions(){
+        return new Collection("permissions", context , this);
+    }
 
+    /**
+     * Currently hardcoded to users, this is because we expect to create and chain different
cases of collections.
+     * The pattern should look like: orgs.apps.users , orgs.apps.groups and so on...
+     * @return
+     */
+    public Collection notifications(){
+        return new Collection("notifications", context , this);
     }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2983fe5e/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/OrgResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/OrgResource.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/OrgResource.java
index 2fca7f3..2436c9f 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/OrgResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/OrgResource.java
@@ -47,13 +47,33 @@ public class OrgResource  extends NamedResource {
     //TODO: why take in a map? Just use base resource and call post from there,
     //TODO: Why ApiResponse when we could just type what we expect back.
     //TODO: wouldn't a user be part of an organization in this sense? They get passed in
together, they should be torn out together
-    public OrgOwner post(Organization organization){
+    public Organization post(Organization organization){
         ApiResponse response = getResource().type( MediaType.APPLICATION_JSON_TYPE ).accept(
MediaType.APPLICATION_JSON )
                      .post( ApiResponse.class,organization );
 
         organization = new Organization(response);
+        organization.setOwner(new User( response ));
+        return organization;
+    }
+
+    public Organization put(Organization organization){
+        ApiResponse response = getResource().type( MediaType.APPLICATION_JSON_TYPE ).accept(
MediaType.APPLICATION_JSON )
+                .put(ApiResponse.class, organization);
+
+        return new Organization(response);
 
-        return new OrgOwner(organization,new User( response ));
     }
 
+    public Organization get(){
+        ApiResponse response = getResource().type( MediaType.APPLICATION_JSON_TYPE ).accept(
MediaType.APPLICATION_JSON )
+                .get(ApiResponse.class);
+
+       return new Organization(response);
+    }
+
+    public void delete(){
+        ApiResponse response = getResource().type( MediaType.APPLICATION_JSON_TYPE ).accept(
MediaType.APPLICATION_JSON )
+                .delete(ApiResponse.class);
+
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2983fe5e/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Organization.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Organization.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Organization.java
index 9f53627..a4719f8 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Organization.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Organization.java
@@ -35,6 +35,8 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
  */
 public class Organization extends Entity {
 
+    private User user;
+
     public Organization() {
 
     }
@@ -86,4 +88,11 @@ public class Organization extends Entity {
     public Object getPasswordHistorySize() {
         return  (Integer) this.get("passwordHistorySize");
     }
+
+    public User getOwner(){
+        return user;
+    }
+    public void setOwner(User user){
+        this.user = user;
+    }
 }


Mime
View raw message