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>();
65 /** The add tenant. */
66 boolean addTenant = true;
68 * This method is called only by the parent class, AbstractServiceTestImpl
72 * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
75 protected String getServicePathComponent() {
76 return new RoleClient().getServicePathComponent();
80 * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
83 protected CollectionSpaceClient getClientInstance() {
84 return new RoleClient();
88 * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
91 protected AbstractCommonList getAbstractCommonList(
92 ClientResponse<AbstractCommonList> response) {
93 //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
94 throw new UnsupportedOperationException();
98 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readPaginatedList(java.lang.String)
100 @Test(dataProvider = "testName")
102 public void readPaginatedList(String testName) throws Exception {
103 //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
106 // ---------------------------------------------------------------
107 // CRUD tests : CREATE tests
108 // ---------------------------------------------------------------
111 * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
114 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
115 public void create(String testName) throws Exception {
117 if (logger.isDebugEnabled()) {
118 logger.debug(testBanner(testName, CLASS_NAME));
120 // Perform setup, such as initializing the type of service request
121 // (e.g. CREATE, DELETE), its valid and expected status codes, and
122 // its associated HTTP method name (e.g. POST, DELETE).
125 // Submit the request to the service and store the response.
126 RoleClient client = new RoleClient();
127 Role role = createRoleInstance(knownRoleName,
128 "all users are required to be in this role",
130 ClientResponse<Response> res = client.create(role);
131 int statusCode = res.getStatus();
133 // Check the status code of the response: does it match
134 // the expected response(s)?
137 // Does it fall within the set of valid status codes?
138 // Does it exactly match the expected status code?
139 if (logger.isDebugEnabled()) {
140 logger.debug(testName + ": status = " + statusCode);
142 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
143 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
144 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
146 // Store the ID returned from this create operation
147 // for additional tests below.
148 knownResourceId = extractId(res);
149 if (logger.isDebugEnabled()) {
150 logger.debug(testName + ": knownResourceId=" + knownResourceId);
155 * Creates the for unique role.
157 * @param testName the test name
158 * @throws Exception the exception
160 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
161 dependsOnMethods = {"create"})
162 public void createForUniqueRole(String testName) throws Exception {
164 if (logger.isDebugEnabled()) {
165 logger.debug(testBanner(testName, CLASS_NAME));
169 // Submit the request to the service and store the response.
170 RoleClient client = new RoleClient();
171 Role role = createRoleInstance("ROLE_USERS",
174 ClientResponse<Response> res = client.create(role);
175 int statusCode = res.getStatus();
177 if (logger.isDebugEnabled()) {
178 logger.debug(testName + ": status = " + statusCode);
180 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
181 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
182 Assert.assertEquals(statusCode, Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
186 * Creates the without role name.
188 * @param testName the test name
189 * @throws Exception the exception
191 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
192 dependsOnMethods = {"create"})
193 public void createWithoutRoleName(String testName) throws Exception {
195 if (logger.isDebugEnabled()) {
196 logger.debug(testBanner(testName, CLASS_NAME));
200 // Submit the request to the service and store the response.
201 RoleClient client = new RoleClient();
202 Role role = createRoleInstance("ROLE_USERS",
205 ClientResponse<Response> res = client.create(role);
206 int statusCode = res.getStatus();
207 // Does it exactly match the expected status code?
208 if (logger.isDebugEnabled()) {
209 logger.debug(testName + ": status = " + statusCode);
211 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
212 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
213 Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
216 //to not cause uniqueness violation for role, createList is removed
218 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
221 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
222 dependsOnMethods = {"create"})
223 public void createList(String testName) throws Exception {
225 if (logger.isDebugEnabled()) {
226 logger.debug(testBanner(testName, CLASS_NAME));
230 // Submit the request to the service and store the response.
231 RoleClient client = new RoleClient();
232 //create a role with lowercase role name without role prefix
233 //the service should make it upper case and add the role prefix
234 Role role1 = createRoleInstance(verifyRoleName,
235 "collection manager",
237 ClientResponse<Response> res = client.create(role1);
238 int statusCode = res.getStatus();
239 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
240 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
241 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
242 verifyResourceId = extractId(res);
243 allResourceIdsCreated.add(verifyResourceId);
245 Role role2 = createRoleInstance("ROLE_COLLECTIONS_CURATOR_TEST",
246 "collections curator",
248 res = client.create(role2);
249 statusCode = res.getStatus();
250 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
251 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
252 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
253 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
254 allResourceIdsCreated.add(extractId(res));
256 Role role3 = createRoleInstance("ROLE_MOVINGIMAGE_ADMIN_TEST",
257 "moving image admin",
259 res = client.create(role3);
260 statusCode = res.getStatus();
261 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
262 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
263 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
264 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
265 allResourceIdsCreated.add(extractId(res));
269 // Placeholders until the three tests below can be uncommented.
270 // See Issue CSPACE-401.
272 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
275 public void createWithEmptyEntityBody(String testName) throws Exception {
276 //FIXME: Should this test really be empty? If so, please comment accordingly.
280 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
283 public void createWithMalformedXml(String testName) throws Exception {
284 //FIXME: Should this test really be empty? If so, please comment accordingly.
288 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
291 public void createWithWrongXmlSchema(String testName) throws Exception {
292 //FIXME: Should this test really be empty? If so, please comment accordingly.
295 // ---------------------------------------------------------------
296 // CRUD tests : READ tests
297 // ---------------------------------------------------------------
300 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
303 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
304 dependsOnMethods = {"create"})
305 public void read(String testName) throws Exception {
307 if (logger.isDebugEnabled()) {
308 logger.debug(testBanner(testName, CLASS_NAME));
313 // Submit the request to the service and store the response.
314 RoleClient client = new RoleClient();
315 ClientResponse<Role> res = client.read(knownResourceId);
316 int statusCode = res.getStatus();
318 // Check the status code of the response: does it match
319 // the expected response(s)?
320 if (logger.isDebugEnabled()) {
321 logger.debug(testName + ": status = " + statusCode);
323 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
324 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
325 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
327 Role output = (Role) res.getEntity();
328 Assert.assertNotNull(output);
331 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
332 dependsOnMethods = {"createList"})
333 public void readToVerify(String testName) throws Exception {
338 // Submit the request to the service and store the response.
339 RoleClient client = new RoleClient();
340 ClientResponse<Role> res = client.read(verifyResourceId);
341 int statusCode = res.getStatus();
343 // Check the status code of the response: does it match
344 // the expected response(s)?
345 if (logger.isDebugEnabled()) {
346 logger.debug(testName + ": status = " + statusCode);
348 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
349 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
350 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
352 Role output = (Role) res.getEntity();
353 Assert.assertNotNull(output);
355 String roleNameToVerify = "ROLE_" + verifyRoleName.toUpperCase();
356 Assert.assertEquals(output.getRoleName(), roleNameToVerify,
357 "RoleName fix did not work!");
361 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
365 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
366 dependsOnMethods = {"read"})
367 public void readNonExistent(String testName) throws Exception {
369 if (logger.isDebugEnabled()) {
370 logger.debug(testBanner(testName, CLASS_NAME));
373 setupReadNonExistent();
375 // Submit the request to the service and store the response.
376 RoleClient client = new RoleClient();
377 ClientResponse<Role> res = client.read(NON_EXISTENT_ID);
378 int statusCode = res.getStatus();
380 // Check the status code of the response: does it match
381 // the expected response(s)?
382 if (logger.isDebugEnabled()) {
383 logger.debug(testName + ": status = " + statusCode);
385 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
386 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
387 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
390 // ---------------------------------------------------------------
391 // CRUD tests : READ_LIST tests
392 // ---------------------------------------------------------------
395 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
398 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
399 dependsOnMethods = {"createList", "read"})
400 public void readList(String testName) throws Exception {
402 if (logger.isDebugEnabled()) {
403 logger.debug(testBanner(testName, CLASS_NAME));
408 // Submit the request to the service and store the response.
409 RoleClient client = new RoleClient();
410 ClientResponse<RolesList> res = client.readList();
411 RolesList list = res.getEntity();
412 int statusCode = res.getStatus();
414 // Check the status code of the response: does it match
415 // the expected response(s)?
416 if (logger.isDebugEnabled()) {
417 logger.debug(testName + ": status = " + statusCode);
419 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
420 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
421 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
423 // Optionally output additional data about list members for debugging.
424 boolean iterateThroughList = true;
425 if (iterateThroughList && logger.isDebugEnabled()) {
426 printList(testName, list);
433 * @param testName the test name
434 * @throws Exception the exception
436 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
437 dependsOnMethods = {"createList", "read"})
438 public void searchRoleName(String testName) throws Exception {
440 if (logger.isDebugEnabled()) {
441 logger.debug(testBanner(testName, CLASS_NAME));
446 // Submit the request to the service and store the response.
447 RoleClient client = new RoleClient();
448 ClientResponse<RolesList> res = client.readSearchList("movingImage");
449 RolesList list = res.getEntity();
450 int statusCode = res.getStatus();
451 // Check the status code of the response: does it match
452 // the expected response(s)?
453 if (logger.isDebugEnabled()) {
454 logger.debug(testName + ": status = " + statusCode);
456 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
457 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
458 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
459 int EXPECTED_ITEMS = 1;
460 if (logger.isDebugEnabled()) {
461 logger.debug(testName + ": received = " + list.getRoles().size()
462 + " expected=" + EXPECTED_ITEMS);
464 Assert.assertEquals(EXPECTED_ITEMS, list.getRoles().size());
465 // Optionally output additional data about list members for debugging.
466 boolean iterateThroughList = true;
467 if (iterateThroughList && logger.isDebugEnabled()) {
468 printList(testName, list);
474 // ---------------------------------------------------------------
475 // CRUD tests : UPDATE tests
476 // ---------------------------------------------------------------
479 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
482 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
483 dependsOnMethods = {"read", "readList", "readNonExistent"})
484 public void update(String testName) throws Exception {
486 if (logger.isDebugEnabled()) {
487 logger.debug(testBanner(testName, CLASS_NAME));
492 Role roleToUpdate = new Role();
493 roleToUpdate.setCsid(knownResourceId);
494 roleToUpdate.setRoleName(knownRoleName);
496 // Update the content of this resource.
497 roleToUpdate.setDescription("updated role description");
498 if (logger.isDebugEnabled()) {
499 logger.debug("updated object");
500 logger.debug(objectAsXmlString(roleToUpdate,
503 RoleClient client = new RoleClient();
504 // Submit the request to the service and store the response.
505 ClientResponse<Role> res = client.update(knownResourceId, roleToUpdate);
506 int statusCode = res.getStatus();
507 // Check the status code of the response: does it match the expected response(s)?
508 if (logger.isDebugEnabled()) {
509 logger.debug(testName + ": status = " + statusCode);
511 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
512 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
513 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
516 Role roleUpdated = (Role) res.getEntity();
517 Assert.assertNotNull(roleUpdated);
519 Assert.assertEquals(roleUpdated.getDescription(),
520 roleToUpdate.getDescription(),
521 "Data in updated object did not match submitted data.");
524 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
525 dependsOnMethods = {"read", "readList", "readNonExistent"})
526 public void updateNotAllowed(String testName) throws Exception {
531 Role roleToUpdate = new Role();
532 roleToUpdate.setCsid(knownResourceId);
533 // Update the content of this resource.
534 roleToUpdate.setRoleName("UPDATED-ROLE_USERS_TEST");
535 if (logger.isDebugEnabled()) {
536 logger.debug("updated object");
537 logger.debug(objectAsXmlString(roleToUpdate,
540 RoleClient client = new RoleClient();
541 // Submit the request to the service and store the response.
542 ClientResponse<Role> res = client.update(knownResourceId, roleToUpdate);
543 int statusCode = res.getStatus();
544 // Check the status code of the response: does it match the expected response(s)?
545 if (logger.isDebugEnabled()) {
546 logger.debug(testName + ": status = " + statusCode);
548 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
549 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
550 Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
555 // Placeholders until the three tests below can be uncommented.
556 // See Issue CSPACE-401.
558 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
561 public void updateWithEmptyEntityBody(String testName) throws Exception {
562 //FIXME: Should this test really be empty? If so, please comment accordingly.
566 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
569 public void updateWithMalformedXml(String testName) throws Exception {
570 //FIXME: Should this test really be empty? If so, please comment accordingly.
574 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
577 public void updateWithWrongXmlSchema(String testName) throws Exception {
578 //FIXME: Should this test really be empty? If so, please comment accordingly.
582 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
585 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
586 dependsOnMethods = {"readNonExistent", "testSubmitRequest"})
587 public void updateNonExistent(String testName) throws Exception {
589 if (logger.isDebugEnabled()) {
590 logger.debug(testBanner(testName, CLASS_NAME));
593 setupUpdateNonExistent();
595 // Submit the request to the service and store the response.
597 // Note: The ID used in this 'create' call may be arbitrary.
598 // The only relevant ID may be the one used in updateRole(), below.
599 RoleClient client = new RoleClient();
600 Role role = createRoleInstance("ROLE_XXX",
603 ClientResponse<Role> res =
604 client.update(NON_EXISTENT_ID, role);
605 int statusCode = res.getStatus();
607 // Check the status code of the response: does it match
608 // the expected response(s)?
609 if (logger.isDebugEnabled()) {
610 logger.debug(testName + ": status = " + statusCode);
612 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
613 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
614 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
617 // ---------------------------------------------------------------
618 // CRUD tests : DELETE tests
619 // ---------------------------------------------------------------
622 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
625 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
626 dependsOnMethods = {"updateNotAllowed", "testSubmitRequest"})
627 public void delete(String testName) throws Exception {
629 if (logger.isDebugEnabled()) {
630 logger.debug(testBanner(testName, CLASS_NAME));
635 // Submit the request to the service and store the response.
636 RoleClient client = new RoleClient();
637 ClientResponse<Response> res = client.delete(knownResourceId);
638 int statusCode = res.getStatus();
640 // Check the status code of the response: does it match
641 // the expected response(s)?
642 if (logger.isDebugEnabled()) {
643 logger.debug(testName + ": status = " + statusCode);
645 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
646 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
647 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
652 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
655 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
656 dependsOnMethods = {"delete"})
657 public void deleteNonExistent(String testName) throws Exception {
659 if (logger.isDebugEnabled()) {
660 logger.debug(testBanner(testName, CLASS_NAME));
663 setupDeleteNonExistent();
665 // Submit the request to the service and store the response.
666 RoleClient client = new RoleClient();
667 ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
668 int statusCode = res.getStatus();
670 // Check the status code of the response: does it match
671 // the expected response(s)?
672 if (logger.isDebugEnabled()) {
673 logger.debug(testName + ": status = " + statusCode);
675 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
676 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
677 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
680 // ---------------------------------------------------------------
681 // Utility tests : tests of code used in tests above
682 // ---------------------------------------------------------------
684 * Tests the code for manually submitting data that is used by several
685 * of the methods above.
689 @Test(dependsOnMethods = {"create"})
690 public void testSubmitRequest() throws Exception {
692 // Expected status code: 200 OK
693 final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
695 // Submit the request to the service and store the response.
696 String method = ServiceRequestType.READ.httpMethodName();
697 String url = getResourceURL(knownResourceId);
698 int statusCode = submitRequest(method, url);
700 // Check the status code of the response: does it match
701 // the expected response(s)?
702 if (logger.isDebugEnabled()) {
703 logger.debug("testSubmitRequest: url=" + url
704 + " status=" + statusCode);
706 Assert.assertEquals(statusCode, EXPECTED_STATUS);
710 // ---------------------------------------------------------------
711 // Utility methods used by tests above
712 // ---------------------------------------------------------------
714 * create role instance
720 public Role createRoleInstance(String roleName,
722 boolean useRoleName) {
724 Role role = RoleFactory.createRoleInstance(roleName, description,
726 if (logger.isDebugEnabled()) {
727 logger.debug("to be created, role");
728 logger.debug(objectAsXmlString(role, Role.class));
737 * @param testName the test name
738 * @param list the list
741 private int printList(String testName, RolesList list) {
745 for (Role role : list.getRoles()) {
746 logger.debug(testName + " role csid=" + role.getCsid()
747 + " name=" + role.getRoleName()
748 + " desc=" + role.getDescription());