]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
0a13b8a4ac9440067a2ff676c91fe42198c6ec9c
[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.List;
26
27 import javax.ws.rs.core.MediaType;
28 import javax.ws.rs.core.Response;
29
30 import org.dom4j.Element;
31 import org.collectionspace.services.client.CollectionSpaceClient;
32 import org.collectionspace.services.client.IntakeClient;
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.api.GregorianCalendarDateTimeUtils;
38 import org.collectionspace.services.intake.EntryMethodList;
39 import org.collectionspace.services.intake.FieldCollectionEventNameList;
40 import org.collectionspace.services.intake.CurrentLocationGroup;
41 import org.collectionspace.services.intake.CurrentLocationGroupList;
42 import org.collectionspace.services.intake.IntakesCommon;
43 import org.collectionspace.services.jaxb.AbstractCommonList;
44
45 import org.testng.Assert;
46 import org.testng.annotations.Test;
47 import org.slf4j.Logger;
48 import org.slf4j.LoggerFactory;
49
50 // FIXME: http://issues.collectionspace.org/browse/CSPACE-1685
51 /**
52  * IntakeServiceTest, carries out tests against a
53  * deployed and running Intake Service.
54  *
55  * $LastChangedRevision$
56  * $LastChangedDate$
57  */
58 public class IntakeServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonList, IntakesCommon> {
59
60     /** The logger. */
61     private final String CLASS_NAME = IntakeServiceTest.class.getName();
62     private final Logger logger = LoggerFactory.getLogger(IntakeServiceTest.class);
63     private final static String CURRENT_DATE_UTC =
64             GregorianCalendarDateTimeUtils.currentDateUTC();
65
66     @Override
67     protected CollectionSpaceClient getClientInstance() {
68         return new IntakeClient();
69     }
70
71         @Override
72         protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
73         return new IntakeClient(clientPropertiesFilename);
74         }
75
76     @Override
77     protected String getServiceName() {
78         return IntakeClient.SERVICE_NAME;
79     }
80
81     // ---------------------------------------------------------------
82     // CRUD tests : CREATE tests
83     // ---------------------------------------------------------------
84     
85     // See Issue CSPACE-401.
86     /* (non-Javadoc)
87      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
88      */
89     @Override
90     public void createWithEmptyEntityBody(String testName) throws Exception {
91         //Should this really be empty?
92     }
93
94     /* (non-Javadoc)
95      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
96      */
97     @Override
98     public void createWithMalformedXml(String testName) throws Exception {
99         //Should this really be empty?
100     }
101
102     /* (non-Javadoc)
103      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
104      */
105     @Override
106     public void createWithWrongXmlSchema(String testName) throws Exception {
107         //Should this really be empty?
108     }
109
110     /*
111     @Override
112     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
113     dependsOnMethods = {"create", "testSubmitRequest"})
114     public void createWithEmptyEntityBody(String testName) throws Exception {
115     
116     if (logger.isDebugEnabled()) {
117     logger.debug(testBanner(testName, CLASS_NAME));
118     }
119     // Perform setup.
120     setupCreateWithEmptyEntityBody();
121     
122     // Submit the request to the service and store the response.
123     String method = REQUEST_TYPE.httpMethodName();
124     String url = getServiceRootURL();
125     String mediaType = MediaType.APPLICATION_XML;
126     final String entity = "";
127     int statusCode = submitRequest(method, url, mediaType, entity);
128     
129     // Check the status code of the response: does it match
130     // the expected response(s)?
131     if(logger.isDebugEnabled()){
132     logger.debug("createWithEmptyEntityBody url=" + url +
133     " status=" + statusCode);
134     }
135     Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
136     invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
137     Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
138     }
139     
140     @Override
141     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
142     dependsOnMethods = {"create", "testSubmitRequest"})
143     public void createWithMalformedXml(String testName) throws Exception {
144     
145     if (logger.isDebugEnabled()) {
146     logger.debug(testBanner(testName, CLASS_NAME));
147     }
148     // Perform setup.
149     setupCreateWithMalformedXml();
150     
151     // Submit the request to the service and store the response.
152     String method = REQUEST_TYPE.httpMethodName();
153     String url = getServiceRootURL();
154     String mediaType = MediaType.APPLICATION_XML;
155     final String entity = MALFORMED_XML_DATA; // Constant from base class.
156     int statusCode = submitRequest(method, url, mediaType, entity);
157     
158     // Check the status code of the response: does it match
159     // the expected response(s)?
160     if(logger.isDebugEnabled()){
161     logger.debug(testName + ": url=" + url +
162     " status=" + statusCode);
163     }
164     Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
165     invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
166     Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
167     }
168     
169     @Override
170     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
171     dependsOnMethods = {"create", "testSubmitRequest"})
172     public void createWithWrongXmlSchema(String testName) throws Exception {
173     
174     if (logger.isDebugEnabled()) {
175     logger.debug(testBanner(testName, CLASS_NAME));
176     }
177     // Perform setup.
178     setupCreateWithWrongXmlSchema(testName, logger);
179     
180     // Submit the request to the service and store the response.
181     String method = REQUEST_TYPE.httpMethodName();
182     String url = getServiceRootURL();
183     String mediaType = MediaType.APPLICATION_XML;
184     final String entity = WRONG_XML_SCHEMA_DATA;
185     int statusCode = submitRequest(method, url, mediaType, entity);
186     
187     // Check the status code of the response: does it match
188     // the expected response(s)?
189     if(logger.isDebugEnabled()){
190     logger.debug(testName + ": url=" + url +
191     " status=" + statusCode);
192     }
193     Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
194     invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
195     Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
196     }
197      */
198     
199     // ---------------------------------------------------------------
200     // CRUD tests : READ tests
201     // ---------------------------------------------------------------
202     
203         protected void compareReadInstances(IntakesCommon original, IntakesCommon fromRead) throws Exception {
204         // Verify the number and contents of values in repeatable fields,
205         // as created in the instance record used for testing.
206         List<String> entryMethods =
207                         fromRead.getEntryMethods().getEntryMethod();
208         Assert.assertTrue(entryMethods.size() > 0);
209         Assert.assertNotNull(entryMethods.get(0));
210
211         List<String> fieldCollectionEventNames =
212                         fromRead.getFieldCollectionEventNames().getFieldCollectionEventName();
213         Assert.assertTrue(fieldCollectionEventNames.size() > 0);
214         Assert.assertNotNull(fieldCollectionEventNames.get(0));
215
216         CurrentLocationGroupList currentLocationGroupList = fromRead.getCurrentLocationGroupList();
217         Assert.assertNotNull(currentLocationGroupList);
218         List<CurrentLocationGroup> currentLocationGroups = currentLocationGroupList.getCurrentLocationGroup();
219         Assert.assertNotNull(currentLocationGroups);
220         Assert.assertTrue(currentLocationGroups.size() > 0);
221         CurrentLocationGroup currentLocationGroup = currentLocationGroups.get(0);
222         Assert.assertNotNull(currentLocationGroup);
223         Assert.assertNotNull(currentLocationGroup.getCurrentLocationNote());
224
225         // Check the values of fields containing Unicode UTF-8 (non-Latin-1) characters.
226         if (logger.isDebugEnabled()) {
227             logger.debug("UTF-8 data sent=" + getUTF8DataFragment() + "\n"
228                     + "UTF-8 data received=" + fromRead.getEntryNote());
229         }
230         Assert.assertEquals(fromRead.getEntryNote(), getUTF8DataFragment(),
231                 "UTF-8 data retrieved '" + fromRead.getEntryNote()
232                 + "' does not match expected data '" + getUTF8DataFragment());
233         }
234     
235     // Failure outcomes
236
237     @Override
238     public void delete(String testName) throws Exception {
239         // Do nothing because this test is not ready to delete the "knownResourceId".
240         // Instead, the method localDelete() will get called later in the dependency chain. The
241         // method localDelete() has a dependency on the test "verifyReadOnlyCoreFields".  Once the "verifyReadOnlyCoreFields"
242         // test is run, the localDelete() test/method will get run.  The localDelete() test/method in turn
243         // calls the inherited delete() test/method.
244     }
245     
246     @Test(dataProvider = "testName", dependsOnMethods = {"CRUDTests", "verifyReadOnlyCoreFields"})
247     public void localDelete(String testName) throws Exception {
248         // Because of issues with TestNG not allowing @Test annotations on on override methods,
249         // and because we want the "updateWrongUser" to run before the "delete" test, we need
250         // this method.  This method will call super.delete() after all the dependencies have been
251         // met.
252         super.delete(testName);
253     }
254
255     @Test(dataProvider = "testName", dependsOnMethods = {"CRUDTests"})
256     public void verifyReadOnlyCoreFields(String testName) throws Exception {
257         // TODO These should be in some core client utils
258         final String COLLECTIONSPACE_CORE_SCHEMA = "collectionspace_core";
259         final String COLLECTIONSPACE_CORE_TENANTID = "tenantId";
260         final String COLLECTIONSPACE_CORE_URI = "uri";
261         final String COLLECTIONSPACE_CORE_CREATED_AT = "createdAt";
262         final String COLLECTIONSPACE_CORE_UPDATED_AT = "updatedAt";
263         final String COLLECTIONSPACE_CORE_CREATED_BY = "createdBy";
264         final String COLLECTIONSPACE_CORE_UPDATED_BY = "updatedBy";
265
266         // Perform setup.
267         setupUpdate();
268
269         // Retrieve the contents of a resource to update.
270         IntakeClient client = new IntakeClient();
271         PoxPayloadIn input = null;
272         Response res = client.read(knownResourceId);
273         try {
274                 if (logger.isDebugEnabled()) {
275                     logger.debug(testName + ": read status = " + res.getStatus());
276                 }
277                 Assert.assertEquals(res.getStatus(), testExpectedStatusCode);
278         
279                 input = new PoxPayloadIn(res.readEntity(String.class));
280         } finally {
281                 res.close();
282         }
283         
284         PayloadInputPart payloadInputPart = input.getPart(COLLECTIONSPACE_CORE_SCHEMA);
285         Element coreAsElement = null;
286         if (payloadInputPart != null) {
287                 coreAsElement = payloadInputPart.getElementBody();
288         }
289         Assert.assertNotNull(coreAsElement);
290         if (logger.isDebugEnabled()) {
291             logger.debug("Core part before update:");
292             logger.debug(coreAsElement.asXML());
293         }
294
295         // Update the read-only elements
296         Element tenantId = coreAsElement.element(COLLECTIONSPACE_CORE_TENANTID);
297         String originalTenantId = tenantId.getText();
298         tenantId.setText("foo");
299         Element uri = coreAsElement.element(COLLECTIONSPACE_CORE_URI);
300         String originalUri = uri.getText();
301         uri.setText("foo");
302         Element createdAt = coreAsElement.element(COLLECTIONSPACE_CORE_CREATED_AT);
303         String originalCreatedAt = createdAt.getText();
304         String now = GregorianCalendarDateTimeUtils.timestampUTC();
305         if(originalCreatedAt.equalsIgnoreCase(now) && logger.isWarnEnabled()) {
306                         logger.warn("Cannot check createdAt read-only; too fast!");
307         }
308         createdAt.setText(now);
309         Element createdBy = coreAsElement.element(COLLECTIONSPACE_CORE_CREATED_BY);
310         String originalCreatedBy = createdBy.getText();
311         createdBy.setText("foo");
312         
313         if (logger.isDebugEnabled()) {
314             logger.debug("Core part to be updated:");
315             logger.debug(coreAsElement.asXML());
316         }
317
318         // Create an output payload to send to the service, and add the common part
319         PoxPayloadOut output = new PoxPayloadOut(this.getServicePathComponent());
320         PayloadOutputPart corePart = output.addPart(COLLECTIONSPACE_CORE_SCHEMA, coreAsElement);
321         
322         // Submit the request to the service and store the response.
323         res = client.update(knownResourceId, output);
324             try {
325                 int statusCode = res.getStatus();
326                 // Check the status code of the response: does it match the expected response(s)?
327                 if (logger.isDebugEnabled()) {
328                     logger.debug(testName + ": status = " + statusCode);
329                 }
330                 Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
331                         invalidStatusCodeMessage(testRequestType, statusCode));
332                 Assert.assertEquals(statusCode, testExpectedStatusCode);
333         
334                 input = new PoxPayloadIn(res.readEntity(String.class));
335             } finally {
336                 res.close();
337             }
338                 
339         PayloadInputPart updatedCorePart = input.getPart(COLLECTIONSPACE_CORE_SCHEMA);
340         Element updatedCoreAsElement = null;
341         if (updatedCorePart != null) {
342                 updatedCoreAsElement = updatedCorePart.getElementBody();
343         }
344         Assert.assertNotNull(updatedCoreAsElement);
345         
346         tenantId = updatedCoreAsElement.element(COLLECTIONSPACE_CORE_TENANTID);
347         String updatedTenantId = tenantId.getText();
348         Assert.assertEquals(updatedTenantId, originalTenantId,
349                                 "CORE part TenantID was able to update!");
350         uri = updatedCoreAsElement.element(COLLECTIONSPACE_CORE_URI);
351         String updatedUri = uri.getText();
352         Assert.assertEquals(updatedUri, originalUri,
353                                 "CORE part URI was able to update!");
354         createdAt = updatedCoreAsElement.element(COLLECTIONSPACE_CORE_CREATED_AT);
355         String updatedCreatedAt = createdAt.getText();
356         Assert.assertEquals(updatedCreatedAt, originalCreatedAt,
357                                 "CORE part CreatedAt was able to update!");
358         createdBy = updatedCoreAsElement.element(COLLECTIONSPACE_CORE_CREATED_BY);
359         String updatedCreatedBy = createdBy.getText();
360         Assert.assertEquals(updatedCreatedBy, originalCreatedBy,
361                                 "CORE part CreatedBy was able to update!");
362
363     }
364
365     // Failure outcomes
366     // Placeholders until the three tests below can be uncommented.
367     
368     // See Issue CSPACE-401.
369     /* (non-Javadoc)
370      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
371      */
372     @Override
373     public void updateWithEmptyEntityBody(String testName) throws Exception {
374         //Should this really be empty?
375     }
376
377     /* (non-Javadoc)
378      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
379      */
380     @Override
381     public void updateWithMalformedXml(String testName) throws Exception {
382         //Should this really be empty?
383     }
384
385     /* (non-Javadoc)
386      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
387      */
388     @Override
389     public void updateWithWrongXmlSchema(String testName) throws Exception {
390         //Should this really be empty?
391     }
392
393     /*
394     @Override
395     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
396     dependsOnMethods = {"create", "update", "testSubmitRequest"})
397     public void updateWithEmptyEntityBody(String testName) throws Exception {
398     
399     if (logger.isDebugEnabled()) {
400     logger.debug(testBanner(testName, CLASS_NAME));
401     }
402     // Perform setup.
403     setupUpdateWithEmptyEntityBody();
404     
405     // Submit the request to the service and store the response.
406     String method = REQUEST_TYPE.httpMethodName();
407     String url = getResourceURL(knownResourceId);
408     String mediaType = MediaType.APPLICATION_XML;
409     final String entity = "";
410     int statusCode = submitRequest(method, url, mediaType, entity);
411     
412     // Check the status code of the response: does it match
413     // the expected response(s)?
414     if(logger.isDebugEnabled()){
415     logger.debug(testName + ": url=" + url +
416     " status=" + statusCode);
417     }
418     Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
419     invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
420     Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
421     }
422     
423     @Override
424     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
425     dependsOnMethods = {"create", "update", "testSubmitRequest"})
426     public void updateWithMalformedXml(String testName) throws Exception {
427     
428     if (logger.isDebugEnabled()) {
429     logger.debug(testBanner(testName, CLASS_NAME));
430     }
431     // Perform setup.
432     setupUpdateWithMalformedXml();
433     
434     // Submit the request to the service and store the response.
435     String method = REQUEST_TYPE.httpMethodName();
436     String url = getResourceURL(knownResourceId);
437     String mediaType = MediaType.APPLICATION_XML;
438     final String entity = MALFORMED_XML_DATA;
439     int statusCode = submitRequest(method, url, mediaType, entity);
440     
441     // Check the status code of the response: does it match
442     // the expected response(s)?
443     if(logger.isDebugEnabled()){
444     logger.debug(testName + ": url=" + url +
445     " status=" + statusCode);
446     }
447     Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
448     invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
449     Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
450     }
451     
452     @Override
453     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
454     dependsOnMethods = {"create", "update", "testSubmitRequest"})
455     public void updateWithWrongXmlSchema(String testName) throws Exception {
456     
457     if (logger.isDebugEnabled()) {
458     logger.debug(testBanner(testName, CLASS_NAME));
459     }
460     // Perform setup.
461     setupUpdateWithWrongXmlSchema();
462     
463     // Submit the request to the service and store the response.
464     String method = REQUEST_TYPE.httpMethodName();
465     String url = getResourceURL(knownResourceId);
466     String mediaType = MediaType.APPLICATION_XML;
467     final String entity = WRONG_XML_SCHEMA_DATA;
468     int statusCode = submitRequest(method, url, mediaType, entity);
469     
470     // Check the status code of the response: does it match
471     // the expected response(s)?
472     if(logger.isDebugEnabled()){
473     logger.debug(testName + ": url=" + url +
474     " status=" + statusCode);
475     }
476     Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
477     invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
478     Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
479     }
480      */
481
482     // ---------------------------------------------------------------
483     // Utility tests : tests of code used in tests above
484     // ---------------------------------------------------------------
485     
486     /* (non-Javadoc)
487      * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
488      */
489     @Override
490     public String getServicePathComponent() {
491         return IntakeClient.SERVICE_PATH_COMPONENT;
492     }
493
494     /**
495      * Creates the intake instance.
496      *
497      * @param identifier the identifier
498      * @return the multipart output
499      */
500     @Override
501     protected PoxPayloadOut createInstance(String identifier) {
502         return createIntakeInstance(
503                 "entryNumber-" + identifier,
504                 CURRENT_DATE_UTC,
505                 "depositor-" + identifier);
506     }
507
508     /**
509      * Creates the intake instance.
510      *
511      * @param entryNumber the entry number
512      * @param entryDate the entry date
513      * @param depositor the depositor
514      * @return the multipart output
515      */
516     private PoxPayloadOut createIntakeInstance(String entryNumber,
517             String entryDate,
518             String depositor) {
519         IntakesCommon intake = new IntakesCommon();
520         intake.setEntryNumber(entryNumber);
521         intake.setEntryDate(entryDate);
522         intake.setDepositor(depositor);
523
524         EntryMethodList entryMethodsList = new EntryMethodList();
525         List<String> entryMethods = entryMethodsList.getEntryMethod();
526         entryMethods.add("Left at doorstep");
527         entryMethods.add("Received via post");
528         intake.setEntryMethods(entryMethodsList);
529
530         FieldCollectionEventNameList eventNamesList = new FieldCollectionEventNameList();
531         List<String> eventNames = eventNamesList.getFieldCollectionEventName();
532         // FIXME Use properly formatted refNames for representative event names
533         // in this example test record. The following are mere placeholders.
534         eventNames.add("Field Collection Event Name-1");
535         eventNames.add("Field Collection Event Name-2");
536         intake.setFieldCollectionEventNames(eventNamesList);
537
538         CurrentLocationGroupList currentLocationGroupList = new CurrentLocationGroupList();
539         List<CurrentLocationGroup> currentLocationGroups = currentLocationGroupList.getCurrentLocationGroup();
540         CurrentLocationGroup currentLocationGroup = new CurrentLocationGroup();
541         currentLocationGroup.setCurrentLocation("upstairs");
542         currentLocationGroup.setCurrentLocationFitness("suitable");
543         currentLocationGroup.setCurrentLocationNote("A most suitable location.");
544         currentLocationGroups.add(currentLocationGroup);
545         intake.setCurrentLocationGroupList(currentLocationGroupList);
546
547         intake.setEntryNote(getUTF8DataFragment());
548
549         PoxPayloadOut multipart = new PoxPayloadOut(IntakeClient.SERVICE_PAYLOAD_NAME);
550         PayloadOutputPart commonPart =
551                 multipart.addPart(intake, MediaType.APPLICATION_XML_TYPE);
552         commonPart.setLabel(new IntakeClient().getCommonPartName());
553
554         if (logger.isDebugEnabled()) {
555             logger.debug("to be created, intake common");
556             logger.debug(objectAsXmlString(intake, IntakesCommon.class));
557         }
558
559         return multipart;
560     }
561
562         @Override
563         protected PoxPayloadOut createInstance(String commonPartName,
564                         String identifier) {
565                 return this.createInstance(identifier);
566         }
567
568         @Override
569         protected IntakesCommon updateInstance(IntakesCommon intakesCommon) {
570                 IntakesCommon result = new IntakesCommon();
571                 
572                 result.setEntryNumber("updated-" + intakesCommon.getEntryNumber());
573                 result.setEntryNote(intakesCommon.getEntryNote());
574
575         CurrentLocationGroupList currentLocationGroupList = intakesCommon.getCurrentLocationGroupList();
576         Assert.assertNotNull(currentLocationGroupList);
577         List<CurrentLocationGroup> currentLocationGroups = currentLocationGroupList.getCurrentLocationGroup();
578         Assert.assertNotNull(currentLocationGroups);
579         Assert.assertTrue(currentLocationGroups.size() > 0);
580         CurrentLocationGroup currentLocationGroup = currentLocationGroups.get(0);
581         Assert.assertNotNull(currentLocationGroup);
582         String currentLocationNote = currentLocationGroup.getCurrentLocationNote();
583         Assert.assertNotNull(currentLocationNote);
584         String updatedCurrentLocationNote = "updated-" + currentLocationNote;
585         currentLocationGroups.get(0).setCurrentLocationNote(updatedCurrentLocationNote);
586         result.setCurrentLocationGroupList(currentLocationGroupList);
587         
588         return result;
589         }
590
591         @Override
592         protected void compareUpdatedInstances(IntakesCommon original,
593                         IntakesCommon updated) throws Exception {
594         Assert.assertEquals(updated.getEntryNumber(),
595                         original.getEntryNumber(),
596                 "Data in updated object did not match submitted data.");
597         
598         CurrentLocationGroupList currentLocationGroupList = updated.getCurrentLocationGroupList();
599         Assert.assertNotNull(currentLocationGroupList);
600         List<CurrentLocationGroup> currentLocationGroups = currentLocationGroupList.getCurrentLocationGroup();
601         Assert.assertNotNull(currentLocationGroups);
602         Assert.assertTrue(currentLocationGroups.size() > 0);
603         Assert.assertNotNull(currentLocationGroups.get(0));
604         
605         String updatedCurrentLocationNote = original.getCurrentLocationGroupList()
606                         .getCurrentLocationGroup().get(0).getCurrentLocationNote();
607         Assert.assertEquals(updatedCurrentLocationNote,
608                 currentLocationGroups.get(0).getCurrentLocationNote(),
609                 "Data in updated object did not match submitted data.");
610         
611         Assert.assertEquals(updated.getEntryNote(), original.getEntryNote(),
612                 "Data in updated object did not match submitted data.");
613         //
614         // UTF-8 Checks
615         //
616         if (logger.isDebugEnabled()) {
617             logger.debug("UTF-8 data sent=" + original.getEntryNote() + "\n"
618                     + "UTF-8 data received=" + updated.getEntryNote());
619         }
620         Assert.assertTrue(updated.getEntryNote().contains(getUTF8DataFragment()),
621                 "UTF-8 data retrieved '" + updated.getEntryNote()
622                 + "' does not contain expected data '" + getUTF8DataFragment());        
623         }
624
625     /*
626      * For convenience and terseness, this test method is the base of the test execution dependency chain.  Other test methods may
627      * refer to this method in their @Test annotation declarations.
628      */
629     @Override
630     @Test(dataProvider = "testName",
631                 dependsOnMethods = {
632                         "org.collectionspace.services.client.test.AbstractServiceTestImpl.baseCRUDTests"})    
633         public void CRUDTests(String testName) {
634                 // TODO Auto-generated method stub              
635         }
636 }