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;
29 import org.collectionspace.services.client.CollectionSpaceClient;
30 import org.collectionspace.services.client.RoleClient;
31 import org.collectionspace.services.authorization.Role;
32 import org.collectionspace.services.authorization.RolesList;
33 import org.collectionspace.services.client.RoleFactory;
34 import org.collectionspace.services.client.test.AbstractServiceTestImpl;
35 import org.collectionspace.services.client.test.ServiceRequestType;
36 import org.collectionspace.services.jaxb.AbstractCommonList;
37 import org.jboss.resteasy.client.ClientResponse;
39 import org.testng.Assert;
40 import org.testng.annotations.Test;
42 import org.slf4j.Logger;
43 import org.slf4j.LoggerFactory;
46 * RoleServiceTest, carries out tests against a
47 * deployed and running Role Service.
49 * $LastChangedRevision: 917 $
50 * $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri, 06 Nov 2009) $
52 public class RoleServiceTest extends AbstractServiceTestImpl {
55 private final static String CLASS_NAME = RoleServiceTest.class.getName();
56 private final static Logger logger = LoggerFactory.getLogger(CLASS_NAME);
58 // Instance variables specific to this test.
59 /** The known resource id. */
60 private String knownResourceId = null;
61 private String knownRoleName = "ROLE_USERS_TEST";
62 private String verifyResourceId = null;
63 private String verifyRoleName = "collections_manager_test";
64 // private List<String> allResourceIdsCreated = new ArrayList<String>();
67 * This method is called only by the parent class, AbstractServiceTestImpl
71 * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
74 protected String getServicePathComponent() {
75 return new RoleClient().getServicePathComponent();
79 * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
82 protected CollectionSpaceClient getClientInstance() {
83 return new RoleClient();
87 * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
90 protected AbstractCommonList getAbstractCommonList(
91 ClientResponse<AbstractCommonList> response) {
92 //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
93 throw new UnsupportedOperationException();
97 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readPaginatedList(java.lang.String)
99 @Test(dataProvider = "testName")
101 public void readPaginatedList(String testName) throws Exception {
102 //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
105 // ---------------------------------------------------------------
106 // CRUD tests : CREATE tests
107 // ---------------------------------------------------------------
110 * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
113 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
114 public void create(String testName) throws Exception {
116 if (logger.isDebugEnabled()) {
117 logger.debug(testBanner(testName, CLASS_NAME));
119 // Perform setup, such as initializing the type of service request
120 // (e.g. CREATE, DELETE), its valid and expected status codes, and
121 // its associated HTTP method name (e.g. POST, DELETE).
124 // Submit the request to the service and store the response.
125 RoleClient client = new RoleClient();
126 Role role = createRoleInstance(knownRoleName,
127 "all users are required to be in this role",
129 ClientResponse<Response> res = client.create(role);
130 int statusCode = res.getStatus();
132 // Check the status code of the response: does it match
133 // the expected response(s)?
136 // Does it fall within the set of valid status codes?
137 // Does it exactly match the expected status code?
138 if (logger.isDebugEnabled()) {
139 logger.debug(testName + ": status = " + statusCode);
141 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
142 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
143 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
145 // Store the ID returned from this create operation
146 // for additional tests below.
147 knownResourceId = extractId(res);
148 if (logger.isDebugEnabled()) {
149 logger.debug(testName + ": knownResourceId=" + knownResourceId);
154 * Creates the for unique role.
156 * @param testName the test name
157 * @throws Exception the exception
159 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
160 dependsOnMethods = {"create"})
161 public void createForUniqueRole(String testName) throws Exception {
163 if (logger.isDebugEnabled()) {
164 logger.debug(testBanner(testName, CLASS_NAME));
168 // Submit the request to the service and store the response.
169 RoleClient client = new RoleClient();
170 Role role = createRoleInstance(knownRoleName,
173 ClientResponse<Response> res = client.create(role);
174 int statusCode = res.getStatus();
176 if (logger.isDebugEnabled()) {
177 logger.debug(testName + ": status = " + statusCode);
179 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
180 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
181 Assert.assertEquals(statusCode, Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
185 * Creates the without role name.
187 * @param testName the test name
188 * @throws Exception the exception
190 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
191 dependsOnMethods = {"create"})
192 public void createWithoutRoleName(String testName) throws Exception {
194 if (logger.isDebugEnabled()) {
195 logger.debug(testBanner(testName, CLASS_NAME));
199 // Submit the request to the service and store the response.
200 RoleClient client = new RoleClient();
201 Role role = createRoleInstance("",
204 ClientResponse<Response> res = client.create(role);
205 int statusCode = res.getStatus();
206 // Does it exactly match the expected status code?
207 if (logger.isDebugEnabled()) {
208 logger.debug(testName + ": status = " + statusCode);
210 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
211 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
212 Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
215 //to not cause uniqueness violation for role, createList is removed
217 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
220 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
221 dependsOnMethods = {"create"})
222 public void createList(String testName) throws Exception {
224 if (logger.isDebugEnabled()) {
225 logger.debug(testBanner(testName, CLASS_NAME));
229 // Submit the request to the service and store the response.
230 RoleClient client = new RoleClient();
231 //create a role with lowercase role name without role prefix
232 //the service should make it upper case and add the role prefix
233 Role role1 = createRoleInstance(verifyRoleName,
234 "collection manager",
236 ClientResponse<Response> res = client.create(role1);
237 int statusCode = res.getStatus();
238 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
239 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
240 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
241 verifyResourceId = extractId(res);
242 allResourceIdsCreated.add(verifyResourceId);
244 Role role2 = createRoleInstance("ROLE_COLLECTIONS_CURATOR_TEST",
245 "collections curator",
247 res = client.create(role2);
248 statusCode = res.getStatus();
249 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
250 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
251 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
252 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
253 allResourceIdsCreated.add(extractId(res));
255 Role role3 = createRoleInstance("ROLE_MOVINGIMAGE_ADMIN_TEST",
256 "moving image admin",
258 res = client.create(role3);
259 statusCode = res.getStatus();
260 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
261 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
262 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
263 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
264 allResourceIdsCreated.add(extractId(res));
268 // Placeholders until the three tests below can be uncommented.
269 // See Issue CSPACE-401.
271 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
274 public void createWithEmptyEntityBody(String testName) throws Exception {
275 //FIXME: Should this test really be empty? If so, please comment accordingly.
279 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
282 public void createWithMalformedXml(String testName) throws Exception {
283 //FIXME: Should this test really be empty? If so, please comment accordingly.
287 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
290 public void createWithWrongXmlSchema(String testName) throws Exception {
291 //FIXME: Should this test really be empty? If so, please comment accordingly.
294 // ---------------------------------------------------------------
295 // CRUD tests : READ tests
296 // ---------------------------------------------------------------
299 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
302 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
303 dependsOnMethods = {"createForUniqueRole"})
304 public void read(String testName) throws Exception {
306 if (logger.isDebugEnabled()) {
307 logger.debug(testBanner(testName, CLASS_NAME));
312 // Submit the request to the service and store the response.
313 RoleClient client = new RoleClient();
314 ClientResponse<Role> res = client.read(knownResourceId);
315 int statusCode = res.getStatus();
317 // Check the status code of the response: does it match
318 // the expected response(s)?
319 if (logger.isDebugEnabled()) {
320 logger.debug(testName + ": status = " + statusCode);
322 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
323 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
324 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
326 Role output = (Role) res.getEntity();
327 Assert.assertNotNull(output);
330 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
331 dependsOnMethods = {"createList"})
332 public void readToVerify(String testName) throws Exception {
337 // Submit the request to the service and store the response.
338 RoleClient client = new RoleClient();
339 ClientResponse<Role> res = client.read(verifyResourceId);
340 int statusCode = res.getStatus();
342 // Check the status code of the response: does it match
343 // the expected response(s)?
344 if (logger.isDebugEnabled()) {
345 logger.debug(testName + ": status = " + statusCode);
347 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
348 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
349 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
351 Role output = (Role) res.getEntity();
352 Assert.assertNotNull(output);
354 //FIXME: Tenant ID of "1" should not be hard coded
355 String roleNameToVerify = "ROLE_" +
357 verifyRoleName.toUpperCase();
358 Assert.assertEquals(output.getRoleName(), roleNameToVerify,
359 "RoleName fix did not work!");
363 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
367 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
368 dependsOnMethods = {"read"})
369 public void readNonExistent(String testName) throws Exception {
371 if (logger.isDebugEnabled()) {
372 logger.debug(testBanner(testName, CLASS_NAME));
375 setupReadNonExistent();
377 // Submit the request to the service and store the response.
378 RoleClient client = new RoleClient();
379 ClientResponse<Role> res = client.read(NON_EXISTENT_ID);
380 int statusCode = res.getStatus();
382 // Check the status code of the response: does it match
383 // the expected response(s)?
384 if (logger.isDebugEnabled()) {
385 logger.debug(testName + ": status = " + statusCode);
387 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
388 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
389 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
392 // ---------------------------------------------------------------
393 // CRUD tests : READ_LIST tests
394 // ---------------------------------------------------------------
397 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
400 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
401 dependsOnMethods = {"createList", "read"})
402 public void readList(String testName) throws Exception {
404 if (logger.isDebugEnabled()) {
405 logger.debug(testBanner(testName, CLASS_NAME));
410 // Submit the request to the service and store the response.
411 RoleClient client = new RoleClient();
412 ClientResponse<RolesList> res = client.readList();
413 RolesList list = res.getEntity();
414 int statusCode = res.getStatus();
416 // Check the status code of the response: does it match
417 // the expected response(s)?
418 if (logger.isDebugEnabled()) {
419 logger.debug(testName + ": status = " + statusCode);
421 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
422 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
423 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
425 // Optionally output additional data about list members for debugging.
426 boolean iterateThroughList = true;
427 if (iterateThroughList && logger.isDebugEnabled()) {
428 printList(testName, list);
435 * @param testName the test name
436 * @throws Exception the exception
438 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
439 dependsOnMethods = {"createList", "read"})
440 public void searchRoleName(String testName) throws Exception {
442 if (logger.isDebugEnabled()) {
443 logger.debug(testBanner(testName, CLASS_NAME));
448 // Submit the request to the service and store the response.
449 RoleClient client = new RoleClient();
450 ClientResponse<RolesList> res = client.readSearchList("movingImage");
451 RolesList list = res.getEntity();
452 int statusCode = res.getStatus();
453 // Check the status code of the response: does it match
454 // the expected response(s)?
455 if (logger.isDebugEnabled()) {
456 logger.debug(testName + ": status = " + statusCode);
458 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
459 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
460 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
461 int EXPECTED_ITEMS = 1;
462 if (logger.isDebugEnabled()) {
463 logger.debug(testName + ": received = " + list.getRoles().size()
464 + " expected=" + EXPECTED_ITEMS);
466 Assert.assertEquals(EXPECTED_ITEMS, list.getRoles().size());
467 // Optionally output additional data about list members for debugging.
468 boolean iterateThroughList = true;
469 if (iterateThroughList && logger.isDebugEnabled()) {
470 printList(testName, list);
476 // ---------------------------------------------------------------
477 // CRUD tests : UPDATE tests
478 // ---------------------------------------------------------------
481 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
484 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
485 dependsOnMethods = {"read", "readList", "readNonExistent"})
486 public void update(String testName) throws Exception {
488 if (logger.isDebugEnabled()) {
489 logger.debug(testBanner(testName, CLASS_NAME));
494 Role roleToUpdate = new Role();
495 roleToUpdate.setCsid(knownResourceId);
496 roleToUpdate.setRoleName(knownRoleName);
498 // Update the content of this resource.
499 roleToUpdate.setDescription("updated role description");
500 if (logger.isDebugEnabled()) {
501 logger.debug("updated object");
502 logger.debug(objectAsXmlString(roleToUpdate,
505 RoleClient client = new RoleClient();
506 // Submit the request to the service and store the response.
507 ClientResponse<Role> res = client.update(knownResourceId, roleToUpdate);
508 int statusCode = res.getStatus();
509 // Check the status code of the response: does it match the expected response(s)?
510 if (logger.isDebugEnabled()) {
511 logger.debug(testName + ": status = " + statusCode);
513 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
514 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
515 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
518 Role roleUpdated = (Role) res.getEntity();
519 Assert.assertNotNull(roleUpdated);
521 Assert.assertEquals(roleUpdated.getDescription(),
522 roleToUpdate.getDescription(),
523 "Data in updated object did not match submitted data.");
526 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
527 dependsOnMethods = {"read", "readList", "readNonExistent"})
528 public void updateNotAllowed(String testName) throws Exception {
533 Role roleToUpdate = new Role();
534 roleToUpdate.setCsid(knownResourceId);
535 // Update the content of this resource.
536 roleToUpdate.setRoleName("UPDATED-ROLE_USERS_TEST");
537 if (logger.isDebugEnabled()) {
538 logger.debug("updated object");
539 logger.debug(objectAsXmlString(roleToUpdate,
542 RoleClient client = new RoleClient();
543 // Submit the request to the service and store the response.
544 ClientResponse<Role> res = client.update(knownResourceId, roleToUpdate);
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, Response.Status.BAD_REQUEST.getStatusCode());
557 // Placeholders until the three tests below can be uncommented.
558 // See Issue CSPACE-401.
560 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
563 public void updateWithEmptyEntityBody(String testName) throws Exception {
564 //FIXME: Should this test really be empty? If so, please comment accordingly.
568 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
571 public void updateWithMalformedXml(String testName) throws Exception {
572 //FIXME: Should this test really be empty? If so, please comment accordingly.
576 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
579 public void updateWithWrongXmlSchema(String testName) throws Exception {
580 //FIXME: Should this test really be empty? If so, please comment accordingly.
584 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
587 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
588 dependsOnMethods = {"readNonExistent", "testSubmitRequest"})
589 public void updateNonExistent(String testName) throws Exception {
591 if (logger.isDebugEnabled()) {
592 logger.debug(testBanner(testName, CLASS_NAME));
595 setupUpdateNonExistent();
597 // Submit the request to the service and store the response.
599 // Note: The ID used in this 'create' call may be arbitrary.
600 // The only relevant ID may be the one used in updateRole(), below.
601 RoleClient client = new RoleClient();
602 Role role = createRoleInstance("ROLE_XXX",
605 ClientResponse<Role> res =
606 client.update(NON_EXISTENT_ID, role);
607 int statusCode = res.getStatus();
609 // Check the status code of the response: does it match
610 // the expected response(s)?
611 if (logger.isDebugEnabled()) {
612 logger.debug(testName + ": status = " + statusCode);
614 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
615 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
616 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
619 // ---------------------------------------------------------------
620 // CRUD tests : DELETE tests
621 // ---------------------------------------------------------------
624 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
627 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
628 dependsOnMethods = {"updateNotAllowed", "testSubmitRequest"})
629 public void delete(String testName) throws Exception {
631 if (logger.isDebugEnabled()) {
632 logger.debug(testBanner(testName, CLASS_NAME));
637 // Submit the request to the service and store the response.
638 RoleClient client = new RoleClient();
639 ClientResponse<Response> res = client.delete(knownResourceId);
640 int statusCode = res.getStatus();
642 // Check the status code of the response: does it match
643 // the expected response(s)?
644 if (logger.isDebugEnabled()) {
645 logger.debug(testName + ": status = " + statusCode);
647 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
648 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
649 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
654 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
657 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
658 dependsOnMethods = {"delete"})
659 public void deleteNonExistent(String testName) throws Exception {
661 if (logger.isDebugEnabled()) {
662 logger.debug(testBanner(testName, CLASS_NAME));
665 setupDeleteNonExistent();
667 // Submit the request to the service and store the response.
668 RoleClient client = new RoleClient();
669 ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
670 int statusCode = res.getStatus();
672 // Check the status code of the response: does it match
673 // the expected response(s)?
674 if (logger.isDebugEnabled()) {
675 logger.debug(testName + ": status = " + statusCode);
677 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
678 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
679 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
682 // ---------------------------------------------------------------
683 // Utility tests : tests of code used in tests above
684 // ---------------------------------------------------------------
686 * Tests the code for manually submitting data that is used by several
687 * of the methods above.
691 @Test(dependsOnMethods = {"create"})
692 public void testSubmitRequest() throws Exception {
694 // Expected status code: 200 OK
695 final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
697 // Submit the request to the service and store the response.
698 String method = ServiceRequestType.READ.httpMethodName();
699 String url = getResourceURL(knownResourceId);
700 int statusCode = submitRequest(method, url);
702 // Check the status code of the response: does it match
703 // the expected response(s)?
704 if (logger.isDebugEnabled()) {
705 logger.debug("testSubmitRequest: url=" + url
706 + " status=" + statusCode);
708 Assert.assertEquals(statusCode, EXPECTED_STATUS);
712 // ---------------------------------------------------------------
713 // Utility methods used by tests above
714 // ---------------------------------------------------------------
716 * create role instance
722 public Role createRoleInstance(String roleName,
724 boolean useRoleName) {
726 Role role = RoleFactory.createRoleInstance(roleName, description,
728 if (logger.isDebugEnabled()) {
729 logger.debug("to be created, role");
730 logger.debug(objectAsXmlString(role, Role.class));
739 * @param testName the test name
740 * @param list the list
743 private int printList(String testName, RolesList list) {
747 for (Role role : list.getRoles()) {
748 logger.debug(testName + " role csid=" + role.getCsid()
749 + " name=" + role.getRoleName()
750 + " desc=" + role.getDescription());