From 02b79106c34895aee914e3daefdaa89a281f568c Mon Sep 17 00:00:00 2001 From: Zack Shoylev Date: Wed, 18 Nov 2015 08:55:20 -0600 Subject: [PATCH] Fixes tenantId when using the keystone admin extension --- .../openstack/keystone/v2_0/options/CreateUserOptions.java | 6 +++--- .../keystone/v2_0/extensions/UserAdminApiMockTest.java | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/options/CreateUserOptions.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/options/CreateUserOptions.java index 1e1b843b6a..a9f5887c71 100644 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/options/CreateUserOptions.java +++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/options/CreateUserOptions.java @@ -34,7 +34,7 @@ import com.google.common.collect.ImmutableMap; public class CreateUserOptions implements MapBinder{ @Inject private BindToJsonPayload jsonBinder; - + private String tenant; private String password; private String email; @@ -75,7 +75,7 @@ public class CreateUserOptions implements MapBinder{ static class ServerRequest { final String name; - String tenant; + String tenantId; String password; String email; boolean enabled; @@ -97,7 +97,7 @@ public class CreateUserOptions implements MapBinder{ if (password != null) user.password = password; if (tenant != null) - user.tenant = tenant; + user.tenantId = tenant; user.enabled = enabled; return bindToRequest(request, ImmutableMap.of("user", user)); diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/extensions/UserAdminApiMockTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/extensions/UserAdminApiMockTest.java index 2c8ac3019b..86798e38f3 100644 --- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/extensions/UserAdminApiMockTest.java +++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/extensions/UserAdminApiMockTest.java @@ -48,7 +48,8 @@ public class UserAdminApiMockTest extends BaseOpenStackMockTest { try { KeystoneApi keystoneApi = api(server.getUrl("/").toString(), "openstack-keystone"); UserAdminApi userAdminApi = keystoneApi.getUserAdminApi().get(); - CreateUserOptions createUserOptions = CreateUserOptions.Builder.email("john.smith@example.org").enabled(true); + CreateUserOptions createUserOptions = CreateUserOptions.Builder.email("john.smith@example.org").enabled(true) + .tenant("12345"); User testUser = userAdminApi.create("jqsmith", "jclouds-password", createUserOptions); assertNotNull(testUser); @@ -61,7 +62,7 @@ public class UserAdminApiMockTest extends BaseOpenStackMockTest { assertEquals(createUserRequest.getRequestLine(), "POST /users HTTP/1.1"); assertEquals( new String(createUserRequest.getBody()), - "{\"user\":{\"name\":\"jqsmith\",\"password\":\"jclouds-password\",\"email\":\"john.smith@example.org\",\"enabled\":true}}"); + "{\"user\":{\"name\":\"jqsmith\",\"tenantId\":\"12345\",\"password\":\"jclouds-password\",\"email\":\"john.smith@example.org\",\"enabled\":true}}"); } finally { server.shutdown(); }