]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-6937-A: Getting all tests passing again.
authorremillet <remillet@yahoo.com>
Fri, 29 Apr 2016 07:18:30 +0000 (00:18 -0700)
committerremillet <remillet@yahoo.com>
Fri, 29 Apr 2016 07:18:30 +0000 (00:18 -0700)
26 files changed:
services/IntegrationTests/src/main/java/org/collectionspace/services/IntegrationTests/xmlreplay/XmlReplayReport.java
services/JaxRsServiceProvider/src/main/resources/log4j.properties
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityDocumentModelHandler.java
services/citation/client/src/test/java/org/collectionspace/services/client/test/CitationAuthorityServiceTest.java
services/client/src/main/java/org/collectionspace/services/client/AuthorityClient.java
services/client/src/main/java/org/collectionspace/services/client/XmlTools.java [moved from services/common/src/main/java/org/collectionspace/services/common/XmlTools.java with 99% similarity]
services/client/src/main/java/org/collectionspace/services/client/test/AbstractAuthorityServiceTest.java
services/client/src/main/java/org/collectionspace/services/client/test/BaseServiceTest.java
services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java
services/common/src/main/java/org/collectionspace/services/common/document/Hierarchy.java
services/common/src/main/java/org/collectionspace/services/common/security/SecurityInterceptor.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoDocumentModelHandler.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryClientImpl.java
services/common/src/main/java/org/collectionspace/services/nuxeo/util/ReindexFulltextRoot.java
services/concept/client/src/test/java/org/collectionspace/services/client/test/ConceptAuthorityServiceTest.java
services/id/service/src/main/java/org/collectionspace/services/id/IDResource.java
services/imports/service/src/main/java/org/collectionspace/services/imports/TemplateExpander.java
services/location/client/src/test/java/org/collectionspace/services/client/test/LocationAuthorityServiceTest.java
services/material/client/src/test/java/org/collectionspace/services/client/test/MaterialAuthorityServiceTest.java
services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityAuthRefsTest.java
services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthorityServiceTest.java
services/place/client/src/test/java/org/collectionspace/services/client/test/PlaceAuthorityServiceTest.java
services/taxonomy/client/src/test/java/org/collectionspace/services/client/test/TaxonomyAuthorityServiceTest.java
services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java
services/work/client/src/test/java/org/collectionspace/services/client/test/WorkAuthorityServiceTest.java

index 6bbdb80ff67f5178accfa679eb08118313fa5431..6d13151892a96dfaadd044b50990442f5ff57ffa 100644 (file)
@@ -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;
index ccbc095805aca82c25d7ac614770ea098e25e948..89b5901f4d90cfc5a8d9a98ca60109c7cd4723f9 100644 (file)
@@ -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
index 9ed8ab2648cf977624730cfc00fc924e0b8c1a20..6d99b8d32220a08a88bdca0641aabb653e55e375 100644 (file)
@@ -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;
index 58af1e5a5a36857094eb3da325c0f6f99f928aef..d7ee444e4af75e3314f95e2e9520d3e9a4d09e9e 100644 (file)
@@ -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;
index 656dde42436bc2971c5a903d06425edcb120a0cb..fff2b2d12567d0c9a2e3ed9ef45f3f0b5588e701 100644 (file)
@@ -144,24 +144,6 @@ public class CitationAuthorityServiceTest extends AbstractAuthorityServiceTest<C
         return newID;
     }
 
