This repository has been archived by the owner on Jan 5, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'gerey/USERGRID-280' into apache_usergri…
…d/two-dot-o Conflicts: stack/rest/src/test/resources/usergrid-custom-test.properties
- Loading branch information
Showing
8 changed files
with
899 additions
and
655 deletions.
There are no files selected for viewing
1,342 changes: 690 additions & 652 deletions
1,342
stack/rest/src/test/java/org/apache/usergrid/rest/management/AdminUsersIT.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
.../test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/FeedResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* | ||
* * 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.endpoints.mgmt; | ||
|
||
|
||
import javax.ws.rs.core.MediaType; | ||
|
||
import org.apache.usergrid.rest.test.resource2point0.endpoints.NamedResource; | ||
import org.apache.usergrid.rest.test.resource2point0.endpoints.UrlResource; | ||
import org.apache.usergrid.rest.test.resource2point0.model.ApiResponse; | ||
import org.apache.usergrid.rest.test.resource2point0.model.Entity; | ||
import org.apache.usergrid.rest.test.resource2point0.state.ClientContext; | ||
|
||
|
||
/** | ||
* Contains the REST methods to interacting with the ManagementEndpoints | ||
* and the user feeds | ||
*/ | ||
public class FeedResource extends NamedResource { | ||
public FeedResource(final ClientContext context, final UrlResource parent) { | ||
super ( "feed",context, parent); | ||
} | ||
|
||
public Entity get() { | ||
return getResource( true ).type( MediaType.APPLICATION_JSON_TYPE ) | ||
.accept( MediaType.APPLICATION_JSON ).get( Entity.class); | ||
|
||
|
||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
...t/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/PasswordResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* 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. | ||
*/ | ||
package org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt; | ||
|
||
|
||
import java.util.Map; | ||
|
||
import javax.ws.rs.core.MediaType; | ||
|
||
import org.apache.usergrid.rest.test.resource2point0.endpoints.NamedResource; | ||
import org.apache.usergrid.rest.test.resource2point0.endpoints.UrlResource; | ||
import org.apache.usergrid.rest.test.resource2point0.model.ApiResponse; | ||
import org.apache.usergrid.rest.test.resource2point0.model.Entity; | ||
import org.apache.usergrid.rest.test.resource2point0.model.Token; | ||
import org.apache.usergrid.rest.test.resource2point0.state.ClientContext; | ||
|
||
import com.sun.jersey.api.client.WebResource; | ||
|
||
|
||
/** | ||
* Relations to the following endpoint | ||
* /management/users/"username"/password | ||
* Allows admin users to change their passwords | ||
*/ | ||
public class PasswordResource extends NamedResource { | ||
|
||
public PasswordResource( final ClientContext context, final UrlResource parent ) { | ||
super( "password", context, parent ); | ||
} | ||
|
||
public Entity post(Token token, Map<String,Object> payload){ | ||
WebResource resource; | ||
|
||
if(token != null) { | ||
resource = getResource( true, token ); | ||
} | ||
else | ||
resource = getResource( true ); | ||
|
||
return resource.type( MediaType.APPLICATION_JSON_TYPE ) | ||
.accept( MediaType.APPLICATION_JSON ).post( Entity.class, payload ); | ||
} | ||
|
||
public Entity post(Map<String, Object> payload){ | ||
return post( null, payload ); | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
.../test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/UserResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* 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. | ||
*/ | ||
package org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt; | ||
|
||
import javax.ws.rs.core.MediaType; | ||
|
||
import org.apache.usergrid.rest.test.resource2point0.endpoints.NamedResource; | ||
import org.apache.usergrid.rest.test.resource2point0.endpoints.UrlResource; | ||
import org.apache.usergrid.rest.test.resource2point0.model.ApiResponse; | ||
import org.apache.usergrid.rest.test.resource2point0.model.Entity; | ||
import org.apache.usergrid.rest.test.resource2point0.state.ClientContext; | ||
|
||
import com.sun.jersey.api.client.WebResource; | ||
|
||
|
||
/** | ||
* Relations to the following endpoint | ||
* /management/users/"username" | ||
* Store endpoints relating to specific users | ||
*/ | ||
public class UserResource extends NamedResource { | ||
|
||
public UserResource( final String name, final ClientContext context, final UrlResource parent ) { | ||
super( name, context, parent ); | ||
} | ||
|
||
public PasswordResource password() { | ||
return new PasswordResource( context, this ); | ||
} | ||
|
||
public FeedResource feed() { | ||
return new FeedResource( context, this ); | ||
} | ||
|
||
public Entity get() { | ||
WebResource resource = getResource( true ); | ||
ApiResponse response = resource.type( MediaType.APPLICATION_JSON_TYPE ) | ||
.accept( MediaType.APPLICATION_JSON ).get( ApiResponse.class ); | ||
return new Entity(response); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters