Skip to content

Commit

Permalink
openstack-keystone extensibility
Browse files Browse the repository at this point in the history
  • Loading branch information
grkvlt committed Aug 12, 2012
1 parent 4fad770 commit 6c9524d
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ public interface ServiceApi {
/**
* The operation returns a list of tenants which the current token provides access to.
*/
Set<Tenant> listTenants();
Set<? extends Tenant> listTenants();
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ public interface ServiceAsyncApi {
@Path("/tenants")
@RequestFilters(AuthenticateRequest.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Tenant>> listTenants();
ListenableFuture<? extends Set<? extends Tenant>> listTenants();
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public interface TenantApi {
/**
* The operation returns a list of tenants which the current token provides access to.
*/
Set<Tenant> list();
Set<? extends Tenant> list();

/**
* Retrieve information about a tenant, by tenant ID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public interface TenantAsyncApi {
@Path("/tenants")
@RequestFilters(AuthenticateRequest.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Tenant>> list();
ListenableFuture<? extends Set<? extends Tenant>> list();

/** @see TenantApi#get(String) */
@GET
Expand All @@ -71,7 +71,7 @@ public interface TenantAsyncApi {
@Path("/tenants/{tenantId}")
@RequestFilters(AuthenticateRequest.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Tenant> get(@PathParam("tenantId") String tenantId);
ListenableFuture<? extends Tenant> get(@PathParam("tenantId") String tenantId);

/** @see TenantApi#getByName(String) */
@GET
Expand All @@ -80,6 +80,6 @@ public interface TenantAsyncApi {
@Path("/tenants")
@RequestFilters(AuthenticateRequest.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Tenant> getByName(@QueryParam("name") String tenantName);
ListenableFuture<? extends Tenant> getByName(@QueryParam("name") String tenantName);

}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ public interface TokenApi {
*
* @return the set of endpoints
*/
Set<Endpoint> listEndpointsForToken(String token);
Set<? extends Endpoint> listEndpointsForToken(String token);

}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public interface TokenAsyncApi {
@Path("/tokens/{token}")
@RequestFilters(AuthenticateRequest.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Token> get(@PathParam("token") String token);
ListenableFuture<? extends Token> get(@PathParam("token") String token);

/** @see TokenApi#getUserOfToken(String) */
@GET
Expand All @@ -73,7 +73,7 @@ public interface TokenAsyncApi {
@Path("/tokens/{token}")
@RequestFilters(AuthenticateRequest.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<User> getUserOfToken(@PathParam("token") String token);
ListenableFuture<? extends User> getUserOfToken(@PathParam("token") String token);

/** @see TokenApi#isValid(String) */
@HEAD
Expand All @@ -89,6 +89,6 @@ public interface TokenAsyncApi {
@Path("/tokens/{token}/endpoints")
@RequestFilters(AuthenticateRequest.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Endpoint>> listEndpointsForToken(@PathParam("token") String token);
ListenableFuture<? extends Set<? extends Endpoint>> listEndpointsForToken(@PathParam("token") String token);

}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public interface UserApi {
*
* @return the list of users
*/
Set<User> list();
Set<? extends User> list();

/**
* Retrieve information about a user, by user ID
Expand All @@ -73,13 +73,13 @@ public interface UserApi {
*
* @return the set of Roles granted to the user
*/
Set<Role> listRolesOfUser(String userId);
Set<? extends Role> listRolesOfUser(String userId);

/**
* List the roles a user has been granted on a specific tenant
*
* @return the set of roles
*/
Set<Role> listRolesOfUserOnTenant(String userId, String tenantId);
Set<? extends Role> listRolesOfUserOnTenant(String userId, String tenantId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public interface UserAsyncApi {
@Path("/users")
@RequestFilters(AuthenticateRequest.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<User>> list();
ListenableFuture<? extends Set<? extends User>> list();

/** @see UserApi#get(String) */
@GET
Expand All @@ -70,7 +70,7 @@ public interface UserAsyncApi {
@Path("/users/{userId}")
@RequestFilters(AuthenticateRequest.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<User> get(@PathParam("userId") String userId);
ListenableFuture<? extends User> get(@PathParam("userId") String userId);

/** @see UserApi#getByName(String) */
@GET
Expand All @@ -79,7 +79,7 @@ public interface UserAsyncApi {
@Path("/users")
@RequestFilters(AuthenticateRequest.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<User> getByName(@QueryParam("name") String userName);
ListenableFuture<? extends User> getByName(@QueryParam("name") String userName);

/** @see UserApi#listRolesOfUser(String) */
@GET
Expand All @@ -88,7 +88,7 @@ public interface UserAsyncApi {
@Path("/users/{userId}/roles")
@RequestFilters(AuthenticateRequest.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Role>> listRolesOfUser(@PathParam("userId") String userId);
ListenableFuture<? extends Set<? extends Role>> listRolesOfUser(@PathParam("userId") String userId);

/** @see UserApi#listRolesOfUserOnTenant(String, String) */
@GET
Expand All @@ -97,5 +97,5 @@ public interface UserAsyncApi {
@Path("/tenants/{tenantId}/users/{userId}/roles")
@RequestFilters(AuthenticateRequest.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Role>> listRolesOfUserOnTenant(@PathParam("userId") String userId, @PathParam("tenantId") String tenantId);
ListenableFuture<? extends Set<? extends Role>> listRolesOfUserOnTenant(@PathParam("userId") String userId, @PathParam("tenantId") String tenantId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void testListTenants() {
HttpResponse.builder().statusCode(200)
.payload(payloadFromResourceWithContentType("/tenant_list.json", APPLICATION_JSON)).build())
.getServiceApi();
Set<Tenant> tenants = api.listTenants();
Set<? extends Tenant> tenants = api.listTenants();
assertNotNull(tenants);
assertFalse(tenants.isEmpty());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class ServiceApiLiveTest extends BaseKeystoneApiLiveTest {

public void testTenants() {
ServiceApi api = keystoneContext.getApi().getServiceApi();
Set<Tenant> result = api.listTenants();
Set<? extends Tenant> result = api.listTenants();
assertNotNull(result);
assertFalse(result.isEmpty());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void testListTenants() {
HttpResponse.builder().statusCode(200).payload(
payloadFromResourceWithContentType("/tenant_list.json", APPLICATION_JSON)).build())
.getTenantApi().get();
Set<Tenant> tenants = api.list();
Set<? extends Tenant> tenants = api.list();
assertNotNull(tenants);
assertFalse(tenants.isEmpty());

Expand All @@ -74,7 +74,7 @@ public void testListTenantsATT() {
HttpResponse.builder().statusCode(200).payload(
payloadFromResourceWithContentType("/tenant_list_att.json", APPLICATION_JSON)).build())
.getTenantApi().get();
Set<Tenant> tenants = api.list();
Set<? extends Tenant> tenants = api.list();
assertNotNull(tenants);
assertFalse(tenants.isEmpty());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class TenantApiLiveTest extends BaseKeystoneApiLiveTest {

public void testTenants() {
TenantApi api = keystoneContext.getApi().getTenantApi().get();
Set<Tenant> result = api.list();
Set<? extends Tenant> result = api.list();
assertNotNull(result);
assertFalse(result.isEmpty());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void testGetEndpointsForToken() {
authenticatedGET().endpoint(endpoint + "/v2.0/tokens/XXXXXX/endpoints").build(),
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/user_endpoints.json", APPLICATION_JSON)).build())
.getTokenApi().get();
Set<Endpoint> endpoints = api.listEndpointsForToken("XXXXXX");
Set<? extends Endpoint> endpoints = api.listEndpointsForToken("XXXXXX");

assertEquals(endpoints, ImmutableSet.of(
Endpoint.builder().publicURL(URI.create("https://csnode.jclouds.org/v2.0/"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void testInvalidToken() {
public void testTokenEndpoints() {

TokenApi api = keystoneContext.getApi().getTokenApi().get();
Set<Endpoint> endpoints = api.listEndpointsForToken(token);
Set<? extends Endpoint> endpoints = api.listEndpointsForToken(token);
assertNotNull(endpoints);
assertFalse(endpoints.isEmpty());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void testListUsers() {
authenticatedGET().endpoint(endpoint + "/v2.0/users").build(),
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/user_list.json", APPLICATION_JSON)).build())
.getUserApi().get();
Set<User> users = api.list();
Set<? extends User> users = api.list();
assertNotNull(users);
assertFalse(users.isEmpty());

Expand Down Expand Up @@ -123,7 +123,7 @@ public void testListRolesOfUser() {
authenticatedGET().endpoint(endpoint + "/v2.0/users/3f6c1c9ba993495ead7d2eb2192e284f/roles").build(),
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/user_role_list.json", APPLICATION_JSON)).build())
.getUserApi().get();
Set<Role> roles = api.listRolesOfUser("3f6c1c9ba993495ead7d2eb2192e284f");
Set<? extends Role> roles = api.listRolesOfUser("3f6c1c9ba993495ead7d2eb2192e284f");
assertNotNull(roles);
assertFalse(roles.isEmpty());
assertEquals(roles, ImmutableSet.of(
Expand Down Expand Up @@ -154,7 +154,7 @@ public void testListRolesOfUserInTenant() {
authenticatedGET().endpoint(endpoint + "/v2.0/users/3f6c1c9ba993495ead7d2eb2192e284f/roles").build(),
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/user_tenant_role_list.json", APPLICATION_JSON)).build())
.getUserApi().get();
Set<Role> roles = api.listRolesOfUser("3f6c1c9ba993495ead7d2eb2192e284f");
Set<? extends Role> roles = api.listRolesOfUser("3f6c1c9ba993495ead7d2eb2192e284f");
assertNotNull(roles);
assertFalse(roles.isEmpty());
assertEquals(roles, ImmutableSet.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class UserApiLiveTest extends BaseKeystoneApiLiveTest {
public void testUsers() {

UserApi api = keystoneContext.getApi().getUserApi().get();
Set<User> users = api.list();
Set<? extends User> users = api.list();
assertNotNull(users);
assertFalse(users.isEmpty());
for (User user : users) {
Expand All @@ -54,12 +54,12 @@ public void testUsers() {
public void testUserRolesOnTenant() {

UserApi api = keystoneContext.getApi().getUserApi().get();
Set<User> users = api.list();
Set<Tenant> tenants = keystoneContext.getApi().getTenantApi().get().list();
Set<? extends User> users = api.list();
Set<? extends Tenant> tenants = keystoneContext.getApi().getTenantApi().get().list();

for (User user : users) {
for (Tenant tenant : tenants) {
Set<Role> roles = api.listRolesOfUserOnTenant(user.getId(), tenant.getId());
Set<? extends Role> roles = api.listRolesOfUserOnTenant(user.getId(), tenant.getId());
for (Role role : roles) {
assertNotNull(role.getId());
}
Expand All @@ -72,7 +72,7 @@ public void testListRolesOfUser() {

UserApi api = keystoneContext.getApi().getUserApi().get();
for (User user : api.list()) {
Set<Role> roles = api.listRolesOfUser(user.getId());
Set<? extends Role> roles = api.listRolesOfUser(user.getId());
for (Role role : roles) {
assertNotNull(role.getId());
}
Expand Down

0 comments on commit 6c9524d

Please sign in to comment.