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;
36 import javax.ws.rs.core.MediaType;
37 import javax.ws.rs.core.Response;
39 import org.collectionspace.services.account.AccountsCommon;
40 import org.collectionspace.services.authorization.AccountRole;
41 import org.collectionspace.services.authorization.AccountValue;
42 import org.collectionspace.services.authorization.perms.ActionType;
43 import org.collectionspace.services.authorization.perms.EffectType;
44 import org.collectionspace.services.authorization.perms.Permission;
45 import org.collectionspace.services.authorization.perms.PermissionAction;
46 import org.collectionspace.services.authorization.PermissionRole;
47 import org.collectionspace.services.authorization.PermissionValue;
48 import org.collectionspace.services.authorization.Role;
49 import org.collectionspace.services.authorization.RoleValue;
50 import org.collectionspace.services.client.AccountClient;
51 import org.collectionspace.services.client.AccountFactory;
52 import org.collectionspace.services.client.AccountRoleClient;
53 import org.collectionspace.services.client.AccountRoleFactory;
54 import org.collectionspace.services.client.CollectionSpaceClient;
55 import org.collectionspace.services.client.DimensionClient;
56 import org.collectionspace.services.client.DimensionFactory;
57 import org.collectionspace.services.client.IntakeClient;
58 import org.collectionspace.services.client.PayloadOutputPart;
59 import org.collectionspace.services.client.PermissionClient;
60 import org.collectionspace.services.client.PermissionFactory;
61 import org.collectionspace.services.client.PermissionRoleClient;
62 import org.collectionspace.services.client.PermissionRoleFactory;
63 import org.collectionspace.services.client.PoxPayloadIn;
64 import org.collectionspace.services.client.PoxPayloadOut;
65 import org.collectionspace.services.client.RoleClient;
66 import org.collectionspace.services.client.RoleFactory;
67 import org.collectionspace.services.client.test.BaseServiceTest;
68 import org.collectionspace.services.dimension.DimensionsCommon;
69 import org.collectionspace.services.intake.IntakesCommon;
70 import org.collectionspace.services.jaxb.AbstractCommonList;
71 import org.testng.Assert;
72 import org.testng.annotations.Test;
73 import org.testng.annotations.AfterClass;
74 import org.testng.annotations.BeforeClass;
75 import org.slf4j.Logger;
76 import org.slf4j.LoggerFactory;
79 * AuthorizationServiceTest, carries out tests against a deployed and running
80 * Permission, Role, AccountRole, PermissionRole and CollectionObject Services.
82 * Pre-requisite : authorization-mgt/client tests seed some permissions used by
85 * $LastChangedRevision: 917 $ $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri,
88 public class AuthorizationServiceTest extends BaseServiceTest<AbstractCommonList> {
90 private final String CLASS_NAME = AuthorizationServiceTest.class.getName();
91 private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
92 // Instance variables specific to this test.
93 private Hashtable<String, AccountValue> accValues = new Hashtable<String, AccountValue>();
94 // key for permValues is id as there could be several perms for the same
96 private Hashtable<String, PermissionValue> permValues = new Hashtable<String, PermissionValue>();
97 // key for roleValues is roleName
98 private Hashtable<String, RoleValue> roleValues = new Hashtable<String, RoleValue>();
99 private String bigbirdPermId;
100 private String elmoPermId;
101 private final static String TEST_SERVICE_NAME = "dimensions";
102 private boolean accountRolesFlipped = false;
105 * This method is called only by the parent class, AbstractServiceTestImpl
109 protected String getServiceName() {
110 // no need to return anything but null since no auth resources are
112 throw new UnsupportedOperationException();
116 protected String getServicePathComponent() {
117 // no need to return anything but null since no auth resources are
119 throw new UnsupportedOperationException();
122 @BeforeClass(alwaysRun = true)
123 public void seedData() throws Exception {
128 seedPermissionRoles();
131 private void seedPermissions() throws Exception {
132 String res = TEST_SERVICE_NAME;
134 PermissionAction pac = new PermissionAction();
135 pac.setName(ActionType.CREATE);
136 PermissionAction par = new PermissionAction();
137 par.setName(ActionType.READ);
138 PermissionAction pau = new PermissionAction();
139 pau.setName(ActionType.UPDATE);
141 // bigbird can create, read and update but not delete
142 List<PermissionAction> bbactions = new ArrayList<PermissionAction>();
146 bigbirdPermId = createPermission(res, bbactions, EffectType.PERMIT);
147 PermissionValue bbpv = new PermissionValue();
148 bbpv.setResourceName(res);
149 bbpv.setPermissionId(bigbirdPermId);
150 permValues.put(bbpv.getPermissionId(), bbpv);
152 // elmo can only read
153 List<PermissionAction> eactions = new ArrayList<PermissionAction>();
155 elmoPermId = createPermission(res, eactions, EffectType.PERMIT);
156 PermissionValue epv = new PermissionValue();
157 epv.setResourceName(res);
158 epv.setPermissionId(elmoPermId);
159 permValues.put(epv.getPermissionId(), epv);
162 private void seedRoles() throws Exception {
163 String rn1 = "xROLE_TEST_CM";
164 String r1RoleId = createRole(rn1);
165 RoleValue rv1 = new RoleValue();
166 rv1.setRoleId(r1RoleId);
167 rv1.setRoleName(rn1);
168 roleValues.put(rv1.getRoleName(), rv1);
170 String rn2 = "xROLE_TEST_INTERN";
171 String r2RoleId = createRole(rn2);
172 RoleValue rv2 = new RoleValue();
173 rv2.setRoleId(r2RoleId);
174 rv2.setRoleName(rn2);
175 roleValues.put(rv2.getRoleName(), rv2);
178 private void seedAccounts() throws Exception {
179 String userId1 = "bigbird2010";
180 String accId1 = createAccount(userId1, "bigbird@cspace.org");
181 AccountValue av1 = new AccountValue();
182 av1.setScreenName(userId1);
183 av1.setUserId(userId1);
184 av1.setAccountId(accId1);
185 accValues.put(av1.getUserId(), av1);
187 String userId2 = "elmo2010";
188 String accId2 = createAccount(userId2, "elmo@cspace.org");
189 AccountValue av2 = new AccountValue();
190 av2.setScreenName(userId2);
191 av2.setUserId(userId2);
192 av2.setAccountId(accId2);
193 accValues.put(av2.getUserId(), av2);
195 String userId3 = "lockedOut";
196 String accId3 = createAccount(userId3, "lockedOut@cspace.org");
197 AccountValue av3 = new AccountValue();
198 av3.setScreenName(userId3);
199 av3.setUserId(userId3);
200 av3.setAccountId(accId3);
201 accValues.put(av3.getUserId(), av3);
204 private void seedAccountRoles() throws Exception {
206 List<RoleValue> bigbirdRoleValues = new ArrayList<RoleValue>();
207 bigbirdRoleValues.add(roleValues.get("xROLE_TEST_CM"));
208 createAccountRole(accValues.get("bigbird2010"), bigbirdRoleValues);
210 List<RoleValue> elmoRoleValues = new ArrayList<RoleValue>();
211 elmoRoleValues.add(roleValues.get("xROLE_TEST_INTERN"));
212 createAccountRole(accValues.get("elmo2010"), elmoRoleValues);
215 private void seedPermissionRoles() throws Exception {
217 List<RoleValue> bigbirdRoleValues = new ArrayList<RoleValue>();
218 bigbirdRoleValues.add(roleValues.get("xROLE_TEST_CM"));
219 createPermissionRole(permValues.get(bigbirdPermId), bigbirdRoleValues);
221 List<RoleValue> elmoRoleValues = new ArrayList<RoleValue>();
222 elmoRoleValues.add(roleValues.get("xROLE_TEST_INTERN"));
223 createPermissionRole(permValues.get(elmoPermId), elmoRoleValues);
231 * org.collectionspace.services.client.test.BaseServiceTest#getClientInstance
235 protected CollectionSpaceClient getClientInstance() {
236 // This method is meaningless to this test.
241 protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
242 // TODO Auto-generated method stub
246 // ---------------------------------------------------------------
247 // CRUD tests : CREATE tests
248 // ---------------------------------------------------------------
251 @Test(dataProvider = "testName")
252 public void create(String testName) throws Exception {
256 // Submit the request to the service and store the response.
257 DimensionClient client = new DimensionClient();
258 // bigbird allowed to create
259 client.setAuth(true, "bigbird2010", true, "bigbird2010", true);
260 String identifier = createIdentifier();
261 DimensionsCommon dimension = new DimensionsCommon();
262 dimension.setDimension("dimensionType");
263 dimension.setMeasurementUnit("measurementUnit-" + identifier);
264 dimension.setValueDate(new Date().toString());
265 PoxPayloadOut multipart = DimensionFactory.createDimensionInstance(client.getCommonPartName(), dimension);
266 Response res = client.create(multipart);
268 statusCode = res.getStatus();
269 if (logger.isDebugEnabled()) {
270 logger.debug(testName + ": status = " + statusCode);
272 Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
273 invalidStatusCodeMessage(testRequestType, statusCode));
274 Assert.assertEquals(statusCode, Response.Status.CREATED.getStatusCode());
275 knownResourceId = extractId(res);
276 if (logger.isDebugEnabled()) {
277 logger.debug(testName + ": knownResourceId=" + knownResourceId);
283 // Now verify that elmo cannot create
284 client = new DimensionClient();
285 client.setAuth(true, "elmo2010", true, "elmo2010", true);
286 res = client.create(multipart);
288 statusCode = res.getStatus();
289 if (logger.isDebugEnabled()) {
290 logger.debug(testName + " (verify not allowed): status = " + statusCode);
292 Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
293 invalidStatusCodeMessage(testRequestType, statusCode));
294 Assert.assertEquals(statusCode, Response.Status.FORBIDDEN.getStatusCode());
299 // Finally, verify that elmo has no access to Intakes
300 // Submit the request to the service and store the response.
301 IntakeClient iclient = new IntakeClient();
302 iclient.setAuth(true, "elmo2010", true, "elmo2010", true);
303 multipart = createIntakeInstance("entryNumber-" + identifier, "entryDate-" + identifier, "depositor-"
305 res = iclient.create(multipart);
307 if (logger.isDebugEnabled()) {
308 logger.debug(testName + " (verify create intake not allowed): status = " + statusCode);
310 Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
311 invalidStatusCodeMessage(testRequestType, statusCode));
312 Assert.assertEquals(statusCode, Response.Status.FORBIDDEN.getStatusCode());
319 * Creates the intake instance.
327 * @return the multipart output
330 private PoxPayloadOut createIntakeInstance(String entryNumber, String entryDate, String depositor) throws Exception {
331 IntakesCommon intake = new IntakesCommon();
332 intake.setEntryNumber(entryNumber);
333 intake.setEntryDate(entryDate);
334 intake.setDepositor(depositor);
336 PoxPayloadOut multipart = new PoxPayloadOut(IntakeClient.SERVICE_PAYLOAD_NAME);
337 PayloadOutputPart commonPart = multipart.addPart(intake, MediaType.APPLICATION_XML_TYPE);
338 commonPart.setLabel(new IntakeClient().getCommonPartName());
340 if (logger.isDebugEnabled()) {
341 logger.debug("to be created, intake common");
342 logger.debug(objectAsXmlString(intake, IntakesCommon.class));
348 @Test(dataProvider = "testName", dependsOnMethods = { "delete" })
349 public void verifyCreateWithFlippedRoles(String testName) throws Exception {
353 // Submit the request to the service and store the response.
354 DimensionClient client = new DimensionClient();
355 flipInitialAccountRoles();
357 // Now verify that elmo can create
358 client.setAuth(true, "elmo2010", true, "elmo2010", true);
359 client = new DimensionClient();
361 String identifier = createIdentifier();
362 DimensionsCommon dimension = new DimensionsCommon();
363 dimension.setDimension("dimensionType");
364 dimension.setMeasurementUnit("measurementUnit-" + identifier);
365 dimension.setValueDate(new Date().toString());
366 PoxPayloadOut multipart = DimensionFactory.createDimensionInstance(client.getCommonPartName(), dimension);
367 Response res = client.create(multipart);
369 statusCode = res.getStatus();
371 if (logger.isDebugEnabled()) {
372 logger.debug(testName + ": status = " + statusCode);
374 Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
375 invalidStatusCodeMessage(testRequestType, statusCode));
376 Assert.assertEquals(statusCode, Response.Status.CREATED.getStatusCode());
377 knownResourceId = extractId(res);
378 if (logger.isDebugEnabled()) {
379 logger.debug(testName + ": knownResourceId=" + knownResourceId);
385 // bigbird no longer allowed to create
386 client.setAuth(true, "bigbird2010", true, "bigbird2010", true);
387 res = client.create(multipart);
389 statusCode = res.getStatus();
390 if (logger.isDebugEnabled()) {
391 logger.debug(testName + " (verify not allowed): status = " + statusCode);
393 Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
394 invalidStatusCodeMessage(testRequestType, statusCode));
395 Assert.assertEquals(statusCode, Response.Status.FORBIDDEN.getStatusCode());
400 restoreInitialAccountRoles();
403 // ---------------------------------------------------------------
404 // CRUD tests : READ tests
405 // ---------------------------------------------------------------
407 @Test(dataProvider = "testName", dependsOnMethods = { "create" })
408 public void read(String testName) throws Exception {
412 // Submit the request to the service and store the response.
413 DimensionClient client = new DimensionClient();
414 // elmo allowed to read
415 client.setAuth(true, "elmo2010", true, "elmo2010", true);
416 Response res = client.read(knownResourceId);
418 assertStatusCode(res, testName);
419 PoxPayloadIn input = new PoxPayloadIn(res.readEntity(String.class));
420 DimensionsCommon dimension = (DimensionsCommon) extractPart(input, client.getCommonPartName(),
421 DimensionsCommon.class);
422 Assert.assertNotNull(dimension);
430 @Test(dataProvider = "testName", dependsOnMethods = { "read" })
431 public void readLockedOut(String testName) throws Exception {
435 // Submit the request to the service and store the response.
436 DimensionClient client = new DimensionClient();
437 // lockedOut allowed to read
438 client.setAuth(true, "lockedOut", true, "lockedOut", true);
439 Response res = client.read(knownResourceId);
441 assertStatusCode(res, testName);
449 @Test(dataProvider = "testName", dependsOnMethods = { "read" })
450 public void updateNotAllowed(String testName) throws Exception {
453 // Create a new client and change its AuthN credentials
454 DimensionClient client = new DimensionClient();
455 // elmo not allowed to update
456 client.setAuth(true, "elmo2010", true, "elmo2010", true);
458 // Create a new dimension object
460 DimensionsCommon dimension = new DimensionsCommon();
461 dimension.setDimension("dimensionType");
462 // Update the content of this resource.
463 dimension.setMeasurementUnit("updated-" + dimension.getMeasurementUnit());
464 dimension.setValueDate("updated-" + dimension.getValueDate());
466 // Create and submit the request to the service and store the response.
468 PoxPayloadOut output = new PoxPayloadOut(DimensionClient.SERVICE_PAYLOAD_NAME);
469 PayloadOutputPart commonPart = output.addPart(client.getCommonPartName(), dimension);
470 Response res = client.update(knownResourceId, output);
472 assertStatusCode(res, testName);
479 // Create another new client with new credentials
481 client = new DimensionClient();
482 // lockedOut not allowed to update
483 client.setAuth(true, "lockedOut", true, "lockedOut", true);
485 // Try the update again.
487 res = client.update(knownResourceId, output);
489 assertStatusCode(res, testName);
498 // ---------------------------------------------------------------
499 // CRUD tests : DELETE tests
500 // ---------------------------------------------------------------
502 @Test(dataProvider = "testName", dependsOnMethods = { "updateNotAllowed" })
503 public void deleteNotAllowed(String testName) throws Exception {
507 // Create a new client and change the AuthN credentials
509 DimensionClient client = new DimensionClient();
510 // bigbird can not delete
511 client.setAuth(true, "bigbird2010", true, "bigbird2010", true);
513 // Try to make a DELETE request
515 Response res = client.delete(knownResourceId);
517 assertStatusCode(res, testName);
525 @Test(dataProvider = "testName", dependsOnMethods = { "deleteNotAllowed" })
526 public void delete(String testName) throws Exception {
530 // Submit the request to the service and store the response.
531 DimensionClient client = new DimensionClient();
533 Response res = client.delete(knownResourceId);
535 assertStatusCode(res, testName);
543 // ---------------------------------------------------------------
544 // Utility methods used by tests above
545 // ---------------------------------------------------------------
546 @AfterClass(alwaysRun = true)
547 public void cleanUp() throws Exception {
549 String noTest = System.getProperty("noTestCleanup");
550 if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
551 if (logger.isDebugEnabled()) {
552 logger.debug("Skipping Cleanup phase ...");
556 if (logger.isDebugEnabled()) {
557 logger.debug("Cleaning up temporary resources created for testing ...");
560 deletePermissionRoles();
561 deleteAccountRoles();
562 // FIXME delete on permission deletes all associations with roles
563 // this would delete association with ROLE_ADMINISTRATOR too
564 // deletePermissions();
569 private void deletePermissionRoles() throws Exception {
570 List<RoleValue> bigbirdRoleValues = new ArrayList<RoleValue>();
571 bigbirdRoleValues.add(roleValues.get("xROLE_TEST_CM"));
572 deletePermissionRole(permValues.get(bigbirdPermId), bigbirdRoleValues);
574 List<RoleValue> elmoRoleValues = new ArrayList<RoleValue>();
575 elmoRoleValues.add(roleValues.get("xROLE_TEST_INTERN"));
576 deletePermissionRole(permValues.get(elmoPermId), elmoRoleValues);
579 private void deleteAccountRoles() throws Exception {
580 List<RoleValue> bigbirdRoleValues = new ArrayList<RoleValue>();
581 bigbirdRoleValues.add(roleValues.get("xROLE_TEST_CM"));
583 List<RoleValue> elmoRoleValues = new ArrayList<RoleValue>();
584 elmoRoleValues.add(roleValues.get("xROLE_TEST_INTERN"));
585 if (!accountRolesFlipped) {
586 deleteAccountRole(accValues.get("bigbird2010"), bigbirdRoleValues);
587 deleteAccountRole(accValues.get("elmo2010"), elmoRoleValues);
589 deleteAccountRole(accValues.get("bigbird2010"), elmoRoleValues);
590 deleteAccountRole(accValues.get("elmo2010"), bigbirdRoleValues);
594 private void flipInitialAccountRoles() throws Exception {
595 if (!accountRolesFlipped) {
596 List<RoleValue> cmRoleValues = new ArrayList<RoleValue>();
597 List<RoleValue> internRoleValues = new ArrayList<RoleValue>();
598 cmRoleValues.add(roleValues.get("xROLE_TEST_CM"));
599 internRoleValues.add(roleValues.get("xROLE_TEST_INTERN"));
601 deleteAccountRole(accValues.get("bigbird2010"), cmRoleValues);
602 deleteAccountRole(accValues.get("elmo2010"), internRoleValues);
604 createAccountRole(accValues.get("bigbird2010"), internRoleValues);
605 createAccountRole(accValues.get("elmo2010"), cmRoleValues);
607 accountRolesFlipped = true;
611 private void restoreInitialAccountRoles() throws Exception {
612 if (accountRolesFlipped) {
613 List<RoleValue> cmRoleValues = new ArrayList<RoleValue>();
614 List<RoleValue> internRoleValues = new ArrayList<RoleValue>();
615 cmRoleValues.add(roleValues.get("xROLE_TEST_CM"));
616 internRoleValues.add(roleValues.get("xROLE_TEST_INTERN"));
618 deleteAccountRole(accValues.get("bigbird2010"), internRoleValues);
619 deleteAccountRole(accValues.get("elmo2010"), cmRoleValues);
621 createAccountRole(accValues.get("bigbird2010"), internRoleValues);
622 createAccountRole(accValues.get("elmo2010"), cmRoleValues);
623 accountRolesFlipped = false;
627 private void deletePermissions() throws Exception {
629 for (PermissionValue pv : permValues.values()) {
630 deletePermission(pv.getPermissionId());
634 private void deleteRoles() throws Exception {
635 for (RoleValue rv : roleValues.values()) {
636 deleteRole(rv.getRoleId());
640 private void deleteAccounts() throws Exception {
642 for (AccountValue av1 : accValues.values()) {
643 deleteAccount(av1.getAccountId());
647 private String createPermission(String resName, EffectType effect) throws Exception {
648 List<PermissionAction> actions = PermissionFactory.createDefaultActions();
649 return createPermission(resName, actions, effect);
652 private String createPermission(String resName, List<PermissionAction> actions, EffectType effect) throws Exception {
653 String result = null;
656 PermissionClient permClient = new PermissionClient();
657 Permission permission = PermissionFactory.createPermissionInstance(resName, "default permissions for "
658 + resName, actions, effect, true, true, true);
659 Response res = permClient.create(permission);
661 assertStatusCode(res, "CreatePermission");
662 result = extractId(res);
672 private void deletePermission(String permId) throws Exception {
674 PermissionClient permClient = new PermissionClient();
675 Response res = permClient.delete(permId);
677 assertStatusCode(res, "DeletePermission");
685 private String createRole(String roleName) throws Exception {
686 String result = null;
689 RoleClient roleClient = new RoleClient();
690 Role role = RoleFactory.createRoleInstance(roleName, roleName, // the
693 "role for " + roleName, true, RoleFactory.EMPTY_PERMVALUE_LIST);
694 Response res = roleClient.create(role);
696 assertStatusCode(res, "CreateRole");
697 result = extractId(res);
707 private void deleteRole(String roleId) throws Exception {
709 RoleClient roleClient = new RoleClient();
710 Response res = roleClient.delete(roleId);
712 assertStatusCode(res, "DeleteRole");
720 private String createAccount(String userName, String email) throws Exception {
721 String result = null;
724 AccountClient accountClient = new AccountClient();
725 AccountsCommon account = AccountFactory.createAccountInstance(userName, userName, userName, email,
726 accountClient.getTenantId(), true, false, true, true);
727 Response res = accountClient.create(account);
729 assertStatusCode(res, "CreateAccount");
730 result = extractId(res);
740 private void deleteAccount(String accId) throws Exception {
742 AccountClient accClient = new AccountClient();
743 Response res = accClient.delete(accId);
745 assertStatusCode(res, "DeleteAccount");
753 private String createAccountRole(AccountValue av, Collection<RoleValue> rvs) throws Exception {
754 String result = null;
757 // Submit the request to the service and store the response.
758 AccountRole accRole = AccountRoleFactory.createAccountRoleInstance(av, rvs, true, true);
759 AccountRoleClient client = new AccountRoleClient();
760 Response res = client.create(av.getAccountId(), accRole);
762 assertStatusCode(res, "CreateAccountRole");
763 result = extractId(res);
773 private void deleteAccountRole(AccountValue av, Collection<RoleValue> rvs) throws Exception {
777 // Submit the request to the service and store the response.
778 AccountRoleClient client = new AccountRoleClient();
779 AccountRole accRole = AccountRoleFactory.createAccountRoleInstance(av, rvs, true, true);
780 Response res = client.delete(av.getAccountId());
782 assertStatusCode(res, "DeleteAccountRole");
790 private String createPermissionRole(PermissionValue pv, Collection<RoleValue> rvs) throws Exception {
791 String result = null;
794 List<RoleValue> rvls = new ArrayList<RoleValue>();
796 PermissionRole permRole = PermissionRoleFactory.createPermissionRoleInstance(pv, rvls, true, true);
797 PermissionRoleClient client = new PermissionRoleClient();
798 Response res = client.create(pv.getPermissionId(), permRole);
800 assertStatusCode(res, "CreatePermissionRole");
801 result = extractId(res);
811 private void deletePermissionRole(PermissionValue pv, Collection<RoleValue> rvs) throws Exception {
812 List<RoleValue> rvls = new ArrayList<RoleValue>();
818 // Submit the request to the service and store the response.
819 PermissionRoleClient client = new PermissionRoleClient();
820 PermissionRole permRole = PermissionRoleFactory.createPermissionRoleInstance(pv, rvls, true, true);
821 Response res = client.delete(pv.getPermissionId());
823 assertStatusCode(res, "DeletePermissionRole");
832 protected Class<AbstractCommonList> getCommonListType() {
833 throw new UnsupportedOperationException();