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 String roleNameToVerify = "ROLE_" + verifyRoleName.toUpperCase();
355 Assert.assertEquals(output.getRoleName(), roleNameToVerify,
356 "RoleName fix did not work!");
360 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
364 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
365 dependsOnMethods = {"read"})
366 public void readNonExistent(String testName) throws Exception {
368 if (logger.isDebugEnabled()) {
369 logger.debug(testBanner(testName, CLASS_NAME));
372 setupReadNonExistent();
374 // Submit the request to the service and store the response.
375 RoleClient client = new RoleClient();
376 ClientResponse<Role> res = client.read(NON_EXISTENT_ID);
377 int statusCode = res.getStatus();
379 // Check the status code of the response: does it match
380 // the expected response(s)?
381 if (logger.isDebugEnabled()) {
382 logger.debug(testName + ": status = " + statusCode);
384 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
385 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
386 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
389 // ---------------------------------------------------------------
390 // CRUD tests : READ_LIST tests
391 // ---------------------------------------------------------------
394 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
397 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
398 dependsOnMethods = {"createList", "read"})
399 public void readList(String testName) throws Exception {
401 if (logger.isDebugEnabled()) {
402 logger.debug(testBanner(testName, CLASS_NAME));
407 // Submit the request to the service and store the response.
408 RoleClient client = new RoleClient();
409 ClientResponse<RolesList> res = client.readList();
410 RolesList list = res.getEntity();
411 int statusCode = res.getStatus();
413 // Check the status code of the response: does it match
414 // the expected response(s)?
415 if (logger.isDebugEnabled()) {
416 logger.debug(testName + ": status = " + statusCode);
418 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
419 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
420 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
422 // Optionally output additional data about list members for debugging.
423 boolean iterateThroughList = true;
424 if (iterateThroughList && logger.isDebugEnabled()) {
425 printList(testName, list);
432 * @param testName the test name
433 * @throws Exception the exception
435 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
436 dependsOnMethods = {"createList", "read"})
437 public void searchRoleName(String testName) throws Exception {
439 if (logger.isDebugEnabled()) {
440 logger.debug(testBanner(testName, CLASS_NAME));
445 // Submit the request to the service and store the response.
446 RoleClient client = new RoleClient();
447 ClientResponse<RolesList> res = client.readSearchList("movingImage");
448 RolesList list = res.getEntity();
449 int statusCode = res.getStatus();
450 // Check the status code of the response: does it match
451 // the expected response(s)?
452 if (logger.isDebugEnabled()) {
453 logger.debug(testName + ": status = " + statusCode);
455 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
456 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
457 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
458 int EXPECTED_ITEMS = 1;
459 if (logger.isDebugEnabled()) {
460 logger.debug(testName + ": received = " + list.getRoles().size()
461 + " expected=" + EXPECTED_ITEMS);
463 Assert.assertEquals(EXPECTED_ITEMS, list.getRoles().size());
464 // Optionally output additional data about list members for debugging.
465 boolean iterateThroughList = true;
466 if (iterateThroughList && logger.isDebugEnabled()) {
467 printList(testName, list);
473 // ---------------------------------------------------------------
474 // CRUD tests : UPDATE tests
475 // ---------------------------------------------------------------
478 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
481 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
482 dependsOnMethods = {"read", "readList", "readNonExistent"})
483 public void update(String testName) throws Exception {
485 if (logger.isDebugEnabled()) {
486 logger.debug(testBanner(testName, CLASS_NAME));
491 Role roleToUpdate = new Role();
492 roleToUpdate.setCsid(knownResourceId);
493 roleToUpdate.setRoleName(knownRoleName);
495 // Update the content of this resource.
496 roleToUpdate.setDescription("updated role description");
497 if (logger.isDebugEnabled()) {
498 logger.debug("updated object");
499 logger.debug(objectAsXmlString(roleToUpdate,
502 RoleClient client = new RoleClient();
503 // Submit the request to the service and store the response.
504 ClientResponse<Role> res = client.update(knownResourceId, roleToUpdate);
505 int statusCode = res.getStatus();
506 // Check the status code of the response: does it match the expected response(s)?
507 if (logger.isDebugEnabled()) {
508 logger.debug(testName + ": status = " + statusCode);
510 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
511 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
512 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
515 Role roleUpdated = (Role) res.getEntity();
516 Assert.assertNotNull(roleUpdated);
518 Assert.assertEquals(roleUpdated.getDescription(),
519 roleToUpdate.getDescription(),
520 "Data in updated object did not match submitted data.");
523 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
524 dependsOnMethods = {"read", "readList", "readNonExistent"})
525 public void updateNotAllowed(String testName) throws Exception {
530 Role roleToUpdate = new Role();
531 roleToUpdate.setCsid(knownResourceId);
532 // Update the content of this resource.
533 roleToUpdate.setRoleName("UPDATED-ROLE_USERS_TEST");
534 if (logger.isDebugEnabled()) {
535 logger.debug("updated object");
536 logger.debug(objectAsXmlString(roleToUpdate,
539 RoleClient client = new RoleClient();
540 // Submit the request to the service and store the response.
541 ClientResponse<Role> res = client.update(knownResourceId, roleToUpdate);
542 int statusCode = res.getStatus();
543 // Check the status code of the response: does it match the expected response(s)?
544 if (logger.isDebugEnabled()) {
545 logger.debug(testName + ": status = " + statusCode);
547 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
548 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
549 Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
554 // Placeholders until the three tests below can be uncommented.
555 // See Issue CSPACE-401.
557 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
560 public void updateWithEmptyEntityBody(String testName) throws Exception {
561 //FIXME: Should this test really be empty? If so, please comment accordingly.
565 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
568 public void updateWithMalformedXml(String testName) throws Exception {
569 //FIXME: Should this test really be empty? If so, please comment accordingly.
573 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
576 public void updateWithWrongXmlSchema(String testName) throws Exception {
577 //FIXME: Should this test really be empty? If so, please comment accordingly.
581 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
584 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
585 dependsOnMethods = {"readNonExistent", "testSubmitRequest"})
586 public void updateNonExistent(String testName) throws Exception {
588 if (logger.isDebugEnabled()) {
589 logger.debug(testBanner(testName, CLASS_NAME));
592 setupUpdateNonExistent();
594 // Submit the request to the service and store the response.
596 // Note: The ID used in this 'create' call may be arbitrary.
597 // The only relevant ID may be the one used in updateRole(), below.
598 RoleClient client = new RoleClient();
599 Role role = createRoleInstance("ROLE_XXX",
602 ClientResponse<Role> res =
603 client.update(NON_EXISTENT_ID, role);
604 int statusCode = res.getStatus();
606 // Check the status code of the response: does it match
607 // the expected response(s)?
608 if (logger.isDebugEnabled()) {
609 logger.debug(testName + ": status = " + statusCode);
611 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
612 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
613 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
616 // ---------------------------------------------------------------
617 // CRUD tests : DELETE tests
618 // ---------------------------------------------------------------
621 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
624 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
625 dependsOnMethods = {"updateNotAllowed", "testSubmitRequest"})
626 public void delete(String testName) throws Exception {
628 if (logger.isDebugEnabled()) {
629 logger.debug(testBanner(testName, CLASS_NAME));
634 // Submit the request to the service and store the response.
635 RoleClient client = new RoleClient();
636 ClientResponse<Response> res = client.delete(knownResourceId);
637 int statusCode = res.getStatus();
639 // Check the status code of the response: does it match
640 // the expected response(s)?
641 if (logger.isDebugEnabled()) {
642 logger.debug(testName + ": status = " + statusCode);
644 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
645 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
646 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
651 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
654 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
655 dependsOnMethods = {"delete"})
656 public void deleteNonExistent(String testName) throws Exception {
658 if (logger.isDebugEnabled()) {
659 logger.debug(testBanner(testName, CLASS_NAME));
662 setupDeleteNonExistent();
664 // Submit the request to the service and store the response.
665 RoleClient client = new RoleClient();
666 ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
667 int statusCode = res.getStatus();
669 // Check the status code of the response: does it match
670 // the expected response(s)?
671 if (logger.isDebugEnabled()) {
672 logger.debug(testName + ": status = " + statusCode);
674 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
675 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
676 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
679 // ---------------------------------------------------------------
680 // Utility tests : tests of code used in tests above
681 // ---------------------------------------------------------------
683 * Tests the code for manually submitting data that is used by several
684 * of the methods above.
688 @Test(dependsOnMethods = {"create"})
689 public void testSubmitRequest() throws Exception {
691 // Expected status code: 200 OK
692 final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
694 // Submit the request to the service and store the response.
695 String method = ServiceRequestType.READ.httpMethodName();
696 String url = getResourceURL(knownResourceId);
697 int statusCode = submitRequest(method, url);
699 // Check the status code of the response: does it match
700 // the expected response(s)?
701 if (logger.isDebugEnabled()) {
702 logger.debug("testSubmitRequest: url=" + url
703 + " status=" + statusCode);
705 Assert.assertEquals(statusCode, EXPECTED_STATUS);
709 // ---------------------------------------------------------------
710 // Utility methods used by tests above
711 // ---------------------------------------------------------------
713 * create role instance
719 public Role createRoleInstance(String roleName,
721 boolean useRoleName) {
723 Role role = RoleFactory.createRoleInstance(roleName, description,
725 if (logger.isDebugEnabled()) {
726 logger.debug("to be created, role");
727 logger.debug(objectAsXmlString(role, Role.class));
736 * @param testName the test name
737 * @param list the list
740 private int printList(String testName, RolesList list) {
744 for (Role role : list.getRoles()) {
745 logger.debug(testName + " role csid=" + role.getCsid()
746 + " name=" + role.getRoleName()
747 + " desc=" + role.getDescription());