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.PayloadOutputPart;
36 import org.collectionspace.services.client.PoxPayloadIn;
37 import org.collectionspace.services.client.PoxPayloadOut;
38 import org.collectionspace.services.client.ContactClient;
39 import org.collectionspace.services.client.ContactClientUtils;
40 import org.collectionspace.services.contact.AddressGroup;
41 import org.collectionspace.services.contact.AddressGroupList;
42 import org.collectionspace.services.contact.ContactsCommon;
43 import org.collectionspace.services.client.PersonAuthorityClient;
44 import org.collectionspace.services.client.PersonAuthorityClientUtils;
45 import org.collectionspace.services.jaxb.AbstractCommonList;
46 import org.collectionspace.services.PersonJAXBSchema;
47 import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;
48 import org.collectionspace.services.person.PersonauthoritiesCommon;
49 import org.collectionspace.services.person.PersonTermGroup;
50 import org.collectionspace.services.person.PersonTermGroupList;
51 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 public String getServicePathComponent() {
73 return PersonAuthorityClient.SERVICE_PATH_COMPONENT;
77 protected String getServiceName() {
78 return PersonAuthorityClient.SERVICE_NAME;
81 public String getItemServicePathComponent() {
82 return AuthorityClient.ITEMS;
84 /** The test forename. */
85 final String TEST_FORE_NAME = "John";
86 /** The test middle name. */
87 final String TEST_MIDDLE_NAME = null;
88 /** The test surname. */
89 final String TEST_SUR_NAME = "Wayne";
90 /** The test birthdate. */
91 final String TEST_BIRTH_DATE = "May 26, 1907";
92 /** The test death date. */
93 final String TEST_DEATH_DATE = "June 11, 1979";
94 //private String knownResourceRefName = null;
95 private String knownItemResourceShortIdentifer = null;
96 // The resource ID of an item resource used for partial term matching tests.
97 private String knownItemPartialTermResourceId = null;
98 /** The known contact resource id. */
99 private String knownContactResourceId = null;
100 /** The all contact resource ids created. */
101 private Map<String, String> allContactResourceIdsCreated =
102 new HashMap<String, String>();
104 protected void setKnownResource(String id, String shortIdentifer,
106 knownResourceId = id;
107 knownResourceShortIdentifer = shortIdentifer;
108 //knownResourceRefName = refName;
111 protected void setKnownItemResource(String id, String shortIdentifer) {
112 knownItemResourceId = id;
113 knownItemResourceShortIdentifer = shortIdentifer;
117 * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
120 protected CollectionSpaceClient getClientInstance() {
121 return new PersonAuthorityClient();
125 protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
126 return new PersonAuthorityClient(clientPropertiesFilename);
129 // ---------------------------------------------------------------
130 // CRUD tests : CREATE tests
131 // ---------------------------------------------------------------
134 * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
137 public void create(String testName) throws Exception {
138 // Perform setup, such as initializing the type of service request
139 // (e.g. CREATE, DELETE), its valid and expected status codes, and
140 // its associated HTTP method name (e.g. POST, DELETE).
143 // Submit the request to the service and store the response.
144 PersonAuthorityClient client = new PersonAuthorityClient();
145 String shortId = createIdentifier();
146 String displayName = "displayName-" + shortId;
147 //String baseRefName = PersonAuthorityClientUtils.createPersonAuthRefName(shortId, null);
148 PoxPayloadOut multipart =
149 PersonAuthorityClientUtils.createPersonAuthorityInstance(
150 displayName, shortId, client.getCommonPartName());
153 Response res = client.create(multipart);
155 assertStatusCode(res, testName);
156 newID = extractId(res);
162 // Save values for additional tests
163 if (knownResourceId == null) {
164 setKnownResource(newID, shortId, null ); //baseRefName);
165 if (logger.isDebugEnabled()) {
166 logger.debug(testName + ": knownResourceId=" + knownResourceId);
169 // Store the IDs from every resource created by tests,
170 // so they can be deleted after tests have been run.
171 allResourceIdsCreated.add(newID);
175 protected PoxPayloadOut createInstance(String identifier) {
176 PersonAuthorityClient client = new PersonAuthorityClient();
177 String displayName = "displayName-" + identifier;
178 PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
179 displayName, identifier, client.getCommonPartName());
184 protected PoxPayloadOut createItemInstance(String parentCsid, String identifier) {
185 String headerLabel = new PersonAuthorityClient().getItemCommonPartName();
187 HashMap<String, String> personInfo = new HashMap<String, String>();
188 String shortId = "MarkTwainAuthor" + identifier;
189 personInfo.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId);
191 List<PersonTermGroup> terms = new ArrayList<PersonTermGroup>();
192 PersonTermGroup term = new PersonTermGroup();
193 term.setTermDisplayName("Mark Twain Primary");
194 term.setTermName("MarkTwainPrimary");
197 term = new PersonTermGroup();
198 term.setTermDisplayName("Samuel Langhorne Clemens");
199 term.setTermName("SamuelLanghorneClemens");
202 term = new PersonTermGroup();
203 term.setTermDisplayName("Sam Clemens");
204 term.setTermName("SamClemens");
207 term = new PersonTermGroup();
208 term.setTermDisplayName("Huck Fin");
209 term.setTermName("Huck Fin");
212 return PersonAuthorityClientUtils.createPersonInstance(parentCsid, identifier, personInfo, terms, headerLabel);
216 protected String createItemInAuthority(AuthorityClient client, String vcsid) {
217 String shortId = "johnWayneActor" + System.currentTimeMillis() + random.nextInt();; // short ID needs to be unique
218 return this.createItemInAuthority(client, vcsid, shortId);
222 * Creates an item in an authority, using test data.
224 * @param vcsid the vcsid
225 * @param authRefName the auth ref name
229 protected String createItemInAuthority(AuthorityClient client, String vcsid, String shortId) {
231 final String testName = "createItemInAuthority";
232 if (logger.isDebugEnabled()) {
233 logger.debug(testName + ":" + vcsid + "...");
236 Map<String, String> johnWayneMap = new HashMap<String, String>();
238 // Fill the property map
240 johnWayneMap.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId);
241 johnWayneMap.put(PersonJAXBSchema.GENDER, "male");
242 johnWayneMap.put(PersonJAXBSchema.BIRTH_DATE, TEST_BIRTH_DATE);
243 johnWayneMap.put(PersonJAXBSchema.BIRTH_PLACE, "Winterset, Iowa");
244 johnWayneMap.put(PersonJAXBSchema.DEATH_DATE, TEST_DEATH_DATE);
245 johnWayneMap.put(PersonJAXBSchema.BIO_NOTE, "born Marion Robert Morrison and better"
246 + "known by his stage name John Wayne, was an American film actor, director "
247 + "and producer. He epitomized rugged masculinity and has become an enduring "
248 + "American icon. He is famous for his distinctive voice, walk and height. "
249 + "He was also known for his conservative political views and his support in "
250 + "the 1950s for anti-communist positions.");
252 List<PersonTermGroup> johnWayneTerms = new ArrayList<PersonTermGroup>();
253 PersonTermGroup term = new PersonTermGroup();
254 term.setTermDisplayName("John Wayne DisplayName");
255 term.setTermName("John Wayne");
256 term.setForeName(TEST_FORE_NAME);
257 term.setSurName(TEST_SUR_NAME);
258 johnWayneTerms.add(term);
260 Map<String, List<String>> johnWayneRepeatablesMap = new HashMap<String, List<String>>();
261 List<String> johnWayneGroups = new ArrayList<String>();
262 johnWayneGroups.add("Irish");
263 johnWayneGroups.add("Scottish");
264 johnWayneRepeatablesMap.put(PersonJAXBSchema.GROUPS, johnWayneGroups);
266 return createItemInAuthority(client, vcsid, null /*authRefName*/, shortId, johnWayneMap, johnWayneTerms, johnWayneRepeatablesMap);
271 * Creates an item in an authority.
273 * @param vcsid the vcsid
274 * @param authRefName the auth ref name
275 * @param itemFieldProperties a set of properties specifying the values of fields.
276 * @param itemRepeatableFieldProperties a set of properties specifying the values of repeatable fields.
279 private String createItemInAuthority(AuthorityClient client, String vcsid, String authRefName, String shortId,
280 Map itemFieldProperties, List<PersonTermGroup> terms, Map itemRepeatableFieldProperties) {
282 final String testName = "createItemInAuthority";
283 if (logger.isDebugEnabled()) {
284 logger.debug(testName + ":" + vcsid + "...");
287 // Submit the request to the service and store the response.
288 if (client == null) {
289 client = new PersonAuthorityClient();
291 PoxPayloadOut multipart =
292 PersonAuthorityClientUtils.createPersonInstance(vcsid, null /*authRefName*/, itemFieldProperties,
293 terms, itemRepeatableFieldProperties, client.getItemCommonPartName());
295 Response res = client.createItem(vcsid, multipart);
298 assertStatusCode(res, testName);
299 newID = PersonAuthorityClientUtils.extractId(res);
306 // Store the ID returned from the first item resource created
307 // for additional tests below.
308 if (knownItemResourceId == null) {
309 setKnownItemResource(newID, shortId);
310 if (logger.isDebugEnabled()) {
311 logger.debug(testName + ": knownItemResourceId=" + knownItemResourceId);
315 if (logger.isDebugEnabled()) {
316 logger.debug(testName + " (created):" + vcsid + "/(" + newID + "," + shortId + ")");
319 // Store the IDs from any item resources created
320 // by tests, along with the IDs of their parents, so these items
321 // can be deleted after all tests have been run.
322 allResourceItemIdsCreated.put(newID, vcsid);
328 * Creates the contact.
330 * @param testName the test name
332 @Test(dataProvider = "testName", groups = {"create"},
333 dependsOnMethods = {"createItem"})
334 public void createContact(String testName) {
336 String newID = createContactInItem(knownResourceId, knownItemResourceId);
340 * Creates the contact in item.
342 * @param parentcsid the parentcsid
343 * @param itemcsid the itemcsid
346 private String createContactInItem(String parentcsid, String itemcsid) {
348 final String testName = "createContactInItem";
349 if (logger.isDebugEnabled()) {
350 logger.debug(testName + ":...");
352 // Submit the request to the service and store the response.
353 PersonAuthorityClient client = new PersonAuthorityClient();
354 String identifier = createIdentifier();
355 PoxPayloadOut multipart = ContactClientUtils.createContactInstance(parentcsid,
356 itemcsid, identifier, new ContactClient().getCommonPartName());
359 Response res = client.createContact(parentcsid, itemcsid, multipart);
362 assertStatusCode(res, testName);
363 newID = PersonAuthorityClientUtils.extractId(res);
370 // Store the ID returned from the first contact resource created
371 // for additional tests below.
372 if (knownContactResourceId == null) {
373 knownContactResourceId = newID;
374 if (logger.isDebugEnabled()) {
375 logger.debug(testName + ": knownContactResourceId=" + knownContactResourceId);
379 // Store the IDs from any contact resources created
380 // by tests, along with the IDs of their parent items,
381 // so these items can be deleted after all tests have been run.
382 allContactResourceIdsCreated.put(newID, itemcsid);
388 * Attempts to create an authority with an short identifier that contains
389 * non-word characters.
391 * @param testName the test name
393 @Test(dataProvider = "testName", groups = {"create", "nonWordCharsInShortId"})
394 public void createWithShortIdNonWordChars(String testName) throws Exception {
395 testExpectedStatusCode = STATUS_BAD_REQUEST;
396 testRequestType = ServiceRequestType.CREATE;
397 testSetup(testExpectedStatusCode, testRequestType);
399 // Create the payload to be included in the body of the request
400 PersonAuthorityClient client = new PersonAuthorityClient();
401 String shortId = createIdentifier() + "*" + createIdentifier();
402 String displayName = "displayName-" + shortId;
403 PoxPayloadOut multipart =
404 PersonAuthorityClientUtils.createPersonAuthorityInstance(
405 displayName, shortId, client.getCommonPartName());
407 // Submit the request to the service and store the response.
408 Response res = client.create(multipart);
410 // Check the status code of the response: does it match
411 // the expected response(s)? We expect failure here.
413 assertStatusCode(res, testName);
422 * Attempts to create an item with an short identifier that contains
423 * non-word characters.
425 * @param testName the test name
427 @Test(dataProvider = "testName", groups = {"create", "nonWordCharsInShortId"},
428 dependsOnMethods = {"org.collectionspace.services.client.test.AbstractServiceTestImpl.create"})
429 public void createItemWithShortIdNonWordChars(String testName) {
430 testExpectedStatusCode = STATUS_BAD_REQUEST;
431 testRequestType = ServiceRequestType.CREATE;
432 testSetup(testExpectedStatusCode, testRequestType);
434 PersonAuthorityClient client = new PersonAuthorityClient();
435 // Create the payload to be included in the body of the request
436 String shortId = "7-Eleven";
437 Map<String, String> fieldProperties = new HashMap<String, String>();
438 fieldProperties.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId);
440 List<PersonTermGroup> terms = new ArrayList<PersonTermGroup>();
441 PersonTermGroup term = new PersonTermGroup();
442 term.setTermDisplayName(shortId);
443 term.setTermName(shortId);
446 final Map NULL_REPEATABLE_FIELD_PROPERTIES = null;
447 PoxPayloadOut multipart =
448 PersonAuthorityClientUtils.createPersonInstance(knownResourceId,
449 null /*knownResourceRefName*/, fieldProperties, terms,
450 NULL_REPEATABLE_FIELD_PROPERTIES, client.getItemCommonPartName());
452 // Send the request and receive a response
453 Response res = client.createItem(knownResourceId, multipart);
455 // Check the status code of the response: does it match
456 // the expected response(s)? We expect failure here, so there will be no
457 // new ID to keep track of for later cleanup.
459 assertStatusCode(res, testName);
467 // ---------------------------------------------------------------
468 // CRUD tests : CREATE LIST tests
469 // ---------------------------------------------------------------
472 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
475 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
476 // groups = {"createList"}, dependsOnGroups = {"create"})
477 public void createList(String testName) throws Exception {
478 for (int i = 0; i < nItemsToCreateInList; i++) {
484 * Creates the contact list.
486 * @param testName the test name
487 * @throws Exception the exception
489 @Test(dataProvider = "testName", groups = {"createList"},
490 dependsOnMethods = {"org.collectionspace.services.client.test.AbstractAuthorityServiceTest.createItemList"})
491 public void createContactList(String testName) throws Exception {
492 // Add contacts to the initially-created, known item record.
493 for (int j = 0; j < nItemsToCreateInList; j++) {
494 createContact(testName);
498 // ---------------------------------------------------------------
499 // CRUD tests : READ tests
500 // ---------------------------------------------------------------
503 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
506 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
507 // groups = {"read"}, dependsOnGroups = {"create"})
508 public void read(String testName) throws Exception {
509 readInternal(testName, knownResourceId, null);
515 * @param testName the test name
516 * @throws Exception the exception
519 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
520 // groups = {"read"}, dependsOnMethods = {"read"})
521 public void readByName(String testName) throws Exception {
522 readInternal(testName, null, knownResourceShortIdentifer);
525 protected void readInternal(String testName, String CSID, String shortId) {
526 // Submit the request to the service and store the response.
527 PersonAuthorityClient client = new PersonAuthorityClient();
531 res = client.read(CSID);
532 } else if (shortId != null) {
533 res = client.readByName(shortId);
535 Assert.fail("readInternal: Internal error. One of CSID or shortId must be non-null");
538 assertStatusCode(res, testName);
539 //FIXME: remove the following try catch once Aron fixes signatures
541 PoxPayloadIn input = new PoxPayloadIn(res.readEntity(String.class));
542 PersonauthoritiesCommon personAuthority = (PersonauthoritiesCommon) extractPart(input,
543 client.getCommonPartName(), PersonauthoritiesCommon.class);
544 Assert.assertNotNull(personAuthority);
545 } catch (Exception e) {
546 throw new RuntimeException(e);
558 * @param testName the test name
559 * @throws Exception the exception
561 @Test(dataProvider = "testName", groups = {"readItem", "readNamedItemInNamedAuth"},
562 dependsOnMethods = {"readItemInNamedAuth"})
563 public void readNamedItem(String testName) throws Exception {
564 readItemInternal(testName, knownResourceId, null, null, knownItemResourceShortIdentifer);
568 * Read item in Named Auth.
570 * @param testName the test name
571 * @throws Exception the exception
573 @Test(dataProvider = "testName", groups = {"readItem"},
574 dependsOnMethods = {"readItem"})
575 public void readItemInNamedAuth(String testName) throws Exception {
576 readItemInternal(testName, null, knownResourceShortIdentifer, knownItemResourceId, null);
581 * Read Named item in Named Auth.
583 * @param testName the test name
584 * @throws Exception the exception
586 @Test(dataProvider = "testName", groups = {"readItem"},
587 dependsOnMethods = {"readNamedItem"})
588 public void readNamedItemInNamedAuth(String testName) throws Exception {
589 readItemInternal(testName, null, knownResourceShortIdentifer, null, knownItemResourceShortIdentifer);
592 protected void readItemInternal(String testName,
593 String authCSID, String authShortId, String itemCSID, String itemShortId)
596 if (logger.isDebugEnabled()) {
597 logger.debug("Reading:" + ((authCSID != null) ? authCSID : authShortId) + "/"
598 + ((itemCSID != null) ? authCSID : itemShortId));
601 // Submit the request to the service and store the response.
602 PersonAuthorityClient client = new PersonAuthorityClient();
605 if (authCSID != null) {
606 if (itemCSID != null) {
607 res = client.readItem(authCSID, itemCSID);
608 } else if (itemShortId != null) {
609 res = client.readNamedItem(authCSID, itemShortId);
611 Assert.fail("readInternal: Internal error. One of CSID or shortId must be non-null");
613 } else if (authShortId != null) {
614 if (itemCSID != null) {
615 res = client.readItemInNamedAuthority(authShortId, itemCSID);
616 } else if (itemShortId != null) {
617 res = client.readNamedItemInNamedAuthority(authShortId, itemShortId);
619 Assert.fail("readInternal: Internal error. One of CSID or shortId must be non-null");
622 Assert.fail("readInternal: Internal error. One of authCSID or authShortId must be non-null");
626 assertStatusCode(res, testName);
627 // Check whether we've received a person.
628 PoxPayloadIn input = new PoxPayloadIn(res.readEntity(String.class));
629 PersonsCommon person = (PersonsCommon) extractPart(input,
630 client.getItemCommonPartName(), PersonsCommon.class);
631 Assert.assertNotNull(person);
632 boolean showFull = true;
633 if (showFull && logger.isDebugEnabled()) {
634 logger.debug(testName + ": returned payload:");
635 logger.debug(objectAsXmlString(person, PersonsCommon.class));
638 // Check that the person item is within the expected Person Authority.
639 Assert.assertEquals(person.getInAuthority(), knownResourceId);
641 // Verify the number and contents of values in a repeatable field,
642 // as created in the instance record used for testing.
643 List<String> groups = person.getGroups().getGroup();
644 Assert.assertTrue(groups.size() > 0);
645 Assert.assertNotNull(groups.get(0));
653 // Note: This test depends on server-side validation logic to require
654 // a non-null (and potentially, non-empty) displayname for each term,
655 // and will fail if that validation is not present.
658 * Verify illegal item display name.
660 * @param testName the test name
661 * @throws Exception the exception
663 @Test(dataProvider = "testName", groups = {"update"})
664 public void verifyIllegalItemDisplayName(String testName) throws Exception {
665 // Perform setup for read.
668 // Submit the request to the service and store the response.
669 PersonAuthorityClient client = new PersonAuthorityClient();
670 Response res = client.readItem(knownResourceId, knownItemResourceId);
671 PoxPayloadIn input = null;
673 assertStatusCode(res, testName);
674 input = new PoxPayloadIn(res.readEntity(String.class));
681 // Make an invalid UPDATE request, without a display name
683 PersonsCommon person = (PersonsCommon) extractPart(input,
684 client.getItemCommonPartName(), PersonsCommon.class);
685 Assert.assertNotNull(person);
686 // Try to Update with no displayName
687 PersonTermGroupList termList = person.getPersonTermGroupList();
688 Assert.assertNotNull(termList);
689 List<PersonTermGroup> terms = termList.getPersonTermGroup();
690 Assert.assertNotNull(terms);
691 Assert.assertTrue(terms.size() > 0);
692 terms.get(0).setTermDisplayName(null);
693 terms.get(0).setTermName(null);
695 // Submit the updated resource to the service and store the response.
696 PoxPayloadOut output = new PoxPayloadOut(PersonAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
697 PayloadOutputPart commonPart = output.addPart(client.getItemCommonPartName(), person);
698 setupUpdateWithInvalidBody();
699 res = client.updateItem(knownResourceId, knownItemResourceId, output);
701 assertStatusCode(res, testName);
712 * @param testName the test name
713 * @throws Exception the exception
715 @Test(dataProvider = "testName", groups = {"readItem"},
716 dependsOnMethods = {"createContact", "org.collectionspace.services.client.test.AbstractAuthorityServiceTest.readItem"})
717 public void readContact(String testName) throws Exception {
721 // Submit the request to the service and store the response.
722 PersonAuthorityClient client = new PersonAuthorityClient();
723 PoxPayloadIn input = null;
724 Response res = client.readContact(knownResourceId, knownItemResourceId,
725 knownContactResourceId);
727 assertStatusCode(res, testName);
728 // Check whether we've received a contact.
729 input = new PoxPayloadIn(res.readEntity(String.class));
736 ContactsCommon contact = (ContactsCommon) extractPart(input,
737 new ContactClient().getCommonPartName(), ContactsCommon.class);
738 Assert.assertNotNull(contact);
739 boolean showFull = true;
740 if (showFull && logger.isDebugEnabled()) {
741 logger.debug(testName + ": returned payload:");
742 logger.debug(objectAsXmlString(contact, ContactsCommon.class));
744 Assert.assertEquals(contact.getInAuthority(), knownResourceId);
745 Assert.assertEquals(contact.getInItem(), knownItemResourceId);
750 * Read contact non existent.
752 * @param testName the test name
754 @Test(dataProvider = "testName", groups = {"readItem"}, dependsOnMethods = {"readContact"})
755 public void readContactNonExistent(String testName) {
757 setupReadNonExistent();
759 // Submit the request to the service and store the response.
760 PersonAuthorityClient client = new PersonAuthorityClient();
761 Response res = client.readContact(knownResourceId, knownItemResourceId,
764 assertStatusCode(res, testName);
772 // ---------------------------------------------------------------
773 // CRUD tests : READ_LIST tests
774 // ---------------------------------------------------------------
777 * Read item list override -see immediate superclass.
780 public void readItemList(String testName) {
781 readItemList(knownAuthorityWithItems, null, testName);
785 * Read item list by authority name.
788 public void readItemListByName(String testName) {
789 readItemList(null, READITEMS_SHORT_IDENTIFIER, testName);
795 * @param vcsid the vcsid
796 * @param name the name
798 private void readItemList(String vcsid, String name, String testName) {
800 // Submit the request to the service and store the response.
801 PersonAuthorityClient client = new PersonAuthorityClient();
804 res = client.readItemList(vcsid, null, null);
805 } else if (name != null) {
806 res = client.readItemListForNamedAuthority(name, null, null);
808 Assert.fail("readItemList passed null csid and name!");
810 AbstractCommonList list = null;
812 assertStatusCode(res, testName);
813 list = res.readEntity(AbstractCommonList.class);
820 List<AbstractCommonList.ListItem> items = list.getListItem();
821 int nItemsReturned = items.size();
822 // There will be 'nItemsToCreateInList'
823 // items created by the createItemList test,
824 // all associated with the same parent resource.
825 int nExpectedItems = nItemsToCreateInList;
826 if (logger.isDebugEnabled()) {
827 logger.debug(testName + ": Expected "
828 + nExpectedItems + " items; got: " + nItemsReturned);
830 Assert.assertEquals(nItemsReturned, nExpectedItems);
832 for (AbstractCommonList.ListItem item : items) {
834 AbstractCommonListUtils.ListItemGetElementValue(item, AuthorityItemJAXBSchema.REF_NAME);
835 Assert.assertTrue((null != value), "Item refName is null!");
837 // Per CSPACE-5132, lists items still return a field named displayName,
838 // not termDisplayName, for backward compatibility.
839 // (The format of list items will change significantly in CSPACE-5134.)
841 AbstractCommonListUtils.ListItemGetElementValue(item, AuthorityItemJAXBSchema.TERM_DISPLAY_NAME);
842 Assert.assertTrue((null != value), "Item termDisplayName is null!");
844 if (logger.isTraceEnabled()) {
845 AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
852 @Test(groups = {"readList"},
853 dependsOnMethods = {"org.collectionspace.services.client.test.AbstractAuthorityServiceTest.readItemList"})
854 public void readContactList() {
855 readContactList(knownResourceId, knownItemResourceId);
861 * @param parentcsid the parentcsid
862 * @param itemcsid the itemcsid
864 private void readContactList(String parentcsid, String itemcsid) {
865 final String testName = "readContactList";
870 // Submit the request to the service and store the response.
871 PersonAuthorityClient client = new PersonAuthorityClient();
872 AbstractCommonList list = null;
873 Response res = client.readContactList(parentcsid, itemcsid);
875 assertStatusCode(res, testName);
876 list = res.readEntity(AbstractCommonList.class);
883 List<AbstractCommonList.ListItem> listitems =
885 int nItemsReturned = listitems.size();
886 // There will be one item created, associated with a
887 // known parent resource, by the createItem test.
889 // In addition, there will be 'nItemsToCreateInList'
890 // additional items created by the createItemList test,
891 // all associated with the same parent resource.
892 int nExpectedItems = nItemsToCreateInList + 1;
893 if (logger.isDebugEnabled()) {
894 logger.debug(testName + ": Expected "
895 + nExpectedItems + " items; got: " + nItemsReturned);
897 Assert.assertEquals(nItemsReturned, nExpectedItems);
899 // Optionally output additional data about list members for debugging.
900 boolean iterateThroughList = false;
901 if (iterateThroughList && logger.isDebugEnabled()) {
902 AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
907 // There are no failure outcome tests at present.
908 // ---------------------------------------------------------------
909 // CRUD tests : UPDATE tests
910 // ---------------------------------------------------------------
913 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
916 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
917 // groups = {"update"}, dependsOnGroups = {"readItem", "readList"})
918 public void update(String testName) throws Exception {
919 // Retrieve the contents of a resource to update.
920 PersonAuthorityClient client = new PersonAuthorityClient();
921 PoxPayloadIn input = null;
923 Response res = client.read(knownResourceId);
925 assertStatusCode(res, testName);
926 if (logger.isDebugEnabled()) {
927 logger.debug("got PersonAuthority to update with ID: " + knownResourceId);
929 input = new PoxPayloadIn(res.readEntity(String.class));
936 PersonauthoritiesCommon personAuthority = (PersonauthoritiesCommon) extractPart(input,
937 client.getCommonPartName(), PersonauthoritiesCommon.class);
938 Assert.assertNotNull(personAuthority);
940 // Update the contents of this resource.
941 personAuthority.setDisplayName("updated-" + personAuthority.getDisplayName());
942 personAuthority.setVocabType("updated-" + personAuthority.getVocabType());
943 if (logger.isDebugEnabled()) {
944 logger.debug("to be updated PersonAuthority");
945 logger.debug(objectAsXmlString(personAuthority, PersonauthoritiesCommon.class));
948 // Submit the updated resource to the service and store the response.
949 PoxPayloadOut output = new PoxPayloadOut(PersonAuthorityClient.SERVICE_PAYLOAD_NAME);
950 PayloadOutputPart commonPart = output.addPart(client.getCommonPartName(), personAuthority);
952 res = client.update(knownResourceId, output);
954 assertStatusCode(res, testName);
955 // Retrieve the updated resource and verify that its contents exist.
956 input = new PoxPayloadIn(res.readEntity(String.class));
963 PersonauthoritiesCommon updatedPersonAuthority =
964 (PersonauthoritiesCommon) extractPart(input,
965 client.getCommonPartName(), PersonauthoritiesCommon.class);
966 Assert.assertNotNull(updatedPersonAuthority);
968 // Verify that the updated resource received the correct data.
969 Assert.assertEquals(updatedPersonAuthority.getDisplayName(),
970 personAuthority.getDisplayName(),
971 "Data in updated object did not match submitted data.");
975 * Update item override -see immediate superclass.
977 * @param testName the test name
978 * @throws Exception the exception
981 public void updateItem(String testName) throws Exception {
982 // Retrieve the contents of a resource to update.
983 PersonAuthorityClient client = new PersonAuthorityClient();
984 PoxPayloadIn input = null;
986 Response res = client.readItem(knownResourceId, knownItemResourceId);
988 assertStatusCode(res, testName);
989 if (logger.isDebugEnabled()) {
990 logger.debug("got Person to update with ID: "
991 + knownItemResourceId
992 + " in PersonAuthority: " + knownResourceId);
994 input = new PoxPayloadIn(res.readEntity(String.class));
1001 PersonsCommon person = (PersonsCommon) extractPart(input,
1002 client.getItemCommonPartName(), PersonsCommon.class);
1003 Assert.assertNotNull(person);
1005 if (logger.isDebugEnabled() == true) {
1006 logger.debug("About to update the following person...");
1007 logger.debug(objectAsXmlString(person, PersonsCommon.class));
1010 // Update the contents of this resource.
1011 person.setCsid(null);
1012 PersonTermGroupList termList = person.getPersonTermGroupList();
1013 Assert.assertNotNull(termList);
1014 List<PersonTermGroup> terms = termList.getPersonTermGroup();
1015 Assert.assertNotNull(terms);
1016 Assert.assertTrue(terms.size() > 0);
1017 String foreName = terms.get(0).getForeName();
1018 String updatedForeName = "updated-" + foreName;
1019 terms.get(0).setForeName(updatedForeName);
1020 if (logger.isDebugEnabled()) {
1021 logger.debug("to be updated Person");
1022 logger.debug(objectAsXmlString(person,
1023 PersonsCommon.class));
1026 // Submit the updated resource to the service and store the response.
1027 PoxPayloadOut output = new PoxPayloadOut(PersonAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
1028 PayloadOutputPart commonPart = output.addPart(client.getItemCommonPartName(), person);
1030 res = client.updateItem(knownResourceId, knownItemResourceId, output);
1032 assertStatusCode(res, testName);
1033 // Retrieve the updated resource and verify that its contents exist.
1034 input = new PoxPayloadIn(res.readEntity(String.class));
1041 PersonsCommon updatedPerson =
1042 (PersonsCommon) extractPart(input,
1043 client.getItemCommonPartName(), PersonsCommon.class);
1044 Assert.assertNotNull(updatedPerson);
1046 if (logger.isDebugEnabled() == true) {
1047 logger.debug("Updated to following person to:");
1048 logger.debug(objectAsXmlString(updatedPerson, PersonsCommon.class));
1051 // Verify that the updated resource received the correct data.
1052 PersonTermGroupList updatedTermList = person.getPersonTermGroupList();
1053 Assert.assertNotNull(updatedTermList);
1054 List<PersonTermGroup> updatedTerms = termList.getPersonTermGroup();
1055 Assert.assertNotNull(updatedTerms);
1056 Assert.assertEquals(updatedTerms.get(0).getForeName(), updatedForeName,
1057 "Data in updated Person did not match submitted data.");
1063 * @param testName the test name
1064 * @throws Exception the exception
1066 @Test(dataProvider = "testName", groups = {"update"},
1067 dependsOnMethods = {"readContact", "testContactSubmitRequest",
1068 "org.collectionspace.services.client.test.AbstractAuthorityServiceTest.updateItem"})
1069 public void updateContact(String testName) throws Exception {
1070 String contactsCommonLabel = new ContactClient().getCommonPartName();
1072 // Retrieve the contents of a resource to update.
1073 PersonAuthorityClient client = new PersonAuthorityClient();
1074 PoxPayloadIn input = null;
1076 Response res = client.readContact(knownResourceId, knownItemResourceId,
1077 knownContactResourceId);
1079 assertStatusCode(res, testName);
1080 if (logger.isDebugEnabled()) {
1081 logger.debug("got Contact to update with ID: "
1082 + knownContactResourceId
1083 + " in item: " + knownItemResourceId
1084 + " in parent: " + knownResourceId);
1086 input = new PoxPayloadIn(res.readEntity(String.class));
1093 ContactsCommon contact = (ContactsCommon) extractPart(input,
1094 contactsCommonLabel, ContactsCommon.class);
1095 Assert.assertNotNull(contact);
1097 // Verify the contents of this resource
1098 AddressGroupList addressGroupList = contact.getAddressGroupList();
1099 Assert.assertNotNull(addressGroupList);
1100 List<AddressGroup> addressGroups = addressGroupList.getAddressGroup();
1101 Assert.assertNotNull(addressGroups);
1102 Assert.assertTrue(addressGroups.size() > 0);
1103 String addressPlace1 = addressGroups.get(0).getAddressPlace1();
1104 Assert.assertNotNull(addressPlace1);
1106 // Update the contents of this resource.
1107 addressGroups.get(0).setAddressPlace1("updated-" + addressPlace1);
1108 contact.setAddressGroupList(addressGroupList);
1109 if (logger.isDebugEnabled()) {
1110 logger.debug("to be updated Contact");
1111 logger.debug(objectAsXmlString(contact,
1112 ContactsCommon.class));
1115 // Submit the updated resource to the service and store the response.
1116 PoxPayloadOut output = new PoxPayloadOut(ContactClient.SERVICE_PAYLOAD_NAME);
1117 PayloadOutputPart commonPart = output.addPart(contactsCommonLabel, contact);
1119 res = client.updateContact(knownResourceId, knownItemResourceId, knownContactResourceId, output);
1121 assertStatusCode(res, testName);
1122 // Retrieve the updated resource and verify that its contents exist.
1123 input = new PoxPayloadIn(res.readEntity(String.class));;
1129 ContactsCommon updatedContact = (ContactsCommon) extractPart(input,
1130 contactsCommonLabel, ContactsCommon.class);
1131 Assert.assertNotNull(updatedContact);
1133 // Verify that the updated resource received the correct data.
1134 Assert.assertEquals(updatedContact.getAddressGroupList().getAddressGroup().get(0).getAddressPlace1(),
1135 contact.getAddressGroupList().getAddressGroup().get(0).getAddressPlace1(),
1136 "Data in updated object did not match submitted data.");
1140 * Update non existent contact.
1142 * @param testName the test name
1143 * @throws Exception the exception
1145 @Test(dataProvider = "testName", groups = {"update"},
1146 dependsOnMethods = {"updateContact", "testContactSubmitRequest"})
1147 public void updateNonExistentContact(String testName) throws Exception {
1148 // Currently a no-op test
1151 // ---------------------------------------------------------------
1152 // CRUD tests : DELETE tests
1153 // ---------------------------------------------------------------
1155 // Note: delete sub-resources in ascending hierarchical order,
1156 // before deleting their parents.
1160 * @param testName the test name
1161 * @throws Exception the exception
1163 @Test(dataProvider = "testName", groups = {"delete"},
1164 dependsOnMethods = {"updateContact"})
1165 public void deleteContact(String testName) throws Exception {
1166 if (logger.isDebugEnabled()) {
1167 logger.debug("parentcsid =" + knownResourceId
1168 + " itemcsid = " + knownItemResourceId
1169 + " csid = " + knownContactResourceId);
1172 // Submit the request to the service and store the response.
1173 PersonAuthorityClient client = new PersonAuthorityClient();
1175 Response res = client.deleteContact(knownResourceId, knownItemResourceId,
1176 knownContactResourceId);
1178 assertStatusCode(res, testName);
1187 public void delete(String testName) throws Exception {
1188 // Do nothing. See localDelete(). This ensure proper test order.
1191 @Test(dataProvider = "testName", dependsOnMethods = {"localDeleteItem"})
1192 public void localDelete(String testName) throws Exception {
1193 super.delete(testName);
1197 public void deleteItem(String testName) throws Exception {
1198 // Do nothing. We need to wait until after the test "localDelete" gets run. When it does,
1199 // its dependencies will get run first and then we can call the base class' delete method.
1202 @Test(dataProvider = "testName", groups = {"delete"},
1203 dependsOnMethods = {"verifyIllegalItemDisplayName", "testContactSubmitRequest", "deleteContact"})
1204 public void localDeleteItem(String testName) throws Exception {
1205 super.deleteItem(testName);
1209 * Delete non existent contact.
1211 * @param testName the test name
1213 @Test(dataProvider = "testName", groups = {"delete"},
1214 dependsOnMethods = {"deleteContact"})
1215 public void deleteNonExistentContact(String testName) {
1216 // Submit the request to the service and store the response.
1217 PersonAuthorityClient client = new PersonAuthorityClient();
1218 setupDeleteNonExistent();
1219 Response res = client.deleteContact(knownResourceId, knownItemResourceId, NON_EXISTENT_ID);
1221 assertStatusCode(res, testName);
1230 * Test contact submit request.
1232 @Test(dataProvider = "testName",
1233 dependsOnMethods = {"createContact", "readContact", "testItemSubmitRequest"})
1234 public void testContactSubmitRequest(String testName) {
1236 // Expected status code: 200 OK
1237 final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
1239 // Submit the request to the service and store the response.
1240 String method = ServiceRequestType.READ.httpMethodName();
1241 String url = getContactResourceURL(knownResourceId,
1242 knownItemResourceId, knownContactResourceId);
1243 int statusCode = submitRequest(method, url);
1245 // Check the status code of the response: does it match
1246 // the expected response(s)?
1247 if (logger.isDebugEnabled()) {
1248 logger.debug("testContactSubmitRequest: url=" + url
1249 + " status=" + statusCode);
1251 Assert.assertEquals(statusCode, EXPECTED_STATUS);
1255 // ---------------------------------------------------------------
1256 // Cleanup of resources created during testing
1257 // ---------------------------------------------------------------
1259 * Deletes all resources created by tests, after all tests have been run.
1261 * This cleanup method will always be run, even if one or more tests fail.
1262 * For this reason, it attempts to remove all resources created
1263 * at any point during testing, even if some of those resources
1264 * may be expected to be deleted by certain tests.
1266 @AfterClass(alwaysRun = true)
1268 public void cleanUp() {
1269 String noTest = System.getProperty("noTestCleanup");
1270 if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
1271 if (logger.isDebugEnabled()) {
1272 logger.debug("Skipping Cleanup phase ...");
1277 if (logger.isDebugEnabled()) {
1278 logger.debug("Cleaning up temporary resources created for testing ...");
1281 String parentResourceId;
1282 String itemResourceId;
1283 String contactResourceId;
1284 // Clean up contact resources.
1285 PersonAuthorityClient client = new PersonAuthorityClient();
1286 parentResourceId = knownResourceId;
1287 for (Map.Entry<String, String> entry : allContactResourceIdsCreated.entrySet()) {
1288 contactResourceId = entry.getKey();
1289 itemResourceId = entry.getValue();
1290 // Note: Any non-success responses from the delete operation
1291 // below are ignored and not reported.
1292 Response res = client.deleteContact(parentResourceId, itemResourceId,
1297 // Finally, clean call our superclass' cleanUp method.
1302 // ---------------------------------------------------------------
1303 // Utility methods used by tests above
1304 // ---------------------------------------------------------------
1306 * Gets the contact service path component.
1308 * @return the contact service path component
1310 public String getContactServicePathComponent() {
1311 return ContactClient.SERVICE_PATH_COMPONENT;
1315 * Returns the root URL for the item service.
1317 * This URL consists of a base URL for all services, followed by
1318 * a path component for the owning parent, followed by the
1319 * path component for the items.
1321 * @param parentResourceIdentifier An identifier (such as a UUID) for the
1322 * parent authority resource of the relevant item resource.
1324 * @return The root URL for the item service.
1326 protected String getItemServiceRootURL(String parentResourceIdentifier) {
1327 return getResourceURL(parentResourceIdentifier) + "/" + getItemServicePathComponent();
1331 * Returns the URL of a specific item resource managed by a service, and
1332 * designated by an identifier (such as a universally unique ID, or UUID).
1334 * @param parentResourceIdentifier An identifier (such as a UUID) for the
1335 * parent authority resource of the relevant item resource.
1337 * @param itemResourceIdentifier An identifier (such as a UUID) for an
1340 * @return The URL of a specific item resource managed by a service.
1342 protected String getItemResourceURL(String parentResourceIdentifier, String itemResourceIdentifier) {
1343 return getItemServiceRootURL(parentResourceIdentifier) + "/" + itemResourceIdentifier;
1347 * Returns the root URL for the contact service.
1349 * This URL consists of a base URL for all services, followed by
1350 * a path component for the owning authority, followed by the
1351 * path component for the owning item, followed by the path component
1352 * for the contact service.
1354 * @param parentResourceIdentifier An identifier (such as a UUID) for the
1355 * parent authority resource of the relevant item resource.
1357 * @param itemResourceIdentifier An identifier (such as a UUID) for an
1360 * @return The root URL for the contact service.
1362 protected String getContactServiceRootURL(String parentResourceIdentifier,
1363 String itemResourceIdentifier) {
1364 return getItemResourceURL(parentResourceIdentifier, itemResourceIdentifier) + "/"
1365 + getContactServicePathComponent();
1369 * Returns the URL of a specific contact resource managed by a service, and
1370 * designated by an identifier (such as a universally unique ID, or UUID).
1372 * @param parentResourceIdentifier An identifier (such as a UUID) for the
1373 * parent resource of the relevant item resource.
1375 * @param resourceIdentifier An identifier (such as a UUID) for an
1378 * @return The URL of a specific resource managed by a service.
1380 protected String getContactResourceURL(String parentResourceIdentifier,
1381 String itemResourceIdentifier, String contactResourceIdentifier) {
1382 return getContactServiceRootURL(parentResourceIdentifier,
1383 itemResourceIdentifier) + "/" + contactResourceIdentifier;
1387 public void authorityTests(String testName) {
1388 // TODO Auto-generated method stub
1393 protected PersonsCommon updateItemInstance(PersonsCommon personsCommon) {
1395 PersonTermGroupList termList = personsCommon.getPersonTermGroupList();
1396 Assert.assertNotNull(termList);
1397 List<PersonTermGroup> terms = termList.getPersonTermGroup();
1398 Assert.assertNotNull(terms);
1399 Assert.assertTrue(terms.size() > 0);
1400 terms.get(0).setTermDisplayName("updated-" + terms.get(0).getTermDisplayName());
1401 terms.get(0).setTermName("updated-" + terms.get(0).getTermName());
1402 personsCommon.setPersonTermGroupList(termList);
1404 return personsCommon;
1408 protected void compareUpdatedItemInstances(PersonsCommon original,
1409 PersonsCommon updated) throws Exception {
1411 PersonTermGroupList originalTermList = original.getPersonTermGroupList();
1412 Assert.assertNotNull(originalTermList);
1413 List<PersonTermGroup> originalTerms = originalTermList.getPersonTermGroup();
1414 Assert.assertNotNull(originalTerms);
1415 Assert.assertTrue(originalTerms.size() > 0);
1417 PersonTermGroupList updatedTermList = updated.getPersonTermGroupList();
1418 Assert.assertNotNull(updatedTermList);
1419 List<PersonTermGroup> updatedTerms = updatedTermList.getPersonTermGroup();
1420 Assert.assertNotNull(updatedTerms);
1421 Assert.assertTrue(updatedTerms.size() > 0);
1423 Assert.assertEquals(updatedTerms.get(0).getTermDisplayName(),
1424 originalTerms.get(0).getTermDisplayName(),
1425 "Value in updated record did not match submitted data.");
1429 protected PoxPayloadOut createInstance(String commonPartName,
1430 String identifier) {
1431 String shortId = identifier;
1432 String displayName = "displayName-" + shortId;
1433 PoxPayloadOut result =
1434 PersonAuthorityClientUtils.createPersonAuthorityInstance(
1435 displayName, shortId, commonPartName);
1440 protected PoxPayloadOut createNonExistenceInstance(String commonPartName,
1441 String identifier) {
1442 String displayName = "displayName-NON_EXISTENT_ID";
1443 PoxPayloadOut result = PersonAuthorityClientUtils.createPersonAuthorityInstance(
1444 displayName, "NON_EXISTENT_SHORT_ID", commonPartName);
1448 protected PoxPayloadOut createNonExistenceItemInstance(String commonPartName, String identifier) {
1449 Map<String, String> nonexMap = new HashMap<String, String>();
1450 nonexMap.put(PersonJAXBSchema.SHORT_IDENTIFIER, "nonEX");
1451 nonexMap.put(PersonJAXBSchema.GENDER, "male");
1453 List<PersonTermGroup> terms = new ArrayList<PersonTermGroup>();
1454 PersonTermGroup term = new PersonTermGroup();
1455 term.setTermDisplayName("John Wayne");
1456 term.setTermName("John Wayne");
1457 term.setForeName("John");
1458 term.setSurName("Wayne");
1461 Map<String, List<String>> nonexRepeatablesMap = new HashMap<String, List<String>>();
1462 PoxPayloadOut result =
1463 PersonAuthorityClientUtils.createPersonInstance(NON_EXISTENT_ID,
1464 null, //PersonAuthorityClientUtils.createPersonAuthRefName(NON_EXISTENT_ID, null),
1465 nonexMap, terms, nonexRepeatablesMap, commonPartName);
1470 protected PersonauthoritiesCommon updateInstance(PersonauthoritiesCommon personauthoritiesCommon) {
1471 PersonauthoritiesCommon result = new PersonauthoritiesCommon();
1473 result.setDisplayName("updated-" + personauthoritiesCommon.getDisplayName());
1474 result.setVocabType("updated-" + personauthoritiesCommon.getVocabType());
1480 protected void compareUpdatedInstances(PersonauthoritiesCommon original,
1481 PersonauthoritiesCommon updated) throws Exception {
1482 // Verify that the updated resource received the correct data.
1483 Assert.assertEquals(updated.getDisplayName(),
1484 original.getDisplayName(),
1485 "Display name in updated object did not match submitted data.");
1489 protected void verifyReadItemInstance(PersonsCommon item) throws Exception {
1490 // Do nothing for now. Add more 'read' validation checks here if applicable.