2 * This document is a part of the source code and related artifacts
3 * for CollectionSpace, an open source collections management system
4 * for museums and related institutions:
6 * http://www.collectionspace.org
7 * http://wiki.collectionspace.org
9 * Copyright (c)) 2009 Regents of the University of California
11 * Licensed under the Educational Community License (ECL), Version 2.0.
12 * You may not use this file except in compliance with this License.
14 * You may obtain a copy of the ECL 2.0 License at
15 * https://source.collectionspace.org/collection-space/LICENSE.txt
17 * Unless required by applicable law or agreed to in writing, software
18 * distributed under the License is distributed on an "AS IS" BASIS,
19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 * See the License for the specific language governing permissions and
21 * limitations under the License.
23 package org.collectionspace.services.client.test;
25 import java.util.ArrayList;
26 import java.util.HashMap;
27 import java.util.List;
30 import org.collectionspace.services.TaxonJAXBSchema;
31 import org.collectionspace.services.client.AuthorityClient;
32 import org.collectionspace.services.client.CollectionSpaceClient;
33 import org.collectionspace.services.client.PayloadOutputPart;
34 import org.collectionspace.services.client.PoxPayloadIn;
35 import org.collectionspace.services.client.PoxPayloadOut;
36 import org.collectionspace.services.client.TaxonomyAuthorityClient;
37 import org.collectionspace.services.client.TaxonomyAuthorityClientUtils;
38 import org.collectionspace.services.common.AbstractCommonListUtils;
39 import org.collectionspace.services.jaxb.AbstractCommonList;
40 import org.collectionspace.services.taxonomy.TaxonAuthorGroup;
41 import org.collectionspace.services.taxonomy.TaxonAuthorGroupList;
42 import org.collectionspace.services.taxonomy.TaxonCitationList;
43 import org.collectionspace.services.taxonomy.TaxonomyauthorityCommon;
44 import org.collectionspace.services.taxonomy.TaxonCommon;
46 import javax.ws.rs.core.MediaType;
47 import javax.ws.rs.core.Response;
48 import org.jboss.resteasy.client.ClientResponse;
50 import org.slf4j.Logger;
51 import org.slf4j.LoggerFactory;
53 import org.testng.Assert;
54 import org.testng.annotations.AfterClass;
55 import org.testng.annotations.Test;
58 * TaxonomyAuthorityServiceTest, carries out tests against a
59 * deployed and running TaxonomyAuthority Service.
61 * $LastChangedRevision$
64 public class TaxonomyAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME: Test classes for Vocab, Person, Org, and Taxonomy should have a base class!
67 private final String CLASS_NAME = TaxonomyAuthorityServiceTest.class.getName();
68 private final Logger logger = LoggerFactory.getLogger(TaxonomyAuthorityServiceTest.class);
69 private final String REFNAME = "refName";
70 private final String DISPLAYNAME = "displayName";
73 public String getServicePathComponent() {
74 return TaxonomyAuthorityClient.SERVICE_PATH_COMPONENT;
78 protected String getServiceName() {
79 return TaxonomyAuthorityClient.SERVICE_NAME;
82 public String getItemServicePathComponent() {
83 return AuthorityClient.ITEMS;
85 final String TEST_SHORTID = "CentauruspleurexanthemusGreen1832";
86 final String TEST_TERM_STATUS = "accepted";
87 final String TEST_TAXON_FULL_NAME = "Centaurus pleurexanthemus Green 1832";
88 // TODO Re-implement the Taxon Rank field so as to provide an orderable
89 // ranking value, as well as a display name.
90 final String TEST_TAXON_RANK = "species";
91 final String TEST_TAXON_AUTHOR = "J. Green";
92 final String TEST_TAXON_AUTHOR_TYPE = "ascribed";
93 final String TEST_TAXON_CITATION = "A Monograph of the Trilobites of North America";
94 final String TEST_TAXON_CURRENCY = "current";
95 final String TEST_TAXON_YEAR = "1832";
96 final String TEST_TAXONOMIC_STATUS = "valid";
97 final String TEST_TAXON_IS_NAMED_HYBRID = "false";
98 final TaxonAuthorGroupList NULL_TAXON_AUTHOR_GROUP_LIST = null;
99 final TaxonCitationList NULL_TAXON_CITATION_LIST = null;
100 /** The known resource id. */
101 private String knownResourceId = null;
102 private String knownResourceShortIdentifer = null;
103 private String knownResourceRefName = null;
104 private String knownTaxonomyTypeRefName = null;
105 private String knownItemResourceId = null;
106 private String knownItemResourceShortIdentifer = null;
107 /** The n items to create in list. */
108 private int nItemsToCreateInList = 3;
109 /** The all resource ids created. */
110 private List<String> allResourceIdsCreated = new ArrayList<String>();
111 /** The all item resource ids created. */
112 private Map<String, String> allItemResourceIdsCreated =
113 new HashMap<String, String>();
115 protected void setKnownResource(String id, String shortIdentifer,
117 knownResourceId = id;
118 knownResourceShortIdentifer = shortIdentifer;
119 knownResourceRefName = refName;
122 protected void setKnownItemResource(String id, String shortIdentifer) {
123 knownItemResourceId = id;
124 knownItemResourceShortIdentifer = shortIdentifer;
128 * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
131 protected CollectionSpaceClient getClientInstance() {
132 return new TaxonomyAuthorityClient();
136 protected PoxPayloadOut createInstance(String identifier) {
137 TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
138 String shortId = identifier;
139 String displayName = "displayName-" + shortId;
141 TaxonomyAuthorityClientUtils.createTaxonomyAuthRefName(shortId, null);
142 PoxPayloadOut multipart =
143 TaxonomyAuthorityClientUtils.createTaxonomyAuthorityInstance(
144 displayName, shortId, client.getCommonPartName());
148 // ---------------------------------------------------------------
149 // CRUD tests : CREATE tests
150 // ---------------------------------------------------------------
153 * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
156 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
158 public void create(String testName) throws Exception {
160 if (logger.isDebugEnabled()) {
161 logger.debug(testBanner(testName, CLASS_NAME));
163 // Perform setup, such as initializing the type of service request
164 // (e.g. CREATE, DELETE), its valid and expected status codes, and
165 // its associated HTTP method name (e.g. POST, DELETE).
168 // Submit the request to the service and store the response.
169 TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
170 String shortId = createIdentifier();
171 String displayName = "displayName-" + shortId;
172 // String baseRefName =
173 // TaxonomyAuthorityClientUtils.createTaxonomyAuthRefName(shortId, null);
174 final String EMPTY_REFNAME = "";
175 PoxPayloadOut multipart =
176 TaxonomyAuthorityClientUtils.createTaxonomyAuthorityInstance(
177 displayName, shortId, client.getCommonPartName());
179 ClientResponse<Response> res = client.create(multipart);
181 int statusCode = res.getStatus();
183 // Check the status code of the response: does it match
184 // the expected response(s)?
187 // Does it fall within the set of valid status codes?
188 // Does it exactly match the expected status code?
189 if (logger.isDebugEnabled()) {
190 logger.debug(testName + ": status = " + statusCode);
192 Assert.assertTrue(this.REQUEST_TYPE.isValidStatusCode(statusCode),
193 invalidStatusCodeMessage(this.REQUEST_TYPE, statusCode));
194 Assert.assertEquals(statusCode, this.EXPECTED_STATUS_CODE);
196 newID = TaxonomyAuthorityClientUtils.extractId(res);
198 res.releaseConnection();
200 // Store the ID returned from the first resource created
201 // for additional tests below.
202 if (knownResourceId == null) {
203 setKnownResource(newID, shortId, EMPTY_REFNAME);
204 if (logger.isDebugEnabled()) {
205 logger.debug(testName + ": knownResourceId=" + knownResourceId);
208 // Store the IDs from every resource created by tests,
209 // so they can be deleted after tests have been run.
210 allResourceIdsCreated.add(newID);
216 * @param testName the test name
218 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
219 groups = {"create"}, dependsOnMethods = {"create"})
220 public void createItem(String testName) {
221 if (logger.isDebugEnabled()) {
222 logger.debug(testBanner(testName, CLASS_NAME));
225 createItemInAuthority(knownResourceId, knownResourceRefName);
229 * Creates the item in authority.
231 * @param vcsid the vcsid
232 * @param authRefName the auth ref name
235 private String createItemInAuthority(String vcsid, String authRefName) {
237 final String testName = "createItemInAuthority(" + vcsid + "," + authRefName + ")";
238 if (logger.isDebugEnabled()) {
239 logger.debug(testBanner(testName, CLASS_NAME));
242 // Submit the request to the service and store the response.
243 TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
244 Map<String, String> taxonMap = new HashMap<String, String>();
246 // Fields present in all authority records.
247 taxonMap.put(TaxonJAXBSchema.SHORT_IDENTIFIER, TEST_SHORTID);
248 // TODO Make term status be controlled vocab.
249 taxonMap.put(TaxonJAXBSchema.TERM_STATUS, TEST_TERM_STATUS);
251 // Fields specific to this specific authority record type.
252 taxonMap.put(TaxonJAXBSchema.NAME, TEST_TAXON_FULL_NAME);
253 taxonMap.put(TaxonJAXBSchema.TAXON_RANK, TEST_TAXON_RANK);
254 taxonMap.put(TaxonJAXBSchema.TAXON_CURRENCY, TEST_TAXON_CURRENCY);
255 taxonMap.put(TaxonJAXBSchema.TAXON_YEAR, TEST_TAXON_YEAR);
256 taxonMap.put(TaxonJAXBSchema.TAXONOMIC_STATUS, TEST_TAXONOMIC_STATUS);
257 taxonMap.put(TaxonJAXBSchema.TAXON_IS_NAMED_HYBRID, TEST_TAXON_IS_NAMED_HYBRID);
259 TaxonCitationList taxonCitationList = new TaxonCitationList();
260 List<String> taxonCitations = taxonCitationList.getTaxonCitation();
261 taxonCitations.add(TEST_TAXON_CITATION);
263 TaxonAuthorGroupList taxonAuthorGroupList = new TaxonAuthorGroupList();
264 List<TaxonAuthorGroup> taxonAuthorGroups = taxonAuthorGroupList.getTaxonAuthorGroup();
265 TaxonAuthorGroup taxonAuthorGroup = new TaxonAuthorGroup();
266 taxonAuthorGroup.setTaxonAuthor(TEST_TAXON_AUTHOR);
267 taxonAuthorGroup.setTaxonAuthorType(TEST_TAXON_AUTHOR_TYPE);
268 taxonAuthorGroups.add(taxonAuthorGroup);
270 // FIXME: Add additional fields in the Taxon record here,
271 // including at least one each of:
272 // * a Boolean field (when implemented)
273 // * an authref field (when implemented)
275 String newID = TaxonomyAuthorityClientUtils.createItemInAuthority(vcsid,
276 authRefName, taxonMap, taxonAuthorGroupList, taxonCitationList, client);
278 // Store the ID returned from the first item resource created
279 // for additional tests below.
280 if (knownItemResourceId == null) {
281 setKnownItemResource(newID, TEST_SHORTID);
282 if (logger.isDebugEnabled()) {
283 logger.debug(testName + ": knownItemResourceId=" + newID + " inAuthority=" + vcsid);
287 // Store the IDs from any item resources created
288 // by tests, along with the IDs of their parents, so these items
289 // can be deleted after all tests have been run.
290 allItemResourceIdsCreated.put(newID, vcsid);
296 // Placeholders until the three tests below can be uncommented.
297 // See Issue CSPACE-401.
299 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
302 public void createWithEmptyEntityBody(String testName) throws Exception {
306 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
309 public void createWithMalformedXml(String testName) throws Exception {
313 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
316 public void createWithWrongXmlSchema(String testName) throws Exception {
319 // ---------------------------------------------------------------
320 // CRUD tests : CREATE LIST tests
321 // ---------------------------------------------------------------
324 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
327 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
328 groups = {"createList"}, dependsOnGroups = {"create"})
329 public void createList(String testName) throws Exception {
330 for (int i = 0; i < nItemsToCreateInList; i++) {
336 * Creates the item list.
338 * @param testName the test name
339 * @throws Exception the exception
341 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
342 groups = {"createList"}, dependsOnMethods = {"createList"})
343 public void createItemList(String testName) throws Exception {
344 // Add items to the initially-created, known parent record.
345 for (int j = 0; j < nItemsToCreateInList; j++) {
346 createItem(testName);
350 // ---------------------------------------------------------------
351 // CRUD tests : READ tests
352 // ---------------------------------------------------------------
355 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
358 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
359 groups = {"read"}, dependsOnGroups = {"create"})
360 public void read(String testName) throws Exception {
362 if (logger.isDebugEnabled()) {
363 logger.debug(testBanner(testName, CLASS_NAME));
368 // Submit the request to the service and store the response.
369 TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
371 ClientResponse<String> res = client.read(knownResourceId);
373 assertStatusCode(res, testName);
374 //FIXME: remove the following try catch once Aron fixes signatures
376 PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
377 TaxonomyauthorityCommon taxonomyAuthority =
378 (TaxonomyauthorityCommon) extractPart(input,
379 client.getCommonPartName(), TaxonomyauthorityCommon.class);
380 Assert.assertNotNull(taxonomyAuthority);
381 } catch (Exception e) {
382 throw new RuntimeException(e);
385 res.releaseConnection();
392 * @param testName the test name
393 * @throws Exception the exception
395 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
396 groups = {"read"}, dependsOnGroups = {"create"})
397 public void readByName(String testName) throws Exception {
399 if (logger.isDebugEnabled()) {
400 logger.debug(testBanner(testName + "(" + knownResourceShortIdentifer + ")", CLASS_NAME));
405 // Submit the request to the service and store the response.
406 TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
407 ClientResponse<String> res = client.readByName(knownResourceShortIdentifer);
409 assertStatusCode(res, testName);
410 //FIXME: remove the following try catch once Aron fixes signatures
412 PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
413 TaxonomyauthorityCommon taxonomyAuthority = (TaxonomyauthorityCommon) extractPart(input,
414 client.getCommonPartName(), TaxonomyauthorityCommon.class);
415 Assert.assertNotNull(taxonomyAuthority);
416 } catch (Exception e) {
417 throw new RuntimeException(e);
420 res.releaseConnection();
427 * @param testName the test name
428 * @throws Exception the exception
430 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
431 groups = {"read"}, dependsOnMethods = {"read"})
432 public void readItem(String testName) throws Exception {
434 if (logger.isDebugEnabled()) {
435 logger.debug(testBanner(testName, CLASS_NAME));
440 // Submit the request to the service and store the response.
441 TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
442 ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
444 assertStatusCode(res, testName);
445 // Check whether we've received an authority item record.
446 PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
447 TaxonCommon taxon = (TaxonCommon) extractPart(input,
448 client.getItemCommonPartName(), TaxonCommon.class);
449 Assert.assertNotNull(taxon);
450 boolean showFull = true;
451 if (showFull && logger.isDebugEnabled()) {
452 logger.debug(testName + ": returned payload:");
453 logger.debug(objectAsXmlString(taxon, TaxonCommon.class));
456 // Check that this authority item record has the correct identifier
457 // pointing to its parent authority record.
458 Assert.assertNotNull(taxon.getInAuthority(), "inAuthority field value is unexpectedly null.");
459 Assert.assertEquals(taxon.getInAuthority(), knownResourceId,
460 "Value of item's inAuthority field does not contain the correct identifier "
461 + "pointing to its parent authority record.");
463 // Check individual fields in the authority item record.
464 Assert.assertNotNull(taxon.getTaxonFullName(), "Field value is unexpectedly null.");
465 Assert.assertEquals(taxon.getTaxonFullName(), TEST_TAXON_FULL_NAME,
466 "Field value " + taxon.getTaxonFullName()
467 + "does not match expected value " + TEST_TAXON_FULL_NAME);
469 res.releaseConnection();
474 * Verify item display name.
476 * @param testName the test name
477 * @throws Exception the exception
479 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
480 dependsOnMethods = {"readItem", "updateItem"})
481 public void verifyItemDisplayName(String testName) throws Exception {
483 if (logger.isDebugEnabled()) {
484 logger.debug(testBanner(testName, CLASS_NAME));
489 // Submit the request to the service and store the response.
490 TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
491 ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
493 assertStatusCode(res, testName);
494 // Check whether taxon has expected displayName.
495 PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
496 TaxonCommon taxon = (TaxonCommon) extractPart(input,
497 client.getItemCommonPartName(), TaxonCommon.class);
498 Assert.assertNotNull(taxon);
499 String displayName = taxon.getDisplayName();
500 // Make sure displayName matches computed form
501 String expectedDisplayName =
502 TaxonomyAuthorityClientUtils.prepareDefaultDisplayName(TEST_TAXON_FULL_NAME);
503 Assert.assertNotNull(displayName, expectedDisplayName);
505 // Update the shortName and verify the computed name is updated.
507 taxon.setDisplayNameComputed(true);
508 taxon.setTaxonFullName("updated-" + TEST_TAXON_FULL_NAME);
509 expectedDisplayName =
510 TaxonomyAuthorityClientUtils.prepareDefaultDisplayName("updated-" + TEST_TAXON_FULL_NAME);
512 // Submit the updated resource to the service and store the response.
513 PoxPayloadOut output = new PoxPayloadOut(TaxonomyAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
514 PayloadOutputPart commonPart = output.addPart(taxon, MediaType.APPLICATION_XML_TYPE);
515 commonPart.setLabel(client.getItemCommonPartName());
516 res.releaseConnection();
517 res = client.updateItem(knownResourceId, knownItemResourceId, output);
518 assertStatusCode(res, testName);
519 // Retrieve the updated resource and verify that its contents exist.
520 input = new PoxPayloadIn(res.getEntity());
521 TaxonCommon updatedTaxon =
522 (TaxonCommon) extractPart(input,
523 client.getItemCommonPartName(), TaxonCommon.class);
524 Assert.assertNotNull(updatedTaxon);
526 // Verify that the updated resource received the correct data.
527 Assert.assertEquals(updatedTaxon.getTaxonFullName(), taxon.getTaxonFullName(),
528 "Updated ForeName in Taxonomy did not match submitted data.");
529 // Verify that the updated resource computes the right displayName.
530 Assert.assertEquals(updatedTaxon.getDisplayName(), expectedDisplayName,
531 "Updated ForeName in Taxonomy not reflected in computed DisplayName.");
533 // Now Update the displayName, not computed and verify the computed name is overriden.
534 taxon.setDisplayNameComputed(false);
535 expectedDisplayName = "TestName";
536 taxon.setDisplayName(expectedDisplayName);
538 // Submit the updated resource to the service and store the response.
539 output = new PoxPayloadOut(TaxonomyAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
540 commonPart = output.addPart(taxon, MediaType.APPLICATION_XML_TYPE);
541 commonPart.setLabel(client.getItemCommonPartName());
542 res.releaseConnection();
543 res = client.updateItem(knownResourceId, knownItemResourceId, output);
544 assertStatusCode(res, testName);
545 // Retrieve the updated resource and verify that its contents exist.
546 input = new PoxPayloadIn(res.getEntity());
548 (TaxonCommon) extractPart(input,
549 client.getItemCommonPartName(), TaxonCommon.class);
550 Assert.assertNotNull(updatedTaxon);
552 // Verify that the updated resource received the correct data.
553 Assert.assertEquals(updatedTaxon.isDisplayNameComputed(), false,
554 "Updated displayNameComputed in Taxonomy did not match submitted data.");
555 // Verify that the updated resource computes the right displayName.
556 Assert.assertEquals(updatedTaxon.getDisplayName(),
558 "Updated DisplayName (not computed) in Taxonomy not stored.");
560 res.releaseConnection();
565 * Verify illegal item display name.
567 * @param testName the test name
568 * @throws Exception the exception
570 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
571 dependsOnMethods = {"verifyItemDisplayName"})
572 public void verifyIllegalItemDisplayName(String testName) throws Exception {
574 if (logger.isDebugEnabled()) {
575 logger.debug(testBanner(testName, CLASS_NAME));
578 // Perform setup for read.
581 // Submit the request to the service and store the response.
582 TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
583 ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
584 assertStatusCode(res, testName);
586 // Perform setup for update.
587 testSetup(STATUS_BAD_REQUEST, ServiceRequestType.UPDATE);
590 // Check whether Taxonomy has expected displayName.
591 PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
592 TaxonCommon taxon = (TaxonCommon) extractPart(input,
593 client.getItemCommonPartName(), TaxonCommon.class);
594 Assert.assertNotNull(taxon);
595 // Try to Update with computed false and no displayName
596 taxon.setDisplayNameComputed(false);
597 taxon.setDisplayName(null);
599 // Submit the updated resource to the service and store the response.
600 PoxPayloadOut output = new PoxPayloadOut(TaxonomyAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
601 PayloadOutputPart commonPart = output.addPart(taxon, MediaType.APPLICATION_XML_TYPE);
602 commonPart.setLabel(client.getItemCommonPartName());
603 res.releaseConnection();
604 res = client.updateItem(knownResourceId, knownItemResourceId, output);
605 assertStatusCode(res, testName);
607 res.releaseConnection();
613 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
616 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
617 groups = {"read"}, dependsOnMethods = {"read"})
618 public void readNonExistent(String testName) {
620 if (logger.isDebugEnabled()) {
621 logger.debug(testBanner(testName, CLASS_NAME));
624 setupReadNonExistent();
626 // Submit the request to the service and store the response.
627 TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
628 ClientResponse<String> res = client.read(NON_EXISTENT_ID);
630 int statusCode = res.getStatus();
632 // Check the status code of the response: does it match
633 // the expected response(s)?
634 if (logger.isDebugEnabled()) {
635 logger.debug(testName + ": status = " + statusCode);
637 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
638 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
639 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
641 res.releaseConnection();
646 * Read item non existent.
648 * @param testName the test name
650 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
651 groups = {"read"}, dependsOnMethods = {"readItem"})
652 public void readItemNonExistent(String testName) {
654 if (logger.isDebugEnabled()) {
655 logger.debug(testBanner(testName, CLASS_NAME));
658 setupReadNonExistent();
660 // Submit the request to the service and store the response.
661 TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
662 ClientResponse<String> res = client.readItem(knownResourceId, NON_EXISTENT_ID);
664 int statusCode = res.getStatus();
666 // Check the status code of the response: does it match
667 // the expected response(s)?
668 if (logger.isDebugEnabled()) {
669 logger.debug(testName + ": status = " + statusCode);
671 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
672 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
673 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
675 res.releaseConnection();
679 // ---------------------------------------------------------------
680 // CRUD tests : READ_LIST tests
681 // ---------------------------------------------------------------
685 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
688 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
689 groups = {"readList"}, dependsOnGroups = {"createList", "read"})
690 public void readList(String testName) throws Exception {
692 if (logger.isDebugEnabled()) {
693 logger.debug(testBanner(testName, CLASS_NAME));
698 // Submit the request to the service and store the response.
699 TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
700 ClientResponse<AbstractCommonList> res = client.readList();
702 assertStatusCode(res, testName);
703 AbstractCommonList list = res.getEntity();
704 // Optionally output additional data about list members for debugging.
705 if(logger.isTraceEnabled()){
706 AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
709 res.releaseConnection();
716 @Test(groups = {"readList"}, dependsOnMethods = {"readList"})
717 public void readItemList() {
718 String testName = "readItemList";
719 if (logger.isDebugEnabled()) {
720 logger.debug(testBanner(testName, CLASS_NAME));
722 readItemList(knownResourceId, null);
726 * Read item list by authority name.
728 @Test(groups = {"readList"}, dependsOnMethods = {"readItemList"})
729 public void readItemListByAuthorityName() {
730 String testName = "readItemListByAuthorityName";
731 if (logger.isDebugEnabled()) {
732 logger.debug(testBanner(testName, CLASS_NAME));
734 readItemList(null, knownResourceShortIdentifer);
740 * @param vcsid the vcsid
741 * @param name the name
743 private void readItemList(String vcsid, String shortId) {
745 String testName = "readItemList";
750 // Submit the request to the service and store the response.
751 TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
752 ClientResponse<AbstractCommonList> res = null;
754 res = client.readItemList(vcsid, null, null);
755 } else if (shortId != null) {
756 res = client.readItemListForNamedAuthority(shortId, null, null);
758 Assert.fail("readItemList passed null csid and name!");
761 assertStatusCode(res, testName);
762 AbstractCommonList list = res.getEntity();
763 List<AbstractCommonList.ListItem> items =
765 int nItemsReturned = items.size();
766 // There will be one item created, associated with a
767 // known parent resource, by the createItem test.
769 // In addition, there will be 'nItemsToCreateInList'
770 // additional items created by the createItemList test,
771 // all associated with the same parent resource.
772 int nExpectedItems = nItemsToCreateInList + 1;
773 if (logger.isDebugEnabled()) {
774 logger.debug(testName + ": Expected "
775 + nExpectedItems + " items; got: " + nItemsReturned);
777 Assert.assertEquals(nItemsReturned, nExpectedItems);
779 for (AbstractCommonList.ListItem item : items) {
781 AbstractCommonListUtils.ListItemGetElementValue(item, REFNAME);
782 Assert.assertTrue((null != value), "Item refName is null!");
784 AbstractCommonListUtils.ListItemGetElementValue(item, DISPLAYNAME);
785 Assert.assertTrue((null != value), "Item displayName is null!");
787 if(logger.isTraceEnabled()){
788 AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
791 res.releaseConnection();
797 // ---------------------------------------------------------------
798 // CRUD tests : UPDATE tests
799 // ---------------------------------------------------------------
802 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
805 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
806 groups = {"update"}, dependsOnGroups = {"read", "readList"})
807 public void update(String testName) throws Exception {
809 if (logger.isDebugEnabled()) {
810 logger.debug(testBanner(testName, CLASS_NAME));
815 // Retrieve the contents of a resource to update.
816 TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
817 ClientResponse<String> res = client.read(knownResourceId);
819 if (logger.isDebugEnabled()) {
820 logger.debug(testName + ": read status = " + res.getStatus());
822 Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
824 if (logger.isDebugEnabled()) {
825 logger.debug("got TaxonomyAuthority to update with ID: " + knownResourceId);
827 PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
828 TaxonomyauthorityCommon taxonomyAuthority = (TaxonomyauthorityCommon) extractPart(input,
829 client.getCommonPartName(), TaxonomyauthorityCommon.class);
830 Assert.assertNotNull(taxonomyAuthority);
832 // Update the contents of this resource.
833 taxonomyAuthority.setDisplayName("updated-" + taxonomyAuthority.getDisplayName());
834 taxonomyAuthority.setVocabType("updated-" + taxonomyAuthority.getVocabType());
835 if (logger.isDebugEnabled()) {
836 logger.debug("to be updated TaxonomyAuthority");
837 logger.debug(objectAsXmlString(taxonomyAuthority, TaxonomyauthorityCommon.class));
840 // Submit the updated resource to the service and store the response.
841 PoxPayloadOut output = new PoxPayloadOut(TaxonomyAuthorityClient.SERVICE_PAYLOAD_NAME);
842 PayloadOutputPart commonPart = output.addPart(taxonomyAuthority, MediaType.APPLICATION_XML_TYPE);
843 commonPart.setLabel(client.getCommonPartName());
844 res.releaseConnection();
845 res = client.update(knownResourceId, output);
846 int statusCode = res.getStatus();
848 // Check the status code of the response: does it match the expected response(s)?
849 if (logger.isDebugEnabled()) {
850 logger.debug(testName + ": status = " + statusCode);
852 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
853 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
854 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
856 // Retrieve the updated resource and verify that its contents exist.
857 input = new PoxPayloadIn(res.getEntity());
858 TaxonomyauthorityCommon updatedTaxonomyAuthority =
859 (TaxonomyauthorityCommon) extractPart(input,
860 client.getCommonPartName(), TaxonomyauthorityCommon.class);
861 Assert.assertNotNull(updatedTaxonomyAuthority);
863 // Verify that the updated resource received the correct data.
864 Assert.assertEquals(updatedTaxonomyAuthority.getDisplayName(),
865 taxonomyAuthority.getDisplayName(),
866 "Data in updated object did not match submitted data.");
868 res.releaseConnection();
875 * @param testName the test name
876 * @throws Exception the exception
878 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
879 groups = {"update"}, dependsOnMethods = {"update"})
880 public void updateItem(String testName) throws Exception {
882 if (logger.isDebugEnabled()) {
883 logger.debug(testBanner(testName, CLASS_NAME));
888 // Retrieve the contents of a resource to update.
889 TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
890 ClientResponse<String> res =
891 client.readItem(knownResourceId, knownItemResourceId);
893 assertStatusCode(res, testName);
894 if (logger.isDebugEnabled()) {
895 logger.debug("got Taxonomy to update with ID: "
896 + knownItemResourceId
897 + " in TaxonomyAuthority: " + knownResourceId);
899 PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
900 TaxonCommon taxon = (TaxonCommon) extractPart(input,
901 client.getItemCommonPartName(), TaxonCommon.class);
902 Assert.assertNotNull(taxon);
904 // Update the contents of this resource.
906 taxon.setTaxonFullName("updated-" + taxon.getTaxonFullName());
907 if (logger.isDebugEnabled()) {
908 logger.debug("to be updated Taxonomy");
909 logger.debug(objectAsXmlString(taxon,
913 // Submit the updated resource to the service and store the response.
914 PoxPayloadOut output = new PoxPayloadOut(TaxonomyAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
915 PayloadOutputPart commonPart = output.addPart(taxon, MediaType.APPLICATION_XML_TYPE);
916 commonPart.setLabel(client.getItemCommonPartName());
917 res.releaseConnection();
918 res = client.updateItem(knownResourceId, knownItemResourceId, output);
919 assertStatusCode(res, testName);
921 // Retrieve the updated resource and verify that its contents exist.
922 input = new PoxPayloadIn(res.getEntity());
923 TaxonCommon updatedTaxon =
924 (TaxonCommon) extractPart(input,
925 client.getItemCommonPartName(), TaxonCommon.class);
926 Assert.assertNotNull(updatedTaxon);
928 // Verify that the updated resource received the correct data.
929 Assert.assertEquals(updatedTaxon.getTaxonFullName(), taxon.getTaxonFullName(),
930 "Data in updated Taxon did not match submitted data.");
932 res.releaseConnection();
937 // Placeholders until the three tests below can be uncommented.
938 // See Issue CSPACE-401.
940 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
943 public void updateWithEmptyEntityBody(String testName) throws Exception {
947 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
950 public void updateWithMalformedXml(String testName) throws Exception {
954 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
957 public void updateWithWrongXmlSchema(String testName) throws Exception {
962 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
965 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
966 groups = {"update"}, dependsOnMethods = {"update", "testSubmitRequest"})
967 public void updateNonExistent(String testName) throws Exception {
969 if (logger.isDebugEnabled()) {
970 logger.debug(testBanner(testName, CLASS_NAME));
973 setupUpdateNonExistent();
975 // Submit the request to the service and store the response.
976 // Note: The ID(s) used when creating the request payload may be arbitrary.
977 // The only relevant ID may be the one used in update(), below.
978 TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
979 String displayName = "displayName-NON_EXISTENT_ID";
980 PoxPayloadOut multipart = TaxonomyAuthorityClientUtils.createTaxonomyAuthorityInstance(
981 displayName, "nonEx", client.getCommonPartName());
982 ClientResponse<String> res =
983 client.update(NON_EXISTENT_ID, multipart);
985 int statusCode = res.getStatus();
987 // Check the status code of the response: does it match
988 // the expected response(s)?
989 if (logger.isDebugEnabled()) {
990 logger.debug(testName + ": status = " + statusCode);
992 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
993 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
994 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
996 res.releaseConnection();
1001 * Update non existent item.
1003 * @param testName the test name
1004 * @throws Exception the exception
1006 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
1007 groups = {"update"}, dependsOnMethods = {"updateItem", "testItemSubmitRequest"})
1008 public void updateNonExistentItem(String testName) throws Exception {
1010 if (logger.isDebugEnabled()) {
1011 logger.debug(testBanner(testName, CLASS_NAME));
1014 setupUpdateNonExistent();
1016 // Submit the request to the service and store the response.
1017 // Note: The ID used in this 'create' call may be arbitrary.
1018 // The only relevant ID may be the one used in update(), below.
1019 TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
1020 Map<String, String> nonexMap = new HashMap<String, String>();
1021 nonexMap.put(TaxonJAXBSchema.NAME, TEST_TAXON_FULL_NAME);
1022 nonexMap.put(TaxonJAXBSchema.SHORT_IDENTIFIER, "nonEx");
1023 nonexMap.put(TaxonJAXBSchema.TERM_STATUS, TEST_TERM_STATUS);
1024 // PoxPayloadOut multipart =
1025 // TaxonomyAuthorityClientUtils.createTaxonInstance(
1026 // TaxonomyAuthorityClientUtils.createTaxonomyRefName(knownResourceRefName, "nonEx", "Non Existent"),
1027 // nonexMap, NULL_TAXON_AUTHOR_GROUP_LIST, NULL_TAXON_CITATION_LIST,
1028 // client.getItemCommonPartName());
1029 final String EMPTY_REFNAME = "";
1030 PoxPayloadOut multipart =
1031 TaxonomyAuthorityClientUtils.createTaxonInstance(EMPTY_REFNAME,
1032 nonexMap, NULL_TAXON_AUTHOR_GROUP_LIST, NULL_TAXON_CITATION_LIST,
1033 client.getItemCommonPartName());
1034 ClientResponse<String> res =
1035 client.updateItem(knownResourceId, NON_EXISTENT_ID, multipart);
1037 int statusCode = res.getStatus();
1039 // Check the status code of the response: does it match
1040 // the expected response(s)?
1041 if (logger.isDebugEnabled()) {
1042 logger.debug(testName + ": status = " + statusCode);
1044 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
1045 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
1046 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
1048 res.releaseConnection();
1052 // ---------------------------------------------------------------
1053 // CRUD tests : DELETE tests
1054 // ---------------------------------------------------------------
1056 // Note: delete sub-resources in ascending hierarchical order,
1057 // before deleting their parents.
1061 * @param testName the test name
1062 * @throws Exception the exception
1064 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
1065 //groups = {"delete"}, dependsOnGroups = {"create", "read", "readList", "readListByPartialTerm", "update"})
1066 groups = {"delete"}, dependsOnGroups = {"create", "read", "readList", "update"})
1067 public void deleteItem(String testName) throws Exception {
1069 if (logger.isDebugEnabled()) {
1070 logger.debug(testBanner(testName, CLASS_NAME));
1075 if (logger.isDebugEnabled()) {
1076 logger.debug("parentcsid =" + knownResourceId
1077 + " itemcsid = " + knownItemResourceId);
1080 // Submit the request to the service and store the response.
1081 TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
1082 ClientResponse<Response> res =
1083 client.deleteItem(knownResourceId, knownItemResourceId);
1085 int statusCode = res.getStatus();
1087 // Check the status code of the response: does it match
1088 // the expected response(s)?
1089 if (logger.isDebugEnabled()) {
1090 logger.debug(testName + ": status = " + statusCode);
1092 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
1093 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
1094 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
1096 res.releaseConnection();
1101 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
1104 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
1105 // groups = {"delete"}, dependsOnMethods = {"deleteItem"})
1106 public void delete(String testName) throws Exception {
1108 if (logger.isDebugEnabled()) {
1109 logger.debug(testBanner(testName, CLASS_NAME));
1114 if (logger.isDebugEnabled()) {
1115 logger.debug("parentcsid =" + knownResourceId);
1118 // Submit the request to the service and store the response.
1119 TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
1120 ClientResponse<Response> res = client.delete(knownResourceId);
1122 int statusCode = res.getStatus();
1124 // Check the status code of the response: does it match
1125 // the expected response(s)?
1126 if (logger.isDebugEnabled()) {
1127 logger.debug(testName + ": status = " + statusCode);
1129 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
1130 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
1131 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
1133 res.releaseConnection();
1139 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
1142 // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
1143 // groups = {"delete"}, dependsOnMethods = {"delete"})
1144 public void deleteNonExistent(String testName) throws Exception {
1146 if (logger.isDebugEnabled()) {
1147 logger.debug(testBanner(testName, CLASS_NAME));
1150 setupDeleteNonExistent();
1152 // Submit the request to the service and store the response.
1153 TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
1154 ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
1156 int statusCode = res.getStatus();
1158 // Check the status code of the response: does it match
1159 // the expected response(s)?
1160 if (logger.isDebugEnabled()) {
1161 logger.debug(testName + ": status = " + statusCode);
1163 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
1164 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
1165 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
1167 res.releaseConnection();
1172 * Delete non existent item.
1174 * @param testName the test name
1176 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
1177 groups = {"delete"}, dependsOnMethods = {"deleteItem"})
1178 public void deleteNonExistentItem(String testName) {
1180 if (logger.isDebugEnabled()) {
1181 logger.debug(testBanner(testName, CLASS_NAME));
1184 setupDeleteNonExistent();
1186 // Submit the request to the service and store the response.
1187 TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
1188 ClientResponse<Response> res = client.deleteItem(knownResourceId, NON_EXISTENT_ID);
1190 int statusCode = res.getStatus();
1192 // Check the status code of the response: does it match
1193 // the expected response(s)?
1194 if (logger.isDebugEnabled()) {
1195 logger.debug(testName + ": status = " + statusCode);
1197 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
1198 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
1199 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
1201 res.releaseConnection();
1205 // ---------------------------------------------------------------
1206 // Utility tests : tests of code used in tests above
1207 // ---------------------------------------------------------------
1209 * Tests the code for manually submitting data that is used by several
1210 * of the methods above.
1212 @Test(dependsOnMethods = {"create", "read"})
1213 public void testSubmitRequest() {
1215 // Expected status code: 200 OK
1216 final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
1218 // Submit the request to the service and store the response.
1219 String method = ServiceRequestType.READ.httpMethodName();
1220 String url = getResourceURL(knownResourceId);
1221 int statusCode = submitRequest(method, url);
1223 // Check the status code of the response: does it match
1224 // the expected response(s)?
1225 if (logger.isDebugEnabled()) {
1226 logger.debug("testSubmitRequest: url=" + url
1227 + " status=" + statusCode);
1229 Assert.assertEquals(statusCode, EXPECTED_STATUS);
1234 * Test item submit request.
1236 @Test(dependsOnMethods = {"createItem", "readItem", "testSubmitRequest"})
1237 public void testItemSubmitRequest() {
1239 // Expected status code: 200 OK
1240 final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
1242 // Submit the request to the service and store the response.
1243 String method = ServiceRequestType.READ.httpMethodName();
1244 String url = getItemResourceURL(knownResourceId, knownItemResourceId);
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("testItemSubmitRequest: 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)
1269 public void cleanUp() {
1270 String noTest = System.getProperty("noTestCleanup");
1271 if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
1272 if (logger.isDebugEnabled()) {
1273 logger.debug("Skipping Cleanup phase ...");
1277 if (logger.isDebugEnabled()) {
1278 logger.debug("Cleaning up temporary resources created for testing ...");
1280 String parentResourceId;
1281 String itemResourceId;
1282 // Clean up contact resources.
1283 TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
1284 parentResourceId = knownResourceId;
1285 // Clean up item resources.
1286 for (Map.Entry<String, String> entry : allItemResourceIdsCreated.entrySet()) {
1287 itemResourceId = entry.getKey();
1288 parentResourceId = entry.getValue();
1289 // Note: Any non-success responses from the delete operation
1290 // below are ignored and not reported.
1291 ClientResponse<Response> res =
1292 client.deleteItem(parentResourceId, itemResourceId);
1293 res.releaseConnection();
1295 // Clean up parent resources.
1296 for (String resourceId : allResourceIdsCreated) {
1297 // Note: Any non-success responses from the delete operation
1298 // below are ignored and not reported.
1299 ClientResponse<Response> res = client.delete(resourceId);
1300 res.releaseConnection();
1304 // ---------------------------------------------------------------
1305 // Utility methods used by tests above
1306 // ---------------------------------------------------------------
1308 * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
1311 * Returns the root URL for the item service.
1313 * This URL consists of a base URL for all services, followed by
1314 * a path component for the owning parent, followed by the
1315 * path component for the items.
1317 * @param parentResourceIdentifier An identifier (such as a UUID) for the
1318 * parent authority resource of the relevant item resource.
1320 * @return The root URL for the item service.
1322 protected String getItemServiceRootURL(String parentResourceIdentifier) {
1323 return getResourceURL(parentResourceIdentifier) + "/" + getItemServicePathComponent();
1327 * Returns the URL of a specific item resource managed by a service, and
1328 * designated by an identifier (such as a universally unique ID, or UUID).
1330 * @param parentResourceIdentifier An identifier (such as a UUID) for the
1331 * parent authority resource of the relevant item resource.
1333 * @param itemResourceIdentifier An identifier (such as a UUID) for an
1336 * @return The URL of a specific item resource managed by a service.
1338 protected String getItemResourceURL(String parentResourceIdentifier, String itemResourceIdentifier) {
1339 return getItemServiceRootURL(parentResourceIdentifier) + "/" + itemResourceIdentifier;