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