public T fromHost(Host in) { return this .name(in.getName()) .service(in.getService()) .zone(in.getZone()); } }
public Host build() { return new Host(name, service); }
@Override public String toString() { return string().toString(); }
public T fromHost(Host in) { return this .name(in.getName()) .service(in.getService()); } }
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); }
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); }
@Override public boolean apply(Host input) { return Objects.equal("compute", input.getService()); } };
public T fromHost(Host in) { return this .name(in.getName()) .service(in.getService()); } }
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); } } } }
@Override public boolean apply(Host input) { return Objects.equal("compute", input.getService()); } };
public T fromHost(Host in) { return this .name(in.getName()) .service(in.getService()) .zone(in.getZone()); } }
public T fromHost(Host in) { return this .name(in.getName()) .service(in.getService()); } }
@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())); } }
@Override public String toString() { return string().toString(); }
public Host build() { return new Host(name, service, zone); }
public T fromHost(Host in) { return this .name(in.getName()) .service(in.getService()) .zone(in.getZone()); } }
@Override public String toString() { return string().toString(); }
public Host build() { return new Host(name, service, zone); }