diff options
Diffstat (limited to 'keystone-client')
39 files changed, 190 insertions, 193 deletions
diff --git a/keystone-client/pom.xml b/keystone-client/pom.xml index 4bd7cd1..d0d4f2d 100644 --- a/keystone-client/pom.xml +++ b/keystone-client/pom.xml @@ -1,4 +1,5 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.so.libs</groupId> @@ -10,28 +11,28 @@ <name>OpenStack Keystone Client</name> <description>OpenStack Keystone Client</description> <dependencies> - <dependency> - <groupId>org.onap.so.libs.openstack-java-sdk</groupId> - <artifactId>openstack-client</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onap.so.libs.openstack-java-sdk</groupId> - <artifactId>keystone-model</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.jmockit</groupId> - <artifactId>jmockit</artifactId> - <version>1.19</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.12</version> - <scope>test</scope> - </dependency> + <dependency> + <groupId>org.onap.so.libs.openstack-java-sdk</groupId> + <artifactId>openstack-client</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.so.libs.openstack-java-sdk</groupId> + <artifactId>keystone-model</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.jmockit</groupId> + <artifactId>jmockit</artifactId> + <version>1.19</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> </dependencies> </project> diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/EndpointsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/EndpointsResource.java index db970a5..cf1909c 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/EndpointsResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/EndpointsResource.java @@ -25,63 +25,63 @@ import com.woorea.openstack.keystone.model.Endpoint; import com.woorea.openstack.keystone.model.Endpoints; public class EndpointsResource { - + private OpenStackClient client; - + public EndpointsResource(OpenStackClient client) { this.client = client; } - + public List list() { return new List(); } - + public Create create(Endpoint endpoint) { return new Create(endpoint); } - + public Show show(String id) { return new Show(id); } - + public Delete delete(String id) { return new Delete(id); } public class List extends OpenStackRequest<Endpoints> { - + public List() { super(client, HttpMethod.GET, "/endpoints", null, Endpoints.class); } } - + public class Create extends OpenStackRequest<Endpoint> { private Endpoint endpoint; - + public Create(Endpoint endpoint) { super(client, HttpMethod.POST, "/endpoints", Entity.json(endpoint), Endpoint.class); this.endpoint = endpoint; } - + } - + public class Show extends OpenStackRequest<Endpoint> { - + public Show(String id) { super(client, HttpMethod.GET, new StringBuilder("/endpoints/").append(id).toString(), null, Endpoint.class); } } - + public class Delete extends OpenStackRequest<Void> { - + public Delete(String id) { super(client, HttpMethod.DELETE, new StringBuilder("/endpoints/").append(id).toString(), null, Void.class); } - + } - + } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java index 71641fb..e7193b5 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java @@ -25,50 +25,51 @@ import com.woorea.openstack.keystone.model.Role; import com.woorea.openstack.keystone.model.Roles; public class RolesResource { - + private OpenStackClient client; - + public RolesResource(OpenStackClient client) { this.client = client; } - + public List list() { return new List(); } - + public Create create(Role role) { return new Create(role); } - + public Delete delete(String id) { return new Delete(id); } public class List extends OpenStackRequest<Roles> { - + public List() { super(client, HttpMethod.GET, "/OS-KSADM/roles", null, Roles.class); } } - + public class Create extends OpenStackRequest<Role> { private Role role; - + public Create(Role role) { super(client, HttpMethod.POST, "/OS-KSADM/roles", Entity.json(role), Role.class); this.role = role; } - + } - + public class Delete extends OpenStackRequest<Void> { - + public Delete(String id) { - super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/roles/").append(id).toString(), null, Void.class); + super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/roles/").append(id).toString(), null, + Void.class); } - + } - + } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/ServicesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/ServicesResource.java index 315d2be..033846f 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/ServicesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/ServicesResource.java @@ -25,62 +25,64 @@ import com.woorea.openstack.keystone.model.Service; import com.woorea.openstack.keystone.model.Services; public class ServicesResource { - + private OpenStackClient client; - + public ServicesResource(OpenStackClient client) { this.client = client; } - + public List list() { return new List(); } - + public Create create(Service service) { return new Create(service); } - + public Show show(String id) { return new Show(id); } - + public Delete delete(String id) { return new Delete(id); } public class List extends OpenStackRequest<Services> { - + public List() { super(client, HttpMethod.GET, "/OS-KSADM/services", null, Services.class); } } - + public class Create extends OpenStackRequest<Service> { private Service service; - + public Create(Service service) { super(client, HttpMethod.POST, "/OS-KSADM/services", Entity.json(service), Service.class); this.service = service; } - + } - + public class Show extends OpenStackRequest<Service> { - + public Show(String id) { - super(client, HttpMethod.GET, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, Service.class); + super(client, HttpMethod.GET, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, + Service.class); } } - + public class Delete extends OpenStackRequest<Void> { - + public Delete(String id) { - super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, Void.class); + super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, + Void.class); } - + } - + } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TenantsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TenantsResource.java index 0d0a027..3fbf545 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TenantsResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TenantsResource.java @@ -130,8 +130,7 @@ public class TenantsResource { private Tenant tenant; public Update(String id, Tenant tenant) { - super(client, HttpMethod.PUT, getTenantsString(id).toString(), Entity.json(tenant), - Tenant.class); + super(client, HttpMethod.PUT, getTenantsString(id).toString(), Entity.json(tenant), Tenant.class); this.tenant = tenant; } } @@ -146,16 +145,14 @@ public class TenantsResource { public class ListUsers extends OpenStackRequest<Users> { public ListUsers(String tenantId) { - super(client, HttpMethod.GET,getTenantsString(tenantId).append("/users").toString(), - null, Users.class); + super(client, HttpMethod.GET, getTenantsString(tenantId).append("/users").toString(), null, Users.class); } } public class AddUser extends OpenStackRequest<Void> { public AddUser(String tenantId, String userId, String roleId) { - super(client, HttpMethod.PUT, - getTenantsString(tenantId).append(USERS).append(userId) + super(client, HttpMethod.PUT, getTenantsString(tenantId).append(USERS).append(userId) .append("/roles/OS-KSADM/").append(roleId).toString(), null, Void.class); } } @@ -163,8 +160,7 @@ public class TenantsResource { public class RemoveUser extends OpenStackRequest<Void> { public RemoveUser(String tenantId, String userId, String roleId) { - super(client, HttpMethod.DELETE, - getTenantsString(tenantId).append(USERS).append(userId) + super(client, HttpMethod.DELETE, getTenantsString(tenantId).append(USERS).append(userId) .append("/roles/OS-KSADM/").append(roleId).toString(), null, Void.class); } } @@ -173,15 +169,14 @@ public class TenantsResource { public ListUserRoles(String tenantId, String userId) { super(client, HttpMethod.GET, - getTenantsString(tenantId).append(USERS).append(userId).append("/roles") - .toString(), null, Roles.class); + getTenantsString(tenantId).append(USERS).append(userId).append("/roles").toString(), null, + Roles.class); } } /** - * The following APIs support Tenant-level metadata. This is a feature supported - * by the DCP/LCP (i.e. AIC cloud), but not native Openstack. The full API as - * documented by AIC is implemented below. + * The following APIs support Tenant-level metadata. This is a feature supported by the DCP/LCP (i.e. AIC cloud), + * but not native Openstack. The full API as documented by AIC is implemented below. */ public class ShowMetadata extends OpenStackRequest<Metadata> { @@ -194,7 +189,7 @@ public class TenantsResource { public CreateOrUpdateMetadata(String tenantId, Metadata metadata) { super(client, HttpMethod.POST, getTenantsString(tenantId).append(METADATA), Entity.json(metadata), - Metadata.class); + Metadata.class); } } @@ -202,32 +197,31 @@ public class TenantsResource { public ReplaceMetadata(String tenantId, Metadata metadata) { super(client, HttpMethod.PUT, getTenantsString(tenantId).append(METADATA), Entity.json(metadata), - Metadata.class); + Metadata.class); } } public class ShowMetadataItem extends OpenStackRequest<Metadata> { public ShowMetadataItem(String tenantId, String key) { - super(client, HttpMethod.GET, - getTenantsString(tenantId).append(METADATA).append(key), null, Metadata.class); + super(client, HttpMethod.GET, getTenantsString(tenantId).append(METADATA).append(key), null, + Metadata.class); } } public class CreateOrUpdateMetadataItem extends OpenStackRequest<Metadata> { public CreateOrUpdateMetadataItem(String tenantId, String key, Metadata metadata) { - super(client, HttpMethod.POST, - getTenantsString(tenantId).append(METADATA).append(key), Entity.json(metadata), - Metadata.class); + super(client, HttpMethod.POST, getTenantsString(tenantId).append(METADATA).append(key), + Entity.json(metadata), Metadata.class); } } public class DeleteMetadataItem extends OpenStackRequest<Void> { public DeleteMetadataItem(String tenantId, String key) { - super(client, HttpMethod.DELETE, - getTenantsString(tenantId).append("/metadata/").append(key), null, Void.class); + super(client, HttpMethod.DELETE, getTenantsString(tenantId).append("/metadata/").append(key), null, + Void.class); } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/UsersResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/UsersResource.java index 87b7a46..bb02043 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/UsersResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/UsersResource.java @@ -82,8 +82,7 @@ public class UsersResource { private User user; public Update(String id, User user) { - super(client, HttpMethod.PUT, getUserString(id), Entity.json(user), - User.class); + super(client, HttpMethod.PUT, getUserString(id), Entity.json(user), User.class); this.user = user; } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneTokenProvider.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneTokenProvider.java index c3f52e6..97973fd 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneTokenProvider.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneTokenProvider.java @@ -42,9 +42,8 @@ public class KeystoneTokenProvider { public Access getAccessByTenant(String tenantName) { Access access = hashTenantAccess.get(tenantName); if (access == null) { - access = keystone.tokens().authenticate(new UsernamePassword(username, password)) - .withTenantName(tenantName) - .execute(); + access = keystone.tokens().authenticate(new UsernamePassword(username, password)).withTenantName(tenantName) + .execute(); hashTenantAccess.put(tenantName, access); } return access; @@ -59,8 +58,7 @@ public class KeystoneTokenProvider { return new OpenStackTokenProvider() { @Override public String getToken() { - return keystoneTokenProvider.getAccessByTenant(tenantName) - .getToken().getId(); + return keystoneTokenProvider.getAccessByTenant(tenantName).getToken().getId(); } @Override diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneUtils.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneUtils.java index 6f81781..29f41df 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneUtils.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneUtils.java @@ -21,8 +21,7 @@ import java.util.List; public class KeystoneUtils { - private KeystoneUtils() { - } + private KeystoneUtils() {} public static String findEndpointURL(List<Service> serviceCatalog, String type, String region, String facing) { for (Service service : serviceCatalog) { diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java index 44ffb2d..c7d547b 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java @@ -30,11 +30,13 @@ public class DomainUserRolesResource extends GenericResource<Role, Roles> { } public OpenStackRequest<Void> add(String roleId) { - return new OpenStackRequest<>(CLIENT, HttpMethod.PUT, new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class); + return new OpenStackRequest<>(CLIENT, HttpMethod.PUT, + new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class); } - + public OpenStackRequest<Void> remove(String roleId) { - return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(roleId).toString(), null, Void.class); + return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, + new StringBuilder(path).append("/").append(roleId).toString(), null, Void.class); } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java index c04aba0..d0e5665 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java @@ -25,13 +25,15 @@ public class DomainsResource extends GenericResource<Domain, Domains> { public DomainsResource(OpenStackClient client) { super(client, "/domains", Domain.class, Domains.class); } - + public DomainUserRolesResource userRoles(String domainId, String userId) { - return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString()); + return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId) + .append("/users/").append(userId).append("/roles").toString()); } - + public DomainUserRolesResource groupRoles(String domainId, String groupId) { - return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/groups/").append(groupId).append("/roles").toString()); + return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId) + .append("/groups/").append(groupId).append("/roles").toString()); } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GenericResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GenericResource.java index c27ab8b..1c1b4fa 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GenericResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GenericResource.java @@ -24,37 +24,40 @@ import com.woorea.openstack.base.client.OpenStackRequest; public class GenericResource<One, Many> { protected final OpenStackClient CLIENT; - + protected CharSequence path; - + protected Class<One> oneClass; protected Class<Many> manyClass; - + public GenericResource(OpenStackClient client, CharSequence path, Class<One> oneClass, Class<Many> manyClass) { CLIENT = client; this.path = path; this.oneClass = oneClass; this.manyClass = manyClass; } - + public OpenStackRequest<Many> list() { return new OpenStackRequest<>(CLIENT, HttpMethod.GET, path, null, manyClass); } - + public OpenStackRequest<One> create(One one) { return new OpenStackRequest<>(CLIENT, HttpMethod.POST, path, Entity.json(one), oneClass); } - + public OpenStackRequest<One> show(String id) { - return new OpenStackRequest<>(CLIENT, HttpMethod.GET, new StringBuilder(path).append("/").append(id).toString(), null, oneClass); + return new OpenStackRequest<>(CLIENT, HttpMethod.GET, new StringBuilder(path).append("/").append(id).toString(), + null, oneClass); } - + public OpenStackRequest<One> update(String id, One one) { - return new OpenStackRequest<>(CLIENT, HttpMethod.PATCH, new StringBuilder(path).append("/").append(id).toString(), Entity.json(one), oneClass); + return new OpenStackRequest<>(CLIENT, HttpMethod.PATCH, + new StringBuilder(path).append("/").append(id).toString(), Entity.json(one), oneClass); } - + public OpenStackRequest<One> delete(String id) { - return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(id).toString(), null, oneClass); + return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, + new StringBuilder(path).append("/").append(id).toString(), null, oneClass); } - + } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupsResource.java index c3b760f..6514ae6 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupsResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupsResource.java @@ -25,9 +25,10 @@ public class GroupsResource extends GenericResource<Group, Groups> { public GroupsResource(OpenStackClient client) { super(client, "/groups", Group.class, Groups.class); } - + public DomainUserRolesResource userRoles(String domainId, String userId) { - return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString()); + return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId) + .append("/users/").append(userId).append("/roles").toString()); } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/PoliciesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/PoliciesResource.java index d22416d..1a8fb42 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/PoliciesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/PoliciesResource.java @@ -17,7 +17,6 @@ package com.woorea.openstack.keystone.v3.api; import com.woorea.openstack.base.client.OpenStackClient; - import com.woorea.openstack.keystone.v3.model.Policies; import com.woorea.openstack.keystone.v3.model.Policy; diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResource.java index a2cd01c..4e26d88 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResource.java @@ -22,22 +22,24 @@ import com.woorea.openstack.base.client.OpenStackClient; import com.woorea.openstack.base.client.OpenStackRequest; public class ProjectRolesResource { - + private final OpenStackClient CLIENT; - + private final String PATH; public ProjectRolesResource(OpenStackClient client, String path) { this.CLIENT = client; this.PATH = path; } - + public OpenStackRequest<Void> add(String roleId) { - return new OpenStackRequest<>(CLIENT, HttpMethod.PUT, new StringBuilder(PATH).append("/").append(roleId).toString(), Entity.json(""), Void.class); + return new OpenStackRequest<>(CLIENT, HttpMethod.PUT, + new StringBuilder(PATH).append("/").append(roleId).toString(), Entity.json(""), Void.class); } - + public OpenStackRequest<Void> remove(String roleId) { - return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, new StringBuilder(PATH).append("/").append(roleId).toString(), null, Void.class); + return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, + new StringBuilder(PATH).append("/").append(roleId).toString(), null, Void.class); } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResource.java index 95f5d0c..9868882 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResource.java @@ -28,13 +28,15 @@ public class ProjectUserRolesResource extends GenericResource<Role, Roles> { public ProjectUserRolesResource(OpenStackClient client, String path) { super(client, path, Role.class, Roles.class); } - + public OpenStackRequest<Void> add(String roleId) { - return new OpenStackRequest<>(CLIENT, HttpMethod.PUT, new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class); + return new OpenStackRequest<>(CLIENT, HttpMethod.PUT, + new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class); } - + public OpenStackRequest<Void> remove(String roleId) { - return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(roleId).toString(), null, Void.class); + return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, + new StringBuilder(path).append("/").append(roleId).toString(), null, Void.class); } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectsResource.java index 900ce20..a5cb8f2 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectsResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectsResource.java @@ -27,17 +27,20 @@ public class ProjectsResource extends GenericResource<Project, Projects> { public ProjectsResource(OpenStackClient client) { super(client, "/projects", Project.class, Projects.class); } - + public OpenStackRequest<Users> users(String projectId) { - return CLIENT.get(new StringBuilder(path).append("/").append(projectId).append("/users/").toString(), Users.class); + return CLIENT.get(new StringBuilder(path).append("/").append(projectId).append("/users/").toString(), + Users.class); } - + public ProjectUserRolesResource userRoles(String projectId, String userId) { - return new ProjectUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(projectId).append("/users/").append(userId).append("/roles").toString()); + return new ProjectUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(projectId) + .append("/users/").append(userId).append("/roles").toString()); } - + public ProjectUserRolesResource groupRoles(String projectId, String groupId) { - return new ProjectUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(projectId).append("/groups/").append(groupId).append("/roles").toString()); + return new ProjectUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(projectId) + .append("/groups/").append(groupId).append("/roles").toString()); } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/RolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/RolesResource.java index ae8fc60..864764d 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/RolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/RolesResource.java @@ -27,9 +27,10 @@ public class RolesResource extends GenericResource<Role, Roles> { public RolesResource(OpenStackClient client) { super(client, "/roles", Role.class, Roles.class); } - + public OpenStackRequest<Users> users(String domainId, String userId) { - return CLIENT.get(new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString(), Users.class); + return CLIENT.get(new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId) + .append("/roles").toString(), Users.class); } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/TokensResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/TokensResource.java index 9d176d7..fda51f2 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/TokensResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/TokensResource.java @@ -24,35 +24,35 @@ import com.woorea.openstack.keystone.v3.model.Authentication; import com.woorea.openstack.keystone.v3.model.Token; public class TokensResource { - + private final OpenStackClient CLIENT; - + public TokensResource(OpenStackClient client) { CLIENT = client; } - + public Authenticate authenticate(Authentication authentication) { return new Authenticate(authentication); } - + public OpenStackRequest<Token> show() { return CLIENT.get("/auth/tokens", Token.class); } public class Authenticate extends OpenStackRequest<Token> { - + private Authentication authentication; - + public Authenticate() { - + } - + public Authenticate(Authentication authentication) { super(CLIENT, HttpMethod.POST, "/auth/tokens", Entity.json(authentication), Token.class); this.authentication = authentication; } } - + } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/UsersResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/UsersResource.java index 0e1e609..dc6894a 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/UsersResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/UsersResource.java @@ -27,17 +27,20 @@ public class UsersResource extends GenericResource<User, Users> { public UsersResource(OpenStackClient client) { super(client, "/users", User.class, Users.class); } - + public OpenStackRequest<Services> groups(String userId) { - return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/groups").toString(), Services.class); + return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/groups").toString(), + Services.class); } - + public OpenStackRequest<Services> projects(String userId) { - return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/projects").toString(), Services.class); + return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/projects").toString(), + Services.class); } - + public OpenStackRequest<Services> roles(String userId) { - return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/roles").toString(), Services.class); + return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/roles").toString(), + Services.class); } } diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/KeystoneTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/KeystoneTest.java index 7a00fd4..ae61d98 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/KeystoneTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/KeystoneTest.java @@ -21,9 +21,7 @@ package com.woorea.openstack.keystone; import com.woorea.openstack.base.client.OpenStackClientConnector; import org.junit.Test; - import javax.swing.table.TableStringConverter; - import static org.junit.Assert.*; public class KeystoneTest { @@ -60,4 +58,4 @@ public class KeystoneTest { keystone.endpoints(); } -}
\ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/api/EndpointsResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/EndpointsResourceTest.java index 324dc3c..08886a7 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/api/EndpointsResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/EndpointsResourceTest.java @@ -21,7 +21,6 @@ package com.woorea.openstack.keystone.api; import com.woorea.openstack.keystone.model.Endpoint; import org.junit.Test; - import static org.junit.Assert.*; public class EndpointsResourceTest { @@ -48,4 +47,4 @@ public class EndpointsResourceTest { endpointsResource.delete("123"); } -}
\ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/api/RolesResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/RolesResourceTest.java index d8d851a..8031ce0 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/api/RolesResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/RolesResourceTest.java @@ -21,7 +21,6 @@ package com.woorea.openstack.keystone.api; import com.woorea.openstack.keystone.model.Role; import org.junit.Test; - import static org.junit.Assert.*; public class RolesResourceTest { @@ -43,4 +42,4 @@ public class RolesResourceTest { rolesResource.delete("123"); } -}
\ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/api/ServicesResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/ServicesResourceTest.java index 25de26e..a74f376 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/api/ServicesResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/ServicesResourceTest.java @@ -21,7 +21,6 @@ package com.woorea.openstack.keystone.api; import com.woorea.openstack.keystone.model.Service; import org.junit.Test; - import static org.junit.Assert.*; public class ServicesResourceTest { @@ -48,4 +47,4 @@ public class ServicesResourceTest { servicesResource.delete("123"); } -}
\ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/api/TenantsResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/TenantsResourceTest.java index 8d208f9..5323f27 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/api/TenantsResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/TenantsResourceTest.java @@ -22,7 +22,6 @@ package com.woorea.openstack.keystone.api; import com.woorea.openstack.keystone.model.Metadata; import com.woorea.openstack.keystone.model.Tenant; import org.junit.Test; - import static org.junit.Assert.*; public class TenantsResourceTest { @@ -104,4 +103,4 @@ public class TenantsResourceTest { tenantsResource.deleteMetadataItem("123", "key"); } -}
\ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/api/TokensResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/TokensResourceTest.java index 9ad711e..77c26a9 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/api/TokensResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/TokensResourceTest.java @@ -21,7 +21,6 @@ package com.woorea.openstack.keystone.api; import com.woorea.openstack.keystone.model.Authentication; import org.junit.Test; - import static org.junit.Assert.*; public class TokensResourceTest { @@ -63,4 +62,4 @@ public class TokensResourceTest { public void withTenantNameTest() { authenticate.withTenantName("123"); } -}
\ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/api/UsersResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/UsersResourceTest.java index 547458b..881eb92 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/api/UsersResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/UsersResourceTest.java @@ -21,7 +21,6 @@ package com.woorea.openstack.keystone.api; import com.woorea.openstack.keystone.model.User; import org.junit.Test; - import static org.junit.Assert.*; public class UsersResourceTest { @@ -53,4 +52,4 @@ public class UsersResourceTest { usersResource.delete("123"); } -}
\ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/utils/KeystoneTokenProviderTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/utils/KeystoneTokenProviderTest.java index 0523f2f..5e51ebc 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/utils/KeystoneTokenProviderTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/utils/KeystoneTokenProviderTest.java @@ -20,14 +20,11 @@ package com.woorea.openstack.keystone.utils; import org.junit.Test; - import static org.junit.Assert.*; public class KeystoneTokenProviderTest { - KeystoneTokenProvider keystoneTokenProvider = new KeystoneTokenProvider("endpoint", - "username", - "password"); + KeystoneTokenProvider keystoneTokenProvider = new KeystoneTokenProvider("endpoint", "username", "password"); @Test(expected = NullPointerException.class) public void getAccessByTenant() throws Exception { @@ -44,4 +41,4 @@ public class KeystoneTokenProviderTest { keystoneTokenProvider.getProviderByTenant("id-123"); } -}
\ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/utils/KeystoneUtilsTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/utils/KeystoneUtilsTest.java index 2b65a91..2a7a8e1 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/utils/KeystoneUtilsTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/utils/KeystoneUtilsTest.java @@ -21,10 +21,8 @@ package com.woorea.openstack.keystone.utils; import com.woorea.openstack.keystone.model.Access.Service; import org.junit.Test; - import java.util.Arrays; import java.util.List; - import static org.junit.Assert.*; public class KeystoneUtilsTest { @@ -35,4 +33,4 @@ public class KeystoneUtilsTest { KeystoneUtils.findEndpointURL(services, "type", "region", "facing"); } -}
\ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/KeystoneTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/KeystoneTest.java index 0be1a9e..a8e5dee 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/KeystoneTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/KeystoneTest.java @@ -23,7 +23,6 @@ import com.woorea.openstack.base.client.OpenStackClientConnector; import com.woorea.openstack.base.client.OpenStackRequest; import com.woorea.openstack.base.client.OpenStackResponse; import org.junit.Test; - import static org.junit.Assert.*; public class KeystoneTest { @@ -70,4 +69,4 @@ public class KeystoneTest { keystone.endpoints(); } -}
\ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/DomainsResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/DomainsResourceTest.java index 1ba5b4f..0f83a4f 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/DomainsResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/DomainsResourceTest.java @@ -35,4 +35,4 @@ public class DomainsResourceTest { domainsResource.groupRoles("test", "test"); } -}
\ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/GenericResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/GenericResourceTest.java index 4cd1959..75e8bd5 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/GenericResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/GenericResourceTest.java @@ -22,7 +22,6 @@ package com.woorea.openstack.keystone.v3.api; import com.woorea.openstack.keystone.v3.model.User; import com.woorea.openstack.keystone.v3.model.Users; import org.junit.Test; - import static org.junit.Assert.*; public class GenericResourceTest { @@ -54,4 +53,4 @@ public class GenericResourceTest { genericResource.delete("123"); } -}
\ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/GroupsResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/GroupsResourceTest.java index 8864758..8ce7cd3 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/GroupsResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/GroupsResourceTest.java @@ -30,4 +30,4 @@ public class GroupsResourceTest { groupsResource.userRoles("test", "test"); } -}
\ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectGroupRolesResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectGroupRolesResourceTest.java index dda74d2..58dfeab 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectGroupRolesResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectGroupRolesResourceTest.java @@ -46,4 +46,4 @@ public class ProjectGroupRolesResourceTest { projectGroupRolesResource.delete("test"); } -}
\ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResourceTest.java index b529579..4b0d70e 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResourceTest.java @@ -35,4 +35,4 @@ public class ProjectRolesResourceTest { projectRolesResource.remove("test"); } -}
\ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResourceTest.java index e0aed69..23518a2 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResourceTest.java @@ -35,4 +35,4 @@ public class ProjectUserRolesResourceTest { projectUserRolesResource.remove("roleid"); } -}
\ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectsResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectsResourceTest.java index 8759ed3..2e6cb67 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectsResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectsResourceTest.java @@ -40,4 +40,4 @@ public class ProjectsResourceTest { projectsResource.groupRoles("pid", "gid"); } -}
\ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/RolesResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/RolesResourceTest.java index c45e2ed..a8b0ee9 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/RolesResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/RolesResourceTest.java @@ -30,4 +30,4 @@ public class RolesResourceTest { rolesResource.users("domainid", "userid"); } -}
\ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/TokensResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/TokensResourceTest.java index d06c823..ddcfc6c 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/TokensResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/TokensResourceTest.java @@ -36,4 +36,4 @@ public class TokensResourceTest { tokensResource.show(); } -}
\ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/UsersResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/UsersResourceTest.java index 2c64f06..247101c 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/UsersResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/UsersResourceTest.java @@ -40,4 +40,4 @@ public class UsersResourceTest { usersResource.roles("uid"); } -}
\ No newline at end of file +} |