Return-Path: X-Original-To: apmail-usergrid-commits-archive@minotaur.apache.org Delivered-To: apmail-usergrid-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CF86310E77 for ; Wed, 4 Mar 2015 22:38:56 +0000 (UTC) Received: (qmail 2511 invoked by uid 500); 4 Mar 2015 22:38:56 -0000 Delivered-To: apmail-usergrid-commits-archive@usergrid.apache.org Received: (qmail 2458 invoked by uid 500); 4 Mar 2015 22:38:56 -0000 Mailing-List: contact commits-help@usergrid.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@usergrid.incubator.apache.org Delivered-To: mailing list commits@usergrid.incubator.apache.org Received: (qmail 2366 invoked by uid 99); 4 Mar 2015 22:38:56 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Mar 2015 22:38:56 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 7B9A0E03C8; Wed, 4 Mar 2015 22:38:56 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sfeldman@apache.org To: commits@usergrid.apache.org Date: Wed, 04 Mar 2015 22:39:00 -0000 Message-Id: In-Reply-To: <9f67f0ff715f46e592508a1b4b84a98f@git.apache.org> References: <9f67f0ff715f46e592508a1b4b84a98f@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [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 Authored: Tue Jan 13 10:01:55 2015 -0800 Committer: grey 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 data = new HashMap(); -// 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 passwordPayload = new HashMap(); + 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.