Search in sources :

Example 1 with KeystoneAuthenticationClient

use of org.openstack.keystone.auth.client.KeystoneAuthenticationClient in project platformlayer by platformlayer.

the class SmokeTest method listTenants_forgedToken.

@Test(expected = KeystoneAuthenticationException.class)
public void listTenants_forgedToken() throws Exception {
    KeystoneAuthenticationClient client = new KeystoneAuthenticationClient();
    KeystoneAuthenticationToken fakeToken = buildFakeToken("HELLOWORLD");
    client.listTenants(fakeToken);
}
Also used : KeystoneAuthenticationClient(org.openstack.keystone.auth.client.KeystoneAuthenticationClient) KeystoneAuthenticationToken(org.openstack.keystone.auth.client.KeystoneAuthenticationToken) Test(org.junit.Test)

Example 2 with KeystoneAuthenticationClient

use of org.openstack.keystone.auth.client.KeystoneAuthenticationClient in project platformlayer by platformlayer.

the class SmokeTest method test.

// private static StandaloneUserServer server;
// 
// @BeforeClass
// public static void startServer() throws Exception {
// File base = new File(".").getCanonicalFile();
// 
// while (!base.getName().equals("auth")) {
// base = base.getParentFile();
// }
// 
// base = new File(base, "server-user");
// 
// server = new StandaloneUserServer();
// server.start(base, 8081);
// }
// 
// @AfterClass
// public static void stopServer() throws Exception {
// server.stop();
// }
@Test
public void test() throws Exception {
    KeystoneAuthenticationClient client = new KeystoneAuthenticationClient();
    PasswordCredentials passwordCredentials = new PasswordCredentials();
    passwordCredentials.setUsername("user1");
    passwordCredentials.setPassword("secretuser1");
    String tenantId = null;
    client.authenticate(tenantId, passwordCredentials);
}
Also used : KeystoneAuthenticationClient(org.openstack.keystone.auth.client.KeystoneAuthenticationClient) PasswordCredentials(org.openstack.docs.identity.api.v2.PasswordCredentials) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 KeystoneAuthenticationClient (org.openstack.keystone.auth.client.KeystoneAuthenticationClient)2 PasswordCredentials (org.openstack.docs.identity.api.v2.PasswordCredentials)1 KeystoneAuthenticationToken (org.openstack.keystone.auth.client.KeystoneAuthenticationToken)1