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.jboss.resteasy.client.ClientResponse;
53 //import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
54 import org.slf4j.Logger;
55 import org.slf4j.LoggerFactory;
56 import org.testng.Assert;
57 import org.testng.annotations.AfterClass;
58 import org.testng.annotations.Test;
61 * PersonAuthorityServiceTest, carries out tests against a
62 * deployed and running PersonAuthority Service.
64 * $LastChangedRevision: 753 $
65 * $LastChangedDate: 2009-09-23 11:03:36 -0700 (Wed, 23 Sep 2009) $
67 public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<PersonauthoritiesCommon, PersonsCommon> { //FIXME: Test classes for Vocab, Person, Org, and Location should have a base class!
70 private final String CLASS_NAME = PersonAuthorityServiceTest.class.getName();
71 private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
74 public String getServicePathComponent() {
75 return PersonAuthorityClient.SERVICE_PATH_COMPONENT;
79 protected String getServiceName() {
80 return PersonAuthorityClient.SERVICE_NAME;
83 public String getItemServicePathComponent() {
84 return AuthorityClient.ITEMS;
86 /** The test forename. */
87 final String TEST_FORE_NAME = "John";
88 /** The test middle name. */
89 final String TEST_MIDDLE_NAME = null;
90 /** The test surname. */
91 final String TEST_SUR_NAME = "Wayne";
92 /** The test birthdate. */
93 final String TEST_BIRTH_DATE = "May 26, 1907";
94 /** The test death date. */
95 final String TEST_DEATH_DATE = "June 11, 1979";
96 //private String knownResourceRefName = null;
97 private String knownItemResourceShortIdentifer = null;
98 // The resource ID of an item resource used for partial term matching tests.
99 private String knownItemPartialTermResourceId = null;
100 /** The known contact resource id. */
101 private String knownContactResourceId = null;
102 /** The all contact resource ids created. */
103 private Map<String, String> allContactResourceIdsCreated =
104 new HashMap<String, String>();
106 protected void setKnownResource(String id, String shortIdentifer,
108 knownResourceId = id;
109 knownResourceShortIdentifer = shortIdentifer;
110 //knownResourceRefName = refName;
113 protected void setKnownItemResource(String id, String shortIdentifer) {
114 knownItemResourceId = id;
115 knownItemResourceShortIdentifer = shortIdentifer;
119 * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
122 protected CollectionSpaceClient getClientInstance() {
123 return new PersonAuthorityClient();
127 protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
128 return new PersonAuthorityClient(clientPropertiesFilename);
131 // ---------------------------------------------------------------
132 // CRUD tests : CREATE tests
133 // ---------------------------------------------------------------
136 * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
139 public void create(String testName) throws Exception {
140 // Perform setup, such as initializing the type of service request
141 // (e.g. CREATE, DELETE), its valid and expected status codes, and
142 // its associated HTTP method name (e.g. POST, DELETE).
145 // Submit the request to the service and store the response.
146 PersonAuthorityClient client = new PersonAuthorityClient();
147 String shortId = createIdentifier();
148 String displayName = "displayName-" + shortId;
149 //String baseRefName = PersonAuthorityClientUtils.createPersonAuthRefName(shortId, null);
150 PoxPayloadOut multipart =
151 PersonAuthorityClientUtils.createPersonAuthorityInstance(
152 displayName, shortId, client.getCommonPartName());
155 Response res = client.create(multipart);
157 assertStatusCode(res, testName);
158 newID = extractId(res);
164 // Save values for additional tests
165 if (knownResourceId == null) {
166 setKnownResource(newID, shortId, null ); //baseRefName);
167 if (logger.isDebugEnabled()) {
168 logger.debug(testName + ": knownResourceId=" + knownResourceId);
171 // Store the IDs from every resource created by tests,
172 // so they can be deleted after tests have been run.
173 allResourceIdsCreated.add(newID);
177 protected PoxPayloadOut createInstance(String identifier) {
178 PersonAuthorityClient client = new PersonAuthorityClient();
179 String displayName = "displayName-" + identifier;
180 PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
181 displayName, identifier, client.getCommonPartName());
186 protected PoxPayloadOut createItemInstance(String parentCsid, String identifier) {
187 String headerLabel = new PersonAuthorityClient().getItemCommonPartName();
189 HashMap<String, String> personInfo = new HashMap<String, String>();
190 String shortId = "MarkTwainAuthor" + identifier;
191 personInfo.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId);
193 List<PersonTermGroup> terms = new ArrayList<PersonTermGroup>();
194 PersonTermGroup term = new PersonTermGroup();
195 term.setTermDisplayName("Mark Twain Primary");
196 term.setTermName("MarkTwainPrimary");
199 term = new PersonTermGroup();
200 term.setTermDisplayName("Samuel Langhorne Clemens");
201 term.setTermName("SamuelLanghorneClemens");
204 term = new PersonTermGroup();
205 term.setTermDisplayName("Sam Clemens");
206 term.setTermName("SamClemens");
209 term = new PersonTermGroup();
210 term.setTermDisplayName("Huck Fin");
211 term.setTermName("Huck Fin");
214 return PersonAuthorityClientUtils.createPersonInstance(parentCsid, identifier, personInfo, terms, headerLabel);
218 * Creates an item in an authority, using test data.
220 * @param vcsid the vcsid
221 * @param authRefName the auth ref name
225 protected String createItemInAuthority(AuthorityClient client, String vcsid) {
227 final String testName = "createItemInAuthority";
228 if (logger.isDebugEnabled()) {
229 logger.debug(testName + ":" + vcsid + "...");
232 Map<String, String> johnWayneMap = new HashMap<String, String>();
234 // Fill the property map
236 String shortId = "johnWayneActor" + System.currentTimeMillis(); // short ID needs to be unique
237 johnWayneMap.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId);
238 johnWayneMap.put(PersonJAXBSchema.GENDER, "male");
239 johnWayneMap.put(PersonJAXBSchema.BIRTH_DATE, TEST_BIRTH_DATE);
240 johnWayneMap.put(PersonJAXBSchema.BIRTH_PLACE, "Winterset, Iowa");
241 johnWayneMap.put(PersonJAXBSchema.DEATH_DATE, TEST_DEATH_DATE);
242 johnWayneMap.put(PersonJAXBSchema.BIO_NOTE, "born Marion Robert Morrison and better"
243 + "known by his stage name John Wayne, was an American film actor, director "
244 + "and producer. He epitomized rugged masculinity and has become an enduring "
245 + "American icon. He is famous for his distinctive voice, walk and height. "
246 + "He was also known for his conservative political views and his support in "
247 + "the 1950s for anti-communist positions.");
249 List<PersonTermGroup> johnWayneTerms = new ArrayList<PersonTermGroup>();
250 PersonTermGroup term = new PersonTermGroup();
251 term.setTermDisplayName("John Wayne DisplayName");
252 term.setTermName("John Wayne");
253 term.setForeName(TEST_FORE_NAME);
254 term.setSurName(TEST_SUR_NAME);
255 johnWayneTerms.add(term);
257 Map<String, List<String>> johnWayneRepeatablesMap = new HashMap<String, List<String>>();
258 List<String> johnWayneGroups = new ArrayList<String>();
259 johnWayneGroups.add("Irish");
260 johnWayneGroups.add("Scottish");
261 johnWayneRepeatablesMap.put(PersonJAXBSchema.GROUPS, johnWayneGroups);
263 return createItemInAuthority(client, vcsid, null /*authRefName*/, shortId, johnWayneMap, johnWayneTerms, johnWayneRepeatablesMap);
268 * Creates an item in an authority.
270 * @param vcsid the vcsid
271 * @param authRefName the auth ref name
272 * @param itemFieldProperties a set of properties specifying the values of fields.
273 * @param itemRepeatableFieldProperties a set of properties specifying the values of repeatable fields.
276 private String createItemInAuthority(AuthorityClient client, String vcsid, String authRefName, String shortId,
277 Map itemFieldProperties, List<PersonTermGroup> terms, Map itemRepeatableFieldProperties) {
279 final String testName = "createItemInAuthority";
280 if (logger.isDebugEnabled()) {
281 logger.debug(testName + ":" + vcsid + "...");
284 // Submit the request to the service and store the response.
285 if (client == null) {
286 client = new PersonAuthorityClient();
288 PoxPayloadOut multipart =
289 PersonAuthorityClientUtils.createPersonInstance(vcsid, null /*authRefName*/, itemFieldProperties,
290 terms, itemRepeatableFieldProperties, client.getItemCommonPartName());
292 Response res = client.createItem(vcsid, multipart);
295 assertStatusCode(res, testName);
296 newID = PersonAuthorityClientUtils.extractId(res);
303 // Store the ID returned from the first item resource created
304 // for additional tests below.
305 if (knownItemResourceId == null) {
306 setKnownItemResource(newID, shortId);
307 if (logger.isDebugEnabled()) {
308 logger.debug(testName + ": knownItemResourceId=" + knownItemResourceId);
311 if (logger.isDebugEnabled()) {
312 logger.debug(testName + " (created):" + vcsid + "/(" + newID + "," + shortId + ")");
315 // Store the IDs from any item resources created
316 // by tests, along with the IDs of their parents, so these items
317 // can be deleted after all tests have been run.
318 allResourceItemIdsCreated.put(newID, vcsid);
324 * Creates the contact.
326 * @param testName the test name
328 @Test(dataProvider = "testName", groups = {"create"},
329 dependsOnMethods = {"createItem"})
330 public void createContact(String testName) {
332 String newID = createContactInItem(knownResourceId, knownItemResourceId);
336 * Creates the contact in item.
338 * @param parentcsid the parentcsid
339 * @param itemcsid the itemcsid
342 private String createContactInItem(String parentcsid, String itemcsid) {
344 final String testName = "createContactInItem";
345 if (logger.isDebugEnabled()) {
346 logger.debug(testName + ":...");
348 // Submit the request to the service and store the response.
349 PersonAuthorityClient client = new PersonAuthorityClient();
350 String identifier = createIdentifier();
351 PoxPayloadOut multipart = ContactClientUtils.createContactInstance(parentcsid,
352 itemcsid, identifier, new ContactClient().getCommonPartName());
355 Response res = client.createContact(parentcsid, itemcsid, multipart);
358 assertStatusCode(res, testName);
359 newID = PersonAuthorityClientUtils.extractId(res);
366 // Store the ID returned from the first contact resource created
367 // for additional tests below.
368 if (knownContactResourceId == null) {
369 knownContactResourceId = newID;
370 if (logger.isDebugEnabled()) {
371 logger.debug(testName + ": knownContactResourceId=" + knownContactResourceId);
375 // Store the IDs from any contact resources created
376 // by tests, along with the IDs of their parent items,
377 // so these items can be deleted after all tests have been run.
378 allContactResourceIdsCreated.put(newID, itemcsid);
384 * Attempts to create an authority with an short identifier that contains
385 * non-word characters.
387 * @param testName the test name
389 @Test(dataProvider = "testName", groups = {"create", "nonWordCharsInShortId"})
390 public void createWithShortIdNonWordChars(String testName) throws Exception {
391 testExpectedStatusCode = STATUS_BAD_REQUEST;
392 testRequestType = ServiceRequestType.CREATE;
393 testSetup(testExpectedStatusCode, testRequestType);
395 // Create the payload to be included in the body of the request
396 PersonAuthorityClient client = new PersonAuthorityClient();
397 String shortId = createIdentifier() + "*" + createIdentifier();
398 String displayName = "displayName-" + shortId;
399 PoxPayloadOut multipart =
400 PersonAuthorityClientUtils.createPersonAuthorityInstance(
401 displayName, shortId, client.getCommonPartName());
403 // Submit the request to the service and store the response.
404 Response res = client.create(multipart);
406 // Check the status code of the response: does it match
407 // the expected response(s)? We expect failure here.
409 assertStatusCode(res, testName);
418 * Attempts to create an item with an short identifier that contains
419 * non-word characters.
421 * @param testName the test name
423 @Test(dataProvider = "testName", groups = {"create", "nonWordCharsInShortId"},
424 dependsOnMethods = {"org.collectionspace.services.client.test.AbstractServiceTestImpl.create"})
425 public void createItemWithShortIdNonWordChars(String testName) {
426 testExpectedStatusCode = STATUS_BAD_REQUEST;
427 testRequestType = ServiceRequestType.CREATE;
428 testSetup(testExpectedStatusCode, testRequestType);
430 PersonAuthorityClient client = new PersonAuthorityClient();
431 // Create the payload to be included in the body of the request
432 String shortId = "7-Eleven";
433 Map<String, String> fieldProperties = new HashMap<String, String>();
434 fieldProperties.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId);
436 List<PersonTermGroup> terms = new ArrayList<PersonTermGroup>();
437 PersonTermGroup term = new PersonTermGroup();
438 term.setTermDisplayName(shortId);
439 term.setTermName(shortId);
442 final Map NULL_REPEATABLE_FIELD_PROPERTIES = null;
443 PoxPayloadOut multipart =
444 PersonAuthorityClientUtils.createPersonInstance(knownResourceId,
445 null /*knownResourceRefName*/, fieldProperties, terms,
446 NULL_REPEATABLE_FIELD_PROPERTIES, client.getItemCommonPartName());
448 // Send the request and receive a response
449 Response res = client.createItem(knownResourceId, multipart);
451 // Check the status code of the response: does it match
452 // the expected response(s)? We expect failure here, so there will be no
453 // new ID to keep track of for later cleanup.
455 assertStatusCode(res, testName);
463 // ---------------------------------------------------------------
464 // CRUD tests : CREATE LIST tests
465 // ---------------------------------------------------------------
468 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
471 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
472 // groups = {"createList"}, dependsOnGroups = {"create"})
473 public void createList(String testName) throws Exception {
474 for (int i = 0; i < nItemsToCreateInList; i++) {
480 * Creates the contact list.
482 * @param testName the test name
483 * @throws Exception the exception
485 @Test(dataProvider = "testName", groups = {"createList"},
486 dependsOnMethods = {"org.collectionspace.services.client.test.AbstractAuthorityServiceTest.createItemList"})
487 public void createContactList(String testName) throws Exception {
488 // Add contacts to the initially-created, known item record.
489 for (int j = 0; j < nItemsToCreateInList; j++) {
490 createContact(testName);
494 // ---------------------------------------------------------------
495 // CRUD tests : READ tests
496 // ---------------------------------------------------------------
499 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
502 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
503 // groups = {"read"}, dependsOnGroups = {"create"})
504 public void read(String testName) throws Exception {
505 readInternal(testName, knownResourceId, null);
511 * @param testName the test name
512 * @throws Exception the exception
515 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
516 // groups = {"read"}, dependsOnMethods = {"read"})
517 public void readByName(String testName) throws Exception {
518 readInternal(testName, null, knownResourceShortIdentifer);
521 protected void readInternal(String testName, String CSID, String shortId) {
522 // Submit the request to the service and store the response.
523 PersonAuthorityClient client = new PersonAuthorityClient();
527 res = client.read(CSID);
528 } else if (shortId != null) {
529 res = client.readByName(shortId);
531 Assert.fail("readInternal: Internal error. One of CSID or shortId must be non-null");
534 assertStatusCode(res, testName);
535 //FIXME: remove the following try catch once Aron fixes signatures
537 PoxPayloadIn input = new PoxPayloadIn(res.readEntity(String.class));
538 PersonauthoritiesCommon personAuthority = (PersonauthoritiesCommon) extractPart(input,
539 client.getCommonPartName(), PersonauthoritiesCommon.class);
540 Assert.assertNotNull(personAuthority);
541 } catch (Exception e) {
542 throw new RuntimeException(e);
554 * @param testName the test name
555 * @throws Exception the exception
557 @Test(dataProvider = "testName", groups = {"readItem", "readNamedItemInNamedAuth"},
558 dependsOnMethods = {"readItemInNamedAuth"})
559 public void readNamedItem(String testName) throws Exception {
560 readItemInternal(testName, knownResourceId, null, null, knownItemResourceShortIdentifer);
564 * Read item in Named Auth.
566 * @param testName the test name
567 * @throws Exception the exception
569 @Test(dataProvider = "testName", groups = {"readItem"},
570 dependsOnMethods = {"readItem"})
571 public void readItemInNamedAuth(String testName) throws Exception {
572 readItemInternal(testName, null, knownResourceShortIdentifer, knownItemResourceId, null);
577 * Read Named item in Named Auth.
579 * @param testName the test name
580 * @throws Exception the exception
582 @Test(dataProvider = "testName", groups = {"readItem"},
583 dependsOnMethods = {"readNamedItem"})
584 public void readNamedItemInNamedAuth(String testName) throws Exception {
585 readItemInternal(testName, null, knownResourceShortIdentifer, null, knownItemResourceShortIdentifer);
588 protected void readItemInternal(String testName,
589 String authCSID, String authShortId, String itemCSID, String itemShortId)
592 if (logger.isDebugEnabled()) {
593 logger.debug("Reading:" + ((authCSID != null) ? authCSID : authShortId) + "/"
594 + ((itemCSID != null) ? authCSID : itemShortId));
597 // Submit the request to the service and store the response.
598 PersonAuthorityClient client = new PersonAuthorityClient();
601 if (authCSID != null) {
602 if (itemCSID != null) {
603 res = client.readItem(authCSID, itemCSID);
604 } else if (itemShortId != null) {
605 res = client.readNamedItem(authCSID, itemShortId);
607 Assert.fail("readInternal: Internal error. One of CSID or shortId must be non-null");
609 } else if (authShortId != null) {
610 if (itemCSID != null) {
611 res = client.readItemInNamedAuthority(authShortId, itemCSID);
612 } else if (itemShortId != null) {
613 res = client.readNamedItemInNamedAuthority(authShortId, itemShortId);
615 Assert.fail("readInternal: Internal error. One of CSID or shortId must be non-null");
618 Assert.fail("readInternal: Internal error. One of authCSID or authShortId must be non-null");
622 assertStatusCode(res, testName);
623 // Check whether we've received a person.
624 PoxPayloadIn input = new PoxPayloadIn(res.readEntity(String.class));
625 PersonsCommon person = (PersonsCommon) extractPart(input,
626 client.getItemCommonPartName(), PersonsCommon.class);
627 Assert.assertNotNull(person);
628 boolean showFull = true;
629 if (showFull && logger.isDebugEnabled()) {
630 logger.debug(testName + ": returned payload:");
631 logger.debug(objectAsXmlString(person, PersonsCommon.class));
634 // Check that the person item is within the expected Person Authority.
635 Assert.assertEquals(person.getInAuthority(), knownResourceId);
637 // Verify the number and contents of values in a repeatable field,
638 // as created in the instance record used for testing.
639 List<String> groups = person.getGroups().getGroup();
640 Assert.assertTrue(groups.size() > 0);
641 Assert.assertNotNull(groups.get(0));
649 // Note: This test depends on server-side validation logic to require
650 // a non-null (and potentially, non-empty) displayname for each term,
651 // and will fail if that validation is not present.
654 * Verify illegal item display name.
656 * @param testName the test name
657 * @throws Exception the exception
659 @Test(dataProvider = "testName", groups = {"update"})
660 public void verifyIllegalItemDisplayName(String testName) throws Exception {
661 // Perform setup for read.
664 // Submit the request to the service and store the response.
665 PersonAuthorityClient client = new PersonAuthorityClient();
666 Response res = client.readItem(knownResourceId, knownItemResourceId);
667 PoxPayloadIn input = null;
669 assertStatusCode(res, testName);
670 input = new PoxPayloadIn(res.readEntity(String.class));
677 // Make an invalid UPDATE request, without a display name
679 PersonsCommon person = (PersonsCommon) extractPart(input,
680 client.getItemCommonPartName(), PersonsCommon.class);
681 Assert.assertNotNull(person);
682 // Try to Update with no displayName
683 PersonTermGroupList termList = person.getPersonTermGroupList();
684 Assert.assertNotNull(termList);
685 List<PersonTermGroup> terms = termList.getPersonTermGroup();
686 Assert.assertNotNull(terms);
687 Assert.assertTrue(terms.size() > 0);
688 terms.get(0).setTermDisplayName(null);
689 terms.get(0).setTermName(null);
691 // Submit the updated resource to the service and store the response.
692 PoxPayloadOut output = new PoxPayloadOut(PersonAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
693 PayloadOutputPart commonPart = output.addPart(client.getItemCommonPartName(), person);
694 setupUpdateWithInvalidBody();
695 res = client.updateItem(knownResourceId, knownItemResourceId, output);
697 assertStatusCode(res, testName);
708 * @param testName the test name
709 * @throws Exception the exception
711 @Test(dataProvider = "testName", groups = {"readItem"},
712 dependsOnMethods = {"createContact", "org.collectionspace.services.client.test.AbstractAuthorityServiceTest.readItem"})
713 public void readContact(String testName) throws Exception {
717 // Submit the request to the service and store the response.
718 PersonAuthorityClient client = new PersonAuthorityClient();
719 PoxPayloadIn input = null;
720 Response res = client.readContact(knownResourceId, knownItemResourceId,
721 knownContactResourceId);
723 assertStatusCode(res, testName);
724 // Check whether we've received a contact.
725 input = new PoxPayloadIn(res.readEntity(String.class));
732 ContactsCommon contact = (ContactsCommon) extractPart(input,
733 new ContactClient().getCommonPartName(), ContactsCommon.class);
734 Assert.assertNotNull(contact);
735 boolean showFull = true;
736 if (showFull && logger.isDebugEnabled()) {
737 logger.debug(testName + ": returned payload:");
738 logger.debug(objectAsXmlString(contact, ContactsCommon.class));
740 Assert.assertEquals(contact.getInAuthority(), knownResourceId);
741 Assert.assertEquals(contact.getInItem(), knownItemResourceId);
746 * Read contact non existent.
748 * @param testName the test name
750 @Test(dataProvider = "testName", groups = {"readItem"}, dependsOnMethods = {"readContact"})
751 public void readContactNonExistent(String testName) {
753 setupReadNonExistent();
755 // Submit the request to the service and store the response.
756 PersonAuthorityClient client = new PersonAuthorityClient();
757 Response res = client.readContact(knownResourceId, knownItemResourceId,
760 assertStatusCode(res, testName);
768 // ---------------------------------------------------------------
769 // CRUD tests : READ_LIST tests
770 // ---------------------------------------------------------------
773 * Read item list override -see immediate superclass.
776 public void readItemList(String testName) {
777 readItemList(knownAuthorityWithItems, null, testName);
781 * Read item list by authority name.
784 public void readItemListByName(String testName) {
785 readItemList(null, READITEMS_SHORT_IDENTIFIER, testName);
791 * @param vcsid the vcsid
792 * @param name the name
794 private void readItemList(String vcsid, String name, String testName) {
796 // Submit the request to the service and store the response.
797 PersonAuthorityClient client = new PersonAuthorityClient();
800 res = client.readItemList(vcsid, null, null);
801 } else if (name != null) {
802 res = client.readItemListForNamedAuthority(name, null, null);
804 Assert.fail("readItemList passed null csid and name!");
806 AbstractCommonList list = null;
808 assertStatusCode(res, testName);
809 list = res.readEntity(AbstractCommonList.class);
816 List<AbstractCommonList.ListItem> items = list.getListItem();
817 int nItemsReturned = items.size();
818 // There will be 'nItemsToCreateInList'
819 // items created by the createItemList test,
820 // all associated with the same parent resource.
821 int nExpectedItems = nItemsToCreateInList;
822 if (logger.isDebugEnabled()) {
823 logger.debug(testName + ": Expected "
824 + nExpectedItems + " items; got: " + nItemsReturned);
826 Assert.assertEquals(nItemsReturned, nExpectedItems);
828 for (AbstractCommonList.ListItem item : items) {
830 AbstractCommonListUtils.ListItemGetElementValue(item, AuthorityItemJAXBSchema.REF_NAME);
831 Assert.assertTrue((null != value), "Item refName is null!");
833 // Per CSPACE-5132, lists items still return a field named displayName,
834 // not termDisplayName, for backward compatibility.
835 // (The format of list items will change significantly in CSPACE-5134.)
837 AbstractCommonListUtils.ListItemGetElementValue(item, AuthorityItemJAXBSchema.TERM_DISPLAY_NAME);
838 Assert.assertTrue((null != value), "Item termDisplayName is null!");
840 if (logger.isTraceEnabled()) {
841 AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
848 @Test(groups = {"readList"},
849 dependsOnMethods = {"org.collectionspace.services.client.test.AbstractAuthorityServiceTest.readItemList"})
850 public void readContactList() {
851 readContactList(knownResourceId, knownItemResourceId);
857 * @param parentcsid the parentcsid
858 * @param itemcsid the itemcsid
860 private void readContactList(String parentcsid, String itemcsid) {
861 final String testName = "readContactList";
866 // Submit the request to the service and store the response.
867 PersonAuthorityClient client = new PersonAuthorityClient();
868 AbstractCommonList list = null;
869 Response res = client.readContactList(parentcsid, itemcsid);
871 assertStatusCode(res, testName);
872 list = res.readEntity(AbstractCommonList.class);
879 List<AbstractCommonList.ListItem> listitems =
881 int nItemsReturned = listitems.size();
882 // There will be one item created, associated with a
883 // known parent resource, by the createItem test.
885 // In addition, there will be 'nItemsToCreateInList'
886 // additional items created by the createItemList test,
887 // all associated with the same parent resource.
888 int nExpectedItems = nItemsToCreateInList + 1;
889 if (logger.isDebugEnabled()) {
890 logger.debug(testName + ": Expected "
891 + nExpectedItems + " items; got: " + nItemsReturned);
893 Assert.assertEquals(nItemsReturned, nExpectedItems);
895 // Optionally output additional data about list members for debugging.
896 boolean iterateThroughList = false;
897 if (iterateThroughList && logger.isDebugEnabled()) {
898 AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
903 // There are no failure outcome tests at present.
904 // ---------------------------------------------------------------
905 // CRUD tests : UPDATE tests
906 // ---------------------------------------------------------------
909 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
912 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
913 // groups = {"update"}, dependsOnGroups = {"readItem", "readList"})
914 public void update(String testName) throws Exception {
915 // Retrieve the contents of a resource to update.
916 PersonAuthorityClient client = new PersonAuthorityClient();
917 PoxPayloadIn input = null;
919 Response res = client.read(knownResourceId);
921 assertStatusCode(res, testName);
922 if (logger.isDebugEnabled()) {
923 logger.debug("got PersonAuthority to update with ID: " + knownResourceId);
925 input = new PoxPayloadIn(res.readEntity(String.class));
932 PersonauthoritiesCommon personAuthority = (PersonauthoritiesCommon) extractPart(input,
933 client.getCommonPartName(), PersonauthoritiesCommon.class);
934 Assert.assertNotNull(personAuthority);
936 // Update the contents of this resource.
937 personAuthority.setDisplayName("updated-" + personAuthority.getDisplayName());
938 personAuthority.setVocabType("updated-" + personAuthority.getVocabType());
939 if (logger.isDebugEnabled()) {
940 logger.debug("to be updated PersonAuthority");
941 logger.debug(objectAsXmlString(personAuthority, PersonauthoritiesCommon.class));
944 // Submit the updated resource to the service and store the response.
945 PoxPayloadOut output = new PoxPayloadOut(PersonAuthorityClient.SERVICE_PAYLOAD_NAME);
946 PayloadOutputPart commonPart = output.addPart(client.getCommonPartName(), personAuthority);
948 res = client.update(knownResourceId, output);
950 assertStatusCode(res, testName);
951 // Retrieve the updated resource and verify that its contents exist.
952 input = new PoxPayloadIn(res.readEntity(String.class));
959 PersonauthoritiesCommon updatedPersonAuthority =
960 (PersonauthoritiesCommon) extractPart(input,
961 client.getCommonPartName(), PersonauthoritiesCommon.class);
962 Assert.assertNotNull(updatedPersonAuthority);
964 // Verify that the updated resource received the correct data.
965 Assert.assertEquals(updatedPersonAuthority.getDisplayName(),
966 personAuthority.getDisplayName(),
967 "Data in updated object did not match submitted data.");
971 * Update item override -see immediate superclass.
973 * @param testName the test name
974 * @throws Exception the exception
977 public void updateItem(String testName) throws Exception {
978 // Retrieve the contents of a resource to update.
979 PersonAuthorityClient client = new PersonAuthorityClient();
980 PoxPayloadIn input = null;
982 Response res = client.readItem(knownResourceId, knownItemResourceId);
984 assertStatusCode(res, testName);
985 if (logger.isDebugEnabled()) {
986 logger.debug("got Person to update with ID: "
987 + knownItemResourceId
988 + " in PersonAuthority: " + knownResourceId);
990 input = new PoxPayloadIn(res.readEntity(String.class));
997 PersonsCommon person = (PersonsCommon) extractPart(input,
998 client.getItemCommonPartName(), PersonsCommon.class);
999 Assert.assertNotNull(person);
1001 if (logger.isDebugEnabled() == true) {
1002 logger.debug("About to update the following person...");
1003 logger.debug(objectAsXmlString(person, PersonsCommon.class));
1006 // Update the contents of this resource.
1007 person.setCsid(null);
1008 PersonTermGroupList termList = person.getPersonTermGroupList();
1009 Assert.assertNotNull(termList);
1010 List<PersonTermGroup> terms = termList.getPersonTermGroup();
1011 Assert.assertNotNull(terms);
1012 Assert.assertTrue(terms.size() > 0);
1013 String foreName = terms.get(0).getForeName();
1014 String updatedForeName = "updated-" + foreName;
1015 terms.get(0).setForeName(updatedForeName);
1016 if (logger.isDebugEnabled()) {
1017 logger.debug("to be updated Person");
1018 logger.debug(objectAsXmlString(person,
1019 PersonsCommon.class));
1022 // Submit the updated resource to the service and store the response.
1023 PoxPayloadOut output = new PoxPayloadOut(PersonAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
1024 PayloadOutputPart commonPart = output.addPart(client.getItemCommonPartName(), person);
1026 res = client.updateItem(knownResourceId, knownItemResourceId, output);
1028 assertStatusCode(res, testName);
1029 // Retrieve the updated resource and verify that its contents exist.
1030 input = new PoxPayloadIn(res.readEntity(String.class));
1037 PersonsCommon updatedPerson =
1038 (PersonsCommon) extractPart(input,
1039 client.getItemCommonPartName(), PersonsCommon.class);
1040 Assert.assertNotNull(updatedPerson);
1042 if (logger.isDebugEnabled() == true) {
1043 logger.debug("Updated to following person to:");
1044 logger.debug(objectAsXmlString(updatedPerson, PersonsCommon.class));
1047 // Verify that the updated resource received the correct data.
1048 PersonTermGroupList updatedTermList = person.getPersonTermGroupList();
1049 Assert.assertNotNull(updatedTermList);
1050 List<PersonTermGroup> updatedTerms = termList.getPersonTermGroup();
1051 Assert.assertNotNull(updatedTerms);
1052 Assert.assertEquals(updatedTerms.get(0).getForeName(), updatedForeName,
1053 "Data in updated Person did not match submitted data.");
1059 * @param testName the test name
1060 * @throws Exception the exception
1062 @Test(dataProvider = "testName", groups = {"update"},
1063 dependsOnMethods = {"readContact", "testContactSubmitRequest",
1064 "org.collectionspace.services.client.test.AbstractAuthorityServiceTest.updateItem"})
1065 public void updateContact(String testName) throws Exception {
1066 String contactsCommonLabel = new ContactClient().getCommonPartName();
1068 // Retrieve the contents of a resource to update.
1069 PersonAuthorityClient client = new PersonAuthorityClient();
1070 PoxPayloadIn input = null;
1072 Response res = client.readContact(knownResourceId, knownItemResourceId,
1073 knownContactResourceId);
1075 assertStatusCode(res, testName);
1076 if (logger.isDebugEnabled()) {
1077 logger.debug("got Contact to update with ID: "
1078 + knownContactResourceId
1079 + " in item: " + knownItemResourceId
1080 + " in parent: " + knownResourceId);
1082 input = new PoxPayloadIn(res.readEntity(String.class));
1089 ContactsCommon contact = (ContactsCommon) extractPart(input,
1090 contactsCommonLabel, ContactsCommon.class);
1091 Assert.assertNotNull(contact);
1093 // Verify the contents of this resource
1094 AddressGroupList addressGroupList = contact.getAddressGroupList();
1095 Assert.assertNotNull(addressGroupList);
1096 List<AddressGroup> addressGroups = addressGroupList.getAddressGroup();
1097 Assert.assertNotNull(addressGroups);
1098 Assert.assertTrue(addressGroups.size() > 0);
1099 String addressPlace1 = addressGroups.get(0).getAddressPlace1();
1100 Assert.assertNotNull(addressPlace1);
1102 // Update the contents of this resource.
1103 addressGroups.get(0).setAddressPlace1("updated-" + addressPlace1);
1104 contact.setAddressGroupList(addressGroupList);
1105 if (logger.isDebugEnabled()) {
1106 logger.debug("to be updated Contact");
1107 logger.debug(objectAsXmlString(contact,
1108 ContactsCommon.class));
1111 // Submit the updated resource to the service and store the response.
1112 PoxPayloadOut output = new PoxPayloadOut(ContactClient.SERVICE_PAYLOAD_NAME);
1113 PayloadOutputPart commonPart = output.addPart(contactsCommonLabel, contact);
1115 res = client.updateContact(knownResourceId, knownItemResourceId, knownContactResourceId, output);
1117 assertStatusCode(res, testName);
1118 // Retrieve the updated resource and verify that its contents exist.
1119 input = new PoxPayloadIn(res.readEntity(String.class));;
1125 ContactsCommon updatedContact = (ContactsCommon) extractPart(input,
1126 contactsCommonLabel, ContactsCommon.class);
1127 Assert.assertNotNull(updatedContact);
1129 // Verify that the updated resource received the correct data.
1130 Assert.assertEquals(updatedContact.getAddressGroupList().getAddressGroup().get(0).getAddressPlace1(),
1131 contact.getAddressGroupList().getAddressGroup().get(0).getAddressPlace1(),
1132 "Data in updated object did not match submitted data.");
1136 * Update non existent contact.
1138 * @param testName the test name
1139 * @throws Exception the exception
1141 @Test(dataProvider = "testName", groups = {"update"},
1142 dependsOnMethods = {"updateContact", "testContactSubmitRequest"})
1143 public void updateNonExistentContact(String testName) throws Exception {
1144 // Currently a no-op test
1147 // ---------------------------------------------------------------
1148 // CRUD tests : DELETE tests
1149 // ---------------------------------------------------------------
1151 // Note: delete sub-resources in ascending hierarchical order,
1152 // before deleting their parents.
1156 * @param testName the test name
1157 * @throws Exception the exception
1159 @Test(dataProvider = "testName", groups = {"delete"},
1160 dependsOnMethods = {"updateContact"})
1161 public void deleteContact(String testName) throws Exception {
1162 if (logger.isDebugEnabled()) {
1163 logger.debug("parentcsid =" + knownResourceId
1164 + " itemcsid = " + knownItemResourceId
1165 + " csid = " + knownContactResourceId);
1168 // Submit the request to the service and store the response.
1169 PersonAuthorityClient client = new PersonAuthorityClient();
1171 Response res = client.deleteContact(knownResourceId, knownItemResourceId,
1172 knownContactResourceId);
1174 assertStatusCode(res, testName);
1183 public void delete(String testName) throws Exception {
1184 // Do nothing. See localDelete(). This ensure proper test order.
1187 @Test(dataProvider = "testName", dependsOnMethods = {"localDeleteItem"})
1188 public void localDelete(String testName) throws Exception {
1189 super.delete(testName);
1193 public void deleteItem(String testName) throws Exception {
1194 // Do nothing. We need to wait until after the test "localDelete" gets run. When it does,
1195 // its dependencies will get run first and then we can call the base class' delete method.
1198 @Test(dataProvider = "testName", groups = {"delete"},
1199 dependsOnMethods = {"verifyIllegalItemDisplayName", "testContactSubmitRequest", "deleteContact"})
1200 public void localDeleteItem(String testName) throws Exception {
1201 super.deleteItem(testName);
1205 * Delete non existent contact.
1207 * @param testName the test name
1209 @Test(dataProvider = "testName", groups = {"delete"},
1210 dependsOnMethods = {"deleteContact"})
1211 public void deleteNonExistentContact(String testName) {
1212 // Submit the request to the service and store the response.
1213 PersonAuthorityClient client = new PersonAuthorityClient();
1214 setupDeleteNonExistent();
1215 Response res = client.deleteContact(knownResourceId, knownItemResourceId, NON_EXISTENT_ID);
1217 assertStatusCode(res, testName);
1226 * Test contact submit request.
1228 @Test(dataProvider = "testName",
1229 dependsOnMethods = {"createContact", "readContact", "testItemSubmitRequest"})
1230 public void testContactSubmitRequest(String testName) {
1232 // Expected status code: 200 OK
1233 final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
1235 // Submit the request to the service and store the response.
1236 String method = ServiceRequestType.READ.httpMethodName();
1237 String url = getContactResourceURL(knownResourceId,
1238 knownItemResourceId, knownContactResourceId);
1239 int statusCode = submitRequest(method, url);
1241 // Check the status code of the response: does it match
1242 // the expected response(s)?
1243 if (logger.isDebugEnabled()) {
1244 logger.debug("testContactSubmitRequest: url=" + url
1245 + " status=" + statusCode);
1247 Assert.assertEquals(statusCode, EXPECTED_STATUS);
1251 // ---------------------------------------------------------------
1252 // Cleanup of resources created during testing
1253 // ---------------------------------------------------------------
1255 * Deletes all resources created by tests, after all tests have been run.
1257 * This cleanup method will always be run, even if one or more tests fail.
1258 * For this reason, it attempts to remove all resources created
1259 * at any point during testing, even if some of those resources
1260 * may be expected to be deleted by certain tests.
1262 @AfterClass(alwaysRun = true)
1264 public void cleanUp() {
1265 String noTest = System.getProperty("noTestCleanup");
1266 if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
1267 if (logger.isDebugEnabled()) {
1268 logger.debug("Skipping Cleanup phase ...");
1272 if (logger.isDebugEnabled()) {
1273 logger.debug("Cleaning up temporary resources created for testing ...");
1275 String parentResourceId;
1276 String itemResourceId;
1277 String contactResourceId;
1278 // Clean up contact resources.
1279 PersonAuthorityClient client = new PersonAuthorityClient();
1280 parentResourceId = knownResourceId;
1281 for (Map.Entry<String, String> entry : allContactResourceIdsCreated.entrySet()) {
1282 contactResourceId = entry.getKey();
1283 itemResourceId = entry.getValue();
1284 // Note: Any non-success responses from the delete operation
1285 // below are ignored and not reported.
1286 Response res = client.deleteContact(parentResourceId, itemResourceId,
1290 // Clean up item resources.
1291 for (Map.Entry<String, String> entry : allResourceItemIdsCreated.entrySet()) {
1292 itemResourceId = entry.getKey();
1293 parentResourceId = entry.getValue();
1294 // Note: Any non-success responses from the delete operation
1295 // below are ignored and not reported.
1296 Response response = client.deleteItem(parentResourceId, itemResourceId);
1298 int status = response.getStatus();
1299 if (status != Response.Status.OK.getStatusCode()) {
1300 logger.debug(String.format("Could not deleted authority item '%s' in authority '%s'.",
1301 itemResourceId, parentResourceId));
1307 // Clean up item using the SAS client resources.
1308 client = (PersonAuthorityClient) this.getSASClientInstance();
1309 for (Map.Entry<String, String> entry : allResourceItemIdsCreated.entrySet()) {
1310 itemResourceId = entry.getKey();
1311 parentResourceId = entry.getValue();
1312 // Note: Any non-success responses from the delete operation
1313 // below are ignored and not reported.
1314 client.deleteItem(parentResourceId, itemResourceId).close();
1317 // Finally, clean up parent resources.
1322 // ---------------------------------------------------------------
1323 // Utility methods used by tests above
1324 // ---------------------------------------------------------------
1326 * Gets the contact service path component.
1328 * @return the contact service path component
1330 public String getContactServicePathComponent() {
1331 return ContactClient.SERVICE_PATH_COMPONENT;
1335 * Returns the root URL for the item service.
1337 * This URL consists of a base URL for all services, followed by
1338 * a path component for the owning parent, followed by the
1339 * path component for the items.
1341 * @param parentResourceIdentifier An identifier (such as a UUID) for the
1342 * parent authority resource of the relevant item resource.
1344 * @return The root URL for the item service.
1346 protected String getItemServiceRootURL(String parentResourceIdentifier) {
1347 return getResourceURL(parentResourceIdentifier) + "/" + getItemServicePathComponent();
1351 * Returns the URL of a specific item resource managed by a service, and
1352 * designated by an identifier (such as a universally unique ID, or UUID).
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 URL of a specific item resource managed by a service.
1362 protected String getItemResourceURL(String parentResourceIdentifier, String itemResourceIdentifier) {
1363 return getItemServiceRootURL(parentResourceIdentifier) + "/" + itemResourceIdentifier;
1367 * Returns the root URL for the contact service.
1369 * This URL consists of a base URL for all services, followed by
1370 * a path component for the owning authority, followed by the
1371 * path component for the owning item, followed by the path component
1372 * for the contact service.
1374 * @param parentResourceIdentifier An identifier (such as a UUID) for the
1375 * parent authority resource of the relevant item resource.
1377 * @param itemResourceIdentifier An identifier (such as a UUID) for an
1380 * @return The root URL for the contact service.
1382 protected String getContactServiceRootURL(String parentResourceIdentifier,
1383 String itemResourceIdentifier) {
1384 return getItemResourceURL(parentResourceIdentifier, itemResourceIdentifier) + "/"
1385 + getContactServicePathComponent();
1389 * Returns the URL of a specific contact resource managed by a service, and
1390 * designated by an identifier (such as a universally unique ID, or UUID).
1392 * @param parentResourceIdentifier An identifier (such as a UUID) for the
1393 * parent resource of the relevant item resource.
1395 * @param resourceIdentifier An identifier (such as a UUID) for an
1398 * @return The URL of a specific resource managed by a service.
1400 protected String getContactResourceURL(String parentResourceIdentifier,
1401 String itemResourceIdentifier, String contactResourceIdentifier) {
1402 return getContactServiceRootURL(parentResourceIdentifier,
1403 itemResourceIdentifier) + "/" + contactResourceIdentifier;
1407 public void authorityTests(String testName) {
1408 // TODO Auto-generated method stub
1413 protected PersonsCommon updateItemInstance(PersonsCommon personsCommon) {
1415 PersonTermGroupList termList = personsCommon.getPersonTermGroupList();
1416 Assert.assertNotNull(termList);
1417 List<PersonTermGroup> terms = termList.getPersonTermGroup();
1418 Assert.assertNotNull(terms);
1419 Assert.assertTrue(terms.size() > 0);
1420 terms.get(0).setTermDisplayName("updated-" + terms.get(0).getTermDisplayName());
1421 terms.get(0).setTermName("updated-" + terms.get(0).getTermName());
1422 personsCommon.setPersonTermGroupList(termList);
1424 return personsCommon;
1428 protected void compareUpdatedItemInstances(PersonsCommon original,
1429 PersonsCommon updated) throws Exception {
1431 PersonTermGroupList originalTermList = original.getPersonTermGroupList();
1432 Assert.assertNotNull(originalTermList);
1433 List<PersonTermGroup> originalTerms = originalTermList.getPersonTermGroup();
1434 Assert.assertNotNull(originalTerms);
1435 Assert.assertTrue(originalTerms.size() > 0);
1437 PersonTermGroupList updatedTermList = updated.getPersonTermGroupList();
1438 Assert.assertNotNull(updatedTermList);
1439 List<PersonTermGroup> updatedTerms = updatedTermList.getPersonTermGroup();
1440 Assert.assertNotNull(updatedTerms);
1441 Assert.assertTrue(updatedTerms.size() > 0);
1443 Assert.assertEquals(updatedTerms.get(0).getTermDisplayName(),
1444 originalTerms.get(0).getTermDisplayName(),
1445 "Value in updated record did not match submitted data.");
1449 protected PoxPayloadOut createInstance(String commonPartName,
1450 String identifier) {
1451 String shortId = identifier;
1452 String displayName = "displayName-" + shortId;
1453 PoxPayloadOut result =
1454 PersonAuthorityClientUtils.createPersonAuthorityInstance(
1455 displayName, shortId, commonPartName);
1460 protected PoxPayloadOut createNonExistenceInstance(String commonPartName,
1461 String identifier) {
1462 String displayName = "displayName-NON_EXISTENT_ID";
1463 PoxPayloadOut result = PersonAuthorityClientUtils.createPersonAuthorityInstance(
1464 displayName, "NON_EXISTENT_SHORT_ID", commonPartName);
1468 protected PoxPayloadOut createNonExistenceItemInstance(String commonPartName, String identifier) {
1469 Map<String, String> nonexMap = new HashMap<String, String>();
1470 nonexMap.put(PersonJAXBSchema.SHORT_IDENTIFIER, "nonEX");
1471 nonexMap.put(PersonJAXBSchema.GENDER, "male");
1473 List<PersonTermGroup> terms = new ArrayList<PersonTermGroup>();
1474 PersonTermGroup term = new PersonTermGroup();
1475 term.setTermDisplayName("John Wayne");
1476 term.setTermName("John Wayne");
1477 term.setForeName("John");
1478 term.setSurName("Wayne");
1481 Map<String, List<String>> nonexRepeatablesMap = new HashMap<String, List<String>>();
1482 PoxPayloadOut result =
1483 PersonAuthorityClientUtils.createPersonInstance(NON_EXISTENT_ID,
1484 null, //PersonAuthorityClientUtils.createPersonAuthRefName(NON_EXISTENT_ID, null),
1485 nonexMap, terms, nonexRepeatablesMap, commonPartName);
1490 protected PersonauthoritiesCommon updateInstance(PersonauthoritiesCommon personauthoritiesCommon) {
1491 PersonauthoritiesCommon result = new PersonauthoritiesCommon();
1493 result.setDisplayName("updated-" + personauthoritiesCommon.getDisplayName());
1494 result.setVocabType("updated-" + personauthoritiesCommon.getVocabType());
1500 protected void compareUpdatedInstances(PersonauthoritiesCommon original,
1501 PersonauthoritiesCommon updated) throws Exception {
1502 // Verify that the updated resource received the correct data.
1503 Assert.assertEquals(updated.getDisplayName(),
1504 original.getDisplayName(),
1505 "Display name in updated object did not match submitted data.");
1509 protected void verifyReadItemInstance(PersonsCommon item) throws Exception {
1510 // Do nothing for now. Add more 'read' validation checks here if applicable.