public void testGetQuotasForCurrentTenant() { if (apiOption.isPresent()) { Quota quota = apiOption.get().getByTenant(tenant); assertQuotasIsValid(quota); } }
public void testGetQuotasForCurrentTenant() { if (apiOption.isPresent()) { Quota quota = apiOption.get().getByTenant(tenant); assertQuotasIsValid(quota); } }
public void testGetQuotasFailsTenantNotFound() throws Exception { URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-quota-sets/demo"); QuotaApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, authenticatedGET().endpoint(endpoint).build(), HttpResponse.builder().statusCode(404).build()).getQuotaExtensionForZone("az-1.region-a.geo-1").get(); assertNull(api.getByTenant("demo")); }
public void testGetQuotas() throws Exception { URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-quota-sets/demo"); QuotaApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, authenticatedGET().endpoint(endpoint).build(), HttpResponse.builder().statusCode(200).payload(payloadFromResource("/quotas.json")).build()).getQuotaExtensionForZone("az-1.region-a.geo-1").get(); assertEquals(api.getByTenant("demo"), getTestQuotas()); }
public void testUpdateQuotasOfCurrentTenantThenReset() { if (apiOption.isPresent()) { QuotaApi api = apiOption.get(); Quota before = api.getByTenant(tenant); assertQuotasIsValid(before); Quota modified = before.toBuilder() .cores(before.getCores() - 1) .instances(before.getInstances() - 1) .metadataItems(before.getMetadatas() - 1) .ram(before.getRam() - 1) .volumes(before.getVolumes() - 1) .build(); assertTrue(api.updateQuotaOfTenant(modified, tenant)); assertEquals(api.getByTenant(tenant), modified); assertTrue(api.updateQuotaOfTenant(before, tenant)); assertEquals(api.getByTenant(tenant), before); } }
public void testUpdateQuotasOfCurrentTenantThenReset() { if (apiOption.isPresent()) { QuotaApi api = apiOption.get(); Quota before = api.getByTenant(tenant); assertQuotasIsValid(before); Quota modified = before.toBuilder() .cores(before.getCores() - 1) .instances(before.getInstances() - 1) .metadataItems(before.getMetadatas() - 1) .ram(before.getRam() - 1) .volumes(before.getVolumes() - 1) .build(); assertTrue(api.updateQuotaOfTenant(modified, tenant)); assertEquals(api.getByTenant(tenant), modified); assertTrue(api.updateQuotaOfTenant(before, tenant)); assertEquals(api.getByTenant(tenant), before); } }
public void testGetQuotas() throws Exception { URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v2/3456/os-quota-sets/demo"); QuotaApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, authenticatedGET().endpoint(endpoint).build(), HttpResponse.builder().statusCode(200).payload(payloadFromResource("/quotas.json")).build()).getQuotaApi("az-1.region-a.geo-1").get(); assertEquals(api.getByTenant("demo"), getTestQuotas()); }