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 (c)) 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.HashMap;
27 import java.util.List;
30 import javax.ws.rs.core.Response;
32 import org.collectionspace.services.client.AbstractCommonListUtils;
33 import org.collectionspace.services.client.AuthorityClient;
34 import org.collectionspace.services.client.CollectionSpaceClient;
35 import org.collectionspace.services.client.PoxPayloadIn;
36 import org.collectionspace.services.client.PoxPayloadOut;
37 import org.collectionspace.services.client.ContactClient;
38 import org.collectionspace.services.client.ContactClientUtils;
39 import org.collectionspace.services.contact.AddressGroup;
40 import org.collectionspace.services.contact.AddressGroupList;
41 import org.collectionspace.services.contact.ContactsCommon;
42 import org.collectionspace.services.client.PersonAuthorityClient;
43 import org.collectionspace.services.client.PersonAuthorityClientUtils;
44 import org.collectionspace.services.jaxb.AbstractCommonList;
45 import org.collectionspace.services.PersonJAXBSchema;
46 import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;
47 import org.collectionspace.services.person.PersonauthoritiesCommon;
48 import org.collectionspace.services.person.PersonTermGroup;
49 import org.collectionspace.services.person.PersonTermGroupList;
50 import org.collectionspace.services.person.PersonsCommon;
52 import org.slf4j.Logger;
53 import org.slf4j.LoggerFactory;
54 import org.testng.Assert;
55 import org.testng.annotations.AfterClass;
56 import org.testng.annotations.Test;
59 * PersonAuthorityServiceTest, carries out tests against a
60 * deployed and running PersonAuthority Service.
62 * $LastChangedRevision: 753 $
63 * $LastChangedDate: 2009-09-23 11:03:36 -0700 (Wed, 23 Sep 2009) $
65 public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<PersonauthoritiesCommon, PersonsCommon> { //FIXME: Test classes for Vocab, Person, Org, and Location should have a base class!
68 private final String CLASS_NAME = PersonAuthorityServiceTest.class.getName();
69 private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
72 * Default constructor. Used to set the short ID for all tests authority items
74 public PersonAuthorityServiceTest() {
76 TEST_SHORTID = "johnWayneActor";
80 protected String getTestAuthorityItemShortId() {
81 return getTestAuthorityItemShortId(true); // The short ID of every person item we create should be unique
85 public String getServicePathComponent() {
86 return PersonAuthorityClient.SERVICE_PATH_COMPONENT;
90 protected String getServiceName() {
91 return PersonAuthorityClient.SERVICE_NAME;
94 public String getItemServicePathComponent() {
95 return AuthorityClient.ITEMS;
98 /** The test forename. */
99 final String TEST_FORE_NAME = "John";
100 /** The test middle name. */
101 final String TEST_MIDDLE_NAME = null;
102 /** The test surname. */
103 final String TEST_SUR_NAME = "Wayne";
104 /** The test birthdate. */
105 final String TEST_BIRTH_DATE = "May 26, 1907";
106 /** The test death date. */
107 final String TEST_DEATH_DATE = "June 11, 1979";
108 //private String knownResourceRefName = null;
109 private String knownItemResourceShortIdentifer = null;
110 /** The known contact resource id. */
111 private String knownContactResourceId = null;
112 /** The all contact resource ids created. */
113 private Map<String, String> allContactResourceIdsCreated =
114 new HashMap<String, String>();
117 protected void setKnownResource(String id, String shortIdentifer,
119 knownResourceId = id;
120 knownResourceShortIdentifer = shortIdentifer;
121 //knownResourceRefName = refName;
124 protected void setKnownItemResource(String id, String shortIdentifer) {
125 knownItemResourceId = id;
126 knownItemResourceShortIdentifer = shortIdentifer;
130 * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
133 protected CollectionSpaceClient getClientInstance() {
134 return new PersonAuthorityClient();
138 protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
139 return new PersonAuthorityClient(clientPropertiesFilename);
142 // ---------------------------------------------------------------
143 // CRUD tests : CREATE tests
144 // ---------------------------------------------------------------
147 * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
150 public void create(String testName) throws Exception {
151 // Perform setup, such as initializing the type of service request
152 // (e.g. CREATE, DELETE), its valid and expected status codes, and
153 // its associated HTTP method name (e.g. POST, DELETE).
156 // Submit the request to the service and store the response.
157 PersonAuthorityClient client = new PersonAuthorityClient();
158 String shortId = createIdentifier();
159 String displayName = "displayName-" + shortId;
160 //String baseRefName = PersonAuthorityClientUtils.createPersonAuthRefName(shortId, null);
161 PoxPayloadOut multipart =
162 PersonAuthorityClientUtils.createPersonAuthorityInstance(
163 displayName, shortId, client.getCommonPartName());
166 Response res = client.create(multipart);
168 assertStatusCode(res, testName);
169 newID = extractId(res);
175 // Save values for additional tests
176 if (knownResourceId == null) {
177 setKnownResource(newID, shortId, null ); //baseRefName);
178 if (logger.isDebugEnabled()) {
179 logger.debug(testName + ": knownResourceId=" + knownResourceId);
182 // Store the IDs from every resource created by tests,
183 // so they can be deleted after tests have been run.
184 allResourceIdsCreated.add(newID);
188 protected PoxPayloadOut createInstance(String identifier) {
189 PersonAuthorityClient client = new PersonAuthorityClient();
190 String displayName = "displayName-" + identifier;
191 PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
192 displayName, identifier, client.getCommonPartName());
197 protected PoxPayloadOut createItemInstance(String parentCsid, String identifier) {
198 String headerLabel = new PersonAuthorityClient().getItemCommonPartName();
200 HashMap<String, String> personInfo = new HashMap<String, String>();
201 String shortId = "MarkTwainAuthor" + identifier;
202 personInfo.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId);
204 List<PersonTermGroup> terms = new ArrayList<PersonTermGroup>();
205 PersonTermGroup term = new PersonTermGroup();
206 term.setTermDisplayName("Mark Twain Primary");
207 term.setTermName("MarkTwainPrimary");
210 term = new PersonTermGroup();
211 term.setTermDisplayName("Samuel Langhorne Clemens");
212 term.setTermName("SamuelLanghorneClemens");
215 term = new PersonTermGroup();
216 term.setTermDisplayName("Sam Clemens");
217 term.setTermName("SamClemens");
220 term = new PersonTermGroup();
221 term.setTermDisplayName("Huck Fin");
222 term.setTermName("Huck Fin");
225 return PersonAuthorityClientUtils.createPersonInstance(parentCsid, identifier, personInfo, terms, headerLabel);
230 * Creates an item in an authority, using test data.
232 * @param vcsid the vcsid
233 * @param authRefName the auth ref name
237 protected String createItemInAuthority(AuthorityClient client, String vcsid, String shortId) {
239 final String testName = "createItemInAuthority";
240 if (logger.isDebugEnabled()) {
241 logger.debug(testName + ":" + vcsid + "...");
244 Map<String, String> johnWayneMap = new HashMap<String, String>();
246 // Fill the property map
248 johnWayneMap.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId);
249 johnWayneMap.put(PersonJAXBSchema.GENDER, "male");
250 johnWayneMap.put(PersonJAXBSchema.BIRTH_DATE, TEST_BIRTH_DATE);
251 johnWayneMap.put(PersonJAXBSchema.BIRTH_PLACE, "Winterset, Iowa");
252 johnWayneMap.put(PersonJAXBSchema.DEATH_DATE, TEST_DEATH_DATE);
253 johnWayneMap.put(PersonJAXBSchema.BIO_NOTE, "born Marion Robert Morrison and better"
254 + "known by his stage name John Wayne, was an American film actor, director "
255 + "and producer. He epitomized rugged masculinity and has become an enduring "
256 + "American icon. He is famous for his distinctive voice, walk and height. "
257 + "He was also known for his conservative political views and his support in "
258 + "the 1950s for anti-communist positions.");
260 List<PersonTermGroup> johnWayneTerms = new ArrayList<PersonTermGroup>();
261 PersonTermGroup term = new PersonTermGroup();
262 term.setTermDisplayName("John Wayne DisplayName");
263 term.setTermName("John Wayne");
264 term.setForeName(TEST_FORE_NAME);
265 term.setSurName(TEST_SUR_NAME);
266 johnWayneTerms.add(term);
268 Map<String, List<String>> johnWayneRepeatablesMap = new HashMap<String, List<String>>();
269 List<String> johnWayneGroups = new ArrayList<String>();
270 johnWayneGroups.add("Irish");
271 johnWayneGroups.add("Scottish");
272 johnWayneRepeatablesMap.put(PersonJAXBSchema.GROUPS, johnWayneGroups);
274 return createItemInAuthority(client, vcsid, null /*authRefName*/, shortId, johnWayneMap, johnWayneTerms, johnWayneRepeatablesMap);
279 * Creates an item in an authority.
281 * @param vcsid the vcsid
282 * @param authRefName the auth ref name
283 * @param itemFieldProperties a set of properties specifying the values of fields.
284 * @param itemRepeatableFieldProperties a set of properties specifying the values of repeatable fields.
287 private String createItemInAuthority(AuthorityClient client, String vcsid, String authRefName, String shortId,
288 Map<String, String> itemFieldProperties, List<PersonTermGroup> terms, Map<String, List<String>> itemRepeatableFieldProperties) {
290 final String testName = "createItemInAuthority";
291 if (logger.isDebugEnabled()) {
292 logger.debug(testName + ":" + vcsid + "...");
295 // Submit the request to the service and store the response.
296 if (client == null) {
297 client = new PersonAuthorityClient();
299 PoxPayloadOut multipart =
300 PersonAuthorityClientUtils.createPersonInstance(vcsid, null /*authRefName*/, itemFieldProperties,
301 terms, itemRepeatableFieldProperties, client.getItemCommonPartName());
303 Response res = client.createItem(vcsid, multipart);
306 assertStatusCode(res, testName);
307 newID = PersonAuthorityClientUtils.extractId(res);
314 // Store the ID returned from the first item resource created
315 // for additional tests below.
316 if (knownItemResourceId == null) {
317 setKnownItemResource(newID, shortId);
318 if (logger.isDebugEnabled()) {
319 logger.debug(testName + ": knownItemResourceId=" + knownItemResourceId);
323 if (logger.isDebugEnabled()) {
324 logger.debug(testName + " (created):" + vcsid + "/(" + newID + "," + shortId + ")");
327 // Store the IDs from any item resources created
328 // by tests, along with the IDs of their parents, so these items
329 // can be deleted after all tests have been run.
330 allResourceItemIdsCreated.put(newID, vcsid);
336 * Creates the contact.
338 * @param testName the test name
340 @Test(dataProvider = "testName", groups = {"create"},
341 dependsOnMethods = {"createItem"})
342 public void createContact(String testName) {
344 createContactInItem(knownResourceId, knownItemResourceId);
348 * Creates the contact in item.
350 * @param parentcsid the parentcsid
351 * @param itemcsid the itemcsid
354 private String createContactInItem(String parentcsid, String itemcsid) {
356 final String testName = "createContactInItem";
357 if (logger.isDebugEnabled()) {
358 logger.debug(testName + ":...");
360 // Submit the request to the service and store the response.
361 PersonAuthorityClient client = new PersonAuthorityClient();
362 String identifier = createIdentifier();
363 PoxPayloadOut multipart = ContactClientUtils.createContactInstance(parentcsid,
364 itemcsid, identifier, new ContactClient().getCommonPartName());
367 Response res = client.createContact(parentcsid, itemcsid, multipart);
370 assertStatusCode(res, testName);
371 newID = PersonAuthorityClientUtils.extractId(res);
378 // Store the ID returned from the first contact resource created
379 // for additional tests below.
380 if (knownContactResourceId == null) {
381 knownContactResourceId = newID;
382 if (logger.isDebugEnabled()) {
383 logger.debug(testName + ": knownContactResourceId=" + knownContactResourceId);
387 // Store the IDs from any contact resources created
388 // by tests, along with the IDs of their parent items,
389 // so these items can be deleted after all tests have been run.
390 allContactResourceIdsCreated.put(newID, itemcsid);
396 * Attempts to create an authority with an short identifier that contains
397 * non-word characters.
399 * @param testName the test name
401 @Test(dataProvider = "testName", groups = {"create", "nonWordCharsInShortId"})
402 public void createWithShortIdNonWordChars(String testName) throws Exception {
403 testExpectedStatusCode = STATUS_BAD_REQUEST;
404 testRequestType = ServiceRequestType.CREATE;
405 testSetup(testExpectedStatusCode, testRequestType);
407 // Create the payload to be included in the body of the request
408 PersonAuthorityClient client = new PersonAuthorityClient();
409 String shortId = createIdentifier() + "*" + createIdentifier();
410 String displayName = "displayName-" + shortId;
411 PoxPayloadOut multipart =
412 PersonAuthorityClientUtils.createPersonAuthorityInstance(
413 displayName, shortId, client.getCommonPartName());
415 // Submit the request to the service and store the response.
416 Response res = client.create(multipart);
417 // Check the status code of the response: does it match
418 // the expected response(s)? We expect failure here.
420 assertStatusCode(res, testName);
429 * Attempts to create an item with an short identifier that contains
430 * non-word characters.
432 * @param testName the test name
434 @Test(dataProvider = "testName", groups = {"create", "nonWordCharsInShortId"},
435 dependsOnMethods = {"org.collectionspace.services.client.test.AbstractServiceTestImpl.create"})
436 public void createItemWithShortIdNonWordChars(String testName) {
437 testExpectedStatusCode = STATUS_BAD_REQUEST;
438 testRequestType = ServiceRequestType.CREATE;
439 testSetup(testExpectedStatusCode, testRequestType);
441 PersonAuthorityClient client = new PersonAuthorityClient();
442 // Create the payload to be included in the body of the request
443 String shortId = "7-Eleven";
444 Map<String, String> fieldProperties = new HashMap<String, String>();
445 fieldProperties.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId);
447 List<PersonTermGroup> terms = new ArrayList<PersonTermGroup>();
448 PersonTermGroup term = new PersonTermGroup();
449 term.setTermDisplayName(shortId);
450 term.setTermName(shortId);
453 final Map<String, List<String>> NULL_REPEATABLE_FIELD_PROPERTIES = null;
454 PoxPayloadOut multipart =
455 PersonAuthorityClientUtils.createPersonInstance(knownResourceId,
456 null /*knownResourceRefName*/, fieldProperties, terms,
457 NULL_REPEATABLE_FIELD_PROPERTIES, client.getItemCommonPartName());
459 // Send the request and receive a response
460 Response res = client.createItem(knownResourceId, multipart);
461 // Check the status code of the response: does it match
462 // the expected response(s)? We expect failure here, so there will be no
463 // new ID to keep track of for later cleanup.
465 assertStatusCode(res, testName);
473 // ---------------------------------------------------------------
474 // CRUD tests : CREATE LIST tests
475 // ---------------------------------------------------------------
478 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
481 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
482 // groups = {"createList"}, dependsOnGroups = {"create"})
483 public void createList(String testName) throws Exception {
484 for (int i = 0; i < nItemsToCreateInList; i++) {
490 * Creates the contact list.
492 * @param testName the test name
493 * @throws Exception the exception
495 @Test(dataProvider = "testName", groups = {"createList"},
496 dependsOnMethods = {"org.collectionspace.services.client.test.AbstractAuthorityServiceTest.createItemList"})
497 public void createContactList(String testName) throws Exception {
498 // Add contacts to the initially-created, known item record.
499 for (int j = 0; j < nItemsToCreateInList; j++) {
500 createContact(testName);
504 // ---------------------------------------------------------------
505 // CRUD tests : READ tests
506 // ---------------------------------------------------------------
509 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
512 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
513 // groups = {"read"}, dependsOnGroups = {"create"})
514 public void read(String testName) throws Exception {
515 readInternal(testName, knownResourceId, null);
521 * @param testName the test name
522 * @throws Exception the exception
525 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
526 // groups = {"read"}, dependsOnMethods = {"read"})
527 public void readByName(String testName) throws Exception {
528 readInternal(testName, null, knownResourceShortIdentifer);
531 protected void readInternal(String testName, String CSID, String shortId) {
532 // Submit the request to the service and store the response.
533 PersonAuthorityClient client = new PersonAuthorityClient();
537 res = client.read(CSID);
538 } else if (shortId != null) {
539 res = client.readByName(shortId);
541 Assert.fail("readInternal: Internal error. One of CSID or shortId must be non-null");
544 assertStatusCode(res, testName);
545 //FIXME: remove the following try catch once Aron fixes signatures
547 PoxPayloadIn input = new PoxPayloadIn(res.readEntity(String.class));
548 PersonauthoritiesCommon personAuthority = (PersonauthoritiesCommon) extractPart(input,
549 client.getCommonPartName(), PersonauthoritiesCommon.class);
550 Assert.assertNotNull(personAuthority);
551 } catch (Exception e) {
552 throw new RuntimeException(e);
564 * @param testName the test name
565 * @throws Exception the exception
567 @Test(dataProvider = "testName", groups = {"readItem", "readNamedItemInNamedAuth"},
568 dependsOnMethods = {"readItemInNamedAuth"})
569 public void readNamedItem(String testName) throws Exception {
570 readItemInternal(testName, knownResourceId, null, null, knownItemResourceShortIdentifer);
574 * Read item in Named Auth.
576 * @param testName the test name
577 * @throws Exception the exception
579 @Test(dataProvider = "testName", groups = {"readItem"},
580 dependsOnMethods = {"readItem"})
581 public void readItemInNamedAuth(String testName) throws Exception {
582 readItemInternal(testName, null, knownResourceShortIdentifer, knownItemResourceId, null);
587 * Read Named item in Named Auth.
589 * @param testName the test name
590 * @throws Exception the exception
592 @Test(dataProvider = "testName", groups = {"readItem"},
593 dependsOnMethods = {"readNamedItem"})
594 public void readNamedItemInNamedAuth(String testName) throws Exception {
595 readItemInternal(testName, null, knownResourceShortIdentifer, null, knownItemResourceShortIdentifer);
598 protected void readItemInternal(String testName,
599 String authCSID, String authShortId, String itemCSID, String itemShortId)
602 if (logger.isDebugEnabled()) {
603 logger.debug("Reading:" + ((authCSID != null) ? authCSID : authShortId) + "/"
604 + ((itemCSID != null) ? authCSID : itemShortId));
607 // Submit the request to the service and store the response.
608 PersonAuthorityClient client = new PersonAuthorityClient();
611 if (authCSID != null) {
612 if (itemCSID != null) {
613 res = client.readItem(authCSID, itemCSID);
614 } else if (itemShortId != null) {
615 res = client.readNamedItem(authCSID, itemShortId);
617 Assert.fail("readInternal: Internal error. One of CSID or shortId must be non-null");
619 } else if (authShortId != null) {
620 if (itemCSID != null) {
621 res = client.readItemInNamedAuthority(authShortId, itemCSID);
622 } else if (itemShortId != null) {
623 res = client.readNamedItemInNamedAuthority(authShortId, itemShortId);
625 Assert.fail("readInternal: Internal error. One of CSID or shortId must be non-null");
628 Assert.fail("readInternal: Internal error. One of authCSID or authShortId must be non-null");
632 assertStatusCode(res, testName);
633 // Check whether we've received a person.
634 PoxPayloadIn input = new PoxPayloadIn(res.readEntity(String.class));
635 PersonsCommon person = (PersonsCommon) extractPart(input,
636 client.getItemCommonPartName(), PersonsCommon.class);
637 Assert.assertNotNull(person);
638 boolean showFull = true;
639 if (showFull && logger.isDebugEnabled()) {
640 logger.debug(testName + ": returned payload:");
641 logger.debug(objectAsXmlString(person, PersonsCommon.class));
644 // Check that the person item is within the expected Person Authority.
645 Assert.assertEquals(person.getInAuthority(), knownResourceId);
647 // Verify the number and contents of values in a repeatable field,
648 // as created in the instance record used for testing.
649 List<String> groups = person.getGroups().getGroup();
650 Assert.assertTrue(groups.size() > 0);
651 Assert.assertNotNull(groups.get(0));
659 // Note: This test depends on server-side validation logic to require
660 // a non-null (and potentially, non-empty) displayname for each term,
661 // and will fail if that validation is not present.
664 * Verify illegal item display name.
666 * @param testName the test name
667 * @throws Exception the exception
669 @Test(dataProvider = "testName", groups = {"update"})
670 public void verifyIllegalItemDisplayName(String testName) throws Exception {
671 // Perform setup for read.
674 // Submit the request to the service and store the response.
675 PersonAuthorityClient client = new PersonAuthorityClient();
676 Response res = client.readItem(knownResourceId, knownItemResourceId);
677 PoxPayloadIn input = null;
679 assertStatusCode(res, testName);
680 input = new PoxPayloadIn(res.readEntity(String.class));
687 // Make an invalid UPDATE request, without a display name
689 PersonsCommon person = (PersonsCommon) extractPart(input,
690 client.getItemCommonPartName(), PersonsCommon.class);
691 Assert.assertNotNull(person);
692 // Try to Update with no displayName
693 PersonTermGroupList termList = person.getPersonTermGroupList();
694 Assert.assertNotNull(termList);
695 List<PersonTermGroup> terms = termList.getPersonTermGroup();
696 Assert.assertNotNull(terms);
697 Assert.assertTrue(terms.size() > 0);
698 terms.get(0).setTermDisplayName(null);
699 terms.get(0).setTermName(null);
701 // Submit the updated resource to the service and store the response.
702 PoxPayloadOut output = new PoxPayloadOut(PersonAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
703 output.addPart(client.getItemCommonPartName(), person);
704 setupUpdateWithInvalidBody();
705 res = client.updateItem(knownResourceId, knownItemResourceId, output);
707 assertStatusCode(res, testName);
718 * @param testName the test name
719 * @throws Exception the exception
721 @Test(dataProvider = "testName", groups = {"readItem"},
722 dependsOnMethods = {"createContact", "org.collectionspace.services.client.test.AbstractAuthorityServiceTest.readItem"})
723 public void readContact(String testName) throws Exception {
727 // Submit the request to the service and store the response.
728 PersonAuthorityClient client = new PersonAuthorityClient();
729 PoxPayloadIn input = null;
730 Response res = client.readContact(knownResourceId, knownItemResourceId,
731 knownContactResourceId);
733 assertStatusCode(res, testName);
734 // Check whether we've received a contact.
735 input = new PoxPayloadIn(res.readEntity(String.class));
742 ContactsCommon contact = (ContactsCommon) extractPart(input,
743 new ContactClient().getCommonPartName(), ContactsCommon.class);
744 Assert.assertNotNull(contact);
745 boolean showFull = true;
746 if (showFull && logger.isDebugEnabled()) {
747 logger.debug(testName + ": returned payload:");
748 logger.debug(objectAsXmlString(contact, ContactsCommon.class));
750 Assert.assertEquals(contact.getInAuthority(), knownResourceId);
751 Assert.assertEquals(contact.getInItem(), knownItemResourceId);
756 * Read contact non existent.
758 * @param testName the test name
760 @Test(dataProvider = "testName", groups = {"readItem"}, dependsOnMethods = {"readContact"})
761 public void readContactNonExistent(String testName) {
763 setupReadNonExistent();
765 // Submit the request to the service and store the response.
766 PersonAuthorityClient client = new PersonAuthorityClient();
767 Response res = client.readContact(knownResourceId, knownItemResourceId,
770 assertStatusCode(res, testName);
778 // ---------------------------------------------------------------
779 // CRUD tests : READ_LIST tests
780 // ---------------------------------------------------------------
783 * Read item list override -see immediate superclass.
786 public void readItemList(String testName) {
787 readItemList(knownAuthorityWithItems, null, testName);
791 * Read item list by authority name.
794 public void readItemListByName(String testName) {
795 readItemList(null, READITEMS_SHORT_IDENTIFIER, testName);
801 * @param vcsid the vcsid
802 * @param name the name
804 private void readItemList(String vcsid, String name, String testName) {
806 // Submit the request to the service and store the response.
807 PersonAuthorityClient client = new PersonAuthorityClient();
810 res = client.readItemList(vcsid, null, null);
811 } else if (name != null) {
812 res = client.readItemListForNamedAuthority(name, null, null);
814 Assert.fail("readItemList passed null csid and name!");
816 AbstractCommonList list = null;
818 assertStatusCode(res, testName);
819 list = res.readEntity(AbstractCommonList.class);
826 List<AbstractCommonList.ListItem> items = list.getListItem();
827 int nItemsReturned = items.size();
828 // There will be 'nItemsToCreateInList'
829 // items created by the createItemList test,
830 // all associated with the same parent resource.
831 int nExpectedItems = nItemsToCreateInList;
832 if (logger.isDebugEnabled()) {
833 logger.debug(testName + ": Expected "
834 + nExpectedItems + " items; got: " + nItemsReturned);
836 Assert.assertEquals(nItemsReturned, nExpectedItems);
838 for (AbstractCommonList.ListItem item : items) {
840 AbstractCommonListUtils.ListItemGetElementValue(item, AuthorityItemJAXBSchema.REF_NAME);
841 Assert.assertTrue((null != value), "Item refName is null!");
843 // Per CSPACE-5132, lists items still return a field named displayName,
844 // not termDisplayName, for backward compatibility.
845 // (The format of list items will change significantly in CSPACE-5134.)
847 AbstractCommonListUtils.ListItemGetElementValue(item, AuthorityItemJAXBSchema.TERM_DISPLAY_NAME);
848 Assert.assertTrue((null != value), "Item termDisplayName is null!");
850 if (logger.isTraceEnabled()) {
851 AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
858 @Test(groups = {"readList"},
859 dependsOnMethods = {"org.collectionspace.services.client.test.AbstractAuthorityServiceTest.readItemList"})
860 public void readContactList() {
861 readContactList(knownResourceId, knownItemResourceId);
867 * @param parentcsid the parentcsid
868 * @param itemcsid the itemcsid
870 private void readContactList(String parentcsid, String itemcsid) {
871 final String testName = "readContactList";
876 // Submit the request to the service and store the response.
877 PersonAuthorityClient client = new PersonAuthorityClient();
878 AbstractCommonList list = null;
879 Response res = client.readContactList(parentcsid, itemcsid);
881 assertStatusCode(res, testName);
882 list = res.readEntity(AbstractCommonList.class);
889 List<AbstractCommonList.ListItem> listitems =
891 int nItemsReturned = listitems.size();
892 // There will be one item created, associated with a
893 // known parent resource, by the createItem test.
895 // In addition, there will be 'nItemsToCreateInList'
896 // additional items created by the createItemList test,
897 // all associated with the same parent resource.
898 int nExpectedItems = nItemsToCreateInList + 1;
899 if (logger.isDebugEnabled()) {
900 logger.debug(testName + ": Expected "
901 + nExpectedItems + " items; got: " + nItemsReturned);
903 Assert.assertEquals(nItemsReturned, nExpectedItems);
905 // Optionally output additional data about list members for debugging.
906 boolean iterateThroughList = false;
907 if (iterateThroughList && logger.isDebugEnabled()) {
908 AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
913 // There are no failure outcome tests at present.
914 // ---------------------------------------------------------------
915 // CRUD tests : UPDATE tests
916 // ---------------------------------------------------------------
919 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
922 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
923 // groups = {"update"}, dependsOnGroups = {"readItem", "readList"})
924 public void update(String testName) throws Exception {
925 // Retrieve the contents of a resource to update.
926 PersonAuthorityClient client = new PersonAuthorityClient();
927 PoxPayloadIn input = null;
929 Response res = client.read(knownResourceId);
931 assertStatusCode(res, testName);
932 if (logger.isDebugEnabled()) {
933 logger.debug("got PersonAuthority to update with ID: " + knownResourceId);
935 input = new PoxPayloadIn(res.readEntity(String.class));
942 PersonauthoritiesCommon personAuthority = (PersonauthoritiesCommon) extractPart(input,
943 client.getCommonPartName(), PersonauthoritiesCommon.class);
944 Assert.assertNotNull(personAuthority);
946 // Update the contents of this resource.
947 personAuthority.setDisplayName("updated-" + personAuthority.getDisplayName());
948 personAuthority.setVocabType("updated-" + personAuthority.getVocabType());
949 if (logger.isDebugEnabled()) {
950 logger.debug("to be updated PersonAuthority");
951 logger.debug(objectAsXmlString(personAuthority, PersonauthoritiesCommon.class));
954 // Submit the updated resource to the service and store the response.
955 PoxPayloadOut output = new PoxPayloadOut(PersonAuthorityClient.SERVICE_PAYLOAD_NAME);
956 output.addPart(client.getCommonPartName(), personAuthority);
958 res = client.update(knownResourceId, output);
960 assertStatusCode(res, testName);
961 // Retrieve the updated resource and verify that its contents exist.
962 input = new PoxPayloadIn(res.readEntity(String.class));
969 PersonauthoritiesCommon updatedPersonAuthority =
970 (PersonauthoritiesCommon) extractPart(input,
971 client.getCommonPartName(), PersonauthoritiesCommon.class);
972 Assert.assertNotNull(updatedPersonAuthority);
974 // Verify that the updated resource received the correct data.
975 Assert.assertEquals(updatedPersonAuthority.getDisplayName(),
976 personAuthority.getDisplayName(),
977 "Data in updated object did not match submitted data.");
981 * Update item override -see immediate superclass.
983 * @param testName the test name
984 * @throws Exception the exception
987 public void updateItem(String testName) throws Exception {
988 // Retrieve the contents of a resource to update.
989 PersonAuthorityClient client = new PersonAuthorityClient();
990 PoxPayloadIn input = null;
992 Response res = client.readItem(knownResourceId, knownItemResourceId);
994 assertStatusCode(res, testName);
995 if (logger.isDebugEnabled()) {
996 logger.debug("got Person to update with ID: "
997 + knownItemResourceId
998 + " in PersonAuthority: " + knownResourceId);
1000 input = new PoxPayloadIn(res.readEntity(String.class));
1007 PersonsCommon person = (PersonsCommon) extractPart(input,
1008 client.getItemCommonPartName(), PersonsCommon.class);
1009 Assert.assertNotNull(person);
1011 if (logger.isDebugEnabled() == true) {
1012 logger.debug("About to update the following person...");
1013 logger.debug(objectAsXmlString(person, PersonsCommon.class));
1016 // Update the contents of this resource.
1017 person.setCsid(null);
1018 PersonTermGroupList termList = person.getPersonTermGroupList();
1019 Assert.assertNotNull(termList);
1020 List<PersonTermGroup> terms = termList.getPersonTermGroup();
1021 Assert.assertNotNull(terms);
1022 Assert.assertTrue(terms.size() > 0);
1023 String foreName = terms.get(0).getForeName();
1024 String updatedForeName = "updated-" + foreName;
1025 terms.get(0).setForeName(updatedForeName);
1026 if (logger.isDebugEnabled()) {
1027 logger.debug("to be updated Person");
1028 logger.debug(objectAsXmlString(person,
1029 PersonsCommon.class));
1032 // Submit the updated resource to the service and store the response.
1033 PoxPayloadOut output = new PoxPayloadOut(PersonAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
1034 output.addPart(client.getItemCommonPartName(), person);
1036 res = client.updateItem(knownResourceId, knownItemResourceId, output);
1038 assertStatusCode(res, testName);
1039 // Retrieve the updated resource and verify that its contents exist.
1040 input = new PoxPayloadIn(res.readEntity(String.class));
1047 PersonsCommon updatedPerson =
1048 (PersonsCommon) extractPart(input,
1049 client.getItemCommonPartName(), PersonsCommon.class);
1050 Assert.assertNotNull(updatedPerson);
1052 if (logger.isDebugEnabled() == true) {
1053 logger.debug("Updated to following person to:");
1054 logger.debug(objectAsXmlString(updatedPerson, PersonsCommon.class));
1057 // Verify that the updated resource received the correct data.
1058 PersonTermGroupList updatedTermList = person.getPersonTermGroupList();
1059 Assert.assertNotNull(updatedTermList);
1060 List<PersonTermGroup> updatedTerms = termList.getPersonTermGroup();
1061 Assert.assertNotNull(updatedTerms);
1062 Assert.assertEquals(updatedTerms.get(0).getForeName(), updatedForeName,
1063 "Data in updated Person did not match submitted data.");
1069 * @param testName the test name
1070 * @throws Exception the exception
1072 @Test(dataProvider = "testName", groups = {"update"},
1073 dependsOnMethods = {"readContact", "testContactSubmitRequest",
1074 "org.collectionspace.services.client.test.AbstractAuthorityServiceTest.updateItem"})
1075 public void updateContact(String testName) throws Exception {
1076 String contactsCommonLabel = new ContactClient().getCommonPartName();
1078 // Retrieve the contents of a resource to update.
1079 PersonAuthorityClient client = new PersonAuthorityClient();
1080 PoxPayloadIn input = null;
1082 Response res = client.readContact(knownResourceId, knownItemResourceId,
1083 knownContactResourceId);
1085 assertStatusCode(res, testName);
1086 if (logger.isDebugEnabled()) {
1087 logger.debug("got Contact to update with ID: "
1088 + knownContactResourceId
1089 + " in item: " + knownItemResourceId
1090 + " in parent: " + knownResourceId);
1092 input = new PoxPayloadIn(res.readEntity(String.class));
1099 ContactsCommon contact = (ContactsCommon) extractPart(input,
1100 contactsCommonLabel, ContactsCommon.class);
1101 Assert.assertNotNull(contact);
1103 // Verify the contents of this resource
1104 AddressGroupList addressGroupList = contact.getAddressGroupList();
1105 Assert.assertNotNull(addressGroupList);
1106 List<AddressGroup> addressGroups = addressGroupList.getAddressGroup();
1107 Assert.assertNotNull(addressGroups);
1108 Assert.assertTrue(addressGroups.size() > 0);
1109 String addressPlace1 = addressGroups.get(0).getAddressPlace1();
1110 Assert.assertNotNull(addressPlace1);
1112 // Update the contents of this resource.
1113 addressGroups.get(0).setAddressPlace1("updated-" + addressPlace1);
1114 contact.setAddressGroupList(addressGroupList);
1115 if (logger.isDebugEnabled()) {
1116 logger.debug("to be updated Contact");
1117 logger.debug(objectAsXmlString(contact,
1118 ContactsCommon.class));
1121 // Submit the updated resource to the service and store the response.
1122 PoxPayloadOut output = new PoxPayloadOut(ContactClient.SERVICE_PAYLOAD_NAME);
1123 output.addPart(contactsCommonLabel, contact);
1125 res = client.updateContact(knownResourceId, knownItemResourceId, knownContactResourceId, output);
1127 assertStatusCode(res, testName);
1128 // Retrieve the updated resource and verify that its contents exist.
1129 input = new PoxPayloadIn(res.readEntity(String.class));;
1135 ContactsCommon updatedContact = (ContactsCommon) extractPart(input,
1136 contactsCommonLabel, ContactsCommon.class);
1137 Assert.assertNotNull(updatedContact);
1139 // Verify that the updated resource received the correct data.
1140 Assert.assertEquals(updatedContact.getAddressGroupList().getAddressGroup().get(0).getAddressPlace1(),
1141 contact.getAddressGroupList().getAddressGroup().get(0).getAddressPlace1(),
1142 "Data in updated object did not match submitted data.");
1146 * Update non existent contact.
1148 * @param testName the test name
1149 * @throws Exception the exception
1151 @Test(dataProvider = "testName", groups = {"update"},
1152 dependsOnMethods = {"updateContact", "testContactSubmitRequest"})
1153 public void updateNonExistentContact(String testName) throws Exception {
1154 // Currently a no-op test
1157 // ---------------------------------------------------------------
1158 // CRUD tests : DELETE tests
1159 // ---------------------------------------------------------------
1161 // Note: delete sub-resources in ascending hierarchical order,
1162 // before deleting their parents.
1166 * @param testName the test name
1167 * @throws Exception the exception
1169 @Test(dataProvider = "testName", groups = {"delete"},
1170 dependsOnMethods = {"updateContact"})
1171 public void deleteContact(String testName) throws Exception {
1172 if (logger.isDebugEnabled()) {
1173 logger.debug("parentcsid =" + knownResourceId
1174 + " itemcsid = " + knownItemResourceId
1175 + " csid = " + knownContactResourceId);
1178 // Submit the request to the service and store the response.
1179 PersonAuthorityClient client = new PersonAuthorityClient();
1181 Response res = client.deleteContact(knownResourceId, knownItemResourceId,
1182 knownContactResourceId);
1184 assertStatusCode(res, testName);
1193 public void delete(String testName) throws Exception {
1194 // Do nothing. See localDelete(). This ensure proper test order.
1197 @Test(dataProvider = "testName", dependsOnMethods = {"localDeleteItem"})
1198 public void localDelete(String testName) throws Exception {
1199 super.delete(testName);
1203 public void deleteItem(String testName) throws Exception {
1204 // Do nothing. We need to wait until after the test "localDelete" gets run. When it does,
1205 // its dependencies will get run first and then we can call the base class' delete method.
1208 @Test(dataProvider = "testName", groups = {"delete"},
1209 dependsOnMethods = {"verifyIllegalItemDisplayName", "testContactSubmitRequest", "deleteContact"})
1210 public void localDeleteItem(String testName) throws Exception {
1211 super.deleteItem(testName);
1215 * Delete non existent contact.
1217 * @param testName the test name
1219 @Test(dataProvider = "testName", groups = {"delete"},
1220 dependsOnMethods = {"deleteContact"})
1221 public void deleteNonExistentContact(String testName) {
1222 // Submit the request to the service and store the response.
1223 PersonAuthorityClient client = new PersonAuthorityClient();
1224 setupDeleteNonExistent();
1225 Response res = client.deleteContact(knownResourceId, knownItemResourceId, NON_EXISTENT_ID);
1227 assertStatusCode(res, testName);
1236 * Test contact submit request.
1238 @Test(dataProvider = "testName",
1239 dependsOnMethods = {"createContact", "readContact", "testItemSubmitRequest"})
1240 public void testContactSubmitRequest(String testName) {
1242 // Expected status code: 200 OK
1243 final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
1245 // Submit the request to the service and store the response.
1246 String method = ServiceRequestType.READ.httpMethodName();
1247 String url = getContactResourceURL(knownResourceId,
1248 knownItemResourceId, knownContactResourceId);
1249 int statusCode = submitRequest(method, url);
1251 // Check the status code of the response: does it match
1252 // the expected response(s)?
1253 if (logger.isDebugEnabled()) {
1254 logger.debug("testContactSubmitRequest: url=" + url
1255 + " status=" + statusCode);
1257 Assert.assertEquals(statusCode, EXPECTED_STATUS);
1261 // ---------------------------------------------------------------
1262 // Cleanup of resources created during testing
1263 // ---------------------------------------------------------------
1265 * Deletes all resources created by tests, after all tests have been run.
1267 * This cleanup method will always be run, even if one or more tests fail.
1268 * For this reason, it attempts to remove all resources created
1269 * at any point during testing, even if some of those resources
1270 * may be expected to be deleted by certain tests.
1272 @AfterClass(alwaysRun = true)
1274 public void cleanUp() {
1275 String noTest = System.getProperty("noTestCleanup");
1276 if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
1277 if (logger.isDebugEnabled()) {
1278 logger.debug("Skipping Cleanup phase ...");
1283 if (logger.isDebugEnabled()) {
1284 logger.debug("Cleaning up temporary resources created for testing ...");
1287 String parentResourceId;
1288 String itemResourceId;
1289 String contactResourceId;
1290 // Clean up contact resources.
1291 PersonAuthorityClient client = new PersonAuthorityClient();
1292 parentResourceId = this.getKnowResourceId();
1293 for (Map.Entry<String, String> entry : allContactResourceIdsCreated.entrySet()) {
1294 contactResourceId = entry.getKey();
1295 itemResourceId = entry.getValue();
1296 // Note: Any non-success responses from the delete operation
1297 // below are ignored and not reported.
1298 Response res = client.deleteContact(parentResourceId, itemResourceId,
1303 // Finally, clean call our superclass' cleanUp method.
1308 // ---------------------------------------------------------------
1309 // Utility methods used by tests above
1310 // ---------------------------------------------------------------
1312 * Gets the contact service path component.
1314 * @return the contact service path component
1316 public String getContactServicePathComponent() {
1317 return ContactClient.SERVICE_PATH_COMPONENT;
1321 * Returns the root URL for the item service.
1323 * This URL consists of a base URL for all services, followed by
1324 * a path component for the owning parent, followed by the
1325 * path component for the items.
1327 * @param parentResourceIdentifier An identifier (such as a UUID) for the
1328 * parent authority resource of the relevant item resource.
1330 * @return The root URL for the item service.
1332 protected String getItemServiceRootURL(String parentResourceIdentifier) {
1333 return getResourceURL(parentResourceIdentifier) + "/" + getItemServicePathComponent();
1337 * Returns the URL of a specific item resource managed by a service, and
1338 * designated by an identifier (such as a universally unique ID, or UUID).
1340 * @param parentResourceIdentifier An identifier (such as a UUID) for the
1341 * parent authority resource of the relevant item resource.
1343 * @param itemResourceIdentifier An identifier (such as a UUID) for an
1346 * @return The URL of a specific item resource managed by a service.
1348 protected String getItemResourceURL(String parentResourceIdentifier, String itemResourceIdentifier) {
1349 return getItemServiceRootURL(parentResourceIdentifier) + "/" + itemResourceIdentifier;
1353 * Returns the root URL for the contact service.
1355 * This URL consists of a base URL for all services, followed by
1356 * a path component for the owning authority, followed by the
1357 * path component for the owning item, followed by the path component
1358 * for the contact service.
1360 * @param parentResourceIdentifier An identifier (such as a UUID) for the
1361 * parent authority resource of the relevant item resource.
1363 * @param itemResourceIdentifier An identifier (such as a UUID) for an
1366 * @return The root URL for the contact service.
1368 protected String getContactServiceRootURL(String parentResourceIdentifier,
1369 String itemResourceIdentifier) {
1370 return getItemResourceURL(parentResourceIdentifier, itemResourceIdentifier) + "/"
1371 + getContactServicePathComponent();
1375 * Returns the URL of a specific contact resource managed by a service, and
1376 * designated by an identifier (such as a universally unique ID, or UUID).
1378 * @param parentResourceIdentifier An identifier (such as a UUID) for the
1379 * parent resource of the relevant item resource.
1381 * @param resourceIdentifier An identifier (such as a UUID) for an
1384 * @return The URL of a specific resource managed by a service.
1386 protected String getContactResourceURL(String parentResourceIdentifier,
1387 String itemResourceIdentifier, String contactResourceIdentifier) {
1388 return getContactServiceRootURL(parentResourceIdentifier,
1389 itemResourceIdentifier) + "/" + contactResourceIdentifier;
1393 public void authorityTests(String testName) {
1394 // TODO Auto-generated method stub
1399 protected PersonsCommon updateItemInstance(PersonsCommon personsCommon) {
1401 PersonTermGroupList termList = personsCommon.getPersonTermGroupList();
1402 Assert.assertNotNull(termList);
1403 List<PersonTermGroup> terms = termList.getPersonTermGroup();
1404 Assert.assertNotNull(terms);
1405 Assert.assertTrue(terms.size() > 0);
1406 terms.get(0).setTermDisplayName("updated-" + terms.get(0).getTermDisplayName());
1407 terms.get(0).setTermName("updated-" + terms.get(0).getTermName());
1408 personsCommon.setPersonTermGroupList(termList);
1410 return personsCommon;
1414 protected void compareUpdatedItemInstances(PersonsCommon original,
1415 PersonsCommon updated) throws Exception {
1417 PersonTermGroupList originalTermList = original.getPersonTermGroupList();
1418 Assert.assertNotNull(originalTermList);
1419 List<PersonTermGroup> originalTerms = originalTermList.getPersonTermGroup();
1420 Assert.assertNotNull(originalTerms);
1421 Assert.assertTrue(originalTerms.size() > 0);
1423 PersonTermGroupList updatedTermList = updated.getPersonTermGroupList();
1424 Assert.assertNotNull(updatedTermList);
1425 List<PersonTermGroup> updatedTerms = updatedTermList.getPersonTermGroup();
1426 Assert.assertNotNull(updatedTerms);
1427 Assert.assertTrue(updatedTerms.size() > 0);
1429 Assert.assertEquals(updatedTerms.get(0).getTermDisplayName(),
1430 originalTerms.get(0).getTermDisplayName(),
1431 "Value in updated record did not match submitted data.");
1435 protected PoxPayloadOut createInstance(String commonPartName,
1436 String identifier) {
1437 String shortId = identifier;
1438 String displayName = "displayName-" + shortId;
1439 PoxPayloadOut result =
1440 PersonAuthorityClientUtils.createPersonAuthorityInstance(
1441 displayName, shortId, commonPartName);
1446 protected PoxPayloadOut createNonExistenceInstance(String commonPartName,
1447 String identifier) {
1448 String displayName = "displayName-NON_EXISTENT_ID";
1449 PoxPayloadOut result = PersonAuthorityClientUtils.createPersonAuthorityInstance(
1450 displayName, "NON_EXISTENT_SHORT_ID", commonPartName);
1454 protected PoxPayloadOut createNonExistenceItemInstance(String commonPartName, String identifier) {
1455 Map<String, String> nonexMap = new HashMap<String, String>();
1456 nonexMap.put(PersonJAXBSchema.SHORT_IDENTIFIER, "nonEX");
1457 nonexMap.put(PersonJAXBSchema.GENDER, "male");
1459 List<PersonTermGroup> terms = new ArrayList<PersonTermGroup>();
1460 PersonTermGroup term = new PersonTermGroup();
1461 term.setTermDisplayName("John Wayne");
1462 term.setTermName("John Wayne");
1463 term.setForeName("John");
1464 term.setSurName("Wayne");
1467 Map<String, List<String>> nonexRepeatablesMap = new HashMap<String, List<String>>();
1468 PoxPayloadOut result =
1469 PersonAuthorityClientUtils.createPersonInstance(NON_EXISTENT_ID,
1470 null, //PersonAuthorityClientUtils.createPersonAuthRefName(NON_EXISTENT_ID, null),
1471 nonexMap, terms, nonexRepeatablesMap, commonPartName);
1476 protected PersonauthoritiesCommon updateInstance(PersonauthoritiesCommon personauthoritiesCommon) {
1477 PersonauthoritiesCommon result = new PersonauthoritiesCommon();
1479 result.setDisplayName("updated-" + personauthoritiesCommon.getDisplayName());
1480 result.setVocabType("updated-" + personauthoritiesCommon.getVocabType());
1486 protected void compareUpdatedInstances(PersonauthoritiesCommon original,
1487 PersonauthoritiesCommon updated) throws Exception {
1488 // Verify that the updated resource received the correct data.
1489 Assert.assertEquals(updated.getDisplayName(),
1490 original.getDisplayName(),
1491 "Display name in updated object did not match submitted data.");
1495 protected void verifyReadItemInstance(PersonsCommon item) throws Exception {
1496 // Do nothing for now. Add more 'read' validation checks here if applicable.