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 © 2009 Regents of the University of California
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
15 * https://source.collectionspace.org/collection-space/LICENSE.txt
17 * Unless required by applicable law or agreed to in writing, software
18 * distributed under the License is distributed on an "AS IS" BASIS,
19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 * See the License for the specific language governing permissions and
21 * limitations under the License.
23 package org.collectionspace.services.authorization.client.test;
25 //import java.util.ArrayList;
26 import java.util.List;
27 import javax.ws.rs.core.Response;
28 //import org.collectionspace.services.authorization.ActionType;
29 import org.collectionspace.services.authorization.EffectType;
31 import org.collectionspace.services.client.CollectionSpaceClient;
32 import org.collectionspace.services.client.PermissionClient;
33 import org.collectionspace.services.authorization.Permission;
34 import org.collectionspace.services.authorization.PermissionAction;
35 import org.collectionspace.services.authorization.PermissionsList;
36 import org.collectionspace.services.client.PermissionFactory;
37 import org.collectionspace.services.client.test.AbstractServiceTestImpl;
38 import org.collectionspace.services.client.test.ServiceRequestType;
39 import org.collectionspace.services.jaxb.AbstractCommonList;
40 import org.jboss.resteasy.client.ClientResponse;
42 import org.testng.Assert;
43 import org.testng.annotations.Test;
45 import org.slf4j.Logger;
46 import org.slf4j.LoggerFactory;
49 * PermissionServiceTest, carries out tests against a
50 * deployed and running Permission Service.
52 * $LastChangedRevision: 917 $
53 * $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri, 06 Nov 2009) $
55 public class PermissionServiceTest extends AbstractServiceTestImpl {
57 /** The Constant logger. */
58 private final static String CLASS_NAME = PermissionServiceTest.class.getName();
59 private final static Logger logger = LoggerFactory.getLogger(CLASS_NAME);
61 // Instance variables specific to this test.
62 /** The known resource id. */
63 private String knownResourceId = null;
64 private String knownResource = "accounts-test";
66 * This method is called only by the parent class, AbstractServiceTestImpl
70 * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
73 protected String getServicePathComponent() {
74 return new PermissionClient().getServicePathComponent();
78 * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
81 protected CollectionSpaceClient getClientInstance() {
82 return new PermissionClient();
86 * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
89 protected AbstractCommonList getAbstractCommonList(
90 ClientResponse<AbstractCommonList> response) {
91 //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
92 throw new UnsupportedOperationException();
96 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readPaginatedList(java.lang.String)
98 @Test(dataProvider = "testName")
100 public void readPaginatedList(String testName) throws Exception {
101 //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
104 // ---------------------------------------------------------------
105 // CRUD tests : CREATE tests
106 // ---------------------------------------------------------------
109 * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
112 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
113 public void create(String testName) throws Exception {
115 if (logger.isDebugEnabled()) {
116 logger.debug(testBanner(testName, CLASS_NAME));
118 // Perform setup, such as initializing the type of service request
119 // (e.g. CREATE, DELETE), its valid and expected status codes, and
120 // its associated HTTP method name (e.g. POST, DELETE).
123 // Submit the request to the service and store the response.
124 List<PermissionAction> actions = PermissionFactory.createDefaultActions();
125 Permission permission = createPermissionInstance(knownResource,
126 "default permissions for account",
132 PermissionClient client = new PermissionClient();
133 ClientResponse<Response> res = client.create(permission);
134 int statusCode = res.getStatus();
136 // Check the status code of the response: does it match
137 // the expected response(s)?
140 // Does it fall within the set of valid status codes?
141 // Does it exactly match the expected status code?
142 if (logger.isDebugEnabled()) {
143 logger.debug(testName + ": status = " + statusCode);
145 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
146 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
147 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
149 // Store the ID returned from this create operation
150 // for additional tests below.
151 knownResourceId = extractId(res);
152 if (logger.isDebugEnabled()) {
153 logger.debug(testName + ": knownResourceId=" + knownResourceId);
158 * Creates the without resource name.
160 * @param testName the test name
161 * @throws Exception the exception
163 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
164 dependsOnMethods = {"create"})
165 public void createWithoutResourceName(String testName) throws Exception {
167 if (logger.isDebugEnabled()) {
168 logger.debug(testBanner(testName, CLASS_NAME));
172 // Submit the request to the service and store the response.
173 List<PermissionAction> actions = PermissionFactory.createDefaultActions();
174 Permission permission = createPermissionInstance(null,
175 "default permissions for account",
181 PermissionClient client = new PermissionClient();
182 ClientResponse<Response> res = client.create(permission);
183 int statusCode = res.getStatus();
184 // Does it exactly match the expected status code?
185 if (logger.isDebugEnabled()) {
186 logger.debug(testName + ": status = " + statusCode);
188 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
189 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
190 Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
193 //to not cause uniqueness violation for permission, createList is removed
195 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
198 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
199 dependsOnMethods = {"create"})
200 public void createList(String testName) throws Exception {
202 if (logger.isDebugEnabled()) {
203 logger.debug(testBanner(testName, CLASS_NAME));
206 // Submit the request to the service and store the response.
207 List<PermissionAction> actions = PermissionFactory.createDefaultActions();
208 Permission permission1 = createPermissionInstance("test-objects",
209 "default permissions for test-objects",
215 PermissionClient client = new PermissionClient();
216 ClientResponse<Response> res = client.create(permission1);
217 int statusCode = res.getStatus();
218 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
219 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
220 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
221 allResourceIdsCreated.add(extractId(res));
223 Permission permission2 = createPermissionInstance("test-acquisitions",
224 "default permissions for test-acquisitions",
230 res = client.create(permission2);
231 statusCode = res.getStatus();
232 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
233 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
234 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
235 allResourceIdsCreated.add(extractId(res));
237 Permission permission3 = createPermissionInstance("test-ids",
238 "default permissions for id service",
244 res = client.create(permission3);
245 statusCode = res.getStatus();
246 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
247 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
248 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
249 allResourceIdsCreated.add(extractId(res));
253 // Placeholders until the three tests below can be uncommented.
254 // See Issue CSPACE-401.
256 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
259 public void createWithEmptyEntityBody(String testName) throws Exception {
260 //FIXME: Should this test really be empty? If so, please comment accordingly.
264 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
267 public void createWithMalformedXml(String testName) throws Exception {
268 //FIXME: Should this test really be empty? If so, please comment accordingly.
272 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
275 public void createWithWrongXmlSchema(String testName) throws Exception {
276 //FIXME: Should this test really be empty? If so, please comment accordingly.
279 // ---------------------------------------------------------------
280 // CRUD tests : READ tests
281 // ---------------------------------------------------------------
284 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
287 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
288 dependsOnMethods = {"create"})
289 public void read(String testName) throws Exception {
291 if (logger.isDebugEnabled()) {
292 logger.debug(testBanner(testName, CLASS_NAME));
297 // Submit the request to the service and store the response.
298 PermissionClient client = new PermissionClient();
299 ClientResponse<Permission> res = client.read(knownResourceId);
300 int statusCode = res.getStatus();
302 // Check the status code of the response: does it match
303 // the expected response(s)?
304 if (logger.isDebugEnabled()) {
305 logger.debug(testName + ": status = " + statusCode);
307 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
308 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
309 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
311 Permission output = (Permission) res.getEntity();
312 Assert.assertNotNull(output);
317 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
320 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
321 dependsOnMethods = {"read"})
322 public void readNonExistent(String testName) throws Exception {
324 if (logger.isDebugEnabled()) {
325 logger.debug(testBanner(testName, CLASS_NAME));
328 setupReadNonExistent();
330 // Submit the request to the service and store the response.
331 PermissionClient client = new PermissionClient();
332 ClientResponse<Permission> res = client.read(NON_EXISTENT_ID);
333 int statusCode = res.getStatus();
335 // Check the status code of the response: does it match
336 // the expected response(s)?
337 if (logger.isDebugEnabled()) {
338 logger.debug(testName + ": status = " + statusCode);
340 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
341 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
342 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
345 // ---------------------------------------------------------------
346 // CRUD tests : READ_LIST tests
347 // ---------------------------------------------------------------
350 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
353 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
354 dependsOnMethods = {"createList", "read"})
355 public void readList(String testName) throws Exception {
357 if (logger.isDebugEnabled()) {
358 logger.debug(testBanner(testName, CLASS_NAME));
363 // Submit the request to the service and store the response.
364 PermissionClient client = new PermissionClient();
365 ClientResponse<PermissionsList> res = client.readList();
366 PermissionsList list = res.getEntity();
367 int statusCode = res.getStatus();
369 // Check the status code of the response: does it match
370 // the expected response(s)?
371 if (logger.isDebugEnabled()) {
372 logger.debug(testName + ": status = " + statusCode);
374 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
375 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
376 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
378 // Optionally output additional data about list members for debugging.
379 boolean iterateThroughList = true;
380 if (iterateThroughList && logger.isDebugEnabled()) {
381 printList(testName, list);
386 * Search resource name.
388 * @param testName the test name
389 * @throws Exception the exception
391 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
392 dependsOnMethods = {"createList", "read"})
393 public void searchResourceName(String testName) throws Exception {
395 if (logger.isDebugEnabled()) {
396 logger.debug(testBanner(testName, CLASS_NAME));
401 // Submit the request to the service and store the response.
402 PermissionClient client = new PermissionClient();
403 ClientResponse<PermissionsList> res = client.readSearchList("acquisition");
404 PermissionsList list = res.getEntity();
405 int statusCode = res.getStatus();
406 // Check the status code of the response: does it match
407 // the expected response(s)?
408 if (logger.isDebugEnabled()) {
409 logger.debug(testName + ": status = " + statusCode);
411 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
412 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
413 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
414 int EXPECTED_ITEMS = 5; //seeded permissions
415 if (logger.isDebugEnabled()) {
416 logger.debug(testName + ": received = " + list.getPermissions().size()
417 + " expected=" + EXPECTED_ITEMS);
419 Assert.assertEquals(EXPECTED_ITEMS, list.getPermissions().size());
420 // Optionally output additional data about list members for debugging.
421 boolean iterateThroughList = true;
422 if (iterateThroughList && logger.isDebugEnabled()) {
423 printList(testName, list);
429 // ---------------------------------------------------------------
430 // CRUD tests : UPDATE tests
431 // ---------------------------------------------------------------
434 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
437 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
438 dependsOnMethods = {"read", "readList", "readNonExistent"})
439 public void update(String testName) throws Exception {
441 if (logger.isDebugEnabled()) {
442 logger.debug(testBanner(testName, CLASS_NAME));
447 Permission permToUpdate = new Permission();
448 permToUpdate.setCsid(knownResourceId);
449 permToUpdate.setResourceName(knownResource);
450 // Update the content of this resource.
451 permToUpdate.setDescription("updated description");
452 if (logger.isDebugEnabled()) {
453 logger.debug("updated object");
454 logger.debug(objectAsXmlString(permToUpdate,
457 PermissionClient client = new PermissionClient();
458 // Submit the request to the service and store the response.
459 ClientResponse<Permission> res = client.update(knownResourceId, permToUpdate);
460 int statusCode = res.getStatus();
461 // Check the status code of the response: does it match the expected response(s)?
462 if (logger.isDebugEnabled()) {
463 logger.debug(testName + ": status = " + statusCode);
465 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
466 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
467 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
470 Permission permUpdated = (Permission) res.getEntity();
471 Assert.assertNotNull(permUpdated);
473 Assert.assertEquals(permUpdated.getDescription(),
474 permToUpdate.getDescription(),
475 "Data in updated object did not match submitted data.");
478 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
479 dependsOnMethods = {"read", "readList", "readNonExistent"})
480 public void updateNotAllowed(String testName) throws Exception {
485 Permission permToUpdate = new Permission();
486 permToUpdate.setCsid(knownResourceId);
487 // Update the content of this resource.
488 permToUpdate.setResourceName("updated-resource");
489 if (logger.isDebugEnabled()) {
490 logger.debug("updated object");
491 logger.debug(objectAsXmlString(permToUpdate,
494 PermissionClient client = new PermissionClient();
495 // Submit the request to the service and store the response.
496 ClientResponse<Permission> res = client.update(knownResourceId, permToUpdate);
497 int statusCode = res.getStatus();
498 // Check the status code of the response: does it match the expected response(s)?
499 if (logger.isDebugEnabled()) {
500 logger.debug(testName + ": status = " + statusCode);
502 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
503 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
504 Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
511 * @param testName the test name
512 * @throws Exception the exception
514 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
515 dependsOnMethods = {"updateNotAllowed"})
516 public void updateActions(String testName) throws Exception {
518 if (logger.isDebugEnabled()) {
519 logger.debug(testBanner(testName, CLASS_NAME));
524 Permission permToUpdate = new Permission();
525 permToUpdate.setCsid(knownResourceId);
526 permToUpdate.setResourceName(knownResource);
527 // Update the content of this resource.
528 List<PermissionAction> actions = PermissionFactory.createDefaultActions();
529 int default_actions = actions.size();
532 int toUpdate_actions = actions.size();
533 if (logger.isDebugEnabled()) {
534 logger.debug(testName + " no. of actions default=" + default_actions
535 + " to update =" + toUpdate_actions);
537 permToUpdate.setActions(actions);
538 if (logger.isDebugEnabled()) {
539 logger.debug(testName + " updated object\n"
540 + objectAsXmlString(permToUpdate, Permission.class));
542 PermissionClient client = new PermissionClient();
543 // Submit the request to the service and store the response.
544 ClientResponse<Permission> res = client.update(knownResourceId, permToUpdate);
545 int statusCode = res.getStatus();
546 // Check the status code of the response: does it match the expected response(s)?
547 if (logger.isDebugEnabled()) {
548 logger.debug(testName + ": status = " + statusCode);
550 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
551 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
552 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
554 Permission permUpdated = (Permission) res.getEntity();
555 Assert.assertNotNull(permUpdated);
556 int updated_actions = permToUpdate.getActions().size();
557 if (logger.isDebugEnabled()) {
558 logger.debug(testName + " no. of actions to update=" + toUpdate_actions
559 + " updated =" + updated_actions);
561 Assert.assertEquals(toUpdate_actions,
563 "Data in updated object did not match submitted data.");
566 // Placeholders until the three tests below can be uncommented.
567 // See Issue CSPACE-401.
570 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
573 public void updateWithEmptyEntityBody(String testName) throws Exception {
574 //FIXME: Should this test really be empty? If so, please comment accordingly.
578 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
581 public void updateWithMalformedXml(String testName) throws Exception {
582 //FIXME: Should this test really be empty? If so, please comment accordingly.
586 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
589 public void updateWithWrongXmlSchema(String testName) throws Exception {
590 //FIXME: Should this test really be empty? If so, please comment accordingly.
594 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
597 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
598 dependsOnMethods = {"readNonExistent", "testSubmitRequest"})
599 public void updateNonExistent(String testName) throws Exception {
601 if (logger.isDebugEnabled()) {
602 logger.debug(testBanner(testName, CLASS_NAME));
605 setupUpdateNonExistent();
607 // Submit the request to the service and store the response.
609 // Note: The ID used in this 'create' call may be arbitrary.
610 // The only relevant ID may be the one used in updatePermission(), below.
611 PermissionClient client = new PermissionClient();
612 List<PermissionAction> actions = PermissionFactory.createDefaultActions();
613 Permission permission = createPermissionInstance("test-acquisitions",
614 "default permissions for test-acquisitions",
620 ClientResponse<Permission> res =
621 client.update(NON_EXISTENT_ID, permission);
622 int statusCode = res.getStatus();
624 // Check the status code of the response: does it match
625 // the expected response(s)?
626 if (logger.isDebugEnabled()) {
627 logger.debug(testName + ": status = " + statusCode);
629 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
630 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
631 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
634 // ---------------------------------------------------------------
635 // CRUD tests : DELETE tests
636 // ---------------------------------------------------------------
639 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
642 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
643 dependsOnMethods = {"updateActions", "testSubmitRequest"})
644 public void delete(String testName) throws Exception {
646 if (logger.isDebugEnabled()) {
647 logger.debug(testBanner(testName, CLASS_NAME));
652 // Submit the request to the service and store the response.
653 PermissionClient client = new PermissionClient();
654 ClientResponse<Response> res = client.delete(knownResourceId);
655 int statusCode = res.getStatus();
657 // Check the status code of the response: does it match
658 // the expected response(s)?
659 if (logger.isDebugEnabled()) {
660 logger.debug(testName + ": status = " + statusCode);
662 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
663 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
664 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
669 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
672 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
673 dependsOnMethods = {"delete"})
674 public void deleteNonExistent(String testName) throws Exception {
676 if (logger.isDebugEnabled()) {
677 logger.debug(testBanner(testName, CLASS_NAME));
680 setupDeleteNonExistent();
682 // Submit the request to the service and store the response.
683 PermissionClient client = new PermissionClient();
684 ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
685 int statusCode = res.getStatus();
687 // Check the status code of the response: does it match
688 // the expected response(s)?
689 if (logger.isDebugEnabled()) {
690 logger.debug(testName + ": status = " + statusCode);
692 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
693 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
694 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
697 // ---------------------------------------------------------------
698 // Utility tests : tests of code used in tests above
699 // ---------------------------------------------------------------
701 * Tests the code for manually submitting data that is used by several
702 * of the methods above.
705 @Test(dependsOnMethods = {"create"})
706 public void testSubmitRequest() throws Exception {
708 // Expected status code: 200 OK
709 final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
711 // Submit the request to the service and store the response.
712 String method = ServiceRequestType.READ.httpMethodName();
713 String url = getResourceURL(knownResourceId);
714 int statusCode = submitRequest(method, url);
716 // Check the status code of the response: does it match
717 // the expected response(s)?
718 if (logger.isDebugEnabled()) {
719 logger.debug("testSubmitRequest: url=" + url
720 + " status=" + statusCode);
722 Assert.assertEquals(statusCode, EXPECTED_STATUS);
726 // ---------------------------------------------------------------
727 // Utility methods used by tests above
728 // ---------------------------------------------------------------
730 * create permission instance
731 * @param resourceName
733 * @param actionList list of actions for this permission
734 * @param effect effect of the permission
735 * @param useResourceName
740 public static Permission createPermissionInstance(String resourceName,
742 List<PermissionAction> actionList,
744 boolean useResourceName,
748 Permission permission = PermissionFactory.createPermissionInstance(resourceName,
749 description, actionList, effect,
750 useResourceName, useAction, useEffect);
752 if (logger.isDebugEnabled()) {
753 logger.debug("to be created, permission");
754 logger.debug(objectAsXmlString(permission, Permission.class));
762 * @param testName the test name
763 * @param list the list
766 private int printList(String testName, PermissionsList list) {
770 for (Permission permission : list.getPermissions()) {
771 logger.debug(testName + " permission csid=" + permission.getCsid()
772 + " name=" + permission.getResourceName()
773 + " desc=" + permission.getDescription());