]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-1685: Removed thousands AND thousands AND thousands of lines of non-DRY testin...
authorRichard Millet <richard.millet@berkeley.edu>
Sat, 28 Jan 2012 23:32:29 +0000 (23:32 +0000)
committerRichard Millet <richard.millet@berkeley.edu>
Sat, 28 Jan 2012 23:32:29 +0000 (23:32 +0000)
188 files changed:
build.properties
pom.xml
services/IntegrationTests/pom.xml
services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/CollectionSpaceIntegrationTest.java
services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/RelationIntegrationTest.java
services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/XmlReplayDevTest.java
services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/XmlReplaySelfTest.java
services/JaxRsServiceProvider/pom.xml
services/JaxRsServiceProvider/src/main/resources/log4j.properties
services/PerformanceTests/pom.xml
services/PerformanceTests/src/test/java/org/collectionspace/services/PerformanceTests/test/PerformanceTest.java
services/account/client/src/main/java/org/collectionspace/services/client/AccountClient.java
services/account/client/src/main/java/org/collectionspace/services/client/AccountRoleClient.java
services/account/client/src/main/java/org/collectionspace/services/client/AccountRoleProxy.java
services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountRoleServiceTest.java
services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountServiceTest.java
services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountTest.java
services/account/jaxb/pom.xml
services/account/jaxb/src/main/resources/accounts_common.xsd
services/account/service/pom.xml
services/acquisition/client/pom.xml
services/acquisition/client/src/main/java/org/collectionspace/services/client/AcquisitionProxy.java
services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionAuthRefsTest.java
services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionServiceTest.java
services/authorization-mgt/client/pom.xml
services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/PermissionClient.java
services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/PermissionRoleClient.java
services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/RoleClient.java
services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/RolePermissionClient.java
services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/PermissionRoleServiceTest.java
services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/PermissionServiceTest.java
services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/RolePermissionServiceTest.java
services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/RoleServiceTest.java
services/authorization-mgt/import/pom.xml
services/authorization-mgt/service/pom.xml
services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/PermissionResource.java
services/authorization/service/pom.xml
services/batch/client/pom.xml
services/batch/client/src/test/java/org/collectionspace/services/client/test/BatchServiceTest.java
services/batch/service/pom.xml
services/blob/client/pom.xml
services/blob/client/src/test/java/org/collectionspace/services/client/test/BlobAuthRefsTest.java
services/blob/client/src/test/java/org/collectionspace/services/client/test/BlobScaleTest.java [new file with mode: 0644]
services/blob/client/src/test/java/org/collectionspace/services/client/test/BlobServiceTest.java
services/blob/client/src/test/resources/log4j.properties
services/blob/service/pom.xml
services/client/pom.xml
services/client/src/main/java/org/collectionspace/services/client/AbstractCommonListPoxServiceClientImpl.java
services/client/src/main/java/org/collectionspace/services/client/AbstractCommonListUtils.java [moved from services/common/src/main/java/org/collectionspace/services/common/AbstractCommonListUtils.java with 93% similarity]
services/client/src/main/java/org/collectionspace/services/client/AbstractPoxServiceClientImpl.java
services/client/src/main/java/org/collectionspace/services/client/AbstractServiceClientImpl.java
services/client/src/main/java/org/collectionspace/services/client/AuthorityClient.java
services/client/src/main/java/org/collectionspace/services/client/AuthorityClientImpl.java
services/client/src/main/java/org/collectionspace/services/client/AuthorityProxy.java
services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceClient.java
services/client/src/main/java/org/collectionspace/services/client/CollectionSpacePoxClient.java
services/client/src/main/java/org/collectionspace/services/client/CollectionSpacePoxProxy.java
services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceProxy.java
services/client/src/main/java/org/collectionspace/services/client/TestServiceClient.java
services/client/src/main/java/org/collectionspace/services/client/TestServiceProxy.java
services/client/src/main/java/org/collectionspace/services/client/test/AbstractAuthorityServiceTest.java [new file with mode: 0644]
services/client/src/main/java/org/collectionspace/services/client/test/AbstractGenericServiceTestImpl.java [deleted file]
services/client/src/main/java/org/collectionspace/services/client/test/AbstractPoxServiceTestImpl.java [new file with mode: 0644]
services/client/src/main/java/org/collectionspace/services/client/test/AbstractServiceTestImpl.java
services/client/src/main/java/org/collectionspace/services/client/test/BaseServiceTest.java
services/client/src/main/java/org/collectionspace/services/client/test/ServiceRequestType.java
services/client/src/main/java/org/collectionspace/services/client/test/ServiceTest.java
services/client/src/main/java/org/collectionspace/services/client/workflow/WorkflowClient.java
services/client/src/main/java/org/collectionspace/services/client/workflow/WorkflowProxy.java
services/collectionobject/client/pom.xml
services/collectionobject/client/src/main/java/org/collectionspace/services/client/CollectionObjectClient.java
services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectAuthRefsTest.java
services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectSearchTest.java
services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectServiceTest.java
services/collectionobject/service/pom.xml
services/common-api/pom.xml
services/common-test/pom.xml
services/common-test/src/test/java/org/collectionspace/services/client/test/ServiceLayerTest.java
services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto.xml
services/common/src/main/java/org/collectionspace/services/common/imaging/nuxeo/NuxeoImageUtils.java
services/common/src/main/java/org/collectionspace/services/common/profile/Profiler.java
services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaDocumentHandler.java
services/common/src/main/java/org/collectionspace/services/common/workflow/service/nuxeo/WorkflowDocumentModelHandler.java
services/contact/client/pom.xml
services/contact/client/src/main/java/org/collectionspace/services/client/AuthorityWithContactsClient.java
services/contact/client/src/main/java/org/collectionspace/services/client/AuthorityWithContactsClientImpl.java
services/contact/client/src/main/java/org/collectionspace/services/client/ContactClient.java
services/contact/client/src/test/java/org/collectionspace/services/client/test/ContactServiceTest.java
services/contact/service/pom.xml
services/dimension/client/pom.xml
services/dimension/client/src/main/java/org/collectionspace/services/client/DimensionClient.java
services/dimension/client/src/main/java/org/collectionspace/services/client/DimensionProxy.java
services/dimension/client/src/test/java/org/collectionspace/services/client/test/DimensionServiceTest.java
services/dimension/jaxb/pom.xml
services/dimension/jaxb/src/main/resources/dimensions-common.xsd
services/dimension/pom.xml
services/dimension/service/pom.xml
services/group/client/pom.xml
services/group/client/src/main/java/org/collectionspace/services/client/GroupClient.java
services/group/client/src/test/java/org/collectionspace/services/client/test/GroupServiceTest.java
services/group/service/pom.xml
services/hyperjaxb/src/main/resources/AbstractCommonList.xsd [deleted file]
services/hyperjaxb/src/main/resources/permissions_list.xsd
services/id/client/src/main/java/org/collectionspace/services/client/IdClient.java
services/id/client/src/test/java/org/collectionspace/services/client/test/IdServiceTest.java
services/imports/service/pom.xml
services/imports/service/src/main/java/org/collectionspace/services/imports/TemplateExpander.java
services/intake/client/pom.xml
services/intake/client/src/main/java/org/collectionspace/services/client/IntakeClient.java
services/intake/client/src/test/java/org/collectionspace/services/client/test/IntakeAuthRefsTest.java
services/intake/client/src/test/java/org/collectionspace/services/client/test/IntakeServiceTest.java
services/intake/client/src/test/java/org/collectionspace/services/client/test/OrganizationAuthRefDocsTest.java
services/intake/client/src/test/java/org/collectionspace/services/client/test/PersonAuthRefDocsTest.java
services/intake/service/pom.xml
services/loanin/client/pom.xml
services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninAuthRefsTest.java
services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninServiceTest.java
services/loanin/service/pom.xml
services/loanout/client/pom.xml
services/loanout/client/src/main/java/org/collectionspace/services/client/LoanoutClient.java
services/loanout/client/src/test/java/org/collectionspace/services/client/test/LoanoutAuthRefsTest.java
services/loanout/client/src/test/java/org/collectionspace/services/client/test/LoanoutServiceTest.java
services/loanout/service/pom.xml
services/location/client/pom.xml
services/location/client/src/main/java/org/collectionspace/services/client/LocationAuthorityClient.java
services/location/client/src/main/java/org/collectionspace/services/client/LocationAuthorityClientUtils.java
services/location/client/src/test/java/org/collectionspace/services/client/test/LocationAuthorityServiceTest.java
services/location/service/pom.xml
services/media/client/pom.xml
services/media/client/src/test/java/org/collectionspace/services/client/test/MediaAuthRefsTest.java
services/media/client/src/test/java/org/collectionspace/services/client/test/MediaServiceTest.java
services/media/service/pom.xml
services/movement/client/pom.xml
services/movement/client/src/test/java/org/collectionspace/services/client/test/MovementAuthRefsTest.java
services/movement/client/src/test/java/org/collectionspace/services/client/test/MovementServiceTest.java
services/movement/client/src/test/java/org/collectionspace/services/client/test/MovementSortByTest.java
services/movement/service/pom.xml
services/note/3rdparty/nuxeo-platform-cs-note/src/main/resources/META-INF/MANIFEST.MF
services/note/3rdparty/nuxeo-platform-cs-note/src/main/resources/OSGI-INF/life-cycle-contrib.xml [new file with mode: 0644]
services/note/client/pom.xml
services/note/client/src/main/java/org/collectionspace/services/client/NoteClient.java
services/note/client/src/main/java/org/collectionspace/services/client/NoteProxy.java
services/note/client/src/test/java/org/collectionspace/services/client/test/NoteServiceTest.java
services/note/jaxb/pom.xml
services/note/jaxb/src/main/resources/notes-common.xsd
services/note/service/pom.xml
services/objectexit/client/pom.xml
services/objectexit/client/src/test/java/org/collectionspace/services/client/test/ObjectExitAuthRefsTest.java
services/objectexit/client/src/test/java/org/collectionspace/services/client/test/ObjectExitServiceTest.java
services/objectexit/service/pom.xml
services/organization/client/pom.xml
services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClient.java
services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityAuthRefsTest.java
services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityServiceTest.java
services/organization/service/pom.xml
services/person/client/pom.xml
services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityClient.java
services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthoritySearchTest.java
services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthorityServicePerfTest.java
services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthorityServiceTest.java
services/person/service/pom.xml
services/pom.xml
services/query/service/pom.xml
services/relation/client/pom.xml
services/relation/client/src/test/java/org/collectionspace/services/client/test/RelationServiceTest.java
services/relation/service/pom.xml
services/relation/service/src/main/java/org/collectionspace/services/relation/RelationResource.java
services/report/client/pom.xml
services/report/client/src/main/java/org/collectionspace/services/client/ReportClient.java
services/report/client/src/test/java/org/collectionspace/services/client/test/ReportServiceTest.java
services/report/service/pom.xml
services/security/client/pom.xml
services/security/client/src/test/java/org/collectionspace/services/security/client/test/AuthenticationServiceTest.java
services/security/client/src/test/java/org/collectionspace/services/security/client/test/AuthorizationServiceTest.java
services/security/client/src/test/java/org/collectionspace/services/security/client/test/MultiTenancyTest.java
services/taxonomy/client/pom.xml
services/taxonomy/client/src/main/java/org/collectionspace/services/client/TaxonomyAuthorityClient.java
services/taxonomy/client/src/main/java/org/collectionspace/services/client/TaxonomyAuthorityClientUtils.java
services/taxonomy/client/src/test/java/org/collectionspace/services/client/test/TaxonomyAuthorityServiceTest.java
services/taxonomy/service/pom.xml
services/vocabulary/client/pom.xml
services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyClient.java
services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyClientUtils.java
services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java
services/vocabulary/service/pom.xml
services/workflow/client/pom.xml
services/workflow/client/src/test/java/org/collectionspace/services/client/test/WorkflowServiceTest.java
services/workflow/service/pom.xml

index 65be4151cffba5492d36c056f8315cf7398cbfa8..4885aef631cad0e0efcde09d66b1afba7ea93b0c 100644 (file)
@@ -1,6 +1,6 @@
 host=127.0.0.1\r
 #cspace\r
-release.version=2.0\r
+release.version=2.1\r
 cspace.release=${release.version}-SNAPSHOT\r
 cspace.services.release=cspace-services-${cspace.release}\r
 domain.cspace=cspace-services\r
diff --git a/pom.xml b/pom.xml
index 9cc6592c34b657268b7d215ae039411fda8bdd63..5d8e4c32045139e7a4acded73292a0fd70f4dbd6 100644 (file)
--- a/pom.xml
+++ b/pom.xml
                                <artifactId>slf4j-log4j12</artifactId>\r
                                <version>1.5.8</version>\r
                        </dependency>\r
+            <dependency>\r
+                <groupId>org.testng</groupId>\r
+                <artifactId>testng</artifactId>\r
+                               <version>6.1.1</version>\r
+                <!-- <version>5.6</version> -->\r
+                <scope>test</scope>\r
+            </dependency>                      \r
                        <dependency>\r
                                <groupId>javax.ejb</groupId>\r
                                <artifactId>ejb</artifactId>\r
index de1699a90b5caf829676313be2bdea5b8b3c0c0b..7886f8529d930b46f27157fb3fee7de2c3125a42 100644 (file)
@@ -7,7 +7,6 @@
     </parent>\r
     \r
     <modelVersion>4.0.0</modelVersion>\r
-    <groupId>org.collectionspace.services</groupId>\r
     <artifactId>org.collectionspace.services.IntegrationTests</artifactId>\r
     <name>services.IntegrationTests</name>\r
     <packaging>jar</packaging>\r
         <dependency>\r
                        <groupId>commons-cli</groupId>\r
                        <artifactId>commons-cli</artifactId>\r
-                       <version>1.2</version>\r
         </dependency>\r
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
+            <scope>compile</scope>\r
         </dependency>\r
         <dependency>\r
             <groupId>org.jboss.resteasy</groupId>\r
@@ -97,7 +95,6 @@
         <dependency>\r
             <groupId>commons-httpclient</groupId>\r
             <artifactId>commons-httpclient</artifactId>\r
-            <version>3.1</version>\r
         </dependency>\r
         <dependency>\r
             <groupId>javax.security</groupId>\r
index ecd4b2fa90cbe1ed69518d2b71dd72cdc66da96b..ce402cdf9cabfbee62b503eeb91d4a5001cbc164 100755 (executable)
@@ -42,10 +42,7 @@ import org.collectionspace.services.collectionobject.TitleGroupList;
 import org.collectionspace.services.common.datetime.GregorianCalendarDateTimeUtils;\r
 import org.collectionspace.services.intake.IntakesCommon;\r
 import org.collectionspace.services.relation.RelationsCommon;\r
-import org.collectionspace.services.relation.RelationshipType;\r
 import org.jboss.resteasy.client.ClientResponse;\r
-import org.jboss.resteasy.plugins.providers.multipart.InputPart;\r
-import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;\r
 \r
 /**\r
  * The Class CollectionSpaceIntegrationTest.\r
index 8736756a8dbb8d26dce93414af1bc442468605aa..fbc73e5d9642a7b420914db39bcb251c100833b2 100755 (executable)
@@ -35,9 +35,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.jboss.resteasy.client.ClientResponse;
-import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
-import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
-import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
 
 import org.collectionspace.services.client.CollectionObjectClient;
 import org.collectionspace.services.client.PayloadOutputPart;
index a184cd7d5c77eb231d72b1f93b6a1d7f9fa73581..7ef498df0e2da665fb6722a7869acd384f1a36df 100755 (executable)
@@ -36,12 +36,11 @@ public class XmlReplayDevTest extends XmlReplayTest {
              List<List<ServiceResult>> list = replay.runMaster(masterFile);
              logTestForGroup(list, "XmlReplayMasterTest");
         } else {
-            System.out.println("XmlReplayDevTest skipping local dev test "+masterFile+" because it doesn't exist in "+replay.getBaseDir()+".  This is expected behavior on a production installation.");
+            System.out.println("XmlReplayDevTest skipping local dev test "
+                       + masterFile+" because it doesn't exist in "
+                       + replay.getBaseDir()
+                       + ".  This is expected behavior on a production installation.");
         }
-
-
-       //used for testing load.
-       // bigLoop(masterFile);
     }
 
     private void bigLoop(String masterFile){
@@ -57,7 +56,7 @@ public class XmlReplayDevTest extends XmlReplayTest {
         while (!quitNow) {
             Thread.yield();
         }
-        System.out.println("DONE. workers: "+MAXWORKERS+" time: "+(System.currentTimeMillis()-start));
+        System.out.println("DONE. workers: " + MAXWORKERS+" time: " + (System.currentTimeMillis()-start));
         for (Long l: stats){
             System.out.println(""+l);
         }
index 7aaac5e47b69bd9be6cc53293e08ad2ee21ebfc0..a4200fe7e00fc83bac924d4bd66d9605434ef215 100755 (executable)
@@ -28,7 +28,6 @@ import org.collectionspace.services.IntegrationTests.xmlreplay.XmlReplay;
 import org.collectionspace.services.IntegrationTests.xmlreplay.XmlReplayTest;\r
 import org.testng.annotations.Test;\r
 \r
-import java.util.ArrayList;\r
 import java.util.List;\r
 import java.util.Map;\r
 \r
index 88f7dfe7fda3fe2c7ec4cd1076f5981760568843..7cece4828851e3a76fe22684d03fc5f46924575c 100644 (file)
          <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>\r
         <!-- Possibly not needed.  Please experiment and remove unnecessary artifacts -->\r
         <dependency>\r
index 848dd0718af5ae6535f180c12a645752ea08a531..116cee8f79cb940967f952ac4390b4c525d2ef60 100644 (file)
@@ -23,11 +23,11 @@ log4j.appender.R.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n
 #\r
 # CollectionSpace log levels\r
 #\r
-log4j.logger.org.collectionspace=DEBUG\r
+log4j.logger.org.collectionspace=INFO\r
 #log4j.logger.org.collectionspace.services.common.vocabulary.nuxeo=TRACE\r
 log4j.logger.perf.collectionspace=ERROR\r
 \r
-log4j.logger.org.nuxeo=ERROR\r
+log4j.logger.org.nuxeo=INFO\r
 #log4j.logger.org.nuxeo.ecm.core.storage.sql=TRACE\r
 log4j.logger.org.apache=ERROR\r
 log4j.logger.httpclient=ERROR\r
index eec6d5aef9e0cc1ca5126a733072c8338e13b6ff..92ebab5d1c2920983a8a755b4611a6b10aeb2b60 100644 (file)
@@ -68,7 +68,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>\r
         <dependency>\r
             <groupId>org.jboss.resteasy</groupId>\r
index 4054a0cab4b3bb0c5bf7e83dea33f5a6b5882e30..e1ec5a2c3f68137b2d3b70f8cd79bfd3437813a6 100644 (file)
@@ -38,11 +38,11 @@ import org.slf4j.LoggerFactory;
 import org.jboss.resteasy.client.ClientResponse;
 import org.jboss.resteasy.util.HttpResponseCodes;
 
+import org.collectionspace.services.client.AbstractCommonListUtils;
 import org.collectionspace.services.client.CollectionObjectClient;
 import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.collectionobject.CollectionobjectsCommon;
-import org.collectionspace.services.common.AbstractCommonListUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 
 /**
index 52f67e58ff0c9ae2113156da9a4f33ccfa60ca37..9bbe68de867b7341dc9e5cb292906c7f5df81dc3 100644 (file)
 package org.collectionspace.services.client;
 
 import javax.ws.rs.core.Response;
+import org.jboss.resteasy.client.ClientResponse;
+
 import org.collectionspace.services.account.AccountsCommon;
 import org.collectionspace.services.account.AccountsCommonList;
-import org.jboss.resteasy.client.ClientResponse;
 
 /**
  * A AccountClient.
 
  * @version $Revision:$
  */
-public class AccountClient extends AbstractServiceClientImpl<AccountsCommonList, AccountProxy> {
+public class AccountClient extends AbstractServiceClientImpl<AccountsCommonList, AccountsCommon,
+               AccountsCommon, AccountProxy> {
     public static final String SERVICE_NAME = "accounts";
     public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;
     public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
index da0cc0b0da1a4e083abc1c62a4ccc75b10597b72..2b771d5b773b482dbf240817b0cf35a35afd5186 100644 (file)
 package org.collectionspace.services.client;
 
 import javax.ws.rs.core.Response;
+import org.jboss.resteasy.client.ClientResponse;
 
-//import org.collectionspace.services.authorization.AccountRolesList;
 import org.collectionspace.services.authorization.AccountRole;
-import org.jboss.resteasy.client.ClientResponse;
+import org.collectionspace.services.jaxb.AbstractCommonList;
 
 /**
  * A AccountRoleClient.
 
  * @version $Revision:$
  */
-public class AccountRoleClient extends AbstractServiceClientImpl<AccountRole, AccountRoleProxy> {
+public class AccountRoleClient extends AbstractServiceClientImpl<AbstractCommonList, AccountRole, AccountRole, AccountRoleProxy> {
        public static final String SERVICE_NAME = "accountroles";
 
        @Override
@@ -92,7 +92,16 @@ public class AccountRoleClient extends AbstractServiceClientImpl<AccountRole, Ac
     public ClientResponse<Response> create(String csid, AccountRole accRole) {
         return getProxy().create(csid, accRole);
     }
-
+    
+    /*
+     * 
+     * Updates on AccountRole entities is not supported.
+     * 
+     */
+       @Override
+       public ClientResponse<AccountRole> update(String csid, AccountRole payload) {
+               throw new RuntimeException("You cannot update an AccountRole object.  You must delete and recreate it instead.");
+       }
 
     /**
      * @param csid
@@ -103,4 +112,18 @@ public class AccountRoleClient extends AbstractServiceClientImpl<AccountRole, Ac
     public ClientResponse<Response> delete(String csid, AccountRole accRole) {
         return getProxy().delete(csid, "delete", accRole);
     }
+
+    /*
+     * Not supported.
+     */
+       @Override
+       public ClientResponse<Response> create(AccountRole payload) {
+               // Use the create(String csid, AccountRole accRole) method instead
+               throw new UnsupportedOperationException();
+       }
+
+       @Override
+       public ClientResponse<AbstractCommonList> readList() {
+               throw new UnsupportedOperationException();
+       }
 }
index 4ad266d31a62f23d7294b30a412cd66d28e4694e..86161236464283197d40dfe5361bd9763747eb33 100644 (file)
@@ -30,13 +30,14 @@ import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
 import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.Response;
 
-//import org.collectionspace.services.authorization.AccountRolesList;
+import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.authorization.AccountRole;
 import org.jboss.resteasy.client.ClientResponse;
 
@@ -46,7 +47,7 @@ import org.jboss.resteasy.client.ClientResponse;
 @Path("/accounts")
 @Produces({"application/xml"})
 @Consumes({"application/xml"})
-public interface AccountRoleProxy extends CollectionSpaceProxy<AccountRole> {
+public interface AccountRoleProxy extends CollectionSpaceProxy<AbstractCommonList> {
 
     //(C)reate
     @POST
@@ -71,6 +72,11 @@ public interface AccountRoleProxy extends CollectionSpaceProxy<AccountRole> {
             @QueryParam("_method") String method,
             AccountRole accRole);
 
+    //(U)pdate
+    @PUT
+    @Path("/{csid}/accountroles")
+    ClientResponse<AccountRole> update(@PathParam("csid") String csid, AccountRole role);
+    
     //(D)elete
     @Override
        @DELETE
index 053da69a652f6d5576339a5001d6684b49791453..e006e29f4476d76173f34ae0a63562b700b2842b 100644 (file)
  */
 package org.collectionspace.services.account.client.test;
 
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Hashtable;
 import java.util.List;
-import javax.ws.rs.core.Response;
 
-//import org.collectionspace.services.authorization.AccountRolesList;
 import org.collectionspace.services.account.AccountsCommon;
 import org.collectionspace.services.account.AccountsCommonList;
 import org.collectionspace.services.account.AccountListItem;
-
 import org.collectionspace.services.authorization.AccountRole;
 import org.collectionspace.services.authorization.AccountValue;
 import org.collectionspace.services.authorization.Role;
@@ -46,17 +42,17 @@ import org.collectionspace.services.client.RoleClient;
 import org.collectionspace.services.client.RoleFactory;
 import org.collectionspace.services.client.test.AbstractServiceTestImpl;
 import org.collectionspace.services.client.test.ServiceRequestType;
-import org.collectionspace.services.jaxb.AbstractCommonList;
-import org.jboss.resteasy.client.ClientResponse;
 
+import javax.ws.rs.core.Response;
+import org.jboss.resteasy.client.ClientResponse;
 
 import org.testng.Assert;
 import org.testng.annotations.Test;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
 
 /**
  * AccountServiceTest, carries out tests against a
@@ -65,18 +61,15 @@ import org.testng.annotations.BeforeClass;
  * $LastChangedRevision: 917 $
  * $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri, 06 Nov 2009) $
  */
-public class AccountRoleServiceTest extends AbstractServiceTestImpl {
+public class AccountRoleServiceTest extends AbstractServiceTestImpl<AccountRole, AccountRole, AccountRole, AccountRole> {
 
     /** The Constant logger. */
     private final static String CLASS_NAME = AccountRoleServiceTest.class.getName();
     private final static Logger logger = LoggerFactory.getLogger(CLASS_NAME);
     // Instance variables specific to this test.
-    /** The known resource id. */
-    private String knownResourceId = null;
     private String prebuiltAdminCSID = null;
     private String prebuiltAdminUserId = "admin@core.collectionspace.org";
     /** The all resource ids created. */
-    private List<String> allResourceIdsCreated = new ArrayList<String>();
     /** The acc values. */
     private Hashtable<String, AccountValue> accValues = new Hashtable<String, AccountValue>();
     /** The role values. */
@@ -137,183 +130,58 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl {
         return new AccountRoleClient();
     }
 
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
-     */
-    @Override
-    protected AbstractCommonList getAbstractCommonList(
-            ClientResponse<AbstractCommonList> response) {
-        //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
-        throw new UnsupportedOperationException();
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readPaginatedList(java.lang.String)
-     */
-    @Test(dataProvider = "testName")
-    @Override
-    public void readPaginatedList(String testName) throws Exception {
-        //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
-    }
-
     // ---------------------------------------------------------------
     // CRUD tests : CREATE tests
     // ---------------------------------------------------------------
     // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
-    public void create(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            testBanner(testName, CLASS_NAME);
-        }
-        // Perform setup, such as initializing the type of service request
-        // (e.g. CREATE, DELETE), its valid and expected status codes, and
-        // its associated HTTP method name (e.g. POST, DELETE).
-        setupCreate();
-
-        // Submit the request to the service and store the response.
+    
+    public void createList(String testName) throws Exception {
+       // Do nothing.  We do not support list creation in this test yet.
+    }
+    
+       @Override
+       protected AccountRole createInstance(String commonPartName,
+                       String identifier) {
+               AccountRole result = null;
+               
+        // Use a known Account to associate the AccountRole instance to
+        AccountValue av = accValues.get("acc-role-user1");
+        AccountRole accRole = createAccountRoleInstance(av,
+                roleValues.values(), true, true);
+        
+        result = accRole;
+        return result;
+       }
+       
+       @Override
+       public void create(String testName) throws Exception {
+               setupCreate();
         AccountValue av = accValues.get("acc-role-user1");
         AccountRole accRole = createAccountRoleInstance(av,
                 roleValues.values(), true, true);
         AccountRoleClient client = new AccountRoleClient();
         ClientResponse<Response> res = client.create(av.getAccountId(), accRole);
         try {
-            int statusCode = res.getStatus();
-
+               assertStatusCode(res, testName);
+            knownResourceId = av.getAccountId();
             if (logger.isDebugEnabled()) {
-                logger.debug(testName + ": status = " + statusCode);
-            }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
-            // Store the ID returned from this create operation
-            // for additional tests below.
-            //this is is not important in case of this relationship
-            knownResourceId = extractId(res);
-            if (logger.isDebugEnabled()) {
-                logger.debug(testName + ": knownResourceId=" + knownResourceId);
+                logger.debug(testName + ": Created an AccountRole instance for account with knownResourceId="
+                               + knownResourceId);
             }
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                       res.releaseConnection();
+               }
         }
-    }
-
-    //to not cause uniqueness violation for accRole, createList is removed
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
-    @Override
-    public void createList(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
-
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
-     */
-    @Override
-    public void createWithEmptyEntityBody(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
-     */
-    @Override
-    public void createWithMalformedXml(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
-     */
-    @Override
-    public void createWithWrongXmlSchema(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
+       }
 
     // ---------------------------------------------------------------
     // CRUD tests : READ tests
     // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
-    public void read(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            testBanner(testName, CLASS_NAME);
-        }
-
-        // Perform setup.
-        setupRead();
-
-        // Submit the request to the service and store the response.
-        AccountRoleClient client = new AccountRoleClient();
-        ClientResponse<AccountRole> res = client.read(
-                accValues.get("acc-role-user1").getAccountId());
-        assertStatusCode(res, testName);
-        try {
-            AccountRole output = res.getEntity();
-            Assert.assertNotNull(output);
-        } finally {
-            res.releaseConnection();
-        }
-    }
-
-    // Failure outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
-    public void readNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            testBanner(testName, CLASS_NAME);
-        }
-
-        // Perform setup.
-        setupReadNonExistent();
 
-        // Submit the request to the service and store the response.
-        AccountRoleClient client = new AccountRoleClient();
-        ClientResponse<AccountRole> res = client.read(this.NON_EXISTENT_ID);
-        int statusCode = res.getStatus();
-        try {
-            // Check the status code of the response: does it match
-            // the expected response(s)?
-            if (logger.isDebugEnabled()) {
-                logger.debug(testName + ": status = " + statusCode);
-            }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        } finally {
-            res.releaseConnection();
-        }
-    }
-
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"CRUDTests"})
     public void readNoRelationship(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            testBanner(testName, CLASS_NAME);
-        }
-
         // Perform setup.
         setupRead();
 
@@ -321,17 +189,20 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl {
         AccountRoleClient client = new AccountRoleClient();
         ClientResponse<AccountRole> res = client.read(
                 accValues.get("acc-role-user2").getAccountId());
-        assertStatusCode(res, testName);
         try {
+            // Check the status code of the response: does it match
+            // the expected response(s)?
+            assertStatusCode(res, testName);
             AccountRole output = res.getEntity();
-
             if(logger.isDebugEnabled()) {
                org.collectionspace.services.authorization.ObjectFactory objectFactory = new org.collectionspace.services.authorization.ObjectFactory();
                String sOutput = objectAsXmlString(objectFactory.createAccountRole(output), AccountRole.class);
                 logger.debug(testName + " received " + sOutput);
             }
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                       res.releaseConnection();
+               }
         }
     }
     
@@ -340,56 +211,56 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl {
      * After we've performed this setup, our call to "/role/{csid}/accountroles" should contain an AccountRole that has
      * a list of 1 account -the test user account we associated during setup.
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-           dependsOnMethods = {"delete"})
+    @Test(dataProvider = "testName",
+           dependsOnMethods = {"CRUDTests"})
     public void readRoleAccounts(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            testBanner(testName, CLASS_NAME);
-        }
-
                /*
                 * Setup a temp local scope for local variables that we need to create the AccountRole for
                 * the setup of the read tests.
                 */
         {
-               setupCreate();
-
                // Associate "acc-role-user2" with all the roles.
                AccountValue av = accValues.get("acc-role-user2");
                AccountRole accRole = createAccountRoleInstance(av,
                        roleValues.values(), true, true);
                AccountRoleClient client = new AccountRoleClient();
+               setupCreate();          
                ClientResponse<Response> res = client.create(av.getAccountId(), accRole);
-               int statusCode = res.getStatus();
-               Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                       invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-               Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+               try {
+                       assertStatusCode(res, testName);
+               } finally {
+                       if (res != null) {
+                               res.releaseConnection();
+                       }
+               }
         }
 
         //
         // Now read the list of accounts associated with the role "ROLE_CO1".
         // There should be just the "acc-role-user2" account.
         //
-        setupRead();        
         RoleClient roleClient = new RoleClient();
         
         // Submit the request to the service and store the response.
+        setupRead();        
         ClientResponse<AccountRole> res = roleClient.readRoleAccounts(
                        roleValues.get("ROLE_CO1").getRoleId());
-        assertStatusCode(res, testName);
         try {
+            // Check the status code of the response: does it match
+            // the expected response(s)?
+            assertStatusCode(res, testName);
             AccountRole output = res.getEntity();
             
             // Now verify that the role has 2 accounts associate to it.
             Assert.assertEquals(output.getAccount().size(), 1);
-
             String sOutput = objectAsXmlString(output, AccountRole.class);
             if(logger.isDebugEnabled()) {
                 logger.debug(testName + " received " + sOutput);
             }
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
     }    
 
@@ -397,15 +268,20 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl {
     // CRUD tests : READ_LIST tests
     // ---------------------------------------------------------------
     // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
-     */
+
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList", "read"})
     public void readList(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
+        //
+       // There is no such thing as a list of AccountRole resources
+       //
     }
+    
+    @Override
+    public void readPaginatedList(String testName) throws Exception {
+        //
+       // There is no such thing as a list of AccountRole resources
+       //
+    }    
 
     // Failure outcomes
     // None at present.
@@ -413,169 +289,124 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl {
     // CRUD tests : UPDATE tests
     // ---------------------------------------------------------------
     // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read", "readList", "readNonExistent"})
-    public void update(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
 
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
-     */
     @Override
-    public void updateWithEmptyEntityBody(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
-     */
-    @Override
-    public void updateWithMalformedXml(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
-     */
-    @Override
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
+    public void update(String testName) throws Exception {
+        //
+       // AccountRole entities cannot be updated.  You must delete and recreate them
+       //
     }
 
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
-     */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"readNonExistent", "testSubmitRequest"})
+    @Test(dataProvider = "testName",
+       dependsOnMethods = {"CRUDTests"})
     public void updateNonExistent(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
+        //
+       // AccountRole entities cannot be updated.  You must delete and recreate them
+       //
     }
 
     // ---------------------------------------------------------------
     // CRUD tests : DELETE tests
     // ---------------------------------------------------------------
     // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
-     */
+    
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
     public void delete(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            testBanner(testName, CLASS_NAME);
-        }
-
-        // Perform setup.
-        setupDelete();
-        
         //
-        // Lookup a know account, and delete all of its role relationships
+        // First, lookup the known account and delete all of its role relationships
         //
         AccountRoleClient client = new AccountRoleClient();
+        setupRead();        
         ClientResponse<AccountRole> readResponse = client.read(
                 accValues.get("acc-role-user1").getAccountId());
         AccountRole toDelete = null;
         try {
+               assertStatusCode(readResponse, testName);
                toDelete = readResponse.getEntity();
-        } catch (Throwable e) {
-               e.printStackTrace();
+               Assert.assertNotNull(toDelete);
         } finally {
-               readResponse.releaseConnection();
+               if (readResponse != null) {
+                       readResponse.releaseConnection();
+               }
         }
 
+        setupDelete();                
         ClientResponse<Response> res = client.delete(
-                toDelete.getAccount().get(0).getAccountId(), toDelete);
+                toDelete.getAccount().get(0).getAccountId(), toDelete); // delete form #1
         try {
-            int statusCode = res.getStatus();
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+               assertStatusCode(readResponse, testName);
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                       res.releaseConnection();
+               }
         }
-        
         //
-        // recreate 'acc-role-user1' account and roles
+        // Recreate 'acc-role-user1' account and roles for the next test
         //
-//        create(testName);
-        
-        /*
-        setupDelete();
-        
+        create(testName);
+                
         //
-        // Lookup a know account, and delete all of its role relationships
+        // Lookup a known account and delete all of its role relationships again
         //
+        setupRead();
         readResponse = client.read(
-                accValues.get("acc-role-user1").getAccountId());
+                       accValues.get("acc-role-user1").getAccountId());
         toDelete = null;
         try {
                toDelete = readResponse.getEntity();
-        } catch (Throwable e) {
-               e.printStackTrace();
         } finally {
-               readResponse.releaseConnection();
+               if (readResponse != null) {
+                       readResponse.releaseConnection();
+               }
         }
 
-        res = client.delete(toDelete.getAccount().get(0).getAccountId());
+        setupDelete();        
+        res = client.delete(toDelete.getAccount().get(0).getAccountId()); // delete form #2
         try {
             int statusCode = res.getStatus();
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
+            Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
             res.releaseConnection();
         }
-        */
-        
     }
 
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-           dependsOnMethods = {"read"})
+    @Test(dataProvider = "testName",
+           dependsOnMethods = {"CRUDTests"})
        public void deleteLockedAccount(String testName) throws Exception {
-
-       if (logger.isDebugEnabled()) {
-               testBanner(testName, CLASS_NAME);
-       }
-       
        findPrebuiltAdminAccount();
 
        // Perform setup.
-        EXPECTED_STATUS_CODE = Response.Status.FORBIDDEN.getStatusCode();
-        REQUEST_TYPE = ServiceRequestType.DELETE;
-        testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
+        testExpectedStatusCode = Response.Status.FORBIDDEN.getStatusCode();
+        testRequestType = ServiceRequestType.DELETE;
+        testSetup(testExpectedStatusCode, testRequestType);
 
        AccountRoleClient client = new AccountRoleClient();
        ClientResponse<Response> res = client.delete(prebuiltAdminCSID);
        try {
                int statusCode = res.getStatus();
-               Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                               invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-               Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                               invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
        } finally {
-               res.releaseConnection();
+               if (res != null) {
+                       res.releaseConnection();
+               }
        }
     }
 
-    // Failure outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
-     */
+    //
+    // Tests with expected failure outcomes
+    //
+
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
     public void deleteNonExistent(String testName) throws Exception {
         //ignoring this test as the service side returns 200 now even if it does
         //not find a record in the db
+       
+       //FIXME: REM - 1/9/2012, need to find out why a 200 status code is returned and fix this.
     }
     
     // ---------------------------------------------------------------
@@ -583,43 +414,14 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl {
     // ---------------------------------------------------------------
     
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
     public void searchWorkflowDeleted(String testName) throws Exception {
         // Fixme: null test for now, overriding test in base class
     }    
 
-    // ---------------------------------------------------------------
-    // Utility tests : tests of code used in tests above
-    // ---------------------------------------------------------------
-    /**
-     * Tests the code for manually submitting data that is used by several
-     * of the methods above.
-     * @throws Exception 
-     */
-    @Test(dependsOnMethods = {"create"})
-    public void testSubmitRequest() throws Exception {  //FIXME:  REM - This is not testing a submit /accounts/*/accountroles, but instead just to /accounts
-
-        // Expected status code: 200 OK
-        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
-
-        // Submit the request to the service and store the response.
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getResourceURL(accValues.get("acc-role-user1").getAccountId());
-        int statusCode = submitRequest(method, url);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug("testSubmitRequest: url=" + url
-                    + " status=" + statusCode);
-        }
-        Assert.assertEquals(statusCode, EXPECTED_STATUS);
-
-    }
-
     // ---------------------------------------------------------------
     // Utility methods used by tests above
     // ---------------------------------------------------------------
+
     /**
      * Creates the account role instance.
      *
@@ -665,7 +467,6 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl {
             logger.debug("Cleaning up temporary resources created for testing ...");
         }
 
-
         for (AccountValue pv : accValues.values()) {
             deleteAccount(pv.getAccountId());
         }
@@ -683,46 +484,47 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl {
      * @return the string
      */
     private String createAccount(String userName, String email) {
-
-        if (logger.isDebugEnabled()) {
-            testBanner("createAccount");
-        }
-
-        setupCreate();
-
         AccountClient accClient = new AccountClient();
         AccountsCommon account = AccountFactory.createAccountInstance(
                 userName, userName, userName, email, accClient.getTenantId(),
                 true, false, true, true);
+        String result = null;
+        
+        setupCreate();
         ClientResponse<Response> res = accClient.create(account);
-        int statusCode = res.getStatus();
-        if (logger.isDebugEnabled()) {
-            logger.debug("createAccount: userName=" + userName
-                    + " status = " + statusCode);
+        try {
+               assertStatusCode(res, "CreateAccount");
+               result = extractId(res);
+        } finally {
+               if (res != null) {
+                       res.releaseConnection();
+               }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        res.releaseConnection();
-        return extractId(res);
+
+        return result;
     }
 
     private void findPrebuiltAdminAccount() {
        // Search for the prebuilt admin user and then hold its CSID
-       if(prebuiltAdminCSID == null) {
+       if (prebuiltAdminCSID == null) {
             setupReadList();
             AccountClient client = new AccountClient();
             ClientResponse<AccountsCommonList> res =
                     client.readSearchList(null, this.prebuiltAdminUserId, null);
-            assertStatusCode(res, "findPrebuiltAdminAccount");
-            AccountsCommonList list = res.getEntity();
-            
-            List<AccountListItem> items = list.getAccountListItem();
-            Assert.assertEquals(1, items.size(), "Found more than one Admin account!");
-            AccountListItem item = items.get(0);
-            prebuiltAdminCSID = item.getCsid();
-            if (logger.isDebugEnabled()) {
-                logger.debug("Found Admin Account with ID: " + prebuiltAdminCSID);
+            try {
+                   assertStatusCode(res, "findPrebuiltAdminAccount");
+                   AccountsCommonList list = res.getEntity();
+                   List<AccountListItem> items = list.getAccountListItem();
+                   Assert.assertEquals(1, items.size(), "Found more than one Admin account!");
+                   AccountListItem item = items.get(0);
+                   prebuiltAdminCSID = item.getCsid();
+                   if (logger.isDebugEnabled()) {
+                       logger.debug("Found Admin Account with ID: " + prebuiltAdminCSID);
+                   }
+            } finally {
+                if (res != null) {
+                    res.releaseConnection();
+                }              
             }
        }
     }
@@ -733,26 +535,15 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl {
      * @param accId the acc id
      */
     private void deleteAccount(String accId) {
-
-        if (logger.isDebugEnabled()) {
-            testBanner("deleteAccount");
-        }
-
-        setupDelete();
-
         AccountClient accClient = new AccountClient();
+        setupDelete();
         ClientResponse<Response> res = accClient.delete(accId);
-        int statusCode = res.getStatus();
         try {
-            if (logger.isDebugEnabled()) {
-                logger.debug("deleteAccount: delete account id="
-                        + accId + " status=" + statusCode);
-            }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+               assertStatusCode(res, "DeleteAccount");
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                       res.releaseConnection();
+               }
         }
     }
 
@@ -763,26 +554,24 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl {
      * @return the string
      */
     private String createRole(String roleName) {
-        if (logger.isDebugEnabled()) {
-            testBanner("createRole");
-        }
-        setupCreate();
+       String result = null;
+       
         RoleClient roleClient = new RoleClient();
-
         Role role = RoleFactory.createRoleInstance(roleName,
                        roleName, //the display name
                 "role for " + roleName, true);
+        setupCreate();
         ClientResponse<Response> res = roleClient.create(role);
-        int statusCode = res.getStatus();
-        if (logger.isDebugEnabled()) {
-            logger.debug("createRole: name=" + roleName
-                    + " status = " + statusCode);
+        try {
+               assertStatusCode(res, "CreateRole");
+               result = extractId(res);
+        } finally {
+               if (res != null) {
+                       res.releaseConnection();
+               }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        res.releaseConnection();
-        return extractId(res);
+        
+        return result;
     }
 
     /**
@@ -791,23 +580,15 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl {
      * @param roleId the role id
      */
     private void deleteRole(String roleId) {
-        if (logger.isDebugEnabled()) {
-            testBanner("deleteRole");
-        }
         setupDelete();
         RoleClient roleClient = new RoleClient();
         ClientResponse<Response> res = roleClient.delete(roleId);
-        int statusCode = res.getStatus();
         try {
-            if (logger.isDebugEnabled()) {
-                logger.debug("deleteRole: delete role id=" + roleId
-                        + " status=" + statusCode);
-            }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+               assertStatusCode(res, "DeleteRole");
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                       res.releaseConnection();
+               }
         }
     }
 
@@ -816,4 +597,43 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl {
                // AccountRoles service is a sub-service of the Account service, so we return Account's service name
                return AccountClient.SERVICE_NAME;
        }
+
+    /*
+     * For convenience and terseness, this test method is the base of the test execution dependency chain.  Other test methods may
+     * refer to this method in their @Test annotation declarations.
+     */
+    @Override
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {
+                       "org.collectionspace.services.client.test.AbstractServiceTestImpl.baseCRUDTests"})    
+    public void CRUDTests(String testName) {
+       // Do nothing.  Simply here to for a TestNG execution order for our tests
+    }
+
+       @Override
+       protected AccountRole updateInstance(AccountRole commonPartObject) {
+        //
+       // AccountRole entities cannot be updated.  You must delete and recreate them
+       //
+               return null;
+       }
+
+       @Override
+       protected void compareReadInstances(AccountRole original, AccountRole updated)
+                       throws Exception {
+               // FIXME: Should add field checks here.
+       }
+
+       @Override
+       protected void compareUpdatedInstances(AccountRole original,
+                       AccountRole updated) throws Exception {
+        //
+       // AccountRole entities cannot be updated.  You must delete and recreate them
+       //
+       }
+
+       @Override
+       protected Class<AccountRole> getCommonListType() {
+               return AccountRole.class;
+       }
 }
index 57f97765ad35a31d95362c9a012391315458987d..28aa2aa133ea0241a2a56191868056aaf9460c95 100644 (file)
@@ -24,6 +24,7 @@ package org.collectionspace.services.account.client.test;
 
 import java.util.List;
 import javax.ws.rs.core.Response;
+import org.jboss.resteasy.client.ClientResponse;
 
 import org.collectionspace.services.client.AccountClient;
 import org.collectionspace.services.client.CollectionSpaceClient;
@@ -35,8 +36,6 @@ import org.collectionspace.services.account.Status;
 import org.collectionspace.services.client.AccountFactory;
 import org.collectionspace.services.client.test.AbstractServiceTestImpl;
 import org.collectionspace.services.client.test.ServiceRequestType;
-import org.collectionspace.services.jaxb.AbstractCommonList;
-import org.jboss.resteasy.client.ClientResponse;
 
 import org.testng.Assert;
 import org.testng.annotations.Test;
@@ -51,14 +50,13 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision: 917 $
  * $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri, 06 Nov 2009) $
  */
-public class AccountServiceTest extends AbstractServiceTestImpl {
+public class AccountServiceTest extends AbstractServiceTestImpl<AccountsCommonList, AccountsCommon, AccountsCommon, AccountsCommon> {
 
     /** The Constant logger. */
     private final String CLASS_NAME = AccountServiceTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+
     // Instance variables specific to this test.
-    /** The known resource id. */
-    private String knownResourceId = null;
     private String prebuiltAdminCSID = null;
     private String prebuiltAdminUserId = "admin@core.collectionspace.org";
     private String knownUserId = "barney";
@@ -94,17 +92,16 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-    protected AbstractCommonList getAbstractCommonList(
-            ClientResponse<AbstractCommonList> response) {
+    protected AccountsCommonList getCommonList(
+            ClientResponse<AccountsCommonList> response) {
         //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
         throw new UnsupportedOperationException();
     }
+    
+    protected Class<AccountsCommonList> getCommonListType() {
+       return (Class<AccountsCommonList>) AccountsCommonList.class;
+    }    
 
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readPaginatedList(java.lang.String)
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-           dependsOnMethods = {"readList"})
     @Override
     public void readPaginatedList(String testName) throws Exception {
         //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
@@ -114,64 +111,16 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
     // CRUD tests : CREATE tests
     // ---------------------------------------------------------------
     // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
-    public void create(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup, such as initializing the type of service request
-        // (e.g. CREATE, DELETE), its valid and expected status codes, and
-        // its associated HTTP method name (e.g. POST, DELETE).
-        setupCreate();
-
-        AccountClient client = new AccountClient();
-        // Submit the request to the service and store the response.
-        AccountsCommon account =
-                createAccountInstance(knownUserId, knownUserId, knownUserPassword,
-                "barney@dinoland.com", client.getTenantId(),
-                true, false, true, true);
-        ClientResponse<Response> res = client.create(account);
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        //
-        // Specifically:
-        // Does it fall within the set of valid status codes?
-        // Does it exactly match the expected status code?
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": status = " + statusCode);
-        }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
-        // Store the ID returned from this create operation
-        // for additional tests below.
-        knownResourceId = extractId(res);
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": knownResourceId=" + knownResourceId);
-        }
-    }
-
+    
     /**
      * Creates the for unique user.
      *
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"CRUDTests"})
     public void createForUniqueUser(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         setupCreate();
 
         // Submit the request to the service and store the response.
@@ -186,8 +135,8 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
     }
 
@@ -197,13 +146,8 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
+    @Test(dataProvider = "testName", dependsOnMethods = {"CRUDTests"})
     public void createWithInvalidTenant(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         setupCreate();
 
         // Submit the request to the service and store the response.
@@ -217,10 +161,9 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
-
     }
 
     /**
@@ -229,13 +172,8 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
+    @Test(dataProvider = "testName", dependsOnMethods = {"CRUDTests"})
     public void createWithoutUser(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         setupCreate();
 
         // Submit the request to the service and store the response.
@@ -249,8 +187,8 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
     }
 
@@ -260,13 +198,8 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
+    @Test(dataProvider = "testName", dependsOnMethods = {"CRUDTests"})
     public void createWithInvalidEmail(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         setupCreate();
 
         // Submit the request to the service and store the response.
@@ -280,8 +213,8 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
     }
 
@@ -291,13 +224,8 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
+    @Test(dataProvider = "testName", dependsOnMethods = {"CRUDTests"})
     public void createWithoutScreenName(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         setupCreate();
 
         // Submit the request to the service and store the response.
@@ -311,8 +239,8 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
     }
 
@@ -322,13 +250,8 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
+    @Test(dataProvider = "testName", dependsOnMethods = {"CRUDTests"})
     public void createWithInvalidPassword(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         setupCreate();
 
         // Submit the request to the service and store the response.
@@ -342,8 +265,8 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
     }
 
@@ -353,13 +276,8 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
+    @Test(dataProvider = "testName", dependsOnMethods = {"CRUDTests"})
     public void createWithMostInvalid(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         setupCreate();
 
         // Submit the request to the service and store the response.
@@ -373,23 +291,16 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
     }
 
-    //to not cause uniqueness violation for account, createList is removed
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
-     */
+    //
+    // To avoid uniqueness violations for accounts, createList is removed
+    //
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
     public void createList(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         setupCreate();
         // Submit the request to the service and store the response.
         AccountClient client = new AccountClient();
@@ -398,9 +309,9 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
                 client.getTenantId(), true, false, true, true);
         ClientResponse<Response> res = client.create(account1);
         int statusCode = res.getStatus();
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
         allResourceIdsCreated.add(extractId(res));
 
         AccountsCommon account2 =
@@ -408,10 +319,10 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
                 client.getTenantId(), true, false, true, true);
         res = client.create(account2);
         statusCode = res.getStatus();
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
         allResourceIdsCreated.add(extractId(res));
 
         AccountsCommon account3 =
@@ -419,19 +330,18 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
                 client.getTenantId(), true, false, true, true);
         res = client.create(account3);
         statusCode = res.getStatus();
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
         allResourceIdsCreated.add(extractId(res));
     }
 
-    // Failure outcomes
+    //
+    // Tests with expected failure outcomes
+    //
     // Placeholders until the three tests below can be uncommented.
     // See Issue CSPACE-401.
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
-     */
     @Override
     public void createWithEmptyEntityBody(String testName) throws Exception {
         //FIXME: Should this test really be empty?  If so, please comment accordingly.
@@ -453,93 +363,10 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         //FIXME: Should this test really be empty?  If so, please comment accordingly.
     }
 
-    // ---------------------------------------------------------------
-    // CRUD tests : READ tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
-    public void read(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupRead();
-
-        // Submit the request to the service and store the response.
-        AccountClient client = new AccountClient();
-        ClientResponse<AccountsCommon> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-
-        AccountsCommon output = (AccountsCommon) res.getEntity();
-        Assert.assertNotNull(output);
-    }
-
-    // Failure outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
-    public void readNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadNonExistent();
-
-        // Submit the request to the service and store the response.
-        AccountClient client = new AccountClient();
-        ClientResponse<AccountsCommon> res = client.read(NON_EXISTENT_ID);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
     // ---------------------------------------------------------------
     // CRUD tests : READ_LIST tests
     // ---------------------------------------------------------------
     // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList", "read"})
-    public void readList(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadList();
-
-        // Submit the request to the service and store the response.
-        AccountClient client = new AccountClient();
-        ClientResponse<AccountsCommonList> res = client.readList();
-        assertStatusCode(res, testName);
-        AccountsCommonList list = res.getEntity();
-
-        // Optionally output additional data about list members for debugging.
-        boolean iterateThroughList = true;
-        if (iterateThroughList && logger.isDebugEnabled()) {
-            printList(testName, list);
-        }
-    }
 
     /**
      * Search screen name.
@@ -547,13 +374,8 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList", "read"})
+    @Test(dataProvider = "testName", dependsOnMethods = {"CRUDTests"})
     public void searchScreenName(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupReadList();
 
@@ -561,45 +383,55 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         AccountClient client = new AccountClient();
         ClientResponse<AccountsCommonList> res =
                 client.readSearchList("tom", null, null);
-        assertStatusCode(res, testName);
-        
-        AccountsCommonList list = res.getEntity();
-        Assert.assertEquals(1, list.getAccountListItem().size());
-        // Optionally output additional data about list members for debugging.
-        boolean iterateThroughList = true;
-        if (iterateThroughList && logger.isDebugEnabled()) {
-            printList(testName, list);
+        try {
+               assertStatusCode(res, testName);                
+               AccountsCommonList list = res.getEntity();      
+               Assert.assertEquals(1, list.getAccountListItem().size());
+               // Optionally output additional data about list members for debugging.
+               boolean iterateThroughList = true;
+               if (iterateThroughList && logger.isDebugEnabled()) {
+                   printList(testName, list);
+               }
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
     }
 
+    @Override
+    @Test(dataProvider = "testName")
+    public void searchWorkflowDeleted(String testName) throws Exception {
+        // Fixme: null test for now, overriding test in base class
+    }
+
     /**
      * Search user id.
      *
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList", "read"})
+    @Test(dataProvider = "testName", dependsOnMethods = {"CRUDTests"})
     public void searchUserId(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupReadList();
 
         // Submit the request to the service and store the response.
         AccountClient client = new AccountClient();
-        ClientResponse<AccountsCommonList> res =
-                client.readSearchList(null, "tom", null);
-        assertStatusCode(res, testName);
-        
-        AccountsCommonList list = res.getEntity();
-        Assert.assertEquals(1, list.getAccountListItem().size());
-        // Optionally output additional data about list members for debugging.
-        boolean iterateThroughList = true;
-        if (iterateThroughList && logger.isDebugEnabled()) {
-            printList(testName, list);
+        ClientResponse<AccountsCommonList> res = client.readSearchList(null, "tom", null);
+        try {
+               assertStatusCode(res, testName);                
+               AccountsCommonList list = res.getEntity();
+               Assert.assertEquals(1, list.getAccountListItem().size());
+               // Optionally output additional data about list members for debugging.
+               boolean iterateThroughList = true;
+               if (iterateThroughList && logger.isDebugEnabled()) {
+                   printList(testName, list);
+               }
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
     }
 
@@ -609,28 +441,27 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList", "read"})
+    @Test(dataProvider = "testName", dependsOnMethods = {"CRUDTests"})
     public void searchEmail(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupReadList();
 
         // Submit the request to the service and store the response.
         AccountClient client = new AccountClient();
-        ClientResponse<AccountsCommonList> res =
-                client.readSearchList(null, null, "dinoland");
-        assertStatusCode(res, testName);
-        
-        AccountsCommonList list = res.getEntity();
-        Assert.assertEquals(2, list.getAccountListItem().size());
-        // Optionally output additional data about list members for debugging.
-        boolean iterateThroughList = true;
-        if (iterateThroughList && logger.isDebugEnabled()) {
-            printList(testName, list);
+        ClientResponse<AccountsCommonList> res = client.readSearchList(null, null, "dinoland");
+        try {
+               assertStatusCode(res, testName);                
+               AccountsCommonList list = res.getEntity();
+               Assert.assertEquals(2, list.getAccountListItem().size());
+               // Optionally output additional data about list members for debugging.
+               boolean iterateThroughList = true;
+               if (iterateThroughList && logger.isDebugEnabled()) {
+                   printList(testName, list);
+               }
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
     }
 
@@ -640,85 +471,33 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList", "read"})
+    @Test(dataProvider = "testName", dependsOnMethods = {"CRUDTests"})
     public void searchScreenNameEmail(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupReadList();
 
         // Submit the request to the service and store the response.
         AccountClient client = new AccountClient();
-        ClientResponse<AccountsCommonList> res =
-                client.readSearchList("tom", null, "jerry");
-        assertStatusCode(res, testName);
-        
-        AccountsCommonList list = res.getEntity();
-        Assert.assertEquals(1, list.getAccountListItem().size());
-        // Optionally output additional data about list members for debugging.
-        boolean iterateThroughList = true;
-        if (iterateThroughList && logger.isDebugEnabled()) {
-            printList(testName, list);
+        ClientResponse<AccountsCommonList> res = client.readSearchList("tom", null, "jerry");
+        try {
+               assertStatusCode(res, testName);
+               AccountsCommonList list = res.getEntity();
+               Assert.assertEquals(1, list.getAccountListItem().size());
+               // Optionally output additional data about list members for debugging.
+               boolean iterateThroughList = true;
+               if (iterateThroughList && logger.isDebugEnabled()) {
+                   printList(testName, list);
+               }
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
     }
 
-    // Failure outcomes
-    // None at present.
     // ---------------------------------------------------------------
     // CRUD tests : UPDATE tests
     // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read", "readList", "readNonExistent"})
-    public void update(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdate();
-
-        AccountClient client = new AccountClient();
-        ClientResponse<AccountsCommon> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("got object to update with ID: " + knownResourceId);
-        }
-        AccountsCommon accountFound =
-                (AccountsCommon) res.getEntity();
-        Assert.assertNotNull(accountFound);
-
-        //create a new account object to test partial updates
-        AccountsCommon accountToUpdate = new AccountsCommon();
-        accountToUpdate.setCsid(knownResourceId);
-        accountToUpdate.setUserId(accountFound.getUserId());
-        // Update the content of this resource.
-        accountToUpdate.setEmail("updated-" + accountFound.getEmail());
-        if (logger.isDebugEnabled()) {
-            logger.debug("updated object");
-            logger.debug(objectAsXmlString(accountFound,
-                    AccountsCommon.class));
-        }
-
-        // Submit the request to the service and store the response.
-        res = client.update(knownResourceId, accountToUpdate);
-        assertStatusCode(res, testName);
-
-        AccountsCommon accountUpdated = (AccountsCommon) res.getEntity();
-        Assert.assertNotNull(accountUpdated);
-
-        Assert.assertEquals(accountUpdated.getEmail(),
-                accountToUpdate.getEmail(),
-                "Data in updated object did not match submitted data.");
-    }
 
     /**
      * Update password.
@@ -726,19 +505,17 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"update"})
+    @Test(dataProvider = "testName", dependsOnMethods = {"CRUDTests"})
     public void updatePassword(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupUpdate();
 
         AccountClient client = new AccountClient();
         ClientResponse<AccountsCommon> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
+        if (logger.isDebugEnabled()) {
+            logger.debug(testName + ": read status = " + res.getStatus());
+        }
+        Assert.assertEquals(res.getStatus(), testExpectedStatusCode);
 
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": got object to update password with ID: " + knownResourceId);
@@ -761,7 +538,14 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
 
         // Submit the request to the service and store the response.
         res = client.update(knownResourceId, accountToUpdate);
-        assertStatusCode(res, testName);
+        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);
 
         AccountsCommon accountUpdated = (AccountsCommon) res.getEntity();
         Assert.assertNotNull(accountUpdated);
@@ -777,13 +561,8 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"update"})
+    @Test(dataProvider = "testName", dependsOnMethods = {"CRUDTests"})
     public void updatePasswordWithoutUser(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupUpdate();
 
@@ -806,8 +585,8 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
 
     }
@@ -818,18 +597,16 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"update"})
+    @Test(dataProvider = "testName", dependsOnMethods = {"CRUDTests"})
     public void updateInvalidPassword(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupUpdate();
         AccountClient client = new AccountClient();
         ClientResponse<AccountsCommon> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
+        if (logger.isDebugEnabled()) {
+            logger.debug(testName + ": read status = " + res.getStatus());
+        }
+        Assert.assertEquals(res.getStatus(), testExpectedStatusCode);
 
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": got object to update password with ID: " + knownResourceId);
@@ -856,45 +633,53 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
-
     }
     
     private void findPrebuiltAdminAccount() {
        // Search for the prebuilt admin user and then hold its CSID
-       if(prebuiltAdminCSID == null) {
+       if (prebuiltAdminCSID == null) {
             setupReadList();
             AccountClient client = new AccountClient();
             ClientResponse<AccountsCommonList> res =
                     client.readSearchList(null, this.prebuiltAdminUserId, null);
-            assertStatusCode(res, "findPrebuiltAdminAccount");
-            AccountsCommonList list = res.getEntity();
-            List<AccountListItem> items = list.getAccountListItem();
-            Assert.assertEquals(1, items.size(), "Found more than one Admin account!");
-            AccountListItem item = items.get(0);
-            prebuiltAdminCSID = item.getCsid();
-            if (logger.isDebugEnabled()) {
-                logger.debug("Found Admin Account with ID: " + prebuiltAdminCSID);
+            try {
+                   assertStatusCode(res, "findPrebuiltAdminAccount");
+                   AccountsCommonList list = res.getEntity();
+                   List<AccountListItem> items = list.getAccountListItem();
+                   Assert.assertEquals(1, items.size(), "Found more than one Admin account!");
+                   AccountListItem item = items.get(0);
+                   prebuiltAdminCSID = item.getCsid();
+                   if (logger.isDebugEnabled()) {
+                       logger.debug("Found Admin Account with ID: " + prebuiltAdminCSID);
+                   }
+            } finally {
+               if (res != null) {
+                    res.releaseConnection();
+                }
             }
        }
     }
     
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-               dependsOnMethods = {"read", "readList", "readNonExistent"})
+    @Test(dataProvider = "testName", dependsOnMethods = {"CRUDTests"})
        public void verifyMetadataProtection(String testName) throws Exception {
        findPrebuiltAdminAccount();
        // Try to update the metadata - it should just get ignored
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupUpdate();
 
         AccountClient client = new AccountClient();
         ClientResponse<AccountsCommon> res = client.read(prebuiltAdminCSID);
-        assertStatusCode(res, testName);
+        if (logger.isDebugEnabled()) {
+            logger.debug(testName + ": read status = " + res.getStatus());
+        }
+        Assert.assertEquals(res.getStatus(), testExpectedStatusCode);
+
+        if (logger.isDebugEnabled()) {
+            logger.debug("Did get on Admin Account to update with ID: " + prebuiltAdminCSID);
+        }
         AccountsCommon accountFound = (AccountsCommon) res.getEntity();
         Assert.assertNotNull(accountFound);
 
@@ -913,14 +698,15 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         // Submit the request to the service and store the response.
         res = client.update(prebuiltAdminCSID, accountToUpdate);
         int statusCode = res.getStatus();
-
-        // Comment below was not understood - but preserved in case it is
-        // important - during work on CSPACE-4572, which replaced several
-        // lines of status code checking with the call below.
-        //
+        // 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));
         // Note that the error is not returned, it is just ignored
-        assertStatusCode(res, testName);
-        
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
+
         AccountsCommon accountUpdated = (AccountsCommon) res.getEntity();
         Assert.assertNotNull(accountUpdated);
 
@@ -929,103 +715,104 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
     }
     
     
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-               dependsOnMethods = {"read", "readList", "readNonExistent"})
+    @Test(dataProvider = "testName", dependsOnMethods = {"CRUDTests"})
        public void verifyProtectionReadOnly(String testName) throws Exception {
-
-       if (logger.isDebugEnabled()) {
-               logger.debug(testBanner(testName, CLASS_NAME));
-       }
-       
         setupCreate();
 
         // Submit the request to the service and store the response.
         AccountClient client = new AccountClient();
-        AccountsCommon account = 
-               createAccountInstance("mdTest", "mdTest", "mdTestPW", "md@test.com", 
+        AccountsCommon account = createAccountInstance("mdTest", "mdTest", "mdTestPW", "md@test.com", 
                                client.getTenantId(), true, false, true, true);
         account.setMetadataProtection(AccountClient.IMMUTABLE);
         account.setRolesProtection(AccountClient.IMMUTABLE);
         ClientResponse<Response> res = client.create(account);
-        int statusCode = res.getStatus();
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
-        // Store the ID returned from this create operation
-        // for additional tests below.
-        String testResourceId = extractId(res);
-        allResourceIdsCreated.add(testResourceId);
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": testResourceId=" + testResourceId);
+        String testResourceId = null;
+        try {
+               assertStatusCode(res, testName);
+               // Store the ID returned from this create operation
+               // for additional tests below.
+               testResourceId = extractId(res);
+               allResourceIdsCreated.add(testResourceId);
+               if (logger.isDebugEnabled()) {
+                   logger.debug(testName + ": testResourceId=" + testResourceId);
+               }
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
+        
         setupRead();
 
         // Submit the request to the service and store the response.
         ClientResponse<AccountsCommon> accountRes = client.read(testResourceId);
-        assertStatusCode(accountRes, testName);
-
-        AccountsCommon accountRead = (AccountsCommon) accountRes.getEntity();
-        Assert.assertNotNull(accountRead);
-        String mdProtection = accountRead.getMetadataProtection();
-        String rolesProtection = accountRead.getRolesProtection();
-        if (logger.isTraceEnabled()) {
-            logger.trace(testName + ": metadataProtection=" + mdProtection);
-            logger.trace(testName + ": rolesProtection=" + rolesProtection);
+        try {
+               assertStatusCode(accountRes, testName);
+               AccountsCommon accountRead = (AccountsCommon) accountRes.getEntity();
+               Assert.assertNotNull(accountRead);
+               String mdProtection = accountRead.getMetadataProtection();
+               String rolesProtection = accountRead.getRolesProtection();
+               if (logger.isTraceEnabled()) {
+                   logger.trace(testName + ": metadataProtection=" + mdProtection);
+                   logger.trace(testName + ": rolesProtection=" + rolesProtection);
+               }
+               Assert.assertFalse(account.getMetadataProtection().equals(mdProtection),
+                               "Account allowed create to set the metadata protection flag.");
+               Assert.assertFalse(account.getRolesProtection().equals(rolesProtection),
+                               "Account allowed create to set the perms protection flag.");
+        } finally {
+               if (accountRes != null) {
+                       accountRes.releaseConnection();
+            }
         }
-       Assert.assertFalse(account.getMetadataProtection().equals(mdProtection),
-                       "Account allowed create to set the metadata protection flag.");
-       Assert.assertFalse(account.getRolesProtection().equals(rolesProtection),
-                       "Account allowed create to set the perms protection flag.");
         
        setupUpdate();
 
-       AccountsCommon accountToUpdate = 
-                       createAccountInstance("mdTest", "mdTest", "mdTestPW", "md@test.com", 
+       AccountsCommon accountToUpdate = createAccountInstance("mdTest", "mdTest", "mdTestPW", "md@test.com", 
                                        client.getTenantId(), true, false, true, true);
        accountToUpdate.setMetadataProtection(AccountClient.IMMUTABLE);
        accountToUpdate.setRolesProtection(AccountClient.IMMUTABLE);
 
        // Submit the request to the service and store the response.
        accountRes = client.update(testResourceId, accountToUpdate);
-        assertStatusCode(accountRes, testName);
-
-       AccountsCommon accountUpdated = (AccountsCommon) accountRes.getEntity();
-       Assert.assertNotNull(accountUpdated);
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + "Updated account: ");
-            logger.debug(objectAsXmlString(accountUpdated,AccountsCommon.class));
-        }
-
-       Assert.assertFalse(
-                       AccountClient.IMMUTABLE.equalsIgnoreCase(accountUpdated.getMetadataProtection()),
-                       "Account allowed update of the metadata protection flag.");
-       Assert.assertFalse(
-                       AccountClient.IMMUTABLE.equalsIgnoreCase(accountUpdated.getRolesProtection()),
-                       "Account allowed update of the roles protection flag.");
+       try {
+               assertStatusCode(accountRes, testName);
+               AccountsCommon accountUpdated = (AccountsCommon) accountRes.getEntity();
+               Assert.assertNotNull(accountUpdated);
+               if (logger.isDebugEnabled()) {
+                   logger.debug(testName + "Updated account: ");
+                   logger.debug(objectAsXmlString(accountUpdated,AccountsCommon.class));
+               }
+               Assert.assertFalse(
+                               AccountClient.IMMUTABLE.equalsIgnoreCase(accountUpdated.getMetadataProtection()),
+                               "Account allowed update of the metadata protection flag.");
+               Assert.assertFalse(
+                               AccountClient.IMMUTABLE.equalsIgnoreCase(accountUpdated.getRolesProtection()),
+                               "Account allowed update of the roles protection flag.");
+       } finally {
+               if (accountRes != null) {
+                       accountRes.releaseConnection();
+            }
+       }
     }
 
-
-
     /**
      * Deactivate.
      *
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"updatePasswordWithoutUser"})
+    @Test(dataProvider = "testName", dependsOnMethods = {"updatePasswordWithoutUser"})
     public void deactivate(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupUpdate();
 
         AccountClient client = new AccountClient();
         ClientResponse<AccountsCommon> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
+        if (logger.isDebugEnabled()) {
+            logger.debug(testName + ": read status = " + res.getStatus());
+        }
+        Assert.assertEquals(res.getStatus(), testExpectedStatusCode);
 
         if (logger.isDebugEnabled()) {
             logger.debug("got object to update with ID: " + knownResourceId);
@@ -1047,7 +834,14 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
 
         // Submit the request to the service and store the response.
         res = client.update(knownResourceId, accountToUpdate);
-        assertStatusCode(res, testName);
+        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);
 
         AccountsCommon accountUpdated = (AccountsCommon) res.getEntity();
         Assert.assertNotNull(accountUpdated);
@@ -1055,7 +849,6 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         Assert.assertEquals(accountUpdated.getStatus(),
                 accountToUpdate.getStatus(),
                 "Data in updated object did not match submitted data.");
-
     }
 
     // Failure outcomes
@@ -1085,17 +878,9 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         //FIXME: Should this test really be empty?  If so, please comment accordingly.
     }
 
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
-     */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"deactivate", "readNonExistent", "testSubmitRequest"})
+    @Test(dataProvider = "testName", dependsOnMethods = {"deactivate", "CRUDTests"})
     public void updateNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupUpdateNonExistent();
 
@@ -1116,9 +901,9 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
 
     /**
@@ -1127,13 +912,8 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"deactivate", "readNonExistent", "testSubmitRequest"})
+    @Test(dataProvider = "testName", dependsOnMethods = {"deactivate", "CRUDTests"})
     public void updateWrongUser(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         setupUpdate();
 
         // Submit the request to the service and store the response.
@@ -1142,7 +922,10 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         // The only relevant ID may be the one used in updateAccount(), below.
         AccountClient client = new AccountClient();
         ClientResponse<AccountsCommon> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
+        if (logger.isDebugEnabled()) {
+            logger.debug(testName + ": read status = " + res.getStatus());
+        }
+        Assert.assertEquals(res.getStatus(), testExpectedStatusCode);
 
         if (logger.isDebugEnabled()) {
             logger.debug("got object to update with ID: " + knownResourceId);
@@ -1166,8 +949,8 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
     }
 
@@ -1175,101 +958,23 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
     // CRUD tests : DELETE tests
     // ---------------------------------------------------------------
     // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"testSubmitRequest", "updateWrongUser"})
-    public void delete(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDelete();
-
-        // Submit the request to the service and store the response.
-        AccountClient client = new AccountClient();
-        ClientResponse<Response> res = client.delete(knownResourceId);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    // Failure outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"delete"})
-    public void deleteNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDeleteNonExistent();
-
-        // Submit the request to the service and store the response.
-        AccountClient client = new AccountClient();
-        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    // ---------------------------------------------------------------
-    // Search tests
-    // ---------------------------------------------------------------
     
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
-    public void searchWorkflowDeleted(String testName) throws Exception {
-        // Fixme: null test for now, overriding test in base class
+    public void delete(String testName) throws Exception {
+       // Do nothing because this test is not ready to delete the "knownResourceId".
+       // Instead, the method localDelete() will get called later in the dependency chain. The
+       // method localDelete() has a dependency on the test "updateWrongUser".  Once the "updateWrongUser"
+       // test is run, the localDelete() test/method will get run.  The localDelete() test/method in turn
+       // calls the inherited delete() test/method.
     }
     
-    // ---------------------------------------------------------------
-    // Utility tests : tests of code used in tests above
-    // ---------------------------------------------------------------
-    /**
-     * Tests the code for manually submitting data that is used by several
-     * of the methods above.
-     * @throws Exception 
-     */
-    @Test(dependsOnMethods = {"create", "read"})
-    public void testSubmitRequest() throws Exception {
-
-        setupRead();
-
-        // Submit the request to the service and store the response.
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getResourceURL(knownResourceId);
-        int statusCode = submitRequest(method, url);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug("testSubmitRequest: url=" + url
-                    + " status=" + statusCode);
-        }
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
+    @Test(dataProvider = "testName", dependsOnMethods = {"CRUDTests", "updateWrongUser"})
+    public void localDelete(String testName) throws Exception {
+       // Because of issues with TestNG not allowing @Test annotations on on override methods,
+       // and because we want the "updateWrongUser" to run before the "delete" test, we need
+       // this method.  This method will call super.delete() after all the dependencies have been
+       // met.
+       super.delete(testName);
     }
 
     // ---------------------------------------------------------------
@@ -1299,8 +1004,8 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
             logger.debug(objectAsXmlString(account,
                     AccountsCommon.class));
         }
+        
         return account;
-
     }
 
 
@@ -1310,11 +1015,12 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
      * @param testName the test name
      * @param list the list
      */
-    private void printList(String testName, AccountsCommonList list) {
+    @Override
+    protected void printList(String testName, AccountsCommonList list) {
+       AccountsCommonList acl = (AccountsCommonList)list;
         List<AccountListItem> items =
-                list.getAccountListItem();
+                acl.getAccountListItem();
         int i = 0;
-
         for (AccountListItem item : items) {
             logger.debug(testName + ": list-item[" + i + "] csid="
                     + item.getCsid());
@@ -1323,7 +1029,49 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
             logger.debug(testName + ": list-item[" + i + "] URI="
                     + item.getUri());
             i++;
-
         }
     }
+
+       @Override
+       protected AccountsCommon createInstance(String commonPartName,
+                       String identifier) {
+               AccountClient client = new AccountClient();
+        AccountsCommon account =
+                createAccountInstance(knownUserId, knownUserId, knownUserPassword,
+                "barney@dinoland.com", client.getTenantId(),
+                true, false, true, true);
+        return account;
+       }
+
+    /*
+     * For convenience and terseness, this test method is the base of the test execution dependency chain.  Other test methods may
+     * refer to this method in their @Test annotation declarations.
+     */
+    @Override
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {
+                       "org.collectionspace.services.client.test.AbstractServiceTestImpl.baseCRUDTests"})    
+    public void CRUDTests(String testName) {
+       // Do nothing.  Simply here to for a TestNG execution order for our tests
+    }
+
+       @Override
+       protected AccountsCommon updateInstance(AccountsCommon accountsCommon) {
+               AccountsCommon result = new AccountsCommon();
+               
+               result.setCsid(knownResourceId);
+               result.setUserId(accountsCommon.getUserId());
+        // Update the content of this resource.
+               result.setEmail("updated-" + accountsCommon.getEmail());
+               
+               return result;
+       }
+
+       @Override
+       protected void compareUpdatedInstances(AccountsCommon original,
+                       AccountsCommon updated) throws Exception {
+        Assert.assertEquals(original.getEmail(), updated.getEmail(),
+                "Data in updated object did not match submitted data.");
+       }
+       
 }
index 1f6ff42027f2469c7420789c18df51b5aafd7eed..98d1b6463527caaf8ca56cd9237cd777d0ce40af 100644 (file)
@@ -11,7 +11,6 @@ import java.util.List;
 import java.util.UUID;
 import javax.persistence.EntityManager;
 import javax.persistence.EntityManagerFactory;
-import javax.persistence.NoResultException;
 import javax.persistence.Persistence;
 
 import javax.persistence.Query;
@@ -23,7 +22,6 @@ import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
@@ -42,13 +40,8 @@ public class AccountTest {
 
     @BeforeMethod
     public void init() {
-
         emf = Persistence.createEntityManagerFactory("org.collectionspace.services.account");
-
         em = emf.createEntityManager();
-//        if (logger.isDebugEnabled()) {
-//            logger.debug("created entity manager");
-//        }
     }
 
     @AfterMethod
@@ -58,7 +51,6 @@ public class AccountTest {
         }
     }
 
-
     @SuppressWarnings("unchecked")
     @Test(dataProvider = "testName", dataProviderClass = AccountTest.class)
     public void create(String testName) throws Exception {
index 048ea2106ba6a7a2bb67faa86adaa87e2dbdd21e..2e6a479230c11568b7bbdded05ef885ff1c7b1c7 100644 (file)
@@ -9,7 +9,6 @@
     </parent>
 
     <modelVersion>4.0.0</modelVersion>
-    <groupId>org.collectionspace.services</groupId>
     <artifactId>org.collectionspace.services.account.jaxb</artifactId>
     <name>services.account.jaxb</name>
 
             <groupId>org.jvnet.hyperjaxb3</groupId>
             <artifactId>hyperjaxb3-ejb-runtime</artifactId>
         </dependency>
+        <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.jaxb</artifactId>
+                       <version>${project.version}</version>
+        </dependency>
         <dependency>
                        <groupId>org.collectionspace.services</groupId>
                        <artifactId>org.collectionspace.services.hyperjaxb</artifactId>
index eab81edd6660a8de028f2dbc63f2d6c5ec0143a8..be8385a37fef64bd0c71cc13568c79114bf54e89 100644 (file)
     <xs:complexType name="abstractCommonList">
         <xs:annotation>
             <xs:appinfo>
-                <jaxb:class ref="org.collectionspace.services.hyperjaxb.AbstractCommonList"/>
+                <jaxb:class ref="org.collectionspace.services.jaxb.AbstractCommonList"/>
             </xs:appinfo>
         </xs:annotation>
     </xs:complexType>
index cfa12508c18da92f41f7bdb1e9f404370ad473bb..e46830595279766ecc70996dbff62d64a6f27c0f 100644 (file)
@@ -66,7 +66,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>\r
 \r
         <!-- apache -->\r
index 7eb1d1c79f94548555cc1ea328d838d3f11bc9e2..0fb156387b30cafb1c4ed63a8d28d05a6a2c0ff7 100644 (file)
@@ -57,7 +57,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>\r
         <dependency>\r
             <groupId>org.jboss.resteasy</groupId>\r
index e85fad7dd6e9dca4ed13c84d1c35dfcc4eed1711..02eaa352b82c4f7f07d493068a6db19c6deacd05 100644 (file)
@@ -1,14 +1,8 @@
 package org.collectionspace.services.client;
 
 import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-
-import org.collectionspace.services.client.workflow.WorkflowClient;
-import org.collectionspace.services.jaxb.AbstractCommonList;
-import org.jboss.resteasy.client.ClientResponse;
 
 /**
  * @version $Revision:$
index 21042281aa6a15c5716e4248875af82dc967b8fe..a71c0297d0d3803880050c33b39a64198f60c7f3 100644 (file)
@@ -27,7 +27,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
 import org.collectionspace.services.PersonJAXBSchema;
@@ -48,7 +47,6 @@ import org.collectionspace.services.acquisition.OwnerList;
 
 import org.jboss.resteasy.client.ClientResponse;
 
-import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
@@ -63,7 +61,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision: 1327 $
  * $LastChangedDate: 2010-02-12 10:35:11 -0800 (Fri, 12 Feb 2010) $
  */
-public class AcquisitionAuthRefsTest extends BaseServiceTest {
+public class AcquisitionAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
 
        private final String CLASS_NAME = AcquisitionAuthRefsTest.class.getName();
        private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
@@ -93,7 +91,7 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest {
         * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
         */
        @Override
-       protected AbstractCommonList getAbstractCommonList(
+       protected AbstractCommonList getCommonList(
                        ClientResponse<AbstractCommonList> response) {
                throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
        }
@@ -104,11 +102,6 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest {
        // Success outcomes
        @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
        public void createWithAuthRefs(String testName) throws Exception {
-
-               if (logger.isDebugEnabled()) {
-                       logger.debug(testBanner(testName, CLASS_NAME));
-               };
-
                // Perform setup.
                testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
 
@@ -139,9 +132,9 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest {
                if(logger.isDebugEnabled()){
                        logger.debug(testName + ": status = " + statusCode);
                }
-               Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                               invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-               Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                               invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
 
                // Store the ID returned from the first resource created
                // for additional tests below.
@@ -164,8 +157,8 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest {
                ClientResponse<Response> res = personAuthClient.create(multipart);
                int statusCode = res.getStatus();
 
-               Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                               invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                               invalidStatusCodeMessage(testRequestType, statusCode));
                Assert.assertEquals(statusCode, STATUS_CREATED);
                personAuthCSID = extractId(res);
 
@@ -214,8 +207,8 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest {
                ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
                int statusCode = res.getStatus();
 
-               Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                               invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                               invalidStatusCodeMessage(testRequestType, statusCode));
                Assert.assertEquals(statusCode, STATUS_CREATED);
                return extractId(res);
        }
@@ -224,23 +217,26 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest {
        @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
                        dependsOnMethods = {"createWithAuthRefs"})
                        public void readAndCheckAuthRefs(String testName) throws Exception {
-
-               if (logger.isDebugEnabled()) {
-                       logger.debug(testBanner(testName, CLASS_NAME));
-               };
-
                // Perform setup.
                testSetup(STATUS_OK, ServiceRequestType.READ);
 
                // Submit the request to the service and store the response.
                AcquisitionClient acquisitionClient = new AcquisitionClient();
                ClientResponse<String> res = acquisitionClient.read(knownResourceId);
-        assertStatusCode(res, testName);
-
-               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-               AcquisitionsCommon acquisition = (AcquisitionsCommon) extractPart(input,
-                               acquisitionClient.getCommonPartName(), AcquisitionsCommon.class);
-               Assert.assertNotNull(acquisition);
+               AcquisitionsCommon acquisition = null;
+               try {
+                       // Check the status code of the response: does it match
+                       // the expected response(s)?
+                       assertStatusCode(res, testName);
+                       PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+                       acquisition = (AcquisitionsCommon) extractPart(input,
+                                       acquisitionClient.getCommonPartName(), AcquisitionsCommon.class);
+                       Assert.assertNotNull(acquisition);
+               } finally {
+                       if (res != null) {
+                res.releaseConnection();
+            }
+               }
 
                // Check a couple of fields
                // Scalar fields
@@ -270,17 +266,24 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest {
                for (String refName : sources) {
                        Assert.assertTrue(acquisitionSourcesRefNames.contains(refName));
                }
-
+               //
                // Get the auth refs and check them
-               ClientResponse<AuthorityRefList> res2 =
-                       acquisitionClient.getAuthorityRefs(knownResourceId);
-                assertStatusCode(res2, testName);
-        
-               AuthorityRefList list = res2.getEntity();
+               //
+               ClientResponse<AuthorityRefList> res2 = acquisitionClient.getAuthorityRefs(knownResourceId);
+               AuthorityRefList list = null;
+               try {
+                       assertStatusCode(res2, testName);
+                       list = res2.getEntity();
+                       Assert.assertNotNull(list);
+               } finally {
+                       if (res2 != null) {
+                               res2.releaseConnection();
+            }
+               }
 
                List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
                int numAuthRefsFound = items.size();
-               if(logger.isDebugEnabled()){
+               if (logger.isDebugEnabled()){
                        logger.debug("Expected " + NUM_AUTH_REFS_EXPECTED +
                                        " authority references, found " + numAuthRefsFound);
                }
@@ -408,11 +411,10 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest {
                }
                acquisition.setAcquisitionSources(acqSourcesList);
 
+               AcquisitionClient acquisitionClient = new AcquisitionClient();
                PoxPayloadOut multipart = new PoxPayloadOut(AcquisitionClient.SERVICE_PAYLOAD_NAME);
                PayloadOutputPart commonPart =
-                       multipart.addPart(acquisition, MediaType.APPLICATION_XML_TYPE);
-               AcquisitionClient acquisitionClient = new AcquisitionClient();
-               commonPart.setLabel(acquisitionClient.getCommonPartName());
+                       multipart.addPart(acquisitionClient.getCommonPartName(), acquisition);
 
                if(logger.isDebugEnabled()){
                        logger.debug("to be created, acquisition common");
index bdd1804eaebab10dc11bf0990164e4513463ef98..06b8d6c3d6f83df6c702d2871abe389ad2d1eb4b 100644 (file)
@@ -26,12 +26,12 @@ import java.util.List;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
+import org.collectionspace.services.client.AbstractCommonListUtils;
 import org.collectionspace.services.client.AcquisitionClient;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
-import org.collectionspace.services.common.AbstractCommonListUtils;
 import org.collectionspace.services.common.datetime.GregorianCalendarDateTimeUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 
@@ -54,25 +54,21 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision: 621 $
  * $LastChangedDate: 2009-09-02 16:49:01 -0700 (Wed, 02 Sep 2009) $
  */
-public class AcquisitionServiceTest extends AbstractServiceTestImpl {
+public class AcquisitionServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonList, AcquisitionsCommon> {
 
     /** The logger. */
     private final String CLASS_NAME = AcquisitionServiceTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
 
     // Instance variables specific to this test.
-    /** The known resource id. */
-    private String knownResourceId = null;
     private final static String CURRENT_DATE_UTC =
             GregorianCalendarDateTimeUtils.timestampUTC();
 
-
     @Override
     public String getServicePathComponent() {
         return AcquisitionClient.SERVICE_PATH_COMPONENT;
     }
 
-
     @Override
     protected String getServiceName() {
         return AcquisitionClient.SERVICE_NAME;
@@ -94,13 +90,8 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
      */
     @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
+//    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
     public void create(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        
         // Perform setup, such as initializing the type of service request
         // (e.g. CREATE, DELETE), its valid and expected status codes, and
         // its associated HTTP method name (e.g. POST, DELETE).
@@ -124,9 +115,9 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
         if(logger.isDebugEnabled()){
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
 
         // Store the ID returned from the first resource created
         // for additional tests below.
@@ -146,8 +137,8 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
      */
     @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-       dependsOnMethods = {"create"})
+//    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+//       dependsOnMethods = {"create"})
     public void createList(String testName) throws Exception {
         for(int i = 0; i < 3; i++){
             create(testName);
@@ -166,11 +157,8 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
     // Verify that record creation occurs successfully when there is NO whitespace
     // between the acquisitionFunding tag and its first child element tag
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-        dependsOnMethods = {"create", "testSubmitRequest"}, groups = {"cspace2578group"})
+        dependsOnMethods = {"CRUDTests"}, groups = {"cspace2578group"})
     public void createFromXmlNoWhitespaceAfterRepeatableGroupTag(String testName) throws Exception {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         String testDataDir = System.getProperty("test-data.fileName");
         String newId =
             createFromXmlFile(testName, testDataDir + "/cspace-2578-no-whitespace.xml", false);
@@ -185,11 +173,8 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
     // fixes, and also after the issue is resolved, to help detect any regressions.
 
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-        dependsOnMethods = {"create", "testSubmitRequest"}, groups = {"cspace2578group"})
+        dependsOnMethods = {"CRUDTests"}, groups = {"cspace2578group"})
     public void createFromXmlWhitespaceAfterRepeatableGroupTag(String testName) throws Exception {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         String testDataDir = System.getProperty("test-data.fileName");
         String newId =
             createFromXmlFile(testName, testDataDir + "/cspace-2578-whitespace.xml", false);
@@ -293,14 +278,9 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
      */
     @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        dependsOnMethods = {"create"})
+//    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+//        dependsOnMethods = {"create"})
     public void read(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        
         // Perform setup.
         setupRead();
 
@@ -315,9 +295,9 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
         if(logger.isDebugEnabled()){
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
 
         PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
         AcquisitionsCommon acquisitionObject = (AcquisitionsCommon) extractPart(input,
@@ -347,14 +327,9 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
      */
     @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        dependsOnMethods = {"read"})
+//    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+//        dependsOnMethods = {"read"})
     public void readNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-
         // Perform setup.
         setupReadNonExistent();
 
@@ -368,9 +343,9 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
         if(logger.isDebugEnabled()){
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
 
     // ---------------------------------------------------------------
@@ -381,28 +356,30 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
      */
     @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        dependsOnMethods = {"createList", "read"})
+//    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+//        dependsOnMethods = {"createList", "read"})
     public void readList(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        
         // Perform setup.
         setupReadList();
 
         // Submit the request to the service and store the response.
         AcquisitionClient client = new AcquisitionClient();
         ClientResponse<AbstractCommonList> res = client.readList();
-        assertStatusCode(res, testName);
-        AbstractCommonList list = res.getEntity();
-
-        // Optionally output additional data about list members for debugging.
-        if(logger.isTraceEnabled()){
-               AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
+        try {
+               // Check the status code of the response: does it match
+               // the expected response(s)?
+               assertStatusCode(res, testName);
+               AbstractCommonList list = res.getEntity();
+       
+               // Optionally output additional data about list members for debugging.
+               if (logger.isTraceEnabled() == true){
+                       AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
+               }
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-
     }
     
     // Failure outcomes
@@ -417,21 +394,19 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
      */
     @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        dependsOnMethods = {"read"})
+//    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+//        dependsOnMethods = {"read"})
     public void update(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        
         // Perform setup.
         setupUpdate();
 
         // Retrieve the contents of a resource to update.
         AcquisitionClient client = new AcquisitionClient();
         ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
+        if(logger.isDebugEnabled()){
+            logger.debug(testName + ": read status = " + res.getStatus());
+        }
+        Assert.assertEquals(res.getStatus(), testExpectedStatusCode);
 
         PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
 
@@ -452,7 +427,13 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
 
         res = client.update(knownResourceId, output);
         int statusCode = res.getStatus();
-        assertStatusCode(res, testName);
+        // 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);
 
         input = new PoxPayloadIn(res.getEntity());
         AcquisitionsCommon updatedAcquisition =
@@ -615,14 +596,9 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
      */
     @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        dependsOnMethods = {"update", "testSubmitRequest"})
+//    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+//        dependsOnMethods = {"update", "testSubmitRequest"})
     public void updateNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        
         // Perform setup.
         setupUpdateNonExistent();
 
@@ -640,9 +616,9 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
         if(logger.isDebugEnabled()){
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
 
     // ---------------------------------------------------------------
@@ -653,14 +629,9 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
      */
     @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        dependsOnMethods = {"create", "read", "update"})
+//    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+//        dependsOnMethods = {"create", "read", "update"})
     public void delete(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        
         // Perform setup.
         setupDelete();
 
@@ -674,9 +645,9 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
         if(logger.isDebugEnabled()){
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
 
     // Failure outcomes
@@ -684,14 +655,9 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
      */
     @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        dependsOnMethods = {"delete"})
+//    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+//        dependsOnMethods = {"delete"})
     public void deleteNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        
         // Perform setup.
         setupDeleteNonExistent();
 
@@ -705,54 +671,14 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
         if(logger.isDebugEnabled()){
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
 
     // ---------------------------------------------------------------
     // Utility tests : tests of code used in tests above
     // ---------------------------------------------------------------
-    /**
-     * Tests the code for manually submitting data that is used by several
-     * of the methods above.
-     * @throws Exception
-     */
-
-    @Test(dependsOnMethods = {"create", "read"})
-    public void testSubmitRequest() throws Exception {
-        testSubmitRequest(knownResourceId);
-    }
-
-    /**
-     * Test submit request.
-     *
-     * @param resourceId the resource id
-     * @throws Exception the exception
-     */
-    private void testSubmitRequest(String resourceId) throws Exception {
-
-        // Expected status code: 200 OK
-        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
-
-        // Submit the request to the service and store the response.
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getResourceURL(resourceId);
-        int statusCode = submitRequest(method, url);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug("testSubmitRequest: url=" + url
-                    + " status=" + statusCode);
-        }
-        Assert.assertEquals(statusCode, EXPECTED_STATUS);
-
-    }
-
-    // ---------------------------------------------------------------
-    // Utility methods used by tests above
-    // ---------------------------------------------------------------
 
     @Override
     protected PoxPayloadOut createInstance(String identifier) {
@@ -867,9 +793,9 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
         String newId = extractId(res);
         allResourceIdsCreated.add(newId);
         return newId;
@@ -912,20 +838,60 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
         // Submit the request to the service and store the response.
         AcquisitionClient client = new AcquisitionClient();
         ClientResponse<String> res = client.read(csid);
-        assertStatusCode(res, testName);
-
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": Reading Common part ...");
+        AcquisitionsCommon acquisition = null;
+        try {
+               // Check the status code of the response: does it match
+               // the expected response(s)?
+               assertStatusCode(res, testName);
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+       
+               if (logger.isDebugEnabled()) {
+                   logger.debug(testName + ": Reading Common part ...");
+               }
+               acquisition = (AcquisitionsCommon) extractPart(input,
+                       client.getCommonPartName(), AcquisitionsCommon.class);
+               Assert.assertNotNull(acquisition);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        AcquisitionsCommon acquisition =
-                (AcquisitionsCommon) extractPart(input,
-                client.getCommonPartName(), AcquisitionsCommon.class);
-        Assert.assertNotNull(acquisition);
 
         return acquisition;
      }
 
+
+       @Override
+       protected PoxPayloadOut createInstance(String commonPartName,
+                       String identifier) {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       protected AcquisitionsCommon updateInstance(
+                       AcquisitionsCommon commonPartObject) {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       protected void compareUpdatedInstances(AcquisitionsCommon original,
+                       AcquisitionsCommon updated) throws Exception {
+               // TODO Auto-generated method stub
+               
+       }
+
+    /*
+     * For convenience and terseness, this test method is the base of the test execution dependency chain.  Other test methods may
+     * refer to this method in their @Test annotation declarations.
+     */
+    @Override
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {
+                       "org.collectionspace.services.client.test.AbstractServiceTestImpl.baseCRUDTests"})    
+    public void CRUDTests(String testName) {
+       // Do nothing.  Simply here to for a TestNG execution order for our tests
+    }  
 }
 
index 87683a93f65720e2c85d436e0c3d4e4abeb67f49..201c23b246aa626437112c27f5e4578ee1fcf53f 100644 (file)
@@ -62,7 +62,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>\r
         <dependency>\r
             <groupId>org.jboss.resteasy</groupId>\r
index 0fc1fbe47af8d1461f8ac15f8515bd9f4951a77a..ba252373f882f85fcd3ba071042a43079866e60a 100644 (file)
@@ -37,7 +37,7 @@ import org.collectionspace.services.authorization.perms.PermissionsList;
 
  * @version $Revision:$
  */
-public class PermissionClient extends AbstractServiceClientImpl<PermissionsList, PermissionProxy> {
+public class PermissionClient extends AbstractServiceClientImpl<PermissionsList, Permission, Permission, PermissionProxy> {
        public static final String SERVICE_NAME = "authorization/permissions";
        public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;       
        public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
index 79dd99f8293212cca0492200c10971be099fda32..885572ef99294e0936d078a768480e27c5f3bc3b 100644 (file)
@@ -35,7 +35,7 @@ import org.collectionspace.services.authorization.PermissionRole;
 
  * @version $Revision:$
  */
-public class PermissionRoleClient extends AbstractServiceClientImpl<PermissionRole, PermissionRoleProxy> {
+public class PermissionRoleClient extends AbstractServiceClientImpl<PermissionRole, PermissionRole, PermissionRole, PermissionRoleProxy> {
        @Override
        public String getServiceName() {
                throw new UnsupportedOperationException(); //FIXME: REM - http://issues.collectionspace.org/browse/CSPACE-3497
@@ -104,4 +104,20 @@ public class PermissionRoleClient extends AbstractServiceClientImpl<PermissionRo
     public ClientResponse<Response> delete(String csid, PermissionRole permRole) {
        return getProxy().delete(csid, "delete", permRole);
     }
+
+       @Override
+       public ClientResponse<Response> create(PermissionRole payload) {
+               throw new UnsupportedOperationException(); //method not supported nor needed
+       }
+
+       @Override
+       public ClientResponse<PermissionRole> update(String csid,
+                       PermissionRole payload) {
+               throw new UnsupportedOperationException(); //method not supported nor needed
+       }
+
+       @Override
+       public ClientResponse<PermissionRole> readList() {
+               throw new UnsupportedOperationException(); //method not supported nor needed
+       }
 }
index 78d1f48de99caa1630b668506820b9433e1d98ca..6f477b8e27344a18e06c3a6dc91a7812cb7d4447 100644 (file)
@@ -39,7 +39,7 @@ import org.jboss.resteasy.client.ClientResponse;
 
  * @version $Revision:$
  */
-public class RoleClient extends AbstractServiceClientImpl<RolesList, RoleProxy> {
+public class RoleClient extends AbstractServiceClientImpl<RolesList, Role, Role, RoleProxy> {
        public static final String SERVICE_NAME = "authorization/roles";
        public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;       
        public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
index ad6f536a4d9f4b1131915a2351d85f9856a9d7cd..2633bca5c507321ffc173a85e0978cdb95b8d896 100644 (file)
 package org.collectionspace.services.client;
 
 import javax.ws.rs.core.Response;
-
-
-import org.collectionspace.services.authorization.PermissionRole;
-import org.jboss.resteasy.client.ProxyFactory;
-import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
 import org.jboss.resteasy.client.ClientResponse;
-import org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor;
-import org.jboss.resteasy.spi.ResteasyProviderFactory;
+import org.collectionspace.services.authorization.PermissionRole;
 
 // TODO: Auto-generated Javadoc
 /**
@@ -42,7 +36,7 @@ import org.jboss.resteasy.spi.ResteasyProviderFactory;
 
  * @version $Revision:$
  */
-public class RolePermissionClient extends AbstractServiceClientImpl<PermissionRole, RolePermissionProxy> {
+public class RolePermissionClient extends AbstractServiceClientImpl<PermissionRole, PermissionRole, PermissionRole, RolePermissionProxy> {
     @Override
     public String getServiceName() { 
        throw new UnsupportedOperationException(); //FIXME: REM - http://issues.collectionspace.org/browse/CSPACE-3498
@@ -109,4 +103,20 @@ public class RolePermissionClient extends AbstractServiceClientImpl<PermissionRo
     public ClientResponse<Response> delete(String csid, PermissionRole permRole) {
         return getProxy().delete(csid, "delete", permRole);
     }
+
+       @Override
+       public ClientResponse<Response> create(PermissionRole payload) {
+               throw new UnsupportedOperationException(); //method not supported nor needed
+       }
+
+       @Override
+       public ClientResponse<PermissionRole> update(String csid,
+                       PermissionRole payload) {
+               throw new UnsupportedOperationException(); //method not supported nor needed
+       }
+
+       @Override
+       public ClientResponse<PermissionRole> readList() {
+               throw new UnsupportedOperationException(); //method not supported nor needed
+       }
 }
index cf6a617606dc0f6d411adde46474ced649c33f78..39804c57f60ecd01a7895490884435648b4c8eb0 100644 (file)
@@ -28,7 +28,6 @@ import java.util.Hashtable;
 import java.util.List;
 import javax.ws.rs.core.Response;
 
-import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.authorization.perms.EffectType;
 import org.collectionspace.services.authorization.perms.Permission;
 import org.collectionspace.services.authorization.perms.PermissionAction;
@@ -65,16 +64,14 @@ import org.testng.annotations.BeforeClass;
  * $LastChangedRevision: 917 $
  * $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri, 06 Nov 2009) $
  */
-public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
+public class PermissionRoleServiceTest extends AbstractServiceTestImpl<PermissionRole, PermissionRole,
+               PermissionRole, PermissionRole> {
 
     /** The Constant logger. */
     private final static String CLASS_NAME = PermissionRoleServiceTest.class.getName();
     private final static Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+
     // Instance variables specific to this test.
-    /** The known resource id. */
-    private String knownResourceId = null;
-    /** The all resource ids created. */
-    private List<String> allResourceIdsCreated = new ArrayList<String>();
     final private static String TEST_MARKER = "_PermissionRoleServiceTest";
     final private static String TEST_SERVICE_NAME = "fakeservice";
     final private static String NO_REL_SUFFIX = "-no-rel";
@@ -152,8 +149,8 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-    protected AbstractCommonList getAbstractCommonList(
-            ClientResponse<AbstractCommonList> response) {
+    protected PermissionRole getCommonList(
+            ClientResponse<PermissionRole> response) {
         //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
         throw new UnsupportedOperationException();
     }
@@ -161,7 +158,6 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readPaginatedList(java.lang.String)
      */
-    @Test(dataProvider = "testName")
     @Override
     public void readPaginatedList(String testName) throws Exception {
         //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
@@ -175,13 +171,8 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
      */
 
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
     public void create(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-
         // Perform setup, such as initializing the type of service request
         // (e.g. CREATE, DELETE), its valid and expected status codes, and
         // its associated HTTP method name (e.g. POST, DELETE).
@@ -200,14 +191,11 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
             if (logger.isDebugEnabled()) {
                 logger.debug(testName + ": status = " + statusCode);
             }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-            res.releaseConnection();
-            // Store the ID returned from this create operation
-            // for additional tests below.
-            //this is is not important in case of this relationship
-            knownResourceId = extractId(res);
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
+            Assert.assertEquals(statusCode, testExpectedStatusCode);
+            
+            knownResourceId = extractId(res); //This is meaningless in this test, see getKnowResourceId() method for details
             if (logger.isDebugEnabled()) {
                 logger.debug(testName + ": knownResourceId=" + knownResourceId);
             }
@@ -223,8 +211,8 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"create"})
     public void createList(String testName) throws Exception {
         //Should this really be empty?
     }
@@ -264,13 +252,9 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"create"})
     public void read(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupRead();
 
@@ -280,7 +264,17 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
         try {
             res = client.read(
                     permValues.get(TEST_SERVICE_NAME + TEST_MARKER).getPermissionId());
-            assertStatusCode(res, testName);
+            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);
+
             PermissionRole output = (PermissionRole) res.getEntity();
             Assert.assertNotNull(output);
         } finally {
@@ -298,10 +292,6 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
     @Override
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
     public void readNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupReadNonExistent();
 
@@ -317,9 +307,9 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
             if (logger.isDebugEnabled()) {
                 logger.debug(testName + ": status = " + statusCode);
             }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
+            Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
             if (res != null) {
                 res.releaseConnection();
@@ -327,13 +317,9 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
         }
     }
 
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"CRUDTests"})
     public void readNoRelationship(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupRead();
 
@@ -343,8 +329,9 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
         try {
             res = client.read(
                     permValues.get(TEST_SERVICE_NAME + TEST_MARKER + NO_REL_SUFFIX).getPermissionId());
+            // Check the status code of the response: does it match
+            // the expected response(s)?
             assertStatusCode(res, testName);
-            
             PermissionRole output = (PermissionRole) res.getEntity();
 
             String sOutput = objectAsXmlString(output, PermissionRole.class);
@@ -367,8 +354,8 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
      */
 
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList", "read"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"createList", "read"})
     public void readList(String testName) throws Exception {
         //Should this really be empty?
     }
@@ -383,8 +370,8 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read", "readList", "readNonExistent"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"read", "readList", "readNonExistent"})
     public void update(String testName) throws Exception {
         //Should this really be empty?
     }
@@ -420,8 +407,8 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"readNonExistent", "testSubmitRequest"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"readNonExistent", "testSubmitRequest"})
     public void updateNonExistent(String testName) throws Exception {
         //Should this really be empty?
     }
@@ -434,13 +421,9 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"read"})
     public void delete(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupDelete();
 
@@ -461,9 +444,9 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
                        toDelete.getPermission().get(0).getPermissionId(), toDelete);
         try {
             int statusCode = res.getStatus();
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
+            Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
             if (res != null) {
                 res.releaseConnection();
@@ -491,9 +474,9 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
         res = client.delete(toDelete.getPermission().get(0).getPermissionId());
         try {
             int statusCode = res.getStatus();
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
+            Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
             res.releaseConnection();
         }
@@ -521,36 +504,11 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
         // Fixme: null test for now, overriding test in base class
     }
 
-    // ---------------------------------------------------------------
-    // Utility tests : tests of code used in tests above
-    // ---------------------------------------------------------------
-    /**
-     * Tests the code for manually submitting data that is used by several
-     * of the methods above.
-     * @throws Exception 
-     */
-    @Test(dependsOnMethods = {"create"})
-    public void testSubmitRequest() throws Exception { //FIXME: REM - This is testing /permissions not /permissions/permroles
-
-        // Expected status code: 200 OK
-        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
-
-        // Submit the request to the service and store the response.
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getResourceURL(permValues.get(TEST_SERVICE_NAME + TEST_MARKER).getPermissionId());
-        int statusCode = submitRequest(method, url);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug("testSubmitRequest: url=" + url
-                    + " status=" + statusCode);
-        }
-        Assert.assertEquals(statusCode, EXPECTED_STATUS);
-
-
+    @Override
+    protected String getKnowResourceId() {
+       return permValues.get(TEST_SERVICE_NAME + TEST_MARKER).getPermissionId();
     }
-
+    
     // ---------------------------------------------------------------
     // Utility methods used by tests above
     // ---------------------------------------------------------------
@@ -613,7 +571,7 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
      */
     private String createPermission(String resName, EffectType effect) {
         if (logger.isDebugEnabled()) {
-            logger.debug(testBanner("createPermission"));
+            logger.debug(getTestBanner("createPermission"));
         }
         setupCreate();
         PermissionClient permClient = new PermissionClient();
@@ -631,9 +589,9 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
                 logger.debug("createPermission: resName=" + resName
                         + " status = " + statusCode);
             }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
+            Assert.assertEquals(statusCode, testExpectedStatusCode);
             id = extractId(res);
         } finally {
             if (res != null) {
@@ -650,7 +608,7 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
      */
     private void deletePermission(String permId) {
         if (logger.isDebugEnabled()) {
-            logger.debug(testBanner("deletePermission"));
+            logger.debug(getTestBanner("deletePermission"));
         }
         setupDelete();
         PermissionClient permClient = new PermissionClient();
@@ -662,9 +620,9 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
                 logger.debug("deletePermission: delete permission id="
                         + permId + " status=" + statusCode);
             }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
+            Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
             res.releaseConnection();
         }
@@ -679,7 +637,7 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
      */
     private String createRole(String roleName) {
         if (logger.isDebugEnabled()) {
-            logger.debug(testBanner("createRole"));
+            logger.debug(getTestBanner("createRole"));
         }
         setupCreate();
         RoleClient roleClient = new RoleClient();
@@ -696,9 +654,9 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
                 logger.debug("createRole: name=" + roleName
                         + " status = " + statusCode);
             }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
+            Assert.assertEquals(statusCode, testExpectedStatusCode);
 
             id = extractId(res);
         } finally {
@@ -714,7 +672,7 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
      */
     private void deleteRole(String roleId) {
         if (logger.isDebugEnabled()) {
-            logger.debug(testBanner("deleteRole"));
+            logger.debug(getTestBanner("deleteRole"));
         }
         setupDelete();
         RoleClient roleClient = new RoleClient();
@@ -726,12 +684,48 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
                 logger.debug("deleteRole: delete role id=" + roleId
                         + " status=" + statusCode);
             }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
+            Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
             res.releaseConnection();
         }
     }
-    
+
+       @Override
+       protected PermissionRole createInstance(String commonPartName,
+                       String identifier) {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       protected PermissionRole updateInstance(PermissionRole commonPartObject) {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       protected void compareUpdatedInstances(PermissionRole original,
+                       PermissionRole updated) throws Exception {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       protected Class<PermissionRole> getCommonListType() {
+               return PermissionRole.class;
+       }
+
+    /*
+     * For convenience and terseness, this test method is the base of the test execution dependency chain.  Other test methods may
+     * refer to this method in their @Test annotation declarations.
+     */
+    @Override
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {
+                       "org.collectionspace.services.client.test.AbstractServiceTestImpl.baseCRUDTests"})    
+    public void CRUDTests(String testName) {
+       // Do nothing.  Simply here to for a TestNG execution order for our tests
+    }  
 }
index 01fcbf7001385574415b93d93196d21c4b96ad33..11b044f82023c1141bc04bc7a43cd6e9a0525b5e 100644 (file)
@@ -36,7 +36,6 @@ import org.collectionspace.services.authorization.perms.PermissionsList;
 import org.collectionspace.services.client.PermissionFactory;
 import org.collectionspace.services.client.test.AbstractServiceTestImpl;
 import org.collectionspace.services.client.test.ServiceRequestType;
-import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.jboss.resteasy.client.ClientResponse;
 
 import org.testng.Assert;
@@ -52,15 +51,14 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision: 917 $
  * $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri, 06 Nov 2009) $
  */
-public class PermissionServiceTest extends AbstractServiceTestImpl {
+public class PermissionServiceTest extends AbstractServiceTestImpl<PermissionsList, Permission,
+               Permission, Permission> {
 
     /** The Constant logger. */
     private final static String CLASS_NAME = PermissionServiceTest.class.getName();
     private final static Logger logger = LoggerFactory.getLogger(CLASS_NAME);
     
     // Instance variables specific to this test.
-    /** The known resource id. */
-    private String knownResourceId = null;
     private String knownResource = "accounts-test";
 
     @Override
@@ -84,78 +82,20 @@ public class PermissionServiceTest extends AbstractServiceTestImpl {
         return new PermissionClient();
     }
 
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
-     */
-    @Override
-    protected AbstractCommonList getAbstractCommonList(
-            ClientResponse<AbstractCommonList> response) {
-        //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
-        throw new UnsupportedOperationException();
-    }
-
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readPaginatedList(java.lang.String)
      */
-    @Test(dataProvider = "testName")
+//    @Test(dataProvider = "testName")
     @Override
     public void readPaginatedList(String testName) throws Exception {
         //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
     }
 
-    // ---------------------------------------------------------------
-    // CRUD tests : CREATE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
-     */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
-    public void create(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup, such as initializing the type of service request
-        // (e.g. CREATE, DELETE), its valid and expected status codes, and
-        // its associated HTTP method name (e.g. POST, DELETE).
-        setupCreate();
-
-        // Submit the request to the service and store the response.
-        List<PermissionAction> actions = PermissionFactory.createDefaultActions();
-        Permission permission = createPermissionInstance(knownResource,
-                "default permissions for account",
-                actions,
-                EffectType.PERMIT,
-                true,
-                true,
-                true);
-        PermissionClient client = new PermissionClient();
-        ClientResponse<Response> res = client.create(permission);
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        //
-        // Specifically:
-        // Does it fall within the set of valid status codes?
-        // Does it exactly match the expected status code?
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": status = " + statusCode);
-        }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
-        // Store the ID returned from this create operation
-        // for additional tests below.
-        knownResourceId = extractId(res);
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": knownResourceId=" + knownResourceId);
-        }
+    protected String getKnowResourceIdentifier() {
+       return knownResource;
     }
-
+    
     /**
      * Creates the without resource name.
      *
@@ -163,12 +103,8 @@ public class PermissionServiceTest extends AbstractServiceTestImpl {
      * @throws Exception the exception
      */
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
+               dependsOnMethods = {"CRUDTests"})
     public void createWithoutResourceName(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         setupCreate();
 
         // Submit the request to the service and store the response.
@@ -187,265 +123,63 @@ public class PermissionServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
     }
 
-    //to not cause uniqueness violation for permission, createList is removed
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
-    public void createList(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        setupCreate();
-        // Submit the request to the service and store the response.
-        List<PermissionAction> actions = PermissionFactory.createDefaultActions();
-        Permission permission1 = createPermissionInstance("test-objects",
-                "default permissions for test-objects",
-                actions,
-                EffectType.PERMIT,
-                true,
-                true,
-                true);
-        PermissionClient client = new PermissionClient();
-        ClientResponse<Response> res = client.create(permission1);
-        int statusCode = res.getStatus();
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        allResourceIdsCreated.add(extractId(res));
-
-        Permission permission2 = createPermissionInstance("test-acquisitions",
-                "default permissions for test-acquisitions",
-                actions,
-                EffectType.PERMIT,
-                true,
-                true,
-                true);
-        res = client.create(permission2);
-        statusCode = res.getStatus();
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        allResourceIdsCreated.add(extractId(res));
-
-        Permission permission3 = createPermissionInstance("test-ids",
-                "default permissions for id service",
-                actions,
-                EffectType.PERMIT,
-                true,
-                true,
-                true);
-        res = client.create(permission3);
-        statusCode = res.getStatus();
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        allResourceIdsCreated.add(extractId(res));
-    }
-
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
-     */
-    @Override
-    public void createWithEmptyEntityBody(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
-     */
-    @Override
-    public void createWithMalformedXml(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
-     */
-    @Override
-    public void createWithWrongXmlSchema(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
-
-    // ---------------------------------------------------------------
-    // CRUD tests : READ tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
-    public void read(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupRead();
-
-        // Submit the request to the service and store the response.
-        PermissionClient client = new PermissionClient();
-        ClientResponse<Permission> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-        Permission output = (Permission) res.getEntity();
-        Assert.assertNotNull(output);
-    }
-
-    // Failure outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
-    public void readNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadNonExistent();
-
-        // Submit the request to the service and store the response.
-        PermissionClient client = new PermissionClient();
-        ClientResponse<Permission> res = client.read(NON_EXISTENT_ID);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    // ---------------------------------------------------------------
-    // CRUD tests : READ_LIST tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList", "read"})
-    public void readList(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadList();
-
-        // Submit the request to the service and store the response.
-        PermissionClient client = new PermissionClient();
-        ClientResponse<PermissionsList> res = client.readList();
-        assertStatusCode(res, testName);
-        PermissionsList list = res.getEntity(PermissionsList.class);
-
-        // Optionally output additional data about list members for debugging.
-        boolean iterateThroughList = true;
-        if (iterateThroughList && logger.isDebugEnabled()) {
-            printList(testName, list);
-        }
-    }
-
     /**
      * Search resource name.
      *
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList", "read"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"CRUDTests"})
     public void searchResourceName(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupReadList();
 
         // Submit the request to the service and store the response.
         PermissionClient client = new PermissionClient();
         ClientResponse<PermissionsList> res = client.readSearchList("acquisition");
-        assertStatusCode(res, testName);
-        PermissionsList list = res.getEntity(PermissionsList.class);
-        int EXPECTED_ITEMS = 5; //seeded permissions
-        int actual = list.getPermission().size();
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": received = " + actual
-                    + " expected=" + EXPECTED_ITEMS);
-        }
-        // Optionally output additional data about list members for debugging.
-        boolean iterateThroughList = true;
-        if ((iterateThroughList || (EXPECTED_ITEMS != list.getPermission().size()))
-                       && logger.isDebugEnabled()) {
-            printList(testName, list);
+        try {
+               assertStatusCode(res, testName);
+               PermissionsList list = res.getEntity(PermissionsList.class);
+               int EXPECTED_ITEMS = 4; //seeded permissions
+               int actual = list.getPermission().size();
+               if (logger.isDebugEnabled()) {
+                   logger.debug(testName + ": received = " + actual
+                           + " expected=" + EXPECTED_ITEMS);
+               }
+               // Optionally output additional data about list members for debugging.
+               boolean iterateThroughList = true;
+               if ((iterateThroughList || (EXPECTED_ITEMS != list.getPermission().size()))
+                               && logger.isDebugEnabled()) {
+                   printList(testName, list);
+               }
+               Assert.assertEquals(list.getPermission().size(), EXPECTED_ITEMS);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertEquals(list.getPermission().size(), EXPECTED_ITEMS);
-
     }
-
-    // Failure outcomes
-    // None at present.
-    // ---------------------------------------------------------------
-    // CRUD tests : UPDATE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
-     */
+    
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read", "readList", "readNonExistent"})
-    public void update(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdate();
-
-        Permission permToUpdate = new Permission();
-        permToUpdate.setCsid(knownResourceId);
-        permToUpdate.setResourceName(knownResource);
-        // Update the content of this resource.
-        permToUpdate.setDescription("updated description");
-        if (logger.isDebugEnabled()) {
-            logger.debug("updated object");
-            logger.debug(objectAsXmlString(permToUpdate,
-                    Permission.class));
-        }
-        PermissionClient client = new PermissionClient();
-        // Submit the request to the service and store the response.
-        ClientResponse<Permission> res = client.update(knownResourceId, permToUpdate);
-        assertStatusCode(res, testName);
-        Permission permUpdated = (Permission) res.getEntity();
-        Assert.assertNotNull(permUpdated);
-
-        Assert.assertEquals(permUpdated.getDescription(),
-                permToUpdate.getDescription(),
-                "Data in updated object did not match submitted data.");
+    public void delete(String testName) throws Exception {
+       //This method does nothing because we want to postpone the "delete" test until after
+       //the "updateNotAllowed" test gets run.  Our "localDelete" test will call the real "delete" test later.
+    }
+    
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"updateNotAllowed", "updateActions"})
+    public void localDelete(String testName) throws Exception {
+       super.delete(testName);
     }
 
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read", "readList", "readNonExistent"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"CRUDTests"})
     public void updateNotAllowed(String testName) throws Exception {
 
         // Perform setup.
@@ -468,8 +202,8 @@ public class PermissionServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
 
     }
@@ -481,12 +215,8 @@ public class PermissionServiceTest extends AbstractServiceTestImpl {
      * @throws Exception the exception
      */
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"updateNotAllowed"})
+               dependsOnMethods = {"updateNotAllowed"})
     public void updateActions(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupUpdate();
 
@@ -511,7 +241,15 @@ public class PermissionServiceTest extends AbstractServiceTestImpl {
         PermissionClient client = new PermissionClient();
         // Submit the request to the service and store the response.
         ClientResponse<Permission> res = client.update(knownResourceId, permToUpdate);
-        assertStatusCode(res, testName);
+        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);
+
         Permission permUpdated = (Permission) res.getEntity();
         Assert.assertNotNull(permUpdated);
         int updated_actions = permToUpdate.getAction().size();
@@ -523,45 +261,14 @@ public class PermissionServiceTest extends AbstractServiceTestImpl {
                 updated_actions,
                 "Data in updated object did not match submitted data.");
     }
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
-     */
-    @Override
-    public void updateWithEmptyEntityBody(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
-     */
-    @Override
-    public void updateWithMalformedXml(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
-     */
-    @Override
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
-
+    
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"readNonExistent", "testSubmitRequest"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//     dependsOnMethods = {"readNonExistent", "testSubmitRequest"})
     public void updateNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupUpdateNonExistent();
 
@@ -587,72 +294,9 @@ public class PermissionServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    // ---------------------------------------------------------------
-    // CRUD tests : DELETE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"update", "updateActions", "testSubmitRequest"})
-    public void delete(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDelete();
-
-        // Submit the request to the service and store the response.
-        PermissionClient client = new PermissionClient();
-        ClientResponse<Response> res = client.delete(knownResourceId);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    // Failure outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"delete"})
-    public void deleteNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDeleteNonExistent();
-
-        // Submit the request to the service and store the response.
-        PermissionClient client = new PermissionClient();
-        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
     
     // ---------------------------------------------------------------
@@ -660,40 +304,10 @@ public class PermissionServiceTest extends AbstractServiceTestImpl {
     // ---------------------------------------------------------------
     
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
     public void searchWorkflowDeleted(String testName) throws Exception {
         // Fixme: null test for now, overriding test in base class
     }
 
-    // ---------------------------------------------------------------
-    // Utility tests : tests of code used in tests above
-    // ---------------------------------------------------------------
-    /**
-     * Tests the code for manually submitting data that is used by several
-     * of the methods above.
-     * @throws Exception 
-     */
-    @Test(dependsOnMethods = {"create"})
-    public void testSubmitRequest() throws Exception {
-
-        // Expected status code: 200 OK
-        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
-
-        // Submit the request to the service and store the response.
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getResourceURL(knownResourceId);
-        int statusCode = submitRequest(method, url);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug("testSubmitRequest: url=" + url
-                    + " status=" + statusCode);
-        }
-        Assert.assertEquals(statusCode, EXPECTED_STATUS);
-
-    }
-
     // ---------------------------------------------------------------
     // Utility methods used by tests above
     // ---------------------------------------------------------------
@@ -734,16 +348,84 @@ public class PermissionServiceTest extends AbstractServiceTestImpl {
      * @param list the list
      * @return the int
      */
-    private int printList(String testName, PermissionsList list) {
-
-        int i = 0;
-
+    @Override
+    protected void printList(String testName, PermissionsList list) {
         for (Permission permission : list.getPermission()) {
             logger.debug(testName + " permission csid=" + permission.getCsid()
                     + " name=" + permission.getResourceName()
                     + " desc=" + permission.getDescription());
-            i++;
         }
-        return i;
     }
+
+       @Override
+       protected Permission createInstance(String commonPartName, String identifier) {
+        List<PermissionAction> actions = PermissionFactory.createDefaultActions();
+        Permission permission = createPermissionInstance(identifier,
+                "default permissions for " + identifier,
+                actions,
+                EffectType.PERMIT,
+                true,
+                true,
+                true);
+        return permission;
+       }
+
+       @Override
+       protected Permission updateInstance(Permission original) {
+               Permission result = new Permission();
+               
+               result.setCsid(original.getCsid());
+               result.setResourceName(original.getResourceName());
+        // Update the content of this resource.
+               result.setDescription("updated-" + original.getDescription());
+               
+               return result;
+       }
+
+       @Override
+       protected void compareUpdatedInstances(Permission original,
+                       Permission updated) throws Exception {
+        Assert.assertEquals(updated.getCsid(),
+                       original.getCsid(),
+                "CSID in updated object did not match submitted data.");
+
+        Assert.assertEquals(updated.getResourceName(),
+                       original.getResourceName(),
+                "Resource name in updated object did not match submitted data.");
+
+        Assert.assertEquals(updated.getDescription(),
+                       original.getDescription(),
+                "Description in updated object did not match submitted data.");
+    }
+
+       @Override
+       protected Class<PermissionsList> getCommonListType() {
+               return PermissionsList.class;
+       }
+
+    @Override
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {
+                       "org.collectionspace.services.client.test.AbstractServiceTestImpl.baseCRUDTests"})    
+    public void CRUDTests(String testName) {
+       // Do nothing.  Simply here to for a TestNG execution order for our tests
+    }
+
+       @Override
+       public void updateWithEmptyEntityBody(String testName) throws Exception {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       public void updateWithMalformedXml(String testName) throws Exception {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       public void updateWithWrongXmlSchema(String testName) throws Exception {
+               // TODO Auto-generated method stub
+               
+       }
 }
index b162c81fec20243c35cdeb0c0caf13f5d440922f..40cafab478c47b5fdd4d18ba4a8c038569d9698f 100644 (file)
@@ -45,7 +45,6 @@ import org.collectionspace.services.client.RoleClient;
 import org.collectionspace.services.client.RoleFactory;
 import org.collectionspace.services.client.test.AbstractServiceTestImpl;
 import org.collectionspace.services.client.test.ServiceRequestType;
-import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.jboss.resteasy.client.ClientResponse;
 
 import org.testng.Assert;
@@ -63,16 +62,13 @@ import org.testng.annotations.BeforeClass;
  * $LastChangedRevision: 917 $
  * $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri, 06 Nov 2009) $
  */
-public class RolePermissionServiceTest extends AbstractServiceTestImpl {
+public class RolePermissionServiceTest extends AbstractServiceTestImpl<PermissionRole, PermissionRole,
+               PermissionRole, PermissionRole> {
 
     /** The Constant logger. */
     private final static String CLASS_NAME = RolePermissionServiceTest.class.getName();
     private final static Logger logger = LoggerFactory.getLogger(CLASS_NAME);
     // Instance variables specific to this test.
-    /** The known resource id. */
-    private String knownResourceId = null;
-    /** The all resource ids created. */
-    private List<String> allResourceIdsCreated = new ArrayList<String>();
     final private static String TEST_MARKER = "_RolePermissionServiceTest";
     final private static String TEST_ROLE_NAME = "ROLE";
     final private static String NO_REL_SUFFIX = "-no-rel";
@@ -142,24 +138,15 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl {
         return new RolePermissionClient();
     }
 
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
-     */
-    @Override
-    protected AbstractCommonList getAbstractCommonList(
-            ClientResponse<AbstractCommonList> response) {
-        //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
-        throw new UnsupportedOperationException();
-    }
-
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readPaginatedList(java.lang.String)
      */
-    @Test(dataProvider = "testName")
+//    @Test(dataProvider = "testName")
     @Override
     public void readPaginatedList(String testName) throws Exception {
         //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
     }
+    
     // ---------------------------------------------------------------
     // CRUD tests : CREATE tests
     // ---------------------------------------------------------------
@@ -169,13 +156,8 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl {
      */
 
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
     public void create(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        ;
         // Perform setup, such as initializing the type of service request
         // (e.g. CREATE, DELETE), its valid and expected status codes, and
         // its associated HTTP method name (e.g. POST, DELETE).
@@ -193,13 +175,11 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl {
             if (logger.isDebugEnabled()) {
                 logger.debug(testName + ": status = " + statusCode);
             }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-            // Store the ID returned from this create operation
-            // for additional tests below.
-            //this is is not important in case of this relationship
-            knownResourceId = extractId(res);
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
+            Assert.assertEquals(statusCode, testExpectedStatusCode);
+
+            knownResourceId = extractId(res); //This is meaningless in this test, see getKnowResourceId() method for details
             if (logger.isDebugEnabled()) {
                 logger.debug(testName + ": knownResourceId=" + knownResourceId);
             }
@@ -215,8 +195,8 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//     dependsOnMethods = {"create"})
     public void createList(String testName) throws Exception {
         //Should this really be empty?
     }
@@ -256,14 +236,9 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//     dependsOnMethods = {"create"})
     public void read(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        ;
         // Perform setup.
         setupRead();
 
@@ -272,7 +247,17 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl {
         ClientResponse<PermissionRole> res = null;
         try {
             res = client.read(roleValues.get(getRoleName()).getRoleId());
-            assertStatusCode(res, testName);
+            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);
+
             PermissionRole output = (PermissionRole) res.getEntity();
             Assert.assertNotNull(output);
         } finally {
@@ -287,13 +272,8 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
     public void readNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        ;
         // Perform setup.
         setupReadNonExistent();
 
@@ -310,9 +290,9 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl {
             if (logger.isDebugEnabled()) {
                 logger.debug(testName + ": status = " + statusCode);
             }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
+            Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
             if (res != null) {
                 res.releaseConnection();
@@ -322,11 +302,6 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl {
 
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
     public void readNoRelationship(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        ;
         setupRead();
         // Submit the request to the service and store the response.
         RolePermissionClient client = new RolePermissionClient();
@@ -334,7 +309,16 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl {
         try {
 
             res = client.read(roleValues.get(getRoleName() + NO_REL_SUFFIX).getRoleId());
-            assertStatusCode(res, testName);
+            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, Response.Status.OK.getStatusCode());
             PermissionRole output = (PermissionRole) res.getEntity();
 
             String sOutput = objectAsXmlString(output, PermissionRole.class);
@@ -356,8 +340,8 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList", "read"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//     dependsOnMethods = {"createList", "read"})
     public void readList(String testName) throws Exception {
         //Should this really be empty?
     }
@@ -372,8 +356,8 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read", "readList", "readNonExistent"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//     dependsOnMethods = {"read", "readList", "readNonExistent"})
     public void update(String testName) throws Exception {
         //Should this really be empty?
     }
@@ -409,8 +393,8 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"readNonExistent", "testSubmitRequest"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"readNonExistent", "testSubmitRequest"})
     public void updateNonExistent(String testName) throws Exception {
         //Should this really be empty?
     }
@@ -423,14 +407,9 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"read"})
     public void delete(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        
         // Perform setup.
         setupDelete();
                 
@@ -441,9 +420,9 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl {
         try {
                delRes = client.delete(rv.getRoleId());
             int statusCode = delRes.getStatus();
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
+            Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
             if (delRes != null) {
                delRes.releaseConnection();
@@ -465,9 +444,9 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl {
             res = client.delete(
                     rv.getRoleId(), toDelete);
             int statusCode = res.getStatus();
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
+            Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
             if (res != null) {
                 res.releaseConnection();
@@ -480,7 +459,7 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
     public void deleteNonExistent(String testName) throws Exception {
         //ignoring this test as the service side returns 200 now even if it does
         //not find a record in the db
@@ -491,7 +470,7 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl {
     // ---------------------------------------------------------------
     
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
     public void searchWorkflowDeleted(String testName) throws Exception {
         // Fixme: null test for now, overriding test in base class
     }
@@ -502,10 +481,10 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl {
     /**
      * Tests the code for manually submitting data that is used by several
      * of the methods above.
-     * @throws Exception 
      */
-    @Test(dependsOnMethods = {"create"}) //FIXME: REM - This is not a test of a submit to the permroles service, but to just authorization/roles
-    public void testSubmitRequest() throws Exception {
+    @Override
+//    @Test(dependsOnMethods = {"create"}) //FIXME: REM - This is not a test of a submit to the permroles service, but to just authorization/roles
+    public void testSubmitRequest() {
 
         // Expected status code: 200 OK
         final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
@@ -522,8 +501,6 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl {
                     + " status=" + statusCode);
         }
         Assert.assertEquals(statusCode, EXPECTED_STATUS);
-
-
     }
 
     // ---------------------------------------------------------------
@@ -601,9 +578,9 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl {
                 logger.debug("createPermission: resName=" + resName
                         + " status = " + statusCode);
             }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
+            Assert.assertEquals(statusCode, testExpectedStatusCode);
             id = extractId(res);
         } finally {
             if (res != null) {
@@ -630,9 +607,9 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl {
                 logger.debug("deletePermission: delete permission id="
                         + permId + " status=" + statusCode);
             }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
+            Assert.assertEquals(statusCode, testExpectedStatusCode);
 
         } finally {
             if (res != null) {
@@ -664,9 +641,9 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl {
                 logger.debug("createRole: name=" + roleName
                         + " status = " + statusCode);
             }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
+            Assert.assertEquals(statusCode, testExpectedStatusCode);
             id = extractId(res);
         } finally {
             if (res != null) {
@@ -692,12 +669,55 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl {
                 logger.debug("deleteRole: delete role id=" + roleId
                         + " status=" + statusCode);
             }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
+            Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
             res.releaseConnection();
         }
 
     }
+
+       @Override
+       protected PermissionRole createInstance(String commonPartName,
+                       String identifier) {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       protected PermissionRole updateInstance(PermissionRole commonPartObject) {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       protected void compareUpdatedInstances(PermissionRole original,
+                       PermissionRole updated) throws Exception {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       protected Class<PermissionRole> getCommonListType() {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+    @Override
+    protected String getKnowResourceId() {
+       return roleValues.get(getRoleName()).getRoleId();
+    }
+       
+    /*
+     * For convenience and terseness, this test method is the base of the test execution dependency chain.  Other test methods may
+     * refer to this method in their @Test annotation declarations.
+     */
+    @Override
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {
+                       "org.collectionspace.services.client.test.AbstractServiceTestImpl.baseCRUDTests"})    
+    public void CRUDTests(String testName) {
+       // Do nothing.  Simply here to for a TestNG execution order for our tests
+    }  
 }
index 1de1a5bb30b517f607db2a22be573e6a9bc62901..bf3720bb82ba0529bd31e280c499a0a92749e0aa 100644 (file)
@@ -32,8 +32,6 @@ import org.collectionspace.services.authorization.Role;
 import org.collectionspace.services.authorization.RolesList;
 import org.collectionspace.services.client.RoleFactory;
 import org.collectionspace.services.client.test.AbstractServiceTestImpl;
-import org.collectionspace.services.client.test.ServiceRequestType;
-import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.jboss.resteasy.client.ClientResponse;
 
 import org.testng.Assert;
@@ -49,7 +47,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision: 917 $
  * $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri, 06 Nov 2009) $
  */
-public class RoleServiceTest extends AbstractServiceTestImpl {
+public class RoleServiceTest extends AbstractServiceTestImpl<RolesList, Role, Role, Role> {
 
     /** The logger. */
     private final static String CLASS_NAME = RoleServiceTest.class.getName();
@@ -57,11 +55,10 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
     
     // Instance variables specific to this test.
     /** The known resource id. */
-    private String knownResourceId = null;
-    private String knownRoleName = "ROLE_USERS_MOCK";
-    private String knownRoleDisplayName = "ROLE_DISPLAYNAME_USERS_MOCK";
+    private String knownRoleName = "ROLE_USERS_MOCK-1";
+    private String knownRoleDisplayName = "ROLE_DISPLAYNAME_USERS_MOCK-1";
     private String verifyResourceId = null;
-    private String verifyRoleName = "collections_manager_mock";
+    private String verifyRoleName = "collections_manager_mock-1";
 //    private List<String> allResourceIdsCreated = new ArrayList<String>();
 
     @Override
@@ -82,20 +79,9 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
         return new RoleClient();
     }
 
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
-     */
-    @Override
-    protected AbstractCommonList getAbstractCommonList(
-            ClientResponse<AbstractCommonList> response) {
-        //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
-        throw new UnsupportedOperationException();
-    }
-
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readPaginatedList(java.lang.String)
      */
-    @Test(dataProvider = "testName")
     @Override
     public void readPaginatedList(String testName) throws Exception {
         //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
@@ -105,16 +91,9 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
     // CRUD tests : CREATE tests
     // ---------------------------------------------------------------
     // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
-     */
+
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
     public void create(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup, such as initializing the type of service request
         // (e.g. CREATE, DELETE), its valid and expected status codes, and
         // its associated HTTP method name (e.g. POST, DELETE).
@@ -137,9 +116,9 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
 
         // Store the ID returned from this create operation
         // for additional tests below.
@@ -149,12 +128,9 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
         }
     }
     
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create"})
+    @Test(dataProvider = "testName", 
+               dependsOnMethods = {"CRUDTests"})
     public void createWithDisplayname(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup, such as initializing the type of service request
         // (e.g. CREATE, DELETE), its valid and expected status codes, and
         // its associated HTTP method name (e.g. POST, DELETE).
@@ -178,9 +154,9 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
 
         // Store the ID returned from this create operation
         // for additional tests below.
@@ -198,12 +174,9 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"CRUDTests"})
     public void createForUniqueRole(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         setupCreate();
 
         // Submit the request to the service and store the response.
@@ -220,8 +193,8 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
             logger.debug(testName + ": status = " + statusCode);
             logger.debug(testName + ": " + res);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
     }
     
@@ -231,12 +204,9 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"createWithDisplayname"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"createWithDisplayname"})
     public void createForUniqueDisplayRole(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         setupCreate();
 
         // Submit the request to the service and store the response.
@@ -254,8 +224,8 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
             logger.debug(testName + ": status = " + statusCode);
             logger.debug(testName + ": " + res);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         if (statusCode != Response.Status.BAD_REQUEST.getStatusCode()) {
             // If the test fails then we've just created a Role that we need to delete, so
             // store the ID returned from this create operation.
@@ -274,13 +244,9 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"CRUDTests"})
     public void createWithoutRoleName(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         setupCreate();
 
         // Submit the request to the service and store the response.
@@ -294,8 +260,8 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
     }
 
@@ -304,13 +270,9 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createWithDisplayname"})
+//    @Test(dataProvider = "testName",
+//     dependsOnMethods = {"createWithDisplayname"})
     public void createList(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         setupCreate();
 
         // Submit the request to the service and store the response.
@@ -322,9 +284,9 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
                 true);
         ClientResponse<Response> res = client.create(role1);
         int statusCode = res.getStatus();
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
         verifyResourceId = extractId(res);
         allResourceIdsCreated.add(verifyResourceId);
 
@@ -333,10 +295,10 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
                 true);
         res = client.create(role2);
         statusCode = res.getStatus();
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
         allResourceIdsCreated.add(extractId(res));
 
         Role role3 = createRoleInstance("ROLE_MOVINGIMAGE_ADMIN_TEST",
@@ -344,10 +306,10 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
                 true);
         res = client.create(role3);
         statusCode = res.getStatus();
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
         allResourceIdsCreated.add(extractId(res));
     }
 
@@ -386,35 +348,50 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createForUniqueRole"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"createForUniqueRole"})
     public void read(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupRead();
 
         // Submit the request to the service and store the response.
         RoleClient client = new RoleClient();
         ClientResponse<Role> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
+        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);
+
         Role output = (Role) res.getEntity();
         Assert.assertNotNull(output);
     }
 
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"CRUDTests"})
     public void readToVerify(String testName) throws Exception {
-
         // Perform setup.
         setupRead();
 
         // Submit the request to the service and store the response.
         RoleClient client = new RoleClient();
         ClientResponse<Role> res = client.read(verifyResourceId);
-        assertStatusCode(res, testName);
+        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);
+
         Role output = (Role) res.getEntity();
         Assert.assertNotNull(output);
 
@@ -431,13 +408,9 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
      */
 
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"read"})
     public void readNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupReadNonExistent();
 
@@ -451,9 +424,9 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
 
     // ---------------------------------------------------------------
@@ -464,26 +437,29 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList", "read"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"createList", "read"})
     public void readList(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupReadList();
 
         // Submit the request to the service and store the response.
         RoleClient client = new RoleClient();
         ClientResponse<RolesList> res = client.readList();
-        assertStatusCode(res, testName);
-        RolesList list = res.getEntity();
-
-        // Optionally output additional data about list members for debugging.
-        boolean iterateThroughList = true;
-        if (iterateThroughList && logger.isDebugEnabled()) {
-            printList(testName, list);
+        try {
+               // Check the status code of the response: does it match
+               // the expected response(s)?
+               assertStatusCode(res, testName);
+               RolesList list = res.getEntity();
+               // Optionally output additional data about list members for debugging.
+               boolean iterateThroughList = true;
+               if (iterateThroughList && logger.isDebugEnabled()) {
+                   printList(testName, list);
+               }
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
     }
 
@@ -493,31 +469,33 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList", "read"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"CRUDTests"})
     public void searchRoleName(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupReadList();
 
         // Submit the request to the service and store the response.
         RoleClient client = new RoleClient();
         ClientResponse<RolesList> res = client.readSearchList("movingImage");
-        assertStatusCode(res, testName);
-        RolesList list = res.getEntity();
-        int EXPECTED_ITEMS = 1;
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": received = " + list.getRole().size()
-                    + " expected=" + EXPECTED_ITEMS);
-        }
-        Assert.assertEquals(EXPECTED_ITEMS, list.getRole().size());
-        // Optionally output additional data about list members for debugging.
-        boolean iterateThroughList = true;
-        if (iterateThroughList && logger.isDebugEnabled()) {
-            printList(testName, list);
+        try {
+               assertStatusCode(res, testName);
+               RolesList list = res.getEntity();
+               int EXPECTED_ITEMS = 1;
+               if (logger.isDebugEnabled()) {
+                   logger.debug(testName + ": received = " + list.getRole().size()
+                           + " expected=" + EXPECTED_ITEMS);
+               }
+               Assert.assertEquals(EXPECTED_ITEMS, list.getRole().size());
+               // Optionally output additional data about list members for debugging.
+               boolean iterateThroughList = true;
+               if (iterateThroughList && logger.isDebugEnabled()) {
+                   printList(testName, list);
+               }
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
     }
 
@@ -531,13 +509,9 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read", "readList", "readNonExistent"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"read", "readList", "readNonExistent"})
     public void update(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupUpdate();
 
@@ -557,7 +531,16 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
         RoleClient client = new RoleClient();
         // Submit the request to the service and store the response.
         ClientResponse<Role> res = client.update(knownResourceId, roleToUpdate);
-        assertStatusCode(res, testName);
+        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);
+
+
         Role roleUpdated = (Role) res.getEntity();
         Assert.assertNotNull(roleUpdated);
 
@@ -566,15 +549,11 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
                 "Data in updated object did not match submitted data.");
     }
     
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-               dependsOnMethods = {"read", "readList", "readNonExistent"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"CRUDTests"})
        public void verifyProtectionReadOnly(String testName) throws Exception {
 
-       if (logger.isDebugEnabled()) {
-               logger.debug(testBanner(testName, CLASS_NAME));
-       }
-       
-        setupCreate();
+       setupCreate();
 
         // Submit the request to the service and store the response.
         RoleClient client = new RoleClient();
@@ -583,9 +562,9 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
         role.setPermsProtection(RoleClient.IMMUTABLE);
         ClientResponse<Response> res = client.create(role);
         int statusCode = res.getStatus();
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
 
         // Store the ID returned from this create operation
         // for additional tests below.
@@ -598,7 +577,12 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
 
         // Submit the request to the service and store the response.
         ClientResponse<Role> roleRes = client.read(testResourceId);
-        assertStatusCode(roleRes, testName);
+        statusCode = roleRes.getStatus();
+
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
+
         Role roleRead = (Role) roleRes.getEntity();
         Assert.assertNotNull(roleRead);
         String mdProtection = roleRead.getMetadataProtection();
@@ -620,7 +604,16 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
 
        // Submit the request to the service and store the response.
        roleRes = client.update(testResourceId, roleToUpdate);
-        assertStatusCode(roleRes, testName);
+       statusCode = roleRes.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);
+
+
        Role roleUpdated = (Role) roleRes.getEntity();
        Assert.assertNotNull(roleUpdated);
         if (logger.isDebugEnabled()) {
@@ -638,10 +631,8 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
                        "Role allowed update of the perms protection flag.");
     }
 
-
-
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read", "readList", "readNonExistent"})
+       @Test(dataProvider = "testName",
+                       dependsOnMethods = {"CRUDTests"})
     public void updateNotAllowed(String testName) throws Exception {
 
         // Perform setup.
@@ -666,8 +657,8 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
 
     }
@@ -702,14 +693,11 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
      */
+    
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"readNonExistent", "testSubmitRequest"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"readNonExistent", "testSubmitRequest"})
     public void updateNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupUpdateNonExistent();
 
@@ -730,9 +718,9 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
 
     // ---------------------------------------------------------------
@@ -743,29 +731,16 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"updateNotAllowed", "testSubmitRequest", "verifyProtectionReadOnly"})
     public void delete(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDelete();
-
-        // Submit the request to the service and store the response.
-        RoleClient client = new RoleClient();
-        ClientResponse<Response> res = client.delete(knownResourceId);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+       // Do nothing since other tests like "updateNotAllowed" need the "known resource" that this test
+       // deletes.  Once all those tests get run, the "localDelete" method will call the base class' delete
+       // method that will delete the "known resource".
+    }
+    
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+               dependsOnMethods = {"updateNotAllowed", "createForUniqueRole", "createForUniqueDisplayRole"})
+    public void localDelete(String testName) throws Exception {
+       super.delete(testName);
     }
 
     // Failure outcomes
@@ -773,13 +748,9 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"delete"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"delete"})
     public void deleteNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupDeleteNonExistent();
 
@@ -793,9 +764,9 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
     
     // ---------------------------------------------------------------
@@ -803,7 +774,7 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
     // ---------------------------------------------------------------
     
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
     public void searchWorkflowDeleted(String testName) throws Exception {
         // Fixme: null test for now, overriding test in base class
     }    
@@ -817,27 +788,6 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
      * @throws Exception 
      */
 
-    @Test(dependsOnMethods = {"create"})
-    public void testSubmitRequest() throws Exception {
-
-        // Expected status code: 200 OK
-        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
-
-        // Submit the request to the service and store the response.
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getResourceURL(knownResourceId);
-        int statusCode = submitRequest(method, url);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug("testSubmitRequest: url=" + url
-                    + " status=" + statusCode);
-        }
-        Assert.assertEquals(statusCode, EXPECTED_STATUS);
-
-    }
-
     // ---------------------------------------------------------------
     // Utility methods used by tests above
     // ---------------------------------------------------------------
@@ -873,16 +823,48 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
      * @param list the list
      * @return the int
      */
-    private int printList(String testName, RolesList list) {
-
-        int i = 0;
-
+    protected void printList(String testName, RolesList list) {
         for (Role role : list.getRole()) {
             logger.debug(testName + " role csid=" + role.getCsid()
                     + " name=" + role.getRoleName()
                     + " desc=" + role.getDescription());
-            i++;
         }
-        return i;
     }
+
+       @Override
+       protected Role createInstance(String commonPartName, String identifier) {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       protected Role updateInstance(Role commonPartObject) {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       protected void compareUpdatedInstances(Role original, Role updated)
+                       throws Exception {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       protected Class<RolesList> getCommonListType() {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+    /*
+     * For convenience and terseness, this test method is the base of the test execution dependency chain.  Other test methods may
+     * refer to this method in their @Test annotation declarations.
+     */
+    @Override
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {
+                       "org.collectionspace.services.client.test.AbstractServiceTestImpl.baseCRUDTests"})    
+    public void CRUDTests(String testName) {
+       // Do nothing.  Simply here to for a TestNG execution order for our tests
+    }  
 }
index 8a0daee1f85b8386e9ed5c759ec724d0509a067a..8088be1c2cc8e12bc157324863962dd721f0fbb6 100644 (file)
@@ -60,7 +60,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>\r
         <dependency>\r
             <groupId>commons-cli</groupId>\r
index 7cb41de3a64629c31f2079e37084a27b2ca2cfe1..9f48c102175678c949624872c4a60c5c81b536dc 100644 (file)
@@ -59,7 +59,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
             <scope>test</scope>\r
         </dependency>\r
         <!-- javax -->\r
index 4f7b0e6f57bac629b0501bbb352de331cd440eb5..0a04791958e307684f9efef3d5d77dd4149ae9bc 100644 (file)
@@ -23,7 +23,6 @@
  */
 package org.collectionspace.services.authorization;
 
-import org.collectionspace.services.authorization.perms.FooPermissionsList;
 import org.collectionspace.services.authorization.perms.Permission;
 import org.collectionspace.services.authorization.perms.PermissionsList;
 import org.collectionspace.services.authorization.storage.AuthorizationDelegate;
@@ -109,14 +108,6 @@ public class PermissionResource extends SecurityResourceBase {
        return result;
     }
 
-    @GET
-    @Path("{csid}/foo")
-    @Produces("application/xml")
-    public FooPermissionsList getPermissionFooList(@Context UriInfo ui) {
-       FooPermissionsList result = new FooPermissionsList();           
-       return result;
-    }
-
     @PUT
     @Path("{csid}")
     public Permission updatePermission(@PathParam("csid") String csid,Permission theUpdate) {
index 8d4ca0f596dd7083839c7c9a8ef86d2df3946e43..8ad4df4ad1475094af16468491fe66aef593abc6 100644 (file)
@@ -57,7 +57,6 @@
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>5.6</version>
             <scope>test</scope>
         </dependency>
         <!-- javax -->
index 5f79eb2f984bfebc667f1a5a26f31f61a510924c..cd0f1ea5316948b1bf5236e63318a951e3b6b9df 100644 (file)
@@ -62,7 +62,6 @@
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>5.6</version>
         </dependency>
         <dependency>
             <groupId>org.jboss.resteasy</groupId>
index f08f6b237b8736c61aeed4c8a91cc1487792b682..e0c5962c2acf6f8200ca84a2f1f874637fcf369a 100644 (file)
@@ -25,13 +25,12 @@ package org.collectionspace.services.client.test;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
+import org.collectionspace.services.client.AbstractCommonListUtils;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.BatchClient;
-import org.collectionspace.services.client.BatchProxy;
 import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
-import org.collectionspace.services.common.AbstractCommonListUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.batch.BatchCommon;
 
@@ -50,12 +49,11 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision:  $
  * $LastChangedDate:  $
  */
-public class BatchServiceTest extends AbstractServiceTestImpl {
+public class BatchServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonList, BatchCommon> {
 
     private final String CLASS_NAME = BatchServiceTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
     final String SERVICE_PATH_COMPONENT = "batch";
-    private String knownResourceId = null;
 
     @Override
        public String getServicePathComponent() {
@@ -72,188 +70,22 @@ public class BatchServiceTest extends AbstractServiceTestImpl {
         return new BatchClient();
     }
 
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
-    public void create(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupCreate();
-        BatchClient client = new BatchClient();
-        PoxPayloadOut multipart = createBatchInstance(createIdentifier());
-        ClientResponse<Response> res = client.create(multipart);
-        assertStatusCode(res, testName);
-        if (knownResourceId == null) {
-            knownResourceId = extractId(res);  // Store the ID returned from the first resource created for additional tests below.
-            logger.debug(testName + ": knownResourceId=" + knownResourceId);
-        }
-        allResourceIdsCreated.add(extractId(res)); // Store the IDs from every resource created by tests so they can be deleted after tests have been run.
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create"})
-    public void createList(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        for (int i = 0; i < 3; i++) {
-            create(testName);
-        }
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create"})
-    public void read(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupRead();
-        BatchClient client = new BatchClient();
-        ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        BatchCommon batch = (BatchCommon) extractPart(input, client.getCommonPartName(), BatchCommon.class);
-        Assert.assertNotNull(batch);
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"createList", "read"})
-    public void readList(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupReadList();
-        BatchClient client = new BatchClient();
-        ClientResponse<AbstractCommonList> res = client.readList();
-        assertStatusCode(res, testName);
-        String bar = "\r\n\r\n=================================\r\n\r\n";
-        System.out.println(bar+" res: "+res);
-        AbstractCommonList  list = res.getEntity();
-        System.out.println(bar+" list: "+list);
-
-        if(logger.isTraceEnabled()){
-               AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
-        }
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"read"})
-    public void update(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupUpdate();
-        BatchClient client = new BatchClient();
-        ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-        logger.debug("got object to update with ID: " + knownResourceId);
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        BatchCommon batch = (BatchCommon) extractPart(input, client.getCommonPartName(), BatchCommon.class);
-        Assert.assertNotNull(batch);
-
-        batch.setName("updated-" + batch.getName());
-        logger.debug("Object to be updated:"+objectAsXmlString(batch, BatchCommon.class));
-        PoxPayloadOut output = new PoxPayloadOut(BatchClient.SERVICE_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = output.addPart(batch, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getCommonPartName());
-        res = client.update(knownResourceId, output);
-        assertStatusCode(res, testName);
-        input = new PoxPayloadIn(res.getEntity());
-        BatchCommon updatedBatch = (BatchCommon) extractPart(input, client.getCommonPartName(), BatchCommon.class);
-        Assert.assertNotNull(updatedBatch);
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"update", "testSubmitRequest"})
-    public void updateNonExistent(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupUpdateNonExistent();
-        // Submit the request to the service and store the response.
-        // Note: The ID used in this 'create' call may be arbitrary.
-        // The only relevant ID may be the one used in update(), below.
-        BatchClient client = new BatchClient();
-        PoxPayloadOut multipart = createBatchInstance(NON_EXISTENT_ID);
-        ClientResponse<String> res = client.update(NON_EXISTENT_ID, multipart);
-        assertStatusCode(res, testName);
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
-    public void delete(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupDelete();
-        BatchClient client = new BatchClient();
-        ClientResponse<Response> res = client.delete(knownResourceId);
-        assertStatusCode(res, testName);
-    }
-
-    // ---------------------------------------------------------------
-    // Failure outcome tests : means we expect response to fail, but test to succeed
-    // ---------------------------------------------------------------
-
-    // Failure outcome
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"read"})
-    public void readNonExistent(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupReadNonExistent();
-        BatchClient client = new BatchClient();
-        ClientResponse<String> res = client.read(NON_EXISTENT_ID);
-        assertStatusCode(res, testName);
-    }
-
-    // Failure outcome
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"delete"})
-    public void deleteNonExistent(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupDeleteNonExistent();
-        BatchClient client = new BatchClient();
-        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
-        assertStatusCode(res, testName);
-    }
-
-    // Failure outcomes
-    // Placeholders until the tests below can be implemented. See Issue CSPACE-401.
-
-    @Override
-    public void createWithEmptyEntityBody(String testName) throws Exception {
-    }
-
-    @Override
-    public void createWithMalformedXml(String testName) throws Exception {
-    }
-
-    @Override
-    public void createWithWrongXmlSchema(String testName) throws Exception {
-    }
-
-    @Override
-    public void updateWithEmptyEntityBody(String testName) throws Exception {
-    }
-
-    @Override
-    public void updateWithMalformedXml(String testName) throws Exception {
-    }
-
-    @Override
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
-    }
-
-    // ---------------------------------------------------------------
-    // Utility tests : tests of code used in tests above
-    // ---------------------------------------------------------------
-
-    @Test(dependsOnMethods = {"create", "read"})
-    public void testSubmitRequest() {
-        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode(); // Expected status code: 200 OK
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getResourceURL(knownResourceId);
-        int statusCode = submitRequest(method, url);
-        logger.debug("testSubmitRequest: url=" + url + " status=" + statusCode);
-        Assert.assertEquals(statusCode, EXPECTED_STATUS);
-    }
-
     // ---------------------------------------------------------------
     // Utility methods used by tests above
     // ---------------------------------------------------------------
     
     @Override
     protected PoxPayloadOut createInstance(String identifier) {
-       BatchClient client = new BatchClient();
        return createBatchInstance(identifier);
     }
     
+       @Override
+       protected PoxPayloadOut createInstance(String commonPartName,
+                       String identifier) {
+               PoxPayloadOut result = createBatchInstance(identifier);
+               return result;
+       }
+
     private PoxPayloadOut createBatchInstance(String exitNumber) {
         String identifier = "batchNumber-" + exitNumber;
         BatchCommon batch = new BatchCommon();
@@ -269,4 +101,33 @@ public class BatchServiceTest extends AbstractServiceTestImpl {
 
         return multipart;
     }
+
+       @Override
+       protected BatchCommon updateInstance(BatchCommon batchCommon) {
+               BatchCommon result = new BatchCommon();
+               
+               result.setName("updated-" + batchCommon.getName());
+               result.setNotes("updated-" + batchCommon.getNotes());
+               
+               return result;
+       }
+
+       @Override
+       protected void compareUpdatedInstances(BatchCommon original,
+                       BatchCommon updated) throws Exception {
+               Assert.assertEquals(updated.getName(), original.getName());
+               Assert.assertEquals(updated.getNotes(), original.getNotes());
+       }
+
+    /*
+     * For convenience and terseness, this test method is the base of the test execution dependency chain.  Other test methods may
+     * refer to this method in their @Test annotation declarations.
+     */
+    @Override
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {
+                       "org.collectionspace.services.client.test.AbstractServiceTestImpl.baseCRUDTests"})    
+    public void CRUDTests(String testName) {
+       // Do nothing.  Simply here to for a TestNG execution order for our tests
+    }  
 }
index 1c52719301e1870c908e70b99c565810d19684f9..d2e347ee9f271e29bcf66919a14350b67fe65a05 100644 (file)
@@ -59,7 +59,6 @@
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>5.6</version>
         </dependency>
         
       <!-- javax -->
index 98e706cc6fbbe61ff629192096b6e6227cab7c04..12be2c20364d11d295ddd2e62e855c65ebf3ad1f 100644 (file)
@@ -59,7 +59,6 @@
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>5.6</version>
         </dependency>
         <dependency>
             <groupId>org.jboss.resteasy</groupId>
index 46a33466ce8b721e756beee36e252d27f113ed40..ee07f9a8ee6101f1470187cf98e733dffc6db863 100644 (file)
@@ -44,9 +44,6 @@ import org.collectionspace.services.blob.BlobsCommon;
 
 import org.jboss.resteasy.client.ClientResponse;
 
-import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
-import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
-import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
@@ -59,7 +56,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision:  $
  * $LastChangedDate:  $
  */
-public class BlobAuthRefsTest extends BaseServiceTest {
+public class BlobAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
 
     private final String CLASS_NAME = BlobAuthRefsTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
@@ -87,39 +84,43 @@ public class BlobAuthRefsTest extends BaseServiceTest {
     }
 
     @Override
-    protected AbstractCommonList getAbstractCommonList(ClientResponse<AbstractCommonList> response) {
+    protected AbstractCommonList getCommonList(ClientResponse<AbstractCommonList> response) {
         throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
 
     private PoxPayloadOut createBlobInstance(String depositorRefName) {
+       BlobClient blobClient = new BlobClient();
         this.depositorRefName = depositorRefName;
         this.blobName = "testblob-"+createIdentifier();
         BlobsCommon blob = new BlobsCommon();
         blob.setName(this.blobName);
 
         PoxPayloadOut multipart = new PoxPayloadOut(BlobClient.SERVICE_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = multipart.addPart(blob, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(new BlobClient().getCommonPartName());
+        PayloadOutputPart commonPart = multipart.addPart(blobClient.getCommonPartName(), blob);
         logger.debug("to be created, blob common: " + objectAsXmlString(blob, BlobsCommon.class));
         return multipart;
     }
 
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+    @Test(dataProvider = "testName")
     public void createWithAuthRefs(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
         testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
-        String identifier = createIdentifier(); // Submit the request to the service and store the response.
         createPersonRefs();// Create all the person refs and entities
         // Create a new Loans In resource. One or more fields in this resource will be PersonAuthority
         //    references, and will refer to Person resources by their refNames.
         BlobClient blobClient = new BlobClient();
         PoxPayloadOut multipart = createBlobInstance(depositorRefName);
         ClientResponse<Response> res = blobClient.create(multipart);
-        assertStatusCode(res, testName);
-        if (knownResourceId == null) {// Store the ID returned from the first resource created for additional tests below.
-            knownResourceId = extractId(res);
+        try {
+               assertStatusCode(res, testName);
+               if (knownResourceId == null) {// Store the ID returned from the first resource created for additional tests below.
+                   knownResourceId = extractId(res);
+               }
+               blobIdsCreated.add(extractId(res));// Store the IDs from every resource created; delete on cleanup
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        blobIdsCreated.add(extractId(res));// Store the IDs from every resource created; delete on cleanup
     }
 
     protected void createPersonRefs() {
@@ -127,22 +128,30 @@ public class BlobAuthRefsTest extends BaseServiceTest {
         // Create a temporary PersonAuthority resource, and its corresponding refName by which it can be identified.
         PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(PERSON_AUTHORITY_NAME, PERSON_AUTHORITY_NAME, personAuthClient.getCommonPartName());
         ClientResponse<Response> res = personAuthClient.create(multipart);
-        assertStatusCode(res, "createPersonRefs (not a surefire test)");
-        personAuthCSID = extractId(res);
-        String authRefName = PersonAuthorityClientUtils.getAuthorityRefName(personAuthCSID, null);
-        // Create temporary Person resources, and their corresponding refNames by which they can be identified.
-        String csid = "";
-
-        csid = createPerson("Owen the Cur", "Owner", "owenCurOwner", authRefName);
-        personIdsCreated.add(csid);
-        depositorRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
-
-        csid = createPerson("Davenport", "Depositor", "davenportDepositor", authRefName);
-        personIdsCreated.add(csid);
-        depositorRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+        try {
+               assertStatusCode(res, "createPersonRefs (not a surefire test)");
+               personAuthCSID = extractId(res);
+               String authRefName = PersonAuthorityClientUtils.getAuthorityRefName(personAuthCSID, null);
+               // Create temporary Person resources, and their corresponding refNames by which they can be identified.
+               String csid = "";
+       
+               csid = createPerson("Owen the Cur", "Owner", "owenCurOwner", authRefName);
+               personIdsCreated.add(csid);
+               depositorRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+       
+               csid = createPerson("Davenport", "Depositor", "davenportDepositor", authRefName);
+               personIdsCreated.add(csid);
+               depositorRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
     }
 
     protected String createPerson(String firstName, String surName, String shortId, String authRefName) {
+       String result = null;
+       
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         Map<String, String> personInfo = new HashMap<String, String>();
         personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
@@ -150,8 +159,16 @@ public class BlobAuthRefsTest extends BaseServiceTest {
         personInfo.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId);
         PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonInstance(personAuthCSID, authRefName, personInfo, personAuthClient.getItemCommonPartName());
         ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
-        assertStatusCode(res, "createPerson (not a surefire test)");
-        return extractId(res);
+        try {
+               assertStatusCode(res, "createPerson (not a surefire test)");
+               result = extractId(res);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
+        
+        return result;
     }
 
     // @Test annotation commented out by Aron 2010-12-02 until blob payload is set to the
@@ -162,36 +179,48 @@ public class BlobAuthRefsTest extends BaseServiceTest {
     //
     // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"createWithAuthRefs"})
     public void readAndCheckAuthRefs(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
         testSetup(STATUS_OK, ServiceRequestType.READ);
         BlobClient blobClient = new BlobClient();
         ClientResponse<String> res = blobClient.read(knownResourceId);
-        assertStatusCode(res, testName);
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        BlobsCommon blob = (BlobsCommon) extractPart(input, blobClient.getCommonPartName(), BlobsCommon.class);
-        Assert.assertNotNull(blob);
-        logger.debug(objectAsXmlString(blob, BlobsCommon.class));
+        BlobsCommon blob = null;
+        try {
+               assertStatusCode(res, testName);
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               blob = (BlobsCommon) extractPart(input, blobClient.getCommonPartName(), BlobsCommon.class);
+               Assert.assertNotNull(blob);
+               logger.debug(objectAsXmlString(blob, BlobsCommon.class));
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
 
         // Check a couple of fields
         Assert.assertEquals(blob.getName(), blobName);
 
         // Get the auth refs and check them
         ClientResponse<AuthorityRefList> res2 = blobClient.getAuthorityRefs(knownResourceId);
-        assertStatusCode(res2, testName);
-        AuthorityRefList list = res2.getEntity();
-        List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
-        int numAuthRefsFound = items.size();
-        logger.debug("Authority references, found " + numAuthRefsFound);
-        //Assert.assertEquals(numAuthRefsFound, NUM_AUTH_REFS_EXPECTED,
-        //                    "Did not find all expected authority references! " +
-        //                    "Expected " + NUM_AUTH_REFS_EXPECTED + ", found " + numAuthRefsFound);
-        if (logger.isDebugEnabled()) {
-            int i = 0;
-            for (AuthorityRefList.AuthorityRefItem item : items) {
-                logger.debug(testName + ": list-item[" + i + "] Field:" + item.getSourceField() + "= " + item.getAuthDisplayName() + item.getItemDisplayName());
-                logger.debug(testName + ": list-item[" + i + "] refName=" + item.getRefName());
-                logger.debug(testName + ": list-item[" + i + "] URI=" + item.getUri());
-                i++;
+        try {
+               assertStatusCode(res2, testName);
+               AuthorityRefList list = res2.getEntity();
+               List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
+               int numAuthRefsFound = items.size();
+               logger.debug("Authority references, found " + numAuthRefsFound);
+               //Assert.assertEquals(numAuthRefsFound, NUM_AUTH_REFS_EXPECTED,
+               //                    "Did not find all expected authority references! " +
+               //                    "Expected " + NUM_AUTH_REFS_EXPECTED + ", found " + numAuthRefsFound);
+               if (logger.isDebugEnabled()) {
+                   int i = 0;
+                   for (AuthorityRefList.AuthorityRefItem item : items) {
+                       logger.debug(testName + ": list-item[" + i + "] Field:" + item.getSourceField() + "= " + item.getAuthDisplayName() + item.getItemDisplayName());
+                       logger.debug(testName + ": list-item[" + i + "] refName=" + item.getRefName());
+                       logger.debug(testName + ": list-item[" + i + "] URI=" + item.getUri());
+                       i++;
+                   }
+               }
+        } finally {
+               if (res2 != null) {
+                       res2.releaseConnection();
             }
         }
     }
@@ -230,5 +259,4 @@ public class BlobAuthRefsTest extends BaseServiceTest {
             }
         }
     }
-
 }
diff --git a/services/blob/client/src/test/java/org/collectionspace/services/client/test/BlobScaleTest.java b/services/blob/client/src/test/java/org/collectionspace/services/client/test/BlobScaleTest.java
new file mode 100644 (file)
index 0000000..3324e73
--- /dev/null
@@ -0,0 +1,151 @@
+package org.collectionspace.services.client.test;\r
+\r
+import java.awt.Color;\r
+import java.awt.Font;\r
+import java.awt.Graphics;\r
+import java.awt.image.BufferedImage;\r
+import java.io.File;\r
+import java.io.IOException;\r
+import java.net.MalformedURLException;\r
+import java.net.URL;\r
+import java.util.Random;\r
+\r
+import javax.imageio.ImageIO;\r
+import javax.ws.rs.core.Response;\r
+\r
+import org.collectionspace.services.client.BlobClient;\r
+import org.collectionspace.services.client.CollectionSpaceClient;\r
+import org.collectionspace.services.common.profile.Profiler;\r
+import org.collectionspace.services.jaxb.AbstractCommonList;\r
+import org.jboss.resteasy.client.ClientResponse;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+import org.testng.annotations.Test;\r
+\r
+public class BlobScaleTest extends BaseServiceTest<AbstractCommonList> {\r
+\r
+    private final Logger logger = LoggerFactory.getLogger(BlobScaleTest.class);\r
+       \r
+       private static final int IMAGE_SIZE = 1000;\r
+       private static final int IMAGE_EDGE = -15;\r
+       private static final int MIN_FONTSIZE = 15;\r
+       private static final int MAX_FONTSIZE = 60;\r
+       private static final String IMAGES_TO_CREATE_PROP = "imagesToCreate";\r
+       private static final int DEFAULT_IMAGES_TO_CREATE = 1;\r
+    private static final String GENERATED_IMAGES = "target/generated_images";\r
+\r
+       private static Random generator = new Random(System.currentTimeMillis());\r
+       \r
+       @Override\r
+       protected CollectionSpaceClient getClientInstance() {\r
+        return new BlobClient();\r
+       }\r
+\r
+       @Override\r
+       protected String getServicePathComponent() {\r
+               return BlobClient.SERVICE_PATH_COMPONENT;\r
+       }\r
+\r
+       @Override\r
+       protected String getServiceName() {\r
+               return BlobClient.SERVICE_NAME;\r
+       }\r
+\r
+       private int getImagesToCreate() {\r
+               int result = DEFAULT_IMAGES_TO_CREATE;\r
+               \r
+        String imagesToCreate = System.getProperty(IMAGES_TO_CREATE_PROP);\r
+        try {\r
+               result = Integer.parseInt(imagesToCreate);\r
+        } catch (NumberFormatException np) {\r
+               logger.info("No value (or a bad value) for system property '"\r
+                               + IMAGES_TO_CREATE_PROP\r
+                               + "' was defined, so we'll use the default instead.");\r
+        } finally {\r
+               logger.info("Testing blob scaling by creating "\r
+                               + result\r
+                               + " images.");\r
+        }\r
+        \r
+        return result;\r
+       }\r
+       \r
+       @Test(dataProvider = "testName")\r
+       public void scaleTest(String testName) throws MalformedURLException {\r
+               this.createDirectory(GENERATED_IMAGES);\r
+               setupCreate();\r
+               int imagesToCreate = getImagesToCreate();\r
+        BlobClient client = new BlobClient();\r
+               Profiler profiler = new Profiler(this, 1);\r
+        \r
+        for (int i = 0; i < imagesToCreate; i++, profiler.reset()) {\r
+                       File jpegFile = createJpeg(GENERATED_IMAGES);   \r
+                       URL url = jpegFile.toURI().toURL();\r
+                       \r
+               profiler.start();\r
+                       ClientResponse<Response> res = client.createBlobFromURI(url.toString());\r
+                       try {\r
+                               profiler.stop();\r
+                       assertStatusCode(res, testName);\r
+                               logger.debug(\r
+                                               i + ": Uploaded image to Nuxeo in "\r
+                                               + profiler.getCumulativeTime()\r
+                                               + " milleseconds "\r
+                                               + " - "\r
+                                               + " : "\r
+                                               + jpegFile.getAbsolutePath());\r
+                               \r
+                       String csid = extractId(res);\r
+                       allResourceIdsCreated.add(csid);\r
+                       } finally {\r
+                               if (res != null) {\r
+                    res.releaseConnection();\r
+                }\r
+                       }\r
+        }\r
+       }\r
+       \r
+       private void createDirectory(String dirName) {\r
+               boolean success = (\r
+                               new File(dirName)).mkdir();\r
+               if (success) {\r
+                       logger.debug("Directory: " \r
+                                       + dirName + " created");\r
+               } \r
+       }\r
+       \r
+       public File createJpeg(String destDir) {\r
+               File result = null;\r
+\r
+               BufferedImage image = new BufferedImage(IMAGE_SIZE, IMAGE_SIZE, BufferedImage.TYPE_INT_RGB);   \r
+               Graphics g = image.getGraphics();\r
+               for (int i = 0; i < IMAGE_SIZE; i = i + 10) {\r
+                       int x = random(IMAGE_EDGE, IMAGE_SIZE);\r
+                       int y = random(IMAGE_EDGE, IMAGE_SIZE);\r
+                       g.drawString(Integer.toString(random(-123456789, 123456789)), x, y);\r
+                       Color c = new Color(random(0, 255), random(0, 255), random(0, 255));\r
+                       g.setColor(c);\r
+\r
+                       Font currentFont = g.getFont();\r
+                       Font newFont = new Font(currentFont.getFontName(), currentFont.getStyle(),\r
+                                       random(MIN_FONTSIZE, MAX_FONTSIZE));\r
+                       g.setFont(newFont);\r
+               }\r
+               try {    \r
+                       ImageIO.write(image, "jpg", result = new File(destDir\r
+                                       + File.separator\r
+                                       + System.currentTimeMillis()\r
+                                       + ".jpg"));\r
+               } catch (IOException e) {    \r
+                       e.printStackTrace();   \r
+               } \r
+\r
+               return result;\r
+       }\r
+\r
+       public int random(int min, int max) {\r
+               return min + (int)(generator.nextFloat() * ((max - min) + 1));\r
+       }\r
+       \r
+\r
+}\r
index 381312b3a4a717510ced908fb6b458749460865b..3bc6e801d997e61e045d3d77c19f6b84d478ca18 100644 (file)
@@ -24,19 +24,15 @@ package org.collectionspace.services.client.test;
 
 import java.io.File;
 import java.math.BigDecimal;
-import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.List;
 
 import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
 
-import org.collectionspace.services.client.BlobProxy;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.BlobClient;
 import org.collectionspace.services.client.PayloadOutputPart;
-import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.blob.BlobsCommon;
@@ -58,11 +54,10 @@ import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
  * $LastChangedRevision:  $
  * $LastChangedDate:  $
  */
-public class BlobServiceTest extends AbstractGenericServiceTestImpl<BlobsCommon> {
+public class BlobServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonList, BlobsCommon> {
 
     private final String CLASS_NAME = BlobServiceTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
-    private String knownResourceId = null;
     
     private final static String KNOWN_IMAGE_FILENAME = "01-03-09_1546.jpg";
     private final static int WIDTH_DIMENSION_INDEX = 0;
@@ -86,12 +81,12 @@ public class BlobServiceTest extends AbstractGenericServiceTestImpl<BlobsCommon>
        }
     
     @Override
-    protected CollectionSpaceClient<AbstractCommonList, BlobProxy> getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() {
         return new BlobClient();
     }
 
     @Override
-    protected AbstractCommonList getAbstractCommonList(ClientResponse<AbstractCommonList> response) {
+    protected AbstractCommonList getCommonList(ClientResponse<AbstractCommonList> response) {
         return response.getEntity(AbstractCommonList.class);
     }
 
@@ -113,23 +108,7 @@ public class BlobServiceTest extends AbstractGenericServiceTestImpl<BlobsCommon>
     private boolean isBlobCleanup() {
        return blobCleanup;
     }
-    
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
-    public void create(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupCreate();
-        BlobClient client = new BlobClient();
-        PoxPayloadOut multipart = createBlobInstance(createIdentifier());
-        ClientResponse<Response> res = client.create(multipart);
-        assertStatusCode(res, testName);
-        if (knownResourceId == null) {
-            knownResourceId = extractId(res);  // Store the ID returned from the first resource created for additional tests below.
-            logger.debug(testName + ": knownResourceId=" + knownResourceId);
-        }
-        allResourceIdsCreated.add(extractId(res)); // Store the IDs from every resource created by tests so they can be deleted after tests have been run.
-    }
-    
+        
     /**
      * Looks in the .../src/test/resources/blobs directory for files from which to create Blob
      * instances.
@@ -168,10 +147,16 @@ public class BlobServiceTest extends AbstractGenericServiceTestImpl<BlobsCommon>
                                            OutputPart outputPart = form.addFormData("file", child, MediaType.valueOf(mimeType));
                                            res = client.createBlobFromFormData(form);
                                        }
-                                   assertStatusCode(res, testName);
-                                   if (isBlobCleanup() == true) {
-                                       allResourceIdsCreated.add(extractId(res));
-                                   }
+                                       try {
+                                           assertStatusCode(res, testName);
+                                           if (isBlobCleanup() == true) {
+                                               allResourceIdsCreated.add(extractId(res));
+                                           }
+                                       } finally {
+                                               if (res != null) {
+                                       res.releaseConnection();
+                                   }
+                                       }
                                }
                        }
                } else {
@@ -182,9 +167,11 @@ public class BlobServiceTest extends AbstractGenericServiceTestImpl<BlobsCommon>
         }
     }
     
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"createBlobWithURI"})
+    /*
+     * For a known image file, make sure we're getting back the correct metadata about it.
+     */
+    @Test(dataProvider = "testName", dependsOnMethods = {"createBlobWithURI"})
     public void testImageDimensions(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
         setupCreate();
         
         String currentDir = this.getResourceDir();
@@ -193,23 +180,40 @@ public class BlobServiceTest extends AbstractGenericServiceTestImpl<BlobsCommon>
         File file = new File(blobsDirPath);
         URL fileUrl = file.toURI().toURL();
         String uri = fileUrl.toString();
-        
+        //
+        // Create the blob
+        //
         BlobClient client = new BlobClient();
                ClientResponse<Response> res = null;
                res = client.createBlobFromURI(uri);
-        assertStatusCode(res, testName);
-        
-        String blobCsid = extractId(res);
-        if (isBlobCleanup() == true) {
-               allResourceIdsCreated.add(blobCsid);
-        }
-        
+               String blobCsid = null;
+               try {
+               assertStatusCode(res, testName);                
+               blobCsid = extractId(res);
+               if (isBlobCleanup() == true) {
+                       allResourceIdsCreated.add(blobCsid);
+               }
+               } finally {
+                       if (res != null) {
+                res.releaseConnection();
+            }
+               }
+        //
+               // Read the blob back to get the new dimension data
+               //
         setupRead();
         ClientResponse<String> readResponse = client.read(blobCsid);
-        assertStatusCode(readResponse, testName);
+        BlobsCommon blobsCommon = null;
+        try {
+               assertStatusCode(readResponse, testName);
+            blobsCommon = this.extractCommonPartValue(readResponse);
+            Assert.assertNotNull(blobsCommon);
+        } finally {
+               if (readResponse != null) {
+                       readResponse.releaseConnection();
+            }
+        }
         
-        BlobsCommon blobsCommon = this.extractCommonPartValue(readResponse);
-        Assert.assertTrue(blobsCommon != null);
         Assert.assertEquals(blobsCommon.getLength(), KNOWN_IMAGE_SIZE, "The known image blob was not the expected size of " + KNOWN_IMAGE_SIZE);
         
         MeasuredPartGroup measuredImagePart = blobsCommon.getMeasuredPartGroupList().getMeasuredPartGroup().get(0);
@@ -225,184 +229,24 @@ public class BlobServiceTest extends AbstractGenericServiceTestImpl<BlobsCommon>
         Assert.assertTrue(heightDimension.getValue().compareTo(KNOWN_IMAGE_HEIGHT) == 0);
     }
     
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create"})
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+               dependsOnMethods = {"CRUDTests"})
     public void createBlobWithURI(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
        createBlob(testName, true /*with URI*/, null);
     }
     
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create"})
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+               dependsOnMethods = {"CRUDTests"})
     public void createBlobWithURL(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
        createBlob(testName, true /*with URI*/, "http://farm6.static.flickr.com/5289/5688023100_15e00cde47_o.jpg");
     }    
     
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
                dependsOnMethods = {"createBlobWithURI"})
     public void createBlobWithPost(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
        createBlob(testName, false /*with POST*/, null);
     }
 
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create"})
-    public void createList(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        for (int i = 0; i < 3; i++) {
-            create(testName);
-        }
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create"})
-    public void read(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupRead();
-        BlobClient client = new BlobClient();
-        ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        BlobsCommon blob = (BlobsCommon) extractPart(input, client.getCommonPartName(), BlobsCommon.class);
-        Assert.assertNotNull(blob);
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"createList", "read"})
-    public void readList(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupReadList();
-        BlobClient client = new BlobClient();
-        ClientResponse<AbstractCommonList> res = client.readList();
-        assertStatusCode(res, testName);
-        AbstractCommonList list = res.getEntity();
-        if (logger.isDebugEnabled()) {
-            List<AbstractCommonList.ListItem> items =
-                list.getListItem();
-            int i = 0;
-            for(AbstractCommonList.ListItem item : items){
-                logger.debug(testName + ": list-item[" + i + "] " +
-                        item.toString());
-                i++;
-            }
-        }
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"read"})
-    public void update(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupUpdate();
-        BlobClient client = new BlobClient();
-        ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-        logger.debug("got object to update with ID: " + knownResourceId);
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        BlobsCommon blob = (BlobsCommon) extractPart(input, client.getCommonPartName(), BlobsCommon.class);
-        Assert.assertNotNull(blob);
-
-        blob.setName("updated-" + blob.getName());
-        logger.debug("Object to be updated:"+objectAsXmlString(blob, BlobsCommon.class));
-        PoxPayloadOut output = new PoxPayloadOut(BlobClient.SERVICE_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = output.addPart(blob, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getCommonPartName());
-        res = client.update(knownResourceId, output);
-        assertStatusCode(res, testName);
-        input = new PoxPayloadIn(res.getEntity());
-        BlobsCommon updatedBlob = (BlobsCommon) extractPart(input, client.getCommonPartName(), BlobsCommon.class);
-        Assert.assertNotNull(updatedBlob);
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"update", "testSubmitRequest"})
-    public void updateNonExistent(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupUpdateNonExistent();
-        // Submit the request to the service and store the response.
-        // Note: The ID used in this 'create' call may be arbitrary.
-        // The only relevant ID may be the one used in update(), below.
-        BlobClient client = new BlobClient();
-        PoxPayloadOut multipart = createBlobInstance(NON_EXISTENT_ID);
-        ClientResponse<String> res = client.update(NON_EXISTENT_ID, multipart);
-        assertStatusCode(res, testName);
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
-    public void delete(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupDelete();
-        BlobClient client = new BlobClient();
-        ClientResponse<Response> res = client.delete(knownResourceId);
-        assertStatusCode(res, testName);
-    }
-
-    // ---------------------------------------------------------------
-    // Failure outcome tests : means we expect response to fail, but test to succeed
-    // ---------------------------------------------------------------
-
-    // Failure outcome
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"read"})
-    public void readNonExistent(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupReadNonExistent();
-        BlobClient client = new BlobClient();
-        ClientResponse<String> res = client.read(NON_EXISTENT_ID);
-        assertStatusCode(res, testName);
-    }
-
-    // Failure outcome
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"delete"})
-    public void deleteNonExistent(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupDeleteNonExistent();
-        BlobClient client = new BlobClient();
-        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
-        assertStatusCode(res, testName);
-    }
-
-    // Failure outcomes
-    // Placeholders until the tests below can be implemented. See Issue CSPACE-401.
-
-    @Override
-    public void createWithEmptyEntityBody(String testName) throws Exception {
-    }
-
-    @Override
-    public void createWithMalformedXml(String testName) throws Exception {
-    }
-
-    @Override
-    public void createWithWrongXmlSchema(String testName) throws Exception {
-    }
-
-    @Override
-    public void updateWithEmptyEntityBody(String testName) throws Exception {
-    }
-
-    @Override
-    public void updateWithMalformedXml(String testName) throws Exception {
-    }
-
-    @Override
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
-    }
-
-    // ---------------------------------------------------------------
-    // Utility tests : tests of code used in tests above
-    // ---------------------------------------------------------------
-
-    @Test(dependsOnMethods = {"create", "read"})
-    public void testSubmitRequest() {
-        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode(); // Expected status code: 200 OK
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getResourceURL(knownResourceId);
-        int statusCode = submitRequest(method, url);
-        logger.debug("testSubmitRequest: url=" + url + " status=" + statusCode);
-        Assert.assertEquals(statusCode, EXPECTED_STATUS);
-    }
-
     // ---------------------------------------------------------------
     // Utility methods used by tests above
     // ---------------------------------------------------------------
@@ -413,12 +257,12 @@ public class BlobServiceTest extends AbstractGenericServiceTestImpl<BlobsCommon>
     }    
     
     private PoxPayloadOut createBlobInstance(String exitNumber) {
+       BlobClient client = new BlobClient();
         String identifier = "blobNumber-" + exitNumber;
         BlobsCommon blob = new BlobsCommon();
         blob.setName(identifier);
         PoxPayloadOut multipart = new PoxPayloadOut(BlobClient.SERVICE_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = multipart.addPart(blob, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(new BlobClient().getCommonPartName());
+        PayloadOutputPart commonPart = multipart.addPart(client.getCommonPartName(), blob);
 
         if (logger.isDebugEnabled()) {
             logger.debug("to be created, blob common");
@@ -427,4 +271,37 @@ public class BlobServiceTest extends AbstractGenericServiceTestImpl<BlobsCommon>
 
         return multipart;
     }
+
+       @Override
+       protected PoxPayloadOut createInstance(String commonPartName,
+                       String identifier) {
+               return createInstance(identifier);
+       }
+
+    /*
+     * For convenience and terseness, this test method is the base of the test execution dependency chain.  Other test methods may
+     * refer to this method in their @Test annotation declarations.
+     */
+    @Override
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {
+                       "org.collectionspace.services.client.test.AbstractServiceTestImpl.baseCRUDTests"})    
+    public void CRUDTests(String testName) {
+       // Do nothing.  Simply here to for a TestNG execution order for our tests
+    }
+
+       @Override
+       protected BlobsCommon updateInstance(BlobsCommon blobsCommon) {
+               BlobsCommon result = new BlobsCommon();
+               
+        result.setName("updated-" + blobsCommon.getName());
+               
+               return result;
+       }
+
+       @Override
+       protected void compareUpdatedInstances(BlobsCommon original,
+                       BlobsCommon updated) throws Exception {
+               Assert.assertEquals(updated.getName(), original.getName());
+       }
 }
index 18c510350fd16aa0b59d63d387ee5634a4d3fea1..5b4e490b602fe38c475c0e6fa82f7a3ca1ac88b2 100644 (file)
@@ -18,6 +18,8 @@ log4j.appender.R.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n
 \r
 #packages\r
 log4j.logger.org.collectionspace=DEBUG\r
+log4j.logger.perf.collectionspace=TRACE\r
+\r
 log4j.logger.org.apache=INFO\r
 log4j.logger.httpclient=INFO\r
 log4j.logger.org.jboss.resteasy=INFO\r
index f589cb5291f8b4dc208dc847ea5305220093a401..3d933d96b529d936158350fd7998ec39bd125940 100644 (file)
@@ -40,7 +40,6 @@
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>5.6</version>
         </dependency>
         
       <!-- javax -->
index 8f9afc50fcfa08d31babf682a2e45e946d8392b9..8ff6556ec0f7c6689c700bea8bda034becb8a5b7 100644 (file)
@@ -7,7 +7,6 @@
     </parent>\r
 \r
     <modelVersion>4.0.0</modelVersion>\r
-    <groupId>org.collectionspace.services</groupId>\r
     <artifactId>org.collectionspace.services.client</artifactId>\r
     <name>services.client</name>\r
     <packaging>jar</packaging>\r
             <artifactId>slf4j-log4j12</artifactId>\r
             <scope>provided</scope>\r
         </dependency>\r
+        \r
 <!-- CollectionSpace dependencies -->\r
-<!--        <dependency>\r
-            <groupId>org.collectionspace.services</groupId>\r
-            <artifactId>org.collectionspace.services.common</artifactId>\r
-            <version>${project.version}</version>\r
-            <optional>true</optional>\r
-        </dependency> -->\r
+\r
         <dependency>\r
             <groupId>org.collectionspace.services</groupId>\r
             <artifactId>org.collectionspace.services.jaxb</artifactId>\r
             <version>${project.version}</version>\r
         </dependency>\r
         \r
-<!-- External dependencies -->        \r
+<!-- External dependencies -->\r
+\r
         <dependency>\r
             <groupId>org.apache.maven.plugins</groupId>\r
             <artifactId>maven-surefire-plugin</artifactId>\r
@@ -74,7 +70,7 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
+            <scope>compile</scope>\r
         </dependency>\r
 \r
         <!-- javax -->\r
index 507c0cf30c046a724e478b852e10c87839eb71c4..22cae7501f250a61707cd3da423e7bd071162b10 100644 (file)
@@ -1,31 +1,18 @@
 package org.collectionspace.services.client;\r
 \r
 import org.collectionspace.services.jaxb.AbstractCommonList;\r
-import org.jboss.resteasy.client.ClientResponse;\r
 \r
-public abstract class AbstractCommonListPoxServiceClientImpl<P \r
-               extends CollectionSpaceCommonListPoxProxy> extends\r
-               AbstractPoxServiceClientImpl<AbstractCommonList, P> {\r
-\r
-       /*\r
-        * Proxied service calls.\r
-        */\r
-       \r
-    /**\r
-     * @return\r
-     * @see org.collectionspace.hello.client.IntakeProxy#getIntake()\r
-     */\r
-    public ClientResponse<AbstractCommonList> readList() {\r
-        return getProxy().readList();\r
-    }\r
-\r
-    /**\r
-     * @param csid\r
-     * @return\r
-     * @see org.collectionspace.hello.client.IntakeProxy#getIntake(java.lang.String)\r
-     */\r
-    @Override\r
-       public ClientResponse<String> read(String csid) {\r
-        return getProxy().read(csid);\r
-    }\r
+/**\r
+ * \r
+ * @author remillet\r
+ *\r
+ * All clients returning AbstractCommonList types should extend this class.\r
+ * \r
+ * @param <P>\r
+ */\r
+public abstract class AbstractCommonListPoxServiceClientImpl<P extends CollectionSpaceCommonListPoxProxy>\r
+       extends AbstractPoxServiceClientImpl<AbstractCommonList, P> {\r
+       //\r
+       // All clients returning AbstractCommonList types should extend this class.\r
+       //\r
 }\r
index 70532093bb7bd6836db656b086c546caf7fe3c6e..56ad16593fc69e6254a9247be2e7c316d737e9b7 100644 (file)
@@ -1,17 +1,17 @@
 package org.collectionspace.services.client;\r
 \r
 import javax.ws.rs.core.Response;\r
+import org.jboss.resteasy.client.ClientResponse;\r
 \r
 import org.collectionspace.services.jaxb.AbstractCommonList;\r
-import org.jboss.resteasy.client.ClientResponse;\r
 \r
 /*\r
- * LT = List type\r
+ * CLT = List type\r
  * P = Proxy type\r
  */\r
-public abstract class AbstractPoxServiceClientImpl<LT extends AbstractCommonList, P extends CollectionSpacePoxProxy<LT>>\r
-       extends AbstractServiceClientImpl<LT, P> \r
-       implements CollectionSpacePoxClient<LT, P> {\r
+public abstract class AbstractPoxServiceClientImpl<CLT extends AbstractCommonList, P extends CollectionSpacePoxProxy<CLT>>\r
+       extends AbstractServiceClientImpl<CLT, PoxPayloadOut, String, P> \r
+       implements CollectionSpacePoxClient<CLT, P> {\r
        \r
     @Override\r
     public ClientResponse<Response> create(PoxPayloadOut xmlPayload) {\r
@@ -22,7 +22,18 @@ public abstract class AbstractPoxServiceClientImpl<LT extends AbstractCommonList
        public ClientResponse<String> read(String csid) {\r
         return getProxy().read(csid);\r
     }\r
-\r
+    \r
+    public ClientResponse<CLT> readList() {\r
+       CollectionSpaceProxy<CLT> proxy = (CollectionSpaceProxy<CLT>)getProxy();\r
+       return proxy.readList();\r
+    }    \r
+    \r
+    @Override\r
+    public ClientResponse<CLT> readIncludeDeleted(Boolean includeDeleted) {\r
+       CollectionSpacePoxProxy<CLT> proxy = getProxy();\r
+       return proxy.readIncludeDeleted(includeDeleted.toString());\r
+    }\r
+    \r
     @Override\r
        public ClientResponse<String> readIncludeDeleted(String csid, Boolean includeDeleted) {\r
         return getProxy().readIncludeDeleted(csid, includeDeleted.toString());\r
@@ -33,21 +44,16 @@ public abstract class AbstractPoxServiceClientImpl<LT extends AbstractCommonList
         return getProxy().update(csid, xmlPayload.getBytes());\r
     }\r
     \r
-    @Override\r
-    public ClientResponse<LT> readIncludeDeleted(Boolean includeDeleted) {\r
-       CollectionSpacePoxProxy<LT> proxy = getProxy();\r
-       return proxy.readIncludeDeleted(includeDeleted.toString());\r
-    }\r
 \r
     @Override\r
-    public ClientResponse<LT> keywordSearchIncludeDeleted(String keywords, Boolean includeDeleted) {\r
-        CollectionSpacePoxProxy<LT> proxy = getProxy();\r
+    public ClientResponse<CLT> keywordSearchIncludeDeleted(String keywords, Boolean includeDeleted) {\r
+        CollectionSpacePoxProxy<CLT> proxy = getProxy();\r
         return proxy.keywordSearchIncludeDeleted(keywords, includeDeleted.toString());\r
     }\r
 \r
     @Override\r
-    public ClientResponse<LT> advancedSearchIncludeDeleted(String whereClause, Boolean includeDeleted) {\r
-        CollectionSpacePoxProxy<LT> proxy = getProxy();\r
+    public ClientResponse<CLT> advancedSearchIncludeDeleted(String whereClause, Boolean includeDeleted) {\r
+        CollectionSpacePoxProxy<CLT> proxy = getProxy();\r
         return proxy.advancedSearchIncludeDeleted(whereClause, includeDeleted.toString());\r
     }\r
 \r
index f2a5e1d11c908f87adbcd4e2d7d4457f66e86d79..f898152a32dbe9891084eb88fba32ff51349ce3a 100644 (file)
@@ -37,7 +37,7 @@ import org.apache.commons.httpclient.auth.AuthScope; //import org.collectionspac
 \r
 import org.collectionspace.services.common.authorityref.AuthorityRefList;\r
 import org.collectionspace.services.jaxb.AbstractCommonList;\r
-import org.collectionspace.services.workflow.WorkflowCommon;\r
+\r
 import org.jboss.resteasy.client.ClientResponse; //import org.collectionspace.services.common.context.ServiceContext;\r
 import org.jboss.resteasy.client.ProxyFactory;\r
 import org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor;\r
@@ -52,9 +52,14 @@ import org.slf4j.LoggerFactory;
  * http://issues.collectionspace.org/browse/CSPACE-1684\r
  * @param <CommonListType> \r
  * @param <ListType> \r
+ * \r
+ * CLT - List type\r
+ * REQUEST_PT - Request payload type\r
+ * RESPONSE_PT - Response payload type\r
+ * P - Proxy type\r
  */\r
-public abstract class AbstractServiceClientImpl<LT, P extends CollectionSpaceProxy<LT>>\r
-       implements CollectionSpaceClient<LT, P> {\r
+public abstract class AbstractServiceClientImpl<CLT, REQUEST_PT, RESPONSE_PT, P extends CollectionSpaceProxy<CLT>>\r
+       implements CollectionSpaceClient<CLT, REQUEST_PT, RESPONSE_PT, P> {\r
 \r
     /** The logger. */\r
     protected final Logger logger = LoggerFactory.getLogger(AbstractServiceClientImpl.class);\r
@@ -101,6 +106,13 @@ public abstract class AbstractServiceClientImpl<LT, P extends CollectionSpacePro
                return result;\r
     }\r
     \r
+    /*\r
+     * Subclasses can override this method to return their AbstractCommonList subclass\r
+     */\r
+    protected Class<CLT> getCommonListType() {\r
+       return (Class<CLT>) AbstractCommonList.class;\r
+    }\r
+    \r
     /**\r
      * Gets the common part name.\r
      *\r
@@ -427,6 +439,7 @@ public abstract class AbstractServiceClientImpl<LT, P extends CollectionSpacePro
      * these methods with their specific "common" list return types.  Otherwise, only the info\r
      * in the AbstractCommonList type will be returned to the callers\r
      */\r
+\r
     \r
     /*\r
      * (non-Javadoc)\r
@@ -436,7 +449,7 @@ public abstract class AbstractServiceClientImpl<LT, P extends CollectionSpacePro
      * .lang.String, java.lang.String)\r
      */\r
     @Override\r
-    public ClientResponse<AbstractCommonList> readList(Long pageSize,\r
+    public ClientResponse<CLT> readList(Long pageSize,\r
                Long pageNumber) {\r
         return getProxy().readList(pageSize, pageNumber);\r
     }\r
@@ -449,7 +462,7 @@ public abstract class AbstractServiceClientImpl<LT, P extends CollectionSpacePro
      * .lang.String, java.lang.String)\r
      */\r
     @Override\r
-    public ClientResponse<AbstractCommonList> readList(String sortBy, Long pageSize,\r
+    public ClientResponse<CLT> readList(String sortBy, Long pageSize,\r
             Long pageNumber) {\r
         return getProxy().readList(sortBy, pageSize, pageNumber);\r
     }\r
index 486f2718cd366704d5fea244e49c51fb3e2a28c8..f81c583fb0d9de7e898a777ce7724ed19c5e486d 100644 (file)
@@ -1,18 +1,18 @@
 package org.collectionspace.services.client;\r
 \r
 import javax.ws.rs.core.Response;\r
+import org.jboss.resteasy.client.ClientResponse;\r
 \r
 import org.collectionspace.services.common.authorityref.AuthorityRefDocList;\r
 import org.collectionspace.services.common.authorityref.AuthorityRefList;\r
 import org.collectionspace.services.jaxb.AbstractCommonList;\r
-import org.jboss.resteasy.client.ClientResponse;\r
 \r
 /*\r
  * LT - List type\r
  * ILT - Authority item list type\r
  * P - Proxy type\r
  */\r
-public interface AuthorityClient<P extends AuthorityProxy> \r
+public interface AuthorityClient<AUTHORITY_ITEM_TYPE, P extends AuthorityProxy> \r
        extends CollectionSpacePoxClient<AbstractCommonList, P> {\r
 \r
     /** The uri path element for items in an authority */\r
@@ -23,6 +23,12 @@ public interface AuthorityClient<P extends AuthorityProxy>
         */\r
        \r
     String getItemCommonPartName();\r
+    \r
+    // Get the inAuthorityCsid (the item's parent)\r
+    String getInAuthority(AUTHORITY_ITEM_TYPE item);\r
+       \r
+    // Get the inAuthorityCsid (the item's parent)\r
+    void setInAuthority(AUTHORITY_ITEM_TYPE item, String inAuthorityCsid);\r
        \r
     //(C)reate Item\r
     ClientResponse<Response> createItem(String vcsid, PoxPayloadOut poxPayloadOut);\r
index f77bfbf3f844aaa511f6e014ecb9c134b5dd96fd..fbdda135d002daa574918d6840ef116d3feb01c6 100644 (file)
@@ -10,9 +10,9 @@ import org.collectionspace.services.jaxb.AbstractCommonList;
 /*\r
  * P - Proxy type\r
  */\r
-public abstract class AuthorityClientImpl<P extends AuthorityProxy>\r
-       extends AbstractCommonListPoxServiceClientImpl<P>\r
-       implements AuthorityClient<P> {\r
+public abstract class AuthorityClientImpl<AUTHORITY_ITEM_TYPE, P extends AuthorityProxy>\r
+       extends AbstractPoxServiceClientImpl<AbstractCommonList, P>\r
+       implements AuthorityClient<AUTHORITY_ITEM_TYPE, P> {\r
 \r
        private static final String INCLUDE_DELETE_TRUE = Boolean.TRUE.toString();\r
        /*\r
index 7ffc3fc5b19a3891a6e62c10a48cdcdfaf38e197..52493c81e12b4251d9e3ab31b0b29ccc6782f4d0 100644 (file)
@@ -10,12 +10,12 @@ import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;\r
 import javax.ws.rs.QueryParam;\r
 import javax.ws.rs.core.Response;\r
+import org.jboss.resteasy.client.ClientResponse;\r
 \r
 import org.collectionspace.services.client.workflow.WorkflowClient;\r
 import org.collectionspace.services.common.authorityref.AuthorityRefDocList;\r
 import org.collectionspace.services.common.authorityref.AuthorityRefList;\r
 import org.collectionspace.services.jaxb.AbstractCommonList;\r
-import org.jboss.resteasy.client.ClientResponse;\r
 \r
 /*\r
  * ILT = Item list type\r
index b4f103e1ebb31435bdeb6c9f7e65b1bb7a528a0f..668a8664d719fdc8c92acfb033d214f9c6cd2fe3 100644 (file)
@@ -25,15 +25,18 @@ package org.collectionspace.services.client;
 
 import javax.ws.rs.core.Response;
 import org.apache.commons.httpclient.HttpClient;
-import org.collectionspace.services.common.authorityref.AuthorityRefList;
-import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.jboss.resteasy.client.ClientResponse;
 
+import org.collectionspace.services.jaxb.AbstractCommonList;
+import org.collectionspace.services.common.authorityref.AuthorityRefList;
+
 /**
  *     LT - List Type
+ *  REQUEST_PT - Request payload type
+ *  RESPONSE_PT - Response payload type
  *     P - Proxy type
  */
-public interface CollectionSpaceClient<LT, P extends CollectionSpaceProxy<LT>> {
+public interface CollectionSpaceClient<CLT, REQUEST_TYPE, RESPONSE_TYPE, P extends CollectionSpaceProxy<CLT>> {
 
     public static final String AUTH_PROPERTY = "cspace.auth";
     public static final String PASSWORD_PROPERTY = "cspace.password";
@@ -150,6 +153,12 @@ public interface CollectionSpaceClient<LT, P extends CollectionSpaceProxy<LT>> {
      * Common proxied service calls
      */
 
+       public ClientResponse<Response> create(REQUEST_TYPE payload);
+       
+       public ClientResponse<RESPONSE_TYPE> read(String csid);
+
+    public ClientResponse<RESPONSE_TYPE> update(String csid, REQUEST_TYPE payload);
+       
     /**
      * Read list.
      *
@@ -157,9 +166,11 @@ public interface CollectionSpaceClient<LT, P extends CollectionSpaceProxy<LT>> {
      * @param pageNumber the page number
      * @return the client response
      */
-    public ClientResponse<AbstractCommonList> readList(
+    public ClientResponse<CLT> readList(
                Long pageSize,
                Long pageNumber);
+    
+    public ClientResponse<CLT> readList();
 
     /**
      * Read list.
@@ -169,7 +180,7 @@ public interface CollectionSpaceClient<LT, P extends CollectionSpaceProxy<LT>> {
      * @param pageNumber the page number
      * @return the client response
      */
-    public ClientResponse<AbstractCommonList> readList(
+    public ClientResponse<CLT> readList(
             String sortBy,
             Long pageSize,
             Long pageNumber);
index fe3b587edc32974d5dd9be24724d9993c01a501a..79ac9a3fedb6be78d848c57ea9744dc13aaaa7f0 100644 (file)
@@ -1,30 +1,21 @@
 package org.collectionspace.services.client;\r
 \r
-import javax.ws.rs.core.Response;\r
-\r
 import org.collectionspace.services.jaxb.AbstractCommonList;\r
 import org.jboss.resteasy.client.ClientResponse;\r
 \r
 /*\r
  * <LT> = List type\r
+ * <PT> = Payload type\r
  * <P> = Proxy type\r
  */\r
 public interface CollectionSpacePoxClient<LT extends AbstractCommonList, P extends CollectionSpacePoxProxy<LT>>\r
-       extends CollectionSpaceClient<LT, P> {\r
+       extends CollectionSpaceClient<LT, PoxPayloadOut, String, P> {\r
        /*\r
         * Common service calls\r
         */\r
-       public ClientResponse<Response> create(PoxPayloadOut xmlPayload);\r
-       \r
-       /*\r
-        * GET resource with workflow 'deleted' state\r
-        */\r
-    public ClientResponse<String> read(String csid);\r
     \r
     public ClientResponse<String> readIncludeDeleted(String csid, Boolean includeDeleted);    \r
 \r
-    public ClientResponse<String> update(String csid, PoxPayloadOut xmlPayload);\r
-    \r
     /*\r
      * GET list with workflow 'deleted' state\r
      */\r
index fa71d50f1656192dba525e27242a9cf786cf671e..e09c6f538b064f7eb4a4b8d95934e0bcca1ad7f0 100644 (file)
@@ -8,10 +8,10 @@ import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;\r
 import javax.ws.rs.QueryParam;\r
 import javax.ws.rs.core.Response;\r
+import org.jboss.resteasy.client.ClientResponse;\r
 \r
 import org.collectionspace.services.client.workflow.WorkflowClient;\r
 import org.collectionspace.services.jaxb.AbstractCommonList;\r
-import org.jboss.resteasy.client.ClientResponse;\r
 \r
 public interface CollectionSpacePoxProxy<LT extends AbstractCommonList> extends\r
                CollectionSpaceProxy<LT> {\r
index df3b30ade1b495deb08e047aede0d63f601c17eb..21df5873a983c84407b042b59a9f1e176c820e04 100644 (file)
@@ -38,7 +38,6 @@ import javax.ws.rs.core.Response;
 \r
 import org.collectionspace.services.client.workflow.WorkflowClient;\r
 import org.collectionspace.services.common.authorityref.AuthorityRefList;\r
-import org.collectionspace.services.jaxb.AbstractCommonList;\r
 \r
 import org.jboss.resteasy.client.ClientResponse;\r
 \r
@@ -46,7 +45,7 @@ import org.jboss.resteasy.client.ClientResponse;
  * The Interface CollectionSpaceProxy.\r
  * FIXME: http://issues.collectionspace.org/browse/CSPACE-1684\r
  */\r
-public interface CollectionSpaceProxy<LT> {\r
+public interface CollectionSpaceProxy<CLT> {\r
 \r
     //(D)elete\r
     @DELETE\r
@@ -75,6 +74,10 @@ public interface CollectionSpaceProxy<LT> {
      * (R)read List operations\r
      */\r
     \r
+    @GET\r
+    @Produces({"application/xml"})\r
+    ClientResponse<CLT> readList();\r
+    \r
     /**\r
      * Read list.\r
      *\r
@@ -84,7 +87,7 @@ public interface CollectionSpaceProxy<LT> {
      */\r
     @GET\r
     @Produces({"application/xml"})\r
-    ClientResponse<AbstractCommonList> readList(\r
+    ClientResponse<CLT> readList(\r
             @QueryParam(IClientQueryParams.PAGE_SIZE_PARAM) Long pageSize,\r
            @QueryParam(IClientQueryParams.START_PAGE_PARAM) Long pageNumber);\r
         \r
@@ -98,7 +101,7 @@ public interface CollectionSpaceProxy<LT> {
      */\r
     @GET\r
     @Produces({"application/xml"})\r
-    ClientResponse<AbstractCommonList> readList(\r
+    ClientResponse<CLT> readList(\r
             @QueryParam(IClientQueryParams.SORT_BY_PARAM) String sortBy,\r
             @QueryParam(IClientQueryParams.PAGE_SIZE_PARAM) Long pageSize,\r
            @QueryParam(IClientQueryParams.START_PAGE_PARAM) Long pageNumber);    \r
index c4e84241f88079e253994c10d11660d546d9a372..b3eb1d9646f5c5036243369e5590e4c1e67d98e1 100644 (file)
  */
 package org.collectionspace.services.client;
 
+import javax.ws.rs.core.Response;
+
+import org.jboss.resteasy.client.ClientResponse;
+import org.collectionspace.services.jaxb.AbstractCommonList;
+
 /**
  * A CollectionObjectClient.
 
  * @version $Revision:$
  */
-public class TestServiceClient extends AbstractServiceClientImpl<Object, TestServiceProxy> {
+
+public final class TestServiceClient extends AbstractServiceClientImpl<AbstractCommonList, Object, Object, TestServiceProxy> {
 
     /**
      *
@@ -49,5 +55,25 @@ public class TestServiceClient extends AbstractServiceClientImpl<Object, TestSer
        public Class<TestServiceProxy> getProxyClass() {
                // TODO Auto-generated method stub
                return TestServiceProxy.class;
+       }
+
+       @Override
+       public ClientResponse<Response> create(Object payload) {
+        throw new UnsupportedOperationException();
+       }
+
+       @Override
+       public ClientResponse<Object> update(String csid, Object payload) {
+        throw new UnsupportedOperationException();
+       }
+
+       @Override
+       public ClientResponse<Object> read(String csid) {
+        throw new UnsupportedOperationException();
+       }
+
+       @Override
+       public ClientResponse<AbstractCommonList> readList() {
+        throw new UnsupportedOperationException();
        } 
 }
index 2d3f53c446c61bcc25bf00b57c30bbf4b8e14ccc..0299771cab397c54b10efa7f7844065c8b4b163b 100644 (file)
@@ -1,5 +1,7 @@
 package org.collectionspace.services.client;\r
 \r
-public interface TestServiceProxy extends CollectionSpaceProxy<Object> {\r
+import org.collectionspace.services.jaxb.AbstractCommonList;\r
+\r
+public interface TestServiceProxy extends CollectionSpaceProxy<AbstractCommonList> {\r
 \r
 }\r
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
new file mode 100644 (file)
index 0000000..5bdf851
--- /dev/null
@@ -0,0 +1,540 @@
+package org.collectionspace.services.client.test;\r
+\r
+import java.util.List;\r
+\r
+import javax.ws.rs.core.Response;\r
+import org.jboss.resteasy.client.ClientResponse;\r
+\r
+import org.collectionspace.services.client.AbstractCommonListUtils;\r
+import org.collectionspace.services.client.AuthorityClient;\r
+import org.collectionspace.services.client.AuthorityClientImpl;\r
+import org.collectionspace.services.client.AuthorityProxy;\r
+import org.collectionspace.services.client.PayloadInputPart;\r
+import org.collectionspace.services.client.PayloadOutputPart;\r
+import org.collectionspace.services.client.PoxPayloadOut;\r
+import org.collectionspace.services.jaxb.AbstractCommonList;\r
+\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+import org.testng.Assert;\r
+import org.testng.annotations.Test;\r
+\r
+/**\r
+ * \r
+ * @author remillet\r
+ *\r
+ * @param <AUTHORITY_COMMON_TYPE>\r
+ * @param <AUTHORITY_ITEM_TYPE>\r
+ * \r
+ * All CRUD related authority test classes should extend this class.\r
+ * \r
+ */\r
+public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHORITY_ITEM_TYPE> \r
+       extends AbstractPoxServiceTestImpl<AbstractCommonList, AUTHORITY_COMMON_TYPE> {\r
+\r
+    private final Logger logger = LoggerFactory.getLogger(AbstractAuthorityServiceTest.class);\r
+       \r
+    protected String knownResourceShortIdentifer = null;\r
+       protected static final String READITEMS_SHORT_IDENTIFIER = "resourceWithItems"; \r
+       protected String knownAuthorityWithItems = null;\r
+       \r
+       protected String knownResourceRefName = null;\r
+    protected String knownItemResourceId = null;\r
+    protected String knownItemResourceShortIdentifer = null;    \r
+    protected int nItemsToCreateInList = 5;\r
+               \r
+       public abstract void authorityTests(String testName);\r
+    protected abstract String createItemInAuthority(String authorityId);\r
\r
+    protected abstract AUTHORITY_ITEM_TYPE updateItemInstance(final AUTHORITY_ITEM_TYPE authorityItem);    \r
+    protected abstract void compareUpdatedItemInstances(AUTHORITY_ITEM_TYPE original, AUTHORITY_ITEM_TYPE updated) throws Exception;\r
+    \r
+    protected void setKnownItemResource(String id, String shortIdentifer ) {\r
+       knownItemResourceId = id;\r
+       knownItemResourceShortIdentifer = shortIdentifer;\r
+    }\r
+\r
+    protected void setKnownResource(String id, String shortIdentifer,\r
+            String refName) {\r
+        knownResourceId = id;\r
+        knownResourceShortIdentifer = shortIdentifer;\r
+        knownResourceRefName = refName;\r
+    }\r
+\r
+    /**\r
+     * Returns the root URL for a service.\r
+     *\r
+     * This URL consists of a base URL for all services, followed by\r
+     * a path component for the owning vocabulary, followed by the \r
+     * path component for the items.\r
+     *\r
+     * @return The root URL for a service.\r
+     */\r
+    protected String getItemServiceRootURL(String parentResourceIdentifier) {\r
+        return getResourceURL(parentResourceIdentifier) + "/" + getServicePathItemsComponent();\r
+    }\r
+\r
+    /**\r
+     * Returns the URL of a specific resource managed by a service, and\r
+     * designated by an identifier (such as a universally unique ID, or UUID).\r
+     *\r
+     * @param  resourceIdentifier  An identifier (such as a UUID) for a resource.\r
+     *\r
+     * @return The URL of a specific resource managed by a service.\r
+     */\r
+    protected String getItemResourceURL(String parentResourceIdentifier, String resourceIdentifier) {\r
+        return getItemServiceRootURL(parentResourceIdentifier) + "/" + resourceIdentifier;\r
+    }\r
+        \r
+    /**\r
+     * For authorities we override this method so we can save the shortid.\r
+     */\r
+    @Override\r
+    protected String createWithIdentifier(String testName, String identifier) throws Exception {\r
+       String csid = createResource(testName, identifier);\r
+        // Store the ID returned from the first resource created\r
+        // for additional tests below.\r
+        if (getKnowResourceId() == null) {\r
+               setKnownResource(csid, identifier /*shortId*/, null /*refname*/ );\r
+            if (logger.isDebugEnabled()) {\r
+                logger.debug(testName + ": Setting knownResourceId=" + getKnowResourceId());\r
+            }\r
+        }\r
+       \r
+        return identifier;\r
+    }    \r
+    \r
+    @Test(dependsOnMethods = {"readItem", "CRUDTests"})\r
+    public void testItemSubmitRequest() {\r
+\r
+        // Expected status code: 200 OK\r
+        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();\r
+\r
+        // Submit the request to the service and store the response.\r
+        String method = ServiceRequestType.READ.httpMethodName();\r
+        String url = getItemResourceURL(knownResourceId, knownItemResourceId);\r
+        int statusCode = submitRequest(method, url);\r
+\r
+        // Check the status code of the response: does it match\r
+        // the expected response(s)?\r
+        if (logger.isDebugEnabled()) {\r
+            logger.debug("testItemSubmitRequest: url=" + url\r
+                    + " status=" + statusCode);\r
+        }\r
+        Assert.assertEquals(statusCode, EXPECTED_STATUS);\r
+    }    \r
+\r
+    \r
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,\r
+       dependsOnMethods = {"readItem"})\r
+    public void verifyIgnoredUpdateWithInAuthority(String testName) throws Exception {\r
+       // Perform setup.\r
+       setupUpdate();\r
+\r
+       // Submit the request to the service and store the response.\r
+        AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy> client = \r
+                       (AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy>)this.getClientInstance();\r
+       ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);\r
+       int statusCode = res.getStatus();\r
+\r
+       // Check the status code of the response: does it match\r
+       // the expected response(s)?\r
+       if (logger.isDebugEnabled()) {\r
+               logger.debug(testName + " read authority:" + knownResourceId + "/Item:"\r
+                               + knownItemResourceId + " status = " + statusCode);\r
+       }\r
+       Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),\r
+                       invalidStatusCodeMessage(testRequestType, statusCode));\r
+       Assert.assertEquals(statusCode, Response.Status.OK.getStatusCode());\r
+\r
+        AUTHORITY_ITEM_TYPE vitem = extractItemCommonPartValue(res);\r
+       Assert.assertNotNull(vitem);\r
+       // Try to Update with new parent vocab (use self, for test).\r
+       Assert.assertEquals(client.getInAuthority(vitem), knownResourceId,\r
+                       "VocabularyItem inAuthority does not match knownResourceId.");\r
+       client.setInAuthority(vitem, knownItemResourceId);\r
+\r
+       // Submit the updated resource to the service and store the response.\r
+        PoxPayloadOut output = this.createItemRequestTypeInstance(vitem);\r
+       res = client.updateItem(knownResourceId, knownItemResourceId, output);\r
+       statusCode = res.getStatus();\r
+\r
+       // Check the status code of the response: does it match the expected response(s)?\r
+       if (logger.isDebugEnabled()) {\r
+               logger.debug(testName + ": status = " + statusCode);\r
+       }\r
+       Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),\r
+                       invalidStatusCodeMessage(testRequestType, statusCode));\r
+       Assert.assertEquals(statusCode, testExpectedStatusCode);\r
+\r
+       // Retrieve the updated resource and verify that the parent did not change\r
+       res = client.readItem(knownResourceId, knownItemResourceId);\r
+        AUTHORITY_ITEM_TYPE updatedVocabularyItem = extractItemCommonPartValue(res);\r
+       Assert.assertNotNull(updatedVocabularyItem);\r
+\r
+       // Verify that the updated resource received the correct data.\r
+       Assert.assertEquals(client.getInAuthority(updatedVocabularyItem),\r
+                       knownResourceId,\r
+                       "VocabularyItem allowed update to the parent (inAuthority).");\r
+    }\r
+    \r
+    @Test(dataProvider = "testName",\r
+               dependsOnMethods = {"CRUDTests"})\r
+    public void createItem(String testName) {\r
+        // Perform setup.\r
+        setupCreate();\r
+\r
+        String newID = createItemInAuthority(knownResourceId);\r
+\r
+        // Store the ID returned from the first item resource created\r
+        // for additional tests below.\r
+        if (knownItemResourceId == null) {\r
+            knownItemResourceId = newID;\r
+            if (null != testName && logger.isDebugEnabled()) {\r
+                logger.debug(testName + ": knownItemResourceId=" + knownItemResourceId);\r
+            }\r
+        }\r
+    }\r
+    \r
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,\r
+               dependsOnMethods = {"createItem"})\r
+    public void createItemList(String testName) throws Exception {\r
+       knownAuthorityWithItems = createResource(testName, READITEMS_SHORT_IDENTIFIER);\r
+        for (int j = 0; j < nItemsToCreateInList; j++) {\r
+               createItemInAuthority(knownAuthorityWithItems);\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Read by name.\r
+     *\r
+     * @param testName the test name\r
+     * @throws Exception the exception\r
+     */\r
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,\r
+               dependsOnMethods = {"CRUDTests"})\r
+    public void readByName(String testName) throws Exception {\r
+        // Perform setup.\r
+        setupRead();\r
+\r
+        // Submit the request to the service and store the response.\r
+        AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy> client = (AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy>)this.getClientInstance();\r
+        ClientResponse<String> res = client.readByName(getKnowResourceIdentifier());\r
+        int statusCode = res.getStatus();\r
+\r
+        // Check the status code of the response: does it match\r
+        // the expected response(s)?\r
+        if (logger.isDebugEnabled()) {\r
+            logger.debug(testName + ": status = " + statusCode);\r
+        }\r
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),\r
+                invalidStatusCodeMessage(testRequestType, statusCode));\r
+        Assert.assertEquals(statusCode, testExpectedStatusCode);\r
+        \r
+        AUTHORITY_COMMON_TYPE commonPart = extractCommonPartValue(res);\r
+        Assert.assertNotNull(commonPart);\r
+    }\r
+    \r
+    /**\r
+     * Extracts the common part item from a service's item payload.\r
+     * \r
+     * @param res\r
+     * @return\r
+     * @throws Exception\r
+     */\r
+       public AUTHORITY_ITEM_TYPE extractItemCommonPartValue(ClientResponse<String> res) throws Exception {\r
+               AUTHORITY_ITEM_TYPE result = null;\r
+               \r
+        AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy> client = (AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy>)this.getClientInstance();\r
+               PayloadInputPart payloadInputPart = extractPart(res, client.getItemCommonPartName());\r
+               if (payloadInputPart != null) {\r
+                       result = (AUTHORITY_ITEM_TYPE) payloadInputPart.getBody();\r
+               }\r
+               Assert.assertNotNull(result,\r
+                               "Part or body of part " + client.getCommonPartName() + " was unexpectedly null.");\r
+               \r
+               return result;\r
+       }\r
+    \r
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,\r
+               dependsOnMethods = {"readItem"})\r
+    public void readItemNonExistent(String testName) {\r
+        // Perform setup.\r
+        setupReadNonExistent();\r
+\r
+        // Submit the request to the service and store the response.\r
+        AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy> client = (AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy>)this.getClientInstance();\r
+        ClientResponse<String> res = client.readItem(knownResourceId, NON_EXISTENT_ID);\r
+        int statusCode = res.getStatus();\r
+\r
+        // Check the status code of the response: does it match\r
+        // the expected response(s)?\r
+        if (logger.isDebugEnabled()) {\r
+            logger.debug(testName + ": status = " + statusCode);\r
+        }\r
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),\r
+                invalidStatusCodeMessage(testRequestType, statusCode));\r
+        Assert.assertEquals(statusCode, testExpectedStatusCode);\r
+    }\r
+       \r
+    @Test(dataProvider = "testName",\r
+               dependsOnMethods = {"createItem"})\r
+    public void readItem(String testName) throws Exception {\r
+        // Perform setup.\r
+        setupRead();\r
+\r
+        // Submit the request to the service and store the response.\r
+        AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy> client = (AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy>)this.getClientInstance();\r
+        ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);\r
+        int statusCode = res.getStatus();\r
+\r
+        // Check the status code of the response: does it match\r
+        // the expected response(s)?\r
+        if (logger.isDebugEnabled()) {\r
+            logger.debug(testName + ": status = " + statusCode);\r
+        }\r
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),\r
+                invalidStatusCodeMessage(testRequestType, statusCode));\r
+        Assert.assertEquals(statusCode, testExpectedStatusCode);\r
+\r
+        AUTHORITY_ITEM_TYPE itemCommonPart = extractItemCommonPartValue(res);\r
+        Assert.assertNotNull(itemCommonPart);\r
+        Assert.assertEquals(client.getInAuthority(itemCommonPart), knownResourceId);\r
+        verifyReadItemInstance(itemCommonPart);\r
+    }\r
+    \r
+    protected abstract void verifyReadItemInstance(AUTHORITY_ITEM_TYPE item) throws Exception;\r
+        \r
+    @Test(dataProvider = "testName",\r
+               dependsOnMethods = {"testItemSubmitRequest", "updateItem", "verifyIgnoredUpdateWithInAuthority"})    \r
+    public void deleteItem(String testName) throws Exception {\r
+        // Perform setup.\r
+        setupDelete();\r
+\r
+        // Submit the request to the service and store the response.\r
+        AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy> client = (AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy>)this.getClientInstance();\r
+        ClientResponse<Response> res = client.deleteItem(knownResourceId, knownItemResourceId);\r
+        int statusCode = res.getStatus();\r
+\r
+        // Check the status code of the response: does it match\r
+        // the expected response(s)?\r
+        if (logger.isDebugEnabled()) {\r
+            logger.debug("delete: status = " + statusCode);\r
+        }\r
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),\r
+                invalidStatusCodeMessage(testRequestType, statusCode));\r
+        Assert.assertEquals(statusCode, testExpectedStatusCode);\r
+    }\r
+    \r
+    protected void readItemListInt(String vcsid, String shortId, String testName) {\r
+        // Perform setup.\r
+        setupReadList();\r
+\r
+        // Submit the request to the service and store the response.\r
+        AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy> client = (AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy>)this.getClientInstance();\r
+        ClientResponse<AbstractCommonList> res = null;\r
+        if (vcsid != null) {\r
+            res = client.readItemList(vcsid, null, null);\r
+        } else if (shortId != null) {\r
+            res = client.readItemListForNamedAuthority(shortId, null, null);\r
+        } else {\r
+            Assert.fail("Internal Error: readItemList both vcsid and shortId are null!");\r
+        }\r
+        AbstractCommonList list = res.getEntity();\r
+        int statusCode = res.getStatus();\r
+\r
+        // Check the status code of the response: does it match\r
+        // the expected response(s)?\r
+        if (logger.isDebugEnabled()) {\r
+            logger.debug("  " + testName + ": status = " + statusCode);\r
+        }\r
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),\r
+                invalidStatusCodeMessage(testRequestType, statusCode));\r
+        Assert.assertEquals(statusCode, testExpectedStatusCode);\r
+\r
+        List<AbstractCommonList.ListItem> items = list.getListItem();\r
+        int nItemsReturned = items.size();\r
+        long nItemsTotal = list.getTotalItems();\r
+        if (logger.isDebugEnabled()) {\r
+            logger.debug("  " + testName + ": Expected "\r
+                    + nItemsToCreateInList + " items; got: " + nItemsReturned + " of: " + nItemsTotal);\r
+        }\r
+        Assert.assertEquals(nItemsTotal, nItemsToCreateInList);\r
+\r
+        if(logger.isTraceEnabled()){\r
+               AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);\r
+        }\r
+    }\r
+    \r
+    @Test(dataProvider = "testName",\r
+               dependsOnMethods = {"createItemList"})\r
+    public void readItemList(String testName) {\r
+        readItemListInt(knownAuthorityWithItems, null, testName);\r
+    }\r
+\r
+    @Test(dataProvider = "testName",\r
+               dependsOnMethods = {"readItem"})\r
+    public void readItemListByName(String testName) {\r
+        readItemListInt(null, READITEMS_SHORT_IDENTIFIER, testName);\r
+    }\r
+\r
+    @Test(dataProvider = "testName",\r
+               dependsOnMethods = {"deleteItem"})\r
+    public void deleteNonExistentItem(String testName) {\r
+        // Perform setup.\r
+        setupDeleteNonExistent();\r
+\r
+        // Submit the request to the service and store the response.\r
+        AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy> client = (AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy>)this.getClientInstance();\r
+        ClientResponse<Response> res = client.deleteItem(knownResourceId, NON_EXISTENT_ID);\r
+        int statusCode = res.getStatus();\r
+\r
+        // Check the status code of the response: does it match\r
+        // the expected response(s)?\r
+        if (logger.isDebugEnabled()) {\r
+            logger.debug(testName + ": status = " + statusCode);\r
+        }\r
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),\r
+                invalidStatusCodeMessage(testRequestType, statusCode));\r
+        Assert.assertEquals(statusCode, testExpectedStatusCode);\r
+    }\r
+    \r
+    protected String getServicePathItemsComponent() {\r
+        return AuthorityClient.ITEMS;\r
+    }\r
+    \r
+       public PoxPayloadOut createItemRequestTypeInstance(AUTHORITY_ITEM_TYPE itemTypeInstance) {\r
+               PoxPayloadOut result = null;\r
+               \r
+        AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy> client = (AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy>)this.getClientInstance();\r
+        PoxPayloadOut payloadOut = new PoxPayloadOut(this.getServicePathItemsComponent());\r
+        PayloadOutputPart part = payloadOut.addPart(client.getItemCommonPartName(), itemTypeInstance);\r
+        result = payloadOut;\r
+               \r
+               return result;\r
+       }\r
+\r
+       /**\r
+        * Update an Authority item.\r
+        * \r
+        * @param testName\r
+        * @throws Exception\r
+        */\r
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,\r
+               dependsOnMethods = {"readItem", "CRUDTests", "verifyIgnoredUpdateWithInAuthority"})\r
+    public void updateItem(String testName) throws Exception {\r
+        // Perform setup.\r
+        setupUpdate();\r
+        AUTHORITY_ITEM_TYPE theUpdate = null;\r
+\r
+        // Retrieve the contents of a resource to update.\r
+        AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy> client =\r
+                       (AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy>)this.getClientInstance();\r
+        ClientResponse<String> res =\r
+                client.readItem(knownResourceId, knownItemResourceId);\r
+        try {\r
+               if (logger.isDebugEnabled()) {\r
+                   logger.debug(testName + ": read status = " + res.getStatus());\r
+               }\r
+               Assert.assertEquals(res.getStatus(), testExpectedStatusCode);\r
+       \r
+               if (logger.isDebugEnabled()) {\r
+                   logger.debug("got Authority item to update with ID: "\r
+                           + knownItemResourceId\r
+                           + " in authority: " + knownResourceId);\r
+               }\r
+               AUTHORITY_ITEM_TYPE authorityItem = extractItemCommonPartValue(res);\r
+               Assert.assertNotNull(authorityItem);\r
+\r
+               // Update the contents of this resource.\r
+               theUpdate = updateItemInstance(authorityItem);\r
+               if (logger.isDebugEnabled()) {\r
+                   logger.debug("\n\nTo be updated fields: CSID = "  + knownItemResourceId + "\n"\r
+                               + objectAsXmlString(theUpdate));\r
+               }\r
+        } finally {\r
+               res.releaseConnection();\r
+        }\r
+\r
+        // Submit the updated resource to the service and store the response.\r
+        PoxPayloadOut output = this.createItemRequestTypeInstance(theUpdate);\r
+        res = client.updateItem(knownResourceId, knownItemResourceId, output);\r
+        try {\r
+               int statusCode = res.getStatus();\r
+       \r
+               // Check the status code of the response: does it match the expected response(s)?\r
+               if (logger.isDebugEnabled()) {\r
+                   logger.debug("updateItem: status = " + statusCode);\r
+               }\r
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),\r
+                       invalidStatusCodeMessage(testRequestType, statusCode));\r
+               Assert.assertEquals(statusCode, testExpectedStatusCode);\r
+       \r
+               // Retrieve the updated resource and verify that its contents exist.\r
+               AUTHORITY_ITEM_TYPE updatedVocabularyItem = extractItemCommonPartValue(res);\r
+               Assert.assertNotNull(updatedVocabularyItem);\r
+\r
+               compareUpdatedItemInstances(theUpdate, updatedVocabularyItem);\r
+        } finally {\r
+               res.releaseConnection();\r
+        }\r
+    }\r
+    \r
+    protected abstract PoxPayloadOut createNonExistenceItemInstance(String commonPartName, String identifier);\r
+    \r
+    /* (non-Javadoc)\r
+     * @see org.collectionspace.services.client.test.ServiceTest#updateNonExistent(java.lang.String)\r
+     */\r
+    @Test(dataProvider = "testName",\r
+       dependsOnMethods = {"create", "update", "updateNonExistent"})\r
+    public void updateNonExistentItem(String testName) throws Exception {\r
+       // Perform setup.\r
+       setupUpdateNonExistent();\r
+\r
+       // Submit the request to the service and store the response.\r
+       // Note: The ID used in this 'create' call may be arbitrary.\r
+       // The only relevant ID may be the one used in update(), below.\r
+        AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy> client =\r
+                       (AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy>)this.getClientInstance();\r
+       PoxPayloadOut multipart = createNonExistenceItemInstance(client.getItemCommonPartName(), NON_EXISTENT_ID);\r
+       ClientResponse<String> res =\r
+                       client.updateItem(knownResourceId, NON_EXISTENT_ID, multipart);\r
+       try {\r
+               int statusCode = res.getStatus();\r
+       \r
+               // Check the status code of the response: does it match\r
+               // the expected response(s)?\r
+               if (logger.isDebugEnabled()) {\r
+                       logger.debug(testName + ": status = " + statusCode);\r
+               }\r
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),\r
+                               invalidStatusCodeMessage(testRequestType, statusCode));\r
+               Assert.assertEquals(statusCode, testExpectedStatusCode);\r
+       } finally {\r
+               res.releaseConnection();\r
+       }\r
+    }\r
+        \r
+    //\r
+    // Methods to persuade TestNG to follow the correct test dependency path\r
+    //\r
+    \r
+    @Test(dataProvider = "testName",\r
+               dependsOnMethods = {"createItem"})\r
+    public void baseAuthorityTests(String testName) {\r
+       // Do nothing.  Here just to setup a test dependency chain.\r
+    }\r
+    \r
+    /*\r
+     * For convenience and terseness, this test method is the base of the test execution dependency chain.  Other test methods may\r
+     * refer to this method in their @Test annotation declarations.\r
+     */\r
+    @Override\r
+    @Test(dataProvider = "testName",\r
+               dependsOnMethods = {\r
+                       "org.collectionspace.services.client.test.AbstractServiceTestImpl.baseCRUDTests"})    \r
+       public void CRUDTests(String testName) {\r
+               // TODO Auto-generated method stub\r
+       }\r
+    \r
+}\r
diff --git a/services/client/src/main/java/org/collectionspace/services/client/test/AbstractGenericServiceTestImpl.java b/services/client/src/main/java/org/collectionspace/services/client/test/AbstractGenericServiceTestImpl.java
deleted file mode 100644 (file)
index 5352d35..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.collectionspace.services.client.test;\r
-\r
-import org.collectionspace.services.client.CollectionSpaceClient;\r
-import org.collectionspace.services.client.CollectionSpaceCommonListPoxProxy;\r
-import org.collectionspace.services.client.PayloadInputPart;\r
-import org.collectionspace.services.client.PoxPayloadIn;\r
-import org.collectionspace.services.jaxb.AbstractCommonList;\r
-import org.jboss.resteasy.client.ClientResponse;\r
-import org.testng.Assert;\r
-\r
-/*\r
- * CPT - Common Part Type\r
- */\r
-public abstract class AbstractGenericServiceTestImpl<CPT> extends AbstractServiceTestImpl {\r
-       public CPT getCommonTypeInstance() {\r
-               CPT result = null;\r
-               return result;\r
-       }\r
-       \r
-    public CPT extractCommonPartValue(ClientResponse<String> res)\r
-            throws Exception {\r
-               CollectionSpaceClient<AbstractCommonList, CollectionSpaceCommonListPoxProxy> client = this.getClientInstance();\r
-            PayloadInputPart payloadInputPart = extractPart(res, client.getCommonPartName());\r
-            Object obj = null;\r
-            if (payloadInputPart != null) {\r
-               obj = payloadInputPart.getBody();\r
-            }\r
-            Assert.assertNotNull(obj,\r
-                    "Body of " + client.getCommonPartName() + " part was unexpectedly null.");\r
-            CPT commonPartTypeInstance = (CPT) obj;\r
-            Assert.assertNotNull(commonPartTypeInstance,\r
-                    client.getCommonPartName() + " part was unexpectedly null.");\r
-            return commonPartTypeInstance;\r
-        }\r
-    \r
-    private PayloadInputPart extractPart(ClientResponse<String> res, String partLabel)\r
-            throws Exception {\r
-            if (getLogger().isDebugEnabled()) {\r
-               getLogger().debug("Reading part " + partLabel + " ...");\r
-            }\r
-            PoxPayloadIn input = new PoxPayloadIn(res.getEntity());\r
-            PayloadInputPart payloadInputPart = input.getPart(partLabel);\r
-            Assert.assertNotNull(payloadInputPart,\r
-                    "Part " + partLabel + " was unexpectedly null.");\r
-            return payloadInputPart;\r
-        }\r
-    \r
-       \r
-}\r
diff --git a/services/client/src/main/java/org/collectionspace/services/client/test/AbstractPoxServiceTestImpl.java b/services/client/src/main/java/org/collectionspace/services/client/test/AbstractPoxServiceTestImpl.java
new file mode 100644 (file)
index 0000000..54d1e71
--- /dev/null
@@ -0,0 +1,80 @@
+package org.collectionspace.services.client.test;\r
+\r
+import org.collectionspace.services.client.CollectionSpaceClient;\r
+import org.collectionspace.services.client.PayloadInputPart;\r
+import org.collectionspace.services.client.PayloadOutputPart;\r
+import org.collectionspace.services.client.PoxPayloadIn;\r
+import org.collectionspace.services.client.PoxPayloadOut;\r
+import org.collectionspace.services.client.AbstractCommonListUtils;\r
+import org.collectionspace.services.jaxb.AbstractCommonList;\r
+\r
+import org.jboss.resteasy.client.ClientResponse;\r
+import org.testng.Assert;\r
+\r
+/*\r
+ * <CLT> - Common list type\r
+ * <CPT> - Common part type\r
+ */\r
+public abstract class AbstractPoxServiceTestImpl<CLT extends AbstractCommonList, CPT>\r
+               extends AbstractServiceTestImpl<CLT, CPT, PoxPayloadOut, String> {\r
+               \r
+       @Override\r
+       public CPT extractCommonPartValue(ClientResponse<String> res) throws Exception {\r
+               CPT result = null;\r
+               \r
+               CollectionSpaceClient client = getClientInstance();\r
+               PayloadInputPart payloadInputPart = extractPart(res, client.getCommonPartName());\r
+               if (payloadInputPart != null) {\r
+                       result = (CPT) payloadInputPart.getBody();\r
+               }\r
+               Assert.assertNotNull(result,\r
+                               "Part or body of part " + client.getCommonPartName() + " was unexpectedly null.");\r
+               \r
+               return result;\r
+       }\r
+       \r
+    protected void printList(String testName, CLT list) {\r
+        if (getLogger().isTraceEnabled()){\r
+               AbstractCommonListUtils.ListItemsInAbstractCommonList(list, getLogger(), testName);\r
+        }\r
+    }\r
+       \r
+       @Override\r
+    public CPT extractCommonPartValue(PoxPayloadOut payloadOut) throws Exception {\r
+       CPT result = null;\r
+       \r
+       CollectionSpaceClient client = getClientInstance();\r
+       PayloadOutputPart payloadOutputPart = payloadOut.getPart(client.getCommonPartName());\r
+       if (payloadOutputPart != null) {\r
+               result = (CPT) payloadOutputPart.getBody();\r
+       }\r
+        Assert.assertNotNull(result,\r
+                "Part or body of part " + client.getCommonPartName() + " was unexpectedly null.");\r
+        \r
+       return result;\r
+    }  \r
+       \r
+       @Override\r
+       public PoxPayloadOut createRequestTypeInstance(CPT commonPartTypeInstance) {\r
+               PoxPayloadOut result = null;\r
+               \r
+               CollectionSpaceClient client = this.getClientInstance();\r
+        PoxPayloadOut payloadOut = new PoxPayloadOut(this.getServicePathComponent());\r
+        PayloadOutputPart part = payloadOut.addPart(client.getCommonPartName(), commonPartTypeInstance);\r
+        result = payloadOut;\r
+               \r
+               return result;\r
+       }\r
+    \r
+    protected PayloadInputPart extractPart(ClientResponse<String> res, String partLabel)\r
+            throws Exception {\r
+            if (getLogger().isDebugEnabled()) {\r
+               getLogger().debug("Reading part " + partLabel + " ...");\r
+            }\r
+            PoxPayloadIn input = new PoxPayloadIn(res.getEntity());\r
+            PayloadInputPart payloadInputPart = input.getPart(partLabel);\r
+            Assert.assertNotNull(payloadInputPart,\r
+                    "Part " + partLabel + " was unexpectedly null.");\r
+            return payloadInputPart;\r
+    }\r
+}\r
index 8bdb47822cc33311a0bd56065c9acb5bf9a3cb31..2a1edf9adb9da1419580433ea70d3d34420f9e92 100644 (file)
 package org.collectionspace.services.client.test;
 
 import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
 
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.workflow.WorkflowCommon;
-import org.collectionspace.services.client.AbstractPoxServiceClientImpl;
 import org.collectionspace.services.client.AuthorityClient;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.CollectionSpacePoxClient;
@@ -45,12 +40,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.testng.Assert;
-import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
 
-import javax.activation.MimetypesFileTypeMap;
 import javax.ws.rs.core.Response;
 
 /**
@@ -61,401 +52,660 @@ import javax.ws.rs.core.Response;
  *
  * For Javadoc descriptions of this class's methods, see the ServiceTest interface.
  *
+ * <CLT> - Common list type
+ * <CPT> - Common part type
+ *
  * $LastChangedRevision$
  * $LastChangedDate$
  */
 // FIXME: http://issues.collectionspace.org/browse/CSPACE-1685
-public abstract class AbstractServiceTestImpl extends BaseServiceTest implements ServiceTest {
-
+public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_TYPE>
+               extends BaseServiceTest<CLT> implements ServiceTest {
     /** The logger. */
     private final Logger logger = LoggerFactory.getLogger(AbstractServiceTestImpl.class);
-    // A non-existent logger.
-    static private final Logger LOGGER_NULL = null;
+
     /** The Constant DEFAULT_LIST_SIZE. */
     static protected final int DEFAULT_LIST_SIZE = 10;
     static protected final int DEFAULT_PAGINATEDLIST_SIZE = 10;
+
+    /** The path to test resources */
     static protected final String RESOURCE_PATH = "src" + File.separator
             + "test" + File.separator
             + "resources";
     
+    /** Misc constants */
     protected static final String BLOBS_DIR = "blobs";
-    static protected final String DEFAULT_MIME = "application/octet-stream; charset=ISO-8859-1";
-    static private final String NO_TEST_CLEANUP = "noTestCleanup";
     static protected final String NO_BLOB_CLEANUP = "noBlobCleanup";
     static protected final String NO_MEDIA_CLEANUP = "noMediaCleanup";
-    private final static String NON_EXISTENT_KEYWORD = "jlmbsoqjlmbsoq";
-
-    protected String getMimeType(File theFile) {
-        String result = null;
-        result = new MimetypesFileTypeMap().getContentType(theFile);
-        if (result == null) {
-            logger.debug("Could not get MIME type for file at: " + theFile.getAbsolutePath());
-            result = DEFAULT_MIME;
-        }
-
-        return result;
-
-    }
-    
-    /* Use this to keep track of resources to delete */
-    protected List<String> allResourceIdsCreated = new ArrayList<String>();
-    /* Use this to track authority items */
-    protected Map<String, String> allResourceItemIdsCreated = new HashMap<String, String>(); /* itemCsid, parentCsid */
-
+    private final static String NON_EXISTENT_KEYWORD = "jlmbsoqjlmbsoq" + System.currentTimeMillis();
     private String EMPTY_SORT_BY_ORDER = "";
-
-    /**
-     * Gets the logger.
-     *
-     * @return the logger
-     */
-    protected Logger getLogger() {
-        return this.logger;
-    }
-
+    
+    /** Error messages */
+    private final static String ERROR_WORKFLOW_TRANSITION = "Workflow transition to 'deleted' did not take place!";
+    
     protected String getResourceDir() {
         String result = null;
         String currentDirectory = System.getProperty("user.dir");
         result = currentDirectory + File.separator + RESOURCE_PATH;
         return result;
     }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
+        
+    /*
+     * Use this method in TestNG "@Test" methods that need to be overridden.  Because of an issue in TestNG 5.6 (and earlier),
+     * we can't just mark the methods as "abstract".  Subclasses must override the @Test methods *without* the "@Test" annotation.
      */
-    @Override
-    protected AbstractCommonList getAbstractCommonList(
-            ClientResponse<AbstractCommonList> response) {
-        return response.getEntity(AbstractCommonList.class);
+    private void mustOverride(String testName) throws Exception {
+       throw new RuntimeException("This method must be implemented by a subclass.");
     }
-
-    // ---------------------------------------------------------------
-    // CRUD tests : CREATE tests
-    //
-    // (See below for utility methods in support of create list tests.)
-    // ---------------------------------------------------------------
-    // Success outcomes
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
+        
+    /*
+     * We use this method to force a TestNG execution order for our tests
      */
-    @Override
-    public abstract void create(String testName) throws Exception;
-
-    /**
-     * Sets up create tests.
+       public abstract void CRUDTests(String testName);
+    
+    /*
+     * We use this method to force a TestNG execution order for our tests
+     */    
+    @Test(dataProvider = "testName", dependsOnMethods = {
+               "create", "read", "update", "delete", "testSubmitRequest", "createList", "readList", "readNonExistent"})
+    public void baseCRUDTests(String testName) {
+       // Do nothing -see "dependsOnMethods" in @Test annotation above.
+    }
+    
+    /*
+     * Sub-classes can override for the workflow tests.
      */
-    protected void setupCreate() {
-        EXPECTED_STATUS_CODE = STATUS_CREATED;
-        REQUEST_TYPE = ServiceRequestType.CREATE;
-        testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
+    protected REQUEST_TYPE createInstance(String identifier) {
+       String commonPartName = getClientInstance().getCommonPartName();
+        return createInstance(commonPartName, identifier);
     }
-
+    
     /**
-     * Checks if 'theFile' is something we can turn into a Blob instance.  It can't
-     * be read-protected, hidden, or a directory.
-     *
-     * @param theFile the the file
-     * @return true, if is blobable
+     * Sub-classes must override this method for the "Create" tests to work properly
      */
-    protected boolean isBlobbable(File theFile) {
-        boolean result = true;
-        if (theFile.isDirectory() || theFile.isHidden() || !theFile.canRead()) {
-            result = false;
+    protected abstract REQUEST_TYPE createInstance(String commonPartName, String identifier);
+    
+    protected REQUEST_TYPE createNonExistenceInstance(String commonPartName, String identifier) {
+       return createInstance(commonPartName, identifier);
+    }
+                    
+    @Override
+    @Test(dataProvider = "testName")
+    public void create(String testName) throws Exception {
+       String identifier = getKnowResourceIdentifier();
+       createWithIdentifier(testName, identifier);
+    }
+    
+    protected String createWithIdentifier(String testName, String identifier) throws Exception {
+       String csid = createResource(testName, identifier);
+        // Store the ID returned from the first resource created
+        // for additional tests below.
+        if (getKnowResourceId() == null) {
+            knownResourceId = csid;
+            if (logger.isDebugEnabled()) {
+                logger.debug(testName + ": knownResourceId=" + getKnowResourceId());
+            }
         }
-        return result;
+       
+        return identifier;
     }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#createList(java.lang.String)
-     */
+    
+    protected String createResource(String testName, String identifier) throws Exception {
+        String result = null;
+        
+       setupCreate();
+       CollectionSpaceClient client = this.getClientInstance();
+        REQUEST_TYPE payload = createInstance(client.getCommonPartName(), identifier);
+        ClientResponse<Response> res = client.create(payload);
+       try {
+               int statusCode = res.getStatus();
+               if (logger.isDebugEnabled()) {
+                   logger.debug(testName + ": HTTP status = " + statusCode);
+               }
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                       invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
+       
+               result = extractId(res);
+               // Store the IDs from every resource created by tests,
+               // so they can be deleted after tests have been run.
+               allResourceIdsCreated.add(result);
+       } finally {
+               res.releaseConnection();
+       }
+       
+       return result;
+    }
+    
     @Override
-    public abstract void createList(String testName) throws Exception;
+    @Test(dataProvider = "testName", dependsOnMethods = {"create"})    
+    public void read(String testName) throws Exception {
+        // Perform setup.
+        setupRead();
 
-    // Note: No setup is required for createList(), as it currently
-    // just invokes create() multiple times.
-    // Failure outcomes
+        // Submit the request to the service and store the response.
+       CollectionSpaceClient client = this.getClientInstance();
+        ClientResponse<RESPONSE_TYPE> res = client.read(getKnowResourceId());
+        int statusCode = res.getStatus();
 
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#createWithEmptyEntityBody(java.lang.String)
-     */
-    @Override
-    public abstract void createWithEmptyEntityBody(String testName)
-            throws Exception;
+        // 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);
 
-    /**
-     * Sets up create tests with empty entity body.
-     */
-    protected void setupCreateWithEmptyEntityBody() {
-        EXPECTED_STATUS_CODE = STATUS_BAD_REQUEST;
-        REQUEST_TYPE = ServiceRequestType.CREATE;
-        testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
+        RESPONSE_TYPE output = (RESPONSE_TYPE) res.getEntity();
+        Assert.assertNotNull(output);
+        
+        //
+        // Now compare with the expected field values
+        //
+        REQUEST_TYPE expectedResult = createInstance("read_test");
+        compareReadInstances(extractCommonPartValue(expectedResult), extractCommonPartValue(res));
     }
+    
+    @Override
+    @Test(dataProvider = "testName", dependsOnMethods = {"create", "read", "update", "readWorkflow"})    
+    public void delete(String testName) throws Exception {
+        setupDelete();
+       CollectionSpaceClient client = this.getClientInstance();
+        ClientResponse<Response> res = client.delete(getKnowResourceId());
+        int statusCode = res.getStatus();
 
-    /**
-     * Sets up create tests with empty entity body.
-     */
-    protected void setupCreateWithInvalidBody() {
-        EXPECTED_STATUS_CODE = STATUS_BAD_REQUEST;
-        REQUEST_TYPE = ServiceRequestType.CREATE;
-        testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
+        // 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);
     }
-
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#createWithMalformedXml(java.lang.String)
-     */
+    
     @Override
-    public abstract void createWithMalformedXml(String testName) throws Exception;
+    @Test(dataProvider = "testName")
+    public void readNonExistent(String testName) throws Exception {
+        // Perform setup.
+        setupReadNonExistent();
 
-    /**
-     * Sets up create tests with malformed xml.
-     */
-    protected void setupCreateWithMalformedXml() {
-        EXPECTED_STATUS_CODE = STATUS_BAD_REQUEST;
-        REQUEST_TYPE = ServiceRequestType.CREATE;
-        testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
+        // Submit the request to the service and store the response.
+       CollectionSpaceClient client = this.getClientInstance();
+        ClientResponse<RESPONSE_TYPE> res = client.read(NON_EXISTENT_ID);
+        int statusCode = res.getStatus();
+        try {
+            // 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);
+        } finally {
+            res.releaseConnection();
+        }
     }
 
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#createWithWrongXmlSchema(java.lang.String)
-     */
     @Override
-    public abstract void createWithWrongXmlSchema(String testName) throws Exception;
+    @Test(dataProvider = "testName", dependsOnMethods = {"delete"})    
+    public void deleteNonExistent(String testName) throws Exception {
+        // Perform setup.
+        setupDeleteNonExistent();
 
-    /**
-     * Sets up create tests with wrong xml schema.
-     */
-    protected void setupCreateWithWrongXmlSchema() {
-        EXPECTED_STATUS_CODE = STATUS_BAD_REQUEST;
-        REQUEST_TYPE = ServiceRequestType.CREATE;
-        testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
-    }
+        // Submit the request to the service and store the response.
+       CollectionSpaceClient client = this.getClientInstance();
+        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
+        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);
+    }    
+    
     // ---------------------------------------------------------------
-    // CRUD tests : READ tests
+    // Abstract CRUD tests : TestNG requires an empty method here. De-
+    // claring them as "abstract" will not work.
+    //
     // ---------------------------------------------------------------
-    // Success outcomes
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#read(java.lang.String)
-     */
+    
+//    protected abstract Class<CPT> getCommonPartTypeClass();
+    
+    public CPT extractCommonPartValue(ClientResponse<RESPONSE_TYPE> res) throws Exception {
+       CPT result = null;
+       result = (CPT) res.getEntity();
+       return result;
+    }
+    
+    public CPT extractCommonPartValue(REQUEST_TYPE req) throws Exception {
+       return (CPT)req;
+    }
+        
+    public REQUEST_TYPE createRequestTypeInstance(CPT commonPartTypeInstance) {
+       return (REQUEST_TYPE)commonPartTypeInstance;
+    }
+    
+    //
+    // This method is called by public void update(String testName).  Subclasses need
+    // to override this method that should update the common part -e.g., CollectionObjectsCommon, DimensionsCommon, etc)
+    //
+    protected abstract CPT updateInstance(final CPT commonPartObject);
+    
+    protected abstract void compareUpdatedInstances(CPT original, CPT updated) throws Exception;
+    
+       protected void compareReadInstances(CPT original, CPT fromRead) throws Exception {
+               // Do nothing by default.  Subclass can override if they want other behavior.
+       }
+    
     @Override
-    public abstract void read(String testName) throws Exception;
+    @Test(dataProvider = "testName", dependsOnMethods = {"create", "read"})    
+    public void update(String testName) throws Exception {
+        // Perform setup.
+        setupUpdate();
 
-    /**
-     * Sets up read tests.
-     */
-    protected void setupRead() {
-        EXPECTED_STATUS_CODE = STATUS_OK;
-        REQUEST_TYPE = ServiceRequestType.READ;
-        testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
-    }
+        // Retrieve the contents of a resource to update.
+       CollectionSpaceClient client = this.getClientInstance();
+        ClientResponse<RESPONSE_TYPE> res = client.read(getKnowResourceId());
+        if (logger.isDebugEnabled()) {
+            logger.debug(testName + ": read status = " + res.getStatus());
+        }
+        Assert.assertEquals(res.getStatus(), testExpectedStatusCode);
 
-    // Failure outcomes
+        if (logger.isDebugEnabled()) {
+            logger.debug("Got object to update with CSID= " + getKnowResourceId());
+        }
 
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#readNonExistent(java.lang.String)
-     */
-    @Override
-    public abstract void readNonExistent(String testName) throws Exception;
+        CPT commonPartObject = this.extractCommonPartValue(res);
+        Assert.assertNotNull(commonPartObject);
+        CPT theUpdate = updateInstance(commonPartObject);
+        if (logger.isDebugEnabled()) {
+            logger.debug("\n\nTo be updated fields: CSID = "  + getKnowResourceId() + "\n"
+                       + objectAsXmlString(theUpdate));
+        }
 
-    /**
-     * Sets up read non existent tests.
-     */
-    protected void setupReadNonExistent() {
-        EXPECTED_STATUS_CODE = STATUS_NOT_FOUND;
-        REQUEST_TYPE = ServiceRequestType.READ;
-        testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
-    }
+        // Submit the request to the service and store the response.
+        REQUEST_TYPE output = this.createRequestTypeInstance(theUpdate);
+        res = client.update(getKnowResourceId(), output);
+        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);
 
+        CPT updatedCommonPartObject = this.extractCommonPartValue(res);
+        Assert.assertNotNull(updatedCommonPartObject);
+
+        compareUpdatedInstances(theUpdate, updatedCommonPartObject);
+    }
+        
     // ---------------------------------------------------------------
-    // CRUD tests : READ (list, or multiple) tests
     //
-    // (See below for utility methods in support of list tests.)
+    // Generic tests that apply to most services
+    //
     // ---------------------------------------------------------------
-    // Success outcomes
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#readList(java.lang.String)
-     */
-    @Override
-    public abstract void readList(String testName) throws Exception;
 
     /**
-     * Sets up read list tests.
+     * A non-RESTEasy HTTP request test.
      */
-    protected void setupReadList() {
-        EXPECTED_STATUS_CODE = STATUS_OK;
-        REQUEST_TYPE = ServiceRequestType.READ_LIST;
-        testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
-    }
+    protected void testSubmitRequest(String csid) {
+        // Expected status code: 200 OK
+        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
 
-    // Failure outcomes
-    // None tested at present.
-    // ---------------------------------------------------------------
-    // CRUD tests : UPDATE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
+        // Submit the request to the service and store the response.
+        String method = ServiceRequestType.READ.httpMethodName();
+        String url = getResourceURL(csid);
+        int statusCode = submitRequest(method, url);
 
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#update(java.lang.String)
+        // Check the status code of the response: does it match
+        // the expected response(s)?
+        if (logger.isDebugEnabled()) {
+            logger.debug("testSubmitRequest: url=" + url
+                    + " status=" + statusCode);
+        }
+        Assert.assertEquals(statusCode, EXPECTED_STATUS);
+    }
+    
+    /**
+     * A non-RESTEasy HTTP request test.
      */
-    @Override
-    public abstract void update(String testName) throws Exception;
+    @Test(dependsOnMethods = {"create",        "read"})
+    public void testSubmitRequest() {
+       testSubmitRequest(getKnowResourceId());
+    }
 
     /**
-     * Sets up update tests.
+     * Creates the list.
+     *
+     * @param testName the test name
+     * @param listSize the list size
+     * @throws Exception the exception
      */
-    protected void setupUpdate() {
-        EXPECTED_STATUS_CODE = STATUS_OK;
-        REQUEST_TYPE = ServiceRequestType.UPDATE;
-        testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
+    protected void createPaginatedList(String testName, int listSize) throws Exception {
+        for (int i = 0; i < listSize; i++) {
+               String identifier = createIdentifier();
+            createWithIdentifier(testName, identifier);
+        }
     }
-
-    // Failure outcomes
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#updateWithEmptyEntityBody(java.lang.String)
+    
+    /**
+     * Create a list of records
      */
     @Override
-    public abstract void updateWithEmptyEntityBody(String testName) throws Exception;
+    @Test(dataProvider = "testName", dependsOnMethods = {"create"})
+    public void createList(String testName) throws Exception {
+       createPaginatedList(testName, DEFAULT_LIST_SIZE);
+    }    
+    
+    protected void printList(String testName, CLT list) {
+       // By default, do nothing.  Tests can override this method to produce additional
+       // output after the "readList" test has run.
+    }
+        
+    @Override
+    @Test(dataProvider = "testName", dependsOnMethods = {"read"})    
+    public void readList(String testName) throws Exception {
+        // Perform setup.
+        setupReadList();
 
+        // Submit the request to the service and store the response.
+        CollectionSpaceClient client = this.getClientInstance();
+        ClientResponse<CLT> res = client.readList();
+        CLT list = res.getEntity();
+        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);
+
+        // Optionally output additional data about list members for debugging.
+        boolean iterateThroughList = true;
+        if (iterateThroughList && logger.isDebugEnabled()) {
+            printList(testName, list);
+        }
+    }
+    
+    
     /**
-     * Sets up update tests with an empty entity body.
+     * Read paginated list.
+     *
+     * @param testName the test name
+     * @throws Exception the exception
      */
-    protected void setupUpdateWithEmptyEntityBody() {
-        EXPECTED_STATUS_CODE = STATUS_BAD_REQUEST;
-        REQUEST_TYPE = ServiceRequestType.UPDATE;
-        testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
+    @Test(dataProvider = "testName", dependsOnMethods = {"read"})
+    public void readPaginatedList(String testName) throws Exception {
+        // Perform setup.
+        setupReadList();
+        CollectionSpaceClient client = this.getClientInstance();
+
+        // Get the current total number of items.
+        // If there are no items then create some
+        AbstractCommonList list = (AbstractCommonList) this.readList(testName,
+                client,
+                1 /*pgSz*/,
+                0 /*pgNum*/,
+                testExpectedStatusCode);
+        if (list == null || list.getTotalItems() == 0) {
+            this.createPaginatedList(testName, DEFAULT_PAGINATEDLIST_SIZE);
+            setupReadList();
+            list = (AbstractCommonList) this.readList(testName,
+                    client,
+                    1 /*pgSz*/,
+                    0 /*pgNum*/,
+                    testExpectedStatusCode);
+        }
+
+        // Print out the current list size to be paginated
+        Assert.assertNotNull(list);
+        long totalItems = list.getTotalItems();
+        Assert.assertFalse(totalItems == 0);
+        if (getLogger().isDebugEnabled() == true) {
+            getLogger().debug(testName + ":" + "created list of "
+                    + totalItems + " to be paginated.");
+        }
+
+        long pageSize = totalItems / 3; //create up to 3 pages to iterate over
+        long pagesTotal = pageSize > 0 ? (totalItems / pageSize) : 0;
+        for (int i = 0; i < pagesTotal; i++) {
+            list = (AbstractCommonList) this.readList(testName, client, pageSize, i, testExpectedStatusCode);
+            assertPaginationInfo(testName,
+                    list,
+                    i, //expected page number
+                    pageSize, //expected page size
+                    pageSize, //expected num of items in page
+                    totalItems);//expected total num of items
+        }
+
+        // if there are any remainders be sure to paginate them as well
+        long mod = pageSize != 0 ? totalItems % pageSize : totalItems;
+        if (mod != 0) {
+            list = (AbstractCommonList) this.readList(testName, client, pageSize, pagesTotal, testExpectedStatusCode);
+            assertPaginationInfo(testName,
+                    list,
+                    pagesTotal, //expected page number
+                    pageSize, //expected page size
+                    mod, //expected num of items in page
+                    totalItems);//expected total num of items
+        }
     }
 
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#updateWithMalformedXml(java.lang.String)
+    /*
+     * This test assumes that no objects exist yet.
+     *
+     * http://localhost:8180/cspace-services/intakes?wf_deleted=false
      */
-    @Override
-    public abstract void updateWithMalformedXml(String testName) throws Exception;
+    @Test(dataProvider = "testName", dependsOnMethods = {"update"})
+    public void readWorkflow(String testName) throws Exception {
+        try {
+            //
+            // Get the total count of non-deleted existing records
+            //
+            long existingRecords = readIncludeDeleted(testName, Boolean.FALSE);
 
-    /**
-     * Sets up update tests with malformed xml.
-     */
-    protected void setupUpdateWithMalformedXml() {
-        EXPECTED_STATUS_CODE = STATUS_BAD_REQUEST;
-        REQUEST_TYPE = ServiceRequestType.UPDATE;
-        testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
+            //
+            // Create 3 new objects
+            //
+            final int OBJECTS_TO_CREATE = 3;
+            for (int i = 0; i < OBJECTS_TO_CREATE; i++) {
+                this.createWorkflowTarget(testName);
+            }
+
+            //
+            // Mark one as soft deleted
+            //
+            int existingTestCreated = allResourceIdsCreated.size(); // assumption is that no other test created records were soft deleted
+            String csid = allResourceIdsCreated.get(existingTestCreated - 1); //0-based index to get the last one added
+            this.setupUpdate();
+            this.updateLifeCycleState(testName, csid, WorkflowClient.WORKFLOWSTATE_DELETED);
+            //
+            // Read the list of existing non-deleted records
+            //
+            long updatedTotal = readIncludeDeleted(testName, Boolean.FALSE);
+            Assert.assertEquals(updatedTotal, existingRecords + OBJECTS_TO_CREATE - 1, "Deleted items seem to be returned in list results.");
+
+            //
+            // Next, test that a GET with WorkflowClient.WORKFLOWSTATE_DELETED query param set to 'false' returns a 404
+            //
+            int trials = 0;
+            int result = 0;
+            while (trials < 30) {
+                   CollectionSpacePoxClient client = this.assertPoxClient();
+                   ClientResponse<String> res = client.readIncludeDeleted(csid, Boolean.FALSE);
+                   result = res.getStatus();
+                   if (result == STATUS_NOT_FOUND) {
+                       logger.info("Workflow transition to 'deleted' is complete");
+                       break;
+                   } else {
+                       /*
+                        * This should never happen, but if it does we need a full stack trace to help track it down.
+                        */
+                       try {
+                               throw new RuntimeException(ERROR_WORKFLOW_TRANSITION);
+                       } catch (RuntimeException e) {
+                               logger.info(ERROR_WORKFLOW_TRANSITION, e);
+                       }
+                   }
+                   trials++;
+            }
+            Assert.assertEquals(result, STATUS_NOT_FOUND);
+
+        } catch (UnsupportedOperationException e) {
+            logger.warn(this.getClass().getName() + " did not implement createWorkflowTarget() method.  No workflow tests performed.");
+            return;
+        }
     }
 
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#updateWithWrongXmlSchema(java.lang.String)
+    /*
+     * Test that searches honor the workflow deleted state.
      */
-    @Override
-    public abstract void updateWithWrongXmlSchema(String testName) throws Exception;
+    @Test(dataProvider = "testName")
+    public void searchWorkflowDeleted(String testName) throws Exception {
+
+        // FIXME: Temporarily avoid running test if client is of an authority service
+        CollectionSpacePoxClient client = this.assertPoxClient();
+        if (isAuthorityClient(client)) {
+            return;
+        }
+
+        try {
+            //
+            // Create 3 new objects
+            //
+            final int OBJECTS_TO_CREATE = 3;
+            final String KEYWORD = NON_EXISTENT_KEYWORD + createIdentifier();
+            for (int i = 0; i < OBJECTS_TO_CREATE; i++) {
+                this.createWorkflowTarget(testName, KEYWORD);
+            }
+
+            //
+            // Mark one as soft deleted
+            //
+            int existingTestCreated = allResourceIdsCreated.size(); // assumption is that no other test created records were soft deleted
+            String csid = allResourceIdsCreated.get(existingTestCreated - 1); //0-based index to get the last one added
+            this.setupUpdate();
+            this.updateLifeCycleState(testName, csid, WorkflowClient.WORKFLOWSTATE_DELETED);
+
+            //
+            // Search for the newly-created records, excluding the soft deleted record.
+            //
+            // Send the search request and receive a response
+            ClientResponse<AbstractCommonList> res = client.keywordSearchIncludeDeleted(KEYWORD, Boolean.FALSE);
+            int result = res.getStatus();
+            Assert.assertEquals(result, STATUS_OK);
+
+            AbstractCommonList list = res.getEntity();
+            long itemsMatchedBySearch = list.getTotalItems();
+            Assert.assertEquals(itemsMatchedBySearch, OBJECTS_TO_CREATE - 1,
+                    "The number of items marked for delete is not correct.");
+            //
+            // Search for the newly-created records, including the soft deleted record.
+            //
+            // Send the search request and receive a response
+            res = client.keywordSearchIncludeDeleted(KEYWORD, Boolean.TRUE);
+            result = res.getStatus();
+            Assert.assertEquals(result, STATUS_OK);
 
+            list = res.getEntity();
+            itemsMatchedBySearch = list.getTotalItems();
+            Assert.assertEquals(itemsMatchedBySearch, OBJECTS_TO_CREATE,
+                    "Deleted item was not returned in list results, even though it was requested to be included.");
+
+        } catch (UnsupportedOperationException e) {
+            logger.warn(this.getClass().getName() + " did not implement createWorkflowTarget() method.  No workflow tests performed.");
+            return;
+        }
+    }
+    
+    // ---------------------------------------------------------------
+    // Utility methods to support the test cases.
+    //
+    // ---------------------------------------------------------------
+    
     /**
-     * Sets up update tests with wrong xml schema.
+     * Checks if 'theFile' is something we can turn into a Blob instance.  It can't
+     * be read-protected, hidden, or a directory.
+     *
+     * @param theFile the the file
+     * @return true, if is blobable
      */
-    protected void setupUpdateWithWrongXmlSchema() {
-        EXPECTED_STATUS_CODE = STATUS_BAD_REQUEST;
-        REQUEST_TYPE = ServiceRequestType.UPDATE;
-        testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
+    protected boolean isBlobbable(File theFile) {
+        boolean result = true;
+        if (theFile.isDirectory() || theFile.isHidden() || !theFile.canRead()) {
+            result = false;
+        }
+        return result;
     }
 
     /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#updateNonExistent(java.lang.String)
+     * @see org.collectionspace.services.client.test.ServiceTest#createWithEmptyEntityBody(java.lang.String)
      */
     @Override
-    public abstract void updateNonExistent(String testName) throws Exception;
-
-    /**
-     * Sets up update non existent tests
-     */
-    protected void setupUpdateNonExistent() {
-        EXPECTED_STATUS_CODE = STATUS_NOT_FOUND;
-        REQUEST_TYPE = ServiceRequestType.UPDATE;
-        testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
+    public void createWithEmptyEntityBody(String testName) throws Exception {
+        //FIXME: Should this test really be empty?  If so, please comment accordingly.
     }
 
-    // ---------------------------------------------------------------
-    // CRUD tests : DELETE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-
     /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#delete(java.lang.String)
+     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
      */
     @Override
-    public abstract void delete(String testName) throws Exception;
-
-    /**
-     * Sets up delete tests.
-     */
-    protected void setupDelete() {
-        EXPECTED_STATUS_CODE = STATUS_OK;
-        REQUEST_TYPE = ServiceRequestType.DELETE;
-        testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
+    public void createWithMalformedXml(String testName) throws Exception {
+        //FIXME: Should this test really be empty?  If so, please comment accordingly.
     }
 
-    // Failure outcomes
-
     /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#deleteNonExistent(java.lang.String)
+     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
      */
     @Override
-    public abstract void deleteNonExistent(String testName) throws Exception;
+    public void createWithWrongXmlSchema(String testName) throws Exception {
+        //FIXME: Should this test really be empty?  If so, please comment accordingly.
+    }
 
-    /**
-     * Sets up delete non existent tests.
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.client.test.ServiceTest#updateNonExistent(java.lang.String)
      */
-    protected void setupDeleteNonExistent() {
-        EXPECTED_STATUS_CODE = STATUS_NOT_FOUND;
-        REQUEST_TYPE = ServiceRequestType.DELETE;
-        testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
+    @Override
+    @Test(dataProvider = "testName",
+       dependsOnMethods = {"create", "update"})
+    public void updateNonExistent(String testName) throws Exception {
+       // Perform setup.
+       setupUpdateNonExistent();
+
+       // Submit the request to the service and store the response.
+       // Note: The ID used in this 'create' call may be arbitrary.
+       // The only relevant ID may be the one used in update(), below.
+        CollectionSpaceClient client = this.getClientInstance();
+       REQUEST_TYPE multipart = createNonExistenceInstance(client.getCommonPartName(), NON_EXISTENT_ID);
+       ClientResponse<String> res =
+                       client.update(NON_EXISTENT_ID, multipart);
+       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);
     }
-
+    
     // ---------------------------------------------------------------
     // Utility methods to clean up resources created during tests.
     // ---------------------------------------------------------------
-    /**
-     * 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.
-     */
-    @AfterClass(alwaysRun = true)
-    public void cleanUp() {
-        String noTestCleanup = System.getProperty(NO_TEST_CLEANUP);
-        if (Boolean.TRUE.toString().equalsIgnoreCase(noTestCleanup)) {
-            if (logger.isDebugEnabled()) {
-                logger.debug("Skipping Cleanup phase ...");
-            }
-            return;
-        }
-        if (logger.isDebugEnabled()) {
-            logger.debug("Cleaning up temporary resources created for testing ...");
-        }
-        CollectionSpaceClient client = this.getClientInstance();
-        //
-        // First, check to see if we need to cleanup any authority items
-        //
-        if (this.isAuthorityClient(client) == true) {
-            AuthorityClient authorityClient = (AuthorityClient) client;
-            for (Map.Entry<String, String> entry : allResourceItemIdsCreated.entrySet()) {
-                String itemResourceId = entry.getKey();
-                String authorityResourceId = entry.getValue();
-                // Note: Any non-success responses are ignored and not reported.
-                authorityClient.deleteItem(authorityResourceId, itemResourceId).releaseConnection();
-            }
-        }
-        //
-        // Next, delete all other entities include possible authorities.
-        //
-        for (String resourceId : allResourceIdsCreated) {
-            // Note: Any non-success responses are ignored and not reported.
-            client.delete(resourceId).releaseConnection();
-        }
-    }
 
     // ---------------------------------------------------------------
     // Utility methods in support of list tests.
@@ -470,14 +720,13 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements
      * @return the abstract common list
      * @throws Exception the exception
      */
-    private AbstractCommonList readList(String testName,
+    private CLT readList(String testName,
             CollectionSpaceClient client,
             long pageSize,
             long pageNumber,
             int expectedStatus) throws Exception {
 
         return readList(testName, client, EMPTY_SORT_BY_ORDER, pageSize, pageNumber, expectedStatus);
-
     }
 
     /**
@@ -491,15 +740,15 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements
      * @return the abstract common list
      * @throws Exception the exception
      */
-    private AbstractCommonList readList(String testName,
+    private CLT readList(String testName,
             CollectionSpaceClient client,
             String sortBy,
             long pageSize,
             long pageNumber,
             int expectedStatus) throws Exception {
-        ClientResponse<AbstractCommonList> response =
+        ClientResponse<CLT> response =
                 client.readList(sortBy, pageSize, pageNumber);
-        AbstractCommonList result = null;
+        CLT result = null;
         try {
             int statusCode = response.getStatus();
 
@@ -510,7 +759,7 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements
             }
             Assert.assertEquals(statusCode, expectedStatus);
 
-            result = this.getAbstractCommonList(response);
+            result = this.getCommonList(response);
         } finally {
             response.releaseConnection();
         }
@@ -518,19 +767,6 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements
         return result;
     }
 
-    /**
-     * Creates the list.
-     *
-     * @param testName the test name
-     * @param listSize the list size
-     * @throws Exception the exception
-     */
-    protected void createPaginatedList(String testName, int listSize) throws Exception {
-        for (int i = 0; i < listSize; i++) {
-            create(testName);
-        }
-    }
-
     /*@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
     public void leafCreate(String testName) throws Exception {
     this.create(testName);
@@ -541,97 +777,33 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements
             long expectedPageSize,
             long expectedListSize,
             long expectedTotalItems) {
-        Assert.assertNotNull(list);
-
-        long pageNum = list.getPageNum();
-        Assert.assertEquals(pageNum, expectedPageNum);
-        if (getLogger().isDebugEnabled() == true) {
-            getLogger().debug(testName + ":" + "page number is " + pageNum);
-        }
-
-        long pageSizeReturned = list.getPageSize();
-        Assert.assertEquals(pageSizeReturned, expectedPageSize);
-        if (getLogger().isDebugEnabled() == true) {
-            getLogger().debug(testName + ":" + "page size is " + list.getPageSize());
-        }
-
-        long itemsInPage = list.getItemsInPage();
-        Assert.assertEquals(itemsInPage, expectedListSize);
-        if (getLogger().isDebugEnabled() == true) {
-            getLogger().debug(testName + ":" + "actual items in page was/were " + itemsInPage);
-        }
-
-        long totalItemsReturned = list.getTotalItems();
-        Assert.assertEquals(totalItemsReturned, expectedTotalItems);
-        if (getLogger().isDebugEnabled() == true) {
-            getLogger().debug(testName + ":" + "total number of items is " + list.getTotalItems());
-        }
-    }
-
-    /**
-     * Read paginated list.
-     *
-     * @param testName the test name
-     * @throws Exception the exception
-     */
-    @Test(dataProvider = "testName") /*, dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"leafCreate"}) */
-
-    public void readPaginatedList(String testName) throws Exception {
-        // Perform setup.
-        setupReadList();
-        CollectionSpaceClient client = this.getClientInstance();
-
-        // Get the current total number of items.
-        // If there are no items then create some
-        AbstractCommonList list = (AbstractCommonList) this.readList(testName,
-                client,
-                1 /*pgSz*/,
-                0 /*pgNum*/,
-                EXPECTED_STATUS_CODE);
-        if (list == null || list.getTotalItems() == 0) {
-            this.createPaginatedList(testName, DEFAULT_PAGINATEDLIST_SIZE);
-            setupReadList();
-            list = (AbstractCommonList) this.readList(testName,
-                    client,
-                    1 /*pgSz*/,
-                    0 /*pgNum*/,
-                    EXPECTED_STATUS_CODE);
+        Assert.assertNotNull(list);
+
+        long pageNum = list.getPageNum();
+        Assert.assertEquals(pageNum, expectedPageNum);
+        if (getLogger().isDebugEnabled() == true) {
+            getLogger().debug(testName + ":" + "page number is " + pageNum);
         }
 
-        // Print out the current list size to be paginated
-        Assert.assertNotNull(list);
-        long totalItems = list.getTotalItems();
-        Assert.assertFalse(totalItems == 0);
+        long pageSizeReturned = list.getPageSize();
+        Assert.assertEquals(pageSizeReturned, expectedPageSize);
         if (getLogger().isDebugEnabled() == true) {
-            getLogger().debug(testName + ":" + "created list of "
-                    + totalItems + " to be paginated.");
+            getLogger().debug(testName + ":" + "page size is " + list.getPageSize());
         }
 
-        long pageSize = totalItems / 3; //create up to 3 pages to iterate over
-        long pagesTotal = pageSize > 0 ? (totalItems / pageSize) : 0;
-        for (int i = 0; i < pagesTotal; i++) {
-            list = (AbstractCommonList) this.readList(testName, client, pageSize, i, EXPECTED_STATUS_CODE);
-            assertPaginationInfo(testName,
-                    list,
-                    i, //expected page number
-                    pageSize, //expected page size
-                    pageSize, //expected num of items in page
-                    totalItems);//expected total num of items
+        long itemsInPage = list.getItemsInPage();
+        Assert.assertEquals(itemsInPage, expectedListSize);
+        if (getLogger().isDebugEnabled() == true) {
+            getLogger().debug(testName + ":" + "actual items in page was/were " + itemsInPage);
         }
 
-        // if there are any remainders be sure to paginate them as well
-        long mod = pageSize != 0 ? totalItems % pageSize : totalItems;
-        if (mod != 0) {
-            list = (AbstractCommonList) this.readList(testName, client, pageSize, pagesTotal, EXPECTED_STATUS_CODE);
-            assertPaginationInfo(testName,
-                    list,
-                    pagesTotal, //expected page number
-                    pageSize, //expected page size
-                    mod, //expected num of items in page
-                    totalItems);//expected total num of items
+        long totalItemsReturned = list.getTotalItems();
+        Assert.assertEquals(totalItemsReturned, expectedTotalItems);
+        if (getLogger().isDebugEnabled() == true) {
+            getLogger().debug(testName + ":" + "total number of items is " + list.getTotalItems());
         }
     }
+    
 
     @SuppressWarnings("rawtypes")
     protected void updateLifeCycleState(String testName, String resourceId, String lifeCycleState) throws Exception {
@@ -640,11 +812,18 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements
         //
         CollectionSpaceClient client = this.getClientInstance();
         ClientResponse<String> res = client.getWorkflow(resourceId);
-        assertStatusCode(res, testName);
-        logger.debug("Got object to update life cycle state with ID: " + resourceId);
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        WorkflowCommon workflowCommons = (WorkflowCommon) extractPart(input, WorkflowClient.SERVICE_COMMONPART_NAME, WorkflowCommon.class);
-        Assert.assertNotNull(workflowCommons);
+        WorkflowCommon workflowCommons = null;
+        try {
+               assertStatusCode(res, testName);
+               logger.debug("Got object to update life cycle state with ID: " + resourceId);
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               workflowCommons = (WorkflowCommon) extractPart(input, WorkflowClient.SERVICE_COMMONPART_NAME, WorkflowCommon.class);
+               Assert.assertNotNull(workflowCommons);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
         //
         // Mark it for a soft delete.
         //
@@ -655,30 +834,45 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements
         //
         // Perform the update
         //
+        WorkflowCommon updatedWorkflowCommons = null;
         res = client.updateWorkflow(resourceId, output);
-        assertStatusCode(res, testName);
-        input = new PoxPayloadIn(res.getEntity());
-        WorkflowCommon updatedWorkflowCommons = (WorkflowCommon) extractPart(input, WorkflowClient.SERVICE_COMMONPART_NAME, WorkflowCommon.class);
-        Assert.assertNotNull(updatedWorkflowCommons);
+        try {
+               assertStatusCode(res, testName);
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               updatedWorkflowCommons = (WorkflowCommon) extractPart(input, WorkflowClient.SERVICE_COMMONPART_NAME, WorkflowCommon.class);
+               Assert.assertNotNull(updatedWorkflowCommons);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
         //
         // Read the updated object and make sure it was updated correctly.
         //
         int trials = 0;
         while (trials < 30) {
                res = client.getWorkflow(resourceId);
-               assertStatusCode(res, testName);
-               logger.debug("Got workflow state of updated object with ID: " + resourceId);
-               input = new PoxPayloadIn(res.getEntity());
-               updatedWorkflowCommons = (WorkflowCommon) extractPart(input, WorkflowClient.SERVICE_COMMONPART_NAME, WorkflowCommon.class);
-               Assert.assertNotNull(workflowCommons);
-               String currentWorkflowState = updatedWorkflowCommons.getCurrentLifeCycleState();
-               if (currentWorkflowState.equalsIgnoreCase(lifeCycleState)) {
-                       logger.debug("Expected workflow state found: " + lifeCycleState);
-                       break;
+               try {
+                       assertStatusCode(res, testName);
+                       logger.debug("Got workflow state of updated object with ID: " + resourceId);
+                       PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+                       updatedWorkflowCommons = (WorkflowCommon) extractPart(input, WorkflowClient.SERVICE_COMMONPART_NAME, WorkflowCommon.class);
+                       Assert.assertNotNull(workflowCommons);
+                       String currentWorkflowState = updatedWorkflowCommons.getCurrentLifeCycleState();
+                       if (currentWorkflowState.equalsIgnoreCase(lifeCycleState)) {
+                               logger.debug("Expected workflow state found: " + lifeCycleState);
+                               break;
+                       }
+               } finally {
+                       if (res != null) {
+                    res.releaseConnection();
+                }
                }
                trials++;
         }
-        
+        //
+        // Finally, assert the state change happened as expected.
+        //
         Assert.assertEquals(updatedWorkflowCommons.getCurrentLifeCycleState(), lifeCycleState);
     }
 
@@ -698,35 +892,39 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements
     }
 
     protected long readIncludeDeleted(String testName, Boolean includeDeleted) {
-        long result = 0;
-        // Perform setup.
-        setupReadList();
-
-        //
-        // Ask for a list of all resources filtered by the incoming 'includeDeleted' workflow param
-        //
-        CollectionSpacePoxClient client = assertPoxClient();
-        ClientResponse<AbstractCommonList> res = client.readIncludeDeleted(includeDeleted);
-        assertStatusCode(res, testName);
-        AbstractCommonList list = res.getEntity();
-        //
-        // Now check that list size is correct
-        //
-        /*
-        List<AbstractCommonList.ListItem> items =
-        list.getListItem();
-        result = items.size();
-         */
-        result = list.getTotalItems();
+       long result = 0;
+       // Perform setup.
+       setupReadList();
+
+       //
+       // Ask for a list of all resources filtered by the incoming 'includeDeleted' workflow param
+       //
+       CollectionSpacePoxClient client = assertPoxClient();
+       ClientResponse<AbstractCommonList> res = client.readIncludeDeleted(includeDeleted);
+       try {
+               //
+               // Check the status code of the response: does it match
+               // the expected response(s)?
+               //
+               assertStatusCode(res, testName);
+               AbstractCommonList list = res.getEntity();
+               //
+               // Now check that list size is correct
+               //
+               result = list.getTotalItems();
+       } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+       }
 
-        return result;
+       return result;
     }
 
     protected long readItemsIncludeDeleted(String testName, String parentCsid, Boolean includeDeleted) {
         long result = 0;
         // Perform setup.
         setupReadList();
-
         //
         // Ask for a list of all resources filtered by the incoming 'includeDeleted' workflow param
         //
@@ -735,148 +933,32 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements
                 null, /* partial terms */
                 null, /* keywords */
                 includeDeleted);
-        assertStatusCode(res, testName);
-        AbstractCommonList list = res.getEntity();
-
-        result = list.getTotalItems();
-
-        return result;
-    }
-
-    /*
-     * This test assumes that no objects exist yet.
-     *
-     * http://localhost:8180/cspace-services/intakes?wf_deleted=false
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
-    public void readWorkflow(String testName) throws Exception {
-        try {
-            //
-            // Get the total count of non-deleted existing records
-            //
-            long existingRecords = readIncludeDeleted(testName, Boolean.FALSE);
-
-            //
-            // Create 3 new objects
-            //
-            final int OBJECTS_TO_CREATE = 3;
-            for (int i = 0; i < OBJECTS_TO_CREATE; i++) {
-                this.createWorkflowTarget(testName);
-            }
-
-            //
-            // Mark one as soft deleted
-            //
-            int existingTestCreated = allResourceIdsCreated.size(); // assumption is that no other test created records were soft deleted
-            String csid = allResourceIdsCreated.get(existingTestCreated - 1); //0-based index to get the last one added
-            this.setupUpdate();
-            this.updateLifeCycleState(testName, csid, WorkflowClient.WORKFLOWSTATE_DELETED);
-            //
-            // Read the list of existing non-deleted records
-            //
-            long updatedTotal = readIncludeDeleted(testName, Boolean.FALSE);
-            Assert.assertEquals(updatedTotal, existingRecords + OBJECTS_TO_CREATE - 1, "Deleted items seem to be returned in list results.");
-
-            //
-            // Next, test that a GET with WorkflowClient.WORKFLOWSTATE_DELETED query param set to 'false' returns a 404
-            //
-            int trials = 0;
-            int result = 0;
-            while (trials < 30) {
-                   CollectionSpacePoxClient client = this.assertPoxClient();
-                   ClientResponse<String> res = client.readIncludeDeleted(csid, Boolean.FALSE);
-                   result = res.getStatus();
-                   if (result == STATUS_NOT_FOUND) {
-                       logger.info("Workflow transition to 'deleted' is complete");
-                       break;
-                   }
-                   trials++;
-            }
-            Assert.assertEquals(result, STATUS_NOT_FOUND);
-
-        } catch (UnsupportedOperationException e) {
-            logger.warn(this.getClass().getName() + " did not implement createWorkflowTarget() method.  No workflow tests performed.");
-            return;
-        }
-    }
-
-    /*
-     * Test that searches honor the workflow deleted state.
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
-    public void searchWorkflowDeleted(String testName) throws Exception {
-
-        // FIXME: Temporarily avoid running test if client is of an authority service
-        CollectionSpacePoxClient client = this.assertPoxClient();
-        if (isAuthorityClient(client)) {
-            return;
-        }
-
         try {
-
-            //
-            // Create 3 new objects
-            //
-            final int OBJECTS_TO_CREATE = 3;
-            final String KEYWORD = NON_EXISTENT_KEYWORD + createIdentifier();
-            for (int i = 0; i < OBJECTS_TO_CREATE; i++) {
-                this.createWorkflowTarget(testName, KEYWORD);
+               assertStatusCode(res, testName);
+               AbstractCommonList list = res.getEntity();
+               result = list.getTotalItems();
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
             }
-
-            //
-            // Mark one as soft deleted
-            //
-            int existingTestCreated = allResourceIdsCreated.size(); // assumption is that no other test created records were soft deleted
-            String csid = allResourceIdsCreated.get(existingTestCreated - 1); //0-based index to get the last one added
-            this.setupUpdate();
-            this.updateLifeCycleState(testName, csid, WorkflowClient.WORKFLOWSTATE_DELETED);
-
-            //
-            // Search for the newly-created records, excluding the soft deleted record.
-            //
-            // Send the search request and receive a response
-            ClientResponse<AbstractCommonList> res = client.keywordSearchIncludeDeleted(KEYWORD, Boolean.FALSE);
-            int result = res.getStatus();
-            assertStatusCode(res, testName);
-
-            AbstractCommonList list = res.getEntity();
-            long itemsMatchedBySearch = list.getTotalItems();
-            Assert.assertEquals(itemsMatchedBySearch, OBJECTS_TO_CREATE - 1,
-                    "Deleted items seem to be returned in list results.");
-
-            //
-            // Search for the newly-created records, including the soft deleted record.
-            //
-            // Send the search request and receive a response
-            res = client.keywordSearchIncludeDeleted(KEYWORD, Boolean.TRUE);
-            result = res.getStatus();
-            assertStatusCode(res, testName);
-
-            list = res.getEntity();
-            itemsMatchedBySearch = list.getTotalItems();
-            Assert.assertEquals(itemsMatchedBySearch, OBJECTS_TO_CREATE,
-                    "Deleted item was not returned in list results, even though it was requested to be included.");
-
-        } catch (UnsupportedOperationException e) {
-            logger.warn(this.getClass().getName() + " did not implement createWorkflowTarget() method.  No workflow tests performed.");
-            return;
         }
+        
+        return result;
     }
 
-    protected String createTestObject(String testName) throws Exception {
 
+    protected String createTestObject() throws Exception {
         String identifier = createIdentifier();
-        String result = createTestObject(testName, identifier);
+        String result = createTestObject(identifier);
         return result;
-
     }
 
-    protected String createTestObject(String testName, String identifier) throws Exception {
+    protected String createTestObject(String identifier) throws Exception {
         String result = null;
 
-        CollectionSpacePoxClient client = (CollectionSpacePoxClient) getClientInstance();
-        PoxPayloadOut multipart = createInstance(identifier);
-        ClientResponse<Response> res = client.create(multipart);
+        CollectionSpaceClient client = getClientInstance();
+        REQUEST_TYPE payload = createInstance(identifier);
+        ClientResponse<Response> res = client.create(payload);
 
         int statusCode = res.getStatus();
         Assert.assertEquals(statusCode, STATUS_CREATED);
@@ -889,55 +971,25 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements
 
     protected String createWorkflowTarget(String testName) throws Exception {
         String result = null;
-        result = createTestObject(testName);
+        result = createTestObject();
         return result;
     }
 
     protected String createWorkflowTarget(String testName, String keyword) throws Exception {
         String result = null;
-        result = createTestObject(testName, keyword);
+        result = createTestObject(keyword);
         return result;
     }
 
-    /*
-     * Sub-classes must override for the workflow tests.
-     */
-    protected PoxPayloadOut createInstance(String identifier) {
-        logger.warn("Sub-class test clients should override this method");
-
-
-        throw new UnsupportedOperationException();
-
-
-
-    }
-
-    /*
-     * Test classes for authority services should override these method and return 'true'
-     */
-    protected boolean isAuthorityClient(CollectionSpaceClient theClient) {
-        return AuthorityClient.class.isInstance(theClient);
-    }
-
     protected PoxPayloadOut createItemInstance(String parentCsid, String identifier) {
         logger.warn("Sub-class test clients should override this method");
-
-
         throw new UnsupportedOperationException();
-
-
     }
 
     final protected String createWorkflowItemTarget(String testName, String parentCsid) throws Exception {
         String result = null;
-
         result = createTestItemObject(testName, parentCsid);
-
-
-
         return result;
-
-
     }
 
     protected String createTestItemObject(String testName, String parentCsid) throws Exception {
@@ -948,19 +1000,13 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements
         PoxPayloadOut multipart = createItemInstance(parentCsid, identifier);
         ClientResponse<Response> res = client.createItem(parentCsid, multipart);
 
-
-
         int statusCode = res.getStatus();
         Assert.assertEquals(statusCode, STATUS_CREATED);
 
         result = extractId(res);
         allResourceItemIdsCreated.put(result, parentCsid);
 
-
-
         return result;
-
-
     }
 
     /*
@@ -968,7 +1014,7 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements
      *
      * http://localhost:8180/cspace-services/intakes?wf_deleted=false
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+    @Test(dataProvider = "testName")
     public void readAuthorityItemWorkflow(String testName) throws Exception {
         //
         // Run this test only if the client is an AuthorityClient //FIXME: REM - Replace this will an AuthorityServiceTest class
@@ -986,27 +1032,20 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements
                 final int OBJECTS_TO_CREATE = 3;
                 String lastCreatedItem = null;
 
-
-                for (int i = 0; i
-                        < OBJECTS_TO_CREATE; i++) {
+                for (int i = 0; i < OBJECTS_TO_CREATE; i++) {
                     lastCreatedItem = this.createWorkflowItemTarget(testName, parentCsid);
-
-
                 } //
                 // Mark one item as soft deleted
                 //
                 String csid = lastCreatedItem;
 
-
                 this.setupUpdate();
 
-
                 this.updateItemLifeCycleState(testName, parentCsid, csid, WorkflowClient.WORKFLOWSTATE_DELETED);
                 //
                 // Read the list of existing non-deleted records
                 //
 
-
                 long updatedTotal = readItemsIncludeDeleted(testName, parentCsid, Boolean.FALSE);
                 Assert.assertEquals(updatedTotal, OBJECTS_TO_CREATE - 1, "Deleted items seem to be returned in list results.");
 
@@ -1016,19 +1055,12 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements
                 AuthorityClient client = (AuthorityClient) this.getClientInstance();
                 ClientResponse<String> res = client.readItem(parentCsid, csid, Boolean.FALSE);
 
-
                 int result = res.getStatus();
                 Assert.assertEquals(result, STATUS_NOT_FOUND);
 
-
-
             } catch (UnsupportedOperationException e) {
                 logger.warn(this.getClass().getName() + " did not implement createWorkflowTarget() method.  No workflow tests performed.");
-
-
                 return;
-
-
             }
         }
     }
@@ -1039,27 +1071,40 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements
         //
         AuthorityClient client = (AuthorityClient) this.getClientInstance();
         ClientResponse<String> res = client.readItemWorkflow(parentCsid, itemCsid);
-        assertStatusCode(res, testName);
-        logger.debug("Got object to update life cycle state with ID: " + itemCsid);
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        WorkflowCommon workflowCommons = (WorkflowCommon) extractPart(input, WorkflowClient.SERVICE_COMMONPART_NAME, WorkflowCommon.class);
-        Assert.assertNotNull(workflowCommons);
+        WorkflowCommon workflowCommons = null;
+        try {
+               assertStatusCode(res, testName);
+               logger.debug("Got object to update life cycle state with ID: " + itemCsid);
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               workflowCommons = (WorkflowCommon) extractPart(input, WorkflowClient.SERVICE_COMMONPART_NAME, WorkflowCommon.class);
+               Assert.assertNotNull(workflowCommons);
+               logger.debug("Current workflow state:" + objectAsXmlString(workflowCommons, WorkflowCommon.class));
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
         //
-        // Mark it for a soft delete.
+        // Mark it for a state change.
         //
-        logger.debug(
-                "Current workflow state:" + objectAsXmlString(workflowCommons, WorkflowCommon.class));
         workflowCommons.setCurrentLifeCycleState(lifeCycleState);
         PoxPayloadOut output = new PoxPayloadOut(WorkflowClient.SERVICE_PAYLOAD_NAME);
         PayloadOutputPart commonPart = output.addPart(WorkflowClient.SERVICE_COMMONPART_NAME, workflowCommons);
         //
-        // Perform the update
+        // Perform the state change update
         //
         res = client.updateItemWorkflow(parentCsid, itemCsid, output);
-        assertStatusCode(res, testName);
-        input = new PoxPayloadIn(res.getEntity());
-        WorkflowCommon updatedWorkflowCommons = (WorkflowCommon) extractPart(input, WorkflowClient.SERVICE_COMMONPART_NAME, WorkflowCommon.class);
-        Assert.assertNotNull(updatedWorkflowCommons);
+        WorkflowCommon updatedWorkflowCommons = null;
+        try {
+               assertStatusCode(res, testName);
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               updatedWorkflowCommons = (WorkflowCommon) extractPart(input, WorkflowClient.SERVICE_COMMONPART_NAME, WorkflowCommon.class);
+               Assert.assertNotNull(updatedWorkflowCommons);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
         
         int trials = 0;
         boolean passed = false;
@@ -1068,23 +1113,33 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements
                // Read the updated object and make sure it was updated correctly.
                //
                res = client.readItemWorkflow(parentCsid, itemCsid);
-               assertStatusCode(res, testName);
-               logger.debug(
-                       "Got workflow state of updated object with ID: " + itemCsid);
-               input = new PoxPayloadIn(res.getEntity());
-               updatedWorkflowCommons = (WorkflowCommon) extractPart(input, WorkflowClient.SERVICE_COMMONPART_NAME, WorkflowCommon.class);
-               Assert.assertNotNull(workflowCommons);
-               String currentState = updatedWorkflowCommons.getCurrentLifeCycleState();
-               if (currentState.equalsIgnoreCase(lifeCycleState)) {
-                       logger.debug("Expected workflow state found: " + lifeCycleState);
-                       break;
+               try {
+                       assertStatusCode(res, testName);
+                       logger.debug(
+                               "Got workflow state of updated object with ID: " + itemCsid);
+                       PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+                       updatedWorkflowCommons = (WorkflowCommon) extractPart(input, WorkflowClient.SERVICE_COMMONPART_NAME, WorkflowCommon.class);
+                       Assert.assertNotNull(workflowCommons);
+                       String currentState = updatedWorkflowCommons.getCurrentLifeCycleState();
+                       if (currentState.equalsIgnoreCase(lifeCycleState)) {
+                               logger.debug("Expected workflow state found: " + lifeCycleState);
+                               break;
+                       }
+                       logger.debug("Workflow state not yet updated for object with id: " + itemCsid + " state is=" +
+                                       currentState);
+               } finally {
+                       if (res != null) {
+                    res.releaseConnection();
+                }
                }
-               logger.debug("Workflow state not yet updated for object with id: " + itemCsid + " state is=" +
-                               currentState);
                trials++;
         }
+        //
+        // Finally check to see if the state change was updated as expected.
+        //
         Assert.assertEquals(updatedWorkflowCommons.getCurrentLifeCycleState(), lifeCycleState);
     }
+
 }
 
 
index b32d6ee59c2d6a38280942d48f7128846f221c8f..7ec701d0c5ffde06f371dc7349a785e630b3d836 100644 (file)
@@ -28,8 +28,13 @@ import java.io.File;
 import java.io.InputStream;\r
 import java.io.StringWriter;\r
 import java.lang.reflect.Method;\r
+import java.util.ArrayList;\r
+import java.util.HashMap;\r
 import java.util.List;\r
+import java.util.Map;\r
+import java.util.Random;\r
 \r
+import javax.activation.MimetypesFileTypeMap;\r
 import javax.ws.rs.core.MultivaluedMap;\r
 import javax.ws.rs.core.Response;\r
 import javax.xml.bind.JAXBContext;\r
@@ -46,18 +51,21 @@ import org.apache.commons.httpclient.methods.PostMethod;
 import org.apache.commons.httpclient.methods.PutMethod;\r
 import org.apache.commons.httpclient.methods.StringRequestEntity;\r
 import org.apache.commons.io.FileUtils;\r
+\r
 import org.jboss.resteasy.client.ClientResponse;\r
 import org.slf4j.Logger;\r
 import org.slf4j.LoggerFactory;\r
 import org.testng.Assert;\r
+import org.testng.annotations.AfterClass;\r
+import org.testng.annotations.BeforeMethod;\r
 import org.testng.annotations.DataProvider;\r
 import org.w3c.dom.Document;\r
 \r
+import org.collectionspace.services.client.AuthorityClient;\r
 import org.collectionspace.services.client.CollectionSpaceClient;\r
 import org.collectionspace.services.client.PayloadInputPart;\r
 import org.collectionspace.services.client.PoxPayloadIn;\r
 import org.collectionspace.services.client.TestServiceClient;\r
-\r
 import org.collectionspace.services.jaxb.AbstractCommonList;\r
 \r
 /**\r
@@ -71,20 +79,39 @@ import org.collectionspace.services.jaxb.AbstractCommonList;
 \r
 // FIXME: http://issues.collectionspace.org/browse/CSPACE-1685\r
 \r
-public abstract class BaseServiceTest {\r
-\r
+/*\r
+ * <CLT> - Common list type\r
+ */\r
+public abstract class BaseServiceTest<CLT> {\r
+       //A default MIME type result\r
+    static protected final String DEFAULT_MIME = "application/octet-stream; charset=ISO-8859-1";\r
     //Maven's base directory -i.e., the one containing the current pom.xml\r
     protected static final String MAVEN_BASEDIR_PROPERTY = "maven.basedir";\r
     /** The Constant logger. */\r
     private static final Logger logger = LoggerFactory.getLogger(BaseServiceTest.class);\r
     /** The Constant serviceClient. */\r
     protected static final TestServiceClient serviceClient = new TestServiceClient();\r
+    \r
+    protected String knownResourceIdentifier = null;\r
+    /** Use this to keep track of a single known resource */\r
+    protected String knownResourceId = null;\r
+    /* Use this to keep track of resources to delete */\r
+    protected List<String> allResourceIdsCreated = new ArrayList<String>();\r
+    /* Use this to track authority items */\r
+    protected Map<String, String> allResourceItemIdsCreated = new HashMap<String, String>(); /* itemCsid, parentCsid */\r
+    /* A runtime/command-line parameter to indicate if we should delete all the test related resource objects */\r
+    static private final String NO_TEST_CLEANUP = "noTestCleanup";\r
+    /* A random number generator */\r
+    static private final Random random = new Random(System.currentTimeMillis());\r
+    \r
+    \r
     /** The non-existent id. */\r
     protected final String NON_EXISTENT_ID = createNonExistentIdentifier();\r
     /** The expected status code. */\r
-    protected int EXPECTED_STATUS_CODE = 0;\r
+    protected int testExpectedStatusCode = 0;\r
     /** The request type type. */\r
-    protected ServiceRequestType REQUEST_TYPE = ServiceRequestType.NON_EXISTENT;\r
+    protected ServiceRequestType testRequestType = ServiceRequestType.NON_EXISTENT;\r
+    \r
     /** The Constant XML_DECLARATION. */\r
     protected static final String XML_DECLARATION = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";\r
     /** The Constant MALFORMED_XML_DATA. */\r
@@ -95,13 +122,11 @@ public abstract class BaseServiceTest {
             + "<wrong_schema>wrong schema contents</wrong_schema>";\r
     /** The null charset. */\r
     private static final String NULL_CHARSET = null;\r
-\r
-    private static final String BANNER_SEPARATOR_LINE =\r
-        "===================================================";\r
-    private static final String BANNER_PREFIX =\r
-        "\n" + BANNER_SEPARATOR_LINE + "\n";\r
-    private static final String BANNER_SUFFIX =\r
-        "\n" + BANNER_SEPARATOR_LINE;\r
+    \r
+    /** A visual separator for our test banners */\r
+    private static final String BANNER_SEPARATOR_LINE = "===================================================";\r
+    private static final String BANNER_PREFIX = "\n" + BANNER_SEPARATOR_LINE + "\n";\r
+    private static final String BANNER_SUFFIX = "\n" + BANNER_SEPARATOR_LINE;    \r
 \r
     // A Unicode UTF-8 data fragment for use in test payloads: a random sequence,\r
     // unlikely to be encountered in actual collections data, and capable of\r
@@ -116,7 +141,9 @@ public abstract class BaseServiceTest {
     // Î© : Greek capital letter Omega (U+03A9)\r
     private final static String UTF8_DATA_FRAGMENT = "utf-8-data-fragment:"\r
             + '\u0394' + '\u04C1' + '\u0174' +'\u03A9';\r
-    \r
+    //\r
+    // Status constants\r
+    //\r
     protected static final int STATUS_BAD_REQUEST =\r
         Response.Status.BAD_REQUEST.getStatusCode();\r
     protected static final int STATUS_CREATED =\r
@@ -126,7 +153,9 @@ public abstract class BaseServiceTest {
     protected static final int STATUS_NOT_FOUND =\r
         Response.Status.NOT_FOUND.getStatusCode();\r
     protected static final int STATUS_OK =\r
-        Response.Status.OK.getStatusCode();\r
+            Response.Status.OK.getStatusCode();\r
+    protected static final int STATUS_FORBIDDEN =\r
+            Response.Status.FORBIDDEN.getStatusCode();\r
 \r
     /**\r
      * Instantiates a new base service test.\r
@@ -135,6 +164,18 @@ public abstract class BaseServiceTest {
         super();\r
     }\r
 \r
+    /*\r
+     * A getter for retrieving the tests logger\r
+     */\r
+    protected Logger getLogger() {\r
+        return this.logger;\r
+    }\r
+    \r
+    @BeforeMethod\r
+    protected void beforeMethod(Method m) {\r
+        logTestBanner(getLogger(), m.getName());       \r
+    }\r
+        \r
     /**\r
      * Gets the client.\r
      *\r
@@ -142,15 +183,18 @@ public abstract class BaseServiceTest {
      */\r
     abstract protected CollectionSpaceClient getClientInstance();\r
 \r
-    /**\r
-     * Gets the abstract common list.\r
-     *\r
-     * @param response the response\r
-     * @return the abstract common list\r
+    /*\r
+     * Subclasses can override this method to return their AbstractCommonList subclass\r
      */\r
-    abstract protected AbstractCommonList getAbstractCommonList(\r
-            ClientResponse<AbstractCommonList> response);\r
+    protected Class<CLT> getCommonListType() {\r
+       return (Class<CLT>)AbstractCommonList.class;\r
+    }\r
 \r
+    protected CLT getCommonList(\r
+            ClientResponse<CLT> response) {\r
+        return response.getEntity(getCommonListType());\r
+    }\r
+    \r
     /**\r
      * Returns the name of the currently running test.\r
      *\r
@@ -184,10 +228,19 @@ public abstract class BaseServiceTest {
      * of those values between tests.\r
      */\r
     protected void clearSetup() {\r
-        EXPECTED_STATUS_CODE = 0;\r
-        REQUEST_TYPE = ServiceRequestType.NON_EXISTENT;\r
+        testExpectedStatusCode = 0;\r
+        testRequestType = ServiceRequestType.NON_EXISTENT;\r
     }\r
 \r
+    /**\r
+     * Sets up create tests.\r
+     */\r
+    protected void setupCreate() {\r
+        testExpectedStatusCode = STATUS_CREATED;\r
+        testRequestType = ServiceRequestType.CREATE;\r
+        testSetup(testExpectedStatusCode, testRequestType);\r
+    }\r
+    \r
     /**\r
      * Initializes setup values for a given test.\r
      *\r
@@ -199,8 +252,8 @@ public abstract class BaseServiceTest {
             int expectedStatusCode,\r
             ServiceRequestType reqType) {\r
         clearSetup();\r
-        EXPECTED_STATUS_CODE = expectedStatusCode;\r
-        REQUEST_TYPE = reqType;\r
+        testExpectedStatusCode = expectedStatusCode;\r
+        testRequestType = reqType;\r
     }\r
 \r
     /**\r
@@ -348,14 +401,30 @@ public abstract class BaseServiceTest {
     }\r
  \r
     /**\r
-     * Creates the identifier.\r
-     *\r
-     * @return the string\r
+     * Tests can override this method to customize their identifiers.\r
      */\r
-    static protected String createIdentifier() {\r
-        long identifier = System.currentTimeMillis();\r
+    protected String createIdentifier() {\r
+        long identifier = System.currentTimeMillis() + random.nextInt();\r
         return Long.toString(identifier);\r
     }\r
+    \r
+    /**\r
+     * Tests can override this method to customize their identifiers.\r
+     */\r
+    protected String getKnowResourceIdentifier() {\r
+       if (knownResourceIdentifier == null) {\r
+               knownResourceIdentifier = createIdentifier();\r
+       }\r
+       return knownResourceIdentifier;\r
+    }\r
+    \r
+    /**\r
+     * Tests can override this method if they have a different knownResourceId\r
+     * @return\r
+     */\r
+    protected String getKnowResourceId() {\r
+       return this.knownResourceId;\r
+    }\r
 \r
     /**\r
      * Creates the non existent identifier.\r
@@ -440,6 +509,20 @@ public abstract class BaseServiceTest {
         }\r
         return sw.toString();\r
     }\r
+    \r
+    static protected String objectAsXmlString(Object o) {\r
+        StringWriter sw = new StringWriter();\r
+        try {\r
+            JAXBContext jc = JAXBContext.newInstance(o.getClass());\r
+            Marshaller m = jc.createMarshaller();\r
+            m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,\r
+                    Boolean.TRUE);\r
+            m.marshal(o, sw);\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+        }\r
+        return sw.toString();\r
+    }    \r
 \r
     /**\r
      * getObjectFromFile get object of given class from given file (in classpath)\r
@@ -520,6 +603,22 @@ public abstract class BaseServiceTest {
         return sb.toString();\r
     }\r
 \r
+    /**\r
+     * Returns a 'banner', consisting of a text label inside a pair of prefix\r
+     * and suffix strings.\r
+     *\r
+     * @param label The label to be output inside the banner.\r
+     *\r
+     * @return The banner.\r
+     */\r
+    protected static String getBannerStr(String label) {\r
+        StringBuffer sb = new StringBuffer();\r
+        sb.append(BANNER_PREFIX);\r
+        sb.append(label);\r
+        sb.append(BANNER_SUFFIX);\r
+        return sb.toString();\r
+    }\r
+    \r
     /**\r
      * Returns a test-specific banner.\r
      *\r
@@ -527,10 +626,10 @@ public abstract class BaseServiceTest {
      *\r
      * @return A test-specific banner.\r
      */\r
-    protected static String testBanner(String testName) {\r
+    private static String getNameBanner(String testName) {\r
         testName = (testName == null || testName.trim().isEmpty()) ?\r
             " Test = no test name specified" : " Test = " + testName;\r
-        return banner(testName);\r
+        return testName;\r
     }\r
 \r
     /**\r
@@ -542,29 +641,26 @@ public abstract class BaseServiceTest {
      *\r
      * @return A test-specific banner.\r
      */\r
-    protected static String testBanner(String testName, String testClass) {\r
-        testName = (testName == null || testName.trim().isEmpty()) ?\r
-            " Test = no test name specified" : " Test = " + testName;\r
+    private static String getBanner(String testName, String testClass) {\r
+       testName = getNameBanner(testName);\r
         testClass = (testClass == null || testClass.trim().isEmpty()) ?\r
             "Class = no test class specified" : "Class = " + classNameFromPackageName(testClass);\r
         String testLabel = testClass + "\n" + testName;\r
-        return banner(testLabel);\r
+        return getBannerStr(testLabel);\r
     }\r
-\r
-    /**\r
-     * Returns a 'banner', consisting of a text label inside a pair of prefix\r
-     * and suffix strings.\r
-     *\r
-     * @param label The label to be output inside the banner.\r
-     *\r
-     * @return The banner.\r
-     */\r
-    protected static String banner(String label) {\r
-        StringBuffer sb = new StringBuffer();\r
-        sb.append(BANNER_PREFIX);\r
-        sb.append(label);\r
-        sb.append(BANNER_SUFFIX);\r
-        return sb.toString();\r
+    \r
+    protected static String getTestBanner(String testName, String testClassName) {\r
+        return getBanner(testName, testClassName);\r
+    }\r
+    \r
+    protected String getTestBanner(String testName) {\r
+       return getTestBanner(testName, this.getClass().getCanonicalName());\r
+    }\r
+        \r
+    protected void logTestBanner(Logger logger, String testName) {\r
+       if (logger.isDebugEnabled() == true) {\r
+               logger.debug(getTestBanner(testName));\r
+       }\r
     }\r
 \r
     protected static String classNameFromPackageName(String className) {\r
@@ -579,16 +675,248 @@ public abstract class BaseServiceTest {
         return className;\r
     }\r
 \r
-    public void assertStatusCode(ClientResponse<?> res, String testName) {\r
+    public int assertStatusCode(ClientResponse<?> res, String testName) {\r
         int statusCode = res.getStatus();\r
+        \r
         // Check the status code of the response: does it match the expected response(s)?\r
         logger.debug(testName + ": status = " + statusCode);\r
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode), invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);\r
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),\r
+                       invalidStatusCodeMessage(testRequestType, statusCode));\r
+        Assert.assertEquals(statusCode, testExpectedStatusCode);\r
+        \r
+        return statusCode;\r
     }\r
 \r
     public static String getUTF8DataFragment() {\r
         return UTF8_DATA_FRAGMENT;\r
     }\r
 \r
+    protected String getMimeType(File theFile) {\r
+        String result = null;\r
+        result = new MimetypesFileTypeMap().getContentType(theFile);\r
+        if (result == null) {\r
+            logger.debug("Could not get MIME type for file at: " + theFile.getAbsolutePath());\r
+            result = DEFAULT_MIME;\r
+        }\r
+\r
+        return result;\r
+    }\r
+\r
+    /*\r
+     * Test classes for authority services should override these method and return 'true'\r
+     */\r
+    protected boolean isAuthorityClient(CollectionSpaceClient theClient) {\r
+        return AuthorityClient.class.isInstance(theClient);\r
+    }\r
+       \r
+    /**\r
+     * Deletes all resources created by tests, after all tests have been run.\r
+     *\r
+     * This cleanup method will always be run, even if one or more tests fail.\r
+     * For this reason, it attempts to remove all resources created\r
+     * at any point during testing, even if some of those resources\r
+     * may be expected to be deleted by certain tests.\r
+     */\r
+    @AfterClass(alwaysRun = true)\r
+    public void cleanUp() {\r
+        String noTestCleanup = System.getProperty(NO_TEST_CLEANUP);\r
+        if (Boolean.TRUE.toString().equalsIgnoreCase(noTestCleanup)) {\r
+            if (logger.isDebugEnabled()) {\r
+                logger.debug("Skipping Cleanup phase ...");\r
+            }\r
+            return;\r
+        }\r
+        if (logger.isDebugEnabled()) {\r
+            logger.debug("Cleaning up temporary resources created for testing ...");\r
+        }\r
+        CollectionSpaceClient client = this.getClientInstance();\r
+        //\r
+        // First, check to see if we need to cleanup any authority items\r
+        //\r
+        if (this.isAuthorityClient(client) == true) {\r
+            AuthorityClient authorityClient = (AuthorityClient) client;\r
+            for (Map.Entry<String, String> entry : allResourceItemIdsCreated.entrySet()) {\r
+                String itemResourceId = entry.getKey();\r
+                String authorityResourceId = entry.getValue();\r
+                // Note: Any non-success responses are ignored and not reported.\r
+                authorityClient.deleteItem(authorityResourceId, itemResourceId).releaseConnection();\r
+            }\r
+        }\r
+        //\r
+        // Next, delete all other entities include possible authorities.\r
+        //\r
+        for (String resourceId : allResourceIdsCreated) {\r
+            // Note: Any non-success responses are ignored and not reported.\r
+            client.delete(resourceId).releaseConnection();\r
+        }\r
+    }\r
+       \r
+       //\r
+       // Status code setup methods for tests\r
+       //\r
+       \r
+    /**\r
+     * Sets up create tests with malformed xml.\r
+     */\r
+    protected void setupCreateWithMalformedXml() {\r
+        testExpectedStatusCode = STATUS_BAD_REQUEST;\r
+        testRequestType = ServiceRequestType.CREATE;\r
+        testSetup(testExpectedStatusCode, testRequestType);\r
+    }\r
+\r
+    /**\r
+     * Sets up create tests with wrong xml schema.\r
+     */\r
+    protected void setupCreateWithWrongXmlSchema() {\r
+        testExpectedStatusCode = STATUS_BAD_REQUEST;\r
+        testRequestType = ServiceRequestType.CREATE;\r
+        testSetup(testExpectedStatusCode, testRequestType);\r
+    }\r
+    \r
+    /**\r
+     * Sets up read tests.\r
+     */\r
+    protected void setupRead() {\r
+        testExpectedStatusCode = STATUS_OK;\r
+        testRequestType = ServiceRequestType.READ;\r
+        testSetup(testExpectedStatusCode, testRequestType);\r
+    }\r
+\r
+    /**\r
+     * Sets up read tests.\r
+     */\r
+    protected void setupForbidden() {\r
+        testExpectedStatusCode = STATUS_FORBIDDEN;\r
+        testRequestType = ServiceRequestType.READ;\r
+        testSetup(testExpectedStatusCode, testRequestType);\r
+    }\r
+\r
+    /**\r
+     * Sets up read non existent tests.\r
+     */\r
+    protected void setupReadNonExistent() {\r
+        testExpectedStatusCode = STATUS_NOT_FOUND;\r
+        testRequestType = ServiceRequestType.READ;\r
+        testSetup(testExpectedStatusCode, testRequestType);\r
+    }\r
+\r
+    /**\r
+     * Sets up read list tests.\r
+     */\r
+    protected void setupReadList() {\r
+        testExpectedStatusCode = STATUS_OK;\r
+        testRequestType = ServiceRequestType.READ_LIST;\r
+        testSetup(testExpectedStatusCode, testRequestType);\r
+    }\r
+\r
+    /**\r
+     * Sets up update tests.\r
+     */\r
+    protected void setupUpdate() {\r
+        testExpectedStatusCode = STATUS_OK;\r
+        testRequestType = ServiceRequestType.UPDATE;\r
+        testSetup(testExpectedStatusCode, testRequestType);\r
+    }\r
+       \r
+    /**\r
+     * Sets up update tests with an empty entity body.\r
+     */\r
+    protected void setupUpdateWithEmptyEntityBody() {\r
+        testExpectedStatusCode = STATUS_BAD_REQUEST;\r
+        testRequestType = ServiceRequestType.UPDATE;\r
+        testSetup(testExpectedStatusCode, testRequestType);\r
+    }\r
+\r
+    /**\r
+     * Sets up update tests with malformed xml.\r
+     */\r
+    protected void setupUpdateWithMalformedXml() {\r
+        testExpectedStatusCode = STATUS_BAD_REQUEST;\r
+        testRequestType = ServiceRequestType.UPDATE;\r
+        testSetup(testExpectedStatusCode, testRequestType);\r
+    }\r
+    \r
+    /**\r
+     * Sets up update tests with wrong xml schema.\r
+     */\r
+    protected void setupUpdateWithWrongXmlSchema() {\r
+        testExpectedStatusCode = STATUS_BAD_REQUEST;\r
+        testRequestType = ServiceRequestType.UPDATE;\r
+        testSetup(testExpectedStatusCode, testRequestType);\r
+    }\r
+    \r
+    /**\r
+     * Sets up update non existent tests\r
+     */\r
+    protected void setupUpdateNonExistent() {\r
+        testExpectedStatusCode = STATUS_NOT_FOUND;\r
+        testRequestType = ServiceRequestType.UPDATE;\r
+        testSetup(testExpectedStatusCode, testRequestType);\r
+    }\r
+\r
+    /**\r
+     * Sets up delete tests.\r
+     */\r
+    protected void setupDelete() {\r
+        testExpectedStatusCode = STATUS_OK;\r
+        testRequestType = ServiceRequestType.DELETE;\r
+        testSetup(testExpectedStatusCode, testRequestType);\r
+    }\r
+\r
+    // Failure outcomes\r
+\r
+    /**\r
+     * Sets up delete non existent tests.\r
+     */\r
+    protected void setupDeleteNonExistent() {\r
+        testExpectedStatusCode = STATUS_NOT_FOUND;\r
+        testRequestType = ServiceRequestType.DELETE;\r
+        testSetup(testExpectedStatusCode, testRequestType);\r
+    }\r
+    \r
+    /**\r
+     * Sets up create tests with empty entity body.\r
+     */\r
+    protected void setupCreateWithEmptyEntityBody() {\r
+        testExpectedStatusCode = STATUS_BAD_REQUEST;\r
+        testRequestType = ServiceRequestType.CREATE;\r
+        testSetup(testExpectedStatusCode, testRequestType);\r
+    }\r
+\r
+    /**\r
+     * Sets up create tests with empty entity body.\r
+     */\r
+    protected void setupCreateWithInvalidBody() {\r
+        testExpectedStatusCode = STATUS_BAD_REQUEST;\r
+        testRequestType = ServiceRequestType.CREATE;\r
+        testSetup(testExpectedStatusCode, testRequestType);\r
+    }\r
+    \r
+    /**\r
+     * Sets up create tests with empty entity body.\r
+     */\r
+    protected void setupUpdateWithInvalidBody() {\r
+        testExpectedStatusCode = STATUS_BAD_REQUEST;\r
+        testRequestType = ServiceRequestType.UPDATE;\r
+        testSetup(testExpectedStatusCode, testRequestType);\r
+    }\r
+    \r
+    public void updateWithEmptyEntityBody(String testName) throws Exception {\r
+        //FIXME: Should this test really be empty?  If so, please comment accordingly.\r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)\r
+     */\r
+    public void updateWithMalformedXml(String testName) throws Exception {\r
+        //FIXME: Should this test really be empty?  If so, please comment accordingly.\r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)\r
+     */\r
+    public void updateWithWrongXmlSchema(String testName) throws Exception {\r
+        //FIXME: Should this test really be empty?  If so, please comment accordingly.\r
+    }\r
+    \r
 }\r
index b6c918ae07f972459f72548890e7a391428b41ec..b28313d4bf17b5f4480337e6673c68d19989d9e8 100644 (file)
@@ -25,9 +25,6 @@ package org.collectionspace.services.client.test;
 import java.util.Arrays;
 import javax.ws.rs.core.Response;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 /**
  * ServiceRequestType, identifies types of service requests
  * and the valid HTTP status codes that can be returned from
index 2958bca3dd7e092183564e78ed79aef3eb85127a..9eeea0063fdaeb1f4616a2e97b7d153e5f395e6f 100644 (file)
@@ -39,8 +39,30 @@ public interface ServiceTest {
     // CRUD tests : CREATE tests
     // ---------------------------------------------------------------
 
+    /*
+     * We use this method to force a TestNG execution order for our tests.  The "leaf" methods
+     * should look something like this:
+     * 
+           //
+           // For convenience and terseness, this test method is the base of the test execution dependency chain.  Other test methods may
+           // refer to this method in their @Test annotation declarations.
+           //
+           @Test(dataProvider = "testName",
+                       dependsOnMethods = {
+                               "org.collectionspace.services.client.test.AbstractServiceTestImpl.baseCRUDTests"})    
+           public void CRUDTests() {
+               // Do nothing.  Simply here to for a TestNG execution order for our tests
+           }
+        *
+        * For an example, see the CollectionObjectServiceTest class.
+        * 
+     */    
+    public void CRUDTests(String testName);
+    
     // Success outcomes
 
+    public void searchWorkflowDeleted(String testName) throws Exception;
+    
     /**
      * Tests creation of a new resource.
      *
@@ -49,7 +71,7 @@ public interface ServiceTest {
      * @throws Exception 
      */
     public void create(String testName) throws Exception;
-
+    
     /**
      * Tests creation of a list of two or more new resources by repeatedly
      * calling create(), and relies on the latter's test assertion(s).
@@ -190,7 +212,6 @@ public interface ServiceTest {
      */
     public void updateNonExistent(String testName) throws Exception;
 
-
     // ---------------------------------------------------------------
     // CRUD tests : DELETE tests
     // ---------------------------------------------------------------
index 108009054cdd3c01811bdea9db2f35dc243bf306..4e5ddc2eb6cea4241ddbb648a80e0b99b97df821 100644 (file)
  */
 package org.collectionspace.services.client.workflow;
 
+import javax.ws.rs.core.Response;
+
 import org.collectionspace.services.jaxb.AbstractCommonList;
-import org.collectionspace.services.client.AbstractPoxServiceClientImpl;
+import org.collectionspace.services.client.AbstractCommonListPoxServiceClientImpl;
+import org.jboss.resteasy.client.ClientResponse;
 
 /**
  * WorkflowClient.java
@@ -26,7 +29,7 @@ import org.collectionspace.services.client.AbstractPoxServiceClientImpl;
  * $LastChangedDate: 2010-05-17 18:25:37 -0700 (Mon, 17 May 2010) $
  *
  */
-public class WorkflowClient extends AbstractPoxServiceClientImpl<AbstractCommonList, WorkflowProxy> {
+public class WorkflowClient extends AbstractCommonListPoxServiceClientImpl<WorkflowProxy> {
        public static final String SERVICE_NAME = "workflow";
        public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;       
        public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
@@ -53,11 +56,29 @@ public class WorkflowClient extends AbstractPoxServiceClientImpl<AbstractCommonL
        @Override
     public String getServicePathComponent() {
         return SERVICE_PATH_COMPONENT;
-    }    
+    }
 
        @Override
        public Class<WorkflowProxy> getProxyClass() {
                // TODO Auto-generated method stub
                return WorkflowProxy.class;
        }
+
+       /*
+        * Proxied service calls
+        */
+       
+       @Override
+       public ClientResponse<AbstractCommonList> readList() {
+        throw new UnsupportedOperationException();
+       }
+       
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.client.AbstractServiceClientImpl#delete(java.lang.String)
+     */
+    @Override
+       public ClientResponse<Response> delete(String csid) {
+        throw new UnsupportedOperationException();
+    }
+       
 }
index b523d5b2dd97dc445a994c1bcb972e76237660fc..6be4834bbe4e2936b4722b782ca2672a1ed917c0 100644 (file)
@@ -1,14 +1,10 @@
 package org.collectionspace.services.client.workflow;
 
 import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
 
-import org.collectionspace.services.client.CollectionSpacePoxProxy;
-import org.collectionspace.services.jaxb.AbstractCommonList;
-import org.jboss.resteasy.client.ClientResponse;
+import org.collectionspace.services.client.CollectionSpaceCommonListPoxProxy;
 
 /**
  * @version $Revision: 2108 $
@@ -16,5 +12,5 @@ import org.jboss.resteasy.client.ClientResponse;
 @Path(WorkflowClient.SERVICE_PATH + "/")
 @Produces({"application/xml"})
 @Consumes({"application/xml"})
-public interface WorkflowProxy extends CollectionSpacePoxProxy<AbstractCommonList> {
+public interface WorkflowProxy extends CollectionSpaceCommonListPoxProxy {
 }
index 58edea1460be17f733ee93c5d7d10d556a5fcd48..789e592a4d97bb645f41e5e373fc746d4a97ef9d 100644 (file)
@@ -65,7 +65,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>\r
         <dependency>\r
             <groupId>org.jboss.resteasy</groupId>\r
index 7732c62b925eaabe09441fda1a9d68e35f6ae3fb..e41e3e0de11dbe58d9cc4d772fd304b78c6bde40 100644 (file)
@@ -61,7 +61,6 @@ public class CollectionObjectClient extends AbstractCommonListPoxServiceClientIm
         return CollectionObjectProxy.class;
     }
 
-
     /**
      * Roundtrip.
      * 
@@ -77,19 +76,4 @@ public class CollectionObjectClient extends AbstractCommonListPoxServiceClientIm
         getLogger().debug("<<<<Roundtrip stop.");
         return result;
     }
-
-    /**
-     * Keyword search.
-     * 
-     * @param keywords the keywords
-     * 
-     * @see org.collectionspace.services.client.CollectionObjectProxy#keywordSearch()
-     * @return the client response< collectionobjects common list>
-     */
-    /*
-    public ClientResponse<CollectionobjectsCommonList> keywordSearch(String keywords) {
-        return getProxy().keywordSearch(keywords);
-    }
-     * 
-     */
 }
index 6d4c1ec13ba8fda436cf2a58f350d3138e95cd77..aaa9b193d08beebd02571c9e1fd7101122e7d25a 100644 (file)
@@ -56,7 +56,6 @@ import org.collectionspace.services.jaxb.AbstractCommonList;
 
 import org.jboss.resteasy.client.ClientResponse;
 
-import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
@@ -71,7 +70,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision: 1327 $
  * $LastChangedDate: 2010-02-12 10:35:11 -0800 (Fri, 12 Feb 2010) $
  */
-public class CollectionObjectAuthRefsTest extends BaseServiceTest {
+public class CollectionObjectAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
 
     @Override
     protected CollectionSpaceClient getClientInstance() {
@@ -98,9 +97,6 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest {
     /** The organization authority name. */
     final String ORG_AUTHORITY_NAME = "TestOrgAuth";
     
-    /** The known resource id. */
-    private String knownResourceId = null;
-    
     /** The collection object ids created. */
     private List<String> collectionObjectIdsCreated = new ArrayList<String>();
     
@@ -154,16 +150,7 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest {
 
     /** The number of authority references expected. */
     private final int NUM_AUTH_REFS_EXPECTED = 4;
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
-     */
-    @Override
-       protected AbstractCommonList getAbstractCommonList(
-                       ClientResponse<AbstractCommonList> response) {
-       throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
-    }
-
+    
     // ---------------------------------------------------------------
     // CRUD tests : CREATE tests
     // ---------------------------------------------------------------
@@ -174,14 +161,8 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest {
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
-    public void createWithAuthRefs(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
-        
+    @Test(dataProvider="testName")
+    public void createWithAuthRefs(String testName) throws Exception {        
         // Create all the person refs and entities
         createPersonRefs();
 
@@ -206,27 +187,21 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest {
 
         // Submit the request to the service and store the response.
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
+        testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
         ClientResponse<Response> res = collectionObjectClient.create(multipart);
-
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        //
-        // Specifically:
-        // Does it fall within the set of valid status codes?
-        // Does it exactly match the expected status code?
-        if(logger.isDebugEnabled()){
-            logger.debug(testName + ": status = " + statusCode);
+        String newCsid = null;
+        try {
+               assertStatusCode(res, testName);
+               newCsid = extractId(res);
+        } finally {
+               if (res != null) {
+                       res.releaseConnection();
+               }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
         // Store the ID returned from the first resource created
         // for additional tests below.
         if (knownResourceId == null){
-            knownResourceId = extractId(res);
+            knownResourceId = newCsid;
             if (logger.isDebugEnabled()) {
                 logger.debug(testName + ": knownResourceId=" + knownResourceId);
             }
@@ -251,8 +226,8 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest {
         ClientResponse<Response> res = personAuthClient.create(multipart);
         int statusCode = res.getStatus();
 
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, STATUS_CREATED);
         personAuthCSID = extractId(res);
         personAuthRefName = PersonAuthorityClientUtils.getAuthorityRefName(personAuthCSID, null);
@@ -278,8 +253,8 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest {
         ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
         int statusCode = res.getStatus();
 
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, STATUS_CREATED);
        return extractId(res);
     }
@@ -345,8 +320,8 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest {
         ClientResponse<Response> res = orgAuthClient.create(multipart);
         int statusCode = res.getStatus();
 
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, STATUS_CREATED);
         orgAuthCSID = extractId(res);
         orgAuthRefName = OrgAuthorityClientUtils.getAuthorityRefName(orgAuthCSID, null);
@@ -372,8 +347,8 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest {
         ClientResponse<Response> res = orgAuthClient.createItem(orgAuthCSID, multipart);
         int statusCode = res.getStatus();
 
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, STATUS_CREATED);
        return extractId(res);
     }
@@ -413,31 +388,41 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest {
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+    @Test(dataProvider="testName",
         dependsOnMethods = {"createWithAuthRefs"})
     public void readAndCheckAuthRefs(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         testSetup(STATUS_OK, ServiceRequestType.READ);
-
-        // Submit the request to the service and store the response.
+        //
+        // First read the object
+        //
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
         ClientResponse<String> res = collectionObjectClient.read(knownResourceId);
-        assertStatusCode(res, testName);
-
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        CollectionobjectsCommon collectionObject = (CollectionobjectsCommon) extractPart(input,
-                       collectionObjectClient.getCommonPartName(), CollectionobjectsCommon.class);
-        Assert.assertNotNull(collectionObject);
-
-        // Get all of the auth refs and check that the expected number is returned
+        CollectionobjectsCommon collectionObject = null;
+        try {
+               assertStatusCode(res, testName);
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               collectionObject = (CollectionobjectsCommon) extractPart(input,
+                               collectionObjectClient.getCommonPartName(), CollectionobjectsCommon.class);
+               Assert.assertNotNull(collectionObject);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
+        //
+        // Next, get all of the auth refs and check that the expected number is returned
+        //
         ClientResponse<AuthorityRefList> res2 = collectionObjectClient.getAuthorityRefs(knownResourceId);
-        assertStatusCode(res2, testName);
-
-        AuthorityRefList list = res2.getEntity();
+        AuthorityRefList list = null;
+        try {
+               assertStatusCode(res2, testName);        
+               list = res2.getEntity();
+        } finally {
+               if (res2 != null) {
+                       res2.releaseConnection();
+            }
+        }
         
         List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
         int numAuthRefsFound = items.size();
index 5afc85d2ec9c463031e72979cffb1c85141bb699..28df7e0fb8048353070f11123d0432f90ca04b07 100644 (file)
@@ -29,12 +29,12 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
 import org.collectionspace.services.CollectionObjectJAXBSchema;
+import org.collectionspace.services.client.AbstractCommonListUtils;
 import org.collectionspace.services.client.CollectionObjectClient;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.collectionobject.CollectionobjectsCommon;
-import org.collectionspace.services.common.AbstractCommonListUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 
 import org.jboss.resteasy.client.ClientResponse;
@@ -52,7 +52,7 @@ import org.testng.annotations.Test;
  * $LastChangedRevision: 1327 $ $LastChangedDate: 2010-02-12 10:35:11 -0800
  * (Fri, 12 Feb 2010) $
  */
-public class CollectionObjectSearchTest extends BaseServiceTest {
+public class CollectionObjectSearchTest extends BaseServiceTest<AbstractCommonList> {
 
        /** The logger. */
        private final String CLASS_NAME = CollectionObjectSearchTest.class
@@ -125,19 +125,7 @@ public class CollectionObjectSearchTest extends BaseServiceTest {
        protected CollectionSpaceClient getClientInstance() {
                return new CollectionObjectClient();
        }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see org.collectionspace.services.client.test.BaseServiceTest#
-        * getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
-        */
-       @Override
-       protected AbstractCommonList getAbstractCommonList(
-                       ClientResponse<AbstractCommonList> response) {
-               return response.getEntity(AbstractCommonList.class);
-       }
-
+       
        /**
         * Creates one or more resources containing a "noise" keyword, which should
         * NOT be retrieved by keyword searches.
@@ -163,11 +151,6 @@ public class CollectionObjectSearchTest extends BaseServiceTest {
 
        @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, groups = { "advancedSearch" })
        public void advancedSearch(String testName) throws Exception {
-
-               if (logger.isDebugEnabled()) {
-                       logger.debug(testBanner(testName, CLASS_NAME));
-               }
-
                // Create one or more keyword retrievable resources, each containing
                // a specified keyword.
                String theKeyword = KEYWORD + "COW";
@@ -189,9 +172,9 @@ public class CollectionObjectSearchTest extends BaseServiceTest {
                if (logger.isDebugEnabled()) {
                        logger.debug(testName + ": status = " + statusCode);
                }
-               Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                               invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-               Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                               invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
 
                // Verify that the number of resources matched by the search
                // is identical to the expected result
@@ -202,11 +185,6 @@ public class CollectionObjectSearchTest extends BaseServiceTest {
 
        @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, groups = { "oneKeyword" })
        public void searchWithOneKeyword(String testName) throws Exception {
-
-               if (logger.isDebugEnabled()) {
-                       logger.debug(testBanner(testName, CLASS_NAME));
-               }
-
                // Create one or more keyword retrievable resources, each containing
                // a specified keyword.
                long numKeywordRetrievableResources = (long) (numNoiseWordResources * pctNonNoiseWordResources);
@@ -228,9 +206,9 @@ public class CollectionObjectSearchTest extends BaseServiceTest {
                if (logger.isDebugEnabled()) {
                        logger.debug(testName + ": status = " + statusCode);
                }
-               Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                               invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-               Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                               invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
 
                // Verify that the number of resources matched by the search
                // is identical to the expected result
@@ -242,11 +220,6 @@ public class CollectionObjectSearchTest extends BaseServiceTest {
        @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
        public void searchWithTwoKeywordsInSameField(String testName)
                        throws Exception {
-
-               if (logger.isDebugEnabled()) {
-                       logger.debug(testBanner(testName, CLASS_NAME));
-               }
-
                // Create one or more keyword retrievable resources, each containing
                // two specified keywords.
                long numKeywordRetrievableResources = (long) (numNoiseWordResources * pctNonNoiseWordResources);
@@ -272,9 +245,9 @@ public class CollectionObjectSearchTest extends BaseServiceTest {
                if (logger.isDebugEnabled()) {
                        logger.debug(testName + ": status = " + statusCode);
                }
-               Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                               invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-               Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                               invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
 
                // Verify that the number of resources matched by the search
                // is identical to the expected result
@@ -293,9 +266,9 @@ public class CollectionObjectSearchTest extends BaseServiceTest {
                if (logger.isDebugEnabled()) {
                        logger.debug(testName + ": status = " + statusCode);
                }
-               Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                               invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-               Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                               invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
 
                // Verify that the number of resources matched by the search
                // is identical to the expected result
@@ -308,11 +281,6 @@ public class CollectionObjectSearchTest extends BaseServiceTest {
        @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
        public void searchWithTwoKeywordsAcrossTwoFields(String testName)
                        throws Exception {
-
-               if (logger.isDebugEnabled()) {
-                       logger.debug(testBanner(testName, CLASS_NAME));
-               }
-
                // Create one or more keyword retrievable resources, each containing
                // two specified keywords.
                long numKeywordRetrievableResources = 5;
@@ -338,9 +306,9 @@ public class CollectionObjectSearchTest extends BaseServiceTest {
                if (logger.isDebugEnabled()) {
                        logger.debug(testName + ": status = " + statusCode);
                }
-               Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                               invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-               Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                               invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
 
                // Verify that the number of resources matched by the search
                // is identical to the expected result
@@ -359,9 +327,9 @@ public class CollectionObjectSearchTest extends BaseServiceTest {
                if (logger.isDebugEnabled()) {
                        logger.debug(testName + ": status = " + statusCode);
                }
-               Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                               invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-               Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                               invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
 
                // Verify that the number of resources matched by the search
                // is identical to the expected result
@@ -384,11 +352,6 @@ public class CollectionObjectSearchTest extends BaseServiceTest {
        // }
        @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, groups = { "utf8" })
        public void searchWithUTF8Keyword(String testName) {
-
-               if (logger.isDebugEnabled()) {
-                       logger.debug(testBanner(testName, CLASS_NAME));
-               }
-
                // Create one or more keyword retrievable resources, each containing
                // two specified keywords.
                long numKeywordRetrievableResources = 2;
@@ -410,9 +373,9 @@ public class CollectionObjectSearchTest extends BaseServiceTest {
                if (logger.isDebugEnabled()) {
                        logger.debug(testName + ": status = " + statusCode);
                }
-               Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                               invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-               Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                               invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
 
                // Verify that the number of resources matched by the search
                // is identical to the expected result
@@ -426,11 +389,6 @@ public class CollectionObjectSearchTest extends BaseServiceTest {
        @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
        public void keywordSearchNonExistentKeyword(String testName)
                        throws Exception {
-
-               if (logger.isDebugEnabled()) {
-                       logger.debug(testBanner(testName, CLASS_NAME));
-               }
-
                // Set the expected status code and group of valid status codes
                testSetup(STATUS_OK, ServiceRequestType.SEARCH);
 
@@ -443,9 +401,9 @@ public class CollectionObjectSearchTest extends BaseServiceTest {
                if (logger.isDebugEnabled()) {
                        logger.debug(testName + ": status = " + statusCode);
                }
-               Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                               invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-               Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                               invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
 
                // Verify that the number of resources matched by the search
                // is identical to the expected result
@@ -506,7 +464,7 @@ public class CollectionObjectSearchTest extends BaseServiceTest {
                        ClientResponse<Response> res = client.create(multipart);
                        try {
                                int statusCode = res.getStatus();
-                               Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+                               Assert.assertEquals(statusCode, testExpectedStatusCode);
                                String id = extractId(res);
                                allResourceIdsCreated.add(id);
                                if (logger.isDebugEnabled()) {
index e7713f6fb5cd9acb009ad22d3c8381a92740d432..1ab3c75d3dc9ea2270faae1adcf130e6b5fdccd5 100644 (file)
@@ -29,12 +29,11 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
 //import org.collectionspace.services.client.AbstractServiceClientImpl;
+import org.collectionspace.services.client.AbstractCommonListUtils;
 import org.collectionspace.services.client.CollectionObjectClient;
 import org.collectionspace.services.client.CollectionObjectFactory;
 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.collectionobject.BriefDescriptionList;
 import org.collectionspace.services.collectionobject.CollectionobjectsCommon;
@@ -52,7 +51,6 @@ import org.collectionspace.services.collectionobject.TitleGroup;
 import org.collectionspace.services.collectionobject.TitleGroupList;
 import org.collectionspace.services.collectionobject.TitleTranslationSubGroup;
 import org.collectionspace.services.collectionobject.TitleTranslationSubGroupList;
-import org.collectionspace.services.common.AbstractCommonListUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 
 import org.jboss.resteasy.client.ClientResponse;
@@ -69,16 +67,12 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision$
  * $LastChangedDate$
  */
-public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
+public class CollectionObjectServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonList, CollectionobjectsCommon> {
 
     /** The logger. */
     private final String CLASS_NAME = CollectionObjectServiceTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
     
-    // Instance variables specific to this test.
-    /** The known resource id. */
-    private String knownResourceId = null;
-
     private final String OBJECT_NAME_VALUE = "an object name";
     private final BigInteger AGE_VALUE = new BigInteger("55");
     private final String MEASURED_PART = "light box frame";
@@ -108,83 +102,37 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
     protected CollectionSpaceClient getClientInstance() {
        return new CollectionObjectClient();
     }
-    
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
-     */
-    @Override
-       protected AbstractCommonList getAbstractCommonList(
-                       ClientResponse<AbstractCommonList> response) {
-        return response.getEntity(AbstractCommonList.class);
-    }
+     
     // ---------------------------------------------------------------
     // CRUD tests : CREATE tests
     // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
+    // Expected success outcomes
+    
+    /*
+     * For convenience and terseness, this test method is the base of the test execution dependency chain.  Other test methods may
+     * refer to this method in their @Test annotation declarations.
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
-    public void create(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup, such as initializing the type of service request
-        // (e.g. CREATE, DELETE), its valid and expected status codes, and
-        // its associated HTTP method name (e.g. POST, DELETE).
-        setupCreate();
-
-        // Submit the request to the service and store the response.
-        CollectionObjectClient client = new CollectionObjectClient();
-        String identifier = createIdentifier();
-        PoxPayloadOut multipart =
-                createCollectionObjectInstance(client.getCommonPartName(), identifier);
-        ClientResponse<Response> res = client.create(multipart);
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        //
-        // Specifically:
-        // Does it fall within the set of valid status codes?
-        // Does it exactly match the expected status code?
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": status = " + statusCode);
-        }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
-        // Store the ID returned from the first resource created
-        // for additional tests below.
-        if (knownResourceId == null) {
-            knownResourceId = extractId(res);
-            if (logger.isDebugEnabled()) {
-                logger.debug(testName + ": knownResourceId=" + knownResourceId);
-            }
-        }
-
-        // Store the IDs from every resource created by tests,
-        // so they can be deleted after tests have been run.
-        allResourceIdsCreated.add(extractId(res));
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {
+                       "org.collectionspace.services.client.test.AbstractServiceTestImpl.baseCRUDTests"})    
+    public void CRUDTests(String testName) {
+       // Do nothing.  Simply here to for a TestNG execution order for our tests
     }
-
-
+        
     /*
      * Tests to diagnose and verify the fixed status of CSPACE-1026,
      * "Whitespace at certain points in payload cause failure"
      */
+    
     /**
      * Creates the from xml cambridge.
      *
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-        dependsOnMethods = {"create", "testSubmitRequest"})
+    @Test(dataProvider = "testName",
+        dependsOnMethods = {"CRUDTests"})
     public void createFromXmlCambridge(String testName) throws Exception {
         String newId =
             createFromXmlFile(testName, "./test-data/testCambridge.xml", true);
@@ -202,11 +150,8 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
     // Verify that record creation occurs successfully when the first value instance
     // of a single, repeatable String scalar field is non-blank.
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-        dependsOnMethods = {"create", "testSubmitRequest"}, groups = {"cspace2242group"})
+        dependsOnMethods = {"CRUDTests"}, groups = {"cspace2242group"})
     public void createFromXmlNonBlankFirstValueInstance(String testName) throws Exception {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         String newId =
             createFromXmlFile(testName, "./test-data/cspace-2242-first-value-instance-nonblank.xml", true);
         CollectionobjectsCommon collectionObject = readCollectionObjectCommonPart(newId);
@@ -219,11 +164,8 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
     // Verify that record creation occurs successfully when the first value instance
     // of a single, repeatable String scalar field is blank.
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-        dependsOnMethods = {"create", "testSubmitRequest"}, groups = {"cspace2242group"})
+        dependsOnMethods = {"CRUDTests"}, groups = {"cspace2242group"})
     public void createFromXmlBlankFirstValueInstance(String testName) throws Exception {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         String newId =
             createFromXmlFile(testName, "./test-data/cspace-2242-first-value-instance-blank.xml", true);
         CollectionobjectsCommon collectionObject = readCollectionObjectCommonPart(newId);
@@ -235,11 +177,8 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
 
      // Verify that values are preserved when enclosed in double quote marks.
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-        dependsOnMethods = {"create", "testSubmitRequest"}, groups = {"cspace3237group"})
+        dependsOnMethods = {"CRUDTests"}, groups = {"cspace3237group"})
     public void doubleQuotesEnclosingFieldContents(String testName) throws Exception {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         String newId =
             createFromXmlFile(testName, "./test-data/cspace-3237-double-quotes.xml", true);
         CollectionobjectsCommon collectionObject = readCollectionObjectCommonPart(newId);
@@ -265,7 +204,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
      * @throws Exception the exception
      */
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-        dependsOnMethods = {"create", "testSubmitRequest"})
+        dependsOnMethods = {"CRUDTests"})
     public void createFromXmlRFWS1(String testName) throws Exception {
        String testDataDir = System.getProperty("test-data.fileName");
         String newId =
@@ -281,7 +220,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
      * @throws Exception the exception
      */
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-        dependsOnMethods = {"create", "testSubmitRequest"})
+        dependsOnMethods = {"CRUDTests"})
     public void createFromXmlRFWS2(String testName) throws Exception {
        String testDataDir = System.getProperty("test-data.fileName");
         String newId =
@@ -297,7 +236,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
      * @throws Exception the exception
      */
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-        dependsOnMethods = {"create", "testSubmitRequest"})
+        dependsOnMethods = {"CRUDTests"})
     public void createFromXmlRFWS3(String testName) throws Exception {
        String testDataDir = System.getProperty("test-data.fileName");
         String newId =
@@ -313,7 +252,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
      * @throws Exception the exception
      */
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-        dependsOnMethods = {"create", "testSubmitRequest"})
+        dependsOnMethods = {"CRUDTests"})
     public void createFromXmlRFWS4(String testName) throws Exception {
        String testDataDir = System.getProperty("test-data.fileName");
         String newId =
@@ -335,7 +274,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
      * @throws Exception the exception
      */
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-        dependsOnMethods = {"create", "testSubmitRequest"})
+        dependsOnMethods = {"CRUDTests"})
     public void createWithNullValueRepeatableField(String testName) throws Exception {
        String testDataDir = System.getProperty("test-data.fileName");
        String newId =
@@ -355,7 +294,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
      * @throws Exception the exception
      */
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-        dependsOnMethods = {"create", "testSubmitRequest"}, groups={"utf8-create"})
+        dependsOnMethods = {"CRUDTests"}, groups={"utf8-create"})
     public void createWithUTF8Data(String testName) throws Exception {
        String testDataDir = System.getProperty("test-data.fileName");
        String newId =
@@ -373,16 +312,6 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
         Assert.assertTrue(distinguishingFeatures.equals(UTF8_DATA_SAMPLE));
     }
 
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#createList()
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
-    public void createList(String testName) throws Exception {
-       this.createPaginatedList(testName, DEFAULT_LIST_SIZE);
-    }
-
     // Failure outcomes
     // Placeholders until the three tests below can be uncommented.
     // See Issue CSPACE-401.
@@ -406,6 +335,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
     @Override
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
     public void createWithMalformedXml(String testName) throws Exception {
+       //FIXME: Should this test really be empty?
     }
 
     /* (non-Javadoc)
@@ -523,9 +453,6 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
     */
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
     public void createWithRequiredValuesNullOrEmpty(String testName) throws Exception {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         setupCreate();
 
         // Build a payload with invalid content, by omitting a
@@ -559,8 +486,8 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
 
         // FIXME: Consider splitting off the following into its own test method.
@@ -589,257 +516,11 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
-
     }
-
-
-    // ---------------------------------------------------------------
-    // CRUD tests : READ tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
-    public void read(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupRead();
-
-        // Submit the request to the service and store the response.
-        CollectionObjectClient client = new CollectionObjectClient();
-        ClientResponse<String> res = client.read(knownResourceId);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
-        // Extract the common part.
-        CollectionobjectsCommon collectionobjectCommon = extractCommonPartValue(testName, res);
-
-        // Verify the number and contents of values in repeatable fields,
-        // as created in the instance record used for testing.
-        MeasuredPartGroupList measuredPartGroupList = collectionobjectCommon.getMeasuredPartGroupList();
-        Assert.assertNotNull(measuredPartGroupList, "Measured part group list was null");
-        List<MeasuredPartGroup> measuredPartGroups = measuredPartGroupList.getMeasuredPartGroup();
-        Assert.assertNotNull(measuredPartGroups, "Measured part groups were null");
-        Assert.assertTrue(measuredPartGroups.size() > 0, "No measured part groups were returned");
-        MeasuredPartGroup mpGroup = measuredPartGroups.get(0);
-        Assert.assertNotNull(mpGroup.getMeasuredPart(), "Measured part was null");
-        Assert.assertEquals(mpGroup.getMeasuredPart(), MEASURED_PART,
-                "Measured part value returned didn't match expected value");
-        
-        DimensionSubGroupList dimensionSubGroupList = mpGroup.getDimensionSubGroupList();
-        Assert.assertNotNull(dimensionSubGroupList, "Dimension subgroup list was null");
-        List<DimensionSubGroup> dimensionSubGroups = dimensionSubGroupList.getDimensionSubGroup();
-        Assert.assertNotNull(dimensionSubGroups, "Dimension subgroups were null");
-        Assert.assertTrue(dimensionSubGroups.size() > 0, "No dimension subgroups were returned");
-        DimensionSubGroup lengthDimension = dimensionSubGroups.get(0);
-        Assert.assertNotNull(lengthDimension, "Length dimension was null");
-        Assert.assertTrue(lengthDimension.getValue().compareTo(DIMENSION_VALUE_LENGTH) == 0,
-                "Dimension length value returned didn't match expected value");
-        
-        /* No longer part of the "default" domain service tests for the CollectionObject record.
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": Reading Natural History part ...");
-        }
-
-        // Currently checking only that the natural history part is non-null;
-        // can add specific field-level checks as warranted.
-        Object conh = extractPartValue(testName, res, getNHPartName());
-        Assert.assertNotNull(conh);
-        */
-    }
-
-    // Failure outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
-    public void readNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadNonExistent();
-
-        // Submit the request to the service and store the response.
-        CollectionObjectClient client = new CollectionObjectClient();
-        ClientResponse<String> res = client.read(NON_EXISTENT_ID);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
     
-    // ---------------------------------------------------------------
-    // CRUD tests : READ_LIST tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList", "read"})
-    public void readList(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadList();
-
-        // Submit the request to the service and store the response.
-        CollectionObjectClient client = new CollectionObjectClient();
-        ClientResponse<AbstractCommonList> res = client.readList();
-        assertStatusCode(res, testName);
-        AbstractCommonList list = res.getEntity();
-        
-        // Optionally output additional data about list members for debugging.
-        // the expected response(s)?
-        if(logger.isTraceEnabled()){
-               AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
-        }
-        
-    }
-
-    // Failure outcomes
-    // None at present.
-    // ---------------------------------------------------------------
-    // CRUD tests : UPDATE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
-    public void update(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-
-        // Read an existing resource that will be updated.
-        ClientResponse<String> res = updateRetrieve(testName, knownResourceId);
-
-        // Extract its common part.
-        CollectionobjectsCommon collectionObjectCommon = extractCommonPartValue(testName, res);
-
-        // Change the content of one or more fields in the common part.
-
-        collectionObjectCommon.setObjectNumber("updated-" + collectionObjectCommon.getObjectNumber());
-
-        // Change the object name in the first value instance in the
-        // object name repeatable group.
-        ObjectNameList objNameList = collectionObjectCommon.getObjectNameList();
-        List<ObjectNameGroup> objNameGroups = objNameList.getObjectNameGroup();
-        Assert.assertNotNull(objNameGroups);
-        Assert.assertTrue(objNameGroups.size() >= 1);
-        String objectName = objNameGroups.get(0).getObjectName();
-        Assert.assertEquals(objectName, OBJECT_NAME_VALUE);
-        String updatedObjectName = "updated-" + objectName;
-        objNameGroups.get(0).setObjectName(updatedObjectName);
-        collectionObjectCommon.setObjectNameList(objNameList);
-
-        // Replace the existing value instances in the dimensions repeatable group
-        // with entirely new value instances, also changing the number of such instances.
-        MeasuredPartGroupList measuredPartGroupList = collectionObjectCommon.getMeasuredPartGroupList();
-        Assert.assertNotNull(measuredPartGroupList);
-        List<MeasuredPartGroup> measuredPartGroups = measuredPartGroupList.getMeasuredPartGroup();
-        Assert.assertNotNull(measuredPartGroups);
-        Assert.assertTrue(measuredPartGroups.size() > 0);
-        MeasuredPartGroup mpGroup = measuredPartGroups.get(0);
-        Assert.assertNotNull(mpGroup.getMeasuredPart());
-        
-        DimensionSubGroupList dimensionSubGroupList = mpGroup.getDimensionSubGroupList();
-        Assert.assertNotNull(dimensionSubGroupList);
-        List<DimensionSubGroup> dimensionSubGroups = dimensionSubGroupList.getDimensionSubGroup();
-        Assert.assertNotNull(dimensionSubGroups);
-        int originalDimensionSubGroupSize = dimensionSubGroups.size();
-        Assert.assertTrue(dimensionSubGroups.size() > 0);
-        dimensionSubGroups.clear();
-        
-        DimensionSubGroup heightDimension = new DimensionSubGroup();
-        heightDimension.setDimension("height");
-        heightDimension.setMeasurementUnit(UPDATED_MEASUREMENT_UNIT);
-        dimensionSubGroups.add(heightDimension);
-        
-        int updatedDimensionGroupSize = dimensionSubGroups.size();
-        Assert.assertTrue(updatedDimensionGroupSize > 0);
-        Assert.assertTrue(updatedDimensionGroupSize != originalDimensionSubGroupSize);
-        
-        collectionObjectCommon.setMeasuredPartGroupList(measuredPartGroupList);
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("sparse update that will be sent in update request:");
-            logger.debug(objectAsXmlString(collectionObjectCommon,
-                    CollectionobjectsCommon.class));
-        }
-
-        // Send the changed resource to be updated and read the updated resource
-        // from the response.
-        res = updateSend(testName, knownResourceId, collectionObjectCommon);
-
-        // Extract its common part.
-        CollectionobjectsCommon updatedCollectionobjectCommon = extractCommonPartValue(testName, res);
-
-        // Read the updated common part and verify that the resource was correctly updated.
-        objNameList = updatedCollectionobjectCommon.getObjectNameList();
-        Assert.assertNotNull(objNameList);
-        objNameGroups = objNameList.getObjectNameGroup();
-        Assert.assertNotNull(objNameGroups);
-        Assert.assertTrue(objNameGroups.size() >= 1);
-        Assert.assertEquals(updatedObjectName,
-                objNameGroups.get(0).getObjectName(),
-                "Data in updated object did not match submitted data.");
-        
-        measuredPartGroupList = collectionObjectCommon.getMeasuredPartGroupList();
-        Assert.assertNotNull(measuredPartGroupList);
-        measuredPartGroups = measuredPartGroupList.getMeasuredPartGroup();
-        Assert.assertNotNull(measuredPartGroups);
-        Assert.assertTrue(measuredPartGroups.size() > 0);
-        mpGroup = measuredPartGroups.get(0);
-        Assert.assertNotNull(mpGroup.getMeasuredPart());
-        
-        dimensionSubGroupList = mpGroup.getDimensionSubGroupList();
-        Assert.assertNotNull(dimensionSubGroupList);
-        dimensionSubGroups = dimensionSubGroupList.getDimensionSubGroup();
-        Assert.assertNotNull(dimensionSubGroups);
-        Assert.assertTrue(dimensionSubGroups.size() > 0);
-        Assert.assertTrue(dimensionSubGroups.size() == updatedDimensionGroupSize);
-        Assert.assertEquals(UPDATED_MEASUREMENT_UNIT,
-                dimensionSubGroups.get(0).getMeasurementUnit(),
-                "Data in updated object did not match submitted data.");
-
-    }
-
     /**
      * Update retrieve.
      *
@@ -857,9 +538,9 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": read status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
         if(logger.isDebugEnabled()){
             logger.debug("got object to update with ID: " + knownResourceId);
         }
@@ -887,9 +568,9 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": read status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
         return res;
     }
 
@@ -901,7 +582,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
      */
     @Override
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
+       dependsOnMethods = {"CRUDTests"})
     public void updateWithEmptyEntityBody(String testName) throws Exception {
        //FIXME: Should this test really be empty?
     }
@@ -916,7 +597,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
     */
     @Override
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
+       dependsOnMethods = {"CRUDTests"})
     public void updateWithMalformedXml(String testName) throws Exception {
        //FIXME: Should this test really be empty?
     }
@@ -926,7 +607,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
      */
     @Override
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
+       dependsOnMethods = {"CRUDTests"})
     public void updateWithWrongXmlSchema(String testName) throws Exception {
        //FIXME: Should this test really be empty?
     }
@@ -1020,17 +701,8 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
     }
 */
 
-    /* (non-Javadoc)
- * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
- */
-@Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"update", "testSubmitRequest"})
+    @Override
     public void updateNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupUpdateNonExistent();
 
@@ -1040,7 +712,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
         // The only relevant ID may be the one used in updateCollectionObject(), below.
         CollectionObjectClient client = new CollectionObjectClient();
         PoxPayloadOut multipart =
-                createCollectionObjectInstance(client.getCommonPartName(), NON_EXISTENT_ID);
+                createInstance(client.getCommonPartName(), NON_EXISTENT_ID);
         ClientResponse<String> res = client.update(NON_EXISTENT_ID, multipart);
         int statusCode = res.getStatus();
 
@@ -1049,9 +721,9 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
 
    /**
@@ -1066,21 +738,20 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
     * @param testName  The name of this test method.  This name is supplied
     *     automatically, via reflection, by a TestNG 'data provider' in
     *     a base class.
- * @throws Exception 
   * @throws Exception 
     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"CRUDTests"})
     public void updateWithRequiredValuesNullOrEmpty(String testName) throws Exception {
-  
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-
         // Read an existing record for updating.
         ClientResponse<String> res = updateRetrieve(testName, knownResourceId);
-
-        // Extract its common part.
-        CollectionobjectsCommon collectionObjectCommon = extractCommonPartValue(testName, res);
+        CollectionobjectsCommon collectionObjectCommon = null;
+        try {
+               // Extract its common part.
+               collectionObjectCommon = extractCommonPartValue(res);
+        } finally {
+               res.releaseConnection();
+        }
 
         // Update the common part with invalid content, by setting a value to
         // the empty String, in a field that requires a non-empty value,
@@ -1096,125 +767,119 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
         // Submit the request to the service and store the response.
         setupUpdate();
         PoxPayloadOut output = new PoxPayloadOut(CollectionObjectClient.SERVICE_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = output.addPart(collectionObjectCommon, MediaType.APPLICATION_XML_TYPE);
         CollectionObjectClient client = new CollectionObjectClient();
-        commonPart.setLabel(client.getCommonPartName());
+        output.addPart(client.getCommonPartName(), collectionObjectCommon);
         res = client.update(knownResourceId, output);
-        int statusCode = res.getStatus();
-
-        // Read the response and verify that the update attempt failed.
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
-
+        
+        try {
+               int statusCode = res.getStatus();
+               // Read the response and verify that the update attempt failed.
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                       invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
+        } finally {
+               res.releaseConnection();
+        }
     }
 
     // ---------------------------------------------------------------
     // CRUD tests : DELETE tests
     // ---------------------------------------------------------------
     // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
-     */
+    
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
     public void delete(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDelete();
-
-        // Submit the request to the service and store the response.
-        CollectionObjectClient client = new CollectionObjectClient();
-        ClientResponse<Response> res = client.delete(knownResourceId);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+       //
+       // Create an object to delete, save the current 'knownResourceId' since we don't want to delete it yet
+       // and temporarily set it to the csid of the resource we just created.
+       //
+       String tempCsid = knownResourceId;
+       // the super.delete() method uses the knownResourceId member
+        knownResourceId = newCollectionObject(true);
+        
+        try {
+               super.delete(testName);
+        } finally {
+               // reset the 'knownResourceId'
+               knownResourceId = tempCsid;
+        }        
     }
 
-    // Failure outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
-     */
+    //
+    // Expected failure outcome tests
+    //
+
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"delete"})
     public void deleteNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupDeleteNonExistent();
 
         // Submit the request to the service and store the response.
         CollectionObjectClient client = new CollectionObjectClient();
         ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
-        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);
+        try {
+               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);
+        } finally {
+               res.releaseConnection();
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
     }
 
     // ---------------------------------------------------------------
     // Utility tests : tests of code used in tests above
     // ---------------------------------------------------------------
+    
     /**
      * Tests the code for manually submitting data that is used by several
      * of the methods above.
      * @throws Exception 
      */
 
-    @Test(dependsOnMethods = {"create", "read"})
-    public void testSubmitRequest() throws Exception {
-        testSubmitRequest(knownResourceId);
-    }
-
-    /**
-     * Test submit request.
-     *
-     * @param resourceId the resource id
-     * @throws Exception the exception
-     */
-    private void testSubmitRequest(String resourceId) throws Exception {
-
-        // Expected status code: 200 OK
-        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
-
-        // Submit the request to the service and store the response.
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getResourceURL(resourceId);
-        int statusCode = submitRequest(method, url);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug("testSubmitRequest: url=" + url
-                    + " status=" + statusCode);
-        }
-        Assert.assertEquals(statusCode, EXPECTED_STATUS);
-
-    }
-
     // ---------------------------------------------------------------
     // Utility methods used by tests above
     // ---------------------------------------------------------------
+        
+    private ClientResponse<Response> newCollectionObject() {
+       ClientResponse<Response> result = null;
+       
+        CollectionObjectClient client = new CollectionObjectClient();
+        String identifier = createIdentifier();
+        PoxPayloadOut multipart =
+                createInstance(client.getCommonPartName(), identifier);
+        result = client.create(multipart);
+        
+        return result;
+    }
+    
+    private String newCollectionObject(boolean assertStatus) {
+       String result = null;
+       
+       ClientResponse<Response> res = newCollectionObject();
+       try {
+               int statusCode = res.getStatus();
+               Assert.assertEquals(statusCode, STATUS_CREATED);
+               result = extractId(res);
+       } finally {
+               res.releaseConnection();
+       }
+
+       return result;
+    }
+            
+    @Override
+    protected PoxPayloadOut createInstance(String identifier) {
+       String commonPartName = CollectionObjectClient.SERVICE_COMMON_PART_NAME;
+       return createInstance(commonPartName, identifier);
+    }
+    
     /**
      * Creates the collection object instance.
      *
@@ -1222,18 +887,13 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
      * @param identifier the identifier
      * @return the multipart output
      */
-    private PoxPayloadOut createCollectionObjectInstance(String commonPartName,
+    @Override
+    protected PoxPayloadOut createInstance(String commonPartName,
             String identifier) {
         return createCollectionObjectInstance(commonPartName,
                 "objectNumber-" + identifier,
                 "objectName-" + identifier);
     }
-    
-    @Override
-    protected PoxPayloadOut createInstance(String identifier) {
-       String commonPartName = CollectionObjectClient.SERVICE_COMMON_PART_NAME;
-       return createCollectionObjectInstance(commonPartName, identifier);
-    }
 
     /**
      * Creates the collection object instance.
@@ -1246,11 +906,11 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
     private PoxPayloadOut createCollectionObjectInstance(String commonPartName,
             String objectNumber, String objectName) {
         CollectionobjectsCommon collectionObject = new CollectionobjectsCommon();
-        
+
         // Scalar fields
         collectionObject.setObjectNumber(objectNumber);
         collectionObject.setAge(AGE_VALUE); //test for null string
-
+        
         // Repeatable structured groups
 
         TitleGroupList titleGroupList = new TitleGroupList();
@@ -1364,8 +1024,8 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
                         CollectionobjectsNaturalhistory.class));
             }
         }
+        
         return multipart;
-
     }
 
     /**
@@ -1393,8 +1053,8 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
             logger.debug(objectAsXmlString(collectionObject,
                     CollectionobjectsCommon.class));
         }
+        
         return multipart;
-
     }
 
     /**
@@ -1458,9 +1118,9 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
         String newId = extractId(res);
         allResourceIdsCreated.add(newId);
         return newId;
@@ -1486,61 +1146,136 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
 
         // Extract the common part.
-        CollectionobjectsCommon collectionObject = extractCommonPartValue(testName, res);
+        CollectionobjectsCommon collectionObject = extractCommonPartValue(res);
         Assert.assertNotNull(collectionObject);
 
         return collectionObject;
      }
 
-    private CollectionobjectsCommon extractCommonPartValue(String testName, ClientResponse<String> res)
-        throws Exception {
-        CollectionObjectClient client = new CollectionObjectClient();
-        PayloadInputPart payloadInputPart = extractPart(testName, res, client.getCommonPartName());
-        Object obj = null;
-        if (payloadInputPart != null) {
-               obj = payloadInputPart.getBody();
-        }
-        Assert.assertNotNull(obj,
-                testName + ": body of " + client.getCommonPartName() + " part was unexpectedly null.");
-        CollectionobjectsCommon collectionobjectCommon = (CollectionobjectsCommon) obj;
-        Assert.assertNotNull(collectionobjectCommon,
-                testName + ": " + client.getCommonPartName() + " part was unexpectedly null.");
-        return collectionobjectCommon;
-    }
-
-//    private Object extractPartValue(String testName, ClientResponse<String> res, String partLabel)
-//        throws Exception {
-//        Object obj = null;
-//        PayloadInputPart payloadInputPart = extractPart(testName, res, partLabel);
-//        if (payloadInputPart != null) {
-//             obj = payloadInputPart.getElementBody();
-//        }
-//        Assert.assertNotNull(obj,
-//                testName + ": value of part " + partLabel + " was unexpectedly null.");
-//        return obj;
-//    }
-
-    private PayloadInputPart extractPart(String testName, ClientResponse<String> res, String partLabel)
-        throws Exception {
-        if (logger.isDebugEnabled()) {
-           logger.debug(testName + ": Reading part " + partLabel + " ...");
-        }
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        PayloadInputPart payloadInputPart = input.getPart(partLabel);
-        Assert.assertNotNull(payloadInputPart,
-                testName + ": part " + partLabel + " was unexpectedly null.");
-        return payloadInputPart;
-    }
-
        @Override
        protected String getServicePathComponent() {
                // TODO Auto-generated method stub
                return CollectionObjectClient.SERVICE_PATH_COMPONENT;
        }
 
+       @Override
+       protected CollectionobjectsCommon updateInstance(CollectionobjectsCommon collectionObjectCommon) {
+        collectionObjectCommon.setObjectNumber("updated-" + collectionObjectCommon.getObjectNumber());
+
+        // Change the object name in the first value instance in the
+        // object name repeatable group.
+        ObjectNameList objNameList = collectionObjectCommon.getObjectNameList();
+        List<ObjectNameGroup> objNameGroups = objNameList.getObjectNameGroup();
+        Assert.assertNotNull(objNameGroups);
+        Assert.assertTrue(objNameGroups.size() >= 1);
+        String objectName = objNameGroups.get(0).getObjectName();
+        Assert.assertEquals(objectName, OBJECT_NAME_VALUE);
+        String updatedObjectName = "updated-" + objectName;
+        objNameGroups.get(0).setObjectName(updatedObjectName);
+        collectionObjectCommon.setObjectNameList(objNameList);
+
+        // Replace the existing value instances in the dimensions repeatable group
+        // with entirely new value instances, also changing the number of such instances.
+        MeasuredPartGroupList measuredPartGroupList = collectionObjectCommon.getMeasuredPartGroupList();
+        Assert.assertNotNull(measuredPartGroupList);
+        List<MeasuredPartGroup> measuredPartGroups = measuredPartGroupList.getMeasuredPartGroup();
+        Assert.assertNotNull(measuredPartGroups);
+        Assert.assertTrue(measuredPartGroups.size() > 0);
+        MeasuredPartGroup mpGroup = measuredPartGroups.get(0);
+        Assert.assertNotNull(mpGroup.getMeasuredPart());
+        
+        DimensionSubGroupList dimensionSubGroupList = mpGroup.getDimensionSubGroupList();
+        Assert.assertNotNull(dimensionSubGroupList);
+        List<DimensionSubGroup> dimensionSubGroups = dimensionSubGroupList.getDimensionSubGroup();
+        Assert.assertNotNull(dimensionSubGroups);
+        int originalDimensionSubGroupSize = dimensionSubGroups.size();
+        Assert.assertTrue(dimensionSubGroups.size() > 0);
+        dimensionSubGroups.clear();
+        
+        DimensionSubGroup heightDimension = new DimensionSubGroup();
+        heightDimension.setDimension("height");
+        heightDimension.setMeasurementUnit(UPDATED_MEASUREMENT_UNIT);
+        dimensionSubGroups.add(heightDimension);
+        
+        int updatedDimensionGroupSize = dimensionSubGroups.size();
+        Assert.assertTrue(updatedDimensionGroupSize > 0);
+        Assert.assertTrue(updatedDimensionGroupSize != originalDimensionSubGroupSize);
+        
+        collectionObjectCommon.setMeasuredPartGroupList(measuredPartGroupList);
+        
+        return collectionObjectCommon;
+       }
+
+       @Override
+       protected void compareReadInstances(CollectionobjectsCommon original,
+                       CollectionobjectsCommon fromRead) throws Exception {
+               // Verify the number and contents of values in repeatable fields,
+               // as created in the instance record used for testing.
+               MeasuredPartGroupList measuredPartGroupList = fromRead.getMeasuredPartGroupList();
+               Assert.assertNotNull(measuredPartGroupList, "Measured part group list was null");
+               List<MeasuredPartGroup> measuredPartGroups = measuredPartGroupList.getMeasuredPartGroup();
+               Assert.assertNotNull(measuredPartGroups, "Measured part groups were null");
+               Assert.assertTrue(measuredPartGroups.size() > 0, "No measured part groups were returned");
+               MeasuredPartGroup mpGroup = measuredPartGroups.get(0);
+               Assert.assertNotNull(mpGroup.getMeasuredPart(), "Measured part was null");
+               Assert.assertEquals(mpGroup.getMeasuredPart(), MEASURED_PART,
+                               "Measured part value returned didn't match expected value");
+
+               DimensionSubGroupList dimensionSubGroupList = mpGroup.getDimensionSubGroupList();
+               Assert.assertNotNull(dimensionSubGroupList, "Dimension subgroup list was null");
+               List<DimensionSubGroup> dimensionSubGroups = dimensionSubGroupList.getDimensionSubGroup();
+               Assert.assertNotNull(dimensionSubGroups, "Dimension subgroups were null");
+               Assert.assertTrue(dimensionSubGroups.size() > 0, "No dimension subgroups were returned");
+               DimensionSubGroup lengthDimension = dimensionSubGroups.get(0);
+               Assert.assertNotNull(lengthDimension, "Length dimension was null");
+               Assert.assertTrue(lengthDimension.getValue().compareTo(DIMENSION_VALUE_LENGTH) == 0,
+                               "Dimension length value returned didn't match expected value");
+       }
+       
+       @Override
+       protected void compareUpdatedInstances(CollectionobjectsCommon original,
+                       CollectionobjectsCommon updated) throws Exception {
+               
+        ObjectNameList objNameList = updated.getObjectNameList();
+        Assert.assertNotNull(objNameList);
+        List<ObjectNameGroup> objNameGroups = objNameList.getObjectNameGroup();
+        Assert.assertNotNull(objNameGroups);
+        Assert.assertTrue(objNameGroups.size() >= 1);
+        Assert.assertEquals(original.getObjectNameList().getObjectNameGroup().get(0).getObjectName(),
+                objNameGroups.get(0).getObjectName(),
+                "Data in updated object did not match submitted data.");
+        //
+        // Get the dimension group size of the original
+        //
+        MeasuredPartGroupList measuredPartGroupList = original.getMeasuredPartGroupList();
+        List<MeasuredPartGroup> measuredPartGroups = measuredPartGroupList.getMeasuredPartGroup();
+        MeasuredPartGroup mpGroup = measuredPartGroups.get(0);
+        DimensionSubGroupList dimensionSubGroupList = mpGroup.getDimensionSubGroupList();
+        List<DimensionSubGroup> dimensionSubGroups = dimensionSubGroupList.getDimensionSubGroup();
+        int updatedDimensionGroupSize = dimensionSubGroups.size();
+        //
+        // Now get the dimension group size of the updated
+        //
+        measuredPartGroupList = updated.getMeasuredPartGroupList();
+        Assert.assertNotNull(measuredPartGroupList);
+        measuredPartGroups = measuredPartGroupList.getMeasuredPartGroup();
+        Assert.assertNotNull(measuredPartGroups);
+        Assert.assertTrue(measuredPartGroups.size() > 0);
+        mpGroup = measuredPartGroups.get(0);
+        Assert.assertNotNull(mpGroup.getMeasuredPart());
+        dimensionSubGroupList = mpGroup.getDimensionSubGroupList();
+        Assert.assertNotNull(dimensionSubGroupList);
+        dimensionSubGroups = dimensionSubGroupList.getDimensionSubGroup();
+        Assert.assertNotNull(dimensionSubGroups);
+               Assert.assertTrue(dimensionSubGroups.size() == updatedDimensionGroupSize);
+               
+        Assert.assertEquals(UPDATED_MEASUREMENT_UNIT,
+                dimensionSubGroups.get(0).getMeasurementUnit(),
+                "Data in updated object did not match submitted data.");
+       }
 }
index 523c831e94e83e708dec328729b6c0f4db16f530..fb0c0cdb41fc62f59f2f686611313e45baee37c2 100644 (file)
@@ -67,7 +67,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>\r
         \r
         <!-- apache -->\r
index 23ecbd1a01c1214bca428bd3982e8ebcd1be5f4b..4ce437113b84850a4347a1c5855003a789e870d8 100755 (executable)
@@ -27,7 +27,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
             <scope>provided</scope>\r
         </dependency>\r
     </dependencies>\r
index 35fce7683fa3d468f00ce8c8eeb916190909b956..e3431e680f8fffe8477ebb7e68aaff05c3a30380 100644 (file)
@@ -72,7 +72,6 @@
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>5.6</version>
         </dependency>
 
     </dependencies>
index 6b8f8b45d319ead912b91a1bac322534cb5b5fd2..75cfa1404017a7175e5d4d7e5d9f9909135ddbbf 100644 (file)
@@ -32,6 +32,7 @@ import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.commons.httpclient.methods.HeadMethod;
 import org.apache.commons.httpclient.methods.OptionsMethod;
 import org.apache.commons.httpclient.methods.TraceMethod;
+import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.TestServiceClient;
 
 import org.slf4j.Logger;
@@ -61,15 +62,15 @@ public class ServiceLayerTest {
             logger.debug("Client properties read from the properties path;\n"
                     + "possibly from the command line or a properties file:");
             logger.debug("url = "
-                    + serviceClient.getProperty(serviceClient.URL_PROPERTY));
+                    + serviceClient.getProperty(CollectionSpaceClient.URL_PROPERTY));
             logger.debug("secure (SSL) = "
-                    + serviceClient.getProperty(serviceClient.SSL_PROPERTY));
+                    + serviceClient.getProperty(CollectionSpaceClient.SSL_PROPERTY));
             logger.debug("useAuth = "
-                    + serviceClient.getProperty(serviceClient.AUTH_PROPERTY));
+                    + serviceClient.getProperty(CollectionSpaceClient.AUTH_PROPERTY));
             logger.debug("user = "
-                    + serviceClient.getProperty(serviceClient.USER_PROPERTY));
+                    + serviceClient.getProperty(CollectionSpaceClient.USER_PROPERTY));
             logger.debug("password = "
-                    + serviceClient.getProperty(serviceClient.PASSWORD_PROPERTY));
+                    + serviceClient.getProperty(CollectionSpaceClient.PASSWORD_PROPERTY));
         }
     }
 
@@ -77,7 +78,7 @@ public class ServiceLayerTest {
     public void servicesExist() {
         
         if (logger.isDebugEnabled()) {
-            logger.debug(BaseServiceTest.testBanner("servicesExist", CLASS_NAME));
+            logger.debug(BaseServiceTest.getTestBanner("servicesExist", CLASS_NAME));
         }
         //use ID service that should always be present in a working service layer
         String url = serviceClient.getBaseURL() + "idgenerators";
@@ -105,7 +106,7 @@ public class ServiceLayerTest {
     @Test
     public void methodNotAllowed() {
         if (logger.isDebugEnabled()) {
-            logger.debug(BaseServiceTest.testBanner("methodNotAllowed", CLASS_NAME));
+            logger.debug(BaseServiceTest.getTestBanner("methodNotAllowed", CLASS_NAME));
         }
         // Delete is not allowed on the root URL of the id service
         String url = serviceClient.getBaseURL() + "idgenerators";
@@ -132,7 +133,7 @@ public class ServiceLayerTest {
     @Test
     public void nonexistentService() {
         if (logger.isDebugEnabled()) {
-            logger.debug(BaseServiceTest.testBanner("nonexistentService", CLASS_NAME));
+            logger.debug(BaseServiceTest.getTestBanner("nonexistentService", CLASS_NAME));
         }
         String url = serviceClient.getBaseURL() + "nonexistent-service";
         GetMethod method = new GetMethod(url);
@@ -158,7 +159,7 @@ public class ServiceLayerTest {
 //    @Test
     public void serviceSecure() {
         if (logger.isDebugEnabled()) {
-            logger.debug(BaseServiceTest.testBanner("serviceSecure", CLASS_NAME));
+            logger.debug(BaseServiceTest.getTestBanner("serviceSecure", CLASS_NAME));
         }
         String url = serviceClient.getBaseURL() + "collectionobjects";
         GetMethod method = new GetMethod(url);
@@ -190,7 +191,7 @@ public class ServiceLayerTest {
     @Test
     public void traceSupported() {
         if (logger.isDebugEnabled()) {
-            logger.debug(BaseServiceTest.testBanner("traceSupported", CLASS_NAME));
+            logger.debug(BaseServiceTest.getTestBanner("traceSupported", CLASS_NAME));
         }
         String url = serviceClient.getBaseURL() + "collectionobjects";
         TraceMethod method = new TraceMethod(url);
@@ -221,7 +222,7 @@ public class ServiceLayerTest {
     @Test
     public void headSupported() {
         if (logger.isDebugEnabled()) {
-            logger.debug(BaseServiceTest.testBanner("headSupported", CLASS_NAME));
+            logger.debug(BaseServiceTest.getTestBanner("headSupported", CLASS_NAME));
         }
         String url = serviceClient.getBaseURL() + "intakes";
         HeadMethod method = new HeadMethod(url);
index f4a5734a1c800d33c0cb2ce3048be7ee9e151a9f..7186877de44969f9b5702c30a401813ca493a126 100644 (file)
 <tenant:TenantBindingConfig xmlns:tenant="http://collectionspace.org/services/common/tenant" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://collectionspace.org/services/common/tenant http://collectionspace.org/services/common/tenant.xsd">
      
      <!-- begin prototype collectionspace.org tenant meta-data -->
-    <tenant:tenantBinding id="-1" name="prototype.collectionspace.org" displayName="CollectionSpace Services Bindings Prototype" version="0.1">
-        <tenant:repositoryDomain name="default-domain" storageName="prototype-domain" repositoryClient="nuxeo-java" />
-        <tenant:properties>
-            <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                <types:key>datePattern</types:key>
-                <types:value>MM/dd/yyyy</types:value>
-            </types:item>
-            <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                <types:key>datePattern</types:key>
-                <types:value>MMM dd, yyyy</types:value>
-            </types:item>
-            <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                <types:key>datePattern</types:key>
-                <types:value>dd.MM.yyyy</types:value>
-            </types:item>
+  <tenant:tenantBinding id="-1" name="prototype.collectionspace.org" displayName="CollectionSpace Services Bindings Prototype" version="0.1">
+    <tenant:repositoryDomain name="default-domain" storageName="prototype-domain" repositoryClient="nuxeo-java" />
+    <tenant:properties>
+      <types:item xmlns:types="http://collectionspace.org/services/common/types">
+        <types:key>datePattern</types:key>
+        <types:value>MM/dd/yyyy</types:value>
+      </types:item>
+      <types:item xmlns:types="http://collectionspace.org/services/common/types">
+        <types:key>datePattern</types:key>
+        <types:value>MMM dd, yyyy</types:value>
+      </types:item>
+      <types:item xmlns:types="http://collectionspace.org/services/common/types">
+        <types:key>datePattern</types:key>
+        <types:value>dd.MM.yyyy</types:value>
+      </types:item>
             <!--
             <types:item>
                 <types:key>datePattern</types:key>
                 <types:value>dd/MM/yyyy</types:value>
             </types:item>
             -->
-            <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                <types:key>localeLanguage</types:key>
-                <types:value>en</types:value>
-            </types:item>
+      <types:item xmlns:types="http://collectionspace.org/services/common/types">
+        <types:key>localeLanguage</types:key>
+        <types:value>en</types:value>
+      </types:item>
             <!--
             <types:item>
                 <types:key>localeLanguage</types:key>
                 <types:value>da</types:value>
             </types:item>
             -->
-        </tenant:properties>
+    </tenant:properties>               
         
         <!-- begin idgenerator service meta-data -->
-        <tenant:serviceBindings id="idgenerators" name="idgenerators" type="utility" version="0.1">
+    <tenant:serviceBindings id="idgenerators" name="idgenerators" type="utility" version="0.1">
             <!-- other URI paths through which this service could be accessed -->
-        </tenant:serviceBindings>
-        <!-- end idgenerator service meta-data -->
+    </tenant:serviceBindings>
+    <!-- end idgenerator service meta-data -->
         
-        <!-- begin id service meta-data -->
-        <tenant:serviceBindings id="id" name="id" type="utility" version="0.1">
+    <!-- begin id service meta-data -->
+    <tenant:serviceBindings id="id" name="id" type="utility" version="0.1">
             <!-- other URI paths through which this service could be accessed -->
             <!-- 
             <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /idgenerators/*/ids
             </service:uriPath>
             -->
-        </tenant:serviceBindings>    
-        <!-- end id service meta-data -->
+    </tenant:serviceBindings>  
+    <!-- end id service meta-data -->
         
-        <!-- begin collectionobject service meta-data -->
-        <tenant:serviceBindings id="CollectionObjects" name="CollectionObjects" type="object" version="0.1">
-            <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/collectionobjects/*/workflow/</service:uriPath>
+    <!-- begin collectionobject service meta-data -->
+    <tenant:serviceBindings id="CollectionObjects" name="CollectionObjects" type="object" version="0.1">
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/collectionobjects/*/workflow/</service:uriPath>
             <!-- other URI paths through which this service could be accessed -->
             <!--
             <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
-                 /collectionobjects/*/authorityrefs/
+                /collectionobjects/*/authorityrefs/
             </service:uriPath>
             -->
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.collectionobject.nuxeo.CollectionObjectDocumentModelHandler</service:documentHandler>
-            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
-                <service:classname>org.collectionspace.services.blob.nuxeo.BlobDocumentModelHandler</service:classname>
-                <service:params>
-                    <service:DublinCoreTitle>collectionobjects</service:DublinCoreTitle>
-                    <service:ListResultsItemMethodName>getCollectionObjectListItem</service:ListResultsItemMethodName>
-                    <service:ListResultsFields>
-                        <service:ListResultField>
-                            <service:element>objectNumber</service:element>
-                            <service:xpath>objectNumber</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>objectName</service:element>
-                            <service:xpath>objectNameList/[0]/objectName</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>title</service:element>
-                            <service:xpath>titleGroupList/[0]/title</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>responsibleDepartment</service:element>
-                            <service:xpath>responsibleDepartments/[0]</service:xpath>
-                        </service:ListResultField>
-                    </service:ListResultsFields>
-                </service:params>
-            </service:DocHandlerParams>
-            <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.collectionobject.nuxeo.CollectionObjectValidatorHandler</service:validatorHandler>
-            <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
-                <service:classname>org.collectionspace.services.common.init.ModifyFieldDatatypes</service:classname>
-                <service:params>
-                    <service:field>
-                        <service:table>collectionobjects_common_briefdescriptions</service:table>
-                        <service:col>item</service:col>
-                        <service:type>LARGETEXT</service:type>
-                        <service:param />
-                    </service:field>
-                    <service:field>
-                        <service:table>collectionobjects_common_comments</service:table>
-                        <service:col>item</service:col>
-                        <service:type>LARGETEXT</service:type>
-                        <service:param />
-                    </service:field>
-                    <service:field>
-                        <service:table>collectionobjects_common_objectproductionreasons</service:table>
-                        <service:col>item</service:col>
-                        <service:type>LARGETEXT</service:type>
-                        <service:param />
-                    </service:field>
-                    <service:field>
-                        <service:table>collectionobjects_common_ownersreferences</service:table>
-                        <service:col>item</service:col>
-                        <service:type>LARGETEXT</service:type>
-                        <service:param />
-                    </service:field>
-                    <service:field>
-                        <service:table>collectionobjects_common_viewersreferences</service:table>
-                        <service:col>item</service:col>
-                        <service:type>LARGETEXT</service:type>
-                        <service:param />
-                    </service:field>
-                </service:params>
-            </service:initHandler>
-            <service:properties xmlns:service="http://collectionspace.org/services/common/service">
-                <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                    <types:key>objectNameProperty</types:key>
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.collectionobject.nuxeo.CollectionObjectDocumentModelHandler</service:documentHandler>
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:classname>org.collectionspace.services.blob.nuxeo.BlobDocumentModelHandler</service:classname>
+        <service:params>
+          <service:DublinCoreTitle>collectionobjects</service:DublinCoreTitle>
+          <service:ListResultsItemMethodName>getCollectionObjectListItem</service:ListResultsItemMethodName>
+          <service:ListResultsFields>
+            <service:ListResultField>
+              <service:element>objectNumber</service:element>
+              <service:xpath>objectNumber</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>objectName</service:element>
+              <service:xpath>objectNameList/[0]/objectName</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>title</service:element>
+              <service:xpath>titleGroupList/[0]/title</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>responsibleDepartment</service:element>
+              <service:xpath>responsibleDepartments/[0]</service:xpath>
+            </service:ListResultField>
+          </service:ListResultsFields>
+        </service:params>
+      </service:DocHandlerParams>
+      <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.collectionobject.nuxeo.CollectionObjectValidatorHandler</service:validatorHandler>
+      <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
+        <service:classname>org.collectionspace.services.common.init.ModifyFieldDatatypes</service:classname>
+        <service:params>
+          <service:field>
+            <service:table>collectionobjects_common_briefdescriptions</service:table>
+            <service:col>item</service:col>
+            <service:type>LARGETEXT</service:type>
+            <service:param />
+          </service:field>
+          <service:field>
+            <service:table>collectionobjects_common_comments</service:table>
+            <service:col>item</service:col>
+            <service:type>LARGETEXT</service:type>
+            <service:param />
+          </service:field>
+          <service:field>
+            <service:table>collectionobjects_common_objectproductionreasons</service:table>
+            <service:col>item</service:col>
+            <service:type>LARGETEXT</service:type>
+            <service:param />
+          </service:field>
+          <service:field>
+            <service:table>collectionobjects_common_ownersreferences</service:table>
+            <service:col>item</service:col>
+            <service:type>LARGETEXT</service:type>
+            <service:param />
+          </service:field>
+          <service:field>
+            <service:table>collectionobjects_common_viewersreferences</service:table>
+            <service:col>item</service:col>
+            <service:type>LARGETEXT</service:type>
+            <service:param />
+          </service:field>
+        </service:params>
+      </service:initHandler>
+      <service:properties xmlns:service="http://collectionspace.org/services/common/service">
+        <types:item xmlns:types="http://collectionspace.org/services/common/types">
+          <types:key>objectNameProperty</types:key>
                     <types:value>objectNameList/[0]/objectName</types:value>
-                </types:item>
-                <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                    <types:key>objectNumberProperty</types:key>
-                    <types:value>objectNumber</types:value>
-                </types:item>
-            </service:properties>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="CollectionObject" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="collectionobjects-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="collectionobjects_common" updated="" order="1">
-                    <service:properties>
+        </types:item>
+        <types:item xmlns:types="http://collectionspace.org/services/common/types">
+          <types:key>objectNumberProperty</types:key>
+          <types:value>objectNumber</types:value>
+        </types:item>
+      </service:properties>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="CollectionObject" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="collectionobjects-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="collectionobjects_common" updated="" order="1">
+          <service:properties>
                         <!-- Fields containing authority term references -->
                         <!-- Object Identification Information group -->
                         <!-- There are currently no authority term references in this group -->
                         <!-- Object Description Information group -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>contentActivities|contentActivity</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>contentConcepts|contentConcept</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>contentActivities|contentActivity</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>contentConcepts|contentConcept</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>contentEventNameGroupList/*/contentEventName</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>contentEventNameGroupList/*/contentEventNameType</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>contentOrganizations|contentOrganization</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>contentOtherGroupList/*/contentOther</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>contentOtherGroupList/*/contentOtherType</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>contentPeoples|contentPeople</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>contentPersons|contentPerson</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>contentPlaces|contentPlace</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>measuredPartGroupList/*/dimensionSubGroupList/*/measuredBy</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>textualInscriptionGroupList/*/inscriptionContentInscriber</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>textualInscriptionGroupList/*/inscriptionContentMethod</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>nonTextualInscriptionGroupList/*/inscriptionDescriptionInscriber</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>nonTextualInscriptionGroupList/*/inscriptionDescriptionMethod</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>materialGroupList/*/material</types:value>
-                        </types:item>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+                                                       <types:value>materialGroupList/*/material</types:value>
+            </types:item>
                         <!-- The following field may become part of a repeatable sub-group -->
                         <!-- for materialComponent, per CSPACE-4563. -->
                         <!-- Names of ancestor elements below are placeholders and subject to change. -->
                         <!--
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+             <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>materialGroupList/*/materialComponentSubGroupList/*/materialComponent</types:value>
-                        </types:item>
+            </types:item>
                         -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>materialGroupList/*/materialSource</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+                                                       <types:value>materialGroupList/*/materialSource</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>styles|style</types:value>
-                        </types:item>
-                         <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>objectComponentGroupList/*/objectComponentName</types:value>
-                        </types:item>  
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+                                                       <types:value>objectComponentGroupList/*/objectComponentName</types:value>
+            </types:item>
                         <!-- Object Production Information group -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>objectProductionOrganizationGroupList/*/objectProductionOrganization</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>objectProductionPeopleGroupList/*/objectProductionPeople</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>objectProductionPersonGroupList/*/objectProductionPerson</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+                                                       <types:value>objectProductionOrganizationGroupList/*/objectProductionOrganization</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+                                                       <types:value>objectProductionPeopleGroupList/*/objectProductionPeople</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+                                                       <types:value>objectProductionPersonGroupList/*/objectProductionPerson</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>objectProductionPlaceGroupList/*/objectProductionPlace</types:value>
                         </types:item>
                         <types:item xmlns:types="http://collectionspace.org/services/common/types">
                             <types:key>authRef</types:key>
-                            <types:value>techniqueGroupList/*/technique</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>techniqueGroupList/*/techniqueType</types:value>
-                        </types:item>
+                                                       <types:value>techniqueGroupList/*/technique</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+                                                       <types:value>techniqueGroupList/*/techniqueType</types:value>
+            </types:item>
                         <!-- Object History and Association Information group -->
                         <!-- The following fields may become part of a repeatable group -->
                         <!-- for associatedEvent, per CSPACE-3229. -->
                         <!-- Names of ancestor elements below are placeholders and subject to change. -->
                         <!--
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>assocEventGroupList/*/assocEventOrganization</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>assocEventGroupList/*/assocEventPeople</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>assocEventGroupList/*/assocEventPerson</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>assocEventGroupList/*/assocEventPlace</types:value>
-                        </types:item>
+            </types:item>
                         -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>assocOrganizationGroupList/*/assocOrganization</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>assocPeopleGroupList/*/assocPeople</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>assocPersonGroupList/*/assocPerson</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>assocPlaceGroupList/*/assocPlace</types:value>
-                        </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+                                                       <types:value>assocOrganizationGroupList/*/assocOrganization</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+                                                       <types:value>assocPeopleGroupList/*/assocPeople</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+                                                       <types:value>assocPersonGroupList/*/assocPerson</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+                                                       <types:value>assocPlaceGroupList/*/assocPlace</types:value>
+            </types:item>
                         <!-- The following fields may become part of a repeatable group -->
                         <!-- for 'owner', per CSPACE-3229. -->
                         <!-- Names of ancestor elements below are placeholders and subject to change. -->
                         <!--
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>ownerGroupList/*/owner</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>ownerGroupList/*/ownershipPlace</types:value>
-                        </types:item>
+            </types:item>
                         -->
                         <!-- Object Owner's Contribution Information group -->
                         <!-- There are currently no authority term references in this group -->
                         <!-- Object Viewer's Contribution Information group -->
                         <!-- There are currently no authority term references in this group -->
                         <!-- Reference Information group -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>referenceGroupList/*/reference</types:value>
-                        </types:item>
+            </types:item>
                         <!-- Object Collection Information group -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>fieldCollectionPlace</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>fieldCollectionSources|fieldCollectionSource</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>fieldCollectors|fieldCollector</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>fieldColEventNames|fieldColEventName</types:value>
-                        </types:item>
+            </types:item>
                         <!-- ### -->
                         <!-- Fields containing term list / controlled vocabulary references -->
                         <!-- ### -->
                         <!-- Object Identification Information group -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
                             <types:key>termRef</types:key>
                             <types:value>otherNumberList/*/numberType</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>objectNameList/*/objectNameCurrency</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>objectNameList/*/objectNameLevel</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>objectNameList/*/objectNameSystem</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>objectNameList/*/objectNameType</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>objectNameList/*/objectNameLanguage</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>responsibleDepartments|responsibleDepartment</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+                            <types:value>responsibleDepartments|responsibleDepartment</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>collection</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>titleGroupList/*/titleLanguage</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>titleGroupList/*/titleTranslationSubGroupList/*/titleTranslationLanguage</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>titleGroupList/*/titleType</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>recordStatus</types:value>
-                        </types:item>
+            </types:item>
                         <!-- Object Description Information group -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>ageUnit</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>contentLanguages|contentLanguage</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>contentObjectGroupList/*/contentObjectType</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>contentPositions|contentPosition</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>contentScripts|contentScript</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>measuredPartGroupList/*/measuredPart</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>measuredPartGroupList/*/dimensionSubGroupList/*/dimension</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>measuredPartGroupList/*/dimensionSubGroupList/*/measurementUnit</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>measuredPartGroupList/*/dimensionSubGroupList/*/measurementMethod</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>forms|form</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>textualInscriptionGroupList/*/inscriptionContentLanguage</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>textualInscriptionGroupList/*/inscriptionContentPosition</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>textualInscriptionGroupList/*/inscriptionContentScript</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>textualInscriptionGroupList/*/inscriptionContentType</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>nonTextualInscriptionGroupList/*/inscriptionDescriptionPosition</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>nonTextualInscriptionGroupList/*/inscriptionDescriptionType</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>objectStatusList|objectStatus</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>phase</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>sex</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>technicalAttributeGroupList/*/technicalAttribute</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>technicalAttributeGroupList/*/technicalAttributeMeasurement</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>technicalAttributeGroupList/*/technicalAttributeMeasurementUnit</types:value>
-                        </types:item>
-                         <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+                                                       <types:value>technicalAttributeGroupList/*/technicalAttribute</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+                                                       <types:value>technicalAttributeGroupList/*/technicalAttributeMeasurement</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+                                                       <types:value>technicalAttributeGroupList/*/technicalAttributeMeasurementUnit</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>objectComponentGroupList/*/objectComponentInformation</types:value>
-                        </types:item>                       
+            </types:item>
                         <!-- Object Production Information group -->
                         <!-- There are currently no term references in this group -->
                         <!-- Object History and Association Information group -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>assocActivityGroupList/*/assocActivity</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>assocConceptGroupList/*/assocConcept</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>assocCulturalContextGroupList/*/assocCulturalContext</types:value>
-                        </types:item>
+            </types:item>
                         <!-- The following fields may become part of a repeatable group -->
                         <!-- for associatedEvent, per CSPACE-3229. -->
                         <!-- Names of ancestor elements below are placeholders and subject to change. -->
                         <!--
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>assocEventGroupList/*/assocEventName</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>assocEventGroupList/*/assocEventNameType</types:value>
-                        </types:item>
-                        -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            -->
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>assocObjectGroupList/*/assocObject</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>assocObjectGroupList/*/assocObjectType</types:value>
-                        </types:item>
+            </types:item>
                         <!-- The following fields may become part of a repeatable group -->
                         <!-- for 'owner', per CSPACE-3229. -->
                         <!-- Names of ancestor elements below are placeholders and subject to change. -->
                         <!--
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>ownerGroupList/*/ownershipAccess</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>ownerGroupList/*/ownershipCategory</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>ownerGroupList/*/ownershipExchangeMethod</types:value>
-                        </types:item>
-                        -->
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+                                                       <types:value>ownerGroupList/*/ownershipAccess</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+                                                       <types:value>ownerGroupList/*/ownershipCategory</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+                                                       <types:value>ownerGroupList/*/ownershipExchangeMethod</types:value>
+            </types:item>
+            -->
                         <types:item xmlns:types="http://collectionspace.org/services/common/types">
                             <types:key>termRef</types:key>
                             <types:value>usageGroupList/*/usage</types:value>
                             <types:key>termRef</types:key>
                             <types:value>fieldCollectionMethods|fieldCollectionMethod</types:value>
                         </types:item>
-                    </service:properties>
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/collectionobject" schemaLocation="http://collectionspace.org/services/collectionobject http://services.collectionspace.org/collectionobject/collectionobjects_common.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!--end collectionobject service meta-data -->
+          </service:properties>
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/collectionobject" schemaLocation="http://collectionspace.org/services/collectionobject http://services.collectionspace.org/collectionobject/collectionobjects_common.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!--end collectionobject service meta-data -->
     
-        <!-- begin blob service meta-data -->
-        <!-- This should likely be type="object" -->
-        <tenant:serviceBindings id="Blobs" name="Blobs" type="procedure" version="0.1">
-            <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/blobs/*/workflow/</service:uriPath>
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.blob.nuxeo.BlobDocumentModelHandler</service:documentHandler>
-            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
-                <service:params>
-                    <service:ListResultsFields>
-                        <service:ListResultField>
-                            <service:element>name</service:element>
-                            <service:xpath>name</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>mimeType</service:element>
-                            <service:xpath>mimeType</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>encoding</service:element>
-                            <service:xpath>encoding</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>length</service:element>
-                            <service:xpath>length</service:xpath>
-                        </service:ListResultField>
-                    </service:ListResultsFields>
-                </service:params>
-            </service:DocHandlerParams>
-            <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.blob.nuxeo.BlobValidatorHandler</service:validatorHandler>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Blob" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="blob-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="blobs_common" updated="" order="1">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/blob" schemaLocation="http://collectionspace.org/services/blob http://services.collectionspace.org/blob/blobs_common.xsd" />
+    <!-- begin blob service meta-data -->
+               <!-- This should likely be type="object" -->
+    <tenant:serviceBindings id="Blobs" name="Blobs" type="procedure" version="0.1">
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/blobs/*/workflow/</service:uriPath>
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.blob.nuxeo.BlobDocumentModelHandler</service:documentHandler>
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:params>
+          <service:ListResultsFields>
+            <service:ListResultField>
+              <service:element>name</service:element>
+              <service:xpath>name</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>mimeType</service:element>
+              <service:xpath>mimeType</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>encoding</service:element>
+              <service:xpath>encoding</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>length</service:element>
+              <service:xpath>length</service:xpath>
+            </service:ListResultField>
+          </service:ListResultsFields>
+        </service:params>
+      </service:DocHandlerParams>
+      <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.blob.nuxeo.BlobValidatorHandler</service:validatorHandler>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Blob" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="blob-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="blobs_common" updated="" order="1">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/blob" schemaLocation="http://collectionspace.org/services/blob http://services.collectionspace.org/blob/blobs_common.xsd" />
                         <!-- The Blob service has at least one authRef field and two or more termRef fields -->
                         <!-- in its multivalued dimensionGroup. -->
                         <!-- If these require enumeration here, please see authRef and termRef declarations -->
                         <!-- in Media for relevant entries. -->
-                    </service:content>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="3" control_group="Managed" versionable="true" auditable="false" label="image_metadata" updated="" order="3">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/image_metadata/" schemaLocation="http://collectionspace.org/image_metadata/ http://services.collectionspace.org/image_metadata.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="4" control_group="Managed" versionable="true" auditable="false" label="iptc" updated="" order="4">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/iptc/" schemaLocation="http://collectionspace.org/iptc/ http://services.collectionspace.org/iptc.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end blob service meta-data -->
+          </service:content>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="3" control_group="Managed" versionable="true" auditable="false" label="image_metadata" updated="" order="3">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/image_metadata/" schemaLocation="http://collectionspace.org/image_metadata/ http://services.collectionspace.org/image_metadata.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="4" control_group="Managed" versionable="true" auditable="false" label="iptc" updated="" order="4">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/iptc/" schemaLocation="http://collectionspace.org/iptc/ http://services.collectionspace.org/iptc.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end blob service meta-data -->
     
-        <!-- begin intake service meta-data -->
-        <tenant:serviceBindings id="Intakes" name="Intakes" type="procedure" version="0.1">
-            <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/intakes/*/workflow/</service:uriPath>
+    <!-- begin intake service meta-data -->
+    <tenant:serviceBindings id="Intakes" name="Intakes" type="procedure" version="0.1">
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/intakes/*/workflow/</service:uriPath>
             <!-- other URI paths through which this service could be accessed -->
             <!--
             <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /intakes/*/authorityrefs/
             </service:uriPath>
             -->
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.intake.nuxeo.IntakeDocumentModelHandler</service:documentHandler>
-            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
-                <service:classname>org.collectionspace.services.group.nuxeo.IntakeDocumentModelHandler</service:classname>
-                <service:params>
-                    <service:SchemaName>intakes</service:SchemaName>
-                    <service:DublinCoreTitle>intakes</service:DublinCoreTitle>
-                    <service:SummaryFields>entryNumber|depositor|currentOwner|uri|csid</service:SummaryFields>
-                    <service:AbstractCommonListClassname />
-                    <service:CommonListItemClassname />
-                    <service:ListResultsItemMethodName>getIntakeListItem</service:ListResultsItemMethodName>
-                    <service:ListResultsFields>
-                        <service:ListResultField>
-                            <service:element>entryNumber</service:element>
-                            <service:xpath>entryNumber</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>depositor</service:element>
-                            <service:xpath>depositor</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>currentOwner</service:element>
-                            <service:xpath>currentOwner</service:xpath>
-                        </service:ListResultField>
-                    </service:ListResultsFields>
-                </service:params>
-            </service:DocHandlerParams> 
-            <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.intake.nuxeo.IntakeValidatorHandler</service:validatorHandler>
-             <service:properties xmlns:service="http://collectionspace.org/services/common/service">
-                <types:item xmlns:types="http://collectionspace.org/services/common/types">
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.intake.nuxeo.IntakeDocumentModelHandler</service:documentHandler>
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:classname>org.collectionspace.services.group.nuxeo.IntakeDocumentModelHandler</service:classname>
+        <service:params>
+          <service:SchemaName>intakes</service:SchemaName>
+          <service:DublinCoreTitle>intakes</service:DublinCoreTitle>
+          <service:SummaryFields> entryNumber|depositor|currentOwner|uri|csid</service:SummaryFields>
+          <service:AbstractCommonListClassname />
+          <service:CommonListItemClassname />
+          <service:ListResultsItemMethodName>getIntakeListItem</service:ListResultsItemMethodName>
+          <service:ListResultsFields>
+            <service:ListResultField>
+              <service:element>entryNumber</service:element>
+              <service:xpath>entryNumber</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>depositor</service:element>
+              <service:xpath>depositor</service:xpath>
+                        </service:ListResultField>
+                        <service:ListResultField>
+              <service:element>currentOwner</service:element>
+              <service:xpath>currentOwner</service:xpath>
+            </service:ListResultField>
+          </service:ListResultsFields>
+        </service:params>
+      </service:DocHandlerParams> 
+      <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.intake.nuxeo.IntakeValidatorHandler</service:validatorHandler>
+      <service:properties xmlns:service="http://collectionspace.org/services/common/service">
+        <types:item xmlns:types="http://collectionspace.org/services/common/types">
                     <types:key>objectNameProperty</types:key>
                     <types:value>currentOwner</types:value>
                 </types:item>
                 <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                    <types:key>objectNumberProperty</types:key>
-                    <types:value>entryNumber</types:value>
-                </types:item>
-            </service:properties>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Intake" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="intakes-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="intakes_common" updated="" order="1">
-                    <service:properties>
+          <types:key>objectNumberProperty</types:key>
+          <types:value>entryNumber</types:value>
+        </types:item>
+      </service:properties>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Intake" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="intakes-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="intakes_common" updated="" order="1">
+          <service:properties>
                         <!-- Fields containing authority term references -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>currentOwner</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>depositor</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>currentOwner</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>depositor</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>fieldCollectionPlace</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>fieldCollectionSources|fieldCollectionSource</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>fieldCollectors|fieldCollector</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>fieldCollectors|fieldCollector</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>fieldCollectionEventNames|fieldCollectionEventName</types:value>
                         </types:item>
                         <types:item xmlns:types="http://collectionspace.org/services/common/types">
                             <types:key>authRef</types:key>
-                            <types:value>valuer</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>insurers|insurer</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+              <types:value>valuer</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>insurers|insurer</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>currentLocationGroupList/*/currentLocation</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>normalLocation</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>conditionCheckersOrAssessors|conditionCheckerOrAssessor</types:value>
-                        </types:item>
+            </types:item>
                         <!-- Fields containing term list / controlled vocabulary references -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>entryMethods|entryMethod</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>entryReason</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>fieldCollectionMethods|fieldCollectionMethod</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+              <types:value>entryMethods|entryMethod</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+              <types:value>entryReason</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+              <types:value>fieldCollectionMethods|fieldCollectionMethod</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>currentLocationGroupList/*/currentLocationFitness</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>conditionCheckMethods|conditionCheckMethod</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>conditionCheckReasons|conditionCheckReason</types:value>
-                        </types:item>
-                    </service:properties>
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/intake" schemaLocation="http://collectionspace.org/services/intake http://services.collectionspace.org/intake/intakes_common.xsd" />
-                    </service:content>
-                </service:part>
-                <!-- BEGIN Laramie for new collectionspace_core -->
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-                <!-- END Laramie for new collectionspace_core -->
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end intake service meta-data -->
+            </types:item>
+          </service:properties>
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/intake" schemaLocation="http://collectionspace.org/services/intake http://services.collectionspace.org/intake/intakes_common.xsd" />
+          </service:content>
+        </service:part>
+        <!-- BEGIN Laramie for new collectionspace_core -->
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+        <!-- END Laramie for new collectionspace_core -->
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end intake service meta-data -->
         
-        <!-- begin loanin service meta-data -->
-        <tenant:serviceBindings id="Loansin" name="Loansin" type="procedure" version="0.1">
-            <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/loansin/*/workflow/</service:uriPath>
+    <!-- begin loanin service meta-data -->
+    <tenant:serviceBindings id="Loansin" name="Loansin" type="procedure" version="0.1">
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/loansin/*/workflow/</service:uriPath>
             <!-- other URI paths through which this service could be accessed -->
             <!--
             <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /loansin/*/authorityrefs/
             </service:uriPath>
             -->
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.loanin.nuxeo.LoaninDocumentModelHandler</service:documentHandler>
-            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
-                <service:classname>org.collectionspace.services.loanin.nuxeo.LoaninDocumentModelHandler</service:classname>
-                <service:params>
-                    <service:SchemaName>loansin</service:SchemaName>
-                    <service:DublinCoreTitle>loansin</service:DublinCoreTitle>
-                    <service:SummaryFields>loanInNumber|lenderList|loanReturnDate|uri|csid</service:SummaryFields>
-                    <service:AbstractCommonListClassname />
-                    <service:CommonListItemClassname />
-                    <service:ListResultsItemMethodName>getLoaninListItem</service:ListResultsItemMethodName>
-                    <service:ListResultsFields>
-                        <service:ListResultField>
-                            <service:element>loanInNumber</service:element>
-                            <service:xpath>loanInNumber</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>lender</service:element>
-                            <service:xpath>lenderGroupList/[0]/lender</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>loanReturnDate</service:element>
-                            <service:xpath>loanReturnDate</service:xpath>
-                        </service:ListResultField>
-                    </service:ListResultsFields>
-                </service:params>
-            </service:DocHandlerParams>
-            <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.loanin.nuxeo.LoaninValidatorHandler</service:validatorHandler>
-            <!-- This block is likely cruft; see CSPACE-4475 -->
-            <s:initHandler xmlns:s="http://collectionspace.org/services/common/service">
-                <s:classname>org.collectionspace.services.common.init.InitHandler</s:classname>
-                <s:params>
-                    <s:field>
-                        <s:table>mytable</s:table>
-                        <s:col>mycol</s:col>
-                        <s:type>mytpe</s:type>
-                        <s:param>myparam, myparamB</s:param>
-                    </s:field>
-                    <s:field>
-                        <s:table>mytable2</s:table>
-                        <s:col>mycol2</s:col>
-                        <s:type>mytpe2</s:type>
-                        <s:param>myparam, myparam2B</s:param>
-                    </s:field>
-                    <s:property>
-                        <s:key>my key</s:key>
-                        <s:value>my value</s:value>
-                    </s:property>
-                    <s:property>
-                        <s:key>my key 2</s:key>
-                        <s:value>my value 2</s:value>
-                    </s:property>
-                </s:params>
-            </s:initHandler>
-            <!-- This tenant:properties block is likely cruft; see CSPACE-4475 -->
-            <tenant:properties>
-                <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                    <types:key>datePattern</types:key>
-                    <types:value>MMM dd, yyyy</types:value>
-                </types:item>
-                <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                    <types:key>datePattern</types:key>
-                    <types:value>dd.MM.yyyy</types:value>
-                </types:item>
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.loanin.nuxeo.LoaninDocumentModelHandler</service:documentHandler>
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:classname>org.collectionspace.services.loanin.nuxeo.LoaninDocumentModelHandler</service:classname>
+        <service:params>
+          <service:SchemaName>loansin</service:SchemaName>
+          <service:DublinCoreTitle>loansin</service:DublinCoreTitle>
+          <service:SummaryFields>loanInNumber|lenderList|loanReturnDate|uri|csid</service:SummaryFields>
+          <service:AbstractCommonListClassname />
+          <service:CommonListItemClassname />
+          <service:ListResultsItemMethodName>getLoaninListItem</service:ListResultsItemMethodName>
+          <service:ListResultsFields>
+            <service:ListResultField>
+              <service:element>loanInNumber</service:element>
+              <service:xpath>loanInNumber</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>lender</service:element>
+              <service:xpath>lenderGroupList/[0]/lender</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>loanReturnDate</service:element>
+              <service:xpath>loanReturnDate</service:xpath>
+            </service:ListResultField>
+          </service:ListResultsFields>
+        </service:params>
+      </service:DocHandlerParams>
+      <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.loanin.nuxeo.LoaninValidatorHandler</service:validatorHandler>
+      <!-- This block is likely cruft; see CSPACE-4475 -->
+      <s:initHandler xmlns:s="http://collectionspace.org/services/common/service">
+        <s:classname>org.collectionspace.services.common.init.InitHandler</s:classname>
+        <s:params>
+          <s:field>
+            <s:table>mytable</s:table>
+            <s:col>mycol</s:col>
+            <s:type>mytpe</s:type>
+            <s:param>myparam, myparamB</s:param>
+          </s:field>
+          <s:field>
+            <s:table>mytable2</s:table>
+            <s:col>mycol2</s:col>
+            <s:type>mytpe2</s:type>
+            <s:param>myparam, myparam2B</s:param>
+          </s:field>
+          <s:property>
+            <s:key>my key</s:key>
+            <s:value>my value</s:value>
+          </s:property>
+          <s:property>
+            <s:key>my key 2</s:key>
+            <s:value>my value 2</s:value>
+          </s:property>
+        </s:params>
+      </s:initHandler>
+      <!-- This tenant:properties block is likely cruft; see CSPACE-4475 -->
+      <tenant:properties>
+        <types:item xmlns:types="http://collectionspace.org/services/common/types">
+          <types:key>datePattern</types:key>
+          <types:value>MMM dd, yyyy</types:value>
+        </types:item>
+        <types:item xmlns:types="http://collectionspace.org/services/common/types">
+          <types:key>datePattern</types:key>
+          <types:value>dd.MM.yyyy</types:value>
+        </types:item>
                 <!--
                 <types:item>
                     <types:key>datePattern</types:key>
                     <types:value>dd/MM/yyyy</types:value>
                 </types:item>
                 -->
-                <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                    <types:key>localeLanguage</types:key>
-                    <types:value>en</types:value>
-                </types:item>
+        <types:item xmlns:types="http://collectionspace.org/services/common/types">
+          <types:key>localeLanguage</types:key>
+          <types:value>en</types:value>
+        </types:item>
                 <!--
                 <types:item>
                     <types:key>localeLanguage</types:key>
                     <types:value>da</types:value>
                 </types:item>
                 -->
-            </tenant:properties>
-            <service:properties xmlns:service="http://collectionspace.org/services/common/service">
-                <types:item xmlns:types="http://collectionspace.org/services/common/types">
+      </tenant:properties>
+      <service:properties xmlns:service="http://collectionspace.org/services/common/service">
+        <types:item xmlns:types="http://collectionspace.org/services/common/types">
                     <types:key>objectNameProperty</types:key>
                     <types:value>lenderGroupList/[0]/lender</types:value>
                 </types:item>
                 <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                    <types:key>objectNumberProperty</types:key>
-                    <types:value>loanInNumber</types:value>
-                </types:item>
-            </service:properties>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Loanin" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="loansin-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="loansin_common" updated="" order="1">
-                    <service:properties>
+          <types:key>objectNumberProperty</types:key>
+          <types:value>loanInNumber</types:value>
+        </types:item>
+      </service:properties>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Loanin" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="loansin-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="loansin_common" updated="" order="1">
+          <service:properties>
                         <!-- Fields containing authority term references -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>lenderGroupList/*/lender</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>lenderGroupList/*/lendersAuthorizer</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+               <types:key>authRef</types:key>
                             <types:value>lenderGroupList/*/lendersContact</types:value>                          
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>borrowersAuthorizer</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>borrowersContact</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+               <types:key>authRef</types:key>
                             <types:value>loanInContact</types:value>
-                        </types:item>
+            </types:item>
                         <!-- Fields containing term list / controlled vocabulary references -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
                             <types:key>termRef</types:key>
                             <types:value>loanPurpose</types:value>
                         </types:item>
                         <types:item xmlns:types="http://collectionspace.org/services/common/types">
                             <types:key>termRef</types:key>
-                            <types:value>loanStatusGroupList/*/loanStatus</types:value>
-                        </types:item>
-                    </service:properties>
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/loanin" schemaLocation="http://collectionspace.org/services/loanin http://services.collectionspace.org/loanin/loansin_common.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end loanin service meta-data -->
+                                                       <types:value>loanStatusGroupList/*/loanStatus</types:value>
+            </types:item>
+          </service:properties>
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/loanin" schemaLocation="http://collectionspace.org/services/loanin http://services.collectionspace.org/loanin/loansin_common.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end loanin service meta-data -->
     
-        <!-- begin loanout service meta-data -->
-        <tenant:serviceBindings id="Loansout" name="Loansout" type="procedure" version="0.1">
-            <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/loansout/*/workflow/</service:uriPath>
+    <!-- begin loanout service meta-data -->
+    <tenant:serviceBindings id="Loansout" name="Loansout" type="procedure" version="0.1">
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/loansout/*/workflow/</service:uriPath>
             <!-- other URI paths through which this service could be accessed -->
             <!--
             <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /loansout/*/authorityrefs/
             </service:uriPath>
             -->
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.loanout.nuxeo.LoanoutDocumentModelHandler</service:documentHandler>
-            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
-                <service:params>
-                    <service:ListResultsFields>
-                        <service:ListResultField>
-                            <service:element>loanOutNumber</service:element>
-                            <service:xpath>loanOutNumber</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>borrower</service:element>
-                            <service:xpath>borrower</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>loanReturnDate</service:element>
-                            <service:xpath>loanReturnDate</service:xpath>
-                        </service:ListResultField>
-                    </service:ListResultsFields>
-                </service:params>
-            </service:DocHandlerParams>
-            <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.loanout.nuxeo.LoanoutValidatorHandler</service:validatorHandler>
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.loanout.nuxeo.LoanoutDocumentModelHandler</service:documentHandler>
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:params>
+          <service:ListResultsFields>
+            <service:ListResultField>
+              <service:element>loanOutNumber</service:element>
+              <service:xpath>loanOutNumber</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>borrower</service:element>
+              <service:xpath>borrower</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>loanReturnDate</service:element>
+              <service:xpath>loanReturnDate</service:xpath>
+            </service:ListResultField>
+          </service:ListResultsFields>
+        </service:params>
+      </service:DocHandlerParams>
+      <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.loanout.nuxeo.LoanoutValidatorHandler</service:validatorHandler>
             <service:properties xmlns:service="http://collectionspace.org/services/common/service">
                 <types:item xmlns:types="http://collectionspace.org/services/common/types">
                     <types:key>objectNameProperty</types:key>
                     <types:value>loanOutNumber</types:value>
                 </types:item>
             </service:properties>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Loanout" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="loansout-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="loansout_common" updated="" order="1">
-                    <service:properties>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Loanout" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="loansout-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="loansout_common" updated="" order="1">
+          <service:properties>
                         <!-- Fields containing authority term references -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>borrower</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>borrowersContact</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>lendersAuthorizer</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>lendersContact</types:value>
-                        </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>borrower</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>borrowersContact</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>lendersAuthorizer</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>lendersContact</types:value>
+            </types:item>
                         <!-- Fields containing term list / controlled vocabulary references -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>loanPurpose</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>loanStatusGroupList/*/loanStatus</types:value>
-                        </types:item>
-                    </service:properties>
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/loanout" schemaLocation="http://collectionspace.org/services/loanout http://services.collectionspace.org/loanout/loansout_common.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end loanout service meta-data -->
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+              <types:value>loanPurpose</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+                                                       <types:value>loanStatusGroupList/*/loanStatus</types:value>
+            </types:item>
+          </service:properties>
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/loanout" schemaLocation="http://collectionspace.org/services/loanout http://services.collectionspace.org/loanout/loansout_common.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end loanout service meta-data -->
     
-        <!-- begin objectexit service meta-data -->
-        <tenant:serviceBindings id="ObjectExit" name="ObjectExit" type="procedure" version="0.1">
-            <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/objectexit/*/workflow/</service:uriPath>
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.objectexit.nuxeo.ObjectExitDocumentModelHandler</service:documentHandler>
-            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
-                <service:classname>org.collectionspace.services.objectexit.nuxeo.ObjectExitDocumentModelHandler</service:classname>
-                <service:params>
-                    <service:ListResultsFields>
-                        <service:ListResultField>
-                            <service:element>exitNumber</service:element>
-                            <service:xpath>exitNumber</service:xpath>
-                            <service:setter>setExitNumber</service:setter>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>currentOwner</service:element>
-                            <service:xpath>currentOwner</service:xpath>
-                            <service:setter>setCurrentOwner</service:setter>
-                        </service:ListResultField>
-                    </service:ListResultsFields>
-                </service:params>
-            </service:DocHandlerParams>
-            <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.objectexit.nuxeo.ObjectExitValidatorHandler</service:validatorHandler>
-            <service:properties xmlns:service="http://collectionspace.org/services/common/service">
-                <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                    <types:key>objectNameProperty</types:key>
-                    <types:value>currentOwner</types:value>
-                </types:item>
-                <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                    <types:key>objectNumberProperty</types:key>
-                    <types:value>exitNumber</types:value>
-                </types:item>
-            </service:properties>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="ObjectExit" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="objectexit-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="objectexit_common" updated="" order="1">
-                    <service:properties>
+    <!-- begin objectexit service meta-data -->
+    <tenant:serviceBindings id="ObjectExit" name="ObjectExit" type="procedure" version="0.1">
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/objectexit/*/workflow/</service:uriPath>
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.objectexit.nuxeo.ObjectExitDocumentModelHandler</service:documentHandler>
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:classname>org.collectionspace.services.objectexit.nuxeo.ObjectExitDocumentModelHandler</service:classname>
+        <service:params>
+          <service:ListResultsFields>
+            <service:ListResultField>
+              <service:element>exitNumber</service:element>
+              <service:xpath>exitNumber</service:xpath>
+              <service:setter>setExitNumber</service:setter>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>currentOwner</service:element>
+              <service:xpath>currentOwner</service:xpath>
+              <service:setter>setCurrentOwner</service:setter>
+            </service:ListResultField>
+          </service:ListResultsFields>
+        </service:params>
+      </service:DocHandlerParams>
+      <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.objectexit.nuxeo.ObjectExitValidatorHandler</service:validatorHandler>
+      <service:properties xmlns:service="http://collectionspace.org/services/common/service">
+        <types:item xmlns:types="http://collectionspace.org/services/common/types">
+          <types:key>objectNameProperty</types:key>
+          <types:value>currentOwner</types:value>
+        </types:item>
+        <types:item xmlns:types="http://collectionspace.org/services/common/types">
+          <types:key>objectNumberProperty</types:key>
+          <types:value>exitNumber</types:value>
+        </types:item>
+      </service:properties>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="ObjectExit" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="objectexit-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="objectexit_common" updated="" order="1">
+          <service:properties>
                         <!-- Fields containing authority term references -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>currentOwner</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>depositor</types:value>
-                        </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>currentOwner</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>depositor</types:value>
+            </types:item>
                         <!-- Fields containing term list / controlled vocabulary references -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>exitMethods|exitMethod</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>exitReason</types:value>
-                        </types:item>
-                    </service:properties>
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/objectexit" schemaLocation="http://collectionspace.org/services/objectexit http://services.collectionspace.org/objectexit/objectexit_common.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end objectexit service meta-data -->
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+              <types:value>exitMethods|exitMethod</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+              <types:value>exitReason</types:value>
+            </types:item>
+          </service:properties>
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/objectexit" schemaLocation="http://collectionspace.org/services/objectexit http://services.collectionspace.org/objectexit/objectexit_common.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end objectexit service meta-data -->
     
-        <!-- begin batch service meta-data -->
-        <tenant:serviceBindings id="Batch" name="Batch" type="procedure" version="0.1">
-            <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/batch/*/workflow/</service:uriPath>
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.batch.nuxeo.BatchDocumentModelHandler</service:documentHandler>
-            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
-                <service:params>
-                    <service:ListResultsFields>
-                        <service:ListResultField>
-                            <service:element>name</service:element>
-                            <service:xpath>name</service:xpath>
-                            <service:setter>setName</service:setter>
-                        </service:ListResultField>
-                    </service:ListResultsFields>
-                </service:params>
-            </service:DocHandlerParams>
-            <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.batch.nuxeo.BatchValidatorHandler</service:validatorHandler>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Batch" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="batch-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="batch_common" updated="" order="1">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/batch" schemaLocation="http://collectionspace.org/services/batch http://services.collectionspace.org/batch/batch_common.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end batch service meta-data -->
+    <!-- begin batch service meta-data -->
+    <tenant:serviceBindings id="Batch" name="Batch" type="procedure" version="0.1">
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/batch/*/workflow/</service:uriPath>
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.batch.nuxeo.BatchDocumentModelHandler</service:documentHandler>
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:params>
+          <service:ListResultsFields>
+            <service:ListResultField>
+              <service:element>name</service:element>
+              <service:xpath>name</service:xpath>
+              <service:setter>setName</service:setter>
+            </service:ListResultField>
+          </service:ListResultsFields>
+        </service:params>
+      </service:DocHandlerParams>
+      <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.batch.nuxeo.BatchValidatorHandler</service:validatorHandler>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Batch" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="batch-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="batch_common" updated="" order="1">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/batch" schemaLocation="http://collectionspace.org/services/batch http://services.collectionspace.org/batch/batch_common.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end batch service meta-data -->
     
-        <!-- begin group service meta-data -->
-        <tenant:serviceBindings id="Groups" name="Groups" type="procedure" version="0.1">
-            <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/groups/*/workflow/</service:uriPath>
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.group.nuxeo.GroupDocumentModelHandler</service:documentHandler>
-            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
-                <service:params>
-                    <service:ListResultsFields>
-                        <service:ListResultField>
-                            <service:element>title</service:element>
-                            <service:xpath>title</service:xpath>
-                        </service:ListResultField>
-                    </service:ListResultsFields>
-                </service:params>
-            </service:DocHandlerParams>
-            <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.group.nuxeo.GroupValidatorHandler</service:validatorHandler>
-            <service:properties xmlns:service="http://collectionspace.org/services/common/service">
-                <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                    <types:key>objectNameProperty</types:key>
-                    <types:value>title</types:value>
-                </types:item>
-            </service:properties>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Group" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="group-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="groups_common" updated="" order="1">
-                    <service:properties>
+    <!-- begin group service meta-data -->
+    <tenant:serviceBindings id="Groups" name="Groups" type="procedure" version="0.1">
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/groups/*/workflow/</service:uriPath>
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.group.nuxeo.GroupDocumentModelHandler</service:documentHandler>
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:params>
+          <service:ListResultsFields>
+            <service:ListResultField>
+              <service:element>title</service:element>
+              <service:xpath>title</service:xpath>
+            </service:ListResultField>
+          </service:ListResultsFields>
+        </service:params>
+      </service:DocHandlerParams>
+      <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.group.nuxeo.GroupValidatorHandler</service:validatorHandler>
+      <service:properties xmlns:service="http://collectionspace.org/services/common/service">
+        <types:item xmlns:types="http://collectionspace.org/services/common/types">
+          <types:key>objectNameProperty</types:key>
+          <types:value>title</types:value>
+        </types:item>
+      </service:properties>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Group" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="group-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="groups_common" updated="" order="1">
+          <service:properties>
                         <!-- Fields containing authority term references -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>owner</types:value>
-                        </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>owner</types:value>
+            </types:item>
                         <!-- Fields containing term list / controlled vocabulary references -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>responsibleDepartment</types:value>
-                        </types:item>
-                    </service:properties>
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/group" schemaLocation="http://collectionspace.org/services/group http://services.collectionspace.org/group/groups_common.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end group service meta-data -->
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+              <types:value>responsibleDepartment</types:value>
+            </types:item>
+          </service:properties>
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/group" schemaLocation="http://collectionspace.org/services/group http://services.collectionspace.org/group/groups_common.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end group service meta-data -->
     
-        <!-- begin imports service meta-data -->
-        <tenant:serviceBindings id="Imports" name="Imports" type="procedure" version="0.1">
-            <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/imports/*/workflow/</service:uriPath>
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.imports.nuxeo.ImportsDocumentModelHandler</service:documentHandler>
-            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
-                <service:classname>org.collectionspace.services.imports.nuxeo.ImportsDocumentModelHandler</service:classname>
-                <service:params>
-                    <service:SchemaName>imports</service:SchemaName>
-                    <service:DublinCoreTitle>imports</service:DublinCoreTitle>
-                    <service:SummaryFields>importsField|uri|csid</service:SummaryFields>
-                    <service:AbstractCommonListClassname>org.collectionspace.services.imports.ImportsCommonList</service:AbstractCommonListClassname>
-                    <service:CommonListItemClassname>org.collectionspace.services.imports.ImportsCommonList$ImportsListItem</service:CommonListItemClassname>
-                    <service:ListResultsItemMethodName>getImportsListItem</service:ListResultsItemMethodName>
-                    <service:ListResultsFields>
-                        <service:ListResultField>
-                            <service:element>importsField</service:element>
-                            <service:xpath>importsField</service:xpath>
-                            <service:setter>setImportsField</service:setter>
-                        </service:ListResultField>
-                    </service:ListResultsFields>
-                </service:params>
-            </service:DocHandlerParams>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Imports" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="imports-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="imports_common" updated="" order="1">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/imports" schemaLocation="http://collectionspace.org/services/imports http://services.collectionspace.org/imports/imports_common.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end imports service meta-data -->
+    <!-- begin imports service meta-data -->
+    <tenant:serviceBindings id="Imports" name="Imports" type="procedure" version="0.1">
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/imports/*/workflow/</service:uriPath>
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.imports.nuxeo.ImportsDocumentModelHandler</service:documentHandler>
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:classname>org.collectionspace.services.imports.nuxeo.ImportsDocumentModelHandler</service:classname>
+        <service:params>
+          <service:SchemaName>imports</service:SchemaName>
+          <service:DublinCoreTitle>imports</service:DublinCoreTitle>
+          <service:SummaryFields>importsField|uri|csid</service:SummaryFields>
+          <service:AbstractCommonListClassname>org.collectionspace.services.imports.ImportsCommonList</service:AbstractCommonListClassname>
+          <service:CommonListItemClassname>org.collectionspace.services.imports.ImportsCommonList$ImportsListItem</service:CommonListItemClassname>
+          <service:ListResultsItemMethodName>getImportsListItem</service:ListResultsItemMethodName>
+          <service:ListResultsFields>
+            <service:ListResultField>
+              <service:element>importsField</service:element>
+              <service:xpath>importsField</service:xpath>
+              <service:setter>setImportsField</service:setter>
+            </service:ListResultField>
+          </service:ListResultsFields>
+        </service:params>
+      </service:DocHandlerParams>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Imports" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="imports-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="imports_common" updated="" order="1">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/imports" schemaLocation="http://collectionspace.org/services/imports http://services.collectionspace.org/imports/imports_common.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end imports service meta-data -->
     
-        <!-- begin media service meta-data -->
-        <!-- This should likely be type="object" -->
-        <tenant:serviceBindings id="Media" name="Media" type="procedure" version="0.1">
-            <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/media/*/workflow/</service:uriPath>
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.media.nuxeo.MediaDocumentModelHandler</service:documentHandler>
-            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
-                <service:params>
-                    <service:ListResultsFields>
-                        <service:ListResultField>
-                            <service:element>title</service:element>
-                            <service:xpath>title</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>source</service:element>
-                            <service:xpath>source</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>filename</service:element>
-                            <service:xpath>filename</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>identificationNumber</service:element>
-                            <service:xpath>identificationNumber</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>blobCsid</service:element>
-                            <service:xpath>blobCsid</service:xpath>
-                        </service:ListResultField>
-                    </service:ListResultsFields>
-                </service:params>
-            </service:DocHandlerParams>
-            <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.media.nuxeo.MediaValidatorHandler</service:validatorHandler>
+    <!-- begin media service meta-data -->
+               <!-- This should likely be type="object" -->
+     <tenant:serviceBindings id="Media" name="Media" type="procedure" version="0.1">
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/media/*/workflow/</service:uriPath>
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.media.nuxeo.MediaDocumentModelHandler</service:documentHandler>
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:params>
+          <service:ListResultsFields>
+            <service:ListResultField>
+              <service:element>title</service:element>
+              <service:xpath>title</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>source</service:element>
+              <service:xpath>source</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>filename</service:element>
+              <service:xpath>filename</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>identificationNumber</service:element>
+              <service:xpath>identificationNumber</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>blobCsid</service:element>
+              <service:xpath>blobCsid</service:xpath>
+            </service:ListResultField>
+          </service:ListResultsFields>
+        </service:params>
+      </service:DocHandlerParams>
+      <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.media.nuxeo.MediaValidatorHandler</service:validatorHandler>
             <service:properties xmlns:service="http://collectionspace.org/services/common/service">
                 <types:item xmlns:types="http://collectionspace.org/services/common/types">
                     <types:key>objectNameProperty</types:key>
                     <types:value>identificationNumber</types:value>
                 </types:item>
             </service:properties>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Media" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="media-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="media_common" updated="" order="1">
-                    <service:properties>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Media" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="media-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="media_common" updated="" order="1">
+          <service:properties>
                         <!-- Fields containing authority term references -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>contributor</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>coverage</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>creator</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>publisher</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>rightsHolder</types:value>
-                        </types:item>
-                        <!-- Subject Authority field -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>subjectList|subject</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>measuredPartGroupList/*/dimensionSubGroupList/*/measuredBy</types:value>
-                        </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>contributor</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>coverage</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>creator</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>publisher</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>rightsHolder</types:value>
+            </types:item>
+            <!-- Subject Authority field -->
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+                                                       <types:value>subjectList|subject</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>measuredPartGroupList/*/dimensionSubGroupList/*/measuredBy</types:value>
+            </types:item>
                         <!-- Fields containing term list / controlled vocabulary references -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>languageList|language</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>typeList|type</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+              <types:value>languageList|language</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+              <types:value>typeList|type</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>measuredPartGroupList/*/dimensionSubGroupList/*/dimension</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>measuredPartGroupList/*/dimensionSubGroupList/*/measurementUnit</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>measuredPartGroupList/*/dimensionSubGroupList/*/measurementMethod</types:value>
-                        </types:item>
-                    </service:properties>
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/media" schemaLocation="http://collectionspace.org/services/media http://services.collectionspace.org/media/media_common.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end media service meta-data -->
+            </types:item>
+          </service:properties>
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/media" schemaLocation="http://collectionspace.org/services/media http://services.collectionspace.org/media/media_common.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end media service meta-data -->
         
-        <!-- begin movement service meta-data -->
-        <tenant:serviceBindings id="Movements" name="Movements" type="procedure" version="0.1">
-            <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/movements/*/workflow/</service:uriPath>
+    <!-- begin movement service meta-data -->
+    <tenant:serviceBindings id="Movements" name="Movements" type="procedure" version="0.1">
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/movements/*/workflow/</service:uriPath>
             <!-- other URI paths through which this service could be accessed -->
             <!--
             <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /movements/*/authorityrefs/
             </service:uriPath>
             -->
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.movement.nuxeo.MovementDocumentModelHandler</service:documentHandler>
-            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
-                <service:params>
-                    <service:ListResultsFields>
-                        <service:ListResultField>
-                            <service:element>movementReferenceNumber</service:element>
-                            <service:xpath>movementReferenceNumber</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>currentLocation</service:element>
-                            <service:xpath>currentLocation</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>locationDate</service:element>
-                            <service:xpath>locationDate</service:xpath>
-                        </service:ListResultField>
-                    </service:ListResultsFields>
-                </service:params>
-            </service:DocHandlerParams>
-            <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.movement.nuxeo.MovementValidatorHandler</service:validatorHandler>
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.movement.nuxeo.MovementDocumentModelHandler</service:documentHandler>
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:params>
+          <service:ListResultsFields>
+            <service:ListResultField>
+              <service:element>movementReferenceNumber</service:element>
+              <service:xpath>movementReferenceNumber</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>currentLocation</service:element>
+              <service:xpath>currentLocation</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>locationDate</service:element>
+              <service:xpath>locationDate</service:xpath>
+            </service:ListResultField>
+          </service:ListResultsFields>
+        </service:params>
+      </service:DocHandlerParams>
+      <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.movement.nuxeo.MovementValidatorHandler</service:validatorHandler>
             <service:properties xmlns:service="http://collectionspace.org/services/common/service">
                 <types:item xmlns:types="http://collectionspace.org/services/common/types">
                     <types:key>objectNameProperty</types:key>
                     <types:value>movementReferenceNumber</types:value>
                 </types:item>
             </service:properties>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Movement" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="movements-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="movements_common" updated="" order="1">
-                    <service:properties>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Movement" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="movements-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="movements_common" updated="" order="1">
+          <service:properties>
                         <!-- See CSPACE-4474 for possible additional authRef and termRef entries -->
                         <!-- Fields containing authority term references -->
                         <!-- Object Location Information group -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>currentLocation</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>normalLocation</types:value>
-                        </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>currentLocation</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>normalLocation</types:value>
+            </types:item>
                         <!-- Movement Information group -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>movementContact</types:value>
-                        </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>movementContact</types:value>
+            </types:item>
                         <!-- Fields containing term list / controlled vocabulary references -->
                         <!-- Object Location Information group -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>currentLocationFitness</types:value>
-                        </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+              <types:value>currentLocationFitness</types:value>
+            </types:item>
                         <!-- Movement Information group -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>movementMethods|movementMethod</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>reasonForMove</types:value>
-                        </types:item>
-                    </service:properties>
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/movement" schemaLocation="http://collectionspace.org/services/movement http://services.collectionspace.org/movement/movements_common.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end movement service meta-data -->
+            </types:item>
+          </service:properties>
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/movement" schemaLocation="http://collectionspace.org/services/movement http://services.collectionspace.org/movement/movements_common.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end movement service meta-data -->
     
-        <!-- begin Workflow service meta-data -->
-        <tenant:serviceBindings id="Workflow" name="Workflow" type="procedure" version="0.1">
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.common.workflow.service.nuxeo.WorkflowDocumentModelHandler</service:documentHandler>
-            <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.workflow.nuxeo.WorkflowValidatorHandler</service:validatorHandler>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Workflow" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="workflow-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="workflow_common" updated="" order="1">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/workflow" schemaLocation="http://collectionspace.org/services/workflow http://services.collectionspace.org/movement/workflow_common.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end Workflow service meta-data -->
+    <!-- begin Workflow service meta-data -->
+    <tenant:serviceBindings id="Workflow" name="Workflow" type="procedure" version="0.1">
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.common.workflow.service.nuxeo.WorkflowDocumentModelHandler</service:documentHandler>
+      <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.workflow.nuxeo.WorkflowValidatorHandler</service:validatorHandler>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Workflow" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="workflow-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="workflow_common" updated="" order="1">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/workflow" schemaLocation="http://collectionspace.org/services/workflow http://services.collectionspace.org/movement/workflow_common.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end Workflow service meta-data -->
         
-        <!-- begin report service meta-data -->
-        <tenant:serviceBindings id="Reports" name="Reports" type="procedure" version="0.1">
-            <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/reports/*/workflow/</service:uriPath>
+    <!-- begin report service meta-data -->
+    <tenant:serviceBindings id="Reports" name="Reports" type="procedure" version="0.1">
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/reports/*/workflow/</service:uriPath>
             <!-- other URI paths through which this service could be accessed -->
             <!--
             <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /reports/*/output/
             </service:uriPath>-->
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.report.nuxeo.ReportDocumentModelHandler</service:documentHandler>
-            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
-                <service:params>
-                    <service:ListResultsFields>
-                        <service:ListResultField>
-                            <service:element>name</service:element>
-                            <service:xpath>name</service:xpath>
-                        </service:ListResultField>
-                    </service:ListResultsFields>
-                </service:params>
-            </service:DocHandlerParams>
-            <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.report.nuxeo.ReportValidatorHandler</service:validatorHandler>
-            <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
-                <service:classname>org.collectionspace.services.report.nuxeo.ReportPostInitHandler</service:classname>
-                <service:params>
-                    <service:property>
-                        <service:key>readerRoleName</service:key>
-                        <service:value>reader</service:value>
-                    </service:property>
-                </service:params>
-            </service:initHandler>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Report" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="reports-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="reports_common" updated="" order="1">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/report" schemaLocation="http://collectionspace.org/services/report http://services.collectionspace.org/report/reports_common.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end report service meta-data -->
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.report.nuxeo.ReportDocumentModelHandler</service:documentHandler>
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:params>
+          <service:ListResultsFields>
+            <service:ListResultField>
+              <service:element>name</service:element>
+              <service:xpath>name</service:xpath>
+            </service:ListResultField>
+          </service:ListResultsFields>
+        </service:params>
+                       </service:DocHandlerParams>
+      <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.report.nuxeo.ReportValidatorHandler</service:validatorHandler>
+      <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
+        <service:classname>org.collectionspace.services.report.nuxeo.ReportPostInitHandler</service:classname>
+        <service:params>
+          <service:property>
+            <service:key>readerRoleName</service:key>
+            <service:value>reader</service:value>
+          </service:property>
+        </service:params>
+      </service:initHandler>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Report" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="reports-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="reports_common" updated="" order="1">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/report" schemaLocation="http://collectionspace.org/services/report http://services.collectionspace.org/report/reports_common.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end report service meta-data -->
     
-        <!-- begin vocabulary service meta-data -->
-        <tenant:serviceBindings id="Vocabularies" name="Vocabularies" type="utility" version="0.1">
-            <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/vocabularies/*/workflow/</service:uriPath>
-            <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/vocabularies/*/items/*/workflow/</service:uriPath>
+    <!-- begin vocabulary service meta-data -->
+    <tenant:serviceBindings id="Vocabularies" name="Vocabularies" type="utility" version="0.1">
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/vocabularies/*/workflow/</service:uriPath>
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/vocabularies/*/items/*/workflow/</service:uriPath>
             <!-- other URI paths through which this service could be accessed -->
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.vocabulary.nuxeo.VocabularyDocumentModelHandler</service:documentHandler>
-            <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.vocabulary.nuxeo.VocabularyValidatorHandler</service:validatorHandler>
-            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
-                <service:params>
-                    <service:ListResultsFields>
-                        <service:ListResultField>
-                            <service:element>displayName</service:element>
-                            <service:xpath>displayName</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>refName</service:element>
-                            <service:xpath>refName</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>shortIdentifier</service:element>
-                            <service:xpath>shortIdentifier</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>vocabType</service:element>
-                            <service:xpath>vocabType</service:xpath>
-                        </service:ListResultField>
-                    </service:ListResultsFields>
-                </service:params>
-            </service:DocHandlerParams>
-            <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
-                <service:classname>org.collectionspace.services.common.init.AddIndices</service:classname>
-                <service:params>
-                    <service:field>
-                        <service:table>vocabularies_common</service:table>
-                        <service:col>displayname</service:col>
-                    </service:field>
-                    <service:field>
-                        <service:table>vocabularies_common</service:table>
-                        <service:col>shortidentifier</service:col>
-                    </service:field>
-                </service:params>
-            </service:initHandler>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Vocabulary" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="vocabularies-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="vocabularies_common" updated="" order="1">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/vocabulary" schemaLocation="http://collectionspace.org/services/vocabulary http://services.collectionspace.org/vocabulary/vocabularies_common.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end vocabulary service meta-data -->
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.vocabulary.nuxeo.VocabularyDocumentModelHandler</service:documentHandler>
+      <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.vocabulary.nuxeo.VocabularyValidatorHandler</service:validatorHandler>
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:params>
+          <service:ListResultsFields>
+            <service:ListResultField>
+              <service:element>displayName</service:element>
+              <service:xpath>displayName</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>refName</service:element>
+              <service:xpath>refName</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>shortIdentifier</service:element>
+              <service:xpath>shortIdentifier</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>vocabType</service:element>
+              <service:xpath>vocabType</service:xpath>
+            </service:ListResultField>
+          </service:ListResultsFields>
+        </service:params>
+     </service:DocHandlerParams>
+     <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
+        <service:classname>org.collectionspace.services.common.init.AddIndices</service:classname>
+        <service:params>
+          <service:field>
+            <service:table>vocabularies_common</service:table>
+            <service:col>displayname</service:col>
+          </service:field>
+          <service:field>
+            <service:table>vocabularies_common</service:table>
+            <service:col>shortidentifier</service:col>
+          </service:field>
+        </service:params>
+      </service:initHandler>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Vocabulary" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="vocabularies-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="vocabularies_common" updated="" order="1">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/vocabulary" schemaLocation="http://collectionspace.org/services/vocabulary http://services.collectionspace.org/vocabulary/vocabularies_common.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end vocabulary service meta-data -->
     
-        <!-- begin vocabularyitem service meta-data.
+    <!-- begin vocabularyitem service meta-data.
             Note there is no Vocabularyitem service, but there is a
             Repository workspace so we have to configure that.
         -->
-        <tenant:serviceBindings id="Vocabularyitems" name="Vocabularyitems" type="authority" version="0.1">
-            <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/vocabularyitems/*/workflow/</service:uriPath>
+    <tenant:serviceBindings id="Vocabularyitems" name="Vocabularyitems" type="authority" version="0.1">
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/vocabularyitems/*/workflow/</service:uriPath>
             <!-- other URI paths through which this service could be accessed -->
-            <!--
-            <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
+      <!--
+                        <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /vocabularies/*/items/
             </service:uriPath>
             <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /vocabularies/*/items/*/refObjs
             </service:uriPath>
-            -->
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.vocabulary.nuxeo.VocabularyItemDocumentModelHandler</service:documentHandler>
-            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
-                <service:params>
-                    <service:ListResultsFields>
-                        <!-- Omit the standard AuthorityItem items (they are handled by the code) -->
-                        <service:ListResultField>
-                            <service:element>order</service:element>
-                            <service:xpath>order</service:xpath>
-                        </service:ListResultField>
-                    </service:ListResultsFields>
-                </service:params>
-            </service:DocHandlerParams>
-            <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.vocabulary.nuxeo.VocabularyItemValidatorHandler</service:validatorHandler>
-            <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
-                <service:classname>org.collectionspace.services.common.init.AddIndices</service:classname>
-                <service:params>
-                    <service:field>
-                        <service:table>vocabularyitems_common</service:table>
-                        <service:col>inauthority</service:col>
-                    </service:field>
-                    <service:field>
-                        <service:table>vocabularyitems_common</service:table>
-                        <service:col>displayname</service:col>
-                    </service:field>
-                    <service:field>
-                        <service:table>vocabularyitems_common</service:table>
-                        <service:col>shortidentifier</service:col>
-                    </service:field>
-                </service:params>
-            </service:initHandler>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Vocabularyitem" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="vocabularyitems-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="vocabularyitems_common" updated="" order="1">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/vocabulary" schemaLocation="http://collectionspace.org/services/vocabulary http://services.collectionspace.org/vocabulary/vocabularyitems_common.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end vocabulary service meta-data -->
+                        -->
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.vocabulary.nuxeo.VocabularyItemDocumentModelHandler</service:documentHandler>
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:params>
+          <service:ListResultsFields>
+                                               <!-- Omit the standard AuthorityItem items (they are handled by the code) -->
+            <service:ListResultField>
+              <service:element>order</service:element>
+              <service:xpath>order</service:xpath>
+            </service:ListResultField>
+          </service:ListResultsFields>
+        </service:params>
+      </service:DocHandlerParams>
+      <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.vocabulary.nuxeo.VocabularyItemValidatorHandler</service:validatorHandler>
+      <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
+        <service:classname>org.collectionspace.services.common.init.AddIndices</service:classname>
+        <service:params>
+          <service:field>
+            <service:table>vocabularyitems_common</service:table>
+            <service:col>inauthority</service:col>
+          </service:field>
+          <service:field>
+            <service:table>vocabularyitems_common</service:table>
+            <service:col>displayname</service:col>
+          </service:field>
+          <service:field>
+            <service:table>vocabularyitems_common</service:table>
+            <service:col>shortidentifier</service:col>
+          </service:field>
+        </service:params>
+      </service:initHandler>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Vocabularyitem" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="vocabularyitems-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="vocabularyitems_common" updated="" order="1">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/vocabulary" schemaLocation="http://collectionspace.org/services/vocabulary http://services.collectionspace.org/vocabulary/vocabularyitems_common.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end vocabulary service meta-data -->
     
-        <!-- begin orgauthority service meta-data -->
-        <tenant:serviceBindings id="Orgauthorities" name="Orgauthorities" type="utility" version="0.1">
-            <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/orgauthorities/*/workflow/</service:uriPath>
-            <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/orgauthorities/*/items/*/workflow/</service:uriPath>
+    <!-- begin orgauthority service meta-data -->
+    <tenant:serviceBindings id="Orgauthorities" name="Orgauthorities" type="utility" version="0.1">
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/orgauthorities/*/workflow/</service:uriPath>
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/orgauthorities/*/items/*/workflow/</service:uriPath>
             <!-- other URI paths through which this service could be accessed -->
             <!--
             <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /orgauthorities/*/items/*/authorityrefs/
             </service:uriPath>
             -->
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.organization.nuxeo.OrgAuthorityDocumentModelHandler</service:documentHandler>
-            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
-                <service:params>
-                    <service:ListResultsFields>
-                        <service:ListResultField>
-                            <service:element>displayName</service:element>
-                            <service:xpath>displayName</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>refName</service:element>
-                            <service:xpath>refName</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>shortIdentifier</service:element>
-                            <service:xpath>shortIdentifier</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>vocabType</service:element>
-                            <service:xpath>vocabType</service:xpath>
-                        </service:ListResultField>
-                    </service:ListResultsFields>
-                </service:params>
-            </service:DocHandlerParams>
-            <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.organization.nuxeo.OrgAuthorityValidatorHandler</service:validatorHandler>
-            <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
-                <service:classname>org.collectionspace.services.common.init.AddIndices</service:classname>
-                <service:params>
-                    <service:field>
-                        <service:table>orgauthorities_common</service:table>
-                        <service:col>displayname</service:col>
-                    </service:field>
-                    <service:field>
-                        <service:table>orgauthorities_common</service:table>
-                        <service:col>shortidentifier</service:col>
-                    </service:field>
-                </service:params>
-            </service:initHandler>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" id="1" name="Orgauthority" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="orgauthorities-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="orgauthorities_common" updated="" order="1">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/organization" schemaLocation="http://collectionspace.org/services/organization http://services.collectionspace.org/organization/orgauthorities_common.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end orgauthority service meta-data -->
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.organization.nuxeo.OrgAuthorityDocumentModelHandler</service:documentHandler>
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:params>
+          <service:ListResultsFields>
+            <service:ListResultField>
+              <service:element>displayName</service:element>
+              <service:xpath>displayName</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>refName</service:element>
+              <service:xpath>refName</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>shortIdentifier</service:element>
+              <service:xpath>shortIdentifier</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>vocabType</service:element>
+              <service:xpath>vocabType</service:xpath>
+            </service:ListResultField>
+          </service:ListResultsFields>
+        </service:params>
+      </service:DocHandlerParams>
+      <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.organization.nuxeo.OrgAuthorityValidatorHandler</service:validatorHandler>
+      <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
+        <service:classname>org.collectionspace.services.common.init.AddIndices</service:classname>
+        <service:params>
+          <service:field>
+            <service:table>orgauthorities_common</service:table>
+            <service:col>displayname</service:col>
+          </service:field>
+          <service:field>
+            <service:table>orgauthorities_common</service:table>
+            <service:col>shortidentifier</service:col>
+          </service:field>
+        </service:params>
+      </service:initHandler>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" id="1" name="Orgauthority" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="orgauthorities-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="orgauthorities_common" updated="" order="1">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/organization" schemaLocation="http://collectionspace.org/services/organization http://services.collectionspace.org/organization/orgauthorities_common.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end orgauthority service meta-data -->
     
-        <!-- begin organization service meta-data.
+    <!-- begin organization service meta-data.
              Note there is no Organization service, but there is a
              Repository workspace so we have to configure that.
         -->
-        <tenant:serviceBindings id="Organizations" name="Organizations" type="authority" version="0.1">
+    <tenant:serviceBindings id="Organizations" name="Organizations" type="authority" version="0.1">
             <!-- other URI paths through which this service could be accessed -->
             <!-- 
             <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /orgauthorities/*/items/*/refObjs
             </service:uriPath>
             -->
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.organization.nuxeo.OrganizationDocumentModelHandler</service:documentHandler>
-            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
-                <service:params>
-                    <service:ListResultsFields>
-                        <!-- Omit the standard AuthorityItem items (they are handled by the code) -->
-                    </service:ListResultsFields>
-                </service:params>
-            </service:DocHandlerParams>
-            <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.organization.nuxeo.OrganizationValidatorHandler</service:validatorHandler>
-            <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
-                <service:classname>org.collectionspace.services.common.init.AddIndices</service:classname>
-                <service:params>
-                    <service:field>
-                        <service:table>organizations_common</service:table>
-                        <service:col>inauthority</service:col>
-                    </service:field>
-                    <service:field>
-                        <service:table>organizations_common</service:table>
-                        <service:col>displayname</service:col>
-                    </service:field>
-                    <service:field>
-                        <service:table>organizations_common</service:table>
-                        <service:col>shortidentifier</service:col>
-                    </service:field>
-                </service:params>
-            </service:initHandler>
-            <service:properties xmlns:service="http://collectionspace.org/services/common/service">
-                <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                    <types:key>objectNameProperty</types:key>
-                    <types:value>displayName</types:value>
-                </types:item>
-                <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                    <types:key>objectNumberProperty</types:key>
-                    <types:value>shortIdentifier</types:value>
-                </types:item>
-            </service:properties>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" id="1" name="Organization" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="organizations-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="organizations_common" updated="" order="1">
-                    <service:properties>
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.organization.nuxeo.OrganizationDocumentModelHandler</service:documentHandler>
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:params>
+          <service:ListResultsFields>
+                                       <!-- Omit the standard AuthorityItem items (they are handled by the code) -->
+          </service:ListResultsFields>
+        </service:params>
+      </service:DocHandlerParams>
+      <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.organization.nuxeo.OrganizationValidatorHandler</service:validatorHandler>
+      <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
+        <service:classname>org.collectionspace.services.common.init.AddIndices</service:classname>
+        <service:params>
+          <service:field>
+            <service:table>organizations_common</service:table>
+            <service:col>inauthority</service:col>
+          </service:field>
+          <service:field>
+            <service:table>organizations_common</service:table>
+            <service:col>displayname</service:col>
+          </service:field>
+          <service:field>
+            <service:table>organizations_common</service:table>
+            <service:col>shortidentifier</service:col>
+          </service:field>
+        </service:params>
+      </service:initHandler>
+      <service:properties xmlns:service="http://collectionspace.org/services/common/service">
+        <types:item xmlns:types="http://collectionspace.org/services/common/types">
+          <types:key>objectNameProperty</types:key>
+          <types:value>displayName</types:value>
+        </types:item>
+        <types:item xmlns:types="http://collectionspace.org/services/common/types">
+          <types:key>objectNumberProperty</types:key>
+          <types:value>shortIdentifier</types:value>
+        </types:item>
+      </service:properties>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" id="1" name="Organization" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="organizations-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="organizations_common" updated="" order="1">
+          <service:properties>
                         <!-- See CSPACE-3939 for potential additional authRef and termRef entries -->
                         <!-- Fields containing authority term references -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>contactNames|contactName</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>foundingPlace</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>groups|group</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>functions|function</types:value>
-                        </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>contactNames|contactName</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>foundingPlace</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>groups|group</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>functions|function</types:value>
+            </types:item>
                         <!-- Organization's subBody field was removed here from the authRef list -->
                         <!-- per anticipated work on CSPACE-4685.-->
                         <!-- Fields containing term list / controlled vocabulary references -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>termStatus</types:value>
-                        </types:item>
-                    </service:properties>
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/organization" schemaLocation="http://collectionspace.org/services/organization http://services.collectionspace.org/organization/organizations_common.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end organization service meta-data -->
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+              <types:value>termStatus</types:value>
+            </types:item>
+          </service:properties>
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/organization" schemaLocation="http://collectionspace.org/services/organization http://services.collectionspace.org/organization/organizations_common.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end organization service meta-data -->
         
-        <!-- begin personauthority service meta-data -->
-        <tenant:serviceBindings id="Personauthorities" name="Personauthorities" type="utility" version="0.1">
-            <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/personauthorities/*/workflow/</service:uriPath>
-            <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/personauthorities/*/items/*/workflow/</service:uriPath>
+    <!-- begin personauthority service meta-data -->
+    <tenant:serviceBindings id="Personauthorities" name="Personauthorities" type="utility" version="0.1">
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/personauthorities/*/workflow/</service:uriPath>
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/personauthorities/*/items/*/workflow/</service:uriPath>
             <!-- other URI paths through which this service could be accessed -->
             <!--
             <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /personauthorities/*/items/*/refObjs
             </service:uriPath>
             -->
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.person.nuxeo.PersonAuthorityDocumentModelHandler</service:documentHandler>
-            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
-                <service:params>
-                    <service:ListResultsFields>
-                        <service:ListResultField>
-                            <service:element>displayName</service:element>
-                            <service:xpath>displayName</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>refName</service:element>
-                            <service:xpath>refName</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>shortIdentifier</service:element>
-                            <service:xpath>shortIdentifier</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>vocabType</service:element>
-                            <service:xpath>vocabType</service:xpath>
-                        </service:ListResultField>
-                    </service:ListResultsFields>
-                </service:params>
-            </service:DocHandlerParams>
-            <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.person.nuxeo.PersonAuthorityValidatorHandler</service:validatorHandler>
-            <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
-                <service:classname>org.collectionspace.services.common.init.AddIndices</service:classname>
-                <service:params>
-                    <service:field>
-                        <service:table>personauthorities_common</service:table>
-                        <service:col>displayname</service:col>
-                    </service:field>
-                    <service:field>
-                        <service:table>personauthorities_common</service:table>
-                        <service:col>shortidentifier</service:col>
-                    </service:field>
-                </service:params>
-            </service:initHandler>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" id="1" name="Personauthority" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="personauthorities-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="personauthorities_common" updated="" order="1">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/person" schemaLocation="http://collectionspace.org/services/person http://services.collectionspace.org/person/personauthorities_common.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end personauthority service meta-data -->
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.person.nuxeo.PersonAuthorityDocumentModelHandler</service:documentHandler>
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:params>
+          <service:ListResultsFields>
+            <service:ListResultField>
+              <service:element>displayName</service:element>
+              <service:xpath>displayName</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>refName</service:element>
+              <service:xpath>refName</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>shortIdentifier</service:element>
+              <service:xpath>shortIdentifier</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>vocabType</service:element>
+              <service:xpath>vocabType</service:xpath>
+            </service:ListResultField>
+          </service:ListResultsFields>
+        </service:params>
+      </service:DocHandlerParams>
+      <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.person.nuxeo.PersonAuthorityValidatorHandler</service:validatorHandler>
+      <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
+        <service:classname>org.collectionspace.services.common.init.AddIndices</service:classname>
+        <service:params>
+          <service:field>
+            <service:table>personauthorities_common</service:table>
+            <service:col>displayname</service:col>
+          </service:field>
+          <service:field>
+            <service:table>personauthorities_common</service:table>
+            <service:col>shortidentifier</service:col>
+          </service:field>
+        </service:params>
+      </service:initHandler>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" id="1" name="Personauthority" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="personauthorities-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="personauthorities_common" updated="" order="1">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/person" schemaLocation="http://collectionspace.org/services/person http://services.collectionspace.org/person/personauthorities_common.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end personauthority service meta-data -->
         
-        <!-- begin person service meta-data.
+    <!-- begin person service meta-data.
              Note there is no Person service, but there is a
              Repository workspace so we have to configure that.
         -->
-        <tenant:serviceBindings id="Persons" name="Persons" type="authority" version="0.1">
+    <tenant:serviceBindings id="Persons" name="Persons" type="authority" version="0.1">
             <!-- other URI paths through which this service could be accessed -->
             <!--
             <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /personauthorities/*/items/
             </service:uriPath>
             -->
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.person.nuxeo.PersonDocumentModelHandler</service:documentHandler>
-            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
-                <service:params>
-                    <service:ListResultsFields>
-                        <!-- Omit the standard AuthorityItem items (they are handled by the code) -->
-                    </service:ListResultsFields>
-                </service:params>
-            </service:DocHandlerParams>
-            <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.person.nuxeo.PersonValidatorHandler</service:validatorHandler>
-            <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
-                <service:classname>org.collectionspace.services.common.init.AddIndices</service:classname>
-                <service:params>
-                    <service:field>
-                        <service:table>persons_common</service:table>
-                        <service:col>inauthority</service:col>
-                    </service:field>
-                    <service:field>
-                        <service:table>persons_common</service:table>
-                        <service:col>displayname</service:col>
-                    </service:field>
-                    <service:field>
-                        <service:table>persons_common</service:table>
-                        <service:col>shortidentifier</service:col>
-                    </service:field>
-                </service:params>
-            </service:initHandler>
-            <service:properties xmlns:service="http://collectionspace.org/services/common/service">
-                <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                    <types:key>objectNameProperty</types:key>
-                    <types:value>displayName</types:value>
-                </types:item>
-                <!-- there is no objectNumberProperty for persons -->
-                <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                    <types:key>objectNumberProperty</types:key>
-                    <types:value>shortIdentifier</types:value>
-                </types:item>
-            </service:properties>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" id="1" name="Person" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="persons-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="persons_common" updated="" order="1">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/person" schemaLocation="http://collectionspace.org/services/person http://services.collectionspace.org/person/persons_common.xsd" />
-                    </service:content>
-                    <service:properties>
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.person.nuxeo.PersonDocumentModelHandler</service:documentHandler>
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:params>
+          <service:ListResultsFields>
+                                       <!-- Omit the standard AuthorityItem items (they are handled by the code) -->
+          </service:ListResultsFields>
+        </service:params>
+      </service:DocHandlerParams>
+      <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.person.nuxeo.PersonValidatorHandler</service:validatorHandler>
+      <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
+        <service:classname>org.collectionspace.services.common.init.AddIndices</service:classname>
+        <service:params>
+          <service:field>
+            <service:table>persons_common</service:table>
+            <service:col>inauthority</service:col>
+          </service:field>
+          <service:field>
+            <service:table>persons_common</service:table>
+            <service:col>displayname</service:col>
+          </service:field>
+          <service:field>
+            <service:table>persons_common</service:table>
+            <service:col>shortidentifier</service:col>
+          </service:field>
+        </service:params>
+      </service:initHandler>
+      <service:properties xmlns:service="http://collectionspace.org/services/common/service">
+        <types:item xmlns:types="http://collectionspace.org/services/common/types">
+          <types:key>objectNameProperty</types:key>
+          <types:value>displayName</types:value>
+        </types:item>
+        <!-- there is no objectNumberProperty for persons -->
+        <types:item xmlns:types="http://collectionspace.org/services/common/types">
+          <types:key>objectNumberProperty</types:key>
+          <types:value>shortIdentifier</types:value>
+        </types:item>
+      </service:properties>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" id="1" name="Person" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="persons-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="persons_common" updated="" order="1">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/person" schemaLocation="http://collectionspace.org/services/person http://services.collectionspace.org/person/persons_common.xsd" />
+          </service:content>
+          <service:properties>
                         <!-- See CSPACE-3938 for potential additional authRef and termRef entries -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>birthPlace</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>deathPlace</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>groups|group</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>nationalities|nationality</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>occupations|occupation</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>schoolsOrStyles|schoolOrStyle</types:value>
-                        </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>birthPlace</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>deathPlace</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>groups|group</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>nationalities|nationality</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>occupations|occupation</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>schoolsOrStyles|schoolOrStyle</types:value>
+            </types:item>
                         <!-- Fields containing term list / controlled vocabulary references -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
                             <types:key>termRef</types:key>
-                            <types:value>salutation</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:value>salutation</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
                             <types:key>termRef</types:key>
-                            <types:value>title</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:value>title</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
                             <types:key>termRef</types:key>
-                            <types:value>gender</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:value>gender</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
                             <types:key>termRef</types:key>
                             <types:value>termStatus</types:value>
-                        </types:item>
-                    </service:properties>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end person service meta-data -->
+            </types:item>
+          </service:properties>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end person service meta-data -->
         
-        <!-- begin locationauthority service meta-data -->
-        <tenant:serviceBindings id="Locationauthorities" name="Locationauthorities" type="utility" version="0.1">
-            <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/locationauthorities/*/workflow/</service:uriPath>
-            <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/locationauthorities/*/items/*/workflow/</service:uriPath>
+    <!-- begin locationauthority service meta-data -->
+    <tenant:serviceBindings id="Locationauthorities" name="Locationauthorities" type="utility" version="0.1">
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/locationauthorities/*/workflow/</service:uriPath>
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/locationauthorities/*/items/*/workflow/</service:uriPath>
             <!-- other URI paths through which this service could be accessed -->
             <!--
             <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /locationauthorities/*/items/
             </service:uriPath>
             -->
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.location.nuxeo.LocationAuthorityDocumentModelHandler</service:documentHandler>
-            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
-                <service:params>
-                    <service:ListResultsFields>
-                        <service:ListResultField>
-                            <service:element>displayName</service:element>
-                            <service:xpath>displayName</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>refName</service:element>
-                            <service:xpath>refName</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>shortIdentifier</service:element>
-                            <service:xpath>shortIdentifier</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>vocabType</service:element>
-                            <service:xpath>vocabType</service:xpath>
-                        </service:ListResultField>
-                    </service:ListResultsFields>
-                </service:params>
-            </service:DocHandlerParams>
-            <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
-                <service:classname>org.collectionspace.services.common.init.AddIndices</service:classname>
-                <service:params>
-                    <service:field>
-                        <service:table>locationauthorities_common</service:table>
-                        <service:col>displayname</service:col>
-                    </service:field>
-                    <service:field>
-                        <service:table>locationauthorities_common</service:table>
-                        <service:col>shortidentifier</service:col>
-                    </service:field>
-                </service:params>
-            </service:initHandler>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" id="1" name="Locationauthority" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="locationauthorities-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="locationauthorities_common" updated="" order="1">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/location" schemaLocation="http://collectionspace.org/services/location http://services.collectionspace.org/location/locationauthorities_common.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end locationauthority service meta-data -->
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.location.nuxeo.LocationAuthorityDocumentModelHandler</service:documentHandler>
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:params>
+          <service:ListResultsFields>
+            <service:ListResultField>
+              <service:element>displayName</service:element>
+              <service:xpath>displayName</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>refName</service:element>
+              <service:xpath>refName</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>shortIdentifier</service:element>
+              <service:xpath>shortIdentifier</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>vocabType</service:element>
+              <service:xpath>vocabType</service:xpath>
+            </service:ListResultField>
+          </service:ListResultsFields>
+        </service:params>
+      </service:DocHandlerParams>
+      <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
+        <service:classname>org.collectionspace.services.common.init.AddIndices</service:classname>
+        <service:params>
+          <service:field>
+            <service:table>locationauthorities_common</service:table>
+            <service:col>displayname</service:col>
+          </service:field>
+          <service:field>
+            <service:table>locationauthorities_common</service:table>
+            <service:col>shortidentifier</service:col>
+          </service:field>
+        </service:params>
+      </service:initHandler>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" id="1" name="Locationauthority" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="locationauthorities-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="locationauthorities_common" updated="" order="1">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/location" schemaLocation="http://collectionspace.org/services/location http://services.collectionspace.org/location/locationauthorities_common.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end locationauthority service meta-data -->
         
-        <!-- begin location service meta-data.
+    <!-- begin location service meta-data.
              Note there is no Location service, but there is a
              Repository workspace so we have to configure that.
         -->
-        <tenant:serviceBindings id="Locations" name="Locations" type="authority" version="0.1">
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.location.nuxeo.LocationDocumentModelHandler</service:documentHandler>
-            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
-                <service:params>
-                    <service:ListResultsFields>
-                    <!-- Omit the standard AuthorityItem items (they are handled by the code) -->
-                    </service:ListResultsFields>
-                </service:params>
-            </service:DocHandlerParams>
-            <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.location.nuxeo.LocationValidatorHandler</service:validatorHandler>
-            <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
-                <service:classname>org.collectionspace.services.common.init.AddIndices</service:classname>
-                <service:params>
-                    <service:field>
-                        <service:table>locations_common</service:table>
-                        <service:col>inauthority</service:col>
-                    </service:field>
-                    <service:field>
-                        <service:table>locations_common</service:table>
-                        <service:col>displayname</service:col>
-                    </service:field>
-                    <service:field>
-                        <service:table>locations_common</service:table>
-                        <service:col>shortidentifier</service:col>
-                    </service:field>
-                </service:params>
-            </service:initHandler>
-            <service:properties xmlns:service="http://collectionspace.org/services/common/service">
-                <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                    <types:key>objectNameProperty</types:key>
-                    <types:value>displayName</types:value>
-                </types:item>
-                <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                    <types:key>objectNumberProperty</types:key>
-                    <types:value>shortIdentifier</types:value>
-                </types:item>
-            </service:properties>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" id="1" name="Locationitem" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="locations-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="locations_common" updated="" order="1">
-                    <service:properties xmlns:service="http://collectionspace.org/services/common/service">
+    <tenant:serviceBindings id="Locations" name="Locations" type="authority" version="0.1">
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.location.nuxeo.LocationDocumentModelHandler</service:documentHandler>
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:params>
+          <service:ListResultsFields>
+                                       <!-- Omit the standard AuthorityItem items (they are handled by the code) -->
+          </service:ListResultsFields>
+        </service:params>
+      </service:DocHandlerParams>
+      <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.location.nuxeo.LocationValidatorHandler</service:validatorHandler>
+      <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
+        <service:classname>org.collectionspace.services.common.init.AddIndices</service:classname>
+        <service:params>
+          <service:field>
+            <service:table>locations_common</service:table>
+            <service:col>inauthority</service:col>
+          </service:field>
+          <service:field>
+            <service:table>locations_common</service:table>
+            <service:col>displayname</service:col>
+          </service:field>
+          <service:field>
+            <service:table>locations_common</service:table>
+            <service:col>shortidentifier</service:col>
+          </service:field>
+        </service:params>
+      </service:initHandler>
+      <service:properties xmlns:service="http://collectionspace.org/services/common/service">
+               <types:item xmlns:types="http://collectionspace.org/services/common/types">
+                       <types:key>objectNameProperty</types:key>
+                       <types:value>displayName</types:value>
+               </types:item>
+               <types:item xmlns:types="http://collectionspace.org/services/common/types">
+                       <types:key>objectNumberProperty</types:key>
+                       <types:value>shortIdentifier</types:value>
+               </types:item>
+      </service:properties>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" id="1" name="Locationitem" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="locations-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="locations_common" updated="" order="1">
+          <service:properties xmlns:service="http://collectionspace.org/services/common/service">
                         <!-- Fields containing term list / controlled vocabulary references -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>locationType</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>termStatus</types:value>
-                        </types:item>
+            </types:item>
                     </service:properties>
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/location" schemaLocation="http://collectionspace.org/services/location http://services.collectionspace.org/location/locations_common.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end location service meta-data -->
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/location" schemaLocation="http://collectionspace.org/services/location http://services.collectionspace.org/location/locations_common.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end location service meta-data -->
     
-        <!-- begin taxonomyauthority service meta-data -->
-        <tenant:serviceBindings id="Taxonomyauthority" name="Taxonomyauthority" type="utility" version="0.1">
-            <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/taxonomyauthority/*/workflow/</service:uriPath>
-            <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/taxonomyauthority/*/items/*/workflow/</service:uriPath>
+    <!-- begin taxonomyauthority service meta-data -->
+    <tenant:serviceBindings id="Taxonomyauthority" name="Taxonomyauthority" type="utility" version="0.1">
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/taxonomyauthority/*/workflow/</service:uriPath>
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/taxonomyauthority/*/items/*/workflow/</service:uriPath>
             <!-- other URI paths through which this service could be accessed -->
             <!--
             <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /taxonomyauthority/*/items/
             </service:uriPath>
             -->
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.taxonomy.nuxeo.TaxonomyAuthorityDocumentModelHandler</service:documentHandler>
-            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
-                <service:params>
-                    <service:ListResultsFields>
-                        <service:ListResultField>
-                            <service:element>displayName</service:element>
-                            <service:xpath>displayName</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>refName</service:element>
-                            <service:xpath>refName</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>shortIdentifier</service:element>
-                            <service:xpath>shortIdentifier</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>vocabType</service:element>
-                            <service:xpath>vocabType</service:xpath>
-                        </service:ListResultField>
-                    </service:ListResultsFields>
-                </service:params>
-            </service:DocHandlerParams>
-            <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
-                <service:classname>org.collectionspace.services.common.init.AddIndices</service:classname>
-                <service:params>
-                    <service:field>
-                        <service:table>taxonomyauthority_common</service:table>
-                        <service:col>displayname</service:col>
-                    </service:field>
-                    <service:field>
-                        <service:table>taxonomyauthority_common</service:table>
-                        <service:col>shortidentifier</service:col>
-                    </service:field>
-                </service:params>
-            </service:initHandler>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" id="1" name="Taxonomyauthority" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="taxonomyauthority-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="taxonomyauthority_common" updated="" order="1">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/taxonomy" schemaLocation="http://collectionspace.org/services/taxonomy http://services.collectionspace.org/location/taxonomyauthority_common.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end taxonomyauthority service meta-data -->
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.taxonomy.nuxeo.TaxonomyAuthorityDocumentModelHandler</service:documentHandler>
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:params>
+          <service:ListResultsFields>
+            <service:ListResultField>
+              <service:element>displayName</service:element>
+              <service:xpath>displayName</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>refName</service:element>
+              <service:xpath>refName</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>shortIdentifier</service:element>
+              <service:xpath>shortIdentifier</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>vocabType</service:element>
+              <service:xpath>vocabType</service:xpath>
+            </service:ListResultField>
+          </service:ListResultsFields>
+        </service:params>
+      </service:DocHandlerParams>
+      <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
+        <service:classname>org.collectionspace.services.common.init.AddIndices</service:classname>
+        <service:params>
+          <service:field>
+            <service:table>taxonomyauthority_common</service:table>
+            <service:col>displayname</service:col>
+          </service:field>
+          <service:field>
+            <service:table>taxonomyauthority_common</service:table>
+            <service:col>shortidentifier</service:col>
+          </service:field>
+        </service:params>
+      </service:initHandler>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" id="1" name="Taxonomyauthority" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="taxonomyauthority-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="taxonomyauthority_common" updated="" order="1">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/taxonomy" schemaLocation="http://collectionspace.org/services/taxonomy http://services.collectionspace.org/location/taxonomyauthority_common.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end taxonomyauthority service meta-data -->
 
-        <!-- begin Taxon (the 'item' child of TaxonomyAuthority) service meta-data.
+    <!-- begin Taxon (the 'item' child of TaxonomyAuthority) service meta-data.
              Note there is no Taxon service, but there is a
              Repository workspace so we have to configure that.
         -->
-        <tenant:serviceBindings id="Taxon" name="Taxon" type="authority" version="0.1">
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.taxonomy.nuxeo.TaxonDocumentModelHandler</service:documentHandler>
-            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
-                <service:params>
-                    <service:ListResultsFields>
-                    <!-- Omit the standard AuthorityItem items (they are handled by the code) -->
-                    </service:ListResultsFields>
-                </service:params>
-            </service:DocHandlerParams>
-            <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.taxonomy.nuxeo.TaxonValidatorHandler</service:validatorHandler>
-            <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
-                <service:classname>org.collectionspace.services.common.init.AddIndices</service:classname>
-                <service:params>
-                    <service:field>
-                        <service:table>taxon_common</service:table>
-                        <service:col>inauthority</service:col>
-                    </service:field>
-                    <service:field>
-                        <service:table>taxon_common</service:table>
-                        <service:col>displayname</service:col>
-                    </service:field>
-                    <service:field>
-                        <service:table>taxon_common</service:table>
-                        <service:col>shortidentifier</service:col>
-                    </service:field>
-                </service:params>
-            </service:initHandler>
-            <service:properties xmlns:service="http://collectionspace.org/services/common/service">
-                <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                    <types:key>objectNameProperty</types:key>
-                    <types:value>displayName</types:value>
-                </types:item>
-                <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                    <types:key>objectNumberProperty</types:key>
-                    <types:value>shortIdentifier</types:value>
-                </types:item>
-            </service:properties>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" id="1" name="Taxon" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="taxon-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="taxon_common" updated="" order="1">
-                    <service:properties xmlns:service="http://collectionspace.org/services/common/service">
+    <tenant:serviceBindings id="Taxon" name="Taxon" type="authority" version="0.1">
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.taxonomy.nuxeo.TaxonDocumentModelHandler</service:documentHandler>
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:params>
+          <service:ListResultsFields>
+                                       <!-- Omit the standard AuthorityItem items (they are handled by the code) -->
+          </service:ListResultsFields>
+        </service:params>
+      </service:DocHandlerParams>
+      <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.taxonomy.nuxeo.TaxonValidatorHandler</service:validatorHandler>
+      <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
+        <service:classname>org.collectionspace.services.common.init.AddIndices</service:classname>
+        <service:params>
+          <service:field>
+            <service:table>taxon_common</service:table>
+            <service:col>inauthority</service:col>
+          </service:field>
+          <service:field>
+            <service:table>taxon_common</service:table>
+            <service:col>displayname</service:col>
+          </service:field>
+          <service:field>
+            <service:table>taxon_common</service:table>
+            <service:col>shortidentifier</service:col>
+          </service:field>
+        </service:params>
+      </service:initHandler>
+      <service:properties xmlns:service="http://collectionspace.org/services/common/service">
+        <types:item xmlns:types="http://collectionspace.org/services/common/types">
+          <types:key>objectNameProperty</types:key>
+          <types:value>displayName</types:value>
+        </types:item>
+        <types:item xmlns:types="http://collectionspace.org/services/common/types">
+          <types:key>objectNumberProperty</types:key>
+          <types:value>shortIdentifier</types:value>
+        </types:item>
+      </service:properties>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" id="1" name="Taxon" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="taxon-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="taxon_common" updated="" order="1">
+          <service:properties xmlns:service="http://collectionspace.org/services/common/service">
                         <!-- Fields containing authority term references -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>taxonAuthorGroupList/*/taxonAuthor</types:value>
-                        </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+                                                       <types:value>taxonAuthorGroupList/*/taxonAuthor</types:value>
+            </types:item>
                         <!-- Fields containing term list / controlled vocabulary references -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>taxonRank</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>taxonCurrency</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>taxonAuthorGroupList/*/taxonAuthorType</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>taxonomicStatus</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>taxonNameSource</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+              <types:value>taxonomicStatus</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+              <types:value>taxonNameSource</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>termStatus</types:value>
-                        </types:item>
-                    </service:properties>
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/taxonomy" schemaLocation="http://collectionspace.org/services/taxonomy http://services.collectionspace.org/taxonomy/taxon_common.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end taxon service meta-data -->
+            </types:item>
+          </service:properties>
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/taxonomy" schemaLocation="http://collectionspace.org/services/taxonomy http://services.collectionspace.org/taxonomy/taxon_common.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end taxon service meta-data -->
     
-        <!-- begin acquisition service meta-data -->
-        <tenant:serviceBindings id="Acquisitions" name="Acquisitions" type="procedure" version="0.1">
-            <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/acquisitions/*/workflow/</service:uriPath>
+    <!-- begin acquisition service meta-data -->
+    <tenant:serviceBindings id="Acquisitions" name="Acquisitions" type="procedure" version="0.1">
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/acquisitions/*/workflow/</service:uriPath>
             <!-- other URI paths through which this service could be accessed -->
             <!--
             <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /acquisitions/*/authorityrefs/
             </service:uriPath>
             -->
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.acquisition.nuxeo.AcquisitionDocumentModelHandler</service:documentHandler>
-            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
-                <service:params>
-                    <service:ListResultsFields>
-                        <service:ListResultField>
-                            <service:element>acquisitionReferenceNumber</service:element>
-                            <service:xpath>acquisitionReferenceNumber</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>acquisitionSource</service:element>
-                            <service:xpath>acquisitionSources/[0]</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>owner</service:element>
-                            <service:xpath>owners/[0]</service:xpath>
-                        </service:ListResultField>
-                    </service:ListResultsFields>
-                </service:params>
-            </service:DocHandlerParams>
-            <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.acquisition.nuxeo.AcquisitionValidatorHandler</service:validatorHandler>
-            <service:properties xmlns:service="http://collectionspace.org/services/common/service">
-                <types:item xmlns:types="http://collectionspace.org/services/common/types">
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.acquisition.nuxeo.AcquisitionDocumentModelHandler</service:documentHandler>
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:params>
+          <service:ListResultsFields>
+            <service:ListResultField>
+              <service:element>acquisitionReferenceNumber</service:element>
+              <service:xpath>acquisitionReferenceNumber</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>acquisitionSource</service:element>
+              <service:xpath>acquisitionSources/[0]</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>owner</service:element>
+              <service:xpath>owners/[0]</service:xpath>
+            </service:ListResultField>
+          </service:ListResultsFields>
+        </service:params>
+      </service:DocHandlerParams>
+      <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.acquisition.nuxeo.AcquisitionValidatorHandler</service:validatorHandler>
+      <service:properties xmlns:service="http://collectionspace.org/services/common/service">
+        <types:item xmlns:types="http://collectionspace.org/services/common/types">
                     <types:key>objectNameProperty</types:key>
                     <types:value>acquisitionSources/[0]</types:value>
                     </types:item>
                 <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                    <types:key>objectNumberProperty</types:key>
-                    <types:value>acquisitionReferenceNumber</types:value>
-                </types:item>
-            </service:properties>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Acquisition" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="acquisitions-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="acquisitions_common" updated="" order="1">
-                    <service:properties>
+          <types:key>objectNumberProperty</types:key>
+          <types:value>acquisitionReferenceNumber</types:value>
+        </types:item>
+      </service:properties>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Acquisition" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="acquisitions-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="acquisitions_common" updated="" order="1">
+          <service:properties>
                         <!-- Fields containing authority term references -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>acquisitionAuthorizer</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>acquisitionAuthorizer</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
                             <types:value>acquisitionFundingList/*/acquisitionFundingSource</types:value>
                         </types:item>
                         <types:item xmlns:types="http://collectionspace.org/services/common/types">
                             <types:key>authRef</types:key>
-                            <types:value>owners|owner</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>acquisitionSources|acquisitionSource</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>fieldCollectionEventNames|fieldCollectionEventName</types:value>
-                        </types:item>
+              <types:value>owners|owner</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>acquisitionSources|acquisitionSource</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+              <types:value>fieldCollectionEventNames|fieldCollectionEventName</types:value>
+            </types:item>
                         <!-- Fields containing term list / controlled vocabulary references -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
                             <types:key>termRef</types:key>
                             <types:value>acquisitionFundingList/*/acquisitionFundingCurrency</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>acquisitionMethod</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>groupPurchasePriceCurrency</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>objectOfferPriceCurrency</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>objectPurchaseOfferPriceCurrency</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>objectPurchasePriceCurrency</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+              <types:value>acquisitionMethod</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+              <types:value>groupPurchasePriceCurrency</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+              <types:value>objectOfferPriceCurrency</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+              <types:value>objectPurchaseOfferPriceCurrency</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+              <types:value>objectPurchasePriceCurrency</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>originalObjectPurchasePriceCurrency</types:value>
-                        </types:item>
-                    </service:properties>
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/acquisition" schemaLocation="http://collectionspace.org/services/acquisition http://services.collectionspace.org/acquisition/acquisitions_common.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end acquisition service meta-data -->
+            </types:item>
+          </service:properties>
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/acquisition" schemaLocation="http://collectionspace.org/services/acquisition http://services.collectionspace.org/acquisition/acquisitions_common.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end acquisition service meta-data -->
     
-        <!-- begin relation service meta-data -->
-        <tenant:serviceBindings id="Relations" name="Relations" type="utility" version="0.1">
-            <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/relations/*/workflow/</service:uriPath>
+    <!-- begin relation service meta-data -->
+    <tenant:serviceBindings id="Relations" name="Relations" type="utility" version="0.1">
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/relations/*/workflow/</service:uriPath>
             <!-- other URI paths through which this service could be accessed -->
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.relation.nuxeo.RelationDocumentModelHandler</service:documentHandler>
-            <!-- Configuration of list results fields for relation items is commented out for now, -->
-            <!-- pending resolution of how to specify nested elements in list results. -->
-            <!--
-            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
-                <service:params>
-                    <service:ListResultsFields>
-                        <service:ListResultField>
-                            <service:element>subjectCsid</service:element>
-                            <service:xpath>subjectCsid</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>subjectRefName</service:element>
-                            <service:xpath>subjectRefName</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>relationshipType</service:element>
-                            <service:xpath>relationshipType</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>predicate</service:element>
-                            <service:xpath>predicate</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>predicateDisplayName</service:element>
-                            <service:xpath>predicateDisplayName</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>objectCsid</service:element>
-                            <service:xpath>objectCsid</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>objectRefName</service:element>
-                            <service:xpath>objectRefName</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>relationshipType</service:element>
-                            <service:xpath>relationshipType</service:xpath>
-                        </service:ListResultField>
-                    </service:ListResultsFields>
-                </service:params>
-            </service:DocHandlerParams>
-            -->
-            <!--
-              Relation list items can include two additional fields,
-              'subject' and 'object', each of which are parent elements of,
-              and hence containers for, as many as eight child fields.  See
-              services/jaxb/src/main/resources/relations_common.xsd
-            -->
-            <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.relation.nuxeo.RelationValidatorHandler</service:validatorHandler>
-            <service:properties xmlns:service="http://collectionspace.org/services/common/service">
-                <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                    <types:key>objectNameProperty</types:key>
-                    <types:value>subjectCsid</types:value>
-                </types:item>
-                <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                    <types:key>objectNumberProperty</types:key>
-                    <types:value>predicateDisplayName</types:value>
-                </types:item>
-            </service:properties>
-            <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
-                <service:classname>org.collectionspace.services.common.init.AddIndices</service:classname>
-                <service:params>
-                    <!-- The database index that is to be created for the ubiquitious updatedAt field -->
-                    <!-- in collectionspace_core is configured here in the Relation -->
-                    <!-- service, as it is a core service that will be reliably present. -->
-                    <service:field>
-                        <service:table>collectionspace_core</service:table>
-                        <service:col>updatedat</service:col>
-                    </service:field>
-                    <service:field>
-                        <service:table>relations_common</service:table>
-                        <service:param>subjectcsid,objectcsid</service:param>
-                    </service:field>
-                </service:params>
-            </service:initHandler>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Relation" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="relations-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="relations_common" updated="" order="1">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/relation" schemaLocation="http://collectionspace.org/services/relation http://services.collectionspace.org/relation/relations_common.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end relation service meta-data -->
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.relation.nuxeo.RelationDocumentModelHandler</service:documentHandler>
+      <!-- Configuration of list results fields for relation items is commented out for now, -->
+      <!-- pending resolution of how to specify nested elements in list results. -->
+      <!--
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:params>
+          <service:ListResultsFields>
+            <service:ListResultField>
+              <service:element>subjectCsid</service:element>
+              <service:xpath>subjectCsid</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>subjectRefName</service:element>
+              <service:xpath>subjectRefName</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>relationshipType</service:element>
+              <service:xpath>relationshipType</service:xpath>
+            </service:ListResultField>
+             <service:ListResultField>
+              <service:element>predicate</service:element>
+              <service:xpath>predicate</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>predicateDisplayName</service:element>
+              <service:xpath>predicateDisplayName</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>objectCsid</service:element>
+              <service:xpath>objectCsid</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>objectRefName</service:element>
+              <service:xpath>objectRefName</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>relationshipType</service:element>
+              <service:xpath>relationshipType</service:xpath>
+            </service:ListResultField>
+          </service:ListResultsFields>
+        </service:params>
+      </service:DocHandlerParams>
+      -->
+      <!--
+          Relation list items can include two additional fields,
+          'subject' and 'object', each of which are parent elements of,
+          and hence containers for, as many as eight child fields.  See
+          services/jaxb/src/main/resources/relations_common.xsd
+      -->
+      <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.relation.nuxeo.RelationValidatorHandler</service:validatorHandler>
+      <service:properties xmlns:service="http://collectionspace.org/services/common/service">
+        <types:item xmlns:types="http://collectionspace.org/services/common/types">
+          <types:key>objectNameProperty</types:key>
+          <types:value>subjectCsid</types:value>
+        </types:item>
+        <types:item xmlns:types="http://collectionspace.org/services/common/types">
+          <types:key>objectNumberProperty</types:key>
+          <types:value>predicateDisplayName</types:value>
+        </types:item>
+      </service:properties>
+      <service:initHandler xmlns:service="http://collectionspace.org/services/common/service">
+        <service:classname>org.collectionspace.services.common.init.AddIndices</service:classname>
+        <service:params>
+          <!-- The database index that is to be created for the ubiquitious updatedAt field -->
+          <!-- in collectionspace_core is configured here in the Relation -->
+          <!-- service, as it is a core service that will be reliably present. -->
+          <service:field>
+            <service:table>collectionspace_core</service:table>
+            <service:col>updatedat</service:col>
+          </service:field>
+          <service:field>
+            <service:table>relations_common</service:table>
+            <service:param>subjectcsid,objectcsid</service:param>
+          </service:field>
+        </service:params>
+      </service:initHandler>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Relation" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="relations-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="relations_common" updated="" order="1">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/relation" schemaLocation="http://collectionspace.org/services/relation http://services.collectionspace.org/relation/relations_common.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end relation service meta-data -->
     
-        <!-- begin account service meta-data -->
-        <tenant:serviceBindings id="Accounts" name="Accounts" type="security" version="0.1">
+    <!-- begin account service meta-data -->
+    <tenant:serviceBindings id="Accounts" name="Accounts" type="security" version="0.1">
             <!-- other URI paths through which this service could be accessed -->
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.account.storage.AccountDocumentHandler</service:documentHandler>
-            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
-                <service:params>
-                    <service:ListResultsFields>
-                        <service:ListResultField>
-                            <service:element>screenName</service:element>
-                            <service:xpath>screenName</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>personRefName</service:element>
-                            <service:xpath>personRefName</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>email</service:element>
-                            <service:xpath>email</service:xpath>
-                        </service:ListResultField>
-                        <service:ListResultField>
-                            <service:element>status</service:element>
-                            <service:xpath>status</service:xpath>
-                        </service:ListResultField>
-                    </service:ListResultsFields>
-                </service:params>
-            </service:DocHandlerParams>
-            <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.account.storage.AccountValidatorHandler</service:validatorHandler>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Acccount" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="accounts_system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="accounts_common" updated="" order="1">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/account" schemaLocation="http://collectionspace.org/services/account http://collectionspace.org/services/account/accounts_common.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end account service meta-data -->
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.account.storage.AccountDocumentHandler</service:documentHandler>
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:params>
+          <service:ListResultsFields>
+            <service:ListResultField>
+              <service:element>screenName</service:element>
+              <service:xpath>screenName</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>personRefName</service:element>
+              <service:xpath>personRefName</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>email</service:element>
+              <service:xpath>email</service:xpath>
+            </service:ListResultField>
+             <service:ListResultField>
+              <service:element>status</service:element>
+              <service:xpath>status</service:xpath>
+            </service:ListResultField>
+          </service:ListResultsFields>
+        </service:params>
+      </service:DocHandlerParams>
+      <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.account.storage.AccountValidatorHandler</service:validatorHandler>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Acccount" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="accounts_system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="accounts_common" updated="" order="1">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/account" schemaLocation="http://collectionspace.org/services/account http://collectionspace.org/services/account/accounts_common.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end account service meta-data -->
     
-        <!-- begin dimension service meta-data -->
-        <tenant:serviceBindings id="Dimensions" name="Dimensions" type="utility" version="0.1">
+    <!-- begin dimension service meta-data -->
+    <tenant:serviceBindings id="Dimensions" name="Dimensions" type="utility" version="0.1">
             <!-- other URI paths through which this service could be accessed -->
-            <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/dimensions/*/workflow/</service:uriPath>
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.dimension.nuxeo.DimensionDocumentModelHandler</service:documentHandler>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Dimension" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="dimensions-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="dimensions_common" updated="" order="1">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/dimension" schemaLocation="http://collectionspace.org/services/dimension http://services.collectionspace.org/dimension/dimensions_common.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end dimension service meta-data -->
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/dimensions/*/workflow/</service:uriPath>
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.dimension.nuxeo.DimensionDocumentModelHandler</service:documentHandler>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Dimension" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="dimensions-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="dimensions_common" updated="" order="1">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/dimension" schemaLocation="http://collectionspace.org/services/dimension http://services.collectionspace.org/dimension/dimensions_common.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end dimension service meta-data -->
     
-        <!-- begin contact service meta-data -->
-        <tenant:serviceBindings id="Contacts" name="Contacts" type="utility" version="0.1">
+    <!-- begin contact service meta-data -->
+    <tenant:serviceBindings id="Contacts" name="Contacts" type="utility" version="0.1">
             <!-- other URI paths through which this service could be accessed -->
             <!--
             <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /orgauthorities/*/items/*/contacts
             </service:uriPath>
             -->
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.contact.nuxeo.ContactDocumentModelHandler</service:documentHandler>
-            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
-                <service:params>
-                    <service:ListResultsFields>
-                        <service:ListResultField>
-                            <service:element>displayName</service:element>
-                            <service:xpath>displayName</service:xpath>
-                        </service:ListResultField>
-                    </service:ListResultsFields>
-                </service:params>
-            </service:DocHandlerParams>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Contact" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="contacts-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="contacts_common" updated="" order="1">
-                    <service:properties>
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.contact.nuxeo.ContactDocumentModelHandler</service:documentHandler>
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:params>
+          <service:ListResultsFields>
+            <service:ListResultField>
+              <service:element>displayName</service:element>
+              <service:xpath>displayName</service:xpath>
+            </service:ListResultField>
+           </service:ListResultsFields>
+        </service:params>
+      </service:DocHandlerParams>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Contact" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="contacts-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="contacts_common" updated="" order="1">
+          <service:properties>
                         <!-- Fields containing authority term references -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>addressGroupList/*/addressMunicipality</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>addressGroupList/*/addressStateOrProvince</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>authRef</types:key>
-                            <types:value>addressGroupList/*/addressCountry</types:value>
-                        </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+                                                       <types:value>addressGroupList/*/addressMunicipality</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+                                                       <types:value>addressGroupList/*/addressStateOrProvince</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>authRef</types:key>
+                                                       <types:value>addressGroupList/*/addressCountry</types:value>
+            </types:item>
                         <!-- Fields containing term list / controlled vocabulary references -->
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>emailGroupList/*/emailType</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+                                                       <types:value>emailGroupList/*/emailType</types:value>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>telephoneNumberGroupList/*/telephoneNumberType</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>faxNumberGroupList/*/faxNumberType</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
                             <types:value>webAddressGroupList/*/webAddressType</types:value>
-                        </types:item>
-                        <types:item xmlns:types="http://collectionspace.org/services/common/types">
-                            <types:key>termRef</types:key>
-                            <types:value>addressGroupList/*/addressType</types:value>
-                        </types:item>
-                    </service:properties>
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/contact" schemaLocation="http://collectionspace.org/services/contact http://services.collectionspace.org/contact/contacts_common.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end contact service meta-data -->
+            </types:item>
+            <types:item xmlns:types="http://collectionspace.org/services/common/types">
+              <types:key>termRef</types:key>
+                                                       <types:value>addressGroupList/*/addressType</types:value>
+            </types:item>
+          </service:properties>
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/contact" schemaLocation="http://collectionspace.org/services/contact http://services.collectionspace.org/contact/contacts_common.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end contact service meta-data -->
     
-        <!-- begin note service meta-data -->
-        <tenant:serviceBindings id="Notes" name="Notes" type="utility" version="0.1">
-            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.note.nuxeo.NoteDocumentModelHandler</service:documentHandler>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="CSNote" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="notes-system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="notes_common" updated="" order="1">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/note" schemaLocation="http://collectionspace.org/services/note http://services.collectionspace.org/note/notes_common.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
+    <!-- begin note service meta-data -->
+    <tenant:serviceBindings id="Notes" name="Notes" type="utility" version="0.1">
+      <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/notes/*/workflow/</service:uriPath>
+      <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.note.nuxeo.NoteDocumentModelHandler</service:documentHandler>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="CSNote" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="notes-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="notes_common" updated="" order="1">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/note" schemaLocation="http://collectionspace.org/services/note http://services.collectionspace.org/note/notes_common.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
     <!-- end note service meta-data -->
     
     <!-- begin role service meta-data -->
-        <tenant:serviceBindings id="authorization/roles" name="authorization/roles" type="security" version="0.1">
+    <tenant:serviceBindings id="authorization/roles" name="authorization/roles" type="security" version="0.1">
             <!-- other URI paths through which this service could be accessed -->
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.authorization.storage.RoleDocumentHandler</service:documentHandler>
-            <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.authorization.storage.RoleValidatorHandler</service:validatorHandler>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Role" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="roles_system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="roles" updated="" order="1">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/authorization" schemaLocation="http://collectionspace.org/services/authorization http://services.collectionspace.org/authorization/roles.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end role service meta-data -->
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.authorization.storage.RoleDocumentHandler</service:documentHandler>
+      <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.authorization.storage.RoleValidatorHandler</service:validatorHandler>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Role" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="roles_system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="roles" updated="" order="1">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/authorization" schemaLocation="http://collectionspace.org/services/authorization http://services.collectionspace.org/authorization/roles.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end role service meta-data -->
         
-        <!-- begin permission service meta-data -->
-        <tenant:serviceBindings id="authorization/permissions" name="authorization/permissions" type="security" version="0.1">
+    <!-- begin permission service meta-data -->
+    <tenant:serviceBindings id="authorization/permissions" name="authorization/permissions" type="security" version="0.1">
             <!-- other URI paths through which this service could be accessed -->
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.authorization.storage.PermissionDocumentHandler</service:documentHandler>
-            <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.authorization.storage.PermissionValidatorHandler</service:validatorHandler>
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Permission" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="permissions_system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="permissions" updated="" order="1">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/authorization" schemaLocation="http://collectionspace.org/services/authorization http://services.collectionspace.org/authorization/permissions.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end permission service meta-data -->
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.authorization.storage.PermissionDocumentHandler</service:documentHandler>
+      <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.authorization.storage.PermissionValidatorHandler</service:validatorHandler>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="Permission" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="permissions_system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="permissions" updated="" order="1">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/authorization" schemaLocation="http://collectionspace.org/services/authorization http://services.collectionspace.org/authorization/permissions.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end permission service meta-data -->
         
-        <!-- begin permission-role service meta-data -->
-        <!-- the following service is same as authorization/roles/permroles service -->
-        <!-- except that it is available as a sub resource of the permission service -->
-        <tenant:serviceBindings id="authorization/permissions/permroles" name="authorization/permissions/permroles" type="security" version="0.1">
+    <!-- begin permission-role service meta-data -->
+    <!-- the following service is same as authorization/roles/permroles service -->
+    <!-- except that it is available as a sub resource of the permission service -->
+    <tenant:serviceBindings id="authorization/permissions/permroles" name="authorization/permissions/permroles" type="security" version="0.1">
             <!-- other URI paths through which this service could be accessed -->
             <!--
             <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /authorization/permissions/*/permroles/
             </service:uriPath>
             -->
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.authorization.storage.PermissionRoleDocumentHandler</service:documentHandler>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.authorization.storage.PermissionRoleDocumentHandler</service:documentHandler>
             <!--
             <service:validatorHandler xmlns:service='http://collectionspace.org/services/common/service'>
                 org.collectionspace.services.authorization.storage.PermissionRoleValidatorHandler
             </service:validatorHandler>
             -->
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="PermissionRole" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="permroles_system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="permroles" updated="" order="1">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/authorization" schemaLocation="http://collectionspace.org/services/authorization http://services.collectionspace.org/authorization/permissions_roles.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end permission-role service meta-data -->
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="PermissionRole" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="permroles_system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="permroles" updated="" order="1">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/authorization" schemaLocation="http://collectionspace.org/services/authorization http://services.collectionspace.org/authorization/permissions_roles.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end permission-role service meta-data -->
     
-        <!-- begin account-role service meta-data -->
-        <tenant:serviceBindings id="accounts/accountroles" name="accounts/accountroles" type="security" version="0.1">
+    <!-- begin account-role service meta-data -->
+    <tenant:serviceBindings id="accounts/accountroles" name="accounts/accountroles" type="security" version="0.1">
             <!-- other URI paths through which this service could be accessed -->
             <!--
             <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /accounts/*/accountroles/
             </service:uriPath>
             -->
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.account.storage.AccountRoleDocumentHandler</service:documentHandler>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.account.storage.AccountRoleDocumentHandler</service:documentHandler>
             <!--
             <service:validatorHandler xmlns:service='http://collectionspace.org/services/common/service'>
                 org.collectionspace.services.account.storage.AccountRoleDocumentHandler
             </service:validatorHandler>
             -->
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="AccountRole" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="accountroles_system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="accountroles" updated="" order="1">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/authorization" schemaLocation="http://collectionspace.org/services/authorization http://services.collectionspace.org/authorization/accounts_roles.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end account-role service meta-data -->
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="AccountRole" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="accountroles_system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="accountroles" updated="" order="1">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/authorization" schemaLocation="http://collectionspace.org/services/authorization http://services.collectionspace.org/authorization/accounts_roles.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end account-role service meta-data -->
     
-        <!-- begin role-permission service meta-data -->
-        <!-- the following service is same as authorization/permissions/permroles service -->
-        <!-- except that it is available as a sub resource of the role service -->
-        <tenant:serviceBindings id="authorization/roles/permroles" name="authorization/roles/permroles" type="security" version="0.1">
+    <!-- begin role-permission service meta-data -->
+    <!-- the following service is same as authorization/permissions/permroles service -->
+    <!-- except that it is available as a sub resource of the role service -->
+    <tenant:serviceBindings id="authorization/roles/permroles" name="authorization/roles/permroles" type="security" version="0.1">
             <!-- other URI paths through which this service could be accessed -->
             <!--
             <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /authorization/roles/*/permroles/
             </service:uriPath>
             -->
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.authorization.storage.PermissionRoleDocumentHandler</service:documentHandler>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.authorization.storage.PermissionRoleDocumentHandler</service:documentHandler>
             <!--
             <service:validatorHandler xmlns:service='http://collectionspace.org/services/common/service'>
                 org.collectionspace.services.authorization.storage.PermissionRoleValidatorHandler
             </service:validatorHandler>
             -->
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="PermissionRole" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="permroles_system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="permroles" updated="" order="1">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/authorization" schemaLocation="http://collectionspace.org/services/authorization http://services.collectionspace.org/authorization/permissions_roles.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-        <!-- end role-permission service meta-data -->
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="PermissionRole" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="permroles_system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="permroles" updated="" order="1">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/authorization" schemaLocation="http://collectionspace.org/services/authorization http://services.collectionspace.org/authorization/permissions_roles.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+    <!-- end role-permission service meta-data -->
         
-        <!-- begin role-account service meta-data -->
-        <!-- the following service is same as account/accountroles service -->
-        <!-- except that it is available as a sub resource of the role service -->
-        <tenant:serviceBindings id="authorization/roles/accountroles" name="authorization/roles/accountroles" type="security" version="0.1">
+    <!-- begin role-account service meta-data -->
+    <!-- the following service is same as account/accountroles service -->
+    <!-- except that it is available as a sub resource of the role service -->
+    <tenant:serviceBindings id="authorization/roles/accountroles" name="authorization/roles/accountroles" type="security" version="0.1">
             <!-- other URI paths through which this service could be accessed -->
             <!--
             <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /authorization/roles/*/accountroles/
             </service:uriPath>
             -->
-            <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.account.storage.AccountRoleDocumentHandler</service:documentHandler>
+      <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.account.storage.AccountRoleDocumentHandler</service:documentHandler>
             <!--
             <service:validatorHandler xmlns:service='http://collectionspace.org/services/common/service'>
                 org.collectionspace.services.authorization.storage.PermissionRoleValidatorHandler
             </service:validatorHandler>
             -->
-            <service:object xmlns:service="http://collectionspace.org/services/common/service" name="AccountRole" version="0.1">
-                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="accountroles_system" updated="" order="0">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-                    </service:content>
-                </service:part>
-                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="accountroles" updated="" order="1">
-                    <service:content contentType="application/xml">
-                        <service:xmlContent namespaceURI="http://collectionspace.org/services/authorization" schemaLocation="http://collectionspace.org/services/authorization http://services.collectionspace.org/authorization/accounts_roles.xsd" />
-                    </service:content>
-                </service:part>
-            </service:object>
-        </tenant:serviceBindings>
-    </tenant:tenantBinding>
+      <service:object xmlns:service="http://collectionspace.org/services/common/service" name="AccountRole" version="0.1">
+        <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="accountroles_system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="accountroles" updated="" order="1">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/authorization" schemaLocation="http://collectionspace.org/services/authorization http://services.collectionspace.org/authorization/accounts_roles.xsd" />
+          </service:content>
+        </service:part>
+      </service:object>
+    </tenant:serviceBindings>
+  </tenant:tenantBinding>
   <!-- end prototype collectionspace.org tenant meta-data -->
   
 </tenant:TenantBindingConfig>
index 2ccf7c99d49eee049b0b096bc782a07c6199fece..0f663c42988b26377282d6941323f23fa7656795 100644 (file)
@@ -725,10 +725,14 @@ public class NuxeoImageUtils {
                        String digestAlgorithm = getFileManagerService()\r
                                        .getDigestAlgorithm(); // Need some way on initializing the\r
                                                                                        // FileManager with a call.\r
+                       \r
+                       logger.debug("Start --> Calling Nuxeo to create an image blob.");\r
                        DocumentModel documentModel = getFileManagerService()\r
                                        .createDocumentFromBlob(nuxeoSession, fileBlob,\r
                                                        blobLocation.getPathAsString(), true,\r
                                                        file.getName());\r
+                       logger.debug("Stop --> Calling Nuxeo to create an image blob.");\r
+                       \r
                        result = createBlobsCommon(documentModel, fileBlob);\r
                } catch (Exception e) {\r
                        result = null;\r
index d7ea173636a0d9c8d9045070451016d7d1a54d56..4f82e784fb4492d44a6471d29798388af58ae3a7 100644 (file)
@@ -113,6 +113,12 @@ public class Profiler {
         setStartTime(currentTime());\r
     }\r
 \r
+    private void stopTimer() {\r
+        setStopTime(currentTime());\r
+        setElapsedTime(getStopTime() - getStartTime());\r
+        addToCumulativeTime(getElapsedTime());\r
+    }\r
+    \r
     /**\r
      * Stores and logs the stop time, and the elapsed and cumulative timings\r
      * from one or more cycles of start and stop.\r
@@ -120,12 +126,8 @@ public class Profiler {
      * Logs using a default message.\r
      */\r
     public void stop() {\r
-        // FIXME: Need to store values before constructing default stop message,\r
-        // hence has some redundant code with stop(msg) below.  Perhaps can be consolidated.\r
-        setStopTime(currentTime());\r
-        setElapsedTime(elapsedTime());\r
-        addToCumulativeTime(elapsedTime());\r
-        stop(defaultStopMessage());\r
+       stopTimer();\r
+        log(defaultStopMessage());\r
     }\r
 \r
     /**\r
@@ -135,9 +137,7 @@ public class Profiler {
      * @param msg the message to log.\r
      */\r
     public void stop(String msg) {\r
-        setStopTime(currentTime());\r
-        setElapsedTime(elapsedTime());\r
-        addToCumulativeTime(elapsedTime());\r
+       stopTimer();\r
         log(msg);\r
     }\r
 \r
index b421640d8f21faf71013a51afad3399163e2947b..73838db0130a504236211b83a1669f3a067da101 100644 (file)
@@ -5,7 +5,7 @@ import java.util.List;
 import org.collectionspace.services.common.document.AbstractDocumentHandlerImpl;\r
 import org.collectionspace.services.common.document.DocumentFilter;\r
 import org.collectionspace.services.common.document.DocumentWrapper;\r
-import org.collectionspace.services.hyperjaxb.AbstractCommonList;\r
+import org.collectionspace.services.jaxb.AbstractCommonList;\r
 \r
 public abstract class JpaDocumentHandler<T, TL, WT, WLT>\r
        extends AbstractDocumentHandlerImpl<T, TL, WT, WLT>{\r
index 71ae9c1b7b8417238cde40c2f8f8e90e4bca985a..59b3348000b3679390224e1c548ba24f8cad9622 100644 (file)
@@ -131,9 +131,14 @@ public class WorkflowDocumentModelHandler
             result = TRANSITION_APPROVE;
         } else if (state.equalsIgnoreCase(WorkflowClient.WORKFLOWSTATE_PROJECT)) {
             result = TRANSITION_UNDELETE;
-        }
+        } else {
+               logger.warn("An attempt was made to transition a document to an unknown workflow state = "
+                               + state);
+        }        
+        
         return result;
     }
+    
     /*
      * Handle Update (PUT)
      */
@@ -143,8 +148,22 @@ public class WorkflowDocumentModelHandler
             ObjectPartType partMeta, Action action,
             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx)
             throws Exception {
-        WorkflowCommon workflowsCommon = (WorkflowCommon) part.getBody();
-        docModel.followTransition(getTransitionFromState(workflowsCommon.getCurrentLifeCycleState()));
+       String toState = null;
+       
+       try {
+               WorkflowCommon workflowsCommon = (WorkflowCommon) part.getBody();
+               toState = getTransitionFromState(workflowsCommon.getCurrentLifeCycleState());
+               docModel.followTransition(toState);
+       } catch (Exception e) {
+               String msg = "Unable to follow workflow transition to state = "
+                               + toState;
+               if (logger.isDebugEnabled() == true) {
+                       logger.debug(msg, e);
+               }
+               ClientException ce = new ClientException("Unable to follow workflow transition to state = "
+                               + toState);
+               throw ce;
+       }
     }
 }
 
index 05756cf1a315bb80456d09b2035d8ba010aac947..5d19581997e57369a9bb02c53be49a9442e2636f 100644 (file)
@@ -49,7 +49,6 @@
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>5.6</version>
         </dependency>
         <dependency>
             <groupId>org.jboss.resteasy</groupId>
index ee79558023f07177f3260d8980e42fd6743ce552..d5ffa928fc49cb9adbeffe35a67ce23f39be1ce6 100644 (file)
@@ -10,8 +10,8 @@ import org.jboss.resteasy.client.ClientResponse;
  * ILT - Authority item list type\r
  * P - Proxy type\r
  */\r
-public interface AuthorityWithContactsClient<P extends AuthorityProxy>\r
-       extends AuthorityClient<P> {\r
+public interface AuthorityWithContactsClient<AUTHORITY_ITEM_TYPE, P extends AuthorityProxy>\r
+       extends AuthorityClient<AUTHORITY_ITEM_TYPE, P> {\r
     /**\r
      * Creates the contact.\r
      *\r
index 9dd97a07072e328ef4a73c6db7b07484d371729d..9f55df44bc365530bfb37ac357b5777922d1bf83 100644 (file)
@@ -10,9 +10,9 @@ import org.collectionspace.services.jaxb.AbstractCommonList;
  * ILT - Authority item list type\r
  * P - Proxy type\r
  */\r
-public abstract class AuthorityWithContactsClientImpl<P extends AuthorityWithContactsProxy>\r
-       extends AuthorityClientImpl<P>\r
-       implements AuthorityWithContactsClient<P> {\r
+public abstract class AuthorityWithContactsClientImpl<AUTHORITY_ITEM_TYPE, P extends AuthorityWithContactsProxy>\r
+       extends AuthorityClientImpl<AUTHORITY_ITEM_TYPE, P>\r
+       implements AuthorityWithContactsClient<AUTHORITY_ITEM_TYPE, P> {\r
        \r
        @Override\r
     public ClientResponse<Response> createContact(String parentcsid,\r
index 2471a8e8eb026c505066e9c4d0d9c0d045e086ab..2d25618ec86671328de680ce2d1e212334c4d173 100644 (file)
@@ -21,6 +21,7 @@ package org.collectionspace.services.client;
  *
  * $LastChangedRevision: $
  * $LastChangedDate: $
+ * 
  */
 public class ContactClient extends AbstractCommonListPoxServiceClientImpl<ContactProxy> {
 
index 66629c3da4c8bc3817aae05e040284a9508fb733..2d0025aeed4852019fb82f53edb85c23828bf04b 100644 (file)
@@ -26,13 +26,13 @@ import java.util.List;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
+import org.collectionspace.services.client.AbstractCommonListUtils;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.ContactClient;
 import org.collectionspace.services.client.ContactClientUtils;
 import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
-import org.collectionspace.services.common.AbstractCommonListUtils;
 import org.collectionspace.services.contact.AddressGroup;
 import org.collectionspace.services.contact.AddressGroupList;
 import org.collectionspace.services.contact.ContactsCommon;
@@ -43,7 +43,6 @@ import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.jboss.resteasy.client.ClientResponse;
 
 import org.testng.Assert;
-import org.testng.annotations.Test;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -55,13 +54,12 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision: 917 $
  * $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri, 06 Nov 2009) $
  */
-public class ContactServiceTest extends AbstractServiceTestImpl {
+public class ContactServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonList, ContactsCommon> {
 
     private final String CLASS_NAME = ContactServiceTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(ContactServiceTest.class);
     // Instance variables specific to this test.
 //    final String SERVICE_PATH_COMPONENT = "contacts";
-    private String knownResourceId = null;
 
     @Override
     public String getServicePathComponent() {
@@ -85,7 +83,7 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-    protected AbstractCommonList getAbstractCommonList(
+    protected AbstractCommonList getCommonList(
             ClientResponse<AbstractCommonList> response) {
         return response.getEntity(AbstractCommonList.class);
     }
@@ -101,13 +99,10 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
     // CRUD tests : CREATE tests
     // ---------------------------------------------------------------
     // Success outcomes
+    
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
     public void create(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup, such as initializing the type of service request
         // (e.g. CREATE, DELETE), its valid and expected status codes, and
         // its associated HTTP method name (e.g. POST, DELETE).
@@ -131,9 +126,9 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
 
         // Store the ID returned from the first resource created
         // for additional tests below.
@@ -150,8 +145,8 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
     }
 
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"create"})
     public void createList(String testName) throws Exception {
         for (int i = 0; i < 3; i++) {
             create(testName);
@@ -269,52 +264,26 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
     // ---------------------------------------------------------------
     // Success outcomes
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"create"})
     public void read(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupRead();
 
         // Submit the request to the service and store the response.
         ContactClient client = new ContactClient();
         ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        ContactsCommon contact = (ContactsCommon) extractPart(input,
-                client.getCommonPartName(), ContactsCommon.class);
-        Assert.assertNotNull(contact);
-    }
-
-    // Failure outcomes
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
-    public void readNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadNonExistent();
-
-        // Submit the request to the service and store the response.
-        ContactClient client = new ContactClient();
-        ClientResponse<String> res = client.read(NON_EXISTENT_ID);
-        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);
+        try {
+               assertStatusCode(res, testName);
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               ContactsCommon contact = (ContactsCommon) extractPart(input,
+                       client.getCommonPartName(), ContactsCommon.class);
+               Assert.assertNotNull(contact);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
     }
 
     // ---------------------------------------------------------------
@@ -322,28 +291,29 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
     // ---------------------------------------------------------------
     // Success outcomes
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"read"})
     public void readList(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupReadList();
 
         // Submit the request to the service and store the response.
         ContactClient client = new ContactClient();
         ClientResponse<AbstractCommonList> res = client.readList();
-        assertStatusCode(res, testName);
-        AbstractCommonList list = res.getEntity();
-
-        // Optionally output additional data about list members for debugging.
-        boolean iterateThroughList = false;
-        if (iterateThroughList && logger.isDebugEnabled()) {
-            AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
+        try {
+               assertStatusCode(res, testName);
+               AbstractCommonList list = res.getEntity();
+       
+               // Optionally output additional data about list members for debugging.
+               boolean iterateThroughList = false;
+               if (iterateThroughList && logger.isDebugEnabled()) {
+                   AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
+               }
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-
     }
 
     // Failure outcomes
@@ -353,28 +323,32 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
     // ---------------------------------------------------------------
     // Success outcomes
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"read"})
     public void update(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupUpdate();
-
-        // Submit the request to the service and store the response.
+        //
+        // First read the object that will be updated
+        //
         ContactClient client = new ContactClient();
         ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("got object to update with ID: " + knownResourceId);
+        ContactsCommon contact = null;
+        try {
+               assertStatusCode(res, testName);
+               
+               if (logger.isDebugEnabled()) {
+                   logger.debug("got object to update with ID: " + knownResourceId);
+               }
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               contact = (ContactsCommon) extractPart(input,
+                       client.getCommonPartName(), ContactsCommon.class);
+               Assert.assertNotNull(contact);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        ContactsCommon contact = (ContactsCommon) extractPart(input,
-                client.getCommonPartName(), ContactsCommon.class);
-        Assert.assertNotNull(contact);
         
         if(logger.isDebugEnabled()){
             logger.debug("contact common before updating");
@@ -412,20 +386,25 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
             logger.debug("to be updated object");
             logger.debug(BaseServiceTest.objectAsXmlString(contact, ContactsCommon.class));
         }
-        
-        // Submit the request to the service and store the response.
+        //
+        // Next, send the update to the server
+        //
         PoxPayloadOut output = new PoxPayloadOut(ContactClient.SERVICE_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = output.addPart(contact, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getCommonPartName());
+        PayloadOutputPart commonPart = output.addPart(client.getCommonPartName(), contact);
 
         res = client.update(knownResourceId, output);
-        assertStatusCode(res, testName);
-
-        input = new PoxPayloadIn(res.getEntity());
-        ContactsCommon updatedContact =
-                (ContactsCommon) extractPart(input,
-                client.getCommonPartName(), ContactsCommon.class);
-        Assert.assertNotNull(updatedContact);
+        ContactsCommon updatedContact = null;
+        try {
+               assertStatusCode(res, testName);
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               updatedContact = (ContactsCommon) extractPart(input,
+                       client.getCommonPartName(), ContactsCommon.class);
+               Assert.assertNotNull(updatedContact);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
         
         if (logger.isDebugEnabled()) {
             logger.debug("object after update");
@@ -549,13 +528,9 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
     }
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"update", "testSubmitRequest"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"update", "testSubmitRequest"})
     public void updateNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupUpdateNonExistent();
 
@@ -574,9 +549,9 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
 
     // ---------------------------------------------------------------
@@ -584,13 +559,9 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
     // ---------------------------------------------------------------
     // Success outcomes
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
     public void delete(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupDelete();
 
@@ -604,20 +575,16 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
 
     // Failure outcomes
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"delete"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"delete"})
     public void deleteNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupDeleteNonExistent();
 
@@ -631,9 +598,9 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
 
     // ---------------------------------------------------------------
@@ -643,7 +610,7 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
      * Tests the code for manually submitting data that is used by several
      * of the methods above.
      */
-    @Test(dependsOnMethods = {"create", "read"})
+//    @Test(dependsOnMethods = {"create", "read"})
     public void testSubmitRequest() {
 
         // Expected status code: 200 OK
@@ -661,6 +628,39 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
                     + " status=" + statusCode);
         }
         Assert.assertEquals(statusCode, EXPECTED_STATUS);
-
     }
+    
+    @Override
+    public void readWorkflow(String testName) throws Exception {
+       // Not applicable for the Contact service
+    }
+    
+    @Override
+    public void searchWorkflowDeleted(String testName) throws Exception {
+       // Not applicable for the Contact service
+    }
+
+       @Override
+       protected PoxPayloadOut createInstance(String commonPartName,
+                       String identifier) {
+               return ContactClientUtils.createContactInstance(identifier, commonPartName);
+       }
+
+       @Override
+       protected ContactsCommon updateInstance(ContactsCommon commonPartObject) {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       protected void compareUpdatedInstances(ContactsCommon original,
+                       ContactsCommon updated) throws Exception {
+               // TODO Auto-generated method stub
+               
+       }
+       
+       @Override
+       public void CRUDTests(String testName) {
+               // TODO Auto-generated method stub              
+       }
 }
index 327f534c171035b8413b42aa0778b594970b5e1d..c7a414cc2ba78344dd675dbd1e5af3d1b22c4d9f 100644 (file)
@@ -38,7 +38,6 @@
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>5.6</version>
         </dependency>        
 
       <!-- javax -->
index cac291a85015e0e6ae5e43e0851c4237ffae0d67..f10ab8f0cccdd98659018877bb70ef7e3e06583d 100644 (file)
@@ -10,7 +10,6 @@
     </parent>\r
 \r
     <modelVersion>4.0.0</modelVersion>\r
-    <groupId>org.collectionspace.services</groupId>\r
     <artifactId>org.collectionspace.services.dimension.client</artifactId>\r
     <name>services.dimension.client</name>\r
     \r
@@ -51,7 +50,7 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
+            <scope>test</scope>\r
         </dependency>\r
         <dependency>\r
             <groupId>org.jboss.resteasy</groupId>\r
index e65cee3632750e91482542a01e0cc4ed7587a751..92c04129573465c054f8ea501db6dd11281b3ec0 100644 (file)
@@ -36,7 +36,7 @@ import org.jboss.resteasy.client.ClientResponse;
  */
 public class DimensionClient extends AbstractPoxServiceClientImpl<DimensionsCommonList, DimensionProxy> {
        public static final String SERVICE_NAME = "dimensions";
-       public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;       
+       public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;
        public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
        public static final String SERVICE_PATH_PROXY = SERVICE_PATH + "/";     
        public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME;
index 1e5c6a5dd99e1d9379776465434590aa811f0fa1..f8d729dc97aaf7bf500db047337677e7bee11be4 100644 (file)
@@ -20,8 +20,8 @@ public interface DimensionProxy extends CollectionSpacePoxProxy<DimensionsCommon
     @GET
     @Produces({"application/xml"})
     ClientResponse<DimensionsCommonList> readList();
-    
-    @Override
+
+       @Override
        @GET
     @Produces({"application/xml"})
     ClientResponse<DimensionsCommonList> readIncludeDeleted(
index 75e8a5fe10686f0326519a1f6bde1b882663e567..b7c8b226626f23f5e234ca531475775de6dc7677 100644 (file)
@@ -25,23 +25,13 @@ package org.collectionspace.services.client.test;
 //import java.util.ArrayList;
 import java.math.BigDecimal;
 import java.util.List;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
 
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.DimensionClient;
 import org.collectionspace.services.client.DimensionFactory;
-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.workflow.WorkflowClient;
 import org.collectionspace.services.dimension.DimensionsCommon;
 import org.collectionspace.services.dimension.DimensionsCommonList;
-import org.collectionspace.services.jaxb.AbstractCommonList;
-import org.collectionspace.services.workflow.WorkflowCommon;
-
-import org.jboss.resteasy.client.ClientResponse;
 
 import org.testng.Assert;
 //import org.testng.annotations.AfterClass;
@@ -57,7 +47,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision: 917 $
  * $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri, 06 Nov 2009) $
  */
-public class DimensionServiceTest extends AbstractServiceTestImpl {
+public class DimensionServiceTest extends AbstractPoxServiceTestImpl<DimensionsCommonList, DimensionsCommon> {
 
     /** The logger. */
     private final String CLASS_NAME = DimensionServiceTest.class.getName();
@@ -65,10 +55,13 @@ public class DimensionServiceTest extends AbstractServiceTestImpl {
 
     // Instance variables specific to this test.
     /** The SERVIC e_ pat h_ component. */
-    /** The known resource id. */
-    private String knownResourceId = null;
     private final String DIMENSION_VALUE = "78.306";
 
+    @Override
+    protected Logger getLogger() {
+        return this.logger;
+    }
+    
        @Override
        protected String getServiceName() {
                return DimensionClient.SERVICE_NAME;
@@ -82,109 +75,176 @@ public class DimensionServiceTest extends AbstractServiceTestImpl {
         return new DimensionClient();
     }
 
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
-     */
     @Override
-    protected AbstractCommonList getAbstractCommonList(
-            ClientResponse<AbstractCommonList> response) {
-        return response.getEntity(DimensionsCommonList.class);
+    protected Class<DimensionsCommonList> getCommonListType() {
+       return DimensionsCommonList.class;
     }
 
+    /*
+     * This method gets called by the parent's method public void readList(String testName)
+     */
+    protected void printList(String testName, DimensionsCommonList list) {
+        // Optionally output additional data about list members for debugging.
+        boolean iterateThroughList = false;
+        if (iterateThroughList && logger.isDebugEnabled()) {
+            List<DimensionsCommonList.DimensionListItem> items =
+                    list.getDimensionListItem();
+            int i = 0;
+            for (DimensionsCommonList.DimensionListItem item : items) {
+                logger.debug(testName + ": list-item[" + i + "] csid="
+                        + item.getCsid());
+                logger.debug(testName + ": list-item[" + i + "] objectNumber="
+                        + item.getDimension());
+                logger.debug(testName + ": list-item[" + i + "] URI="
+                        + item.getUri());
+                i++;
+            }
+        }
+    }
+    
+    protected void compareInstances(DimensionsCommon original, DimensionsCommon updated) throws Exception {
+        Assert.assertEquals(original.getValueDate(),
+                       updated.getValueDate(),
+                "Data in updated object did not match submitted data.");
+    }
+    
+    @Override
+    protected DimensionsCommon updateInstance(DimensionsCommon dimensionsCommon) {
+       DimensionsCommon result = new DimensionsCommon();
+        
+       // Update the content of this resource.
+       result.setValue(dimensionsCommon.getValue().multiply(new BigDecimal("2.0")));
+       result.setValueDate("updated-" + dimensionsCommon.getValueDate());
+        
+        return result;
+    }
+    
     // ---------------------------------------------------------------
-    // CRUD tests : CREATE tests
+    // Utility methods used by tests above
     // ---------------------------------------------------------------
-    // Success outcomes
     /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
+     * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
-    public void create(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup, such as initializing the type of service request
-        // (e.g. CREATE, DELETE), its valid and expected status codes, and
-        // its associated HTTP method name (e.g. POST, DELETE).
-        setupCreate();
+    public String getServicePathComponent() {
+        return DimensionClient.SERVICE_PATH_COMPONENT;
+    }
 
-        // Submit the request to the service and store the response.
-        DimensionClient client = new DimensionClient();
-        String identifier = createIdentifier();
-        PoxPayloadOut multipart = createDimensionInstance(client.getCommonPartName(),
-                identifier);
-        ClientResponse<Response> res = client.create(multipart);
+    @Override
+    protected PoxPayloadOut createInstance(String identifier) {
+       DimensionClient client = new DimensionClient();
+       return createInstance(client.getCommonPartName(), identifier);
+    }
+    
+    /**
+     * Creates the dimension instance.
+     *
+     * @param identifier the identifier
+     * @return the multipart output
+     */
+    @Override
+    protected PoxPayloadOut createInstance(String commonPartName, String identifier) {
+        return createDimensionInstance(commonPartName, 
+                "dimensionType-" + identifier,
+                DIMENSION_VALUE,
+                "entryDate-" + identifier);
+    }
 
-        int statusCode = res.getStatus();
+    /**
+     * Creates the dimension instance.
+     *
+     * @param dimensionType the dimension type
+     * @param entryNumber the entry number
+     * @param entryDate the entry date
+     * @return the multipart output
+     */
+    private PoxPayloadOut createDimensionInstance(String commonPartName, String dimensionType, String dimensionValue, String entryDate) {
+        DimensionsCommon dimensionsCommon = new DimensionsCommon();
+        dimensionsCommon.setDimension(dimensionType);
+        dimensionsCommon.setValue(new BigDecimal(dimensionValue));
+        dimensionsCommon.setValueDate(entryDate);
+        PoxPayloadOut multipart = DimensionFactory.createDimensionInstance(
+                commonPartName, dimensionsCommon);
 
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        //
-        // Specifically:
-        // Does it fall within the set of valid status codes?
-        // Does it exactly match the expected status code?
         if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": status = " + statusCode);
-        }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
-        // Store the ID returned from the first resource created
-        // for additional tests below.
-        if (knownResourceId == null) {
-            knownResourceId = extractId(res);
-            if (logger.isDebugEnabled()) {
-                logger.debug(testName + ": knownResourceId=" + knownResourceId);
-            }
+            logger.debug("to be created, dimension common");
+            logger.debug(objectAsXmlString(dimensionsCommon,
+                    DimensionsCommon.class));
         }
 
-        // Store the IDs from every resource created by tests,
-        // so they can be deleted after tests have been run.
-        allResourceIdsCreated.add(extractId(res));
+        return multipart;
     }
+           
+    // Placeholders until the three tests below can be uncommented.
+    // See Issue CSPACE-401.
 
     /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
+     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
-    public void createList(String testName) throws Exception {
-        for (int i = 0; i < 3; i++) {
-            create(testName);
-        }
+    public void createWithMalformedXml(String testName) throws Exception {
+        //Should this really be empty?
     }
 
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
     /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
+     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
      */
     @Override
-    public void createWithEmptyEntityBody(String testName) throws Exception {
+    public void createWithWrongXmlSchema(String testName) throws Exception {
+        //Should this really be empty?
+    }
+    
+       @Override
+       public void createWithEmptyEntityBody(String testName) throws Exception {
+       //FIXME: Should this test really be empty?
+       }
+    @Override
+    public void updateWithEmptyEntityBody(String testName) throws Exception {
         //Should this really be empty?
     }
 
     /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
+     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
      */
     @Override
-    public void createWithMalformedXml(String testName) throws Exception {
+    public void updateWithMalformedXml(String testName) throws Exception {
         //Should this really be empty?
     }
 
     /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
+     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
      */
     @Override
-    public void createWithWrongXmlSchema(String testName) throws Exception {
+    public void updateWithWrongXmlSchema(String testName) throws Exception {
         //Should this really be empty?
     }
 
+       @Override
+       protected void compareUpdatedInstances(DimensionsCommon original,
+                       DimensionsCommon updated) throws Exception {
+               //Check the dimension value to see if the update happened correctly
+               BigDecimal expectedValue = original.getValue();
+               BigDecimal actualValue = updated.getValue();
+               Assert.assertTrue(actualValue.compareTo(expectedValue) == 0);
+               
+               //Next, check the date value to see if it was updated
+               String expectedDate = original.getValueDate();
+               String actualDate = updated.getValueDate();
+               Assert.assertEquals(actualDate, expectedDate);
+       }
+
+    /*
+     * For convenience and terseness, this test method is the base of the test execution dependency chain.  Other test methods may
+     * refer to this method in their @Test annotation declarations.
+     */
+    @Override
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {
+                       "org.collectionspace.services.client.test.AbstractServiceTestImpl.baseCRUDTests"})    
+    public void CRUDTests(String testName) {
+       // Do nothing.  Simply here to for a TestNG execution order for our tests
+    }  
+
     /*
     @Override
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
@@ -272,201 +332,7 @@ public class DimensionServiceTest extends AbstractServiceTestImpl {
         invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
     }
-     */
-    // ---------------------------------------------------------------
-    // CRUD tests : READ tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
-    public void read(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupRead();
-
-        // Submit the request to the service and store the response.
-        DimensionClient client = new DimensionClient();
-        ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
-        DimensionsCommon dimensionsCommon = null;
-        if (payloadInputPart != null) {
-               dimensionsCommon = (DimensionsCommon) payloadInputPart.getBody();
-        }
-        Assert.assertNotNull(dimensionsCommon);
-    }
-
-    // Failure outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
-    public void readNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadNonExistent();
-
-        // Submit the request to the service and store the response.
-        DimensionClient client = new DimensionClient();
-        ClientResponse<String> res = client.read(NON_EXISTENT_ID);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    // ---------------------------------------------------------------
-    // CRUD tests : READ_LIST tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
-    public void readList(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadList();
-
-        // Submit the request to the service and store the response.
-        DimensionClient client = new DimensionClient();
-        ClientResponse<DimensionsCommonList> res = client.readList();
-        assertStatusCode(res, testName);
-        DimensionsCommonList list = res.getEntity();
-
-        // Optionally output additional data about list members for debugging.
-        boolean iterateThroughList = false;
-        if (iterateThroughList && logger.isDebugEnabled()) {
-            List<DimensionsCommonList.DimensionListItem> items =
-                    list.getDimensionListItem();
-            int i = 0;
-            for (DimensionsCommonList.DimensionListItem item : items) {
-                logger.debug(testName + ": list-item[" + i + "] csid="
-                        + item.getCsid());
-                logger.debug(testName + ": list-item[" + i + "] objectNumber="
-                        + item.getDimension());
-                logger.debug(testName + ": list-item[" + i + "] URI="
-                        + item.getUri());
-                i++;
-            }
-        }
-
-    }
-
-    // Failure outcomes
-    // None at present.
-    // ---------------------------------------------------------------
-    // CRUD tests : UPDATE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
-    public void update(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdate();
-
-        // Retrieve the contents of a resource to update.
-        DimensionClient client = new DimensionClient();
-        ClientResponse<String> res =
-                client.read(knownResourceId);
-        assertStatusCode(res, testName);
-        if (logger.isDebugEnabled()) {
-            logger.debug("got object to update with ID: " + knownResourceId);
-        }
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
-        DimensionsCommon dimensionsCommon = null;
-        if (payloadInputPart != null) {
-               dimensionsCommon = (DimensionsCommon) payloadInputPart.getBody();
-        }
-        Assert.assertNotNull(dimensionsCommon);
-
-        // Update the content of this resource.
-        dimensionsCommon.setValue(dimensionsCommon.getValue().multiply(new BigDecimal("2.0")));
-        dimensionsCommon.setValueDate("updated-" + dimensionsCommon.getValueDate());
-        if (logger.isDebugEnabled()) {
-            logger.debug("to be updated object");
-            logger.debug(objectAsXmlString(dimensionsCommon, DimensionsCommon.class));
-        }
-        // Submit the request to the service and store the response.
-        PoxPayloadOut output = new PoxPayloadOut(this.getServicePathComponent());
-        PayloadOutputPart commonPart = output.addPart(dimensionsCommon, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getCommonPartName());
-
-        res = client.update(knownResourceId, output);
-        int statusCode = res.getStatus();
-        assertStatusCode(res, testName);
-        input = new PoxPayloadIn(res.getEntity());
-        DimensionsCommon updatedDimensionsCommon =
-                (DimensionsCommon) extractPart(input,
-                client.getCommonPartName(), DimensionsCommon.class);
-        Assert.assertNotNull(updatedDimensionsCommon);
-
-        Assert.assertEquals(updatedDimensionsCommon.getValueDate(),
-                dimensionsCommon.getValueDate(),
-                "Data in updated object did not match submitted data.");
-
-    }
-
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
-     */
-    @Override
-    public void updateWithEmptyEntityBody(String testName) throws Exception {
-        //Should this really be empty?
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
-     */
-    @Override
-    public void updateWithMalformedXml(String testName) throws Exception {
-        //Should this really be empty?
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
-     */
-    @Override
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
-        //Should this really be empty?
-    }
-
+*/    
     /*
     @Override
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
@@ -554,282 +420,5 @@ public class DimensionServiceTest extends AbstractServiceTestImpl {
         invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
     }
-     */
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"update", "testSubmitRequest"})
-    public void updateNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdateNonExistent();
-
-        // Submit the request to the service and store the response.
-        // Note: The ID used in this 'create' call may be arbitrary.
-        // The only relevant ID may be the one used in update(), below.
-        DimensionClient client = new DimensionClient();
-        PoxPayloadOut multipart = createDimensionInstance(client.getCommonPartName(),
-                NON_EXISTENT_ID);
-        ClientResponse<String> res =
-                client.update(NON_EXISTENT_ID, multipart);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    // ---------------------------------------------------------------
-    // CRUD tests : DELETE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create", "readList", "testSubmitRequest", "update", "readWorkflow"})
-    public void delete(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDelete();
-
-        // Submit the request to the service and store the response.
-        DimensionClient client = new DimensionClient();
-        ClientResponse<Response> res = client.delete(knownResourceId);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    // Failure outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"delete"})
-    public void deleteNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDeleteNonExistent();
-
-        // Submit the request to the service and store the response.
-        DimensionClient client = new DimensionClient();
-        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-    
-    // ---------------------------------------------------------------
-    // Search tests
-    // ---------------------------------------------------------------
-    
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
-    public void searchWorkflowDeleted(String testName) throws Exception {
-        // Fixme: null test for now, overriding test in base class
-    }
-
-    // ---------------------------------------------------------------
-    // Utility tests : tests of code used in tests above
-    // ---------------------------------------------------------------
-    /**
-     * Tests the code for manually submitting data that is used by several
-     * of the methods above.
-     */
-    @Test(dependsOnMethods = {"create", "read"})
-    public void testSubmitRequest() {
-
-        // Expected status code: 200 OK
-        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
-
-        // Submit the request to the service and store the response.
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getResourceURL(knownResourceId);
-        int statusCode = submitRequest(method, url);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug("testSubmitRequest: url=" + url
-                    + " status=" + statusCode);
-        }
-        Assert.assertEquals(statusCode, EXPECTED_STATUS);
-
-    }
-
-    // ---------------------------------------------------------------
-    // Utility methods used by tests above
-    // ---------------------------------------------------------------
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
-     */
-    @Override
-    public String getServicePathComponent() {
-        return DimensionClient.SERVICE_PATH_COMPONENT;
-    }
-
-    @Override
-    protected PoxPayloadOut createInstance(String identifier) {
-       DimensionClient client = new DimensionClient();
-       return createDimensionInstance(client.getCommonPartName(), identifier);
-    }
-    
-    /**
-     * Creates the dimension instance.
-     *
-     * @param identifier the identifier
-     * @return the multipart output
-     */
-    private PoxPayloadOut createDimensionInstance(String commonPartName, String identifier) {
-        return createDimensionInstance(commonPartName, 
-                "dimensionType-" + identifier,
-                DIMENSION_VALUE,
-                "entryDate-" + identifier);
-    }
-
-    /**
-     * Creates the dimension instance.
-     *
-     * @param dimensionType the dimension type
-     * @param entryNumber the entry number
-     * @param entryDate the entry date
-     * @return the multipart output
-     */
-    private PoxPayloadOut createDimensionInstance(String commonPartName, String dimensionType, String dimensionValue, String entryDate) {
-        DimensionsCommon dimensionsCommon = new DimensionsCommon();
-        dimensionsCommon.setDimension(dimensionType);
-        dimensionsCommon.setValue(new BigDecimal(dimensionValue));
-        dimensionsCommon.setValueDate(entryDate);
-        PoxPayloadOut multipart = DimensionFactory.createDimensionInstance(
-                commonPartName, dimensionsCommon);
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("to be created, dimension common");
-            logger.debug(objectAsXmlString(dimensionsCommon,
-                    DimensionsCommon.class));
-        }
-
-        return multipart;
-    }
-       
-//     @Override
-//    protected String createTestObject(String testName) throws Exception {
-//             String result = null;
-//             
-//        DimensionClient client = new DimensionClient();
-//        String identifier = createIdentifier();
-//        PoxPayloadOut multipart = createDimensionInstance(client.getCommonPartName(),
-//                identifier);
-//        ClientResponse<Response> res = client.create(multipart);
-//
-//        int statusCode = res.getStatus();
-//        Assert.assertEquals(statusCode, STATUS_CREATED);
-//
-//        result = extractId(res);
-//        allResourceIdsCreated.add(result);
-//
-//        return result;
-//     }
-       
-//     /*
-//      * This test assumes that no objects exist yet.
-//      * 
-//      * http://localhost:8180/cspace-services/intakes?wf_deleted=false
-//      */
-//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"update"})
-//     public void readWorkflowList(String testName) throws Exception {
-//     //
-//     // Create 3 new objects
-//     //
-//     final int OBJECTS_TOTAL = 3;
-//     for (int i = 0; i < OBJECTS_TOTAL; i++) {
-//             this.createWorkflowTarget(testName);
-//     }
-//     //
-//     // Mark one as soft deleted
-//     //
-//     int currentTotal = allResourceIdsCreated.size();
-//     String csid = allResourceIdsCreated.get(currentTotal - 1); //0-based index to get the last one added
-//     this.setupUpdate();
-//     this.updateLifeCycleState(testName, csid, WorkflowClient.WORKFLOWSTATE_DELETED);
-//     //
-//     // Read the list back.  The deleted item should not be in the list
-//     //
-////           int updatedTotal = readIncludeDeleted(testName, Boolean.FALSE);
-////           Assert.assertEquals(updatedTotal, currentTotal - 1, "Deleted items seem to be returned in list results.");
-//     }
-    
-    protected void updateLifeCycleState(String testName, String resourceId, String lifeCycleState) throws Exception {
-        //
-        // Read the existing object
-        //
-        DimensionClient client = new DimensionClient();
-        ClientResponse<String> res = client.getWorkflow(resourceId);
-        assertStatusCode(res, testName);
-        logger.debug("Got object to update life cycle state with ID: " + resourceId);
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        WorkflowCommon workflowCommons = (WorkflowCommon) extractPart(input, WorkflowClient.SERVICE_COMMONPART_NAME, WorkflowCommon.class);
-        Assert.assertNotNull(workflowCommons);
-        //
-        // Mark it for a soft delete.
-        //
-        logger.debug("Current workflow state:" + objectAsXmlString(workflowCommons, WorkflowCommon.class));
-        workflowCommons.setCurrentLifeCycleState(lifeCycleState);
-        PoxPayloadOut output = new PoxPayloadOut(WorkflowClient.SERVICE_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = output.addPart(workflowCommons, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(WorkflowClient.SERVICE_COMMONPART_NAME);
-        //
-        // Perform the update
-        //
-        res = client.updateWorkflow(resourceId, output);
-        assertStatusCode(res, testName);
-        input = new PoxPayloadIn(res.getEntity());
-        WorkflowCommon updatedWorkflowCommons = (WorkflowCommon) extractPart(input, WorkflowClient.SERVICE_COMMONPART_NAME, WorkflowCommon.class);
-        Assert.assertNotNull(updatedWorkflowCommons);
-        //
-        // Read the updated object and make sure it was updated correctly.
-        //
-        res = client.getWorkflow(resourceId);
-        assertStatusCode(res, testName);
-        logger.debug("Got workflow state of updated object with ID: " + resourceId);
-        input = new PoxPayloadIn(res.getEntity());
-        updatedWorkflowCommons = (WorkflowCommon) extractPart(input, WorkflowClient.SERVICE_COMMONPART_NAME, WorkflowCommon.class);
-        Assert.assertNotNull(workflowCommons);
-        Assert.assertEquals(updatedWorkflowCommons.getCurrentLifeCycleState(), lifeCycleState);
-    }
-    
+*/
 }
index d2925bdc5c60690326b7fe3152b8d28afad8d98a..3bbba1b9064a0170676cf553dea23f9f11b19c12 100644 (file)
@@ -10,7 +10,6 @@
     </parent>
 
     <modelVersion>4.0.0</modelVersion>
-    <groupId>org.collectionspace.services</groupId>
     <artifactId>org.collectionspace.services.dimension.jaxb</artifactId>
     <name>services.dimension.jaxb</name>
 
             <artifactId>org.collectionspace.services.jaxb</artifactId>
             <version>${project.version}</version>
         </dependency>        
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.hyperjaxb</artifactId>
+            <version>${project.version}</version>
+        </dependency>
     </dependencies>
     
     <build>
index a23171c4169638d0aa65ddb8d5c3e8762c64d194..fd46cf25d658b94f927ebdcd9119be5c84ac35f0 100644 (file)
@@ -13,8 +13,8 @@
 
 <xs:schema 
   xmlns:xs="http://www.w3.org/2001/XMLSchema"
-  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
-  jaxb:version="1.0" elementFormDefault="unqualified"
+  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0"
+  elementFormDefault="unqualified"
   xmlns:ns="http://collectionspace.org/services/dimension"
   xmlns="http://collectionspace.org/services/dimension"
   targetNamespace="http://collectionspace.org/services/dimension"
                                     <xs:element name="dimension" type="xs:string"
                                         minOccurs="1" />
                                     <!-- uri to retrive dimension details -->
-                                    <xs:element name="uri" type="xs:anyURI"
-                                        minOccurs="1" />
-                                    <xs:element name="csid" type="xs:string"
-                                        minOccurs="1" />
+                                    <xs:element name="uri" type="xs:anyURI" minOccurs="1" />
+                                    <xs:element name="csid" type="xs:string" minOccurs="1" />
                                 </xs:sequence>
                             </xs:complexType>
                         </xs:element>
index bf90df9588c5d5d3593bfea3ff4ff5966d1aef7c..b1097c2c9c67d05bbe23124cd8a21c35b2e796f2 100644 (file)
@@ -9,7 +9,6 @@
     </parent>\r
 \r
     <modelVersion>4.0.0</modelVersion>\r
-    <groupId>org.collectionspace.services</groupId>\r
     <artifactId>org.collectionspace.services.dimension</artifactId>\r
     <name>services.dimension</name>\r
     <packaging>pom</packaging>\r
index a5cec6693875c7e0ec3341244fa8611d111a700a..39787294ba52413a9218ee00b6e1caf66c716ac2 100644 (file)
@@ -45,7 +45,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>\r
         \r
       <!-- javax -->\r
index 729c4e91c10596bdd388fe9fe5a752ee00b0aa0c..a4ae3bdff00731f206da5fbde453b98c9c293095 100644 (file)
@@ -62,7 +62,6 @@
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>5.6</version>
         </dependency>
         <dependency>
             <groupId>org.jboss.resteasy</groupId>
index fce1d34043f22263935d0de92e93e8ab2df6459d..1c820eef30026c1481a4587a6afe72a6a2459a05 100644 (file)
@@ -24,6 +24,7 @@ package org.collectionspace.services.client;
  *
  */
 public class GroupClient extends AbstractCommonListPoxServiceClientImpl<GroupProxy> {
+       
        public static final String SERVICE_NAME = "groups";
        public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;       
        public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
@@ -42,8 +43,6 @@ public class GroupClient extends AbstractCommonListPoxServiceClientImpl<GroupPro
 
        @Override
        public Class<GroupProxy> getProxyClass() {
-               // TODO Auto-generated method stub
                return GroupProxy.class;
        }
-
 }
index 216ee7e7880fa4c1b6924a1675ae81d4e003aef7..2acd4f4c6d39f63909f8772ff54f0f5d48007b81 100644 (file)
  */
 package org.collectionspace.services.client.test;
 
-import java.util.List;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
+import org.collectionspace.services.client.AbstractCommonListUtils;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.GroupClient;
 import org.collectionspace.services.client.GroupProxy;
 import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
-import org.collectionspace.services.common.AbstractCommonListUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.group.GroupsCommon;
 
@@ -49,7 +48,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision:  $
  * $LastChangedDate:  $
  */
-public class GroupServiceTest extends AbstractServiceTestImpl {
+public class GroupServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonList, GroupsCommon> {
 
     private final String CLASS_NAME = GroupServiceTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
@@ -67,183 +66,15 @@ public class GroupServiceTest extends AbstractServiceTestImpl {
        }
     
     @Override
-    protected CollectionSpaceClient<AbstractCommonList, GroupProxy> getClientInstance() {
+    protected CollectionSpaceClient<AbstractCommonList, PoxPayloadOut, String, GroupProxy> getClientInstance() {
         return new GroupClient();
     }
 
     @Override
-    protected AbstractCommonList getAbstractCommonList(ClientResponse<AbstractCommonList> response) {
+    protected AbstractCommonList getCommonList(ClientResponse<AbstractCommonList> response) {
         return response.getEntity(AbstractCommonList.class);
     }
 
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
-    public void create(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupCreate();
-        GroupClient client = new GroupClient();
-        PoxPayloadOut multipart = createGroupInstance(createIdentifier());
-        ClientResponse<Response> res = client.create(multipart);
-        assertStatusCode(res, testName);
-        if (knownResourceId == null) {
-            knownResourceId = extractId(res);  // Store the ID returned from the first resource created for additional tests below.
-            logger.debug(testName + ": knownResourceId=" + knownResourceId);
-        }
-        allResourceIdsCreated.add(extractId(res)); // Store the IDs from every resource created by tests so they can be deleted after tests have been run.
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create"})
-    public void createList(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        for (int i = 0; i < 3; i++) {
-            create(testName);
-        }
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create"})
-    public void read(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupRead();
-        GroupClient client = new GroupClient();
-        ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        GroupsCommon group = (GroupsCommon) extractPart(input, client.getCommonPartName(), GroupsCommon.class);
-        Assert.assertNotNull(group);
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"createList", "read"})
-    public void readList(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupReadList();
-        GroupClient client = new GroupClient();
-        ClientResponse<AbstractCommonList> res = client.readList();
-        assertStatusCode(res, testName);
-        AbstractCommonList list = res.getEntity();
-        if(logger.isTraceEnabled()){
-               AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
-        }
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"read"})
-    public void update(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupUpdate();
-        GroupClient client = new GroupClient();
-        ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-        logger.debug("got object to update with ID: " + knownResourceId);
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        GroupsCommon group = (GroupsCommon) extractPart(input, client.getCommonPartName(), GroupsCommon.class);
-        Assert.assertNotNull(group);
-
-        group.setTitle("updated-" + group.getTitle());
-        logger.debug("Object to be updated:"+objectAsXmlString(group, GroupsCommon.class));
-        PoxPayloadOut output = new PoxPayloadOut(GroupClient.SERVICE_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = output.addPart(group, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getCommonPartName());
-        res = client.update(knownResourceId, output);
-        assertStatusCode(res, testName);
-        input = new PoxPayloadIn(res.getEntity());
-        GroupsCommon updatedGroup = (GroupsCommon) extractPart(input, client.getCommonPartName(), GroupsCommon.class);
-        Assert.assertNotNull(updatedGroup);
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"update", "testSubmitRequest"})
-    public void updateNonExistent(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupUpdateNonExistent();
-        // Submit the request to the service and store the response.
-        // Note: The ID used in this 'create' call may be arbitrary.
-        // The only relevant ID may be the one used in update(), below.
-        GroupClient client = new GroupClient();
-        PoxPayloadOut multipart = createGroupInstance(NON_EXISTENT_ID);
-        ClientResponse<String> res = client.update(NON_EXISTENT_ID, multipart);
-        assertStatusCode(res, testName);
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
-    public void delete(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupDelete();
-        GroupClient client = new GroupClient();
-        ClientResponse<Response> res = client.delete(knownResourceId);
-        assertStatusCode(res, testName);
-    }
-
-    // ---------------------------------------------------------------
-    // Failure outcome tests : means we expect response to fail, but test to succeed
-    // ---------------------------------------------------------------
-
-    // Failure outcome
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"read"})
-    public void readNonExistent(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupReadNonExistent();
-        GroupClient client = new GroupClient();
-        ClientResponse<String> res = client.read(NON_EXISTENT_ID);
-        assertStatusCode(res, testName);
-    }
-
-    // Failure outcome
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"delete"})
-    public void deleteNonExistent(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupDeleteNonExistent();
-        GroupClient client = new GroupClient();
-        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
-        assertStatusCode(res, testName);
-    }
-
-    // Failure outcomes
-    // Placeholders until the tests below can be implemented. See Issue CSPACE-401.
-
-    @Override
-    public void createWithEmptyEntityBody(String testName) throws Exception {
-    }
-
-    @Override
-    public void createWithMalformedXml(String testName) throws Exception {
-    }
-
-    @Override
-    public void createWithWrongXmlSchema(String testName) throws Exception {
-    }
-
-    @Override
-    public void updateWithEmptyEntityBody(String testName) throws Exception {
-    }
-
-    @Override
-    public void updateWithMalformedXml(String testName) throws Exception {
-    }
-
-    @Override
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
-    }
-
-    // ---------------------------------------------------------------
-    // Utility tests : tests of code used in tests above
-    // ---------------------------------------------------------------
-
-    @Test(dependsOnMethods = {"create", "read"})
-    public void testSubmitRequest() {
-        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode(); // Expected status code: 200 OK
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getResourceURL(knownResourceId);
-        int statusCode = submitRequest(method, url);
-        logger.debug("testSubmitRequest: url=" + url + " status=" + statusCode);
-        Assert.assertEquals(statusCode, EXPECTED_STATUS);
-    }
-
     // ---------------------------------------------------------------
     // Utility methods used by tests above
     // ---------------------------------------------------------------
@@ -251,9 +82,15 @@ public class GroupServiceTest extends AbstractServiceTestImpl {
     @Override
     protected PoxPayloadOut createInstance(String identifier) {
        GroupClient client = new GroupClient();
-       return createGroupInstance(identifier);
+       return createInstance(client.getCommonPartName(), identifier);
     }
     
+       @Override
+       protected PoxPayloadOut createInstance(String commonPartName,
+                       String identifier) {
+               return createGroupInstance(identifier);
+       }
+    
     private PoxPayloadOut createGroupInstance(String uid) {
         String identifier = "title-" + uid;
         GroupsCommon group = new GroupsCommon();
@@ -270,4 +107,25 @@ public class GroupServiceTest extends AbstractServiceTestImpl {
 
         return multipart;
     }
+
+       @Override
+       public void CRUDTests(String testName) {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       protected GroupsCommon updateInstance(GroupsCommon groupsCommon) {
+               GroupsCommon result = new GroupsCommon();
+               
+        result.setTitle("updated-" + groupsCommon.getTitle());
+               
+               return result;
+       }
+
+       @Override
+       protected void compareUpdatedInstances(GroupsCommon original,
+                       GroupsCommon updated) throws Exception {
+               Assert.assertEquals(updated.getTitle(), original.getTitle());
+       }
 }
index d92827f979230f82e7fe7eee8decee8b7dc7daf4..a3464eea70fd71448ac97ccf3ecc68b7e0c49582 100644 (file)
@@ -44,7 +44,6 @@
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>5.6</version>
         </dependency>
         
       <!-- javax -->
diff --git a/services/hyperjaxb/src/main/resources/AbstractCommonList.xsd b/services/hyperjaxb/src/main/resources/AbstractCommonList.xsd
deleted file mode 100644 (file)
index b5906a8..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
-\r
-<!--\r
-    $LastChangedRevision: 1341 $\r
-    $LastChangedDate: 2010-02-15 22:01:55 -0800 (Mon, 15 Feb 2010) $\r
--->\r
-\r
-<xs:schema \r
-    xmlns:xs="http://www.w3.org/2001/XMLSchema"\r
-    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0"\r
-    xmlns:hj="http://hyperjaxb3.jvnet.org/ejb/schemas/customizations"\r
-    xmlns:ns="http://collectionspace.org/services/hyperjaxb"\r
-    xmlns="http://collectionspace.org/services/hyperjaxb"\r
-    targetNamespace="http://collectionspace.org/services/hyperjaxb"\r
-    jaxb:extensionBindingPrefixes="hj"\r
-    version="0.9">\r
-    \r
-       <xs:annotation>\r
-               <xs:appinfo>\r
-                       <jaxb:globalBindings generateIsSetMethod="true" localScoping="toplevel">\r
-                               <jaxb:serializable/>\r
-                       </jaxb:globalBindings>\r
-               </xs:appinfo>\r
-       </xs:annotation>\r
-           \r
-    <xs:element name="abstract-common-list">\r
-        <xs:complexType>\r
-            <xs:annotation>\r
-                <xs:documentation>\r
-                </xs:documentation>\r
-                <xs:appinfo>\r
-                    <hj:ignored/>\r
-                </xs:appinfo>\r
-            </xs:annotation>        \r
-            <xs:sequence>\r
-                <xs:element name="pageNum" type="xs:unsignedInt" />\r
-                <xs:element name="pageSize" type="xs:unsignedInt" />\r
-                <!-- "itemsInPage" is useful to our testing framework's unit tests -->\r
-                <xs:element name="itemsInPage" type="xs:unsignedInt" />\r
-                <xs:element name="totalItems" type="xs:unsignedInt" />\r
-            </xs:sequence>\r
-        </xs:complexType>\r
-    </xs:element>\r
-    \r
-</xs:schema>
\ No newline at end of file
index 83234aaae8ef22160693ef8f8fc0b0156d1895c0..2427a84df1bb41d94c84ded8b57cfbd004b6d1c6 100644 (file)
@@ -26,8 +26,7 @@
     <!--
     Avoid XmlRootElement nightmare:
     See http://weblogs.java.net/blog/kohsuke/archive/2006/03/why_does_jaxb_p.html
--->
-
+       -->
 
     <xs:include schemaLocation="permissions.xsd"/>
    
            </xs:complexType>
        </xs:element>
 
-    <xs:element name="foo_permissions_list">
-           <xs:complexType>
-               <xs:annotation>
-                   <xs:appinfo>
-                       <hj:ignored/>
-                   </xs:appinfo>
-               </xs:annotation>
-            <xs:complexContent>
-                <xs:extension base="abstractCommonList">                    
-                           <xs:sequence>
-                               <xs:element name="permissions-list-item" maxOccurs="unbounded">
-                                   <xs:complexType>
-                                       <xs:annotation>
-                                           <xs:appinfo>
-                                               <hj:ignored/>
-                                           </xs:appinfo>
-                                       </xs:annotation>
-                                       <xs:sequence>
-                                           <xs:element name="screenName" type="xs:string" minOccurs="1"/>
-                                           <xs:element name="personRefName" type="xs:string" minOccurs="1" />
-                                           <xs:element name="email" type="xs:string" minOccurs="1" />
-                                           <!-- uri to retrive collection object details -->
-                                           <xs:element name="uri" type="xs:anyURI" minOccurs="1" />
-                                           <xs:element name="csid" type="xs:string" minOccurs="1" />
-                                       </xs:sequence>
-                                   </xs:complexType>
-                               </xs:element>
-                           </xs:sequence>
-                </xs:extension>
-            </xs:complexContent>        
-           </xs:complexType>
-       </xs:element>
-       
-    <!-- This is the base class for paginated lists -->
-    <xs:complexType name="abstractCommonList">
-        <xs:annotation>
-            <xs:appinfo>
-                <jaxb:class ref="org.collectionspace.services.hyperjaxb.AbstractCommonList"/>
-            </xs:appinfo>
-        </xs:annotation>
-    </xs:complexType>
-       
-    <xs:element name="foo-common-list">
-        <xs:complexType>
-            <xs:annotation>
-                <xs:documentation>
-                    AccountsCommonList contains information about one or more
-                    accounts. An instance of this type could be returned on
-                    index and search operations.
-                </xs:documentation>
-                <xs:appinfo>
-                    <hj:ignored/>
-                </xs:appinfo>
-            </xs:annotation>
-            <xs:complexContent>
-                <xs:extension base="abstractCommonList">                    
-                           <xs:sequence>
-                               <xs:element name="foo-list-item" maxOccurs="unbounded">
-                                   <xs:complexType>
-                                       <xs:annotation>
-                                           <xs:appinfo>
-                                               <hj:ignored/>
-                                           </xs:appinfo>
-                                       </xs:annotation>
-                                       <xs:sequence>
-                                           <xs:element name="screenName" type="xs:string" minOccurs="1"/>
-                                           <xs:element name="personRefName" type="xs:string" minOccurs="1" />
-                                           <xs:element name="email" type="xs:string" minOccurs="1" />
-                                           <!-- uri to retrive collection object details -->
-                                           <xs:element name="uri" type="xs:anyURI" minOccurs="1" />
-                                           <xs:element name="csid" type="xs:string" minOccurs="1" />
-                                       </xs:sequence>
-                                   </xs:complexType>
-                               </xs:element>
-                           </xs:sequence>
-                </xs:extension>
-            </xs:complexContent>        
-        </xs:complexType>
-    </xs:element>
-       
-
 </xs:schema>
 
index fc1f5ebd4e346c1d52375a358e43038f842ae43a..a2c6d7242e66cd9aae85a94a99f331c4479c6ca0 100644 (file)
@@ -9,7 +9,7 @@ import org.jboss.resteasy.client.ClientResponse;
  * $LastChangedRevision:  $
  * $LastChangedDate:  $
  */
-public class IdClient extends AbstractServiceClientImpl<String, IdProxy> {
+public class IdClient extends AbstractServiceClientImpl<String, String, String, IdProxy> {
 
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.BaseServiceClient#getServicePathComponent()
@@ -57,4 +57,8 @@ public class IdClient extends AbstractServiceClientImpl<String, IdProxy> {
     public ClientResponse<String> createId(String csid) {
         return getProxy().createId(csid);
     }
+
+       @Override
+       public ClientResponse<String> update(String csid, String payload) {
+               throw new UnsupportedOperationException("ID client does not support an update operation.");     }
 }
index 819a9be055ad57869e406a63fed8896477effd5c..9f8f7500149e3bfa515d9aff6e5f7e516e0a7f91 100644 (file)
@@ -66,17 +66,7 @@ public class IdServiceTest extends BaseServiceTest {
      */
     @Override
     protected CollectionSpaceClient getClientInstance() {
-       return new IdClient();
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
-     */
-    @Override
-       protected AbstractCommonList getAbstractCommonList(
-                       ClientResponse<AbstractCommonList> response) {
-        throw new UnsupportedOperationException(
-            "IdServiceTest.getAbstractCommonList method is not currently supported.");
+       return (CollectionSpaceClient) new IdClient();
     }
 
     // ---------------------------------------------------------------
@@ -87,11 +77,6 @@ public class IdServiceTest extends BaseServiceTest {
     
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
     public void create(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        };
-
         // Perform setup.
         testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
 
@@ -108,9 +93,9 @@ public class IdServiceTest extends BaseServiceTest {
         if(logger.isDebugEnabled()){
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
         
         String newID = extractId(res);
         
@@ -133,11 +118,6 @@ public class IdServiceTest extends BaseServiceTest {
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
         dependsOnMethods = {"create"})
     public void createId(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        };
-
         // Perform setup, such as initializing the type of service request
         // (e.g. CREATE, DELETE), its valid and expected status codes, and
         // its associated HTTP method name (e.g. POST, DELETE).
@@ -146,27 +126,37 @@ public class IdServiceTest extends BaseServiceTest {
         // Submit the request to the service and store the response.
         IdClient client = new IdClient();
         ClientResponse<String> res = client.createId(knownResourceId);
-        assertStatusCode(res, testName);
-
-        String generatedId = res.getEntity();
-        Assert.assertNotNull(generatedId);
-        Assert.assertFalse(generatedId.isEmpty());
-        if (logger.isDebugEnabled()) {
-            logger.debug("generated ID=" + generatedId);
+        String generatedId = null;
+        try {
+               assertStatusCode(res, testName);
+               generatedId = res.getEntity();
+               Assert.assertNotNull(generatedId);
+               Assert.assertFalse(generatedId.isEmpty());
+               if (logger.isDebugEnabled()) {
+                   logger.debug("generated ID=" + generatedId);
+               }
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-                        
         // Create a second ID.  Verify that it is different from the first.
         // Assumes that the last part in the ID pattern generates values
         // that will always differ at each generation.
         res = client.createId(knownResourceId);
-        assertStatusCode(res, testName);
-
-        String secondGeneratedId = res.getEntity();
-        Assert.assertNotNull(secondGeneratedId);
-        Assert.assertFalse(secondGeneratedId.isEmpty());
-        Assert.assertFalse(secondGeneratedId.equals(generatedId));
-        if (logger.isDebugEnabled()) {
-            logger.debug("second generated ID=" + secondGeneratedId);
+        try {
+               assertStatusCode(res, testName);
+               String secondGeneratedId = res.getEntity();
+               Assert.assertNotNull(secondGeneratedId);
+               Assert.assertFalse(secondGeneratedId.isEmpty());
+               Assert.assertFalse(secondGeneratedId.equals(generatedId));
+               if (logger.isDebugEnabled()) {
+                   logger.debug("second generated ID=" + secondGeneratedId);
+               }
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
         
     }
@@ -183,11 +173,6 @@ public class IdServiceTest extends BaseServiceTest {
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
         dependsOnMethods = {"create"})
     public void read(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        };
-
         // Perform setup.
         testSetup(STATUS_OK, ServiceRequestType.READ);
         
@@ -198,7 +183,17 @@ public class IdServiceTest extends BaseServiceTest {
         // Submit the request to the service and store the response.
         IdClient client = new IdClient();
         ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
+        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);
+
         String entity = res.getEntity();
         Assert.assertNotNull(entity);
         if (logger.isDebugEnabled()) {
@@ -218,18 +213,32 @@ public class IdServiceTest extends BaseServiceTest {
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
         dependsOnMethods = {"create"})
     public void readList(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        };
-
         // Perform setup.
         testSetup(STATUS_OK, ServiceRequestType.READ_LIST);
 
         // Submit the request to the service and store the response.
         IdClient client = new IdClient();
         ClientResponse<String> res = client.readList();
-        assertStatusCode(res, testName);
+        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);
+
+        // 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);
+
         String entity = res.getEntity();
         Assert.assertNotNull(entity);
         if (logger.isDebugEnabled()) {
@@ -244,11 +253,6 @@ public class IdServiceTest extends BaseServiceTest {
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
         dependsOnMethods = {"create", "createId", "read", "readList"})
     public void delete(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-
         // Perform setup.
         testSetup(STATUS_OK, ServiceRequestType.DELETE);
 
@@ -262,9 +266,9 @@ public class IdServiceTest extends BaseServiceTest {
         if(logger.isDebugEnabled()){
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
 
     // ---------------------------------------------------------------
index 736ea830e156f707c999e15c2ba1edc7293c140d..2363444a91c3dffaedfe3b329cc76717d2c5979e 100755 (executable)
@@ -45,7 +45,6 @@
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>5.6</version>
         </dependency>
         
       <!-- javax -->
index 5b4cecb710dfc3c4c292e4e9af785cc4ad636a53..8242eb1d74c7d58097786c9c3f840e22a25be293 100755 (executable)
@@ -24,7 +24,6 @@
 \r
 package org.collectionspace.services.imports;\r
 \r
-import java.io.*;\r
 import java.util.UUID;\r
 \r
 import org.collectionspace.services.common.IFragmentHandler;\r
@@ -37,8 +36,6 @@ import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 \r
 import org.dom4j.Document;\r
 import org.dom4j.Element;\r
-import org.hibernate.sql.Template;\r
-import org.testng.annotations.Test;\r
 import org.xml.sax.InputSource;\r
 \r
 /** This class expands templates specifically for the imports service.\r
index 90d5fa27364a799d5f3bf68686c1fc1ec5310e72..241e62f8f97368e437dc90aad01d23d69f8756d5 100644 (file)
@@ -67,7 +67,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>\r
         <dependency>\r
             <groupId>org.jboss.resteasy</groupId>\r
index f18038a73a7f56fef074eb1d524e321b4903fb9e..af3ab35340262bff2647d03011049c4b8940a586 100644 (file)
@@ -48,7 +48,6 @@ public class IntakeClient extends AbstractCommonListPoxServiceClientImpl<IntakeP
 
     @Override
     public Class<IntakeProxy> getProxyClass() {
-        // TODO Auto-generated method stub
         return IntakeProxy.class;
     }
 }
index b324cc1e1ad7489b45546e5ed8619ba3b4051cc2..cb27abf31f341590ff8fae9750a9922e5e4a1110 100644 (file)
@@ -27,7 +27,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
 import org.collectionspace.services.PersonJAXBSchema;
@@ -64,7 +63,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision: 1327 $
  * $LastChangedDate: 2010-02-12 10:35:11 -0800 (Fri, 12 Feb 2010) $
  */
-public class IntakeAuthRefsTest extends BaseServiceTest {
+public class IntakeAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
 
     private final String CLASS_NAME = IntakeAuthRefsTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
@@ -102,7 +101,7 @@ public class IntakeAuthRefsTest extends BaseServiceTest {
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-       protected AbstractCommonList getAbstractCommonList(
+       protected AbstractCommonList getCommonList(
                        ClientResponse<AbstractCommonList> response) {
        throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
@@ -113,10 +112,6 @@ public class IntakeAuthRefsTest extends BaseServiceTest {
     // Success outcomes
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
     public void createWithAuthRefs(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
 
         // Submit the request to the service and store the response.
@@ -148,9 +143,9 @@ public class IntakeAuthRefsTest extends BaseServiceTest {
         if(logger.isDebugEnabled()){
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
 
         // Store the ID returned from the first resource created
         // for additional tests below.
@@ -173,8 +168,8 @@ public class IntakeAuthRefsTest extends BaseServiceTest {
         ClientResponse<Response> res = personAuthClient.create(multipart);
         int statusCode = res.getStatus();
 
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, STATUS_CREATED);
         personAuthCSID = extractId(res);
         
@@ -213,42 +208,49 @@ public class IntakeAuthRefsTest extends BaseServiceTest {
         ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
         int statusCode = res.getStatus();
 
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, STATUS_CREATED);
        return extractId(res);
     }
 
     // Success outcomes
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+    @Test(dataProvider="testName",
         dependsOnMethods = {"createWithAuthRefs"})
     public void readAndCheckAuthRefs(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         testSetup(STATUS_OK, ServiceRequestType.READ);
 
         // Submit the request to the service and store the response.
         IntakeClient intakeClient = new IntakeClient();
         ClientResponse<String> res = intakeClient.read(knownResourceId);
-        assertStatusCode(res, testName);
-
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        IntakesCommon intake = (IntakesCommon) extractPart(input,
-                       intakeClient.getCommonPartName(), IntakesCommon.class);
-        Assert.assertNotNull(intake);
-        // Check a couple of fields
-        Assert.assertEquals(intake.getCurrentOwner(), currentOwnerRefName);
-        Assert.assertEquals(intake.getConditionCheckersOrAssessors().getConditionCheckerOrAssessor().get(0), conditionCheckerOrAssessorRefName);
-        Assert.assertEquals(intake.getInsurers().getInsurer().get(0), insurerRefName);
+        try {
+               assertStatusCode(res, testName);
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               IntakesCommon intake = (IntakesCommon) extractPart(input,
+                               intakeClient.getCommonPartName(), IntakesCommon.class);
+               Assert.assertNotNull(intake);
+               // Check a couple of fields
+               Assert.assertEquals(intake.getCurrentOwner(), currentOwnerRefName);
+               Assert.assertEquals(intake.getConditionCheckersOrAssessors().getConditionCheckerOrAssessor().get(0), conditionCheckerOrAssessorRefName);
+               Assert.assertEquals(intake.getInsurers().getInsurer().get(0), insurerRefName);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
         
         // Get the auth refs and check them
         ClientResponse<AuthorityRefList> res2 = intakeClient.getAuthorityRefs(knownResourceId);
-        assertStatusCode(res2, testName);
-
-        AuthorityRefList list = res2.getEntity();
+        AuthorityRefList list = null;
+        try {
+               assertStatusCode(res2, testName);
+               list = res2.getEntity();
+        } finally {
+               if (res2 != null) {
+                       res2.releaseConnection();
+            }
+        }
         
         List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
         int numAuthRefsFound = items.size();
@@ -350,8 +352,7 @@ public class IntakeAuthRefsTest extends BaseServiceTest {
 
         PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent());
         PayloadOutputPart commonPart =
-            multipart.addPart(intake, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(new IntakeClient().getCommonPartName());
+            multipart.addPart(new IntakeClient().getCommonPartName(), intake);
 
         if(logger.isDebugEnabled()){
             logger.debug("to be created, intake common");
index 1f354ed37b97440ae13a27fc3f91332b267726b7..57198ae8286601cde938f223ac87db1955ed0384 100644 (file)
@@ -24,7 +24,6 @@ package org.collectionspace.services.client.test;
 
 import java.util.List;
 import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
 
 import org.dom4j.Element;
 
@@ -34,7 +33,6 @@ 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.common.AbstractCommonListUtils;
 import org.collectionspace.services.common.datetime.GregorianCalendarDateTimeUtils;
 import org.collectionspace.services.intake.EntryMethodList;
 import org.collectionspace.services.intake.FieldCollectionEventNameList;
@@ -58,13 +56,11 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision$
  * $LastChangedDate$
  */
-public class IntakeServiceTest extends AbstractServiceTestImpl {
+public class IntakeServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonList, IntakesCommon> {
 
     /** The logger. */
     private final String CLASS_NAME = IntakeServiceTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(IntakeServiceTest.class);
-    /** The known resource id. */
-    private String knownResourceId = null;
     private final static String CURRENT_DATE_UTC =
             GregorianCalendarDateTimeUtils.currentDateUTC();
 
@@ -78,86 +74,10 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
         return IntakeClient.SERVICE_NAME;
     }
 
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
-     */
-    @Override
-    protected AbstractCommonList getAbstractCommonList(
-            ClientResponse<AbstractCommonList> response) {
-        return response.getEntity(AbstractCommonList.class);
-    }
-
     // ---------------------------------------------------------------
     // CRUD tests : CREATE tests
     // ---------------------------------------------------------------
     
-    // Success outcomes
-    
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
-    public void create(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup, such as initializing the type of service request
-        // (e.g. CREATE, DELETE), its valid and expected status codes, and
-        // its associated HTTP method name (e.g. POST, DELETE).
-        setupCreate();
-
-        // Submit the request to the service and store the response.
-        IntakeClient client = new IntakeClient();
-        String identifier = createIdentifier();
-        PoxPayloadOut multipart = createInstance(identifier);
-        ClientResponse<Response> res = client.create(multipart);
-
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        //
-        // Specifically:
-        // Does it fall within the set of valid status codes?
-        // Does it exactly match the expected status code?
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": status = " + statusCode);
-        }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
-        // Store the ID returned from the first resource created
-        // for additional tests below.
-        if (knownResourceId == null) {
-            knownResourceId = extractId(res);
-            if (logger.isDebugEnabled()) {
-                logger.debug(testName + ": knownResourceId=" + knownResourceId);
-            }
-        }
-
-        // Store the IDs from every resource created by tests,
-        // so they can be deleted after tests have been run.
-        allResourceIdsCreated.add(extractId(res));
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
-    public void createList(String testName) throws Exception {
-        for (int i = 0; i < 3; i++) {
-            create(testName);
-        }
-    }
-
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    
     // See Issue CSPACE-401.
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
@@ -276,50 +196,20 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
     // CRUD tests : READ tests
     // ---------------------------------------------------------------
     
-    // Success outcomes
-    
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
-    public void read(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupRead();
-
-        // Submit the request to the service and store the response.
-        IntakeClient client = new IntakeClient();
-        ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
-        IntakesCommon intakeCommons = null;
-        if (payloadInputPart != null) {
-            intakeCommons = (IntakesCommon) payloadInputPart.getBody();
-        }
-//        IntakesCommon intake = (IntakesCommon) extractPart(input,
-//                client.getCommonPartName(), IntakesCommon.class);
-        Assert.assertNotNull(intakeCommons);
-
+       protected void compareReadInstances(IntakesCommon original, IntakesCommon fromRead) throws Exception {
         // Verify the number and contents of values in repeatable fields,
         // as created in the instance record used for testing.
         List<String> entryMethods =
-                intakeCommons.getEntryMethods().getEntryMethod();
+                       fromRead.getEntryMethods().getEntryMethod();
         Assert.assertTrue(entryMethods.size() > 0);
         Assert.assertNotNull(entryMethods.get(0));
 
         List<String> fieldCollectionEventNames =
-                intakeCommons.getFieldCollectionEventNames().getFieldCollectionEventName();
+                       fromRead.getFieldCollectionEventNames().getFieldCollectionEventName();
         Assert.assertTrue(fieldCollectionEventNames.size() > 0);
         Assert.assertNotNull(fieldCollectionEventNames.get(0));
 
-        CurrentLocationGroupList currentLocationGroupList = intakeCommons.getCurrentLocationGroupList();
+        CurrentLocationGroupList currentLocationGroupList = fromRead.getCurrentLocationGroupList();
         Assert.assertNotNull(currentLocationGroupList);
         List<CurrentLocationGroup> currentLocationGroups = currentLocationGroupList.getCurrentLocationGroup();
         Assert.assertNotNull(currentLocationGroups);
@@ -331,184 +221,34 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
         // Check the values of fields containing Unicode UTF-8 (non-Latin-1) characters.
         if (logger.isDebugEnabled()) {
             logger.debug("UTF-8 data sent=" + getUTF8DataFragment() + "\n"
-                    + "UTF-8 data received=" + intakeCommons.getEntryNote());
+                    + "UTF-8 data received=" + fromRead.getEntryNote());
         }
-        Assert.assertEquals(intakeCommons.getEntryNote(), getUTF8DataFragment(),
-                "UTF-8 data retrieved '" + intakeCommons.getEntryNote()
+        Assert.assertEquals(fromRead.getEntryNote(), getUTF8DataFragment(),
+                "UTF-8 data retrieved '" + fromRead.getEntryNote()
                 + "' does not match expected data '" + getUTF8DataFragment());
-    }
-
-    // Failure outcomes
+       }
     
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
-    public void readNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadNonExistent();
-
-        // Submit the request to the service and store the response.
-        IntakeClient client = new IntakeClient();
-        ClientResponse<String> res = client.read(NON_EXISTENT_ID);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
+    // Failure outcomes
 
-    // ---------------------------------------------------------------
-    // CRUD tests : READ_LIST tests
-    // ---------------------------------------------------------------
-    
-    // Success outcomes
-    
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
-     */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList", "read"})
-    public void readList(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadList();
-
-        // Submit the request to the service and store the response.
-        IntakeClient client = new IntakeClient();
-        ClientResponse<AbstractCommonList> res = client.readList();
-        assertStatusCode(res, testName);
-        AbstractCommonList list = res.getEntity();
-
-        // Optionally output additional data about list members for debugging.
-        boolean iterateThroughList = true;
-        if (iterateThroughList && logger.isDebugEnabled()) {
-            AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
-        }
-
+    public void delete(String testName) throws Exception {
+       // Do nothing because this test is not ready to delete the "knownResourceId".
+       // Instead, the method localDelete() will get called later in the dependency chain. The
+       // method localDelete() has a dependency on the test "verifyReadOnlyCoreFields".  Once the "verifyReadOnlyCoreFields"
+       // test is run, the localDelete() test/method will get run.  The localDelete() test/method in turn
+       // calls the inherited delete() test/method.
     }
-
-    // Failure outcomes
-    // None at present.
-    
-    // ---------------------------------------------------------------
-    // CRUD tests : UPDATE tests
-    // ---------------------------------------------------------------
     
-    // Success outcomes
-    
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
-    public void update(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdate();
-
-        // Retrieve the contents of a resource to update.
-        IntakeClient client = new IntakeClient();
-        ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("got object to update with ID: " + knownResourceId);
-        }
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
-        IntakesCommon intakeCommons = null;
-        if (payloadInputPart != null) {
-            intakeCommons = (IntakesCommon) payloadInputPart.getBody();
-        }
-//        IntakesCommon intake = (IntakesCommon) extractPart(input,
-//                client.getCommonPartName(), IntakesCommon.class);
-        Assert.assertNotNull(intakeCommons);
-
-        // Update the content of this resource.
-        intakeCommons.setEntryNumber("updated-" + intakeCommons.getEntryNumber());
-        if (logger.isDebugEnabled()) {
-            logger.debug("to be updated object");
-            logger.debug(objectAsXmlString(intakeCommons, IntakesCommon.class));
-        }
-
-        CurrentLocationGroupList currentLocationGroupList = intakeCommons.getCurrentLocationGroupList();
-        Assert.assertNotNull(currentLocationGroupList);
-        List<CurrentLocationGroup> currentLocationGroups = currentLocationGroupList.getCurrentLocationGroup();
-        Assert.assertNotNull(currentLocationGroups);
-        Assert.assertTrue(currentLocationGroups.size() > 0);
-        CurrentLocationGroup currentLocationGroup = currentLocationGroups.get(0);
-        Assert.assertNotNull(currentLocationGroup);
-        String currentLocationNote = currentLocationGroup.getCurrentLocationNote();
-        Assert.assertNotNull(currentLocationNote);
-        String updatedCurrentLocationNote = "updated-" + currentLocationNote;
-        currentLocationGroups.get(0).setCurrentLocationNote(updatedCurrentLocationNote);
-        intakeCommons.setCurrentLocationGroupList(currentLocationGroupList);
-
-        // Create an output payload to send to the service, and add teh common part
-        PoxPayloadOut output = new PoxPayloadOut(this.getServicePathComponent());
-        PayloadOutputPart commonPart = output.addPart(intakeCommons, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getCommonPartName());
-        
-        // Submit the request to the service and store the response.
-        res = client.update(knownResourceId, output);
-        assertStatusCode(res, testName);
-        
-        input = new PoxPayloadIn(res.getEntity());
-        IntakesCommon updatedIntake =
-                (IntakesCommon) extractPart(input,
-                client.getCommonPartName(), IntakesCommon.class);
-
-        Assert.assertNotNull(updatedIntake);
-
-        Assert.assertEquals(updatedIntake.getEntryNumber(),
-                intakeCommons.getEntryNumber(),
-                "Data in updated object did not match submitted data.");
-
-        currentLocationGroupList = updatedIntake.getCurrentLocationGroupList();
-        Assert.assertNotNull(currentLocationGroupList);
-        currentLocationGroups = currentLocationGroupList.getCurrentLocationGroup();
-        Assert.assertNotNull(currentLocationGroups);
-        Assert.assertTrue(currentLocationGroups.size() > 0);
-        Assert.assertNotNull(currentLocationGroups.get(0));
-        Assert.assertEquals(updatedCurrentLocationNote,
-                currentLocationGroups.get(0).getCurrentLocationNote(),
-                "Data in updated object did not match submitted data.");
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("UTF-8 data sent=" + intakeCommons.getEntryNote() + "\n"
-                    + "UTF-8 data received=" + updatedIntake.getEntryNote());
-        }
-        Assert.assertTrue(updatedIntake.getEntryNote().contains(getUTF8DataFragment()),
-                "UTF-8 data retrieved '" + updatedIntake.getEntryNote()
-                + "' does not contain expected data '" + getUTF8DataFragment());
-        Assert.assertEquals(updatedIntake.getEntryNote(),
-                intakeCommons.getEntryNote(),
-                "Data in updated object did not match submitted data.");
-
+    @Test(dataProvider = "testName", dependsOnMethods = {"CRUDTests", "verifyReadOnlyCoreFields"})
+    public void localDelete(String testName) throws Exception {
+       // Because of issues with TestNG not allowing @Test annotations on on override methods,
+       // and because we want the "updateWrongUser" to run before the "delete" test, we need
+       // this method.  This method will call super.delete() after all the dependencies have been
+       // met.
+       super.delete(testName);
     }
 
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"update"})
+    @Test(dataProvider = "testName", dependsOnMethods = {"CRUDTests"})
     public void verifyReadOnlyCoreFields(String testName) throws Exception {
         // TODO These should be in some core client utils
         final String COLLECTIONSPACE_CORE_SCHEMA = "collectionspace_core";
@@ -519,16 +259,16 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
         final String COLLECTIONSPACE_CORE_CREATED_BY = "createdBy";
         final String COLLECTIONSPACE_CORE_UPDATED_BY = "updatedBy";
 
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupUpdate();
 
         // Retrieve the contents of a resource to update.
         IntakeClient client = new IntakeClient();
         ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
+        if (logger.isDebugEnabled()) {
+            logger.debug(testName + ": read status = " + res.getStatus());
+        }
+        Assert.assertEquals(res.getStatus(), testExpectedStatusCode);
 
         PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
         PayloadInputPart payloadInputPart = input.getPart(COLLECTIONSPACE_CORE_SCHEMA);
@@ -572,7 +312,14 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
         
         // Submit the request to the service and store the response.
         res = client.update(knownResourceId, output);
-        assertStatusCode(res, testName);
+        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);
 
         input = new PoxPayloadIn(res.getEntity());
         PayloadInputPart updatedCorePart = input.getPart(COLLECTIONSPACE_CORE_SCHEMA);
@@ -718,138 +465,10 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
     }
      */
 
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"update", "testSubmitRequest"})
-    public void updateNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdateNonExistent();
-
-        // Submit the request to the service and store the response.
-        // Note: The ID used in this 'create' call may be arbitrary.
-        // The only relevant ID may be the one used in update(), below.
-        IntakeClient client = new IntakeClient();
-        PoxPayloadOut multipart = createInstance(NON_EXISTENT_ID);
-        ClientResponse<String> res =
-                client.update(NON_EXISTENT_ID, multipart);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    // ---------------------------------------------------------------
-    // CRUD tests : DELETE tests
-    // ---------------------------------------------------------------
-    
-    // Success outcomes
-    
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create", "readList", "testSubmitRequest", "update", "verifyReadOnlyCoreFields"})
-    public void delete(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDelete();
-
-        // Submit the request to the service and store the response.
-        IntakeClient client = new IntakeClient();
-        ClientResponse<Response> res = client.delete(knownResourceId);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    // Failure outcomes
-    
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"delete"})
-    public void deleteNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDeleteNonExistent();
-
-        // Submit the request to the service and store the response.
-        IntakeClient client = new IntakeClient();
-        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
     // ---------------------------------------------------------------
     // Utility tests : tests of code used in tests above
     // ---------------------------------------------------------------
     
-    /**
-     * Tests the code for manually submitting data that is used by several
-     * of the methods above.
-     */
-    @Test(dependsOnMethods = {"create", "read"})
-    public void testSubmitRequest() {
-
-        // Expected status code: 200 OK
-        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
-
-        // Submit the request to the service and store the response.
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getResourceURL(knownResourceId);
-        int statusCode = submitRequest(method, url);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug("testSubmitRequest: url=" + url
-                    + " status=" + statusCode);
-        }
-        Assert.assertEquals(statusCode, EXPECTED_STATUS);
-
-    }
-
-    // ---------------------------------------------------------------
-    // Utility methods used by tests above
-    // ---------------------------------------------------------------
-    
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
      */
@@ -925,4 +544,79 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
 
         return multipart;
     }
+
+       @Override
+       protected PoxPayloadOut createInstance(String commonPartName,
+                       String identifier) {
+               return this.createInstance(identifier);
+       }
+
+       @Override
+       protected IntakesCommon updateInstance(IntakesCommon intakesCommon) {
+               IntakesCommon result = new IntakesCommon();
+               
+               result.setEntryNumber("updated-" + intakesCommon.getEntryNumber());
+               result.setEntryNote(intakesCommon.getEntryNote());
+
+        CurrentLocationGroupList currentLocationGroupList = intakesCommon.getCurrentLocationGroupList();
+        Assert.assertNotNull(currentLocationGroupList);
+        List<CurrentLocationGroup> currentLocationGroups = currentLocationGroupList.getCurrentLocationGroup();
+        Assert.assertNotNull(currentLocationGroups);
+        Assert.assertTrue(currentLocationGroups.size() > 0);
+        CurrentLocationGroup currentLocationGroup = currentLocationGroups.get(0);
+        Assert.assertNotNull(currentLocationGroup);
+        String currentLocationNote = currentLocationGroup.getCurrentLocationNote();
+        Assert.assertNotNull(currentLocationNote);
+        String updatedCurrentLocationNote = "updated-" + currentLocationNote;
+        currentLocationGroups.get(0).setCurrentLocationNote(updatedCurrentLocationNote);
+        result.setCurrentLocationGroupList(currentLocationGroupList);
+        
+        return result;
+       }
+
+       @Override
+       protected void compareUpdatedInstances(IntakesCommon original,
+                       IntakesCommon updated) throws Exception {
+        Assert.assertEquals(updated.getEntryNumber(),
+                       original.getEntryNumber(),
+                "Data in updated object did not match submitted data.");
+        
+        CurrentLocationGroupList currentLocationGroupList = updated.getCurrentLocationGroupList();
+        Assert.assertNotNull(currentLocationGroupList);
+        List<CurrentLocationGroup> currentLocationGroups = currentLocationGroupList.getCurrentLocationGroup();
+        Assert.assertNotNull(currentLocationGroups);
+        Assert.assertTrue(currentLocationGroups.size() > 0);
+        Assert.assertNotNull(currentLocationGroups.get(0));
+        
+        String updatedCurrentLocationNote = original.getCurrentLocationGroupList()
+                       .getCurrentLocationGroup().get(0).getCurrentLocationNote();
+        Assert.assertEquals(updatedCurrentLocationNote,
+                currentLocationGroups.get(0).getCurrentLocationNote(),
+                "Data in updated object did not match submitted data.");
+        
+        Assert.assertEquals(updated.getEntryNote(), original.getEntryNote(),
+                "Data in updated object did not match submitted data.");
+        //
+        // UTF-8 Checks
+        //
+        if (logger.isDebugEnabled()) {
+            logger.debug("UTF-8 data sent=" + original.getEntryNote() + "\n"
+                    + "UTF-8 data received=" + updated.getEntryNote());
+        }
+        Assert.assertTrue(updated.getEntryNote().contains(getUTF8DataFragment()),
+                "UTF-8 data retrieved '" + updated.getEntryNote()
+                + "' does not contain expected data '" + getUTF8DataFragment());        
+       }
+
+    /*
+     * For convenience and terseness, this test method is the base of the test execution dependency chain.  Other test methods may
+     * refer to this method in their @Test annotation declarations.
+     */
+    @Override
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {
+                       "org.collectionspace.services.client.test.AbstractServiceTestImpl.baseCRUDTests"})    
+       public void CRUDTests(String testName) {
+               // TODO Auto-generated method stub              
+       }
 }
index c113011d1924bc6845729ce0139ddfb633549e75..497389fece17f20a1d97b66d3303a4dcb79f7f68 100644 (file)
@@ -63,7 +63,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision: 1327 $\r
  * $LastChangedDate: 2010-02-12 10:35:11 -0800 (Fri, 12 Feb 2010) $\r
  */\r
-public class OrganizationAuthRefDocsTest extends BaseServiceTest {\r
+public class OrganizationAuthRefDocsTest extends BaseServiceTest<AbstractCommonList> {\r
 \r
     private final String CLASS_NAME = OrganizationAuthRefDocsTest.class.getName();\r
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);\r
@@ -103,7 +103,7 @@ public class OrganizationAuthRefDocsTest extends BaseServiceTest {
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)\r
      */\r
     @Override\r
-       protected AbstractCommonList getAbstractCommonList(\r
+       protected AbstractCommonList getCommonList(\r
                        ClientResponse<AbstractCommonList> response) {\r
        throw new UnsupportedOperationException(); //method not supported (or needed) in this test class\r
     }\r
@@ -114,10 +114,6 @@ public class OrganizationAuthRefDocsTest extends BaseServiceTest {
     // Success outcomes\r
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)\r
     public void createIntakeWithAuthRefs(String testName) throws Exception {\r
-\r
-        if (logger.isDebugEnabled()) {\r
-            logger.debug(testBanner(testName, CLASS_NAME));\r
-        }\r
         testSetup(STATUS_CREATED, ServiceRequestType.CREATE);\r
 \r
         // Submit the request to the service and store the response.\r
@@ -150,9 +146,9 @@ public class OrganizationAuthRefDocsTest extends BaseServiceTest {
                if(logger.isDebugEnabled()){\r
                    logger.debug(testName + ": status = " + statusCode);\r
                }\r
-               Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),\r
-                       invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
-               Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);\r
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),\r
+                       invalidStatusCodeMessage(testRequestType, statusCode));\r
+               Assert.assertEquals(statusCode, testExpectedStatusCode);\r
         } finally {\r
                res.releaseConnection();\r
         }\r
@@ -183,8 +179,8 @@ public class OrganizationAuthRefDocsTest extends BaseServiceTest {
         ClientResponse<Response> res = orgAuthClient.create(multipart);\r
         int statusCode = res.getStatus();\r
 \r
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),\r
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),\r
+                invalidStatusCodeMessage(testRequestType, statusCode));\r
         Assert.assertEquals(statusCode, STATUS_CREATED);\r
         orgAuthCSID = extractId(res);\r
         \r
@@ -226,8 +222,8 @@ public class OrganizationAuthRefDocsTest extends BaseServiceTest {
         ClientResponse<Response> res = orgAuthClient.createItem(orgAuthCSID, multipart);\r
         int statusCode = res.getStatus();\r
 \r
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),\r
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),\r
+                invalidStatusCodeMessage(testRequestType, statusCode));\r
         Assert.assertEquals(statusCode, STATUS_CREATED);\r
        return extractId(res);\r
     }\r
@@ -236,10 +232,6 @@ public class OrganizationAuthRefDocsTest extends BaseServiceTest {
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,\r
         dependsOnMethods = {"createIntakeWithAuthRefs"})\r
     public void readAndCheckAuthRefDocs(String testName) throws Exception {\r
-\r
-        if (logger.isDebugEnabled()) {\r
-            logger.debug(testBanner(testName, CLASS_NAME));\r
-        }\r
         // Perform setup.\r
         testSetup(STATUS_OK, ServiceRequestType.READ);\r
         \r
@@ -247,9 +239,16 @@ public class OrganizationAuthRefDocsTest extends BaseServiceTest {
        OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();\r
        ClientResponse<AuthorityRefDocList> refDocListResp =\r
                orgAuthClient.getReferencingObjects(orgAuthCSID, currentOwnerOrgCSID);\r
-        assertStatusCode(refDocListResp, testName);\r
-\r
-        AuthorityRefDocList list = refDocListResp.getEntity();\r
+       AuthorityRefDocList list = null;\r
+       try {\r
+          assertStatusCode(refDocListResp, testName);\r
+          list = refDocListResp.getEntity();\r
+          Assert.assertNotNull(list);\r
+       } finally {\r
+          if (refDocListResp != null) {\r
+                  refDocListResp.releaseConnection();\r
+           }\r
+       }\r
 \r
         // Optionally output additional data about list members for debugging.\r
         boolean iterateThroughList = true;\r
@@ -352,8 +351,7 @@ public class OrganizationAuthRefDocsTest extends BaseServiceTest {
 \r
         PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent());\r
         PayloadOutputPart commonPart =\r
-            multipart.addPart(intake, MediaType.APPLICATION_XML_TYPE);\r
-        commonPart.setLabel(new IntakeClient().getCommonPartName());\r
+            multipart.addPart(new IntakeClient().getCommonPartName(), intake);\r
 \r
         if(logger.isDebugEnabled()){\r
             logger.debug("to be created, intake common");\r
index 837177cbfb9106ce42cbc3af9154032cca594ade..c73cf1fbd198b66814b1be49759d81b3dacd2b66 100644 (file)
@@ -27,7 +27,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
 import org.collectionspace.services.PersonJAXBSchema;
@@ -63,7 +62,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision: 1327 $
  * $LastChangedDate: 2010-02-12 10:35:11 -0800 (Fri, 12 Feb 2010) $
  */
-public class PersonAuthRefDocsTest extends BaseServiceTest {
+public class PersonAuthRefDocsTest extends BaseServiceTest<AbstractCommonList> {
 
     private final String CLASS_NAME = PersonAuthRefDocsTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
@@ -105,7 +104,7 @@ public class PersonAuthRefDocsTest extends BaseServiceTest {
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-    protected AbstractCommonList getAbstractCommonList(
+    protected AbstractCommonList getCommonList(
             ClientResponse<AbstractCommonList> response) {
         throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
@@ -114,12 +113,8 @@ public class PersonAuthRefDocsTest extends BaseServiceTest {
     // CRUD tests : CREATE tests
     // ---------------------------------------------------------------
     // Success outcomes
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+    @Test(dataProvider = "testName")
     public void createIntakeWithAuthRefs(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
 
         // Submit the request to the service and store the response.
@@ -151,9 +146,9 @@ public class PersonAuthRefDocsTest extends BaseServiceTest {
             if (logger.isDebugEnabled()) {
                 logger.debug(testName + ": status = " + statusCode);
             }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
+            Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
             res.releaseConnection();
         }
@@ -182,8 +177,8 @@ public class PersonAuthRefDocsTest extends BaseServiceTest {
         ClientResponse<Response> res = personAuthClient.create(multipart);
         int statusCode = res.getStatus();
 
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, STATUS_CREATED);
         personAuthCSID = extractId(res);
 
@@ -239,31 +234,33 @@ public class PersonAuthRefDocsTest extends BaseServiceTest {
         ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
         int statusCode = res.getStatus();
 
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, STATUS_CREATED);
         return extractId(res);
     }
 
     // Success outcomes
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createIntakeWithAuthRefs"})
+    @Test(dataProvider = "testName", dependsOnMethods = {"createIntakeWithAuthRefs"})
     public void readAndCheckAuthRefDocs(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         testSetup(STATUS_OK, ServiceRequestType.READ);
 
         // Get the auth ref docs and check them
 
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
-        ClientResponse<AuthorityRefDocList> refDocListResp =
+        ClientResponse<AuthorityRefDocList> res =
                 personAuthClient.getReferencingObjects(personAuthCSID, currentOwnerPersonCSID);
-        assertStatusCode(refDocListResp, testName);
-
-        AuthorityRefDocList list = refDocListResp.getEntity();
+        AuthorityRefDocList list = null;
+        try {
+               assertStatusCode(res, testName);
+               list = res.getEntity();
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
+        
         List<AuthorityRefDocList.AuthorityRefDocItem> items =
                 list.getAuthorityRefDocItem();
         Assert.assertTrue(items != null);
@@ -289,13 +286,20 @@ public class PersonAuthRefDocsTest extends BaseServiceTest {
             }
             Assert.assertTrue(fFoundIntake, "Did not find Intake with authref!");
         }
-
+        //
+        // Get the referencing objects
+        //
         personAuthClient = new PersonAuthorityClient();
-        refDocListResp =
-                personAuthClient.getReferencingObjects(personAuthCSID, depositorPersonCSID);
-        assertStatusCode(refDocListResp, testName);
-
-        list = refDocListResp.getEntity();
+        res = personAuthClient.getReferencingObjects(personAuthCSID, depositorPersonCSID);
+        try {
+               assertStatusCode(res, testName);
+               list = res.getEntity();
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
+        
         items = list.getAuthorityRefDocItem();
         Assert.assertTrue(items != null);
         Assert.assertTrue(items.size() > 0);
@@ -327,13 +331,9 @@ public class PersonAuthRefDocsTest extends BaseServiceTest {
      * Read and check the list of referencing objects, where the authRef field
      * is a value instance of a repeatable scalar field.
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createIntakeWithAuthRefs"}, groups = {"repeatableScalar"})
+    @Test(dataProvider = "testName", dependsOnMethods = {"createIntakeWithAuthRefs"},
+               groups = {"repeatableScalar"})
     public void readAndCheckAuthRefDocsRepeatableScalar(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         testSetup(STATUS_OK, ServiceRequestType.READ);
 
@@ -341,11 +341,18 @@ public class PersonAuthRefDocsTest extends BaseServiceTest {
 
         // Single scalar field
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
-        ClientResponse<AuthorityRefDocList> refDocListResp =
+        ClientResponse<AuthorityRefDocList> res =
                 personAuthClient.getReferencingObjects(personAuthCSID, insurerPersonCSID);
-        assertStatusCode(refDocListResp, testName);
-
-        AuthorityRefDocList list = refDocListResp.getEntity();
+        AuthorityRefDocList list = null;
+        try {
+               assertStatusCode(res, testName);
+               list = res.getEntity();
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
+        
         List<AuthorityRefDocList.AuthorityRefDocItem> items =
                 list.getAuthorityRefDocItem();
         Assert.assertTrue(items != null);
@@ -449,8 +456,7 @@ public class PersonAuthRefDocsTest extends BaseServiceTest {
 
         PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent());
         PayloadOutputPart commonPart =
-                multipart.addPart(intake, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(new IntakeClient().getCommonPartName());
+                multipart.addPart(new IntakeClient().getCommonPartName(), intake);
 
         if (logger.isDebugEnabled()) {
             logger.debug("to be created, intake common");
index e67f35c6cb250a75abdb748469b6e6035e61c773..4ecea62b7dcfdd4bd97f5d96422ec7e3d4ba94b2 100644 (file)
@@ -49,7 +49,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>\r
         \r
       <!-- javax -->\r
index d109e5269389ad97fd6da3369a992c070b9167a9..9e86adbdfdab9cca41358085350fa484c18d248f 100644 (file)
@@ -61,7 +61,6 @@
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>5.6</version>
         </dependency>
         <dependency>
             <groupId>org.jboss.resteasy</groupId>
index 69a9d1a0c5c58cdf42b92cb0a6f746096dc5caed..6b7c49be01db4714b47ceee367908191338df947 100644 (file)
@@ -31,12 +31,10 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
 import org.collectionspace.services.PersonJAXBSchema;
-import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.LoaninClient;
 import org.collectionspace.services.client.PersonAuthorityClient;
 import org.collectionspace.services.client.PersonAuthorityClientUtils;
-import org.collectionspace.services.client.PayloadInputPart;
 import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
@@ -63,7 +61,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision$
  * $LastChangedDate$
  */
-public class LoaninAuthRefsTest extends BaseServiceTest {
+public class LoaninAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
 
     private final String CLASS_NAME = LoaninAuthRefsTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
@@ -97,7 +95,7 @@ public class LoaninAuthRefsTest extends BaseServiceTest {
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-       protected AbstractCommonList getAbstractCommonList(
+       protected AbstractCommonList getCommonList(
                        ClientResponse<AbstractCommonList> response) {
        throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
@@ -108,10 +106,6 @@ public class LoaninAuthRefsTest extends BaseServiceTest {
     // Success outcomes
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
     public void createWithAuthRefs(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
 
         // Submit the request to the service and store the response.
@@ -145,9 +139,9 @@ public class LoaninAuthRefsTest extends BaseServiceTest {
                if(logger.isDebugEnabled()){
                    logger.debug(testName + ": status = " + statusCode);
                }
-               Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                       invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-               Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                       invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
        
                // Store the ID returned from the first resource created
                // for additional tests below.
@@ -176,8 +170,8 @@ public class LoaninAuthRefsTest extends BaseServiceTest {
         ClientResponse<Response> res = personAuthClient.create(multipart);
         int statusCode = res.getStatus();
 
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-            invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+            invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, STATUS_CREATED);
         personAuthCSID = extractId(res);
 
@@ -221,8 +215,8 @@ public class LoaninAuthRefsTest extends BaseServiceTest {
         ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
         int statusCode = res.getStatus();
 
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, STATUS_CREATED);
        return extractId(res);
     }
@@ -231,39 +225,49 @@ public class LoaninAuthRefsTest extends BaseServiceTest {
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
         dependsOnMethods = {"createWithAuthRefs"})
     public void readAndCheckAuthRefs(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         testSetup(STATUS_OK, ServiceRequestType.READ);
 
         // Submit the request to the service and store the response.
         LoaninClient loaninClient = new LoaninClient();
         ClientResponse<String> res = loaninClient.read(knownResourceId);
-        assertStatusCode(res, testName);
-
-        // Extract the common part from the response.
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        LoansinCommon loaninCommon = (LoansinCommon) extractPart(input,
-            loaninClient.getCommonPartName(), LoansinCommon.class);
-        Assert.assertNotNull(loaninCommon);
-        if(logger.isDebugEnabled()){
-            logger.debug(objectAsXmlString(loaninCommon, LoansinCommon.class));
+        LoansinCommon loaninCommon = null;
+        try {
+               assertStatusCode(res, testName);
+               // Extract the common part from the response.
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               loaninCommon = (LoansinCommon) extractPart(input,
+                   loaninClient.getCommonPartName(), LoansinCommon.class);
+               Assert.assertNotNull(loaninCommon);
+               if(logger.isDebugEnabled()){
+                   logger.debug(objectAsXmlString(loaninCommon, LoansinCommon.class));
+               }
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-
+        //
         // Check a couple of fields
         // Assert.assertEquals(loaninCommon.getLender(), lenderRefName);
         // Assert.assertEquals(loaninCommon.getLendersAuthorizer(), lendersAuthorizerRefName);
         // Assert.assertEquals(loaninCommon.getLendersContact(), lendersContactRefName);
+        //
         Assert.assertEquals(loaninCommon.getLoanInContact(), loanInContactRefName);
         Assert.assertEquals(loaninCommon.getBorrowersAuthorizer(), borrowersAuthorizerRefName);
         
         // Get the auth refs and check them
-        ClientResponse<AuthorityRefList> res2 =
-           loaninClient.getAuthorityRefs(knownResourceId);
-        assertStatusCode(res2, testName);
-        AuthorityRefList list = res2.getEntity();
+        ClientResponse<AuthorityRefList> res2 = loaninClient.getAuthorityRefs(knownResourceId);
+        AuthorityRefList list = null;
+        try {
+               assertStatusCode(res2, testName);
+               list = res2.getEntity();
+               Assert.assertNotNull(list);
+        } finally {
+               if (res2 != null) {
+                       res2.releaseConnection();
+            }
+        }
         
         List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
         int numAuthRefsFound = items.size();
@@ -357,37 +361,40 @@ public class LoaninAuthRefsTest extends BaseServiceTest {
         return SERVICE_PATH_COMPONENT;
     }
 
-
-   private PoxPayloadOut createLoaninInstance(String loaninNumber,
+    private PoxPayloadOut createLoaninInstance(String loaninNumber,
                String returnDate,
-                String lender,
-                String lendersAuthorizer,
-                String lendersContact,
-                String loaninContact,
-                String borrowersAuthorizer) {
-        LoansinCommon loaninCommon = new LoansinCommon();
-        loaninCommon.setLoanInNumber(loaninNumber);
-        loaninCommon.setLoanInNumber(returnDate);
-        LenderGroupList lenderGroupList =  new LenderGroupList();
-        LenderGroup lenderGroup = new LenderGroup();
-        lenderGroup.setLender(lender);
-        lenderGroup.setLendersAuthorizer(lendersAuthorizer);
-        lenderGroup.setLendersContact(lendersContact);
-        lenderGroupList.getLenderGroup().add(lenderGroup);
-        loaninCommon.setLenderGroupList(lenderGroupList);
-        loaninCommon.setLoanInContact(loaninContact);
-        loaninCommon.setBorrowersAuthorizer(borrowersAuthorizer);
-
-        PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent());
-        PayloadOutputPart commonPart =
-            multipart.addPart(loaninCommon, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(new LoaninClient().getCommonPartName());
+               String lender,
+               String lendersAuthorizer,
+               String lendersContact,
+               String loaninContact,
+               String borrowersAuthorizer) {
+       LoansinCommon loaninCommon = new LoansinCommon();
+       loaninCommon.setLoanInNumber(loaninNumber);
+       loaninCommon.setLoanInNumber(returnDate);
+       LenderGroupList lenderGroupList =  new LenderGroupList();
+       LenderGroup lenderGroup = new LenderGroup();
+       lenderGroup.setLender(lender);
+       lenderGroup.setLendersAuthorizer(lendersAuthorizer);
+       lenderGroup.setLendersContact(lendersContact);
+       lenderGroupList.getLenderGroup().add(lenderGroup);
+       loaninCommon.setLenderGroupList(lenderGroupList);
+       loaninCommon.setLoanInContact(loaninContact);
+       loaninCommon.setBorrowersAuthorizer(borrowersAuthorizer);
+
+       PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent());
+       PayloadOutputPart commonPart =
+                       multipart.addPart(new LoaninClient().getCommonPartName(), loaninCommon);
+
+       if(logger.isDebugEnabled()){
+               logger.debug("to be created, loanin common");
+               logger.debug(objectAsXmlString(loaninCommon, LoansinCommon.class));
+       }
 
-        if(logger.isDebugEnabled()){
-            logger.debug("to be created, loanin common");
-            logger.debug(objectAsXmlString(loaninCommon, LoansinCommon.class));
-        }
+       return multipart;
+    }
 
-        return multipart;
+    @Override
+    protected Class<AbstractCommonList> getCommonListType() {
+       return AbstractCommonList.class;
     }
 }
index d94590c839f2bfc5dcbc65a02adbad97baa5874b..0c6157c9831338fe40736cd7fa1e9f88f0299553 100644 (file)
@@ -27,13 +27,13 @@ import java.util.List;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
+import org.collectionspace.services.client.AbstractCommonListUtils;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.LoaninClient;
 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.common.AbstractCommonListUtils;
 import org.collectionspace.services.common.datetime.GregorianCalendarDateTimeUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.loanin.LenderGroup;
@@ -42,7 +42,6 @@ import org.collectionspace.services.loanin.LoansinCommon;
 
 import org.jboss.resteasy.client.ClientResponse;
 import org.testng.Assert;
-import org.testng.annotations.Test;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -54,7 +53,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision$
  * $LastChangedDate$
  */
-public class LoaninServiceTest extends AbstractServiceTestImpl {
+public class LoaninServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonList, LoansinCommon> {
 
     /** The logger. */
     private final String CLASS_NAME = LoaninServiceTest.class.getName();
@@ -63,8 +62,6 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
     /** The service path component. */
     final String SERVICE_NAME = "loansin";
     final String SERVICE_PATH_COMPONENT = "loansin";
-    /** The known resource id. */
-    private String knownResourceId = null;
     private String LENDER_REF_NAME =
             "urn:cspace:org.collectionspace.demo:personauthorities:name(TestPersonAuth):item:name(HarryLender)'Harry Lender'";
     private final static String CURRENT_DATE_UTC =
@@ -82,7 +79,7 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-    protected AbstractCommonList getAbstractCommonList(
+    protected AbstractCommonList getCommonList(
             ClientResponse<AbstractCommonList> response) {
         return response.getEntity(AbstractCommonList.class);
     }
@@ -97,12 +94,8 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
     public void create(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup, such as initializing the type of service request
         // (e.g. CREATE, DELETE), its valid and expected status codes, and
         // its associated HTTP method name (e.g. POST, DELETE).
@@ -126,13 +119,15 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
             if (logger.isDebugEnabled()) {
                 logger.debug(testName + ": status = " + statusCode);
             }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
+            Assert.assertEquals(statusCode, testExpectedStatusCode);
 
             newID = extractId(res);
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
 
         // Store the ID returned from the first resource created
@@ -153,41 +148,14 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"create"})
     public void createList(String testName) throws Exception {
         for (int i = 0; i < 3; i++) {
             create(testName);
         }
     }
 
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-    
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
-     */
-    @Override
-    public void createWithEmptyEntityBody(String testName) throws Exception {
-        //Should this really be empty?
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
-     */
-    @Override
-    public void createWithMalformedXml(String testName) throws Exception {
-        //Should this really be empty?
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
-     */
-    @Override
-    public void createWithWrongXmlSchema(String testName) throws Exception {
-        //Should this really be empty?
-    }
 
     /*
     @Override
@@ -288,25 +256,23 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"create"})
     public void read(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupRead();
 
         // Submit the request to the service and store the response.
         LoaninClient client = new LoaninClient();
         ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
         PoxPayloadIn input = null;
         try {
+            assertStatusCode(res, testName);
             input = new PoxPayloadIn(res.getEntity());
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
 
         // Get the common part of the response and verify that it is not null.
@@ -342,13 +308,9 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"read"})
     public void readNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupReadNonExistent();
 
@@ -363,11 +325,13 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
             if (logger.isDebugEnabled()) {
                 logger.debug(testName + ": status = " + statusCode);
             }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
+            Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
     }
 
@@ -381,13 +345,9 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList", "read"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"createList", "read"})
     public void readList(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupReadList();
 
@@ -397,9 +357,22 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
         ClientResponse<AbstractCommonList> res = client.readList();
         assertStatusCode(res, testName);
         try {
+            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 = res.getEntity();
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
 
         // Optionally output additional data about list members for debugging.
@@ -423,28 +396,26 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"read"})
     public void update(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
-        setupUpdate();
+        setupRead();
 
         // Retrieve the contents of a resource to update.
         LoaninClient client = new LoaninClient();
         ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
         PoxPayloadIn input = null;
         try {
-            if (logger.isDebugEnabled()) {
+               assertStatusCode(res, testName);
+            input = new PoxPayloadIn(res.getEntity());
+               if (logger.isDebugEnabled()) {
                 logger.debug("got object to update with ID: " + knownResourceId);
             }
-            input = new PoxPayloadIn(res.getEntity());
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
 
         // Extract the common part from the response.
@@ -463,17 +434,28 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
             logger.debug(objectAsXmlString(loaninCommon, LoansinCommon.class));
         }
 
+        setupUpdate();
+        
         // Submit the updated common part in an update request to the service
         // and store the response.
         PoxPayloadOut output = new PoxPayloadOut(this.getServicePathComponent());
-        PayloadOutputPart commonPart = output.addPart(loaninCommon, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getCommonPartName());
+        PayloadOutputPart commonPart = output.addPart(client.getCommonPartName(), loaninCommon);
         res = client.update(knownResourceId, output);
-        assertStatusCode(res, testName);
         try {
+               assertStatusCode(res, testName);
+            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);
             input = new PoxPayloadIn(res.getEntity());
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
 
         // Extract the updated common part from the response.
@@ -501,134 +483,10 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
                 "Data in updated object did not match submitted data.");
     }
 
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-    
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
-     */
-    @Override
-    public void updateWithEmptyEntityBody(String testName) throws Exception {
-        //Should this really be empty?
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
-     */
-    @Override
-    public void updateWithMalformedXml(String testName) throws Exception {
-        //Should this really be empty?
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
-     */
     @Override
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
-        //Should this really be empty?
-    }
-
-    /*
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-    dependsOnMethods = {"create", "update", "testSubmitRequest"})
-    public void updateWithEmptyEntityBody(String testName) throws Exception {
-    
-    if (logger.isDebugEnabled()) {
-    logger.debug(testBanner(testName, CLASS_NAME));
-    }
-    // Perform setup.
-    setupUpdateWithEmptyEntityBody();
-    
-    // Submit the request to the service and store the response.
-    String method = REQUEST_TYPE.httpMethodName();
-    String url = getResourceURL(knownResourceId);
-    String mediaType = MediaType.APPLICATION_XML;
-    final String entity = "";
-    int statusCode = submitRequest(method, url, mediaType, entity);
-    
-    // Check the status code of the response: does it match
-    // the expected response(s)?
-    if(logger.isDebugEnabled()){
-    logger.debug(testName + ": url=" + url +
-    " status=" + statusCode);
-    }
-    Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-    Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-    
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-    dependsOnMethods = {"create", "update", "testSubmitRequest"})
-    public void updateWithMalformedXml(String testName) throws Exception {
-    
-    if (logger.isDebugEnabled()) {
-    logger.debug(testBanner(testName, CLASS_NAME));
-    }
-    // Perform setup.
-    setupUpdateWithMalformedXml();
-    
-    // Submit the request to the service and store the response.
-    String method = REQUEST_TYPE.httpMethodName();
-    String url = getResourceURL(knownResourceId);
-    String mediaType = MediaType.APPLICATION_XML;
-    final String entity = MALFORMED_XML_DATA;
-    int statusCode = submitRequest(method, url, mediaType, entity);
-    
-    // Check the status code of the response: does it match
-    // the expected response(s)?
-    if(logger.isDebugEnabled()){
-    logger.debug(testName + ": url=" + url +
-    " status=" + statusCode);
-    }
-    Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-    Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-    
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-    dependsOnMethods = {"create", "update", "testSubmitRequest"})
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
-    
-    if (logger.isDebugEnabled()) {
-    logger.debug(testBanner(testName, CLASS_NAME));
-    }
-    // Perform setup.
-    setupUpdateWithWrongXmlSchema();
-    
-    // Submit the request to the service and store the response.
-    String method = REQUEST_TYPE.httpMethodName();
-    String url = getResourceURL(knownResourceId);
-    String mediaType = MediaType.APPLICATION_XML;
-    final String entity = WRONG_XML_SCHEMA_DATA;
-    int statusCode = submitRequest(method, url, mediaType, entity);
-    
-    // Check the status code of the response: does it match
-    // the expected response(s)?
-    if(logger.isDebugEnabled()){
-    logger.debug(testName + ": url=" + url +
-    " status=" + statusCode);
-    }
-    Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-    Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-     */
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"update", "testSubmitRequest"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"update", "testSubmitRequest"})
     public void updateNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupUpdateNonExistent();
 
@@ -646,11 +504,13 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
             if (logger.isDebugEnabled()) {
                 logger.debug(testName + ": status = " + statusCode);
             }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
+            Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
     }
 
@@ -664,13 +524,9 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
     public void delete(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupDelete();
 
@@ -685,11 +541,13 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
             if (logger.isDebugEnabled()) {
                 logger.debug(testName + ": status = " + statusCode);
             }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
+            Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
     }
 
@@ -699,13 +557,9 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"delete"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"delete"})
     public void deleteNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupDeleteNonExistent();
 
@@ -720,11 +574,13 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
             if (logger.isDebugEnabled()) {
                 logger.debug(testName + ": status = " + statusCode);
             }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
+            Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
     }
 
@@ -736,7 +592,7 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
      * Tests the code for manually submitting data that is used by several
      * of the methods above.
      */
-    @Test(dependsOnMethods = {"create", "read"})
+//    @Test(dependsOnMethods = {"create", "read"})
     public void testSubmitRequest() {
 
         // Expected status code: 200 OK
@@ -814,8 +670,7 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
 
         PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent());
         PayloadOutputPart commonPart =
-                multipart.addPart(loaninCommon, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(new LoaninClient().getCommonPartName());
+                multipart.addPart(new LoaninClient().getCommonPartName(), loaninCommon);
 
         if (logger.isDebugEnabled()) {
             logger.debug("to be created, loanin common");
@@ -824,4 +679,30 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
 
         return multipart;
     }
+
+       @Override
+       public void CRUDTests(String testName) {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       protected PoxPayloadOut createInstance(String commonPartName,
+                       String identifier) {
+        PoxPayloadOut result = createLoaninInstance(identifier);
+        return result;
+       }
+
+       @Override
+       protected LoansinCommon updateInstance(LoansinCommon commonPartObject) {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       protected void compareUpdatedInstances(LoansinCommon original,
+                       LoansinCommon updated) throws Exception {
+               // TODO Auto-generated method stub
+               
+       }
 }
index 1bdcec7be8fc1364905dd1ea649e6325c4b57fe9..1933f2dbd837537a0a46e7f066717b901460970f 100644 (file)
@@ -44,7 +44,6 @@
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>5.6</version>
         </dependency>
         
       <!-- javax -->
index fa8b812490e43a1cb20e3e5766cfa35d067fb634..da2c7d6b04e78ae35aa4ad99691ec14b19138828 100644 (file)
@@ -62,7 +62,6 @@
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>5.6</version>
         </dependency>
         <dependency>
             <groupId>org.jboss.resteasy</groupId>
index 4968940b7e47f1144bf87f5f1dff6b050fce0334..657bd95eeef7c433fa64c5af9975a8de137b079e 100644 (file)
@@ -42,7 +42,6 @@ public class LoanoutClient extends AbstractCommonListPoxServiceClientImpl<Loanou
 
     @Override
     public Class<LoanoutProxy> getProxyClass() {
-        // TODO Auto-generated method stub
         return LoanoutProxy.class;
     }
 
index 862551da32a63532b72258e84253938c4aba11e9..a352ee6d09c23054b1246b55daa755eb43212213 100644 (file)
@@ -27,7 +27,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
 import org.collectionspace.services.PersonJAXBSchema;
@@ -39,11 +38,9 @@ import org.collectionspace.services.client.PersonAuthorityClientUtils;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.authorityref.AuthorityRefList;
-//import org.collectionspace.services.common.authorityref.AuthorityRefList.AuthorityRefItem;
 import org.collectionspace.services.common.datetime.GregorianCalendarDateTimeUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.loanout.LoansoutCommon;
-//import org.collectionspace.services.loanout.LoansoutCommonList;
 
 import org.jboss.resteasy.client.ClientResponse;
 
@@ -61,7 +58,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision$
  * $LastChangedDate$
  */
-public class LoanoutAuthRefsTest extends BaseServiceTest {
+public class LoanoutAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
 
     private final String CLASS_NAME = LoanoutAuthRefsTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
@@ -99,7 +96,7 @@ public class LoanoutAuthRefsTest extends BaseServiceTest {
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-       protected AbstractCommonList getAbstractCommonList(
+       protected AbstractCommonList getCommonList(
                        ClientResponse<AbstractCommonList> response) {
        throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
@@ -110,10 +107,6 @@ public class LoanoutAuthRefsTest extends BaseServiceTest {
     // Success outcomes
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
     public void createWithAuthRefs(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
 
         // Submit the request to the service and store the response.
@@ -146,9 +139,9 @@ public class LoanoutAuthRefsTest extends BaseServiceTest {
         if(logger.isDebugEnabled()){
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
 
         // Store the ID returned from the first resource created
         // for additional tests below.
@@ -174,8 +167,8 @@ public class LoanoutAuthRefsTest extends BaseServiceTest {
         ClientResponse<Response> res = personAuthClient.create(multipart);
         int statusCode = res.getStatus();
 
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-            invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+            invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, STATUS_CREATED);
         personAuthCSID = extractId(res);
         
@@ -216,8 +209,8 @@ public class LoanoutAuthRefsTest extends BaseServiceTest {
         ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
         int statusCode = res.getStatus();
 
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, STATUS_CREATED);
        return extractId(res);
     }
@@ -226,26 +219,29 @@ public class LoanoutAuthRefsTest extends BaseServiceTest {
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
         dependsOnMethods = {"createWithAuthRefs"})
     public void readAndCheckAuthRefs(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         testSetup(STATUS_OK, ServiceRequestType.READ);
 
         // Submit the request to the service and store the response.
         LoanoutClient loanoutClient = new LoanoutClient();
         ClientResponse<String> res = loanoutClient.read(knownResourceId);
-        assertStatusCode(res, testName);
-
-        // Extract the common part from the response.
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        LoansoutCommon loanoutCommon = (LoansoutCommon) extractPart(input,
-            loanoutClient.getCommonPartName(), LoansoutCommon.class);
-        Assert.assertNotNull(loanoutCommon);
-        if(logger.isDebugEnabled()){
-            logger.debug(objectAsXmlString(loanoutCommon, LoansoutCommon.class));
+        LoansoutCommon loanoutCommon = null;
+        try {
+               assertStatusCode(res, testName);
+               // Extract the common part from the response.
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               loanoutCommon = (LoansoutCommon) extractPart(input,
+                   loanoutClient.getCommonPartName(), LoansoutCommon.class);
+               Assert.assertNotNull(loanoutCommon);
+               if(logger.isDebugEnabled()){
+                   logger.debug(objectAsXmlString(loanoutCommon, LoansoutCommon.class));
+               }
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
+        
         // Check a couple of fields
         Assert.assertEquals(loanoutCommon.getBorrower(), borrowerRefName);
         Assert.assertEquals(loanoutCommon.getBorrowersContact(), borrowersContactRefName);
@@ -253,11 +249,16 @@ public class LoanoutAuthRefsTest extends BaseServiceTest {
         Assert.assertEquals(loanoutCommon.getLendersContact(), lendersContactRefName);
         
         // Get the auth refs and check them
-        ClientResponse<AuthorityRefList> res2 =
-           loanoutClient.getAuthorityRefs(knownResourceId);
-        assertStatusCode(res2, testName);
-
-        AuthorityRefList list = res2.getEntity();
+        ClientResponse<AuthorityRefList> res2 = loanoutClient.getAuthorityRefs(knownResourceId);
+        AuthorityRefList list = null;
+        try {
+               assertStatusCode(res2, testName);
+               list = res2.getEntity();
+        } finally {
+               if (res2 != null) {
+                       res2.releaseConnection();
+            }
+        }
 
         List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
         int numAuthRefsFound = items.size();
@@ -343,30 +344,35 @@ public class LoanoutAuthRefsTest extends BaseServiceTest {
         return SERVICE_PATH_COMPONENT;
     }
 
-   private PoxPayloadOut createLoanoutInstance(String loanoutNumber,
+    private PoxPayloadOut createLoanoutInstance(String loanoutNumber,
                String returnDate,
-                String borrower,
-                String borrowersContact,
-                String lendersAuthorizer,
-                String lendersContact) {
-        LoansoutCommon loanoutCommon = new LoansoutCommon();
-        loanoutCommon.setLoanOutNumber(loanoutNumber);
-        loanoutCommon.setLoanReturnDate(returnDate);
-        loanoutCommon.setBorrower(borrower);
-        loanoutCommon.setBorrowersContact(borrowersContact);
-        loanoutCommon.setLendersAuthorizer(lendersAuthorizer);
-        loanoutCommon.setLendersContact(lendersContact);
-
-        PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent());
-        PayloadOutputPart commonPart =
-            multipart.addPart(loanoutCommon, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(new LoanoutClient().getCommonPartName());
+               String borrower,
+               String borrowersContact,
+               String lendersAuthorizer,
+               String lendersContact) {
+       LoansoutCommon loanoutCommon = new LoansoutCommon();
+       loanoutCommon.setLoanOutNumber(loanoutNumber);
+       loanoutCommon.setLoanReturnDate(returnDate);
+       loanoutCommon.setBorrower(borrower);
+       loanoutCommon.setBorrowersContact(borrowersContact);
+       loanoutCommon.setLendersAuthorizer(lendersAuthorizer);
+       loanoutCommon.setLendersContact(lendersContact);
+
+       PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent());
+       PayloadOutputPart commonPart =
+                       multipart.addPart(new LoanoutClient().getCommonPartName(), loanoutCommon);
+
+       if(logger.isDebugEnabled()){
+               logger.debug("to be created, loanout common");
+               logger.debug(objectAsXmlString(loanoutCommon, LoansoutCommon.class));
+       }
 
-        if(logger.isDebugEnabled()){
-            logger.debug("to be created, loanout common");
-            logger.debug(objectAsXmlString(loanoutCommon, LoansoutCommon.class));
-        }
+       return multipart;
+    }
 
-        return multipart;
+    @Override
+    protected Class<AbstractCommonList> getCommonListType() {
+       // TODO Auto-generated method stub
+       return null;
     }
 }
index 0063f4c8c03f84e97139ce0e3fcbd499cdc7b886..2b0ae6c160f42f5e03cf311fc976979c9ad049f2 100644 (file)
@@ -26,13 +26,13 @@ import java.util.List;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
+import org.collectionspace.services.client.AbstractCommonListUtils;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.LoanoutClient;
 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.common.AbstractCommonListUtils;
 import org.collectionspace.services.common.datetime.GregorianCalendarDateTimeUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.loanout.LoanStatusGroup;
@@ -42,7 +42,6 @@ import org.collectionspace.services.loanout.LoansoutCommon;
 import org.jboss.resteasy.client.ClientResponse;
 
 import org.testng.Assert;
-import org.testng.annotations.Test;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -54,13 +53,12 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision$
  * $LastChangedDate$
  */
-public class LoanoutServiceTest extends AbstractServiceTestImpl {
+public class LoanoutServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonList, LoansoutCommon> {
 
     /** The logger. */
     private final String CLASS_NAME = LoanoutServiceTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
     /** The known resource id. */
-    private String knownResourceId = null;
     private final static String CURRENT_DATE_UTC =
         GregorianCalendarDateTimeUtils.currentDateUTC();
 
@@ -76,7 +74,7 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-    protected AbstractCommonList getAbstractCommonList(
+    protected AbstractCommonList getCommonList(
             ClientResponse<AbstractCommonList> response) {
         return response.getEntity(AbstractCommonList.class);
     }
@@ -89,12 +87,8 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
     public void create(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup, such as initializing the type of service request
         // (e.g. CREATE, DELETE), its valid and expected status codes, and
         // its associated HTTP method name (e.g. POST, DELETE).
@@ -117,9 +111,9 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
 
         // Store the ID returned from the first resource created
         // for additional tests below.
@@ -139,8 +133,8 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"create"})
     public void createList(String testName) throws Exception {
         for (int i = 0; i < 3; i++) {
             create(testName);
@@ -270,29 +264,30 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"create"})
     public void read(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupRead();
 
         // Submit the request to the service and store the response.
         LoanoutClient client = new LoanoutClient();
         ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-
-        // Get the common part of the response and verify that it is not null.
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
         LoansoutCommon loanoutCommon = null;
-        if (payloadInputPart != null) {
-            loanoutCommon = (LoansoutCommon) payloadInputPart.getBody();
+        try {
+               assertStatusCode(res, testName);
+               // Get the common part of the response and verify that it is not null.
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
+               if (payloadInputPart != null) {
+                   loanoutCommon = (LoansoutCommon) payloadInputPart.getBody();
+               }
+               Assert.assertNotNull(loanoutCommon);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertNotNull(loanoutCommon);
 
         // Check selected fields in the common part.
         Assert.assertNotNull(loanoutCommon.getLoanOutNumber());
@@ -321,13 +316,9 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"read"})
     public void readNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupReadNonExistent();
 
@@ -341,9 +332,9 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
 
     // ---------------------------------------------------------------
@@ -354,25 +345,27 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList", "read"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"createList", "read"})
     public void readList(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupReadList();
 
         // Submit the request to the service and store the response.
         LoanoutClient client = new LoanoutClient();
         ClientResponse<AbstractCommonList> res = client.readList();
-        assertStatusCode(res, testName);
-        AbstractCommonList list = res.getEntity();
-
+        AbstractCommonList list = null;
+        try {
+               assertStatusCode(res, testName);
+               list = res.getEntity();
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
         // Optionally output additional data about list members for debugging.
         boolean iterateThroughList = true;
-        if(iterateThroughList && logger.isDebugEnabled()){
+        if (iterateThroughList && logger.isDebugEnabled()){
                AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
         }
 
@@ -388,29 +381,30 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"read"})
     public void update(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
-        setupUpdate();
+        setupRead();
 
         // Retrieve the contents of a resource to update.
         LoanoutClient client = new LoanoutClient();
         ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-
-        // Extract the common part from the response.
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
         LoansoutCommon loanoutCommon = null;
-        if (payloadInputPart != null) {
-            loanoutCommon = (LoansoutCommon) payloadInputPart.getBody();
+        try {
+               assertStatusCode(res, testName);
+               // Extract the common part from the response.
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
+               if (payloadInputPart != null) {
+                   loanoutCommon = (LoansoutCommon) payloadInputPart.getBody();
+               }
+               Assert.assertNotNull(loanoutCommon);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertNotNull(loanoutCommon);
 
         // Update the content of this resource.
         loanoutCommon.setLoanOutNumber("updated-" + loanoutCommon.getLoanOutNumber());
@@ -432,21 +426,28 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
         }
         loanoutCommon.setLoanOutNote("updated-" + loanoutCommon.getLoanOutNote());
 
+        setupUpdate();
+        
         // Submit the updated resource in an update request to the service and store the response.
         PoxPayloadOut output = new PoxPayloadOut(this.getServicePathComponent());
-        PayloadOutputPart commonPart = output.addPart(loanoutCommon, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getCommonPartName());
-        res = client.update(knownResourceId, output);
-        assertStatusCode(res, testName);
+        PayloadOutputPart commonPart = output.addPart(client.getCommonPartName(), loanoutCommon);
 
-        // Extract the updated common part from the response.
-        input = new PoxPayloadIn(res.getEntity());
-        payloadInputPart = input.getPart(client.getCommonPartName());
+        res = client.update(knownResourceId, output);
         LoansoutCommon updatedLoanoutCommon = null;
-        if (payloadInputPart != null) {
-            updatedLoanoutCommon = (LoansoutCommon) payloadInputPart.getBody();
+        try {
+               assertStatusCode(res, testName);
+               // Extract the updated common part from the response.
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
+               if (payloadInputPart != null) {
+                   updatedLoanoutCommon = (LoansoutCommon) payloadInputPart.getBody();
+               }
+               Assert.assertNotNull(updatedLoanoutCommon);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertNotNull(updatedLoanoutCommon);
 
         // Check selected fields in the updated resource.
         Assert.assertEquals(updatedLoanoutCommon.getLoanOutNumber(),
@@ -598,13 +599,9 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"update", "testSubmitRequest"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"update", "testSubmitRequest"})
     public void updateNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupUpdateNonExistent();
 
@@ -621,9 +618,9 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
 
     // ---------------------------------------------------------------
@@ -634,13 +631,9 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
     public void delete(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupDelete();
 
@@ -654,9 +647,9 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
 
     // Failure outcomes
@@ -664,13 +657,9 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"delete"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    dependsOnMethods = {"delete"})
     public void deleteNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupDeleteNonExistent();
 
@@ -684,9 +673,9 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
 
     // ---------------------------------------------------------------
@@ -696,7 +685,7 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
      * Tests the code for manually submitting data that is used by several
      * of the methods above.
      */
-    @Test(dependsOnMethods = {"create", "read"})
+//    @Test(dependsOnMethods = {"create", "read"})
     public void testSubmitRequest() {
 
         // Expected status code: 200 OK
@@ -773,8 +762,7 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
 
         PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent());
         PayloadOutputPart commonPart =
-                multipart.addPart(loanoutCommon, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(new LoanoutClient().getCommonPartName());
+                multipart.addPart(new LoanoutClient().getCommonPartName(), loanoutCommon);
 
         if (logger.isDebugEnabled()) {
             logger.debug("to be created, loanout common");
@@ -789,4 +777,30 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
     protected String getServiceName() {
         return LoanoutClient.SERVICE_NAME;
     }
+
+       @Override
+       public void CRUDTests(String testName) {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       protected PoxPayloadOut createInstance(String commonPartName,
+                       String identifier) {
+        PoxPayloadOut result = createLoanoutInstance(identifier);
+        return result;
+       }
+
+       @Override
+       protected LoansoutCommon updateInstance(LoansoutCommon commonPartObject) {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       protected void compareUpdatedInstances(LoansoutCommon original,
+                       LoansoutCommon updated) throws Exception {
+               // TODO Auto-generated method stub
+               
+       }
 }
index a6d60e172122dc19f11c9dd8b23307eee6a4a3dd..5f80ca17d6e2355927267afea45c6a425bb6a3d3 100644 (file)
@@ -39,7 +39,6 @@
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>5.6</version>
         </dependency>
         
       <!-- javax -->
index 8762eb92185881dba32112ec9ed447488f6caa26..a62213f36b1a57c3c8e04f0ed6826dc9ed29d678 100644 (file)
@@ -9,7 +9,6 @@
     </parent>\r
 \r
     <modelVersion>4.0.0</modelVersion>\r
-    <groupId>org.collectionspace.services</groupId>\r
     <artifactId>org.collectionspace.services.location.client</artifactId>\r
     <name>services.location.client</name>\r
     \r
@@ -59,7 +58,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>\r
         <dependency>\r
             <groupId>org.jboss.resteasy</groupId>\r
@@ -83,7 +81,6 @@
         <dependency>\r
             <groupId>commons-httpclient</groupId>\r
             <artifactId>commons-httpclient</artifactId>\r
-            <version>3.1</version>\r
         </dependency>\r
     </dependencies>\r
     \r
index c102107de32e05c44552a256044cbca403b83e04..be15359fff6ac2cee620218fe5fada78d45d1275 100644 (file)
  */
 package org.collectionspace.services.client;
 
+import org.collectionspace.services.location.LocationsCommon;
+
 /**
  * The Class LocationAuthorityClient.
  */
-public class LocationAuthorityClient extends AuthorityClientImpl<LocationAuthorityProxy> {
+public class LocationAuthorityClient extends AuthorityClientImpl<LocationsCommon, LocationAuthorityProxy> {
        public static final String SERVICE_NAME = "locationauthorities";
        public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;       
        public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
@@ -66,4 +68,14 @@ public class LocationAuthorityClient extends AuthorityClientImpl<LocationAuthori
        public Class<LocationAuthorityProxy> getProxyClass() {
                return LocationAuthorityProxy.class;
        }
+
+       @Override
+       public String getInAuthority(LocationsCommon item) {
+               return item.getInAuthority();
+       }
+
+       @Override
+       public void setInAuthority(LocationsCommon item, String inAuthorityCsid) {
+               item.setInAuthority(inAuthorityCsid);
+       }
 }
index 7175c5bf52dcdc100d7cb53605f6b68a3cae1670..6490045501d427e713ded4bd4aec4a2338abea73 100644 (file)
@@ -2,7 +2,6 @@ package org.collectionspace.services.client;
 \r
 import java.io.File;\r
 import java.util.ArrayList;\r
-import java.util.Arrays;\r
 import java.util.List;\r
 import java.util.Map;\r
 \r
@@ -21,7 +20,6 @@ import org.dom4j.DocumentException;
 import org.jboss.resteasy.client.ClientResponse;\r
 import org.slf4j.Logger;\r
 import org.slf4j.LoggerFactory;\r
-import org.testng.Assert;\r
 \r
 public class LocationAuthorityClientUtils {\r
     private static final Logger logger =\r
@@ -36,15 +34,16 @@ public class LocationAuthorityClientUtils {
      */\r
     public static PoxPayloadOut createLocationAuthorityInstance(\r
                String displayName, String shortIdentifier, String headerLabel ) {\r
+       \r
         LocationauthoritiesCommon locationAuthority = new LocationauthoritiesCommon();\r
         locationAuthority.setDisplayName(displayName);\r
         locationAuthority.setShortIdentifier(shortIdentifier);\r
         // String refName = createLocationAuthRefName(shortIdentifier, displayName);\r
         // locationAuthority.setRefName(refName);\r
         locationAuthority.setVocabType("LocationAuthority"); //FIXME: REM - Should this really be hard-coded?\r
+        \r
         PoxPayloadOut multipart = new PoxPayloadOut(LocationAuthorityClient.SERVICE_PAYLOAD_NAME);\r
-        PayloadOutputPart commonPart = multipart.addPart(locationAuthority, MediaType.APPLICATION_XML_TYPE);\r
-        commonPart.setLabel(headerLabel);\r
+        PayloadOutputPart commonPart = multipart.addPart(headerLabel, locationAuthority);\r
 \r
         if(logger.isDebugEnabled()){\r
                logger.debug("to be created, locationAuthority common ", \r
index cb373ac54ad9f9949ae568c00ebe8fc0baeb5801..a72e48426fa071059283ff592a9a25f12f054dca 100644 (file)
  */
 package org.collectionspace.services.client.test;
 
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
 import org.collectionspace.services.LocationJAXBSchema;
+import org.collectionspace.services.client.AbstractCommonListUtils;
 import org.collectionspace.services.client.AuthorityClient;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
-import org.collectionspace.services.common.AbstractCommonListUtils;
 import org.collectionspace.services.common.datetime.GregorianCalendarDateTimeUtils;
 import org.collectionspace.services.client.LocationAuthorityClient;
 import org.collectionspace.services.client.LocationAuthorityClientUtils;
@@ -41,8 +40,6 @@ import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.location.LocationauthoritiesCommon;
 import org.collectionspace.services.location.LocationsCommon;
 
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
 import org.jboss.resteasy.client.ClientResponse;
 
 import org.slf4j.Logger;
@@ -59,7 +56,7 @@ import org.testng.annotations.Test;
  * $LastChangedRevision: 753 $
  * $LastChangedDate: 2009-09-23 11:03:36 -0700 (Wed, 23 Sep 2009) $
  */
-public class LocationAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME: Test classes for Vocab, Person, Org, and Location should have a base class!
+public class LocationAuthorityServiceTest extends AbstractAuthorityServiceTest<LocationauthoritiesCommon, LocationsCommon> {
 
     /** The logger. */
     private final String CLASS_NAME = LocationAuthorityServiceTest.class.getName();
@@ -107,1142 +104,316 @@ public class LocationAuthorityServiceTest extends AbstractServiceTestImpl { //FI
     final String TEST_STATUS = "Approved";
     
     /** The known resource id. */
-    private String knownResourceId = null;
     private String knownResourceShortIdentifer = null;
     private String knownResourceRefName = null;
-    private String knownLocationTypeRefName = null;
-    private String knownItemResourceId = null;
-    private String knownItemResourceShortIdentifer = null;
-    private String knownContactResourceId = null;
-    
-    /** The n items to create in list. */
-    private int nItemsToCreateInList = 3;
-    
-    /** The all resource ids created. */
-    private List<String> allResourceIdsCreated = new ArrayList<String>();
-    
-    /** The all item resource ids created. */
-    private Map<String, String> allItemResourceIdsCreated =
-        new HashMap<String, String>();
-    
-    protected void setKnownResource( String id, String shortIdentifer,
-               String refName ) {
-       knownResourceId = id;
-       knownResourceShortIdentifer = shortIdentifer;
-       knownResourceRefName = refName;
-    }
-
-    protected void setKnownItemResource( String id, String shortIdentifer ) {
-       knownItemResourceId = id;
-       knownItemResourceShortIdentifer = shortIdentifer;
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
-     */
-    @Override
-    protected CollectionSpaceClient getClientInstance() {
-       return new LocationAuthorityClient();
-    }
-    
-    @Override
-    protected PoxPayloadOut createInstance(String identifier) {
-       LocationAuthorityClient client = new LocationAuthorityClient();
-        String shortId = identifier;
-       String displayName = "displayName-" + shortId;
-       // String baseRefName = LocationAuthorityClientUtils.createLocationAuthRefName(shortId, null);
-       PoxPayloadOut multipart = 
-            LocationAuthorityClientUtils.createLocationAuthorityInstance(
-           displayName, shortId, client.getCommonPartName());
-       return multipart;
-    }
-        
-    // ---------------------------------------------------------------
-    // CRUD tests : CREATE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        groups = {"create"})
-    public void create(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup, such as initializing the type of service request
-        // (e.g. CREATE, DELETE), its valid and expected status codes, and
-        // its associated HTTP method name (e.g. POST, DELETE).
-        setupCreate();
-
-        // Submit the request to the service and store the response.
-        LocationAuthorityClient client = new LocationAuthorityClient();
-        String shortId = createIdentifier();
-       String displayName = "displayName-" + shortId;
-       // String baseRefName = LocationAuthorityClientUtils.createLocationAuthRefName(shortId, null);
-       
-       PoxPayloadOut multipart = 
-            LocationAuthorityClientUtils.createLocationAuthorityInstance(
-           displayName, shortId, client.getCommonPartName());
-       String newID = null;
-        ClientResponse<Response> res = client.create(multipart);
-        try {
-               int statusCode = res.getStatus();
-       
-               // Check the status code of the response: does it match
-               // the expected response(s)?
-               //
-               // Specifically:
-               // Does it fall within the set of valid status codes?
-               // Does it exactly match the expected status code?
-               if(logger.isDebugEnabled()){
-                   logger.debug(testName + ": status = " + statusCode);
-               }
-               Assert.assertTrue(this.REQUEST_TYPE.isValidStatusCode(statusCode),
-                       invalidStatusCodeMessage(this.REQUEST_TYPE, statusCode));
-               Assert.assertEquals(statusCode, this.EXPECTED_STATUS_CODE);
-       
-               newID = LocationAuthorityClientUtils.extractId(res);
-        } finally {
-               res.releaseConnection();
-        }
-        // Store the ID returned from the first resource created
-        // for additional tests below.
-        final String EMPTY_REFNAME = "";
-        if (knownResourceId == null){
-               setKnownResource( newID, shortId, EMPTY_REFNAME );
-            if (logger.isDebugEnabled()) {
-                logger.debug(testName + ": knownResourceId=" + knownResourceId);
-            }
-        }
-        // Store the IDs from every resource created by tests,
-        // so they can be deleted after tests have been run.
-        allResourceIdsCreated.add(newID);
-    }
-
-    /**
-     * Creates the item.
-     *
-     * @param testName the test name
-     */
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        groups = {"create"}, dependsOnMethods = {"create"})
-    public void createItem(String testName) {
-        if(logger.isDebugEnabled()){
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        setupCreate();
-        createItemInAuthority(knownResourceId, knownResourceRefName);
-    }
-
-    /**
-     * Creates the item in authority.
-     *
-     * @param vcsid the vcsid
-     * @param authRefName the auth ref name
-     * @return the string
-     */
-    private String createItemInAuthority(String vcsid, String authRefName) {
-
-        final String testName = "createItemInAuthority("+vcsid+","+authRefName+")";
-        if(logger.isDebugEnabled()){
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-
-        // Submit the request to the service and store the response.
-        LocationAuthorityClient client = new LocationAuthorityClient();
-        Map<String, String> shelf1Map = new HashMap<String,String>();
-        // TODO Make loc type and status be controlled vocabs.
-        shelf1Map.put(LocationJAXBSchema.NAME, TEST_NAME);
-        shelf1Map.put(LocationJAXBSchema.SHORT_IDENTIFIER, TEST_SHORTID);
-        shelf1Map.put(LocationJAXBSchema.CONDITION_NOTE, TEST_CONDITION_NOTE);
-        shelf1Map.put(LocationJAXBSchema.CONDITION_NOTE_DATE, TEST_CONDITION_NOTE_DATE);
-        shelf1Map.put(LocationJAXBSchema.SECURITY_NOTE, TEST_SECURITY_NOTE);
-        shelf1Map.put(LocationJAXBSchema.ACCESS_NOTE, TEST_ACCESS_NOTE);
-        shelf1Map.put(LocationJAXBSchema.ADDRESS, TEST_ADDRESS);
-        shelf1Map.put(LocationJAXBSchema.LOCATION_TYPE, TEST_LOCATION_TYPE);
-        shelf1Map.put(LocationJAXBSchema.TERM_STATUS, TEST_STATUS);
-        
-        String newID = LocationAuthorityClientUtils.createItemInAuthority(vcsid,
-                       authRefName, shelf1Map, client );
-
-        // Store the ID returned from the first item resource created
-        // for additional tests below.
-        if (knownItemResourceId == null){
-               setKnownItemResource(newID, TEST_SHORTID);
-            if (logger.isDebugEnabled()) {
-                logger.debug(testName + ": knownItemResourceId=" + newID);
-            }
-        }
-
-        // Store the IDs from any item resources created
-        // by tests, along with the IDs of their parents, so these items
-        // can be deleted after all tests have been run.
-        allItemResourceIdsCreated.put(newID, vcsid);
-
-        return newID;
-    }
-
-
-
-    // Failure outcomes
-
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
-     */
-    @Override
-    public void createWithEmptyEntityBody(String testName) throws Exception {
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
-     */
-    @Override
-    public void createWithMalformedXml(String testName) throws Exception {
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
-     */
-    @Override
-    public void createWithWrongXmlSchema(String testName) throws Exception {
-    }
-
-
-    // ---------------------------------------------------------------
-    // CRUD tests : CREATE LIST tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-        * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
-        */
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        groups = {"createList"}, dependsOnGroups = {"create"})
-    public void createList(String testName) throws Exception {
-        for (int i = 0; i < nItemsToCreateInList; i++) {
-            create(testName);
-        }
-    }
-
-    /**
-     * Creates the item list.
-     *
-     * @param testName the test name
-     * @throws Exception the exception
-     */
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        groups = {"createList"}, dependsOnMethods = {"createList"})
-    public void createItemList(String testName) throws Exception {
-        // Add items to the initially-created, known parent record.
-        for (int j = 0; j < nItemsToCreateInList; j++) {
-            createItem(testName);
-        }
-    }
-
-    // ---------------------------------------------------------------
-    // CRUD tests : READ tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        groups = {"read"}, dependsOnGroups = {"create"})
-    public void read(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupRead();
-        
-        // Submit the request to the service and store the response.
-        LocationAuthorityClient client = new LocationAuthorityClient();
-       String newID = null;
-        ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-        try {
-               //FIXME: remove the following try catch once Aron fixes signatures
-               try {
-                   PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-                   LocationauthoritiesCommon locationAuthority = 
-                       (LocationauthoritiesCommon) extractPart(input,
-                           client.getCommonPartName(), LocationauthoritiesCommon.class);
-                   Assert.assertNotNull(locationAuthority);
-                   Assert.assertNotNull(locationAuthority.getDisplayName());
-                   Assert.assertNotNull(locationAuthority.getShortIdentifier());
-                   Assert.assertNotNull(locationAuthority.getRefName());
-               } catch (Exception e) {
-                   throw new RuntimeException(e);
-               }
-        } finally {
-               res.releaseConnection();
-        }
-    }
-
-    /**
-     * Read by name.
-     *
-     * @param testName the test name
-     * @throws Exception the exception
-     */
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-            groups = {"read"}, dependsOnGroups = {"create"})
-        public void readByName(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName+"("+knownResourceShortIdentifer+")", CLASS_NAME));
-        }
-        // Perform setup.
-        setupRead();
-
-        // Submit the request to the service and store the response.
-        LocationAuthorityClient client = new LocationAuthorityClient();
-        ClientResponse<String> res = client.readByName(knownResourceShortIdentifer);
-        assertStatusCode(res, testName);
-        try {
-               //FIXME: remove the following try catch once Aron fixes signatures
-               try {
-                   PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-                   LocationauthoritiesCommon locationAuthority = (LocationauthoritiesCommon) extractPart(input,
-                           client.getCommonPartName(), LocationauthoritiesCommon.class);
-                   Assert.assertNotNull(locationAuthority);
-               } catch (Exception e) {
-                   throw new RuntimeException(e);
-               }
-        } finally {
-               res.releaseConnection();
-        }
-    }
-
-
-    /**
-        * Read item.
-        *
-        * @param testName the test name
-        * @throws Exception the exception
-        */
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        groups = {"read"}, dependsOnMethods = {"read"})
-    public void readItem(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupRead();
-
-        // Submit the request to the service and store the response.
-        LocationAuthorityClient client = new LocationAuthorityClient();
-        ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
-        assertStatusCode(res, testName);
-        try {
-               // Check whether we've received a location.
-               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-               LocationsCommon location = (LocationsCommon) extractPart(input,
-                       client.getItemCommonPartName(), LocationsCommon.class);
-               Assert.assertNotNull(location);
-               boolean showFull = true;
-               if(showFull && logger.isDebugEnabled()){
-                   logger.debug(testName + ": returned payload:");
-                   logger.debug(objectAsXmlString(location, LocationsCommon.class));
-               }
-               Assert.assertEquals(location.getInAuthority(), knownResourceId);
-           } finally {
-               res.releaseConnection();
-           }
-
-    }
-
-    /**
-     * Verify item display name.
-     *
-     * @param testName the test name
-     * @throws Exception the exception
-     */
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        dependsOnMethods = {"readItem", "updateItem"})
-    public void verifyItemDisplayName(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdate();
-
-        // Submit the request to the service and store the response.
-        LocationAuthorityClient client = new LocationAuthorityClient();
-        ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
-        assertStatusCode(res, testName);
-        try {
-               // Check whether location has expected displayName.
-               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-               LocationsCommon location = (LocationsCommon) extractPart(input,
-                       client.getItemCommonPartName(), LocationsCommon.class);
-               Assert.assertNotNull(location);
-               String displayName = location.getDisplayName();
-               // Make sure displayName matches computed form
-               String expectedDisplayName = 
-                   LocationAuthorityClientUtils.prepareDefaultDisplayName(TEST_NAME);
-               Assert.assertNotNull(displayName, expectedDisplayName);
-               
-               // Update the shortName and verify the computed name is updated.
-               location.setCsid(null);
-               location.setDisplayNameComputed(true);
-               location.setName("updated-" + TEST_NAME);
-               expectedDisplayName = 
-                   LocationAuthorityClientUtils.prepareDefaultDisplayName("updated-" + TEST_NAME);
-       
-               // Submit the updated resource to the service and store the response.
-               PoxPayloadOut output = new PoxPayloadOut(LocationAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
-               PayloadOutputPart commonPart = output.addPart(location, MediaType.APPLICATION_XML_TYPE);
-               commonPart.setLabel(client.getItemCommonPartName());
-               res.releaseConnection();
-               res = client.updateItem(knownResourceId, knownItemResourceId, output);
-               assertStatusCode(res, testName);
-       
-               // Retrieve the updated resource and verify that its contents exist.
-               input = new PoxPayloadIn(res.getEntity());
-               LocationsCommon updatedLocation =
-                       (LocationsCommon) extractPart(input,
-                               client.getItemCommonPartName(), LocationsCommon.class);
-               Assert.assertNotNull(updatedLocation);
-       
-               // Verify that the updated resource received the correct data.
-               Assert.assertEquals(updatedLocation.getName(), location.getName(),
-                   "Updated ForeName in Location did not match submitted data.");
-               // Verify that the updated resource computes the right displayName.
-               Assert.assertEquals(updatedLocation.getDisplayName(), expectedDisplayName,
-                   "Updated ForeName in Location not reflected in computed DisplayName.");
-       
-               // Now Update the displayName, not computed and verify the computed name is overriden.
-               location.setDisplayNameComputed(false);
-               expectedDisplayName = "TestName";
-               location.setDisplayName(expectedDisplayName);
-       
-               // Submit the updated resource to the service and store the response.
-               output = new PoxPayloadOut(LocationAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
-               commonPart = output.addPart(location, MediaType.APPLICATION_XML_TYPE);
-               commonPart.setLabel(client.getItemCommonPartName());
-               res.releaseConnection();
-               res = client.updateItem(knownResourceId, knownItemResourceId, output);
-               assertStatusCode(res, testName);
-       
-               // Retrieve the updated resource and verify that its contents exist.
-               input = new PoxPayloadIn(res.getEntity());
-               updatedLocation =
-                       (LocationsCommon) extractPart(input,
-                               client.getItemCommonPartName(), LocationsCommon.class);
-               Assert.assertNotNull(updatedLocation);
-       
-               // Verify that the updated resource received the correct data.
-               Assert.assertEquals(updatedLocation.isDisplayNameComputed(), false,
-                       "Updated displayNameComputed in Location did not match submitted data.");
-               // Verify that the updated resource computes the right displayName.
-               Assert.assertEquals(updatedLocation.getDisplayName(),
-                               expectedDisplayName,
-                       "Updated DisplayName (not computed) in Location not stored.");
-           } finally {
-               res.releaseConnection();
-           }
-    }
-
-    /**
-     * Verify illegal item display name.
-     *
-     * @param testName the test name
-     * @throws Exception the exception
-     */
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-            dependsOnMethods = {"verifyItemDisplayName"})
-    public void verifyIllegalItemDisplayName(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        
-        // Perform setup for read.
-        setupRead();
-
-        // Submit the request to the service and store the response.
-        LocationAuthorityClient client = new LocationAuthorityClient();
-        ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
-        assertStatusCode(res, testName);
-        
-        // Perform setup for update.
-        testSetup(STATUS_BAD_REQUEST, ServiceRequestType.UPDATE);
-
-        try {
-       
-               // Check whether Location has expected displayName.
-               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-               LocationsCommon location = (LocationsCommon) extractPart(input,
-                       client.getItemCommonPartName(), LocationsCommon.class);
-               Assert.assertNotNull(location);
-               // Try to Update with computed false and no displayName
-               location.setDisplayNameComputed(false);
-               location.setDisplayName(null);
-       
-               // Submit the updated resource to the service and store the response.
-               PoxPayloadOut output = new PoxPayloadOut(LocationAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
-               PayloadOutputPart commonPart = output.addPart(location, MediaType.APPLICATION_XML_TYPE);
-               commonPart.setLabel(client.getItemCommonPartName());
-               res.releaseConnection();
-               res = client.updateItem(knownResourceId, knownItemResourceId, output);
-            assertStatusCode(res, testName);
-           } finally {
-               res.releaseConnection();
-           }
-    }
-   
-
-    // Failure outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        groups = {"read"}, dependsOnMethods = {"read"})
-    public void readNonExistent(String testName) {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadNonExistent();
-
-        // Submit the request to the service and store the response.
-        LocationAuthorityClient client = new LocationAuthorityClient();
-        ClientResponse<String> res = client.read(NON_EXISTENT_ID);
-        try {
-               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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                       invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-               Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-           } finally {
-               res.releaseConnection();
-           }
-    }
-
-    /**
-     * Read item non existent.
-     *
-     * @param testName the test name
-     */
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        groups = {"read"}, dependsOnMethods = {"readItem"})
-    public void readItemNonExistent(String testName) {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadNonExistent();
-
-        // Submit the request to the service and store the response.
-        LocationAuthorityClient client = new LocationAuthorityClient();
-        ClientResponse<String> res = client.readItem(knownResourceId, NON_EXISTENT_ID);
-        try {
-               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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                       invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-               Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-           } finally {
-               res.releaseConnection();
-           }
-    }
-
-
-    // ---------------------------------------------------------------
-    // CRUD tests : READ_LIST tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        groups = {"readList"}, dependsOnGroups = {"createList", "read"})
-    public void readList(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadList();
-
-        // Submit the request to the service and store the response.
-        LocationAuthorityClient client = new LocationAuthorityClient();
-        ClientResponse<AbstractCommonList> res = client.readList();
-        assertStatusCode(res, testName);
-        try {
-               AbstractCommonList list = res.getEntity();
-       
-               // Optionally output additional data about list members for debugging.
-               if(logger.isTraceEnabled()){
-                       AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
-               }
-           } finally {
-               res.releaseConnection();
-           }
-    }
-
-    /**
-     * Read item list.
-     */
-    @Test(groups = {"readList"}, dependsOnMethods = {"readList"})
-    public void readItemList() {
-        String testName = "readItemList";
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        readItemList(knownResourceId, null);
-    }
-
-    /**
-     * Read item list by authority name.
-     */
-    @Test(groups = {"readList"}, dependsOnMethods = {"readItemList"})
-    public void readItemListByAuthorityName() {
-        String testName = "readItemListByAuthorityName";
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        readItemList(null, knownResourceShortIdentifer);
-    }
-    
-    /**
-     * 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();
-        ClientResponse<AbstractCommonList> 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!");
-        }
-        assertStatusCode(res, testName);
-        try {
-               AbstractCommonList list = res.getEntity();
-       
-               List<AbstractCommonList.ListItem> items =
-                   list.getListItem();
-               int nItemsReturned = items.size();
-               // There will be one item created, associated with a
-               // known parent resource, by the createItem test.
-               //
-               // In addition, there will be 'nItemsToCreateInList'
-               // additional items created by the createItemList test,
-               // all associated with the same parent resource.
-               int nExpectedItems = nItemsToCreateInList + 1;
-               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, REFNAME);
-                Assert.assertTrue((null != value), "Item refName is null!");
-               value = 
-                       AbstractCommonListUtils.ListItemGetElementValue(item, DISPLAYNAME);
-                Assert.assertTrue((null != value), "Item displayName is null!");
-            }
-            if(logger.isTraceEnabled()){
-               AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
-            }
-           } finally {
-               res.releaseConnection();
-           }
-    }
-
-
-    // Failure outcomes
-    // None at present.
-
-    // ---------------------------------------------------------------
-    // CRUD tests : UPDATE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        groups = {"update"}, dependsOnGroups = {"read", "readList"})
-    public void update(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdate();
-
-        // Retrieve the contents of a resource to update.
-        LocationAuthorityClient client = new LocationAuthorityClient();
-        ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-        try {
-       
-               if(logger.isDebugEnabled()){
-                   logger.debug("got LocationAuthority to update with ID: " + knownResourceId);
-               }
-               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-               LocationauthoritiesCommon locationAuthority = (LocationauthoritiesCommon) extractPart(input,
-                       client.getCommonPartName(), LocationauthoritiesCommon.class);
-               Assert.assertNotNull(locationAuthority);
-       
-               // Update the contents of this resource.
-               locationAuthority.setDisplayName("updated-" + locationAuthority.getDisplayName());
-               locationAuthority.setVocabType("updated-" + locationAuthority.getVocabType());
-               if(logger.isDebugEnabled()){
-                   logger.debug("to be updated LocationAuthority");
-                   logger.debug(objectAsXmlString(locationAuthority, LocationauthoritiesCommon.class));
-               }
-       
-               // Submit the updated resource to the service and store the response.
-               PoxPayloadOut output = new PoxPayloadOut(LocationAuthorityClient.SERVICE_PAYLOAD_NAME);
-               PayloadOutputPart commonPart = output.addPart(locationAuthority, MediaType.APPLICATION_XML_TYPE);
-               commonPart.setLabel(client.getCommonPartName());
-               res.releaseConnection();
-               res = client.update(knownResourceId, output);
-               assertStatusCode(res, testName);
-
-               // Retrieve the updated resource and verify that its contents exist.
-               input = new PoxPayloadIn(res.getEntity());
-               LocationauthoritiesCommon updatedLocationAuthority =
-                       (LocationauthoritiesCommon) extractPart(input,
-                               client.getCommonPartName(), LocationauthoritiesCommon.class);
-               Assert.assertNotNull(updatedLocationAuthority);
-       
-               // Verify that the updated resource received the correct data.
-               Assert.assertEquals(updatedLocationAuthority.getDisplayName(),
-                       locationAuthority.getDisplayName(),
-                       "Data in updated object did not match submitted data.");
-           } finally {
-               res.releaseConnection();
-           }
-    }
-
-    /**
-     * Update item.
-     *
-     * @param testName the test name
-     * @throws Exception the exception
-     */
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        groups = {"update"}, dependsOnMethods = {"update"})
-    public void updateItem(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdate();
-
-        // Retrieve the contents of a resource to update.
-        LocationAuthorityClient client = new LocationAuthorityClient();
-        ClientResponse<String> res =
-                client.readItem(knownResourceId, knownItemResourceId);
-        assertStatusCode(res, testName);
-        try {
-               if(logger.isDebugEnabled()){
-                   logger.debug("got Location to update with ID: " +
-                       knownItemResourceId +
-                       " in LocationAuthority: " + knownResourceId );
-               }
-               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-               LocationsCommon location = (LocationsCommon) extractPart(input,
-                       client.getItemCommonPartName(), LocationsCommon.class);
-               Assert.assertNotNull(location);
-       
-               // Update the contents of this resource.
-               location.setCsid(null);
-               location.setName("updated-" + location.getName());
-               if(logger.isDebugEnabled()){
-                   logger.debug("to be updated Location");
-                   logger.debug(objectAsXmlString(location,
-                       LocationsCommon.class));
-               }        
-       
-               // Submit the updated resource to the service and store the response.
-               PoxPayloadOut output = new PoxPayloadOut(LocationAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
-               PayloadOutputPart commonPart = output.addPart(location, MediaType.APPLICATION_XML_TYPE);
-               commonPart.setLabel(client.getItemCommonPartName());
-               res.releaseConnection();
-               res = client.updateItem(knownResourceId, knownItemResourceId, output);
-               assertStatusCode(res, testName);
-
-               // Retrieve the updated resource and verify that its contents exist.
-               input = new PoxPayloadIn(res.getEntity());
-               LocationsCommon updatedLocation =
-                       (LocationsCommon) extractPart(input,
-                               client.getItemCommonPartName(), LocationsCommon.class);
-               Assert.assertNotNull(updatedLocation);
-       
-               // Verify that the updated resource received the correct data.
-               Assert.assertEquals(updatedLocation.getName(), location.getName(),
-                       "Data in updated Location did not match submitted data.");
-           } finally {
-               res.releaseConnection();
-           }
-    }
-
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
-     */
-    @Override
-    public void updateWithEmptyEntityBody(String testName) throws Exception {
-    }
-
+    
+    private String knownLocationTypeRefName = null;
+    private String knownContactResourceId = null;
+        
     /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
+     * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    public void updateWithMalformedXml(String testName) throws Exception {
+    protected CollectionSpaceClient getClientInstance() {
+       return new LocationAuthorityClient();
     }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
+    
+    /**
+     * Creates the item in authority.
+     *
+     * @param vcsid the vcsid
+     * @param authRefName the auth ref name
+     * @return the string
      */
-    @Override
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
-    }
-
+    private String createItemInAuthority(String vcsid, String authRefName) {
+        final String testName = "createItemInAuthority("+vcsid+","+authRefName+")";
 
-    /* (non-Javadoc)
-        * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
-        */
-@Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        groups = {"update"}, dependsOnMethods = {"update", "testSubmitRequest"})
-    public void updateNonExistent(String testName) throws Exception {
+        // Submit the request to the service and store the response.
+        LocationAuthorityClient client = new LocationAuthorityClient();
+        Map<String, String> shelf1Map = new HashMap<String,String>();
+        // TODO Make loc type and status be controlled vocabs.
+        shelf1Map.put(LocationJAXBSchema.NAME, TEST_NAME);
+        shelf1Map.put(LocationJAXBSchema.SHORT_IDENTIFIER, TEST_SHORTID);
+        shelf1Map.put(LocationJAXBSchema.CONDITION_NOTE, TEST_CONDITION_NOTE);
+        shelf1Map.put(LocationJAXBSchema.CONDITION_NOTE_DATE, TEST_CONDITION_NOTE_DATE);
+        shelf1Map.put(LocationJAXBSchema.SECURITY_NOTE, TEST_SECURITY_NOTE);
+        shelf1Map.put(LocationJAXBSchema.ACCESS_NOTE, TEST_ACCESS_NOTE);
+        shelf1Map.put(LocationJAXBSchema.ADDRESS, TEST_ADDRESS);
+        shelf1Map.put(LocationJAXBSchema.LOCATION_TYPE, TEST_LOCATION_TYPE);
+        shelf1Map.put(LocationJAXBSchema.TERM_STATUS, TEST_STATUS);
+        
+        String newID = LocationAuthorityClientUtils.createItemInAuthority(vcsid,
+                       authRefName, shelf1Map, client );
 
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
+        // Store the ID returned from the first item resource created
+        // for additional tests below.
+        if (knownItemResourceId == null){
+               setKnownItemResource(newID, TEST_SHORTID);
+            if (logger.isDebugEnabled()) {
+                logger.debug(testName + ": knownItemResourceId=" + newID);
+            }
         }
-        // Perform setup.
-        setupUpdateNonExistent();
 
-        // Submit the request to the service and store the response.
-        // Note: The ID(s) used when creating the request payload may be arbitrary.
-        // The only relevant ID may be the one used in update(), below.
-        LocationAuthorityClient client = new LocationAuthorityClient();
-       String displayName = "displayName-NON_EXISTENT_ID";
-       PoxPayloadOut multipart = LocationAuthorityClientUtils.createLocationAuthorityInstance(
-                               displayName, "nonEx", client.getCommonPartName());
-        ClientResponse<String> res =
-                client.update(NON_EXISTENT_ID, multipart);
-        try {
-               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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                       invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-               Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-           } finally {
-               res.releaseConnection();
-           }
+        // Store the IDs from any item resources created
+        // by tests, along with the IDs of their parents, so these items
+        // can be deleted after all tests have been run.
+        allResourceItemIdsCreated.put(newID, vcsid);
+
+        return newID;
     }
 
     /**
-     * Update non existent item.
+     * Verify item display name.
      *
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        groups = {"update"}, dependsOnMethods = {"updateItem", "testItemSubmitRequest"})
-    public void updateNonExistentItem(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
+    @Test(dataProvider="testName",
+        dependsOnMethods = {"readItem", "updateItem"})
+    public void verifyItemDisplayName(String testName) throws Exception {
         // Perform setup.
-        setupUpdateNonExistent();
-
-        // Submit the request to the service and store the response.
-        // Note: The ID used in this 'create' call may be arbitrary.
-        // The only relevant ID may be the one used in update(), below.
+        setupRead();
+        //
+        // First, read our known item resource
+        //
         LocationAuthorityClient client = new LocationAuthorityClient();
-        Map<String, String> nonexMap = new HashMap<String,String>();
-        nonexMap.put(LocationJAXBSchema.NAME, TEST_NAME);
-        nonexMap.put(LocationJAXBSchema.SHORT_IDENTIFIER, "nonEx");
-        nonexMap.put(LocationJAXBSchema.LOCATION_TYPE, TEST_LOCATION_TYPE);
-        nonexMap.put(LocationJAXBSchema.TERM_STATUS, TEST_STATUS);
-        // PoxPayloadOut multipart = 
-       // LocationAuthorityClientUtils.createLocationInstance(
-       //              LocationAuthorityClientUtils.createLocationRefName(knownResourceRefName, "nonEx", "Non Existent"), 
-       //              nonexMap, client.getItemCommonPartName() );
-        final String EMPTY_REFNAME = "";
-        PoxPayloadOut multipart = 
-                LocationAuthorityClientUtils.createLocationInstance(EMPTY_REFNAME, 
-                       nonexMap, client.getItemCommonPartName() );
-        ClientResponse<String> res =
-                client.updateItem(knownResourceId, NON_EXISTENT_ID, multipart);
+        ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
+        LocationsCommon location = null;
         try {
-               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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                       invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-               Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-           } finally {
-               res.releaseConnection();
-           }
-    }
-
-    // ---------------------------------------------------------------
-    // CRUD tests : DELETE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-
-    // Note: delete sub-resources in ascending hierarchical order,
-    // before deleting their parents.
-
-   /**
-    * Delete item.
-    *
-    * @param testName the test name
-    * @throws Exception the exception
-    */
-   @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        //groups = {"delete"}, dependsOnGroups = {"create", "read", "readList", "readListByPartialTerm", "update"})
-        groups = {"delete"}, dependsOnGroups = {"create", "read", "readList", "update"})
-    public void deleteItem(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDelete();
-
-        if(logger.isDebugEnabled()){
-            logger.debug("parentcsid =" + knownResourceId +
-                " itemcsid = " + knownItemResourceId);
+            assertStatusCode(res, testName);
+               // Check whether location has expected displayName.
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               location = (LocationsCommon) extractPart(input,
+                       client.getItemCommonPartName(), LocationsCommon.class);
+               Assert.assertNotNull(location);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-
-        // Submit the request to the service and store the response.
-        LocationAuthorityClient client = new LocationAuthorityClient();
-        ClientResponse<Response> res = 
-               client.deleteItem(knownResourceId, knownItemResourceId);
+        //
+        // Now prepare an updated payload.
+        //
+        String displayName = location.getDisplayName();
+        // Make sure displayName matches computed form
+        String expectedDisplayName = 
+            LocationAuthorityClientUtils.prepareDefaultDisplayName(TEST_NAME);
+        Assert.assertNotNull(displayName, expectedDisplayName);
+        
+        // Update the shortName and verify the computed name is updated.
+        location.setCsid(null);
+        location.setDisplayNameComputed(true);
+        location.setName("updated-" + TEST_NAME);
+        expectedDisplayName = 
+            LocationAuthorityClientUtils.prepareDefaultDisplayName("updated-" + TEST_NAME);
+
+        // Submit the updated resource to the service and store the response.
+        PoxPayloadOut output = new PoxPayloadOut(LocationAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
+        PayloadOutputPart commonPart = output.addPart(client.getItemCommonPartName(), location);
+
+        setupUpdate();        
+        res = client.updateItem(knownResourceId, knownItemResourceId, output);
+        LocationsCommon updatedLocation = null;
         try {
-               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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                       invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-               Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-           } finally {
-               res.releaseConnection();
-           }
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        groups = {"delete"}, dependsOnMethods = {"deleteItem"})
-    public void delete(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDelete();
-
-        if(logger.isDebugEnabled()){
-            logger.debug("parentcsid =" + knownResourceId);
+               assertStatusCode(res, testName);
+               // Retrieve the updated resource and verify that its contents exist.
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               updatedLocation = (LocationsCommon) extractPart(input,
+                               client.getItemCommonPartName(), LocationsCommon.class);
+               Assert.assertNotNull(updatedLocation);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
 
-        // Submit the request to the service and store the response.
-        LocationAuthorityClient client = new LocationAuthorityClient();
-        ClientResponse<Response> res = client.delete(knownResourceId);
+        // Verify that the updated resource received the correct data.
+        Assert.assertEquals(updatedLocation.getName(), location.getName(),
+            "Updated ForeName in Location did not match submitted data.");
+        // Verify that the updated resource computes the right displayName.
+        Assert.assertEquals(updatedLocation.getDisplayName(), expectedDisplayName,
+            "Updated ForeName in Location not reflected in computed DisplayName.");
+        //
+        // Now Update the displayName, not computed and verify the computed name is overriden.
+        //
+        location.setDisplayNameComputed(false);
+        expectedDisplayName = "TestName";
+        location.setDisplayName(expectedDisplayName);
+
+        // Submit the updated resource to the service and store the response.
+        output = new PoxPayloadOut(LocationAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
+        commonPart = output.addPart(client.getItemCommonPartName(), location);
+        setupUpdate();        
+        res = client.updateItem(knownResourceId, knownItemResourceId, output);
         try {
-               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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                       invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-               Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-           } finally {
-               res.releaseConnection();
-           }
-    }
-
-    // Failure outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        groups = {"delete"}, dependsOnMethods = {"delete"})
-    public void deleteNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
+               assertStatusCode(res, testName);
+               // Retrieve the updated resource and verify that its contents exist.
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               updatedLocation = (LocationsCommon) extractPart(input,
+                               client.getItemCommonPartName(), LocationsCommon.class);
+               Assert.assertNotNull(updatedLocation);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        // Perform setup.
-        setupDeleteNonExistent();
 
-        // Submit the request to the service and store the response.
-        LocationAuthorityClient client = new LocationAuthorityClient();
-        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
-        try {
-               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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                       invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-               Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-           } finally {
-               res.releaseConnection();
-           }
+        // Verify that the updated resource received the correct data.
+        Assert.assertEquals(updatedLocation.isDisplayNameComputed(), false,
+                "Updated displayNameComputed in Location did not match submitted data.");
+        // Verify that the updated resource computes the right displayName.
+        Assert.assertEquals(updatedLocation.getDisplayName(),
+                       expectedDisplayName,
+                "Updated DisplayName (not computed) in Location not stored.");
     }
 
     /**
-     * Delete non existent item.
+     * Verify illegal item display name.
      *
      * @param testName the test name
+     * @throws Exception the exception
      */
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        groups = {"delete"}, dependsOnMethods = {"deleteItem"})
-    public void deleteNonExistentItem(String testName) {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDeleteNonExistent();
+    @Test(dataProvider="testName",
+            dependsOnMethods = {"verifyItemDisplayName"})
+    public void verifyIllegalItemDisplayName(String testName) throws Exception {
+        // Perform setup for read.
+        setupRead();
 
         // Submit the request to the service and store the response.
         LocationAuthorityClient client = new LocationAuthorityClient();
-        ClientResponse<Response> res = client.deleteItem(knownResourceId, NON_EXISTENT_ID);
+        ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
+        LocationsCommon location = null;
         try {
-               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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                       invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-               Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            assertStatusCode(res, testName);        
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               location = (LocationsCommon) extractPart(input,
+                       client.getItemCommonPartName(), LocationsCommon.class);
+               Assert.assertNotNull(location);
            } finally {
-               res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
            }
+               
+        // Try to Update with computed false and no displayName
+        location.setDisplayNameComputed(false);
+        location.setDisplayName(null);
+        
+        // Submit the updated resource to the service and store the response.
+        PoxPayloadOut output = new PoxPayloadOut(LocationAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
+        PayloadOutputPart commonPart = output.addPart(client.getItemCommonPartName(), location);
+        setupUpdateWithInvalidBody(); // we expected a failure here.
+        res = client.updateItem(knownResourceId, knownItemResourceId, output);
+        try {
+               assertStatusCode(res, testName);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
     }
 
-    // ---------------------------------------------------------------
-    // Utility tests : tests of code used in tests above
-    // ---------------------------------------------------------------
     /**
-     * Tests the code for manually submitting data that is used by several
-     * of the methods above.
+     * Read item list.
      */
-    @Test(dependsOnMethods = {"create", "read"})
-    public void testSubmitRequest() {
-
-        // Expected status code: 200 OK
-        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
-
-        // Submit the request to the service and store the response.
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getResourceURL(knownResourceId);
-        int statusCode = submitRequest(method, url);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if(logger.isDebugEnabled()){
-            logger.debug("testSubmitRequest: url=" + url +
-                " status=" + statusCode);
-        }
-        Assert.assertEquals(statusCode, EXPECTED_STATUS);
-
+    @Test(dataProvider = "testName", groups = {"readList"},
+               dependsOnMethods = {"readList"})
+    public void readItemList(String testName) {
+        readItemList(knownAuthorityWithItems, null);
     }
 
     /**
-     * Test item submit request.
+     * Read item list by authority name.
      */
-    @Test(dependsOnMethods = {"createItem", "readItem", "testSubmitRequest"})
-    public void testItemSubmitRequest() {
-
-        // Expected status code: 200 OK
-        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
-
-        // Submit the request to the service and store the response.
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getItemResourceURL(knownResourceId, knownItemResourceId);
-        int statusCode = submitRequest(method, url);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if(logger.isDebugEnabled()){
-            logger.debug("testItemSubmitRequest: url=" + url +
-                " status=" + statusCode);
-        }
-        Assert.assertEquals(statusCode, EXPECTED_STATUS);
+    @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();
+               ClientResponse<AbstractCommonList> 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.getEntity();
+               } finally {
+                       if (res != null) {
+                res.releaseConnection();
+            }
+               }
+               
+               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, REFNAME);
+                       Assert.assertTrue((null != value), "Item refName is null!");
+                       value = AbstractCommonListUtils.ListItemGetElementValue(item,
+                                       DISPLAYNAME);
+                       Assert.assertTrue((null != value), "Item displayName 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.
+    }
+    
+    @Test(dataProvider = "testName", dependsOnMethods = {"localDeleteItem"})    
+    public void localDelete(String testName) throws Exception {
+       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.
+    }
+    
+    @Test(dataProvider = "testName", groups = {"delete"},
+       dependsOnMethods = {"verifyIllegalItemDisplayName"})
+    public void localDeleteItem(String testName) throws Exception {
+       super.deleteItem(testName);
+    }
+    
     // ---------------------------------------------------------------
     // Cleanup of resources created during testing
     // ---------------------------------------------------------------
@@ -1274,21 +445,18 @@ public class LocationAuthorityServiceTest extends AbstractServiceTestImpl { //FI
         LocationAuthorityClient client = new LocationAuthorityClient();
         parentResourceId = knownResourceId;
         // Clean up item resources.
-        for (Map.Entry<String, String> entry : allItemResourceIdsCreated.entrySet()) {
+        for (Map.Entry<String, String> entry : allResourceItemIdsCreated.entrySet()) {
             itemResourceId = entry.getKey();
             parentResourceId = entry.getValue();
             // Note: Any non-success responses from the delete operation
             // below are ignored and not reported.
-            ClientResponse<Response> res =
-                client.deleteItem(parentResourceId, itemResourceId);
-               res.releaseConnection();
+            client.deleteItem(parentResourceId, itemResourceId).releaseConnection();
         }
         // Clean up parent resources.
         for (String resourceId : allResourceIdsCreated) {
             // Note: Any non-success responses from the delete operation
             // below are ignored and not reported.
-            ClientResponse<Response> res = client.delete(resourceId);
-               res.releaseConnection();
+            client.delete(resourceId).releaseConnection();
         }
     }
 
@@ -1331,5 +499,111 @@ public class LocationAuthorityServiceTest extends AbstractServiceTestImpl { //FI
         return getItemServiceRootURL(parentResourceIdentifier) + "/" + itemResourceIdentifier;
     }
 
+       @Override
+       public void authorityTests(String testName) {
+               // TODO Auto-generated method stub
+               
+       }
+
+       //
+       // Location specific overrides
+       //
+       
+       @Override
+       protected PoxPayloadOut createInstance(String commonPartName,
+                       String identifier) {
+        // Submit the request to the service and store the response.
+        String shortId = identifier;
+       String displayName = "displayName-" + shortId;
+       // String baseRefName = LocationAuthorityClientUtils.createLocationAuthRefName(shortId, null);          
+       PoxPayloadOut result = 
+            LocationAuthorityClientUtils.createLocationAuthorityInstance(
+           displayName, shortId, commonPartName);
+               return result;
+       }
+       
+       @Override
+    protected PoxPayloadOut createNonExistenceInstance(String commonPartName, String identifier) {
+        String displayName = "displayName-NON_EXISTENT_ID";
+       PoxPayloadOut result = LocationAuthorityClientUtils.createLocationAuthorityInstance(
+                               displayName, "nonEx", commonPartName);
+       return result;
+    }
+
+       @Override
+       protected LocationauthoritiesCommon updateInstance(LocationauthoritiesCommon locationauthoritiesCommon) {
+               LocationauthoritiesCommon result = new LocationauthoritiesCommon();
+               
+               result.setDisplayName("updated-" + locationauthoritiesCommon.getDisplayName());
+               result.setVocabType("updated-" + locationauthoritiesCommon.getVocabType());
+               
+               return result;
+       }
+
+       @Override
+       protected void compareUpdatedInstances(LocationauthoritiesCommon original,
+                       LocationauthoritiesCommon updated) throws Exception {
+        Assert.assertEquals(updated.getDisplayName(),
+                       original.getDisplayName(),
+                "Display name in updated object did not match submitted data.");
+       }
+
+       protected void compareReadInstances(LocationauthoritiesCommon original,
+                       LocationauthoritiesCommon fromRead) throws Exception {
+        Assert.assertNotNull(fromRead.getDisplayName());
+        Assert.assertNotNull(fromRead.getShortIdentifier());
+        Assert.assertNotNull(fromRead.getRefName());
+       }
+       
+       //
+       // Authority item specific overrides
+       //
+       
+       @Override
+       protected String createItemInAuthority(String authorityId) {
+               return createItemInAuthority(authorityId, null /*refname*/);
+       }
+
+       @Override
+       protected LocationsCommon updateItemInstance(LocationsCommon locationsCommon) {
+               LocationsCommon result = new LocationsCommon();
+               
+        result.setName("updated-" + locationsCommon.getName());
+               result.setDisplayName("updated-" + locationsCommon.getDisplayName());
+               
+               return result;
+       }
+
+       @Override
+       protected void compareUpdatedItemInstances(LocationsCommon original,
+                       LocationsCommon updated) throws Exception {
+        Assert.assertEquals(updated.getName(), original.getName(),
+                "Data in updated Location did not match submitted data.");
+       }
+
+       @Override
+       protected void verifyReadItemInstance(LocationsCommon item)
+                       throws Exception {
+               // TODO Auto-generated method stub
+               
+       }
 
+       @Override
+       protected PoxPayloadOut createNonExistenceItemInstance(
+                       String commonPartName, String identifier) {
+        Map<String, String> nonexMap = new HashMap<String,String>();
+        nonexMap.put(LocationJAXBSchema.NAME, TEST_NAME);
+        nonexMap.put(LocationJAXBSchema.SHORT_IDENTIFIER, "nonEx");
+        nonexMap.put(LocationJAXBSchema.LOCATION_TYPE, TEST_LOCATION_TYPE);
+        nonexMap.put(LocationJAXBSchema.TERM_STATUS, TEST_STATUS);
+        // PoxPayloadOut multipart = 
+       // LocationAuthorityClientUtils.createLocationInstance(
+       //              LocationAuthorityClientUtils.createLocationRefName(knownResourceRefName, "nonEx", "Non Existent"), 
+       //              nonexMap, client.getItemCommonPartName() );
+        final String EMPTY_REFNAME = "";
+        PoxPayloadOut result = 
+                LocationAuthorityClientUtils.createLocationInstance(EMPTY_REFNAME, 
+                       nonexMap, commonPartName);
+               return result;
+       }
 }
index 3476c0f1c53fd0b0aa81a6f5f1238ae6bd17cf54..6af2334469ec5573d2b85b315deece34b2c31907 100644 (file)
@@ -57,7 +57,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>\r
         \r
         <!-- apache -->\r
index 24b6342c87db4f75c70bfdd63fadfba70cc95fb6..066984d91c861d195300079cd7b11d0abdf57ded 100644 (file)
@@ -67,7 +67,6 @@
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>5.6</version>
         </dependency>
         <dependency>
             <groupId>org.jboss.resteasy</groupId>
index 201bc7204f741dafaecbe4ad4d436af7d5ad1648..48d2819a2d83e625d737c7eee86b1799ea0efcce 100644 (file)
@@ -44,9 +44,6 @@ import org.collectionspace.services.media.MediaCommon;
 
 import org.jboss.resteasy.client.ClientResponse;
 
-import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
-import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
-import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
@@ -59,7 +56,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision:  $
  * $LastChangedDate:  $
  */
-public class MediaAuthRefsTest extends BaseServiceTest {
+public class MediaAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
     private final String CLASS_NAME = MediaAuthRefsTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(MediaAuthRefsTest.class);
     final String PERSON_AUTHORITY_NAME = "MediaPersonAuth";
@@ -86,7 +83,7 @@ public class MediaAuthRefsTest extends BaseServiceTest {
     }
 
     @Override
-    protected AbstractCommonList getAbstractCommonList(ClientResponse<AbstractCommonList> response) {
+    protected AbstractCommonList getCommonList(ClientResponse<AbstractCommonList> response) {
         throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
 
@@ -97,15 +94,13 @@ public class MediaAuthRefsTest extends BaseServiceTest {
         media.setTitle(title);
 
         PoxPayloadOut multipart = new PoxPayloadOut(MediaClient.SERVICE_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = multipart.addPart(media, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(new MediaClient().getCommonPartName());
+        PayloadOutputPart commonPart = multipart.addPart(new MediaClient().getCommonPartName(), media);
         logger.debug("to be created, media common: " + objectAsXmlString(media, MediaCommon.class));
         return multipart;
     }
 
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+    @Test(dataProvider = "testName")
     public void createWithAuthRefs(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
         testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
         String identifier = createIdentifier(); // Submit the request to the service and store the response.
         createPersonRefs();// Create all the person refs and entities
@@ -114,11 +109,17 @@ public class MediaAuthRefsTest extends BaseServiceTest {
         MediaClient mediaClient = new MediaClient();
         PoxPayloadOut multipart = createMediaInstance(depositorRefName, "media.title-" + identifier);
         ClientResponse<Response> res = mediaClient.create(multipart);
-        assertStatusCode(res, testName);
-        if (knownResourceId == null) {// Store the ID returned from the first resource created for additional tests below.
-            knownResourceId = extractId(res);
+        try {
+               assertStatusCode(res, testName);
+               if (knownResourceId == null) {// Store the ID returned from the first resource created for additional tests below.
+                   knownResourceId = extractId(res);
+               }
+               mediaIdsCreated.add(extractId(res));// Store the IDs from every resource created; delete on cleanup
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        mediaIdsCreated.add(extractId(res));// Store the IDs from every resource created; delete on cleanup
     }
 
     protected void createPersonRefs() {
@@ -127,8 +128,14 @@ public class MediaAuthRefsTest extends BaseServiceTest {
         PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
                        PERSON_AUTHORITY_NAME, PERSON_AUTHORITY_NAME, personAuthClient.getCommonPartName());
         ClientResponse<Response> res = personAuthClient.create(multipart);
-        assertStatusCode(res, "createPersonRefs (not a surefire test)");
-        personAuthCSID = extractId(res);
+        try {
+               assertStatusCode(res, "createPersonRefs (not a surefire test)");
+               personAuthCSID = extractId(res);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
         String authRefName = PersonAuthorityClientUtils.getAuthorityRefName(personAuthCSID, null);
         // Create temporary Person resources, and their corresponding refNames by which they can be identified.
         String csid = "";
@@ -143,6 +150,8 @@ public class MediaAuthRefsTest extends BaseServiceTest {
     }
 
     protected String createPerson(String firstName, String surName, String shortId, String authRefName) {
+       String result = null;
+       
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         Map<String, String> personInfo = new HashMap<String, String>();
         personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
@@ -151,8 +160,16 @@ public class MediaAuthRefsTest extends BaseServiceTest {
         PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonInstance(
                        personAuthCSID, authRefName, personInfo, personAuthClient.getItemCommonPartName());
         ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
-        assertStatusCode(res, "createPerson (not a surefire test)");
-        return extractId(res);
+        try {
+               assertStatusCode(res, "createPerson (not a surefire test)");
+               result = extractId(res);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
+        
+        return result;
     }
 
     // @Test annotation commented out by Aron 2010-12-02 until media payload is set to the
@@ -164,23 +181,39 @@ public class MediaAuthRefsTest extends BaseServiceTest {
     //
     // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"createWithAuthRefs"})
     public void readAndCheckAuthRefs(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
         testSetup(STATUS_OK, ServiceRequestType.READ);
+
         MediaClient mediaClient = new MediaClient();
         ClientResponse<String> res = mediaClient.read(knownResourceId);
-        assertStatusCode(res, testName);
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        MediaCommon media = (MediaCommon) extractPart(input, mediaClient.getCommonPartName(), MediaCommon.class);
-        Assert.assertNotNull(media);
-        logger.debug(objectAsXmlString(media, MediaCommon.class));
+        PoxPayloadIn input = null;
+        MediaCommon media = null;
+        try {
+               assertStatusCode(res, testName);
+               input = new PoxPayloadIn(res.getEntity());
+               media = (MediaCommon) extractPart(input, mediaClient.getCommonPartName(), MediaCommon.class);
+               Assert.assertNotNull(media);
+               logger.debug(objectAsXmlString(media, MediaCommon.class));
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
 
         // Check a couple of fields
         Assert.assertEquals(media.getTitle(), title);
 
         // Get the auth refs and check them
         ClientResponse<AuthorityRefList> res2 = mediaClient.getAuthorityRefs(knownResourceId);
-        assertStatusCode(res2, testName);
-        AuthorityRefList list = res2.getEntity();
+        AuthorityRefList list = null;
+        try {
+               assertStatusCode(res2, testName);
+               list = res2.getEntity();
+        } finally {
+               if (res2 != null) {
+                       res2.releaseConnection();
+            }
+        }
+        
         List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
         int numAuthRefsFound = items.size();
         logger.debug("Authority references, found " + numAuthRefsFound);
index b1e08d34b3d8b885adad69f50744b482631819ae..3d8a2cf5c3f62480a530f77d8160b454e4443bd5 100644 (file)
@@ -24,7 +24,6 @@ package org.collectionspace.services.client.test;
 
 import java.io.File;
 import java.net.URL;
-import java.util.ArrayList;
 import java.util.List;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
@@ -32,9 +31,7 @@ import javax.ws.rs.core.Response;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.MediaClient;
 import org.collectionspace.services.client.PayloadOutputPart;
-import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
-import org.collectionspace.services.common.AbstractCommonListUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.media.LanguageList;
 import org.collectionspace.services.media.MediaCommon;
@@ -55,11 +52,10 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision:  $
  * $LastChangedDate:  $
  */
-public class MediaServiceTest extends AbstractServiceTestImpl {
+public class MediaServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonList, MediaCommon> {
 
     private final String CLASS_NAME = MediaServiceTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(MediaServiceTest.class);
-    private String knownResourceId = null;
 
     private boolean mediaCleanup = true;
     
@@ -99,26 +95,10 @@ public class MediaServiceTest extends AbstractServiceTestImpl {
     }
 
     @Override
-    protected AbstractCommonList getAbstractCommonList(ClientResponse<AbstractCommonList> response) {
+    protected AbstractCommonList getCommonList(ClientResponse<AbstractCommonList> response) {
         return response.getEntity(AbstractCommonList.class);
     }
 
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
-    public void create(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupCreate();
-        MediaClient client = new MediaClient();
-        PoxPayloadOut multipart = createMediaInstance(createIdentifier());
-        ClientResponse<Response> res = client.create(multipart);
-        assertStatusCode(res, testName);
-        if (knownResourceId == null) {
-            knownResourceId = extractId(res);  // Store the ID returned from the first resource created for additional tests below.
-            logger.debug(testName + ": knownResourceId=" + knownResourceId);
-        }
-        allResourceIdsCreated.add(extractId(res)); // Store the IDs from every resource created by tests so they can be deleted after tests have been run.
-    }
-
     /**
      * Looks in the .../src/test/resources/blobs directory for files from which to create Blob
      * instances.
@@ -128,85 +108,101 @@ public class MediaServiceTest extends AbstractServiceTestImpl {
      * @param fromUri - if 'false' then send the service a multipart/form-data POST from which to create the blob.
      * @throws Exception the exception
      */    
-    public void createBlob(String testName, boolean fromUri) throws Exception {
-        setupCreate();
-        MediaClient client = new MediaClient();
-        PoxPayloadOut multipart = createMediaInstance(createIdentifier());
-        ClientResponse<Response> mediaRes = null;
-        String mediaCsid = null;
-        try {
-               mediaRes = client.create(multipart);
-               assertStatusCode(mediaRes, testName);
-               mediaCsid = extractId(mediaRes);
-        } finally {
-               mediaRes.releaseConnection();
-        }
-        
-        String currentDir = this.getResourceDir();
-        String blobsDirPath = currentDir + File.separator + BLOBS_DIR;
-        File blobsDir = new File(blobsDirPath);
-        if (blobsDir != null && blobsDir.exists()) {
-               File[] children = blobsDir.listFiles();
-               if (children != null && children.length > 0) {
-                       File blobFile = null;
-                       //
-                       // Since Media records can have only a single associated blob,
-                       // we'll stop after we find a valid candidate
-                       //
-                       for (File child : children) {
-                               if (isBlobbable(child) == true) {
-                                       blobFile = child;
-                                       break;
-                               }
-                       }
-                       //
-                       // If we found a good blob candidate file, then try to create the blob record
-                       //
-                       if (blobFile != null) {
-                               client = new MediaClient();
-                               ClientResponse<Response> res = null;
-                               String mimeType = this.getMimeType(blobFile);
-                               logger.debug("Processing file URI: " + blobFile.getAbsolutePath());
-                               logger.debug("MIME type is: " + mimeType);
-                               try {
-                                       if (fromUri == true) {
-                                               URL childUrl = blobFile.toURI().toURL();
-                                               res = client.createBlobFromUri(mediaCsid, childUrl.toString());
-                                       } else {
-                                           MultipartFormDataOutput formData = new MultipartFormDataOutput();
-                                           OutputPart outputPart = formData.addFormData("file", blobFile, MediaType.valueOf(mimeType));
-                                           res = client.createBlobFromFormData(mediaCsid, formData);
-                                       }
-                               } finally {
-                                       res.releaseConnection();
-                               }
-                           assertStatusCode(res, testName);
-                           if (isMediaCleanup() == true) {
-                               allResourceIdsCreated.add(extractId(res));
-                               allResourceIdsCreated.add(mediaCsid);
-                           }
-                       } else {
-                               logger.debug("Directory: " + blobsDirPath + " contains no readable files.");
-                       }
-               } else {
-                       logger.debug("Directory: " + blobsDirPath + " is empty or cannot be read.");
-               }
-        } else {
-               logger.debug("Directory: " + blobsDirPath + " is missing or cannot be read.");
-        }        
-    }
+       public void createBlob(String testName, boolean fromUri) throws Exception {
+               setupCreate();
+               //
+               // First create a media record
+               //
+               MediaClient client = new MediaClient();
+               PoxPayloadOut multipart = createMediaInstance(createIdentifier());
+               ClientResponse<Response> mediaRes = client.create(multipart);
+               String mediaCsid = null;
+               try {
+                       assertStatusCode(mediaRes, testName);
+                       mediaCsid = extractId(mediaRes);
+               } finally {
+                       if (mediaRes != null) {
+                               mediaRes.releaseConnection();
+                       }
+               }
+               //
+               // Next, create a blob record to associate with the media record
+               // FIXME: REM - 1/2012, This method is too large.  Break it up.  The code below
+               // could be put into a utility class that could also be used by the blob service tests.
+               //
+               String currentDir = this.getResourceDir();
+               String blobsDirPath = currentDir + File.separator + BLOBS_DIR;
+               File blobsDir = new File(blobsDirPath);
+               if (blobsDir != null && blobsDir.exists()) {
+                       File[] children = blobsDir.listFiles();
+                       if (children != null && children.length > 0) {
+                               File blobFile = null;
+                               //
+                               // Since Media records can have only a single associated
+                               // blob, we'll stop after we find a valid candidate.
+                               //
+                               for (File child : children) {
+                                       if (isBlobbable(child) == true) {
+                                               blobFile = child;
+                                               break;
+                                       }
+                               }
+                               //
+                               // If we found a good blob candidate file, then try to
+                               // create the blob record
+                               //
+                               if (blobFile != null) {
+                                       client = new MediaClient();
+                                       ClientResponse<Response> res = null;
+                                       String mimeType = this.getMimeType(blobFile);
+                                       logger.debug("Processing file URI: " + blobFile.getAbsolutePath());
+                                       logger.debug("MIME type is: " + mimeType);
+                                       if (fromUri == true) {
+                                               URL childUrl = blobFile.toURI().toURL();
+                                               res = client.createBlobFromUri(mediaCsid,
+                                                               childUrl.toString());
+                                       } else {
+                                               MultipartFormDataOutput formData = new MultipartFormDataOutput();
+                                               OutputPart outputPart = formData.addFormData("file",
+                                                               blobFile, MediaType.valueOf(mimeType));
+                                               res = client
+                                                               .createBlobFromFormData(mediaCsid, formData);
+                                       }
+                                       try {
+                                               assertStatusCode(res, testName);
+                                               String blobCsid = extractId(res);
+                                               if (isMediaCleanup() == true) {
+                                                       allResourceIdsCreated.add(blobCsid);
+                                                       allResourceIdsCreated.add(mediaCsid);
+                                               }
+                                       } finally {
+                                               if (res != null) {
+                                                       res.releaseConnection();
+                                               }
+                                       }
+                               } else {
+                                       logger.debug("Directory: " + blobsDirPath
+                                                       + " contains no readable files.");
+                               }
+                       } else {
+                               logger.debug("Directory: " + blobsDirPath
+                                               + " is empty or cannot be read.");
+                       }
+               } else {
+                       logger.debug("Directory: " + blobsDirPath
+                                       + " is missing or cannot be read.");
+               }
+       }
     
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, 
-               dependsOnMethods = {"create"})
+    @Test(dataProvider = "testName", 
+               dependsOnMethods = {"CRUDTests"})
     public void createWithBlobUri(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
         createBlob(testName, true /*with URI*/);
     }
     
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, 
+    @Test(dataProvider = "testName", 
                dependsOnMethods = {"createWithBlobUri"})
     public void createWithBlobPost(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
         createBlob(testName, false /*with POST*/);
     }
     
@@ -224,165 +220,15 @@ public class MediaServiceTest extends AbstractServiceTestImpl {
 //        allResourceIdsCreated.add(extractId(res)); // Store the IDs from every resource created by tests so they can be deleted after tests have been run.
 //    }
 
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create"})
-    public void createList(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        for (int i = 0; i < 3; i++) {
-            create(testName);
-        }
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create"})
-    public void read(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupRead();
-        MediaClient client = new MediaClient();
-        ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        MediaCommon media = (MediaCommon) extractPart(input, client.getCommonPartName(), MediaCommon.class);
-        Assert.assertNotNull(media);
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"createList", "read"})
-    public void readList(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupReadList();
-        MediaClient client = new MediaClient();
-        ClientResponse<AbstractCommonList> res = client.readList();
-        assertStatusCode(res, testName);
-        AbstractCommonList list = res.getEntity();
-        // Optionally output additional data about list members for debugging.
-        if(logger.isTraceEnabled()){
-               AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
-        }
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"read"})
-    public void update(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupUpdate();
-        MediaClient client = new MediaClient();
-        ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-        logger.debug("got object to update with ID: " + knownResourceId);
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());;
-        MediaCommon media = (MediaCommon) extractPart(input, client.getCommonPartName(), MediaCommon.class);
-        Assert.assertNotNull(media);
-
-        media.setTitle("updated-" + media.getTitle());
-        logger.debug("Object to be updated:"+objectAsXmlString(media, MediaCommon.class));
-        PoxPayloadOut output = new PoxPayloadOut(MediaClient.SERVICE_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = output.addPart(media, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getCommonPartName());
-        res = client.update(knownResourceId, output);
-        assertStatusCode(res, testName);
-        input = new PoxPayloadIn(res.getEntity());
-        MediaCommon updatedMedia = (MediaCommon) extractPart(input, client.getCommonPartName(), MediaCommon.class);
-        Assert.assertNotNull(updatedMedia);
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"update", "testSubmitRequest"})
-    public void updateNonExistent(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupUpdateNonExistent();
-        // Submit the request to the service and store the response.
-        // Note: The ID used in this 'create' call may be arbitrary.
-        // The only relevant ID may be the one used in update(), below.
-        MediaClient client = new MediaClient();
-        PoxPayloadOut multipart = createMediaInstance(NON_EXISTENT_ID);
-        ClientResponse<String> res = client.update(NON_EXISTENT_ID, multipart);
-        assertStatusCode(res, testName);
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
-    public void delete(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupDelete();
-        MediaClient client = new MediaClient();
-        ClientResponse<Response> res = client.delete(knownResourceId);
-        assertStatusCode(res, testName);
-    }
-
-    // ---------------------------------------------------------------
-    // Failure outcome tests : means we expect response to fail, but test to succeed
-    // ---------------------------------------------------------------
-
-    // Failure outcome
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"read"})
-    public void readNonExistent(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupReadNonExistent();
-        MediaClient client = new MediaClient();
-        ClientResponse<String> res = client.read(NON_EXISTENT_ID);
-        assertStatusCode(res, testName);
-    }
-
-    // Failure outcome
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"delete"})
-    public void deleteNonExistent(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupDeleteNonExistent();
-        MediaClient client = new MediaClient();
-        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
-        assertStatusCode(res, testName);
-    }
-
-    // Failure outcomes
-    // Placeholders until the tests below can be implemented. See Issue CSPACE-401.
-
-    @Override
-    public void createWithEmptyEntityBody(String testName) throws Exception {
-    }
-
-    @Override
-    public void createWithMalformedXml(String testName) throws Exception {
-    }
-
-    @Override
-    public void createWithWrongXmlSchema(String testName) throws Exception {
-    }
-
-    @Override
-    public void updateWithEmptyEntityBody(String testName) throws Exception {
-    }
-
-    @Override
-    public void updateWithMalformedXml(String testName) throws Exception {
-    }
-
-    @Override
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
-    }
-
     // ---------------------------------------------------------------
     // Utility tests : tests of code used in tests above
     // ---------------------------------------------------------------
 
-    @Test(dependsOnMethods = {"create", "read"})
-    public void testSubmitRequest() {
-        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode(); // Expected status code: 200 OK
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getResourceURL(knownResourceId);
-        int statusCode = submitRequest(method, url);
-        logger.debug("testSubmitRequest: url=" + url + " status=" + statusCode);
-        Assert.assertEquals(statusCode, EXPECTED_STATUS);
-    }
-
     @Override
     protected PoxPayloadOut createInstance(String identifier) {
        return createMediaInstance(identifier);
     }
     
-    
     // ---------------------------------------------------------------
     // Utility methods used by tests above
     // ---------------------------------------------------------------
@@ -414,4 +260,34 @@ public class MediaServiceTest extends AbstractServiceTestImpl {
 
         return multipart;
     }
+
+       @Override
+       protected PoxPayloadOut createInstance(String commonPartName,
+                       String identifier) {
+               return createMediaInstance(identifier);
+       }
+
+       @Override
+       protected MediaCommon updateInstance(final MediaCommon original) {
+               MediaCommon result = new MediaCommon();
+               
+               result.setTitle("updated-" + original.getTitle());
+
+               return result;
+       }
+
+       @Override
+       protected void compareUpdatedInstances(MediaCommon original,
+                       MediaCommon updated) throws Exception {
+               Assert.assertEquals(updated.getTitle(), original.getTitle());
+       }
+
+       @Override
+    @Test(dataProvider = "testName",
+       dependsOnMethods = {
+               "org.collectionspace.services.client.test.AbstractServiceTestImpl.baseCRUDTests"})      
+       public void CRUDTests(String testName) {
+               // TODO Auto-generated method stub
+               
+       }
 }
index 12eed8972bd80b162d7f5bf9cb10473ddb1fe3dc..5d04019ea52bb2cbcfd6cf2d2981089e8fbe422f 100644 (file)
@@ -54,7 +54,6 @@
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>5.6</version>
         </dependency>
         
       <!-- javax -->
index 52d85c548bba8430367fc33486021e80a9cc62e7..d0de00df37c90b373cf85422b9d94289b2ff6699 100644 (file)
@@ -63,7 +63,6 @@
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>5.6</version>
         </dependency>
         <dependency>
             <groupId>org.jboss.resteasy</groupId>
index 16f071a9f38ce61326880962c6e47c87517a7839..1d1f22e2724975e8a286f172c8038bb578c07135 100644 (file)
@@ -60,7 +60,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision$
  * $LastChangedDate$
  */
-public class MovementAuthRefsTest extends BaseServiceTest {
+public class MovementAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
 
     private final String CLASS_NAME = MovementAuthRefsTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
@@ -69,7 +69,6 @@ public class MovementAuthRefsTest extends BaseServiceTest {
 
     // Instance variables specific to this test.
     final String PERSON_AUTHORITY_NAME = "TestPersonAuth";
-    private String knownResourceId = null;
     private List<String> movementIdsCreated = new ArrayList<String>();
     private List<String> personIdsCreated = new ArrayList<String>();
     private String personAuthCSID = null;
@@ -92,7 +91,7 @@ public class MovementAuthRefsTest extends BaseServiceTest {
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-       protected AbstractCommonList getAbstractCommonList(
+       protected AbstractCommonList getCommonList(
                        ClientResponse<AbstractCommonList> response) {
        throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
@@ -101,12 +100,8 @@ public class MovementAuthRefsTest extends BaseServiceTest {
     // CRUD tests : CREATE tests
     // ---------------------------------------------------------------
     // Success outcomes
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
+    @Test(dataProvider="testName")
     public void createWithAuthRefs(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
 
         // Submit the request to the service and store the response.
@@ -136,9 +131,9 @@ public class MovementAuthRefsTest extends BaseServiceTest {
         if(logger.isDebugEnabled()){
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
 
         // Store the ID returned from the first resource created
         // for additional tests below.
@@ -164,8 +159,8 @@ public class MovementAuthRefsTest extends BaseServiceTest {
         ClientResponse<Response> res = personAuthClient.create(multipart);
         int statusCode = res.getStatus();
 
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-            invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+            invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, STATUS_CREATED);
         personAuthCSID = extractId(res);
 
@@ -190,8 +185,8 @@ public class MovementAuthRefsTest extends BaseServiceTest {
         ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
         int statusCode = res.getStatus();
 
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, STATUS_CREATED);
        return extractId(res);
     }
@@ -200,39 +195,45 @@ public class MovementAuthRefsTest extends BaseServiceTest {
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
         dependsOnMethods = {"createWithAuthRefs"})
     public void readAndCheckAuthRefs(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         testSetup(STATUS_OK, ServiceRequestType.READ);
 
         // Submit the request to the service and store the response.
         MovementClient movementClient = new MovementClient();
         ClientResponse<String> res = movementClient.read(knownResourceId);
-        assertStatusCode(res, testName);
-
-        // Extract and return the common part of the record.
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        PayloadInputPart payloadInputPart = input.getPart(movementClient.getCommonPartName());
         MovementsCommon movementCommon = null;
-        if (payloadInputPart != null) {
-               movementCommon = (MovementsCommon) payloadInputPart.getBody();
-        }
-        Assert.assertNotNull(movementCommon);
-        if(logger.isDebugEnabled()){
-            logger.debug(objectAsXmlString(movementCommon, MovementsCommon.class));
+        try {
+               assertStatusCode(res, testName);
+               // Extract and return the common part of the record.
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               PayloadInputPart payloadInputPart = input.getPart(movementClient.getCommonPartName());
+               if (payloadInputPart != null) {
+                       movementCommon = (MovementsCommon) payloadInputPart.getBody();
+               }
+               Assert.assertNotNull(movementCommon);
+               if(logger.isDebugEnabled()){
+                   logger.debug(objectAsXmlString(movementCommon, MovementsCommon.class));
+               }
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
         // Check a couple of fields
         // FIXME
         Assert.assertEquals(movementCommon.getMovementContact(), movementContactRefName);
         
         // Get the auth refs and check them
-        ClientResponse<AuthorityRefList> res2 =
-           movementClient.getAuthorityRefs(knownResourceId);
-        assertStatusCode(res2, testName);
-
-        AuthorityRefList list = res2.getEntity();
+        ClientResponse<AuthorityRefList> res2 = movementClient.getAuthorityRefs(knownResourceId);
+        AuthorityRefList list = null;
+        try {
+            assertStatusCode(res2, testName);
+               list = res2.getEntity();
+        } finally {
+               if (res2 != null) {
+                       res2.releaseConnection();
+            }
+        }
         
         List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
         int numAuthRefsFound = items.size();
index b3370c00df52c066227e147bae6e3e0638711a81..9dcef12048db771fbc84fe85eb3098da65224172 100644 (file)
  */
 package org.collectionspace.services.client.test;
 
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
 import java.util.List;
-import java.util.TimeZone;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
-import org.collectionspace.services.common.AbstractCommonListUtils;
 import org.collectionspace.services.common.datetime.GregorianCalendarDateTimeUtils;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.MovementClient;
@@ -41,6 +35,7 @@ import org.collectionspace.services.movement.MovementMethodsList;
 
 import org.jboss.resteasy.client.ClientResponse;
 
+import org.collectionspace.services.client.AbstractCommonListUtils;
 import org.collectionspace.services.client.PayloadInputPart;
 import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadIn;
@@ -52,746 +47,214 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * MovementServiceTest, carries out tests against a
- * deployed and running Movement Service.
- *
- * $LastChangedRevision$
- * $LastChangedDate$
+ * MovementServiceTest, carries out tests against a deployed and running
+ * Movement Service.
+ * 
+ * $LastChangedRevision$ $LastChangedDate: 2011-11-14 23:26:36 -0800
+ * (Mon, 14 Nov 2011) $
  */
-public class MovementServiceTest extends AbstractServiceTestImpl {
-
-   /** The logger. */
-    private final String CLASS_NAME = MovementServiceTest.class.getName();
-    private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
-
-    final String SERVICE_NAME = "movements";
-    final String SERVICE_PATH_COMPONENT = "movements";
-
-    // Instance variables specific to this test.
-    private String knownResourceId = null;
-    private final static String TIMESTAMP_UTC =
-            GregorianCalendarDateTimeUtils.timestampUTC();
-    
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
-     */
-    @Override
-    protected CollectionSpaceClient getClientInstance() {
-       return new MovementClient();
-    }
-    
-    // ---------------------------------------------------------------
-    // CRUD tests : CREATE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
-    public void create(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup, such as initializing the type of service request
-        // (e.g. CREATE, DELETE), its valid and expected status codes, and
-        // its associated HTTP method name (e.g. POST, DELETE).
-        setupCreate();
-
-        // Submit the request to the service and store the response.
-        MovementClient client = new MovementClient();
-        String identifier = createIdentifier();
-        PoxPayloadOut multipart = createMovementInstance(identifier);
-        ClientResponse<Response> res = client.create(multipart);
-
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        //
-        // Specifically:
-        // Does it fall within the set of valid status codes?
-        // Does it exactly match the expected status code?
-        if(logger.isDebugEnabled()){
-            logger.debug(testName + ": status = " + statusCode);
-        }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
-        // Store the ID returned from the first resource created
-        // for additional tests below.
-        if (knownResourceId == null){
-            knownResourceId = extractId(res);
-            if (logger.isDebugEnabled()) {
-                logger.debug(testName + ": knownResourceId=" + knownResourceId);
-            }
-        }
-        
-        // Store the IDs from every resource created by tests,
-        // so they can be deleted after tests have been run.
-        allResourceIdsCreated.add(extractId(res));
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        dependsOnMethods = {"create"})
-    public void createList(String testName) throws Exception {
-        for(int i = 0; i < 3; i++){
-            create(testName);
-        }
-    }
-
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
-     */
-    @Override
-    public void createWithEmptyEntityBody(String testName) throws Exception {
-       //Should this really be empty?
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
-     */
-    @Override
-    public void createWithMalformedXml(String testName) throws Exception {
-       //Should this really be empty?
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
-     */
-    @Override
-    public void createWithWrongXmlSchema(String testName) throws Exception {
-       //Should this really be empty?
-    }
-
-    /*
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-        dependsOnMethods = {"create", "testSubmitRequest"})
-    public void createWithEmptyEntityBody(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupCreateWithEmptyEntityBody();
-
-        // Submit the request to the service and store the response.
-        String method = REQUEST_TYPE.httpMethodName();
-        String url = getServiceRootURL();
-        String mediaType = MediaType.APPLICATION_XML;
-        final String entity = "";
-        int statusCode = submitRequest(method, url, mediaType, entity);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if(logger.isDebugEnabled()){
-            logger.debug("createWithEmptyEntityBody url=" + url +
-                " status=" + statusCode);
-         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-        invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-        dependsOnMethods = {"create", "testSubmitRequest"})
-    public void createWithMalformedXml(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupCreateWithMalformedXml();
-
-        // Submit the request to the service and store the response.
-        String method = REQUEST_TYPE.httpMethodName();
-        String url = getServiceRootURL();
-        String mediaType = MediaType.APPLICATION_XML;
-        final String entity = MALFORMED_XML_DATA; // Constant from base class.
-        int statusCode = submitRequest(method, url, mediaType, entity);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if(logger.isDebugEnabled()){
-            logger.debug(testName + ": url=" + url +
-                " status=" + statusCode);
-         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-        invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-        dependsOnMethods = {"create", "testSubmitRequest"})
-    public void createWithWrongXmlSchema(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupCreateWithWrongXmlSchema();
-
-        // Submit the request to the service and store the response.
-        String method = REQUEST_TYPE.httpMethodName();
-        String url = getServiceRootURL();
-        String mediaType = MediaType.APPLICATION_XML;
-        final String entity = WRONG_XML_SCHEMA_DATA;
-        int statusCode = submitRequest(method, url, mediaType, entity);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if(logger.isDebugEnabled()){
-            logger.debug(testName + ": url=" + url +
-                " status=" + statusCode);
-         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-        invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-     */
-
-    // ---------------------------------------------------------------
-    // CRUD tests : READ tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        dependsOnMethods = {"create"})
-    public void read(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupRead();
-
-        // Submit the request to the service and store the response.
-        MovementClient client = new MovementClient();
-        ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-
-        // Get the common part of the response and verify that it is not null.
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
-        MovementsCommon movementCommon = null;
-        if (payloadInputPart != null) {
-               movementCommon = (MovementsCommon) payloadInputPart.getBody();
-        }
-        Assert.assertNotNull(movementCommon);
-
-        // Check selected fields.
-
-        // Check the values of one or more date/time fields.
-        if (logger.isDebugEnabled()) {
-            logger.debug("locationDate=" + movementCommon.getLocationDate());
-            logger.debug("TIMESTAMP_UTC=" + TIMESTAMP_UTC);
-        }
-        Assert.assertTrue(movementCommon.getLocationDate().equals(TIMESTAMP_UTC));
-        Assert.assertTrue(movementCommon.getPlannedRemovalDate().equals(TIMESTAMP_UTC));
-        Assert.assertNull(movementCommon.getRemovalDate());
-        
-        // Check the values of fields containing Unicode UTF-8 (non-Latin-1) characters.
-       if(logger.isDebugEnabled()){
-            logger.debug("UTF-8 data sent=" + getUTF8DataFragment() + "\n"
-                    + "UTF-8 data received=" + movementCommon.getMovementNote());
-    }
-        Assert.assertEquals(movementCommon.getMovementNote(), getUTF8DataFragment(),
-                "UTF-8 data retrieved '" + movementCommon.getMovementNote()
-                + "' does not match expected data '" + getUTF8DataFragment());
-
-    }
-
-    // Failure outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        dependsOnMethods = {"read"})
-    public void readNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadNonExistent();
-
-        // Submit the request to the service and store the response.
-        MovementClient client = new MovementClient();
-        ClientResponse<String> res = client.read(NON_EXISTENT_ID);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    // ---------------------------------------------------------------
-    // CRUD tests : READ_LIST tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        dependsOnMethods = {"createList", "read"})
-    public void readList(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadList();
-
-        // Submit the request to the service and store the response.
-        MovementClient client = new MovementClient();
-        ClientResponse<AbstractCommonList> res = client.readList();
-        assertStatusCode(res, testName);
-        AbstractCommonList list = res.getEntity();
-
-        // Optionally output additional data about list members for debugging.
-        if(logger.isTraceEnabled()){
-               AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
-        }
-    }
-
-    // Failure outcomes
-    // None at present.
-    // ---------------------------------------------------------------
-    // CRUD tests : UPDATE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        dependsOnMethods = {"read"})
-    public void update(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdate();
-
-        // Retrieve the contents of a resource to update.
-        MovementClient client = new MovementClient();
-        ClientResponse<String> res = client.read(knownResourceId);
-                       assertStatusCode(res, testName);
-        assertStatusCode(res, testName);
-
-        // Extract the common part from the response.
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
-        MovementsCommon movementCommon = null;
-        if (payloadInputPart != null) {
-               movementCommon = (MovementsCommon) payloadInputPart.getBody();
-        }
-        Assert.assertNotNull(movementCommon);
-
-        // Update its content.
-        movementCommon.setMovementReferenceNumber("updated-" + movementCommon.getMovementReferenceNumber());
-        movementCommon.setMovementNote("updated movement note-" + movementCommon.getMovementNote());
-        movementCommon.setNormalLocation(""); // Test deletion of existing string value
-
-        String currentTimestamp = GregorianCalendarDateTimeUtils.timestampUTC();
-        movementCommon.setPlannedRemovalDate(""); // Test deletion of existing date or date/time value
-        movementCommon.setRemovalDate(currentTimestamp);
-
-        if(logger.isDebugEnabled()){
-            logger.debug("to be updated object");
-            logger.debug(objectAsXmlString(movementCommon, MovementsCommon.class));
-        }
-
-        // Submit the request to the service and store the response.
-        PoxPayloadOut output = new PoxPayloadOut(this.getServicePathComponent());
-        PayloadOutputPart commonPart = output.addPart(movementCommon, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getCommonPartName());
-        res = client.update(knownResourceId, output);
-        assertStatusCode(res, testName);
-
-        // Extract the updated common part from the response.
-        input = new PoxPayloadIn(res.getEntity());
-        payloadInputPart = input.getPart(client.getCommonPartName());
-        MovementsCommon updatedMovementCommon = null;
-        if (payloadInputPart != null) {
-               updatedMovementCommon = (MovementsCommon) payloadInputPart.getBody();
-        }
-        Assert.assertNotNull(movementCommon);
-        if(logger.isDebugEnabled()){
-            logger.debug("updated object");
-            logger.debug(objectAsXmlString(updatedMovementCommon, MovementsCommon.class));
-        }
-
-        // Check selected fields in the updated common part.
-        
-        // By submitting an empty string in the update payload, the value of this field
-        // in the object created from the response payload will be null.
-        Assert.assertNull(updatedMovementCommon.getNormalLocation(), "Data in updated object did not match submitted data.");
-        if(logger.isDebugEnabled()){
-            logger.debug("Normal location after update=|" + updatedMovementCommon.getNormalLocation() + "|");
-        }
-
-        Assert.assertEquals(updatedMovementCommon.getMovementReferenceNumber(),
-            movementCommon.getMovementReferenceNumber(),
-            "Data in updated object did not match submitted data.");
-        Assert.assertEquals(updatedMovementCommon.getMovementNote(),
-            movementCommon.getMovementNote(),
-            "Data in updated object did not match submitted data.");
-        Assert.assertNull(updatedMovementCommon.getPlannedRemovalDate());
-        Assert.assertEquals(updatedMovementCommon.getRemovalDate(),
-            movementCommon.getRemovalDate(),
-            "Data in updated object did not match submitted data.");
-
-        if(logger.isDebugEnabled()){
-            logger.debug("UTF-8 data sent=" + movementCommon.getMovementNote() + "\n"
-                    + "UTF-8 data received=" + updatedMovementCommon.getMovementNote());
-    }
-        Assert.assertTrue(updatedMovementCommon.getMovementNote().contains(getUTF8DataFragment()),
-                "UTF-8 data retrieved '" + updatedMovementCommon.getMovementNote()
-                + "' does not contain expected data '" + getUTF8DataFragment());
-        Assert.assertEquals(updatedMovementCommon.getMovementNote(),
-                movementCommon.getMovementNote(),
-                "Data in updated object did not match submitted data.");
-
-    }
-
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
-     */
-    @Override
-    public void updateWithEmptyEntityBody(String testName) throws Exception{
-       //Should this really be empty?
-    }
-    
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
-     */
-    @Override
-    public void updateWithMalformedXml(String testName) throws Exception {
-       //Should this really be empty?
-    }
-    
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
-     */
-    @Override
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
-       //Should this really be empty?
-    }
-
-    /*
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-        dependsOnMethods = {"create", "update", "testSubmitRequest"})
-    public void updateWithEmptyEntityBody(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdateWithEmptyEntityBody();
-
-        // Submit the request to the service and store the response.
-        String method = REQUEST_TYPE.httpMethodName();
-        String url = getResourceURL(knownResourceId);
-        String mediaType = MediaType.APPLICATION_XML;
-        final String entity = "";
-        int statusCode = submitRequest(method, url, mediaType, entity);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if(logger.isDebugEnabled()){
-            logger.debug(testName + ": url=" + url +
-                " status=" + statusCode);
-         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-        invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-        dependsOnMethods = {"create", "update", "testSubmitRequest"})
-    public void updateWithMalformedXml(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdateWithMalformedXml();
-
-        // Submit the request to the service and store the response.
-        String method = REQUEST_TYPE.httpMethodName();
-        String url = getResourceURL(knownResourceId);
-        String mediaType = MediaType.APPLICATION_XML;
-        final String entity = MALFORMED_XML_DATA;
-        int statusCode = submitRequest(method, url, mediaType, entity);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if(logger.isDebugEnabled()){
-            logger.debug(testName + ": url=" + url +
-             " status=" + statusCode);
-         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-        invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-        dependsOnMethods = {"create", "update", "testSubmitRequest"})
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdateWithWrongXmlSchema();
-
-        // Submit the request to the service and store the response.
-        String method = REQUEST_TYPE.httpMethodName();
-        String url = getResourceURL(knownResourceId);
-        String mediaType = MediaType.APPLICATION_XML;
-        final String entity = WRONG_XML_SCHEMA_DATA;
-        int statusCode = submitRequest(method, url, mediaType, entity);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if(logger.isDebugEnabled()){
-            logger.debug(testName + ": url=" + url +
-            " status=" + statusCode);
-         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-        invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-     */
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        dependsOnMethods = {"update", "testSubmitRequest"})
-    public void updateNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdateNonExistent();
-
-        // Submit the request to the service and store the response.
-        // Note: The ID used in this 'create' call may be arbitrary.
-        // The only relevant ID may be the one used in update(), below.
-        MovementClient client = new MovementClient();
-        PoxPayloadOut multipart = createMovementInstance(NON_EXISTENT_ID);
-        ClientResponse<String> res = client.update(NON_EXISTENT_ID, multipart);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    // ---------------------------------------------------------------
-    // CRUD tests : DELETE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
-     */
-
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
-    public void delete(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        /*
-        // Perform setup.
-        setupDelete();
-
-        // Submit the request to the service and store the response.
-        MovementClient client = new MovementClient();
-        ClientResponse<Response> res = client.delete(knownResourceId);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-     *
-     */
-    }
-
-
-    // Failure outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        dependsOnMethods = {"delete"})
-    public void deleteNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDeleteNonExistent();
-
-        // Submit the request to the service and store the response.
-        MovementClient client = new MovementClient();
-        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    // ---------------------------------------------------------------
-    // Utility tests : tests of code used in tests above
-    // ---------------------------------------------------------------
-    /**
-     * Tests the code for manually submitting data that is used by several
-     * of the methods above.
-     */
-    @Test(dependsOnMethods = {"create", "read"})
-    public void testSubmitRequest() {
-
-        // Expected status code: 200 OK
-        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
-
-        // Submit the request to the service and store the response.
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getResourceURL(knownResourceId);
-        int statusCode = submitRequest(method, url);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if(logger.isDebugEnabled()){
-            logger.debug("testSubmitRequest: url=" + url +
-                " status=" + statusCode);
-        }
-        Assert.assertEquals(statusCode, EXPECTED_STATUS);
-
-    }
-
-    // ---------------------------------------------------------------
-    // Utility methods used by tests above
-    // ---------------------------------------------------------------
-
-    @Override
-    protected String getServiceName() {
-        return SERVICE_NAME;
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
-     */
-    @Override
-    public String getServicePathComponent() {
-        return SERVICE_PATH_COMPONENT;
-    }
-
-    /**
-     * Creates the movement instance.
-     *
-     * @param identifier the identifier
-     * @return the multipart output
-     */
-    private PoxPayloadOut createMovementInstance(String identifier) {
-        return createInstance("movementReferenceNumber-" + identifier);
-    }
-
-    /**
-     * Creates an instance of a Movement record for testing.
-     *
-     * @param movementReferenceNumber A movement reference number.
-     * @return Multipart output suitable for use as a payload
-     *     in a create or update request.
-     */
-    @Override
-    public PoxPayloadOut createInstance(String movementReferenceNumber) {
-        MovementsCommon movementCommon = new MovementsCommon();
-        // FIXME: Values of currentLocation, normalLocation,
-        // and movementContact should be refNames.
-        movementCommon.setCurrentLocation("currentLocation value");
-        movementCommon.setCurrentLocationFitness("currentLocationFitness value");
-        movementCommon.setCurrentLocationNote("currentLocationNote value");
-        movementCommon.setLocationDate(TIMESTAMP_UTC);
-        movementCommon.setNormalLocation("normalLocation value");
-        movementCommon.setMovementContact("movementContact value");
-        MovementMethodsList movementMethodsList = new MovementMethodsList();
-        List<String> methods = movementMethodsList.getMovementMethod();
-        // @TODO Use properly formatted refNames for representative movement
-        // methods in this example record. The values below are placeholders.
-        String identifier = createIdentifier();
-        methods.add("First Movement Method-" + identifier);
-        methods.add("Second Movement Method-" + identifier);
-        movementCommon.setMovementMethods(movementMethodsList);
-        movementCommon.setMovementNote(getUTF8DataFragment());
-        movementCommon.setMovementReferenceNumber(movementReferenceNumber);
-        movementCommon.setPlannedRemovalDate(TIMESTAMP_UTC);
-        movementCommon.setRemovalDate(""); // Test empty date value
-        movementCommon.setReasonForMove("reasonForMove value");
-
-        PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent());
-        PayloadOutputPart commonPart =
-            multipart.addPart(movementCommon, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(new MovementClient().getCommonPartName());
-
-        if(logger.isDebugEnabled()){
-            logger.debug("to be created, movement common");
-            logger.debug(objectAsXmlString(movementCommon, MovementsCommon.class));
-        }
-
-        return multipart;
-    }
-
+public class MovementServiceTest extends
+               AbstractPoxServiceTestImpl<AbstractCommonList, MovementsCommon> {
+
+       /** The logger. */
+       private final String CLASS_NAME = MovementServiceTest.class.getName();
+       private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+
+       final String SERVICE_NAME = "movements";
+       final String SERVICE_PATH_COMPONENT = "movements";
+
+       private final static String TIMESTAMP_UTC = GregorianCalendarDateTimeUtils
+                       .timestampUTC();
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * org.collectionspace.services.client.test.BaseServiceTest#getClientInstance
+        * ()
+        */
+       @Override
+       protected CollectionSpaceClient getClientInstance() {
+               return new MovementClient();
+       }
+
+       // ---------------------------------------------------------------
+       // Utility methods used by tests above
+       // ---------------------------------------------------------------
+
+       @Override
+       protected String getServiceName() {
+               return SERVICE_NAME;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.collectionspace.services.client.test.BaseServiceTest#
+        * getServicePathComponent()
+        */
+       @Override
+       public String getServicePathComponent() {
+               return SERVICE_PATH_COMPONENT;
+       }
+
+       /**
+        * Creates the movement instance.
+        * 
+        * @param identifier
+        *            the identifier
+        * @return the multipart output
+        */
+       private PoxPayloadOut createMovementInstance(String identifier) {
+               return createInstance("movementReferenceNumber-" + identifier);
+       }
+
+       @Override
+       protected PoxPayloadOut createInstance(String commonPartName,
+                       String identifier) {
+               PoxPayloadOut result = createMovementInstance(identifier);
+               return result;
+       }
+
+       /**
+        * Creates an instance of a Movement record for testing.
+        * 
+        * @param movementReferenceNumber
+        *            A movement reference number.
+        * @return Multipart output suitable for use as a payload in a create or
+        *         update request.
+        */
+       @Override
+       protected PoxPayloadOut createInstance(String movementReferenceNumber) {
+               MovementsCommon movementCommon = new MovementsCommon();
+               // FIXME: Values of currentLocation, normalLocation,
+               // and movementContact should be refNames.
+               movementCommon.setCurrentLocation("currentLocation value");
+               movementCommon
+                               .setCurrentLocationFitness("currentLocationFitness value");
+               movementCommon.setCurrentLocationNote("currentLocationNote value");
+               movementCommon.setLocationDate(TIMESTAMP_UTC);
+               movementCommon.setNormalLocation("normalLocation value");
+               movementCommon.setMovementContact("movementContact value");
+               MovementMethodsList movementMethodsList = new MovementMethodsList();
+               List<String> methods = movementMethodsList.getMovementMethod();
+               // @TODO Use properly formatted refNames for representative movement
+               // methods in this example record. The values below are placeholders.
+               String identifier = createIdentifier();
+               methods.add("First Movement Method-" + identifier);
+               methods.add("Second Movement Method-" + identifier);
+               movementCommon.setMovementMethods(movementMethodsList);
+               movementCommon.setMovementNote(getUTF8DataFragment());
+               movementCommon.setMovementReferenceNumber(movementReferenceNumber);
+               movementCommon.setPlannedRemovalDate(TIMESTAMP_UTC);
+               movementCommon.setRemovalDate(""); // Test empty date value
+               movementCommon.setReasonForMove("reasonForMove value");
+
+               PoxPayloadOut multipart = new PoxPayloadOut(
+                               this.getServicePathComponent());
+               PayloadOutputPart commonPart = multipart.addPart(
+                               new MovementClient().getCommonPartName(), movementCommon);
+
+               if (logger.isDebugEnabled()) {
+                       logger.debug("to be created, movement common");
+                       logger.debug(objectAsXmlString(movementCommon,
+                                       MovementsCommon.class));
+               }
+
+               return multipart;
+       }
+
+       @Override
+       protected MovementsCommon updateInstance(MovementsCommon movementsCommon) {
+               MovementsCommon result = new MovementsCommon();
+               
+               result.setMovementReferenceNumber("updated-"
+                               + movementsCommon.getMovementReferenceNumber());
+               result.setMovementNote("updated movement note-"
+                               + movementsCommon.getMovementNote());
+               result.setNormalLocation(""); // Test deletion of existing
+                                                                                               // string value
+
+               String currentTimestamp = GregorianCalendarDateTimeUtils.timestampUTC();
+               result.setPlannedRemovalDate(""); // Test deletion of existing
+                                                                                                       // date or date/time value
+               result.setRemovalDate(currentTimestamp);
+               
+               return result;
+       }
+
+       @Override
+       protected void compareUpdatedInstances(MovementsCommon original,
+                       MovementsCommon updated) throws Exception {
+               // By submitting an empty string in the update payload, the value of
+               // this field
+               // in the object created from the response payload will be null.
+               Assert.assertNull(updated.getNormalLocation(),
+                               "Normal location in updated object did not match submitted data.");
+               if (logger.isDebugEnabled()) {
+                       logger.debug("Normal location after update=|"
+                                       + updated.getNormalLocation() + "|");
+               }
+
+               Assert.assertEquals(updated.getMovementReferenceNumber(),
+                               original.getMovementReferenceNumber(),
+                               "Movement reference number in updated object did not match submitted data.");
+               Assert.assertEquals(updated.getMovementNote(),
+                               original.getMovementNote(),
+                               "Movement note in updated object did not match submitted data.");
+               Assert.assertNull(updated.getPlannedRemovalDate());
+               Assert.assertEquals(updated.getRemovalDate(),
+                               original.getRemovalDate(),
+                               "Removal date in updated object did not match submitted data.");
+
+               if (logger.isDebugEnabled()) {
+                       logger.debug("UTF-8 data sent=" + original.getMovementNote()
+                                       + "\n" + "UTF-8 data received="
+                                       + updated.getMovementNote());
+               }
+               Assert.assertTrue(
+                               updated.getMovementNote().contains(
+                                               getUTF8DataFragment()), "UTF-8 data retrieved '"
+                                               + updated.getMovementNote()
+                                               + "' does not contain expected data '"
+                                               + getUTF8DataFragment());
+               Assert.assertEquals(updated.getMovementNote(),
+                               original.getMovementNote(),
+                               "Movement note in updated object did not match submitted data.");
+       }
+
+       protected void compareReadInstances(MovementsCommon original,
+                       MovementsCommon fromRead) throws Exception {
+               // Check the values of one or more date/time fields.
+               if (logger.isDebugEnabled()) {
+                       logger.debug("locationDate=" + fromRead.getLocationDate());
+                       logger.debug("TIMESTAMP_UTC=" + TIMESTAMP_UTC);
+               }
+               Assert.assertTrue(fromRead.getLocationDate().equals(TIMESTAMP_UTC));
+               Assert.assertTrue(fromRead.getPlannedRemovalDate().equals(TIMESTAMP_UTC));
+               Assert.assertNull(fromRead.getRemovalDate());
+
+               // Check the values of fields containing Unicode UTF-8 (non-Latin-1)
+               // characters.
+               if (logger.isDebugEnabled()) {
+                       logger.debug("UTF-8 data sent=" + getUTF8DataFragment() + "\n"
+                                       + "UTF-8 data received=" + fromRead.getMovementNote());
+               }
+               Assert.assertEquals(fromRead.getMovementNote(),
+                               getUTF8DataFragment(), "UTF-8 data retrieved '"
+                                               + fromRead.getMovementNote()
+                                               + "' does not match expected data '"
+                                               + getUTF8DataFragment());
+       }
+
+       /*
+        * For convenience and terseness, this test method is the base of the test
+        * execution dependency chain. Other test methods may refer to this method
+        * in their @Test annotation declarations.
+        */
+       @Override
+       @Test(dataProvider = "testName", dependsOnMethods = { "org.collectionspace.services.client.test.AbstractServiceTestImpl.baseCRUDTests" })
+       public void CRUDTests(String testName) {
+               // TODO Auto-generated method stub
+       }
 }
index 47155c63535d0cd76fde05fae30601f2fea628d4..9b4199a9cdbbb38d709c14bcfa650b5e486e9de6 100644 (file)
@@ -27,17 +27,16 @@ import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.List;
 import java.util.Locale;
-import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
 import org.collectionspace.services.MovementJAXBSchema;
+import org.collectionspace.services.client.AbstractCommonListUtils;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.MovementClient;
 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.common.AbstractCommonListUtils;
 import org.collectionspace.services.movement.MovementsCommon;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 
@@ -58,7 +57,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision: 2562 $
  * $LastChangedDate: 2010-06-22 23:26:51 -0700 (Tue, 22 Jun 2010) $
  */
-public class MovementSortByTest extends BaseServiceTest {
+public class MovementSortByTest extends BaseServiceTest<AbstractCommonList> {
 
     private final String CLASS_NAME = MovementSortByTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
@@ -86,7 +85,7 @@ public class MovementSortByTest extends BaseServiceTest {
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-    protected AbstractCommonList getAbstractCommonList(
+    protected AbstractCommonList getCommonList(
             ClientResponse<AbstractCommonList> response) {
         throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
@@ -101,14 +100,9 @@ public class MovementSortByTest extends BaseServiceTest {
      * Tests whether a list of records, sorted by a String field in
      * ascending order, is returned in the expected order.
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"createList"})
     public void sortByStringFieldAscending(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-
         String sortFieldName = qualifySortFieldName(MovementJAXBSchema.MOVEMENT_NOTE);
         if (logger.isDebugEnabled()) {
             logger.debug("Sorting on field name=" + sortFieldName);
@@ -154,14 +148,9 @@ public class MovementSortByTest extends BaseServiceTest {
      * This verifies that summary list results from keyword searches, in
      * addition to 'read list' requests, can be returned in sorted order.
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"createList"})
     public void sortKeywordSearchResultsByStringFieldAscending(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-
         String sortFieldName = qualifySortFieldName(MovementJAXBSchema.MOVEMENT_NOTE);
         if (logger.isDebugEnabled()) {
             logger.debug("Sorting on field name=" + sortFieldName);
@@ -204,14 +193,9 @@ public class MovementSortByTest extends BaseServiceTest {
      * Tests whether a list of records, sorted by a String field in
      * descending order, is returned in the expected order.
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"createList"})
     public void sortByStringFieldDescending(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-
         String sortFieldName =
                 asDescendingSort(qualifySortFieldName(MovementJAXBSchema.MOVEMENT_NOTE));
         if (logger.isDebugEnabled()) {
@@ -255,14 +239,9 @@ public class MovementSortByTest extends BaseServiceTest {
      * Tests whether a list of records, sorted by a dateTime field in
      * ascending order, is returned in the expected order.
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"createList"})
     public void sortByDateTimeFieldAscending(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-
         String sortFieldName = qualifySortFieldName(MovementJAXBSchema.LOCATION_DATE);
         if (logger.isDebugEnabled()) {
             logger.debug("Sorting on field name=" + sortFieldName);
@@ -294,14 +273,9 @@ public class MovementSortByTest extends BaseServiceTest {
      * Tests whether a list of records, sorted by a dateTime field in
      * descending order, is returned in the expected order.
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"createList"})
     public void sortByDateTimeFieldDescending(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-
         String sortFieldName =
                 asDescendingSort(qualifySortFieldName(MovementJAXBSchema.LOCATION_DATE));
         if (logger.isDebugEnabled()) {
@@ -334,14 +308,9 @@ public class MovementSortByTest extends BaseServiceTest {
      * Tests whether a list of records, sorted by two different fields in
      * ascending order, is returned in the expected order.
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"createList"})
     public void sortByTwoFieldsAscending(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-
         String firstSortFieldName = qualifySortFieldName(MovementJAXBSchema.MOVEMENT_NOTE);
         String secondSortFieldName = qualifySortFieldName(MovementJAXBSchema.LOCATION_DATE);
         if (logger.isDebugEnabled()) {
@@ -392,14 +361,9 @@ public class MovementSortByTest extends BaseServiceTest {
      * Tests whether a list of records, sorted by one different fields in
      * descending order and a second field in ascending order, is returned in the expected order.
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"createList"})
     public void sortByOneFieldAscendingOneFieldsDescending(String testName) throws Exception {
-
-       if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-
         String firstSortFieldName =
                 asDescendingSort(qualifySortFieldName(MovementJAXBSchema.LOCATION_DATE));
         String secondSortFieldName = qualifySortFieldName(MovementJAXBSchema.MOVEMENT_NOTE);
@@ -453,12 +417,8 @@ public class MovementSortByTest extends BaseServiceTest {
      * as expected: the query parameter is simply ignored, and a list
      * of records is returned, unsorted, with a success result.
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+    @Test(dataProvider = "testName")
     public void sortWithEmptySortFieldName(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         testSetup(STATUS_OK, ServiceRequestType.READ);
 
         // Submit the request to the service and store the response.
@@ -466,17 +426,13 @@ public class MovementSortByTest extends BaseServiceTest {
         final String EMPTY_SORT_FIELD_NAME = "";
         ClientResponse<AbstractCommonList> res =
                 client.readListSortedBy(EMPTY_SORT_FIELD_NAME);
-        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);
+        try {
+               assertStatusCode(res, testName);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
     }
 
     // Failure outcomes
@@ -486,41 +442,29 @@ public class MovementSortByTest extends BaseServiceTest {
      * handled as expected.  The field name provided in this test is valid,
      * but has not been qualified by being prefixed by a schema name and delimiter.
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+    @Test(dataProvider = "testName")
     public void sortWithUnqualifiedFieldName(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         testSetup(STATUS_BAD_REQUEST, ServiceRequestType.READ);
 
         // Submit the request to the service and store the response.
         MovementClient client = new MovementClient();
         ClientResponse<AbstractCommonList> res =
                 client.readListSortedBy(MovementJAXBSchema.LOCATION_DATE);
-        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);
+        try {
+               assertStatusCode(res, testName);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
     }
 
     /*
      * Tests whether a request to sort by an invalid identifier for the
      * sort order (ascending or descending) is handled as expected.
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+    @Test(dataProvider = "testName")
     public void sortWithInvalidSortOrderIdentifier(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         testSetup(STATUS_BAD_REQUEST, ServiceRequestType.READ);
 
         // Submit the request to the service and store the response.
@@ -529,39 +473,14 @@ public class MovementSortByTest extends BaseServiceTest {
         ClientResponse<AbstractCommonList> res =
                 client.readListSortedBy(MovementJAXBSchema.LOCATION_DATE
                 + " " + INVALID_SORT_ORDER_IDENTIFIER);
-        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);
+        try {
+               assertStatusCode(res, testName);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
-    }
-
-    /*
-     * Tests whether a request to sort by a malformed field name is
-     * handled as expected.
-     */
-/*
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
-    public void sortWithMalformedFieldName(String testName) throws Exception {
-
-    // FIXME: Implement this stub method.
-
-    // FIXME: Consider splitting this test into various tests, with
-    // different malformed field name formats that might confuse parsers
-    // and/or validation code.
-
-    // FIXME: Consider fixing DocumentFilter.setSortOrder() to return
-    // an error response to this test case, then revise this test case
-    // to expect that response.
-
     }
-*/
 
     // ---------------------------------------------------------------
     // Cleanup of resources created during testing
@@ -590,7 +509,7 @@ public class MovementSortByTest extends BaseServiceTest {
         MovementClient movementClient = new MovementClient();
         for (String resourceId : movementIdsCreated) {
             // Note: Any non-success responses are ignored and not reported.
-            movementClient.delete(resourceId);
+            movementClient.delete(resourceId).releaseConnection();
         }
     }
 
@@ -664,7 +583,7 @@ public class MovementSortByTest extends BaseServiceTest {
 
         String testName = "createList";
         if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
+            logger.debug(getTestBanner(testName, CLASS_NAME));
         }
         testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
 
@@ -674,7 +593,8 @@ public class MovementSortByTest extends BaseServiceTest {
     }
 
     private void create(String movementNote, String locationDate) throws Exception {
-
+       String result = null;
+       
         String testName = "create";
         testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
 
@@ -683,42 +603,42 @@ public class MovementSortByTest extends BaseServiceTest {
                 movementNote, locationDate);
         MovementClient client = new MovementClient();
         ClientResponse<Response> res = client.create(multipart);
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        //
-        // Specifically:
-        // Does it fall within the set of valid status codes?
-        // Does it exactly match the expected status code?
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": status = " + statusCode);
+        try {
+               assertStatusCode(res, testName);
+            // Store the IDs from every resource created by tests,
+            // so they can be deleted after tests have been run.
+               result = extractId(res);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
+        
+        if (result != null) {
+               movementIdsCreated.add(result);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
-        // Store the IDs from every resource created by tests,
-        // so they can be deleted after tests have been run.
-        movementIdsCreated.add(extractId(res));
     }
 
     private MovementsCommon read(String csid) throws Exception {
-
         String testName = "read";
         testSetup(STATUS_OK, ServiceRequestType.READ);
 
         // Submit the request to the service and store the response.
         MovementClient client = new MovementClient();
         ClientResponse<String> res = client.read(csid);
-        assertStatusCode(res, testName);
-
-        // Extract and return the common part of the record.
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
         MovementsCommon movementCommon = null;
-        if (payloadInputPart != null) {
-               movementCommon = (MovementsCommon) payloadInputPart.getBody();
+        try {
+               assertStatusCode(res, testName);
+               // Extract and return the common part of the record.
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
+               if (payloadInputPart != null) {
+                       movementCommon = (MovementsCommon) payloadInputPart.getBody();
+               }
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
 
         return movementCommon;
@@ -735,8 +655,7 @@ public class MovementSortByTest extends BaseServiceTest {
 
         PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent());
         PayloadOutputPart commonPart =
-            multipart.addPart(movementCommon, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(new MovementClient().getCommonPartName());
+            multipart.addPart(new MovementClient().getCommonPartName(), movementCommon);
         if (logger.isDebugEnabled()) {
             logger.debug("to be created, movement common");
             logger.debug(objectAsXmlString(movementCommon, MovementsCommon.class));
@@ -746,17 +665,22 @@ public class MovementSortByTest extends BaseServiceTest {
     }
 
     private AbstractCommonList readSortedList(String sortFieldName) throws Exception {
-
         String testName = "readSortedList";
         testSetup(STATUS_OK, ServiceRequestType.READ);
 
         // Submit the request to the service and store the response.
         MovementClient client = new MovementClient();
 
-        ClientResponse<AbstractCommonList> res =
-                client.readListSortedBy(sortFieldName);
-        assertStatusCode(res, testName);
-        AbstractCommonList list = res.getEntity();
+        ClientResponse<AbstractCommonList> res = client.readListSortedBy(sortFieldName);
+        AbstractCommonList list = null;
+        try {
+               assertStatusCode(res, testName);
+               list = res.getEntity();
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }        
 
         return list;
 
@@ -764,7 +688,8 @@ public class MovementSortByTest extends BaseServiceTest {
 
     private AbstractCommonList keywordSearchSortedBy(String keywords,
             String sortFieldName) throws Exception {
-
+       AbstractCommonList result = null;
+       
         String testName = "keywordSearchSortedBy";
         testSetup(STATUS_OK, ServiceRequestType.READ);
 
@@ -773,11 +698,17 @@ public class MovementSortByTest extends BaseServiceTest {
 
         ClientResponse<AbstractCommonList> res =
                 client.keywordSearchSortedBy(keywords, sortFieldName);
-        assertStatusCode(res, testName);
-        AbstractCommonList list = res.getEntity();
+        AbstractCommonList list = null;
+        try {
+               assertStatusCode(res, testName);
+               list = res.getEntity();
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
 
         return list;
-
     }
 
 }
index 22863329566060b8d0fcca9a6007a1d7614e251c..3ebae0ddb2a6ff491e2f46b3c6295ef7a0c05b23 100644 (file)
@@ -44,7 +44,6 @@
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>5.6</version>
         </dependency>
         
       <!-- javax -->
index 50d35a9dc37b79d65c0c9633afa2c81066ad2c6b..3ce672f4b0a5698180267324f5048b6cea03d5af 100644 (file)
@@ -17,6 +17,7 @@ Require-Bundle: org.nuxeo.runtime,
  org.collectionspace.collectionspace_core\r
 Provide-Package: org.collectionspace.note\r
 Nuxeo-Component: OSGI-INF/core-types-contrib.xml,\r
+ OSGI-INF/life-cycle-contrib.xml,\r
  OSGI-INF/ecm-types-contrib.xml,\r
  OSGI-INF/layouts-contrib.xml\r
 \r
diff --git a/services/note/3rdparty/nuxeo-platform-cs-note/src/main/resources/OSGI-INF/life-cycle-contrib.xml b/services/note/3rdparty/nuxeo-platform-cs-note/src/main/resources/OSGI-INF/life-cycle-contrib.xml
new file mode 100644 (file)
index 0000000..82774c7
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<component name="org.collectionspace.ecm.platform.note.LifeCycleManagerExtensions">
+
+  <extension target="org.nuxeo.ecm.core.lifecycle.LifeCycleService"
+             point="types">
+    <types>
+      <type name="CSNote">default</type>
+    </types>
+  </extension>
+
+</component>
index 13678d7b8a1ffd172946efbf095236831f1deaa2..22ca843471eda8d38c8fe6bddcb7160f434c574f 100644 (file)
@@ -9,7 +9,6 @@
     </parent>\r
 \r
     <modelVersion>4.0.0</modelVersion>\r
-    <groupId>org.collectionspace.services</groupId>\r
     <artifactId>org.collectionspace.services.note.client</artifactId>\r
     <name>services.note.client</name>\r
     \r
         </dependency>\r
 \r
         <!-- External dependencies -->\r
+        \r
+        <!-- \r
         <dependency>\r
             <groupId>dom4j</groupId>\r
             <artifactId>dom4j</artifactId>\r
             <version>1.6.1</version>\r
             <scope>provided</scope>\r
-        </dependency>        \r
+        </dependency>\r
+         --> \r
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>\r
         <dependency>\r
             <groupId>org.jboss.resteasy</groupId>\r
index ac2bef72ac80230e345b470c9a3fff27cd95727c..f38dae4ef5a0cb7817cb366b47111805f0c0095d 100644 (file)
@@ -33,7 +33,7 @@ import org.jboss.resteasy.spi.ResteasyProviderFactory;
  * $LastChangedDate: $\r
  */\r
  \r
-public class NoteClient extends AbstractServiceClientImpl<NotesCommonList, NoteProxy> {\r
+public class NoteClient extends AbstractPoxServiceClientImpl<NotesCommonList, NoteProxy> {\r
 \r
     public static final String SERVICE_NAME = "notes";\r
     public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;\r
@@ -65,37 +65,4 @@ public class NoteClient extends AbstractServiceClientImpl<NotesCommonList, NoteP
     public ClientResponse<NotesCommonList> readList() {\r
         return getProxy().readList();\r
     }\r
-\r
-    /**\r
-     * @param csid\r
-     * @return\r
-     * @see org.collectionspace.services.client.Note#getNote(java.lang.String)\r
-     */\r
-\r
-    public ClientResponse<String> read(String csid) {\r
-        return getProxy().read(csid);\r
-    }\r
-\r
-    /**\r
-     * @param multipart\r
-     * @param note\r
-     * @return\r
-     * @see org.collectionspace.services.client.Note#createNote(org.collectionspace.services.Note)\r
-     */\r
-    public ClientResponse<Response> create(PoxPayloadOut multipart) {\r
-        String payload = multipart.toXML();\r
-        return getProxy().create(payload);\r
-    }\r
-\r
-    /**\r
-     * @param csid\r
-     * @param multipart\r
-     * @return\r
-     * @see org.collectionspace.services.client.Note#updateNote(java.lang.Long, org.collectionspace.services.Note)\r
-     */\r
-    public ClientResponse<String> update(String csid, PoxPayloadOut multipart) {\r
-        String payload = multipart.toXML();\r
-        return getProxy().update(csid, payload);\r
-\r
-    }\r
 }\r
index 73e36f9477776426b89212cf3a9743e4caee2254..f2402c629d7faef969cb958eaff88c0b4192a1cf 100644 (file)
@@ -22,12 +22,25 @@ import org.jboss.resteasy.client.ClientResponse;
 @Path("/notes/")\r
 @Produces({"application/xml;charset=UTF-8"})\r
 @Consumes({"application/xml"})\r
-public interface NoteProxy extends CollectionSpaceProxy<NotesCommonList> {\r
-\r
+public interface NoteProxy extends CollectionSpacePoxProxy<NotesCommonList> {\r
     @GET\r
     @Produces({"application/xml"})\r
     ClientResponse<NotesCommonList> readList();\r
     \r
+       @Override\r
+       @GET\r
+    @Produces({"application/xml"})\r
+    ClientResponse<NotesCommonList> readIncludeDeleted(\r
+            @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);    \r
+\r
+    @Override\r
+    @GET\r
+    @Produces({"application/xml"})\r
+    ClientResponse<NotesCommonList> keywordSearchIncludeDeleted(\r
+               @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords,\r
+            @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);\r
+    \r
+    /*\r
     //(C)reate\r
     @POST\r
     ClientResponse<Response> create(String payload);\r
@@ -46,4 +59,5 @@ public interface NoteProxy extends CollectionSpaceProxy<NotesCommonList> {
     @DELETE\r
     @Path("/{csid}")\r
     ClientResponse<Response> delete(@PathParam("csid") String csid);\r
+    */\r
 }\r
index 528184021e8ed236e612664acdba3079e1ff7b61..d2e2a232d18c3c5bb8c72adaace8c9c26f3a9292 100644 (file)
  */\r
 package org.collectionspace.services.client.test;\r
 \r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
 import org.collectionspace.services.client.CollectionSpaceClient;\r
 import org.collectionspace.services.client.NoteClient;\r
 import org.collectionspace.services.client.NoteClientUtils;\r
-import org.collectionspace.services.client.PayloadInputPart;\r
-import org.collectionspace.services.client.PayloadOutputPart;\r
-import org.collectionspace.services.client.PoxPayloadIn;\r
 import org.collectionspace.services.client.PoxPayloadOut;\r
 import org.collectionspace.services.note.NotesCommon;\r
 import org.collectionspace.services.note.NotesCommonList;\r
-import org.collectionspace.services.jaxb.AbstractCommonList;\r
-\r
-import javax.ws.rs.core.MediaType;\r
-import javax.ws.rs.core.Response;\r
-import org.jboss.resteasy.client.ClientResponse;\r
-import org.dom4j.DocumentException;\r
-\r
-import org.testng.Assert;\r
-import org.testng.annotations.AfterClass;\r
-import org.testng.annotations.Test;\r
 \r
 import org.slf4j.Logger;\r
 import org.slf4j.LoggerFactory;\r
+import org.testng.Assert;\r
 \r
 /**\r
  * NoteServiceTest, carries out tests against a\r
@@ -55,7 +40,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision: 917 $\r
  * $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri, 06 Nov 2009) $\r
  */\r
-public class NoteServiceTest extends AbstractServiceTestImpl {\r
+public class NoteServiceTest extends AbstractPoxServiceTestImpl<NotesCommonList, NotesCommon> {\r
 \r
     private final String CLASS_NAME = NoteServiceTest.class.getName();\r
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);\r
@@ -63,9 +48,6 @@ public class NoteServiceTest extends AbstractServiceTestImpl {
     private final String SERVICE_PATH_COMPONENT = "notes";\r
     private final String SERVICE_NAME = "notes";\r
 \r
-    // Instance variables specific to this test.\r
-    private String knownResourceId = null;\r
-\r
     /* (non-Javadoc)\r
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()\r
      */\r
@@ -74,383 +56,15 @@ public class NoteServiceTest extends AbstractServiceTestImpl {
        return new NoteClient();\r
     }\r
     \r
-    /* (non-Javadoc)\r
-     * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)\r
-     */\r
-    @Override\r
-       protected AbstractCommonList getAbstractCommonList(\r
-                       ClientResponse<AbstractCommonList> response) {\r
-        return response.getEntity(NotesCommonList.class);\r
-    }\r
-\r
-    // ---------------------------------------------------------------\r
-    // CRUD tests : CREATE tests\r
-    // ---------------------------------------------------------------\r
-    // Success outcomes\r
-    @Override\r
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)\r
-    public void create(String testName) throws Exception {\r
-\r
-        if (logger.isDebugEnabled()) {\r
-            logger.debug(testBanner(testName, CLASS_NAME));\r
-        }\r
-        // Perform setup, such as initializing the type of service request\r
-        // (e.g. CREATE, DELETE), its valid and expected status codes, and\r
-        // its associated HTTP method name (e.g. POST, DELETE).\r
-        setupCreate();\r
-\r
-        // Submit the request to the service and store the response.\r
-        NoteClient client = new NoteClient();\r
-        String identifier = createIdentifier();\r
-        PoxPayloadOut multipart =\r
-            NoteClientUtils.createNoteInstance("owner"+identifier, identifier, \r
-                                                               client.getCommonPartName());\r
-        ClientResponse<Response> res = client.create(multipart);\r
-\r
-        int statusCode = res.getStatus();\r
-\r
-        // Check the status code of the response: does it match\r
-        // the expected response(s)?\r
-        //\r
-        // Specifically:\r
-        // Does it fall within the set of valid status codes?\r
-        // Does it exactly match the expected status code?\r
-        if(logger.isDebugEnabled()){\r
-            logger.debug(testName + ": status = " + statusCode);\r
-        }\r
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),\r
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);\r
-\r
-        // Store the ID returned from the first resource created\r
-        // for additional tests below.\r
-        if (knownResourceId == null){\r
-            knownResourceId = extractId(res);\r
-            if (logger.isDebugEnabled()) {\r
-                logger.debug(testName + ": knownResourceId=" + knownResourceId);\r
-            }\r
-        }\r
-\r
-        // Store the IDs from every resource created by tests,\r
-        // so they can be deleted after tests have been run.\r
-        allResourceIdsCreated.add(extractId(res));\r
-    }\r
-\r
-    @Override\r
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,\r
-        dependsOnMethods = {"create"})\r
-    public void createList(String testName) throws Exception {\r
-        for(int i = 0; i < 3; i++){\r
-            create(testName);\r
-        }\r
-    }\r
-\r
-    // Failure outcomes\r
-    // Placeholders until the three tests below can be uncommented.\r
-    // See Issue CSPACE-401.\r
-    @Override\r
-    public void createWithEmptyEntityBody(String testName) throws Exception {\r
-       //Should this really be empty?\r
-    }\r
-\r
-    @Override\r
-    public void createWithMalformedXml(String testName) throws Exception {\r
-       //Should this really be empty??\r
-    }\r
-\r
-    @Override\r
-    public void createWithWrongXmlSchema(String testName) throws Exception {\r
-       //Should this really be empty??\r
-    }\r
-\r
-\r
-    // ---------------------------------------------------------------\r
-    // CRUD tests : READ tests\r
-    // ---------------------------------------------------------------\r
-    // Success outcomes\r
-    @Override\r
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,\r
-        dependsOnMethods = {"create"})\r
-    public void read(String testName) throws Exception {\r
-\r
-        if (logger.isDebugEnabled()) {\r
-            logger.debug(testBanner(testName, CLASS_NAME));\r
-        }\r
-        // Perform setup.\r
-        setupRead();\r
-\r
-        // Submit the request to the service and store the response.\r
-        NoteClient client = new NoteClient();\r
-        ClientResponse<String> res = client.read(knownResourceId);\r
-        assertStatusCode(res, testName);\r
-\r
-        // Get the common part of the response and verify that it is not null.\r
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());\r
-        PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());\r
-        NotesCommon noteCommon = null;\r
-        if (payloadInputPart != null) {\r
-               noteCommon = (NotesCommon) payloadInputPart.getBody();\r
-    }\r
-        Assert.assertNotNull(noteCommon);\r
-    }\r
-\r
-    // Failure outcomes\r
-    @Override\r
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,\r
-        dependsOnMethods = {"read"})\r
-    public void readNonExistent(String testName) throws Exception {\r
-\r
-        if (logger.isDebugEnabled()) {\r
-            logger.debug(testBanner(testName, CLASS_NAME));\r
-        }\r
-        // Perform setup.\r
-        setupReadNonExistent();\r
-\r
-        // Submit the request to the service and store the response.\r
-        NoteClient client = new NoteClient();\r
-        ClientResponse<String> res = client.read(NON_EXISTENT_ID);\r
-        int statusCode = res.getStatus();\r
-\r
-        // Check the status code of the response: does it match\r
-        // the expected response(s)?\r
-        if(logger.isDebugEnabled()){\r
-            logger.debug(testName + ": status = " + statusCode);\r
-        }\r
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),\r
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);\r
-    }\r
-\r
-    // ---------------------------------------------------------------\r
-    // CRUD tests : READ_LIST tests\r
-    // ---------------------------------------------------------------\r
-    // Success outcomes\r
-    @Override\r
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,\r
-        dependsOnMethods = {"read"})\r
-    public void readList(String testName) throws Exception {\r
-\r
-        if (logger.isDebugEnabled()) {\r
-            logger.debug(testBanner(testName, CLASS_NAME));\r
-        }\r
-        // Perform setup.\r
-        setupReadList();\r
-\r
-        // Submit the request to the service and store the response.\r
-        NoteClient client = new NoteClient();\r
-        ClientResponse<NotesCommonList> res = client.readList();\r
-        NotesCommonList list = res.getEntity();\r
-        assertStatusCode(res, testName);\r
-\r
-        // Optionally output additional data about list members for debugging.\r
-        boolean iterateThroughList = false;\r
-        if(iterateThroughList && logger.isDebugEnabled()){\r
-            List<NotesCommonList.NoteListItem> items =\r
-                    list.getNoteListItem();\r
-            int i = 0;\r
-            for(NotesCommonList.NoteListItem item : items){\r
-                logger.debug(testName + ": list-item[" + i + "] csid=" +\r
-                        item.getCsid());\r
-                logger.debug(testName + ": list-item[" + i + "] content=" +\r
-                        item.getContent());\r
-                logger.debug(testName + ": list-item[" + i + "] URI=" +\r
-                        item.getUri());\r
-                i++;\r
-            }\r
-        }\r
-\r
-    }\r
-\r
-    // Failure outcomes\r
-    // None at present.\r
-    // ---------------------------------------------------------------\r
-    // CRUD tests : UPDATE tests\r
-    // ---------------------------------------------------------------\r
-    // Success outcomes\r
-    @Override\r
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,\r
-        dependsOnMethods = {"read"})\r
-    public void update(String testName) throws Exception {\r
-\r
-        if (logger.isDebugEnabled()) {\r
-            logger.debug(testBanner(testName, CLASS_NAME));\r
-        }\r
-        // Perform setup.\r
-        setupUpdate();\r
-\r
-        // Submit the request to the service and store the response.\r
-        NoteClient client = new NoteClient();\r
-        ClientResponse<String> res = client.read(knownResourceId);\r
-        assertStatusCode(res, testName);\r
-\r
-        // Get the common part of the response and verify that it is not null.\r
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());\r
-        PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());\r
-        NotesCommon noteCommon = null;\r
-        if (payloadInputPart != null) {\r
-               noteCommon = (NotesCommon) payloadInputPart.getBody();\r
-        }\r
-        Assert.assertNotNull(noteCommon);\r
-\r
-        // Update the common part, both the subitem, and the content\r
-        noteCommon.setContent("updated-" + noteCommon.getContent());\r
-        noteCommon.setOrder(noteCommon.getOrder()+10);\r
-        if(logger.isDebugEnabled()){\r
-            logger.debug("to be updated object");\r
-            logger.debug(objectAsXmlString(noteCommon, NotesCommon.class));\r
-        }\r
-\r
-        // Submit the common part in an update request to the service\r
-        // and store the response.\r
-        PoxPayloadOut output = new PoxPayloadOut(this.getServicePathComponent());\r
-        PayloadOutputPart commonPart = output.addPart(noteCommon, MediaType.APPLICATION_XML_TYPE);\r
-        commonPart.setLabel(client.getCommonPartName());\r
-        res = client.update(knownResourceId, output);\r
-\r
-        // Check the status code of the response: does it match the expected response(s)?\r
-        int statusCode = res.getStatus();\r
-        if(logger.isDebugEnabled()){\r
-            logger.debug(testName + ": status = " + statusCode);\r
-        }\r
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),\r
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);\r
-\r
-        // Extract the updated common part from the response.\r
-        payloadInputPart = input.getPart(client.getCommonPartName());\r
-        NotesCommon updatedNoteCommon = null;\r
-        if (payloadInputPart != null) {\r
-               updatedNoteCommon = (NotesCommon) payloadInputPart.getBody();\r
-        }\r
-        Assert.assertNotNull(updatedNoteCommon);\r
-\r
-        // Check selected fields in the updated common part.\r
-        Assert.assertEquals(updatedNoteCommon.getContent(), noteCommon.getContent(),\r
-                "Data in updated object did not match submitted data.");\r
-        Assert.assertEquals(updatedNoteCommon.getOrder(), noteCommon.getOrder(),\r
-                "Data in updated object (subitem) did not match submitted data.");\r
-    }\r
-\r
-    // Failure outcomes\r
-    // Placeholders until the three tests below can be uncommented.\r
-    // See Issue CSPACE-401.\r
-    @Override\r
-    public void updateWithEmptyEntityBody(String testName) throws Exception {\r
-       //Should this really be empty??\r
-    }\r
-    \r
-    /* (non-Javadoc)\r
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)\r
-     */\r
-    @Override\r
-    public void updateWithMalformedXml(String testName) throws Exception {\r
-       //Should this really be empty??\r
-    }\r
-\r
-    @Override\r
-    public void updateWithWrongXmlSchema(String testName) throws Exception {\r
-       //Should this really be empty??\r
-    }\r
-\r
-\r
-    @Override\r
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,\r
-        dependsOnMethods = {"update", "testSubmitRequest"})\r
-    public void updateNonExistent(String testName) throws Exception {\r
-\r
-        if (logger.isDebugEnabled()) {\r
-            logger.debug(testBanner(testName, CLASS_NAME));\r
-        }\r
-        // Perform setup.\r
-        setupUpdateNonExistent();\r
-\r
-        // Submit the request to the service and store the response.\r
-        // Note: The ID used in this 'create' call may be arbitrary.\r
-        // The only relevant ID may be the one used in update(), below.\r
-        NoteClient client = new NoteClient();\r
-        PoxPayloadOut multipart =\r
-                NoteClientUtils.createNoteInstance(\r
-                        NON_EXISTENT_ID, NON_EXISTENT_ID, client.getCommonPartName());\r
-        ClientResponse<String> res = client.update(NON_EXISTENT_ID, multipart);\r
-        int statusCode = res.getStatus();\r
-\r
-        // Check the status code of the response: does it match\r
-        // the expected response(s)?\r
-        if(logger.isDebugEnabled()){\r
-            logger.debug(testName + ": status = " + statusCode);\r
-        }\r
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),\r
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);\r
-    }\r
-\r
-    // ---------------------------------------------------------------\r
-    // CRUD tests : DELETE tests\r
-    // ---------------------------------------------------------------\r
-    // Success outcomes\r
-    @Override\r
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,\r
-        dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})\r
-    public void delete(String testName) throws Exception {\r
-\r
-        if (logger.isDebugEnabled()) {\r
-            logger.debug(testBanner(testName, CLASS_NAME));\r
-        }\r
-        // Perform setup.\r
-        setupDelete();\r
-\r
-        // Submit the request to the service and store the response.\r
-        NoteClient client = new NoteClient();\r
-        ClientResponse<Response> res = client.delete(knownResourceId);\r
-        int statusCode = res.getStatus();\r
-\r
-        // Check the status code of the response: does it match\r
-        // the expected response(s)?\r
-        if(logger.isDebugEnabled()){\r
-            logger.debug(testName + ": status = " + statusCode);\r
-        }\r
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),\r
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);\r
-    }\r
-\r
-    // Failure outcomes\r
-    @Override\r
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,\r
-        dependsOnMethods = {"delete"})\r
-    public void deleteNonExistent(String testName) throws Exception {\r
-        \r
-        if (logger.isDebugEnabled()) {\r
-            logger.debug(testBanner(testName, CLASS_NAME));\r
-        }\r
-        // Perform setup.\r
-        setupDeleteNonExistent();\r
-\r
-        // Submit the request to the service and store the response.\r
-        NoteClient client = new NoteClient();\r
-        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);\r
-        int statusCode = res.getStatus();\r
-\r
-        // Check the status code of the response: does it match\r
-        // the expected response(s)?\r
-        if(logger.isDebugEnabled()){\r
-            logger.debug(testName + ": status = " + statusCode);\r
-        }\r
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),\r
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);\r
-    }\r
-    \r
-    // ---------------------------------------------------------------\r
-    // Search tests\r
-    // ---------------------------------------------------------------\r
+       @Override\r
+       protected PoxPayloadOut createInstance(String commonPartName,\r
+                       String identifier) {\r
+        PoxPayloadOut result =\r
+                NoteClientUtils.createNoteInstance("owner"+identifier, identifier, \r
+                                                               commonPartName);\r
+        return result;\r
+       }\r
     \r
-    @Override\r
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)\r
-    public void searchWorkflowDeleted(String testName) throws Exception {\r
-        // Fixme: null test for now, overriding test in base class\r
-    }    \r
-\r
     // ---------------------------------------------------------------\r
     // Utility tests : tests of code used in tests above\r
     // ---------------------------------------------------------------\r
@@ -460,31 +74,6 @@ public class NoteServiceTest extends AbstractServiceTestImpl {
         return SERVICE_NAME;\r
     }\r
 \r
-    /**\r
-     * Tests the code for manually submitting data that is used by several\r
-     * of the methods above.\r
-     */\r
-    @Test(dependsOnMethods = {"create", "read"})\r
-    public void testSubmitRequest() {\r
-\r
-        // Expected status code: 200 OK\r
-        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();\r
-\r
-        // Submit the request to the service and store the response.\r
-        String method = ServiceRequestType.READ.httpMethodName();\r
-        String url = getResourceURL(knownResourceId);\r
-        int statusCode = submitRequest(method, url);\r
-\r
-        // Check the status code of the response: does it match\r
-        // the expected response(s)?\r
-        if(logger.isDebugEnabled()){\r
-            logger.debug("testSubmitRequest: url=" + url +\r
-                " status=" + statusCode);\r
-        }\r
-        Assert.assertEquals(statusCode, EXPECTED_STATUS);\r
-\r
-    }\r
-\r
     // ---------------------------------------------------------------\r
     // Utility methods used by tests above\r
     // ---------------------------------------------------------------\r
@@ -492,5 +81,36 @@ public class NoteServiceTest extends AbstractServiceTestImpl {
     public String getServicePathComponent() {\r
         return SERVICE_PATH_COMPONENT;\r
     }\r
+    \r
+    @Override\r
+    protected Class<NotesCommonList> getCommonListType() {\r
+       return NotesCommonList.class;\r
+    }\r
 \r
+       @Override\r
+       protected NotesCommon updateInstance(NotesCommon notesCommon) {\r
+               NotesCommon result = new NotesCommon();\r
+               \r
+        // Update the common part, both the subitem, and the content\r
+        result.setContent("updated-" + notesCommon.getContent());\r
+        result.setOrder(notesCommon.getOrder() + 10);\r
+               \r
+               return result;\r
+       }\r
+\r
+       @Override\r
+       protected void compareUpdatedInstances(NotesCommon original,\r
+                       NotesCommon updated) throws Exception {\r
+        // Check selected fields in the updated common part.\r
+        Assert.assertEquals(updated.getContent(), original.getContent(),\r
+                "Content in updated object did not match submitted data.");\r
+        Assert.assertEquals(updated.getOrder(), original.getOrder(),\r
+                "Order in updated object (subitem) did not match submitted data.");\r
+       }\r
+       \r
+       @Override\r
+       public void CRUDTests(String testName) {\r
+               // TODO Auto-generated method stub\r
+               \r
+       }\r
 }\r
index 36f21a19ce35db36db2bd8b5837e2f282315e9bf..417d7d0038280c49d4696de058ef66bf0926554a 100644 (file)
@@ -9,7 +9,6 @@
     </parent>\r
     \r
     <modelVersion>4.0.0</modelVersion>\r
-    <groupId>org.collectionspace.services</groupId>\r
     <artifactId>org.collectionspace.services.note.jaxb</artifactId>\r
     <name>services.note.jaxb</name>\r
     \r
             <artifactId>org.collectionspace.services.jaxb</artifactId>\r
             <version>${project.version}</version>\r
         </dependency>        \r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.hyperjaxb</artifactId>\r
+            <version>${project.version}</version>\r
+        </dependency>\r
     </dependencies>\r
     \r
     <build>\r
index 9511c6b4eae8a2a2b75ca359900d237350564cdd..aa01369f25b1b34e9a5cbfdbf912369d000023c8 100644 (file)
@@ -1,88 +1,74 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
 \r
-<!--\r
-    Contact schema (XSD)\r
-    \r
-    Entity  : Contact\r
-    Part    : Common\r
-    Used for: JAXB binding between XML and Java objects\r
+<!-- Contact schema (XSD) Entity : Contact Part : Common Used for: JAXB binding \r
+       between XML and Java objects $LastChangedRevision: 1929 $ $LastChangedDate: \r
+       2010-04-28 01:50:27 -0700 (Wed, 28 Apr 2010) $ -->\r
 \r
-    $LastChangedRevision: 1929 $\r
-    $LastChangedDate: 2010-04-28 01:50:27 -0700 (Wed, 28 Apr 2010) $\r
--->\r
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"\r
+       xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0"\r
+       elementFormDefault="unqualified"\r
+       xmlns:ns="http://collectionspace.org/services/note"\r
+       xmlns="http://collectionspace.org/services/note"\r
+       targetNamespace="http://collectionspace.org/services/note"\r
+       version="0.1">\r
 \r
-<xs:schema \r
-  xmlns:xs="http://www.w3.org/2001/XMLSchema"\r
-  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"\r
-  jaxb:version="1.0" elementFormDefault="unqualified"\r
-  xmlns:ns="http://collectionspace.org/services/note"\r
-  xmlns="http://collectionspace.org/services/note"\r
-  targetNamespace="http://collectionspace.org/services/note"\r
-  version="0.1"\r
->\r
+       <!-- Avoid XmlRootElement nightmare: See http://weblogs.java.net/blog/kohsuke/archive/2006/03/why_does_jaxb_p.html -->\r
+       <!-- See http://wiki.collectionspace.org/display/collectionspace/Contact+Schema -->\r
+\r
+       <!-- This is the base class for subitems -->\r
+       <xs:complexType name="subitem">\r
+               <xs:annotation>\r
+                       <xs:appinfo>\r
+                               <jaxb:class ref="org.collectionspace.services.common.subitem.Subitem" />\r
+                       </xs:appinfo>\r
+               </xs:annotation>\r
+       </xs:complexType>\r
+\r
+       <xs:element name="notes_common">\r
+               <xs:complexType>\r
+                       <xs:complexContent>\r
+                               <xs:extension base="subitem">\r
+                                       <xs:sequence>\r
+                                               <xs:element name="content" type="xs:string" />\r
+                                               <xs:element name="author" type="xs:string" />\r
+                                               <xs:element name="date" type="xs:string" />\r
+                                       </xs:sequence>\r
+                               </xs:extension>\r
+                       </xs:complexContent>\r
+               </xs:complexType>\r
+       </xs:element>\r
+\r
+       <!-- This is the base class for subitems -->\r
+       <xs:complexType name="abstractCommonList">\r
+               <xs:annotation>\r
+                       <xs:appinfo>\r
+                               <jaxb:class ref="org.collectionspace.services.jaxb.AbstractCommonList" />\r
+                       </xs:appinfo>\r
+               </xs:annotation>\r
+       </xs:complexType>\r
+\r
+       <!-- note records, as in Nuxeo repository -->\r
+       <xs:element name="notes-common-list">\r
+               <xs:complexType>\r
+                       <xs:complexContent>\r
+                               <xs:extension base="abstractCommonList">\r
+                                       <xs:sequence>\r
+                                               <xs:element name="note-list-item" maxOccurs="unbounded">\r
+                                                       <xs:complexType>\r
+                                                               <xs:sequence>\r
+                                                                       <xs:element name="content" type="xs:string"\r
+                                                                               minOccurs="1" />\r
+                                                                       <!-- uri to retrive note details -->\r
+                                                                       <xs:element name="uri" type="xs:anyURI" minOccurs="1" />\r
+                                                                       <xs:element name="csid" type="xs:string" minOccurs="1" />\r
+                                                               </xs:sequence>\r
+                                                       </xs:complexType>\r
+                                               </xs:element>\r
+                                       </xs:sequence>\r
+                               </xs:extension>\r
+                       </xs:complexContent>\r
+               </xs:complexType>\r
+       </xs:element>\r
 \r
-<!--\r
-    Avoid XmlRootElement nightmare:\r
-    See http://weblogs.java.net/blog/kohsuke/archive/2006/03/why_does_jaxb_p.html\r
--->\r
-<!-- See http://wiki.collectionspace.org/display/collectionspace/Contact+Schema -->    \r
-    \r
-    <!-- This is the base class for subitems -->\r
-    <xs:complexType name="subitem">\r
-        <xs:annotation>\r
-            <xs:appinfo>\r
-                <jaxb:class ref="org.collectionspace.services.common.subitem.Subitem"/>\r
-            </xs:appinfo>\r
-        </xs:annotation>\r
-    </xs:complexType>\r
-    \r
-    <xs:element name="notes_common">\r
-        <xs:complexType>\r
-            <xs:complexContent>\r
-               <xs:extension base="subitem">                    \r
-                                                                       <xs:sequence>\r
-                                                                                       <xs:element name="content" type="xs:string" />\r
-                                                                                       <xs:element name="author" type="xs:string" />\r
-                                                                                       <xs:element name="date" type="xs:string" />\r
-                                                                       </xs:sequence>\r
-               </xs:extension>\r
-            </xs:complexContent>                    \r
-        </xs:complexType>\r
-    </xs:element>\r
-    \r
-    <!-- This is the base class for subitems -->\r
-    <xs:complexType name="abstractCommonList">\r
-        <xs:annotation>\r
-            <xs:appinfo>\r
-                <jaxb:class ref="org.collectionspace.services.jaxb.AbstractCommonList"/>\r
-            </xs:appinfo>\r
-        </xs:annotation>\r
-    </xs:complexType>\r
-    \r
-    <!-- note records, as in Nuxeo repository -->\r
-    <xs:element name="notes-common-list">\r
-        <xs:complexType>\r
-            <xs:complexContent>\r
-                <xs:extension base="abstractCommonList">                    \r
-                    <xs:sequence>\r
-                        <xs:element name="note-list-item" maxOccurs="unbounded">\r
-                            <xs:complexType>\r
-                                <xs:sequence>\r
-                                    <xs:element name="content" type="xs:string"\r
-                                        minOccurs="1" />\r
-                                    <!-- uri to retrive note details -->\r
-                                    <xs:element name="uri" type="xs:anyURI"\r
-                                        minOccurs="1" />\r
-                                    <xs:element name="csid" type="xs:string"\r
-                                        minOccurs="1" />\r
-                                </xs:sequence>\r
-                            </xs:complexType>\r
-                        </xs:element>\r
-                    </xs:sequence>\r
-                </xs:extension>\r
-            </xs:complexContent>                    \r
-        </xs:complexType>\r
-    </xs:element>\r
-    \r
 </xs:schema>\r
 \r
index c55dff8ce3ffd971d08478f10f54033e09b4cc05..ece15b7a0fcbdd07c870b31b4f366298127e7e19 100644 (file)
@@ -32,7 +32,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>        \r
 \r
       <!-- javax -->\r
index 7967328d30fcaa04360a4dde2b2722b6eefdaa12..fafa40ba57e3291b1e1863780f7730f719f6e115 100644 (file)
@@ -62,7 +62,6 @@
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>5.6</version>
         </dependency>
         <dependency>
             <groupId>org.jboss.resteasy</groupId>
index 6f55f6b105539c03755caf1ae0519f25e882b225..92529ab89349e5db53913ae5ddefed1c012d0a96 100644 (file)
@@ -32,7 +32,6 @@ import javax.ws.rs.core.Response;
 
 import org.collectionspace.services.PersonJAXBSchema;
 import org.collectionspace.services.client.CollectionSpaceClient;
-import org.collectionspace.services.client.ContactClient;
 import org.collectionspace.services.client.ObjectExitClient;
 import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PersonAuthorityClient;
@@ -46,7 +45,6 @@ import org.collectionspace.services.objectexit.ObjectexitCommon;
 
 import org.jboss.resteasy.client.ClientResponse;
 
-import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
@@ -59,12 +57,11 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision:  $
  * $LastChangedDate:  $
  */
-public class ObjectExitAuthRefsTest extends BaseServiceTest {
+public class ObjectExitAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
 
     private final String CLASS_NAME = ObjectExitAuthRefsTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
     final String PERSON_AUTHORITY_NAME = "ObjectexitPersonAuth";
-    private String knownResourceId = null;
     private List<String> objectexitIdsCreated = new ArrayList<String>();
     private List<String> personIdsCreated = new ArrayList<String>();
     private String personAuthCSID = null;
@@ -90,7 +87,7 @@ public class ObjectExitAuthRefsTest extends BaseServiceTest {
     }
 
     @Override
-    protected AbstractCommonList getAbstractCommonList(ClientResponse<AbstractCommonList> response) {
+    protected AbstractCommonList getCommonList(ClientResponse<AbstractCommonList> response) {
         throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
 
@@ -104,15 +101,14 @@ public class ObjectExitAuthRefsTest extends BaseServiceTest {
         objectexit.setExitDate(exitDate);
 
         PoxPayloadOut multipart = new PoxPayloadOut(ObjectExitClient.SERVICE_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = multipart.addPart(objectexit, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(new ObjectExitClient().getCommonPartName());
+        PayloadOutputPart commonPart = multipart.addPart(new ObjectExitClient().getCommonPartName(),
+                       objectexit);
         logger.debug("to be created, objectexit common: " + objectAsXmlString(objectexit, ObjectexitCommon.class));
         return multipart;
     }
 
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
     public void createWithAuthRefs(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
         testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
         String identifier = createIdentifier(); // Submit the request to the service and store the response.
         createPersonRefs();// Create all the person refs and entities
@@ -122,9 +118,15 @@ public class ObjectExitAuthRefsTest extends BaseServiceTest {
         PoxPayloadOut multipart = createObjectExitInstance(depositorRefName,
                 "exitNumber-" + identifier, CURRENT_DATE_UTC);
         ClientResponse<Response> res = objectexitClient.create(multipart);
-        assertStatusCode(res, testName);
-        if (knownResourceId == null) {// Store the ID returned from the first resource created for additional tests below.
-            knownResourceId = extractId(res);
+        try {
+               assertStatusCode(res, testName);
+               if (knownResourceId == null) {// Store the ID returned from the first resource created for additional tests below.
+                   knownResourceId = extractId(res);
+               }
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
         objectexitIdsCreated.add(extractId(res));// Store the IDs from every resource created; delete on cleanup
     }
@@ -134,8 +136,14 @@ public class ObjectExitAuthRefsTest extends BaseServiceTest {
         // Create a temporary PersonAuthority resource, and its corresponding refName by which it can be identified.
         PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(PERSON_AUTHORITY_NAME, PERSON_AUTHORITY_NAME, personAuthClient.getCommonPartName());
         ClientResponse<Response> res = personAuthClient.create(multipart);
-        assertStatusCode(res, "createPersonRefs (not a surefire test)");
-        personAuthCSID = extractId(res);
+        try {
+               assertStatusCode(res, "createPersonRefs (not a surefire test)");
+               personAuthCSID = extractId(res);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
         String authRefName = PersonAuthorityClientUtils.getAuthorityRefName(personAuthCSID, null);
         // Create temporary Person resources, and their corresponding refNames by which they can be identified.
         String csid = "";
@@ -150,6 +158,8 @@ public class ObjectExitAuthRefsTest extends BaseServiceTest {
     }
 
     protected String createPerson(String firstName, String surName, String shortId, String authRefName) {
+       String result = null;
+       
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         Map<String, String> personInfo = new HashMap<String, String>();
         personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
@@ -157,21 +167,36 @@ public class ObjectExitAuthRefsTest extends BaseServiceTest {
         personInfo.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId);
         PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonInstance(personAuthCSID, authRefName, personInfo, personAuthClient.getItemCommonPartName());
         ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
-        assertStatusCode(res, "createPerson (not a surefire test)");
-        return extractId(res);
+        try {
+               assertStatusCode(res, "createPerson (not a surefire test)");
+               result = extractId(res);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
+        
+        return result;
     }
 
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"createWithAuthRefs"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"createWithAuthRefs"})
     public void readAndCheckAuthRefs(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
         testSetup(STATUS_OK, ServiceRequestType.READ);
         ObjectExitClient objectexitClient = new ObjectExitClient();
         ClientResponse<String> res = objectexitClient.read(knownResourceId);
-        assertStatusCode(res, testName);
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        ObjectexitCommon objectexit = (ObjectexitCommon) extractPart(input, objectexitClient.getCommonPartName(), ObjectexitCommon.class);
-        Assert.assertNotNull(objectexit);
-        logger.debug(objectAsXmlString(objectexit, ObjectexitCommon.class));
+        ObjectexitCommon objectexit = null;
+        try {
+               assertStatusCode(res, testName);
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               objectexit = (ObjectexitCommon) extractPart(input, objectexitClient.getCommonPartName(), ObjectexitCommon.class);
+               Assert.assertNotNull(objectexit);
+               logger.debug(objectAsXmlString(objectexit, ObjectexitCommon.class));
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
 
         // Check a couple of fields
         Assert.assertEquals(objectexit.getDepositor(), depositorRefName);
@@ -179,8 +204,15 @@ public class ObjectExitAuthRefsTest extends BaseServiceTest {
 
         // Get the auth refs and check them
         ClientResponse<AuthorityRefList> res2 = objectexitClient.getAuthorityRefs(knownResourceId);
-        assertStatusCode(res2, testName);
-        AuthorityRefList list = res2.getEntity();
+        AuthorityRefList list = null;
+        try {
+               assertStatusCode(res2, testName);
+               list = res2.getEntity();
+        } finally {
+               if (res2 != null) {
+                       res2.releaseConnection();
+            }
+        }
         List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
         int numAuthRefsFound = items.size();
         logger.debug("Authority references, found " + numAuthRefsFound);
@@ -233,4 +265,10 @@ public class ObjectExitAuthRefsTest extends BaseServiceTest {
         }
     }
 
+       @Override
+       protected Class<AbstractCommonList> getCommonListType() {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
 }
index c0d4c21b91d431a3d955ccdd17c03e6ecd793ed0..66728a0642910fa4b4477d2e577588fad4a9fa4c 100644 (file)
@@ -25,12 +25,12 @@ package org.collectionspace.services.client.test;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
+import org.collectionspace.services.client.AbstractCommonListUtils;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.ObjectExitClient;
 import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
-import org.collectionspace.services.common.AbstractCommonListUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.objectexit.ObjectexitCommon;
 
@@ -41,20 +41,18 @@ import org.testng.annotations.Test;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-//import org.w3c.dom.Element;
-//import org.w3c.dom.Node;
+
 
 /**
  * ObjectExitServiceTest, carries out tests against a deployed and running ObjectExit Service. <p/>
  * $LastChangedRevision:  $
  * $LastChangedDate:  $
  */
-public class ObjectExitServiceTest extends AbstractServiceTestImpl {
+public class ObjectExitServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonList, ObjectexitCommon> {
 
     private final String CLASS_NAME = ObjectExitServiceTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
     final String SERVICE_PATH_COMPONENT = "objectexit";
-    private String knownResourceId = null;
 
     @Override
        public String getServicePathComponent() {
@@ -72,185 +70,10 @@ public class ObjectExitServiceTest extends AbstractServiceTestImpl {
     }
 
     @Override
-    protected AbstractCommonList getAbstractCommonList(ClientResponse<AbstractCommonList> response) {
+    protected AbstractCommonList getCommonList(ClientResponse<AbstractCommonList> response) {
         return response.getEntity(AbstractCommonList.class);
     }
 
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
-    public void create(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupCreate();
-        ObjectExitClient client = new ObjectExitClient();
-        PoxPayloadOut multipart = createObjectExitInstance(createIdentifier());
-        ClientResponse<Response> res = client.create(multipart);
-        assertStatusCode(res, testName);
-        if (knownResourceId == null) {
-            knownResourceId = extractId(res);  // Store the ID returned from the first resource created for additional tests below.
-            logger.debug(testName + ": knownResourceId=" + knownResourceId);
-        }
-        allResourceIdsCreated.add(extractId(res)); // Store the IDs from every resource created by tests so they can be deleted after tests have been run.
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create"})
-    public void createList(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        for (int i = 0; i < 3; i++) {
-            create(testName);
-        }
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create"})
-    public void read(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupRead();
-        ObjectExitClient client = new ObjectExitClient();
-        ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        ObjectexitCommon objectexit = (ObjectexitCommon) extractPart(input, client.getCommonPartName(), ObjectexitCommon.class);
-        Assert.assertNotNull(objectexit);
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"createList", "read"})
-    public void readList(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupReadList();
-        ObjectExitClient client = new ObjectExitClient();
-        ClientResponse<AbstractCommonList> res = client.readList();
-        assertStatusCode(res, testName);
-        String bar = "\r\n\r\n=================================\r\n\r\n";
-        System.out.println(bar+" res: "+res);
-        AbstractCommonList list = res.getEntity();
-        System.out.println(bar+" list: "+list);
-
-        // Optionally output additional data about list members for debugging.
-        boolean iterateThroughList = true;
-        if(iterateThroughList && logger.isDebugEnabled()){
-               AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
-        }
-        
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"read"})
-    public void update(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupUpdate();
-        ObjectExitClient client = new ObjectExitClient();
-        ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-        logger.debug("got object to update with ID: " + knownResourceId);
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        ObjectexitCommon objectexit = (ObjectexitCommon) extractPart(input, client.getCommonPartName(), ObjectexitCommon.class);
-        Assert.assertNotNull(objectexit);
-
-        objectexit.setExitNumber("updated-" + objectexit.getExitNumber());
-        logger.debug("Object to be updated:"+objectAsXmlString(objectexit, ObjectexitCommon.class));
-        PoxPayloadOut output = new PoxPayloadOut(ObjectExitClient.SERVICE_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = output.addPart(objectexit, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getCommonPartName());
-        res = client.update(knownResourceId, output);
-        assertStatusCode(res, testName);
-        input = new PoxPayloadIn(res.getEntity());
-        ObjectexitCommon updatedObjectExit = (ObjectexitCommon) extractPart(input, client.getCommonPartName(), ObjectexitCommon.class);
-        Assert.assertNotNull(updatedObjectExit);
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"update", "testSubmitRequest"})
-    public void updateNonExistent(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupUpdateNonExistent();
-        // Submit the request to the service and store the response.
-        // Note: The ID used in this 'create' call may be arbitrary.
-        // The only relevant ID may be the one used in update(), below.
-        ObjectExitClient client = new ObjectExitClient();
-        PoxPayloadOut multipart = createObjectExitInstance(NON_EXISTENT_ID);
-        ClientResponse<String> res = client.update(NON_EXISTENT_ID, multipart);
-        assertStatusCode(res, testName);
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
-    public void delete(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupDelete();
-        ObjectExitClient client = new ObjectExitClient();
-        ClientResponse<Response> res = client.delete(knownResourceId);
-        assertStatusCode(res, testName);
-    }
-
-    // ---------------------------------------------------------------
-    // Failure outcome tests : means we expect response to fail, but test to succeed
-    // ---------------------------------------------------------------
-
-    // Failure outcome
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"read"})
-    public void readNonExistent(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupReadNonExistent();
-        ObjectExitClient client = new ObjectExitClient();
-        ClientResponse<String> res = client.read(NON_EXISTENT_ID);
-        assertStatusCode(res, testName);
-    }
-
-    // Failure outcome
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"delete"})
-    public void deleteNonExistent(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupDeleteNonExistent();
-        ObjectExitClient client = new ObjectExitClient();
-        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
-        assertStatusCode(res, testName);
-    }
-
-    // Failure outcomes
-    // Placeholders until the tests below can be implemented. See Issue CSPACE-401.
-
-    @Override
-    public void createWithEmptyEntityBody(String testName) throws Exception {
-    }
-
-    @Override
-    public void createWithMalformedXml(String testName) throws Exception {
-    }
-
-    @Override
-    public void createWithWrongXmlSchema(String testName) throws Exception {
-    }
-
-    @Override
-    public void updateWithEmptyEntityBody(String testName) throws Exception {
-    }
-
-    @Override
-    public void updateWithMalformedXml(String testName) throws Exception {
-    }
-
-    @Override
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
-    }
-
-    // ---------------------------------------------------------------
-    // Utility tests : tests of code used in tests above
-    // ---------------------------------------------------------------
-
-    @Test(dependsOnMethods = {"create", "read"})
-    public void testSubmitRequest() {
-        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode(); // Expected status code: 200 OK
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getResourceURL(knownResourceId);
-        int statusCode = submitRequest(method, url);
-        logger.debug("testSubmitRequest: url=" + url + " status=" + statusCode);
-        Assert.assertEquals(statusCode, EXPECTED_STATUS);
-    }
-
     // ---------------------------------------------------------------
     // Utility methods used by tests above
     // ---------------------------------------------------------------
@@ -277,4 +100,31 @@ public class ObjectExitServiceTest extends AbstractServiceTestImpl {
 
         return multipart;
     }
+
+       @Override
+       public void CRUDTests(String testName) {
+               // TODO Auto-generated method stub              
+       }
+
+       @Override
+       protected PoxPayloadOut createInstance(String commonPartName,
+                       String identifier) {
+        PoxPayloadOut result = createObjectExitInstance(createIdentifier());
+               return result;
+       }
+
+       @Override
+       protected ObjectexitCommon updateInstance(ObjectexitCommon objectexitCommon) {
+               ObjectexitCommon result = new ObjectexitCommon();
+
+               result.setExitNumber("updated-" + objectexitCommon.getExitNumber());
+               
+               return result;
+       }
+
+       @Override
+       protected void compareUpdatedInstances(ObjectexitCommon original,
+                       ObjectexitCommon updated) throws Exception {
+               Assert.assertEquals(updated.getExitNumber(), original.getExitNumber());
+       }
 }
index cd6b1e0b13dd3c9c69519f6c13fa1f16d54dc62c..a0e0a1effdafe2b309faed7f3166c9cd78444c02 100644 (file)
@@ -44,7 +44,6 @@
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>5.6</version>
         </dependency>
         
       <!-- javax -->
index 87d9e464143d1f8f18c7ef18d7b0e027a35606c7..ba8bfbc3cd8059c4753eef9f0fb53d1eb62c0d49 100644 (file)
@@ -56,7 +56,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>\r
         <dependency>\r
             <groupId>org.jboss.resteasy</groupId>\r
index 56b375bc318206e59f2cd88a674da7df2f5ce033..45e13eebb7edab059fd9091cdc1c172fbf6b0a80 100644 (file)
  */
 package org.collectionspace.services.client;
 
+import org.collectionspace.services.organization.OrganizationsCommon;
+
 /**
  * The Class OrgAuthorityClient.
  */
-public class OrgAuthorityClient extends AuthorityWithContactsClientImpl<OrgAuthorityProxy> {
+public class OrgAuthorityClient extends AuthorityWithContactsClientImpl<OrganizationsCommon, OrgAuthorityProxy> {
        public static final String SERVICE_NAME = "orgauthorities";
        public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;       
        public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
@@ -66,4 +68,14 @@ public class OrgAuthorityClient extends AuthorityWithContactsClientImpl<OrgAutho
     public String getItemCommonPartName() {
         return getCommonPartName(SERVICE_ITEM_NAME);
     }
+
+       @Override
+       public String getInAuthority(OrganizationsCommon item) {
+               return item.getInAuthority();
+       }
+
+       @Override
+       public void setInAuthority(OrganizationsCommon item, String inAuthorityCsid) {
+               item.setInAuthority(inAuthorityCsid);
+       }
 }
index fd460b1b0de176da8fb481d79544b0ceb5e5454d..86bb6562d39027427585a7cfa8d26f5343249add 100644 (file)
@@ -60,7 +60,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision$
  * $LastChangedDate$
  */
-public class OrgAuthorityAuthRefsTest extends BaseServiceTest {
+public class OrgAuthorityAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
 
    /** The logger. */
     private final String CLASS_NAME = OrgAuthorityAuthRefsTest.class.getName();
@@ -80,19 +80,10 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest {
                return OrgAuthorityClient.SERVICE_NAME;
        }
 
-    private String knownResourceId = null;
+    protected String knownItemResourceId = null;
+       
     private String knownResourceRefName = null;
-    
-    /** The known item id. */
-    private String knownItemResourceId = null;
-    
-    /** The all resource ids created. */
-    private List<String> allResourceIdsCreated = new ArrayList<String>();
-    
-    /** The all item resource ids created. */
-    private Map<String, String> allItemResourceIdsCreated =
-        new HashMap<String, String>();
-    
+            
     /** The person ids created. */
     private List<String> personIdsCreated = new ArrayList<String>();
     
@@ -128,7 +119,7 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest {
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-       protected AbstractCommonList getAbstractCommonList(
+       protected AbstractCommonList getCommonList(
                        ClientResponse<AbstractCommonList> response) {
        throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
@@ -143,12 +134,8 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest {
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
+    @Test(dataProvider="testName")
     public void createWithAuthRefs(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
 
         // Create a new Organization Authority resource.
@@ -173,9 +160,9 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest {
                if(logger.isDebugEnabled()){
                    logger.debug(testName + ": status = " + statusCode);
                }
-               Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                   invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-               Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                   invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
        
                // Store the IDs from every resource created by tests,
                // so they can be deleted after tests have been run.
@@ -228,7 +215,7 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest {
 
         // Store the IDs from every item created by tests,
         // so they can be deleted after tests have been run.
-        allItemResourceIdsCreated.put(knownItemResourceId, knownResourceId);
+        allResourceItemIdsCreated.put(knownItemResourceId, knownResourceId);
     }
     
     /**
@@ -244,8 +231,8 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest {
        ClientResponse<Response> res = personAuthClient.create(multipart);
         try {
             int statusCode = res.getStatus();
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
             Assert.assertEquals(statusCode, STATUS_CREATED);
             personAuthCSID = extractId(res);
         } finally {
@@ -291,8 +278,8 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest {
        try {
                int statusCode = res.getStatus();
        
-               Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                       invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                       invalidStatusCodeMessage(testRequestType, statusCode));
                Assert.assertEquals(statusCode, STATUS_CREATED);
                result = extractId(res);
        } finally {
@@ -310,7 +297,7 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest {
         // Organization authority as its parent Organization resource.
 
         String subBodyResourceId = createSubBodyOrganization("Test SubBody Organization");
-        allItemResourceIdsCreated.put(subBodyResourceId, knownResourceId);
+        allResourceItemIdsCreated.put(subBodyResourceId, knownResourceId);
         subBodyRefName = OrgAuthorityClientUtils.getOrgRefName(knownResourceId, subBodyResourceId, null);
     }
 
@@ -331,8 +318,8 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest {
        ClientResponse<Response> res = orgAuthClient.createItem(knownResourceId, multipart);
        try {
             int statusCode = res.getStatus();
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
             Assert.assertEquals(statusCode, STATUS_CREATED);
             result = extractId(res);
        } finally {
@@ -349,28 +336,29 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest {
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+    @Test(dataProvider="testName",
         dependsOnMethods = {"createWithAuthRefs"})
     public void readAndCheckAuthRefs(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         testSetup(STATUS_OK, ServiceRequestType.READ);
 
         // Submit the request to the service and store the response.
         OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
-        ClientResponse<String> res =
-            orgAuthClient.readItem(knownResourceId, knownItemResourceId);
-        assertStatusCode(res, testName);
-
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        OrganizationsCommon organization = (OrganizationsCommon) extractPart(input,
-            orgAuthClient.getItemCommonPartName(), OrganizationsCommon.class);
-        Assert.assertNotNull(organization);
-        if(logger.isDebugEnabled()){
-            logger.debug(objectAsXmlString(organization, OrganizationsCommon.class));
+        ClientResponse<String> res = orgAuthClient.readItem(knownResourceId, knownItemResourceId);
+        OrganizationsCommon organization = null;
+        try {
+               assertStatusCode(res, testName);
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               organization = (OrganizationsCommon) extractPart(input,
+                   orgAuthClient.getItemCommonPartName(), OrganizationsCommon.class);
+               Assert.assertNotNull(organization);
+               if (logger.isDebugEnabled()){
+                   logger.debug(objectAsXmlString(organization, OrganizationsCommon.class));
+               }
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
         // Check one or more of the authority fields in the Organization item
         Assert.assertEquals(organization.getContactNames().getContactName().get(0),
@@ -385,9 +373,15 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest {
         // and get the ID for the organization item
         ClientResponse<AuthorityRefList> res2 =
            orgAuthClient.getItemAuthorityRefs(knownResourceId, knownItemResourceId);
-        assertStatusCode(res2, testName);
-        
-        AuthorityRefList list = res2.getEntity();
+        AuthorityRefList list = null;
+        try {
+               assertStatusCode(res2, testName);
+               list = res2.getEntity();
+        } finally {
+               if (res2 != null) {
+                       res2.releaseConnection();
+            }
+        }
         
         List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
         int numAuthRefsFound = items.size();
@@ -456,7 +450,7 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest {
         String itemResourceId;
         OrgAuthorityClient client = new OrgAuthorityClient();
         // Clean up item resources.
-        for (Map.Entry<String, String> entry : allItemResourceIdsCreated.entrySet()) {
+        for (Map.Entry<String, String> entry : allResourceItemIdsCreated.entrySet()) {
             itemResourceId = entry.getKey();
             parentResourceId = entry.getValue();
             // Note: Any non-success responses from the delete operation
index 225af8b9f3830f62bd7642cc42c0d628ddb7c983..fde3af062214f923b4a76e510ae039a2743e27a1 100644 (file)
@@ -30,6 +30,7 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
 import org.collectionspace.services.OrganizationJAXBSchema;
+import org.collectionspace.services.client.AbstractCommonListUtils;
 import org.collectionspace.services.client.AuthorityClient;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.ContactClient;
@@ -37,7 +38,6 @@ import org.collectionspace.services.client.ContactClientUtils;
 import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
-import org.collectionspace.services.common.AbstractCommonListUtils;
 import org.collectionspace.services.contact.AddressGroup;
 import org.collectionspace.services.contact.AddressGroupList;
 import org.collectionspace.services.contact.ContactsCommon;
@@ -64,7 +64,7 @@ import org.testng.annotations.Test;
  * $LastChangedRevision$
  * $LastChangedDate$
  */
-public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME: Test classes for Vocab, Person, Org, and Location should have a base class!
+public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<OrgauthoritiesCommon, OrganizationsCommon> {
 
     /** The logger. */
     private final String CLASS_NAME = OrgAuthorityServiceTest.class.getName();
@@ -83,32 +83,19 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
     }
     /** The test organization shortname. */
     private final String TEST_ORG_SHORTNAME = "Test Org";
+    
     /** The test organization founding place. */
     private final String TEST_ORG_FOUNDING_PLACE = "Anytown, USA";
-    // Hold some values for a recently created item to verify upon read.
-    private String knownResourceId = null;
-    private String knownResourceShortIdentifer = null;
-    private String knownResourceRefName = null;
-    private String knownItemResourceId = null;
+    
     private String knownItemResourceShortIdentifer = null;
+    
     /** The known contact resource id. */
     private String knownContactResourceId = null;
-    /** The n items to create in list. */
-    private int nItemsToCreateInList = 3;
-    /** The all item resource ids created. */
-    private Map<String, String> allItemResourceIdsCreated =
-            new HashMap<String, String>();
+    
     /** The all contact resource ids created. */
     private Map<String, String> allContactResourceIdsCreated =
             new HashMap<String, String>();
 
-    protected void setKnownResource(String id, String shortIdentifer,
-            String refName) {
-        knownResourceId = id;
-        knownResourceShortIdentifer = shortIdentifer;
-        knownResourceRefName = refName;
-    }
-
     protected void setKnownItemResource(String id, String shortIdentifer) {
         knownItemResourceId = id;
         knownItemResourceShortIdentifer = shortIdentifer;
@@ -122,70 +109,6 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
         return new OrgAuthorityClient();
     }
 
-    // ---------------------------------------------------------------
-    // CRUD tests : CREATE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"create"})
-    public void create(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup, such as initializing the type of service request
-        // (e.g. CREATE, DELETE), its valid and expected status codes, and
-        // its associated HTTP method name (e.g. POST, DELETE).
-        setupCreate();
-
-        // Submit the request to the service and store the response.
-        OrgAuthorityClient client = new OrgAuthorityClient();
-        String shortId = createIdentifier();
-        String displayName = "displayName-" + shortId;
-        //String baseRefName = OrgAuthorityClientUtils.createOrgAuthRefName(shortId, null);
-        PoxPayloadOut multipart = OrgAuthorityClientUtils.createOrgAuthorityInstance(
-                displayName, shortId, client.getCommonPartName());
-
-        String newID = null;
-        ClientResponse<Response> res = client.create(multipart);
-        try {
-            int statusCode = res.getStatus();
-
-            // Check the status code of the response: does it match
-            // the expected response(s)?
-            //
-            // Specifically:
-            // Does it fall within the set of valid status codes?
-            // Does it exactly match the expected status code?
-            if (logger.isDebugEnabled()) {
-                logger.debug(testName + ": status = " + statusCode);
-            }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
-            newID = OrgAuthorityClientUtils.extractId(res);
-        } finally {
-            res.releaseConnection();
-        }
-
-        // Store the ID returned from the first resource created
-        // for additional tests below.
-        if (knownResourceId == null) {
-            setKnownResource(newID, shortId, null ); //baseRefName);
-            if (logger.isDebugEnabled()) {
-                logger.debug(testName + ": knownResourceId=" + knownResourceId);
-            }
-        }
-        // Store the IDs from every resource created by tests,
-        // so they can be deleted after tests have been run.
-        allResourceIdsCreated.add(newID);
-    }
-
     @Override
     protected PoxPayloadOut createInstance(String identifier) {
         OrgAuthorityClient client = new OrgAuthorityClient();
@@ -209,18 +132,6 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
         return OrgAuthorityClientUtils.createOrganizationInstance(identifier, testOrgMap, headerLabel);
     }
 
-    /**
-     * Creates the item.
-     *
-     * @param testName the test name
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"create"}, dependsOnMethods = {"create"})
-    public void createItem(String testName) {
-        setupCreate();
-        String newID = createItemInAuthority(knownResourceId, knownResourceRefName);
-    }
-
     /**
      * Creates the item in authority.
      *
@@ -273,7 +184,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
         // Store the IDs from any item resources created
         // by tests, along with the IDs of their parents, so these items
         // can be deleted after all tests have been run.
-        allItemResourceIdsCreated.put(newID, vcsid);
+        allResourceItemIdsCreated.put(newID, vcsid);
 
         return newID;
     }
@@ -283,8 +194,8 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
      *
      * @param testName the test name
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"create"}, dependsOnMethods = {"createItem"})
+    @Test(dataProvider = "testName", groups = {"create"},
+               dependsOnMethods = {"createItem"})
     public void createContact(String testName) {
         setupCreate();
         String newID = createContactInItem(knownResourceId, knownItemResourceId);
@@ -301,7 +212,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
 
         final String testName = "createContactInItem";
         if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
+            logger.debug(getTestBanner(testName, CLASS_NAME));
         }
         setupCreate();
 
@@ -316,19 +227,12 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
         ClientResponse<Response> res =
                 client.createContact(parentcsid, itemcsid, multipart);
         try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
+            assertStatusCode(res, testName);
             newID = OrgAuthorityClientUtils.extractId(res);
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
 
         // Store the ID returned from the first contact resource created
@@ -348,160 +252,14 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
         return newID;
     }
 
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
-     */
-    @Override
-    public void createWithEmptyEntityBody(String testName) throws Exception {
-        //Should this really be empty?
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
-     */
-    @Override
-    public void createWithMalformedXml(String testName) throws Exception {
-        //Should this really be empty?
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
-     */
-    @Override
-    public void createWithWrongXmlSchema(String testName) throws Exception {
-        //Should this really be empty?
-    }
-
-    /*
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-    groups = {"create"}, dependsOnMethods = {"create", "testSubmitRequest"})
-    public void createWithEmptyEntityBody(String testName) throws Exception {
-    
-    if (logger.isDebugEnabled()) {
-    logger.debug(testBanner(testName, CLASS_NAME));
-    }
-    // Perform setup.
-    setupCreateWithEmptyEntityBody();
-    
-    // Submit the request to the service and store the response.
-    String method = REQUEST_TYPE.httpMethodName();
-    String url = getServiceRootURL();
-    String mediaType = MediaType.APPLICATION_XML;
-    final String entity = "";
-    int statusCode = submitRequest(method, url, mediaType, entity);
-    
-    // Check the status code of the response: does it match
-    // the expected response(s)?
-    if(logger.isDebugEnabled()) {
-    logger.debug(testName + ": url=" + url +
-    " status=" + statusCode);
-    }
-    Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-    Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-    
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-    groups = {"create"}, dependsOnMethods = {"create", "testSubmitRequest"})
-    public void createWithMalformedXml(String testName) throws Exception {
-    
-    if (logger.isDebugEnabled()) {
-    logger.debug(testBanner(testName, CLASS_NAME));
-    }
-    // Perform setup.
-    setupCreateWithMalformedXml();
-    
-    // Submit the request to the service and store the response.
-    String method = REQUEST_TYPE.httpMethodName();
-    String url = getServiceRootURL();
-    String mediaType = MediaType.APPLICATION_XML;
-    final String entity = MALFORMED_XML_DATA; // Constant from base class.
-    int statusCode = submitRequest(method, url, mediaType, entity);
-    
-    // Check the status code of the response: does it match
-    // the expected response(s)?
-    if(logger.isDebugEnabled()){
-    logger.debug(testName + ": url=" + url +
-    " status=" + statusCode);
-    }
-    Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-    Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-    
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-    groups = {"create"}, dependsOnMethods = {"create", "testSubmitRequest"})
-    public void createWithWrongXmlSchema(String testName) throws Exception {
-    
-    if (logger.isDebugEnabled()) {
-    logger.debug(testBanner(testName, CLASS_NAME));
-    }
-    // Perform setup.
-    setupCreateWithWrongXmlSchema();
-    
-    // Submit the request to the service and store the response.
-    String method = REQUEST_TYPE.httpMethodName();
-    String url = getServiceRootURL();
-    String mediaType = MediaType.APPLICATION_XML;
-    final String entity = WRONG_XML_SCHEMA_DATA;
-    int statusCode = submitRequest(method, url, mediaType, entity);
-    
-    // Check the status code of the response: does it match
-    // the expected response(s)?
-    if(logger.isDebugEnabled()){
-    logger.debug(testName + ": url=" + url +
-    " status=" + statusCode);
-    }
-    Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-    Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-     */
-    // ---------------------------------------------------------------
-    // CRUD tests : CREATE LIST tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"createList"}, dependsOnGroups = {"create"})
-    public void createList(String testName) throws Exception {
-        for (int i = 0; i < nItemsToCreateInList; i++) {
-            create(testName);
-        }
-    }
-
-    /**
-     * Creates the item list.
-     *
-     * @param testName the test name
-     * @throws Exception the exception
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"createList"}, dependsOnMethods = {"createList"})
-    public void createItemList(String testName) throws Exception {
-        // Add items to the initially-created, known parent record.
-        for (int j = 0; j < nItemsToCreateInList; j++) {
-            createItem(testName);
-        }
-    }
-
     /**
      * Creates the contact list.
      *
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"createList"}, dependsOnMethods = {"createItemList"})
+    @Test(dataProvider = "testName", groups = {"createList"},
+               dependsOnMethods = {"createItemList"})
     public void createContactList(String testName) throws Exception {
         // Add contacts to the initially-created, known item record.
         for (int j = 0; j < nItemsToCreateInList; j++) {
@@ -517,8 +275,8 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"read"}, dependsOnGroups = {"create"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    groups = {"read"}, dependsOnGroups = {"create"})
     public void read(String testName) throws Exception {
         readInternal(testName, knownResourceId, null);
     }
@@ -529,17 +287,13 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"read"}, dependsOnGroups = {"create"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    groups = {"read"}, dependsOnGroups = {"create"})
     public void readByName(String testName) throws Exception {
         readInternal(testName, null, knownResourceShortIdentifer);
     }
 
     protected void readInternal(String testName, String CSID, String shortId) {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupRead();
 
@@ -553,8 +307,8 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
         } else {
             Assert.fail("readInternal: Internal error. One of CSID or shortId must be non-null");
         }
-        assertStatusCode(res, testName);
         try {
+            assertStatusCode(res, testName);           
             //FIXME: remove the following try catch once Aron fixes signatures
             try {
                 PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
@@ -568,22 +322,12 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
                 throw new RuntimeException(e);
             }
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
     }
 
-    /**
-     * Read item.
-     *
-     * @param testName the test name
-     * @throws Exception the exception
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"readItem"}, dependsOnGroups = {"read"})
-    public void readItem(String testName) throws Exception {
-        readItemInternal(testName, knownResourceId, null, knownItemResourceId, null);
-    }
-
     /**
      * Read item in Named Auth.
      * 
@@ -598,17 +342,30 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
     readItemInternal(testName, null, knownResourceShortIdentifer, knownItemResourceId, null);
     }
      */
+    
     /**
      * Read named item.
      *
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"readItem"}, dependsOnGroups = {"read"})
+    @Test(dataProvider = "testName", groups = {"readItem"},
+               dependsOnMethods = {"readItemInNamedAuth"})
     public void readNamedItem(String testName) throws Exception {
         readItemInternal(testName, knownResourceId, null, null, knownItemResourceShortIdentifer);
     }
+    
+    /**
+     * Read item in Named Auth.
+     *
+     * @param testName the test name
+     * @throws Exception the exception
+     */
+    @Test(dataProvider = "testName", groups = {"readItem"},
+               dependsOnMethods = {"readItem"})
+    public void readItemInNamedAuth(String testName) throws Exception {
+        readItemInternal(testName, null, knownResourceShortIdentifer, knownItemResourceId, null);
+    }
 
     /**
      * Read Named item in Named Auth.
@@ -616,8 +373,8 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"readItem"}, dependsOnGroups = {"read"})
+    @Test(dataProvider = "testName", groups = {"readItem"},
+               dependsOnMethods = {"readItem"})
     public void readNamedItemInNamedAuth(String testName) throws Exception {
         readItemInternal(testName, null, knownResourceShortIdentifer, null, knownItemResourceShortIdentifer);
     }
@@ -625,10 +382,6 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
     protected void readItemInternal(String testName,
             String authCSID, String authShortId, String itemCSID, String itemShortId)
             throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupRead();
 
@@ -654,8 +407,8 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
         } else {
             Assert.fail("readInternal: Internal error. One of authCSID or authShortId must be non-null");
         }
-        assertStatusCode(res, testName);
         try {
+            assertStatusCode(res, testName);
             // Check whether we've received a organization.
             PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
             OrganizationsCommon organization = (OrganizationsCommon) extractPart(input,
@@ -677,9 +430,18 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
             Assert.assertNotNull(contactNames.get(0));
 
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
     }
+    
+    @Override
+    protected void verifyReadItemInstance(OrganizationsCommon item) throws Exception {
+        List<String> contactNames = item.getContactNames().getContactName();
+        Assert.assertTrue(contactNames.size() > 0);
+        Assert.assertNotNull(contactNames.get(0));
+    }
 
     /**
      * Verify item display name.
@@ -687,25 +449,26 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"readItem", "updateItem"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"org.collectionspace.services.client.test.AbstractAuthorityServiceTest.updateItem"})
     public void verifyItemDisplayName(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
-        setupUpdate();
-
-        // Submit the request to the service and store the response.
+        setupRead();
+        //
+        // First, read our known resource.
+        //
         OrgAuthorityClient client = new OrgAuthorityClient();
         PoxPayloadIn input = null;
         ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
-        assertStatusCode(res, testName);
         try {
+            assertStatusCode(res, testName);
+            // Check whether organization has expected displayName.
             input = new PoxPayloadIn(res.getEntity());
+            Assert.assertNotNull(input);
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
 
         // Check whether organization has expected displayName.
@@ -728,26 +491,32 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
         MainBodyGroup mainBodyGroup = new MainBodyGroup();
         String updatedShortName = "updated-" + TEST_ORG_SHORTNAME;
         mainBodyGroup.setShortName(updatedShortName);
+        mainBodyGroups.clear(); //clear all the elements and do a sparse update
         mainBodyGroups.add(mainBodyGroup);
         organization.setMainBodyGroupList(mainBodyList);
 
         expectedDisplayName =
                 OrgAuthorityClientUtils.prepareDefaultDisplayName(
                 updatedShortName, TEST_ORG_FOUNDING_PLACE);
-
-        // Submit the updated resource to the service and store the response.
+        //
+        // Next, submit the updated resource to the service and store the response.
+        //
+        setupUpdate();
         PoxPayloadOut output = new PoxPayloadOut(OrgAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = output.addPart(organization, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getItemCommonPartName());
+        PayloadOutputPart commonPart = output.addPart(client.getItemCommonPartName(), organization);
         res = client.updateItem(knownResourceId, knownItemResourceId, output);
-        assertStatusCode(res, testName);
         try {
+            assertStatusCode(res, testName);
             // Retrieve the updated resource and verify that its contents exist.
             input = new PoxPayloadIn(res.getEntity());
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-
+        //
+        // Now verify the update was correct.
+        //
         OrganizationsCommon updatedOrganization =
                 (OrganizationsCommon) extractPart(input,
                 client.getItemCommonPartName(), OrganizationsCommon.class);
@@ -763,25 +532,27 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
         // Verify that the updated resource computes the right displayName.
         Assert.assertEquals(updatedOrganization.getDisplayName(), expectedDisplayName,
                 "Updated ShortName in Organization not reflected in computed DisplayName.");
-
+        //
         // Now Update the displayName, not computed and verify the computed name is overriden.
+        //
         organization.setDisplayNameComputed(false);
         expectedDisplayName = "TestName";
         organization.setDisplayName(expectedDisplayName);
 
         // Submit the updated resource to the service and store the response.
         output = new PoxPayloadOut(OrgAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
-        commonPart = output.addPart(organization, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getItemCommonPartName());
+        commonPart = output.addPart(client.getItemCommonPartName(), organization);
         res = client.updateItem(knownResourceId, knownItemResourceId, output);
-        assertStatusCode(res, testName);
+        input = null;
         try {
+            assertStatusCode(res, testName);
             // Retrieve the updated resource and verify that its contents exist.
             input = new PoxPayloadIn(res.getEntity());
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-
         updatedOrganization =
                 (OrganizationsCommon) extractPart(input,
                 client.getItemCommonPartName(), OrganizationsCommon.class);
@@ -802,43 +573,47 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"verifyItemDisplayName"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"verifyItemDisplayName"})
     public void verifyIllegalItemDisplayName(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        
         // Perform setup for read.
         setupRead();
-        
-        // Submit the request to the service and store the response.
+        //
+        // First read our known resource.
+        //
         OrgAuthorityClient client = new OrgAuthorityClient();
         ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
-        assertStatusCode(res, testName);
-        
-        // Perform setup for update.
-        testSetup(STATUS_BAD_REQUEST, ServiceRequestType.UPDATE);
-
+        OrganizationsCommon organization = null;
         try {
+            assertStatusCode(res, testName);           
             // Check whether organization has expected displayName.
             PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-            OrganizationsCommon organization = (OrganizationsCommon) extractPart(input,
+            organization = (OrganizationsCommon) extractPart(input,
                     client.getItemCommonPartName(), OrganizationsCommon.class);
             Assert.assertNotNull(organization);
-            // Try to Update with computed false and no displayName
-            organization.setDisplayNameComputed(false);
-            organization.setDisplayName(null);
-
-            // Submit the updated resource to the service and store the response.
-            PoxPayloadOut output = new PoxPayloadOut(OrgAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
-            PayloadOutputPart commonPart = output.addPart(organization, MediaType.APPLICATION_XML_TYPE);
-            commonPart.setLabel(client.getItemCommonPartName());
-            res = client.updateItem(knownResourceId, knownItemResourceId, output);
-            assertStatusCode(res, testName);
-       } finally {
-            res.releaseConnection();
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
+        //
+        // Try to Update with 'displayNameComputed' flag set to false and no displayName
+        //
+        organization.setDisplayNameComputed(false);
+        organization.setDisplayName(null);
+        
+        setupUpdateWithInvalidBody(); // we expect a failure
+        // Submit the updated resource to the service and store the response.
+        PoxPayloadOut output = new PoxPayloadOut(OrgAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
+        PayloadOutputPart commonPart = output.addPart(client.getItemCommonPartName(),
+                       organization);
+        res = client.updateItem(knownResourceId, knownItemResourceId, output);
+        try {
+               assertStatusCode(res, testName);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
     }
 
@@ -848,13 +623,9 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"readItem"}, dependsOnMethods = {"readItem"})
+    @Test(dataProvider = "testName", groups = {"readItem"},
+               dependsOnMethods = {"readItem"})
     public void readContact(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupRead();
 
@@ -863,8 +634,8 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
         ClientResponse<String> res =
                 client.readContact(knownResourceId, knownItemResourceId,
                 knownContactResourceId);
-        assertStatusCode(res, testName);
         try {
+            assertStatusCode(res, testName);           
             // Check whether we've received a contact.
             PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
             ContactsCommon contact = (ContactsCommon) extractPart(input,
@@ -878,28 +649,27 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
             Assert.assertEquals(contact.getInAuthority(), knownResourceId);
             Assert.assertEquals(contact.getInItem(), knownItemResourceId);
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
     }
 
-    // Failure outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
+    /**
+     * Read contact non existent.
+     *
+     * @param testName the test name
      */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"read"}, dependsOnMethods = {"read"})
-    public void readNonExistent(String testName) {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
+    @Test(dataProvider = "testName", groups = {"readItem"},
+               dependsOnMethods = {"readContact"})
+    public void readContactNonExistent(String testName) {
         // Perform setup.
         setupReadNonExistent();
 
         // Submit the request to the service and store the response.
         OrgAuthorityClient client = new OrgAuthorityClient();
-        ClientResponse<String> res = client.read(NON_EXISTENT_ID);
+        ClientResponse<String> res =
+                client.readContact(knownResourceId, knownItemResourceId, NON_EXISTENT_ID);
         try {
             int statusCode = res.getStatus();
 
@@ -908,148 +678,46 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
             if (logger.isDebugEnabled()) {
                 logger.debug(testName + ": status = " + statusCode);
             }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
+            Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
     }
 
     /**
-     * Read item non existent.
-     *
-     * @param testName the test name
+     * Read item list.
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"readItem"}, dependsOnMethods = {"readItem"})
-    public void readItemNonExistent(String testName) {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadNonExistent();
-
-        // Submit the request to the service and store the response.
-        OrgAuthorityClient client = new OrgAuthorityClient();
-        ClientResponse<String> res = client.readItem(knownResourceId, NON_EXISTENT_ID);
-        try {
-            int statusCode = res.getStatus();
+    @Override
+//     @Test(groups = {"readList"}, dependsOnMethods = {"readList"})
+    public void readItemList(String testName) {
+        readItemList(knownAuthorityWithItems, null);
+    }
 
-            // Check the status code of the response: does it match
-            // the expected response(s)?
-            if (logger.isDebugEnabled()) {
-                logger.debug(testName + ": status = " + statusCode);
-            }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        } finally {
-            res.releaseConnection();
-        }
+    /**
+     * Read item list by authority name.
+     */
+    @Override
+//    @Test(dataProvider = "testName",
+//             dependsOnMethods = {"readItem"})
+    public void readItemListByName(String testName) {
+        readItemList(null, READITEMS_SHORT_IDENTIFIER);
     }
 
     /**
-     * Read contact non existent.
+     * Read item list.
      *
-     * @param testName the test name
+     * @param vcsid the vcsid
+     * @param name the name
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"readItem"}, dependsOnMethods = {"readContact"})
-    public void readContactNonExistent(String testName) {
+    private void readItemList(String vcsid, String name) {
 
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
+        final String testName = "readItemList";
         // Perform setup.
-        setupReadNonExistent();
-
-        // Submit the request to the service and store the response.
-        OrgAuthorityClient client = new OrgAuthorityClient();
-        ClientResponse<String> res =
-                client.readContact(knownResourceId, knownItemResourceId, NON_EXISTENT_ID);
-        try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        } finally {
-            res.releaseConnection();
-        }
-    }
-
-    // ---------------------------------------------------------------
-    // CRUD tests : READ_LIST tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"readList"}, dependsOnGroups = {"createList", "read"})
-    public void readList(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadList();
-
-        // Submit the request to the service and store the response.
-        OrgAuthorityClient client = new OrgAuthorityClient();
-        ClientResponse<AbstractCommonList> res = client.readList();
-        assertStatusCode(res, testName);
-        try {
-            AbstractCommonList list = res.getEntity();
-            // Optionally output additional data about list members for debugging.
-            if (logger.isTraceEnabled()) {
-                AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
-            }
-        } finally {
-            res.releaseConnection();
-        }
-    }
-
-    /**
-     * Read item list.
-     */
-    @Test(groups = {"readList"}, dependsOnMethods = {"readList"})
-    public void readItemList() {
-        readItemList(knownResourceId, null);
-    }
-
-    /**
-     * Read item list by authority name.
-     */
-    @Test(groups = {"readList"}, dependsOnMethods = {"readItemList"})
-    public void readItemListByAuthorityName() {
-        readItemList(null, knownResourceShortIdentifer);
-    }
-
-    /**
-     * Read item list.
-     *
-     * @param vcsid the vcsid
-     * @param name the name
-     */
-    private void readItemList(String vcsid, String name) {
-
-        final String testName = "readItemList";
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadList();
+        setupReadList();
 
         // Submit the request to the service and store the response.
         OrgAuthorityClient client = new OrgAuthorityClient();
@@ -1061,45 +729,47 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
         } else {
             Assert.fail("readItemList passed null csid and name!");
         }
-        assertStatusCode(res, testName);
+        
+        AbstractCommonList list = null;
         try {
-            AbstractCommonList list = res.getEntity();
-            List<AbstractCommonList.ListItem> items =
-                    list.getListItem();
-            int nItemsReturned = items.size();
-            // There will be one item created, associated with a
-            // known parent resource, by the createItem test.
-            //
-            // In addition, there will be 'nItemsToCreateInList'
-            // additional items created by the createItemList test,
-            // all associated with the same parent resource.
-            int nExpectedItems = nItemsToCreateInList + 1;
-            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, REFNAME);
-                Assert.assertTrue((null != value), "Item refName is null!");
-                value =
-                        AbstractCommonListUtils.ListItemGetElementValue(item, DISPLAYNAME);
-                Assert.assertTrue((null != value), "Item displayName is null!");
-            }
-            if (logger.isTraceEnabled()) {
-                AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
-            }
+            assertStatusCode(res, testName);           
+            list = res.getEntity();
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
+        
+        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, REFNAME);
+            Assert.assertTrue((null != value), "Item refName is null!");
+            value =
+                    AbstractCommonListUtils.ListItemGetElementValue(item, DISPLAYNAME);
+            Assert.assertTrue((null != value), "Item displayName is null!");
+        }
+        if (logger.isTraceEnabled()) {
+            AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
         }
     }
 
     /**
      * Read contact list.
      */
-    @Test(groups = {"readList"}, dependsOnMethods = {"readItemList"})
+    @Test(groups = {"readList"},
+               dependsOnMethods = {"org.collectionspace.services.client.test.AbstractAuthorityServiceTest.readItemList"})
     public void readContactList() {
         readContactList(knownResourceId, knownItemResourceId);
     }
@@ -1112,185 +782,43 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
      */
     private void readContactList(String parentcsid, String itemcsid) {
         final String testName = "readContactList";
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupReadList();
 
         // Submit the request to the service and store the response.
         OrgAuthorityClient client = new OrgAuthorityClient();
-        AbstractCommonList list = null;
         ClientResponse<AbstractCommonList> res =
                 client.readContactList(parentcsid, itemcsid);
-        assertStatusCode(res, testName);
+        AbstractCommonList list = null;
         try {
+            assertStatusCode(res, testName);
             list = res.getEntity();
-
-            List<AbstractCommonList.ListItem> listitems =
-                list.getListItem();
-            int nItemsReturned = listitems.size();
-            // There will be one item created, associated with a
-            // known parent resource, by the createItem test.
-            //
-            // In addition, there will be 'nItemsToCreateInList'
-            // additional items created by the createItemList test,
-            // all associated with the same parent resource.
-            int nExpectedItems = nItemsToCreateInList + 1;
-            if (logger.isDebugEnabled()) {
-                logger.debug(testName + ": Expected "
-                        + nExpectedItems + " items; got: " + nItemsReturned);
-            }
-            Assert.assertEquals(nItemsReturned, nExpectedItems);
-
-            // Optionally output additional data about list members for debugging.
-            boolean iterateThroughList = false;
-            if (iterateThroughList && logger.isDebugEnabled()) {
-                AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
-            }
         } finally {
-            res.releaseConnection();
-        }
-    }
-
-    // Failure outcomes
-    // None at present.
-    // ---------------------------------------------------------------
-    // CRUD tests : UPDATE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"update"}, dependsOnGroups = {"read", "readList"})
-    public void update(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdate();
-
-        // Retrieve the contents of a resource to update.
-        OrgAuthorityClient client = new OrgAuthorityClient();
-        ClientResponse<String> res =
-                client.read(knownResourceId);
-        assertStatusCode(res, testName);
-        try {
-            if (logger.isDebugEnabled()) {
-                logger.debug("got OrgAuthority to update with ID: " + knownResourceId);
-            }
-            PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-            OrgauthoritiesCommon orgAuthority = (OrgauthoritiesCommon) extractPart(input,
-                    client.getCommonPartName(), OrgauthoritiesCommon.class);
-            Assert.assertNotNull(orgAuthority);
-
-            // Update the contents of this resource.
-            orgAuthority.setDisplayName("updated-" + orgAuthority.getDisplayName());
-            orgAuthority.setVocabType("updated-" + orgAuthority.getVocabType());
-            if (logger.isDebugEnabled()) {
-                logger.debug("to be updated OrgAuthority");
-                logger.debug(objectAsXmlString(orgAuthority, OrgauthoritiesCommon.class));
+               if (res != null) {
+                res.releaseConnection();
             }
-
-            // Submit the updated resource to the service and store the response.
-            PoxPayloadOut output = new PoxPayloadOut(OrgAuthorityClient.SERVICE_PAYLOAD_NAME);
-            PayloadOutputPart commonPart = output.addPart(orgAuthority, MediaType.APPLICATION_XML_TYPE);
-            commonPart.setLabel(client.getCommonPartName());
-            res.releaseConnection();
-            res = client.update(knownResourceId, output);
-            assertStatusCode(res, testName);
-
-            // Retrieve the updated resource and verify that its contents exist.
-            input = new PoxPayloadIn(res.getEntity());
-            OrgauthoritiesCommon updatedOrgAuthority =
-                    (OrgauthoritiesCommon) extractPart(input,
-                    client.getCommonPartName(), OrgauthoritiesCommon.class);
-            Assert.assertNotNull(updatedOrgAuthority);
-
-            // Verify that the updated resource received the correct data.
-            Assert.assertEquals(updatedOrgAuthority.getDisplayName(),
-                    orgAuthority.getDisplayName(),
-                    "Data in updated object did not match submitted data.");
-        } finally {
-            res.releaseConnection();
         }
-    }
-
-    /**
-     * Update item.
-     *
-     * @param testName the test name
-     * @throws Exception the exception
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"update"}, dependsOnMethods = {"update"})
-    public void updateItem(String testName) throws Exception {
 
+        List<AbstractCommonList.ListItem> listitems =
+            list.getListItem();
+        int nItemsReturned = listitems.size();
+        // There will be one item created, associated with a
+        // known parent resource, by the createItem test.
+        //
+        // In addition, there will be 'nItemsToCreateInList'
+        // additional items created by the createItemList test,
+        // all associated with the same parent resource.
+        int nExpectedItems = nItemsToCreateInList + 1;
         if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
+            logger.debug(testName + ": Expected "
+                    + nExpectedItems + " items; got: " + nItemsReturned);
         }
-        // Perform setup.
-        setupUpdate();
-
-        // Retrieve the contents of a resource to update.
-        OrgAuthorityClient client = new OrgAuthorityClient();
-        ClientResponse<String> res =
-                client.readItem(knownResourceId, knownItemResourceId);
-        assertStatusCode(res, testName);
-        try {
-            if (logger.isDebugEnabled()) {
-                logger.debug("got Organization to update with ID: "
-                        + knownItemResourceId
-                        + " in OrgAuthority: " + knownResourceId);
-            }
-            PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-            OrganizationsCommon organization = (OrganizationsCommon) extractPart(input,
-                    client.getItemCommonPartName(), OrganizationsCommon.class);
-            Assert.assertNotNull(organization);
-
-            // Update the contents of this resource.
-            organization.setCsid(null);
+        Assert.assertEquals(nItemsReturned, nExpectedItems);
 
-            MainBodyGroupList mainBodyList = organization.getMainBodyGroupList();
-            Assert.assertNotNull(mainBodyList);
-            List<MainBodyGroup> mainBodyGroups = mainBodyList.getMainBodyGroup();
-            Assert.assertTrue(mainBodyList.getMainBodyGroup().size() > 0);
-            String updatedShortName = "updated-" + mainBodyGroups.get(0).getShortName();
-            mainBodyGroups.get(0).setShortName(updatedShortName);
-
-            if (logger.isDebugEnabled()) {
-                logger.debug("to be updated Organization");
-                logger.debug(objectAsXmlString(organization,
-                        OrganizationsCommon.class));
-            }
-
-            // Submit the updated resource to the service and store the response.
-            PoxPayloadOut output = new PoxPayloadOut(OrgAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
-            PayloadOutputPart commonPart = output.addPart(organization, MediaType.APPLICATION_XML_TYPE);
-            commonPart.setLabel(client.getItemCommonPartName());
-            res.releaseConnection();
-            res = client.updateItem(knownResourceId, knownItemResourceId, output);
-            assertStatusCode(res, testName);
-
-            // Retrieve the updated resource and verify that its contents exist.
-            input = new PoxPayloadIn(res.getEntity());
-            OrganizationsCommon updatedOrganization =
-                    (OrganizationsCommon) extractPart(input,
-                    client.getItemCommonPartName(), OrganizationsCommon.class);
-            Assert.assertNotNull(updatedOrganization);
-
-            // Verify that the updated resource received the correct data.
-            mainBodyList = organization.getMainBodyGroupList();
-            Assert.assertNotNull(mainBodyList);
-            Assert.assertTrue(mainBodyList.getMainBodyGroup().size() > 0);
-            Assert.assertEquals(updatedOrganization.getMainBodyGroupList().getMainBodyGroup().get(0).getShortName(),
-                    updatedShortName, "Data in updated Organization did not match submitted data.");
-        } finally {
-            res.releaseConnection();
+        // Optionally output additional data about list members for debugging.
+        boolean iterateThroughList = false;
+        if (iterateThroughList && logger.isDebugEnabled()) {
+            AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
         }
     }
 
@@ -1300,13 +828,9 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"update"}, dependsOnMethods = {"updateItem"})
+    @Test(dataProvider = "testName", groups = {"update"},
+               dependsOnMethods = {"org.collectionspace.services.client.test.AbstractAuthorityServiceTest.updateItem"})
     public void updateContact(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupUpdate();
 
@@ -1314,8 +838,9 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
         OrgAuthorityClient client = new OrgAuthorityClient();
         ClientResponse<String> res =
                 client.readContact(knownResourceId, knownItemResourceId, knownContactResourceId);
-        assertStatusCode(res, testName);
+        ContactsCommon contact = null;
         try {
+            assertStatusCode(res, testName);           
             if (logger.isDebugEnabled()) {
                 logger.debug("got Contact to update with ID: "
                         + knownContactResourceId
@@ -1323,247 +848,56 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
                         + " in parent: " + knownResourceId);
             }
             PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-            ContactsCommon contact = (ContactsCommon) extractPart(input,
+            contact = (ContactsCommon) extractPart(input,
                     new ContactClient().getCommonPartName(), ContactsCommon.class);
             Assert.assertNotNull(contact);
-
-            // Verify the contents of this resource
-            AddressGroupList addressGroupList = contact.getAddressGroupList();
-            Assert.assertNotNull(addressGroupList);
-            List<AddressGroup> addressGroups = addressGroupList.getAddressGroup();
-            Assert.assertNotNull(addressGroups);
-            Assert.assertTrue(addressGroups.size() > 0);
-            String addressPlace1 = addressGroups.get(0).getAddressPlace1();
-            Assert.assertNotNull(addressPlace1);
-
-            // Update the contents of this resource.
-            addressGroups.get(0).setAddressPlace1("updated-" + addressPlace1);
-            contact.setAddressGroupList(addressGroupList);
-            if (logger.isDebugEnabled()) {
-                logger.debug("to be updated Contact");
-                logger.debug(objectAsXmlString(contact,
-                        ContactsCommon.class));
-            }
-
-            // Submit the updated resource to the service and store the response.
-            PoxPayloadOut output = new PoxPayloadOut(ContactClient.SERVICE_PAYLOAD_NAME);
-            PayloadOutputPart commonPart = output.addPart(contact, MediaType.APPLICATION_XML_TYPE);
-            commonPart.setLabel(new ContactClient().getCommonPartName());
-            res.releaseConnection();
-            res = client.updateContact(knownResourceId, knownItemResourceId, knownContactResourceId, output);
-            assertStatusCode(res, testName);
-
-            // Retrieve the updated resource and verify that its contents exist.
-            input = new PoxPayloadIn(res.getEntity());
-            ContactsCommon updatedContact =
-                    (ContactsCommon) extractPart(input,
-                    new ContactClient().getCommonPartName(), ContactsCommon.class);
-            Assert.assertNotNull(updatedContact);
-
-            // Verify that the updated resource received the correct data.
-            Assert.assertEquals(updatedContact.getAddressGroupList().getAddressGroup().get(0).getAddressPlace1(),
-                    contact.getAddressGroupList().getAddressGroup().get(0).getAddressPlace1(),
-                    "Data in updated object did not match submitted data.");
-
         } finally {
-            res.releaseConnection();
-        }
-    }
-
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
-     */
-    @Override
-    public void updateWithEmptyEntityBody(String testName) throws Exception {
-        //Should this really be empty?
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
-     */
-    @Override
-    public void updateWithMalformedXml(String testName) throws Exception {
-        //Should this really be empty?
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
-     */
-    @Override
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
-        //Should this really be empty?
-    }
-
-    /*
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-    groups = {"update"}, dependsOnMethods = {"update", "testSubmitRequest"})
-    public void updateWithEmptyEntityBody(String testName) throws Exception {
-    
-    if (logger.isDebugEnabled()) {
-    logger.debug(testBanner(testName, CLASS_NAME));
-    }
-    // Perform setup.
-    setupUpdateWithEmptyEntityBody();
-    
-    // Submit the request to the service and store the response.
-    String method = REQUEST_TYPE.httpMethodName();
-    String url = getResourceURL(knownResourceId);
-    String mediaType = MediaType.APPLICATION_XML;
-    final String entity = "";
-    int statusCode = submitRequest(method, url, mediaType, entity);
-    
-    // Check the status code of the response: does it match
-    // the expected response(s)?
-    if(logger.isDebugEnabled()){
-    logger.debug(testName + ": url=" + url +
-    " status=" + statusCode);
-    }
-    Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-    Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-    
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-    groups = {"update"}, dependsOnMethods = {"update", "testSubmitRequest"})
-    public void updateWithMalformedXml(String testName) throws Exception {
-    
-    if (logger.isDebugEnabled()) {
-    logger.debug(testBanner(testName, CLASS_NAME));
-    }
-    // Perform setup.
-    setupUpdateWithMalformedXml();
-    
-    // Submit the request to the service and store the response.
-    String method = REQUEST_TYPE.httpMethodName();
-    String url = getResourceURL(knownResourceId);
-    String mediaType = MediaType.APPLICATION_XML;
-    final String entity = MALFORMED_XML_DATA;
-    int statusCode = submitRequest(method, url, mediaType, entity);
-    
-    // Check the status code of the response: does it match
-    // the expected response(s)?
-    if(logger.isDebugEnabled()){
-    logger.debug(testName + ": url=" + url +
-    " status=" + statusCode);
-    }
-    Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-    Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-    
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-    groups = {"update"}, dependsOnMethods = {"update", "testSubmitRequest"})
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
-    
-    // Perform setup.
-    setupUpdateWithWrongXmlSchema(testName, logger);
-    
-    // Submit the request to the service and store the response.
-    String method = REQUEST_TYPE.httpMethodName();
-    String url = getResourceURL(knownResourceId);
-    String mediaType = MediaType.APPLICATION_XML;
-    final String entity = WRONG_XML_SCHEMA_DATA;
-    int statusCode = submitRequest(method, url, mediaType, entity);
-    
-    // Check the status code of the response: does it match
-    // the expected response(s)?
-    if(logger.isDebugEnabled()){
-    logger.debug("updateWithWrongXmlSchema: url=" + url +
-    " status=" + statusCode);
-    }
-    Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-    Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-     */
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"update"}, dependsOnMethods = {"update", "testSubmitRequest"})
-    public void updateNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdateNonExistent();
-
-        // Submit the request to the service and store the response.
-        // Note: The ID used in this 'create' call may be arbitrary.
-        // The only relevant ID may be the one used in update(), below.
-        OrgAuthorityClient client = new OrgAuthorityClient();
-        PoxPayloadOut multipart = OrgAuthorityClientUtils.createOrgAuthorityInstance(
-                NON_EXISTENT_ID, NON_EXISTENT_ID,
-                new OrgAuthorityClient().getCommonPartName());
-        ClientResponse<String> res =
-                client.update(NON_EXISTENT_ID, multipart);
-        try {
-            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);
+               if (res != null) {
+                res.releaseConnection();
             }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        } finally {
-            res.releaseConnection();
         }
-    }
 
-    /**
-     * Update non existent item.
-     *
-     * @param testName the test name
-     * @throws Exception the exception
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"update"}, dependsOnMethods = {"updateItem", "testItemSubmitRequest"})
-    public void updateNonExistentItem(String testName) throws Exception {
+        // Verify the contents of this resource
+        AddressGroupList addressGroupList = contact.getAddressGroupList();
+        Assert.assertNotNull(addressGroupList);
+        List<AddressGroup> addressGroups = addressGroupList.getAddressGroup();
+        Assert.assertNotNull(addressGroups);
+        Assert.assertTrue(addressGroups.size() > 0);
+        String addressPlace1 = addressGroups.get(0).getAddressPlace1();
+        Assert.assertNotNull(addressPlace1);
 
+        // Update the contents of this resource.
+        addressGroups.get(0).setAddressPlace1("updated-" + addressPlace1);
+        contact.setAddressGroupList(addressGroupList);
         if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
+            logger.debug("to be updated Contact");
+            logger.debug(objectAsXmlString(contact,
+                    ContactsCommon.class));
         }
-        // Perform setup.
-        setupUpdateNonExistent();
 
-        // Submit the request to the service and store the response.
-        // Note: The ID(s) used when creating the request payload may be arbitrary.
-        // The only relevant ID may be the one used in update(), below.
-        OrgAuthorityClient client = new OrgAuthorityClient();
-        Map<String, String> nonexOrgMap = new HashMap<String, String>();
-        nonexOrgMap.put(OrganizationJAXBSchema.SHORT_IDENTIFIER, "nonExistent");
-        nonexOrgMap.put(OrganizationJAXBSchema.SHORT_NAME, "Non-existent");
-        PoxPayloadOut multipart =
-                OrgAuthorityClientUtils.createOrganizationInstance(
-                knownResourceRefName,
-                nonexOrgMap, client.getItemCommonPartName());
-        ClientResponse<String> res =
-                client.updateItem(knownResourceId, NON_EXISTENT_ID, multipart);
-        try {
-            int statusCode = res.getStatus();
+        // Submit the updated resource to the service and store the response.
+        PoxPayloadOut output = new PoxPayloadOut(ContactClient.SERVICE_PAYLOAD_NAME);
+        PayloadOutputPart commonPart = output.addPart(contact, MediaType.APPLICATION_XML_TYPE);
+        commonPart.setLabel(new ContactClient().getCommonPartName());
 
-            // Check the status code of the response: does it match
-            // the expected response(s)?
-            if (logger.isDebugEnabled()) {
-                logger.debug(testName + ": status = " + statusCode);
-            }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        res = client.updateContact(knownResourceId, knownItemResourceId, knownContactResourceId, output);
+        try {
+               assertStatusCode(res, testName);
+               // Retrieve the updated resource and verify that its contents exist.
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               ContactsCommon updatedContact =
+                       (ContactsCommon) extractPart(input,
+                       new ContactClient().getCommonPartName(), ContactsCommon.class);
+               Assert.assertNotNull(updatedContact);
+       
+               // Verify that the updated resource received the correct data.
+               Assert.assertEquals(updatedContact.getAddressGroupList().getAddressGroup().get(0).getAddressPlace1(),
+                       contact.getAddressGroupList().getAddressGroup().get(0).getAddressPlace1(),
+                       "Data in updated object did not match submitted data.");
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
     }
 
@@ -1573,8 +907,8 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"update"}, dependsOnMethods = {"updateContact", "testContactSubmitRequest"})
+    @Test(dataProvider = "testName", groups = {"update"},
+               dependsOnMethods = {"updateContact", "testContactSubmitRequest"})
     public void updateNonExistentContact(String testName) throws Exception {
         // Currently a no-op test
     }
@@ -1591,13 +925,9 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"delete"}, dependsOnGroups = {"create", "read", "readList", "update"})
+    @Test(dataProvider = "testName", groups = {"delete"},
+               dependsOnMethods = {"updateContact"})
     public void deleteContact(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupDelete();
 
@@ -1612,178 +942,44 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
         ClientResponse<Response> res =
                 client.deleteContact(knownResourceId, knownItemResourceId, knownContactResourceId);
         try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            assertStatusCode(res, testName);
         } finally {
-            res.releaseConnection();
-        }
-    }
-
-    /**
-     * Delete item.
-     *
-     * @param testName the test name
-     * @throws Exception the exception
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"delete"}, dependsOnMethods = {"deleteContact"})
-    public void deleteItem(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDelete();
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("parentcsid =" + knownResourceId
-                    + " itemcsid = " + knownItemResourceId);
-        }
-
-        // Submit the request to the service and store the response.
-        OrgAuthorityClient client = new OrgAuthorityClient();
-        ClientResponse<Response> res = client.deleteItem(knownResourceId, knownItemResourceId);
-        try {
-            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);
+               if (res != null) {
+                res.releaseConnection();
             }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        } finally {
-            res.releaseConnection();
         }
     }
 
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
-     */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"delete"}, dependsOnMethods = {"deleteItem"})
     public void delete(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDelete();
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("parentcsid =" + knownResourceId);
-        }
-
-        // Submit the request to the service and store the response.
-        OrgAuthorityClient client = new OrgAuthorityClient();
-        ClientResponse<Response> res = client.delete(knownResourceId);
-        try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        } finally {
-            res.releaseConnection();
-        }
+       // Do nothing.  See localDelete().  This ensure proper test order.
     }
-
-    // Failure outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"delete"}, dependsOnMethods = {"delete"})
-    public void deleteNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDeleteNonExistent();
-
-        // Submit the request to the service and store the response.
-        OrgAuthorityClient client = new OrgAuthorityClient();
-        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
-        try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        } finally {
-            res.releaseConnection();
-        }
+    
+    @Test(dataProvider = "testName", dependsOnMethods = {"localDeleteItem"})    
+    public void localDelete(String testName) throws Exception {
+       super.delete(testName);
     }
 
-    /**
-     * Delete non existent item.
-     *
-     * @param testName the test name
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"delete"}, dependsOnMethods = {"deleteItem"})
-    public void deleteNonExistentItem(String testName) {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDeleteNonExistent();
-
-        // Submit the request to the service and store the response.
-        OrgAuthorityClient client = new OrgAuthorityClient();
-        ClientResponse<Response> res = client.deleteItem(knownResourceId, NON_EXISTENT_ID);
-        try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        } finally {
-            res.releaseConnection();
-        }
+    @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.
     }
-
+    
+    @Test(dataProvider = "testName", groups = {"delete"},
+       dependsOnMethods = {"verifyIllegalItemDisplayName", "testContactSubmitRequest", "deleteContact"})
+    public void localDeleteItem(String testName) throws Exception {
+       super.deleteItem(testName);
+    }    
+    
     /**
      * Delete non existent contact.
      *
      * @param testName the test name
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"delete"}, dependsOnMethods = {"deleteContact"})
+    @Test(dataProvider = "testName", groups = {"delete"},
+               dependsOnMethods = {"deleteContact"})
     public void deleteNonExistentContact(String testName) {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupDeleteNonExistent();
 
@@ -1792,71 +988,12 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
         ClientResponse<Response> res =
                 client.deleteContact(knownResourceId, knownItemResourceId, NON_EXISTENT_ID);
         try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            assertStatusCode(res, testName);
         } finally {
-            res.releaseConnection();
-        }
-    }
-
-    // ---------------------------------------------------------------
-    // Utility tests : tests of code used in tests above
-    // ---------------------------------------------------------------
-    /**
-     * Tests the code for manually submitting data that is used by several
-     * of the methods above.
-     */
-    @Test(dependsOnMethods = {"create", "read"})
-    public void testSubmitRequest() {
-
-        // Expected status code: 200 OK
-        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
-
-        // Submit the request to the service and store the response.
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getResourceURL(knownResourceId);
-        int statusCode = submitRequest(method, url);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug("testSubmitRequest: url=" + url
-                    + " status=" + statusCode);
-        }
-        Assert.assertEquals(statusCode, EXPECTED_STATUS);
-
-    }
-
-    /**
-     * Test item submit request.
-     */
-    @Test(dependsOnMethods = {"createItem", "readItem", "testSubmitRequest"})
-    public void testItemSubmitRequest() {
-
-        // Expected status code: 200 OK
-        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
-
-        // Submit the request to the service and store the response.
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getItemResourceURL(knownResourceId, knownItemResourceId);
-        int statusCode = submitRequest(method, url);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug("testItemSubmitRequest: url=" + url
-                    + " status=" + statusCode);
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertEquals(statusCode, EXPECTED_STATUS);
-
     }
 
     /**
@@ -1877,7 +1014,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
         // Check the status code of the response: does it match
         // the expected response(s)?
         if (logger.isDebugEnabled()) {
-            logger.debug("testItemSubmitRequest: url=" + url
+            logger.debug("testContactSubmitRequest: url=" + url
                     + " status=" + statusCode);
         }
         Assert.assertEquals(statusCode, EXPECTED_STATUS);
@@ -1925,7 +1062,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
             res.releaseConnection();
         }
         // Clean up item resources.
-        for (Map.Entry<String, String> entry : allItemResourceIdsCreated.entrySet()) {
+        for (Map.Entry<String, String> entry : allResourceItemIdsCreated.entrySet()) {
             itemResourceId = entry.getKey();
             parentResourceId = entry.getValue();
             // Note: Any non-success responses from the delete operation
@@ -2034,4 +1171,93 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME:
         return getContactServiceRootURL(parentResourceIdentifier,
                 itemResourceIdentifier) + "/" + contactResourceIdentifier;
     }
+
+       @Override
+       public void authorityTests(String testName) {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       protected String createItemInAuthority(String authorityId) {
+               return createItemInAuthority(authorityId, null /*refname*/);
+       }
+
+       @Override
+       protected OrganizationsCommon updateItemInstance(OrganizationsCommon organizationsCommon) {
+               OrganizationsCommon result = organizationsCommon; //new OrganizationsCommon();
+               
+        MainBodyGroupList mainBodyList = organizationsCommon.getMainBodyGroupList();
+        Assert.assertNotNull(mainBodyList);
+        List<MainBodyGroup> mainBodyGroups = mainBodyList.getMainBodyGroup();
+        Assert.assertTrue(mainBodyList.getMainBodyGroup().size() > 0);
+        String updatedShortName = "updated-" + mainBodyGroups.get(0).getShortName();
+        mainBodyGroups.get(0).setShortName(updatedShortName);
+        
+        return result;
+       }
+
+       @Override
+       protected void compareUpdatedItemInstances(OrganizationsCommon original,
+                       OrganizationsCommon updated) throws Exception {
+               MainBodyGroupList mainBodyList = original.getMainBodyGroupList();
+        Assert.assertNotNull(mainBodyList);
+        Assert.assertTrue(mainBodyList.getMainBodyGroup().size() > 0);
+        Assert.assertEquals(updated.getMainBodyGroupList().getMainBodyGroup().get(0).getShortName(),
+                original.getMainBodyGroupList().getMainBodyGroup().get(0).getShortName(),
+                "Short name in updated Organization did not match submitted data.");
+       }
+
+       @Override
+       protected PoxPayloadOut createInstance(String commonPartName,
+                       String identifier) {
+        String shortId = identifier;
+        String displayName = "displayName-" + shortId;
+        //String baseRefName = OrgAuthorityClientUtils.createOrgAuthRefName(shortId, null);
+        PoxPayloadOut result = OrgAuthorityClientUtils.createOrgAuthorityInstance(
+                displayName, shortId, commonPartName);
+        return result;
+       }
+
+       @Override
+       protected PoxPayloadOut createNonExistenceInstance(String commonPartName,
+                       String identifier) {
+        String shortId = identifier;
+        String displayName = "displayName-" + shortId;
+        //String baseRefName = OrgAuthorityClientUtils.createOrgAuthRefName(shortId, null);
+        PoxPayloadOut result = OrgAuthorityClientUtils.createOrgAuthorityInstance(
+                displayName, shortId, commonPartName);
+        return result;
+       }
+       
+    protected PoxPayloadOut createNonExistenceItemInstance(String commonPartName,
+               String identifier) {
+        Map<String, String> nonexOrgMap = new HashMap<String, String>();
+        nonexOrgMap.put(OrganizationJAXBSchema.SHORT_IDENTIFIER, "nonExistent");
+        nonexOrgMap.put(OrganizationJAXBSchema.SHORT_NAME, "Non-existent");
+        PoxPayloadOut result =
+                OrgAuthorityClientUtils.createOrganizationInstance(
+                knownResourceRefName,
+                nonexOrgMap, commonPartName);
+        return result;
+    }
+
+       @Override
+       protected OrgauthoritiesCommon updateInstance(OrgauthoritiesCommon orgauthoritiesCommon) {
+               OrgauthoritiesCommon result = new OrgauthoritiesCommon();
+               
+        result.setDisplayName("updated-" + orgauthoritiesCommon.getDisplayName());
+        result.setVocabType("updated-" + orgauthoritiesCommon.getVocabType());
+        
+               return result;
+       }
+
+       @Override
+       protected void compareUpdatedInstances(OrgauthoritiesCommon original,
+                       OrgauthoritiesCommon updated) throws Exception {
+        // Verify that the updated resource received the correct data.
+        Assert.assertEquals(updated.getDisplayName(),
+                       original.getDisplayName(),
+                "Display name in updated object did not match submitted data.");
+       }
 }
index c63d5f2659158b307597a213d179acd3fc4e7ed6..4208e044d80431f096fec66dcef6e6bdc034ae71 100644 (file)
@@ -58,7 +58,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>\r
         \r
         <!-- apache -->\r
index 2fbf49c94ff897049396b2d14c27525cb6ac1adf..024a82e264548dbdce8ac6f46a43c1ef7745fdc3 100644 (file)
@@ -59,7 +59,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>\r
         <!-- RESTEasy -->\r
         <dependency>\r
index fe728bfd8362a2e64fad193c4979320ee959ebaa..7a06e57e301f28e83393bf2f452d0446400ad567 100644 (file)
  */
 package org.collectionspace.services.client;
 
+import org.collectionspace.services.person.PersonsCommon;
+
 /**
  * The Class PersonAuthorityClient.
  */
-public class PersonAuthorityClient extends AuthorityWithContactsClientImpl<PersonAuthorityProxy> {
+public class PersonAuthorityClient extends AuthorityWithContactsClientImpl<PersonsCommon, PersonAuthorityProxy> {
        public static final String SERVICE_NAME = "personauthorities";
        public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;       
        public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
@@ -71,4 +73,14 @@ public class PersonAuthorityClient extends AuthorityWithContactsClientImpl<Perso
        public Class<PersonAuthorityProxy> getProxyClass() {
                return PersonAuthorityProxy.class;
        }
+
+       @Override
+       public String getInAuthority(PersonsCommon item) {
+               return item.getInAuthority();
+       }
+
+       @Override
+       public void setInAuthority(PersonsCommon item, String inAuthorityCsid) {
+               item.setInAuthority(inAuthorityCsid);
+       }
 }
index 9a9e51637c335f06ebdc2c13628c6e05c3bd2446..226cf33ac93e160dff8c58be3112e765ca9fe891 100644 (file)
  */
 package org.collectionspace.services.client.test;
 
-import java.io.PrintStream;
 import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
-import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -53,7 +51,7 @@ import org.testng.annotations.Test;
  * $LastChangedRevision: 753 $
  * $LastChangedDate: 2009-09-23 11:03:36 -0700 (Wed, 23 Sep 2009) $
  */
-public class PersonAuthoritySearchTest extends BaseServiceTest {
+public class PersonAuthoritySearchTest extends BaseServiceTest<AbstractCommonList> {
 
     private final String CLASS_NAME = PersonAuthoritySearchTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
@@ -157,7 +155,7 @@ public class PersonAuthoritySearchTest extends BaseServiceTest {
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-    protected AbstractCommonList getAbstractCommonList(
+    protected AbstractCommonList getCommonList(
                     ClientResponse<AbstractCommonList> response) {
     return response.getEntity(AbstractCommonList.class);
     }
@@ -225,12 +223,8 @@ public class PersonAuthoritySearchTest extends BaseServiceTest {
     /**
      * Reads an item list by partial term.
      */
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        groups = {"readListByPartialTerm"})
+    @Test(dataProvider="testName", groups = {"readListByPartialTerm"})
     public void partialTermMatch(String testName) {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         int numMatchesFound = 0;
         String partialTerm = getPartialTermCommon();
         if (logger.isDebugEnabled()) {
@@ -249,12 +243,9 @@ public class PersonAuthoritySearchTest extends BaseServiceTest {
      * of an all-lowercase variation of the expected match, to test case-insensitive
      * matching.
      */
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        groups = {"readListByPartialTerm"}, dependsOnMethods = {"partialTermMatch"})
+    @Test(dataProvider="testName", groups = {"readListByPartialTerm"},
+               dependsOnMethods = {"partialTermMatch"})
     public void partialTermMatchCaseInsensitiveLowerCase(String testName) {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         int numMatchesFound = 0;
 
         final String partialTerm = getPartialTermCommon().toLowerCase();
@@ -275,12 +266,9 @@ public class PersonAuthoritySearchTest extends BaseServiceTest {
      * of an all-uppercase variation of the expected match, to test case-insensitive
      * matching.
      */
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+    @Test(dataProvider="testName",
         groups = {"readListByPartialTerm"}, dependsOnMethods = {"partialTermMatch"})
     public void partialTermMatchCaseInsensitiveUpperCase(String testName) {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         int numMatchesFound = 0;
 
         final String partialTerm = getPartialTermCommon().toUpperCase();
@@ -300,12 +288,9 @@ public class PersonAuthoritySearchTest extends BaseServiceTest {
      * Reads an item list by partial term, with a partial term that is of
      * the minimum character length that may be expected to be matched.
      */
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+    @Test(dataProvider="testName",
         groups = {"readListByPartialTerm"}, dependsOnMethods = {"partialTermMatch"})
     public void partialTermMatchMinimumLength(String testName) {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         int numMatchesFound = 0;
         String partialTerm = getPartialTermMinimumLength();
         if (logger.isDebugEnabled()) {
@@ -324,12 +309,9 @@ public class PersonAuthoritySearchTest extends BaseServiceTest {
      * Reads an item list by partial term, with a partial term that contains
      * at least one Unicode UTF-8 character (outside the USASCII range).
      */
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+    @Test(dataProvider="testName",
         groups = {"readListByPartialTerm"}, dependsOnMethods = {"partialTermMatch"})
     public void partialTermMatchUTF8(String testName) {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         int numMatchesFound = 0;
         String partialTerm = getPartialTermUtf8();
         String ptEncoded;
@@ -355,12 +337,9 @@ public class PersonAuthoritySearchTest extends BaseServiceTest {
      * Reads an item list by partial term, with a partial term that contains
      * at least one Unicode UTF-8 character (outside the USASCII range).
      */
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+    @Test(dataProvider="testName",
         groups = {"readListByPartialTerm"}, dependsOnMethods = {"partialTermMatch"})
     public void partialTermMatchQuote(String testName) {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         int numMatchesFound = 0;
         String partialTerm = getPartialTermQuote();
         if (logger.isDebugEnabled()) {
@@ -378,12 +357,8 @@ public class PersonAuthoritySearchTest extends BaseServiceTest {
     /**
      * Finds terms by keywords.
      */
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-            groups = {"readListByKwdTerm"})
+    @Test(dataProvider="testName", groups = {"readListByKwdTerm"})
     public void keywordTermMatch(String testName) {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         int numMatchesFound = 0;
         String kwdTerm = getKwdTerm();
         if (logger.isDebugEnabled()) {
@@ -400,12 +375,9 @@ public class PersonAuthoritySearchTest extends BaseServiceTest {
     /**
      * Finds terms by keywords.
      */
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+    @Test(dataProvider="testName",
         groups = {"readListByKwdTerm"}, dependsOnMethods = {"keywordTermMatch"})
     public void keywordTermMatchUTF8(String testName) {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         int numMatchesFound = 0;
         String kwdTerm = getKwdTermUTF8();
         if (logger.isDebugEnabled()) {
@@ -427,12 +399,9 @@ public class PersonAuthoritySearchTest extends BaseServiceTest {
      * Reads an item list by partial term, with a partial term that is not
      * expected to be matched by any term in any resource.
      */
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+    @Test(dataProvider="testName",
         groups = {"readListByPartialTerm"}, dependsOnMethods = {"partialTermMatch"})
     public void partialTermMatchOnNonexistentTerm(String testName) {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         int numMatchesFound = 0;
         int ZERO_MATCHES_EXPECTED = 0;
         String partialTerm = getPartialTermNonExistent();
@@ -452,12 +421,9 @@ public class PersonAuthoritySearchTest extends BaseServiceTest {
      * Reads an item list by partial term, with a partial term that is not
      * expected to be matched by any term in any resource.
      */
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        groups = {"readListByKwdTerm"}, dependsOnMethods = {"keywordTermMatch"})
+    @Test(dataProvider="testName", groups = {"readListByKwdTerm"},
+               dependsOnMethods = {"keywordTermMatch"})
     public void keywordTermMatchOnNonexistentTerm(String testName) {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         int numMatchesFound = 0;
         int ZERO_MATCHES_EXPECTED = 0;
         String kwdTerm = getKwdTermNonExistent();
@@ -501,12 +467,14 @@ public class PersonAuthoritySearchTest extends BaseServiceTest {
         } else {
             Assert.fail("readItemListByPartialTerm passed null csid!");
         }
-        assertStatusCode(res, testName);
         AbstractCommonList list = null;
         try {
+            assertStatusCode(res, testName);
             list = res.getEntity();
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
 
         List<AbstractCommonList.ListItem> items = list.getListItem();
@@ -572,7 +540,7 @@ public class PersonAuthoritySearchTest extends BaseServiceTest {
 
         String testName = "createAuthority";
         if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
+            logger.debug(getTestBanner(testName, CLASS_NAME));
         }
 
         // Perform setup.
@@ -592,18 +560,12 @@ public class PersonAuthoritySearchTest extends BaseServiceTest {
        String newID = null;
        ClientResponse<Response> res = client.create(multipart);
         try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, this.EXPECTED_STATUS_CODE);
+            assertStatusCode(res, testName);
             newID = PersonAuthorityClientUtils.extractId(res);
        } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
        }
         // Store the refname from the first resource created
         // for additional tests below.
@@ -684,19 +646,11 @@ public class PersonAuthoritySearchTest extends BaseServiceTest {
         String newID = null;
         ClientResponse<Response> res = client.createItem(authorityCsid, multipart);
         try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
             newID = PersonAuthorityClientUtils.extractId(res);
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
 
         // Store the ID returned from the first item resource created
index adc39f7fdb3871ec534605c18ba6dbf90527e13c..0e6ed24524eb6e8d0c7ef72ad7c6bc54850dd473 100644 (file)
@@ -50,7 +50,7 @@ import org.testng.annotations.Test;
  * $LastChangedRevision: 753 $
  * $LastChangedDate: 2009-09-23 11:03:36 -0700 (Wed, 23 Sep 2009) $
  */
-public class PersonAuthorityServicePerfTest extends BaseServiceTest {
+public class PersonAuthorityServicePerfTest extends BaseServiceTest<AbstractCommonList> {
 
     private final String CLASS_NAME = PersonAuthorityServicePerfTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
@@ -114,7 +114,7 @@ public class PersonAuthorityServicePerfTest extends BaseServiceTest {
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-       protected AbstractCommonList getAbstractCommonList(
+       protected AbstractCommonList getCommonList(
                        ClientResponse<AbstractCommonList> response) {
         return response.getEntity(AbstractCommonList.class);
     }
@@ -163,16 +163,13 @@ public class PersonAuthorityServicePerfTest extends BaseServiceTest {
        String newID = null;
        ClientResponse<Response> res = client.create(multipart);
         try {
-            int statusCode = res.getStatus();
-            // Check the status code of the response: does it match
-            // the expected response(s)?
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, this.EXPECTED_STATUS_CODE);
+            assertStatusCode(res, testName);
             newID = PersonAuthorityClientUtils.extractId(res);
             logger.info("{}: succeeded.", testName);
        } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
        }
         // Store the refname from the first resource created
         // for additional tests below.
@@ -217,16 +214,12 @@ public class PersonAuthorityServicePerfTest extends BaseServiceTest {
         String newID = null;
         ClientResponse<Response> res = client.createItem(authId, multipart);
         try {
-            int statusCode = res.getStatus();
-            // Check the status code of the response: does it match
-            // the expected response(s)?
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
+            assertStatusCode(res, "createItem");
             newID = PersonAuthorityClientUtils.extractId(res);
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
 
         // Store the IDs from any item resources created
@@ -264,11 +257,8 @@ public class PersonAuthorityServicePerfTest extends BaseServiceTest {
     /**
      * Reads an item list by partial term.
      */
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
+    @Test(dataProvider="testName")
     public void partialTermMatch(String testName) {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         for(int i=0; i<partialTerms.length; i++) {
                long startTime = System.currentTimeMillis();
             int numMatchesFound = readItemListWithFilters(testName, authId, 
@@ -314,11 +304,13 @@ public class PersonAuthorityServicePerfTest extends BaseServiceTest {
             Assert.fail(testName+" passed null csid!");
         }
         AbstractCommonList list = null;
-        assertStatusCode(res, testName);
         try {
+            assertStatusCode(res, testName);
             list = res.getEntity();
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
 
         List<AbstractCommonList.ListItem> items = list.getListItem();
index 11101e8306e301f0968b9a8f96d2904eff346d58..61dcc1f28c756c1b166f1bf368b50dc32b8fa703 100644 (file)
@@ -26,9 +26,9 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
+import org.collectionspace.services.client.AbstractCommonListUtils;
 import org.collectionspace.services.client.AuthorityClient;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.PayloadOutputPart;
@@ -37,7 +37,6 @@ import org.collectionspace.services.client.PoxPayloadOut;
 
 import org.collectionspace.services.client.ContactClient;
 import org.collectionspace.services.client.ContactClientUtils;
-import org.collectionspace.services.common.AbstractCommonListUtils;
 import org.collectionspace.services.contact.AddressGroup;
 import org.collectionspace.services.contact.AddressGroupList;
 import org.collectionspace.services.contact.ContactsCommon;
@@ -64,7 +63,7 @@ import org.testng.annotations.Test;
  * $LastChangedRevision: 753 $
  * $LastChangedDate: 2009-09-23 11:03:36 -0700 (Wed, 23 Sep 2009) $
  */
-public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME: Test classes for Vocab, Person, Org, and Location should have a base class!
+public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<PersonauthoritiesCommon, PersonsCommon> { //FIXME: Test classes for Vocab, Person, Org, and Location should have a base class!
 
     /** The logger. */
     private final String CLASS_NAME = PersonAuthorityServiceTest.class.getName();
@@ -95,21 +94,12 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
     final String TEST_BIRTH_DATE = "May 26, 1907";
     /** The test death date. */
     final String TEST_DEATH_DATE = "June 11, 1979";
-    // Hold some values for a recently created item to verify upon read.
-    private String knownResourceId = null;
-    private String knownResourceShortIdentifer = null;
     //private String knownResourceRefName = null;
-    private String knownItemResourceId = null;
     private String knownItemResourceShortIdentifer = null;
     // The resource ID of an item resource used for partial term matching tests.
     private String knownItemPartialTermResourceId = null;
     /** The known contact resource id. */
     private String knownContactResourceId = null;
-    /** The n items to create in list. */
-    private int nItemsToCreateInList = 3;
-    /** The all item resource ids created. */
-    private Map<String, String> allItemResourceIdsCreated =
-            new HashMap<String, String>();
     /** The all contact resource ids created. */
     private Map<String, String> allContactResourceIdsCreated =
             new HashMap<String, String>();
@@ -142,13 +132,9 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
      * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"create"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    groups = {"create"})
     public void create(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup, such as initializing the type of service request
         // (e.g. CREATE, DELETE), its valid and expected status codes, and
         // its associated HTTP method name (e.g. POST, DELETE).
@@ -166,24 +152,12 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
         String newID = null;
         ClientResponse<Response> res = client.create(multipart);
         try {
-            int statusCode = res.getStatus();
-
-            // Check the status code of the response: does it match
-            // the expected response(s)?
-            //
-            // Specifically:
-            // Does it fall within the set of valid status codes?
-            // Does it exactly match the expected status code?
-            if (logger.isDebugEnabled()) {
-                logger.debug(testName + ": status = " + statusCode);
-            }
-            Assert.assertTrue(this.REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(this.REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, this.EXPECTED_STATUS_CODE);
-
-            newID = PersonAuthorityClientUtils.extractId(res);
+               assertStatusCode(res, testName);
+            newID = extractId(res);
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                       res.releaseConnection();
+               }
         }
         // Save values for additional tests
         if (knownResourceId == null) {
@@ -220,49 +194,6 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
         return PersonAuthorityClientUtils.createPersonInstance(parentCsid, identifier, personInfo, headerLabel);
     }
 
-    /**
-     * Creates the item.
-     *
-     * @param testName the test name
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"create"}, dependsOnMethods = {"create"})
-    public void createItem(String testName) {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        setupCreate();
-        String newID = createItemInAuthority(knownResourceId, null ); //knownResourceRefName);
-    }
-
-    /**
-     * Creates the item with an empty short identifier.
-     *
-     * @param testName the test name
-     */
-    /*
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-    groups = {"create"}, dependsOnMethods = {"create"})
-    public void createItemWithEmptyShortId(String testName) {
-    if (logger.isDebugEnabled()) {
-    logger.debug(testBanner(testName, CLASS_NAME));
-    }
-    setupCreate();
-    
-    // Fill the property map
-    String shortId = "";
-    Map<String, String> fieldProperties = new HashMap<String,String>();
-    fieldProperties.put(PersonJAXBSchema.DISPLAY_NAME_COMPUTED, "false");
-    fieldProperties.put(PersonJAXBSchema.DISPLAY_NAME, "Rod Beck");
-    fieldProperties.put(PersonJAXBSchema.SHORT_DISPLAY_NAME_COMPUTED, "false");
-    fieldProperties.put(PersonJAXBSchema.SHORT_DISPLAY_NAME, "RodBeck");
-    
-    final Map NULL_REPEATABLE_FIELD_PROPERTIES = null;
-    String newID = createItemInAuthority(knownResourceId, knownResourceRefName,
-    shortId, fieldProperties, NULL_REPEATABLE_FIELD_PROPERTIES);
-    allResourceIdsCreated.add(newID);
-    }
-     */
     /**
      * Creates an item in an authority, using test data.
      *
@@ -270,7 +201,8 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
      * @param authRefName the auth ref name
      * @return the string
      */
-    private String createItemInAuthority(String vcsid, String authRefName) {
+    @Override
+    protected String createItemInAuthority(String vcsid) {
 
         final String testName = "createItemInAuthority";
         if (logger.isDebugEnabled()) {
@@ -330,27 +262,19 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
 
         // Submit the request to the service and store the response.
         PersonAuthorityClient client = new PersonAuthorityClient();
-
         PoxPayloadOut multipart =
                 PersonAuthorityClientUtils.createPersonInstance(vcsid, null /*authRefName*/, itemFieldProperties,
                 itemRepeatableFieldProperties, client.getItemCommonPartName());
-
-        String newID = null;
+        setupCreate();
         ClientResponse<Response> res = client.createItem(vcsid, multipart);
+        String newID = null;
         try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
+               assertStatusCode(res, testName);
             newID = PersonAuthorityClientUtils.extractId(res);
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                       res.releaseConnection();
+               }
         }
 
         // Store the ID returned from the first item resource created
@@ -368,7 +292,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
         // Store the IDs from any item resources created
         // by tests, along with the IDs of their parents, so these items
         // can be deleted after all tests have been run.
-        allItemResourceIdsCreated.put(newID, vcsid);
+        allResourceItemIdsCreated.put(newID, vcsid);
 
         return newID;
     }
@@ -378,12 +302,9 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
      *
      * @param testName the test name
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"create"}, dependsOnMethods = {"createItem"})
+    @Test(dataProvider = "testName", groups = {"create"},
+               dependsOnMethods = {"createItem"})
     public void createContact(String testName) {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         setupCreate();
         String newID = createContactInItem(knownResourceId, knownItemResourceId);
     }
@@ -401,32 +322,23 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ":...");
         }
-
-        setupCreate();
-
         // Submit the request to the service and store the response.
         PersonAuthorityClient client = new PersonAuthorityClient();
         String identifier = createIdentifier();
         PoxPayloadOut multipart = ContactClientUtils.createContactInstance(parentcsid,
                 itemcsid, identifier, new ContactClient().getCommonPartName());
 
-        String newID = null;
+        setupCreate();
         ClientResponse<Response> res =
                 client.createContact(parentcsid, itemcsid, multipart);
+        String newID = null;
         try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
+               assertStatusCode(res, testName);
             newID = PersonAuthorityClientUtils.extractId(res);
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                       res.releaseConnection();
+               }
         }
 
         // Store the ID returned from the first contact resource created
@@ -446,136 +358,17 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
         return newID;
     }
 
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
-     */
-    @Override
-    public void createWithEmptyEntityBody(String testName) throws Exception {
-        //Should this really be empty?
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
-     */
-    @Override
-    public void createWithMalformedXml(String testName) throws Exception {
-        //Should this really be empty?
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
-     */
-    @Override
-    public void createWithWrongXmlSchema(String testName) throws Exception {
-        //Should this really be empty?
-    }
-
-    /*
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-    groups = {"create"}, dependsOnMethods = {"create", "testSubmitRequest"})
-    public void createWithEmptyEntityBody(String testName) throws Exception {
-    
-    if (logger.isDebugEnabled()) {
-    logger.debug(testBanner(testName, CLASS_NAME));
-    }
-    // Perform setup.
-    setupCreateWithEmptyEntityBody();
-    
-    // Submit the request to the service and store the response.
-    String method = REQUEST_TYPE.httpMethodName();
-    String url = getServiceRootURL();
-    String mediaType = MediaType.APPLICATION_XML;
-    final String entity = "";
-    int statusCode = submitRequest(method, url, mediaType, entity);
-    
-    // Check the status code of the response: does it match
-    // the expected response(s)?
-    if(logger.isDebugEnabled()) {
-    logger.debug(testName + ": url=" + url +
-    " status=" + statusCode);
-    }
-    Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-    Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-    
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-    groups = {"create"}, dependsOnMethods = {"create", "testSubmitRequest"})
-    public void createWithMalformedXml(String testName) throws Exception {
-    
-    if (logger.isDebugEnabled()) {
-    logger.debug(testBanner(testName, CLASS_NAME));
-    }
-    // Perform setup.
-    setupCreateWithMalformedXml();
-    
-    // Submit the request to the service and store the response.
-    String method = REQUEST_TYPE.httpMethodName();
-    String url = getServiceRootURL();
-    String mediaType = MediaType.APPLICATION_XML;
-    final String entity = MALFORMED_XML_DATA; // Constant from base class.
-    int statusCode = submitRequest(method, url, mediaType, entity);
-    
-    // Check the status code of the response: does it match
-    // the expected response(s)?
-    if(logger.isDebugEnabled()){
-    logger.debug(testName + ": url=" + url +
-    " status=" + statusCode);
-    }
-    Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-    Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-    
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-    groups = {"create"}, dependsOnMethods = {"create", "testSubmitRequest"})
-    public void createWithWrongXmlSchema(String testName) throws Exception {
-    
-    if (logger.isDebugEnabled()) {
-    logger.debug(testBanner(testName, CLASS_NAME));
-    }
-    // Perform setup.
-    setupCreateWithWrongXmlSchema();
-    
-    // Submit the request to the service and store the response.
-    String method = REQUEST_TYPE.httpMethodName();
-    String url = getServiceRootURL();
-    String mediaType = MediaType.APPLICATION_XML;
-    final String entity = WRONG_XML_SCHEMA_DATA;
-    int statusCode = submitRequest(method, url, mediaType, entity);
-    
-    // Check the status code of the response: does it match
-    // the expected response(s)?
-    if(logger.isDebugEnabled()){
-    logger.debug(testName + ": url=" + url +
-    " status=" + statusCode);
-    }
-    Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-    Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-     */
     /**
      * Attempts to create an authority with an short identifier that contains
      * non-word characters.
      *
      * @param testName the test name
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"create", "nonWordCharsInShortId"})
+    @Test(dataProvider = "testName", groups = {"create", "nonWordCharsInShortId"})
     public void createWithShortIdNonWordChars(String testName) throws Exception {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        EXPECTED_STATUS_CODE = STATUS_BAD_REQUEST;
-        REQUEST_TYPE = ServiceRequestType.CREATE;
-        testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
+        testExpectedStatusCode = STATUS_BAD_REQUEST;
+        testRequestType = ServiceRequestType.CREATE;
+        testSetup(testExpectedStatusCode, testRequestType);
 
         // Create the payload to be included in the body of the request
         PersonAuthorityClient client = new PersonAuthorityClient();
@@ -591,17 +384,12 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
         // Check the status code of the response: does it match
         // the expected response(s)?
         try {
-            int statusCode = res.getStatus();
-            if (logger.isDebugEnabled()) {
-                logger.debug(testName + ": status = " + statusCode);
-            }
-            Assert.assertTrue(this.REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(this.REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, this.EXPECTED_STATUS_CODE);
+               assertStatusCode(res, testName);
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                       res.releaseConnection();
+               }
         }
-
     }
 
     /**
@@ -610,18 +398,14 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
      *
      * @param testName the test name
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"create", "nonWordCharsInShortId"}, dependsOnMethods = {"create"})
+    @Test(dataProvider = "testName", groups = {"create", "nonWordCharsInShortId"},
+               dependsOnMethods = {"org.collectionspace.services.client.test.AbstractServiceTestImpl.create"})
     public void createItemWithShortIdNonWordChars(String testName) {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        EXPECTED_STATUS_CODE = STATUS_BAD_REQUEST;
-        REQUEST_TYPE = ServiceRequestType.CREATE;
-        testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
+        testExpectedStatusCode = STATUS_BAD_REQUEST;
+        testRequestType = ServiceRequestType.CREATE;
+        testSetup(testExpectedStatusCode, testRequestType);
 
         PersonAuthorityClient client = new PersonAuthorityClient();
-
         // Create the payload to be included in the body of the request
         String shortId = "7-Eleven";
         Map<String, String> fieldProperties = new HashMap<String, String>();
@@ -638,22 +422,14 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
 
         // Send the request and receive a response
         ClientResponse<Response> res = client.createItem(knownResourceId, multipart);
-
         // Check the status code of the response: does it match
         // the expected response(s)?
         try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+               assertStatusCode(res, testName);
         } finally {
-            res.releaseConnection();
-
+               if (res != null) {
+                       res.releaseConnection();
+               }
         }
     }
 
@@ -665,43 +441,22 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"createList"}, dependsOnGroups = {"create"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    groups = {"createList"}, dependsOnGroups = {"create"})
     public void createList(String testName) throws Exception {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         for (int i = 0; i < nItemsToCreateInList; i++) {
             create(testName);
         }
     }
 
-    /**
-     * Creates the item list.
-     *
-     * @param testName the test name
-     * @throws Exception the exception
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"createList"}, dependsOnMethods = {"createList"})
-    public void createItemList(String testName) throws Exception {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Add items to the initially-created, known parent record.
-        for (int j = 0; j < nItemsToCreateInList; j++) {
-            createItem(testName);
-        }
-    }
-
     /**
      * Creates the contact list.
      *
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"createList"}, dependsOnMethods = {"createItemList"})
+    @Test(dataProvider = "testName", groups = {"createList"},
+               dependsOnMethods = {"org.collectionspace.services.client.test.AbstractAuthorityServiceTest.createItemList"})
     public void createContactList(String testName) throws Exception {
         // Add contacts to the initially-created, known item record.
         for (int j = 0; j < nItemsToCreateInList; j++) {
@@ -717,8 +472,8 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"read"}, dependsOnGroups = {"create"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    groups = {"read"}, dependsOnGroups = {"create"})
     public void read(String testName) throws Exception {
         readInternal(testName, knownResourceId, null);
     }
@@ -729,22 +484,18 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"read"}, dependsOnMethods = {"read"})
+    @Override
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    groups = {"read"}, dependsOnMethods = {"read"})
     public void readByName(String testName) throws Exception {
         readInternal(testName, null, knownResourceShortIdentifer);
     }
 
     protected void readInternal(String testName, String CSID, String shortId) {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupRead();
-
         // Submit the request to the service and store the response.
         PersonAuthorityClient client = new PersonAuthorityClient();
         ClientResponse<String> res = null;
+        setupRead();
         if (CSID != null) {
             res = client.read(CSID);
         } else if (shortId != null) {
@@ -752,8 +503,8 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
         } else {
             Assert.fail("readInternal: Internal error. One of CSID or shortId must be non-null");
         }
-        assertStatusCode(res, testName);
         try {
+            assertStatusCode(res, testName);
             //FIXME: remove the following try catch once Aron fixes signatures
             try {
                 PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
@@ -764,20 +515,22 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
                 throw new RuntimeException(e);
             }
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
     }
 
     /**
-     * Read item.
+     * Read named item.
      *
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"readItem"}, dependsOnGroups = {"read"})
-    public void readItem(String testName) throws Exception {
-        readItemInternal(testName, knownResourceId, null, knownItemResourceId, null);
+    @Test(dataProvider = "testName", groups = {"readItem", "readNamedItemInNamedAuth"},
+               dependsOnMethods = {"readItemInNamedAuth"})
+    public void readNamedItem(String testName) throws Exception {
+        readItemInternal(testName, knownResourceId, null, null, knownItemResourceShortIdentifer);
     }
 
     /**
@@ -786,32 +539,21 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"readItem"}, dependsOnMethods = {"readItem"})
+    @Test(dataProvider = "testName", groups = {"readItem"},
+               dependsOnMethods = {"readItem"})
     public void readItemInNamedAuth(String testName) throws Exception {
         readItemInternal(testName, null, knownResourceShortIdentifer, knownItemResourceId, null);
     }
 
-    /**
-     * Read named item.
-     *
-     * @param testName the test name
-     * @throws Exception the exception
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"readItem"}, dependsOnMethods = {"readItem"})
-    public void readNamedItem(String testName) throws Exception {
-        readItemInternal(testName, knownResourceId, null, null, knownItemResourceShortIdentifer);
-    }
-
+    
     /**
      * Read Named item in Named Auth.
      *
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"readItem"}, dependsOnMethods = {"readItem"})
+    @Test(dataProvider = "testName", groups = {"readItem"},
+               dependsOnMethods = {"readNamedItem"})
     public void readNamedItemInNamedAuth(String testName) throws Exception {
         readItemInternal(testName, null, knownResourceShortIdentifer, null, knownItemResourceShortIdentifer);
     }
@@ -821,15 +563,13 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
             throws Exception {
 
         if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
             logger.debug("Reading:" + ((authCSID != null) ? authCSID : authShortId) + "/"
                     + ((itemCSID != null) ? authCSID : itemShortId));
         }
-        // Perform setup.
-        setupRead();
 
         // Submit the request to the service and store the response.
         PersonAuthorityClient client = new PersonAuthorityClient();
+        setupRead();
         ClientResponse<String> res = null;
         if (authCSID != null) {
             if (itemCSID != null) {
@@ -850,8 +590,8 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
         } else {
             Assert.fail("readInternal: Internal error. One of authCSID or authShortId must be non-null");
         }
-        assertStatusCode(res, testName);
         try {
+            assertStatusCode(res, testName);
             // Check whether we've received a person.
             PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
             PersonsCommon person = (PersonsCommon) extractPart(input,
@@ -871,9 +611,10 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
             List<String> groups = person.getGroups().getGroup();
             Assert.assertTrue(groups.size() > 0);
             Assert.assertNotNull(groups.get(0));
-
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
     }
 
@@ -883,13 +624,9 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"update"}, dependsOnMethods = {"updateItem"})
-    public void verifyItemDisplayNames(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
+    @Test(dataProvider = "testName", groups = {"update"},
+               dependsOnMethods = {"org.collectionspace.services.client.test.AbstractAuthorityServiceTest.updateItem"})
+    public void verifyItemDisplayName(String testName) throws Exception {
         // Perform setup.
         setupUpdate();
 
@@ -897,11 +634,14 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
         PersonAuthorityClient client = new PersonAuthorityClient();
         PoxPayloadIn input = null;
         ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
-        assertStatusCode(res, testName);
         try {
+            assertStatusCode(res, testName);
+            // Check whether person has expected displayName.
             input = new PoxPayloadIn(res.getEntity());
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
 
         PersonsCommon person = (PersonsCommon) extractPart(input,
@@ -938,15 +678,16 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
 
         // Submit the updated resource to the service and store the response.
         PoxPayloadOut output = new PoxPayloadOut(PersonAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = output.addPart(person, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getItemCommonPartName());
+        PayloadOutputPart commonPart = output.addPart(client.getItemCommonPartName(), person);
         res = client.updateItem(knownResourceId, knownItemResourceId, output);
-        assertStatusCode(res, testName);
         try {
+            assertStatusCode(res, testName);
             // Retrieve the updated resource and verify that its contents exist.
             input = new PoxPayloadIn(res.getEntity());
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
 
         PersonsCommon updatedPerson =
@@ -973,15 +714,16 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
 
         // Submit the updated resource to the service and store the response.
         output = new PoxPayloadOut(PersonAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
-        commonPart = output.addPart(person, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getItemCommonPartName());
+        commonPart = output.addPart(client.getItemCommonPartName(), person);
         res = client.updateItem(knownResourceId, knownItemResourceId, output);
-        assertStatusCode(res, testName);
         try {
+            assertStatusCode(res, testName);
             // Retrieve the updated resource and verify that its contents exist.
             input = new PoxPayloadIn(res.getEntity());
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
 
         updatedPerson =
@@ -1011,32 +753,28 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"update"}, dependsOnMethods = {"verifyItemDisplayNames"})
+    @Test(dataProvider = "testName", groups = {"update"},
+               dependsOnMethods = {"verifyItemDisplayName"})
     public void verifyIllegalItemDisplayName(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-
         // Perform setup for read.
         setupRead();
 
         // Submit the request to the service and store the response.
         PersonAuthorityClient client = new PersonAuthorityClient();
         ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
-        assertStatusCode(res, testName);
-        
-        // Perform setup for update.
-        testSetup(STATUS_BAD_REQUEST, ServiceRequestType.UPDATE);
-
         PoxPayloadIn input = null;
         try {
+            assertStatusCode(res, testName);
             input = new PoxPayloadIn(res.getEntity());
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-
+        //
+        // Make an invalid UPDATE request -i.e., if we don't want the display name computed, then
+        // we need to supply one.
+        //
         PersonsCommon person = (PersonsCommon) extractPart(input,
                 client.getItemCommonPartName(), PersonsCommon.class);
         Assert.assertNotNull(person);
@@ -1046,14 +784,15 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
 
         // Submit the updated resource to the service and store the response.
         PoxPayloadOut output = new PoxPayloadOut(PersonAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = output.addPart(person, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getItemCommonPartName());
+        PayloadOutputPart commonPart = output.addPart(client.getItemCommonPartName(), person);
+        setupUpdateWithInvalidBody();
         res = client.updateItem(knownResourceId, knownItemResourceId, output);
-        assertStatusCode(res, testName);
         try {
-            // intentionally empty try block
+            assertStatusCode(res, testName);
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
     }
 
@@ -1063,13 +802,9 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"readItem"}, dependsOnMethods = {"readItem"})
+    @Test(dataProvider = "testName", groups = {"readItem"},
+               dependsOnMethods = {"createContact", "org.collectionspace.services.client.test.AbstractAuthorityServiceTest.readItem"})
     public void readContact(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupRead();
 
@@ -1079,12 +814,14 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
         ClientResponse<String> res =
                 client.readContact(knownResourceId, knownItemResourceId,
                 knownContactResourceId);
-        assertStatusCode(res, testName);
         try {
+            assertStatusCode(res, testName);
             // Check whether we've received a contact.
             input = new PoxPayloadIn(res.getEntity());
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
 
         ContactsCommon contact = (ContactsCommon) extractPart(input,
@@ -1100,85 +837,14 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
 
     }
 
-    // Failure outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"read"}, dependsOnMethods = {"read"})
-    public void readNonExistent(String testName) {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadNonExistent();
-
-        // Submit the request to the service and store the response.
-        PersonAuthorityClient client = new PersonAuthorityClient();
-        ClientResponse<String> res = client.read(NON_EXISTENT_ID);
-        try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        } finally {
-            res.releaseConnection();
-        }
-    }
-
-    /**
-     * Read item non existent.
-     *
-     * @param testName the test name
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"readItem"}, dependsOnMethods = {"readItem"})
-    public void readItemNonExistent(String testName) {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadNonExistent();
-
-        // Submit the request to the service and store the response.
-        PersonAuthorityClient client = new PersonAuthorityClient();
-        ClientResponse<String> res = client.readItem(knownResourceId, NON_EXISTENT_ID);
-        try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        } finally {
-            res.releaseConnection();
-        }
-    }
-
     /**
      * Read contact non existent.
      *
      * @param testName the test name
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"readItem"}, dependsOnMethods = {"readContact"})
+    @Test(dataProvider = "testName", groups = {"readItem"},
+               dependsOnMethods = {"readContact"})
     public void readContactNonExistent(String testName) {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupReadNonExistent();
 
@@ -1187,73 +853,36 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
         ClientResponse<String> res =
                 client.readContact(knownResourceId, knownItemResourceId, NON_EXISTENT_ID);
         try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            assertStatusCode(res, testName);
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
     }
 
     // ---------------------------------------------------------------
     // CRUD tests : READ_LIST tests
     // ---------------------------------------------------------------
-    // Success outcomes
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"readList"}, dependsOnGroups = {"createList", "read"})
-    public void readList(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadList();
-
-        // Submit the request to the service and store the response.
-        PersonAuthorityClient client = new PersonAuthorityClient();
-        AbstractCommonList list = null;
-        ClientResponse<AbstractCommonList> res = client.readList();
-        assertStatusCode(res, testName);
-        try {
-            list = res.getEntity();
-        } finally {
-            res.releaseConnection();
-        }
-
-        // Optionally output additional data about list members for debugging.
-        if (logger.isTraceEnabled()) {
-            AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
-        }
-    }
 
     /**
      * Read item list.
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"readList"}, dependsOnMethods = {"readList"})
+    @Override
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    groups = {"readList"}, dependsOnMethods = {"readList"})
     public void readItemList(String testName) {
-        readItemList(knownResourceId, null, testName);
+        readItemList(knownAuthorityWithItems, null, testName);
     }
 
     /**
      * Read item list by authority name.
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"readList"}, dependsOnMethods = {"readItemList"})
-    public void readItemListByAuthorityName(String testName) {
-        readItemList(null, knownResourceShortIdentifer, testName);
+    @Override
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    groups = {"readList"}, dependsOnMethods = {"readItemList"})
+    public void readItemListByName(String testName) {
+        readItemList(null, READITEMS_SHORT_IDENTIFIER, testName);
     }
 
     /**
@@ -1263,10 +892,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
      * @param name the name
      */
     private void readItemList(String vcsid, String name, String testName) {
-
-        // Perform setup.
         setupReadList();
-
         // Submit the request to the service and store the response.
         PersonAuthorityClient client = new PersonAuthorityClient();
         ClientResponse<AbstractCommonList> res = null;
@@ -1277,24 +903,22 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
         } else {
             Assert.fail("readItemList passed null csid and name!");
         }
-        assertStatusCode(res, testName);
         AbstractCommonList list = null;
         try {
+            assertStatusCode(res, testName);
             list = res.getEntity();
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
 
-        List<AbstractCommonList.ListItem> items =
-                list.getListItem();
+        List<AbstractCommonList.ListItem> items = list.getListItem();
         int nItemsReturned = items.size();
-        // There will be one item created, associated with a
-        // known parent resource, by the createItem test.
-        //
-        // In addition, there will be 'nItemsToCreateInList'
-        // additional items created by the createItemList test,
+        // There will be 'nItemsToCreateInList'
+        // items created by the createItemList test,
         // all associated with the same parent resource.
-        int nExpectedItems = nItemsToCreateInList + 1;
+        int nExpectedItems = nItemsToCreateInList;
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": Expected "
                     + nExpectedItems + " items; got: " + nItemsReturned);
@@ -1317,7 +941,8 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
     /**
      * Read contact list.
      */
-    @Test(groups = {"readList"}, dependsOnMethods = {"readItemList"})
+    @Test(groups = {"readList"},
+               dependsOnMethods = {"org.collectionspace.services.client.test.AbstractAuthorityServiceTest.readItemList"})
     public void readContactList() {
         readContactList(knownResourceId, knownItemResourceId);
     }
@@ -1339,11 +964,13 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
         AbstractCommonList list = null;
         ClientResponse<AbstractCommonList> res =
                 client.readContactList(parentcsid, itemcsid);
-        assertStatusCode(res, testName);
         try {
+            assertStatusCode(res, testName);
             list = res.getEntity();
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
 
         List<AbstractCommonList.ListItem> listitems =
@@ -1379,25 +1006,24 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"update"}, dependsOnGroups = {"readItem", "readList"})
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    groups = {"update"}, dependsOnGroups = {"readItem", "readList"})
     public void update(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdate();
-
         // Retrieve the contents of a resource to update.
         PersonAuthorityClient client = new PersonAuthorityClient();
         PoxPayloadIn input = null;
+        setupRead();
         ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
         try {
+            assertStatusCode(res, testName);
+            if (logger.isDebugEnabled()) {
+                logger.debug("got PersonAuthority to update with ID: " + knownResourceId);
+            }
             input = new PoxPayloadIn(res.getEntity());
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
 
         PersonauthoritiesCommon personAuthority = (PersonauthoritiesCommon) extractPart(input,
@@ -1414,15 +1040,17 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
 
         // Submit the updated resource to the service and store the response.
         PoxPayloadOut output = new PoxPayloadOut(PersonAuthorityClient.SERVICE_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = output.addPart(personAuthority, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getCommonPartName());
+        PayloadOutputPart commonPart = output.addPart(client.getCommonPartName(), personAuthority);
+        setupUpdate();
         res = client.update(knownResourceId, output);
-        assertStatusCode(res, testName);
         try {
+            assertStatusCode(res, testName);
             // Retrieve the updated resource and verify that its contents exist.
             input = new PoxPayloadIn(res.getEntity());
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
 
         PersonauthoritiesCommon updatedPersonAuthority =
@@ -1442,26 +1070,28 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"update"}, dependsOnMethods = {"update"})
+    @Override
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+//    groups = {"update"}, dependsOnMethods = {"update"})
     public void updateItem(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdate();
-
         // Retrieve the contents of a resource to update.
         PersonAuthorityClient client = new PersonAuthorityClient();
         PoxPayloadIn input = null;
+        setupRead();
         ClientResponse<String> res =
                 client.readItem(knownResourceId, knownItemResourceId);
-        assertStatusCode(res, testName);
         try {
+            assertStatusCode(res, testName);
+            if (logger.isDebugEnabled()) {
+                logger.debug("got Person to update with ID: "
+                        + knownItemResourceId
+                        + " in PersonAuthority: " + knownResourceId);
+            }
             input = new PoxPayloadIn(res.getEntity());
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
 
         PersonsCommon person = (PersonsCommon) extractPart(input,
@@ -1484,15 +1114,17 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
 
         // Submit the updated resource to the service and store the response.
         PoxPayloadOut output = new PoxPayloadOut(PersonAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = output.addPart(person, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getItemCommonPartName());
+        PayloadOutputPart commonPart = output.addPart(client.getItemCommonPartName(), person);
+        setupUpdate();
         res = client.updateItem(knownResourceId, knownItemResourceId, output);
-        assertStatusCode(res, testName);
         try {
+            assertStatusCode(res, testName);
             // Retrieve the updated resource and verify that its contents exist.
             input = new PoxPayloadIn(res.getEntity());
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
 
         PersonsCommon updatedPerson =
@@ -1517,30 +1149,35 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"update"}, dependsOnMethods = {"updateItem"})
+    @Test(dataProvider = "testName", groups = {"update"},
+               dependsOnMethods = {"readContact", "testContactSubmitRequest",
+                       "org.collectionspace.services.client.test.AbstractAuthorityServiceTest.updateItem"})
     public void updateContact(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdate();
+       String contactsCommonLabel = new ContactClient().getCommonPartName();
 
         // Retrieve the contents of a resource to update.
         PersonAuthorityClient client = new PersonAuthorityClient();
         PoxPayloadIn input = null;
+        setupRead();
         ClientResponse<String> res =
                 client.readContact(knownResourceId, knownItemResourceId, knownContactResourceId);
-        assertStatusCode(res, testName);
         try {
+            assertStatusCode(res, testName);
+            if (logger.isDebugEnabled()) {
+                logger.debug("got Contact to update with ID: "
+                        + knownContactResourceId
+                        + " in item: " + knownItemResourceId
+                        + " in parent: " + knownResourceId);
+            }
             input = new PoxPayloadIn(res.getEntity());
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
 
         ContactsCommon contact = (ContactsCommon) extractPart(input,
-                new ContactClient().getCommonPartName(), ContactsCommon.class);
+                contactsCommonLabel, ContactsCommon.class);
         Assert.assertNotNull(contact);
 
         // Verify the contents of this resource
@@ -1563,19 +1200,20 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
 
         // Submit the updated resource to the service and store the response.
         PoxPayloadOut output = new PoxPayloadOut(ContactClient.SERVICE_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = output.addPart(contact, MediaType.APPLICATION_XML_TYPE); //FIXME: REM - Replace with output.addPart(contact, client.getCommonPartName())
-        commonPart.setLabel(client.getCommonPartName());
+        PayloadOutputPart commonPart = output.addPart(contactsCommonLabel, contact);
+        setupUpdate();
         res = client.updateContact(knownResourceId, knownItemResourceId, knownContactResourceId, output);
-        assertStatusCode(res, testName);
         try {
+            assertStatusCode(res, testName);
             // Retrieve the updated resource and verify that its contents exist.
             input = new PoxPayloadIn(res.getEntity());;
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        ContactsCommon updatedContact =
-                (ContactsCommon) extractPart(input,
-                new ContactClient().getCommonPartName(), ContactsCommon.class);
+        ContactsCommon updatedContact = (ContactsCommon) extractPart(input,
+                contactsCommonLabel, ContactsCommon.class);
         Assert.assertNotNull(updatedContact);
 
         // Verify that the updated resource received the correct data.
@@ -1584,217 +1222,14 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
                 "Data in updated object did not match submitted data.");
     }
 
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
-     */
-    @Override
-    public void updateWithEmptyEntityBody(String testName) throws Exception {
-        //Should this really be empty?
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
-     */
-    @Override
-    public void updateWithMalformedXml(String testName) throws Exception {
-        //Should this really be empty?
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
-     */
-    @Override
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
-        //Should this really be empty?
-    }
-
-    /* //FIXME: REM - Can we kill all this dead code please?
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-    groups = {"update"}, dependsOnMethods = {"update", "testSubmitRequest"})
-    public void updateWithEmptyEntityBody(String testName) throws Exception {
-    
-    if (logger.isDebugEnabled()) {
-    logger.debug(testBanner(testName, CLASS_NAME));
-    }
-    // Perform setup.
-    setupUpdateWithEmptyEntityBody(testName, logger);
-    
-    // Submit the request to the service and store the response.
-    String method = REQUEST_TYPE.httpMethodName();
-    String url = getResourceURL(knownResourceId);
-    String mediaType = MediaType.APPLICATION_XML;
-    final String entity = "";
-    int statusCode = submitRequest(method, url, mediaType, entity);
-    
-    // Check the status code of the response: does it match
-    // the expected response(s)?
-    if(logger.isDebugEnabled()){
-    logger.debug(testName + ": url=" + url +
-    " status=" + statusCode);
-    }
-    Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-    Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-    
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-    groups = {"update"}, dependsOnMethods = {"update", "testSubmitRequest"})
-    public void updateWithMalformedXml(String testName) throws Exception {
-    
-    if (logger.isDebugEnabled()) {
-    logger.debug(testBanner(testName, CLASS_NAME));
-    }
-    // Perform setup.
-    setupUpdateWithMalformedXml();
-    
-    // Submit the request to the service and store the response.
-    String method = REQUEST_TYPE.httpMethodName();
-    String url = getResourceURL(knownResourceId);
-    String mediaType = MediaType.APPLICATION_XML;
-    final String entity = MALFORMED_XML_DATA;
-    int statusCode = submitRequest(method, url, mediaType, entity);
-    
-    // Check the status code of the response: does it match
-    // the expected response(s)?
-    if(logger.isDebugEnabled()){
-    logger.debug(testName + ": url=" + url +
-    " status=" + statusCode);
-    }
-    Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-    Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-    
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-    groups = {"update"}, dependsOnMethods = {"update", "testSubmitRequest"})
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
-    
-    if (logger.isDebugEnabled()) {
-    logger.debug(testBanner(testName, CLASS_NAME));
-    }
-    // Perform setup.
-    setupUpdateWithWrongXmlSchema();
-    
-    // Submit the request to the service and store the response.
-    String method = REQUEST_TYPE.httpMethodName();
-    String url = getResourceURL(knownResourceId);
-    String mediaType = MediaType.APPLICATION_XML;
-    final String entity = WRONG_XML_SCHEMA_DATA;
-    int statusCode = submitRequest(method, url, mediaType, entity);
-    
-    // Check the status code of the response: does it match
-    // the expected response(s)?
-    if(logger.isDebugEnabled()){
-    logger.debug("updateWithWrongXmlSchema: url=" + url +
-    " status=" + statusCode);
-    }
-    Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-    Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-     */
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"update"}, dependsOnMethods = {"update", "testSubmitRequest"})
-    public void updateNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdateNonExistent();
-
-        // Submit the request to the service and store the response.
-        // Note: The ID(s) used when creating the request payload may be arbitrary.
-        // The only relevant ID may be the one used in update(), below.
-        PersonAuthorityClient client = new PersonAuthorityClient();
-        String displayName = "displayName-NON_EXISTENT_ID";
-        PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
-                displayName, "NON_EXISTENT_SHORT_ID", client.getCommonPartName());
-        ClientResponse<String> res =
-                client.update(NON_EXISTENT_ID, multipart);
-        try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        } finally {
-            res.releaseConnection();
-        }
-    }
-
-    /**
-     * Update non existent item.
-     *
-     * @param testName the test name
-     * @throws Exception the exception
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"update"}, dependsOnMethods = {"updateItem", "testItemSubmitRequest"})
-    public void updateNonExistentItem(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdateNonExistent();
-
-        // Submit the request to the service and store the response.
-        // Note: The ID used in this 'create' call may be arbitrary.
-        // The only relevant ID may be the one used in update(), below.
-        PersonAuthorityClient client = new PersonAuthorityClient();
-        Map<String, String> nonexMap = new HashMap<String, String>();
-        nonexMap.put(PersonJAXBSchema.SHORT_IDENTIFIER, "nonEX");
-        nonexMap.put(PersonJAXBSchema.FORE_NAME, "John");
-        nonexMap.put(PersonJAXBSchema.SUR_NAME, "Wayne");
-        nonexMap.put(PersonJAXBSchema.GENDER, "male");
-        Map<String, List<String>> nonexRepeatablesMap = new HashMap<String, List<String>>();
-        PoxPayloadOut multipart =
-                PersonAuthorityClientUtils.createPersonInstance(NON_EXISTENT_ID,
-                null, //PersonAuthorityClientUtils.createPersonAuthRefName(NON_EXISTENT_ID, null),
-                nonexMap, nonexRepeatablesMap, client.getItemCommonPartName());
-        ClientResponse<String> res =
-                client.updateItem(knownResourceId, NON_EXISTENT_ID, multipart);
-        try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        } finally {
-            res.releaseConnection();
-        }
-    }
-
     /**
      * Update non existent contact.
      *
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"update"}, dependsOnMethods = {"updateContact", "testContactSubmitRequest"})
+    @Test(dataProvider = "testName", groups = {"update"},
+               dependsOnMethods = {"updateContact", "testContactSubmitRequest"})
     public void updateNonExistentContact(String testName) throws Exception {
         // Currently a no-op test
     }
@@ -1811,16 +1246,9 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"delete"}, dependsOnGroups = {"update"})
+    @Test(dataProvider = "testName", groups = {"delete"},
+               dependsOnMethods = {"updateContact"})
     public void deleteContact(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDelete();
-
         if (logger.isDebugEnabled()) {
             logger.debug("parentcsid =" + knownResourceId
                     + " itemcsid = " + knownItemResourceId
@@ -1829,167 +1257,38 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
 
         // Submit the request to the service and store the response.
         PersonAuthorityClient client = new PersonAuthorityClient();
+        setupDelete();
         ClientResponse<Response> res =
                 client.deleteContact(knownResourceId, knownItemResourceId, knownContactResourceId);
         try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+               assertStatusCode(res, testName);
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                       res.releaseConnection();
+               }
         }
     }
 
-    /**
-     * Delete item.
-     *
-     * @param testName the test name
-     * @throws Exception the exception
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"delete"}, dependsOnMethods = {"deleteContact"})
-    public void deleteItem(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDelete();
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("parentcsid =" + knownResourceId
-                    + " itemcsid = " + knownItemResourceId);
-        }
-
-        // Submit the request to the service and store the response.
-        PersonAuthorityClient client = new PersonAuthorityClient();
-        ClientResponse<Response> res = client.deleteItem(knownResourceId, knownItemResourceId);
-        try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        } finally {
-            res.releaseConnection();
-        }
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
-     */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"delete"}, dependsOnMethods = {"deleteItem"})
     public void delete(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDelete();
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("parentcsid =" + knownResourceId);
-        }
-
-        // Submit the request to the service and store the response.
-        PersonAuthorityClient client = new PersonAuthorityClient();
-        ClientResponse<Response> res = client.delete(knownResourceId);
-        try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        } finally {
-            res.releaseConnection();
-        }
+       // Do nothing.  See localDelete().  This ensure proper test order.
+    }
+    
+    @Test(dataProvider = "testName", dependsOnMethods = {"localDeleteItem"})    
+    public void localDelete(String testName) throws Exception {
+       super.delete(testName);
     }
 
-    // Failure outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
-     */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"delete"}, dependsOnMethods = {"delete"})
-    public void deleteNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDeleteNonExistent();
-
-        // Submit the request to the service and store the response.
-        PersonAuthorityClient client = new PersonAuthorityClient();
-        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
-        try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        } finally {
-            res.releaseConnection();
-        }
+    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.
     }
-
-    /**
-     * Delete non existent item.
-     *
-     * @param testName the test name
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"delete"}, dependsOnMethods = {"deleteItem"})
-    public void deleteNonExistentItem(String testName) {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDeleteNonExistent();
-
-        // Submit the request to the service and store the response.
-        PersonAuthorityClient client = new PersonAuthorityClient();
-        ClientResponse<Response> res = client.deleteItem(knownResourceId, NON_EXISTENT_ID);
-        try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        } finally {
-            res.releaseConnection();
-        }
+    
+    @Test(dataProvider = "testName", groups = {"delete"},
+       dependsOnMethods = {"verifyIllegalItemDisplayName", "testContactSubmitRequest", "deleteContact"})
+    public void localDeleteItem(String testName) throws Exception {
+       super.deleteItem(testName);
     }
 
     /**
@@ -1997,93 +1296,29 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
      *
      * @param testName the test name
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"delete"}, dependsOnMethods = {"deleteContact"})
+    @Test(dataProvider = "testName", groups = {"delete"},
+               dependsOnMethods = {"deleteContact"})
     public void deleteNonExistentContact(String testName) {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDeleteNonExistent();
-
         // Submit the request to the service and store the response.
         PersonAuthorityClient client = new PersonAuthorityClient();
+        setupDeleteNonExistent();
         ClientResponse<Response> res =
                 client.deleteContact(knownResourceId, knownItemResourceId, NON_EXISTENT_ID);
         try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+               assertStatusCode(res, testName);
         } finally {
-            res.releaseConnection();
-        }
-    }
-
-    // ---------------------------------------------------------------
-    // Utility tests : tests of code used in tests above
-    // ---------------------------------------------------------------
-    /**
-     * Tests the code for manually submitting data that is used by several
-     * of the methods above.
-     */
-    @Test(dependsOnMethods = {"create", "read"})
-    public void testSubmitRequest() {
-
-        // Expected status code: 200 OK
-        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
-
-        // Submit the request to the service and store the response.
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getResourceURL(knownResourceId);
-        int statusCode = submitRequest(method, url);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug("testSubmitRequest: url=" + url
-                    + " status=" + statusCode);
-        }
-        Assert.assertEquals(statusCode, EXPECTED_STATUS);
-
-    }
-
-    /**
-     * Test item submit request.
-     */
-    @Test(dependsOnMethods = {"createItem", "readItem", "testSubmitRequest"})
-    public void testItemSubmitRequest() {
-
-        // Expected status code: 200 OK
-        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
-
-        // Submit the request to the service and store the response.
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getItemResourceURL(knownResourceId, knownItemResourceId);
-        int statusCode = submitRequest(method, url);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug("testItemSubmitRequest: url=" + url
-                    + " status=" + statusCode);
+               if (res != null) {
+                       res.releaseConnection();
+               }
         }
-        Assert.assertEquals(statusCode, EXPECTED_STATUS);
-
     }
 
     /**
      * Test contact submit request.
      */
-    @Test(dependsOnMethods = {"createContact", "readContact", "testItemSubmitRequest"})
-    public void testContactSubmitRequest() {
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"createContact", "readContact", "testItemSubmitRequest"})
+    public void testContactSubmitRequest(String testName) {
 
         // Expected status code: 200 OK
         final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
@@ -2097,7 +1332,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
         // Check the status code of the response: does it match
         // the expected response(s)?
         if (logger.isDebugEnabled()) {
-            logger.debug("testItemSubmitRequest: url=" + url
+            logger.debug("testContactSubmitRequest: url=" + url
                     + " status=" + statusCode);
         }
         Assert.assertEquals(statusCode, EXPECTED_STATUS);
@@ -2144,7 +1379,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
             res.releaseConnection();
         }
         // Clean up item resources.
-        for (Map.Entry<String, String> entry : allItemResourceIdsCreated.entrySet()) {
+        for (Map.Entry<String, String> entry : allResourceItemIdsCreated.entrySet()) {
             itemResourceId = entry.getKey();
             parentResourceId = entry.getValue();
             // Note: Any non-success responses from the delete operation
@@ -2240,4 +1475,76 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { //FIXM
         return getContactServiceRootURL(parentResourceIdentifier,
                 itemResourceIdentifier) + "/" + contactResourceIdentifier;
     }
+
+       @Override
+       public void authorityTests(String testName) {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       protected PersonsCommon updateItemInstance(PersonsCommon authorityItem) {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       protected void compareUpdatedItemInstances(PersonsCommon original,
+                       PersonsCommon updated) throws Exception {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       protected PoxPayloadOut createInstance(String commonPartName,
+                       String identifier) {
+        String shortId = identifier;
+        String displayName = "displayName-" + shortId;
+        PoxPayloadOut result =
+                PersonAuthorityClientUtils.createPersonAuthorityInstance(
+                displayName, shortId, commonPartName);
+        return result;
+       }
+       
+       @Override
+       protected PoxPayloadOut createNonExistenceInstance(String commonPartName,
+                       String identifier) {
+        String displayName = "displayName-NON_EXISTENT_ID";
+        PoxPayloadOut result = PersonAuthorityClientUtils.createPersonAuthorityInstance(
+                displayName, "NON_EXISTENT_SHORT_ID", commonPartName);
+        return result;
+       }
+       
+    protected PoxPayloadOut createNonExistenceItemInstance(String commonPartName, String identifier) {
+        Map<String, String> nonexMap = new HashMap<String, String>();
+        nonexMap.put(PersonJAXBSchema.SHORT_IDENTIFIER, "nonEX");
+        nonexMap.put(PersonJAXBSchema.FORE_NAME, "John");
+        nonexMap.put(PersonJAXBSchema.SUR_NAME, "Wayne");
+        nonexMap.put(PersonJAXBSchema.GENDER, "male");
+        Map<String, List<String>> nonexRepeatablesMap = new HashMap<String, List<String>>();
+        PoxPayloadOut result =
+                PersonAuthorityClientUtils.createPersonInstance(NON_EXISTENT_ID,
+                null, //PersonAuthorityClientUtils.createPersonAuthRefName(NON_EXISTENT_ID, null),
+                nonexMap, nonexRepeatablesMap, commonPartName);
+        return result;
+    }
+       
+
+       @Override
+       protected PersonauthoritiesCommon updateInstance(
+                       PersonauthoritiesCommon commonPartObject) {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       protected void compareUpdatedInstances(PersonauthoritiesCommon original,
+                       PersonauthoritiesCommon updated) throws Exception {
+               // TODO Auto-generated method stub
+       }
+
+       @Override
+       protected void verifyReadItemInstance(PersonsCommon item) throws Exception {
+               // Do nothing for now.  Add more 'read' validation checks here if applicable.
+       }
 }
index bd08440a29c87b7628d2d0e9fa52978e2fcd0084..8a0b046fe05079e7a4d1c3b1578df75779f4a51a 100644 (file)
@@ -57,7 +57,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>\r
         \r
         <!-- apache -->\r
index 79a9922787eceb46ca7e9b4cf3471afa38e601dc..61fcf8ceabf48d207b009f50f30a4732365d653b 100644 (file)
@@ -77,7 +77,6 @@
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
             <scope>test</scope>
-            <classifier>jdk15</classifier>
         </dependency>
     </dependencies>
 
                                                                <args>
                                                                        <arg>-Xannotate</arg> 
                                                                        <arg>-verbose</arg> 
-                                                                       <arg>-XtoString</arg>
+                                                                       <!-- <arg>-XtoString</arg> -->
                                                                        <arg>-Xequals</arg>
                                                                        <arg>-XhashCode</arg>
-                                                                       <arg>-Xcopyable</arg>
+                                                                       <!-- <arg>-Xcopyable</arg> -->
                                                                </args>
                                                                <plugins>
                                                                        <plugin> 
 
         </plugins>
     </reporting>
+    
     <dependencyManagement>
         <dependencies>
                         <dependency>
                 <groupId>net.java.dev.jaxb2-commons</groupId>
                 <artifactId>jaxb-fluent-api</artifactId>
                 <version>2.0.2</version>
-            </dependency>
-            <dependency>
-                <groupId>org.testng</groupId>
-                <artifactId>testng</artifactId>
-                <version>5.6</version>
-                <scope>test</scope>
-                <classifier>jdk15</classifier>
             </dependency>
                        <dependency>
                                <groupId>org.jvnet.jaxb2_commons</groupId>
index 86c9489949de18dd5490fa80b68b6d7eb027aef3..f45021241d13e9efdd05c9cd0e35c598cdc3ead5 100644 (file)
@@ -30,7 +30,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>\r
         \r
         <!-- apache -->\r
index fb42d6d26e37a0a9d5b04406794ad4e445c77d70..b3f90862897a3bc012c6389a6b2dd49ff03aa89d 100644 (file)
@@ -57,7 +57,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>\r
         <dependency>\r
             <groupId>org.jboss.resteasy</groupId>\r
index 6c9b3b2db069c728e3584222a1a3a4b43580f6bd..feaabf021670119107f0c177d44cdc6361124b16 100644 (file)
@@ -47,6 +47,10 @@ import org.collectionspace.services.relation.RelationshipType;
 import org.jboss.resteasy.client.ClientResponse;
 
 import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterSuite;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeSuite;
 import org.testng.annotations.Test;
 
 import org.slf4j.Logger;
@@ -59,17 +63,23 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision$
  * $LastChangedDate$
  */
-public class RelationServiceTest extends AbstractServiceTestImpl {
+public class RelationServiceTest extends AbstractPoxServiceTestImpl<RelationsCommonList, RelationsCommon> {
 
    /** The logger. */
     private final String CLASS_NAME = RelationServiceTest.class.getName();
     private final String PERSON_AUTHORITY_NAME = "TestPersonAuth";
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
     private List<String> personIdsCreated = new ArrayList<String>();
-    private String samSubjectPersonCSID = null;
-    private String oliveObjectPersonCSID = null;
-    private String samSubjectRefName = null;
-    private String oliveObjectRefName = null;
+    
+    private static final String UNINITIALIZED_CSID = "-1";
+    private static final String UNINITIALIZED_REFNAME = "null";
+    
+    private static final String PERSONS_DOCUMENT_TYPE = "Person";
+    private String samSubjectPersonCSID = UNINITIALIZED_CSID;
+    private String oliveObjectPersonCSID = UNINITIALIZED_REFNAME;
+    private String samSubjectRefName = UNINITIALIZED_CSID;
+    private String oliveObjectRefName = UNINITIALIZED_REFNAME;
+    
     private String personAuthCSID = null;
     private String personShortId = PERSON_AUTHORITY_NAME;
     
@@ -77,9 +87,6 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
     /** The SERVICE path component. */
     final String SERVICE_PATH_COMPONENT = "relations";
     
-    /** The known resource id. */
-    private String knownResourceId = null;
-    
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
@@ -87,81 +94,26 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
     protected CollectionSpaceClient getClientInstance() {
        return new RelationClient();
     }
-    
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
-     */
-    @Override
-       protected AbstractCommonList getAbstractCommonList(
-                       ClientResponse<AbstractCommonList> response) {
-        return response.getEntity(RelationsCommonList.class);
+     
+    protected Class<RelationsCommonList> getCommonListType() {
+       return (Class<RelationsCommonList>)RelationsCommonList.class;
     }
-    // ---------------------------------------------------------------
-    // CRUD tests : CREATE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
+        
+    /**
+     * Creates the person refs as a precondition for running the tests in this class.
      */
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
-    @Override
-    public void create(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup, such as initializing the type of service request
-        // (e.g. CREATE, DELETE), its valid and expected status codes, and
-        // its associated HTTP method name (e.g. POST, DELETE).
+    @BeforeSuite
+    private void createPersonRefs() {
         setupCreate();
-        createPersonRefs();
 
-        // Submit the request to the service and store the response.
-        RelationClient client = new RelationClient();
-        String identifier = createIdentifier();
-        PoxPayloadOut multipart = createRelationInstance(identifier);
-        ClientResponse<Response> res = client.create(multipart);
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        //
-        // Does it fall within the set of valid status codes?
-        // Does it exactly match the expected status code?
-        if(logger.isDebugEnabled()){
-            logger.debug(testName + ": status = " + statusCode);
-        }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
-        // Store the ID returned from the first resource created
-        // for additional tests below.
-        if (knownResourceId == null){
-            knownResourceId = extractId(res);
-            if (logger.isDebugEnabled()) {
-                logger.debug(testName + ": knownResourceId=" + knownResourceId);
-            }
-        }
-
-        // Store the IDs from every resource created by tests,
-        // so they can be deleted after tests have been run.
-        allResourceIdsCreated.add(extractId(res));
-    }
-    
-    /**
-     * Creates the person refs.
-     */
-    protected void createPersonRefs() {
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
                 PERSON_AUTHORITY_NAME, PERSON_AUTHORITY_NAME, personAuthClient.getCommonPartName());
         ClientResponse<Response> res = personAuthClient.create(multipart);
         int statusCode = res.getStatus();
 
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, STATUS_CREATED);
         personAuthCSID = extractId(res);
 
@@ -181,8 +133,15 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
         Assert.assertNotNull(oliveObjectRefName);
         personIdsCreated.add(csid);
     }
+    
+    @AfterSuite
+    private void deletePersonRefs() {
+       //
+       // Delete all the persons we created for the tests
+       //
+    }
 
-    protected String createPerson(String firstName, String surName, String shortId, String authRefName) {
+    private String createPerson(String firstName, String surName, String shortId, String authRefName) {
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         Map<String, String> personInfo = new HashMap<String, String>();
         personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
@@ -194,34 +153,16 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
         ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
         int statusCode = res.getStatus();
 
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, STATUS_CREATED);
         return extractId(res);
-    }
-
+    }    
     
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        dependsOnMethods = {"create"})
-    public void createList(String testName) throws Exception {
-        for(int i = 0; i < 3; i++){
-            create(testName);
-        }
-    }
-    
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+    @Test(dataProvider="testName",
             dependsOnMethods = {"create"})
     public void createWithSelfRelation(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-
+       // Test result codes setup
         setupCreateWithInvalidBody();
 
         // Submit the request to the service and store the response.
@@ -242,607 +183,28 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
         if(logger.isDebugEnabled()){
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, STATUS_BAD_REQUEST);   //should be an error: same objectID and subjectID are not allowed by validator.
     }
-
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
-     */
-    @Override
-    public void createWithEmptyEntityBody(String testName) throws Exception {
-       //Should this test really be empty?
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
-     */
-    @Override
-    public void createWithMalformedXml(String testName) throws Exception {
-       //Should this test really be empty?
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
-     */
-    @Override
-    public void createWithWrongXmlSchema(String testName) throws Exception {
-       //Should this test really be empty?
-    }
-
-    /*
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-        dependsOnMethods = {"create", "testSubmitRequest"})
-    public void createWithEmptyEntityBody(String testName) throws Exception {
-    
-            if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupCreateWithEmptyEntityBody();
-
-        // Submit the request to the service and store the response.
-        String method = REQUEST_TYPE.httpMethodName();
-        String url = getServiceRootURL();
-        String mediaType = MediaType.APPLICATION_XML;
-        final String entity = "";
-        int statusCode = submitRequest(method, url, mediaType, entity);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if(logger.isDebugEnabled()){
-            logger.debug(testName + ": url=" + url +
-                " status=" + statusCode);
-         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-        invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-        dependsOnMethods = {"create", "testSubmitRequest"})
-    public void createWithMalformedXml(String testName) throws Exception {
-    
-            if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupCreateWithMalformedXml();
-
-        // Submit the request to the service and store the response.
-        String method = REQUEST_TYPE.httpMethodName();
-        String url = getServiceRootURL();
-        String mediaType = MediaType.APPLICATION_XML;
-        final String entity = MALFORMED_XML_DATA; // Constant from base class.
-        int statusCode = submitRequest(method, url, mediaType, entity);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if(logger.isDebugEnabled()){
-            logger.debug(testName + ": url=" + url +
-                " status=" + statusCode);
-         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-        invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-        dependsOnMethods = {"create", "testSubmitRequest"})
-    public void createWithWrongXmlSchema(String testName) throws Exception {
-    
-            if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupCreateWithWrongXmlSchema();
-
-        // Submit the request to the service and store the response.
-        String method = REQUEST_TYPE.httpMethodName();
-        String url = getServiceRootURL();
-        String mediaType = MediaType.APPLICATION_XML;
-        final String entity = WRONG_XML_SCHEMA_DATA;
-        int statusCode = submitRequest(method, url, mediaType, entity);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if(logger.isDebugEnabled()){
-          logger.debug(testName + ": url=" + url +
-              " status=" + statusCode);
-         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-        invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-     */
-
-    // ---------------------------------------------------------------
-    // CRUD tests : READ tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        dependsOnMethods = {"create"})
-    public void read(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupRead();
-
-        // Submit the request to the service and store the response.
-        RelationClient client = new RelationClient();
-        ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-
-        // Get the common part from the response and check that it is not null.
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
-        RelationsCommon relationCommon = null;
-        if (payloadInputPart != null) {
-               relationCommon = (RelationsCommon) payloadInputPart.getBody();
-        }
-        Assert.assertNotNull(relationCommon);
-
-    }
-
-    // Failure outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        dependsOnMethods = {"read"})
-    public void readNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadNonExistent();
-
-        // Submit the request to the service and store the response.
-        RelationClient client = new RelationClient();
-        ClientResponse<String> res = client.read(NON_EXISTENT_ID);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-   
-    // ---------------------------------------------------------------
-    // CRUD tests : READ_LIST tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        dependsOnMethods = {"createList", "read"})
-    public void readList(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadList();
-
-        // Submit the request to the service and store the response.
-        RelationClient client = new RelationClient();
-        ClientResponse<RelationsCommonList> res = client.readList();
-        assertStatusCode(res, testName);
-        RelationsCommonList list = res.getEntity();
-        
-        // Optionally output additional data about list members for debugging.
-        boolean iterateThroughList = false;
-        if(iterateThroughList && logger.isDebugEnabled()){
-            List<RelationsCommonList.RelationListItem> items =
-                    list.getRelationListItem();
-            int i = 0;
-            for(RelationsCommonList.RelationListItem item : items){
-                logger.debug(testName + ": list-item[" + i + "] csid=" +
-                        item.getCsid());
-                logger.debug(testName + ": list-item[" + i + "] URI=" +
-                        item.getUri());
-                i++;
-            }
-        }
-
-    }
-
-
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        dependsOnMethods = {"createList", "read"})
-    public void readListPaginated(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadList();
-
-        Long pageSize=1L;
-        Long pageNumber=0L;
-        RelationClient client = new RelationClient();
-        ClientResponse<RelationsCommonList> res = client.readList("", //subjectCsid,
-                                                                  "", //subjectType,
-                                                                  "", //predicate,
-                                                                  "", //objectCsid,
-                                                                  "", //objectType,
-                                                                  "", //sortBy,
-                                                                  pageSize,
-                                                                  pageNumber);
-        RelationsCommonList list = res.getEntity();
-        assertStatusCode(res, testName);
-
-        // Optionally output additional data about list members for debugging.
-        boolean iterateThroughList = false;
-        if(iterateThroughList && logger.isDebugEnabled()){
-            List<RelationsCommonList.RelationListItem> items =
-                    list.getRelationListItem();
-            int i = 0;
-            for(RelationsCommonList.RelationListItem item : items){
-                logger.debug(testName + ": list-item[" + i + "] csid=" +
-                        item.getCsid());
-                logger.debug(testName + ": list-item[" + i + "] URI=" +
-                        item.getUri());
-                i++;
-            }
-        }
-
-    }
-
-
-    // Failure outcomes
-    // None at present.
-
-    // ---------------------------------------------------------------
-    // CRUD tests : UPDATE tests
-    // ---------------------------------------------------------------
-
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        dependsOnMethods = {"read"})
-    public void update(String testName) throws Exception {
-
-       logger.debug(testBanner(testName, CLASS_NAME));
-        // Perform setup.
-        setupUpdate();
-
-        // Retrieve an existing resource that we can update.
-        RelationClient client = new RelationClient();
-        ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-        logger.debug("Got object to update with ID: " + knownResourceId);
-        
-        // Extract the common part and verify that it is not null.
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
-        RelationsCommon relationCommon = null;
-        if (payloadInputPart != null) {
-               relationCommon = (RelationsCommon) payloadInputPart.getBody();
-        }
-        Assert.assertNotNull(relationCommon);
-        logger.trace("object before update");
-        logger.trace(objectAsXmlString(relationCommon, RelationsCommon.class));
-
-        String newSubjectDocType = relationCommon.getObjectDocumentType();
-        String newObjectDocType = relationCommon.getSubjectDocumentType();
-        String newSubjectId = relationCommon.getObjectCsid();
-        String newObjectId = relationCommon.getSubjectCsid();
-        // Update the content of this resource, inverting subject and object
-        relationCommon.setSubjectCsid(newSubjectId);
-        relationCommon.setSubjectDocumentType("Hooey");
-        relationCommon.setObjectCsid(newObjectId);
-        relationCommon.setObjectDocumentType("Fooey");
-        relationCommon.setPredicateDisplayName("updated-" + relationCommon.getPredicateDisplayName());
-        logger.trace("updated object to send");
-        logger.trace(objectAsXmlString(relationCommon, RelationsCommon.class));
-
-        // Submit the request containing the updated resource to the service
-        // and store the response.
-        PoxPayloadOut output = new PoxPayloadOut(this.getServicePathComponent());
-        PayloadOutputPart commonPart = output.addPart(relationCommon, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getCommonPartName());
-        res = client.update(knownResourceId, output);
-        assertStatusCode(res, testName);
-
-        // Extract the common part of the updated resource and verify that it is not null.
-        input = new PoxPayloadIn(res.getEntity());
-        RelationsCommon updatedRelationCommon =
-                (RelationsCommon) extractPart(input,
-                        client.getCommonPartName(), RelationsCommon.class);
-        Assert.assertNotNull(updatedRelationCommon);
-
-        logger.trace("updated object as received");
-        logger.trace(objectAsXmlString(updatedRelationCommon, RelationsCommon.class));
-
-        final String msg =
-                "Data in updated object did not match submitted data.";
-        final String msg2 =
-                "Data in updated object was not correctly computed.";
-        Assert.assertEquals(
-                updatedRelationCommon.getSubjectCsid(), newSubjectId, msg);
-        Assert.assertEquals(
-                updatedRelationCommon.getSubjectDocumentType(), newSubjectDocType, msg2);
-        Assert.assertEquals(
-                updatedRelationCommon.getObjectCsid(), newObjectId, msg);
-        Assert.assertEquals(
-                updatedRelationCommon.getObjectDocumentType(), newObjectDocType, msg2);
-        Assert.assertEquals(
-                updatedRelationCommon.getPredicateDisplayName(), relationCommon.getPredicateDisplayName(), msg);
-
-    }
-
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
-     */
-    @Override
-    public void updateWithEmptyEntityBody(String testName) throws Exception {
-       //Should this test really be empty?
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
-     */
-    @Override
-    public void updateWithMalformedXml(String testName) throws Exception {
-       //Should this test really be empty?
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
-     */
-    @Override
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
-       //Should this test really be empty?
-    }
-
-    /*
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-        dependsOnMethods = {"create", "update", "testSubmitRequest"})
-    public void updateWithEmptyEntityBody(String testName) throws Exception {
-    
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdateWithEmptyEntityBody();
-
-        // Submit the request to the service and store the response.
-        String method = REQUEST_TYPE.httpMethodName();
-        String url = getResourceURL(knownResourceId);
-        String mediaType = MediaType.APPLICATION_XML;
-        final String entity = "";
-        int statusCode = submitRequest(method, url, mediaType, entity);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if(logger.isDebugEnabled()){
-           logger.debug(testName + ": url=" + url +
-               " status=" + statusCode);
-         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-        invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-        dependsOnMethods = {"create", "update", "testSubmitRequest"})
-    public void updateWithMalformedXml(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdateWithMalformedXml();
-
-        // Submit the request to the service and store the response.
-        String method = REQUEST_TYPE.httpMethodName();
-        String url = getResourceURL(knownResourceId);
-        String mediaType = MediaType.APPLICATION_XML;
-        final String entity = MALFORMED_XML_DATA; // Constant from abstract base class.
-        int statusCode = submitRequest(method, url, mediaType, entity);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if(logger.isDebugEnabled()){
-            logger.debug(testName + ": url=" + url +
-            " status=" + statusCode);
-         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-        invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-        dependsOnMethods = {"create", "update", "testSubmitRequest"})
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
-    
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdateWithWrongXmlSchema();
-
-        // Submit the request to the service and store the response.
-        String method = REQUEST_TYPE.httpMethodName();
-        String url = getResourceURL(knownResourceId);
-        String mediaType = MediaType.APPLICATION_XML;
-        final String entity = WRONG_XML_SCHEMA_DATA; // Constant from abstract base class.
-        int statusCode = submitRequest(method, url, mediaType, entity);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if(logger.isDebugEnabled()){
-            logger.debug(testName + ": url=" + url +
-            " status=" + statusCode);
-         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-        invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-     */
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        dependsOnMethods = {"update", "testSubmitRequest"})
-    public void updateNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdateNonExistent();
-
-        // Submit the request to the service and store the response.
-        // Note: The ID used in this 'create' call may be arbitrary.
-        // The only relevant ID may be the one used in update(), below.
-        RelationClient client = new RelationClient();
-        PoxPayloadOut multipart = createRelationInstance(NON_EXISTENT_ID);
-        ClientResponse<String> res =
-                client.update(NON_EXISTENT_ID, multipart);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    // ---------------------------------------------------------------
-    // CRUD tests : DELETE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
-    public void delete(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDelete();
-
-        // Submit the request to the service and store the response.
-        RelationClient client = new RelationClient();
-        ClientResponse<Response> res = client.delete(knownResourceId);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    // Failure outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        dependsOnMethods = {"delete"})
-    public void deleteNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDeleteNonExistent();
-
-        // Submit the request to the service and store the response.
-        RelationClient client = new RelationClient();
-        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    // ---------------------------------------------------------------
-    // RELATE_OBJECT tests
-    // ---------------------------------------------------------------
-    /**
-     * Relate objects.
-     */
-    @Test(dependsOnMethods = {"create"})
-    public void relateObjects() {
-       //Should this test really be empty?
-    }
-
-    // ---------------------------------------------------------------
-    // Utility tests : tests of code used in tests above
-    // ---------------------------------------------------------------
+       
     /**
-     * Tests the code for manually submitting data that is used by several
-     * of the methods above.
+     * This method is called by the base class method (test) readList().
+     * @param testName
+     * @param list
      */
-    @Test(dependsOnMethods = {"create", "read"})
-    public void testSubmitRequest() {
-
-        setupRead();
-
-        // Submit the request to the service and store the response.
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getResourceURL(knownResourceId);
-        int statusCode = submitRequest(method, url);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if(logger.isDebugEnabled()){
-            logger.debug("testSubmitRequest: url=" + url +
-                " status=" + statusCode);
+    @Override
+    protected void printList(String testName, RelationsCommonList list) {
+        List<RelationsCommonList.RelationListItem> items =
+                list.getRelationListItem();
+        int i = 0;
+        for(RelationsCommonList.RelationListItem item : items){
+            logger.debug(testName + ": list-item[" + i + "] csid=" +
+                    item.getCsid());
+            logger.debug(testName + ": list-item[" + i + "] URI=" +
+                    item.getUri());
+            i++;
         }
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
     }
 
     // ---------------------------------------------------------------
@@ -865,8 +227,7 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
     private PoxPayloadOut createRelationInstance(RelationsCommon relation) {
         PoxPayloadOut result = new PoxPayloadOut(this.getServicePathComponent());
         PayloadOutputPart commonPart =
-               result.addPart(relation, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(new RelationClient().getCommonPartName());
+               result.addPart(new RelationClient().getCommonPartName(), relation);
         if(logger.isDebugEnabled()){
           logger.debug("to be created, relation common");
           logger.debug(objectAsXmlString(relation, RelationsCommon.class));
@@ -895,7 +256,7 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
     private void fillRelation(RelationsCommon relationCommon, String identifier) {
         fillRelation(relationCommon, samSubjectPersonCSID, null, oliveObjectPersonCSID, null,
                 RelationshipType.COLLECTIONOBJECT_INTAKE.toString(),
-                RelationshipType.COLLECTIONOBJECT_INTAKE + ".displayName");
+                RelationshipType.COLLECTIONOBJECT_INTAKE + ".displayName-" + identifier);
     }
 
     /**
@@ -926,4 +287,49 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
        protected String getServiceName() {
                return RelationClient.SERVICE_NAME;
        }
+
+       @Override
+       public void CRUDTests(String testName) {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       protected PoxPayloadOut createInstance(String commonPartName,
+                       String identifier) {
+               return createRelationInstance(identifier);
+       }
+
+       @Override
+       protected RelationsCommon updateInstance(RelationsCommon relationCommon) {
+               RelationsCommon result = new RelationsCommon();
+                       
+        // Update the content of this resource, inverting subject and object
+        result.setSubjectCsid(relationCommon.getObjectCsid());
+        result.setSubjectDocumentType("Hooey"); // DocumentType changes should be ignored.
+        result.setObjectCsid(relationCommon.getSubjectCsid());
+        result.setObjectDocumentType("Fooey"); // DocumentType changes should be ignored.
+        result.setPredicateDisplayName("updated-" + relationCommon.getPredicateDisplayName());
+               
+               return result;
+       }
+
+       @Override
+       protected void compareUpdatedInstances(RelationsCommon original,
+                       RelationsCommon updated) throws Exception {
+        final String msg =
+                "Data in updated object did not match submitted data.";
+        final String msg2 =
+                "Data in updated object was not correctly computed.";
+        Assert.assertEquals(
+                       updated.getSubjectCsid(), original.getSubjectCsid(), msg);
+        Assert.assertEquals(
+                       updated.getSubjectDocumentType(), PERSONS_DOCUMENT_TYPE, msg2); // DocumentType changes should have been ignored.
+        Assert.assertEquals(
+                       updated.getObjectCsid(), original.getObjectCsid(), msg);
+        Assert.assertEquals(
+                       updated.getObjectDocumentType(), PERSONS_DOCUMENT_TYPE, msg2); // DocumentType changes should have been ignored.
+        Assert.assertEquals(
+                       updated.getPredicateDisplayName(), original.getPredicateDisplayName(), msg);
+       }
 }
index edaab82458766b168c3c0a1d9b2aa5a817f89cad..1007a6825df704d1c72cc660a7e1ba1be074e884 100644 (file)
@@ -33,7 +33,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>\r
         \r
         <dependency>\r
index 4e7eb2178e045ebcca1dd1ebec01c89e9cfb50eb..1bc19d1a68cfa5490387a0b2c22289cb90fc4930 100644 (file)
@@ -33,6 +33,7 @@ import org.collectionspace.services.common.ResourceBase;
 import org.collectionspace.services.common.ServiceMessages;
 import org.collectionspace.services.common.context.ServiceContext;
 import org.collectionspace.services.common.document.DocumentHandler;
+import org.collectionspace.services.common.query.QueryManager;
 import org.collectionspace.services.common.relation.IRelationsManager;
 import org.collectionspace.services.common.relation.nuxeo.RelationsUtils;
 import org.slf4j.Logger;
@@ -91,6 +92,15 @@ public class RelationResource extends ResourceBase {
 
             String relationClause = RelationsUtils.buildWhereClause(subjectCsid, subjectType, predicate, objectCsid, objectType);
             handler.getDocumentFilter().appendWhereClause(relationClause, IQueryManager.SEARCH_QUALIFIER_AND);
+            //
+            // Handle keyword clause
+            //
+            String keywords = queryParams.getFirst(IQueryManager.SEARCH_TYPE_KEYWORDS_KW);            
+            if (keywords != null && keywords.isEmpty() == false) {
+               String keywordClause = QueryManager.createWhereClauseFromKeywords(keywords);
+               handler.getDocumentFilter().appendWhereClause(keywordClause, IQueryManager.SEARCH_QUALIFIER_AND);
+            }
+            
             return (RelationsCommonList)finish_getList(ctx, handler);
         } catch (Exception e) {
             throw bigReThrow(e, ServiceMessages.LIST_FAILED);
index 8073f15697a30f42a3eb0591f1821f3f3f764b96..f5f12af59c4e0c2bcdd50537137dfcc4592deb78 100644 (file)
@@ -61,7 +61,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>\r
         <dependency>\r
             <groupId>org.jboss.resteasy</groupId>\r
index 9f5c7429b2cb110f110da7a8012b17d42b5f7748..db2976f136ba9ff8ae049d22778c52f634eed2b3 100644 (file)
@@ -56,6 +56,10 @@ public class ReportClient extends AbstractCommonListPoxServiceClientImpl<ReportP
                return ReportProxy.class;
        }
        
+       /*
+        * Proxied service calls
+        */
+       
     /**
      * @return
      * @see org.collectionspace.services.client.ReportProxy#getReport()
index e09fb1903963210cec198b5400645085c45378d4..f6c28ed7e6d76c08a1de9a039a5c59a265c1d4bf 100644 (file)
@@ -24,16 +24,12 @@ package org.collectionspace.services.client.test;
 
 import java.util.ArrayList;
 import java.util.List;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
 
+import org.collectionspace.services.client.AbstractCommonListUtils;
 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.ReportClient;
-import org.collectionspace.services.common.AbstractCommonListUtils;
 import org.collectionspace.services.report.ReportsCommon;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 
@@ -53,17 +49,14 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision: 2261 $
  * $LastChangedDate: 2010-05-28 16:52:22 -0700 (Fri, 28 May 2010) $
  */
-public class ReportServiceTest extends AbstractServiceTestImpl {
+public class ReportServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonList, ReportsCommon> {
 
     /** The logger. */
     private final String CLASS_NAME = ReportServiceTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
     final String SERVICE_NAME = "reports";
     final String SERVICE_PATH_COMPONENT = "reports";
-    // Instance variables specific to this test.
-    /** The known resource id. */
-    private String knownResourceId = null;
-    
+    // Instance variables specific to this test.    
     private String testDocType = "Acquisition";
 
     /* (non-Javadoc)
@@ -73,240 +66,49 @@ public class ReportServiceTest extends AbstractServiceTestImpl {
     protected CollectionSpaceClient getClientInstance() {
         return new ReportClient();
     }
-
-//    @Override
-//    protected PoxPayloadOut createInstance(String identifier) {
-//        PoxPayloadOut multipart = createReportInstance(identifier);
-//        return multipart;
-//    }
-        
-    // ---------------------------------------------------------------
-    // CRUD tests : CREATE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
-    public void create(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup, such as initializing the type of service request
-        // (e.g. CREATE, DELETE), its valid and expected status codes, and
-        // its associated HTTP method name (e.g. POST, DELETE).
-        setupCreate();
-
-        // Submit the request to the service and store the response.
-        ReportClient client = new ReportClient();
-        String identifier = createIdentifier();
-        PoxPayloadOut multipart = createReportInstance(identifier);
-        ClientResponse<Response> res = client.create(multipart);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        //
-        // Specifically:
-        // Does it fall within the set of valid status codes?
-        // Does it exactly match the expected status code?
-        int statusCode = res.getStatus();
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": status = " + statusCode);
-        }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
-        // Store the ID returned from the first resource created
-        // for additional tests below.
-        if (knownResourceId == null) {
-            knownResourceId = extractId(res);
-            if (logger.isDebugEnabled()) {
-                logger.debug(testName + ": knownResourceId=" + knownResourceId);
-            }
-        }
-
-        // Store the IDs from every resource created by tests,
-        // so they can be deleted after tests have been run.
-        allResourceIdsCreated.add(extractId(res));
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
-    public void createList(String testName) throws Exception {
-        for (int i = 0; i < 3; i++) {
-            create(testName);
-        }
-    }
-
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
-     */
-    @Override
-    public void createWithEmptyEntityBody(String testName) throws Exception {
-        //Should this really be empty?
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
-     */
-    @Override
-    public void createWithMalformedXml(String testName) throws Exception {
-        //Should this really be empty?
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
-     */
-    @Override
-    public void createWithWrongXmlSchema(String testName) throws Exception {
-        //Should this really be empty?
-    }
-
-    // ---------------------------------------------------------------
-    // CRUD tests : READ tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
-    public void read(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupRead();
-
-        // Submit the request to the service and store the response.
-        ReportClient client = new ReportClient();
-        ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-
-        // Get the common part of the response and verify that it is not null.
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
-        ReportsCommon reportCommon = null;
-        if (payloadInputPart != null) {
-            reportCommon = (ReportsCommon) payloadInputPart.getBody();
-        }
-        Assert.assertNotNull(reportCommon);
-
-        // Check the values of fields containing Unicode UTF-8 (non-Latin-1) characters.
-        if (logger.isDebugEnabled()) {
-            logger.debug("UTF-8 data sent=" + getUTF8DataFragment() + "\n"
-                    + "UTF-8 data received=" + reportCommon.getNotes());
-        }
-        Assert.assertEquals(reportCommon.getNotes(), getUTF8DataFragment(),
-                "UTF-8 data retrieved '" + reportCommon.getNotes()
-                + "' does not match expected data '" + getUTF8DataFragment());
-    }
-
-    // Failure outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
-    public void readNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadNonExistent();
-
-        // Submit the request to the service and store the response.
-        ReportClient client = new ReportClient();
-        ClientResponse<String> res = client.read(NON_EXISTENT_ID);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    // ---------------------------------------------------------------
-    // CRUD tests : READ_LIST tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList", "read"})
-    public void readList(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadList();
-
-        // Submit the request to the service and store the response.
-        ReportClient client = new ReportClient();
-        ClientResponse<AbstractCommonList> res = client.readList();
-        assertStatusCode(res, testName);
-        AbstractCommonList list = res.getEntity();
-
-        // Optionally output additional data about list members for debugging.
-        if(logger.isTraceEnabled()){
-               AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
-        }
-    }
-
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-               dependsOnMethods = {"readList"})
+    
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"CRUDTests"})
     public void readListFiltered(String testName) throws Exception {
-       if (logger.isDebugEnabled()) {
-               logger.debug(testBanner(testName, CLASS_NAME));
-       }
        // Perform setup.
        setupReadList();
 
        // Submit the request to the service and store the response.
        ReportClient client = new ReportClient();
-       ClientResponse<AbstractCommonList> res = client.readListFiltered(
-                       testDocType, "single");
-        assertStatusCode(res, testName);
-       AbstractCommonList list = res.getEntity();
-
-       List<AbstractCommonList.ListItem> items =
-               list.getListItem();
+       ClientResponse<AbstractCommonList> res = client.readListFiltered(testDocType, "single");
+       AbstractCommonList list = null;
+       try {
+               assertStatusCode(res, testName);
+               list = res.getEntity();
+       } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+       }
+       List<AbstractCommonList.ListItem> items = list.getListItem();
        // We must find the basic one we created
        boolean fFoundBaseItem = false;
                for (AbstractCommonList.ListItem item : items) {
-                       if(knownResourceId.equalsIgnoreCase(AbstractCommonListUtils.ListItemGetCSID(item))) {
+                       String itemCsid = AbstractCommonListUtils.ListItemGetCSID(item);
+                       if (knownResourceId.equalsIgnoreCase(itemCsid)) {
                                fFoundBaseItem = true;
                                break;
                        }
                }
-               if(!fFoundBaseItem)
+               if(!fFoundBaseItem) {
                        Assert.fail("readListFiltered failed to return base item");
+               }
                
                // Now filter for something else, and ensure it is NOT returned
        res = client.readListFiltered("Intake", "single");
-        assertStatusCode(res, testName);
-       list = res.getEntity();
+       try {
+               assertStatusCode(res, testName);
+               list = res.getEntity();
+       } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+       }
 
        items = list.getListItem();
        // We must NOT find the basic one we created
@@ -317,8 +119,14 @@ public class ReportServiceTest extends AbstractServiceTestImpl {
                
                // Now filter for something else, and ensure it is NOT returned
        res = client.readListFiltered(testDocType, "group");
-        assertStatusCode(res, testName);
-       list = res.getEntity();
+       try {
+               assertStatusCode(res, testName);
+               list = res.getEntity();
+       } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+       }
 
        items = list.getListItem();
        // We must NOT find the basic one we created
@@ -328,237 +136,25 @@ public class ReportServiceTest extends AbstractServiceTestImpl {
                }
     }
 
-    // ---------------------------------------------------------------
-    // CRUD tests : UPDATE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read", "readListFiltered"})
-    public void update(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdate();
-
-        // Retrieve the contents of a resource to update.
-        ReportClient client = new ReportClient();
-        ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-        if (logger.isDebugEnabled()) {
-            logger.debug("got object to update with ID: " + knownResourceId);
-        }
-
-        // Extract the common part from the response.
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
-        ReportsCommon reportCommon = null;
-        if (payloadInputPart != null) {
-            reportCommon = (ReportsCommon) payloadInputPart.getBody();
-        }
-        Assert.assertNotNull(reportCommon);
-
-        // Update its content.
-        reportCommon.setName("updated-" + reportCommon.getName());
-        reportCommon.setOutputMIME("updated-" + reportCommon.getOutputMIME());
-        if (logger.isDebugEnabled()) {
-            logger.debug("to be updated object");
-            logger.debug(objectAsXmlString(reportCommon, ReportsCommon.class));
-        }
-        reportCommon.setNotes("updated-" + reportCommon.getNotes());
-
-        // Submit the updated common part in an update request to the service
-        // and store the response.
-        PoxPayloadOut output = new PoxPayloadOut(this.getServicePathComponent());
-        PayloadOutputPart commonPart = output.addPart(reportCommon, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getCommonPartName());
-        res = client.update(knownResourceId, output);
-        assertStatusCode(res, testName);
-
-        // Extract the updated common part from the response.
-        input = new PoxPayloadIn(res.getEntity());
-        payloadInputPart = input.getPart(client.getCommonPartName());
-        ReportsCommon updatedReportCommon = null;
-        if (payloadInputPart != null) {
-            updatedReportCommon = (ReportsCommon) payloadInputPart.getBody();
-        }
-        Assert.assertNotNull(updatedReportCommon);
-        if (logger.isDebugEnabled()) {
-            logger.debug("updated object");
-            logger.debug(objectAsXmlString(updatedReportCommon, ReportsCommon.class));
-        }
-
-        // Check selected fields in the updated common part.
-        Assert.assertEquals(updatedReportCommon.getName(),
-                reportCommon.getName(),
-                "Data in updated object did not match submitted data.");
-
-        // Check the values of fields containing Unicode UTF-8 (non-Latin-1) characters.
-        if (logger.isDebugEnabled()) {
-            logger.debug("UTF-8 data sent=" + reportCommon.getNotes() + "\n"
-                    + "UTF-8 data received=" + updatedReportCommon.getNotes());
-        }
-        Assert.assertTrue(updatedReportCommon.getNotes().contains(getUTF8DataFragment()),
-                "UTF-8 data retrieved '" + updatedReportCommon.getNotes()
-                + "' does not contain expected data '" + getUTF8DataFragment());
-        Assert.assertEquals(updatedReportCommon.getNotes(),
-                reportCommon.getNotes(),
-                "Data in updated object did not match submitted data.");
-    }
-
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
-     */
-    @Override
-    public void updateWithEmptyEntityBody(String testName) throws Exception {
-        //Should this really be empty?
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
-     */
-    @Override
-    public void updateWithMalformedXml(String testName) throws Exception {
-        //Should this really be empty?
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
-     */
-    @Override
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
-        //Should this really be empty?
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"update", "testSubmitRequest"})
-    public void updateNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdateNonExistent();
-
-        // Submit the request to the service and store the response.
-        // Note: The ID used in this 'create' call may be arbitrary.
-        // The only relevant ID may be the one used in update(), below.
-        ReportClient client = new ReportClient();
-        PoxPayloadOut multipart = createReportInstance(NON_EXISTENT_ID);
-        ClientResponse<String> res = client.update(NON_EXISTENT_ID, multipart);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    // ---------------------------------------------------------------
-    // CRUD tests : DELETE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
+    /**
+     * This method overrides the delete method in the base class which is marked with the TestNG @Test annotation.
+     * Since we don't want the actually delete test to happen until later in the dependency test chain, we're make this
+     * an empty method.  Later in the test suite, the method localDelete() will get called and it will call super.delete()
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create", "readListFiltered", "testSubmitRequest", "update", "readWorkflow"})
     public void delete(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDelete();
-
-        // Submit the request to the service and store the response.
-        ReportClient client = new ReportClient();
-        ClientResponse<Response> res = client.delete(knownResourceId);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    // Failure outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"delete"})
-    public void deleteNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDeleteNonExistent();
-
-        // Submit the request to the service and store the response.
-        ReportClient client = new ReportClient();
-        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+       //
+       // Do nothing for now.  The test localDelete() will get called later in the dependency chain.
+       //
     }
-
-    // ---------------------------------------------------------------
-    // Utility tests : tests of code used in tests above
-    // ---------------------------------------------------------------
+    
     /**
-     * Tests the code for manually submitting data that is used by several
-     * of the methods above.
+     * This test will delete the known resource after the test readListFiltered() is run
      */
-    @Test(dependsOnMethods = {"create", "read"})
-    public void testSubmitRequest() {
-
-        // Expected status code: 200 OK
-        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
-
-        // Submit the request to the service and store the response.
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getResourceURL(knownResourceId);
-        int statusCode = submitRequest(method, url);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug("testSubmitRequest: url=" + url
-                    + " status=" + statusCode);
-        }
-        Assert.assertEquals(statusCode, EXPECTED_STATUS);
-
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"readListFiltered"})
+    public void localDelete(String testName) throws Exception {
+       super.delete(testName);
     }
 
     // ---------------------------------------------------------------
@@ -587,7 +183,7 @@ public class ReportServiceTest extends AbstractServiceTestImpl {
        List<String> docTypes = new ArrayList<String>();
        docTypes.add(testDocType);
         return createReportInstance(
-                "Acquisition Summary"
+                "Acquisition Summary " + identifier
                 docTypes, true, false, false, true,
                 "acq_basic.jasper",
                 "application/pdf");
@@ -623,8 +219,7 @@ public class ReportServiceTest extends AbstractServiceTestImpl {
 
         PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent());
         PayloadOutputPart commonPart =
-                multipart.addPart(reportCommon, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(new ReportClient().getCommonPartName());
+                multipart.addPart(new ReportClient().getCommonPartName(), reportCommon);
 
         if (logger.isDebugEnabled()) {
             logger.debug("to be created, report common");
@@ -634,4 +229,62 @@ public class ReportServiceTest extends AbstractServiceTestImpl {
 
         return multipart;
     }
+
+       @Override
+       protected PoxPayloadOut createInstance(String commonPartName,
+                       String identifier) {
+        PoxPayloadOut result = createReportInstance(identifier);
+               return result;
+       }
+
+       @Override
+       protected ReportsCommon updateInstance(ReportsCommon reportsCommon) {
+               ReportsCommon result = new ReportsCommon();
+               
+               result.setSupportsSingleDoc(true);
+               result.setName("updated-" + reportsCommon.getName());
+               result.setOutputMIME("updated-" + reportsCommon.getOutputMIME());
+        result.setNotes("updated-" + reportsCommon.getNotes());
+               
+               return result;
+       }
+
+       @Override
+       protected void compareUpdatedInstances(ReportsCommon original,
+                       ReportsCommon updated) throws Exception {
+        // Check selected fields in the updated common part.
+        Assert.assertEquals(updated.getName(),
+                       original.getName(),
+                "Name in updated object did not match submitted data.");
+
+        // Check the values of fields containing Unicode UTF-8 (non-Latin-1) characters.
+        if (logger.isDebugEnabled()) {
+            logger.debug("UTF-8 data sent=" + original.getNotes() + "\n"
+                    + "UTF-8 data received=" + updated.getNotes());
+        }
+        Assert.assertTrue(updated.getNotes().contains(getUTF8DataFragment()),
+                "UTF-8 data retrieved '" + updated.getNotes()
+                + "' does not contain expected data '" + getUTF8DataFragment());
+        Assert.assertEquals(updated.getNotes(),
+                       original.getNotes(),
+                "Notes in updated object did not match submitted data.");
+       }
+       
+       protected void compareReadInstances(ReportsCommon original, ReportsCommon fromRead) throws Exception {
+        Assert.assertEquals(fromRead.getNotes(), getUTF8DataFragment(),
+                "UTF-8 data retrieved '" + fromRead.getNotes()
+                + "' does not match expected data '" + getUTF8DataFragment());
+       }       
+       
+    /*
+     * For convenience and terseness, this test method is the base of the test execution dependency chain.  Other test methods may
+     * refer to this method in their @Test annotation declarations.
+     */
+    @Override
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {
+                       "org.collectionspace.services.client.test.AbstractServiceTestImpl.baseCRUDTests"})    
+       public void CRUDTests(String testName) {
+               // TODO Auto-generated method stub              
+       }
 }
index 8615a4f715b6f52e1b5d75c22233a06cf27bef46..54dedbe7cdc5f4968ff1087f68b09f7b987554bb 100644 (file)
@@ -50,7 +50,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>\r
         \r
       <!-- javax -->\r
index ef504dd89578fa36dbcab0f97be8bac227a79709..f8659117cb6df6d6b17ad58b71820f011e08766a 100644 (file)
@@ -61,7 +61,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>\r
         <dependency>\r
             <groupId>org.jboss.resteasy</groupId>\r
index 4995769f23d736aac060cc29ac2de8bed082c64d..fc3341251a3d340d5b51caf070c117477fc2c1bf 100644 (file)
 package org.collectionspace.services.security.client.test;
 
 import java.util.List;
-
 import javax.ws.rs.core.Response;
-
-//import org.apache.commons.codec.binary.Base64;
 import org.jboss.resteasy.client.ClientResponse;
-import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
 
 import org.testng.Assert;
 import org.testng.annotations.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import org.collectionspace.services.account.AccountTenant;
 import org.collectionspace.services.account.AccountsCommon;
@@ -42,16 +40,12 @@ import org.collectionspace.services.client.CollectionObjectClient;
 import org.collectionspace.services.client.CollectionObjectFactory;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.PoxPayloadOut;
-import org.collectionspace.services.client.test.AbstractServiceTestImpl;
 import org.collectionspace.services.client.test.BaseServiceTest;
 import org.collectionspace.services.collectionobject.CollectionobjectsCommon;
 import org.collectionspace.services.collectionobject.TitleGroup;
 import org.collectionspace.services.collectionobject.TitleGroupList;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 /**
  * AuthenticationServiceTest uses CollectionObject service to test
  * authentication
@@ -59,15 +53,14 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision: 434 $ $LastChangedDate: 2009-07-28 14:34:15 -0700 (Tue,
  * 28 Jul 2009) $
  */
-public class AuthenticationServiceTest extends AbstractServiceTestImpl {
+public class AuthenticationServiceTest extends BaseServiceTest<AbstractCommonList> {
 
+    private final Logger logger = LoggerFactory.getLogger(AuthenticationServiceTest.class);
     /** The known resource id. */
-    private String knownResourceId = null;
     private String barneyAccountId = null; //active
     private String georgeAccountId = null; //inactive
     /** The logger. */
     private final String CLASS_NAME = AuthenticationServiceTest.class.getName();
-    private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
 
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.test.AbstractServiceTest#getServicePathComponent()
@@ -98,23 +91,13 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-    protected AbstractCommonList getAbstractCommonList(
+    protected AbstractCommonList getCommonList(
             ClientResponse<AbstractCommonList> response) {
         throw new UnsupportedOperationException(); //Since this test does not support lists, this method is not needed.
     }
 
     @Test(dataProvider = "testName")
-    @Override
-    public void readPaginatedList(String testName) throws Exception {
-        // Test not supported.
-    }
-
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
     public void createActiveAccount(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup, such as initializing the type of service request
         // (e.g. CREATE, DELETE), its valid and expected status codes, and
         // its associated HTTP method name (e.g. POST, DELETE).
@@ -134,9 +117,9 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": barney status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
 
         // Store the ID returned from this create operation
         // for additional tests below.
@@ -148,12 +131,8 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl {
 
     }
 
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+    @Test(dataProvider = "testName")
     public void createInactiveAccount(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupCreate();
 
@@ -171,9 +150,9 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": george status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
 
         // Store the ID returned from this create operation
         // for additional tests below.
@@ -198,9 +177,9 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
+        Assert.assertEquals(statusCode, testExpectedStatusCode);
         res1.releaseConnection();
     }
 
@@ -208,17 +187,14 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl {
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.test.AbstractServiceTest#create()
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createActiveAccount"})
-    @Override
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"createActiveAccount"})
     public void create(String testName) {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         setupCreate();
+
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
         collectionObjectClient.setAuth(true, "barney", true, "barney08", true);
-        String identifier = BaseServiceTest.createIdentifier();
+        String identifier = createIdentifier();
         PoxPayloadOut multipart = createCollectionObjectInstance(
                 collectionObjectClient.getCommonPartName(), identifier);
         ClientResponse<Response> res = collectionObjectClient.create(multipart);
@@ -237,18 +213,16 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl {
 
     }
 
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createActiveAccount"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"createActiveAccount"})
     public void createWithoutAuthn(String testName) {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         setupCreate();
+        
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
         String user = collectionObjectClient.getProperty(collectionObjectClient.USER_PROPERTY);
         String pass = collectionObjectClient.getProperty(collectionObjectClient.PASSWORD_PROPERTY);
         collectionObjectClient.setAuth(false, user, true, pass, true);
-        String identifier = BaseServiceTest.createIdentifier();
+        String identifier = createIdentifier();
         PoxPayloadOut multipart = createCollectionObjectInstance(
                 collectionObjectClient.getCommonPartName(), identifier);
         ClientResponse<Response> res = collectionObjectClient.create(multipart);
@@ -262,14 +236,12 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl {
 
     }
 
-    @Test(dataProvider = "testName", dependsOnMethods = {"createInactiveAccount"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"createInactiveAccount"})
     public void createWithInactiveAccount(String testName) {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName));
-        }
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
         collectionObjectClient.setAuth(true, "george", true, "george08", true);
-        String identifier = BaseServiceTest.createIdentifier();
+        String identifier = createIdentifier();
         PoxPayloadOut multipart = createCollectionObjectInstance(
                 collectionObjectClient.getCommonPartName(), identifier);
 
@@ -286,15 +258,13 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl {
     /**
      * Creates the collection object instance without password.
      */
-    @Test(dataProvider = "testName", dependsOnMethods = {"createActiveAccount"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"createActiveAccount"})
     public void createWithoutPassword(String testName) {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName));
-        }
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
         String user = collectionObjectClient.getProperty(collectionObjectClient.USER_PROPERTY);
         collectionObjectClient.setAuth(true, user, true, "", false);
-        String identifier = BaseServiceTest.createIdentifier();
+        String identifier = createIdentifier();
         PoxPayloadOut multipart = createCollectionObjectInstance(
                 collectionObjectClient.getCommonPartName(), identifier);
         ClientResponse<Response> res = collectionObjectClient.create(multipart);
@@ -308,14 +278,12 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl {
     /**
      * Creates the collection object with unknown user
      */
-    @Test(dataProvider = "testName", dependsOnMethods = {"createActiveAccount"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"createActiveAccount"})
     public void createWithUnknownUser(String testName) {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName));
-        }
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
         collectionObjectClient.setAuth(true, "foo", true, "bar", true);
-        String identifier = BaseServiceTest.createIdentifier();
+        String identifier = createIdentifier();
         PoxPayloadOut multipart = createCollectionObjectInstance(
                 collectionObjectClient.getCommonPartName(), identifier);
         ClientResponse<Response> res = collectionObjectClient.create(multipart);
@@ -329,15 +297,13 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl {
     /**
      * Creates the collection object instance with incorrect password.
      */
-    @Test(dataProvider = "testName", dependsOnMethods = {"createActiveAccount"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"createActiveAccount"})
     public void createWithIncorrectPassword(String testName) {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName));
-        }
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
         String user = collectionObjectClient.getProperty(collectionObjectClient.USER_PROPERTY);
         collectionObjectClient.setAuth(true, user, true, "bar", true);
-        String identifier = BaseServiceTest.createIdentifier();
+        String identifier = createIdentifier();
         PoxPayloadOut multipart = createCollectionObjectInstance(
                 collectionObjectClient.getCommonPartName(), identifier);
         ClientResponse<Response> res = collectionObjectClient.create(multipart);
@@ -353,12 +319,9 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl {
      */
     @Test(dataProvider = "testName", dependsOnMethods = {"createActiveAccount"})
     public void createWithIncorrectUserPassword(String testName) {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName));
-        }
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
         collectionObjectClient.setAuth(true, "foo", true, "bar", true);
-        String identifier = BaseServiceTest.createIdentifier();
+        String identifier = createIdentifier();
         PoxPayloadOut multipart = createCollectionObjectInstance(
                 collectionObjectClient.getCommonPartName(), identifier);
         ClientResponse<Response> res = collectionObjectClient.create(multipart);
@@ -375,12 +338,9 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl {
      */
     @Test(dataProvider = "testName", dependsOnMethods = {"createActiveAccount"})
     public void createWithoutTenant(String testName) {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName));
-        }
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
         collectionObjectClient.setAuth(true, "babybop", true, "babybop09", true);
-        String identifier = BaseServiceTest.createIdentifier();
+        String identifier = createIdentifier();
         PoxPayloadOut multipart = createCollectionObjectInstance(
                 collectionObjectClient.getCommonPartName(), identifier);
         ClientResponse<Response> res = collectionObjectClient.create(multipart);
@@ -392,24 +352,9 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl {
         res.releaseConnection();
     }
 
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTest#delete()
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
-    public void delete(String testName) {
-        setupDelete();
-
-    }
-
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create", "createWithInactiveAccount"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"create", "createWithInactiveAccount"})
     public void deleteAccounts(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupDelete();
         AccountClient accountClient = new AccountClient();
@@ -420,29 +365,19 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": barney status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
 
         res = accountClient.delete(georgeAccountId);
         statusCode = res.getStatus();
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": george status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         res.releaseConnection();
     }
     
-    // ---------------------------------------------------------------
-    // Search tests
-    // ---------------------------------------------------------------
-    
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
-    public void searchWorkflowDeleted(String testName) throws Exception {
-        // Fixme: null test for now, overriding test in base class
-    } 
-
     // ---------------------------------------------------------------
     // Utility methods used by tests above
     // ---------------------------------------------------------------
@@ -517,107 +452,9 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl {
 
     }
 
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTest#createList()
-     */
-    @Override
-    public void createList(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTest#createWithEmptyEntityBody()
-     */
-    @Override
-    public void createWithEmptyEntityBody(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTest#createWithMalformedXml()
-     */
-    @Override
-    public void createWithMalformedXml(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTest#createWithWrongXmlSchema()
-     */
-    @Override
-    public void createWithWrongXmlSchema(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTest#read()
-     */
-    @Override
-    public void read(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTest#readNonExistent()
-     */
-    @Override
-    public void readNonExistent(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTest#readList()
-     */
-    @Override
-    public void readList(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTest#update()
-     */
-    @Override
-    public void update(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTest#updateWithEmptyEntityBody()
-     */
-    @Override
-    public void updateWithEmptyEntityBody(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTest#updateWithMalformedXml()
-     */
-    @Override
-    public void updateWithMalformedXml(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTest#updateWithWrongXmlSchema()
-     */
-    @Override
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTest#updateNonExistent()
-     */
-    @Override
-    public void updateNonExistent(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTest#deleteNonExistent()
-     */
-    @Override
-    public void deleteNonExistent(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
+       @Override
+       protected Class<AbstractCommonList> getCommonListType() {
+               // TODO Auto-generated method stub
+               return null;
+       }       
 }
index 04835922021afd79495aa7e79311dd9f3881b4a1..65f66e498df67526dd27d9fa1648a57fcebcfa1b 100644 (file)
@@ -32,14 +32,16 @@ import java.util.Collection;
 import java.util.Date;
 import java.util.Hashtable;
 import java.util.List;
+
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
+import org.jboss.resteasy.client.ClientResponse;
+
 import org.collectionspace.services.account.AccountsCommon;
 import org.collectionspace.services.authorization.AccountRole;
 import org.collectionspace.services.authorization.AccountValue;
 import org.collectionspace.services.authorization.perms.ActionType;
 import org.collectionspace.services.authorization.perms.EffectType;
-
 import org.collectionspace.services.authorization.perms.Permission;
 import org.collectionspace.services.authorization.perms.PermissionAction;
 import org.collectionspace.services.authorization.PermissionRole;
@@ -63,22 +65,18 @@ import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.client.RoleClient;
 import org.collectionspace.services.client.RoleFactory;
-import org.collectionspace.services.client.test.AbstractServiceTestImpl;
+import org.collectionspace.services.client.test.BaseServiceTest;
 import org.collectionspace.services.dimension.DimensionsCommon;
 import org.collectionspace.services.intake.IntakesCommon;
 import org.collectionspace.services.jaxb.AbstractCommonList;
-import org.jboss.resteasy.client.ClientResponse;
-import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
-import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
-import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
 
 import org.testng.Assert;
 import org.testng.annotations.Test;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
 
 /**
  * AuthorizationServiceTest, carries out tests against a
@@ -91,14 +89,11 @@ import org.testng.annotations.BeforeClass;
  * $LastChangedRevision: 917 $
  * $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri, 06 Nov 2009) $
  */
-public class AuthorizationServiceTest extends AbstractServiceTestImpl {
+public class AuthorizationServiceTest extends BaseServiceTest<AbstractCommonList> {
 
     private final String CLASS_NAME = AuthorizationServiceTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
     // Instance variables specific to this test.
-    private String knownResourceId = null;
-    private List<String> allResourceIdsCreated = new ArrayList();
-    //key for accValues is userId
     private Hashtable<String, AccountValue> accValues = new Hashtable<String, AccountValue>();
     //key for permValues is id as there could be several perms for the same resource
     private Hashtable<String, PermissionValue> permValues = new Hashtable<String, PermissionValue>();
@@ -238,35 +233,17 @@ public class AuthorizationServiceTest extends AbstractServiceTestImpl {
      */
     @Override
     protected CollectionSpaceClient getClientInstance() {
+       // This method is meaningless to this test.
         return null;
     }
 
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
-     */
-    @Override
-    protected AbstractCommonList getAbstractCommonList(
-            ClientResponse<AbstractCommonList> response) {
-        //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
-        throw new UnsupportedOperationException();
-    }
-
-    @Test(dataProvider = "testName")
-    @Override
-    public void readPaginatedList(String testName) throws Exception {
-        //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
-    }
     // ---------------------------------------------------------------
     // CRUD tests : CREATE tests
     // ---------------------------------------------------------------
     // Success outcomes
 
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+    @Test(dataProvider = "testName")
     public void create(String testName) throws Exception {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         setupCreate();
 
         // Submit the request to the service and store the response.
@@ -287,8 +264,8 @@ public class AuthorizationServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, Response.Status.CREATED.getStatusCode());
         knownResourceId = extractId(res);
         if (logger.isDebugEnabled()) {
@@ -304,8 +281,8 @@ public class AuthorizationServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + " (verify not allowed): status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, Response.Status.FORBIDDEN.getStatusCode());
         
         //Finally, verify that elmo has no access to Intakes
@@ -320,8 +297,8 @@ public class AuthorizationServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + " (verify create intake not allowed): status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, Response.Status.FORBIDDEN.getStatusCode());
         
     }
@@ -354,14 +331,10 @@ public class AuthorizationServiceTest extends AbstractServiceTestImpl {
 
         return multipart;
     }
-
     
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+    @Test(dataProvider = "testName",
            dependsOnMethods = {"delete"})
     public void verifyCreateWithFlippedRoles(String testName) throws Exception {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         setupCreate();
 
         // Submit the request to the service and store the response.
@@ -386,8 +359,8 @@ public class AuthorizationServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, Response.Status.CREATED.getStatusCode());
         knownResourceId = extractId(res);
         if (logger.isDebugEnabled()) {
@@ -402,46 +375,19 @@ public class AuthorizationServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug(testName + " (verify not allowed): status = " + statusCode);
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, Response.Status.FORBIDDEN.getStatusCode());
         restoreInitialAccountRoles();
     }
 
-    //to not cause uniqueness violation for permRole, createList is removed
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
-    public void createList(String testName) throws Exception {
-    }
-
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-    @Override
-    public void createWithEmptyEntityBody(String testName) throws Exception {
-    }
-
-    @Override
-    public void createWithMalformedXml(String testName) throws Exception {
-    }
-
-    @Override
-    public void createWithWrongXmlSchema(String testName) throws Exception {
-    }
-
     // ---------------------------------------------------------------
     // CRUD tests : READ tests
     // ---------------------------------------------------------------
     // Success outcomes
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"create"})
     public void read(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupRead();
 
@@ -450,186 +396,120 @@ public class AuthorizationServiceTest extends AbstractServiceTestImpl {
         //elmo allowed to read
         client.setAuth(true, "elmo2010", true, "elmo2010", true);
         ClientResponse<String> res = client.read(knownResourceId);
-        assertStatusCode(res, testName);
-
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        DimensionsCommon dimension = (DimensionsCommon) extractPart(input,
-                client.getCommonPartName(), DimensionsCommon.class);
-        Assert.assertNotNull(dimension);
+        try {
+               assertStatusCode(res, testName);
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               DimensionsCommon dimension = (DimensionsCommon) extractPart(input,
+                       client.getCommonPartName(), DimensionsCommon.class);
+               Assert.assertNotNull(dimension);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
     }
 
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+    @Test(dataProvider = "testName",
            dependsOnMethods = {"read"})
     public void readLockedOut(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
-        setupRead();
+       setupForbidden();
 
         // Submit the request to the service and store the response.
         DimensionClient client = new DimensionClient();
         //lockedOut allowed to read
         client.setAuth(true, "lockedOut", true, "lockedOut", true);
         ClientResponse<String> res = client.read(knownResourceId);
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + " (test lockedOut): status = " + statusCode);
+        try {
+               assertStatusCode(res, testName);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, Response.Status.FORBIDDEN.getStatusCode());
-    }
-
-    // Failure outcomes
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
-    public void readNonExistent(String testName) throws Exception {
-
-        // Perform setup.
-        setupReadNonExistent();
-    }
-
-    // ---------------------------------------------------------------
-    // CRUD tests : READ_LIST tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList", "read"})
-    public void readList(String testName) throws Exception {
-        setupReadList();
-    }
-
-    // Failure outcomes
-    // None at present.
-    // ---------------------------------------------------------------
-    // CRUD tests : UPDATE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read", "readList", "readNonExistent"})
-    public void update(String testName) throws Exception {
-        setupUpdate();
-
     }
 
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read", "readList", "readNonExistent"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"read"})
     public void updateNotAllowed(String testName) throws Exception {
+        setupForbidden();
 
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        setupUpdate();
-
+        // Create a new client and change its AuthN credentials
         DimensionClient client = new DimensionClient();
-
         //elmo not allowed to update
         client.setAuth(true, "elmo2010", true, "elmo2010", true);
-
+        //
+        // Create a new dimension object
+        //
         DimensionsCommon dimension = new DimensionsCommon();
         dimension.setDimension("dimensionType");
         // Update the content of this resource.
         dimension.setMeasurementUnit("updated-" + dimension.getMeasurementUnit());
         dimension.setValueDate("updated-" + dimension.getValueDate());
-        // Submit the request to the service and store the response.
+        //
+        // Create and submit the request to the service and store the response.
+        //
         PoxPayloadOut output = new PoxPayloadOut(DimensionClient.SERVICE_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = output.addPart(dimension, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getCommonPartName());
-
+        PayloadOutputPart commonPart = output.addPart(client.getCommonPartName(), dimension);
         ClientResponse<String> res = client.update(knownResourceId, output);
-        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);
+        try {
+               assertStatusCode(res, testName);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, Response.Status.FORBIDDEN.getStatusCode());
-        
+        //
+        // Create another new client with new credentials
+        //
         client = new DimensionClient();
-
         //lockedOut not allowed to update
         client.setAuth(true, "lockedOut", true, "lockedOut", true);
+        //
+        // Try the update again.
+        //
         res = client.update(knownResourceId, output);
-        statusCode = res.getStatus();
-        // Check the status code of the response: does it match the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": (lockedOut) status = " + statusCode);
+        try {
+               assertStatusCode(res, testName);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, Response.Status.FORBIDDEN.getStatusCode());
         
     }
 
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-    @Override
-    public void updateWithEmptyEntityBody(String testName) throws Exception {
-    }
-
-    @Override
-    public void updateWithMalformedXml(String testName) throws Exception {
-    }
-
-    @Override
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"readNonExistent", "testSubmitRequest"})
-    public void updateNonExistent(String testName) throws Exception {
-    }
-
     // ---------------------------------------------------------------
     // CRUD tests : DELETE tests
     // ---------------------------------------------------------------
     // Success outcomes
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"updateNotAllowed"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"updateNotAllowed"})
     public void deleteNotAllowed(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
-        setupDelete();
-
-        // Submit the request to the service and store the response.
+        setupForbidden();
+        //
+        // Create a new client and change the AuthN credentials
+        //
         DimensionClient client = new DimensionClient();
         //bigbird can not delete
         client.setAuth(true, "bigbird2010", true, "bigbird2010", true);
+        //
+        // Try to make a DELETE request
+        //
         ClientResponse<Response> res = client.delete(knownResourceId);
-        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);
+        try {
+               assertStatusCode(res, testName);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, Response.Status.FORBIDDEN.getStatusCode());
-
     }
 
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"deleteNotAllowed"})
+    @Test(dataProvider = "testName",
+       dependsOnMethods = {"deleteNotAllowed"})
     public void delete(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
         setupDelete();
 
@@ -637,46 +517,13 @@ public class AuthorizationServiceTest extends AbstractServiceTestImpl {
         DimensionClient client = new DimensionClient();
 
         ClientResponse<Response> res = client.delete(knownResourceId);
-        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);
+        try {
+               assertStatusCode(res, testName);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
-    }
-
-    // Failure outcomes
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
-    public void deleteNonExistent(String testName) throws Exception {
-        //ignoring this test as the service side returns 200 now even if it does
-        //not find a record in the db
-    }
-    
-    // ---------------------------------------------------------------
-    // Search tests
-    // ---------------------------------------------------------------
-    
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
-    public void searchWorkflowDeleted(String testName) throws Exception {
-        // Fixme: null test for now, overriding test in base class
-    } 
-
-    // ---------------------------------------------------------------
-    // Utility tests : tests of code used in tests above
-    // ---------------------------------------------------------------
-    /**
-     * Tests the code for manually submitting data that is used by several
-     * of the methods above.
-     */
-    @Test(dependsOnMethods = {"create"})
-    public void testSubmitRequest() throws Exception {
     }
 
     // ---------------------------------------------------------------
@@ -706,7 +553,6 @@ public class AuthorizationServiceTest extends AbstractServiceTestImpl {
     }
 
     private void deletePermissionRoles() {
-
         List<RoleValue> bigbirdRoleValues = new ArrayList<RoleValue>();
         bigbirdRoleValues.add(roleValues.get("ROLE_TEST_CM"));
         deletePermissionRole(permValues.get(bigbirdPermId), bigbirdRoleValues);
@@ -714,7 +560,6 @@ public class AuthorizationServiceTest extends AbstractServiceTestImpl {
         List<RoleValue> elmoRoleValues = new ArrayList<RoleValue>();
         elmoRoleValues.add(roleValues.get("ROLE_TEST_INTERN"));
         deletePermissionRole(permValues.get(elmoPermId), elmoRoleValues);
-
     }
 
     private void deleteAccountRoles() {
@@ -765,8 +610,6 @@ public class AuthorizationServiceTest extends AbstractServiceTestImpl {
         }
     }
 
-
-
     private void deletePermissions() {
         //delete entities
         for (PermissionValue pv : permValues.values()) {
@@ -794,127 +637,126 @@ public class AuthorizationServiceTest extends AbstractServiceTestImpl {
 
     private String createPermission(String resName,
             List<PermissionAction> actions, EffectType effect) {
+       String result = null;
+       
         setupCreate();
         PermissionClient permClient = new PermissionClient();
         Permission permission = PermissionFactory.createPermissionInstance(resName,
-                "default permissions for " + resName,
-                actions, effect, true, true, true);
+                "default permissions for " + resName, actions, effect, true, true, true);
         ClientResponse<Response> res = permClient.create(permission);
-        int statusCode = res.getStatus();
-        if (logger.isDebugEnabled()) {
-            logger.debug("createPermission: resName=" + resName
-                    + " status = " + statusCode);
+        try {
+               assertStatusCode(res, "CreatePermission");
+               result = extractId(res);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        res.releaseConnection();
-        return extractId(res);
+
+        return result;
     }
 
     private void deletePermission(String permId) {
         setupDelete();
         PermissionClient permClient = new PermissionClient();
         ClientResponse<Response> res = permClient.delete(permId);
-        int statusCode = res.getStatus();
-        if (logger.isDebugEnabled()) {
-            logger.debug("deletePermission: delete permission id="
-                    + permId + " status=" + statusCode);
+        try {
+               assertStatusCode(res, "DeletePermission");
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        res.releaseConnection();
     }
 
     private String createRole(String roleName) {
+       String result = null;
+       
         setupCreate();
         RoleClient roleClient = new RoleClient();
-
         Role role = RoleFactory.createRoleInstance(roleName,
                        roleName, //the display name
                 "role for " + roleName, true);
         ClientResponse<Response> res = roleClient.create(role);
-        int statusCode = res.getStatus();
-        if (logger.isDebugEnabled()) {
-            logger.debug("createRole: name=" + roleName
-                    + " status = " + statusCode);
+        try {
+               assertStatusCode(res, "CreateRole");
+               result = extractId(res);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        res.releaseConnection();
-        return extractId(res);
+        
+        return result;
     }
 
     private void deleteRole(String roleId) {
         setupDelete();
         RoleClient roleClient = new RoleClient();
         ClientResponse<Response> res = roleClient.delete(roleId);
-        int statusCode = res.getStatus();
-        if (logger.isDebugEnabled()) {
-            logger.debug("deleteRole: delete role id=" + roleId
-                    + " status=" + statusCode);
+        try {
+               assertStatusCode(res, "DeleteRole");
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        res.releaseConnection();
     }
 
     private String createAccount(String userName, String email) {
+       String result = null;
+       
         setupCreate();
         AccountClient accountClient = new AccountClient();
         AccountsCommon account = AccountFactory.createAccountInstance(
                 userName, userName, userName, email, accountClient.getTenantId(),
                 true, false, true, true);
         ClientResponse<Response> res = accountClient.create(account);
-        int statusCode = res.getStatus();
-        if (logger.isDebugEnabled()) {
-            logger.debug("createAccount: userName=" + userName
-                    + " status = " + statusCode);
+        try {
+               assertStatusCode(res, "CreateAccount");
+               result = extractId(res);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        res.releaseConnection();
-        return extractId(res);
+        
+        return result;
     }
 
     private void deleteAccount(String accId) {
         setupDelete();
         AccountClient accClient = new AccountClient();
         ClientResponse<Response> res = accClient.delete(accId);
-        int statusCode = res.getStatus();
-        if (logger.isDebugEnabled()) {
-            logger.debug("deleteAccount: delete account id="
-                    + accId + " status=" + statusCode);
+        try {
+               assertStatusCode(res, "DeleteAccount");
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        res.releaseConnection();
     }
 
     private String createAccountRole(AccountValue av,
             Collection<RoleValue> rvs) {
+       String result = null;
+       
         setupCreate();
-
         // Submit the request to the service and store the response.
         AccountRole accRole = AccountRoleFactory.createAccountRoleInstance(
                 av, rvs, true, true);
         AccountRoleClient client = new AccountRoleClient();
         ClientResponse<Response> res = client.create(av.getAccountId(), accRole);
-        int statusCode = res.getStatus();
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("createAccountRole: status = " + statusCode);
+        try {
+               assertStatusCode(res, "CreateAccountRole");
+               result = extractId(res);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        res.releaseConnection();
-        return extractId(res);
+        
+        return result;
     }
 
     private void deleteAccountRole(AccountValue av,
@@ -926,23 +768,19 @@ public class AuthorizationServiceTest extends AbstractServiceTestImpl {
         AccountRoleClient client = new AccountRoleClient();
         AccountRole accRole = AccountRoleFactory.createAccountRoleInstance(
                 av, rvs, true, true);
-        ClientResponse<Response> res = client.delete(
-                av.getAccountId());
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug("deleteAccountRole: status = " + statusCode);
+        ClientResponse<Response> res = client.delete(av.getAccountId());
+        try {
+               assertStatusCode(res, "DeleteAccountRole");
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        res.releaseConnection();
     }
 
-    private String createPermissionRole(PermissionValue pv,
-            Collection<RoleValue> rvs) {
+    private String createPermissionRole(PermissionValue pv, Collection<RoleValue> rvs) {
+       String result = null;
+       
         setupCreate();
         List<RoleValue> rvls = new ArrayList<RoleValue>();
         rvls.addAll(rvs);
@@ -950,16 +788,16 @@ public class AuthorizationServiceTest extends AbstractServiceTestImpl {
                 pv, rvls, true, true);
         PermissionRoleClient client = new PermissionRoleClient();
         ClientResponse<Response> res = client.create(pv.getPermissionId(), permRole);
-        int statusCode = res.getStatus();
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("createPermissionRole: status = " + statusCode);
+        try {
+               assertStatusCode(res, "CreatePermissionRole");
+               result = extractId(res);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        res.releaseConnection();
-        return extractId(res);
+        
+        return result;
     }
 
     private void deletePermissionRole(PermissionValue pv,
@@ -975,16 +813,17 @@ public class AuthorizationServiceTest extends AbstractServiceTestImpl {
         PermissionRole permRole = PermissionRoleFactory.createPermissionRoleInstance(
                 pv, rvls, true, true);
         ClientResponse<Response> res = client.delete(pv.getPermissionId());
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug("deletePermissionRole : status = " + statusCode);
+        try {
+               assertStatusCode(res, "DeletePermissionRole");
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        res.releaseConnection();
     }
+
+       @Override
+       protected Class<AbstractCommonList> getCommonListType() {
+               throw new UnsupportedOperationException();
+       }
 }
index 4d809f9879f7920a2aca3327a54d089f0237f76a..da5dbce9311203df6b0586886b942b9b614a9a47 100644 (file)
@@ -32,7 +32,6 @@ import java.util.Collection;
 import java.util.Date;
 import java.util.Hashtable;
 import java.util.List;
-import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import org.collectionspace.services.account.AccountsCommon;
 import org.collectionspace.services.authorization.AccountRole;
@@ -62,13 +61,10 @@ import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.client.RoleClient;
 import org.collectionspace.services.client.RoleFactory;
-import org.collectionspace.services.client.test.AbstractServiceTestImpl;
+import org.collectionspace.services.client.test.BaseServiceTest;
 import org.collectionspace.services.dimension.DimensionsCommon;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.jboss.resteasy.client.ClientResponse;
-import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
-import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
-import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
 
 import org.testng.Assert;
 import org.testng.annotations.Test;
@@ -89,8 +85,18 @@ import org.testng.annotations.BeforeClass;
  * $LastChangedRevision: 917 $
  * $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri, 06 Nov 2009) $
  */
-public class MultiTenancyTest extends AbstractServiceTestImpl {
+public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
 
+    private static class UserInfo {
+        String userName;
+        String password;
+
+        UserInfo(String u, String p) {
+            userName = u;
+            password = p;
+        }
+    }
+    
     private final String CLASS_NAME = MultiTenancyTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
     private final static String TENANT_1_ADMIN_USER = "admin@core.collectionspace.org";
@@ -103,20 +109,9 @@ public class MultiTenancyTest extends AbstractServiceTestImpl {
     private final static String TEST_ROLE_NAME = "ROLE_TEST_REGISTRAR";
     private final static String TEST_SERVICE_A = "dimensions";
 
-    private static class UserInfo {
-
-        String userName;
-        String password;
-
-        UserInfo(String u, String p) {
-            userName = u;
-            password = p;
-        }
-    }
     // Instance variables specific to this test.
     private String TENANT_RESOURCE_1 = null;
     private String TENANT_RESOURCE_2 = null;
-    private List<String> allResourceIdsCreated = new ArrayList();
     //key for userAccounts is userId
     private Hashtable<String, AccountValue> userAccounts = new Hashtable<String, AccountValue>();
     //key for permValues is id as there could be several perms for the same resource
@@ -128,9 +123,6 @@ public class MultiTenancyTest extends AbstractServiceTestImpl {
     private Hashtable<String, Role> tenantAdminRoles = new Hashtable<String, Role>();
     private Hashtable<String, PermissionValue> tenantPermissions = new Hashtable<String, PermissionValue>();
 
-//    private String permId1;
-//    private String permId2;
-
     /*
      * This method is called only by the parent class, AbstractServiceTestImpl
      */
@@ -141,10 +133,6 @@ public class MultiTenancyTest extends AbstractServiceTestImpl {
 
     @BeforeClass(alwaysRun = true)
     public void seedData() {
-        if (logger.isDebugEnabled()) {
-            testBanner("seedData", CLASS_NAME);
-        }
-
         //tenant admin users are used to create accounts, roles and permissions and relationships
         //assumption : two tenant admin users exist before running this test
         tenantAdminUsers.put(TENANT_1, new UserInfo(TENANT_1_ADMIN_USER, TENANT_ADMIN_PASS));
@@ -234,7 +222,6 @@ public class MultiTenancyTest extends AbstractServiceTestImpl {
     }
 
     private void seedAccountRoles() {
-
         for (String tenantId : tenantAccounts.keySet()) {
             AccountValue av = (AccountValue) tenantAccounts.get(tenantId);
             seedAccountRole(tenantId, av.getUserId());
@@ -251,7 +238,6 @@ public class MultiTenancyTest extends AbstractServiceTestImpl {
     }
 
     private void seedPermissionRoles() {
-
         for (String tenantId : tenantPermissions.keySet()) {
             PermissionValue pv = tenantPermissions.get(tenantId);
             seedPermissionRole(tenantId, pv.getPermissionId());
@@ -269,7 +255,6 @@ public class MultiTenancyTest extends AbstractServiceTestImpl {
         }
     }
 
-
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
@@ -282,33 +267,20 @@ public class MultiTenancyTest extends AbstractServiceTestImpl {
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-    protected AbstractCommonList getAbstractCommonList(
+    protected AbstractCommonList getCommonList(
             ClientResponse<AbstractCommonList> response) {
         //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
         throw new UnsupportedOperationException();
     }
 
-    @Test(dataProvider = "testName")
-    @Override
-    public void readPaginatedList(String testName) throws Exception {
-        //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
-    }
     // ---------------------------------------------------------------
     // CRUD tests : CREATE tests
     // ---------------------------------------------------------------
     // Success outcomes
 
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+    @Test(dataProvider = "testName")
     public void create(String testName) throws Exception {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-
-        ClientResponse<Response> res = create(testName, TENANT_1_USER, TENANT_1);
-
-        TENANT_RESOURCE_1 = extractId(res);
-
+       TENANT_RESOURCE_1 = create(testName, TENANT_1_USER, TENANT_1);
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": tenantId= " + TENANT_1
                     + " userId=" + TENANT_1_USER
@@ -316,15 +288,9 @@ public class MultiTenancyTest extends AbstractServiceTestImpl {
         }
     }
 
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+    @Test(dataProvider = "testName")
     public void create2(String testName) throws Exception {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-
-        ClientResponse<Response> res = create(testName, TENANT_2_USER, TENANT_2);
-
-        TENANT_RESOURCE_2 = extractId(res);
+       TENANT_RESOURCE_2 = create(testName, TENANT_2_USER, TENANT_2);
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": tenantId= " + TENANT_2
                     + " userId=" + TENANT_2_USER
@@ -332,65 +298,49 @@ public class MultiTenancyTest extends AbstractServiceTestImpl {
         }
     }
 
-    private ClientResponse<Response> create(String testName, String userName, String tenatnId) {
+    private String create(String testName, String userName, String tenatnId) {
+       String result = null;
+       
         setupCreate();
-        // Submit the request to the service and store the response.
+        //
+        // Create a new client and change the default AuthN credentials
+        //
         DimensionClient client = new DimensionClient();
         client.setAuth(true, userName, true, userName, true);
+        //
+        // Setup a dimension object to create
+        //
         String identifier = createIdentifier();
         DimensionsCommon dimension = new DimensionsCommon();
         dimension.setDimension("dimensionType");
         dimension.setMeasurementUnit("measurementUnit-" + identifier);
         dimension.setValueDate(new Date().toString());
+        //
+        // Create a payload and send the POST request
+        //
         PoxPayloadOut multipart = DimensionFactory.createDimensionInstance(client.getCommonPartName(),
                 dimension);
         ClientResponse<Response> res = client.create(multipart);
-        int statusCode = res.getStatus();
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": status = " + statusCode);
+        try {
+               assertStatusCode(res, testName);
+               result = extractId(res);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, Response.Status.CREATED.getStatusCode());
-        return res;
 
-    }
+        return result;
 
-    //to not cause uniqueness violation for permRole, createList is removed
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
-    public void createList(String testName) throws Exception {
-    }
-
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-    @Override
-    public void createWithEmptyEntityBody(String testName) throws Exception {
-    }
-
-    @Override
-    public void createWithMalformedXml(String testName) throws Exception {
-    }
-
-    @Override
-    public void createWithWrongXmlSchema(String testName) throws Exception {
     }
 
     // ---------------------------------------------------------------
     // CRUD tests : READ tests
     // ---------------------------------------------------------------
     // Success outcomes
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"create"})
     public void read(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         DimensionsCommon dimension = read(testName, TENANT_RESOURCE_1, TENANT_1_USER);
         Assert.assertNotNull(dimension);
         if (logger.isDebugEnabled()) {
@@ -400,13 +350,9 @@ public class MultiTenancyTest extends AbstractServiceTestImpl {
         }
     }
 
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create2"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"create2"})
     public void read2(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         DimensionsCommon dimension = read(testName, TENANT_RESOURCE_2, TENANT_2_USER);
         Assert.assertNotNull(dimension);
         if (logger.isDebugEnabled()) {
@@ -417,159 +363,110 @@ public class MultiTenancyTest extends AbstractServiceTestImpl {
     }
 
     private DimensionsCommon read(String testName, String id, String userName) throws Exception {
-        setupRead();
+       DimensionsCommon result = null;
+       
+       setupRead();
         // Submit the request to the service and store the response.
         DimensionClient client = new DimensionClient();
         client.setAuth(true, userName, true, userName, true);
         ClientResponse<String> res = client.read(id);
-        assertStatusCode(res, testName);
+        try {
+               assertStatusCode(res, testName);
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               result = (DimensionsCommon) extractPart(input,
+                       client.getCommonPartName(), DimensionsCommon.class);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
         
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        return (DimensionsCommon) extractPart(input,
-                client.getCommonPartName(), DimensionsCommon.class);
-    }
-    // Failure outcomes
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
-    public void readNonExistent(String testName) throws Exception {
-
-        // Perform setup.
-        setupReadNonExistent();
+        return result;
     }
 
     // ---------------------------------------------------------------
     // CRUD tests : READ_LIST tests
     // ---------------------------------------------------------------
-    // Success outcomes
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList", "read"})
-    public void readList(String testName) throws Exception {
-        setupReadList();
-    }
-
-    // Failure outcomes
-    // None at present.
-    // ---------------------------------------------------------------
-    // CRUD tests : UPDATE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read", "readList", "readNonExistent"})
-    public void update(String testName) throws Exception {
-        setupUpdate();
-
-    }
 
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-    @Override
-    public void updateWithEmptyEntityBody(String testName) throws Exception {
-    }
-
-    @Override
-    public void updateWithMalformedXml(String testName) throws Exception {
-    }
-
-    @Override
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read2", "readNonExistent", "testSubmitRequest"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"read2"})
     public void updateNonExistent(String testName) throws Exception {
-
+       
+       setupUpdateNonExistent();
+       //
+       // Create a new client and change the default AuthN credentials
+       //
         DimensionClient client = new DimensionClient();
         //TENANT_1_USER is not allowed to update the resource of TENANT_2
         client.setAuth(true, TENANT_1_USER, true, TENANT_1_USER, true);
-
+        //
+        // Create a new dimension object to try to update
+        //
         DimensionsCommon dimension = new DimensionsCommon();
         dimension.setDimension("dimensionType");
         // Update the content of this resource.
         dimension.setMeasurementUnit("updated-" + dimension.getMeasurementUnit());
         dimension.setValueDate("updated-" + dimension.getValueDate());
-        // Submit the request to the service and store the response.
+        //
+        // Create and send a dimension payload for the UPDATE request
+        //
         PoxPayloadOut output = new PoxPayloadOut(DimensionClient.SERVICE_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = output.addPart(dimension, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getCommonPartName());
-
+        PayloadOutputPart commonPart = output.addPart(client.getCommonPartName(), dimension);
         ClientResponse<String> res = client.update(TENANT_RESOURCE_2, output);
-        int statusCode = res.getStatus();
-        // Check the status code of the response: does it match the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + " resource = " + TENANT_RESOURCE_2
-                    + " status = " + statusCode);
+        try {
+               assertStatusCode(res, testName);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        //going to incorrect Nuxeo domain would give DocumentNotFoundException
-        //instead of giving FORBIDDEN
-        Assert.assertEquals(statusCode, Response.Status.NOT_FOUND.getStatusCode());
     }
 
     // ---------------------------------------------------------------
     // CRUD tests : DELETE tests
     // ---------------------------------------------------------------
     // Success outcomes
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"deleteNonExistent"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"deleteNonExistent"})
     public void delete(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-
         int statusCode = delete(testName, TENANT_RESOURCE_1, TENANT_1_USER);
     }
 
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"updateNonExistent"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"updateNonExistent"})
     public void delete2(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         int statusCode = delete(testName, TENANT_RESOURCE_2, TENANT_2_USER);
 
     }
 
     private int delete(String testName, String id, String userName) throws Exception {
+       int result = -1;
+       
         // Perform setup.
         setupDelete();
         // Submit the request to the service and store the response.
         DimensionClient client = new DimensionClient();
         client.setAuth(true, userName, true, userName, true);
         ClientResponse<Response> res = client.delete(id);
-        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);
+        try {
+               result = assertStatusCode(res, testName);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        return statusCode;
+        
+        return result;
     }
 
     // Failure outcomes
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"read"})
     public void deleteNonExistent(String testName) throws Exception {
         //ignoring this test as the service side returns 200 now even if it does
         //not find a record in the db
 
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
+       // Perform setup.
         setupDelete();
 
         // Submit the request to the service and store the response.
@@ -577,49 +474,30 @@ public class MultiTenancyTest extends AbstractServiceTestImpl {
         //TENANT_2_USER of TENANT_2 is not allowed to delete the resource of TENANT_1
         client.setAuth(true, TENANT_2_USER, true, TENANT_2_USER, true);
         ClientResponse<Response> res = client.delete(TENANT_RESOURCE_1);
-        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);
+        try {
+               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));
+               //going to incorrect Nuxeo domain would give DocumentNotFoundException
+               //instead of giving FORBIDDEN
+               Assert.assertEquals(statusCode, Response.Status.NOT_FOUND.getStatusCode());
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        //going to incorrect Nuxeo domain would give DocumentNotFoundException
-        //instead of giving FORBIDDEN
-        Assert.assertEquals(statusCode, Response.Status.NOT_FOUND.getStatusCode());
     }
     
-    // ---------------------------------------------------------------
-    // Search tests
-    // ---------------------------------------------------------------
-    
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
-    public void searchWorkflowDeleted(String testName) throws Exception {
-        // Fixme: null test for now, overriding test in base class
-    } 
-
-    // ---------------------------------------------------------------
-    // Utility tests : tests of code used in tests above
-    // ---------------------------------------------------------------
-    /**
-     * Tests the code for manually submitting data that is used by several
-     * of the methods above.
-     */
-    @Test(dependsOnMethods = {"create"})
-    public void testSubmitRequest() throws Exception {
-    }
-
     // ---------------------------------------------------------------
     // Utility methods used by tests above
     // ---------------------------------------------------------------
     @AfterClass(alwaysRun = true)
     public void cleanUp() {
-        if (logger.isDebugEnabled()) {
-            testBanner("cleanUp", CLASS_NAME);
-        }
         setupDelete();
         String noTest = System.getProperty("noTestCleanup");
         if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
@@ -644,7 +522,6 @@ public class MultiTenancyTest extends AbstractServiceTestImpl {
     }
 
     private void deletePermissionRoles() {
-
         for (String tenantId : tenantPermissions.keySet()) {
             List<RoleValue> tenantRoleValues = new ArrayList<RoleValue>();
             tenantRoleValues.add(tenantRoles.get(tenantId));
@@ -677,7 +554,6 @@ public class MultiTenancyTest extends AbstractServiceTestImpl {
     }
 
     private void deleteAccounts() {
-
         for (String tenantId : tenantAccounts.keySet()) {
             AccountValue av = tenantAccounts.get(tenantId);
             deleteAccount(tenantId, av.getAccountId());
@@ -686,6 +562,8 @@ public class MultiTenancyTest extends AbstractServiceTestImpl {
 
     private String createPermission(String tenantId, String resName,
             List<PermissionAction> actions, EffectType effect) {
+       String result = null;
+       
         setupCreate();
         PermissionClient permClient = new PermissionClient();
         UserInfo ui = tenantAdminUsers.get(tenantId);
@@ -695,16 +573,16 @@ public class MultiTenancyTest extends AbstractServiceTestImpl {
                 actions, effect, true, true, true);
         permission.setTenantId(tenantId);
         ClientResponse<Response> res = permClient.create(permission);
-        int statusCode = res.getStatus();
-        if (logger.isDebugEnabled()) {
-            logger.debug("createPermission: resName=" + resName
-                    + " status = " + statusCode);
+        try {
+               assertStatusCode(res, "CreatePermission");
+               result = extractId(res);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        res.releaseConnection();
-        return extractId(res);
+        
+        return result;
     }
 
     private void deletePermission(String tenantId, String permId) {
@@ -713,18 +591,18 @@ public class MultiTenancyTest extends AbstractServiceTestImpl {
         UserInfo ui = tenantAdminUsers.get(tenantId);
         permClient.setAuth(true, ui.userName, true, ui.password, true);
         ClientResponse<Response> res = permClient.delete(permId);
-        int statusCode = res.getStatus();
-        if (logger.isDebugEnabled()) {
-            logger.debug("deletePermission: delete permission id="
-                    + permId + " status=" + statusCode);
+        try {
+               assertStatusCode(res, "DeletePermission");
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        res.releaseConnection();
     }
 
     private String createRole(String tenantId, String roleName) {
+       String result = null;
+       
         setupCreate();
         RoleClient roleClient = new RoleClient();
         UserInfo ui = tenantAdminUsers.get(tenantId);
@@ -734,16 +612,16 @@ public class MultiTenancyTest extends AbstractServiceTestImpl {
                 "role for " + roleName, true);
         role.setTenantId(tenantId);
         ClientResponse<Response> res = roleClient.create(role);
-        int statusCode = res.getStatus();
-        if (logger.isDebugEnabled()) {
-            logger.debug("createRole: name=" + roleName
-                    + " status = " + statusCode);
+        try {
+               assertStatusCode(res, "CreateRole");
+               result = extractId(res);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        res.releaseConnection();
-        return extractId(res);
+        
+        return result;
     }
 
     private void deleteRole(String tenantId, String roleId) {
@@ -752,18 +630,18 @@ public class MultiTenancyTest extends AbstractServiceTestImpl {
         UserInfo ui = tenantAdminUsers.get(tenantId);
         roleClient.setAuth(true, ui.userName, true, ui.password, true);
         ClientResponse<Response> res = roleClient.delete(roleId);
-        int statusCode = res.getStatus();
-        if (logger.isDebugEnabled()) {
-            logger.debug("deleteRole: delete role id=" + roleId
-                    + " status=" + statusCode);
+        try {
+               assertStatusCode(res, "DeleteRole");
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        res.releaseConnection();
     }
 
     private String createAccount(String tenantId, String userName, String email) {
+       String result = null;
+       
         setupCreate();
         AccountClient accountClient = new AccountClient();
         UserInfo ui = tenantAdminUsers.get(tenantId);
@@ -772,16 +650,16 @@ public class MultiTenancyTest extends AbstractServiceTestImpl {
                 userName, userName, userName, email, tenantId,
                 true, false, true, true);
         ClientResponse<Response> res = accountClient.create(account);
-        int statusCode = res.getStatus();
-        if (logger.isDebugEnabled()) {
-            logger.debug("createAccount: tenantId=" + tenantId + " userName=" + userName
-                    + " status = " + statusCode);
+        try {
+               assertStatusCode(res, "CreateAccount");
+               result = extractId(res);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        res.releaseConnection();
-        return extractId(res);
+        
+        return result;
     }
 
     private void deleteAccount(String tenantId, String accId) {
@@ -790,21 +668,20 @@ public class MultiTenancyTest extends AbstractServiceTestImpl {
         UserInfo ui = tenantAdminUsers.get(tenantId);
         accClient.setAuth(true, ui.userName, true, ui.password, true);
         ClientResponse<Response> res = accClient.delete(accId);
-        int statusCode = res.getStatus();
-        if (logger.isDebugEnabled()) {
-            logger.debug("deleteAccount: delete account id="
-                    + accId + " status=" + statusCode);
+        try {
+               assertStatusCode(res, "DeleteAccount");
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        res.releaseConnection();
     }
 
     private String createAccountRole(String tenantId, AccountValue av,
             Collection<RoleValue> rvs) {
+       String result = null;
+       
         setupCreate();
-
         // Submit the request to the service and store the response.
         AccountRole accRole = AccountRoleFactory.createAccountRoleInstance(
                 av, rvs, true, true);
@@ -812,16 +689,16 @@ public class MultiTenancyTest extends AbstractServiceTestImpl {
         UserInfo ui = tenantAdminUsers.get(tenantId);
         client.setAuth(true, ui.userName, true, ui.password, true);
         ClientResponse<Response> res = client.create(av.getAccountId(), accRole);
-        int statusCode = res.getStatus();
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("createAccountRole: status = " + statusCode);
+        try {
+               assertStatusCode(res, "CreateAccountRole");
+               result = extractId(res);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        res.releaseConnection();
-        return extractId(res);
+
+        return result;
     }
 
     private void deleteAccountRole(String tenantId, AccountValue av,
@@ -835,23 +712,20 @@ public class MultiTenancyTest extends AbstractServiceTestImpl {
         client.setAuth(true, ui.userName, true, ui.password, true);
         AccountRole accRole = AccountRoleFactory.createAccountRoleInstance(
                 av, rvs, true, true);
-        ClientResponse<Response> res = client.delete(
-                av.getAccountId());
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug("deleteAccountRole: status = " + statusCode);
+        ClientResponse<Response> res = client.delete(av.getAccountId());
+        try {
+               assertStatusCode(res, "DeleteAccountRole");
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        res.releaseConnection();
     }
 
     private String createPermissionRole(String tenantId, PermissionValue pv,
             Collection<RoleValue> rvs) {
+       String result = null;
+       
         setupCreate();
         List<RoleValue> rvls = new ArrayList<RoleValue>();
         rvls.addAll(rvs);
@@ -861,20 +735,19 @@ public class MultiTenancyTest extends AbstractServiceTestImpl {
         UserInfo ui = tenantAdminUsers.get(tenantId);
         client.setAuth(true, ui.userName, true, ui.password, true);
         ClientResponse<Response> res = client.create(pv.getPermissionId(), permRole);
-        int statusCode = res.getStatus();
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("createPermissionRole: status = " + statusCode);
+        try {
+               assertStatusCode(res, "createPermissionRole");
+               result = extractId(res);
+        }  finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        res.releaseConnection();
-        return extractId(res);
+        
+        return result;
     }
 
     private void deletePermissionRole(String tenantId, PermissionValue pv, List<RoleValue> rvls) {
-
         // Perform setup.
         setupDelete();
 
@@ -885,17 +758,13 @@ public class MultiTenancyTest extends AbstractServiceTestImpl {
         PermissionRole permRole = PermissionRoleFactory.createPermissionRoleInstance(
                 pv, rvls, true, true);
         ClientResponse<Response> res = client.delete(pv.getPermissionId());
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug("deletePermissionRole : status = " + statusCode);
+        try {
+               assertStatusCode(res, "DeletePermissionRole");
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        res.releaseConnection();
     }
 
        @Override
@@ -903,4 +772,10 @@ public class MultiTenancyTest extends AbstractServiceTestImpl {
                // TODO Auto-generated method stub
        throw new UnsupportedOperationException();
        }
+
+       @Override
+       protected Class<AbstractCommonList> getCommonListType() {
+               // TODO Auto-generated method stub
+               throw new UnsupportedOperationException();
+       }
 }
index 42f2b3cdd9d99d1156694afbfd0fb10fb25cfafc..5f66bdc6a842fcec1dec23e6b4a655ee4a3ad62a 100644 (file)
@@ -59,7 +59,6 @@
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>5.6</version>
         </dependency>
         <dependency>
             <groupId>org.jboss.resteasy</groupId>
index 90cc6f74e302480757186bd6a159dbfa4153ccbf..25d336904e0e9b13ccdd15f26feae348f15c7ea4 100644 (file)
  */
 package org.collectionspace.services.client;
 
+import org.collectionspace.services.taxonomy.TaxonCommon;
+
 /**
  * The Class TaxonomyAuthorityClient.
  */
-public class TaxonomyAuthorityClient extends AuthorityClientImpl<TaxonomyAuthorityProxy> {
+public class TaxonomyAuthorityClient extends AuthorityClientImpl<TaxonCommon, TaxonomyAuthorityProxy> {
 
     public static final String SERVICE_NAME = "taxonomyauthority";
     public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;
@@ -67,4 +69,14 @@ public class TaxonomyAuthorityClient extends AuthorityClientImpl<TaxonomyAuthori
     public Class<TaxonomyAuthorityProxy> getProxyClass() {
         return TaxonomyAuthorityProxy.class;
     }
+
+       @Override
+       public String getInAuthority(TaxonCommon item) {
+               return item.getInAuthority();
+       }
+
+       @Override
+       public void setInAuthority(TaxonCommon item, String inAuthorityCsid) {
+               item.setInAuthority(inAuthorityCsid);
+       }
 }
index f9c92a4572b907d4551f776471f5b3cf220b6eec..774bebbca4918d4ecddb493ea07fcf2c846b3d62 100644 (file)
@@ -2,8 +2,6 @@ package org.collectionspace.services.client;
 
 import java.io.File;
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
 import java.util.Map;
 
 import javax.ws.rs.core.MediaType;
@@ -21,7 +19,6 @@ import org.dom4j.DocumentException;
 import org.jboss.resteasy.client.ClientResponse;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.testng.Assert;
 
 public class TaxonomyAuthorityClientUtils {
 
index 4ed239c7f130a555c93064787ebec1e0537d34db..8650b4c54607c042accbafdd1a72092539617568 100644 (file)
  */
 package org.collectionspace.services.client.test;
 
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
 import org.collectionspace.services.TaxonJAXBSchema;
+import org.collectionspace.services.client.AbstractCommonListUtils;
 import org.collectionspace.services.client.AuthorityClient;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.PayloadOutputPart;
@@ -35,7 +35,7 @@ import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.client.TaxonomyAuthorityClient;
 import org.collectionspace.services.client.TaxonomyAuthorityClientUtils;
-import org.collectionspace.services.common.AbstractCommonListUtils;
+import org.collectionspace.services.client.TaxonomyAuthorityProxy;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.taxonomy.TaxonAuthorGroup;
 import org.collectionspace.services.taxonomy.TaxonAuthorGroupList;
@@ -43,7 +43,6 @@ import org.collectionspace.services.taxonomy.TaxonCitationList;
 import org.collectionspace.services.taxonomy.TaxonomyauthorityCommon;
 import org.collectionspace.services.taxonomy.TaxonCommon;
 
-import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import org.jboss.resteasy.client.ClientResponse;
 
@@ -61,7 +60,7 @@ import org.testng.annotations.Test;
  * $LastChangedRevision$
  * $LastChangedDate$
  */
-public class TaxonomyAuthorityServiceTest extends AbstractServiceTestImpl { //FIXME: Test classes for Vocab, Person, Org, and Taxonomy should have a base class!
+public class TaxonomyAuthorityServiceTest extends AbstractAuthorityServiceTest<TaxonomyauthorityCommon, TaxonCommon> {
 
     /** The logger. */
     private final String CLASS_NAME = TaxonomyAuthorityServiceTest.class.getName();
@@ -69,19 +68,6 @@ public class TaxonomyAuthorityServiceTest extends AbstractServiceTestImpl { //FI
     private final String REFNAME = "refName";
     private final String DISPLAYNAME = "displayName";
 
-    @Override
-    public String getServicePathComponent() {
-        return TaxonomyAuthorityClient.SERVICE_PATH_COMPONENT;
-    }
-
-    @Override
-    protected String getServiceName() {
-        return TaxonomyAuthorityClient.SERVICE_NAME;
-    }
-
-    public String getItemServicePathComponent() {
-        return AuthorityClient.ITEMS;
-    }
     final String TEST_SHORTID = "CentauruspleurexanthemusGreen1832";
     final String TEST_TERM_STATUS = "accepted";
     final String TEST_TAXON_FULL_NAME = "Centaurus pleurexanthemus Green 1832";
@@ -97,132 +83,30 @@ public class TaxonomyAuthorityServiceTest extends AbstractServiceTestImpl { //FI
     final String TEST_TAXON_IS_NAMED_HYBRID = "false";
     final TaxonAuthorGroupList NULL_TAXON_AUTHOR_GROUP_LIST = null;
     final TaxonCitationList NULL_TAXON_CITATION_LIST = null;
-    /** The known resource id. */
-    private String knownResourceId = null;
+    
     private String knownResourceShortIdentifer = null;
-    private String knownResourceRefName = null;
     private String knownTaxonomyTypeRefName = null;
-    private String knownItemResourceId = null;
-    private String knownItemResourceShortIdentifer = null;
-    /** The n items to create in list. */
-    private int nItemsToCreateInList = 3;
-    /** The all resource ids created. */
-    private List<String> allResourceIdsCreated = new ArrayList<String>();
-    /** The all item resource ids created. */
-    private Map<String, String> allItemResourceIdsCreated =
-            new HashMap<String, String>();
-
-    protected void setKnownResource(String id, String shortIdentifer,
-            String refName) {
-        knownResourceId = id;
-        knownResourceShortIdentifer = shortIdentifer;
-        knownResourceRefName = refName;
-    }
-
-    protected void setKnownItemResource(String id, String shortIdentifer) {
-        knownItemResourceId = id;
-        knownItemResourceShortIdentifer = shortIdentifer;
-    }
 
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
-     */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
-        return new TaxonomyAuthorityClient();
+    public String getServicePathComponent() {
+        return TaxonomyAuthorityClient.SERVICE_PATH_COMPONENT;
     }
 
     @Override
-    protected PoxPayloadOut createInstance(String identifier) {
-        TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
-        String shortId = identifier;
-        String displayName = "displayName-" + shortId;
-        String baseRefName =
-                TaxonomyAuthorityClientUtils.createTaxonomyAuthRefName(shortId, null);
-        PoxPayloadOut multipart =
-                TaxonomyAuthorityClientUtils.createTaxonomyAuthorityInstance(
-                displayName, shortId, client.getCommonPartName());
-        return multipart;
+    protected String getServiceName() {
+        return TaxonomyAuthorityClient.SERVICE_NAME;
     }
 
-    // ---------------------------------------------------------------
-    // CRUD tests : CREATE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
+    public String getItemServicePathComponent() {
+        return AuthorityClient.ITEMS;
+    }
+        
     /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
+     * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"create"})
-    public void create(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup, such as initializing the type of service request
-        // (e.g. CREATE, DELETE), its valid and expected status codes, and
-        // its associated HTTP method name (e.g. POST, DELETE).
-        setupCreate();
-
-        // Submit the request to the service and store the response.
-        TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
-        String shortId = createIdentifier();
-        String displayName = "displayName-" + shortId;
-        // String baseRefName =
-        //        TaxonomyAuthorityClientUtils.createTaxonomyAuthRefName(shortId, null);
-        final String EMPTY_REFNAME = "";
-        PoxPayloadOut multipart =
-                TaxonomyAuthorityClientUtils.createTaxonomyAuthorityInstance(
-                displayName, shortId, client.getCommonPartName());
-        String newID = null;
-        ClientResponse<Response> res = client.create(multipart);
-        try {
-            int statusCode = res.getStatus();
-
-            // Check the status code of the response: does it match
-            // the expected response(s)?
-            //
-            // Specifically:
-            // Does it fall within the set of valid status codes?
-            // Does it exactly match the expected status code?
-            if (logger.isDebugEnabled()) {
-                logger.debug(testName + ": status = " + statusCode);
-            }
-            Assert.assertTrue(this.REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(this.REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, this.EXPECTED_STATUS_CODE);
-
-            newID = TaxonomyAuthorityClientUtils.extractId(res);
-        } finally {
-            res.releaseConnection();
-        }
-        // Store the ID returned from the first resource created
-        // for additional tests below.
-        if (knownResourceId == null) {
-            setKnownResource(newID, shortId, EMPTY_REFNAME);
-            if (logger.isDebugEnabled()) {
-                logger.debug(testName + ": knownResourceId=" + knownResourceId);
-            }
-        }
-        // Store the IDs from every resource created by tests,
-        // so they can be deleted after tests have been run.
-        allResourceIdsCreated.add(newID);
-    }
-
-    /**
-     * Creates the item.
-     *
-     * @param testName the test name
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"create"}, dependsOnMethods = {"create"})
-    public void createItem(String testName) {
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        setupCreate();
-        createItemInAuthority(knownResourceId, knownResourceRefName);
+    protected CollectionSpaceClient<AbstractCommonList, PoxPayloadOut, String, TaxonomyAuthorityProxy> getClientInstance() {
+        return new TaxonomyAuthorityClient();
     }
 
     /**
@@ -236,7 +120,7 @@ public class TaxonomyAuthorityServiceTest extends AbstractServiceTestImpl { //FI
 
         final String testName = "createItemInAuthority(" + vcsid + "," + authRefName + ")";
         if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
+            logger.debug(getTestBanner(testName, CLASS_NAME));
         }
 
         // Submit the request to the service and store the response.
@@ -287,278 +171,112 @@ public class TaxonomyAuthorityServiceTest extends AbstractServiceTestImpl { //FI
         // Store the IDs from any item resources created
         // by tests, along with the IDs of their parents, so these items
         // can be deleted after all tests have been run.
-        allItemResourceIdsCreated.put(newID, vcsid);
+        allResourceItemIdsCreated.put(newID, vcsid);
 
         return newID;
     }
 
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
-     */
-    @Override
-    public void createWithEmptyEntityBody(String testName) throws Exception {
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
-     */
-    @Override
-    public void createWithMalformedXml(String testName) throws Exception {
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
-     */
-    @Override
-    public void createWithWrongXmlSchema(String testName) throws Exception {
-    }
-
-    // ---------------------------------------------------------------
-    // CRUD tests : CREATE LIST tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"createList"}, dependsOnGroups = {"create"})
-    public void createList(String testName) throws Exception {
-        for (int i = 0; i < nItemsToCreateInList; i++) {
-            create(testName);
-        }
-    }
-
-    /**
-     * Creates the item list.
-     *
-     * @param testName the test name
-     * @throws Exception the exception
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"createList"}, dependsOnMethods = {"createList"})
-    public void createItemList(String testName) throws Exception {
-        // Add items to the initially-created, known parent record.
-        for (int j = 0; j < nItemsToCreateInList; j++) {
-            createItem(testName);
-        }
-    }
-
-    // ---------------------------------------------------------------
-    // CRUD tests : READ tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"read"}, dependsOnGroups = {"create"})
-    public void read(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupRead();
-
-        // Submit the request to the service and store the response.
-        TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
-        String newID = null;
-        ClientResponse<String> res = client.read(knownResourceId);
-        try {
-            assertStatusCode(res, testName);
-            //FIXME: remove the following try catch once Aron fixes signatures
-            try {
-                PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-                TaxonomyauthorityCommon taxonomyAuthority =
-                        (TaxonomyauthorityCommon) extractPart(input,
-                        client.getCommonPartName(), TaxonomyauthorityCommon.class);
-                Assert.assertNotNull(taxonomyAuthority);
-            } catch (Exception e) {
-                throw new RuntimeException(e);
-            }
-        } finally {
-            res.releaseConnection();
-        }
-    }
-
-    /**
-     * Read by name.
-     *
-     * @param testName the test name
-     * @throws Exception the exception
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"read"}, dependsOnGroups = {"create"})
-    public void readByName(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName + "(" + knownResourceShortIdentifer + ")", CLASS_NAME));
-        }
-        // Perform setup.
-        setupRead();
-
-        // Submit the request to the service and store the response.
-        TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
-        ClientResponse<String> res = client.readByName(knownResourceShortIdentifer);
-        try {
-            assertStatusCode(res, testName);
-            //FIXME: remove the following try catch once Aron fixes signatures
-            try {
-                PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-                TaxonomyauthorityCommon taxonomyAuthority = (TaxonomyauthorityCommon) extractPart(input,
-                        client.getCommonPartName(), TaxonomyauthorityCommon.class);
-                Assert.assertNotNull(taxonomyAuthority);
-            } catch (Exception e) {
-                throw new RuntimeException(e);
-            }
-        } finally {
-            res.releaseConnection();
-        }
-    }
-
     /**
-     * Read item.
+     * Verify item display name.
      *
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"read"}, dependsOnMethods = {"read"})
-    public void readItem(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupRead();
-
-        // Submit the request to the service and store the response.
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"readItem", "updateItem"})
+    public void verifyItemDisplayName(String testName) throws Exception {
+        //
+       // First read in our known resource
+       //
+       setupRead();
         TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
         ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
+        TaxonCommon taxon = null;
         try {
-            assertStatusCode(res, testName);
-            // Check whether we've received an authority item record.
+               assertStatusCode(res, testName);
+            // Check whether taxon has expected displayName.
             PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-            TaxonCommon taxon = (TaxonCommon) extractPart(input,
+            taxon = (TaxonCommon) extractPart(input,
                     client.getItemCommonPartName(), TaxonCommon.class);
             Assert.assertNotNull(taxon);
-            boolean showFull = true;
-            if (showFull && logger.isDebugEnabled()) {
-                logger.debug(testName + ": returned payload:");
-                logger.debug(objectAsXmlString(taxon, TaxonCommon.class));
-            }
-
-            // Check that this authority item record has the correct identifier
-            // pointing to its parent authority record.
-            Assert.assertNotNull(taxon.getInAuthority(), "inAuthority field value is unexpectedly null.");
-            Assert.assertEquals(taxon.getInAuthority(), knownResourceId,
-                    "Value of item's inAuthority field does not contain the correct identifier "
-                    + "pointing to its parent authority record.");
-
-            // Check individual fields in the authority item record.
-            Assert.assertNotNull(taxon.getTaxonFullName(), "Field value is unexpectedly null.");
-            Assert.assertEquals(taxon.getTaxonFullName(), TEST_TAXON_FULL_NAME,
-                    "Field value " + taxon.getTaxonFullName()
-                    + "does not match expected value " + TEST_TAXON_FULL_NAME);
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-    }
-
-    /**
-     * Verify item display name.
-     *
-     * @param testName the test name
-     * @throws Exception the exception
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"readItem", "updateItem"})
-    public void verifyItemDisplayName(String testName) throws Exception {
+        //
+        // Now setup for an update
+        //
+        String displayName = taxon.getDisplayName();
+        // Make sure displayName matches computed form
+        String expectedDisplayName =
+                TaxonomyAuthorityClientUtils.prepareDefaultDisplayName(TEST_TAXON_FULL_NAME);
+        Assert.assertNotNull(displayName, "Display name was null.  Expected it to be: " + expectedDisplayName);
+        // Update the shortName and verify the computed name is updated.
+        taxon.setCsid(null);
+        taxon.setDisplayNameComputed(true);
+        taxon.setTaxonFullName("updated-" + TEST_TAXON_FULL_NAME);
+        expectedDisplayName =
+                TaxonomyAuthorityClientUtils.prepareDefaultDisplayName("updated-" + TEST_TAXON_FULL_NAME);
+
+        // Create the update payload.
+        PoxPayloadOut output = new PoxPayloadOut(TaxonomyAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
+        PayloadOutputPart commonPart = output.addPart(client.getItemCommonPartName(), taxon);
 
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
         setupUpdate();
-
-        // Submit the request to the service and store the response.
-        TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
-        ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
+        res = client.updateItem(knownResourceId, knownItemResourceId, output);
+        TaxonCommon updatedTaxon = null;
         try {
-            assertStatusCode(res, testName);
-            // Check whether taxon has expected displayName.
-            PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-            TaxonCommon taxon = (TaxonCommon) extractPart(input,
-                    client.getItemCommonPartName(), TaxonCommon.class);
-            Assert.assertNotNull(taxon);
-            String displayName = taxon.getDisplayName();
-            // Make sure displayName matches computed form
-            String expectedDisplayName =
-                    TaxonomyAuthorityClientUtils.prepareDefaultDisplayName(TEST_TAXON_FULL_NAME);
-            Assert.assertNotNull(displayName, expectedDisplayName);
-
-            // Update the shortName and verify the computed name is updated.
-            taxon.setCsid(null);
-            taxon.setDisplayNameComputed(true);
-            taxon.setTaxonFullName("updated-" + TEST_TAXON_FULL_NAME);
-            expectedDisplayName =
-                    TaxonomyAuthorityClientUtils.prepareDefaultDisplayName("updated-" + TEST_TAXON_FULL_NAME);
-
-            // Submit the updated resource to the service and store the response.
-            PoxPayloadOut output = new PoxPayloadOut(TaxonomyAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
-            PayloadOutputPart commonPart = output.addPart(taxon, MediaType.APPLICATION_XML_TYPE);
-            commonPart.setLabel(client.getItemCommonPartName());
-            res.releaseConnection();
-            res = client.updateItem(knownResourceId, knownItemResourceId, output);
-            assertStatusCode(res, testName);
+               assertStatusCode(res, testName);
             // Retrieve the updated resource and verify that its contents exist.
-            input = new PoxPayloadIn(res.getEntity());
-            TaxonCommon updatedTaxon =
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+            updatedTaxon =
                     (TaxonCommon) extractPart(input,
                     client.getItemCommonPartName(), TaxonCommon.class);
             Assert.assertNotNull(updatedTaxon);
-
-            // Verify that the updated resource received the correct data.
-            Assert.assertEquals(updatedTaxon.getTaxonFullName(), taxon.getTaxonFullName(),
-                    "Updated ForeName in Taxonomy did not match submitted data.");
-            // Verify that the updated resource computes the right displayName.
-            Assert.assertEquals(updatedTaxon.getDisplayName(), expectedDisplayName,
-                    "Updated ForeName in Taxonomy not reflected in computed DisplayName.");
-
-            // Now Update the displayName, not computed and verify the computed name is overriden.
-            taxon.setDisplayNameComputed(false);
-            expectedDisplayName = "TestName";
-            taxon.setDisplayName(expectedDisplayName);
-
-            // Submit the updated resource to the service and store the response.
-            output = new PoxPayloadOut(TaxonomyAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
-            commonPart = output.addPart(taxon, MediaType.APPLICATION_XML_TYPE);
-            commonPart.setLabel(client.getItemCommonPartName());
-            res.releaseConnection();
-            res = client.updateItem(knownResourceId, knownItemResourceId, output);
-            assertStatusCode(res, testName);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
+        // Verify that the updated resource received the correct data.
+        Assert.assertEquals(updatedTaxon.getTaxonFullName(), taxon.getTaxonFullName(),
+                "Updated ForeName in Taxonomy did not match submitted data.");
+        // Verify that the updated resource computes the right displayName.
+        Assert.assertEquals(updatedTaxon.getDisplayName(), expectedDisplayName,
+                "Updated ForeName in Taxonomy not reflected in computed DisplayName.");
+        //
+        // Now Update the displayName, not computed and verify the computed name is overriden.
+        //
+        taxon.setDisplayNameComputed(false);
+        expectedDisplayName = "TestName";
+        taxon.setDisplayName(expectedDisplayName);
+
+        // Submit the updated resource to the service and store the response.
+        output = new PoxPayloadOut(TaxonomyAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
+        commonPart = output.addPart(client.getItemCommonPartName(), taxon);
+        setupUpdate(); // setup expected status code for result
+        res = client.updateItem(knownResourceId, knownItemResourceId, output);
+        try {
+               assertStatusCode(res, testName);
             // Retrieve the updated resource and verify that its contents exist.
-            input = new PoxPayloadIn(res.getEntity());
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
             updatedTaxon =
                     (TaxonCommon) extractPart(input,
                     client.getItemCommonPartName(), TaxonCommon.class);
             Assert.assertNotNull(updatedTaxon);
-
-            // Verify that the updated resource received the correct data.
-            Assert.assertEquals(updatedTaxon.isDisplayNameComputed(), false,
-                    "Updated displayNameComputed in Taxonomy did not match submitted data.");
-            // Verify that the updated resource computes the right displayName.
-            Assert.assertEquals(updatedTaxon.getDisplayName(),
-                    expectedDisplayName,
-                    "Updated DisplayName (not computed) in Taxonomy not stored.");
         } finally {
-            res.releaseConnection();
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
+        // Verify that the updated resource received the correct data.
+        Assert.assertEquals(updatedTaxon.isDisplayNameComputed(), false,
+                "Updated displayNameComputed in Taxonomy did not match submitted data.");
+        // Verify that the updated resource computes the right displayName.
+        Assert.assertEquals(updatedTaxon.getDisplayName(),
+                expectedDisplayName,
+                "Updated DisplayName (not computed) in Taxonomy not stored.");
     }
 
     /**
@@ -567,66 +285,88 @@ public class TaxonomyAuthorityServiceTest extends AbstractServiceTestImpl { //FI
      * @param testName the test name
      * @throws Exception the exception
      */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"verifyItemDisplayName"})
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"verifyItemDisplayName"})
     public void verifyIllegalItemDisplayName(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-
-        // Perform setup for read.
+        //
+       // First read in our known resource.
+       //
         setupRead();
-
-        // Submit the request to the service and store the response.
         TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
         ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
-        assertStatusCode(res, testName);
-        
-        // Perform setup for update.
-        testSetup(STATUS_BAD_REQUEST, ServiceRequestType.UPDATE);
-        
+        TaxonCommon taxon = null;
         try {
+            assertStatusCode(res, testName);
             // Check whether Taxonomy has expected displayName.
             PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-            TaxonCommon taxon = (TaxonCommon) extractPart(input,
+            taxon = (TaxonCommon) extractPart(input,
                     client.getItemCommonPartName(), TaxonCommon.class);
             Assert.assertNotNull(taxon);
-            // Try to Update with computed false and no displayName
-            taxon.setDisplayNameComputed(false);
-            taxon.setDisplayName(null);
-
-            // Submit the updated resource to the service and store the response.
-            PoxPayloadOut output = new PoxPayloadOut(TaxonomyAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
-            PayloadOutputPart commonPart = output.addPart(taxon, MediaType.APPLICATION_XML_TYPE);
-            commonPart.setLabel(client.getItemCommonPartName());
-            res.releaseConnection();
-            res = client.updateItem(knownResourceId, knownItemResourceId, output);
-            assertStatusCode(res, testName);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
+        //
+        // Try to Update with computed false and no displayName
+        //
+        taxon.setDisplayNameComputed(false);
+        taxon.setDisplayName(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);
         } finally {
             res.releaseConnection();
         }
     }
 
-    // Failure outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
+    /**
+     * Read item list.
      */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"read"}, dependsOnMethods = {"read"})
-    public void readNonExistent(String testName) {
+    @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";
 
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         // Perform setup.
-        setupReadNonExistent();
+        setupReadList();
 
         // Submit the request to the service and store the response.
         TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
-        ClientResponse<String> res = client.read(NON_EXISTENT_ID);
+        ClientResponse<AbstractCommonList> 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.getEntity();
             int statusCode = res.getStatus();
 
             // Check the status code of the response: does it match
@@ -634,142 +374,17 @@ public class TaxonomyAuthorityServiceTest extends AbstractServiceTestImpl { //FI
             if (logger.isDebugEnabled()) {
                 logger.debug(testName + ": status = " + statusCode);
             }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        } finally {
-            res.releaseConnection();
-        }
-    }
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
+            Assert.assertEquals(statusCode, testExpectedStatusCode);
 
-    /**
-     * Read item non existent.
-     *
-     * @param testName the test name
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"read"}, dependsOnMethods = {"readItem"})
-    public void readItemNonExistent(String testName) {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadNonExistent();
-
-        // Submit the request to the service and store the response.
-        TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
-        ClientResponse<String> res = client.readItem(knownResourceId, NON_EXISTENT_ID);
-        try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        } finally {
-            res.releaseConnection();
-        }
-    }
-
-    // ---------------------------------------------------------------
-    // CRUD tests : READ_LIST tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"readList"}, dependsOnGroups = {"createList", "read"})
-    public void readList(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadList();
-
-        // Submit the request to the service and store the response.
-        TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
-        ClientResponse<AbstractCommonList> res = client.readList();
-        try {
-            assertStatusCode(res, testName);
-               AbstractCommonList list = res.getEntity();
-            // Optionally output additional data about list members for debugging.
-            if(logger.isTraceEnabled()){
-               AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
-            }
-        } finally {
-            res.releaseConnection();
-        }
-    }
-
-    /**
-     * Read item list.
-     */
-    @Test(groups = {"readList"}, dependsOnMethods = {"readList"})
-    public void readItemList() {
-        String testName = "readItemList";
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        readItemList(knownResourceId, null);
-    }
-
-    /**
-     * Read item list by authority name.
-     */
-    @Test(groups = {"readList"}, dependsOnMethods = {"readItemList"})
-    public void readItemListByAuthorityName() {
-        String testName = "readItemListByAuthorityName";
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        readItemList(null, knownResourceShortIdentifer);
-    }
-
-    /**
-     * 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();
-        ClientResponse<AbstractCommonList> 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.getEntity();
             List<AbstractCommonList.ListItem> items =
                     list.getListItem();
             int nItemsReturned = items.size();
-            // There will be one item created, associated with a
-            // known parent resource, by the createItem test.
-            //
-            // In addition, there will be 'nItemsToCreateInList'
-            // additional items created by the createItemList test,
+            // There will be 'nItemsToCreateInList'
+            // items created by the createItemList test,
             // all associated with the same parent resource.
-            int nExpectedItems = nItemsToCreateInList + 1;
+            int nExpectedItems = nItemsToCreateInList;
             if (logger.isDebugEnabled()) {
                 logger.debug(testName + ": Expected "
                         + nExpectedItems + " items; got: " + nItemsReturned);
@@ -792,468 +407,28 @@ public class TaxonomyAuthorityServiceTest extends AbstractServiceTestImpl { //FI
         }
     }
 
-    // Failure outcomes
-    // None at present.
-    // ---------------------------------------------------------------
-    // CRUD tests : UPDATE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
-     */
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"update"}, dependsOnGroups = {"read", "readList"})
-    public void update(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdate();
-
-        // Retrieve the contents of a resource to update.
-        TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
-        ClientResponse<String> res = client.read(knownResourceId);
-        try {
-            if (logger.isDebugEnabled()) {
-                logger.debug(testName + ": read status = " + res.getStatus());
-            }
-            Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
-
-            if (logger.isDebugEnabled()) {
-                logger.debug("got TaxonomyAuthority to update with ID: " + knownResourceId);
-            }
-            PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-            TaxonomyauthorityCommon taxonomyAuthority = (TaxonomyauthorityCommon) extractPart(input,
-                    client.getCommonPartName(), TaxonomyauthorityCommon.class);
-            Assert.assertNotNull(taxonomyAuthority);
-
-            // Update the contents of this resource.
-            taxonomyAuthority.setDisplayName("updated-" + taxonomyAuthority.getDisplayName());
-            taxonomyAuthority.setVocabType("updated-" + taxonomyAuthority.getVocabType());
-            if (logger.isDebugEnabled()) {
-                logger.debug("to be updated TaxonomyAuthority");
-                logger.debug(objectAsXmlString(taxonomyAuthority, TaxonomyauthorityCommon.class));
-            }
-
-            // Submit the updated resource to the service and store the response.
-            PoxPayloadOut output = new PoxPayloadOut(TaxonomyAuthorityClient.SERVICE_PAYLOAD_NAME);
-            PayloadOutputPart commonPart = output.addPart(taxonomyAuthority, MediaType.APPLICATION_XML_TYPE);
-            commonPart.setLabel(client.getCommonPartName());
-            res.releaseConnection();
-            res = client.update(knownResourceId, output);
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
-            // Retrieve the updated resource and verify that its contents exist.
-            input = new PoxPayloadIn(res.getEntity());
-            TaxonomyauthorityCommon updatedTaxonomyAuthority =
-                    (TaxonomyauthorityCommon) extractPart(input,
-                    client.getCommonPartName(), TaxonomyauthorityCommon.class);
-            Assert.assertNotNull(updatedTaxonomyAuthority);
-
-            // Verify that the updated resource received the correct data.
-            Assert.assertEquals(updatedTaxonomyAuthority.getDisplayName(),
-                    taxonomyAuthority.getDisplayName(),
-                    "Data in updated object did not match submitted data.");
-        } finally {
-            res.releaseConnection();
-        }
-    }
-
-    /**
-     * Update item.
-     *
-     * @param testName the test name
-     * @throws Exception the exception
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"update"}, dependsOnMethods = {"update"})
-    public void updateItem(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdate();
-
-        // Retrieve the contents of a resource to update.
-        TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
-        ClientResponse<String> res =
-                client.readItem(knownResourceId, knownItemResourceId);
-        try {
-            assertStatusCode(res, testName);
-            if (logger.isDebugEnabled()) {
-                logger.debug("got Taxonomy to update with ID: "
-                        + knownItemResourceId
-                        + " in TaxonomyAuthority: " + knownResourceId);
-            }
-            PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-            TaxonCommon taxon = (TaxonCommon) extractPart(input,
-                    client.getItemCommonPartName(), TaxonCommon.class);
-            Assert.assertNotNull(taxon);
-
-            // Update the contents of this resource.
-            taxon.setCsid(null);
-            taxon.setTaxonFullName("updated-" + taxon.getTaxonFullName());
-            if (logger.isDebugEnabled()) {
-                logger.debug("to be updated Taxonomy");
-                logger.debug(objectAsXmlString(taxon,
-                        TaxonCommon.class));
-            }
-
-            // Submit the updated resource to the service and store the response.
-            PoxPayloadOut output = new PoxPayloadOut(TaxonomyAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
-            PayloadOutputPart commonPart = output.addPart(taxon, MediaType.APPLICATION_XML_TYPE);
-            commonPart.setLabel(client.getItemCommonPartName());
-            res.releaseConnection();
-            res = client.updateItem(knownResourceId, knownItemResourceId, output);
-            assertStatusCode(res, testName);
-
-            // Retrieve the updated resource and verify that its contents exist.
-            input = new PoxPayloadIn(res.getEntity());
-            TaxonCommon updatedTaxon =
-                    (TaxonCommon) extractPart(input,
-                    client.getItemCommonPartName(), TaxonCommon.class);
-            Assert.assertNotNull(updatedTaxon);
-
-            // Verify that the updated resource received the correct data.
-            Assert.assertEquals(updatedTaxon.getTaxonFullName(), taxon.getTaxonFullName(),
-                    "Data in updated Taxon did not match submitted data.");
-        } finally {
-            res.releaseConnection();
-        }
-    }
-
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
-     */
-    @Override
-    public void updateWithEmptyEntityBody(String testName) throws Exception {
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
-     */
     @Override
-    public void updateWithMalformedXml(String testName) throws Exception {
+    public void delete(String testName) throws Exception {
+       // Do nothing.  See localDelete().  This ensure proper test order.
     }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
-     */
-    @Override
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
+    
+    @Test(dataProvider = "testName", dependsOnMethods = {"localDeleteItem"})    
+    public void localDelete(String testName) throws Exception {
+       super.delete(testName);
     }
 
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
-     */
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"update"}, dependsOnMethods = {"update", "testSubmitRequest"})
-    public void updateNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdateNonExistent();
-
-        // Submit the request to the service and store the response.
-        // Note: The ID(s) used when creating the request payload may be arbitrary.
-        // The only relevant ID may be the one used in update(), below.
-        TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
-        String displayName = "displayName-NON_EXISTENT_ID";
-        PoxPayloadOut multipart = TaxonomyAuthorityClientUtils.createTaxonomyAuthorityInstance(
-                displayName, "nonEx", client.getCommonPartName());
-        ClientResponse<String> res =
-                client.update(NON_EXISTENT_ID, multipart);
-        try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        } finally {
-            res.releaseConnection();
-        }
-    }
-
-    /**
-     * Update non existent item.
-     *
-     * @param testName the test name
-     * @throws Exception the exception
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"update"}, dependsOnMethods = {"updateItem", "testItemSubmitRequest"})
-    public void updateNonExistentItem(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdateNonExistent();
-
-        // Submit the request to the service and store the response.
-        // Note: The ID used in this 'create' call may be arbitrary.
-        // The only relevant ID may be the one used in update(), below.
-        TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
-        Map<String, String> nonexMap = new HashMap<String, String>();
-        nonexMap.put(TaxonJAXBSchema.NAME, TEST_TAXON_FULL_NAME);
-        nonexMap.put(TaxonJAXBSchema.SHORT_IDENTIFIER, "nonEx");
-        nonexMap.put(TaxonJAXBSchema.TERM_STATUS, TEST_TERM_STATUS);
-        // PoxPayloadOut multipart =
-        //        TaxonomyAuthorityClientUtils.createTaxonInstance(
-        //        TaxonomyAuthorityClientUtils.createTaxonomyRefName(knownResourceRefName, "nonEx", "Non Existent"),
-        //        nonexMap, NULL_TAXON_AUTHOR_GROUP_LIST, NULL_TAXON_CITATION_LIST,
-        //        client.getItemCommonPartName());
-        final String EMPTY_REFNAME = "";
-        PoxPayloadOut multipart =
-                TaxonomyAuthorityClientUtils.createTaxonInstance(EMPTY_REFNAME,
-                nonexMap, NULL_TAXON_AUTHOR_GROUP_LIST, NULL_TAXON_CITATION_LIST,
-                client.getItemCommonPartName());
-        ClientResponse<String> res =
-                client.updateItem(knownResourceId, NON_EXISTENT_ID, multipart);
-        try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        } finally {
-            res.releaseConnection();
-        }
-    }
-
-    // ---------------------------------------------------------------
-    // CRUD tests : DELETE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    // Note: delete sub-resources in ascending hierarchical order,
-    // before deleting their parents.
-    /**
-     * Delete item.
-     *
-     * @param testName the test name
-     * @throws Exception the exception
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    //groups = {"delete"}, dependsOnGroups = {"create", "read", "readList", "readListByPartialTerm", "update"})
-    groups = {"delete"}, dependsOnGroups = {"create", "read", "readList", "update"})
     public void deleteItem(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDelete();
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("parentcsid =" + knownResourceId
-                    + " itemcsid = " + knownItemResourceId);
-        }
-
-        // Submit the request to the service and store the response.
-        TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
-        ClientResponse<Response> res =
-                client.deleteItem(knownResourceId, knownItemResourceId);
-        try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        } finally {
-            res.releaseConnection();
-        }
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
-     */
-    @Override
-    // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    // groups = {"delete"}, dependsOnMethods = {"deleteItem"})
-    public void delete(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDelete();
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("parentcsid =" + knownResourceId);
-        }
-
-        // Submit the request to the service and store the response.
-        TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
-        ClientResponse<Response> res = client.delete(knownResourceId);
-        try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        } finally {
-            res.releaseConnection();
-        }
-    }
-
-    // Failure outcomes
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
-     */
-    @Override
-    // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    // groups = {"delete"}, dependsOnMethods = {"delete"})
-    public void deleteNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDeleteNonExistent();
-
-        // Submit the request to the service and store the response.
-        TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
-        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
-        try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        } finally {
-            res.releaseConnection();
-        }
-    }
-
-    /**
-     * Delete non existent item.
-     *
-     * @param testName the test name
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    groups = {"delete"}, dependsOnMethods = {"deleteItem"})
-    public void deleteNonExistentItem(String testName) {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDeleteNonExistent();
-
-        // Submit the request to the service and store the response.
-        TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
-        ClientResponse<Response> res = client.deleteItem(knownResourceId, NON_EXISTENT_ID);
-        try {
-            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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        } finally {
-            res.releaseConnection();
-        }
-    }
-
-    // ---------------------------------------------------------------
-    // Utility tests : tests of code used in tests above
-    // ---------------------------------------------------------------
-    /**
-     * Tests the code for manually submitting data that is used by several
-     * of the methods above.
-     */
-    @Test(dependsOnMethods = {"create", "read"})
-    public void testSubmitRequest() {
-
-        // Expected status code: 200 OK
-        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
-
-        // Submit the request to the service and store the response.
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getResourceURL(knownResourceId);
-        int statusCode = submitRequest(method, url);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug("testSubmitRequest: url=" + url
-                    + " status=" + statusCode);
-        }
-        Assert.assertEquals(statusCode, EXPECTED_STATUS);
-
+       // 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 item submit request.
-     */
-    @Test(dependsOnMethods = {"createItem", "readItem", "testSubmitRequest"})
-    public void testItemSubmitRequest() {
-
-        // Expected status code: 200 OK
-        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
-
-        // Submit the request to the service and store the response.
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getItemResourceURL(knownResourceId, knownItemResourceId);
-        int statusCode = submitRequest(method, url);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug("testItemSubmitRequest: url=" + url
-                    + " status=" + statusCode);
-        }
-        Assert.assertEquals(statusCode, EXPECTED_STATUS);
-
+    
+    @Test(dataProvider = "testName", groups = {"delete"},
+       dependsOnMethods = {"verifyIllegalItemDisplayName"})
+    public void localDeleteItem(String testName) throws Exception {
+       super.deleteItem(testName);
     }
-
+    
     // ---------------------------------------------------------------
     // Cleanup of resources created during testing
     // ---------------------------------------------------------------
@@ -1283,7 +458,7 @@ public class TaxonomyAuthorityServiceTest extends AbstractServiceTestImpl { //FI
         TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
         parentResourceId = knownResourceId;
         // Clean up item resources.
-        for (Map.Entry<String, String> entry : allItemResourceIdsCreated.entrySet()) {
+        for (Map.Entry<String, String> entry : allResourceItemIdsCreated.entrySet()) {
             itemResourceId = entry.getKey();
             parentResourceId = entry.getValue();
             // Note: Any non-success responses from the delete operation
@@ -1338,4 +513,108 @@ public class TaxonomyAuthorityServiceTest extends AbstractServiceTestImpl { //FI
     protected String getItemResourceURL(String parentResourceIdentifier, String itemResourceIdentifier) {
         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) {
+        String shortId = identifier;
+        String displayName = "displayName-" + shortId;
+        String baseRefName =
+                TaxonomyAuthorityClientUtils.createTaxonomyAuthRefName(shortId, null);
+        PoxPayloadOut multipart =
+                TaxonomyAuthorityClientUtils.createTaxonomyAuthorityInstance(
+                displayName, shortId, commonPartName);
+        return multipart;
+       }
+       
+       @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 {
+        // Verify that the updated resource received the correct data.
+        Assert.assertEquals(updated.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 authorityItem) {
+               TaxonCommon result = new TaxonCommon();
+               
+        result.setDisplayName("updated-" + authorityItem.getTaxonFullName());
+        result.setTaxonFullName("updated-" + authorityItem.getTaxonFullName());
+               
+               return result;
+       }
+
+       @Override
+       protected void compareUpdatedItemInstances(TaxonCommon original,
+                       TaxonCommon updated) throws Exception {
+        Assert.assertEquals(updated.getTaxonFullName(), original.getTaxonFullName(),
+                "Taxon full name in updated Taxon 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()
+                + "does not match expected value " + TEST_TAXON_FULL_NAME);
+       }
+
+       @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");
+        nonexMap.put(TaxonJAXBSchema.TERM_STATUS, TEST_TERM_STATUS);
+        // PoxPayloadOut multipart =
+        //        TaxonomyAuthorityClientUtils.createTaxonInstance(
+        //        TaxonomyAuthorityClientUtils.createTaxonomyRefName(knownResourceRefName, "nonEx", "Non Existent"),
+        //        nonexMap, NULL_TAXON_AUTHOR_GROUP_LIST, NULL_TAXON_CITATION_LIST,
+        //        client.getItemCommonPartName());
+        final String EMPTY_REFNAME = "";
+        PoxPayloadOut result =
+                TaxonomyAuthorityClientUtils.createTaxonInstance(EMPTY_REFNAME,
+                nonexMap, NULL_TAXON_AUTHOR_GROUP_LIST, NULL_TAXON_CITATION_LIST,
+                commonPartName);
+               return result;
+       }
 }
index cbe760099210a58ccf5e0731761e5df3f2291aa4..ba3946b0546bf6a1fbd11cf48d287204ba08d537 100644 (file)
@@ -52,7 +52,6 @@
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>5.6</version>
         </dependency>
         
         <!-- apache -->
index e78eeeefc0ff525bfb1f6d15be49b3d37d3be80c..c1fbef4d12ce1f5755ab23bdd4220af1e132c37d 100644 (file)
@@ -44,7 +44,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>\r
         <dependency>\r
             <groupId>org.jboss.resteasy</groupId>\r
index 54d87bfb956fed13c3cf87623a8eb3e063768f6f..7aa09403c1dfbc09f37a3894811e82dd5c2b93b6 100644 (file)
  */
 package org.collectionspace.services.client;
 
+import org.collectionspace.services.vocabulary.VocabularyitemsCommon;
+
 /**
  * The Class VocabularyClient.
  */
-public class VocabularyClient extends AuthorityClientImpl<VocabularyProxy> {
+public class VocabularyClient extends AuthorityClientImpl<VocabularyitemsCommon, VocabularyProxy> {
        public static final String SERVICE_NAME = "vocabularies";
        public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;       
        public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
@@ -73,4 +75,14 @@ public class VocabularyClient extends AuthorityClientImpl<VocabularyProxy> {
     public String getCommonPartItemName() {
         return getCommonPartName(SERVICE_ITEM_PAYLOAD_NAME);
     }
+
+       @Override
+    public void setInAuthority(VocabularyitemsCommon item, String inAuthorityCsid) {
+               item.setInAuthority(inAuthorityCsid);
+       }
+       
+       @Override
+       public String getInAuthority(VocabularyitemsCommon item) {
+               return item.getInAuthority();
+       }
 }
index 5e62c178cd94d5e9277d2da3bc315b3c8269e35e..7bbc5c2cee0315208077cf42134017d1a372a126 100644 (file)
@@ -77,7 +77,7 @@ public class VocabularyClientUtils {
                                +"\" in personAuthority: \"" + vcsid +"\"");\r
        }\r
        PoxPayloadOut multipart = createVocabularyItemInstance(null, //vocabularyRefName,\r
-                               itemMap, client.getCommonPartItemName());\r
+                               itemMap, client.getItemCommonPartName());\r
        ClientResponse<Response> res = client.createItem(vcsid, multipart);\r
 \r
        int statusCode = res.getStatus();\r
index ad183f898b6ec59d293eed6adcbc8a6411d9118c..0ed1d47b48e2a1935ced3b4e90b99f3efc3575c1 100644 (file)
  */
 package org.collectionspace.services.client.test;
 
-import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
-import org.collectionspace.services.client.AuthorityClient;
-import org.collectionspace.services.common.AbstractCommonListUtils;
 import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.PayloadOutputPart;
@@ -38,15 +32,14 @@ import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.client.VocabularyClient;
 import org.collectionspace.services.client.VocabularyClientUtils;
-import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.vocabulary.VocabulariesCommon;
 import org.collectionspace.services.vocabulary.VocabularyitemsCommon;
 
 import org.jboss.resteasy.client.ClientResponse;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
-import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
 
 /**
@@ -56,7 +49,7 @@ import org.testng.annotations.Test;
  * $LastChangedRevision: 753 $
  * $LastChangedDate: 2009-09-23 11:03:36 -0700 (Wed, 23 Sep 2009) $
  */
-public class VocabularyServiceTest extends AbstractServiceTestImpl {
+public class VocabularyServiceTest extends AbstractAuthorityServiceTest<VocabulariesCommon, VocabularyitemsCommon> {
 
     private final String CLASS_NAME = VocabularyServiceTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
@@ -64,23 +57,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
     final String SERVICE_PATH_COMPONENT = VocabularyClient.SERVICE_PATH_COMPONENT;//"vocabularies";
     final String SERVICE_PAYLOAD_NAME = VocabularyClient.SERVICE_PAYLOAD_NAME;
     final String SERVICE_ITEM_PAYLOAD_NAME = VocabularyClient.SERVICE_ITEM_PAYLOAD_NAME;
-    private String knownResourceId = null;
-    private String knownResourceShortIdentifer = null;
-    //private String knownResourceRefName = null;
-    //private String knownResourceFullRefName = null;
-    private String knownItemResourceId = null;
-    private int nItemsToCreateInList = 5;
-//    private List<String> allResourceIdsCreated = new ArrayList<String>();
-//    private Map<String, String> allResourceItemIdsCreated =
-//            new HashMap<String, String>();
 
-    protected void setKnownResource(String id, String shortIdentifer,
-            String refName, String fullRefName) {
-        knownResourceId = id;
-        knownResourceShortIdentifer = shortIdentifer;
-        //knownResourceRefName = refName;
-        //knownResourceFullRefName = fullRefName;
-    }
 
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
@@ -91,149 +68,24 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
     }
 
     @Override
-    protected PoxPayloadOut createInstance(String identifier) {
-       VocabularyClient client = new VocabularyClient();
-        String displayName = "displayName-" + identifier;
-        PoxPayloadOut multipart = VocabularyClientUtils.createEnumerationInstance(
-                displayName, identifier, client.getCommonPartName());
-        return multipart;
-    }    
-    
-    // ---------------------------------------------------------------
-    // CRUD tests : CREATE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
-    public void create(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup, such as initializing the type of service request
-        // (e.g. CREATE, DELETE), its valid and expected status codes, and
-        // its associated HTTP method name (e.g. POST, DELETE).
-        setupCreate();
-
-        // Submit the request to the service and store the response.
-        VocabularyClient client = new VocabularyClient();
-        String identifier = createIdentifier();
-        String displayName = "displayName-" + identifier;
-        PoxPayloadOut multipart = VocabularyClientUtils.createEnumerationInstance(
-                displayName, identifier, client.getCommonPartName());
-        ClientResponse<Response> res = client.create(multipart);
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        //
-        // Specifically:
-        // Does it fall within the set of valid status codes?
-        // Does it exactly match the expected status code?
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": status = " + statusCode);
-        }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
-        // Store the ID returned from the first resource created
-        // for additional tests below.
-        if (knownResourceId == null) {
-            setKnownResource(extractId(res), identifier, null, null );
-                    //VocabularyClientUtils.createVocabularyRefName(identifier, null),
-                    //VocabularyClientUtils.createVocabularyRefName(identifier, displayName));
-            if (logger.isDebugEnabled()) {
-                logger.debug(testName + ": knownResourceId=" + knownResourceId);
-            }
-        }
-        // Store the IDs from every resource created by tests,
-        // so they can be deleted after tests have been run.
-        allResourceIdsCreated.add(extractId(res));
-
-    }
-
-    @Override
-    protected PoxPayloadOut createItemInstance(String parentCsid, String identifier) {
-       String headerLabel = new VocabularyClient().getItemCommonPartName();
-        HashMap<String, String> vocabItemInfo = new HashMap<String, String>();
-        String shortId = createIdentifier();
-        vocabItemInfo.put(AuthorityItemJAXBSchema.SHORT_IDENTIFIER, shortId);
-        vocabItemInfo.put(AuthorityItemJAXBSchema.DISPLAY_NAME, "display-" + shortId);
-
-       return VocabularyClientUtils.createVocabularyItemInstance(identifier, vocabItemInfo, headerLabel);
-    }    
-    
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
-    public void createItem(String testName) {
-
-        if (null != testName && logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupCreate();
-
+    protected String createItemInAuthority(String authorityId) {
+       String result = null;
+       
         VocabularyClient client = new VocabularyClient();
         HashMap<String, String> itemInfo = new HashMap<String, String>();
         String shortId = createIdentifier();
         itemInfo.put(AuthorityItemJAXBSchema.SHORT_IDENTIFIER, shortId);
         itemInfo.put(AuthorityItemJAXBSchema.DISPLAY_NAME, "display-" + shortId);
-        String newID = VocabularyClientUtils.createItemInVocabulary(knownResourceId,
+        result = VocabularyClientUtils.createItemInVocabulary(authorityId,
                 null /*knownResourceRefName*/, itemInfo, client);
-
-        // Store the ID returned from the first item resource created
-        // for additional tests below.
-        if (knownItemResourceId == null) {
-            knownItemResourceId = newID;
-            if (null != testName && logger.isDebugEnabled()) {
-                logger.debug(testName + ": knownItemResourceId=" + knownItemResourceId);
-            }
-        }
-        // Store the IDs from any item resources created
-        // by tests, along with the IDs of their parents, so these items
-        // can be deleted after all tests have been run.
-        allResourceItemIdsCreated.put(newID, knownResourceId);
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create", "createItem", "readItem"})
-    public void createList(String testName) throws Exception {
-        for (int i = 0; i < 3; i++) {
-            // Force create to reset the known resource info
-            setKnownResource(null, null, null, null);
-            knownItemResourceId = null;
-            create(testName);
-            // Add nItemsToCreateInList items to each vocab
-            for (int j = 0; j < nItemsToCreateInList; j++) {
-                createItem(null);
-            }
-        }
-    }
-
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-    @Override
-    public void createWithEmptyEntityBody(String testName) throws Exception {
-    }
-
-    @Override
-    public void createWithMalformedXml(String testName) throws Exception {
-    }
-
-    @Override
-    public void createWithWrongXmlSchema(String testName) throws Exception {
+        allResourceItemIdsCreated.put(result, authorityId);
+        
+        return result;
     }
-
+    
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
+               dependsOnMethods = {"CRUDTests"})
     public void createWithBadShortId(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         testSetup(STATUS_BAD_REQUEST, ServiceRequestType.CREATE);
 
         // Submit the request to the service and store the response.
@@ -241,29 +93,18 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
         PoxPayloadOut multipart = VocabularyClientUtils.createEnumerationInstance(
                 "Vocab with Bad Short Id", "Bad Short Id!", client.getCommonPartName());
         ClientResponse<Response> res = client.create(multipart);
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        //
-        // Specifically:
-        // Does it fall within the set of valid status codes?
-        // Does it exactly match the expected status code?
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": status = " + statusCode);
+        try {
+               assertStatusCode(res, testName);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
     }
 
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createItem"})
+               dependsOnMethods = {"authorityTests"})
     public void createItemWithBadShortId(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
         setupCreateWithMalformedXml();
 
         // Submit the request to the service and store the response.
@@ -273,977 +114,222 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
         itemInfo.put(AuthorityItemJAXBSchema.DISPLAY_NAME, "Bad Item!");
         PoxPayloadOut multipart =
                 VocabularyClientUtils.createVocabularyItemInstance(null, //knownResourceRefName,
-                itemInfo, client.getCommonPartItemName());
+                itemInfo, client.getItemCommonPartName());
         ClientResponse<Response> res = client.createItem(knownResourceId, multipart);
+        try {
+               int statusCode = res.getStatus();
 
-        int statusCode = res.getStatus();
-
-        if (!REQUEST_TYPE.isValidStatusCode(statusCode)) {
-            throw new RuntimeException("Could not create Item: \"" + itemInfo.get(AuthorityItemJAXBSchema.DISPLAY_NAME)
-                    + "\" in personAuthority: \"" + knownResourceId //knownResourceRefName
-                    + "\" " + invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        }
-        if (statusCode != EXPECTED_STATUS_CODE) {
-            throw new RuntimeException("Unexpected Status when creating Item: \"" + itemInfo.get(AuthorityItemJAXBSchema.DISPLAY_NAME)
-                    + "\" in personAuthority: \"" + knownResourceId /*knownResourceRefName*/ + "\", Status:" + statusCode);
-        }
-    }
-
-    /*
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-    dependsOnMethods = {"create", "testSubmitRequest"})
-    public void createWithEmptyEntityBody(String testName) throws Exception {
-
-    if (logger.isDebugEnabled()) {
-    logger.debug(testBanner(testName, CLASS_NAME));
-    }
-    // Perform setup.
-    setupCreateWithEmptyEntityBody(testName, CLASS_NAME);
-
-    // Submit the request to the service and store the response.
-    String method = REQUEST_TYPE.httpMethodName();
-    String url = getServiceRootURL();
-    String mediaType = MediaType.APPLICATION_XML;
-    final String entity = "";
-    int statusCode = submitRequest(method, url, mediaType, entity);
-
-    // Check the status code of the response: does it match
-    // the expected response(s)?
-    if(logger.isDebugEnabled()) {
-    logger.debug(testName + ": url=" + url +
-    " status=" + statusCode);
-    }
-    Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-    Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-    dependsOnMethods = {"create", "testSubmitRequest"})
-    public void createWithMalformedXml(String testName) throws Exception {
-
-    if (logger.isDebugEnabled()) {
-    logger.debug(testBanner(testName, CLASS_NAME));
-    }
-    // Perform setup.
-    setupCreateWithMalformedXml();
-
-    // Submit the request to the service and store the response.
-    String method = REQUEST_TYPE.httpMethodName();
-    String url = getServiceRootURL();
-    String mediaType = MediaType.APPLICATION_XML;
-    final String entity = MALFORMED_XML_DATA; // Constant from base class.
-    int statusCode = submitRequest(method, url, mediaType, entity);
-
-    // Check the status code of the response: does it match
-    // the expected response(s)?
-    if(logger.isDebugEnabled()){
-    logger.debug(testName + ": url=" + url +
-    " status=" + statusCode);
-    }
-    Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-    Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-    dependsOnMethods = {"create", "testSubmitRequest"})
-    public void createWithWrongXmlSchema(String testName) throws Exception {
-
-    if (logger.isDebugEnabled()) {
-    logger.debug(testBanner(testName, CLASS_NAME));
-    }
-    // Perform setup.
-    setupCreateWithWrongXmlSchema();
-
-    // Submit the request to the service and store the response.
-    String method = REQUEST_TYPE.httpMethodName();
-    String url = getServiceRootURL();
-    String mediaType = MediaType.APPLICATION_XML;
-    final String entity = WRONG_XML_SCHEMA_DATA;
-    int statusCode = submitRequest(method, url, mediaType, entity);
-
-    // Check the status code of the response: does it match
-    // the expected response(s)?
-    if(logger.isDebugEnabled()){
-    logger.debug(testName + ": url=" + url +
-    " status=" + statusCode);
-    }
-    Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-    Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-     */
-    // ---------------------------------------------------------------
-    // CRUD tests : READ tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create"})
-    public void read(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupRead();
-
-        // Submit the request to the service and store the response.
-        VocabularyClient client = new VocabularyClient();
-        ClientResponse<String> res = client.read(knownResourceId);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        VocabulariesCommon vocabulary = (VocabulariesCommon) extractPart(input,
-                client.getCommonPartName(), VocabulariesCommon.class);
-
-        Assert.assertNotNull(vocabulary);
-        //Assert.assertEquals(vocabulary.getRefName(), knownResourceFullRefName);
-    }
-
-    /**
-     * Read by name.
-     *
-     * @param testName the test name
-     * @throws Exception the exception
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
-    public void readByName(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupRead();
-
-        // Submit the request to the service and store the response.
-        VocabularyClient client = new VocabularyClient();
-        ClientResponse<String> res = client.readByName(knownResourceShortIdentifer);
-        assertStatusCode(res, testName);
-
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        VocabulariesCommon vocabulary = (VocabulariesCommon) extractPart(input,
-                client.getCommonPartName(), VocabulariesCommon.class);
-
-        Assert.assertNotNull(vocabulary);
-    }
-
-    /*
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-    dependsOnMethods = {"read"})
-    public void readByName(String testName) throws Exception {
-
-    if (logger.isDebugEnabled()) {
-    logger.debug(testBanner(testName, CLASS_NAME));
-    }
-    // Perform setup.
-    setupRead();
-
-    // Submit the request to the service and store the response.
-    ClientResponse<PoxPayloadIn> res = client.read(knownResourceId);
-    int statusCode = res.getStatus();
-    assertStatusCode(res, testName);
-
-    //FIXME: remove the following try catch once Aron fixes signatures
-    try {
-    PoxPayloadIn input = (PoxPayloadIn) res.getEntity();
-    VocabulariesCommon vocabulary = (VocabulariesCommon) extractPart(input,
-    client.getCommonPartName(), VocabulariesCommon.class);
-    Assert.assertNotNull(vocabulary);
-    } catch (Exception e) {
-    throw new RuntimeException(e);
-    }
-    }
-     */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createItem", "read"})
-    public void readItem(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
+            if (!testRequestType.isValidStatusCode(statusCode)) {
+                throw new RuntimeException("Could not create Item: \"" + itemInfo.get(AuthorityItemJAXBSchema.DISPLAY_NAME)
+                        + "\" in personAuthority: \"" + knownResourceId //knownResourceRefName
+                        + "\" " + invalidStatusCodeMessage(testRequestType, statusCode));
+            }
+            if (statusCode != testExpectedStatusCode) {
+                throw new RuntimeException("Unexpected Status when creating Item: \"" + itemInfo.get(AuthorityItemJAXBSchema.DISPLAY_NAME)
+                        + "\" in personAuthority: \"" + knownResourceId /*knownResourceRefName*/ + "\", Status:" + statusCode);
+            }
+       } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        // Perform setup.
-        setupRead();
-
-        // Submit the request to the service and store the response.
-        VocabularyClient client = new VocabularyClient();
-        ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
-        assertStatusCode(res, testName);
-
-        // Check whether we've received a vocabulary item.
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        VocabularyitemsCommon vocabularyItem = (VocabularyitemsCommon) extractPart(input,
-                client.getCommonPartItemName(), VocabularyitemsCommon.class);
-        Assert.assertNotNull(vocabularyItem);
-        Assert.assertEquals(vocabularyItem.getInAuthority(), knownResourceId);
     }
-
+    
     // Failure outcomes
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"updateItem"})
+               dependsOnMethods = {"updateItem"})
     public void verifyIllegalItemDisplayName(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-
         // Perform setup for read.
         setupRead();
         
         // Submit the request to the service and store the response.
         VocabularyClient client = new VocabularyClient();
         ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
-        assertStatusCode(res, testName);
-        
-        // Perform setup for update.
-        testSetup(STATUS_BAD_REQUEST, ServiceRequestType.UPDATE);
-
-        // Check whether Person has expected displayName.
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        VocabularyitemsCommon vitem = (VocabularyitemsCommon) extractPart(input,
-                client.getCommonPartItemName(), VocabularyitemsCommon.class);
-        Assert.assertNotNull(vitem);
+        VocabularyitemsCommon vitem = null;
+        try {
+               assertStatusCode(res, testName);
+               // Check whether Person has expected displayName.
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               vitem = (VocabularyitemsCommon) extractPart(input,
+                       client.getItemCommonPartName(), VocabularyitemsCommon.class);
+               Assert.assertNotNull(vitem);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
+        }
+        //
         // Try to Update with null displayName
+        //
+        setupUpdateWithInvalidBody();
         vitem.setDisplayName(null);
-
         // Submit the updated resource to the service and store the response.
         PoxPayloadOut output = new PoxPayloadOut(SERVICE_ITEM_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = output.addPart(vitem, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getCommonPartItemName());
+        PayloadOutputPart commonPart = output.addPart(client.getItemCommonPartName(), vitem);
         res = client.updateItem(knownResourceId, knownItemResourceId, output);
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug("updateItem: status = " + statusCode);
+        try {
+               assertStatusCode(res, testName);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE,
-                "Expecting invalid message because of null displayName.");
-
+        //
         // Now try to Update with 1-char displayName (too short)
+        //
+        setupUpdateWithInvalidBody();
         vitem.setDisplayName("a");
-
         // Submit the updated resource to the service and store the response.
         output = new PoxPayloadOut(SERVICE_ITEM_PAYLOAD_NAME);
-        commonPart = output.addPart(vitem, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getCommonPartItemName());
+        commonPart = output.addPart(client.getItemCommonPartName(), vitem);
         res = client.updateItem(knownResourceId, knownItemResourceId, output);
-        statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug("updateItem: status = " + statusCode);
-        }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE,
-                "Expecting invalid message because of 1-char displayName.");
-    }
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
-    public void readNonExistent(String testName) {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadNonExistent();
-
-        // Submit the request to the service and store the response.
-        VocabularyClient client = new VocabularyClient();
-        ClientResponse<String> res = client.read(NON_EXISTENT_ID);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"readItem", "readNonExistent"})
-    public void readItemNonExistent(String testName) {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadNonExistent();
-
-        // Submit the request to the service and store the response.
-        VocabularyClient client = new VocabularyClient();
-        ClientResponse<String> res = client.readItem(knownResourceId, NON_EXISTENT_ID);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-    // ---------------------------------------------------------------
-    // CRUD tests : READ_LIST tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList", "read"})
-    public void readList(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupReadList();
-
-        // Submit the request to the service and store the response.
-        VocabularyClient client = new VocabularyClient();
-        ClientResponse<AbstractCommonList> res = client.readList();
-        assertStatusCode(res, testName);
-        AbstractCommonList list = res.getEntity();
-
-        // Optionally output additional data about list members for debugging.
-        if(logger.isTraceEnabled()){
-               AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
-        }
-    }
-
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList", "readItem"})
-    public void readItemList(String testName) {
-        readItemListInt(knownResourceId, null, testName);
-    }
-
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createList", "readItem"})
-    public void readItemListByName(String testName) {
-        readItemListInt(null, knownResourceShortIdentifer, testName);
-    }
-
-    private void readItemListInt(String vcsid, String shortId, String testName) {
-
-        // Perform setup.
-        setupReadList();
-
-        // Submit the request to the service and store the response.
-        VocabularyClient client = new VocabularyClient();
-        ClientResponse<AbstractCommonList> res = null;
-        if (vcsid != null) {
-            res = client.readItemList(vcsid, null, null);
-        } else if (shortId != null) {
-            res = client.readItemListForNamedAuthority(shortId, null, null);
-        } else {
-            Assert.fail("Internal Error: readItemList both vcsid and shortId are null!");
-        }
-        assertStatusCode(res, testName);
-        AbstractCommonList list = res.getEntity();
-
-        List<AbstractCommonList.ListItem> items = list.getListItem();
-        int nItemsReturned = items.size();
-        long nItemsTotal = list.getTotalItems();
-        if (logger.isDebugEnabled()) {
-            logger.debug("  " + testName + ": Expected "
-                    + nItemsToCreateInList + " items; got: " + nItemsReturned + " of: " + nItemsTotal);
-        }
-        Assert.assertEquals(nItemsTotal, nItemsToCreateInList);
-
-        if(logger.isTraceEnabled()){
-               AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
-        }
-    }
-
-    // Failure outcomes
-    // None at present.
-    // ---------------------------------------------------------------
-    // CRUD tests : UPDATE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"read"})
-    public void update(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdate();
-
-        // Retrieve the contents of a resource to update.
-        VocabularyClient client = new VocabularyClient();
-        ClientResponse<String> res =
-                client.read(knownResourceId);
-        assertStatusCode(res, testName);
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("got Vocabulary to update with ID: " + knownResourceId);
-        }
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        VocabulariesCommon vocabulary = (VocabulariesCommon) extractPart(input,
-                client.getCommonPartName(), VocabulariesCommon.class);
-        Assert.assertNotNull(vocabulary);
-
-        // Update the contents of this resource.
-        vocabulary.setDisplayName("updated-" + vocabulary.getDisplayName());
-        vocabulary.setVocabType("updated-" + vocabulary.getVocabType());
-        if (logger.isDebugEnabled()) {
-            logger.debug("to be updated Vocabulary");
-            logger.debug(objectAsXmlString(vocabulary, VocabulariesCommon.class));
-        }
-
-        // Submit the updated resource to the service and store the response.
-        PoxPayloadOut output = new PoxPayloadOut(SERVICE_PAYLOAD_NAME);
-
-        PayloadOutputPart commonPart = output.addPart(vocabulary, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getCommonPartName());
-        res = client.update(knownResourceId, output);
-        assertStatusCode(res, testName);
-
-        // Retrieve the updated resource and verify that its contents exist.
-        input = new PoxPayloadIn(res.getEntity());
-        VocabulariesCommon updatedVocabulary =
-                (VocabulariesCommon) extractPart(input,
-                client.getCommonPartName(), VocabulariesCommon.class);
-        Assert.assertNotNull(updatedVocabulary);
-
-        // Verify that the updated resource received the correct data.
-        Assert.assertEquals(updatedVocabulary.getDisplayName(),
-                vocabulary.getDisplayName(),
-                "Data in updated object did not match submitted data.");
-    }
-
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"readItem", "update", "verifyIgnoredUpdateWithInAuthority"})
-    public void updateItem(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdate();
-
-        // Retrieve the contents of a resource to update.
-        VocabularyClient client = new VocabularyClient();
-        ClientResponse<String> res =
-                client.readItem(knownResourceId, knownItemResourceId);
-        assertStatusCode(res, testName);
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("got VocabularyItem to update with ID: "
-                    + knownItemResourceId
-                    + " in Vocab: " + knownResourceId);
-        }
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        VocabularyitemsCommon vocabularyItem = (VocabularyitemsCommon) extractPart(input,
-                client.getCommonPartItemName(), VocabularyitemsCommon.class);
-        Assert.assertNotNull(vocabularyItem);
-
-        // Update the contents of this resource.
-        vocabularyItem.setDisplayName("updated-" + vocabularyItem.getDisplayName());
-        if (logger.isDebugEnabled()) {
-            logger.debug("to be updated VocabularyItem");
-            logger.debug(objectAsXmlString(vocabularyItem,
-                    VocabularyitemsCommon.class));
+        try {
+               assertStatusCode(res, testName);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-
-        // Submit the updated resource to the service and store the response.
-        PoxPayloadOut output = new PoxPayloadOut(SERVICE_ITEM_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = output.addPart(vocabularyItem, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getCommonPartItemName());
-        res = client.updateItem(knownResourceId, knownItemResourceId, output);
-        assertStatusCode(res, testName);
-
-        // Retrieve the updated resource and verify that its contents exist.
-        input = new PoxPayloadIn(res.getEntity());
-        VocabularyitemsCommon updatedVocabularyItem =
-                (VocabularyitemsCommon) extractPart(input,
-                client.getCommonPartItemName(), VocabularyitemsCommon.class);
-        Assert.assertNotNull(updatedVocabularyItem);
-
-        // Verify that the updated resource received the correct data.
-        Assert.assertEquals(updatedVocabularyItem.getDisplayName(),
-                vocabularyItem.getDisplayName(),
-                "Data in updated VocabularyItem did not match submitted data.");
     }
 
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"readItem"})
-    public void verifyIgnoredUpdateWithInAuthority(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdate();
-
-        // Submit the request to the service and store the response.
-        VocabularyClient client = new VocabularyClient();
-        ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
-        assertStatusCode(res, testName);
-
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        VocabularyitemsCommon vitem = (VocabularyitemsCommon) extractPart(input,
-                client.getCommonPartItemName(), VocabularyitemsCommon.class);
-        Assert.assertNotNull(vitem);
-        // Try to Update with new parent vocab (use self, for test).
-        Assert.assertEquals(vitem.getInAuthority(),
-                knownResourceId,
-                "VocabularyItem inAuthority does not match knownResourceId.");
-        vitem.setInAuthority(knownItemResourceId);
-
-        // Submit the updated resource to the service and store the response.
-        PoxPayloadOut output = new PoxPayloadOut(SERVICE_ITEM_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = output.addPart(vitem, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(client.getCommonPartItemName());
-        res = client.updateItem(knownResourceId, knownItemResourceId, output);
-        assertStatusCode(res, testName);
-
-        // Retrieve the updated resource and verify that the parent did not change
-        res = client.readItem(knownResourceId, knownItemResourceId);
-        input = new PoxPayloadIn(res.getEntity());
-        VocabularyitemsCommon updatedVocabularyItem =
-                (VocabularyitemsCommon) extractPart(input,
-                client.getCommonPartItemName(), VocabularyitemsCommon.class);
-        Assert.assertNotNull(updatedVocabularyItem);
-
-        // Verify that the updated resource received the correct data.
-        Assert.assertEquals(updatedVocabularyItem.getInAuthority(),
-                knownResourceId,
-                "VocabularyItem allowed update to the parent (inAuthority).");
+    @Test(dataProvider = "testName", dependsOnMethods = {"localDeleteItem"})
+    public void localDelete(String testName) throws Exception {
+       super.delete(testName);
     }
 
-    // Failure outcomes
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
     @Override
-    public void updateWithEmptyEntityBody(String testName) throws Exception {
-    }
-
-    @Override
-    public void updateWithMalformedXml(String testName) throws Exception {
+    public void delete(String testName) throws Exception {
+       //
+       // This overrides the base test.  We don't want to do anything at this point
+       // in the test suite.  See the localDelete() method for the actual "delete" test
+       //
     }
-
+        
     @Override
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
-    }
+    public void deleteItem(String testName) throws Exception {
+       //Do nothing.  We don't want to delete the known item until all the dependencies of the
+       // localDeleteItem() test have been fulfilled.
+    }    
 
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {"authorityTests", "readItemList", "testItemSubmitRequest",
+        "updateItem", "verifyIllegalItemDisplayName", "verifyIgnoredUpdateWithInAuthority"})
+    public void localDeleteItem(String testName) throws Exception {
+       super.deleteItem(testName);
+    }    
+    
     /*
+     * For convenience and terseness, this test method is the base of the test execution dependency chain.  Other test methods may
+     * refer to this method in their @Test annotation declarations.
+     */
     @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-    dependsOnMethods = {"create", "update", "testSubmitRequest"})
-    public void updateWithEmptyEntityBody(String testName) throws Exception {
-
-    if (logger.isDebugEnabled()) {
-    logger.debug(testBanner(testName, CLASS_NAME));
-    }
-    // Perform setup.
-    setupUpdateWithEmptyEntityBody();
-
-    // Submit the request to the service and store the response.
-    String method = REQUEST_TYPE.httpMethodName();
-    String url = getResourceURL(knownResourceId);
-    String mediaType = MediaType.APPLICATION_XML;
-    final String entity = "";
-    int statusCode = submitRequest(method, url, mediaType, entity);
-
-    // Check the status code of the response: does it match
-    // the expected response(s)?
-    if(logger.isDebugEnabled()){
-    logger.debug(testName + ": url=" + url +
-    " status=" + statusCode);
-    }
-    Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-    Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
+    @Test(dataProvider = "testName",
+               dependsOnMethods = {
+                       "org.collectionspace.services.client.test.AbstractAuthorityServiceTest.baseAuthorityTests"})    
+       public void authorityTests(String testName) {
+               // This method only exists as a dependency target for TestNG
+       }
+    
+    // ---------------------------------------------------------------
+    // Vocabulary test specific overrides
+    // ---------------------------------------------------------------
+    
     @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-    dependsOnMethods = {"create", "update", "testSubmitRequest"})
-    public void updateWithMalformedXml(String testName) throws Exception {
-
-    if (logger.isDebugEnabled()) {
-    logger.debug(testBanner(testName, CLASS_NAME));
-    }
-    // Perform setup.
-    setupUpdateWithMalformedXml();
-
-    // Submit the request to the service and store the response.
-    String method = REQUEST_TYPE.httpMethodName();
-    String url = getResourceURL(knownResourceId);
-    String mediaType = MediaType.APPLICATION_XML;
-    final String entity = MALFORMED_XML_DATA;
-    int statusCode = submitRequest(method, url, mediaType, entity);
-
-    // Check the status code of the response: does it match
-    // the expected response(s)?
-    if(logger.isDebugEnabled()){
-    logger.debug(testName + ": url=" + url +
-    " status=" + statusCode);
-    }
-    Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-    Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+    public String getServicePathComponent() {
+        return SERVICE_PATH_COMPONENT;
     }
 
     @Override
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
-    dependsOnMethods = {"create", "update", "testSubmitRequest"})
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
-
-    if (logger.isDebugEnabled()) {
-    logger.debug(testBanner(testName, CLASS_NAME));
+    protected String getServiceName() {
+        return VocabularyClient.SERVICE_NAME;
     }
-    // Perform setup.
-    setupUpdateWithWrongXmlSchema();
-
-    // Submit the request to the service and store the response.
-    String method = REQUEST_TYPE.httpMethodName();
-    String url = getResourceURL(knownResourceId);
-    String mediaType = MediaType.APPLICATION_XML;
-    final String entity = WRONG_XML_SCHEMA_DATA;
-    int statusCode = submitRequest(method, url, mediaType, entity);
 
-    // Check the status code of the response: does it match
-    // the expected response(s)?
-    if(logger.isDebugEnabled()){
-    logger.debug("updateWithWrongXmlSchema: url=" + url +
-    " status=" + statusCode);
-    }
-    Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-    Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-     */
+       @Override
+       protected PoxPayloadOut createInstance(String commonPartName,
+                       String identifier) {
+        String displayName = "displayName-" + identifier;
+        PoxPayloadOut result = VocabularyClientUtils.createEnumerationInstance(
+                displayName, identifier, commonPartName);
+               return result;
+       }
+    
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"update", "testSubmitRequest"})
-    public void updateNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdateNonExistent();
-
-        // Submit the request to the service and store the response.
-        // Note: The ID used in this 'create' call may be arbitrary.
-        // The only relevant ID may be the one used in update(), below.
-        VocabularyClient client = new VocabularyClient();
-        String displayName = "displayName-" + NON_EXISTENT_ID;
-        PoxPayloadOut multipart = VocabularyClientUtils.createEnumerationInstance(
-                displayName, NON_EXISTENT_ID, client.getCommonPartName());
-        ClientResponse<String> res =
-                client.update(NON_EXISTENT_ID, multipart);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
+    protected PoxPayloadOut createInstance(String identifier) {
+       VocabularyClient client = new VocabularyClient();
+        return createInstance(client.getCommonPartName(), identifier);
+    }    
 
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"updateItem", "testItemSubmitRequest"})
-    public void updateNonExistentItem(String testName) throws Exception {
+       @Override
+       protected VocabulariesCommon updateInstance(
+                       VocabulariesCommon vocabulariesCommon) {
+               VocabulariesCommon result = new VocabulariesCommon();
+               
+               result.setDisplayName("updated-" + vocabulariesCommon.getDisplayName());
+               result.setVocabType("updated-" + vocabulariesCommon.getVocabType());
+        
+        return result;
+       }
+
+       @Override
+       protected void compareUpdatedInstances(VocabulariesCommon original,
+                       VocabulariesCommon updated) throws Exception {
+        Assert.assertEquals(updated.getDisplayName(),
+                       original.getDisplayName(),
+                "Display name in updated object did not match submitted data.");
+        Assert.assertEquals(updated.getVocabType(),
+                       original.getVocabType(),
+                "Vocabulary tyype name in updated object did not match submitted data.");
+       }
+
+    //
+    // Vocabulary item specific overrides
+    //
 
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupUpdateNonExistent();
+    @Override
+    protected PoxPayloadOut createItemInstance(String parentCsid, String identifier) {
+       String headerLabel = new VocabularyClient().getItemCommonPartName();
+        HashMap<String, String> vocabItemInfo = new HashMap<String, String>();
+        String shortId = createIdentifier();
+        vocabItemInfo.put(AuthorityItemJAXBSchema.SHORT_IDENTIFIER, shortId);
+        vocabItemInfo.put(AuthorityItemJAXBSchema.DISPLAY_NAME, "display-" + shortId);
 
-        // Submit the request to the service and store the response.
-        // Note: The ID used in this 'create' call may be arbitrary.
-        // The only relevant ID may be the one used in update(), below.
-        VocabularyClient client = new VocabularyClient();
+       return VocabularyClientUtils.createVocabularyItemInstance(identifier, vocabItemInfo, headerLabel);
+    }    
+       
+       @Override
+       protected VocabularyitemsCommon updateItemInstance(
+                       VocabularyitemsCommon authorityItem) {
+               VocabularyitemsCommon result = new VocabularyitemsCommon();
+               result.setDisplayName("updated-" + authorityItem.getDisplayName());
+               return result;
+       }
+
+       @Override
+       protected void compareUpdatedItemInstances(VocabularyitemsCommon original,
+                       VocabularyitemsCommon updated) throws Exception {
+        Assert.assertEquals(updated.getDisplayName(),
+                       original.getDisplayName(),
+                "Display name in updated VocabularyItem did not match submitted data.");
+       }
+
+       @Override
+       protected void verifyReadItemInstance(VocabularyitemsCommon item)
+                       throws Exception {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       protected PoxPayloadOut createNonExistenceItemInstance(
+                       String commonPartName, String identifier) {
         HashMap<String, String> itemInfo = new HashMap<String, String>();
         itemInfo.put(AuthorityItemJAXBSchema.SHORT_IDENTIFIER, "nonex");
         itemInfo.put(AuthorityItemJAXBSchema.DISPLAY_NAME, "display-nonex");
-        PoxPayloadOut multipart =
+        PoxPayloadOut result =
                 VocabularyClientUtils.createVocabularyItemInstance(
                 null, //VocabularyClientUtils.createVocabularyRefName(NON_EXISTENT_ID, null),
-                itemInfo, client.getCommonPartItemName());
-        ClientResponse<String> res =
-                client.updateItem(knownResourceId, NON_EXISTENT_ID, multipart);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    // ---------------------------------------------------------------
-    // CRUD tests : DELETE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create", "readList", "testSubmitRequest", "update", "deleteItem"})
-    public void delete(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDelete();
-
-        // Submit the request to the service and store the response.
-        VocabularyClient client = new VocabularyClient();
-        ClientResponse<Response> res = client.delete(knownResourceId);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"createItem", "readItemList", "testItemSubmitRequest",
-        "updateItem", "verifyIllegalItemDisplayName", "verifyIgnoredUpdateWithInAuthority"})
-    public void deleteItem(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDelete();
-
-        // Submit the request to the service and store the response.
-        VocabularyClient client = new VocabularyClient();
-        ClientResponse<Response> res = client.deleteItem(knownResourceId, knownItemResourceId);
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug("delete: status = " + statusCode);
-        }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    // Failure outcomes
-    @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"delete"})
-    public void deleteNonExistent(String testName) throws Exception {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDeleteNonExistent();
-
-        // Submit the request to the service and store the response.
-        VocabularyClient client = new VocabularyClient();
-        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"deleteItem"})
-    public void deleteNonExistentItem(String testName) {
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testBanner(testName, CLASS_NAME));
-        }
-        // Perform setup.
-        setupDeleteNonExistent();
-
-        // Submit the request to the service and store the response.
-        VocabularyClient client = new VocabularyClient();
-        ClientResponse<Response> res = client.deleteItem(knownResourceId, NON_EXISTENT_ID);
-        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(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-    }
-
-    // ---------------------------------------------------------------
-    // Utility tests : tests of code used in tests above
-    // ---------------------------------------------------------------
-    /**
-     * Tests the code for manually submitting data that is used by several
-     * of the methods above.
-     */
-    @Test(dependsOnMethods = {"create", "read"})
-    public void testSubmitRequest() {
-
-        // Expected status code: 200 OK
-        setupRead();
-
-        // Submit the request to the service and store the response.
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getResourceURL(knownResourceId);
-        int statusCode = submitRequest(method, url);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug("testSubmitRequest: url=" + url
-                    + " status=" + statusCode);
-        }
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
-    }
-
-    @Test(dependsOnMethods = {"createItem", "readItem", "testSubmitRequest"})
-    public void testItemSubmitRequest() {
-
-        // Expected status code: 200 OK
-        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
-
-        // Submit the request to the service and store the response.
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getItemResourceURL(knownResourceId, knownItemResourceId);
-        int statusCode = submitRequest(method, url);
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug("testItemSubmitRequest: url=" + url
-                    + " status=" + statusCode);
-        }
-        Assert.assertEquals(statusCode, EXPECTED_STATUS);
-
-    }
-
-    // ---------------------------------------------------------------
-    // 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.
-     */
-//    @AfterClass(alwaysRun = true)
-//    public void cleanUp() {
-//        String noTest = System.getProperty("noTestCleanup");
-//        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 ...");
-//        }
-//        VocabularyClient client = new VocabularyClient();
-//        String vocabularyResourceId;
-//        String vocabularyItemResourceId;
-//        // Clean up vocabulary item resources.
-//        for (Map.Entry<String, String> entry : allResourceItemIdsCreated.entrySet()) {
-//            vocabularyItemResourceId = entry.getKey();
-//            vocabularyResourceId = entry.getValue();
-//            // Note: Any non-success responses are ignored and not reported.
-//            client.deleteItem(vocabularyResourceId, vocabularyItemResourceId).releaseConnection();
-//        }
-//        // Clean up vocabulary resources.
-//        for (String resourceId : allResourceIdsCreated) {
-//            // Note: Any non-success responses are ignored and not reported.
-//            client.delete(resourceId).releaseConnection();
-//        }
-//
-//    }
-
-    // ---------------------------------------------------------------
-    // Utility methods used by tests above
-    // ---------------------------------------------------------------
-    @Override
-    public String getServicePathComponent() {
-        return SERVICE_PATH_COMPONENT;
-    }
-
-    public String getServicePathItemsComponent() {
-        return AuthorityClient.ITEMS;
-    }
-
-    /**
-     * Returns the root URL for a service.
-     *
-     * This URL consists of a base URL for all services, followed by
-     * a path component for the owning vocabulary, followed by the 
-     * path component for the items.
-     *
-     * @return The root URL for a service.
-     */
-    protected String getItemServiceRootURL(String parentResourceIdentifier) {
-        return getResourceURL(parentResourceIdentifier) + "/" + getServicePathItemsComponent();
-    }
-
-    /**
-     * Returns the URL of a specific resource managed by a service, and
-     * designated by an identifier (such as a universally unique ID, or UUID).
-     *
-     * @param  resourceIdentifier  An identifier (such as a UUID) for a resource.
-     *
-     * @return The URL of a specific resource managed by a service.
-     */
-    protected String getItemResourceURL(String parentResourceIdentifier, String resourceIdentifier) {
-        return getItemServiceRootURL(parentResourceIdentifier) + "/" + resourceIdentifier;
-    }
-
-    @Override
-    protected String getServiceName() {
-        return VocabularyClient.SERVICE_NAME;
-    }
+                itemInfo, commonPartName);
+               return result;
+       }
+    
 }
index 6b0041c2897b37d967a20db6bd9d04f727530788..f43debd7b29538709fc12e0a3ddb13e76aba6cd8 100644 (file)
@@ -53,7 +53,6 @@
         <dependency>\r
             <groupId>org.testng</groupId>\r
             <artifactId>testng</artifactId>\r
-            <version>5.6</version>\r
         </dependency>\r
         \r
         <!-- apache -->\r
index a71164c6ac5458e3a35b928ee480e4a5f0ac15d6..8f386a73cf97fe4c0c7078963e64d84caf796d8f 100644 (file)
@@ -9,7 +9,6 @@
     </parent>
 
     <modelVersion>4.0.0</modelVersion>
-    <groupId>org.collectionspace.services</groupId>
     <artifactId>org.collectionspace.services.workflow.client</artifactId>
     <name>services.workflow.client</name>
     
@@ -51,7 +50,6 @@
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>5.6</version>
         </dependency>
         <dependency>
             <groupId>org.jboss.resteasy</groupId>
@@ -75,7 +73,6 @@
         <dependency>
             <groupId>commons-httpclient</groupId>
             <artifactId>commons-httpclient</artifactId>
-            <version>3.1</version>
         </dependency>
     </dependencies>
     
index c007ea5a61fd3dd1c89edc584fa151769b54a8e0..387685ee44eca3f211e6b4abb1a2b28591b52957 100644 (file)
@@ -22,9 +22,6 @@
  */
 package org.collectionspace.services.client.test;
 
-
-import javax.ws.rs.core.Response;
-
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadIn;
@@ -39,7 +36,6 @@ import org.collectionspace.services.dimension.DimensionsCommon;
 import org.jboss.resteasy.client.ClientResponse;
 
 import org.testng.Assert;
-import org.testng.annotations.Test;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -49,7 +45,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision:  $
  * $LastChangedDate:  $
  */
-public class WorkflowServiceTest extends AbstractServiceTestImpl {
+public class WorkflowServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonList, WorkflowCommon> {
 
     private final String CLASS_NAME = WorkflowServiceTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
@@ -70,158 +66,96 @@ public class WorkflowServiceTest extends AbstractServiceTestImpl {
         return new DimensionClient();
     }
 
-    @Override
-    protected AbstractCommonList getAbstractCommonList(ClientResponse<AbstractCommonList> response) {
-        return response.getEntity(AbstractCommonList.class);
-    }
-
-    @Override
-    public void createList(String testName) throws Exception {
-       //empty N/A
-    }
+    //
+    // Test overrides
+    //
+    
+       @Override
+       public void create(String testName) throws Exception {
+               String csid = this.createTestObject(testName);
+               if (this.knownResourceId == null) {
+                       this.knownResourceId = csid;
+               }
+       }
 
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create"})
     public void read(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
         setupRead();
         DimensionClient client = new DimensionClient();
         ClientResponse<String> res = client.getWorkflow(knownResourceId);
-        assertStatusCode(res, testName);
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-        WorkflowCommon workflowsCommon = (WorkflowCommon) extractPart(input, WorkflowClient.SERVICE_COMMONPART_NAME, WorkflowCommon.class);
-        if (logger.isDebugEnabled() == true) {
-               logger.debug("Workflow payload is: " + input.getXmlPayload());
+        try {
+               assertStatusCode(res, testName);
+               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               WorkflowCommon workflowsCommon = (WorkflowCommon) extractPart(input, WorkflowClient.SERVICE_COMMONPART_NAME, WorkflowCommon.class);
+               if (logger.isDebugEnabled() == true) {
+                       logger.debug("Workflow payload is: " + input.getXmlPayload());
+               }
+               Assert.assertNotNull(workflowsCommon);
+        } finally {
+               if (res != null) {
+                res.releaseConnection();
+            }
         }
-        Assert.assertNotNull(workflowsCommon);
     }
-
-//    @Override
-//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"createList", "read"})
-//    public void readList(String testName) throws Exception {
-//        logger.debug(testBanner(testName, CLASS_NAME));
-//        setupReadList();
-//        WorkflowClient client = new WorkflowClient();
-//        ClientResponse<AbstractCommonList> res = client.readList();
-//        assertStatusCode(res, testName);
-//        AbstractCommonList list = res.getEntity();
-//        if (logger.isDebugEnabled()) {
-//            List<AbstractCommonList.ListItem> items =
-//                list.getListItem();
-//            int i = 0;
-//            for(AbstractCommonList.ListItem item : items){
-//                logger.debug(testName + ": list-item[" + i + "] " +
-//                        item.toString());
-//                i++;
-//            }
-//        }
-//    }
+    
+    //
+    // FIXME: REM - This test should be a subclass of BaseServiceTest and *not* AbstractPoxServiceTestImpl
+    //
     
     @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"read"})
     public void update(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
         setupUpdate();
         updateLifeCycleState(testName, knownResourceId, WorkflowClient.WORKFLOWSTATE_APPROVED);
     }    
 
-
-    @Override
-//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"update", "testSubmitRequest"})
-    public void updateNonExistent(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupUpdateNonExistent();
-        // Submit the request to the service and store the response.
-        // Note: The ID used in this 'create' call may be arbitrary.
-        // The only relevant ID may be the one used in update(), below.
-        WorkflowClient client = new WorkflowClient();
-        PoxPayloadOut multipart = createDimensionInstance(NON_EXISTENT_ID);
-        ClientResponse<String> res = client.update(NON_EXISTENT_ID, multipart);
-        assertStatusCode(res, testName);
-    }
-
     @Override
-//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
     public void delete(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupDelete();
-        WorkflowClient client = new WorkflowClient();
-        ClientResponse<Response> res = client.delete(knownResourceId);
-        assertStatusCode(res, testName);
-    }
-
-    // ---------------------------------------------------------------
-    // Failure outcome tests : means we expect response to fail, but test to succeed
-    // ---------------------------------------------------------------
-
-    // Failure outcome
-    @Override
-//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"read"})
-    public void readNonExistent(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupReadNonExistent();
-        WorkflowClient client = new WorkflowClient();
-        ClientResponse<String> res = client.read(NON_EXISTENT_ID);
-        assertStatusCode(res, testName);
-    }
-
-    // Failure outcome
-    @Override
-//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"delete"})
-    public void deleteNonExistent(String testName) throws Exception {
-        logger.debug(testBanner(testName, CLASS_NAME));
-        setupDeleteNonExistent();
-        WorkflowClient client = new WorkflowClient();
-        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
-        assertStatusCode(res, testName);
-    }
-
-    // Failure outcomes
-    // Placeholders until the tests below can be implemented. See Issue CSPACE-401.
-
-    @Override
-    public void createWithEmptyEntityBody(String testName) throws Exception {
-    }
-
-    @Override
-    public void createWithMalformedXml(String testName) throws Exception {
+       // Do nothing.  N/A
     }
+        
+    public void searchWorkflowDeleted(String testName) throws Exception {
+       // Do nothing.  N/A
+    }    
 
-    @Override
-    public void createWithWrongXmlSchema(String testName) throws Exception {
-    }
+       @Override
+       public void readList(String testName) throws Exception {
+               // Do nothing.  N/A
+       }       
+               
+       @Override
+    public void readPaginatedList(String testName) throws Exception {
+               // Do nothing.  N/A
+       }
 
-    @Override
-    public void updateWithEmptyEntityBody(String testName) throws Exception {
-    }
+       @Override
+       public void CRUDTests(String testName) {
+               // TODO Auto-generated method stub              
+       }
 
-    @Override
-    public void updateWithMalformedXml(String testName) throws Exception {
-    }
+       @Override
+       protected WorkflowCommon updateInstance(WorkflowCommon commonPartObject) {
+               // TODO Auto-generated method stub
+               return null;
+       }
 
-    @Override
-    public void updateWithWrongXmlSchema(String testName) throws Exception {
-    }
+       @Override
+       protected void compareUpdatedInstances(WorkflowCommon original,
+                       WorkflowCommon updated) throws Exception {
+               // TODO Auto-generated method stub
+               
+       }
     
-    // ---------------------------------------------------------------
-    // Search tests
-    // ---------------------------------------------------------------
+       /*
+        * (non-Javadoc)
+        * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
+        */
+       @Override
+       public void createList(String testName) throws Exception {
+               //empty N/A
+       }
     
-    public void searchWorkflowDeleted(String testName) throws Exception {
-    }    
-
-    // ---------------------------------------------------------------
-    // Utility tests : tests of code used in tests above
-    // ---------------------------------------------------------------
-
-//    @Test(dependsOnMethods = {"create", "read"})
     public void testSubmitRequest() {
-        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode(); // Expected status code: 200 OK
-        String method = ServiceRequestType.READ.httpMethodName();
-        String url = getResourceURL(knownResourceId);
-        int statusCode = submitRequest(method, url);
-        logger.debug("testSubmitRequest: url=" + url + " status=" + statusCode);
-        Assert.assertEquals(statusCode, EXPECTED_STATUS);
+       // Do nothing.  N/A
     }
 
     // ---------------------------------------------------------------
@@ -230,17 +164,35 @@ public class WorkflowServiceTest extends AbstractServiceTestImpl {
     
     @Override
     protected PoxPayloadOut createInstance(String identifier) {
-       return createDimensionInstance(identifier);
+        String dimensionsCommonPartName = new DimensionClient().getCommonPartName();
+       return createInstance(identifier, dimensionsCommonPartName);
     }    
     
+       @Override
+       protected PoxPayloadOut createInstance(String commonPartName,
+                       String identifier) {
+               return createDimensionInstance(commonPartName, identifier);
+       }
+    
+       /*
+        * We're using a DimensionsCommon instance to test the workflow service.
+        */
     private PoxPayloadOut createDimensionInstance(String dimensionValue) {
+        String commonPartName = new DimensionClient().getCommonPartName();
+        return createDimensionInstance(commonPartName, dimensionValue);
+    }
+       
+       /*
+        * We're using a DimensionsCommon instance to test the workflow service.
+        */
+    private PoxPayloadOut createDimensionInstance(String commonPartName,
+               String dimensionValue) {
         String measurementUnit = "measurementUnit-" + dimensionValue;
-        String dimensionsCommonPartName = new DimensionClient().getCommonPartName();
         DimensionsCommon dimensionsCommon = new DimensionsCommon();
         
         dimensionsCommon.setMeasurementUnit(measurementUnit);
         PoxPayloadOut multipart = new PoxPayloadOut(DimensionClient.SERVICE_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = multipart.addPart(dimensionsCommonPartName, dimensionsCommon);
+        PayloadOutputPart commonPart = multipart.addPart(commonPartName, dimensionsCommon);
 
         if (logger.isDebugEnabled()) {
             logger.debug("To be created, Dimensions common: " + commonPart.asXML());
@@ -249,24 +201,5 @@ public class WorkflowServiceTest extends AbstractServiceTestImpl {
 
         return multipart;
     }
-
-       @Override
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
-       public void create(String testName) throws Exception {
-               String csid = this.createTestObject(testName);
-               if (this.knownResourceId == null) {
-                       this.knownResourceId = csid;
-               }
-       }
-
-       
-       @Override
-       public void readList(String testName) throws Exception {
-       }       
-               
-       @Override
-    public void readPaginatedList(String testName) throws Exception {
-               //empty N/A
-       }
        
 }
index 76090dbb1fb00b21f40bf66108a720310020873c..2f85981def3113ac857f968912c61819ae5f1462 100644 (file)
@@ -34,7 +34,6 @@
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>5.6</version>
         </dependency>
         
       <!-- javax -->