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;
29 import javax.ws.rs.core.Response;
31 import org.collectionspace.services.client.AbstractCommonListUtils;
32 import org.collectionspace.services.client.AuthorityClient;
33 import org.collectionspace.services.client.CollectionSpaceClient;
34 import org.collectionspace.services.client.PayloadOutputPart;
35 import org.collectionspace.services.client.PoxPayloadIn;
36 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;
44 import org.collectionspace.services.client.PersonAuthorityClient;
45 import org.collectionspace.services.client.PersonAuthorityClientUtils;
46 import org.collectionspace.services.jaxb.AbstractCommonList;
47 import org.collectionspace.services.PersonJAXBSchema;
48 import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;
49 import org.collectionspace.services.person.PersonauthoritiesCommon;
50 import org.collectionspace.services.person.PersonTermGroup;
51 import org.collectionspace.services.person.PersonTermGroupList;
52 import org.collectionspace.services.person.PersonsCommon;
54 import org.jboss.resteasy.client.ClientResponse;
55 //import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
56 import org.slf4j.Logger;
57 import org.slf4j.LoggerFactory;
58 import org.testng.Assert;
59 import org.testng.annotations.AfterClass;
60 import org.testng.annotations.Test;
63 * PersonAuthorityServiceTest, carries out tests against a
64 * deployed and running PersonAuthority Service.
66 * $LastChangedRevision: 753 $
67 * $LastChangedDate: 2009-09-23 11:03:36 -0700 (Wed, 23 Sep 2009) $
69 public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<PersonauthoritiesCommon, PersonsCommon> { //FIXME: Test classes for Vocab, Person, Org, and Location should have a base class!
72 private final String CLASS_NAME = PersonAuthorityServiceTest.class.getName();
73 private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
76 public String getServicePathComponent() {
77 return PersonAuthorityClient.SERVICE_PATH_COMPONENT;
81 protected String getServiceName() {
82 return PersonAuthorityClient.SERVICE_NAME;
85 public String getItemServicePathComponent() {
86 return AuthorityClient.ITEMS;
88 /** The test forename. */
89 final String TEST_FORE_NAME = "John";
90 /** The test middle name. */
91 final String TEST_MIDDLE_NAME = null;
92 /** The test surname. */
93 final String TEST_SUR_NAME = "Wayne";
94 /** The test birthdate. */
95 final String TEST_BIRTH_DATE = "May 26, 1907";
96 /** The test death date. */
97 final String TEST_DEATH_DATE = "June 11, 1979";
98 //private String knownResourceRefName = null;
99 private String knownItemResourceShortIdentifer = null;
100 // The resource ID of an item resource used for partial term matching tests.
101 private String knownItemPartialTermResourceId = null;
102 /** The known contact resource id. */
103 private String knownContactResourceId = null;
104 /** The all contact resource ids created. */
105 private Map<String, String> allContactResourceIdsCreated =
106 new HashMap<String, String>();
108 protected void setKnownResource(String id, String shortIdentifer,
110 knownResourceId = id;
111 knownResourceShortIdentifer = shortIdentifer;
112 //knownResourceRefName = refName;
115 protected void setKnownItemResource(String id, String shortIdentifer) {
116 knownItemResourceId = id;
117 knownItemResourceShortIdentifer = shortIdentifer;
121 * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
124 protected CollectionSpaceClient getClientInstance() {
125 return new PersonAuthorityClient();
128 // ---------------------------------------------------------------
129 // CRUD tests : CREATE tests
130 // ---------------------------------------------------------------
133 * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
136 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
137 // groups = {"create"})
138 public void create(String testName) throws Exception {
139 // Perform setup, such as initializing the type of service request
140 // (e.g. CREATE, DELETE), its valid and expected status codes, and
141 // its associated HTTP method name (e.g. POST, DELETE).
144 // Submit the request to the service and store the response.
145 PersonAuthorityClient client = new PersonAuthorityClient();
146 String shortId = createIdentifier();
147 String displayName = "displayName-" + shortId;
148 //String baseRefName = PersonAuthorityClientUtils.createPersonAuthRefName(shortId, null);
149 PoxPayloadOut multipart =
150 PersonAuthorityClientUtils.createPersonAuthorityInstance(
151 displayName, shortId, client.getCommonPartName());
154 Response res = client.create(multipart);
156 assertStatusCode(res, testName);
157 newID = extractId(res);
163 // Save values for additional tests
164 if (knownResourceId == null) {
165 setKnownResource(newID, shortId, null ); //baseRefName);
166 if (logger.isDebugEnabled()) {
167 logger.debug(testName + ": knownResourceId=" + knownResourceId);
170 // Store the IDs from every resource created by tests,
171 // so they can be deleted after tests have been run.
172 allResourceIdsCreated.add(newID);
176 protected PoxPayloadOut createInstance(String identifier) {
177 PersonAuthorityClient client = new PersonAuthorityClient();
178 String displayName = "displayName-" + identifier;
179 PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
180 displayName, identifier, client.getCommonPartName());
185 protected PoxPayloadOut createItemInstance(String parentCsid, String identifier) {
186 String headerLabel = new PersonAuthorityClient().getItemCommonPartName();
188 HashMap<String, String> personInfo = new HashMap<String, String>();
189 String shortId = "MarkTwainAuthor";
190 personInfo.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId);
192 List<PersonTermGroup> terms = new ArrayList<PersonTermGroup>();
193 PersonTermGroup term = new PersonTermGroup();
194 term.setTermDisplayName("Mark Twain Primary");
195 term.setTermName("MarkTwainPrimary");
198 term = new PersonTermGroup();
199 term.setTermDisplayName("Samuel Langhorne Clemens");
200 term.setTermName("SamuelLanghorneClemens");
203 term = new PersonTermGroup();
204 term.setTermDisplayName("Sam Clemens");
205 term.setTermName("SamClemens");
208 term = new PersonTermGroup();
209 term.setTermDisplayName("Huck Fin");
210 term.setTermName("Huck Fin");
213 return PersonAuthorityClientUtils.createPersonInstance(parentCsid, identifier, personInfo, terms, headerLabel);
217 * Creates an item in an authority, using test data.
219 * @param vcsid the vcsid
220 * @param authRefName the auth ref name
224 protected String createItemInAuthority(String vcsid) {
226 final String testName = "createItemInAuthority";
227 if (logger.isDebugEnabled()) {
228 logger.debug(testName + ":" + vcsid + "...");
231 Map<String, String> johnWayneMap = new HashMap<String, String>();
233 // Fill the property map
235 String shortId = "johnWayneActor";
236 johnWayneMap.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId);
237 johnWayneMap.put(PersonJAXBSchema.GENDER, "male");
238 johnWayneMap.put(PersonJAXBSchema.BIRTH_DATE, TEST_BIRTH_DATE);
239 johnWayneMap.put(PersonJAXBSchema.BIRTH_PLACE, "Winterset, Iowa");
240 johnWayneMap.put(PersonJAXBSchema.DEATH_DATE, TEST_DEATH_DATE);
241 johnWayneMap.put(PersonJAXBSchema.BIO_NOTE, "born Marion Robert Morrison and better"
242 + "known by his stage name John Wayne, was an American film actor, director "
243 + "and producer. He epitomized rugged masculinity and has become an enduring "
244 + "American icon. He is famous for his distinctive voice, walk and height. "
245 + "He was also known for his conservative political views and his support in "
246 + "the 1950s for anti-communist positions.");
248 List<PersonTermGroup> johnWayneTerms = new ArrayList<PersonTermGroup>();
249 PersonTermGroup term = new PersonTermGroup();
250 term.setTermDisplayName("John Wayne DisplayName");
251 term.setTermName("John Wayne");
252 term.setForeName(TEST_FORE_NAME);
253 term.setSurName(TEST_SUR_NAME);
254 johnWayneTerms.add(term);
256 Map<String, List<String>> johnWayneRepeatablesMap = new HashMap<String, List<String>>();
257 List<String> johnWayneGroups = new ArrayList<String>();
258 johnWayneGroups.add("Irish");
259 johnWayneGroups.add("Scottish");
260 johnWayneRepeatablesMap.put(PersonJAXBSchema.GROUPS, johnWayneGroups);
262 return createItemInAuthority(vcsid, null /*authRefName*/, shortId, johnWayneMap, johnWayneTerms, johnWayneRepeatablesMap);
267 * Creates an item in an authority.
269 * @param vcsid the vcsid
270 * @param authRefName the auth ref name
271 * @param itemFieldProperties a set of properties specifying the values of fields.
272 * @param itemRepeatableFieldProperties a set of properties specifying the values of repeatable fields.
275 private String createItemInAuthority(String vcsid, String authRefName, String shortId,
276 Map itemFieldProperties, List<PersonTermGroup> terms, Map itemRepeatableFieldProperties) {
278 final String testName = "createItemInAuthority";
279 if (logger.isDebugEnabled()) {
280 logger.debug(testName + ":" + vcsid + "...");
283 // Submit the request to the service and store the response.
284 PersonAuthorityClient client = new PersonAuthorityClient();
285 PoxPayloadOut multipart =
286 PersonAuthorityClientUtils.createPersonInstance(vcsid, null /*authRefName*/, itemFieldProperties,
287 terms, itemRepeatableFieldProperties, client.getItemCommonPartName());
289 Response res = client.createItem(vcsid, multipart);
292 assertStatusCode(res, testName);
293 newID = PersonAuthorityClientUtils.extractId(res);
300 // Store the ID returned from the first item resource created
301 // for additional tests below.
302 if (knownItemResourceId == null) {
303 setKnownItemResource(newID, shortId);
304 if (logger.isDebugEnabled()) {
305 logger.debug(testName + ": knownItemResourceId=" + knownItemResourceId);
308 if (logger.isDebugEnabled()) {
309 logger.debug(testName + " (created):" + vcsid + "/(" + newID + "," + shortId + ")");
312 // Store the IDs from any item resources created
313 // by tests, along with the IDs of their parents, so these items
314 // can be deleted after all tests have been run.
315 allResourceItemIdsCreated.put(newID, vcsid);
321 * Creates the contact.
323 * @param testName the test name
325 @Test(dataProvider = "testName", groups = {"create"},
326 dependsOnMethods = {"createItem"})
327 public void createContact(String testName) {
329 String newID = createContactInItem(knownResourceId, knownItemResourceId);
333 * Creates the contact in item.
335 * @param parentcsid the parentcsid
336 * @param itemcsid the itemcsid
339 private String createContactInItem(String parentcsid, String itemcsid) {
341 final String testName = "createContactInItem";
342 if (logger.isDebugEnabled()) {
343 logger.debug(testName + ":...");
345 // Submit the request to the service and store the response.
346 PersonAuthorityClient client = new PersonAuthorityClient();
347 String identifier = createIdentifier();
348 PoxPayloadOut multipart = ContactClientUtils.createContactInstance(parentcsid,
349 itemcsid, identifier, new ContactClient().getCommonPartName());
352 ClientResponse<Response> res =
353 client.createContact(parentcsid, itemcsid, multipart);
356 assertStatusCode(res, testName);
357 newID = PersonAuthorityClientUtils.extractId(res);
360 res.releaseConnection();
364 // Store the ID returned from the first contact resource created
365 // for additional tests below.
366 if (knownContactResourceId == null) {
367 knownContactResourceId = newID;
368 if (logger.isDebugEnabled()) {
369 logger.debug(testName + ": knownContactResourceId=" + knownContactResourceId);
373 // Store the IDs from any contact resources created
374 // by tests, along with the IDs of their parent items,
375 // so these items can be deleted after all tests have been run.
376 allContactResourceIdsCreated.put(newID, itemcsid);
382 * Attempts to create an authority with an short identifier that contains
383 * non-word characters.
385 * @param testName the test name
387 @Test(dataProvider = "testName", groups = {"create", "nonWordCharsInShortId"})
388 public void createWithShortIdNonWordChars(String testName) throws Exception {
389 testExpectedStatusCode = STATUS_BAD_REQUEST;
390 testRequestType = ServiceRequestType.CREATE;
391 testSetup(testExpectedStatusCode, testRequestType);
393 // Create the payload to be included in the body of the request
394 PersonAuthorityClient client = new PersonAuthorityClient();
395 String shortId = createIdentifier() + "*" + createIdentifier();
396 String displayName = "displayName-" + shortId;
397 PoxPayloadOut multipart =
398 PersonAuthorityClientUtils.createPersonAuthorityInstance(
399 displayName, shortId, client.getCommonPartName());
401 // Submit the request to the service and store the response.
402 Response res = client.create(multipart);
404 // Check the status code of the response: does it match
405 // the expected response(s)?
407 assertStatusCode(res, testName);
416 * Attempts to create an item with an short identifier that contains
417 * non-word characters.
419 * @param testName the test name
421 @Test(dataProvider = "testName", groups = {"create", "nonWordCharsInShortId"},
422 dependsOnMethods = {"org.collectionspace.services.client.test.AbstractServiceTestImpl.create"})
423 public void createItemWithShortIdNonWordChars(String testName) {
424 testExpectedStatusCode = STATUS_BAD_REQUEST;
425 testRequestType = ServiceRequestType.CREATE;
426 testSetup(testExpectedStatusCode, testRequestType);
428 PersonAuthorityClient client = new PersonAuthorityClient();
429 // Create the payload to be included in the body of the request
430 String shortId = "7-Eleven";
431 Map<String, String> fieldProperties = new HashMap<String, String>();
432 fieldProperties.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId);
434 List<PersonTermGroup> terms = new ArrayList<PersonTermGroup>();
435 PersonTermGroup term = new PersonTermGroup();
436 term.setTermDisplayName(shortId);
437 term.setTermName(shortId);
440 final Map NULL_REPEATABLE_FIELD_PROPERTIES = null;
441 PoxPayloadOut multipart =
442 PersonAuthorityClientUtils.createPersonInstance(knownResourceId,
443 null /*knownResourceRefName*/, fieldProperties, terms,
444 NULL_REPEATABLE_FIELD_PROPERTIES, client.getItemCommonPartName());
446 // Send the request and receive a response
447 Response res = client.createItem(knownResourceId, multipart);
448 // Check the status code of the response: does it match
449 // the expected response(s)?
451 assertStatusCode(res, testName);
459 // ---------------------------------------------------------------
460 // CRUD tests : CREATE LIST tests
461 // ---------------------------------------------------------------
464 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
467 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
468 // groups = {"createList"}, dependsOnGroups = {"create"})
469 public void createList(String testName) throws Exception {
470 for (int i = 0; i < nItemsToCreateInList; i++) {
476 * Creates the contact list.
478 * @param testName the test name
479 * @throws Exception the exception
481 @Test(dataProvider = "testName", groups = {"createList"},
482 dependsOnMethods = {"org.collectionspace.services.client.test.AbstractAuthorityServiceTest.createItemList"})
483 public void createContactList(String testName) throws Exception {
484 // Add contacts to the initially-created, known item record.
485 for (int j = 0; j < nItemsToCreateInList; j++) {
486 createContact(testName);
490 // ---------------------------------------------------------------
491 // CRUD tests : READ tests
492 // ---------------------------------------------------------------
495 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
498 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
499 // groups = {"read"}, dependsOnGroups = {"create"})
500 public void read(String testName) throws Exception {
501 readInternal(testName, knownResourceId, null);
507 * @param testName the test name
508 * @throws Exception the exception
511 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
512 // groups = {"read"}, dependsOnMethods = {"read"})
513 public void readByName(String testName) throws Exception {
514 readInternal(testName, null, knownResourceShortIdentifer);
517 protected void readInternal(String testName, String CSID, String shortId) {
518 // Submit the request to the service and store the response.
519 PersonAuthorityClient client = new PersonAuthorityClient();
523 res = client.read(CSID);
524 } else if (shortId != null) {
525 res = client.readByName(shortId);
527 Assert.fail("readInternal: Internal error. One of CSID or shortId must be non-null");
530 assertStatusCode(res, testName);
531 //FIXME: remove the following try catch once Aron fixes signatures
533 PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
534 PersonauthoritiesCommon personAuthority = (PersonauthoritiesCommon) extractPart(input,
535 client.getCommonPartName(), PersonauthoritiesCommon.class);
536 Assert.assertNotNull(personAuthority);
537 } catch (Exception e) {
538 throw new RuntimeException(e);
550 * @param testName the test name
551 * @throws Exception the exception
553 @Test(dataProvider = "testName", groups = {"readItem", "readNamedItemInNamedAuth"},
554 dependsOnMethods = {"readItemInNamedAuth"})
555 public void readNamedItem(String testName) throws Exception {
556 readItemInternal(testName, knownResourceId, null, null, knownItemResourceShortIdentifer);
560 * Read item in Named Auth.
562 * @param testName the test name
563 * @throws Exception the exception
565 @Test(dataProvider = "testName", groups = {"readItem"},
566 dependsOnMethods = {"readItem"})
567 public void readItemInNamedAuth(String testName) throws Exception {
568 readItemInternal(testName, null, knownResourceShortIdentifer, knownItemResourceId, null);
573 * Read Named item in Named Auth.
575 * @param testName the test name
576 * @throws Exception the exception
578 @Test(dataProvider = "testName", groups = {"readItem"},
579 dependsOnMethods = {"readNamedItem"})
580 public void readNamedItemInNamedAuth(String testName) throws Exception {
581 readItemInternal(testName, null, knownResourceShortIdentifer, null, knownItemResourceShortIdentifer);
584 protected void readItemInternal(String testName,
585 String authCSID, String authShortId, String itemCSID, String itemShortId)
588 if (logger.isDebugEnabled()) {
589 logger.debug("Reading:" + ((authCSID != null) ? authCSID : authShortId) + "/"
590 + ((itemCSID != null) ? authCSID : itemShortId));
593 // Submit the request to the service and store the response.
594 PersonAuthorityClient client = new PersonAuthorityClient();
597 if (authCSID != null) {
598 if (itemCSID != null) {
599 res = client.readItem(authCSID, itemCSID);
600 } else if (itemShortId != null) {
601 res = client.readNamedItem(authCSID, itemShortId);
603 Assert.fail("readInternal: Internal error. One of CSID or shortId must be non-null");
605 } else if (authShortId != null) {
606 if (itemCSID != null) {
607 res = client.readItemInNamedAuthority(authShortId, itemCSID);
608 } else if (itemShortId != null) {
609 res = client.readNamedItemInNamedAuthority(authShortId, itemShortId);
611 Assert.fail("readInternal: Internal error. One of CSID or shortId must be non-null");
614 Assert.fail("readInternal: Internal error. One of authCSID or authShortId must be non-null");
618 assertStatusCode(res, testName);
619 // Check whether we've received a person.
620 PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
621 PersonsCommon person = (PersonsCommon) extractPart(input,
622 client.getItemCommonPartName(), PersonsCommon.class);
623 Assert.assertNotNull(person);
624 boolean showFull = true;
625 if (showFull && logger.isDebugEnabled()) {
626 logger.debug(testName + ": returned payload:");
627 logger.debug(objectAsXmlString(person, PersonsCommon.class));
630 // Check that the person item is within the expected Person Authority.
631 Assert.assertEquals(person.getInAuthority(), knownResourceId);
633 // Verify the number and contents of values in a repeatable field,
634 // as created in the instance record used for testing.
635 List<String> groups = person.getGroups().getGroup();
636 Assert.assertTrue(groups.size() > 0);
637 Assert.assertNotNull(groups.get(0));
645 // Note: This test depends on server-side validation logic to require
646 // a non-null (and potentially, non-empty) displayname for each term,
647 // and will fail if that validation is not present.
650 * Verify illegal item display name.
652 * @param testName the test name
653 * @throws Exception the exception
655 @Test(dataProvider = "testName", groups = {"update"})
656 public void verifyIllegalItemDisplayName(String testName) throws Exception {
657 // Perform setup for read.
660 // Submit the request to the service and store the response.
661 PersonAuthorityClient client = new PersonAuthorityClient();
662 Response res = client.readItem(knownResourceId, knownItemResourceId);
663 PoxPayloadIn input = null;
665 assertStatusCode(res, testName);
666 input = new PoxPayloadIn((String)res.getEntity());
673 // Make an invalid UPDATE request, without a display name
675 PersonsCommon person = (PersonsCommon) extractPart(input,
676 client.getItemCommonPartName(), PersonsCommon.class);
677 Assert.assertNotNull(person);
678 // Try to Update with no displayName
679 PersonTermGroupList termList = person.getPersonTermGroupList();
680 Assert.assertNotNull(termList);
681 List<PersonTermGroup> terms = termList.getPersonTermGroup();
682 Assert.assertNotNull(terms);
683 Assert.assertTrue(terms.size() > 0);
684 terms.get(0).setTermDisplayName(null);
685 terms.get(0).setTermName(null);
687 // Submit the updated resource to the service and store the response.
688 PoxPayloadOut output = new PoxPayloadOut(PersonAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
689 PayloadOutputPart commonPart = output.addPart(client.getItemCommonPartName(), person);
690 setupUpdateWithInvalidBody();
691 res = client.updateItem(knownResourceId, knownItemResourceId, output);
693 assertStatusCode(res, testName);
704 * @param testName the test name
705 * @throws Exception the exception
707 @Test(dataProvider = "testName", groups = {"readItem"},
708 dependsOnMethods = {"createContact", "org.collectionspace.services.client.test.AbstractAuthorityServiceTest.readItem"})
709 public void readContact(String testName) throws Exception {
713 // Submit the request to the service and store the response.
714 PersonAuthorityClient client = new PersonAuthorityClient();
715 PoxPayloadIn input = null;
716 ClientResponse<String> res =
717 client.readContact(knownResourceId, knownItemResourceId,
718 knownContactResourceId);
720 assertStatusCode(res, testName);
721 // Check whether we've received a contact.
722 input = new PoxPayloadIn(res.getEntity());
725 res.releaseConnection();
729 ContactsCommon contact = (ContactsCommon) extractPart(input,
730 new ContactClient().getCommonPartName(), ContactsCommon.class);
731 Assert.assertNotNull(contact);
732 boolean showFull = true;
733 if (showFull && logger.isDebugEnabled()) {
734 logger.debug(testName + ": returned payload:");
735 logger.debug(objectAsXmlString(contact, ContactsCommon.class));
737 Assert.assertEquals(contact.getInAuthority(), knownResourceId);
738 Assert.assertEquals(contact.getInItem(), knownItemResourceId);
743 * Read contact non existent.
745 * @param testName the test name
747 @Test(dataProvider = "testName", groups = {"readItem"},
748 dependsOnMethods = {"readContact"})
749 public void readContactNonExistent(String testName) {
751 setupReadNonExistent();
753 // Submit the request to the service and store the response.
754 PersonAuthorityClient client = new PersonAuthorityClient();
755 ClientResponse<String> res =
756 client.readContact(knownResourceId, knownItemResourceId, NON_EXISTENT_ID);
758 assertStatusCode(res, testName);
761 res.releaseConnection();
766 // ---------------------------------------------------------------
767 // CRUD tests : READ_LIST tests
768 // ---------------------------------------------------------------
774 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
775 // groups = {"readList"}, dependsOnMethods = {"readList"})
776 public void readItemList(String testName) {
777 readItemList(knownAuthorityWithItems, null, testName);
781 * Read item list by authority name.
784 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
785 // groups = {"readList"}, dependsOnMethods = {"readItemList"})
786 public void readItemListByName(String testName) {
787 readItemList(null, READITEMS_SHORT_IDENTIFIER, testName);
793 * @param vcsid the vcsid
794 * @param name the name
796 private void readItemList(String vcsid, String name, String testName) {
798 // Submit the request to the service and store the response.
799 PersonAuthorityClient client = new PersonAuthorityClient();
800 ClientResponse<AbstractCommonList> res = null;
802 res = client.readItemList(vcsid, null, null);
803 } else if (name != null) {
804 res = client.readItemListForNamedAuthority(name, null, null);
806 Assert.fail("readItemList passed null csid and name!");
808 AbstractCommonList list = null;
810 assertStatusCode(res, testName);
811 list = res.getEntity();
814 res.releaseConnection();
818 List<AbstractCommonList.ListItem> items = list.getListItem();
819 int nItemsReturned = items.size();
820 // There will be 'nItemsToCreateInList'
821 // items created by the createItemList test,
822 // all associated with the same parent resource.
823 int nExpectedItems = nItemsToCreateInList;
824 if (logger.isDebugEnabled()) {
825 logger.debug(testName + ": Expected "
826 + nExpectedItems + " items; got: " + nItemsReturned);
828 Assert.assertEquals(nItemsReturned, nExpectedItems);
830 for (AbstractCommonList.ListItem item : items) {
832 AbstractCommonListUtils.ListItemGetElementValue(item, AuthorityItemJAXBSchema.REF_NAME);
833 Assert.assertTrue((null != value), "Item refName is null!");
835 // Per CSPACE-5132, lists items still return a field named displayName,
836 // not termDisplayName, for backward compatibility.
837 // (The format of list items will change significantly in CSPACE-5134.)
839 AbstractCommonListUtils.ListItemGetElementValue(item, AuthorityItemJAXBSchema.TERM_DISPLAY_NAME);
840 Assert.assertTrue((null != value), "Item termDisplayName is null!");
842 if (logger.isTraceEnabled()) {
843 AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
850 @Test(groups = {"readList"},
851 dependsOnMethods = {"org.collectionspace.services.client.test.AbstractAuthorityServiceTest.readItemList"})
852 public void readContactList() {
853 readContactList(knownResourceId, knownItemResourceId);
859 * @param parentcsid the parentcsid
860 * @param itemcsid the itemcsid
862 private void readContactList(String parentcsid, String itemcsid) {
863 final String testName = "readContactList";
868 // Submit the request to the service and store the response.
869 PersonAuthorityClient client = new PersonAuthorityClient();
870 AbstractCommonList list = null;
871 ClientResponse<AbstractCommonList> res =
872 client.readContactList(parentcsid, itemcsid);
874 assertStatusCode(res, testName);
875 list = res.getEntity();
878 res.releaseConnection();
882 List<AbstractCommonList.ListItem> listitems =
884 int nItemsReturned = listitems.size();
885 // There will be one item created, associated with a
886 // known parent resource, by the createItem test.
888 // In addition, there will be 'nItemsToCreateInList'
889 // additional items created by the createItemList test,
890 // all associated with the same parent resource.
891 int nExpectedItems = nItemsToCreateInList + 1;
892 if (logger.isDebugEnabled()) {
893 logger.debug(testName + ": Expected "
894 + nExpectedItems + " items; got: " + nItemsReturned);
896 Assert.assertEquals(nItemsReturned, nExpectedItems);
898 // Optionally output additional data about list members for debugging.
899 boolean iterateThroughList = false;
900 if (iterateThroughList && logger.isDebugEnabled()) {
901 AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
906 // There are no failure outcome tests at present.
907 // ---------------------------------------------------------------
908 // CRUD tests : UPDATE tests
909 // ---------------------------------------------------------------
912 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
915 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
916 // groups = {"update"}, dependsOnGroups = {"readItem", "readList"})
917 public void update(String testName) throws Exception {
918 // Retrieve the contents of a resource to update.
919 PersonAuthorityClient client = new PersonAuthorityClient();
920 PoxPayloadIn input = null;
922 Response res = client.read(knownResourceId);
924 assertStatusCode(res, testName);
925 if (logger.isDebugEnabled()) {
926 logger.debug("got PersonAuthority to update with ID: " + knownResourceId);
928 input = new PoxPayloadIn((String)res.getEntity());
935 PersonauthoritiesCommon personAuthority = (PersonauthoritiesCommon) extractPart(input,
936 client.getCommonPartName(), PersonauthoritiesCommon.class);
937 Assert.assertNotNull(personAuthority);
939 // Update the contents of this resource.
940 personAuthority.setDisplayName("updated-" + personAuthority.getDisplayName());
941 personAuthority.setVocabType("updated-" + personAuthority.getVocabType());
942 if (logger.isDebugEnabled()) {
943 logger.debug("to be updated PersonAuthority");
944 logger.debug(objectAsXmlString(personAuthority, PersonauthoritiesCommon.class));
947 // Submit the updated resource to the service and store the response.
948 PoxPayloadOut output = new PoxPayloadOut(PersonAuthorityClient.SERVICE_PAYLOAD_NAME);
949 PayloadOutputPart commonPart = output.addPart(client.getCommonPartName(), personAuthority);
951 res = client.update(knownResourceId, output);
953 assertStatusCode(res, testName);
954 // Retrieve the updated resource and verify that its contents exist.
955 input = new PoxPayloadIn((String)res.getEntity());
962 PersonauthoritiesCommon updatedPersonAuthority =
963 (PersonauthoritiesCommon) extractPart(input,
964 client.getCommonPartName(), PersonauthoritiesCommon.class);
965 Assert.assertNotNull(updatedPersonAuthority);
967 // Verify that the updated resource received the correct data.
968 Assert.assertEquals(updatedPersonAuthority.getDisplayName(),
969 personAuthority.getDisplayName(),
970 "Data in updated object did not match submitted data.");
976 * @param testName the test name
977 * @throws Exception the exception
980 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
981 // groups = {"update"}, dependsOnMethods = {"update"})
982 public void updateItem(String testName) throws Exception {
983 // Retrieve the contents of a resource to update.
984 PersonAuthorityClient client = new PersonAuthorityClient();
985 PoxPayloadIn input = null;
987 Response res = client.readItem(knownResourceId, knownItemResourceId);
989 assertStatusCode(res, testName);
990 if (logger.isDebugEnabled()) {
991 logger.debug("got Person to update with ID: "
992 + knownItemResourceId
993 + " in PersonAuthority: " + knownResourceId);
995 input = new PoxPayloadIn((String)res.getEntity());
1002 PersonsCommon person = (PersonsCommon) extractPart(input,
1003 client.getItemCommonPartName(), PersonsCommon.class);
1004 Assert.assertNotNull(person);
1006 if (logger.isDebugEnabled() == true) {
1007 logger.debug("About to update the following person...");
1008 logger.debug(objectAsXmlString(person, PersonsCommon.class));
1011 // Update the contents of this resource.
1012 person.setCsid(null);
1013 PersonTermGroupList termList = person.getPersonTermGroupList();
1014 Assert.assertNotNull(termList);
1015 List<PersonTermGroup> terms = termList.getPersonTermGroup();
1016 Assert.assertNotNull(terms);
1017 Assert.assertTrue(terms.size() > 0);
1018 String foreName = terms.get(0).getForeName();
1019 String updatedForeName = "updated-" + foreName;
1020 terms.get(0).setForeName(updatedForeName);
1021 if (logger.isDebugEnabled()) {
1022 logger.debug("to be updated Person");
1023 logger.debug(objectAsXmlString(person,
1024 PersonsCommon.class));
1027 // Submit the updated resource to the service and store the response.
1028 PoxPayloadOut output = new PoxPayloadOut(PersonAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
1029 PayloadOutputPart commonPart = output.addPart(client.getItemCommonPartName(), person);
1031 res = client.updateItem(knownResourceId, knownItemResourceId, output);
1033 assertStatusCode(res, testName);
1034 // Retrieve the updated resource and verify that its contents exist.
1035 input = new PoxPayloadIn((String)res.getEntity());
1042 PersonsCommon updatedPerson =
1043 (PersonsCommon) extractPart(input,
1044 client.getItemCommonPartName(), PersonsCommon.class);
1045 Assert.assertNotNull(updatedPerson);
1047 if (logger.isDebugEnabled() == true) {
1048 logger.debug("Updated to following person to:");
1049 logger.debug(objectAsXmlString(updatedPerson, PersonsCommon.class));
1052 // Verify that the updated resource received the correct data.
1053 PersonTermGroupList updatedTermList = person.getPersonTermGroupList();
1054 Assert.assertNotNull(updatedTermList);
1055 List<PersonTermGroup> updatedTerms = termList.getPersonTermGroup();
1056 Assert.assertNotNull(updatedTerms);
1057 Assert.assertEquals(updatedTerms.get(0).getForeName(), updatedForeName,
1058 "Data in updated Person did not match submitted data.");
1064 * @param testName the test name
1065 * @throws Exception the exception
1067 @Test(dataProvider = "testName", groups = {"update"},
1068 dependsOnMethods = {"readContact", "testContactSubmitRequest",
1069 "org.collectionspace.services.client.test.AbstractAuthorityServiceTest.updateItem"})
1070 public void updateContact(String testName) throws Exception {
1071 String contactsCommonLabel = new ContactClient().getCommonPartName();
1073 // Retrieve the contents of a resource to update.
1074 PersonAuthorityClient client = new PersonAuthorityClient();
1075 PoxPayloadIn input = null;
1077 ClientResponse<String> res =
1078 client.readContact(knownResourceId, knownItemResourceId, knownContactResourceId);
1080 assertStatusCode(res, testName);
1081 if (logger.isDebugEnabled()) {
1082 logger.debug("got Contact to update with ID: "
1083 + knownContactResourceId
1084 + " in item: " + knownItemResourceId
1085 + " in parent: " + knownResourceId);
1087 input = new PoxPayloadIn(res.getEntity());
1094 ContactsCommon contact = (ContactsCommon) extractPart(input,
1095 contactsCommonLabel, ContactsCommon.class);
1096 Assert.assertNotNull(contact);
1098 // Verify the contents of this resource
1099 AddressGroupList addressGroupList = contact.getAddressGroupList();
1100 Assert.assertNotNull(addressGroupList);
1101 List<AddressGroup> addressGroups = addressGroupList.getAddressGroup();
1102 Assert.assertNotNull(addressGroups);
1103 Assert.assertTrue(addressGroups.size() > 0);
1104 String addressPlace1 = addressGroups.get(0).getAddressPlace1();
1105 Assert.assertNotNull(addressPlace1);
1107 // Update the contents of this resource.
1108 addressGroups.get(0).setAddressPlace1("updated-" + addressPlace1);
1109 contact.setAddressGroupList(addressGroupList);
1110 if (logger.isDebugEnabled()) {
1111 logger.debug("to be updated Contact");
1112 logger.debug(objectAsXmlString(contact,
1113 ContactsCommon.class));
1116 // Submit the updated resource to the service and store the response.
1117 PoxPayloadOut output = new PoxPayloadOut(ContactClient.SERVICE_PAYLOAD_NAME);
1118 PayloadOutputPart commonPart = output.addPart(contactsCommonLabel, contact);
1120 res = client.updateContact(knownResourceId, knownItemResourceId, knownContactResourceId, output);
1122 assertStatusCode(res, testName);
1123 // Retrieve the updated resource and verify that its contents exist.
1124 input = new PoxPayloadIn(res.getEntity());;
1130 ContactsCommon updatedContact = (ContactsCommon) extractPart(input,
1131 contactsCommonLabel, ContactsCommon.class);
1132 Assert.assertNotNull(updatedContact);
1134 // Verify that the updated resource received the correct data.
1135 Assert.assertEquals(updatedContact.getAddressGroupList().getAddressGroup().get(0).getAddressPlace1(),
1136 contact.getAddressGroupList().getAddressGroup().get(0).getAddressPlace1(),
1137 "Data in updated object did not match submitted data.");
1141 * Update non existent contact.
1143 * @param testName the test name
1144 * @throws Exception the exception
1146 @Test(dataProvider = "testName", groups = {"update"},
1147 dependsOnMethods = {"updateContact", "testContactSubmitRequest"})
1148 public void updateNonExistentContact(String testName) throws Exception {
1149 // Currently a no-op test
1152 // ---------------------------------------------------------------
1153 // CRUD tests : DELETE tests
1154 // ---------------------------------------------------------------
1156 // Note: delete sub-resources in ascending hierarchical order,
1157 // before deleting their parents.
1161 * @param testName the test name
1162 * @throws Exception the exception
1164 @Test(dataProvider = "testName", groups = {"delete"},
1165 dependsOnMethods = {"updateContact"})
1166 public void deleteContact(String testName) throws Exception {
1167 if (logger.isDebugEnabled()) {
1168 logger.debug("parentcsid =" + knownResourceId
1169 + " itemcsid = " + knownItemResourceId
1170 + " csid = " + knownContactResourceId);
1173 // Submit the request to the service and store the response.
1174 PersonAuthorityClient client = new PersonAuthorityClient();
1176 ClientResponse<Response> res =
1177 client.deleteContact(knownResourceId, knownItemResourceId, knownContactResourceId);
1179 assertStatusCode(res, testName);
1188 public void delete(String testName) throws Exception {
1189 // Do nothing. See localDelete(). This ensure proper test order.
1192 @Test(dataProvider = "testName", dependsOnMethods = {"localDeleteItem"})
1193 public void localDelete(String testName) throws Exception {
1194 super.delete(testName);
1198 public void deleteItem(String testName) throws Exception {
1199 // Do nothing. We need to wait until after the test "localDelete" gets run. When it does,
1200 // its dependencies will get run first and then we can call the base class' delete method.
1203 @Test(dataProvider = "testName", groups = {"delete"},
1204 dependsOnMethods = {"verifyIllegalItemDisplayName", "testContactSubmitRequest", "deleteContact"})
1205 public void localDeleteItem(String testName) throws Exception {
1206 super.deleteItem(testName);
1210 * Delete non existent contact.
1212 * @param testName the test name
1214 @Test(dataProvider = "testName", groups = {"delete"},
1215 dependsOnMethods = {"deleteContact"})
1216 public void deleteNonExistentContact(String testName) {
1217 // Submit the request to the service and store the response.
1218 PersonAuthorityClient client = new PersonAuthorityClient();
1219 setupDeleteNonExistent();
1220 ClientResponse<Response> res =
1221 client.deleteContact(knownResourceId, knownItemResourceId, NON_EXISTENT_ID);
1223 assertStatusCode(res, testName);
1232 * Test contact submit request.
1234 @Test(dataProvider = "testName",
1235 dependsOnMethods = {"createContact", "readContact", "testItemSubmitRequest"})
1236 public void testContactSubmitRequest(String testName) {
1238 // Expected status code: 200 OK
1239 final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
1241 // Submit the request to the service and store the response.
1242 String method = ServiceRequestType.READ.httpMethodName();
1243 String url = getContactResourceURL(knownResourceId,
1244 knownItemResourceId, knownContactResourceId);
1245 int statusCode = submitRequest(method, url);
1247 // Check the status code of the response: does it match
1248 // the expected response(s)?
1249 if (logger.isDebugEnabled()) {
1250 logger.debug("testContactSubmitRequest: url=" + url
1251 + " status=" + statusCode);
1253 Assert.assertEquals(statusCode, EXPECTED_STATUS);
1257 // ---------------------------------------------------------------
1258 // Cleanup of resources created during testing
1259 // ---------------------------------------------------------------
1261 * Deletes all resources created by tests, after all tests have been run.
1263 * This cleanup method will always be run, even if one or more tests fail.
1264 * For this reason, it attempts to remove all resources created
1265 * at any point during testing, even if some of those resources
1266 * may be expected to be deleted by certain tests.
1268 @AfterClass(alwaysRun = true)
1270 public void cleanUp() {
1271 String noTest = System.getProperty("noTestCleanup");
1272 if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
1273 if (logger.isDebugEnabled()) {
1274 logger.debug("Skipping Cleanup phase ...");
1278 if (logger.isDebugEnabled()) {
1279 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 ClientResponse<Response> res =
1293 client.deleteContact(parentResourceId, itemResourceId, contactResourceId);
1296 // Clean up item resources.
1297 for (Map.Entry<String, String> entry : allResourceItemIdsCreated.entrySet()) {
1298 itemResourceId = entry.getKey();
1299 parentResourceId = entry.getValue();
1300 // Note: Any non-success responses from the delete operation
1301 // below are ignored and not reported.
1302 client.deleteItem(parentResourceId, itemResourceId).close();
1304 // Clean up parent resources.
1308 // ---------------------------------------------------------------
1309 // Utility methods used by tests above
1310 // ---------------------------------------------------------------
1312 * Gets the contact service path component.
1314 * @return the contact service path component
1316 public String getContactServicePathComponent() {
1317 return ContactClient.SERVICE_PATH_COMPONENT;
1321 * Returns the root URL for the item service.
1323 * This URL consists of a base URL for all services, followed by
1324 * a path component for the owning parent, followed by the
1325 * path component for the items.
1327 * @param parentResourceIdentifier An identifier (such as a UUID) for the
1328 * parent authority resource of the relevant item resource.
1330 * @return The root URL for the item service.
1332 protected String getItemServiceRootURL(String parentResourceIdentifier) {
1333 return getResourceURL(parentResourceIdentifier) + "/" + getItemServicePathComponent();
1337 * Returns the URL of a specific item resource managed by a service, and
1338 * designated by an identifier (such as a universally unique ID, or UUID).
1340 * @param parentResourceIdentifier An identifier (such as a UUID) for the
1341 * parent authority resource of the relevant item resource.
1343 * @param itemResourceIdentifier An identifier (such as a UUID) for an
1346 * @return The URL of a specific item resource managed by a service.
1348 protected String getItemResourceURL(String parentResourceIdentifier, String itemResourceIdentifier) {
1349 return getItemServiceRootURL(parentResourceIdentifier) + "/" + itemResourceIdentifier;
1353 * Returns the root URL for the contact service.
1355 * This URL consists of a base URL for all services, followed by
1356 * a path component for the owning authority, followed by the
1357 * path component for the owning item, followed by the path component
1358 * for the contact service.
1360 * @param parentResourceIdentifier An identifier (such as a UUID) for the
1361 * parent authority resource of the relevant item resource.
1363 * @param itemResourceIdentifier An identifier (such as a UUID) for an
1366 * @return The root URL for the contact service.
1368 protected String getContactServiceRootURL(String parentResourceIdentifier,
1369 String itemResourceIdentifier) {
1370 return getItemResourceURL(parentResourceIdentifier, itemResourceIdentifier) + "/"
1371 + getContactServicePathComponent();
1375 * Returns the URL of a specific contact resource managed by a service, and
1376 * designated by an identifier (such as a universally unique ID, or UUID).
1378 * @param parentResourceIdentifier An identifier (such as a UUID) for the
1379 * parent resource of the relevant item resource.
1381 * @param resourceIdentifier An identifier (such as a UUID) for an
1384 * @return The URL of a specific resource managed by a service.
1386 protected String getContactResourceURL(String parentResourceIdentifier,
1387 String itemResourceIdentifier, String contactResourceIdentifier) {
1388 return getContactServiceRootURL(parentResourceIdentifier,
1389 itemResourceIdentifier) + "/" + contactResourceIdentifier;
1393 public void authorityTests(String testName) {
1394 // TODO Auto-generated method stub
1399 protected PersonsCommon updateItemInstance(PersonsCommon personsCommon) {
1401 PersonTermGroupList termList = personsCommon.getPersonTermGroupList();
1402 Assert.assertNotNull(termList);
1403 List<PersonTermGroup> terms = termList.getPersonTermGroup();
1404 Assert.assertNotNull(terms);
1405 Assert.assertTrue(terms.size() > 0);
1406 terms.get(0).setTermDisplayName("updated-" + terms.get(0).getTermDisplayName());
1407 terms.get(0).setTermName("updated-" + terms.get(0).getTermName());
1408 personsCommon.setPersonTermGroupList(termList);
1410 return personsCommon;
1414 protected void compareUpdatedItemInstances(PersonsCommon original,
1415 PersonsCommon updated) throws Exception {
1417 PersonTermGroupList originalTermList = original.getPersonTermGroupList();
1418 Assert.assertNotNull(originalTermList);
1419 List<PersonTermGroup> originalTerms = originalTermList.getPersonTermGroup();
1420 Assert.assertNotNull(originalTerms);
1421 Assert.assertTrue(originalTerms.size() > 0);
1423 PersonTermGroupList updatedTermList = updated.getPersonTermGroupList();
1424 Assert.assertNotNull(updatedTermList);
1425 List<PersonTermGroup> updatedTerms = updatedTermList.getPersonTermGroup();
1426 Assert.assertNotNull(updatedTerms);
1427 Assert.assertTrue(updatedTerms.size() > 0);
1429 Assert.assertEquals(updatedTerms.get(0).getTermDisplayName(),
1430 originalTerms.get(0).getTermDisplayName(),
1431 "Value in updated record did not match submitted data.");
1435 protected PoxPayloadOut createInstance(String commonPartName,
1436 String identifier) {
1437 String shortId = identifier;
1438 String displayName = "displayName-" + shortId;
1439 PoxPayloadOut result =
1440 PersonAuthorityClientUtils.createPersonAuthorityInstance(
1441 displayName, shortId, commonPartName);
1446 protected PoxPayloadOut createNonExistenceInstance(String commonPartName,
1447 String identifier) {
1448 String displayName = "displayName-NON_EXISTENT_ID";
1449 PoxPayloadOut result = PersonAuthorityClientUtils.createPersonAuthorityInstance(
1450 displayName, "NON_EXISTENT_SHORT_ID", commonPartName);
1454 protected PoxPayloadOut createNonExistenceItemInstance(String commonPartName, String identifier) {
1455 Map<String, String> nonexMap = new HashMap<String, String>();
1456 nonexMap.put(PersonJAXBSchema.SHORT_IDENTIFIER, "nonEX");
1457 nonexMap.put(PersonJAXBSchema.GENDER, "male");
1459 List<PersonTermGroup> terms = new ArrayList<PersonTermGroup>();
1460 PersonTermGroup term = new PersonTermGroup();
1461 term.setTermDisplayName("John Wayne");
1462 term.setTermName("John Wayne");
1463 term.setForeName("John");
1464 term.setSurName("Wayne");
1467 Map<String, List<String>> nonexRepeatablesMap = new HashMap<String, List<String>>();
1468 PoxPayloadOut result =
1469 PersonAuthorityClientUtils.createPersonInstance(NON_EXISTENT_ID,
1470 null, //PersonAuthorityClientUtils.createPersonAuthRefName(NON_EXISTENT_ID, null),
1471 nonexMap, terms, nonexRepeatablesMap, commonPartName);
1476 protected PersonauthoritiesCommon updateInstance(PersonauthoritiesCommon personauthoritiesCommon) {
1477 PersonauthoritiesCommon result = new PersonauthoritiesCommon();
1479 result.setDisplayName("updated-" + personauthoritiesCommon.getDisplayName());
1480 result.setVocabType("updated-" + personauthoritiesCommon.getVocabType());
1486 protected void compareUpdatedInstances(PersonauthoritiesCommon original,
1487 PersonauthoritiesCommon updated) throws Exception {
1488 // Verify that the updated resource received the correct data.
1489 Assert.assertEquals(updated.getDisplayName(),
1490 original.getDisplayName(),
1491 "Display name in updated object did not match submitted data.");
1495 protected void verifyReadItemInstance(PersonsCommon item) throws Exception {
1496 // Do nothing for now. Add more 'read' validation checks here if applicable.