> + .addHeader("X-Auth-Token", authToken)
> + .payload(payloadFromStringWithContentType(
> + "{\"os-getVNCConsole\":{\"type\":\"novnc\"}}",
> + "application/json"))
> +
> .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/"
> + + "servers/" + serverId + "/action")
> + .build();
> +
> + HttpResponse getConsoleResponse =
> HttpResponse.builder().statusCode(200)
> + .message("HTTP/1.1 200 OK")
> + .payload(payloadFromResourceWithContentType("/vnc_console.json",
> + "application/json; charset=UTF-8")).build();
> +
> + NovaApi api =
> requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
> + responseWithKeystoneAccess, extensionsOfNovaRequest,
> extensionsOfNovaResponse,
> + getConsole, getConsoleResponse);
Hi,
Following the examples, I tried this:
```
@Test(groups = "unit", testName = "ConsolesApiMockTest")
public class ConsolesApiMockTest extends BaseOpenStackMockTest<NovaApi> {
public void getVNCConsole() throws Exception {
String serverId = "5f64fca7-879b-4173-bf9c-8fa88330a4dc";
MockWebServer server = mockOpenStackServer();
server.enqueue(addCommonHeaders(new
MockResponse().setBody(stringFromResource("/keystoneAuthResponse.json"))));
server.enqueue(addCommonHeaders(new
MockResponse().setBody(stringFromResource("/extension_list_full.json"))));
try {
NovaApi novaApi = api(server.getUrl("/").toString(), "openstack-nova");
String zoneId = getFirst(novaApi.getConfiguredZones(), "RegionTwo");
Optional<? extends ConsolesApi> consolesApi =
novaApi.getConsolesExtensionForZone(zoneId);
...
} finally {
server.shutdown();
}
}
}
```
and I get an exception
```
org.jclouds.http.HttpResponseException: CacheLoader returned null for key
[identity=jclouds:joe, credential=letmein]. connecting to GET
https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/extensions HTTP/1.1
at
org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:162)
at
org.jclouds.rest.internal.InvokeSyncToAsyncHttpMethod.invoke(InvokeSyncToAsyncHttpMethod.java:129)
...
```
which is caused in `novaApi.getConsolesExtensionForZone(zoneId)` because it's
trying to actually connect to the publicURL for the specific zone. I don't know
how to proceed from this point, so once more I ask for your help!
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/339/files#r12129059