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 public String getServiceName() {
68 return RoleClient.SERVICE_NAME;
72 protected String getServicePathComponent() {
73 return new RoleClient().getServicePathComponent();
77 * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
80 protected CollectionSpaceClient getClientInstance() {
81 return new RoleClient();
85 * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
88 protected AbstractCommonList getAbstractCommonList(
89 ClientResponse<AbstractCommonList> response) {
90 //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
91 throw new UnsupportedOperationException();
95 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readPaginatedList(java.lang.String)
97 @Test(dataProvider = "testName")
99 public void readPaginatedList(String testName) throws Exception {
100 //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
103 // ---------------------------------------------------------------
104 // CRUD tests : CREATE tests
105 // ---------------------------------------------------------------
108 * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
111 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
112 public void create(String testName) throws Exception {
114 if (logger.isDebugEnabled()) {
115 logger.debug(testBanner(testName, CLASS_NAME));
117 // Perform setup, such as initializing the type of service request
118 // (e.g. CREATE, DELETE), its valid and expected status codes, and
119 // its associated HTTP method name (e.g. POST, DELETE).
122 // Submit the request to the service and store the response.
123 RoleClient client = new RoleClient();
124 Role role = createRoleInstance(knownRoleName,
125 "all users are required to be in this role",
127 ClientResponse<Response> res = client.create(role);
128 int statusCode = res.getStatus();
130 // Check the status code of the response: does it match
131 // the expected response(s)?
134 // Does it fall within the set of valid status codes?
135 // Does it exactly match the expected status code?
136 if (logger.isDebugEnabled()) {
137 logger.debug(testName + ": status = " + statusCode);
139 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
140 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
141 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
143 // Store the ID returned from this create operation
144 // for additional tests below.
145 knownResourceId = extractId(res);
146 if (logger.isDebugEnabled()) {
147 logger.debug(testName + ": knownResourceId=" + knownResourceId);
152 * Creates the for unique role.
154 * @param testName the test name
155 * @throws Exception the exception
157 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
158 dependsOnMethods = {"create"})
159 public void createForUniqueRole(String testName) throws Exception {
161 if (logger.isDebugEnabled()) {
162 logger.debug(testBanner(testName, CLASS_NAME));
166 // Submit the request to the service and store the response.
167 RoleClient client = new RoleClient();
168 Role role = createRoleInstance(knownRoleName,
171 ClientResponse<Response> res = client.create(role);
172 int statusCode = res.getStatus();
174 if (logger.isDebugEnabled()) {
175 logger.debug(testName + ": Role with name \"" +
176 knownRoleName + "\" should already exist, so this request should fail.");
177 logger.debug(testName + ": status = " + statusCode);
178 logger.debug(testName + ": " + res);
180 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
181 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
182 Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.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("",
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 = {"createForUniqueRole"})
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 //FIXME: Tenant ID of "1" should not be hard coded
356 String roleNameToVerify = "ROLE_" +
358 verifyRoleName.toUpperCase();
359 Assert.assertEquals(output.getRoleName(), roleNameToVerify,
360 "RoleName fix did not work!");
364 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
368 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
369 dependsOnMethods = {"read"})
370 public void readNonExistent(String testName) throws Exception {
372 if (logger.isDebugEnabled()) {
373 logger.debug(testBanner(testName, CLASS_NAME));
376 setupReadNonExistent();
378 // Submit the request to the service and store the response.
379 RoleClient client = new RoleClient();
380 ClientResponse<Role> res = client.read(NON_EXISTENT_ID);
381 int statusCode = res.getStatus();
383 // Check the status code of the response: does it match
384 // the expected response(s)?
385 if (logger.isDebugEnabled()) {
386 logger.debug(testName + ": status = " + statusCode);
388 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
389 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
390 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
393 // ---------------------------------------------------------------
394 // CRUD tests : READ_LIST tests
395 // ---------------------------------------------------------------
398 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
401 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
402 dependsOnMethods = {"createList", "read"})
403 public void readList(String testName) throws Exception {
405 if (logger.isDebugEnabled()) {
406 logger.debug(testBanner(testName, CLASS_NAME));
411 // Submit the request to the service and store the response.
412 RoleClient client = new RoleClient();
413 ClientResponse<RolesList> res = client.readList();
414 RolesList list = res.getEntity();
415 int statusCode = res.getStatus();
417 // Check the status code of the response: does it match
418 // the expected response(s)?
419 if (logger.isDebugEnabled()) {
420 logger.debug(testName + ": status = " + statusCode);
422 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
423 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
424 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
426 // Optionally output additional data about list members for debugging.
427 boolean iterateThroughList = true;
428 if (iterateThroughList && logger.isDebugEnabled()) {
429 printList(testName, list);
436 * @param testName the test name
437 * @throws Exception the exception
439 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
440 dependsOnMethods = {"createList", "read"})
441 public void searchRoleName(String testName) throws Exception {
443 if (logger.isDebugEnabled()) {
444 logger.debug(testBanner(testName, CLASS_NAME));
449 // Submit the request to the service and store the response.
450 RoleClient client = new RoleClient();
451 ClientResponse<RolesList> res = client.readSearchList("movingImage");
452 RolesList list = res.getEntity();
453 int statusCode = res.getStatus();
454 // Check the status code of the response: does it match
455 // the expected response(s)?
456 if (logger.isDebugEnabled()) {
457 logger.debug(testName + ": status = " + statusCode);
459 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
460 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
461 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
462 int EXPECTED_ITEMS = 1;
463 if (logger.isDebugEnabled()) {
464 logger.debug(testName + ": received = " + list.getRoles().size()
465 + " expected=" + EXPECTED_ITEMS);
467 Assert.assertEquals(EXPECTED_ITEMS, list.getRoles().size());
468 // Optionally output additional data about list members for debugging.
469 boolean iterateThroughList = true;
470 if (iterateThroughList && logger.isDebugEnabled()) {
471 printList(testName, list);
477 // ---------------------------------------------------------------
478 // CRUD tests : UPDATE tests
479 // ---------------------------------------------------------------
482 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
485 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
486 dependsOnMethods = {"read", "readList", "readNonExistent"})
487 public void update(String testName) throws Exception {
489 if (logger.isDebugEnabled()) {
490 logger.debug(testBanner(testName, CLASS_NAME));
495 Role roleToUpdate = new Role();
496 roleToUpdate.setCsid(knownResourceId);
497 roleToUpdate.setRoleName(knownRoleName);
498 roleToUpdate.setDisplayName(knownRoleName);
500 // Update the content of this resource.
501 roleToUpdate.setDescription("updated role description");
502 if (logger.isDebugEnabled()) {
503 logger.debug("updated object");
504 logger.debug(objectAsXmlString(roleToUpdate,
507 RoleClient client = new RoleClient();
508 // Submit the request to the service and store the response.
509 ClientResponse<Role> res = client.update(knownResourceId, roleToUpdate);
510 int statusCode = res.getStatus();
511 // Check the status code of the response: does it match the expected response(s)?
512 if (logger.isDebugEnabled()) {
513 logger.debug(testName + ": status = " + statusCode);
515 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
516 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
517 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
520 Role roleUpdated = (Role) res.getEntity();
521 Assert.assertNotNull(roleUpdated);
523 Assert.assertEquals(roleUpdated.getDescription(),
524 roleToUpdate.getDescription(),
525 "Data in updated object did not match submitted data.");
528 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
529 dependsOnMethods = {"read", "readList", "readNonExistent"})
530 public void updateNotAllowed(String testName) throws Exception {
535 Role roleToUpdate = new Role();
536 roleToUpdate.setCsid(knownResourceId);
537 // Update the content of this resource.
538 roleToUpdate.setRoleName("UPDATED-ROLE_USERS_TEST");
539 roleToUpdate.setDisplayName("UPDATED-ROLE_USERS_TEST");
540 if (logger.isDebugEnabled()) {
541 logger.debug("updated object");
542 logger.debug(objectAsXmlString(roleToUpdate,
545 RoleClient client = new RoleClient();
546 // Submit the request to the service and store the response.
547 ClientResponse<Role> res = client.update(knownResourceId, roleToUpdate);
548 int statusCode = res.getStatus();
549 // Check the status code of the response: does it match the expected response(s)?
550 if (logger.isDebugEnabled()) {
551 logger.debug(testName + ": status = " + statusCode);
553 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
554 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
555 Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
560 // Placeholders until the three tests below can be uncommented.
561 // See Issue CSPACE-401.
563 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
566 public void updateWithEmptyEntityBody(String testName) throws Exception {
567 //FIXME: Should this test really be empty? If so, please comment accordingly.
571 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
574 public void updateWithMalformedXml(String testName) throws Exception {
575 //FIXME: Should this test really be empty? If so, please comment accordingly.
579 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
582 public void updateWithWrongXmlSchema(String testName) throws Exception {
583 //FIXME: Should this test really be empty? If so, please comment accordingly.
587 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
590 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
591 dependsOnMethods = {"readNonExistent", "testSubmitRequest"})
592 public void updateNonExistent(String testName) throws Exception {
594 if (logger.isDebugEnabled()) {
595 logger.debug(testBanner(testName, CLASS_NAME));
598 setupUpdateNonExistent();
600 // Submit the request to the service and store the response.
602 // Note: The ID used in this 'create' call may be arbitrary.
603 // The only relevant ID may be the one used in updateRole(), below.
604 RoleClient client = new RoleClient();
605 Role role = createRoleInstance("ROLE_XXX",
608 ClientResponse<Role> res =
609 client.update(NON_EXISTENT_ID, role);
610 int statusCode = res.getStatus();
612 // Check the status code of the response: does it match
613 // the expected response(s)?
614 if (logger.isDebugEnabled()) {
615 logger.debug(testName + ": status = " + statusCode);
617 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
618 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
619 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
622 // ---------------------------------------------------------------
623 // CRUD tests : DELETE tests
624 // ---------------------------------------------------------------
627 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
630 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
631 dependsOnMethods = {"updateNotAllowed", "testSubmitRequest"})
632 public void delete(String testName) throws Exception {
634 if (logger.isDebugEnabled()) {
635 logger.debug(testBanner(testName, CLASS_NAME));
640 // Submit the request to the service and store the response.
641 RoleClient client = new RoleClient();
642 ClientResponse<Response> res = client.delete(knownResourceId);
643 int statusCode = res.getStatus();
645 // Check the status code of the response: does it match
646 // the expected response(s)?
647 if (logger.isDebugEnabled()) {
648 logger.debug(testName + ": status = " + statusCode);
650 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
651 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
652 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
657 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
660 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
661 dependsOnMethods = {"delete"})
662 public void deleteNonExistent(String testName) throws Exception {
664 if (logger.isDebugEnabled()) {
665 logger.debug(testBanner(testName, CLASS_NAME));
668 setupDeleteNonExistent();
670 // Submit the request to the service and store the response.
671 RoleClient client = new RoleClient();
672 ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
673 int statusCode = res.getStatus();
675 // Check the status code of the response: does it match
676 // the expected response(s)?
677 if (logger.isDebugEnabled()) {
678 logger.debug(testName + ": status = " + statusCode);
680 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
681 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
682 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
685 // ---------------------------------------------------------------
686 // Utility tests : tests of code used in tests above
687 // ---------------------------------------------------------------
689 * Tests the code for manually submitting data that is used by several
690 * of the methods above.
694 @Test(dependsOnMethods = {"create"})
695 public void testSubmitRequest() throws Exception {
697 // Expected status code: 200 OK
698 final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
700 // Submit the request to the service and store the response.
701 String method = ServiceRequestType.READ.httpMethodName();
702 String url = getResourceURL(knownResourceId);
703 int statusCode = submitRequest(method, url);
705 // Check the status code of the response: does it match
706 // the expected response(s)?
707 if (logger.isDebugEnabled()) {
708 logger.debug("testSubmitRequest: url=" + url
709 + " status=" + statusCode);
711 Assert.assertEquals(statusCode, EXPECTED_STATUS);
715 // ---------------------------------------------------------------
716 // Utility methods used by tests above
717 // ---------------------------------------------------------------
719 * create role instance
725 public Role createRoleInstance(String roleName,
727 boolean useRoleName) {
729 Role role = RoleFactory.createRoleInstance(roleName,
730 roleName, //the display name
733 if (logger.isDebugEnabled()) {
734 logger.debug("to be created, role");
735 logger.debug(objectAsXmlString(role, Role.class));
744 * @param testName the test name
745 * @param list the list
748 private int printList(String testName, RolesList list) {
752 for (Role role : list.getRoles()) {
753 logger.debug(testName + " role csid=" + role.getCsid()
754 + " name=" + role.getRoleName()
755 + " desc=" + role.getDescription());