-    /**
-     * Read item list.
-     */
-    @Test(dataProvider = "testName", groups = {"readList"},
-            dependsOnMethods = {"readList"})
-    public void readItemList(String testName) {
-        readItemList(knownAuthorityWithItems, null);
-    }
-
-    /**
-     * Read item list by authority name.
-     */
-    @Test(dataProvider = "testName", groups = {"readList"},
-            dependsOnMethods = {"readItemList"})
-    public void readItemListByAuthorityName(String testName) {
-        readItemList(null, READITEMS_SHORT_IDENTIFIER);
-    }
-
     /**
      * Read item list.
      *
index 9ae1208c4d5b1f04b1d03fec85608a1d39418281..34121443020562077ea93f40d9aa05da029be8c3 100644 (file)
@@ -18,6 +18,10 @@ public interface AuthorityClient<AUTHORITY_ITEM_TYPE, P extends AuthorityProxy>
 
     /** 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
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 d344243fa7f7c28e266c2a08c67cf0cd97be0cc1..11579ca609edce4211b581457405c459356227ad 100644 (file)
@@ -1,4 +1,4 @@
-package org.collectionspace.services.common;
+package org.collectionspace.services.client;
 
 import java.io.Closeable;
 import java.io.File;
index 83bb131b4d25615f90e5a44e0fb0c36f99da06e3..5c2cb9e9e5038b0d16524c1881d88764b54936be 100644 (file)
@@ -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<AUTHORITY_COMMON_TYPE, AUTHOR
     protected String knownResourceShortIdentifer = null;
        protected static final String READITEMS_SHORT_IDENTIFIER = "resourceWithItems" + random.nextInt(1000); 
        protected String knownAuthorityWithItems = null;
+       protected String knownAuthorityWithItemsIdentifier = null;
        
        protected static final String SAS_IDENTIFIER = "SAS"; 
        protected String knownSASAuthorityResourceId = null;
@@ -290,7 +295,7 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
             }
         }
     }
-    
+        
     /**
      * Sync the local with the SAS
      */
@@ -401,10 +406,27 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
                dependsOnMethods = {"createItem"})
     public void createItemList(String testName) throws Exception {
        knownAuthorityWithItems = createResource(testName, READITEMS_SHORT_IDENTIFIER);
+       knownAuthorityWithItemsIdentifier = getShortId(knownAuthorityWithItems);
         for (int j = 0; j < nItemsToCreateInList; j++) {
                createItemInAuthority((AuthorityClient) getClientInstance(), knownAuthorityWithItems, this.getTestAuthorityItemShortId(true));
         }
     }
+    
+    private String getShortId(String authorityCsid) throws Exception {
+       String result = null;
+       
+        // Submit the request to the service and store the response.
+        AuthorityClient client = (AuthorityClient) getClientInstance();
+        Response res = client.read(authorityCsid);
+        try {
+               int statusCode = res.getStatus();
+               result = this.extractAuthorityShortId(res);
+        } finally {
+               res.close();
+        }
+        
+        return result;
+    }
 
     /**
      * Read by name.
@@ -460,6 +482,24 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
                
                return result;
        }
+       
+    /**
+     * Extracts the short ID from a service request payload
+     * 
+     * @param res
+     * @return
+     * @throws Exception
+     */
+       public String extractAuthorityShortId(Response res) throws Exception {
+               String result = null;
+               
+        PoxPayloadIn input = new PoxPayloadIn((String)res.readEntity(getEntityResponseType()));                
+               Document document = input.getDOMDocument();
+               result = XmlTools.getElementValue(document, "//" + AuthorityClient.SHORT_IDENTIFIER);
+
+               return result;
+       }
+       
     
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
                dependsOnMethods = {"readItem"})
@@ -580,6 +620,18 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
                }
                Assert.assertEquals(nItemsTotal, nItemsToCreateInList);
        
+                       for (AbstractCommonList.ListItem item : items) {
+                               String refName = AbstractCommonListUtils.ListItemGetElementValue(
+                                               item, AuthorityClient.REF_NAME);
+                               Assert.assertTrue((refName != null), "Item refName is null or not set in the item list!");
+                               String termDisplayName = AbstractCommonListUtils.ListItemGetElementValue(item,
+                                               AuthorityClient.TERM_DISPLAY_NAME);
+                               String vocabDisplayName = AbstractCommonListUtils.ListItemGetElementValue(item,
+                                               AuthorityClient.VOCAB_DISPLAY_NAME);
+                               // One of these names needs to be set.
+                               Assert.assertTrue(!(termDisplayName == null && vocabDisplayName == null), "The item's display name is null or not set in the item list!");
+                       }
+               
                if(logger.isTraceEnabled()){
                        AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
                }
@@ -588,16 +640,14 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
         }
     }
     
