Merge pull request #780 from grkvlt/openstack

Openstack Extensibility
This commit is contained in:
Adrian Cole 2012-08-12 09:29:51 -07:00
commit b055fb1233
67 changed files with 170 additions and 147 deletions

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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

View File

@ -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
@ -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
@ -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);
}

View File

@ -72,6 +72,6 @@ public interface TokenApi {
*
* @return the set of endpoints
*/
Set<Endpoint> listEndpointsForToken(String token);
Set<? extends Endpoint> listEndpointsForToken(String token);
}

View File

@ -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
@ -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
@ -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);
}

View File

@ -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
@ -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);
}

View File

@ -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
@ -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
@ -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
@ -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
@ -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);
}

View File

@ -50,7 +50,7 @@ public class ServiceApiExpectTest extends BaseKeystoneRestApiExpectTest<Keystone
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());

View File

@ -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());

View File

@ -56,7 +56,7 @@ public class TenantApiExpectTest extends BaseKeystoneRestApiExpectTest<KeystoneA
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());
@ -74,7 +74,7 @@ public class TenantApiExpectTest extends BaseKeystoneRestApiExpectTest<KeystoneA
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());

View File

@ -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());

View File

@ -138,7 +138,7 @@ public class TokenApiExpectTest extends BaseKeystoneRestApiExpectTest<KeystoneAp
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/"))

View File

@ -82,7 +82,7 @@ public class TokenApiLiveTest extends BaseKeystoneApiLiveTest {
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());

View File

@ -56,7 +56,7 @@ public class UserApiExpectTest extends BaseKeystoneRestApiExpectTest<KeystoneApi
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());
@ -123,7 +123,7 @@ public class UserApiExpectTest extends BaseKeystoneRestApiExpectTest<KeystoneApi
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(
@ -154,7 +154,7 @@ public class UserApiExpectTest extends BaseKeystoneRestApiExpectTest<KeystoneApi
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(

View File

@ -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) {
@ -54,12 +54,12 @@ public class UserApiLiveTest extends BaseKeystoneApiLiveTest {
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());
}
@ -72,7 +72,7 @@ public class UserApiLiveTest extends BaseKeystoneApiLiveTest {
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());
}

View File

