import java.util.Date;
import java.util.List;
import java.util.Map;
-
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
-
import org.apache.commons.io.FileUtils;
import org.collectionspace.services.TaxonJAXBSchema;
import org.collectionspace.services.client.test.ServiceRequestType;
import org.collectionspace.services.common.api.Tools;
-import org.collectionspace.services.taxonomy.*;
+import org.collectionspace.services.taxonomy.CommonNameGroupList;
+import org.collectionspace.services.taxonomy.TaxonAuthorGroupList;
+import org.collectionspace.services.taxonomy.TaxonCitationList;
+import org.collectionspace.services.taxonomy.TaxonCommon;
+import org.collectionspace.services.taxonomy.TaxonTermGroup;
+import org.collectionspace.services.taxonomy.TaxonTermGroupList;
+import org.collectionspace.services.taxonomy.TaxonomyauthorityCommon;
import org.dom4j.DocumentException;
import org.jboss.resteasy.client.ClientResponse;
import org.slf4j.Logger;
/**
* Creates a new Taxonomy Authority
+ *
* @param displayName The displayName used in UI, etc.
- * @param refName The proper refName for this authority
+ * @param refName The proper refName for this authority
* @param headerLabel The common part label
* @return The PoxPayloadOut payload for the create call
*/
}
/**
- * @param taxonomyAuthRefName The proper refName for this authority.
- * @param taxonInfo the properties for the new instance of a term in this authority.
- * @param taxonAuthorGroupList an author group list (values of a repeatable group in the term record).
- * @param taxonCitationList a citation list (values of a repeatable scalar in the term record).
+ * @param taxonomyAuthRefName The proper refName for this authority.
+ * @param taxonInfo the properties for the new instance of a term in this
+ * authority.
+ * @param taxonAuthorGroupList an author group list (values of a repeatable
+ * group in the term record).
+ * @param taxonCitationList a citation list (values of a repeatable scalar
+ * in the term record).
* @param headerLabel The common part label
* @return The PoxPayloadOut payload for the create call
*/
public static PoxPayloadOut createTaxonInstance(
- String taxonomyAuthRefName, Map<String, String> taxonInfo, List<TaxonTermGroup> terms,
- TaxonAuthorGroupList taxonAuthorGroupList, TaxonCitationList taxonCitationList,
- String headerLabel) {
+ String taxonomyAuthRefName, Map<String, String> taxonInfo,
+ List<TaxonTermGroup> terms, TaxonAuthorGroupList taxonAuthorGroupList,
+ TaxonCitationList taxonCitationList, CommonNameGroupList commonNameGroupList, String headerLabel) {
TaxonCommon taxon = new TaxonCommon();
String shortId = taxonInfo.get(TaxonJAXBSchema.SHORT_IDENTIFIER);
taxon.setShortIdentifier(shortId);
terms = getTermGroupInstance(getGeneratedIdentifier());
}
}
+ terms.get(0).setTermDisplayName(taxonInfo.get(TaxonJAXBSchema.NAME));
+ terms.get(0).setTermName(taxonInfo.get(TaxonJAXBSchema.NAME));
terms.get(0).setTermStatus(taxonInfo.get(TaxonJAXBSchema.TERM_STATUS));
- termList.getTaxonTermGroup().addAll(terms);
- taxon.setTaxonTermGroupList(termList);
-
+ terms.get(0).setTaxonomicStatus(taxonInfo.get(TaxonJAXBSchema.TAXONOMIC_STATUS));
+ termList.getTaxonTermGroup().addAll(terms);
+ taxon.setTaxonTermGroupList(termList);
+
String value = null;
// Fields specific to this authority record type.
- if ((value = (String) taxonInfo.get(TaxonJAXBSchema.NAME)) != null) {
- taxon.setTaxonFullName(value);
- }
if ((value = (String) taxonInfo.get(TaxonJAXBSchema.TAXON_RANK)) != null) {
taxon.setTaxonRank(value);
}
if ((value = (String) taxonInfo.get(TaxonJAXBSchema.TAXON_YEAR)) != null) {
taxon.setTaxonYear(value);
}
- if ((value = (String) taxonInfo.get(TaxonJAXBSchema.TAXONOMIC_STATUS)) != null) {
- taxon.setTaxonomicStatus(value);
- }
- if ((value = (String) taxonInfo.get(TaxonJAXBSchema.TAXON_IS_NAMED_HYBRID)) != null) {
- taxon.setTaxonIsNamedHybrid(value);
- }
if (taxonCitationList != null) {
taxon.setTaxonCitationList(taxonCitationList);
}
-
if (taxonAuthorGroupList != null) {
taxon.setTaxonAuthorGroupList(taxonAuthorGroupList);
}
+ if (commonNameGroupList != null) {
+ taxon.setCommonNameGroupList(commonNameGroupList);
+ }
- // FIXME: When the field isNamedHybrid becomes Boolean, add it as such to sample instances.
+ taxon.setTaxonIsNamedHybrid(Boolean.parseBoolean(
+ taxonInfo.get(TaxonJAXBSchema.TAXON_IS_NAMED_HYBRID)));
PoxPayloadOut multipart = new PoxPayloadOut(TaxonomyAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
PayloadOutputPart commonPart = multipart.addPart(taxon,
public static String createItemInAuthority(String vcsid,
String TaxonomyauthorityRefName, Map<String, String> taxonMap,
List<TaxonTermGroup> terms, TaxonAuthorGroupList taxonAuthorGroupList,
- TaxonCitationList taxonCitationList, TaxonomyAuthorityClient client) {
+ TaxonCitationList taxonCitationList, CommonNameGroupList commonNameGroupList,
+ TaxonomyAuthorityClient client) {
// Expected status code: 201 Created
int EXPECTED_STATUS_CODE = Response.Status.CREATED.getStatusCode();
// Type of service request being tested
}
PoxPayloadOut multipart =
createTaxonInstance(TaxonomyauthorityRefName,
- taxonMap, terms, taxonAuthorGroupList, taxonCitationList, client.getItemCommonPartName());
+ taxonMap, terms, taxonAuthorGroupList, taxonCitationList, commonNameGroupList, client.getItemCommonPartName());
String newID = null;
ClientResponse<Response> res = client.createItem(vcsid, multipart);
try {
* specific call to a service does not fall within a set of valid status
* codes for that service.
*
- * @param serviceRequestType A type of service request (e.g. CREATE, DELETE).
+ * @param serviceRequestType A type of service request (e.g. CREATE,
+ * DELETE).
*
- * @param statusCode The invalid status code that was returned in the response,
- * from submitting that type of request to the service.
+ * @param statusCode The invalid status code that was returned in the
+ * response, from submitting that type of request to the service.
*
* @return An error message.
*/
/**
* Produces a default displayName from the basic name and dates fields.
+ *
* @see TaxonomyDocumentModelHandler.prepareDefaultDisplayName() which
* duplicates this logic, until we define a service-general utils package
* that is neither client nor service specific.
- * @param name
+ * @param name
* @return
*/
public static String prepareDefaultDisplayName(
newStr.append(name);
return newStr.toString();
}
-
+
public static List<TaxonTermGroup> getTermGroupInstance(String identifier) {
if (Tools.isBlank(identifier)) {
identifier = getGeneratedIdentifier();
terms.add(term);
return terms;
}
-
+
private static String getGeneratedIdentifier() {
- return "id" + new Date().getTime();
- }
+ return "id" + new Date().getTime();
+ }
}
/**
- * This document is a part of the source code and related artifacts
- * for CollectionSpace, an open source collections management system
- * for museums and related institutions:
+ * This document is a part of the source code and related artifacts for
+ * CollectionSpace, an open source collections management system for museums and
+ * related institutions:
*
- * http://www.collectionspace.org
- * http://wiki.collectionspace.org
+ * http://www.collectionspace.org http://wiki.collectionspace.org
*
* Copyright (c)) 2009 Regents of the University of California
*
- * Licensed under the Educational Community License (ECL), Version 2.0.
- * You may not use this file except in compliance with this License.
+ * Licensed under the Educational Community License (ECL), Version 2.0. You may
+ * not use this file except in compliance with this License.
*
* You may obtain a copy of the ECL 2.0 License at
* https://source.collectionspace.org/collection-space/LICENSE.txt
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.collectionspace.services.client.test;
import org.collectionspace.services.client.TaxonomyAuthorityClientUtils;
import org.collectionspace.services.client.TaxonomyAuthorityProxy;
import org.collectionspace.services.jaxb.AbstractCommonList;
+import org.collectionspace.services.taxonomy.CommonNameGroupList;
import org.collectionspace.services.taxonomy.TaxonAuthorGroup;
import org.collectionspace.services.taxonomy.TaxonAuthorGroupList;
import org.collectionspace.services.taxonomy.TaxonCitationList;
import org.testng.annotations.Test;
/**
- * TaxonomyAuthorityServiceTest, carries out tests against a
- * deployed and running TaxonomyAuthority Service.
+ * TaxonomyAuthorityServiceTest, carries out tests against a deployed and
+ * running TaxonomyAuthority Service.
*
- * $LastChangedRevision$
- * $LastChangedDate$
+ * $LastChangedRevision$ $LastChangedDate$
*/
public class TaxonomyAuthorityServiceTest extends AbstractAuthorityServiceTest<TaxonomyauthorityCommon, TaxonCommon> {
- /** The logger. */
+ /**
+ * The logger.
+ */
private final String CLASS_NAME = TaxonomyAuthorityServiceTest.class.getName();
private final Logger logger = LoggerFactory.getLogger(TaxonomyAuthorityServiceTest.class);
-
private final String TEST_SHORTID = "CentauruspleurexanthemusGreen1832";
private final String TEST_TERM_STATUS = "accepted";
private final String TEST_TAXON_FULL_NAME = "Centaurus pleurexanthemus Green 1832";
private final List<TaxonTermGroup> NULL_TAXON_TERMS_LIST = null;
private final TaxonAuthorGroupList NULL_TAXON_AUTHOR_GROUP_LIST = null;
private final TaxonCitationList NULL_TAXON_CITATION_LIST = null;
-
+ private final CommonNameGroupList NULL_COMMON_NAME_GROUP_LIST = null;
+
private String knownResourceShortIdentifer = null;
private String knownTaxonomyTypeRefName = null;
public String getItemServicePathComponent() {
return AuthorityClient.ITEMS;
}
-
- /* (non-Javadoc)
- * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
+
+ /*
+ * (non-Javadoc) @see
+ * org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
*/
@Override
protected CollectionSpaceClient<AbstractCommonList, PoxPayloadOut, String, TaxonomyAuthorityProxy> getClientInstance() {
taxonAuthorGroup.setTaxonAuthor(TEST_TAXON_AUTHOR);
taxonAuthorGroup.setTaxonAuthorType(TEST_TAXON_AUTHOR_TYPE);
taxonAuthorGroups.add(taxonAuthorGroup);
+
+ CommonNameGroupList commonNameGroupList = new CommonNameGroupList();
+ List<CommonNameGroup> commonNameGroups = commonNameGroupList.getCommonNameGroup();
+ CommonNameGroup commonNameGroup = new CommonNameGroup();
+ commonNameGroup.setCommonName(TEST_TAXON_FULL_NAME);
+ commonNameGroups.add(commonNameGroup);
// FIXME: Add additional fields in the Taxon record here,
// including at least one each of:
// * an authref field (when implemented)
String newID = TaxonomyAuthorityClientUtils.createItemInAuthority(vcsid,
- authRefName, taxonMap, NULL_TAXON_TERMS_LIST, taxonAuthorGroupList, taxonCitationList, client);
+ authRefName, taxonMap, NULL_TAXON_TERMS_LIST, taxonAuthorGroupList,
+ taxonCitationList, commonNameGroupList, client);
// Store the ID returned from the first item resource created
// for additional tests below.
@Test(dataProvider = "testName")
public void verifyIllegalItemDisplayName(String testName) throws Exception {
//
- // First read in our known resource.
- //
+ // First read in our known resource.
+ //
setupRead();
TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
client.getItemCommonPartName(), TaxonCommon.class);
Assert.assertNotNull(taxon);
} finally {
- if (res != null) {
+ if (res != null) {
res.releaseConnection();
}
}
Assert.assertTrue(terms.size() > 0);
terms.get(0).setTermDisplayName(null);
terms.get(0).setTermName(null);
-
+
PoxPayloadOut output = new PoxPayloadOut(TaxonomyAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
PayloadOutputPart commonPart = output.addPart(client.getItemCommonPartName(), taxon);
setupUpdateWithInvalidBody(); // we expect a failure here
res = client.updateItem(knownResourceId, knownItemResourceId, output);
try {
- assertStatusCode(res, testName);
+ assertStatusCode(res, testName);
} finally {
res.releaseConnection();
}
* Read item list.
*/
@Test(dataProvider = "testName", groups = {"readList"},
- dependsOnMethods = {"readList"})
+ dependsOnMethods = {"readList"})
public void readItemList(String testName) {
readItemList(knownAuthorityWithItems, null);
}
* Read item list by authority name.
*/
@Test(dataProvider = "testName", groups = {"readList"},
- dependsOnMethods = {"readItemList"})
+ dependsOnMethods = {"readItemList"})
public void readItemListByAuthorityName(String testName) {
readItemList(null, READITEMS_SHORT_IDENTIFIER);
}
}
try {
assertStatusCode(res, testName);
- AbstractCommonList list = res.getEntity();
+ AbstractCommonList list = res.getEntity();
int statusCode = res.getStatus();
// Check the status code of the response: does it match
Assert.assertEquals(nItemsReturned, nExpectedItems);
for (AbstractCommonList.ListItem item : items) {
- String value =
- AbstractCommonListUtils.ListItemGetElementValue(item, TaxonJAXBSchema.REF_NAME);
+ String value =
+ AbstractCommonListUtils.ListItemGetElementValue(item, TaxonJAXBSchema.REF_NAME);
Assert.assertTrue((null != value), "Item refName is null!");
- value =
- AbstractCommonListUtils.ListItemGetElementValue(item, TaxonJAXBSchema.DISPLAY_NAME);
+ value =
+ AbstractCommonListUtils.ListItemGetElementValue(item, TaxonJAXBSchema.DISPLAY_NAME);
Assert.assertTrue((null != value), "Item displayName is null!");
}
- if(logger.isTraceEnabled()){
- AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
+ if (logger.isTraceEnabled()) {
+ AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
}
} finally {
res.releaseConnection();
@Override
public void delete(String testName) throws Exception {
- // Do nothing. See localDelete(). This ensure proper test order.
+ // Do nothing. See localDelete(). This ensure proper test order.
}
-
- @Test(dataProvider = "testName", dependsOnMethods = {"localDeleteItem"})
+
+ @Test(dataProvider = "testName", dependsOnMethods = {"localDeleteItem"})
public void localDelete(String testName) throws Exception {
- super.delete(testName);
+ super.delete(testName);
}
@Override
public void deleteItem(String testName) throws Exception {
- // Do nothing. We need to wait until after the test "localDelete" gets run. When it does,
- // its dependencies will get run first and then we can call the base class' delete method.
+ // Do nothing. We need to wait until after the test "localDelete" gets run. When it does,
+ // its dependencies will get run first and then we can call the base class' delete method.
}
-
+
@Test(dataProvider = "testName", groups = {"delete"},
- dependsOnMethods = {"verifyIllegalItemDisplayName"})
+ dependsOnMethods = {"verifyIllegalItemDisplayName"})
public void localDeleteItem(String testName) throws Exception {
- super.deleteItem(testName);
+ super.deleteItem(testName);
}
-
+
// ---------------------------------------------------------------
// Cleanup of resources created during testing
// ---------------------------------------------------------------
* Deletes all resources created by tests, after all tests have been run.
*
* This cleanup method will always be run, even if one or more tests fail.
- * For this reason, it attempts to remove all resources created
- * at any point during testing, even if some of those resources
- * may be expected to be deleted by certain tests.
+ * For this reason, it attempts to remove all resources created at any point
+ * during testing, even if some of those resources may be expected to be
+ * deleted by certain tests.
*/
@AfterClass(alwaysRun = true)
public void cleanUp() {
// ---------------------------------------------------------------
// Utility methods used by tests above
// ---------------------------------------------------------------
- /* (non-Javadoc)
- * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
+ /*
+ * (non-Javadoc) @see
+ * org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
*/
/**
* Returns the root URL for the item service.
*
- * This URL consists of a base URL for all services, followed by
- * a path component for the owning parent, followed by the
- * path component for the items.
+ * This URL consists of a base URL for all services, followed by a path
+ * component for the owning parent, followed by the path component for the
+ * items.
*
- * @param parentResourceIdentifier An identifier (such as a UUID) for the
+ * @param parentResourceIdentifier An identifier (such as a UUID) for the
* parent authority resource of the relevant item resource.
*
* @return The root URL for the item service.
* Returns the URL of a specific item resource managed by a service, and
* designated by an identifier (such as a universally unique ID, or UUID).
*
- * @param parentResourceIdentifier An identifier (such as a UUID) for the
+ * @param parentResourceIdentifier An identifier (such as a UUID) for the
* parent authority resource of the relevant item resource.
*
- * @param itemResourceIdentifier An identifier (such as a UUID) for an
- * item resource.
+ * @param itemResourceIdentifier An identifier (such as a UUID) for an item
+ * resource.
*
* @return The URL of a specific item resource managed by a service.
*/
return getItemServiceRootURL(parentResourceIdentifier) + "/" + itemResourceIdentifier;
}
- @Override
- public void authorityTests(String testName) {
- // TODO Auto-generated method stub
- }
-
- //
- // Taxonomy authority specific instances
- //
-
- @Override
- protected PoxPayloadOut createInstance(String commonPartName,
- String identifier) {
+ @Override
+ public void authorityTests(String testName) {
+ // TODO Auto-generated method stub
+ }
+
+ //
+ // Taxonomy authority specific instances
+ //
+ @Override
+ protected PoxPayloadOut createInstance(String commonPartName,
+ String identifier) {
String shortId = identifier;
String displayName = "displayName-" + shortId;
String baseRefName =
TaxonomyAuthorityClientUtils.createTaxonomyAuthorityInstance(
displayName, shortId, commonPartName);
return multipart;
- }
-
- @Override
+ }
+
+ @Override
protected PoxPayloadOut createNonExistenceInstance(String commonPartName, String identifier) {
String displayName = "displayName-NON_EXISTENT_ID";
- PoxPayloadOut result = TaxonomyAuthorityClientUtils.createTaxonomyAuthorityInstance(
- displayName, "nonEx", commonPartName);
- return result;
- }
-
- @Override
- protected TaxonomyauthorityCommon updateInstance(
- TaxonomyauthorityCommon taxonomyAuthority) {
- TaxonomyauthorityCommon result = new TaxonomyauthorityCommon();
-
- result.setDisplayName("updated-" + taxonomyAuthority.getDisplayName());
- result.setVocabType("updated-" + taxonomyAuthority.getVocabType());
-
- return result;
- }
-
- @Override
- protected void compareUpdatedInstances(TaxonomyauthorityCommon original,
- TaxonomyauthorityCommon updated) throws Exception {
+ PoxPayloadOut result = TaxonomyAuthorityClientUtils.createTaxonomyAuthorityInstance(
+ displayName, "nonEx", commonPartName);
+ return result;
+ }
+
+ @Override
+ protected TaxonomyauthorityCommon updateInstance(
+ TaxonomyauthorityCommon taxonomyAuthority) {
+ TaxonomyauthorityCommon result = new TaxonomyauthorityCommon();
+
+ result.setDisplayName("updated-" + taxonomyAuthority.getDisplayName());
+ result.setVocabType("updated-" + taxonomyAuthority.getVocabType());
+
+ return result;
+ }
+
+ @Override
+ protected void compareUpdatedInstances(TaxonomyauthorityCommon original,
+ TaxonomyauthorityCommon updated) throws Exception {
// Verify that the updated resource received the correct data.
Assert.assertEquals(updated.getDisplayName(),
- original.getDisplayName(),
+ original.getDisplayName(),
"Display name in updated object did not match submitted data.");
- }
-
- //
- // Authority item specific overrides
- //
-
- @Override
- protected String createItemInAuthority(String authorityId) {
- return createItemInAuthority(authorityId, null /*refname*/);
- }
-
- @Override
- protected TaxonCommon updateItemInstance(TaxonCommon taxonCommon) {
- TaxonCommon result = taxonCommon;
- TaxonTermGroupList termList = taxonCommon.getTaxonTermGroupList();
- Assert.assertNotNull(termList);
- List<TaxonTermGroup> terms = termList.getTaxonTermGroup();
- Assert.assertNotNull(terms);
- Assert.assertTrue(terms.size() > 0);
- terms.get(0).setTermDisplayName("updated-" + terms.get(0).getTermDisplayName());
- terms.get(0).setTermName("updated-" + terms.get(0).getTermName());
- result.setTaxonTermGroupList(termList);
- return result;
- }
-
- @Override
- protected void compareUpdatedItemInstances(TaxonCommon original,
- TaxonCommon updated) throws Exception {
-
- TaxonTermGroupList originalTermList = original.getTaxonTermGroupList();
- Assert.assertNotNull(originalTermList);
- List<TaxonTermGroup> originalTerms = originalTermList.getTaxonTermGroup();
- Assert.assertNotNull(originalTerms);
- Assert.assertTrue(originalTerms.size() > 0);
-
- TaxonTermGroupList updatedTermList = updated.getTaxonTermGroupList();
- Assert.assertNotNull(updatedTermList);
- List<TaxonTermGroup> updatedTerms = updatedTermList.getTaxonTermGroup();
- Assert.assertNotNull(updatedTerms);
- Assert.assertTrue(updatedTerms.size() > 0);
-
- Assert.assertEquals(updatedTerms.get(0).getTermDisplayName(),
+ }
+
+ //
+ // Authority item specific overrides
+ //
+ @Override
+ protected String createItemInAuthority(String authorityId) {
+ return createItemInAuthority(authorityId, null /*
+ * refname
+ */);
+ }
+
+ @Override
+ protected TaxonCommon updateItemInstance(TaxonCommon taxonCommon) {
+ TaxonCommon result = taxonCommon;
+ TaxonTermGroupList termList = taxonCommon.getTaxonTermGroupList();
+ Assert.assertNotNull(termList);
+ List<TaxonTermGroup> terms = termList.getTaxonTermGroup();
+ Assert.assertNotNull(terms);
+ Assert.assertTrue(terms.size() > 0);
+ terms.get(0).setTermDisplayName("updated-" + terms.get(0).getTermDisplayName());
+ terms.get(0).setTermName("updated-" + terms.get(0).getTermName());
+ result.setTaxonTermGroupList(termList);
+ return result;
+ }
+
+ @Override
+ protected void compareUpdatedItemInstances(TaxonCommon original,
+ TaxonCommon updated) throws Exception {
+
+ TaxonTermGroupList originalTermList = original.getTaxonTermGroupList();
+ Assert.assertNotNull(originalTermList);
+ List<TaxonTermGroup> originalTerms = originalTermList.getTaxonTermGroup();
+ Assert.assertNotNull(originalTerms);
+ Assert.assertTrue(originalTerms.size() > 0);
+
+ TaxonTermGroupList updatedTermList = updated.getTaxonTermGroupList();
+ Assert.assertNotNull(updatedTermList);
+ List<TaxonTermGroup> updatedTerms = updatedTermList.getTaxonTermGroup();
+ Assert.assertNotNull(updatedTerms);
+ Assert.assertTrue(updatedTerms.size() > 0);
+
+ Assert.assertEquals(updatedTerms.get(0).getTermDisplayName(),
originalTerms.get(0).getTermDisplayName(),
"Value in updated record did not match submitted data.");
- }
+ }
- @Override
- protected void verifyReadItemInstance(TaxonCommon item) throws Exception {
- Assert.assertNotNull(item.getTaxonFullName(), "Field value is unexpectedly null.");
- Assert.assertEquals(item.getTaxonFullName(), TEST_TAXON_FULL_NAME,
- "Field value " + item.getTaxonFullName()
+ @Override
+ protected void verifyReadItemInstance(TaxonCommon item) throws Exception {
+
+ TaxonTermGroupList termList = item.getTaxonTermGroupList();
+ Assert.assertNotNull(termList);
+ List<TaxonTermGroup> terms = termList.getTaxonTermGroup();
+ Assert.assertNotNull(terms);
+ Assert.assertTrue(terms.size() > 0);
+
+ String preferredTermName = terms.get(0).getTermName();
+ Assert.assertNotNull(preferredTermName, "Field value is unexpectedly null.");
+ Assert.assertEquals(preferredTermName, TEST_TAXON_FULL_NAME,
+ "Field value " + preferredTermName
+ "does not match expected value " + TEST_TAXON_FULL_NAME);
- }
+ }
- @Override
- protected PoxPayloadOut createNonExistenceItemInstance(
- String commonPartName, String identifier) {
+ @Override
+ protected PoxPayloadOut createNonExistenceItemInstance(
+ String commonPartName, String identifier) {
Map<String, String> nonexMap = new HashMap<String, String>();
nonexMap.put(TaxonJAXBSchema.NAME, TEST_TAXON_FULL_NAME);
nonexMap.put(TaxonJAXBSchema.SHORT_IDENTIFIER, "nonEx");
PoxPayloadOut result =
TaxonomyAuthorityClientUtils.createTaxonInstance(EMPTY_REFNAME,
nonexMap, NULL_TAXON_TERMS_LIST, NULL_TAXON_AUTHOR_GROUP_LIST, NULL_TAXON_CITATION_LIST,
- commonPartName);
- return result;
- }
+ NULL_COMMON_NAME_GROUP_LIST, commonPartName);
+ return result;
+ }
}