-    @Test(dataProvider = "testName",
-               dependsOnMethods = {"createItemList"})
+    @Test(dataProvider = "testName", dependsOnMethods = {"createItemList"})
     public void readItemList(String testName) {
         readItemListInt(knownAuthorityWithItems, null, testName);
     }
 
-    @Test(dataProvider = "testName",
-               dependsOnMethods = {"readItem"})
+    @Test(dataProvider = "testName", dependsOnMethods = {"readItemList"})
     public void readItemListByName(String testName) {
-        readItemListInt(null, READITEMS_SHORT_IDENTIFIER, testName);
+        readItemListInt(null, knownAuthorityWithItemsIdentifier, testName);
     }
 
     @Test(dataProvider = "testName",
index 0cab25e4540512c288797826b2a053dd199676e9..e6217c1f6eb6d7653bdfc93172d64043c73081ec 100644 (file)
@@ -60,7 +60,9 @@ import org.w3c.dom.Document;
 import org.collectionspace.services.client.AuthorityClient;
 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.TestServiceClient;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.common.api.FileTools;
@@ -487,18 +489,32 @@ public abstract class BaseServiceTest<CLT> {
      * @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.
index 9d59d4f576d17f276cc960f82028d1d1152683c1..ed70792398abc9bbadf55483f7e0ef93feb0ccee 100644 (file)
@@ -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;
index 621857f21ef0b6b9b0c6dca37273844059ded584..6afc4b775df716c249c00e008db2f25ac9b835c9 100644 (file)
@@ -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;
 
 /**
index 60f3d23b89a2d6931161c46ac4ba475b75caa56c..421eccb9c78dd13f30b6555bcae038253632ad83 100644 (file)
@@ -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<Principal> 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<LoginContext>();
                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.
+        }
     }  
 }
index 4b2c25439a0c1ff13375857634d961c559aadb67..97256338e5909cca5d98f733a402133ac64b3fc3 100644 (file)
@@ -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;
index 931446ec91521571a1e0c6396ad6c839d55f3dd1..305807e38fc53ff78a068f277ad210ca8c0e2317 100644 (file)
@@ -1885,16 +1885,16 @@ public class RepositoryClientImpl implements RepositoryClient<PoxPayloadIn, PoxP
             logger.error(errMsg);
             throw new Exception(errMsg);
         }
-        //
-        // If we couldn't find a repoSession from the service context (or the context was null) then we need to create a new one using
-        // just the repo name
-        //
         if (repoSession == null) {
+            //
+            // If we couldn't find a repoSession from the service context (or the context was null) then we need to create a new one using
+            // just the repository name.
+            //
             NuxeoClientEmbedded client = NuxeoConnectorEmbedded.getInstance().getClient();
             repoSession = client.openRepository(repoName, timeoutSeconds);
         } else {
-            if (logger.isDebugEnabled() == true) {
-                logger.warn("Reusing the current context's repository session.");
+            if (logger.isTraceEnabled() == true) {
+                logger.trace("Reusing the current context's repository session.");
             }
         }
 
index 90dc86e27cb445ae500596c13b9c1f2a67af5375..67665c6f76454901658f7f2a72a44a8ee64003b3 100644 (file)
@@ -152,6 +152,9 @@ public class ReindexFulltextRoot {
             log("Reindexing limited to batch: %s", batch + 1);
         }
 
+        //
+        // Commit and close the transaction that was started by our standard request lifecycle.
+        //
         boolean tx = TransactionHelper.isTransactionActive();
         if (tx) {
             TransactionHelper.commitOrRollbackTransaction();
@@ -181,6 +184,9 @@ public class ReindexFulltextRoot {
         }
 
         log("Reindexing done");
+        //
+        // Start a new transaction so our standard request lifecycle can complete.
+        //
         if (tx) {
             TransactionHelper.startTransaction();
         }
index a19d6546a2efe129e9b36b51d7c07848af50f13a..4ff6d67b7c7e9e2c1306f9485956e7108d475b81 100644 (file)
@@ -146,25 +146,7 @@ public class ConceptAuthorityServiceTest extends AbstractAuthorityServiceTest<Co
 
         return newID;
     }
-    
-    /**
-     * Read item list.
-     */
-    @Test(dataProvider = "testName", groups = {"readList"},
-               dependsOnMethods = {"readList"})
-    public void readItemList(String testName) {
-        readItemList(knownAuthorityWithItems, null);
-    }
-
-    /**
-     * Read item list by authority name.
-     */
-    @Test(dataProvider = "testName", groups = {"readList"},
-               dependsOnMethods = {"readItemList"})
-    public void readItemListByAuthorityName(String testName) {
-        readItemList(null, READITEMS_SHORT_IDENTIFIER);
-    }
-    
+        
     /**
      * Read item list.
      *
index dd3e9987fc5d80194269248ec45d374dbd6fbb40..40098deca9fc5fd090506cc17cabb33a53287342 100644 (file)
@@ -24,6 +24,7 @@ package org.collectionspace.services.id;
 
 import java.util.Map;
 import java.util.UUID;
+
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -39,22 +40,20 @@ import javax.ws.rs.core.UriBuilder;
 
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
+import org.collectionspace.services.client.XmlTools;
 import org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl;
 // May at some point instead use
 // org.jboss.resteasy.spi.NotFoundException
-import org.collectionspace.services.common.XmlTools;
 import org.collectionspace.services.common.document.BadRequestException;
 import org.collectionspace.services.common.document.DocumentNotFoundException;
 import org.collectionspace.services.common.context.MultipartServiceContextFactory;
 import org.collectionspace.services.common.context.ServiceContext;
 import org.collectionspace.services.common.context.ServiceContextFactory;
 import org.collectionspace.services.client.IdClient;
-
 import org.dom4j.Document;
 import org.dom4j.DocumentHelper;
 import org.dom4j.Element;
 import org.dom4j.Namespace;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
index 223cab2077b14bbe894df8fff083f557e5f4fc9c..91d02327aaa2481a486b96cd548dfcaeb8a1f5f7 100644 (file)
@@ -27,9 +27,12 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.UUID;
+
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
+
+import org.collectionspace.services.client.XmlTools;
 import org.collectionspace.services.common.IFragmentHandler;
 import org.collectionspace.services.common.ServiceMain;
 import org.collectionspace.services.common.StoredValuesUriTemplate;
@@ -37,7 +40,6 @@ import org.collectionspace.services.common.UriTemplateFactory;
 import org.collectionspace.services.common.UriTemplateRegistry;
 import org.collectionspace.services.common.UriTemplateRegistryKey;
 import org.collectionspace.services.common.XmlSaxFragmenter;
-import org.collectionspace.services.common.XmlTools;
 import org.collectionspace.services.common.api.FileTools;
 import org.collectionspace.services.common.api.GregorianCalendarDateTimeUtils;
 import org.collectionspace.services.common.api.RefName;
index 03df14293cf982f8a2dfbd4757dd51a569ebfb66..506ecc0a390e66ed5c30a5b0d7751a4e0c81cbf0 100644 (file)
@@ -221,86 +221,7 @@ public class LocationAuthorityServiceTest extends AbstractAuthorityServiceTest<L
             }
         }
     }
-
-    /**
-     * Read item list.
-     */
-    @Test(dataProvider = "testName", groups = {"readList"},
-               dependsOnMethods = {"readList"})
-    public void readItemList(String testName) {
-        readItemList(knownAuthorityWithItems, null);
-    }
-
-    /**
-     * Read item list by authority name.
-     */
-    @Test(dataProvider = "testName", groups = {"readList"},
-               dependsOnMethods = {"readItemList"})
-    public void readItemListByAuthorityName(String testName) {
-        readItemList(null, READITEMS_SHORT_IDENTIFIER);
-    }
     
-       /**
-        * Read item list.
-        * 
-        * @param vcsid
-        *            the vcsid
-        * @param name
-        *            the name
-        */
-       private void readItemList(String vcsid, String shortId) {
-               String testName = "readItemList";
-
-               // Perform setup.
-               setupReadList();
-
-               // Submit the request to the service and store the response.
-               LocationAuthorityClient client = new LocationAuthorityClient();
-               Response res = null;
-               if (vcsid != null) {
-                       res = client.readItemList(vcsid, null, null);
-               } else if (shortId != null) {
-                       res = client.readItemListForNamedAuthority(shortId, null, null);
-               } else {
-                       Assert.fail("readItemList passed null csid and name!");
-               }
-               
-               AbstractCommonList list = null;
-               try {
-                       assertStatusCode(res, testName);
-                       list = res.readEntity(AbstractCommonList.class);
-               } finally {
-                       if (res != null) {
-                res.close();
-            }
-               }
-               
-               List<AbstractCommonList.ListItem> 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.
index 4ceb52ec338b0afd777300d14ca4aaadf07551f7..82ef25cfe065b6b134c650505d95ec21e9e34b9d 100644 (file)
@@ -208,85 +208,6 @@ public class MaterialAuthorityServiceTest extends AbstractAuthorityServiceTest<M
                }
        }
 
-    /**
-     * Read item list.
-     */
-    @Test(dataProvider = "testName", groups = {"readList"},
-               dependsOnMethods = {"readList"})
-    public void readItemList(String testName) {
-        readItemList(knownAuthorityWithItems, null);
-    }
-
-    /**
-     * Read item list by authority name.
-     */
-    @Test(dataProvider = "testName", groups = {"readList"},
-            dependsOnMethods = {"readItemList"})
-    public void readItemListByAuthorityName(String testName) {
-        readItemList(null, READITEMS_SHORT_IDENTIFIER);
-    }
-    
-    /**
-     * Read item list.
-     * 
-     * @param vcsid
-     *            the vcsid
-     * @param name
-     *            the name
-     */
-    private void readItemList(String vcsid, String shortId) {
-        String testName = "readItemList";
-
-        // Perform setup.
-        setupReadList();
-
-        // Submit the request to the service and store the response.
-        MaterialAuthorityClient client = new MaterialAuthorityClient();
-        Response res = null;
-        if (vcsid != null) {
-            res = client.readItemList(vcsid, null, null);
-        } else if (shortId != null) {
-            res = client.readItemListForNamedAuthority(shortId, null, null);
-        } else {
-            Assert.fail("readItemList passed null csid and name!");
-        }
-        
-        AbstractCommonList list = null;
-        try {
-            assertStatusCode(res, testName);
-            list = res.readEntity(AbstractCommonList.class);
-        } finally {
-            if (res != null) {
-                res.close();
-            }
-        }
-        
-        List<AbstractCommonList.ListItem> 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.
index 434bf65f8b4582f9da81c0dfac286f93c91a30bd..d6f06905b98d62f8f560ce68887b04a2619d651f 100644 (file)
@@ -233,13 +233,13 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest<AbstractCommonList
         
         // Create temporary Person resources, and their corresponding refNames
         // by which they can be identified.
-               String csid = createPerson(personAuthCSID, "Charlie", "Orgcontact", "charlieOrgcontact", null ); // authRefName);
+               String csid = createPerson(personAuthCSID, "Charlie", "Orgcontact", "charlieOrgcontact" + System.currentTimeMillis(), null ); // authRefName);
         personIdsCreated.add(csid);
         organizationContactPersonRefName1 = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
 
         // Create temporary Person resources, and their corresponding refNames
         // by which they can be identified.
-               csid = createPerson(personAuthCSID, "Chelsie", "Contact", "chelsieContact", null ); // authRefName);
+               csid = createPerson(personAuthCSID, "Chelsie", "Contact", "chelsieContact" + System.currentTimeMillis(), null ); // authRefName);
         personIdsCreated.add(csid);
         organizationContactPersonRefName2 = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
     }
@@ -380,27 +380,17 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest<AbstractCommonList
     @AfterClass(alwaysRun=true)
     public void cleanUp() {
         String noTest = System.getProperty("noTestCleanup");
-       if(Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
+       if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
             if (logger.isDebugEnabled()) {
                 logger.debug("Skipping Cleanup phase ...");
             }
             return;
        }
+       
         if (logger.isDebugEnabled()) {
             logger.debug("Cleaning up temporary resources created for testing ...");
         }
-        PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
-        // Delete Person resource(s) (before PersonAuthority resources).
-        for (String resourceId : personIdsCreated) {
-            // Note: Any non-success responses are ignored and not reported.
-            personAuthClient.deleteItem(personAuthCSID, resourceId).close();
-        }
-        // Delete PersonAuthority resource(s).
-        // Note: Any non-success response is ignored and not reported.
-        if(personAuthCSID!=null) {
-               personAuthClient.delete(personAuthCSID).close();
-        }
-        
+                
         String parentResourceId;
         String itemResourceId;
         OrgAuthorityClient client = new OrgAuthorityClient();
@@ -413,6 +403,24 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest<AbstractCommonList
             client.deleteItem(parentResourceId, itemResourceId).close();
         }
         
+        //
+        // Delete the person authority items we created for the authRefs.  Note
+        // that we needed to delete the objects/records referencing these authority items first since
+        // we can't delete authority items that still have records referencing them
+        //
+        PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+        // Delete Person resource(s) (before PersonAuthority resources).
+        for (String resourceId : personIdsCreated) {
+            // Note: Any non-success responses are ignored and not reported.
+            personAuthClient.deleteItem(personAuthCSID, resourceId).close();
+        }
+        
+        // Delete PersonAuthority resource(s).
+        // Note: Any non-success response is ignored and not reported.
+        if (personAuthCSID != null) {
+               personAuthClient.delete(personAuthCSID).close();
+        }        
+        
         // Clean up parent resources.
         for (String resourceId : allResourceIdsCreated) {
             // Note: Any non-success responses from the delete operation
index e6f43feb1d99dc83aadfc752612103af95b13e0a..69e59735ae7b9a78a104e428dd8abd30cbdd3f0d 100644 (file)
@@ -43,7 +43,6 @@ import org.collectionspace.services.client.PersonAuthorityClient;
 import org.collectionspace.services.client.PersonAuthorityClientUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.PersonJAXBSchema;
-import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;
 import org.collectionspace.services.person.PersonauthoritiesCommon;
 import org.collectionspace.services.person.PersonTermGroup;
 import org.collectionspace.services.person.PersonTermGroupList;
@@ -161,6 +160,10 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
         PoxPayloadOut multipart =
                 PersonAuthorityClientUtils.createPersonAuthorityInstance(
                 displayName, shortId, client.getCommonPartName());
+        // Extract the short ID since it might have been randomized by the createPersonAuthRefName() method
+        PersonauthoritiesCommon personAuthority = (PersonauthoritiesCommon) extractPart(multipart,
+                client.getCommonPartName(), PersonauthoritiesCommon.class);
+        shortId = personAuthority.getShortIdentifier();
 
         String newID = null;
         Response res = client.create(multipart);
@@ -779,79 +782,6 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
     // CRUD tests : READ_LIST tests
     // ---------------------------------------------------------------
 
-    /**
-     * Read item list override -see immediate superclass.
-     */
-    @Override
-    public void readItemList(String testName) {
-        readItemList(knownAuthorityWithItems, null, testName);
-    }
-
-    /**
-     * Read item list by authority name.
-     */
-    @Override
-    public void readItemListByName(String testName) {
-        readItemList(null, READITEMS_SHORT_IDENTIFIER, testName);
-    }
-
-    /**
-     * Read item list.
-     *
-     * @param vcsid the vcsid
-     * @param name the name
-     */
-    private void readItemList(String vcsid, String name, String testName) {
-        setupReadList();
-        // Submit the request to the service and store the response.
-        PersonAuthorityClient client = new PersonAuthorityClient();
-        Response res = null;
-        if (vcsid != null) {
-            res = client.readItemList(vcsid, null, null);
-        } else if (name != null) {
-            res = client.readItemListForNamedAuthority(name, null, null);
-        } else {
-            Assert.fail("readItemList passed null csid and name!");
-        }
-        AbstractCommonList list = null;
-        try {
-            assertStatusCode(res, testName);
-            list = res.readEntity(AbstractCommonList.class);
-        } finally {
-               if (res != null) {
-                res.close();
-            }
-        }
-
-        List<AbstractCommonList.ListItem> 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.
      */
index c7d66a88ba0bacd5bcec5e1b09c4a8e5a0fcedd4..a9f59e87fe171fb4f9776674b698d048ae2865a4 100644 (file)
@@ -216,85 +216,6 @@ public class PlaceAuthorityServiceTest extends AbstractAuthorityServiceTest<Plac
         }
     }
 
-    /**
-     * Read item list.
-     */
-    @Test(dataProvider = "testName", groups = {"readList"},
-               dependsOnMethods = {"readList"})
-    public void readItemList(String testName) {
-        readItemList(knownAuthorityWithItems, null);
-    }
-
-    /**
-     * Read item list by authority name.
-     */
-    @Test(dataProvider = "testName", groups = {"readList"},
-               dependsOnMethods = {"readItemList"})
-    public void readItemListByAuthorityName(String testName) {
-        readItemList(null, READITEMS_SHORT_IDENTIFIER);
-    }
-    
-       /**
-        * Read item list.
-        * 
-        * @param vcsid
-        *            the vcsid
-        * @param name
-        *            the name
-        */
-       private void readItemList(String vcsid, String shortId) {
-               String testName = "readItemList";
-
-               // Perform setup.
-               setupReadList();
-
-               // Submit the request to the service and store the response.
-               PlaceAuthorityClient client = new PlaceAuthorityClient();
-               Response res = null;
-               if (vcsid != null) {
-                       res = client.readItemList(vcsid, null, null);
-               } else if (shortId != null) {
-                       res = client.readItemListForNamedAuthority(shortId, null, null);
-               } else {
-                       Assert.fail("readItemList passed null csid and name!");
-               }
-               
-               AbstractCommonList list = null;
-               try {
-                       assertStatusCode(res, testName);
-                       list = res.readEntity(AbstractCommonList.class);
-               } finally {
-                       if (res != null) {
-                res.close();
-            }
-               }
-               
-               List<AbstractCommonList.ListItem> 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.
index ce5dd3616f4cd45cf492fd304f6073b44ce60411..e9ec75758192c5896d07c034f8adbb5def0c382e 100644 (file)
@@ -248,88 +248,6 @@ public class TaxonomyAuthorityServiceTest extends AbstractAuthorityServiceTest<T
         }
     }
 
