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:
6 * http://www.collectionspace.org
7 * http://wiki.collectionspace.org
9 * Copyright © 2009 Regents of the University of California
11 * Licensed under the Educational Community License (ECL), Version 2.0.
12 * You may not use this file except in compliance with this License.
14 * You may obtain a copy of the ECL 2.0 License at
15 * https://source.collectionspace.org/collection-space/LICENSE.txt
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.
23 package org.collectionspace.services.client.test;
25 //import java.util.ArrayList;
26 import java.util.List;
27 import javax.ws.rs.core.MediaType;
28 import javax.ws.rs.core.Response;
30 import org.collectionspace.services.client.CollectionSpaceClient;
31 import org.collectionspace.services.client.LoaninClient;
32 import org.collectionspace.services.jaxb.AbstractCommonList;
33 import org.collectionspace.services.loanin.LoansinCommon;
34 import org.collectionspace.services.loanin.LoansinCommonList;
35 import org.collectionspace.services.loanin.LenderList;
37 import org.jboss.resteasy.client.ClientResponse;
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;
45 import org.slf4j.Logger;
46 import org.slf4j.LoggerFactory;
49 * LoaninServiceTest, carries out tests against a
50 * deployed and running Loanin (aka Loans In) Service.
52 * $LastChangedRevision$
55 public class LoaninServiceTest extends AbstractServiceTestImpl {
58 private final Logger logger =
59 LoggerFactory.getLogger(LoaninServiceTest.class);
61 // Instance variables specific to this test.
62 /** The SERVIC e_ pat h_ component. */
63 final String SERVICE_PATH_COMPONENT = "loansin";
65 /** The known resource id. */
66 private String knownResourceId = null;
69 * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
72 protected CollectionSpaceClient getClientInstance() {
73 return new LoaninClient();
77 * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
80 protected AbstractCommonList getAbstractCommonList(
81 ClientResponse<AbstractCommonList> response) {
82 return response.getEntity(LoansinCommonList.class);
85 // ---------------------------------------------------------------
86 // CRUD tests : CREATE tests
87 // ---------------------------------------------------------------
90 * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
93 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
94 public void create(String testName) throws Exception {
96 // Perform setup, such as initializing the type of service request
97 // (e.g. CREATE, DELETE), its valid and expected status codes, and
98 // its associated HTTP method name (e.g. POST, DELETE).
99 setupCreate(testName);
101 // Submit the request to the service and store the response.
102 LoaninClient client = new LoaninClient();
103 String identifier = createIdentifier();
104 MultipartOutput multipart = createLoaninInstance(identifier);
106 ClientResponse<Response> res = client.create(multipart);
108 int statusCode = res.getStatus();
110 // Check the status code of the response: does it match
111 // the expected response(s)?
114 // Does it fall within the set of valid status codes?
115 // Does it exactly match the expected status code?
116 if(logger.isDebugEnabled()){
117 logger.debug(testName + ": status = " + statusCode);
119 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
120 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
121 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
123 newID = extractId(res);
125 res.releaseConnection();
128 // Store the ID returned from the first resource created
129 // for additional tests below.
130 if (knownResourceId == null){
131 knownResourceId = newID;
132 if (logger.isDebugEnabled()) {
133 logger.debug(testName + ": knownResourceId=" + knownResourceId);
137 // Store the IDs from every resource created by tests,
138 // so they can be deleted after tests have been run.
139 allResourceIdsCreated.add(newID);
143 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
146 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
147 dependsOnMethods = {"create"})
148 public void createList(String testName) throws Exception {
149 for(int i = 0; i < 3; i++){
155 // Placeholders until the three tests below can be uncommented.
156 // See Issue CSPACE-401.
158 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
161 public void createWithEmptyEntityBody(String testName) throws Exception {
162 //Should this really be empty?
166 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
169 public void createWithMalformedXml(String testName) throws Exception {
170 //Should this really be empty?
174 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
177 public void createWithWrongXmlSchema(String testName) throws Exception {
178 //Should this really be empty?
183 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
184 dependsOnMethods = {"create", "testSubmitRequest"})
185 public void createWithEmptyEntityBody(String testName) throws Exception {
188 setupCreateWithEmptyEntityBody(testName);
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);
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);
203 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
204 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
205 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
209 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
210 dependsOnMethods = {"create", "testSubmitRequest"})
211 public void createWithMalformedXml(String testName) throws Exception {
214 setupCreateWithMalformedXml(testName);
216 // Submit the request to the service and store the response.
217 String method = REQUEST_TYPE.httpMethodName();
218 String url = getServiceRootURL();
219 String mediaType = MediaType.APPLICATION_XML;
220 final String entity = MALFORMED_XML_DATA; // Constant from base class.
221 int statusCode = submitRequest(method, url, mediaType, entity);
223 // Check the status code of the response: does it match
224 // the expected response(s)?
225 if(logger.isDebugEnabled()){
226 logger.debug(testName + ": url=" + url +
227 " status=" + statusCode);
229 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
230 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
231 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
235 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
236 dependsOnMethods = {"create", "testSubmitRequest"})
237 public void createWithWrongXmlSchema(String testName) throws Exception {
240 setupCreateWithWrongXmlSchema(testName);
242 // Submit the request to the service and store the response.
243 String method = REQUEST_TYPE.httpMethodName();
244 String url = getServiceRootURL();
245 String mediaType = MediaType.APPLICATION_XML;
246 final String entity = WRONG_XML_SCHEMA_DATA;
247 int statusCode = submitRequest(method, url, mediaType, entity);
249 // Check the status code of the response: does it match
250 // the expected response(s)?
251 if(logger.isDebugEnabled()){
252 logger.debug(testName + ": url=" + url +
253 " status=" + statusCode);
255 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
256 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
257 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
261 // ---------------------------------------------------------------
262 // CRUD tests : READ tests
263 // ---------------------------------------------------------------
266 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
269 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
270 dependsOnMethods = {"create"})
271 public void read(String testName) throws Exception {
275 // Submit the request to the service and store the response.
276 MultipartInput input = null;
277 LoaninClient client = new LoaninClient();
278 ClientResponse<MultipartInput> res = client.read(knownResourceId);
280 int statusCode = res.getStatus();
282 // Check the status code of the response: does it match
283 // the expected response(s)?
284 if(logger.isDebugEnabled()){
285 logger.debug(testName + ": status = " + statusCode);
287 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
288 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
289 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
291 input = res.getEntity();
293 res.releaseConnection();
296 LoansinCommon loanin = (LoansinCommon) extractPart(input,
297 client.getCommonPartName(), LoansinCommon.class);
298 Assert.assertNotNull(loanin);
303 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
306 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
307 dependsOnMethods = {"read"})
308 public void readNonExistent(String testName) throws Exception {
311 setupReadNonExistent(testName);
313 // Submit the request to the service and store the response.
314 LoaninClient client = new LoaninClient();
315 ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
317 int statusCode = res.getStatus();
319 // Check the status code of the response: does it match
320 // the expected response(s)?
321 if(logger.isDebugEnabled()){
322 logger.debug(testName + ": status = " + statusCode);
324 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
325 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
326 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
328 res.releaseConnection();
332 // ---------------------------------------------------------------
333 // CRUD tests : READ_LIST tests
334 // ---------------------------------------------------------------
337 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
340 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
341 dependsOnMethods = {"createList", "read"})
342 public void readList(String testName) throws Exception {
344 setupReadList(testName);
346 // Submit the request to the service and store the response.
347 LoansinCommonList list = null;
348 LoaninClient client = new LoaninClient();
349 ClientResponse<LoansinCommonList> res = client.readList();
351 int statusCode = res.getStatus();
353 // Check the status code of the response: does it match
354 // the expected response(s)?
355 if(logger.isDebugEnabled()){
356 logger.debug(testName + ": status = " + statusCode);
358 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
359 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
360 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
362 list = res.getEntity();
364 res.releaseConnection();
367 // Optionally output additional data about list members for debugging.
368 boolean iterateThroughList = false;
369 if (iterateThroughList && logger.isDebugEnabled()){
370 List<LoansinCommonList.LoaninListItem> items =
371 list.getLoaninListItem();
373 for(LoansinCommonList.LoaninListItem item : items){
374 logger.debug(testName + ": list-item[" + i + "] csid=" +
376 logger.debug(testName + ": list-item[" + i + "] loanInNumber=" +
377 item.getLoanInNumber());
378 logger.debug(testName + ": list-item[" + i + "] URI=" +
387 // ---------------------------------------------------------------
388 // CRUD tests : UPDATE tests
389 // ---------------------------------------------------------------
392 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
395 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
396 dependsOnMethods = {"read"})
397 public void update(String testName) throws Exception {
400 setupUpdate(testName);
402 // Retrieve the contents of a resource to update.
403 MultipartInput input = null;
404 LoaninClient client = new LoaninClient();
405 ClientResponse<MultipartInput> res =
406 client.read(knownResourceId);
408 if(logger.isDebugEnabled()){
409 logger.debug(testName + ": read status = " + res.getStatus());
411 Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
413 if(logger.isDebugEnabled()){
414 logger.debug("got object to update with ID: " + knownResourceId);
416 input = res.getEntity();
418 res.releaseConnection();
421 LoansinCommon loanin = (LoansinCommon) extractPart(input,
422 client.getCommonPartName(), LoansinCommon.class);
423 Assert.assertNotNull(loanin);
425 // Update the content of this resource.
426 loanin.setLoanInNumber("updated-" + loanin.getLoanInNumber());
427 loanin.setLoanReturnDate("updated-" + loanin.getLoanReturnDate());
428 if(logger.isDebugEnabled()){
429 logger.debug("to be updated object");
430 logger.debug(objectAsXmlString(loanin, LoansinCommon.class));
432 // Submit the request to the service and store the response.
433 MultipartOutput output = new MultipartOutput();
434 OutputPart commonPart = output.addPart(loanin, MediaType.APPLICATION_XML_TYPE);
435 commonPart.getHeaders().add("label", client.getCommonPartName());
437 res = client.update(knownResourceId, output);
439 int statusCode = res.getStatus();
440 // Check the status code of the response: does it match the expected response(s)?
441 if(logger.isDebugEnabled()){
442 logger.debug(testName + ": status = " + statusCode);
444 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
445 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
446 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
449 input = (MultipartInput) res.getEntity();
451 res.releaseConnection();
454 LoansinCommon updatedLoanin =
455 (LoansinCommon) extractPart(input,
456 client.getCommonPartName(), LoansinCommon.class);
457 Assert.assertNotNull(updatedLoanin);
459 Assert.assertEquals(updatedLoanin.getLoanReturnDate(),
460 loanin.getLoanReturnDate(),
461 "Data in updated object did not match submitted data.");
465 // Placeholders until the three tests below can be uncommented.
466 // See Issue CSPACE-401.
468 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
471 public void updateWithEmptyEntityBody(String testName) throws Exception {
472 //Should this really be empty?
476 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
479 public void updateWithMalformedXml(String testName) throws Exception {
480 //Should this really be empty?
484 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
487 public void updateWithWrongXmlSchema(String testName) throws Exception {
488 //Should this really be empty?
493 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
494 dependsOnMethods = {"create", "update", "testSubmitRequest"})
495 public void updateWithEmptyEntityBody(String testName) throws Exception {
498 setupUpdateWithEmptyEntityBody(testName);
500 // Submit the request to the service and store the response.
501 String method = REQUEST_TYPE.httpMethodName();
502 String url = getResourceURL(knownResourceId);
503 String mediaType = MediaType.APPLICATION_XML;
504 final String entity = "";
505 int statusCode = submitRequest(method, url, mediaType, entity);
507 // Check the status code of the response: does it match
508 // the expected response(s)?
509 if(logger.isDebugEnabled()){
510 logger.debug(testName + ": url=" + url +
511 " status=" + statusCode);
513 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
514 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
515 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
519 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
520 dependsOnMethods = {"create", "update", "testSubmitRequest"})
521 public void updateWithMalformedXml(String testName) throws Exception {
524 setupUpdateWithMalformedXml(testName);
526 // Submit the request to the service and store the response.
527 String method = REQUEST_TYPE.httpMethodName();
528 String url = getResourceURL(knownResourceId);
529 String mediaType = MediaType.APPLICATION_XML;
530 final String entity = MALFORMED_XML_DATA;
531 int statusCode = submitRequest(method, url, mediaType, entity);
533 // Check the status code of the response: does it match
534 // the expected response(s)?
535 if(logger.isDebugEnabled()){
536 logger.debug(testName + ": url=" + url +
537 " status=" + statusCode);
539 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
540 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
541 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
545 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
546 dependsOnMethods = {"create", "update", "testSubmitRequest"})
547 public void updateWithWrongXmlSchema(String testName) throws Exception {
550 setupUpdateWithWrongXmlSchema(testName);
552 // Submit the request to the service and store the response.
553 String method = REQUEST_TYPE.httpMethodName();
554 String url = getResourceURL(knownResourceId);
555 String mediaType = MediaType.APPLICATION_XML;
556 final String entity = WRONG_XML_SCHEMA_DATA;
557 int statusCode = submitRequest(method, url, mediaType, entity);
559 // Check the status code of the response: does it match
560 // the expected response(s)?
561 if(logger.isDebugEnabled()){
562 logger.debug(testName + ": url=" + url +
563 " status=" + statusCode);
565 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
566 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
567 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
572 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
575 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
576 dependsOnMethods = {"update", "testSubmitRequest"})
577 public void updateNonExistent(String testName) throws Exception {
580 setupUpdateNonExistent(testName);
582 // Submit the request to the service and store the response.
583 // Note: The ID used in this 'create' call may be arbitrary.
584 // The only relevant ID may be the one used in update(), below.
585 LoaninClient client = new LoaninClient();
586 MultipartOutput multipart = createLoaninInstance(NON_EXISTENT_ID);
587 ClientResponse<MultipartInput> res =
588 client.update(NON_EXISTENT_ID, multipart);
590 int statusCode = res.getStatus();
592 // Check the status code of the response: does it match
593 // the expected response(s)?
594 if(logger.isDebugEnabled()){
595 logger.debug(testName + ": status = " + statusCode);
597 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
598 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
599 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
601 res.releaseConnection();
605 // ---------------------------------------------------------------
606 // CRUD tests : DELETE tests
607 // ---------------------------------------------------------------
610 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
613 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
614 dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
615 public void delete(String testName) throws Exception {
618 setupDelete(testName);
620 // Submit the request to the service and store the response.
621 LoaninClient client = new LoaninClient();
622 ClientResponse<Response> res = client.delete(knownResourceId);
624 int statusCode = res.getStatus();
626 // Check the status code of the response: does it match
627 // the expected response(s)?
628 if(logger.isDebugEnabled()){
629 logger.debug(testName + ": status = " + statusCode);
631 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
632 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
633 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
635 res.releaseConnection();
641 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
644 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
645 dependsOnMethods = {"delete"})
646 public void deleteNonExistent(String testName) throws Exception {
648 setupDeleteNonExistent(testName);
650 // Submit the request to the service and store the response.
651 LoaninClient client = new LoaninClient();
652 ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
654 int statusCode = res.getStatus();
656 // Check the status code of the response: does it match
657 // the expected response(s)?
658 if(logger.isDebugEnabled()){
659 logger.debug(testName + ": status = " + statusCode);
661 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
662 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
663 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
665 res.releaseConnection();
669 // ---------------------------------------------------------------
670 // Utility tests : tests of code used in tests above
671 // ---------------------------------------------------------------
673 * Tests the code for manually submitting data that is used by several
674 * of the methods above.
676 @Test(dependsOnMethods = {"create", "read"})
677 public void testSubmitRequest() {
679 // Expected status code: 200 OK
680 final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
682 // Submit the request to the service and store the response.
683 String method = ServiceRequestType.READ.httpMethodName();
684 String url = getResourceURL(knownResourceId);
685 int statusCode = submitRequest(method, url);
687 // Check the status code of the response: does it match
688 // the expected response(s)?
689 if(logger.isDebugEnabled()){
690 logger.debug("testSubmitRequest: url=" + url +
691 " status=" + statusCode);
693 Assert.assertEquals(statusCode, EXPECTED_STATUS);
697 // ---------------------------------------------------------------
698 // Utility methods used by tests above
699 // ---------------------------------------------------------------
701 * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
704 public String getServicePathComponent() {
705 return SERVICE_PATH_COMPONENT;
709 * Creates the loanin instance.
711 * @param identifier the identifier
712 * @return the multipart output
714 private MultipartOutput createLoaninInstance(String identifier) {
715 return createLoaninInstance(
716 "loaninNumber-" + identifier,
717 "returnDate-" + identifier);
721 * Creates the loanin instance.
723 * @param loaninNumber the loanin number
724 * @param returnDate the return date
725 * @return the multipart output
727 private MultipartOutput createLoaninInstance(String loaninNumber,
729 LoansinCommon loanin = new LoansinCommon();
730 loanin.setLoanInNumber(loaninNumber);
731 loanin.setLoanReturnDate(returnDate);
732 LenderList lenderList = new LenderList();
733 lenderList.getLender().add(
734 "urn:cspace:org.collectionspace.demo:personauthority:name(TestPersonAuth):person:name(Harry Lender)'Harry Lender'");
735 lenderList.getLender().add(
736 "urn:cspace:org.collectionspace.demo:personauthority:name(TestPersonAuth):person:name(Sally Lender)'Sally Lender'");
737 loanin.setLenders(lenderList);
738 loanin.setLoanPurpose("For Surfboards of the 1960s exhibition.");
739 MultipartOutput multipart = new MultipartOutput();
740 OutputPart commonPart =
741 multipart.addPart(loanin, MediaType.APPLICATION_XML_TYPE);
742 commonPart.getHeaders().add("label", new LoaninClient().getCommonPartName());
744 if(logger.isDebugEnabled()){
745 logger.debug("to be created, loanin common");
746 logger.debug(objectAsXmlString(loanin, LoansinCommon.class));