openstack-quantum extensibility

This commit is contained in:
Andrew Donald Kennedy 2012-08-12 12:46:25 +01:00
parent 70fc6f5c52
commit 2bfa9e0b23
8 changed files with 24 additions and 24 deletions

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 * 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. * 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. * Returns all networks currently defined in Quantum for the current tenant.
*/ */
Set<Network> list(); Set<? extends Network> list();
/** /**
* Returns the specific network. * Returns the specific network.

View File

@ -64,7 +64,7 @@ public interface NetworkAsyncApi {
@GET @GET
@SelectJson("networks") @SelectJson("networks")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Reference>> listReferences(); ListenableFuture<? extends Set<? extends Reference>> listReferences();
/** /**
* @see NetworkApi#list * @see NetworkApi#list
@ -73,7 +73,7 @@ public interface NetworkAsyncApi {
@SelectJson("networks") @SelectJson("networks")
@Path("/detail") @Path("/detail")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Network>> list(); ListenableFuture<? extends Set<? extends Network>> list();
/** /**
* @see NetworkApi#get * @see NetworkApi#get
@ -82,7 +82,7 @@ public interface NetworkAsyncApi {
@SelectJson("network") @SelectJson("network")
@Path("/{id}") @Path("/{id}")
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Network> get(@PathParam("id") String id); ListenableFuture<? extends Network> get(@PathParam("id") String id);
/** /**
* @see NetworkApi#getDetails * @see NetworkApi#getDetails
@ -91,7 +91,7 @@ public interface NetworkAsyncApi {
@SelectJson("network") @SelectJson("network")
@Path("/{id}/detail") @Path("/{id}/detail")
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<NetworkDetails> getDetails(@PathParam("id") String id); ListenableFuture<? extends NetworkDetails> getDetails(@PathParam("id") String id);
/** /**
* @see NetworkApi#create * @see NetworkApi#create
@ -100,7 +100,7 @@ public interface NetworkAsyncApi {
@SelectJson("network") @SelectJson("network")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@WrapWith("network") @WrapWith("network")
ListenableFuture<Reference> create(@PayloadParam("name") String name); ListenableFuture<? extends Reference> create(@PayloadParam("name") String name);
/** /**
* @see NetworkApi#rename * @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 * 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. * Returns the set of ports currently defined in Quantum for the requested network.
*/ */
Set<Port> list(); Set<? extends Port> list();
/** /**
* Returns a specific port. * Returns a specific port.

View File

@ -64,7 +64,7 @@ public interface PortAsyncApi {
@GET @GET
@SelectJson("ports") @SelectJson("ports")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Reference>> listReferences(); ListenableFuture<? extends Set<? extends Reference>> listReferences();
/** /**
* @see PortApi#list * @see PortApi#list
@ -73,7 +73,7 @@ public interface PortAsyncApi {
@SelectJson("ports") @SelectJson("ports")
@Path("/detail") @Path("/detail")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Port>> list(); ListenableFuture<? extends Set<? extends Port>> list();
/** /**
* @see PortApi#get * @see PortApi#get
@ -82,7 +82,7 @@ public interface PortAsyncApi {
@SelectJson("port") @SelectJson("port")
@Path("/{id}") @Path("/{id}")
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Port> get(@PathParam("id") String id); ListenableFuture<? extends Port> get(@PathParam("id") String id);
/** /**
* @see PortApi#getDetails * @see PortApi#getDetails
@ -92,14 +92,14 @@ public interface PortAsyncApi {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Path("/{id}/detail") @Path("/{id}/detail")
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<PortDetails> getDetails(@PathParam("id") String id); ListenableFuture<? extends PortDetails> getDetails(@PathParam("id") String id);
/** /**
* @see PortApi#create() * @see PortApi#create()
*/ */
@POST @POST
@SelectJson("port") @SelectJson("port")
ListenableFuture<Reference> create(); ListenableFuture<? extends Reference> create();
/** /**
* @see PortApi#create(org.jclouds.openstack.quantum.v1_0.domain.Port.State) * @see PortApi#create(org.jclouds.openstack.quantum.v1_0.domain.Port.State)
@ -131,7 +131,7 @@ public interface PortAsyncApi {
@SelectJson("attachment") @SelectJson("attachment")
@Path("/{id}/attachment") @Path("/{id}/attachment")
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Attachment> showAttachment(@PathParam("id") String portId); ListenableFuture<? extends Attachment> showAttachment(@PathParam("id") String portId);
/** /**
* @see PortApi#plugAttachment * @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()) HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/list_network_refs.json", APPLICATION_JSON)).build())
.getNetworkApiForRegion("region-a.geo-1"); .getNetworkApiForRegion("region-a.geo-1");
Set<Reference> nets = api.listReferences(); Set<? extends Reference> nets = api.listReferences();
assertEquals(nets, listOfNetworkRefs()); assertEquals(nets, listOfNetworkRefs());
} }
@ -76,7 +76,7 @@ public class NetworkApiExpectTest extends BaseQuantumApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/list_networks.json", APPLICATION_JSON)).build()) HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/list_networks.json", APPLICATION_JSON)).build())
.getNetworkApiForRegion("region-a.geo-1"); .getNetworkApiForRegion("region-a.geo-1");
Set<Network> nets = api.list(); Set<? extends Network> nets = api.list();
assertEquals(nets, listOfNetworks()); assertEquals(nets, listOfNetworks());
} }

View File

@ -42,8 +42,8 @@ public class NetworkApiLiveTest extends BaseQuantumApiLiveTest {
public void testListNetworks() { public void testListNetworks() {
for (String regionId : quantumContext.getApi().getConfiguredRegions()) { for (String regionId : quantumContext.getApi().getConfiguredRegions()) {
Set<Reference> ids = quantumContext.getApi().getNetworkApiForRegion(regionId).listReferences(); Set<? extends Reference> ids = quantumContext.getApi().getNetworkApiForRegion(regionId).listReferences();
Set<Network> networks = quantumContext.getApi().getNetworkApiForRegion(regionId).list(); Set<? extends Network> networks = quantumContext.getApi().getNetworkApiForRegion(regionId).list();
assertNotNull(ids); assertNotNull(ids);
assertEquals(ids.size(), networks.size()); assertEquals(ids.size(), networks.size());
for (Network network : networks) { 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()) 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"); .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())); 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()) 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"); .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())); 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() { public void testListPorts() {
for (String regionId : quantumContext.getApi().getConfiguredRegions()) { for (String regionId : quantumContext.getApi().getConfiguredRegions()) {
NetworkApi netApi = quantumContext.getApi().getNetworkApiForRegion(regionId); NetworkApi netApi = quantumContext.getApi().getNetworkApiForRegion(regionId);
Set<Reference> nets = netApi.listReferences(); Set<? extends Reference> nets = netApi.listReferences();
for(Reference net : nets) { for(Reference net : nets) {
PortApi portApi = quantumContext.getApi().getPortApiForRegionAndNetwork(regionId, net.getId()); PortApi portApi = quantumContext.getApi().getPortApiForRegionAndNetwork(regionId, net.getId());
Set<Reference> portRefs = portApi.listReferences(); Set<? extends Reference> portRefs = portApi.listReferences();
Set<Port> ports = portApi.list(); Set<? extends Port> ports = portApi.list();
assertEquals(portRefs.size(), ports.size()); assertEquals(portRefs.size(), ports.size());
for (Port port : ports) { for (Port port : ports) {