You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2015/02/26 16:43:15 UTC

[12/24] incubator-usergrid git commit: [USERGRID-333] cleaning up Credentials

[USERGRID-333] cleaning up Credentials


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

Branch: refs/heads/USERGRID-273
Commit: 29316b2b371bbe42013824e4ffd68564606e1090
Parents: 11a0aef
Author: ryan bridges <rb...@apigee.com>
Authored: Fri Feb 13 14:35:40 2015 -0500
Committer: ryan bridges <rb...@apigee.com>
Committed: Fri Feb 13 14:35:40 2015 -0500

----------------------------------------------------------------------
 .../test/resource2point0/model/Credentials.java | 50 +++++++++++---------
 1 file changed, 28 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/29316b2b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Credentials.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Credentials.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Credentials.java
index 8a9bfc4..9244e83 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Credentials.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Credentials.java
@@ -1,3 +1,23 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  *  contributor license agreements.  The ASF licenses this file to You
+ *  * under the Apache License, Version 2.0 (the "License"); you may not
+ *  * use this file except in compliance with the License.
+ *  * You may obtain a copy of the License at
+ *  *
+ *  *     http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software
+ *  * distributed under the License is distributed on an "AS IS" BASIS,
+ *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  * See the License for the specific language governing permissions and
+ *  * limitations under the License.  For additional information regarding
+ *  * copyright in this work, please see the NOTICE file in the top level
+ *  * directory of this distribution.
+ *
+ */
+
 package org.apache.usergrid.rest.test.resource2point0.model;
 
 import java.util.Map;
@@ -5,34 +25,20 @@ import java.util.Map;
 /**
  */
 public class Credentials extends Entity {
-    private String clientId;
-    private String clientSecret;
-
+    public Credentials(){}
     public Credentials(ApiResponse response) {
-        super(response);
-        Map<String, Object> properties = response.getProperties();
-        if (properties.containsKey("credentials")) {
-            Map<String, String> credentials = (Map<String, String>) properties.get("credentials");
-            this.setClientId(credentials.get("client_id"));
-            this.setClientSecret(credentials.get("client_secret"));
-        }
+        setResponse( response, "credentials");
     }
-
-    public String getClientSecret() {
-        return clientSecret;
+    public Credentials mapOrgResponse(Map<String,Object> map){
+        putAll((Map<String, Object>) map.get("credentials"));
+        return this;
     }
 
-    public void setClientSecret(String clientSecret) {
-        this.clientSecret = clientSecret;
+    public String getClientSecret() {
+        return (String)get("secret");
     }
 
     public String getClientId() {
-        return clientId;
-    }
-
-    public void setClientId(String clientId) {
-        this.clientId = clientId;
+        return (String)get("id");
     }
-
-
 }