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