@ -100,98 +100,98 @@ public interface NovaApi {
* Provides synchronous access to Floating IP features.
*/
@Delegate
Optional<FloatingIPApi> getFloatingIPExtensionForZone(
Optional<? extends FloatingIPApi> getFloatingIPExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides synchronous access to Security Group features.
*/
@Delegate
Optional<SecurityGroupApi> getSecurityGroupExtensionForZone(
Optional<? extends SecurityGroupApi> getSecurityGroupExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides synchronous access to Key Pair features.
*/
@Delegate
Optional<KeyPairApi> getKeyPairExtensionForZone(
Optional<? extends KeyPairApi> getKeyPairExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides synchronous access to Host Administration features.
*/
@Delegate
Optional<HostAdministrationApi> getHostAdministrationExtensionForZone(
Optional<? extends HostAdministrationApi> getHostAdministrationExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides synchronous access to Simple Tenant Usage features.
*/
@Delegate
Optional<SimpleTenantUsageApi> getSimpleTenantUsageExtensionForZone(
Optional<? extends SimpleTenantUsageApi> getSimpleTenantUsageExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides synchronous access to Volume features.
*/
@Delegate
Optional<VolumeApi> getVolumeExtensionForZone(
Optional<? extends VolumeApi> getVolumeExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides synchronous access to Virtual Interface features.
*/
@Delegate
Optional<VirtualInterfaceApi> getVirtualInterfaceExtensionForZone(
Optional<? extends VirtualInterfaceApi> getVirtualInterfaceExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides synchronous access to Server Extra Data features.
*/
@Delegate
Optional<ServerWithSecurityGroupsApi> getServerWithSecurityGroupsExtensionForZone(
Optional<? extends ServerWithSecurityGroupsApi> getServerWithSecurityGroupsExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides synchronous access to Server Admin Actions features.
*/
@Delegate
Optional<AdminActionsApi> getAdminActionsExtensionForZone(
Optional<? extends AdminActionsApi> getAdminActionsExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides synchronous access to Aggregate features.
*/
@Delegate
Optional<HostAggregateApi> getHostAggregateExtensionForZone(
Optional<? extends HostAggregateApi> getHostAggregateExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides synchronous access to Flavor extra specs features.
*/
@Delegate
Optional<FlavorExtraSpecsApi> getFlavorExtraSpecsExtensionForZone(
Optional<? extends FlavorExtraSpecsApi> getFlavorExtraSpecsExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides synchronous access to Quota features.
*/
@Delegate
Optional<QuotaApi> getQuotaExtensionForZone(
Optional<? extends QuotaApi> getQuotaExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides synchronous access to Quota Classes features.
*/
@Delegate
Optional<QuotaClassApi> getQuotaClassExtensionForZone(
Optional<? extends QuotaClassApi> getQuotaClassExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides synchronous access to Volume Type features.
*/
@Delegate
Optional<VolumeTypeApi> getVolumeTypeExtensionForZone(
Optional<? extends VolumeTypeApi> getVolumeTypeExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
}

View File

@ -98,49 +98,49 @@ public interface NovaAsyncApi {
* Provides asynchronous access to Floating IP features.
*/
@Delegate
Optional<FloatingIPAsyncApi> getFloatingIPExtensionForZone(
Optional<? extends FloatingIPAsyncApi> getFloatingIPExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides asynchronous access to Security Group features.
*/
@Delegate
Optional<SecurityGroupAsyncApi> getSecurityGroupExtensionForZone(
Optional<? extends SecurityGroupAsyncApi> getSecurityGroupExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides asynchronous access to Key Pair features.
*/
@Delegate
Optional<KeyPairAsyncApi> getKeyPairExtensionForZone(
Optional<? extends KeyPairAsyncApi> getKeyPairExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides asynchronous access to Host Administration features.
*/
@Delegate
Optional<HostAdministrationAsyncApi> getHostAdministrationExtensionForZone(
Optional<? extends HostAdministrationAsyncApi> getHostAdministrationExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides asynchronous access to Simple Tenant Usage features.
*/
@Delegate
Optional<SimpleTenantUsageAsyncApi> getSimpleTenantUsageExtensionForZone(
Optional<? extends SimpleTenantUsageAsyncApi> getSimpleTenantUsageExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides asynchronous access to Volume features.
*/
@Delegate
Optional<VolumeAsyncApi> getVolumeExtensionForZone(
Optional<? extends VolumeAsyncApi> getVolumeExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides asynchronous access to Virtual Interface features.
*/
@Delegate
Optional<VirtualInterfaceAsyncApi> getVirtualInterfaceExtensionForZone(
Optional<? extends VirtualInterfaceAsyncApi> getVirtualInterfaceExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
@ -148,49 +148,49 @@ public interface NovaAsyncApi {
* Provides asynchronous access to Server Extra Data features.
*/
@Delegate
Optional<ServerWithSecurityGroupsAsyncApi> getServerWithSecurityGroupsExtensionForZone(
Optional<? extends ServerWithSecurityGroupsAsyncApi> getServerWithSecurityGroupsExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides asynchronous access to Server Admin Actions features.
*/
@Delegate
Optional<AdminActionsAsyncApi> getAdminActionsExtensionForZone(
Optional<? extends AdminActionsAsyncApi> getAdminActionsExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides asynchronous access to HostAggregate features.
*/
@Delegate
Optional<HostAggregateAsyncApi> getHostAggregateExtensionForZone(
Optional<? extends HostAggregateAsyncApi> getHostAggregateExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides asynchronous access to Flavor extra specs features.
*/
@Delegate
Optional<FlavorExtraSpecsAsyncApi> getFlavorExtraSpecsExtensionForZone(
Optional<? extends FlavorExtraSpecsAsyncApi> getFlavorExtraSpecsExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides asynchronous access to Quota features.
*/
@Delegate
Optional<QuotaAsyncApi> getQuotaExtensionForZone(
Optional<? extends QuotaAsyncApi> getQuotaExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides asynchronous access to Quota Classes features.
*/
@Delegate
Optional<QuotaClassAsyncApi> getQuotaClassExtensionForZone(
Optional<? extends QuotaClassAsyncApi> getQuotaClassExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides asynchronous access to Volume Type features.
*/
@Delegate
Optional<VolumeTypeAsyncApi> getVolumeTypeExtensionForZone(
Optional<? extends VolumeTypeAsyncApi> getVolumeTypeExtensionForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
}

View File

@ -135,7 +135,7 @@ public class NovaComputeService extends BaseComputeService {
}
private void cleanupOrphanedSecurityGroupsInZone(Set<String> groups, String zoneId) {
Optional<SecurityGroupApi> securityGroupApi = novaApi.getSecurityGroupExtensionForZone(zoneId);
Optional<? extends SecurityGroupApi> securityGroupApi = novaApi.getSecurityGroupExtensionForZone(zoneId);
if (securityGroupApi.isPresent()) {
for (String group : groups) {
for (SecurityGroup securityGroup : Iterables.filter(securityGroupApi.get().listSecurityGroups(),
@ -152,7 +152,7 @@ public class NovaComputeService extends BaseComputeService {
}
private void cleanupOrphanedKeyPairsInZone(Set<String> groups, String zoneId) {
Optional<KeyPairApi> keyPairApi = novaApi.getKeyPairExtensionForZone(zoneId);
Optional<? extends KeyPairApi> keyPairApi = novaApi.getKeyPairExtensionForZone(zoneId);
if (keyPairApi.isPresent()) {
for (String group : groups) {
for (Map<String, KeyPair> view : keyPairApi.get().listKeyPairs()) {

View File

@ -62,7 +62,7 @@ public class CreateSecurityGroupIfNeeded implements Function<ZoneSecurityGroupNa
checkNotNull(zoneSecurityGroupNameAndPorts, "zoneSecurityGroupNameAndPorts");
String zoneId = zoneSecurityGroupNameAndPorts.getZone();
Optional<SecurityGroupApi> api = novaApi.getSecurityGroupExtensionForZone(zoneId);
Optional<? extends SecurityGroupApi> api = novaApi.getSecurityGroupExtensionForZone(zoneId);
checkArgument(api.isPresent(), "Security groups are required, but the extension is not availablein zone %s!", zoneId);
logger.debug(">> creating securityGroup %s", zoneSecurityGroupNameAndPorts);
try {

View File

@ -59,7 +59,7 @@ public class CreateUniqueKeyPair extends CacheLoader<ZoneAndName, KeyPair> {
String zoneId = checkNotNull(zoneAndName, "zoneAndName").getZone();
String prefix = zoneAndName.getName();
Optional<KeyPairApi> api = novaApi.getKeyPairExtensionForZone(zoneId);
Optional<? extends KeyPairApi> api = novaApi.getKeyPairExtensionForZone(zoneId);
checkArgument(api.isPresent(), "Key pairs are required, but the extension is not available in zone %s!",
zoneId);

View File

@ -51,7 +51,7 @@ public class LoadFloatingIpsForInstance extends CacheLoader<ZoneAndId, Iterable<
@Override
public Iterable<FloatingIP> load(final ZoneAndId key) throws Exception {
String zone = key.getZone();
Optional<FloatingIPApi> ipApiOptional = api.getFloatingIPExtensionForZone(zone);
Optional<? extends FloatingIPApi> ipApiOptional = api.getFloatingIPExtensionForZone(zone);
if (ipApiOptional.isPresent()) {
return Iterables.filter(ipApiOptional.get().listFloatingIPs(),
new Predicate<FloatingIP>() {

View File

@ -129,12 +129,12 @@ public class NovaRestClientModule<S extends NovaApi, A extends NovaAsyncApi> ext
@Provides
@Singleton
public LoadingCache<String, Set<Extension>> provideExtensionsByZone(final Provider<NovaApi> novaApi) {
public LoadingCache<String, Set<? extends Extension>> provideExtensionsByZone(final Provider<NovaApi> novaApi) {
return CacheBuilder.newBuilder().expireAfterWrite(23, TimeUnit.HOURS)
.build(new CacheLoader<String, Set<Extension>>() {
.build(new CacheLoader<String, Set<? extends Extension>>() {
@Override
public Set<Extension> load(String key) throws Exception {
public Set<? extends Extension> load(String key) throws Exception {
return novaApi.get().getExtensionApiForZone(key).listExtensions();
}

View File

@ -42,7 +42,7 @@ public interface ExtensionApi {
*
* @return all extensions
*/
Set<Extension> listExtensions();
Set<? extends Extension> listExtensions();
/**
* Extensions may also be queried individually by their unique alias.

View File

@ -59,7 +59,7 @@ public interface ExtensionAsyncApi {
@Consumes(MediaType.APPLICATION_JSON)
@Path("/extensions")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Extension>> listExtensions();
ListenableFuture<? extends Set<? extends Extension>> listExtensions();
/**
* @see ExtensionApi#getExtensionByAlias
@ -69,6 +69,6 @@ public interface ExtensionAsyncApi {
@Consumes(MediaType.APPLICATION_JSON)
@Path("/extensions/{alias}")
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Extension> getExtensionByAlias(@PathParam("alias") String id);
ListenableFuture<? extends Extension> getExtensionByAlias(@PathParam("alias") String id);
}

View File

@ -43,7 +43,7 @@ public interface FlavorApi {
*
* @return all flavors (IDs, names, links)
*/
Set<Resource> listFlavors();
Set<? extends Resource> listFlavors();
/**
* List all flavors (all details)

View File

@ -61,7 +61,7 @@ public interface FlavorAsyncApi {
@Consumes(MediaType.APPLICATION_JSON)
@Path("/flavors")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Resource>> listFlavors();
ListenableFuture<? extends Set<? extends Resource>> listFlavors();
/**
* @see FlavorApi#listFlavorsInDetail

View File

@ -43,7 +43,7 @@ public interface ImageApi {
*
* @return all images (IDs, names, links)
*/
Set<Resource> listImages();
Set<? extends Resource> listImages();
/**
* List all images (all details)

View File

@ -59,7 +59,7 @@ public interface ImageAsyncApi {
@Consumes(MediaType.APPLICATION_JSON)
@Path("/images")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Resource>> listImages();
ListenableFuture<? extends Set<? extends Resource>> listImages();
/**
* @see ImageApi#listImagesInDetail

View File

@ -47,7 +47,7 @@ public interface ServerApi {
*
* @return all servers (IDs, names, links)
*/
Set<Resource> listServers();
Set<? extends Resource> listServers();
/**
* List all servers (all details)

View File

@ -76,7 +76,7 @@ public interface ServerAsyncApi {
@Consumes(MediaType.APPLICATION_JSON)
@Path("/servers")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Resource>> listServers();
ListenableFuture<? extends Set<? extends Resource>> listServers();
/**
* @see ServerApi#listServersInDetail

View File

@ -51,7 +51,7 @@ import com.google.common.collect.Multimap;
@Singleton
public class PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet implements
ImplicitOptionalConverter {
private final LoadingCache<String, Set<Extension>> extensions;
private final LoadingCache<String, Set<? extends Extension>> extensions;
@com.google.inject.Inject(optional=true)
@Named("openstack.nova.extensions")
@ -88,7 +88,7 @@ public class PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensio
@Inject
public PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet(
LoadingCache<String, Set<Extension>> extensions) {
LoadingCache<String, Set<? extends Extension>> extensions) {
this.extensions = checkNotNull(extensions, "extensions");
}

View File

@ -62,7 +62,7 @@ public class FindSecurityGroupWithNameAndReturnTrue implements Predicate<AtomicR
checkNotNull(securityGroupInZoneRef, "securityGroupRef");
final ZoneAndName securityGroupInZone = checkNotNull(securityGroupInZoneRef.get(), "securityGroupInZone");
Optional<SecurityGroupApi> api = novaApi.getSecurityGroupExtensionForZone(securityGroupInZone.getZone());
Optional<? extends SecurityGroupApi> api = novaApi.getSecurityGroupExtensionForZone(securityGroupInZone.getZone());
checkArgument(api.isPresent(), "Security groups are required, but the extension is not available!");
logger.trace("looking for security group %s", securityGroupInZone.slashEncode());

View File

@ -52,7 +52,9 @@ public class CreateUniqueKeyPairTest {
KeyPair pair = createMock(KeyPair.class);
expect(api.getKeyPairExtensionForZone("zone")).andReturn(Optional.of(keyApi)).atLeastOnce();
Optional optKeyApi = Optional.of(keyApi);
expect(api.getKeyPairExtensionForZone("zone")).andReturn(optKeyApi).atLeastOnce();
expect(keyApi.createKeyPair("group-1")).andReturn(pair);
@ -83,7 +85,7 @@ public class CreateUniqueKeyPairTest {
KeyPair pair = createMock(KeyPair.class);
expect(api.getKeyPairExtensionForZone("zone")).andReturn(Optional.of(keyApi)).atLeastOnce();
expect(api.getKeyPairExtensionForZone("zone")).andReturn((Optional) Optional.of(keyApi)).atLeastOnce();
expect(uniqueIdSupplier.get()).andReturn("1");
expect(keyApi.createKeyPair("group-1")).andThrow(new IllegalStateException());

View File

@ -46,7 +46,7 @@ public class LoadFloatingIpsForInstanceTest {
FloatingIPApi ipApi = createMock(FloatingIPApi.class);
FloatingIP testIp = FloatingIP.builder().id("1").ip("1.1.1.1").fixedIp("10.1.1.1").instanceId("i-blah").build();
expect(api.getFloatingIPExtensionForZone("Zone")).andReturn(Optional.of(ipApi)).atLeastOnce();
expect(api.getFloatingIPExtensionForZone("Zone")).andReturn((Optional) Optional.of(ipApi)).atLeastOnce();
expect(ipApi.listFloatingIPs()).andReturn(ImmutableSet.<FloatingIP>of(testIp)).atLeastOnce();
replay(api);
@ -65,7 +65,7 @@ public class LoadFloatingIpsForInstanceTest {
NovaApi api = createMock(NovaApi.class);
FloatingIPApi ipApi = createMock(FloatingIPApi.class);
expect(api.getFloatingIPExtensionForZone("Zone")).andReturn(Optional.of(ipApi)).atLeastOnce();
expect(api.getFloatingIPExtensionForZone("Zone")).andReturn((Optional) Optional.of(ipApi)).atLeastOnce();
expect(ipApi.listFloatingIPs()).andReturn(ImmutableSet.<FloatingIP>of()).atLeastOnce();
@ -86,7 +86,7 @@ public class LoadFloatingIpsForInstanceTest {
NovaApi api = createMock(NovaApi.class);
FloatingIPApi ipApi = createMock(FloatingIPApi.class);
expect(api.getFloatingIPExtensionForZone("Zone")).andReturn(Optional.of(ipApi)).atLeastOnce();
expect(api.getFloatingIPExtensionForZone("Zone")).andReturn((Optional) Optional.of(ipApi)).atLeastOnce();
expect(ipApi.listFloatingIPs()).andReturn(
ImmutableSet.<FloatingIP>of(FloatingIP.builder().id("1").ip("1.1.1.1").build()))

View File

@ -53,7 +53,7 @@ public class AdminActionsApiLiveTest extends BaseNovaApiLiveTest {
private ImageApi imageApi;
private ServerApi serverApi;
private ExtensionApi extensionApi;
private Optional<AdminActionsApi> apiOption;
private Optional<? extends AdminActionsApi> apiOption;
private String zone;
private String testServerId;

View File

@ -44,7 +44,7 @@ import com.google.common.collect.Maps;
@Test(groups = "live", testName = "FlavorExtraSpecsApiLiveTest", singleThreaded = true)
public class FlavorExtraSpecsApiLiveTest extends BaseNovaApiLiveTest {
private FlavorApi flavorApi;
private Optional<FlavorExtraSpecsApi> apiOption;
private Optional<? extends FlavorExtraSpecsApi> apiOption;
private String zone;
private Resource testFlavor;

View File

@ -48,7 +48,7 @@ public class FloatingIPApiLiveTest extends BaseNovaApiLiveTest {
@Test
public void testListFloatingIPs() throws Exception {
for (String zoneId : novaContext.getApi().getConfiguredZones()) {
Optional<FloatingIPApi> apiOption = novaContext.getApi().getFloatingIPExtensionForZone(zoneId);
Optional<? extends FloatingIPApi> apiOption = novaContext.getApi().getFloatingIPExtensionForZone(zoneId);
if (!apiOption.isPresent())
continue;
FloatingIPApi api = apiOption.get();
@ -70,7 +70,7 @@ public class FloatingIPApiLiveTest extends BaseNovaApiLiveTest {
@Test
public void testAllocateAndDeallocateFloatingIPs() throws Exception {
for (String zoneId : novaContext.getApi().getConfiguredZones()) {
Optional<FloatingIPApi> apiOption = novaContext.getApi().getFloatingIPExtensionForZone(zoneId);
Optional<? extends FloatingIPApi> apiOption = novaContext.getApi().getFloatingIPExtensionForZone(zoneId);
if (!apiOption.isPresent())
continue;
FloatingIPApi api = apiOption.get();
@ -101,7 +101,7 @@ public class FloatingIPApiLiveTest extends BaseNovaApiLiveTest {
@Test
public void testAddAndRemoveFloatingIp() throws Exception {
for (String zoneId : novaContext.getApi().getConfiguredZones()) {
Optional<FloatingIPApi> apiOption = novaContext.getApi().getFloatingIPExtensionForZone(zoneId);
Optional<? extends FloatingIPApi> apiOption = novaContext.getApi().getFloatingIPExtensionForZone(zoneId);
if (!apiOption.isPresent())
continue;
FloatingIPApi api = apiOption.get();

View File

@ -42,7 +42,7 @@ import com.google.common.collect.Iterables;
*/
@Test(groups = "live", testName = "HostAdministrationApiLiveTest", singleThreaded = true)
public class HostAdministrationApiLiveTest extends BaseNovaApiLiveTest {
private Optional<HostAdministrationApi> optApi = Optional.absent();
private Optional<? extends HostAdministrationApi> optApi = Optional.absent();
Predicate<Host> isComputeHost = new Predicate<Host>() {
@Override

View File

@ -44,8 +44,8 @@ import com.google.common.collect.Iterables;
*/
@Test(groups = "live", testName = "AggregateApiLiveTest", singleThreaded = true)
public class HostAggregateApiLiveTest extends BaseNovaApiLiveTest {
private Optional<HostAggregateApi> apiOption;
private Optional<HostAdministrationApi> hostAdminOption;
private Optional<? extends HostAggregateApi> apiOption;
private Optional<? extends HostAdministrationApi> hostAdminOption;
private HostAggregate testAggregate;

View File

@ -36,7 +36,7 @@ import com.google.common.collect.Iterables;
*/
@Test(groups = "live", testName = "QuotaApiLiveTest", singleThreaded = true)
public class QuotaApiLiveTest extends BaseNovaApiLiveTest {
private Optional<QuotaApi> apiOption;
private Optional<? extends QuotaApi> apiOption;
private String tenant;
@BeforeClass(groups = {"integration", "live"})

View File

@ -36,7 +36,7 @@ import com.google.common.collect.Iterables;
*/
@Test(groups = "live", testName = "QuotaClassApiLiveTest", singleThreaded = true)
public class QuotaClassApiLiveTest extends BaseNovaApiLiveTest {
private Optional<QuotaClassApi> apiOption;
private Optional<? extends QuotaClassApi> apiOption;
private String zone;
@BeforeClass(groups = {"integration", "live"})

View File

@ -41,7 +41,7 @@ import com.google.common.collect.Iterables;
@Test(groups = "live", testName = "ServerWithSecurityGroupsApiLiveTest", singleThreaded = true)
public class ServerWithSecurityGroupsApiLiveTest extends BaseNovaApiLiveTest {
private ServerApi serverApi;
private Optional<ServerWithSecurityGroupsApi> apiOption;
private Optional<? extends ServerWithSecurityGroupsApi> apiOption;
private String zone;
@BeforeGroups(groups = {"integration", "live"})

View File

@ -38,7 +38,7 @@ public class SimpleTenantUsageApiLiveTest extends BaseNovaApiLiveTest {
public void testList() throws Exception {
for (String zoneId : novaContext.getApi().getConfiguredZones()) {
Optional<SimpleTenantUsageApi> optApi = novaContext.getApi().getSimpleTenantUsageExtensionForZone(zoneId);
Optional<? extends SimpleTenantUsageApi> optApi = novaContext.getApi().getSimpleTenantUsageExtensionForZone(zoneId);
if (optApi.isPresent() && identity.endsWith(":admin")) {
SimpleTenantUsageApi api = optApi.get();
Set<SimpleTenantUsage> usages = api.listTenantUsages();

View File

@ -38,7 +38,7 @@ import com.google.common.collect.Iterables;
*/
@Test(groups = "live", testName = "VirtualInterfaceApiLiveTest", singleThreaded = true)
public class VirtualInterfaceApiLiveTest extends BaseNovaApiLiveTest {
private Optional<VirtualInterfaceApi> apiOption;
private Optional<? extends VirtualInterfaceApi> apiOption;
private String zone;

View File

@ -48,7 +48,7 @@ import com.google.common.collect.Iterables;
@Test(groups = "live", testName = "VolumeApiLiveTest", singleThreaded = true)
public class VolumeApiLiveTest extends BaseNovaApiLiveTest {
private Optional<VolumeApi> volumeOption;
private Optional<? extends VolumeApi> volumeOption;
private String zone;
private Volume testVolume;

View File

@ -46,7 +46,7 @@ import com.google.common.collect.Iterables;
@Test(groups = "live", testName = "VolumeTypeApiLiveTest", singleThreaded = true)
public class VolumeTypeApiLiveTest extends BaseNovaApiLiveTest {
private Optional<VolumeTypeApi> volumeTypeOption;
private Optional<? extends VolumeTypeApi> volumeTypeOption;
private String zone;
private VolumeType testVolumeType;

View File

@ -44,7 +44,7 @@ public class ExtensionApiLiveTest extends BaseNovaApiLiveTest {
public void testListExtensions() throws Exception {
for (String zoneId : novaContext.getApi().getConfiguredZones()) {
ExtensionApi api = novaContext.getApi().getExtensionApiForZone(zoneId);
Set<Extension> response = api.listExtensions();
Set<? extends Extension> response = api.listExtensions();
assert null != response;
assertTrue(response.size() >= 0);
for (Extension extension : response) {

View File

@ -45,7 +45,7 @@ public class FlavorApiLiveTest extends BaseNovaApiLiveTest {
public void testListFlavors() throws Exception {
for (String zoneId : novaContext.getApi().getConfiguredZones()) {
FlavorApi api = novaContext.getApi().getFlavorApiForZone(zoneId);
Set<Resource> response = api.listFlavors();
Set<? extends Resource> response = api.listFlavors();
assert null != response;
assertTrue(response.size() >= 0);
for (Resource flavor : response) {

View File

@ -41,7 +41,7 @@ public class ImageApiLiveTest extends BaseNovaApiLiveTest {
public void testListImages() throws Exception {
for (String zoneId : novaContext.getApi().getConfiguredZones()) {
ImageApi api = novaContext.getApi().getImageApiForZone(zoneId);
Set<Resource> response = api.listImages();
Set<? extends Resource> response = api.listImages();
assertNotNull(response);
assertTrue(response.size() >= 0);
for (Resource image : response) {

View File

@ -40,7 +40,7 @@ public class ServerApiLiveTest extends BaseNovaApiLiveTest {
public void testListServersInDetail() throws Exception {
for (String zoneId : novaContext.getApi().getConfiguredZones()) {
ServerApi api = novaContext.getApi().getServerApiForZone(zoneId);
Set<Resource> response = api.listServers();
Set<? extends Resource> response = api.listServers();
assert null != response;
assertTrue(response.size() >= 0);
for (Resource server : response) {

View File

@ -20,6 +20,8 @@ package org.jclouds.util;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.WildcardType;
import com.google.common.base.Optional;
@ -35,7 +37,11 @@ public class Optionals2 {
if (optional) {
ParameterizedType futureType = ParameterizedType.class.cast(method.getGenericReturnType());
// TODO: error checking in case this is a type, not a class.
syncClass = Class.class.cast(futureType.getActualTypeArguments()[0]);
Type t = futureType.getActualTypeArguments()[0];
if (t instanceof WildcardType) {
t = ((WildcardType) t).getUpperBounds()[0];
}
syncClass = Class.class.cast(t);
} else {
syncClass = method.getReturnType();
}

View File

@ -44,12 +44,12 @@ public interface ImageApi {
/**
* Returns a set of brief metadata about images
*/
Set<Image> list(ListImageOptions... options);
Set<? extends Image> list(ListImageOptions... options);
/**
* Returns a set of detailed metadata about images
*/
Set<ImageDetails> listInDetail(ListImageOptions... options);
Set<? extends ImageDetails> listInDetail(ListImageOptions... options);
/**
* Return metadata about an image with id

View File

@ -73,7 +73,7 @@ public interface ImageAsyncApi {
@Consumes(MediaType.APPLICATION_JSON)
@Path("/images")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Image>> list(ListImageOptions... options);
ListenableFuture<? extends Set<? extends Image>> list(ListImageOptions... options);
/**
* @see ImageApi#listInDetail
@ -83,7 +83,7 @@ public interface ImageAsyncApi {
@Consumes(MediaType.APPLICATION_JSON)
@Path("/images/detail")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<ImageDetails>> listInDetail(ListImageOptions... options);
ListenableFuture<? extends Set<? extends ImageDetails>> listInDetail(ListImageOptions... options);
/**
* @see ImageApi#show
@ -110,7 +110,7 @@ public interface ImageAsyncApi {
@Produces(MediaType.APPLICATION_OCTET_STREAM)
@SelectJson("image")
@Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<ImageDetails> create(@HeaderParam("x-image-meta-name") String name, Payload payload, CreateImageOptions... options);
ListenableFuture<? extends ImageDetails> create(@HeaderParam("x-image-meta-name") String name, Payload payload, CreateImageOptions... options);
/**
* @see ImageApi#reserve
@ -119,7 +119,7 @@ public interface ImageAsyncApi {
@Path("/images")
@SelectJson("image")
@Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<ImageDetails> reserve(@HeaderParam("x-image-meta-name") String name, CreateImageOptions... options);
ListenableFuture<? extends ImageDetails> reserve(@HeaderParam("x-image-meta-name") String name, CreateImageOptions... options);
/**
* @see ImageApi#upload
@ -129,7 +129,7 @@ public interface ImageAsyncApi {
@Produces(MediaType.APPLICATION_OCTET_STREAM)
@SelectJson("image")
@Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<ImageDetails> upload(@PathParam("id") String id, Payload imageData, UpdateImageOptions... options);
ListenableFuture<? extends ImageDetails> upload(@PathParam("id") String id, Payload imageData, UpdateImageOptions... options);
/**
* @see ImageApi#update
@ -138,7 +138,7 @@ public interface ImageAsyncApi {
@Path("/images/{id}")
@SelectJson("image")
@Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<ImageDetails> update(@PathParam("id") String id, UpdateImageOptions... options);
ListenableFuture<? extends ImageDetails> update(@PathParam("id") String id, UpdateImageOptions... options);
/**
* @see ImageApi#delete

View File

@ -18,7 +18,21 @@
*/
package org.jclouds.openstack.glance.v1_0.functions;
import static org.jclouds.openstack.glance.v1_0.options.ImageField.*;
import static org.jclouds.openstack.glance.v1_0.options.ImageField.CHECKSUM;
import static org.jclouds.openstack.glance.v1_0.options.ImageField.CONTAINER_FORMAT;
import static org.jclouds.openstack.glance.v1_0.options.ImageField.CREATED_AT;
import static org.jclouds.openstack.glance.v1_0.options.ImageField.DELETED_AT;
import static org.jclouds.openstack.glance.v1_0.options.ImageField.DISK_FORMAT;
import static org.jclouds.openstack.glance.v1_0.options.ImageField.ID;
import static org.jclouds.openstack.glance.v1_0.options.ImageField.IS_PUBLIC;
import static org.jclouds.openstack.glance.v1_0.options.ImageField.LOCATION;
import static org.jclouds.openstack.glance.v1_0.options.ImageField.MIN_DISK;
import static org.jclouds.openstack.glance.v1_0.options.ImageField.MIN_RAM;
import static org.jclouds.openstack.glance.v1_0.options.ImageField.NAME;
import static org.jclouds.openstack.glance.v1_0.options.ImageField.OWNER;
import static org.jclouds.openstack.glance.v1_0.options.ImageField.SIZE;
import static org.jclouds.openstack.glance.v1_0.options.ImageField.STATUS;
import static org.jclouds.openstack.glance.v1_0.options.ImageField.UPDATED_AT;
import javax.inject.Inject;
@ -44,6 +58,7 @@ public class ParseImageDetailsFromHeaders implements Function<HttpResponse, Imag
this.dateService = dateService;
}
@Override
public ImageDetails apply(HttpResponse from) {
ImageDetails.Builder<?> builder = ImageDetails.builder()
.id(from.getFirstHeaderOrNull(ID.asHeader()))

View File

@ -49,7 +49,7 @@ public class ImageApiLiveTest extends BaseGlanceApiLiveTest {
public void testList() throws Exception {
for (String zoneId : glanceContext.getApi().getConfiguredRegions()) {
ImageApi api = glanceContext.getApi().getImageApiForRegion(zoneId);
Set<Image> response = api.list(ListImageOptions.Builder.limit(100));
Set<? extends Image> response = api.list(ListImageOptions.Builder.limit(100));
assert null != response;
for (Image image : response) {
checkImage(image);
@ -67,7 +67,7 @@ public class ImageApiLiveTest extends BaseGlanceApiLiveTest {
public void testListInDetail() throws Exception {
for (String zoneId : glanceContext.getApi().getConfiguredRegions()) {
ImageApi api = glanceContext.getApi().getImageApiForRegion(zoneId);
Set<ImageDetails> response = api.listInDetail();
Set<? extends ImageDetails> response = api.listInDetail();
assert null != response;
for (ImageDetails image : response) {
checkImage(image);

View File

@ -44,12 +44,12 @@ public interface NetworkApi {
* Returns the list of all networks currently defined in Quantum for the current tenant. The list provides the unique
* identifier of each network configured for the tenant.
*/
Set<Reference> listReferences();
Set<? extends Reference> listReferences();
/**
* Returns all networks currently defined in Quantum for the current tenant.
*/
Set<Network> list();
Set<? extends Network> list();
/**
* Returns the specific network.

View File

@ -64,7 +64,7 @@ public interface NetworkAsyncApi {
@GET
@SelectJson("networks")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Reference>> listReferences();
ListenableFuture<? extends Set<? extends Reference>> listReferences();
/**
* @see NetworkApi#list
@ -73,7 +73,7 @@ public interface NetworkAsyncApi {
@SelectJson("networks")
@Path("/detail")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Network>> list();
ListenableFuture<? extends Set<? extends Network>> list();
/**
* @see NetworkApi#get
@ -82,7 +82,7 @@ public interface NetworkAsyncApi {
@SelectJson("network")
@Path("/{id}")
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Network> get(@PathParam("id") String id);
ListenableFuture<? extends Network> get(@PathParam("id") String id);
/**
* @see NetworkApi#getDetails
@ -91,7 +91,7 @@ public interface NetworkAsyncApi {
@SelectJson("network")
@Path("/{id}/detail")
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<NetworkDetails> getDetails(@PathParam("id") String id);
ListenableFuture<? extends NetworkDetails> getDetails(@PathParam("id") String id);
/**
* @see NetworkApi#create
@ -100,7 +100,7 @@ public interface NetworkAsyncApi {
@SelectJson("network")
@Produces(MediaType.APPLICATION_JSON)
@WrapWith("network")
ListenableFuture<Reference> create(@PayloadParam("name") String name);
ListenableFuture<? extends Reference> create(@PayloadParam("name") String name);
/**
* @see NetworkApi#rename

View File

@ -44,12 +44,12 @@ public interface PortApi {
/**
* Returns the list of all ports currently defined in Quantum for the requested network
*/
Set<Reference> listReferences();
Set<? extends Reference> listReferences();
/**
* Returns the set of ports currently defined in Quantum for the requested network.
*/
Set<Port> list();
Set<? extends Port> list();
/**
* Returns a specific port.

View File

@ -64,7 +64,7 @@ public interface PortAsyncApi {
@GET
@SelectJson("ports")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Reference>> listReferences();
ListenableFuture<? extends Set<? extends Reference>> listReferences();
/**
* @see PortApi#list
@ -73,7 +73,7 @@ public interface PortAsyncApi {
@SelectJson("ports")
@Path("/detail")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Port>> list();
ListenableFuture<? extends Set<? extends Port>> list();
/**
* @see PortApi#get
@ -82,7 +82,7 @@ public interface PortAsyncApi {
@SelectJson("port")
@Path("/{id}")
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Port> get(@PathParam("id") String id);
ListenableFuture<? extends Port> get(@PathParam("id") String id);
/**
* @see PortApi#getDetails
@ -92,14 +92,14 @@ public interface PortAsyncApi {
@Consumes(MediaType.APPLICATION_JSON)
@Path("/{id}/detail")
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<PortDetails> getDetails(@PathParam("id") String id);
ListenableFuture<? extends PortDetails> getDetails(@PathParam("id") String id);
/**
* @see PortApi#create()
*/
@POST
@SelectJson("port")
ListenableFuture<Reference> create();
ListenableFuture<? extends Reference> create();
/**
* @see PortApi#create(org.jclouds.openstack.quantum.v1_0.domain.Port.State)
@ -131,7 +131,7 @@ public interface PortAsyncApi {
@SelectJson("attachment")
@Path("/{id}/attachment")
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Attachment> showAttachment(@PathParam("id") String portId);
ListenableFuture<? extends Attachment> showAttachment(@PathParam("id") String portId);
/**
* @see PortApi#plugAttachment

View File

@ -55,7 +55,7 @@ public class NetworkApiExpectTest extends BaseQuantumApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/list_network_refs.json", APPLICATION_JSON)).build())
.getNetworkApiForRegion("region-a.geo-1");
Set<Reference> nets = api.listReferences();
Set<? extends Reference> nets = api.listReferences();
assertEquals(nets, listOfNetworkRefs());
}
@ -76,7 +76,7 @@ public class NetworkApiExpectTest extends BaseQuantumApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/list_networks.json", APPLICATION_JSON)).build())
.getNetworkApiForRegion("region-a.geo-1");
Set<Network> nets = api.list();
Set<? extends Network> nets = api.list();
assertEquals(nets, listOfNetworks());
}

View File

@ -42,8 +42,8 @@ public class NetworkApiLiveTest extends BaseQuantumApiLiveTest {
public void testListNetworks() {
for (String regionId : quantumContext.getApi().getConfiguredRegions()) {
Set<Reference> ids = quantumContext.getApi().getNetworkApiForRegion(regionId).listReferences();
Set<Network> networks = quantumContext.getApi().getNetworkApiForRegion(regionId).list();
Set<? extends Reference> ids = quantumContext.getApi().getNetworkApiForRegion(regionId).listReferences();
Set<? extends Network> networks = quantumContext.getApi().getNetworkApiForRegion(regionId).list();
assertNotNull(ids);
assertEquals(ids.size(), networks.size());
for (Network network : networks) {

View File

@ -56,7 +56,7 @@ public class PortApiExpectTest extends BaseQuantumApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromStringWithContentType("{\"ports\": [{\"id\": \"a6058a59-fa8c-46cc-bac8-08904e6ff0a5\"}]}", APPLICATION_JSON)).build())
.getPortApiForRegionAndNetwork("region-a.geo-1", "1a104cf5-cb18-4d35-9407-2fd2646d9d0b");
Set<Reference> nets = api.listReferences();
Set<? extends Reference> nets = api.listReferences();
assertEquals(nets, ImmutableSet.of(Reference.builder().id("a6058a59-fa8c-46cc-bac8-08904e6ff0a5").build()));
}
@ -77,7 +77,7 @@ public class PortApiExpectTest extends BaseQuantumApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromStringWithContentType("{\"ports\": [{\"state\": \"DOWN\", \"id\": \"814ae4bb-33d9-425f-8ee2-13a5c90b1465\"}]}", APPLICATION_JSON)).build())
.getPortApiForRegionAndNetwork("region-a.geo-1", "1a104cf5-cb18-4d35-9407-2fd2646d9d0b");
Set<Port> nets = api.list();
Set<? extends Port> nets = api.list();
assertEquals(nets, ImmutableSet.of(Port.builder().state(Port.State.DOWN).id("814ae4bb-33d9-425f-8ee2-13a5c90b1465").build()));
}

View File

@ -46,11 +46,11 @@ public class PortApiLiveTest extends BaseQuantumApiLiveTest {
public void testListPorts() {
for (String regionId : quantumContext.getApi().getConfiguredRegions()) {
NetworkApi netApi = quantumContext.getApi().getNetworkApiForRegion(regionId);
Set<Reference> nets = netApi.listReferences();
Set<? extends Reference> nets = netApi.listReferences();
for(Reference net : nets) {
PortApi portApi = quantumContext.getApi().getPortApiForRegionAndNetwork(regionId, net.getId());
Set<Reference> portRefs = portApi.listReferences();
Set<Port> ports = portApi.list();
Set<? extends Reference> portRefs = portApi.listReferences();
Set<? extends Port> ports = portApi.list();
assertEquals(portRefs.size(), ports.size());
for (Port port : ports) {

View File

@ -47,7 +47,7 @@ public interface AccountApi {
/**
* @see #listContainers(ListContainersOptions)
*/
Set<ContainerMetadata> listContainers();
Set<? extends ContainerMetadata> listContainers();
/**
* retrieve a list of existing storage containers ordered by name. The sort order for the name is
@ -57,6 +57,6 @@ public interface AccountApi {
* @param options
* @return a list of existing storage containers ordered by name.
*/
Set<ContainerMetadata> listContainers(ListContainersOptions options);
Set<? extends ContainerMetadata> listContainers(ListContainersOptions options);
}

View File

@ -59,7 +59,7 @@ public interface AccountAsyncApi {
@HEAD
@ResponseParser(ParseAccountMetadataResponseFromHeaders.class)
@Path("/")
ListenableFuture<AccountMetadata> getAccountMetadata();
ListenableFuture<? extends AccountMetadata> getAccountMetadata();
/**
* @see AccountApi#listContainers()
@ -69,7 +69,7 @@ public interface AccountAsyncApi {
@QueryParams(keys = "format", values = "json")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Path("/")
ListenableFuture<Set<ContainerMetadata>> listContainers();
ListenableFuture<? extends Set<? extends ContainerMetadata>> listContainers();
/**
* @see AccountApi#listContainers(ListContainersOptions)
@ -79,5 +79,5 @@ public interface AccountAsyncApi {
@QueryParams(keys = "format", values = "json")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Path("/")
ListenableFuture<Set<ContainerMetadata>> listContainers(ListContainersOptions options);
ListenableFuture<? extends Set<? extends ContainerMetadata>> listContainers(ListContainersOptions options);
}

View File

@ -49,7 +49,7 @@ public class AccountApiLiveTest extends BaseSwiftApiLiveTest {
public void testListContainers() throws Exception {
for (String regionId : swiftContext.getApi().getConfiguredRegions()) {
AccountApi api = swiftContext.getApi().getAccountApiForRegion(regionId);
Set<ContainerMetadata> response = api.listContainers();
Set<? extends ContainerMetadata> response = api.listContainers();
assertNotNull(response);
for (ContainerMetadata container : response) {
assertNotNull(container.getName());