private void checkResource(Resource resource) { assertNotNull(resource.getId()); assertNotNull(resource.getName()); assertNotNull(resource.getLinks()); assertTrue(Iterables.any(resource.getLinks(), LinkPredicates.relationEquals(Relation.SELF))); }
public T fromResource(Resource in) { return this .id(in.getId()) .name(in.getName()) .links(in.getLinks()); } }
@Test(description = "GET /v${apiVersion}/{tenantId}/images") public void testListImages() throws Exception { for (String zoneId : zones) { ImageApi imageApi = api.getImageApiForZone(zoneId); Set<? extends Resource> response = imageApi.list().concat().toSet(); assertNotNull(response); assertFalse(response.isEmpty()); for (Resource image : response) { assertNotNull(image.getId()); assertNotNull(image.getName()); assertNotNull(image.getLinks()); } } }
public T fromResource(Resource in) { return this .id(in.getId()) .name(in.getName()) .links(in.getLinks()); } }
public T fromResource(Resource in) { return this .id(in.getId()) .name(in.getName()) .links(in.getLinks()); } }
public T fromResource(Resource in) { return this .id(in.getId()) .name(in.getName()) .links(in.getLinks()); } }
public T fromResource(Resource in) { return this .id(in.getId()) .name(in.getName()) .links(in.getLinks()); } }
public T fromResource(Resource in) { return this .id(in.getId()) .name(in.getName()) .links(in.getLinks()); } }
private void checkResource(Resource resource) { assertNotNull(resource.getId()); assertNotNull(resource.getName()); assertNotNull(resource.getLinks()); assertTrue(Iterables.any(resource.getLinks(), LinkPredicates.relationEquals(Relation.SELF))); }
public T fromResource(Resource in) { return this .id(in.getId()) .name(in.getName()) .links(in.getLinks()); } }
@Test(description = "GET /v${apiVersion}/{tenantId}/images") public void testListImages() throws Exception { for (String regionId : regions) { ImageApi imageApi = api.getImageApi(regionId); Set<? extends Resource> response = imageApi.list().concat().toSet(); assertNotNull(response); assertFalse(response.isEmpty()); for (Resource image : response) { assertNotNull(image.getId()); assertNotNull(image.getName()); assertNotNull(image.getLinks()); } } }
/** * Tests the listing of Flavors. * * @throws Exception */ @Test(description = "GET /v${apiVersion}/{tenantId}/flavors") public void testListFlavors() throws Exception { for (String zoneId : zones) { FlavorApi flavorApi = api.getFlavorApiForZone(zoneId); Set<? extends Resource> response = flavorApi.list().concat().toSet(); assertNotNull(response); assertFalse(response.isEmpty()); for (Resource flavor : response) { assertNotNull(flavor.getId()); assertNotNull(flavor.getName()); assertNotNull(flavor.getLinks()); } } }
/** * Tests the listing of Flavors. * * @throws Exception */ @Test(description = "GET /v${apiVersion}/{tenantId}/flavors") public void testListFlavors() throws Exception { for (String regionId : regions) { FlavorApi flavorApi = api.getFlavorApi(regionId); Set<? extends Resource> response = flavorApi.list().concat().toSet(); assertNotNull(response); assertFalse(response.isEmpty()); for (Resource flavor : response) { assertNotNull(flavor.getId()); assertNotNull(flavor.getName()); assertNotNull(flavor.getLinks()); } } }
@BeforeClass(groups = { "integration", "live" }) @Override public void setup() { super.setup(); zones = api.getConfiguredZones(); for (String zone : zones){ ServerApi serverApi = api.getServerApiForZone(zone); for (Resource server : serverApi.list().concat()){ if (server.getName().equals(hostName)) serverApi.delete(server.getId()); } } }
@Test(description = "GET /v${apiVersion}/{tenantId}/servers/{id}", dependsOnMethods = { "testListServersInDetail" }) public void testGetServerById() throws Exception { for (String zoneId : zones) { ServerApi serverApi = api.getServerApiForZone(zoneId); for (Resource server : serverApi.list().concat()) { Server details = serverApi.get(server.getId()); assertEquals(details.getId(), server.getId()); assertEquals(details.getName(), server.getName()); assertEquals(details.getLinks(), server.getLinks()); checkServer(details); } } }
@BeforeClass(groups = { "integration", "live" }) @Override public void setup() { super.setup(); if (singleRegion != null) { regions = ImmutableSet.of(singleRegion); } else { regions = api.getConfiguredRegions(); } for (String region : regions) { ServerApi serverApi = api.getServerApi(region); for (Resource server : serverApi.list().concat()) { if (server.getName().equals(hostName)) serverApi.delete(server.getId()); } } }
@Test(description = "GET /v${apiVersion}/{tenantId}/servers/{id}", dependsOnMethods = {"testListServersInDetail"}) public void testGetServerById() throws Exception { for (String regionId : regions) { ServerApi serverApi = api.getServerApi(regionId); for (Resource server : serverApi.list().concat()) { Server details = serverApi.get(server.getId()); assertEquals(details.getId(), server.getId()); assertEquals(details.getName(), server.getName()); assertEquals(details.getLinks(), server.getLinks()); checkServer(details); } } }
public void testGetServer() { if (apiOption.isPresent()) { for (Resource server : serverApi.list().concat()) { ServerWithSecurityGroups serverWithGroups = apiOption.get().get(server.getId()); assertEquals(serverWithGroups.getId(), server.getId()); assertEquals(serverWithGroups.getName(), server.getName()); assertNotNull(serverWithGroups.getSecurityGroupNames()); } // Create a new server to verify the groups work as expected Server testServer = null; try { testServer = createServerInZone(zone); ServerWithSecurityGroups results = apiOption.get().get(testServer.getId()); assertEquals(results.getId(), testServer.getId()); assertEquals(results.getSecurityGroupNames(), ImmutableSet.of("default")); } finally { if (testServer != null) { serverApi.delete(testServer.getId()); } } } }
public void testGetServer() { if (apiOption.isPresent()) { for (Resource server : serverApi.list().concat()) { ServerWithSecurityGroups serverWithGroups = apiOption.get().get(server.getId()); assertEquals(serverWithGroups.getId(), server.getId()); assertEquals(serverWithGroups.getName(), server.getName()); assertNotNull(serverWithGroups.getSecurityGroupNames()); } // Create a new server to verify the groups work as expected Server testServer = null; try { testServer = createServerInRegion(region); ServerWithSecurityGroups results = apiOption.get().get(testServer.getId()); assertEquals(results.getId(), testServer.getId()); assertEquals(results.getSecurityGroupNames(), ImmutableSet.of("default")); } finally { if (testServer != null) { serverApi.delete(testServer.getId()); } } } }