-    /**
-     * Read item list.
-     */
-    @Test(dataProvider = "testName", groups = {"readList"},
-    dependsOnMethods = {"readList"})
-    public void readItemList(String testName) {
-        readItemList(knownAuthorityWithItems, null);
-    }
-
-    /**
-     * Read item list by authority name.
-     */
-    @Test(dataProvider = "testName", groups = {"readList"},
-    dependsOnMethods = {"readItemList"})
-    public void readItemListByAuthorityName(String testName) {
-        readItemList(null, READITEMS_SHORT_IDENTIFIER);
-    }
-
-    /**
-     * Read item list.
-     *
-     * @param vcsid the vcsid
-     * @param name the name
-     */
-    private void readItemList(String vcsid, String shortId) {
-        String testName = "readItemList";
-
-        // Perform setup.
-        setupReadList();
-
-        // Submit the request to the service and store the response.
-        TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
-        Response res = null;
-        if (vcsid != null) {
-            res = client.readItemList(vcsid, null, null);
-        } else if (shortId != null) {
-            res = client.readItemListForNamedAuthority(shortId, null, null);
-        } else {
-            Assert.fail("readItemList passed null csid and name!");
-        }
-        try {
-            assertStatusCode(res, testName);
-            AbstractCommonList list = res.readEntity(AbstractCommonList.class);
-            int statusCode = res.getStatus();
-
-            // Check the status code of the response: does it match
-            // the expected response(s)?
-            if (logger.isDebugEnabled()) {
-                logger.debug(testName + ": status = " + statusCode);
-            }
-            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(testRequestType, statusCode));
-            Assert.assertEquals(statusCode, testExpectedStatusCode);
-
-            List<AbstractCommonList.ListItem> 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, TaxonJAXBSchema.REF_NAME);
-                Assert.assertTrue((null != value), "Item refName is null!");
-                value =
-                        AbstractCommonListUtils.ListItemGetElementValue(item, TaxonJAXBSchema.TERM_DISPLAY_NAME);
-                Assert.assertTrue((null != value), "Item termDisplayName is null!");
-            }
-            if (logger.isTraceEnabled()) {
-                AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
-            }
-        } finally {
-            res.close();
-        }
-    }
-
     @Override
     public void delete(String testName) throws Exception {
         // Do nothing.  See localDelete().  This ensure proper test order.
index 4f2cf164932f39a9ee1d5ec79b43c16983ff230e..eefad4387db1a4699cf8c6862953821c35c1f6ce 100644 (file)
@@ -34,10 +34,10 @@ import org.collectionspace.services.client.VocabularyClient;
 import org.collectionspace.services.client.VocabularyClientUtils;
 import org.collectionspace.services.vocabulary.VocabulariesCommon;
 import org.collectionspace.services.vocabulary.VocabularyitemsCommon;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
+import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
 
 import javax.ws.rs.core.Response;
@@ -117,15 +117,7 @@ public class VocabularyServiceTest extends AbstractAuthorityServiceTest<Vocabula
             }
         }
     }
