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