use of com.att.cdp.zones.model.Tenant in project AJSC by att.
the class TestOpenStackContext method testLoginLogout.
/**
* Test that we can login and out of the provider, and access the services once logged in (so we dont have to
* repeatedly login/out)
*
* @throws ZoneException
*/
@Test
@Ignore
public void testLoginLogout() throws ZoneException {
OpenStackContext context = login();
/*
* make sure we can retreive all of the services
*/
ComputeService computeService = context.getComputeService();
assertNotNull(computeService);
IdentityService identityService = context.getIdentityService();
assertNotNull(identityService);
ImageService imageService = context.getImageService();
assertNotNull(imageService);
NetworkService networkService = context.getNetworkService();
assertNotNull(networkService);
VolumeService volumeService = context.getVolumeService();
assertNotNull(volumeService);
SnapshotService snapshotService = context.getSnapshotService();
assertNotNull(snapshotService);
StackService stackService = context.getStackService();
assertNotNull(stackService);
/*
* Services are locally cached by the provider context. If we get them again, we should get the same exact
* object. Check that too.
*/
assertTrue(computeService == context.getComputeService());
assertTrue(identityService == context.getIdentityService());
assertTrue(imageService == context.getImageService());
assertTrue(networkService == context.getNetworkService());
assertTrue(volumeService == context.getVolumeService());
assertTrue(snapshotService == context.getSnapshotService());
assertTrue(stackService == context.getStackService());
/*
* Test that we can also obtain the connectors
*/
GlanceConnector glanceConnector = context.getGlanceConnector();
assertNotNull(glanceConnector);
NovaConnector novaConnector = context.getNovaConnector();
assertNotNull(novaConnector);
QuantumConnector quantumConnector = context.getQuantumConnector();
assertNotNull(quantumConnector);
/*
* Connectors are locally cached, check that
*/
assertTrue(glanceConnector == context.getGlanceConnector());
assertTrue(novaConnector == context.getNovaConnector());
assertTrue(quantumConnector == context.getQuantumConnector());
/*
* Now, check that we can obtain the tenant as well
*/
Tenant tenant = context.getTenant();
assertNotNull(tenant);
assertEquals(tenant.getName(), context.getTenantName());
assertEquals(tenant.getId(), context.getTenantId());
logout(context);
}
use of com.att.cdp.zones.model.Tenant in project AJSC by att.
the class AbstractOpenStackIdentityService method getTenants.
public Set<Tenant> getTenants() throws ZoneException {
checkLoggedIn();
Context context = getContext();
trackRequest();
Set<Tenant> tenants = new HashSet<Tenant>();
Keystone keystone = getKeystone();
keystoneUrl = context.getProperties().getProperty(ContextFactory.PROPERTY_IDENTITY_URL);
try {
Tenants tenantList = keystone.tenants().list().execute();
for (com.woorea.openstack.keystone.model.Tenant t : tenantList.getList()) {
tenants.add(new OpenStackTenant((OpenStackContext) context, t));
}
} catch (OpenStackConnectException e) {
throw new ContextConnectionException(EELFResourceManager.format(OSMsg.PAL_OS_CONNECTION_FAILED, "Identity", keystoneUrl), e);
} catch (OpenStackResponseException e) {
throw new ZoneException(EELFResourceManager.format(OSMsg.PAL_OS_REQUEST_FAILURE, "get tenant " + tenantName), e);
}
return tenants;
}
use of com.att.cdp.zones.model.Tenant in project AJSC by att.
the class TestTenant method testConnectedTenant.
/**
* tests that once a context exists and a login has occurred, that the tenant object can be obtained
*/
@SuppressWarnings("unused")
@Test
public void testConnectedTenant() {
Tenant tenant;
try {
tenant = context.getTenant();
assertNotNull(tenant);
// Context ctx = tenant.getContext();
} catch (ZoneException e1) {
e1.printStackTrace();
fail("Should have succeeded!");
}
}
Aggregations