-    
-    @Override
-    public void createItemList(String testName) throws Exception {
-       knownAuthorityWithItems = createResource(testName, READITEMS_SHORT_IDENTIFIER);
-        for (int j = 0; j < nItemsToCreateInList; j++) {
-               createItemInAuthority((AuthorityClient) getClientInstance(), knownAuthorityWithItems, getTestAuthorityItemShortId(true));
-        }
-    }    
-    
+        
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
                dependsOnMethods = {"CRUDTests"})
     public void createWithNonuniqueShortId(String testName) throws Exception {
@@ -396,4 +388,10 @@ public class VocabularyServiceTest extends AbstractAuthorityServiceTest<Vocabula
                 itemInfo, commonPartName);
                return result;
        }
+       
+    @AfterClass(alwaysRun = true)
+    @Override
+    public void cleanUp() {
+       super.cleanUp();
+    }  
 }
index 1507dfd97fa303414a882bd32cc05c222af7060f..c9644d1a8985d5f672ea929df1d1b60013c8c626 100644 (file)
@@ -222,85 +222,6 @@ public class WorkAuthorityServiceTest extends AbstractAuthorityServiceTest<Worka
                }
        }
 
-    /**
-     * Read item list.
-     */
-    @Test(dataProvider = "testName", groups = {"readList"},
-               dependsOnMethods = {"readList"})
-    public void readItemList(String testName) {
-        readItemList(knownAuthorityWithItems, null);
-    }
-
-    /**
-     * Read item list by authority name.
-     */
-    @Test(dataProvider = "testName", groups = {"readList"},
-            dependsOnMethods = {"readItemList"})
-    public void readItemListByAuthorityName(String testName) {
-        readItemList(null, READITEMS_SHORT_IDENTIFIER);
-    }
-    
-    /**
-     * Read item list.
-     * 
-     * @param vcsid
-     *            the vcsid
-     * @param name
-     *            the name
-     */
-    private void readItemList(String vcsid, String shortId) {
-        String testName = "readItemList";
-
-        // Perform setup.
-        setupReadList();
-
-        // Submit the request to the service and store the response.
-        WorkAuthorityClient client = new WorkAuthorityClient();
-        Response res = null;
-        if (vcsid != null) {
-            res = client.readItemList(vcsid, null, null);
-        } else if (shortId != null) {
-            res = client.readItemListForNamedAuthority(shortId, null, null);
-        } else {
-            Assert.fail("readItemList passed null csid and name!");
-        }
-        
-        AbstractCommonList list = null;
-        try {
-            assertStatusCode(res, testName);
-            list = res.readEntity(AbstractCommonList.class);
-        } finally {
-            if (res != null) {
-                res.close();
-            }
-        }
-        
-        List<AbstractCommonList.ListItem> 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.