Search in sources :

Example 1 with Tenant

use of org.openstack4j.model.identity.v2.Tenant in project openstack4j by ContainX.

the class KeystoneTests method testAuthorizationFailure.

public void testAuthorizationFailure() throws IOException {
    // First we simulate a 401 Authorization error
    respondWith(401);
    // The retry logic should re-authenticate and would be expecting the
    // Access object
    respondWith(JSON_ACCESS);
    // The retry logic would then run the user lists expecting the proper
    // result
    respondWith(JSON_USERS);
    assertEquals(osv2.identity().users().list().size(), 8);
    // Positive test to make sure we are back in sync
    respondWith(JSON_TENANT);
    Tenant t = osv2.identity().tenants().get("b80f8d4e28b74188858b654cb1fccf7d");
    assertEquals(t.getName(), "admin");
}
Also used : Tenant(org.openstack4j.model.identity.v2.Tenant)

Example 2 with Tenant

use of org.openstack4j.model.identity.v2.Tenant in project openstack4j by ContainX.

the class KeystoneTests method testTenants.

/**
     * Tests tenant based operations
     *
     * @throws Exception
     */
public void testTenants() throws Exception {
    respondWith(JSON_TENANTS);
    List<? extends Tenant> tenants = osv2().identity().tenants().list();
    assertEquals(tenants.size(), 3);
    respondWith(JSON_TENANT);
    Tenant t = osv2().identity().tenants().get("b80f8d4e28b74188858b654cb1fccf7d");
    assertEquals(t.getName(), "admin");
}
Also used : Tenant(org.openstack4j.model.identity.v2.Tenant)

Aggregations

Tenant (org.openstack4j.model.identity.v2.Tenant)2