public T fromTenant(Tenant in) { return this .id(in.getId()) .name(in.getName()) .description(in.getDescription()); } }
public Tenant build() { return new Tenant(id, name, description); }
@Override public String toString() { return string().toString(); }
@Override public String apply(Tenant input) { return input.getId(); } });
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); } }
public void testTenantsByName() { TenantApi tenantApi = api.getTenantApi().get(); for (Tenant tenant : tenantApi.list().concat()) { Tenant aTenant = tenantApi.getByName(tenant.getName()); assertNotNull(aTenant, "get returned null for tenant: " + tenant); assertEquals(aTenant, tenant); } } }
public void testListTenants() { ServiceApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint + "/v2.0/tenants").build(), HttpResponse.builder().statusCode(200) .payload(payloadFromResourceWithContentType("/tenant_list.json", APPLICATION_JSON)).build()) .getServiceApi(); Set<? extends Tenant> tenants = api.listTenants(); assertNotNull(tenants); assertFalse(tenants.isEmpty()); Set<Tenant> expected = ImmutableSet.of(Tenant.builder().name("demo").id("05d1dc7af71646deba64cfc17b81bec0") .build(), Tenant.builder().name("admin").id("7aa2e17ec29f44d193c48feaba0852cc").build()); assertEquals(tenants, expected); }
@Override public String apply(Tenant input) { return input.getId(); } });
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); }
public void testTenantsByName() { TenantApi tenantApi = api.getTenantApi().get(); for (Tenant tenant : tenantApi.list().concat()) { Tenant aTenant = tenantApi.getByName(tenant.getName()); assertNotNull(aTenant, "get returned null for tenant: " + tenant); assertEquals(aTenant, tenant); } } }
@Test(enabled = false) public void testListTenantsATT() { TenantApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint + "/v2.0/tenants").build(), HttpResponse.builder().statusCode(200).payload( payloadFromResourceWithContentType("/tenant_list_att.json", APPLICATION_JSON)).build()) .getTenantApi().get(); Set<Tenant> expected = ImmutableSet.of(Tenant.builder().name("this-is-a-test").id("14").description("None").build()); assertEquals(api.list().concat().toSet(), expected); }
public T fromTenant(Tenant in) { return this .id(in.getId()) .name(in.getName()) .description(in.getDescription()); } }
@Override public String apply(Tenant input) { return input.getId(); } });
@Override public String toString() { return string().toString(); }
public Tenant build() { return new Tenant(id, name, description); }
@Test(enabled = false) public void testListTenantsATT() { TenantApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint + "/v2.0/tenants").build(), HttpResponse.builder().statusCode(200).payload( payloadFromResourceWithContentType("/tenant_list_att.json", APPLICATION_JSON)).build()) .getTenantApi().get(); Set<Tenant> expected = ImmutableSet.of(Tenant.builder().name("this-is-a-test").id("14").description("None").build()); assertEquals(api.list().concat().toSet(), expected); }
public T fromTenant(Tenant in) { return this .id(in.getId()) .name(in.getName()) .description(in.getDescription()); } }
@Override public String apply(Tenant input) { return input.getId(); } });
@Override public String toString() { return string().toString(); }
public Tenant build() { return new Tenant(id, name, description, enabled); }