From: remillet Date: Fri, 29 Apr 2016 07:18:30 +0000 (-0700) Subject: CSPACE-6937-A: Getting all tests passing again. X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=3e6bd283f7e9d18d2a9e834191815ad268bed171;p=tmp%2Fjakarta-migration.git CSPACE-6937-A: Getting all tests passing again. --- diff --git a/services/IntegrationTests/src/main/java/org/collectionspace/services/IntegrationTests/xmlreplay/XmlReplayReport.java b/services/IntegrationTests/src/main/java/org/collectionspace/services/IntegrationTests/xmlreplay/XmlReplayReport.java index 6bbdb80ff..6d1315189 100644 --- a/services/IntegrationTests/src/main/java/org/collectionspace/services/IntegrationTests/xmlreplay/XmlReplayReport.java +++ b/services/IntegrationTests/src/main/java/org/collectionspace/services/IntegrationTests/xmlreplay/XmlReplayReport.java @@ -1,12 +1,13 @@ package org.collectionspace.services.IntegrationTests.xmlreplay; -import org.collectionspace.services.common.XmlTools; +import org.collectionspace.services.client.XmlTools; import org.collectionspace.services.common.api.FileTools; import org.collectionspace.services.common.api.Tools; import org.dom4j.Document; import org.dom4j.DocumentHelper; import javax.swing.text.Style; + import java.io.File; import java.util.ArrayList; import java.util.List; diff --git a/services/JaxRsServiceProvider/src/main/resources/log4j.properties b/services/JaxRsServiceProvider/src/main/resources/log4j.properties index ccbc09580..89b5901f4 100644 --- a/services/JaxRsServiceProvider/src/main/resources/log4j.properties +++ b/services/JaxRsServiceProvider/src/main/resources/log4j.properties @@ -53,8 +53,9 @@ log4j.additivity.perf.collectionspace=false # CollectionSpace loggers and default levels - all loggers using the rootLogger if not otherwise specified # log4j.logger.org.collectionspace=WARN -log4j.logger.org.collectionspace.services.nuxeo.client.java.NuxeoClientEmbedded=TRACE -log4j.logger.org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl=DEBUG +log4j.logger.org.collectionspace.services.nuxeo.client.java.NuxeoClientEmbedded=ERROR +log4j.logger.org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl=ERROR +log4j.logger.org.collectionspace.services.common.security.SecurityInterceptor=TRACE #log4j.logger.org.collectionspace.services.nuxeo.client.java=ERROR #log4j.logger.org.collectionspace.services.common.storage.JDBCTools=ERROR #log4j.logger.org.collectionspace.services.common.profile.CSpaceFilter=ERROR diff --git a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java index 9ed8ab264..6d99b8d32 100644 --- a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java +++ b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java @@ -45,8 +45,8 @@ import org.collectionspace.services.client.IClientQueryParams; import org.collectionspace.services.client.IQueryManager; import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; +import org.collectionspace.services.client.XmlTools; import org.collectionspace.services.client.workflow.WorkflowClient; -import org.collectionspace.services.common.XmlTools; import org.collectionspace.services.common.CSWebApplicationException; import org.collectionspace.services.common.NuxeoBasedResource; import org.collectionspace.services.common.ResourceMap; diff --git a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityDocumentModelHandler.java b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityDocumentModelHandler.java index 58af1e5a5..d7ee444e4 100644 --- a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityDocumentModelHandler.java +++ b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityDocumentModelHandler.java @@ -36,9 +36,9 @@ import org.collectionspace.services.client.PayloadInputPart; import org.collectionspace.services.client.VocabularyClient; import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; +import org.collectionspace.services.client.XmlTools; import org.collectionspace.services.client.workflow.WorkflowClient; import org.collectionspace.services.common.ResourceMap; -import org.collectionspace.services.common.XmlTools; import org.collectionspace.services.common.api.RefName; import org.collectionspace.services.common.api.RefName.Authority; import org.collectionspace.services.common.api.RefNameUtils; diff --git a/services/citation/client/src/test/java/org/collectionspace/services/client/test/CitationAuthorityServiceTest.java b/services/citation/client/src/test/java/org/collectionspace/services/client/test/CitationAuthorityServiceTest.java index 656dde424..fff2b2d12 100644 --- a/services/citation/client/src/test/java/org/collectionspace/services/client/test/CitationAuthorityServiceTest.java +++ b/services/citation/client/src/test/java/org/collectionspace/services/client/test/CitationAuthorityServiceTest.java @@ -144,24 +144,6 @@ public class CitationAuthorityServiceTest extends AbstractAuthorityServiceTest /** The uri path element for items in an authority */ public static String ITEMS = "items"; //used to construct uri's in service paths for authorities. + public static final String SHORT_IDENTIFIER = "shortIdentifier"; + public static final String TERM_DISPLAY_NAME = "termDisplayName"; + public static final String VOCAB_DISPLAY_NAME = "displayName"; + public static final String REF_NAME = "refName"; /* * Basic CRUD operations diff --git a/services/common/src/main/java/org/collectionspace/services/common/XmlTools.java b/services/client/src/main/java/org/collectionspace/services/client/XmlTools.java similarity index 99% rename from services/common/src/main/java/org/collectionspace/services/common/XmlTools.java rename to services/client/src/main/java/org/collectionspace/services/client/XmlTools.java index d344243fa..11579ca60 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/XmlTools.java +++ b/services/client/src/main/java/org/collectionspace/services/client/XmlTools.java @@ -1,4 +1,4 @@ -package org.collectionspace.services.common; +package org.collectionspace.services.client; import java.io.Closeable; import java.io.File; diff --git a/services/client/src/main/java/org/collectionspace/services/client/test/AbstractAuthorityServiceTest.java b/services/client/src/main/java/org/collectionspace/services/client/test/AbstractAuthorityServiceTest.java index 83bb131b4..5c2cb9e9e 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/test/AbstractAuthorityServiceTest.java +++ b/services/client/src/main/java/org/collectionspace/services/client/test/AbstractAuthorityServiceTest.java @@ -13,8 +13,12 @@ import org.collectionspace.services.client.AuthorityProxy; import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.PayloadInputPart; import org.collectionspace.services.client.PayloadOutputPart; +import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; +import org.collectionspace.services.client.XmlTools; import org.collectionspace.services.jaxb.AbstractCommonList; + +import org.dom4j.Document; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.Assert; @@ -38,6 +42,7 @@ public abstract class AbstractAuthorityServiceTest { * @return the object * @throws Exception the exception */ - static protected Object extractPart(PoxPayloadIn input, String label, Class clazz) - throws Exception { - Object result = null; - PayloadInputPart payloadInputPart = input.getPart(label); - if (payloadInputPart != null) { - result = payloadInputPart.getBody(); - } else if (logger.isWarnEnabled() == true) { - logger.warn("Payload part: " + label + - " is missing from payload: " + input.getName()); - } - return result; - } + static protected Object extractPart(PoxPayloadIn input, String label, Class clazz) throws Exception { + Object result = null; + + PayloadInputPart payloadInputPart = input.getPart(label); + if (payloadInputPart != null) { + result = payloadInputPart.getBody(); + } else if (logger.isWarnEnabled() == true) { + logger.warn("Payload part: " + label + " is missing from payload: " + input.getName()); + } + + return result; + } + + static protected Object extractPart(PoxPayloadOut output, String label, Class clazz) throws Exception { + Object result = null; + + PayloadOutputPart payloadOutPart = output.getPart(label); + if (payloadOutPart != null) { + result = payloadOutPart.getBody(); + } else if (logger.isWarnEnabled() == true) { + logger.warn("Payload part: " + label + " is missing from payload: " + output.getName()); + } + + return result; + } + /** * Gets the part object. diff --git a/services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java b/services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java index 9d59d4f57..ed7079239 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java +++ b/services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java @@ -18,6 +18,7 @@ import javax.sql.DataSource; import org.apache.tomcat.dbcp.dbcp.BasicDataSource; import org.collectionspace.authentication.AuthN; +import org.collectionspace.services.client.XmlTools; import org.collectionspace.services.common.api.JEEServerDeployment; import org.collectionspace.services.common.api.FileTools; import org.collectionspace.services.common.api.Tools; @@ -41,7 +42,6 @@ import org.collectionspace.services.config.types.PropertyItemType; import org.collectionspace.services.config.types.PropertyType; import org.collectionspace.services.nuxeo.client.java.NuxeoConnectorEmbedded; import org.collectionspace.services.nuxeo.client.java.TenantRepository; - import org.apache.commons.io.FileUtils; import org.jboss.resteasy.spi.ResteasyProviderFactory; import org.dom4j.Document; diff --git a/services/common/src/main/java/org/collectionspace/services/common/document/Hierarchy.java b/services/common/src/main/java/org/collectionspace/services/common/document/Hierarchy.java index 621857f21..6afc4b775 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/document/Hierarchy.java +++ b/services/common/src/main/java/org/collectionspace/services/common/document/Hierarchy.java @@ -27,7 +27,7 @@ package org.collectionspace.services.common.document; import org.collectionspace.services.client.IRelationsManager; import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; -import org.collectionspace.services.common.XmlTools; +import org.collectionspace.services.client.XmlTools; import org.collectionspace.services.common.api.Tools; import org.collectionspace.services.common.context.ServiceContext; import org.collectionspace.services.common.relation.RelationResource; @@ -36,6 +36,7 @@ import org.collectionspace.services.relation.RelationsDocListItem; import org.collectionspace.services.relation.RelationshipType; import javax.ws.rs.core.MultivaluedMap; + import java.util.List; /** diff --git a/services/common/src/main/java/org/collectionspace/services/common/security/SecurityInterceptor.java b/services/common/src/main/java/org/collectionspace/services/common/security/SecurityInterceptor.java index 60f3d23b8..421eccb9c 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/security/SecurityInterceptor.java +++ b/services/common/src/main/java/org/collectionspace/services/common/security/SecurityInterceptor.java @@ -80,6 +80,7 @@ public class SecurityInterceptor implements PreProcessInterceptor, PostProcessIn /** The Constant logger. */ private static final Logger logger = LoggerFactory.getLogger(SecurityInterceptor.class); private static final String ACCOUNT_PERMISSIONS = "accounts/*/accountperms"; + private static final String NUXEO_ADMIN = null; // // Use this thread specific member instance to hold our login context with Nuxeo // @@ -88,7 +89,7 @@ public class SecurityInterceptor implements PreProcessInterceptor, PostProcessIn // // Error messages // - private static final String ERROR_NUXEO_LOGOUT = "Attempt to logout when Nuxeo login context was null"; + private static final String ERROR_NUXEO_LOGOUT = "Attempt to logout when Nuxeo login context was null."; private static final String ERROR_UNBALANCED_LOGINS = "The number of Logins vs Logouts to the Nuxeo framework was unbalanced."; private boolean isAnonymousRequest(HttpRequest request, ResourceMethodInvoker resourceMethodInvoker) { @@ -285,7 +286,7 @@ public class SecurityInterceptor implements PreProcessInterceptor, PostProcessIn public ServerResponse nuxeoPreProcess(HttpRequest request, ResourceMethodInvoker resourceMethodInvoker) throws Failure, CSWebApplicationException { try { - nuxeoLogin(); + nuxeoLogin(NUXEO_ADMIN); } catch (LoginException e) { String msg = "Unable to login to the Nuxeo framework"; logger.error(msg, e); @@ -305,13 +306,6 @@ public class SecurityInterceptor implements PreProcessInterceptor, PostProcessIn logger.error(msg, e); } } - - private synchronized void nuxeoLogin() throws LoginException { - // - // Login as the Nuxeo system/admin user - // - nuxeoLogin(null); - } private void logLoginContext(LoginContext loginContext) { logger.trace("CollectionSpace services now logged in to Nuxeo with LoginContext: " @@ -324,6 +318,22 @@ public class SecurityInterceptor implements PreProcessInterceptor, PostProcessIn } } + private void logLogoutContext(LoginContext loginContext) { + if (loginContext != null) { + logger.trace("CollectionSpace services now logging out of Nuxeo with LoginContext: " + + loginContext); + Subject subject = loginContext.getSubject(); + Set principals = subject.getPrincipals(); + logger.debug("Nuxeo logout performed with principals: "); + for (Principal principal : principals) { + logger.debug("[" + principal.getName() + "]"); + } + } else { + logger.trace("Logged out."); + } + } + + /* * Login to Nuxeo and save the LoginContext instance in a thread local variable */ @@ -334,10 +344,8 @@ public class SecurityInterceptor implements PreProcessInterceptor, PostProcessIn if (threadLocalLoginContext == null) { threadLocalLoginContext = new ThreadLocal(); if (logger.isTraceEnabled() == true) { - logger.trace("Created ThreadLocal instance: " - + threadLocalLoginContext.getClass().getCanonicalName() - + " - " - + threadLocalLoginContext.get()); + logger.trace(String.format("Thread ID %s: Created new ThreadLocal instance: %s)", + Thread.currentThread(), threadLocalLoginContext)); } } @@ -348,10 +356,8 @@ public class SecurityInterceptor implements PreProcessInterceptor, PostProcessIn frameworkLogins++; threadLocalLoginContext.set(loginContext); if (logger.isTraceEnabled() == true) { - logger.trace("Setting ThreadLocal instance: " - + threadLocalLoginContext.getClass().getCanonicalName() - + " - " - + threadLocalLoginContext.get()); + logger.trace(String.format("Thread ID %s: Logged in with ThreadLocal instance %s - %s ", + Thread.currentThread(), threadLocalLoginContext, threadLocalLoginContext.get())); } // // Debug message @@ -359,19 +365,42 @@ public class SecurityInterceptor implements PreProcessInterceptor, PostProcessIn if (logger.isDebugEnabled() == true) { logLoginContext(loginContext); } + } else { + // + // We're already logged in somehow? This is probably not good. It seems to mean that the LoginContext last + // used on this thread is still active -which is a *potential* security vulnerability. However, as of 4/2016, we + // use the Nuxeo default "system admin" context for ever request, regardless of the CollectionSpace user making + // the request. In short, there's no real security vulnerability here -just bad bookkeeping of logins. + // + logger.warn(String.format(String.format("Thread ID %s: Alreadyed logged in with ThreadLocal instance %s - %s ", + Thread.currentThread(), threadLocalLoginContext, threadLocalLoginContext.get()))); + frameworkLogins++; } } - public synchronized void nuxeoLogout() throws LoginException { + private synchronized void nuxeoLogout() throws LoginException { LoginContext loginContext = threadLocalLoginContext != null ? threadLocalLoginContext.get() : null; if (loginContext != null) { + if (logger.isDebugEnabled() == true) { + logLogoutContext(loginContext); + } loginContext.logout(); + threadLocalLoginContext.set(null); // We need to clear the login context from this thread, so the next request on this thread has to login again. + logLogoutContext(null); frameworkLogins--; - + if (logger.isDebugEnabled()) { + String.format("Framework logins: ", frameworkLogins); + } } else { logger.warn(ERROR_NUXEO_LOGOUT); } - threadLocalLoginContext = null; //Clear the ThreadLocal to void Tomcat warnings associated with thread pools. + if (frameworkLogins == 0) { + if (threadLocalLoginContext != null) { + logger.trace(String.format("Thread ID %s: Clearing ThreadLocal instance %s - %s ", + Thread.currentThread(), threadLocalLoginContext, threadLocalLoginContext.get())); + } + threadLocalLoginContext = null; //Clear the ThreadLocal to void Tomcat warnings associated with thread pools. + } } } diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoDocumentModelHandler.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoDocumentModelHandler.java index 4b2c25439..97256338e 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoDocumentModelHandler.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoDocumentModelHandler.java @@ -38,9 +38,9 @@ import org.collectionspace.services.client.IRelationsManager; import org.collectionspace.services.client.PoxPayload; import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; +import org.collectionspace.services.client.XmlTools; import org.collectionspace.services.client.workflow.WorkflowClient; import org.collectionspace.services.common.ReflectionMapper; -import org.collectionspace.services.common.XmlTools; import org.collectionspace.services.common.api.GregorianCalendarDateTimeUtils; import org.collectionspace.services.common.api.Tools; import org.collectionspace.services.common.config.ServiceConfigUtils; diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryClientImpl.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryClientImpl.java index 931446ec9..305807e38 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryClientImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryClientImpl.java @@ -1885,16 +1885,16 @@ public class RepositoryClientImpl implements RepositoryClient items = list.getListItem(); - int nItemsReturned = items.size(); - // There will be 'nItemsToCreateInList' - // items created by the createItemList test, - // all associated with the same parent resource. - int nExpectedItems = nItemsToCreateInList; - if (logger.isDebugEnabled()) { - logger.debug(testName + ": Expected " + nExpectedItems - + " items; got: " + nItemsReturned); - } - Assert.assertEquals(nItemsReturned, nExpectedItems); - - for (AbstractCommonList.ListItem item : items) { - String value = AbstractCommonListUtils.ListItemGetElementValue( - item, LocationJAXBSchema.REF_NAME); - Assert.assertTrue((null != value), "Item refName is null!"); - value = AbstractCommonListUtils.ListItemGetElementValue(item, - LocationJAXBSchema.TERM_DISPLAY_NAME); - Assert.assertTrue((null != value), "Item termDisplayName is null!"); - } - if (logger.isTraceEnabled()) { - AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, - testName); - } - } - @Override public void delete(String testName) throws Exception { // Do nothing. See localDelete(). This ensure proper test order. diff --git a/services/material/client/src/test/java/org/collectionspace/services/client/test/MaterialAuthorityServiceTest.java b/services/material/client/src/test/java/org/collectionspace/services/client/test/MaterialAuthorityServiceTest.java index 4ceb52ec3..82ef25cfe 100644 --- a/services/material/client/src/test/java/org/collectionspace/services/client/test/MaterialAuthorityServiceTest.java +++ b/services/material/client/src/test/java/org/collectionspace/services/client/test/MaterialAuthorityServiceTest.java @@ -208,85 +208,6 @@ public class MaterialAuthorityServiceTest extends AbstractAuthorityServiceTest items = list.getListItem(); - int nItemsReturned = items.size(); - // There will be 'nItemsToCreateInList' - // items created by the createItemList test, - // all associated with the same parent resource. - int nExpectedItems = nItemsToCreateInList; - if (logger.isDebugEnabled()) { - logger.debug(testName + ": Expected " + nExpectedItems - + " items; got: " + nItemsReturned); - } - Assert.assertEquals(nItemsReturned, nExpectedItems); - - for (AbstractCommonList.ListItem item : items) { - String value = AbstractCommonListUtils.ListItemGetElementValue( - item, MaterialJAXBSchema.REF_NAME); - Assert.assertTrue((null != value), "Item refName is null!"); - value = AbstractCommonListUtils.ListItemGetElementValue(item, - MaterialJAXBSchema.MATERIAL_TERM_DISPLAY_NAME); - Assert.assertTrue((null != value), "Item termDisplayName is null!"); - } - if (logger.isTraceEnabled()) { - AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, - testName); - } - } - @Override public void delete(String testName) throws Exception { // Do nothing. See localDelete(). This ensure proper test order. diff --git a/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityAuthRefsTest.java b/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityAuthRefsTest.java index 434bf65f8..d6f06905b 100644 --- a/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityAuthRefsTest.java +++ b/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityAuthRefsTest.java @@ -233,13 +233,13 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest items = list.getListItem(); - int nItemsReturned = items.size(); - // There will be 'nItemsToCreateInList' - // items created by the createItemList test, - // all associated with the same parent resource. - int nExpectedItems = nItemsToCreateInList; - if (logger.isDebugEnabled()) { - logger.debug(testName + ": Expected " - + nExpectedItems + " items; got: " + nItemsReturned); - } - Assert.assertEquals(nItemsReturned, nExpectedItems); - - for (AbstractCommonList.ListItem item : items) { - String value = - AbstractCommonListUtils.ListItemGetElementValue(item, AuthorityItemJAXBSchema.REF_NAME); - Assert.assertTrue((null != value), "Item refName is null!"); - - // Per CSPACE-5132, lists items still return a field named displayName, - // not termDisplayName, for backward compatibility. - // (The format of list items will change significantly in CSPACE-5134.) - value = - AbstractCommonListUtils.ListItemGetElementValue(item, AuthorityItemJAXBSchema.TERM_DISPLAY_NAME); - Assert.assertTrue((null != value), "Item termDisplayName is null!"); - } - if (logger.isTraceEnabled()) { - AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName); - } - } - /** * Read contact list. */ diff --git a/services/place/client/src/test/java/org/collectionspace/services/client/test/PlaceAuthorityServiceTest.java b/services/place/client/src/test/java/org/collectionspace/services/client/test/PlaceAuthorityServiceTest.java index c7d66a88b..a9f59e87f 100644 --- a/services/place/client/src/test/java/org/collectionspace/services/client/test/PlaceAuthorityServiceTest.java +++ b/services/place/client/src/test/java/org/collectionspace/services/client/test/PlaceAuthorityServiceTest.java @@ -216,85 +216,6 @@ public class PlaceAuthorityServiceTest extends AbstractAuthorityServiceTest items = list.getListItem(); - int nItemsReturned = items.size(); - // There will be 'nItemsToCreateInList' - // items created by the createItemList test, - // all associated with the same parent resource. - int nExpectedItems = nItemsToCreateInList; - if (logger.isDebugEnabled()) { - logger.debug(testName + ": Expected " + nExpectedItems - + " items; got: " + nItemsReturned); - } - Assert.assertEquals(nItemsReturned, nExpectedItems); - - for (AbstractCommonList.ListItem item : items) { - String value = AbstractCommonListUtils.ListItemGetElementValue( - item, PlaceJAXBSchema.REF_NAME); - Assert.assertTrue((null != value), "Item refName is null!"); - value = AbstractCommonListUtils.ListItemGetElementValue(item, - PlaceJAXBSchema.TERM_DISPLAY_NAME); - Assert.assertTrue((null != value), "Item termDisplayName is null!"); - } - if (logger.isTraceEnabled()) { - AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, - testName); - } - } - @Override public void delete(String testName) throws Exception { // Do nothing. See localDelete(). This ensure proper test order. diff --git a/services/taxonomy/client/src/test/java/org/collectionspace/services/client/test/TaxonomyAuthorityServiceTest.java b/services/taxonomy/client/src/test/java/org/collectionspace/services/client/test/TaxonomyAuthorityServiceTest.java index ce5dd3616..e9ec75758 100644 --- a/services/taxonomy/client/src/test/java/org/collectionspace/services/client/test/TaxonomyAuthorityServiceTest.java +++ b/services/taxonomy/client/src/test/java/org/collectionspace/services/client/test/TaxonomyAuthorityServiceTest.java @@ -248,88 +248,6 @@ public class TaxonomyAuthorityServiceTest extends AbstractAuthorityServiceTest items = list.getListItem(); - int nItemsReturned = items.size(); - // There will be 'nItemsToCreateInList' - // items created by the createItemList test, - // all associated with the same parent resource. - int nExpectedItems = nItemsToCreateInList; - if (logger.isDebugEnabled()) { - logger.debug(testName + ": Expected " + nExpectedItems - + " items; got: " + nItemsReturned); - } - Assert.assertEquals(nItemsReturned, nExpectedItems); - - for (AbstractCommonList.ListItem item : items) { - String value = AbstractCommonListUtils.ListItemGetElementValue( - item, WorkJAXBSchema.REF_NAME); - Assert.assertTrue((null != value), "Item refName is null!"); - value = AbstractCommonListUtils.ListItemGetElementValue(item, - WorkJAXBSchema.WORK_TERM_DISPLAY_NAME); - Assert.assertTrue((null != value), "Item termDisplayName is null!"); - } - if (logger.isTraceEnabled()) { - AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, - testName); - } - } - @Override public void delete(String testName) throws Exception { // Do nothing. See localDelete(). This ensure proper test order.