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 Response res = client.createContact(parentcsid, itemcsid, multipart);
355 assertStatusCode(res, testName);
356 newID = PersonAuthorityClientUtils.extractId(res);
363 // Store the ID returned from the first contact resource created
364 // for additional tests below.
365 if (knownContactResourceId == null) {
366 knownContactResourceId = newID;
367 if (logger.isDebugEnabled()) {
368 logger.debug(testName + ": knownContactResourceId=" + knownContactResourceId);
372 // Store the IDs from any contact resources created
373 // by tests, along with the IDs of their parent items,
374 // so these items can be deleted after all tests have been run.
375 allContactResourceIdsCreated.put(newID, itemcsid);
381 * Attempts to create an authority with an short identifier that contains
382 * non-word characters.
384 * @param testName the test name
386 @Test(dataProvider = "testName", groups = {"create", "nonWordCharsInShortId"})
387 public void createWithShortIdNonWordChars(String testName) throws Exception {
388 testExpectedStatusCode = STATUS_BAD_REQUEST;
389 testRequestType = ServiceRequestType.CREATE;
390 testSetup(testExpectedStatusCode, testRequestType);
392 // Create the payload to be included in the body of the request
393 PersonAuthorityClient client = new PersonAuthorityClient();
394 String shortId = createIdentifier() + "*" + createIdentifier();
395 String displayName = "displayName-" + shortId;
396 PoxPayloadOut multipart =
397 PersonAuthorityClientUtils.createPersonAuthorityInstance(
398 displayName, shortId, client.getCommonPartName());
400 // Submit the request to the service and store the response.
401 Response res = client.create(multipart);
403 // Check the status code of the response: does it match
404 // the expected response(s)?
406 assertStatusCode(res, testName);
415 * Attempts to create an item with an short identifier that contains
416 * non-word characters.
418 * @param testName the test name
420 @Test(dataProvider = "testName", groups = {"create", "nonWordCharsInShortId"},
421 dependsOnMethods = {"org.collectionspace.services.client.test.AbstractServiceTestImpl.create"})
422 public void createItemWithShortIdNonWordChars(String testName) {
423 testExpectedStatusCode = STATUS_BAD_REQUEST;
424 testRequestType = ServiceRequestType.CREATE;
425 testSetup(testExpectedStatusCode, testRequestType);
427 PersonAuthorityClient client = new PersonAuthorityClient();
428 // Create the payload to be included in the body of the request
429 String shortId = "7-Eleven";
430 Map<String, String> fieldProperties = new HashMap<String, String>();
431 fieldProperties.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId);
433 List<PersonTermGroup> terms = new ArrayList<PersonTermGroup>();
434 PersonTermGroup term = new PersonTermGroup();
435 term.setTermDisplayName(shortId);
436 term.setTermName(shortId);
439 final Map NULL_REPEATABLE_FIELD_PROPERTIES = null;
440 PoxPayloadOut multipart =
441 PersonAuthorityClientUtils.createPersonInstance(knownResourceId,
442 null /*knownResourceRefName*/, fieldProperties, terms,
443 NULL_REPEATABLE_FIELD_PROPERTIES, client.getItemCommonPartName());
445 // Send the request and receive a response
446 Response res = client.createItem(knownResourceId, multipart);
447 // Check the status code of the response: does it match
448 // the expected response(s)?
450 assertStatusCode(res, testName);
458 // ---------------------------------------------------------------
459 // CRUD tests : CREATE LIST tests
460 // ---------------------------------------------------------------
463 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
466 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
467 // groups = {"createList"}, dependsOnGroups = {"create"})
468 public void createList(String testName) throws Exception {
469 for (int i = 0; i < nItemsToCreateInList; i++) {
475 * Creates the contact list.
477 * @param testName the test name
478 * @throws Exception the exception
480 @Test(dataProvider = "testName", groups = {"createList"},
481 dependsOnMethods = {"org.collectionspace.services.client.test.AbstractAuthorityServiceTest.createItemList"})
482 public void createContactList(String testName) throws Exception {
483 // Add contacts to the initially-created, known item record.
484 for (int j = 0; j < nItemsToCreateInList; j++) {
485 createContact(testName);
489 // ---------------------------------------------------------------
490 // CRUD tests : READ tests
491 // ---------------------------------------------------------------
494 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
497 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
498 // groups = {"read"}, dependsOnGroups = {"create"})
499 public void read(String testName) throws Exception {
500 readInternal(testName, knownResourceId, null);
506 * @param testName the test name
507 * @throws Exception the exception
510 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
511 // groups = {"read"}, dependsOnMethods = {"read"})
512 public void readByName(String testName) throws Exception {
513 readInternal(testName, null, knownResourceShortIdentifer);
516 protected void readInternal(String testName, String CSID, String shortId) {
517 // Submit the request to the service and store the response.
518 PersonAuthorityClient client = new PersonAuthorityClient();
522 res = client.read(CSID);
523 } else if (shortId != null) {
524 res = client.readByName(shortId);
526 Assert.fail("readInternal: Internal error. One of CSID or shortId must be non-null");
529 assertStatusCode(res, testName);
530 //FIXME: remove the following try catch once Aron fixes signatures
532 PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
533 PersonauthoritiesCommon personAuthority = (PersonauthoritiesCommon) extractPart(input,
534 client.getCommonPartName(), PersonauthoritiesCommon.class);
535 Assert.assertNotNull(personAuthority);
536 } catch (Exception e) {
537 throw new RuntimeException(e);
549 * @param testName the test name
550 * @throws Exception the exception
552 @Test(dataProvider = "testName", groups = {"readItem", "readNamedItemInNamedAuth"},
553 dependsOnMethods = {"readItemInNamedAuth"})
554 public void readNamedItem(String testName) throws Exception {
555 readItemInternal(testName, knownResourceId, null, null, knownItemResourceShortIdentifer);
559 * Read item in Named Auth.
561 * @param testName the test name
562 * @throws Exception the exception
564 @Test(dataProvider = "testName", groups = {"readItem"},
565 dependsOnMethods = {"readItem"})
566 public void readItemInNamedAuth(String testName) throws Exception {
567 readItemInternal(testName, null, knownResourceShortIdentifer, knownItemResourceId, null);
572 * Read Named item in Named Auth.
574 * @param testName the test name
575 * @throws Exception the exception
577 @Test(dataProvider = "testName", groups = {"readItem"},
578 dependsOnMethods = {"readNamedItem"})
579 public void readNamedItemInNamedAuth(String testName) throws Exception {
580 readItemInternal(testName, null, knownResourceShortIdentifer, null, knownItemResourceShortIdentifer);
583 protected void readItemInternal(String testName,
584 String authCSID, String authShortId, String itemCSID, String itemShortId)
587 if (logger.isDebugEnabled()) {
588 logger.debug("Reading:" + ((authCSID != null) ? authCSID : authShortId) + "/"
589 + ((itemCSID != null) ? authCSID : itemShortId));
592 // Submit the request to the service and store the response.
593 PersonAuthorityClient client = new PersonAuthorityClient();
596 if (authCSID != null) {
597 if (itemCSID != null) {
598 res = client.readItem(authCSID, itemCSID);
599 } else if (itemShortId != null) {
600 res = client.readNamedItem(authCSID, itemShortId);
602 Assert.fail("readInternal: Internal error. One of CSID or shortId must be non-null");
604 } else if (authShortId != null) {
605 if (itemCSID != null) {
606 res = client.readItemInNamedAuthority(authShortId, itemCSID);
607 } else if (itemShortId != null) {
608 res = client.readNamedItemInNamedAuthority(authShortId, itemShortId);
610 Assert.fail("readInternal: Internal error. One of CSID or shortId must be non-null");
613 Assert.fail("readInternal: Internal error. One of authCSID or authShortId must be non-null");
617 assertStatusCode(res, testName);
618 // Check whether we've received a person.
619 PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
620 PersonsCommon person = (PersonsCommon) extractPart(input,
621 client.getItemCommonPartName(), PersonsCommon.class);
622 Assert.assertNotNull(person);
623 boolean showFull = true;
624 if (showFull && logger.isDebugEnabled()) {
625 logger.debug(testName + ": returned payload:");
626 logger.debug(objectAsXmlString(person, PersonsCommon.class));
629 // Check that the person item is within the expected Person Authority.
630 Assert.assertEquals(person.getInAuthority(), knownResourceId);
632 // Verify the number and contents of values in a repeatable field,
633 // as created in the instance record used for testing.
634 List<String> groups = person.getGroups().getGroup();
635 Assert.assertTrue(groups.size() > 0);
636 Assert.assertNotNull(groups.get(0));
644 // Note: This test depends on server-side validation logic to require
645 // a non-null (and potentially, non-empty) displayname for each term,
646 // and will fail if that validation is not present.
649 * Verify illegal item display name.
651 * @param testName the test name
652 * @throws Exception the exception
654 @Test(dataProvider = "testName", groups = {"update"})
655 public void verifyIllegalItemDisplayName(String testName) throws Exception {
656 // Perform setup for read.
659 // Submit the request to the service and store the response.
660 PersonAuthorityClient client = new PersonAuthorityClient();
661 Response res = client.readItem(knownResourceId, knownItemResourceId);
662 PoxPayloadIn input = null;
664 assertStatusCode(res, testName);
665 input = new PoxPayloadIn((String)res.getEntity());
672 // Make an invalid UPDATE request, without a display name
674 PersonsCommon person = (PersonsCommon) extractPart(input,
675 client.getItemCommonPartName(), PersonsCommon.class);
676 Assert.assertNotNull(person);
677 // Try to Update with no displayName
678 PersonTermGroupList termList = person.getPersonTermGroupList();
679 Assert.assertNotNull(termList);
680 List<PersonTermGroup> terms = termList.getPersonTermGroup();
681 Assert.assertNotNull(terms);
682 Assert.assertTrue(terms.size() > 0);
683 terms.get(0).setTermDisplayName(null);
684 terms.get(0).setTermName(null);
686 // Submit the updated resource to the service and store the response.
687 PoxPayloadOut output = new PoxPayloadOut(PersonAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
688 PayloadOutputPart commonPart = output.addPart(client.getItemCommonPartName(), person);
689 setupUpdateWithInvalidBody();
690 res = client.updateItem(knownResourceId, knownItemResourceId, output);
692 assertStatusCode(res, testName);
703 * @param testName the test name
704 * @throws Exception the exception
706 @Test(dataProvider = "testName", groups = {"readItem"},
707 dependsOnMethods = {"createContact", "org.collectionspace.services.client.test.AbstractAuthorityServiceTest.readItem"})
708 public void readContact(String testName) throws Exception {
712 // Submit the request to the service and store the response.
713 PersonAuthorityClient client = new PersonAuthorityClient();
714 PoxPayloadIn input = null;
715 Response res = client.readContact(knownResourceId, knownItemResourceId,
716 knownContactResourceId);
718 assertStatusCode(res, testName);
719 // Check whether we've received a contact.
720 input = new PoxPayloadIn(res.readEntity(String.class));
727 ContactsCommon contact = (ContactsCommon) extractPart(input,
728 new ContactClient().getCommonPartName(), ContactsCommon.class);
729 Assert.assertNotNull(contact);
730 boolean showFull = true;
731 if (showFull && logger.isDebugEnabled()) {
732 logger.debug(testName + ": returned payload:");
733 logger.debug(objectAsXmlString(contact, ContactsCommon.class));
735 Assert.assertEquals(contact.getInAuthority(), knownResourceId);
736 Assert.assertEquals(contact.getInItem(), knownItemResourceId);
741 * Read contact non existent.
743 * @param testName the test name
745 @Test(dataProvider = "testName", groups = {"readItem"},
746 dependsOnMethods = {"readContact"})
747 public void readContactNonExistent(String testName) {
749 setupReadNonExistent();
751 // Submit the request to the service and store the response.
752 PersonAuthorityClient client = new PersonAuthorityClient();
753 Response res = client.readContact(knownResourceId, knownItemResourceId,
756 assertStatusCode(res, testName);
764 // ---------------------------------------------------------------
765 // CRUD tests : READ_LIST tests
766 // ---------------------------------------------------------------
772 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
773 // groups = {"readList"}, dependsOnMethods = {"readList"})
774 public void readItemList(String testName) {
775 readItemList(knownAuthorityWithItems, null, testName);
779 * Read item list by authority name.
782 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
783 // groups = {"readList"}, dependsOnMethods = {"readItemList"})
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((String)res.getEntity());
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((String)res.getEntity());
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.");
973 * @param testName the test name
974 * @throws Exception the exception
977 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
978 // groups = {"update"}, dependsOnMethods = {"update"})
979 public void updateItem(String testName) throws Exception {
980 // Retrieve the contents of a resource to update.
981 PersonAuthorityClient client = new PersonAuthorityClient();
982 PoxPayloadIn input = null;
984 Response res = client.readItem(knownResourceId, knownItemResourceId);
986 assertStatusCode(res, testName);
987 if (logger.isDebugEnabled()) {
988 logger.debug("got Person to update with ID: "
989 + knownItemResourceId
990 + " in PersonAuthority: " + knownResourceId);
992 input = new PoxPayloadIn((String)res.getEntity());
999 PersonsCommon person = (PersonsCommon) extractPart(input,
1000 client.getItemCommonPartName(), PersonsCommon.class);
1001 Assert.assertNotNull(person);
1003 if (logger.isDebugEnabled() == true) {
1004 logger.debug("About to update the following person...");
1005 logger.debug(objectAsXmlString(person, PersonsCommon.class));
1008 // Update the contents of this resource.
1009 person.setCsid(null);
1010 PersonTermGroupList termList = person.getPersonTermGroupList();
1011 Assert.assertNotNull(termList);
1012 List<PersonTermGroup> terms = termList.getPersonTermGroup();
1013 Assert.assertNotNull(terms);
1014 Assert.assertTrue(terms.size() > 0);
1015 String foreName = terms.get(0).getForeName();
1016 String updatedForeName = "updated-" + foreName;
1017 terms.get(0).setForeName(updatedForeName);
1018 if (logger.isDebugEnabled()) {
1019 logger.debug("to be updated Person");
1020 logger.debug(objectAsXmlString(person,
1021 PersonsCommon.class));
1024 // Submit the updated resource to the service and store the response.
1025 PoxPayloadOut output = new PoxPayloadOut(PersonAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
1026 PayloadOutputPart commonPart = output.addPart(client.getItemCommonPartName(), person);
1028 res = client.updateItem(knownResourceId, knownItemResourceId, output);
1030 assertStatusCode(res, testName);
1031 // Retrieve the updated resource and verify that its contents exist.
1032 input = new PoxPayloadIn((String)res.getEntity());
1039 PersonsCommon updatedPerson =
1040 (PersonsCommon) extractPart(input,
1041 client.getItemCommonPartName(), PersonsCommon.class);
1042 Assert.assertNotNull(updatedPerson);
1044 if (logger.isDebugEnabled() == true) {
1045 logger.debug("Updated to following person to:");
1046 logger.debug(objectAsXmlString(updatedPerson, PersonsCommon.class));
1049 // Verify that the updated resource received the correct data.
1050 PersonTermGroupList updatedTermList = person.getPersonTermGroupList();
1051 Assert.assertNotNull(updatedTermList);
1052 List<PersonTermGroup> updatedTerms = termList.getPersonTermGroup();
1053 Assert.assertNotNull(updatedTerms);
1054 Assert.assertEquals(updatedTerms.get(0).getForeName(), updatedForeName,
1055 "Data in updated Person did not match submitted data.");
1061 * @param testName the test name
1062 * @throws Exception the exception
1064 @Test(dataProvider = "testName", groups = {"update"},
1065 dependsOnMethods = {"readContact", "testContactSubmitRequest",
1066 "org.collectionspace.services.client.test.AbstractAuthorityServiceTest.updateItem"})
1067 public void updateContact(String testName) throws Exception {
1068 String contactsCommonLabel = new ContactClient().getCommonPartName();
1070 // Retrieve the contents of a resource to update.
1071 PersonAuthorityClient client = new PersonAuthorityClient();
1072 PoxPayloadIn input = null;
1074 Response res = client.readContact(knownResourceId, knownItemResourceId,
1075 knownContactResourceId);
1077 assertStatusCode(res, testName);
1078 if (logger.isDebugEnabled()) {
1079 logger.debug("got Contact to update with ID: "
1080 + knownContactResourceId
1081 + " in item: " + knownItemResourceId
1082 + " in parent: " + knownResourceId);
1084 input = new PoxPayloadIn(res.readEntity(String.class));
1091 ContactsCommon contact = (ContactsCommon) extractPart(input,
1092 contactsCommonLabel, ContactsCommon.class);
1093 Assert.assertNotNull(contact);
1095 // Verify the contents of this resource
1096 AddressGroupList addressGroupList = contact.getAddressGroupList();
1097 Assert.assertNotNull(addressGroupList);
1098 List<AddressGroup> addressGroups = addressGroupList.getAddressGroup();
1099 Assert.assertNotNull(addressGroups);
1100 Assert.assertTrue(addressGroups.size() > 0);
1101 String addressPlace1 = addressGroups.get(0).getAddressPlace1();
1102 Assert.assertNotNull(addressPlace1);
1104 // Update the contents of this resource.
1105 addressGroups.get(0).setAddressPlace1("updated-" + addressPlace1);
1106 contact.setAddressGroupList(addressGroupList);
1107 if (logger.isDebugEnabled()) {
1108 logger.debug("to be updated Contact");
1109 logger.debug(objectAsXmlString(contact,
1110 ContactsCommon.class));
1113 // Submit the updated resource to the service and store the response.
1114 PoxPayloadOut output = new PoxPayloadOut(ContactClient.SERVICE_PAYLOAD_NAME);
1115 PayloadOutputPart commonPart = output.addPart(contactsCommonLabel, contact);
1117 res = client.updateContact(knownResourceId, knownItemResourceId, knownContactResourceId, output);
1119 assertStatusCode(res, testName);
1120 // Retrieve the updated resource and verify that its contents exist.
1121 input = new PoxPayloadIn(res.readEntity(String.class));;
1127 ContactsCommon updatedContact = (ContactsCommon) extractPart(input,
1128 contactsCommonLabel, ContactsCommon.class);
1129 Assert.assertNotNull(updatedContact);
1131 // Verify that the updated resource received the correct data.
1132 Assert.assertEquals(updatedContact.getAddressGroupList().getAddressGroup().get(0).getAddressPlace1(),
1133 contact.getAddressGroupList().getAddressGroup().get(0).getAddressPlace1(),
1134 "Data in updated object did not match submitted data.");
1138 * Update non existent contact.
1140 * @param testName the test name
1141 * @throws Exception the exception
1143 @Test(dataProvider = "testName", groups = {"update"},
1144 dependsOnMethods = {"updateContact", "testContactSubmitRequest"})
1145 public void updateNonExistentContact(String testName) throws Exception {
1146 // Currently a no-op test
1149 // ---------------------------------------------------------------
1150 // CRUD tests : DELETE tests
1151 // ---------------------------------------------------------------
1153 // Note: delete sub-resources in ascending hierarchical order,
1154 // before deleting their parents.
1158 * @param testName the test name
1159 * @throws Exception the exception
1161 @Test(dataProvider = "testName", groups = {"delete"},
1162 dependsOnMethods = {"updateContact"})
1163 public void deleteContact(String testName) throws Exception {
1164 if (logger.isDebugEnabled()) {
1165 logger.debug("parentcsid =" + knownResourceId
1166 + " itemcsid = " + knownItemResourceId
1167 + " csid = " + knownContactResourceId);
1170 // Submit the request to the service and store the response.
1171 PersonAuthorityClient client = new PersonAuthorityClient();
1173 Response res = client.deleteContact(knownResourceId, knownItemResourceId,
1174 knownContactResourceId);
1176 assertStatusCode(res, testName);
1185 public void delete(String testName) throws Exception {
1186 // Do nothing. See localDelete(). This ensure proper test order.
1189 @Test(dataProvider = "testName", dependsOnMethods = {"localDeleteItem"})
1190 public void localDelete(String testName) throws Exception {
1191 super.delete(testName);
1195 public void deleteItem(String testName) throws Exception {
1196 // Do nothing. We need to wait until after the test "localDelete" gets run. When it does,
1197 // its dependencies will get run first and then we can call the base class' delete method.
1200 @Test(dataProvider = "testName", groups = {"delete"},
1201 dependsOnMethods = {"verifyIllegalItemDisplayName", "testContactSubmitRequest", "deleteContact"})
1202 public void localDeleteItem(String testName) throws Exception {
1203 super.deleteItem(testName);
1207 * Delete non existent contact.
1209 * @param testName the test name
1211 @Test(dataProvider = "testName", groups = {"delete"},
1212 dependsOnMethods = {"deleteContact"})
1213 public void deleteNonExistentContact(String testName) {
1214 // Submit the request to the service and store the response.
1215 PersonAuthorityClient client = new PersonAuthorityClient();
1216 setupDeleteNonExistent();
1217 Response res = client.deleteContact(knownResourceId, knownItemResourceId, NON_EXISTENT_ID);
1219 assertStatusCode(res, testName);
1228 * Test contact submit request.
1230 @Test(dataProvider = "testName",
1231 dependsOnMethods = {"createContact", "readContact", "testItemSubmitRequest"})
1232 public void testContactSubmitRequest(String testName) {
1234 // Expected status code: 200 OK
1235 final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
1237 // Submit the request to the service and store the response.
1238 String method = ServiceRequestType.READ.httpMethodName();
1239 String url = getContactResourceURL(knownResourceId,
1240 knownItemResourceId, knownContactResourceId);
1241 int statusCode = submitRequest(method, url);
1243 // Check the status code of the response: does it match
1244 // the expected response(s)?
1245 if (logger.isDebugEnabled()) {
1246 logger.debug("testContactSubmitRequest: url=" + url
1247 + " status=" + statusCode);
1249 Assert.assertEquals(statusCode, EXPECTED_STATUS);
1253 // ---------------------------------------------------------------
1254 // Cleanup of resources created during testing
1255 // ---------------------------------------------------------------
1257 * Deletes all resources created by tests, after all tests have been run.
1259 * This cleanup method will always be run, even if one or more tests fail.
1260 * For this reason, it attempts to remove all resources created
1261 * at any point during testing, even if some of those resources
1262 * may be expected to be deleted by certain tests.
1264 @AfterClass(alwaysRun = true)
1266 public void cleanUp() {
1267 String noTest = System.getProperty("noTestCleanup");
1268 if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
1269 if (logger.isDebugEnabled()) {
1270 logger.debug("Skipping Cleanup phase ...");
1274 if (logger.isDebugEnabled()) {
1275 logger.debug("Cleaning up temporary resources created for testing ...");
1277 String parentResourceId;
1278 String itemResourceId;
1279 String contactResourceId;
1280 // Clean up contact resources.
1281 PersonAuthorityClient client = new PersonAuthorityClient();
1282 parentResourceId = knownResourceId;
1283 for (Map.Entry<String, String> entry : allContactResourceIdsCreated.entrySet()) {
1284 contactResourceId = entry.getKey();
1285 itemResourceId = entry.getValue();
1286 // Note: Any non-success responses from the delete operation
1287 // below are ignored and not reported.
1288 Response res = client.deleteContact(parentResourceId, itemResourceId,
1292 // Clean up item resources.
1293 for (Map.Entry<String, String> entry : allResourceItemIdsCreated.entrySet()) {
1294 itemResourceId = entry.getKey();
1295 parentResourceId = entry.getValue();
1296 // Note: Any non-success responses from the delete operation
1297 // below are ignored and not reported.
1298 client.deleteItem(parentResourceId, itemResourceId).close();
1300 // Clean up parent resources.
1304 // ---------------------------------------------------------------
1305 // Utility methods used by tests above
1306 // ---------------------------------------------------------------
1308 * Gets the contact service path component.
1310 * @return the contact service path component
1312 public String getContactServicePathComponent() {
1313 return ContactClient.SERVICE_PATH_COMPONENT;
1317 * Returns the root URL for the item service.
1319 * This URL consists of a base URL for all services, followed by
1320 * a path component for the owning parent, followed by the
1321 * path component for the items.
1323 * @param parentResourceIdentifier An identifier (such as a UUID) for the
1324 * parent authority resource of the relevant item resource.
1326 * @return The root URL for the item service.
1328 protected String getItemServiceRootURL(String parentResourceIdentifier) {
1329 return getResourceURL(parentResourceIdentifier) + "/" + getItemServicePathComponent();
1333 * Returns the URL of a specific item resource managed by a service, and
1334 * designated by an identifier (such as a universally unique ID, or UUID).
1336 * @param parentResourceIdentifier An identifier (such as a UUID) for the
1337 * parent authority resource of the relevant item resource.
1339 * @param itemResourceIdentifier An identifier (such as a UUID) for an
1342 * @return The URL of a specific item resource managed by a service.
1344 protected String getItemResourceURL(String parentResourceIdentifier, String itemResourceIdentifier) {
1345 return getItemServiceRootURL(parentResourceIdentifier) + "/" + itemResourceIdentifier;
1349 * Returns the root URL for the contact service.
1351 * This URL consists of a base URL for all services, followed by
1352 * a path component for the owning authority, followed by the
1353 * path component for the owning item, followed by the path component
1354 * for the contact service.
1356 * @param parentResourceIdentifier An identifier (such as a UUID) for the
1357 * parent authority resource of the relevant item resource.
1359 * @param itemResourceIdentifier An identifier (such as a UUID) for an
1362 * @return The root URL for the contact service.
1364 protected String getContactServiceRootURL(String parentResourceIdentifier,
1365 String itemResourceIdentifier) {
1366 return getItemResourceURL(parentResourceIdentifier, itemResourceIdentifier) + "/"
1367 + getContactServicePathComponent();
1371 * Returns the URL of a specific contact resource managed by a service, and
1372 * designated by an identifier (such as a universally unique ID, or UUID).
1374 * @param parentResourceIdentifier An identifier (such as a UUID) for the
1375 * parent resource of the relevant item resource.
1377 * @param resourceIdentifier An identifier (such as a UUID) for an
1380 * @return The URL of a specific resource managed by a service.
1382 protected String getContactResourceURL(String parentResourceIdentifier,
1383 String itemResourceIdentifier, String contactResourceIdentifier) {
1384 return getContactServiceRootURL(parentResourceIdentifier,
1385 itemResourceIdentifier) + "/" + contactResourceIdentifier;
1389 public void authorityTests(String testName) {
1390 // TODO Auto-generated method stub
1395 protected PersonsCommon updateItemInstance(PersonsCommon personsCommon) {
1397 PersonTermGroupList termList = personsCommon.getPersonTermGroupList();
1398 Assert.assertNotNull(termList);
1399 List<PersonTermGroup> terms = termList.getPersonTermGroup();
1400 Assert.assertNotNull(terms);
1401 Assert.assertTrue(terms.size() > 0);
1402 terms.get(0).setTermDisplayName("updated-" + terms.get(0).getTermDisplayName());
1403 terms.get(0).setTermName("updated-" + terms.get(0).getTermName());
1404 personsCommon.setPersonTermGroupList(termList);
1406 return personsCommon;
1410 protected void compareUpdatedItemInstances(PersonsCommon original,
1411 PersonsCommon updated) throws Exception {
1413 PersonTermGroupList originalTermList = original.getPersonTermGroupList();
1414 Assert.assertNotNull(originalTermList);
1415 List<PersonTermGroup> originalTerms = originalTermList.getPersonTermGroup();
1416 Assert.assertNotNull(originalTerms);
1417 Assert.assertTrue(originalTerms.size() > 0);
1419 PersonTermGroupList updatedTermList = updated.getPersonTermGroupList();
1420 Assert.assertNotNull(updatedTermList);
1421 List<PersonTermGroup> updatedTerms = updatedTermList.getPersonTermGroup();
1422 Assert.assertNotNull(updatedTerms);
1423 Assert.assertTrue(updatedTerms.size() > 0);
1425 Assert.assertEquals(updatedTerms.get(0).getTermDisplayName(),
1426 originalTerms.get(0).getTermDisplayName(),
1427 "Value in updated record did not match submitted data.");
1431 protected PoxPayloadOut createInstance(String commonPartName,
1432 String identifier) {
1433 String shortId = identifier;
1434 String displayName = "displayName-" + shortId;
1435 PoxPayloadOut result =
1436 PersonAuthorityClientUtils.createPersonAuthorityInstance(
1437 displayName, shortId, commonPartName);
1442 protected PoxPayloadOut createNonExistenceInstance(String commonPartName,
1443 String identifier) {
1444 String displayName = "displayName-NON_EXISTENT_ID";
1445 PoxPayloadOut result = PersonAuthorityClientUtils.createPersonAuthorityInstance(
1446 displayName, "NON_EXISTENT_SHORT_ID", commonPartName);
1450 protected PoxPayloadOut createNonExistenceItemInstance(String commonPartName, String identifier) {
1451 Map<String, String> nonexMap = new HashMap<String, String>();
1452 nonexMap.put(PersonJAXBSchema.SHORT_IDENTIFIER, "nonEX");
1453 nonexMap.put(PersonJAXBSchema.GENDER, "male");
1455 List<PersonTermGroup> terms = new ArrayList<PersonTermGroup>();
1456 PersonTermGroup term = new PersonTermGroup();
1457 term.setTermDisplayName("John Wayne");
1458 term.setTermName("John Wayne");
1459 term.setForeName("John");
1460 term.setSurName("Wayne");
1463 Map<String, List<String>> nonexRepeatablesMap = new HashMap<String, List<String>>();
1464 PoxPayloadOut result =
1465 PersonAuthorityClientUtils.createPersonInstance(NON_EXISTENT_ID,
1466 null, //PersonAuthorityClientUtils.createPersonAuthRefName(NON_EXISTENT_ID, null),
1467 nonexMap, terms, nonexRepeatablesMap, commonPartName);
1472 protected PersonauthoritiesCommon updateInstance(PersonauthoritiesCommon personauthoritiesCommon) {
1473 PersonauthoritiesCommon result = new PersonauthoritiesCommon();
1475 result.setDisplayName("updated-" + personauthoritiesCommon.getDisplayName());
1476 result.setVocabType("updated-" + personauthoritiesCommon.getVocabType());
1482 protected void compareUpdatedInstances(PersonauthoritiesCommon original,
1483 PersonauthoritiesCommon updated) throws Exception {
1484 // Verify that the updated resource received the correct data.
1485 Assert.assertEquals(updated.getDisplayName(),
1486 original.getDisplayName(),
1487 "Display name in updated object did not match submitted data.");
1491 protected void verifyReadItemInstance(PersonsCommon item) throws Exception {
1492 // Do nothing for now. Add more 'read' validation checks here if applicable.