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 + ": Role with name \"" +
178 knownRoleName + "\" should already exist, so this request should fail.");
179 logger.debug(testName + ": status = " + statusCode);
180 logger.debug(testName + ": " + res);
182 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
183 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
184 Assert.assertEquals(statusCode, Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
188 * Creates the without role name.
190 * @param testName the test name
191 * @throws Exception the exception
193 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
194 dependsOnMethods = {"create"})
195 public void createWithoutRoleName(String testName) throws Exception {
197 if (logger.isDebugEnabled()) {
198 logger.debug(testBanner(testName, CLASS_NAME));
202 // Submit the request to the service and store the response.
203 RoleClient client = new RoleClient();
204 Role role = createRoleInstance("",
207 ClientResponse<Response> res = client.create(role);
208 int statusCode = res.getStatus();
209 // Does it exactly match the expected status code?
210 if (logger.isDebugEnabled()) {
211 logger.debug(testName + ": status = " + statusCode);
213 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
214 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
215 Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
218 //to not cause uniqueness violation for role, createList is removed
220 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
223 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
224 dependsOnMethods = {"create"})
225 public void createList(String testName) throws Exception {
227 if (logger.isDebugEnabled()) {
228 logger.debug(testBanner(testName, CLASS_NAME));
232 // Submit the request to the service and store the response.
233 RoleClient client = new RoleClient();
234 //create a role with lowercase role name without role prefix
235 //the service should make it upper case and add the role prefix
236 Role role1 = createRoleInstance(verifyRoleName,
237 "collection manager",
239 ClientResponse<Response> res = client.create(role1);
240 int statusCode = res.getStatus();
241 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
242 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
243 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
244 verifyResourceId = extractId(res);
245 allResourceIdsCreated.add(verifyResourceId);
247 Role role2 = createRoleInstance("ROLE_COLLECTIONS_CURATOR_TEST",
248 "collections curator",
250 res = client.create(role2);
251 statusCode = res.getStatus();
252 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
253 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
254 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
255 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
256 allResourceIdsCreated.add(extractId(res));
258 Role role3 = createRoleInstance("ROLE_MOVINGIMAGE_ADMIN_TEST",
259 "moving image admin",
261 res = client.create(role3);
262 statusCode = res.getStatus();
263 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
264 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
265 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
266 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
267 allResourceIdsCreated.add(extractId(res));
271 // Placeholders until the three tests below can be uncommented.
272 // See Issue CSPACE-401.
274 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
277 public void createWithEmptyEntityBody(String testName) throws Exception {
278 //FIXME: Should this test really be empty? If so, please comment accordingly.
282 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
285 public void createWithMalformedXml(String testName) throws Exception {
286 //FIXME: Should this test really be empty? If so, please comment accordingly.
290 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
293 public void createWithWrongXmlSchema(String testName) throws Exception {
294 //FIXME: Should this test really be empty? If so, please comment accordingly.
297 // ---------------------------------------------------------------
298 // CRUD tests : READ tests
299 // ---------------------------------------------------------------
302 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
305 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
306 dependsOnMethods = {"createForUniqueRole"})
307 public void read(String testName) throws Exception {
309 if (logger.isDebugEnabled()) {
310 logger.debug(testBanner(testName, CLASS_NAME));
315 // Submit the request to the service and store the response.
316 RoleClient client = new RoleClient();
317 ClientResponse<Role> res = client.read(knownResourceId);
318 int statusCode = res.getStatus();
320 // Check the status code of the response: does it match
321 // the expected response(s)?
322 if (logger.isDebugEnabled()) {
323 logger.debug(testName + ": status = " + statusCode);
325 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
326 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
327 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
329 Role output = (Role) res.getEntity();
330 Assert.assertNotNull(output);
333 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
334 dependsOnMethods = {"createList"})
335 public void readToVerify(String testName) throws Exception {
340 // Submit the request to the service and store the response.
341 RoleClient client = new RoleClient();
342 ClientResponse<Role> res = client.read(verifyResourceId);
343 int statusCode = res.getStatus();
345 // Check the status code of the response: does it match
346 // the expected response(s)?
347 if (logger.isDebugEnabled()) {
348 logger.debug(testName + ": status = " + statusCode);
350 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
351 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
352 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
354 Role output = (Role) res.getEntity();
355 Assert.assertNotNull(output);
357 //FIXME: Tenant ID of "1" should not be hard coded
358 String roleNameToVerify = "ROLE_" +
360 verifyRoleName.toUpperCase();
361 Assert.assertEquals(output.getRoleName(), roleNameToVerify,
362 "RoleName fix did not work!");
366 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
370 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
371 dependsOnMethods = {"read"})
372 public void readNonExistent(String testName) throws Exception {
374 if (logger.isDebugEnabled()) {
375 logger.debug(testBanner(testName, CLASS_NAME));
378 setupReadNonExistent();
380 // Submit the request to the service and store the response.
381 RoleClient client = new RoleClient();
382 ClientResponse<Role> res = client.read(NON_EXISTENT_ID);
383 int statusCode = res.getStatus();
385 // Check the status code of the response: does it match
386 // the expected response(s)?
387 if (logger.isDebugEnabled()) {
388 logger.debug(testName + ": status = " + statusCode);
390 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
391 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
392 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
395 // ---------------------------------------------------------------
396 // CRUD tests : READ_LIST tests
397 // ---------------------------------------------------------------
400 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
403 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
404 dependsOnMethods = {"createList", "read"})
405 public void readList(String testName) throws Exception {
407 if (logger.isDebugEnabled()) {
408 logger.debug(testBanner(testName, CLASS_NAME));
413 // Submit the request to the service and store the response.
414 RoleClient client = new RoleClient();
415 ClientResponse<RolesList> res = client.readList();
416 RolesList list = res.getEntity();
417 int statusCode = res.getStatus();
419 // Check the status code of the response: does it match
420 // the expected response(s)?
421 if (logger.isDebugEnabled()) {
422 logger.debug(testName + ": status = " + statusCode);
424 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
425 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
426 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
428 // Optionally output additional data about list members for debugging.
429 boolean iterateThroughList = true;
430 if (iterateThroughList && logger.isDebugEnabled()) {
431 printList(testName, list);
438 * @param testName the test name
439 * @throws Exception the exception
441 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
442 dependsOnMethods = {"createList", "read"})
443 public void searchRoleName(String testName) throws Exception {
445 if (logger.isDebugEnabled()) {
446 logger.debug(testBanner(testName, CLASS_NAME));
451 // Submit the request to the service and store the response.
452 RoleClient client = new RoleClient();
453 ClientResponse<RolesList> res = client.readSearchList("movingImage");
454 RolesList list = res.getEntity();
455 int statusCode = res.getStatus();
456 // Check the status code of the response: does it match
457 // the expected response(s)?
458 if (logger.isDebugEnabled()) {
459 logger.debug(testName + ": status = " + statusCode);
461 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
462 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
463 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
464 int EXPECTED_ITEMS = 1;
465 if (logger.isDebugEnabled()) {
466 logger.debug(testName + ": received = " + list.getRoles().size()
467 + " expected=" + EXPECTED_ITEMS);
469 Assert.assertEquals(EXPECTED_ITEMS, list.getRoles().size());
470 // Optionally output additional data about list members for debugging.
471 boolean iterateThroughList = true;
472 if (iterateThroughList && logger.isDebugEnabled()) {
473 printList(testName, list);
479 // ---------------------------------------------------------------
480 // CRUD tests : UPDATE tests
481 // ---------------------------------------------------------------
484 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
487 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
488 dependsOnMethods = {"read", "readList", "readNonExistent"})
489 public void update(String testName) throws Exception {
491 if (logger.isDebugEnabled()) {
492 logger.debug(testBanner(testName, CLASS_NAME));
497 Role roleToUpdate = new Role();
498 roleToUpdate.setCsid(knownResourceId);
499 roleToUpdate.setRoleName(knownRoleName);
500 roleToUpdate.setDisplayName(knownRoleName);
502 // Update the content of this resource.
503 roleToUpdate.setDescription("updated role description");
504 if (logger.isDebugEnabled()) {
505 logger.debug("updated object");
506 logger.debug(objectAsXmlString(roleToUpdate,
509 RoleClient client = new RoleClient();
510 // Submit the request to the service and store the response.
511 ClientResponse<Role> res = client.update(knownResourceId, roleToUpdate);
512 int statusCode = res.getStatus();
513 // Check the status code of the response: does it match the expected response(s)?
514 if (logger.isDebugEnabled()) {
515 logger.debug(testName + ": status = " + statusCode);
517 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
518 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
519 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
522 Role roleUpdated = (Role) res.getEntity();
523 Assert.assertNotNull(roleUpdated);
525 Assert.assertEquals(roleUpdated.getDescription(),
526 roleToUpdate.getDescription(),
527 "Data in updated object did not match submitted data.");
530 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
531 dependsOnMethods = {"read", "readList", "readNonExistent"})
532 public void updateNotAllowed(String testName) throws Exception {
537 Role roleToUpdate = new Role();
538 roleToUpdate.setCsid(knownResourceId);
539 // Update the content of this resource.
540 roleToUpdate.setRoleName("UPDATED-ROLE_USERS_TEST");
541 roleToUpdate.setDisplayName("UPDATED-ROLE_USERS_TEST");
542 if (logger.isDebugEnabled()) {
543 logger.debug("updated object");
544 logger.debug(objectAsXmlString(roleToUpdate,
547 RoleClient client = new RoleClient();
548 // Submit the request to the service and store the response.
549 ClientResponse<Role> res = client.update(knownResourceId, roleToUpdate);
550 int statusCode = res.getStatus();
551 // Check the status code of the response: does it match the expected response(s)?
552 if (logger.isDebugEnabled()) {
553 logger.debug(testName + ": status = " + statusCode);
555 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
556 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
557 Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
562 // Placeholders until the three tests below can be uncommented.
563 // See Issue CSPACE-401.
565 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
568 public void updateWithEmptyEntityBody(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#updateWithMalformedXml(java.lang.String)
576 public void updateWithMalformedXml(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#updateWithWrongXmlSchema(java.lang.String)
584 public void updateWithWrongXmlSchema(String testName) throws Exception {
585 //FIXME: Should this test really be empty? If so, please comment accordingly.
589 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
592 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
593 dependsOnMethods = {"readNonExistent", "testSubmitRequest"})
594 public void updateNonExistent(String testName) throws Exception {
596 if (logger.isDebugEnabled()) {
597 logger.debug(testBanner(testName, CLASS_NAME));
600 setupUpdateNonExistent();
602 // Submit the request to the service and store the response.
604 // Note: The ID used in this 'create' call may be arbitrary.
605 // The only relevant ID may be the one used in updateRole(), below.
606 RoleClient client = new RoleClient();
607 Role role = createRoleInstance("ROLE_XXX",
610 ClientResponse<Role> res =
611 client.update(NON_EXISTENT_ID, role);
612 int statusCode = res.getStatus();
614 // Check the status code of the response: does it match
615 // the expected response(s)?
616 if (logger.isDebugEnabled()) {
617 logger.debug(testName + ": status = " + statusCode);
619 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
620 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
621 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
624 // ---------------------------------------------------------------
625 // CRUD tests : DELETE tests
626 // ---------------------------------------------------------------
629 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
632 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
633 dependsOnMethods = {"updateNotAllowed", "testSubmitRequest"})
634 public void delete(String testName) throws Exception {
636 if (logger.isDebugEnabled()) {
637 logger.debug(testBanner(testName, CLASS_NAME));
642 // Submit the request to the service and store the response.
643 RoleClient client = new RoleClient();
644 ClientResponse<Response> res = client.delete(knownResourceId);
645 int statusCode = res.getStatus();
647 // Check the status code of the response: does it match
648 // the expected response(s)?
649 if (logger.isDebugEnabled()) {
650 logger.debug(testName + ": status = " + statusCode);
652 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
653 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
654 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
659 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
662 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
663 dependsOnMethods = {"delete"})
664 public void deleteNonExistent(String testName) throws Exception {
666 if (logger.isDebugEnabled()) {
667 logger.debug(testBanner(testName, CLASS_NAME));
670 setupDeleteNonExistent();
672 // Submit the request to the service and store the response.
673 RoleClient client = new RoleClient();
674 ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
675 int statusCode = res.getStatus();
677 // Check the status code of the response: does it match
678 // the expected response(s)?
679 if (logger.isDebugEnabled()) {
680 logger.debug(testName + ": status = " + statusCode);
682 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
683 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
684 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
687 // ---------------------------------------------------------------
688 // Utility tests : tests of code used in tests above
689 // ---------------------------------------------------------------
691 * Tests the code for manually submitting data that is used by several
692 * of the methods above.
696 @Test(dependsOnMethods = {"create"})
697 public void testSubmitRequest() throws Exception {
699 // Expected status code: 200 OK
700 final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
702 // Submit the request to the service and store the response.
703 String method = ServiceRequestType.READ.httpMethodName();
704 String url = getResourceURL(knownResourceId);
705 int statusCode = submitRequest(method, url);
707 // Check the status code of the response: does it match
708 // the expected response(s)?
709 if (logger.isDebugEnabled()) {
710 logger.debug("testSubmitRequest: url=" + url
711 + " status=" + statusCode);
713 Assert.assertEquals(statusCode, EXPECTED_STATUS);
717 // ---------------------------------------------------------------
718 // Utility methods used by tests above
719 // ---------------------------------------------------------------
721 * create role instance
727 public Role createRoleInstance(String roleName,
729 boolean useRoleName) {
731 Role role = RoleFactory.createRoleInstance(roleName,
732 roleName, //the display name
735 if (logger.isDebugEnabled()) {
736 logger.debug("to be created, role");
737 logger.debug(objectAsXmlString(role, Role.class));
746 * @param testName the test name
747 * @param list the list
750 private int printList(String testName, RolesList list) {
754 for (Role role : list.getRoles()) {
755 logger.debug(testName + " role csid=" + role.getCsid()
756 + " name=" + role.getRoleName()
757 + " desc=" + role.getDescription());