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