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