public void testListAndGet() throws Exception { if (optApi.isPresent()) { HostAdministrationApi api = optApi.get(); Set<? extends Host> hosts = api.list().toSet(); assertNotNull(hosts); for (Host host : hosts) { for (HostResourceUsage usage : api.listResourceUsage(host.getName())) { assertEquals(usage.getHost(), host.getName()); assertNotNull(usage); } } } }
@Test(enabled = false) public void testReboot() throws Exception { if (optApi.isPresent()) { HostAdministrationApi api = optApi.get(); Host host = Iterables.find(api.list(), isComputeHost); assertTrue(api.reboot(host.getName())); } }
@Test(enabled = false) public void testReboot() throws Exception { if (optApi.isPresent()) { HostAdministrationApi api = optApi.get(); Host host = Iterables.find(api.list(), isComputeHost); assertTrue(api.reboot(host.getName())); } }
public void testListAndGet() throws Exception { if (optApi.isPresent()) { HostAdministrationApi api = optApi.get(); Set<? extends Host> hosts = api.list().toSet(); assertNotNull(hosts); for (Host host : hosts) { for (HostResourceUsage usage : api.listResourceUsage(host.getName())) { assertEquals(usage.getHost(), host.getName()); assertNotNull(usage); } } } }
@Test(enabled = false) public void testEnableDisable() throws Exception { if (optApi.isPresent()) { HostAdministrationApi api = optApi.get(); Host host = Iterables.find(api.list(), isComputeHost); assertTrue(api.disable(host.getName())); assertTrue(api.enable(host.getName())); } }
@Test(enabled = false) public void testMaintenanceMode() throws Exception { if (optApi.isPresent()) { HostAdministrationApi api = optApi.get(); Host host = Iterables.find(api.list(), isComputeHost); assertTrue(api.startMaintenance(host.getName())); assertTrue(api.stopMaintenance(host.getName())); } }
@Test(enabled = false) public void testShutdownAndStartup() throws Exception { if (optApi.isPresent()) { HostAdministrationApi api = optApi.get(); Host host = Iterables.find(api.list(), isComputeHost); assertTrue(api.shutdown(host.getName())); assertTrue(api.startup(host.getName())); } } }
@Test(enabled = false) public void testMaintenanceMode() throws Exception { if (optApi.isPresent()) { HostAdministrationApi api = optApi.get(); Host host = Iterables.find(api.list(), isComputeHost); assertTrue(api.startMaintenance(host.getName())); assertTrue(api.stopMaintenance(host.getName())); } }
@Test(enabled = false) public void testShutdownAndStartup() throws Exception { if (optApi.isPresent()) { HostAdministrationApi api = optApi.get(); Host host = Iterables.find(api.list(), isComputeHost); assertTrue(api.shutdown(host.getName())); assertTrue(api.startup(host.getName())); } } }
@Test(enabled = false) public void testEnableDisable() throws Exception { if (optApi.isPresent()) { HostAdministrationApi api = optApi.get(); Host host = Iterables.find(api.list(), isComputeHost); assertTrue(api.disable(host.getName())); assertTrue(api.enable(host.getName())); } }
@Test(enabled = false, dependsOnMethods = "testCreateAggregate") public void testModifyHosts() { if (apiOption.isPresent() && hostAdminOption.isPresent()) { HostAggregateApi api = apiOption.get(); Host host = Iterables.getFirst(hostAdminOption.get().list(), null); assertNotNull(host); String host_id = host.getName(); assertNotNull(host_id); HostAggregate details; try { details = api.addHost(testAggregate.getId(), host_id); assertEquals(details.getHosts(), ImmutableSet.of(host_id)); // re-fetch to double-check details = api.get(testAggregate.getId()); assertEquals(details.getHosts(), ImmutableSet.of(host_id)); // TODO wait until status of aggregate isn't CHANGING (hostAdministration.shutdown?) } finally { details = api.removeHost(testAggregate.getId(), host_id); } assertEquals(details.getHosts(), ImmutableSet.of()); } } }
@Test(enabled = false, dependsOnMethods = "testCreateAggregate") public void testModifyHosts() { if (apiOption.isPresent() && hostAdminOption.isPresent()) { HostAggregateApi api = apiOption.get(); Host host = Iterables.getFirst(hostAdminOption.get().list(), null); assertNotNull(host); String host_id = host.getName(); assertNotNull(host_id); HostAggregate details; try { details = api.addHost(testAggregate.getId(), host_id); assertEquals(details.getHosts(), ImmutableSet.of(host_id)); // re-fetch to double-check details = api.get(testAggregate.getId()); assertEquals(details.getHosts(), ImmutableSet.of(host_id)); // TODO wait until status of aggregate isn't CHANGING (hostAdministration.shutdown?) } finally { details = api.removeHost(testAggregate.getId(), host_id); } assertEquals(details.getHosts(), ImmutableSet.of()); } } }
public void testList() { URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts"); HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, HttpRequest.builder().method("GET") .addHeader("Accept", "application/json") .addHeader("X-Auth-Token", authToken) .endpoint(endpoint).build(), HttpResponse.builder().statusCode(200).payload(payloadFromResource("/hosts_list.json")).build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get(); Host expected = Host.builder().name("ubuntu").service("compute").build(); Set<? extends Host> result = api.list().toSet(); Host host = Iterables.getOnlyElement(result); assertEquals(host.getName(), "ubuntu"); assertEquals(host.getService(), "compute"); assertEquals(host, expected); }
public void testList() { URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v2/3456/os-hosts"); HostAdministrationApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, HttpRequest.builder().method("GET") .addHeader("Accept", "application/json") .addHeader("X-Auth-Token", authToken) .endpoint(endpoint).build(), HttpResponse.builder().statusCode(200).payload(payloadFromResource("/hosts_list.json")).build()).getHostAdministrationApi("az-1.region-a.geo-1").get(); Host expected = Host.builder().name("ubuntu").service("compute").zone("nova").build(); Set<? extends Host> result = api.list().toSet(); Host host = Iterables.getOnlyElement(result); assertEquals(host.getName(), "ubuntu"); assertEquals(host.getService(), "compute"); assertEquals(host.getZone(), "nova"); assertEquals(host, expected); }