You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2015/03/04 23:39:00 UTC

[05/38] incubator-usergrid git commit: did some cleanup on commented out code. Commented back in a couple more of the tests that need updating.

did some cleanup on commented out code. Commented back in a couple more of the tests that need updating.


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

Branch: refs/heads/USERGRID-432
Commit: 0e17c53d7d8e7a8ee30b953a6b183d0f71c03de9
Parents: cbbb8bf
Author: grey <gr...@apigee.com>
Authored: Tue Jan 13 10:01:55 2015 -0800
Committer: grey <gr...@apigee.com>
Committed: Tue Jan 13 10:01:55 2015 -0800

----------------------------------------------------------------------
 .../usergrid/rest/management/AdminUsersIT.java  | 85 ++++++++++----------
 .../endpoints/mgmt/UsersResource.java           |  1 -
 2 files changed, 43 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/0e17c53d/stack/rest/src/test/java/org/apache/usergrid/rest/management/AdminUsersIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/AdminUsersIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/AdminUsersIT.java
index e576a6d..d9a250d 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/AdminUsersIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/AdminUsersIT.java
@@ -137,8 +137,6 @@ public class AdminUsersIT extends AbstractRestIT {
     @Test
     public void passwordMismatchErrorAdmin() {
 
-
-
         String username = clientSetup.getUsername();
         String password = clientSetup.getPassword();
 
@@ -149,10 +147,6 @@ public class AdminUsersIT extends AbstractRestIT {
 
         // change the password as admin. The old password isn't required
         management.users().user( username ).password().post( passwordPayload );
-//        JsonNode node = mapper.readTree( resource().path( "/management/users/test/password" ).accept( MediaType.APPLICATION_JSON )
-//                                                   .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, passwordPayload ));
-
-
 
         this.refreshIndex();
 
@@ -171,45 +165,52 @@ public class AdminUsersIT extends AbstractRestIT {
         }
 
     }
-//
-//
-//    /**
-//     * Checks that as a superuser (i.e with a superuser token ) we can change the password of a admin.
-//     * @throws IOException
-//     */
-//    @Test
-//    public void setAdminPasswordAsSysAdmin() throws IOException {
-//
-//        String superToken = superAdminToken();
-//
-//        String newPassword = "foo";
-//
-//        Map<String, String> data = new HashMap<String, String>();
-//        data.put( "newpassword", newPassword );
-//
-//        // change the password as admin. The old password isn't required
+
+
+    /**
+     * Checks that as a superuser (i.e with a superuser token ) we can change the password of a admin.
+     * @throws IOException
+     */
+    @Test
+    public void setAdminPasswordAsSysAdmin() throws IOException {
+
+        String username = clientSetup.getUsername();
+        String password = clientSetup.getPassword();
+
+        String superToken = superAdminToken();
+
+        String newPassword = "foo";
+
+        Map<String, Object> passwordPayload = new HashMap<String, Object>();
+        data.put( "newpassword", newPassword );
+
+
+        // change the password as admin. The old password isn't required
+        management.users().user( username ).password().post( passwordPayload );
+
+
 //        JsonNode node = mapper.readTree( resource().path( "/management/users/test/password" ).queryParam( "access_token", superToken )
 //                                                   .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
 //                                                   .post( String.class, data ));
-//
-//        assertNull( getError( node ) );
-//
-//        refreshIndex("test-organization", "test-app");
-//
-//        // log in with the new password
-//        String token = mgmtToken( "test", newPassword );
-//
-//        assertNotNull( token );
-//
-//        data.put( "newpassword", "test" );
-//
-//        // now change the password back
-//        node = mapper.readTree( resource().path( "/management/users/test/password" ).queryParam( "access_token", superToken )
-//                                          .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
-//                                          .post( String.class, data ));
-//
-//        assertNull( getError( node ) );
-//    }
+
+        assertNull( getError( node ) );
+
+        refreshIndex();
+
+        // log in with the new password
+        String token = mgmtToken( "test", newPassword );
+
+        assertNotNull( token );
+
+        data.put( "newpassword", "test" );
+
+        // now change the password back
+        node = mapper.readTree( resource().path( "/management/users/test/password" ).queryParam( "access_token", superToken )
+                                          .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
+                                          .post( String.class, data ));
+
+        assertNull( getError( node ) );
+    }
 //
 //    @Test
 //    public void mgmtUserFeed() throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/0e17c53d/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/UsersResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/UsersResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/UsersResource.java
index 7a9e5dd..b71247c 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/UsersResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/UsersResource.java
@@ -54,7 +54,6 @@ public class UsersResource extends NamedResource {
         return new UserResource( identifier, context, this );
     }
 
-
     public Entity post(Entity userPayload){
         WebResource resource = getResource(true);
 //TODO: need to parse the specific response gotten for admin entities. It is different from regular entities.