]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
b70255bc50ef83dc9436274376d6ce078925c004
[tmp/jakarta-migration.git] /
1 /**
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:
5  *
6  * http://www.collectionspace.org
7  * http://wiki.collectionspace.org
8  *
9  * Copyright © 2009 Regents of the University of California
10  *
11  * Licensed under the Educational Community License (ECL), Version 2.0.
12  * You may not use this file except in compliance with this License.
13  *
14  * You may obtain a copy of the ECL 2.0 License at
15  * https://source.collectionspace.org/collection-space/LICENSE.txt
16  *
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.
22  */
23 package org.collectionspace.services.client.test;
24
25 import java.util.List;
26 import javax.ws.rs.core.MediaType;
27 import javax.ws.rs.core.Response;
28
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.contact.ContactsCommon;
36 import org.collectionspace.services.contact.ContactsCommonList;
37 import org.collectionspace.services.jaxb.AbstractCommonList;
38
39 import org.jboss.resteasy.client.ClientResponse;
40 //import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
41
42 import org.testng.Assert;
43 import org.testng.annotations.AfterClass;
44 import org.testng.annotations.Test;
45
46 import org.slf4j.Logger;
47 import org.slf4j.LoggerFactory;
48
49 /**
50  * ContactServiceTest, carries out tests against a
51  * deployed and running Contact Service.
52  *
53  * $LastChangedRevision: 917 $
54  * $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri, 06 Nov 2009) $
55  */
56 public class ContactServiceTest extends AbstractServiceTestImpl {
57     private final String CLASS_NAME = ContactServiceTest.class.getName();
58     private final Logger logger = LoggerFactory.getLogger(ContactServiceTest.class);
59
60     // Instance variables specific to this test.
61 //    final String SERVICE_PATH_COMPONENT = "contacts";
62     
63     private String knownResourceId = null;
64
65         @Override
66         public String getServicePathComponent() {
67                 return ContactClient.SERVICE_PATH_COMPONENT;
68         }
69
70         @Override
71         protected String getServiceName() {
72                 return ContactClient.SERVICE_NAME;
73         }
74     
75     /* (non-Javadoc)
76      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
77      */
78     @Override
79     protected CollectionSpaceClient getClientInstance() {
80         return new ContactClient();
81     }
82     
83     /* (non-Javadoc)
84      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
85      */
86     @Override
87         protected AbstractCommonList getAbstractCommonList(
88                         ClientResponse<AbstractCommonList> response) {
89         return response.getEntity(ContactsCommonList.class);
90     }
91
92     // ---------------------------------------------------------------
93     // CRUD tests : CREATE tests
94     // ---------------------------------------------------------------
95     // Success outcomes
96     @Override
97     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
98     public void create(String testName) throws Exception {
99
100         if (logger.isDebugEnabled()) {
101             logger.debug(testBanner(testName, CLASS_NAME));
102         }
103         // Perform setup, such as initializing the type of service request
104         // (e.g. CREATE, DELETE), its valid and expected status codes, and
105         // its associated HTTP method name (e.g. POST, DELETE).
106         setupCreate();
107
108         // Submit the request to the service and store the response.
109         ContactClient client = new ContactClient();
110         String identifier = createIdentifier();
111         PoxPayloadOut multipart =
112             ContactClientUtils.createContactInstance(identifier, client.getCommonPartName());
113         ClientResponse<Response> res = client.create(multipart);
114
115         int statusCode = res.getStatus();
116
117         // Check the status code of the response: does it match
118         // the expected response(s)?
119         //
120         // Specifically:
121         // Does it fall within the set of valid status codes?
122         // Does it exactly match the expected status code?
123         if(logger.isDebugEnabled()){
124             logger.debug(testName + ": status = " + statusCode);
125         }
126         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
127                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
128         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
129
130         // Store the ID returned from the first resource created
131         // for additional tests below.
132         if (knownResourceId == null){
133             knownResourceId = extractId(res);
134             if (logger.isDebugEnabled()) {
135                 logger.debug(testName + ": knownResourceId=" + knownResourceId);
136             }
137         }
138
139         // Store the IDs from every resource created by tests,
140         // so they can be deleted after tests have been run.
141         allResourceIdsCreated.add(extractId(res));
142     }
143
144     @Override
145     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
146         dependsOnMethods = {"create"})
147     public void createList(String testName) throws Exception {
148         for(int i = 0; i < 3; i++){
149             create(testName);
150         }
151     }
152
153     // Failure outcomes
154     // Placeholders until the three tests below can be uncommented.
155     // See Issue CSPACE-401.
156     @Override
157     public void createWithEmptyEntityBody(String testName) throws Exception {
158         //Should this really be empty?
159     }
160
161     @Override
162     public void createWithMalformedXml(String testName) throws Exception {
163         //Should this really be empty??
164     }
165
166     @Override
167     public void createWithWrongXmlSchema(String testName) throws Exception {
168         //Should this really be empty??
169     }
170
171     /*
172     @Override
173     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
174         dependsOnMethods = {"create", "testSubmitRequest"})
175     public void createWithEmptyEntityBody(String testName) throws Exception {
176
177         if (logger.isDebugEnabled()) {
178             logger.debug(testBanner(testName, CLASS_NAME));
179         }
180         // Perform setup.
181         setupCreateWithEmptyEntityBody(testName, logger);
182
183         // Submit the request to the service and store the response.
184         String method = REQUEST_TYPE.httpMethodName();
185         String url = getServiceRootURL();
186         String mediaType = MediaType.APPLICATION_XML;
187         final String entity = "";
188         int statusCode = submitRequest(method, url, mediaType, entity);
189
190         // Check the status code of the response: does it match
191         // the expected response(s)?
192         if(logger.isDebugEnabled()){
193             logger.debug("createWithEmptyEntityBody url=" + url +
194                 " status=" + statusCode);
195          }
196         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
197         invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
198         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
199     }
200
201     @Override
202     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
203         dependsOnMethods = {"create", "testSubmitRequest"})
204     public void createWithMalformedXml(String testName) throws Exception {
205
206         if (logger.isDebugEnabled()) {
207             logger.debug(testBanner(testName, CLASS_NAME));
208         }
209         // Perform setup.
210         setupCreateWithMalformedXml();
211
212         // Submit the request to the service and store the response.
213         String method = REQUEST_TYPE.httpMethodName();
214         String url = getServiceRootURL();
215         String mediaType = MediaType.APPLICATION_XML;
216         final String entity = MALFORMED_XML_DATA; // Constant from base class.
217         int statusCode = submitRequest(method, url, mediaType, entity);
218
219         // Check the status code of the response: does it match
220         // the expected response(s)?
221         if(logger.isDebugEnabled()){
222             logger.debug(testName + ": url=" + url +
223                 " status=" + statusCode);
224          }
225         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
226         invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
227         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
228     }
229
230     @Override
231     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
232         dependsOnMethods = {"create", "testSubmitRequest"})
233     public void createWithWrongXmlSchema(String testName) throws Exception {
234
235         if (logger.isDebugEnabled()) {
236             logger.debug(testBanner(testName, CLASS_NAME));
237         }
238         // Perform setup.
239         setupCreateWithWrongXmlSchema(testName, logger);
240
241         // Submit the request to the service and store the response.
242         String method = REQUEST_TYPE.httpMethodName();
243         String url = getServiceRootURL();
244         String mediaType = MediaType.APPLICATION_XML;
245         final String entity = WRONG_XML_SCHEMA_DATA;
246         int statusCode = submitRequest(method, url, mediaType, entity);
247
248         // Check the status code of the response: does it match
249         // the expected response(s)?
250         if(logger.isDebugEnabled()){
251             logger.debug(testName + ": url=" + url +
252                 " status=" + statusCode);
253          }
254         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
255         invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
256         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
257     }
258      */
259
260     // ---------------------------------------------------------------
261     // CRUD tests : READ tests
262     // ---------------------------------------------------------------
263     // Success outcomes
264     @Override
265     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
266         dependsOnMethods = {"create"})
267     public void read(String testName) throws Exception {
268
269         if (logger.isDebugEnabled()) {
270             logger.debug(testBanner(testName, CLASS_NAME));
271         }
272         // Perform setup.
273         setupRead();
274
275         // Submit the request to the service and store the response.
276         ContactClient client = new ContactClient();
277         ClientResponse<String> res = client.read(knownResourceId);
278         int statusCode = res.getStatus();
279
280         // Check the status code of the response: does it match
281         // the expected response(s)?
282         if(logger.isDebugEnabled()){
283             logger.debug(testName + ": status = " + statusCode);
284         }
285         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
286                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
287         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
288
289         PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
290         ContactsCommon contact = (ContactsCommon) extractPart(input,
291                 client.getCommonPartName(), ContactsCommon.class);
292         Assert.assertNotNull(contact);
293     }
294
295     // Failure outcomes
296     @Override
297     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
298         dependsOnMethods = {"read"})
299     public void readNonExistent(String testName) throws Exception {
300
301         if (logger.isDebugEnabled()) {
302             logger.debug(testBanner(testName, CLASS_NAME));
303         }
304         // Perform setup.
305         setupReadNonExistent();
306
307         // Submit the request to the service and store the response.
308         ContactClient client = new ContactClient();
309         ClientResponse<String> res = client.read(NON_EXISTENT_ID);
310         int statusCode = res.getStatus();
311
312         // Check the status code of the response: does it match
313         // the expected response(s)?
314         if(logger.isDebugEnabled()){
315             logger.debug(testName + ": status = " + statusCode);
316         }
317         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
318                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
319         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
320     }
321
322     // ---------------------------------------------------------------
323     // CRUD tests : READ_LIST tests
324     // ---------------------------------------------------------------
325     // Success outcomes
326     @Override
327     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
328         dependsOnMethods = {"read"})
329     public void readList(String testName) throws Exception {
330
331         if (logger.isDebugEnabled()) {
332             logger.debug(testBanner(testName, CLASS_NAME));
333         }
334         // Perform setup.
335         setupReadList();
336
337         // Submit the request to the service and store the response.
338         ContactClient client = new ContactClient();
339         ClientResponse<ContactsCommonList> res = client.readList();
340         ContactsCommonList list = res.getEntity();
341         int statusCode = res.getStatus();
342
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);
347         }
348         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
349                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
350         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
351
352         // Optionally output additional data about list members for debugging.
353         boolean iterateThroughList = false;
354         if(iterateThroughList && logger.isDebugEnabled()){
355             List<ContactsCommonList.ContactListItem> items =
356                     list.getContactListItem();
357             int i = 0;
358             for(ContactsCommonList.ContactListItem item : items){
359                 logger.debug(testName + ": list-item[" + i + "] csid=" +
360                         item.getCsid());
361                 logger.debug(testName + ": list-item[" + i + "] objectNumber=" +
362                         item.getAddressPlace());
363                 logger.debug(testName + ": list-item[" + i + "] URI=" +
364                         item.getUri());
365                 i++;
366             }
367         }
368
369     }
370
371     // Failure outcomes
372     // None at present.
373     // ---------------------------------------------------------------
374     // CRUD tests : UPDATE tests
375     // ---------------------------------------------------------------
376     // Success outcomes
377     @Override
378     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
379         dependsOnMethods = {"read"})
380     public void update(String testName) throws Exception {
381
382         if (logger.isDebugEnabled()) {
383             logger.debug(testBanner(testName, CLASS_NAME));
384         }
385         // Perform setup.
386         setupUpdate();
387
388         // Submit the request to the service and store the response.
389         ContactClient client = new ContactClient();
390         ClientResponse<String> res = client.read(knownResourceId);
391         if(logger.isDebugEnabled()){
392             logger.debug(testName + ": read status = " + res.getStatus());
393         }
394         Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
395
396         if(logger.isDebugEnabled()){
397             logger.debug("got object to update with ID: " + knownResourceId);
398         }
399         PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
400         ContactsCommon contact = (ContactsCommon) extractPart(input,
401                 client.getCommonPartName(), ContactsCommon.class);
402         Assert.assertNotNull(contact);
403
404         // Update the content of this resource.
405         contact.setAddressType("updated-" + contact.getAddressType());
406         contact.setAddressPlace("updated-" + contact.getAddressPlace());
407         contact.setEmail("updated-" + contact.getEmail());
408         if(logger.isDebugEnabled()){
409             logger.debug("to be updated object");
410             logger.debug(objectAsXmlString(contact, ContactsCommon.class));
411         }
412         // Submit the request to the service and store the response.
413         PoxPayloadOut output = new PoxPayloadOut(ContactClient.SERVICE_PAYLOAD_NAME);
414         PayloadOutputPart commonPart = output.addPart(contact, MediaType.APPLICATION_XML_TYPE);
415         commonPart.setLabel(client.getCommonPartName());
416
417         res = client.update(knownResourceId, output);
418         int statusCode = res.getStatus();
419         // Check the status code of the response: does it match the expected response(s)?
420         if(logger.isDebugEnabled()){
421             logger.debug(testName + ": status = " + statusCode);
422         }
423         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
424                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
425         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
426
427
428         input = new PoxPayloadIn(res.getEntity());
429         ContactsCommon updatedContact =
430                 (ContactsCommon) extractPart(input,
431                         client.getCommonPartName(), ContactsCommon.class);
432         Assert.assertNotNull(updatedContact);
433
434         Assert.assertEquals(updatedContact.getEmail(),
435                 contact.getEmail(),
436                 "Data in updated object did not match submitted data.");
437
438     }
439
440     // Failure outcomes
441     // Placeholders until the three tests below can be uncommented.
442     // See Issue CSPACE-401.
443     @Override
444     public void updateWithEmptyEntityBody(String testName) throws Exception {
445         //Should this really be empty??
446     }
447     
448     /* (non-Javadoc)
449      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
450      */
451     @Override
452     public void updateWithMalformedXml(String testName) throws Exception {
453         //Should this really be empty??
454     }
455
456     @Override
457     public void updateWithWrongXmlSchema(String testName) throws Exception {
458         //Should this really be empty??
459     }
460
461     /*
462     @Override
463     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
464         dependsOnMethods = {"create", "update", "testSubmitRequest"})
465     public void updateWithEmptyEntityBody(String testName) throws Exception {
466
467             if (logger.isDebugEnabled()) {
468                 logger.debug(testBanner(testName, CLASS_NAME));
469             }
470         // Perform setup.
471         setupUpdateWithEmptyEntityBody();
472
473         // Submit the request to the service and store the response.
474         String method = REQUEST_TYPE.httpMethodName();
475         String url = getResourceURL(knownResourceId);
476         String mediaType = MediaType.APPLICATION_XML;
477         final String entity = "";
478         int statusCode = submitRequest(method, url, mediaType, entity);
479
480         // Check the status code of the response: does it match
481         // the expected response(s)?
482         if(logger.isDebugEnabled()){
483             logger.debug(testName + ": url=" + url +
484                 " status=" + statusCode);
485          }
486         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
487         invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
488         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
489     }
490
491     @Override
492     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
493         dependsOnMethods = {"create", "update", "testSubmitRequest"})
494     public void updateWithMalformedXml(String testName) throws Exception {
495
496         if (logger.isDebugEnabled()) {
497             logger.debug(testBanner(testName, CLASS_NAME));
498         }
499         // Perform setup.
500         setupUpdateWithMalformedXml();
501
502         // Submit the request to the service and store the response.
503         String method = REQUEST_TYPE.httpMethodName();
504         String url = getResourceURL(knownResourceId);
505         String mediaType = MediaType.APPLICATION_XML;
506         final String entity = MALFORMED_XML_DATA;
507         int statusCode = submitRequest(method, url, mediaType, entity);
508
509         // Check the status code of the response: does it match
510         // the expected response(s)?
511         if(logger.isDebugEnabled()){
512             logger.debug(testName + ": url=" + url +
513              " status=" + statusCode);
514          }
515         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
516         invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
517         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
518     }
519
520     @Override
521     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
522         dependsOnMethods = {"create", "update", "testSubmitRequest"})
523     public void updateWithWrongXmlSchema(String testName) throws Exception {
524
525         if (logger.isDebugEnabled()) {
526             logger.debug(testBanner(testName, CLASS_NAME));
527         }
528         // Perform setup.
529         setupUpdateWithWrongXmlSchema(testName, logger);
530
531         // Submit the request to the service and store the response.
532         String method = REQUEST_TYPE.httpMethodName();
533         String url = getResourceURL(knownResourceId);
534         String mediaType = MediaType.APPLICATION_XML;
535         final String entity = WRONG_XML_SCHEMA_DATA;
536         int statusCode = submitRequest(method, url, mediaType, entity);
537
538         // Check the status code of the response: does it match
539         // the expected response(s)?
540         if(logger.isDebugEnabled()){
541             logger.debug(testName + ": url=" + url +
542             " status=" + statusCode);
543          }
544         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
545         invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
546         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
547     }
548      */
549
550     @Override
551     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
552         dependsOnMethods = {"update", "testSubmitRequest"})
553     public void updateNonExistent(String testName) throws Exception {
554
555         if (logger.isDebugEnabled()) {
556             logger.debug(testBanner(testName, CLASS_NAME));
557         }
558         // Perform setup.
559         setupUpdateNonExistent();
560
561         // Submit the request to the service and store the response.
562         // Note: The ID used in this 'create' call may be arbitrary.
563         // The only relevant ID may be the one used in update(), below.
564         ContactClient client = new ContactClient();
565         PoxPayloadOut multipart =
566                 ContactClientUtils.createContactInstance(NON_EXISTENT_ID, client.getCommonPartName());
567         ClientResponse<String> res =
568                 client.update(NON_EXISTENT_ID, multipart);
569         int statusCode = res.getStatus();
570
571         // Check the status code of the response: does it match
572         // the expected response(s)?
573         if(logger.isDebugEnabled()){
574             logger.debug(testName + ": status = " + statusCode);
575         }
576         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
577                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
578         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
579     }
580
581     // ---------------------------------------------------------------
582     // CRUD tests : DELETE tests
583     // ---------------------------------------------------------------
584     // Success outcomes
585     @Override
586     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
587         dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
588     public void delete(String testName) throws Exception {
589
590         if (logger.isDebugEnabled()) {
591             logger.debug(testBanner(testName, CLASS_NAME));
592         }
593         // Perform setup.
594         setupDelete();
595
596         // Submit the request to the service and store the response.
597         ContactClient client = new ContactClient();
598         ClientResponse<Response> res = client.delete(knownResourceId);
599         int statusCode = res.getStatus();
600
601         // Check the status code of the response: does it match
602         // the expected response(s)?
603         if(logger.isDebugEnabled()){
604             logger.debug(testName + ": status = " + statusCode);
605         }
606         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
607                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
608         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
609     }
610
611     // Failure outcomes
612     @Override
613     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
614         dependsOnMethods = {"delete"})
615     public void deleteNonExistent(String testName) throws Exception {
616
617         if (logger.isDebugEnabled()) {
618             logger.debug(testBanner(testName, CLASS_NAME));
619         }
620         // Perform setup.
621         setupDeleteNonExistent();
622
623         // Submit the request to the service and store the response.
624         ContactClient client = new ContactClient();
625         ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
626         int statusCode = res.getStatus();
627
628         // Check the status code of the response: does it match
629         // the expected response(s)?
630         if(logger.isDebugEnabled()){
631             logger.debug(testName + ": status = " + statusCode);
632         }
633         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
634                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
635         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
636     }
637
638     // ---------------------------------------------------------------
639     // Utility tests : tests of code used in tests above
640     // ---------------------------------------------------------------
641     /**
642      * Tests the code for manually submitting data that is used by several
643      * of the methods above.
644      */
645     @Test(dependsOnMethods = {"create", "read"})
646     public void testSubmitRequest() {
647
648         // Expected status code: 200 OK
649         final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
650
651         // Submit the request to the service and store the response.
652         String method = ServiceRequestType.READ.httpMethodName();
653         String url = getResourceURL(knownResourceId);
654         int statusCode = submitRequest(method, url);
655
656         // Check the status code of the response: does it match
657         // the expected response(s)?
658         if(logger.isDebugEnabled()){
659             logger.debug("testSubmitRequest: url=" + url +
660                 " status=" + statusCode);
661         }
662         Assert.assertEquals(statusCode, EXPECTED_STATUS);
663
664     }
665 }