@SuppressWarnings("unchecked") @Override public IterableWithMarker<Tenant> apply(Object input) { PaginationOptions paginationOptions = PaginationOptions.class.cast(input); return IterableWithMarker.class.cast(tenantApi.list(paginationOptions)); }
public boolean apply(TenantApi tenantApi) { return tenantApi.get(tenantId) == null; } }, 5 * 1000L).apply(tenantApi.get()));
public void testTenants() { TenantApi tenantApi = api.getTenantApi().get(); Set<? extends Tenant> result = tenantApi.list().concat().toSet(); assertNotNull(result); assertFalse(result.isEmpty()); for (Tenant tenant : result) { assertNotNull(tenant.getId()); Tenant aTenant = tenantApi.get(tenant.getId()); assertNotNull(aTenant, "get returned null for tenant: " + tenant); assertEquals(aTenant, tenant); } }
public void testGetTenantByNameFailNotFound() { TenantApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint + "/v2.0/tenants?name=admin").build(), HttpResponse.builder().statusCode(404).build()).getTenantApi().get(); assertNull(api.getByName("admin")); }
public void testTenants() { TenantApi tenantApi = api.getTenantApi().get(); Set<? extends Tenant> result = tenantApi.list().concat().toSet(); assertNotNull(result); assertFalse(result.isEmpty()); for (Tenant tenant : result) { assertNotNull(tenant.getId()); Tenant aTenant = tenantApi.get(tenant.getId()); assertNotNull(aTenant, "get returned null for tenant: " + tenant); assertEquals(aTenant, tenant); } }
public void testGetTenantByName() { TenantApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint + "/v2.0/tenants?name=admin").build(), HttpResponse.builder().statusCode(200).payload( payloadFromResourceWithContentType("/tenant_details.json", APPLICATION_JSON)).build()) .getTenantApi().get(); Tenant tenant = api.getByName("admin"); assertNotNull(tenant); assertEquals(tenant, Tenant.builder().id("013ba41150a14830bec85ffe93353bcc").name("admin").build()); }
@SuppressWarnings("unchecked") @Override public IterableWithMarker<Tenant> apply(Object input) { PaginationOptions paginationOptions = PaginationOptions.class.cast(input); return IterableWithMarker.class.cast(tenantApi.list(paginationOptions)); }
public boolean apply(TenantApi tenantApi) { return tenantApi.get(testTenant.getId()) != null; } }, 180 * 1000L).apply(tenantApi.get()));
public void testGetTenantByName() { TenantApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint + "/v2.0/tenants?name=admin").build(), HttpResponse.builder().statusCode(200).payload( payloadFromResourceWithContentType("/tenant_details.json", APPLICATION_JSON)).build()) .getTenantApi().get(); Tenant tenant = api.getByName("admin"); assertNotNull(tenant); assertEquals(tenant, Tenant.builder().id("013ba41150a14830bec85ffe93353bcc").name("admin").enabled(true). build()); }
@SuppressWarnings("unchecked") @Override public IterableWithMarker<Tenant> apply(Object input) { PaginationOptions paginationOptions = PaginationOptions.class.cast(input); return IterableWithMarker.class.cast(tenantApi.list(paginationOptions)); }
public void testCreateTenant() { testTenant = tenantAdminOption.get().create("jclouds-test-tenant", CreateTenantOptions.Builder.enabled(true).description("jclouds-test-description")); assertTrue(retry(new Predicate<TenantApi>() { public boolean apply(TenantApi tenantApi) { return tenantApi.get(testTenant.getId()) != null; } }, 180 * 1000L).apply(tenantApi.get())); assertEquals(tenantApi.get().get(testTenant.getId()).getName(), "jclouds-test-tenant"); assertEquals(tenantApi.get().get(testTenant.getId()).getDescription(), "jclouds-test-description"); assertEquals(tenantApi.get().get(testTenant.getId()).isEnabled(), true); }
@SuppressWarnings("unchecked") @Override public IterableWithMarker<Tenant> apply(Object input) { PaginationOptions paginationOptions = PaginationOptions.class.cast(input); return IterableWithMarker.class.cast(tenantApi.list(paginationOptions)); }
public void testUpdateTenant() { testTenant = tenantAdminOption.get().update( testTenant.getId(), UpdateTenantOptions.Builder.description("jclouds-test-description-modified").enabled(false) .name("jclouds-test-tenant-modified")); assertEquals(tenantApi.get().get(testTenant.getId()).getName(), "jclouds-test-tenant-modified"); assertEquals(tenantApi.get().get(testTenant.getId()).getDescription(), "jclouds-test-description-modified"); assertEquals(tenantApi.get().get(testTenant.getId()).isEnabled(), false); } }
@SuppressWarnings("unchecked") @Override public IterableWithMarker<Tenant> apply(Object input) { PaginationOptions paginationOptions = PaginationOptions.class.cast(input); return IterableWithMarker.class.cast(tenantApi.list(paginationOptions)); }
@Test(expectedExceptions = AuthorizationException.class) public void testListTenantsFailNotAuthorized() { TenantApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint + "/v2.0/tenants/013ba41150a14830bec85ffe93353bcc").build(), HttpResponse.builder().statusCode(401).build()).getTenantApi().get(); api.get("013ba41150a14830bec85ffe93353bcc"); }
@SuppressWarnings("unchecked") @Override public IterableWithMarker<Tenant> apply(Object input) { return IterableWithMarker.class.cast(tenantApi.list(marker(input.toString()))); }
public void testGetTenant() { TenantApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint + "/v2.0/tenants/013ba41150a14830bec85ffe93353bcc").build(), HttpResponse.builder().statusCode(200).payload( payloadFromResourceWithContentType("/tenant_details.json", APPLICATION_JSON)).build()) .getTenantApi().get(); Tenant tenant = api.get("013ba41150a14830bec85ffe93353bcc"); assertNotNull(tenant); assertEquals(tenant, Tenant.builder().id("013ba41150a14830bec85ffe93353bcc").name("admin").build()); }
@SuppressWarnings("unchecked") @Override public IterableWithMarker<Tenant> apply(Object input) { return IterableWithMarker.class.cast(tenantApi.list(marker(input.toString()))); }