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.client.test;
25 import java.util.List;
26 import javax.ws.rs.core.MediaType;
27 import javax.ws.rs.core.Response;
29 import org.collectionspace.services.client.CollectionSpaceClient;
30 import org.collectionspace.services.client.ContactClient;
31 import org.collectionspace.services.client.ContactClientUtils;
32 import org.collectionspace.services.client.PayloadOutputPart;
33 import org.collectionspace.services.client.PoxPayloadIn;
34 import org.collectionspace.services.client.PoxPayloadOut;
35 import org.collectionspace.services.common.AbstractCommonListUtils;
36 import org.collectionspace.services.contact.AddressGroup;
37 import org.collectionspace.services.contact.AddressGroupList;
38 import org.collectionspace.services.contact.ContactsCommon;
39 import org.collectionspace.services.contact.EmailGroup;
40 import org.collectionspace.services.contact.EmailGroupList;
41 import org.collectionspace.services.jaxb.AbstractCommonList;
43 import org.jboss.resteasy.client.ClientResponse;
45 import org.testng.Assert;
46 import org.testng.annotations.Test;
48 import org.slf4j.Logger;
49 import org.slf4j.LoggerFactory;
52 * ContactServiceTest, carries out tests against a
53 * deployed and running Contact Service.
55 * $LastChangedRevision: 917 $
56 * $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri, 06 Nov 2009) $
58 public class ContactServiceTest extends AbstractServiceTestImpl {
60 private final String CLASS_NAME = ContactServiceTest.class.getName();
61 private final Logger logger = LoggerFactory.getLogger(ContactServiceTest.class);
62 // Instance variables specific to this test.
63 // final String SERVICE_PATH_COMPONENT = "contacts";
64 private String knownResourceId = null;
67 public String getServicePathComponent() {
68 return ContactClient.SERVICE_PATH_COMPONENT;
72 protected String getServiceName() {
73 return ContactClient.SERVICE_NAME;
77 * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
80 protected CollectionSpaceClient getClientInstance() {
81 return new ContactClient();
85 * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
88 protected AbstractCommonList getAbstractCommonList(
89 ClientResponse<AbstractCommonList> response) {
90 return response.getEntity(AbstractCommonList.class);
94 // protected PoxPayloadOut createInstance(String identifier) {
95 // ContactClient client = new ContactClient();
96 // PoxPayloadOut multipart =
97 // ContactClientUtils.createContactInstance(identifier, client.getCommonPartName());
100 // ---------------------------------------------------------------
101 // CRUD tests : CREATE tests
102 // ---------------------------------------------------------------
105 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
106 public void create(String testName) throws Exception {
108 if (logger.isDebugEnabled()) {
109 logger.debug(testBanner(testName, CLASS_NAME));
111 // Perform setup, such as initializing the type of service request
112 // (e.g. CREATE, DELETE), its valid and expected status codes, and
113 // its associated HTTP method name (e.g. POST, DELETE).
116 // Submit the request to the service and store the response.
117 ContactClient client = new ContactClient();
118 String identifier = createIdentifier();
119 PoxPayloadOut multipart =
120 ContactClientUtils.createContactInstance(identifier, client.getCommonPartName());
121 ClientResponse<Response> res = client.create(multipart);
123 int statusCode = res.getStatus();
125 // Check the status code of the response: does it match
126 // the expected response(s)?
129 // Does it fall within the set of valid status codes?
130 // Does it exactly match the expected status code?
131 if (logger.isDebugEnabled()) {
132 logger.debug(testName + ": status = " + statusCode);
134 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
135 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
136 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
138 // Store the ID returned from the first resource created
139 // for additional tests below.
140 if (knownResourceId == null) {
141 knownResourceId = extractId(res);
142 if (logger.isDebugEnabled()) {
143 logger.debug(testName + ": knownResourceId=" + knownResourceId);
147 // Store the IDs from every resource created by tests,
148 // so they can be deleted after tests have been run.
149 allResourceIdsCreated.add(extractId(res));
153 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
154 dependsOnMethods = {"create"})
155 public void createList(String testName) throws Exception {
156 for (int i = 0; i < 3; i++) {
162 // Placeholders until the three tests below can be uncommented.
163 // See Issue CSPACE-401.
165 public void createWithEmptyEntityBody(String testName) throws Exception {
166 //Should this really be empty?
170 public void createWithMalformedXml(String testName) throws Exception {
171 //Should this really be empty??
175 public void createWithWrongXmlSchema(String testName) throws Exception {
176 //Should this really be empty??
181 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
182 dependsOnMethods = {"create", "testSubmitRequest"})
183 public void createWithEmptyEntityBody(String testName) throws Exception {
185 if (logger.isDebugEnabled()) {
186 logger.debug(testBanner(testName, CLASS_NAME));
189 setupCreateWithEmptyEntityBody(testName, logger);
191 // Submit the request to the service and store the response.
192 String method = REQUEST_TYPE.httpMethodName();
193 String url = getServiceRootURL();
194 String mediaType = MediaType.APPLICATION_XML;
195 final String entity = "";
196 int statusCode = submitRequest(method, url, mediaType, entity);
198 // Check the status code of the response: does it match
199 // the expected response(s)?
200 if(logger.isDebugEnabled()){
201 logger.debug("createWithEmptyEntityBody url=" + url +
202 " status=" + statusCode);
204 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
205 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
206 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
210 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
211 dependsOnMethods = {"create", "testSubmitRequest"})
212 public void createWithMalformedXml(String testName) throws Exception {
214 if (logger.isDebugEnabled()) {
215 logger.debug(testBanner(testName, CLASS_NAME));
218 setupCreateWithMalformedXml();
220 // Submit the request to the service and store the response.
221 String method = REQUEST_TYPE.httpMethodName();
222 String url = getServiceRootURL();
223 String mediaType = MediaType.APPLICATION_XML;
224 final String entity = MALFORMED_XML_DATA; // Constant from base class.
225 int statusCode = submitRequest(method, url, mediaType, entity);
227 // Check the status code of the response: does it match
228 // the expected response(s)?
229 if(logger.isDebugEnabled()){
230 logger.debug(testName + ": url=" + url +
231 " status=" + statusCode);
233 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
234 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
235 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
239 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
240 dependsOnMethods = {"create", "testSubmitRequest"})
241 public void createWithWrongXmlSchema(String testName) throws Exception {
243 if (logger.isDebugEnabled()) {
244 logger.debug(testBanner(testName, CLASS_NAME));
247 setupCreateWithWrongXmlSchema(testName, logger);
249 // Submit the request to the service and store the response.
250 String method = REQUEST_TYPE.httpMethodName();
251 String url = getServiceRootURL();
252 String mediaType = MediaType.APPLICATION_XML;
253 final String entity = WRONG_XML_SCHEMA_DATA;
254 int statusCode = submitRequest(method, url, mediaType, entity);
256 // Check the status code of the response: does it match
257 // the expected response(s)?
258 if(logger.isDebugEnabled()){
259 logger.debug(testName + ": url=" + url +
260 " status=" + statusCode);
262 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
263 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
264 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
267 // ---------------------------------------------------------------
268 // CRUD tests : READ tests
269 // ---------------------------------------------------------------
272 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
273 dependsOnMethods = {"create"})
274 public void read(String testName) throws Exception {
276 if (logger.isDebugEnabled()) {
277 logger.debug(testBanner(testName, CLASS_NAME));
282 // Submit the request to the service and store the response.
283 ContactClient client = new ContactClient();
284 ClientResponse<String> res = client.read(knownResourceId);
285 int statusCode = res.getStatus();
287 // Check the status code of the response: does it match
288 // the expected response(s)?
289 if (logger.isDebugEnabled()) {
290 logger.debug(testName + ": status = " + statusCode);
292 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
293 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
294 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
296 PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
297 ContactsCommon contact = (ContactsCommon) extractPart(input,
298 client.getCommonPartName(), ContactsCommon.class);
299 Assert.assertNotNull(contact);
304 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
305 dependsOnMethods = {"read"})
306 public void readNonExistent(String testName) throws Exception {
308 if (logger.isDebugEnabled()) {
309 logger.debug(testBanner(testName, CLASS_NAME));
312 setupReadNonExistent();
314 // Submit the request to the service and store the response.
315 ContactClient client = new ContactClient();
316 ClientResponse<String> res = client.read(NON_EXISTENT_ID);
317 int statusCode = res.getStatus();
319 // Check the status code of the response: does it match
320 // the expected response(s)?
321 if (logger.isDebugEnabled()) {
322 logger.debug(testName + ": status = " + statusCode);
324 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
325 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
326 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
329 // ---------------------------------------------------------------
330 // CRUD tests : READ_LIST tests
331 // ---------------------------------------------------------------
334 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
335 dependsOnMethods = {"read"})
336 public void readList(String testName) throws Exception {
338 if (logger.isDebugEnabled()) {
339 logger.debug(testBanner(testName, CLASS_NAME));
344 // Submit the request to the service and store the response.
345 ContactClient client = new ContactClient();
346 ClientResponse<AbstractCommonList> res = client.readList();
347 AbstractCommonList list = res.getEntity();
348 int statusCode = res.getStatus();
350 // Check the status code of the response: does it match
351 // the expected response(s)?
352 if (logger.isDebugEnabled()) {
353 logger.debug(testName + ": status = " + statusCode);
355 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
356 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
357 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
359 // Optionally output additional data about list members for debugging.
360 boolean iterateThroughList = false;
361 if (iterateThroughList && logger.isDebugEnabled()) {
362 AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
369 // ---------------------------------------------------------------
370 // CRUD tests : UPDATE tests
371 // ---------------------------------------------------------------
374 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
375 dependsOnMethods = {"read"})
376 public void update(String testName) throws Exception {
378 if (logger.isDebugEnabled()) {
379 logger.debug(testBanner(testName, CLASS_NAME));
384 // Submit the request to the service and store the response.
385 ContactClient client = new ContactClient();
386 ClientResponse<String> res = client.read(knownResourceId);
387 if (logger.isDebugEnabled()) {
388 logger.debug(testName + ": read status = " + res.getStatus());
390 Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
392 if (logger.isDebugEnabled()) {
393 logger.debug("got object to update with ID: " + knownResourceId);
395 PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
396 ContactsCommon contact = (ContactsCommon) extractPart(input,
397 client.getCommonPartName(), ContactsCommon.class);
398 Assert.assertNotNull(contact);
400 if(logger.isDebugEnabled()){
401 logger.debug("contact common before updating");
402 logger.debug(BaseServiceTest.objectAsXmlString(contact, ContactsCommon.class));
405 // Verify the contents of this resource
406 EmailGroupList emailGroupList = contact.getEmailGroupList();
407 Assert.assertNotNull(emailGroupList);
408 List<EmailGroup> emailGroups = emailGroupList.getEmailGroup();
409 Assert.assertNotNull(emailGroups);
410 Assert.assertTrue(emailGroups.size() > 0);
411 String email = emailGroups.get(0).getEmail();
412 Assert.assertNotNull(email);
414 AddressGroupList addressGroupList = contact.getAddressGroupList();
415 Assert.assertNotNull(addressGroupList);
416 List<AddressGroup> addressGroups = addressGroupList.getAddressGroup();
417 Assert.assertNotNull(addressGroups);
418 Assert.assertTrue(addressGroups.size() > 0);
419 String addressType = addressGroups.get(0).getAddressType();
420 String addressPlace1 = addressGroups.get(0).getAddressPlace1();
421 Assert.assertNotNull(addressType);
422 Assert.assertNotNull(addressPlace1);
424 // Update the contents of this resource.
425 emailGroups.get(0).setEmail("updated-" + email);
426 contact.setEmailGroupList(emailGroupList);
428 addressGroups.get(0).setAddressType("updated-" + addressType);
429 addressGroups.get(0).setAddressPlace1("updated-" + addressPlace1);
430 contact.setAddressGroupList(addressGroupList);
432 if (logger.isDebugEnabled()) {
433 logger.debug("to be updated object");
434 logger.debug(BaseServiceTest.objectAsXmlString(contact, ContactsCommon.class));
437 // Submit the request to the service and store the response.
438 PoxPayloadOut output = new PoxPayloadOut(ContactClient.SERVICE_PAYLOAD_NAME);
439 PayloadOutputPart commonPart = output.addPart(contact, MediaType.APPLICATION_XML_TYPE);
440 commonPart.setLabel(client.getCommonPartName());
442 res = client.update(knownResourceId, output);
443 int statusCode = res.getStatus();
444 // Check the status code of the response: does it match the expected response(s)?
445 if (logger.isDebugEnabled()) {
446 logger.debug(testName + ": status = " + statusCode);
448 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
449 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
450 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
452 input = new PoxPayloadIn(res.getEntity());
453 ContactsCommon updatedContact =
454 (ContactsCommon) extractPart(input,
455 client.getCommonPartName(), ContactsCommon.class);
456 Assert.assertNotNull(updatedContact);
458 if (logger.isDebugEnabled()) {
459 logger.debug("object after update");
460 logger.debug(objectAsXmlString(updatedContact, ContactsCommon.class));
463 Assert.assertNotNull(updatedContact.getEmailGroupList().getEmailGroup().get(0));
464 Assert.assertEquals(updatedContact.getEmailGroupList().getEmailGroup().get(0).getEmail(),
465 contact.getEmailGroupList().getEmailGroup().get(0).getEmail(),
466 "Data in updated object did not match submitted data.");
471 // Placeholders until the three tests below can be uncommented.
472 // See Issue CSPACE-401.
474 public void updateWithEmptyEntityBody(String testName) throws Exception {
475 //Should this really be empty??
479 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
482 public void updateWithMalformedXml(String testName) throws Exception {
483 //Should this really be empty??
487 public void updateWithWrongXmlSchema(String testName) throws Exception {
488 //Should this really be empty??
493 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
494 dependsOnMethods = {"create", "update", "testSubmitRequest"})
495 public void updateWithEmptyEntityBody(String testName) throws Exception {
497 if (logger.isDebugEnabled()) {
498 logger.debug(testBanner(testName, CLASS_NAME));
501 setupUpdateWithEmptyEntityBody();
503 // Submit the request to the service and store the response.
504 String method = REQUEST_TYPE.httpMethodName();
505 String url = getResourceURL(knownResourceId);
506 String mediaType = MediaType.APPLICATION_XML;
507 final String entity = "";
508 int statusCode = submitRequest(method, url, mediaType, entity);
510 // Check the status code of the response: does it match
511 // the expected response(s)?
512 if(logger.isDebugEnabled()){
513 logger.debug(testName + ": url=" + url +
514 " status=" + statusCode);
516 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
517 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
518 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
522 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
523 dependsOnMethods = {"create", "update", "testSubmitRequest"})
524 public void updateWithMalformedXml(String testName) throws Exception {
526 if (logger.isDebugEnabled()) {
527 logger.debug(testBanner(testName, CLASS_NAME));
530 setupUpdateWithMalformedXml();
532 // Submit the request to the service and store the response.
533 String method = REQUEST_TYPE.httpMethodName();
534 String url = getResourceURL(knownResourceId);
535 String mediaType = MediaType.APPLICATION_XML;
536 final String entity = MALFORMED_XML_DATA;
537 int statusCode = submitRequest(method, url, mediaType, entity);
539 // Check the status code of the response: does it match
540 // the expected response(s)?
541 if(logger.isDebugEnabled()){
542 logger.debug(testName + ": url=" + url +
543 " status=" + statusCode);
545 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
546 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
547 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
551 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
552 dependsOnMethods = {"create", "update", "testSubmitRequest"})
553 public void updateWithWrongXmlSchema(String testName) throws Exception {
555 if (logger.isDebugEnabled()) {
556 logger.debug(testBanner(testName, CLASS_NAME));
559 setupUpdateWithWrongXmlSchema(testName, logger);
561 // Submit the request to the service and store the response.
562 String method = REQUEST_TYPE.httpMethodName();
563 String url = getResourceURL(knownResourceId);
564 String mediaType = MediaType.APPLICATION_XML;
565 final String entity = WRONG_XML_SCHEMA_DATA;
566 int statusCode = submitRequest(method, url, mediaType, entity);
568 // Check the status code of the response: does it match
569 // the expected response(s)?
570 if(logger.isDebugEnabled()){
571 logger.debug(testName + ": url=" + url +
572 " status=" + statusCode);
574 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
575 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
576 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
580 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
581 dependsOnMethods = {"update", "testSubmitRequest"})
582 public void updateNonExistent(String testName) throws Exception {
584 if (logger.isDebugEnabled()) {
585 logger.debug(testBanner(testName, CLASS_NAME));
588 setupUpdateNonExistent();
590 // Submit the request to the service and store the response.
591 // Note: The ID used in this 'create' call may be arbitrary.
592 // The only relevant ID may be the one used in update(), below.
593 ContactClient client = new ContactClient();
594 PoxPayloadOut multipart =
595 ContactClientUtils.createContactInstance(NON_EXISTENT_ID, client.getCommonPartName());
596 ClientResponse<String> res =
597 client.update(NON_EXISTENT_ID, multipart);
598 int statusCode = res.getStatus();
600 // Check the status code of the response: does it match
601 // the expected response(s)?
602 if (logger.isDebugEnabled()) {
603 logger.debug(testName + ": status = " + statusCode);
605 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
606 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
607 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
610 // ---------------------------------------------------------------
611 // CRUD tests : DELETE tests
612 // ---------------------------------------------------------------
615 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
616 dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
617 public void delete(String testName) throws Exception {
619 if (logger.isDebugEnabled()) {
620 logger.debug(testBanner(testName, CLASS_NAME));
625 // Submit the request to the service and store the response.
626 ContactClient client = new ContactClient();
627 ClientResponse<Response> res = client.delete(knownResourceId);
628 int statusCode = res.getStatus();
630 // Check the status code of the response: does it match
631 // the expected response(s)?
632 if (logger.isDebugEnabled()) {
633 logger.debug(testName + ": status = " + statusCode);
635 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
636 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
637 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
642 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
643 dependsOnMethods = {"delete"})
644 public void deleteNonExistent(String testName) throws Exception {
646 if (logger.isDebugEnabled()) {
647 logger.debug(testBanner(testName, CLASS_NAME));
650 setupDeleteNonExistent();
652 // Submit the request to the service and store the response.
653 ContactClient client = new ContactClient();
654 ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
655 int statusCode = res.getStatus();
657 // Check the status code of the response: does it match
658 // the expected response(s)?
659 if (logger.isDebugEnabled()) {
660 logger.debug(testName + ": status = " + statusCode);
662 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
663 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
664 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
667 // ---------------------------------------------------------------
668 // Utility tests : tests of code used in tests above
669 // ---------------------------------------------------------------
671 * Tests the code for manually submitting data that is used by several
672 * of the methods above.
674 @Test(dependsOnMethods = {"create", "read"})
675 public void testSubmitRequest() {
677 // Expected status code: 200 OK
678 final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
680 // Submit the request to the service and store the response.
681 String method = ServiceRequestType.READ.httpMethodName();
682 String url = getResourceURL(knownResourceId);
683 int statusCode = submitRequest(method, url);
685 // Check the status code of the response: does it match
686 // the expected response(s)?
687 if (logger.isDebugEnabled()) {
688 logger.debug("testSubmitRequest: url=" + url
689 + " status=" + statusCode);
691 Assert.assertEquals(statusCode, EXPECTED_STATUS);