2 * This document is a part of the source code and related artifacts
3 * for CollectionSpace, an open source collections management system
4 * for museums and related institutions:
6 * http://www.collectionspace.org
7 * http://wiki.collectionspace.org
9 * Copyright 2010 University of California at Berkeley
11 * Licensed under the Educational Community License (ECL), Version 2.0.
12 * You may not use this file except in compliance with this License.
14 * You may obtain a copy of the ECL 2.0 License at
16 * https://source.collectionspace.org/collection-space/LICENSE.txt
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
25 * To change this template, choose Tools | Templates
26 * and open the template in the editor.
28 package org.collectionspace.services.security.client.test;
30 import java.util.ArrayList;
31 import java.util.Collection;
32 import java.util.Date;
33 import java.util.Hashtable;
34 import java.util.List;
35 import javax.ws.rs.core.Response;
36 import org.collectionspace.services.account.AccountsCommon;
37 import org.collectionspace.services.authorization.AccountRole;
38 import org.collectionspace.services.authorization.AccountValue;
39 import org.collectionspace.services.authorization.perms.ActionType;
40 import org.collectionspace.services.authorization.perms.EffectType;
42 import org.collectionspace.services.authorization.perms.Permission;
43 import org.collectionspace.services.authorization.perms.PermissionAction;
44 import org.collectionspace.services.authorization.PermissionRole;
45 import org.collectionspace.services.authorization.PermissionValue;
46 import org.collectionspace.services.authorization.Role;
47 import org.collectionspace.services.authorization.RoleValue;
48 import org.collectionspace.services.client.AccountClient;
49 import org.collectionspace.services.client.AccountFactory;
50 import org.collectionspace.services.client.AccountRoleClient;
51 import org.collectionspace.services.client.AccountRoleFactory;
52 import org.collectionspace.services.client.CollectionSpaceClient;
53 import org.collectionspace.services.client.DimensionClient;
54 import org.collectionspace.services.client.DimensionFactory;
55 import org.collectionspace.services.client.PayloadOutputPart;
56 import org.collectionspace.services.client.PermissionClient;
57 import org.collectionspace.services.client.PermissionFactory;
58 import org.collectionspace.services.client.PermissionRoleClient;
59 import org.collectionspace.services.client.PermissionRoleFactory;
60 import org.collectionspace.services.client.PoxPayloadIn;
61 import org.collectionspace.services.client.PoxPayloadOut;
62 import org.collectionspace.services.client.RoleClient;
63 import org.collectionspace.services.client.RoleFactory;
64 import org.collectionspace.services.client.test.BaseServiceTest;
65 import org.collectionspace.services.dimension.DimensionsCommon;
66 import org.collectionspace.services.jaxb.AbstractCommonList;
67 import org.jboss.resteasy.client.ClientResponse;
69 import org.testng.Assert;
70 import org.testng.annotations.Test;
72 import org.slf4j.Logger;
73 import org.slf4j.LoggerFactory;
74 import org.testng.annotations.AfterClass;
75 import org.testng.annotations.BeforeClass;
78 * AuthorizationServiceTest, carries out tests against a
79 * deployed and running Permission, Role, AccountRole, PermissionRole and
80 * CollectionObject Services.
82 * Pre-requisite : authorization-mgt/client tests seed some permissions used
85 * $LastChangedRevision: 917 $
86 * $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri, 06 Nov 2009) $
88 public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
90 private static class UserInfo {
94 UserInfo(String u, String p) {
100 private final String CLASS_NAME = MultiTenancyTest.class.getName();
101 private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
102 private final static String TENANT_1_ADMIN_USER = "admin@core.collectionspace.org";
103 private final static String TENANT_2_ADMIN_USER = "admin@lifesci.collectionspace.org";
104 private final static String TENANT_ADMIN_PASS = "Administrator";
105 private final static String TENANT_1_USER = "user1@museum1.org";
106 private final static String TENANT_2_USER = "user2@museum2.org";
107 private final static String TENANT_1 = "1";
108 private final static String TENANT_2 = "2";
109 private final static String TEST_ROLE_NAME = "ROLE_TEST_REGISTRAR";
110 private final static String TEST_SERVICE_A = "dimensions";
112 // Instance variables specific to this test.
113 private String TENANT_RESOURCE_1 = null;
114 private String TENANT_RESOURCE_2 = null;
115 //key for userAccounts is userId
116 private Hashtable<String, AccountValue> userAccounts = new Hashtable<String, AccountValue>();
117 //key for permValues is id as there could be several perms for the same resource
118 private Hashtable<String, PermissionValue> permValues = new Hashtable<String, PermissionValue>();
119 //key for all tenantXXX tables is tenant id, expecting only one entity per tenant for this test
120 private Hashtable<String, UserInfo> tenantAdminUsers = new Hashtable<String, UserInfo>();
121 private Hashtable<String, AccountValue> tenantAccounts = new Hashtable<String, AccountValue>();
122 private Hashtable<String, RoleValue> tenantRoles = new Hashtable<String, RoleValue>();
123 private Hashtable<String, Role> tenantAdminRoles = new Hashtable<String, Role>();
124 private Hashtable<String, PermissionValue> tenantPermissions = new Hashtable<String, PermissionValue>();
127 * This method is called only by the parent class, AbstractServiceTestImpl
130 protected String getServicePathComponent() {
134 @BeforeClass(alwaysRun = true)
135 public void seedData() {
136 //tenant admin users are used to create accounts, roles and permissions and relationships
137 //assumption : two tenant admin users exist before running this test
138 tenantAdminUsers.put(TENANT_1, new UserInfo(TENANT_1_ADMIN_USER, TENANT_ADMIN_PASS));
139 tenantAdminUsers.put(TENANT_2, new UserInfo(TENANT_2_ADMIN_USER, TENANT_ADMIN_PASS));
145 seedPermissionRoles();
148 private void seedAccounts() {
149 seedAccount(TENANT_1, TENANT_1_USER);
150 seedAccount(TENANT_2, TENANT_2_USER);
153 private void seedAccount(String tenantId, String userId) {
154 //create account using default user in admin role but assign tenant id
155 //create username, email and password same for simplicity
156 String accId = createAccount(tenantId, userId, userId);
157 AccountValue ava = new AccountValue();
158 ava.setScreenName(userId);
159 ava.setUserId(userId);
160 ava.setAccountId(accId);
161 userAccounts.put(ava.getUserId(), ava);
162 tenantAccounts.put(tenantId, ava);
163 if (logger.isDebugEnabled()) {
164 logger.debug("seedAccount tenantId=" + tenantId + " userId=" + userId);
168 private void seedPermissions() {
169 String resource = TEST_SERVICE_A;
171 PermissionAction pac = new PermissionAction();
172 pac.setName(ActionType.CREATE);
173 PermissionAction par = new PermissionAction();
174 par.setName(ActionType.READ);
175 PermissionAction pau = new PermissionAction();
176 pau.setName(ActionType.UPDATE);
177 PermissionAction pad = new PermissionAction();
178 pad.setName(ActionType.DELETE);
180 //both users can create, read and update and delete
181 List<PermissionAction> testActions = new ArrayList<PermissionAction>();
182 testActions.add(pac);
183 testActions.add(par);
184 testActions.add(pau);
185 testActions.add(pad);
187 seedPermission(TENANT_1, resource, testActions, EffectType.PERMIT);
188 seedPermission(TENANT_2, resource, testActions, EffectType.PERMIT);
191 private void seedPermission(String tenantId,
192 String resource, List<PermissionAction> testActions, EffectType effect) {
193 //create permission using default user in admin role but assign tenant id
194 String id = createPermission(tenantId, resource, testActions, effect);
195 PermissionValue pv = new PermissionValue();
196 pv.setResourceName(resource);
197 pv.setPermissionId(id);
198 permValues.put(pv.getPermissionId(), pv);
199 tenantPermissions.put(tenantId, pv);
200 if (logger.isDebugEnabled()) {
201 logger.debug("seedPermission tenantId=" + tenantId
202 + " permId=" + id + " resource=" + resource);
206 private void seedRoles() {
207 //create role using default user in admin role but assign tenant id
208 //use the same role name to check constraints
209 seedRole(TENANT_1, TEST_ROLE_NAME);
210 seedRole(TENANT_2, TEST_ROLE_NAME);
213 private void seedRole(String tenantId, String roleName) {
214 String rid = createRole(tenantId, roleName);
215 RoleValue rv = new RoleValue();
217 rv.setRoleName(roleName);
218 tenantRoles.put(tenantId, rv);
219 if (logger.isDebugEnabled()) {
220 logger.debug("seedRole tenantId=" + tenantId + " roleName=" + roleName);
224 private void seedAccountRoles() {
225 for (String tenantId : tenantAccounts.keySet()) {
226 AccountValue av = (AccountValue) tenantAccounts.get(tenantId);
227 seedAccountRole(tenantId, av.getUserId());
231 private void seedAccountRole(String tenantId, String userId) {
232 List<RoleValue> tenantRoleValues = new ArrayList<RoleValue>();
233 tenantRoleValues.add(tenantRoles.get(tenantId));
234 createAccountRole(tenantId, userAccounts.get(userId), tenantRoleValues);
235 if (logger.isDebugEnabled()) {
236 logger.debug("seedAccountRole tenantId=" + tenantId + " userId=" + userId);
240 private void seedPermissionRoles() {
241 for (String tenantId : tenantPermissions.keySet()) {
242 PermissionValue pv = tenantPermissions.get(tenantId);
243 seedPermissionRole(tenantId, pv.getPermissionId());
247 private void seedPermissionRole(String tenantId, String permId) {
248 List<RoleValue> tenantRoleValues = new ArrayList<RoleValue>();
249 tenantRoleValues.add(tenantRoles.get(tenantId));
250 PermissionValue pv = permValues.get(permId);
251 createPermissionRole(tenantId, permValues.get(permId), tenantRoleValues);
252 if (logger.isDebugEnabled()) {
253 logger.debug("seedPermissionRole tenantId=" + tenantId
254 + " permId=" + permId + " resource=" + pv.getResourceName());
259 * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
262 protected CollectionSpaceClient getClientInstance() {
267 * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
270 protected AbstractCommonList getCommonList(
271 ClientResponse<AbstractCommonList> response) {
272 //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
273 throw new UnsupportedOperationException();
276 // ---------------------------------------------------------------
277 // CRUD tests : CREATE tests
278 // ---------------------------------------------------------------
281 @Test(dataProvider = "testName")
282 public void create(String testName) throws Exception {
283 TENANT_RESOURCE_1 = create(testName, TENANT_1_USER, TENANT_1);
284 if (logger.isDebugEnabled()) {
285 logger.debug(testName + ": tenantId= " + TENANT_1
286 + " userId=" + TENANT_1_USER
287 + " TENANT_RESOURCE_1 id=" + TENANT_RESOURCE_1);
291 @Test(dataProvider = "testName")
292 public void create2(String testName) throws Exception {
293 TENANT_RESOURCE_2 = create(testName, TENANT_2_USER, TENANT_2);
294 if (logger.isDebugEnabled()) {
295 logger.debug(testName + ": tenantId= " + TENANT_2
296 + " userId=" + TENANT_2_USER
297 + " TENANT_RESOURCE_2 id=" + TENANT_RESOURCE_2);
301 private String create(String testName, String userName, String tenatnId) {
302 String result = null;
306 // Create a new client and change the default AuthN credentials
308 DimensionClient client = new DimensionClient();
309 client.setAuth(true, userName, true, userName, true);
311 // Setup a dimension object to create
313 String identifier = createIdentifier();
314 DimensionsCommon dimension = new DimensionsCommon();
315 dimension.setDimension("dimensionType");
316 dimension.setMeasurementUnit("measurementUnit-" + identifier);
317 dimension.setValueDate(new Date().toString());
319 // Create a payload and send the POST request
321 PoxPayloadOut multipart = DimensionFactory.createDimensionInstance(client.getCommonPartName(),
323 Response res = client.create(multipart);
325 assertStatusCode(res, testName);
326 result = extractId(res);
337 // ---------------------------------------------------------------
338 // CRUD tests : READ tests
339 // ---------------------------------------------------------------
341 @Test(dataProvider = "testName",
342 dependsOnMethods = {"create"})
343 public void read(String testName) throws Exception {
344 DimensionsCommon dimension = read(testName, TENANT_RESOURCE_1, TENANT_1_USER);
345 Assert.assertNotNull(dimension);
346 if (logger.isDebugEnabled()) {
347 logger.debug(testName + ": tenantId= " + TENANT_1
348 + " userId=" + TENANT_1_USER
349 + " TENANT_RESOURCE_1 retrieved id=" + dimension.getCsid());
353 @Test(dataProvider = "testName",
354 dependsOnMethods = {"create2"})
355 public void read2(String testName) throws Exception {
356 DimensionsCommon dimension = read(testName, TENANT_RESOURCE_2, TENANT_2_USER);
357 Assert.assertNotNull(dimension);
358 if (logger.isDebugEnabled()) {
359 logger.debug(testName + ": tenantId= " + TENANT_2
360 + " userId=" + TENANT_2_USER
361 + " TENANT_RESOURCE_1 retrieved id=" + dimension.getCsid());
365 private DimensionsCommon read(String testName, String id, String userName) throws Exception {
366 DimensionsCommon result = null;
369 // Submit the request to the service and store the response.
370 DimensionClient client = new DimensionClient();
371 client.setAuth(true, userName, true, userName, true);
372 ClientResponse<String> res = client.read(id);
374 assertStatusCode(res, testName);
375 PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
376 result = (DimensionsCommon) extractPart(input,
377 client.getCommonPartName(), DimensionsCommon.class);
380 res.releaseConnection();
387 // ---------------------------------------------------------------
388 // CRUD tests : READ_LIST tests
389 // ---------------------------------------------------------------
391 @Test(dataProvider = "testName",
392 dependsOnMethods = {"read2"})
393 public void updateNonExistent(String testName) throws Exception {
395 setupUpdateNonExistent();
397 // Create a new client and change the default AuthN credentials
399 DimensionClient client = new DimensionClient();
400 //TENANT_1_USER is not allowed to update the resource of TENANT_2
401 client.setAuth(true, TENANT_1_USER, true, TENANT_1_USER, true);
403 // Create a new dimension object to try to update
405 DimensionsCommon dimension = new DimensionsCommon();
406 dimension.setDimension("dimensionType");
407 // Update the content of this resource.
408 dimension.setMeasurementUnit("updated-" + dimension.getMeasurementUnit());
409 dimension.setValueDate("updated-" + dimension.getValueDate());
411 // Create and send a dimension payload for the UPDATE request
413 PoxPayloadOut output = new PoxPayloadOut(DimensionClient.SERVICE_PAYLOAD_NAME);
414 PayloadOutputPart commonPart = output.addPart(client.getCommonPartName(), dimension);
415 ClientResponse<String> res = client.update(TENANT_RESOURCE_2, output);
417 assertStatusCode(res, testName);
420 res.releaseConnection();
425 // ---------------------------------------------------------------
426 // CRUD tests : DELETE tests
427 // ---------------------------------------------------------------
429 @Test(dataProvider = "testName",
430 dependsOnMethods = {"deleteNonExistent"})
431 public void delete(String testName) throws Exception {
432 int statusCode = delete(testName, TENANT_RESOURCE_1, TENANT_1_USER);
435 @Test(dataProvider = "testName",
436 dependsOnMethods = {"updateNonExistent"})
437 public void delete2(String testName) throws Exception {
438 int statusCode = delete(testName, TENANT_RESOURCE_2, TENANT_2_USER);
442 private int delete(String testName, String id, String userName) throws Exception {
447 // Submit the request to the service and store the response.
448 DimensionClient client = new DimensionClient();
449 client.setAuth(true, userName, true, userName, true);
450 ClientResponse<Response> res = client.delete(id);
452 result = assertStatusCode(res, testName);
455 res.releaseConnection();
463 @Test(dataProvider = "testName",
464 dependsOnMethods = {"read"})
465 public void deleteNonExistent(String testName) throws Exception {
466 //ignoring this test as the service side returns 200 now even if it does
467 //not find a record in the db
472 // Submit the request to the service and store the response.
473 DimensionClient client = new DimensionClient();
474 //TENANT_2_USER of TENANT_2 is not allowed to delete the resource of TENANT_1
475 client.setAuth(true, TENANT_2_USER, true, TENANT_2_USER, true);
476 ClientResponse<Response> res = client.delete(TENANT_RESOURCE_1);
478 int statusCode = res.getStatus();
479 // Check the status code of the response: does it match
480 // the expected response(s)?
481 if (logger.isDebugEnabled()) {
482 logger.debug(testName + ": status = " + statusCode);
484 Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
485 invalidStatusCodeMessage(testRequestType, statusCode));
486 //going to incorrect Nuxeo domain would give DocumentNotFoundException
487 //instead of giving FORBIDDEN
488 Assert.assertEquals(statusCode, Response.Status.NOT_FOUND.getStatusCode());
491 res.releaseConnection();
496 // ---------------------------------------------------------------
497 // Utility methods used by tests above
498 // ---------------------------------------------------------------
499 @AfterClass(alwaysRun = true)
500 public void cleanUp() {
502 String noTest = System.getProperty("noTestCleanup");
503 if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
504 if (logger.isDebugEnabled()) {
505 logger.debug("Skipping Cleanup phase ...");
509 if (logger.isDebugEnabled()) {
510 logger.debug("Cleaning up temporary resources created for testing ...");
513 //tenant admin users are used to create accounts, roles and permissions and relationships
514 //assumption : two tenant admin users exist before running this test
516 deletePermissionRoles();
517 deleteAccountRoles();
518 //deletePermissions would delete association with ROLE_XXX_ADMINISTRTOR too
519 //deletePermissions();
524 private void deletePermissionRoles() {
525 for (String tenantId : tenantPermissions.keySet()) {
526 List<RoleValue> tenantRoleValues = new ArrayList<RoleValue>();
527 tenantRoleValues.add(tenantRoles.get(tenantId));
528 PermissionValue pv = tenantPermissions.get(tenantId);
529 deletePermissionRole(tenantId, pv, tenantRoleValues);
533 private void deleteAccountRoles() {
534 for (String tenantId : tenantAccounts.keySet()) {
535 List<RoleValue> tenantRoleValues = new ArrayList<RoleValue>();
536 tenantRoleValues.add(tenantRoles.get(tenantId));
537 AccountValue av = tenantAccounts.get(tenantId);
538 deleteAccountRole(tenantId, av, tenantRoleValues);
542 private void deletePermissions() {
543 for (String tenantId : tenantPermissions.keySet()) {
544 PermissionValue pv = tenantPermissions.get(tenantId);
545 deletePermission(tenantId, pv.getPermissionId());
549 private void deleteRoles() {
550 for (String tenantId : tenantRoles.keySet()) {
551 RoleValue rv = tenantRoles.get(tenantId);
552 deleteRole(tenantId, rv.getRoleId());
556 private void deleteAccounts() {
557 for (String tenantId : tenantAccounts.keySet()) {
558 AccountValue av = tenantAccounts.get(tenantId);
559 deleteAccount(tenantId, av.getAccountId());
563 private String createPermission(String tenantId, String resName,
564 List<PermissionAction> actions, EffectType effect) {
565 String result = null;
568 PermissionClient permClient = new PermissionClient();
569 UserInfo ui = tenantAdminUsers.get(tenantId);
570 permClient.setAuth(true, ui.userName, true, ui.password, true);
571 Permission permission = PermissionFactory.createPermissionInstance(resName,
572 "default permissions for " + resName,
573 actions, effect, true, true, true);
574 permission.setTenantId(tenantId);
575 ClientResponse<Response> res = permClient.create(permission);
577 assertStatusCode(res, "CreatePermission");
578 result = extractId(res);
581 res.releaseConnection();
588 private void deletePermission(String tenantId, String permId) {
590 PermissionClient permClient = new PermissionClient();
591 UserInfo ui = tenantAdminUsers.get(tenantId);
592 permClient.setAuth(true, ui.userName, true, ui.password, true);
593 ClientResponse<Response> res = permClient.delete(permId);
595 assertStatusCode(res, "DeletePermission");
598 res.releaseConnection();
603 private String createRole(String tenantId, String roleName) {
604 String result = null;
607 RoleClient roleClient = new RoleClient();
608 UserInfo ui = tenantAdminUsers.get(tenantId);
609 roleClient.setAuth(true, ui.userName, true, ui.password, true);
610 Role role = RoleFactory.createRoleInstance(roleName,
611 roleName, //the display name
612 "role for " + roleName, true);
613 role.setTenantId(tenantId);
614 ClientResponse<Response> res = roleClient.create(role);
616 assertStatusCode(res, "CreateRole");
617 result = extractId(res);
620 res.releaseConnection();
627 private void deleteRole(String tenantId, String roleId) {
629 RoleClient roleClient = new RoleClient();
630 UserInfo ui = tenantAdminUsers.get(tenantId);
631 roleClient.setAuth(true, ui.userName, true, ui.password, true);
632 ClientResponse<Response> res = roleClient.delete(roleId);
634 assertStatusCode(res, "DeleteRole");
637 res.releaseConnection();
642 private String createAccount(String tenantId, String userName, String email) {
643 String result = null;
646 AccountClient accountClient = new AccountClient();
647 UserInfo ui = tenantAdminUsers.get(tenantId);
648 accountClient.setAuth(true, ui.userName, true, ui.password, true);
649 AccountsCommon account = AccountFactory.createAccountInstance(
650 userName, userName, userName, email, tenantId,
651 true, false, true, true);
652 ClientResponse<Response> res = accountClient.create(account);
654 assertStatusCode(res, "CreateAccount");
655 result = extractId(res);
658 res.releaseConnection();
665 private void deleteAccount(String tenantId, String accId) {
667 AccountClient accClient = new AccountClient();
668 UserInfo ui = tenantAdminUsers.get(tenantId);
669 accClient.setAuth(true, ui.userName, true, ui.password, true);
670 ClientResponse<Response> res = accClient.delete(accId);
672 assertStatusCode(res, "DeleteAccount");
675 res.releaseConnection();
680 private String createAccountRole(String tenantId, AccountValue av,
681 Collection<RoleValue> rvs) {
682 String result = null;
685 // Submit the request to the service and store the response.
686 AccountRole accRole = AccountRoleFactory.createAccountRoleInstance(
687 av, rvs, true, true);
688 AccountRoleClient client = new AccountRoleClient();
689 UserInfo ui = tenantAdminUsers.get(tenantId);
690 client.setAuth(true, ui.userName, true, ui.password, true);
691 ClientResponse<Response> res = client.create(av.getAccountId(), accRole);
693 assertStatusCode(res, "CreateAccountRole");
694 result = extractId(res);
697 res.releaseConnection();
704 private void deleteAccountRole(String tenantId, AccountValue av,
705 List<RoleValue> rvs) {
709 // Submit the request to the service and store the response.
710 AccountRoleClient client = new AccountRoleClient();
711 UserInfo ui = tenantAdminUsers.get(tenantId);
712 client.setAuth(true, ui.userName, true, ui.password, true);
713 AccountRole accRole = AccountRoleFactory.createAccountRoleInstance(
714 av, rvs, true, true);
715 ClientResponse<Response> res = client.delete(av.getAccountId());
717 assertStatusCode(res, "DeleteAccountRole");
720 res.releaseConnection();
725 private String createPermissionRole(String tenantId, PermissionValue pv,
726 Collection<RoleValue> rvs) {
727 String result = null;
730 List<RoleValue> rvls = new ArrayList<RoleValue>();
732 PermissionRole permRole = PermissionRoleFactory.createPermissionRoleInstance(
733 pv, rvls, true, true);
734 PermissionRoleClient client = new PermissionRoleClient();
735 UserInfo ui = tenantAdminUsers.get(tenantId);
736 client.setAuth(true, ui.userName, true, ui.password, true);
737 ClientResponse<Response> res = client.create(pv.getPermissionId(), permRole);
739 assertStatusCode(res, "createPermissionRole");
740 result = extractId(res);
743 res.releaseConnection();
750 private void deletePermissionRole(String tenantId, PermissionValue pv, List<RoleValue> rvls) {
754 // Submit the request to the service and store the response.
755 PermissionRoleClient client = new PermissionRoleClient();
756 UserInfo ui = tenantAdminUsers.get(tenantId);
757 client.setAuth(true, ui.userName, true, ui.password, true);
758 PermissionRole permRole = PermissionRoleFactory.createPermissionRoleInstance(
759 pv, rvls, true, true);
760 ClientResponse<Response> res = client.delete(pv.getPermissionId());
762 assertStatusCode(res, "DeletePermissionRole");
765 res.releaseConnection();
771 protected String getServiceName() {
772 // TODO Auto-generated method stub
773 throw new UnsupportedOperationException();
777 protected Class<AbstractCommonList> getCommonListType() {
778 // TODO Auto-generated method stub
779 throw new UnsupportedOperationException();