diff options
8 files changed, 424 insertions, 0 deletions
diff --git a/keystone-client/pom.xml b/keystone-client/pom.xml index b217d50..6c511f4 100644 --- a/keystone-client/pom.xml +++ b/keystone-client/pom.xml @@ -20,6 +20,18 @@ <artifactId>keystone-model</artifactId> <version>1.2.0-SNAPSHOT</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>
\ No newline at end of file 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 new file mode 100644 index 0000000..5ce9b60 --- /dev/null +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/KeystoneTest.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +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 { + + Keystone keystone = new Keystone(null, null); + + @Test + public void tokensTest() throws Exception { + keystone.tokens(); + } + + @Test + public void tenantsTest() throws Exception { + keystone.tenants(); + } + + @Test + public void usersTest() throws Exception { + keystone.users(); + } + + @Test + public void rolesTest() throws Exception { + keystone.roles(); + } + + @Test + public void servicesTest() throws Exception { + keystone.services(); + } + + @Test + public void endpointsTest() throws Exception { + 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 new file mode 100644 index 0000000..4464a7f --- /dev/null +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/EndpointsResourceTest.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +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 { + + EndpointsResource endpointsResource = new EndpointsResource(null); + + @Test + public void listTest() throws Exception { + endpointsResource.list(); + } + + @Test + public void createTest() throws Exception { + endpointsResource.create(new Endpoint()); + } + + @Test + public void showTest() throws Exception { + endpointsResource.show("123"); + } + + @Test + public void deleteTest() throws Exception { + 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 new file mode 100644 index 0000000..fa17a9d --- /dev/null +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/RolesResourceTest.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +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 { + + RolesResource rolesResource = new RolesResource(null); + + @Test + public void listTest() throws Exception { + rolesResource.list(); + } + + @Test + public void createTest() throws Exception { + rolesResource.create(new Role()); + } + + @Test + public void deleteTest() throws Exception { + 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 new file mode 100644 index 0000000..16251d6 --- /dev/null +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/ServicesResourceTest.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +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 { + + ServicesResource servicesResource = new ServicesResource(null); + + @Test + public void listTest() throws Exception { + servicesResource.list(); + } + + @Test + public void createTest() throws Exception { + servicesResource.create(new Service()); + } + + @Test + public void showTest() throws Exception { + servicesResource.show("123"); + } + + @Test + public void deleteTest() throws Exception { + 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 new file mode 100644 index 0000000..3e3137c --- /dev/null +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/TenantsResourceTest.java @@ -0,0 +1,103 @@ +/*- + * ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +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 { + + TenantsResource tenantsResource = new TenantsResource(null); + + @Test + public void listTest() throws Exception { + tenantsResource.list(); + } + + @Test + public void createTest() throws Exception { + tenantsResource.create(new Tenant()); + } + + @Test + public void showTest() throws Exception { + tenantsResource.show("123"); + } + + @Test + public void updateTest() throws Exception { + tenantsResource.update("123", new Tenant()); + } + + @Test + public void deleteTest() throws Exception { + tenantsResource.delete("123"); + } + + @Test + public void listUsersTest() throws Exception { + tenantsResource.listUsers("123"); + } + + @Test + public void addUserTest() throws Exception { + tenantsResource.addUser("123", "123", "123"); + } + + @Test + public void removeUserTest() throws Exception { + tenantsResource.removeUser("123", "123", "123"); + } + + @Test + public void listUserRolesTest() throws Exception { + tenantsResource.listUserRoles("tenantid", "userid"); + } + + @Test + public void showMetadataTest() throws Exception { + tenantsResource.showMetadata("123"); + } + + @Test + public void createOrUpdateMetadata() throws Exception { + tenantsResource.createOrUpdateMetadata("123", new Metadata()); + } + + @Test + public void replaceMetadataTest() throws Exception { + tenantsResource.replaceMetadata("123", new Metadata()); + } + + @Test + public void showMetadataItemTest() throws Exception { + tenantsResource.showMetadataItem("123", "123key"); + } + + @Test + public void createOrUpdateMetadataItemTest() throws Exception { + tenantsResource.createOrUpdateMetadataItem("123", "key", new Metadata()); + } + + @Test + public void deleteMetadataItemTest() throws Exception { + 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 new file mode 100644 index 0000000..0533b3c --- /dev/null +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/TokensResourceTest.java @@ -0,0 +1,62 @@ +/*- + * ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +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 { + + TokensResource tokensResource = new TokensResource(null); + TokensResource.Authenticate authenticate = tokensResource.new Authenticate(new Authentication() { + @Override + public String getTenantId() { + return super.getTenantId(); + } + + @Override + public void setTenantId(String tenantId) { + super.setTenantId(tenantId); + } + + @Override + public String getTenantName() { + return super.getTenantName(); + } + + @Override + public void setTenantName(String tenantName) { + super.setTenantName(tenantName); + } + }); + + @Test + public void authenticateTest() throws Exception { + tokensResource.authenticate(); + } + + @Test + public void withTenantIdTest() { + authenticate.withTenantId("123"); + } + + @Test + 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 new file mode 100644 index 0000000..bd51fdb --- /dev/null +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/UsersResourceTest.java @@ -0,0 +1,52 @@ +/*- + * ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +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 { + + UsersResource usersResource = new UsersResource(null); + + @Test + public void listTest() throws Exception { + usersResource.list(); + } + + @Test + public void createTest() throws Exception { + usersResource.create(new User()); + } + + @Test + public void showTest() throws Exception { + usersResource.show("123"); + } + + @Test + public void updateTest() throws Exception { + usersResource.update("123", new User()); + } + + @Test + public void deleteTest() throws Exception { + usersResource.delete("123"); + } + +}
\ No newline at end of file |