public void testGetServerWithSecurityGroupsFailNotFound() { URI endpoint = URI.create( "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v2/3456/os-create-server-ext/8d0a6ca5-8849-4b3d-b86e-f24c92490ebb"); ServerWithSecurityGroupsApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, authenticatedGET().endpoint(endpoint).build(), HttpResponse.builder().statusCode(404).build()) .getServerWithSecurityGroupsExtensionForZone("az-1.region-a.geo-1") .get(); assertNull(api.get("8d0a6ca5-8849-4b3d-b86e-f24c92490ebb")); }
public void testGetServerWithSecurityGroups() { URI endpoint = URI.create( "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v2/3456/os-create-server-ext/8d0a6ca5-8849-4b3d-b86e-f24c92490ebb"); ServerWithSecurityGroupsApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, authenticatedGET().endpoint(endpoint).build(), HttpResponse.builder() .statusCode(200) .payload(payloadFromResource("/server_with_security_groups.json")) .build()) .getServerWithSecurityGroupsExtensionForZone("az-1.region-a.geo-1") .get(); ServerWithSecurityGroups server = api.get("8d0a6ca5-8849-4b3d-b86e-f24c92490ebb"); assertEquals(server.getId(), "8d0a6ca5-8849-4b3d-b86e-f24c92490ebb"); assertEquals(server.getSecurityGroupNames(), ImmutableSet.of("default", "group1")); }