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);
497 roleToUpdate.setDisplayName(knownRoleName);
499 // Update the content of this resource.
500 roleToUpdate.setDescription("updated role description");
501 if (logger.isDebugEnabled()) {
502 logger.debug("updated object");
503 logger.debug(objectAsXmlString(roleToUpdate,
506 RoleClient client = new RoleClient();
507 // Submit the request to the service and store the response.
508 ClientResponse<Role> res = client.update(knownResourceId, roleToUpdate);
509 int statusCode = res.getStatus();
510 // Check the status code of the response: does it match the expected response(s)?
511 if (logger.isDebugEnabled()) {
512 logger.debug(testName + ": status = " + statusCode);
514 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
515 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
516 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
519 Role roleUpdated = (Role) res.getEntity();
520 Assert.assertNotNull(roleUpdated);
522 Assert.assertEquals(roleUpdated.getDescription(),
523 roleToUpdate.getDescription(),
524 "Data in updated object did not match submitted data.");
527 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
528 dependsOnMethods = {"read", "readList", "readNonExistent"})
529 public void updateNotAllowed(String testName) throws Exception {
534 Role roleToUpdate = new Role();
535 roleToUpdate.setCsid(knownResourceId);
536 // Update the content of this resource.
537 roleToUpdate.setRoleName("UPDATED-ROLE_USERS_TEST");
538 roleToUpdate.setDisplayName("UPDATED-ROLE_USERS_TEST");
539 if (logger.isDebugEnabled()) {
540 logger.debug("updated object");
541 logger.debug(objectAsXmlString(roleToUpdate,
544 RoleClient client = new RoleClient();
545 // Submit the request to the service and store the response.
546 ClientResponse<Role> res = client.update(knownResourceId, roleToUpdate);
547 int statusCode = res.getStatus();
548 // Check the status code of the response: does it match the expected response(s)?
549 if (logger.isDebugEnabled()) {
550 logger.debug(testName + ": status = " + statusCode);
552 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
553 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
554 Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
559 // Placeholders until the three tests below can be uncommented.
560 // See Issue CSPACE-401.
562 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
565 public void updateWithEmptyEntityBody(String testName) throws Exception {
566 //FIXME: Should this test really be empty? If so, please comment accordingly.
570 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
573 public void updateWithMalformedXml(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#updateWithWrongXmlSchema(java.lang.String)
581 public void updateWithWrongXmlSchema(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#updateNonExistent(java.lang.String)
589 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
590 dependsOnMethods = {"readNonExistent", "testSubmitRequest"})
591 public void updateNonExistent(String testName) throws Exception {
593 if (logger.isDebugEnabled()) {
594 logger.debug(testBanner(testName, CLASS_NAME));
597 setupUpdateNonExistent();
599 // Submit the request to the service and store the response.
601 // Note: The ID used in this 'create' call may be arbitrary.
602 // The only relevant ID may be the one used in updateRole(), below.
603 RoleClient client = new RoleClient();
604 Role role = createRoleInstance("ROLE_XXX",
607 ClientResponse<Role> res =
608 client.update(NON_EXISTENT_ID, role);
609 int statusCode = res.getStatus();
611 // Check the status code of the response: does it match
612 // the expected response(s)?
613 if (logger.isDebugEnabled()) {
614 logger.debug(testName + ": status = " + statusCode);
616 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
617 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
618 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
621 // ---------------------------------------------------------------
622 // CRUD tests : DELETE tests
623 // ---------------------------------------------------------------
626 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
629 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
630 dependsOnMethods = {"updateNotAllowed", "testSubmitRequest"})
631 public void delete(String testName) throws Exception {
633 if (logger.isDebugEnabled()) {
634 logger.debug(testBanner(testName, CLASS_NAME));
639 // Submit the request to the service and store the response.
640 RoleClient client = new RoleClient();
641 ClientResponse<Response> res = client.delete(knownResourceId);
642 int statusCode = res.getStatus();
644 // Check the status code of the response: does it match
645 // the expected response(s)?
646 if (logger.isDebugEnabled()) {
647 logger.debug(testName + ": status = " + statusCode);
649 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
650 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
651 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
656 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
659 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
660 dependsOnMethods = {"delete"})
661 public void deleteNonExistent(String testName) throws Exception {
663 if (logger.isDebugEnabled()) {
664 logger.debug(testBanner(testName, CLASS_NAME));
667 setupDeleteNonExistent();
669 // Submit the request to the service and store the response.
670 RoleClient client = new RoleClient();
671 ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
672 int statusCode = res.getStatus();
674 // Check the status code of the response: does it match
675 // the expected response(s)?
676 if (logger.isDebugEnabled()) {
677 logger.debug(testName + ": status = " + statusCode);
679 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
680 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
681 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
684 // ---------------------------------------------------------------
685 // Utility tests : tests of code used in tests above
686 // ---------------------------------------------------------------
688 * Tests the code for manually submitting data that is used by several
689 * of the methods above.
693 @Test(dependsOnMethods = {"create"})
694 public void testSubmitRequest() throws Exception {
696 // Expected status code: 200 OK
697 final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
699 // Submit the request to the service and store the response.
700 String method = ServiceRequestType.READ.httpMethodName();
701 String url = getResourceURL(knownResourceId);
702 int statusCode = submitRequest(method, url);
704 // Check the status code of the response: does it match
705 // the expected response(s)?
706 if (logger.isDebugEnabled()) {
707 logger.debug("testSubmitRequest: url=" + url
708 + " status=" + statusCode);
710 Assert.assertEquals(statusCode, EXPECTED_STATUS);
714 // ---------------------------------------------------------------
715 // Utility methods used by tests above
716 // ---------------------------------------------------------------
718 * create role instance
724 public Role createRoleInstance(String roleName,
726 boolean useRoleName) {
728 Role role = RoleFactory.createRoleInstance(roleName,
729 roleName, //the display name
732 if (logger.isDebugEnabled()) {
733 logger.debug("to be created, role");
734 logger.debug(objectAsXmlString(role, Role.class));
743 * @param testName the test name
744 * @param list the list
747 private int printList(String testName, RolesList list) {
751 for (Role role : list.getRoles()) {
752 logger.debug(testName + " role csid=" + role.getCsid()
753 + " name=" + role.getRoleName()
754 + " desc=" + role.getDescription());