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