]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-6959: Refactored client code to deal better with init exceptions.
authorremillet <remillet@yahoo.com>
Wed, 8 Jun 2016 23:13:03 +0000 (16:13 -0700)
committerremillet <remillet@yahoo.com>
Wed, 8 Jun 2016 23:13:03 +0000 (16:13 -0700)
137 files changed:
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/PerformanceTests/src/test/java/org/collectionspace/services/PerformanceTests/test/I1591Multiple.java
services/PerformanceTests/src/test/java/org/collectionspace/services/PerformanceTests/test/I1591OneInst.java
services/PerformanceTests/src/test/java/org/collectionspace/services/PerformanceTests/test/I1591OneInstOneClose.java
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/TenantClient.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/acquisition/client/src/main/java/org/collectionspace/services/client/AcquisitionClient.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/authority/jaxb/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityJAXBSchema.java
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityServiceUtils.java
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityDocumentModelHandler.java
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java
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/batch/client/src/main/java/org/collectionspace/services/client/BatchClient.java
services/batch/client/src/test/java/org/collectionspace/services/client/test/BatchServiceTest.java
services/blob/client/src/main/java/org/collectionspace/services/client/BlobClient.java
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
services/blob/client/src/test/java/org/collectionspace/services/client/test/BlobServiceTest.java
services/citation/client/src/main/java/org/collectionspace/services/client/CitationAuthorityClient.java
services/citation/client/src/test/java/org/collectionspace/services/client/test/CitationAuthorityServiceTest.java
services/client/src/main/java/org/collectionspace/services/client/AbstractCommonListPoxServiceClientImpl.java
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/AuthorityClientImpl.java
services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceClient.java
services/client/src/main/java/org/collectionspace/services/client/GenericAuthorityClientImpl.java
services/client/src/main/java/org/collectionspace/services/client/RelationClient.java
services/client/src/main/java/org/collectionspace/services/client/TestServiceClient.java
services/client/src/main/java/org/collectionspace/services/client/index/IndexClient.java
services/client/src/main/java/org/collectionspace/services/client/test/AbstractAuthorityServiceTest.java
services/client/src/main/java/org/collectionspace/services/client/test/AbstractPoxServiceTestImpl.java
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/workflow/WorkflowClient.java
services/client/src/main/resources/sas-collectionspace-client.properties
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/common-api/src/main/java/org/collectionspace/services/common/api/Tools.java
services/common-test/src/test/java/org/collectionspace/services/client/test/ServiceLayerTest.java
services/common/src/main/java/org/collectionspace/services/common/context/AbstractServiceContextImpl.java
services/common/src/main/java/org/collectionspace/services/common/context/ServiceContext.java
services/common/src/main/java/org/collectionspace/services/common/document/AbstractDocumentHandlerImpl.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/TenantRepository.java
services/concept/client/src/main/java/org/collectionspace/services/client/ConceptAuthorityClient.java
services/concept/client/src/test/java/org/collectionspace/services/client/test/ConceptAuthorityServiceTest.java
services/conditioncheck/client/src/main/java/org/collectionspace/services/client/ConditioncheckClient.java
services/conditioncheck/client/src/test/java/org/collectionspace/services/client/test/ConditioncheckAuthRefsTest.java
services/conditioncheck/client/src/test/java/org/collectionspace/services/client/test/ConditioncheckServiceTest.java
services/config/src/main/resources/instance1.xml [new file with mode: 0644]
services/config/src/main/resources/service.xsd
services/config/src/main/resources/tenant.xsd
services/conservation/client/src/main/java/org/collectionspace/services/client/ConservationClient.java
services/conservation/client/src/test/java/org/collectionspace/services/client/test/ConservationAuthRefsTest.java
services/conservation/client/src/test/java/org/collectionspace/services/client/test/ConservationServiceTest.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/dimension/client/src/main/java/org/collectionspace/services/client/DimensionClient.java
services/dimension/client/src/test/java/org/collectionspace/services/client/test/DimensionServiceTest.java
services/exhibition/client/src/main/java/org/collectionspace/services/client/ExhibitionClient.java
services/exhibition/client/src/test/java/org/collectionspace/services/client/test/ExhibitionServiceTest.java
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/id/client/src/main/java/org/collectionspace/services/client/IdClient.java
services/id/service/src/test/java/org/collectionspace/services/id/IdServiceTest.java
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/loanin/client/src/main/java/org/collectionspace/services/client/LoaninClient.java
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/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/location/client/src/main/java/org/collectionspace/services/client/LocationAuthorityClient.java
services/location/client/src/test/java/org/collectionspace/services/client/test/LocationAuthorityServiceTest.java
services/material/client/src/main/java/org/collectionspace/services/client/MaterialAuthorityClient.java
services/material/client/src/test/java/org/collectionspace/services/client/test/MaterialAuthorityServiceTest.java
services/media/client/src/main/java/org/collectionspace/services/client/MediaClient.java
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/src/main/java/org/collectionspace/services/media/MediaResource.java
services/movement/client/src/main/java/org/collectionspace/services/client/MovementClient.java
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/objectexit/client/src/main/java/org/collectionspace/services/client/ObjectExitClient.java
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/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClient.java
services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClientUtils.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/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityClient.java
services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityClientUtils.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/place/client/src/main/java/org/collectionspace/services/client/PlaceAuthorityClient.java
services/place/client/src/test/java/org/collectionspace/services/client/test/PlaceAuthorityServiceTest.java
services/publicitem/client/src/main/java/org/collectionspace/services/client/PublicItemClient.java
services/publicitem/client/src/test/java/org/collectionspace/services/client/test/PublicItemServiceTest.java
services/relation/client/src/test/java/org/collectionspace/services/client/test/RelationServiceTest.java
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/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/servicegroup/client/src/main/java/org/collectionspace/services/client/ServiceGroupClient.java
services/servicegroup/client/src/test/java/org/collectionspace/services/client/test/ServiceGroupServiceTest.java
services/taxonomy/client/src/main/java/org/collectionspace/services/client/TaxonomyAuthorityClient.java
services/taxonomy/client/src/test/java/org/collectionspace/services/client/test/TaxonomyAuthorityServiceTest.java
services/valuationcontrol/client/src/main/java/org/collectionspace/services/client/ValuationcontrolClient.java
services/valuationcontrol/client/src/test/java/org/collectionspace/services/client/test/ValuationcontrolServiceTest.java
services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyClient.java
services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java
services/work/client/src/main/java/org/collectionspace/services/client/WorkAuthorityClient.java
services/work/client/src/test/java/org/collectionspace/services/client/test/WorkAuthorityServiceTest.java
services/workflow/client/src/test/java/org/collectionspace/services/client/test/WorkflowServiceTest.java

index 534cae94d1db3871364a59c4c311784ac9471e61..1fa2515c7756b75e422f70dd30486e305be9e98a 100644 (file)
@@ -142,8 +142,8 @@ public abstract class CollectionSpaceIntegrationTest {
        String extractId(Response res) {
                String result = null;
                
-               MultivaluedMap mvm = res.getMetadata();
-               String uri = (String) ((ArrayList) mvm.get("Location")).get(0);
+               MultivaluedMap<String, Object> mvm = res.getMetadata();
+               String uri = (String) ((ArrayList<Object>) mvm.get("Location")).get(0);
                verbose("extractId:uri=" + uri);
                String[] segments = uri.split("/");
                result = segments[segments.length - 1];
@@ -167,13 +167,13 @@ public abstract class CollectionSpaceIntegrationTest {
         * @throws Exception
         *             the exception
         */
-       static Object extractPart(PoxPayloadIn input, String label, Class clazz) {
+       static Object extractPart(PoxPayloadIn input, String label) {
                Object obj = null;
 
                PayloadInputPart payloadInputPart = input.getPart(label);
                if (payloadInputPart != null) {
                        obj = payloadInputPart.getBody();
-                               }
+               }
 
                return obj;
        }
index aec72528c5c14f075d04cc4dc6543ab1a324cfad..6c174f5db7a11ef4f617daf2a9dd279a2bcf2552 100644 (file)
@@ -65,13 +65,19 @@ public class RelationIntegrationTest extends CollectionSpaceIntegrationTest {
        //
        // Get clients for the CollectionSpace services
        //
-       private CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
-       private RelationClient relationClient = new RelationClient();
-       private IntakeClient intakeClient = new IntakeClient();
-       private DimensionClient dimensionClient = new DimensionClient();
+       private CollectionObjectClient collectionObjectClient;
+       private RelationClient relationClient;
+       private IntakeClient intakeClient;
+       private DimensionClient dimensionClient;
        
        private static final int OBJECTS_TO_INTAKE = 1;
        
+       public RelationIntegrationTest() throws Exception {
+               collectionObjectClient = new CollectionObjectClient();
+               relationClient = new RelationClient();
+               intakeClient = new IntakeClient();
+               dimensionClient = new DimensionClient();
+       }
        
     @AfterClass(alwaysRun = true)
     public void cleanUp() {
@@ -119,7 +125,7 @@ public class RelationIntegrationTest extends CollectionSpaceIntegrationTest {
         return multipart;
     }
        
-    protected PoxPayloadOut createDimensionInstance(String identifier) {
+    protected PoxPayloadOut createDimensionInstance(String identifier) throws Exception {
        DimensionClient client = new DimensionClient();
        return createDimensionInstance(client.getCommonPartName(), identifier);
     }
@@ -139,7 +145,7 @@ public class RelationIntegrationTest extends CollectionSpaceIntegrationTest {
                 "entryDate-" + identifier);
     }
     
-       @Test void deleteCollectionObjectRelationshipToLockedDimension() {
+       @Test void deleteCollectionObjectRelationshipToLockedDimension() throws Exception {
                // First create a CollectionObject
                CollectionobjectsCommon co = new CollectionobjectsCommon();
                fillCollectionObject(co, createIdentifier());           
@@ -225,7 +231,7 @@ public class RelationIntegrationTest extends CollectionSpaceIntegrationTest {
            }
        }
        
-       @Test void createCollectionObjectRelationshipToManyDimensions() {
+       @Test void createCollectionObjectRelationshipToManyDimensions() throws Exception {
                //
                // First create a CollectionObject
                //
@@ -358,7 +364,7 @@ public class RelationIntegrationTest extends CollectionSpaceIntegrationTest {
            }               
        }    
        
-       @Test void releteCollectionObjectToLockedDimension() {
+       @Test void releteCollectionObjectToLockedDimension() throws Exception {
                //
                // First create a CollectionObject
                //
@@ -532,8 +538,7 @@ public class RelationIntegrationTest extends CollectionSpaceIntegrationTest {
                        Assert.assertEquals(responseStatus, Response.Status.OK.getStatusCode());
                        PoxPayloadIn input = new PoxPayloadIn(multiPartResponse.readEntity(String.class));
                        resultRelation = (RelationsCommon) extractPart(input,
-                                       relationClient.getCommonPartName(),
-                                       RelationsCommon.class);
+                                       relationClient.getCommonPartName());
                } catch (Exception e) {
                        e.printStackTrace();
                } finally {
@@ -663,9 +668,7 @@ public class RelationIntegrationTest extends CollectionSpaceIntegrationTest {
                                int responseStatus = multiPartResponse.getStatus();
                                Assert.assertEquals(responseStatus, Response.Status.OK.getStatusCode());
                                PoxPayloadIn input = new PoxPayloadIn(multiPartResponse.readEntity(String.class));
-                               resultRelation = (RelationsCommon) extractPart(input,
-                                               relationClient.getCommonPartName(),
-                                               RelationsCommon.class);
+                               resultRelation = (RelationsCommon) extractPart(input, relationClient.getCommonPartName());
                        } catch (Exception e) {
                                e.printStackTrace();
                        } finally {
index bbc28b2d7382fe1e97504750ed6d8ddde32e5929..669ada3ed89f749798eb4ac5de695a83d3c1fec8 100644 (file)
@@ -28,14 +28,8 @@ import javax.ws.rs.core.Response;
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
-import org.jboss.resteasy.client.ClientResponse;
-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;
 import org.collectionspace.services.client.PoxPayloadOut;
@@ -53,17 +47,20 @@ import org.collectionspace.services.collectionobject.CollectionobjectsCommon;
 public class I1591Multiple extends CollectionSpacePerformanceTest {
 
     final Logger logger = LoggerFactory.getLogger(I1591Multiple.class);
-    private final String COLLECTION_OBJECT_COMMON_PART_NAME =
-        getCollectionObjectCommonPartName();
     private static int MAX_RECORDS = 500;
     String[] coList = new String[MAX_RECORDS];
+    private String COLLECTION_OBJECT_COMMON_PART_NAME;
+    
+    public I1591Multiple() throws Exception {
+        COLLECTION_OBJECT_COMMON_PART_NAME = getCollectionObjectCommonPartName();
+    }
 
-    private String getCollectionObjectCommonPartName() {
+    private String getCollectionObjectCommonPartName() throws Exception {
         return new CollectionObjectClient().getCommonPartName();
     }
 
     @Test
-    public void testCreateWithMultipleClientInstantiations() {
+    public void testCreateWithMultipleClientInstantiations() throws Exception {
         coList = this.createCollectionObjects(MAX_RECORDS);
     }
 
@@ -75,8 +72,9 @@ public class I1591Multiple extends CollectionSpacePerformanceTest {
      * @param identifier A arbitrary identifier to use when filling
      *                   the CollectionObject's fields with values.
      * @return A resource ID for the newly-created object.
+     * @throws Exception 
      */
-    private String createCollectionObject(long identifier) throws AssertionError {
+    private String createCollectionObject(long identifier) throws AssertionError, Exception {
 
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
         String resourceId = null;
@@ -111,8 +109,9 @@ public class I1591Multiple extends CollectionSpacePerformanceTest {
      *
      * @param numberOfObjects The number of CollectionObject resources to create.
      * @return A list of the resource IDs of the newly-created object resources.
+     * @throws Exception 
      */
-       public String[] createCollectionObjects(int numberOfObjects) {
+       public String[] createCollectionObjects(int numberOfObjects) throws Exception {
                long identifier = 0;
                int i = 0;
 
@@ -136,7 +135,7 @@ public class I1591Multiple extends CollectionSpacePerformanceTest {
        }
 
     @AfterClass(alwaysRun=true)
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
         String resourceId = "";
 
index 99478a8132983189d15bb0c908c02641aa09c34d..e0f6238f7ee64ef6e552ebd1354420441c4b9c5f 100644 (file)
@@ -28,14 +28,9 @@ import javax.ws.rs.core.Response;
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.jboss.resteasy.client.ClientResponse;
-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;
 import org.collectionspace.services.client.PoxPayloadOut;
@@ -54,17 +49,11 @@ import org.collectionspace.services.collectionobject.CollectionobjectsCommon;
 public class I1591OneInst extends CollectionSpacePerformanceTest {
 
     final Logger logger = LoggerFactory.getLogger(I1591OneInst.class);
-    private final String COLLECTION_OBJECT_COMMON_PART_NAME =
-        getCollectionObjectCommonPartName();
     private static int MAX_RECORDS = 500;
     String[] coList = new String[MAX_RECORDS];
-
-    private String getCollectionObjectCommonPartName() {
-        return new CollectionObjectClient().getCommonPartName();
-    }
-
+    
     @Test
-    public void testCreateWithSingleClientInstantiation() {
+    public void testCreateWithSingleClientInstantiation() throws Exception {
         createCollectionObjects(MAX_RECORDS);
     }
 
@@ -72,13 +61,12 @@ public class I1591OneInst extends CollectionSpacePerformanceTest {
      * Creates multiple CollectionObject resources.
      *
      * @param numberOfObjects The number of CollectionObject resources to create.
+     * @throws Exception 
      */
-    public void createCollectionObjects(int numberOfObjects) {
-
+    public void createCollectionObjects(int numberOfObjects) throws Exception {
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
 
         long identifier = 0;
-
         for (int i = 0; i <= numberOfObjects; i++) {
 
             // Create a CollectionObject instance.
@@ -117,7 +105,7 @@ public class I1591OneInst extends CollectionSpacePerformanceTest {
     }
 
     @AfterClass(alwaysRun=true)
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
 
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
         String resourceId = "";
index 6bd225505b784f8751c4230ada637d68ab24db37..b48684b1806a15e03b942fee49bfb6d0887161b6 100644 (file)
@@ -28,14 +28,9 @@ import javax.ws.rs.core.Response;
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.jboss.resteasy.client.ClientResponse;
-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;
 import org.collectionspace.services.client.PoxPayloadOut;
@@ -54,17 +49,11 @@ import org.collectionspace.services.collectionobject.CollectionobjectsCommon;
 public class I1591OneInstOneClose extends CollectionSpacePerformanceTest {
 
     final Logger logger = LoggerFactory.getLogger(I1591OneInstOneClose.class);
-    private final String COLLECTION_OBJECT_COMMON_PART_NAME =
-        getCollectionObjectCommonPartName();
     private static int MAX_RECORDS = 500;
     String[] coList = new String[MAX_RECORDS];
 
-    private String getCollectionObjectCommonPartName() {
-        return new CollectionObjectClient().getCommonPartName();
-    }
-
     @Test
-    public void testCreateWithSingleClientInstantiationAndOneClose() {
+    public void testCreateWithSingleClientInstantiationAndOneClose() throws Exception {
         createCollectionObjects(MAX_RECORDS);
     }
 
@@ -72,8 +61,9 @@ public class I1591OneInstOneClose extends CollectionSpacePerformanceTest {
      * Creates multiple CollectionObject resources.
      *
      * @param numberOfObjects The number of CollectionObject resources to create.
+     * @throws Exception 
      */
-    public void createCollectionObjects(int numberOfObjects) {
+    public void createCollectionObjects(int numberOfObjects) throws Exception {
 
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
         long identifier = 0;
@@ -113,7 +103,7 @@ public class I1591OneInstOneClose extends CollectionSpacePerformanceTest {
     }
 
     @AfterClass(alwaysRun=true)
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
 
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
         String resourceId = "";
index 387ce3f4b51a76acc7e4053b5e08af935c0e7eca..300dac9dacd52695872848232835a407ad30d1cb 100644 (file)
@@ -28,13 +28,12 @@ import java.util.Random;
 
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
-import org.jboss.resteasy.util.HttpResponseCodes;
 
+import org.jboss.resteasy.util.HttpResponseCodes;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import org.collectionspace.services.client.AbstractCommonListUtils;
 import org.collectionspace.services.client.CollectionObjectClient;
 import org.collectionspace.services.client.PayloadOutputPart;
@@ -63,9 +62,10 @@ public class PerformanceTest extends CollectionSpacePerformanceTest {
 
     /**
      * Performance test.
+     * @throws Exception 
      */
     @Test
-    public void performanceTest() {
+    public void performanceTest() throws Exception {
         roundTripOverhead(10);
         deleteCollectionObjects();
         String[] coList = this.createCollectionObjects(MAX_RECORDS);
@@ -80,8 +80,9 @@ public class PerformanceTest extends CollectionSpacePerformanceTest {
      *
      * @param numOfCalls the num of calls
      * @return the long
+     * @throws Exception 
      */
-    private long roundTripOverhead(int numOfCalls) {
+    private long roundTripOverhead(int numOfCalls) throws Exception {
         long result = 0;
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
 
@@ -112,8 +113,9 @@ public class PerformanceTest extends CollectionSpacePerformanceTest {
      * Search collection objects.
      *
      * @param numberOfObjects the number of objects
+     * @throws Exception 
      */
-    private void searchCollectionObjects(int numberOfObjects) {
+    private void searchCollectionObjects(int numberOfObjects) throws Exception {
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
         Random randomGenerator = new Random(System.currentTimeMillis());
         Response searchResultsResponse;
@@ -197,8 +199,9 @@ public class PerformanceTest extends CollectionSpacePerformanceTest {
      *
      * @param numberOfObjects the number of objects
      * @return the string[]
+     * @throws Exception 
      */
-    public String[] createCollectionObjects(int numberOfObjects) {
+    public String[] createCollectionObjects(int numberOfObjects) throws Exception {
         Random randomGenerator = new Random(System.currentTimeMillis());
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
         String[] coList = new String[numberOfObjects];
@@ -260,8 +263,9 @@ public class PerformanceTest extends CollectionSpacePerformanceTest {
      * Delete collection objects.
      *
      * @param arrayOfObjects the array of objects
+     * @throws Exception 
      */
-    public void readCollectionObjects(String[] arrayOfObjects) {
+    public void readCollectionObjects(String[] arrayOfObjects) throws Exception {
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
 
         Date startTime = new Date();
@@ -279,8 +283,9 @@ public class PerformanceTest extends CollectionSpacePerformanceTest {
     /**
      * Delete collection objects.
      * FIXME: Deletes a page at a time until there are no more CollectionObjects.
+     * @throws Exception 
      */
-    public void readCollectionObjects() {
+    public void readCollectionObjects() throws Exception {
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
 
         List<AbstractCommonList.ListItem> coListItems = null;
@@ -326,8 +331,9 @@ public class PerformanceTest extends CollectionSpacePerformanceTest {
      * Delete collection objects.
      *
      * @param arrayOfObjects the array of objects
+     * @throws Exception 
      */
-    private void deleteCollectionObjects(String[] arrayOfObjects) {
+    private void deleteCollectionObjects(String[] arrayOfObjects) throws Exception {
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
 
         Date startTime = new Date();
@@ -345,8 +351,9 @@ public class PerformanceTest extends CollectionSpacePerformanceTest {
     /**
      * Delete collection objects.
      * FIXME: Deletes a page at a time until there are no more CollectionObjects.
+     * @throws Exception 
      */
-    private void deleteCollectionObjects() {
+    private void deleteCollectionObjects() throws Exception {
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
 
         List<AbstractCommonList.ListItem> coListItems = null;
index b94982bb7d9a3564e0e8ac16991e0ba78231009c..7efb2f6005a4aee9bd635929dd6563923bfa46ea 100644 (file)
@@ -27,8 +27,8 @@
 package org.collectionspace.services.client;
 
 import javax.ws.rs.core.Response;
-import org.apache.http.HttpStatus;
 
+import org.apache.http.HttpStatus;
 import org.collectionspace.services.account.AccountsCommon;
 import org.collectionspace.services.account.AccountsCommonList;
 import org.collectionspace.services.description.ServiceDescription;
@@ -45,11 +45,11 @@ public class AccountClient extends AbstractServiceClientImpl<AccountsCommonList,
     public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
     public final static String IMMUTABLE = "immutable";
 
-       public AccountClient() {
+       public AccountClient() throws Exception {
                super();
        }
 
-       public AccountClient(String clientPropertiesFilename) {
+       public AccountClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
@@ -67,7 +67,7 @@ public class AccountClient extends AbstractServiceClientImpl<AccountsCommonList,
     }
     
     public String getTenantId() {
-        return getProperty(AccountClient.TENANT_PROPERTY);
+        return getProperty(AccountClient.TENANT_NAME_PROPERTY);
     }
 
        @Override
index 055a57dc809c442505cc38233fb6db23a52c340d..1c634c63b4319b3e147e5e87f75155993883ab42 100644 (file)
@@ -27,8 +27,8 @@
 package org.collectionspace.services.client;
 
 import javax.ws.rs.core.Response;
-import org.apache.http.HttpStatus;
 
+import org.apache.http.HttpStatus;
 import org.collectionspace.services.authorization.AccountRole;
 import org.collectionspace.services.description.ServiceDescription;
 import org.collectionspace.services.jaxb.AbstractCommonList;
@@ -41,11 +41,11 @@ import org.collectionspace.services.jaxb.AbstractCommonList;
 public class AccountRoleClient extends AbstractServiceClientImpl<AbstractCommonList, AccountRole, AccountRole, AccountRoleProxy> {
        public static final String SERVICE_NAME = "accountroles";
 
-       public AccountRoleClient() {
+       public AccountRoleClient() throws Exception {
                super();
        }
        
-       public AccountRoleClient(String clientPropertiesFilename) {
+       public AccountRoleClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
index 1dcee1967e213695094999fda8a95cbdb46cca9a..b50b2af9171356f7862d7d4517893a826caad563 100644 (file)
@@ -40,7 +40,12 @@ import org.collectionspace.services.description.ServiceDescription;
  */
 public class TenantClient extends AbstractServiceClientImpl<TenantsList, Tenant,
                Tenant, TenantProxy> {
-    public static final String SERVICE_NAME = "tenants";
+       
+    public TenantClient() throws Exception {
+               super();
+       }
+
+       public static final String SERVICE_NAME = "tenants";
     public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;
     public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
 
index aead4d2c906b84ab006e6aad7fbc48b3804b8b11..2fba8111e55007cad2c46ab5ffc0822c16580e36 100644 (file)
@@ -81,7 +81,7 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl<AccountRole,
      * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
      */
     @Override
-    protected String getServicePathComponent() {
+    protected String getServicePathComponent() throws Exception {
         return new AccountRoleClient().getServicePathComponent();
     }
     
@@ -94,9 +94,10 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl<AccountRole,
 
     /**
      * Seed data.
+     * @throws Exception 
      */
     @BeforeClass(alwaysRun = true)
-    public void seedData() {
+    public void seedData() throws Exception {
         String userId = "acc-role-user1";
         String accId = createAccount(userId, "acc-role-user1-test@cspace.org");
         AccountValue ava = new AccountValue();
@@ -132,12 +133,12 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl<AccountRole,
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new AccountRoleClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new AccountRoleClient(clientPropertiesFilename);
        }
 
@@ -460,11 +461,11 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl<AccountRole,
 
     /**
      * Clean up.
+     * @throws Exception 
      */
     @AfterClass(alwaysRun = true)
     @Override
-    public void cleanUp() {
-
+    public void cleanUp() throws Exception {
         setupDelete();
 
         String noTest = System.getProperty("noTestCleanup");
@@ -493,8 +494,9 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl<AccountRole,
      * @param userName the user name
      * @param email the email
      * @return the string
+     * @throws Exception 
      */
-    private String createAccount(String userName, String email) {
+    private String createAccount(String userName, String email) throws Exception {
         AccountClient accClient = new AccountClient();
         AccountsCommon account = AccountFactory.createAccountInstance(
                 userName, userName, userName, email, accClient.getTenantId(),
@@ -515,7 +517,7 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl<AccountRole,
         return result;
     }
 
-    private void findPrebuiltAdminAccount() {
+    private void findPrebuiltAdminAccount() throws Exception {
        // Search for the prebuilt admin user and then hold its CSID
        if (prebuiltAdminCSID == null) {
             setupReadList();
@@ -543,8 +545,9 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl<AccountRole,
      * Delete account.
      *
      * @param accId the acc id
+     * @throws Exception 
      */
-    private void deleteAccount(String accId) {
+    private void deleteAccount(String accId) throws Exception {
         AccountClient accClient = new AccountClient();
         setupDelete();
         Response res = accClient.delete(accId);
@@ -562,8 +565,9 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl<AccountRole,
      *
      * @param roleName the role name
      * @return the string
+     * @throws Exception 
      */
-    private String createRole(String roleName) {
+    private String createRole(String roleName) throws Exception {
        String result = null;
        
         RoleClient roleClient = new RoleClient();
@@ -588,8 +592,9 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl<AccountRole,
      * Delete role.
      *
      * @param roleId the role id
+     * @throws Exception 
      */
-    private void deleteRole(String roleId) {
+    private void deleteRole(String roleId) throws Exception {
         setupDelete();
         RoleClient roleClient = new RoleClient();
         Response res = roleClient.delete(roleId);
index ddee6112982d9a88dd0644be912a7a01e8d3c201..3887bbcc77bc5467c18f88d38f42ce85ee4d699a 100644 (file)
@@ -34,7 +34,6 @@ import org.collectionspace.services.account.AccountListItem;
 import org.collectionspace.services.account.Status;
 import org.collectionspace.services.client.AccountFactory;
 import org.collectionspace.services.client.test.AbstractServiceTestImpl;
-
 import org.testng.Assert;
 import org.testng.annotations.Test;
 import org.slf4j.Logger;
@@ -80,7 +79,7 @@ public class AccountServiceTest extends AbstractServiceTestImpl<AccountsCommonLi
      * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
      */
     @Override
-    protected String getServicePathComponent() {
+    protected String getServicePathComponent() throws Exception {
         return new AccountClient().getServicePathComponent();
     }
 
@@ -88,12 +87,12 @@ public class AccountServiceTest extends AbstractServiceTestImpl<AccountsCommonLi
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new AccountClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new AccountClient(clientPropertiesFilename);
        }
        
@@ -706,7 +705,7 @@ public class AccountServiceTest extends AbstractServiceTestImpl<AccountsCommonLi
         }
     }
     
-    private void findPrebuiltAdminAccount() {
+    private void findPrebuiltAdminAccount() throws Exception {
        // Search for the prebuilt admin user and then hold its CSID
        if (prebuiltAdminCSID == null) {
             setupReadList();
@@ -1129,7 +1128,7 @@ public class AccountServiceTest extends AbstractServiceTestImpl<AccountsCommonLi
 
        @Override
        protected AccountsCommon createInstance(String commonPartName,
-                       String identifier) {
+                       String identifier) throws Exception {
                AccountClient client = new AccountClient();
         AccountsCommon account =
                 createAccountInstance(knownUserId, knownUserId, knownUserPassword,
index 10b530804bca3fd7844c5aef2541aca2356188d2..f8814a58d849d19b748a4a95c0a18c4710582e70 100644 (file)
@@ -14,11 +14,11 @@ public class AcquisitionClient extends AbstractCommonListPoxServiceClientImpl<Ac
        public static final String SERVICE_PATH_PROXY = SERVICE_PATH + "/";     
        public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME;
 
-       public AcquisitionClient() {
+       public AcquisitionClient() throws Exception {
                super();
        }
 
-       public AcquisitionClient(String clientPropertiesFilename) {
+       public AcquisitionClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
index 1e64da1c2f841b76e0d75fe0194779c37a746c42..41ea72852f087bf760bbe8967e1942c929c3e6e8 100644 (file)
@@ -154,7 +154,7 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest<AbstractCommonList>
                acquisitionIdsCreated.add(extractId(res));
        }
 
-       protected void createPersonRefs(){
+       protected void createPersonRefs() throws Exception{
                PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
                PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
                                PERSON_AUTHORITY_NAME, PERSON_AUTHORITY_NAME, personAuthClient.getCommonPartName());
@@ -199,7 +199,7 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest<AbstractCommonList>
                personIdsCreated.add(csid);
        }
 
-       protected String createPerson(String firstName, String surName, String shortId, String authRefName ) {
+       protected String createPerson(String firstName, String surName, String shortId, String authRefName ) throws Exception {
                Map<String, String> personInfo = new HashMap<String,String>();
                personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
                personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
@@ -337,9 +337,10 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest<AbstractCommonList>
         * 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.
+        * @throws Exception 
         */
        @AfterClass(alwaysRun=true)
-       public void cleanUp() {
+       public void cleanUp() throws Exception {
                String noTest = System.getProperty("noTestCleanup");
                if(Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
                        if (logger.isDebugEnabled()) {
@@ -384,7 +385,7 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest<AbstractCommonList>
                        String acquisitionAuthorizer,
                        List<String> acquisitionFundingSources,
                        List<String> acqOwners,
-                       List<String> acquisitionSources) {
+                       List<String> acquisitionSources) throws Exception {
 
                AcquisitionsCommon acquisition = new AcquisitionsCommon();
                StructuredDateGroup accessionDateGroup = new StructuredDateGroup(); 
index c6012e830886df37aa1d750965b7d7a87370468c..fd0b6b52316036d70e365d4136ba490a3bd757a6 100644 (file)
@@ -40,7 +40,6 @@ import org.collectionspace.services.acquisition.AcquisitionDateGroupList;
 import org.collectionspace.services.acquisition.AcquisitionSourceList;
 import org.collectionspace.services.acquisition.OwnerList;
 import org.collectionspace.services.acquisition.StructuredDateGroup;
-
 import org.testng.Assert;
 import org.testng.annotations.Test;
 import org.slf4j.Logger;
@@ -77,12 +76,12 @@ public class AcquisitionServiceTest extends AbstractPoxServiceTestImpl<AbstractC
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
        return new AcquisitionClient();
     }
     
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
        return new AcquisitionClient(clientPropertiesFilename);
        }
     
@@ -711,7 +710,7 @@ public class AcquisitionServiceTest extends AbstractPoxServiceTestImpl<AbstractC
     // ---------------------------------------------------------------
 
     @Override
-    protected PoxPayloadOut createInstance(String identifier) {
+    protected PoxPayloadOut createInstance(String identifier) throws Exception {
        return createAcquisitionInstance(identifier);
     }
         
@@ -720,8 +719,9 @@ public class AcquisitionServiceTest extends AbstractPoxServiceTestImpl<AbstractC
      *
      * @param identifier the identifier
      * @return the multipart output
+     * @throws Exception 
      */
-    private PoxPayloadOut createAcquisitionInstance(String identifier) {
+    private PoxPayloadOut createAcquisitionInstance(String identifier) throws Exception {
         AcquisitionsCommon acquisition = new AcquisitionsCommon();
         acquisition.setAcquisitionReferenceNumber("acquisitionReferenceNumber-"  + identifier);
 
index b0714322d53008beb2bac6839ebe09076fd1ee1f..14dcb04b48b75ca85599a24a83c67d5bb6e23221 100644 (file)
@@ -27,6 +27,7 @@ public interface AuthorityJAXBSchema {
        final static String DISPLAY_NAME = "displayName";
        final static String REF_NAME = "refName";
        final static String SHORT_IDENTIFIER = "shortIdentifier";
+       final static String REMOTECLIENT_CONFIG_NAME = "remoteClientConfigName";
        final static String VOCAB_TYPE = "vocabType";
        final static String CSID = "csid";
     final static String REV = "rev";
index 5b293110e5fde3205941acb3a0c91e99c618052a..d1d10e173f91d823b67b4ade4a26367f41fb01a9 100644 (file)
@@ -1,5 +1,6 @@
 package org.collectionspace.services.common.vocabulary;
 
+import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -8,13 +9,17 @@ import javax.ws.rs.core.Response;
 import org.collectionspace.services.client.AuthorityClient;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.PoxPayloadIn;
-import org.collectionspace.services.common.api.RefNameUtils.AuthorityTermInfo;
+import org.collectionspace.services.common.ServiceMain;
+import org.collectionspace.services.common.api.Tools;
 import org.collectionspace.services.common.context.MultipartServiceContextImpl;
 import org.collectionspace.services.common.context.ServiceContext;
 import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.AuthorityItemSpecifier;
 import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.Specifier;
-import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.SpecifierForm;
 import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityIdentifierUtils;
+import org.collectionspace.services.config.service.ServiceBindingType;
+import org.collectionspace.services.config.tenant.RemoteClientConfig;
+import org.collectionspace.services.config.tenant.RemoteClientConfigurations;
+import org.collectionspace.services.config.tenant.TenantBindingType;
 import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
 import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 import org.dom4j.DocumentException;
@@ -22,10 +27,12 @@ import org.nuxeo.ecm.core.api.DocumentModel;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@SuppressWarnings("rawtypes")
 public class AuthorityServiceUtils {
     private static final Logger logger = LoggerFactory.getLogger(AuthorityIdentifierUtils.class);
     //
     // Used to keep track if an authority item's is deprecated
+    public static final String DEFAULT_REMOTECLIENT_CONFIG_NAME = "default";
     public static final String IS_DEPRECATED_PROPERTY = "IS_DEPRECATED_PROPERTY";
     public static final Boolean DEPRECATED = true;
     public static final Boolean NOT_DEPRECATED = !DEPRECATED;
@@ -44,6 +51,58 @@ public class AuthorityServiceUtils {
 
     public static final Boolean NO_CHANGE = null;
 
+    /*
+     * Try to find a named remote client configuration in the current tenant bindings.  If the value of the incoming param 'remoteClientConfigName' is
+     * blank or null, we'll try to find a name in the authority service's bindings.  If we can't find a name there, we'll try using the default name.
+     * 
+     * If the incoming param 'remoteClientConfigName' is not null, we'll look through all the named remote client configurations in the tenant's binding
+     * to find the configuration.  If we can't find the named configuration, we'll throw an exception.
+     * 
+     * If there are no remote client configurations in the tenant's bindings, we'll throw an exception.
+     */
+       public static final RemoteClientConfig getRemoteClientConfig(ServiceContext ctx, String remoteClientConfigName) throws Exception {
+       RemoteClientConfig result = null;
+       
+       TenantBindingType tenantBinding = ServiceMain.getInstance().getTenantBindingConfigReader().getTenantBinding(ctx.getTenantId());
+       RemoteClientConfigurations remoteClientConfigurations = tenantBinding.getRemoteClientConfigurations();
+       if (remoteClientConfigurations != null) {
+               if (Tools.isEmpty(remoteClientConfigName) == true) {
+                       // Since the authority instance didn't specify a remote client config name, let's see if the authority type's service bindings specifies one
+                       ServiceBindingType serviceBindingType =
+                                       ServiceMain.getInstance().getTenantBindingConfigReader().getServiceBinding(ctx.getTenantId(), ctx.getServiceName());
+                       remoteClientConfigName = serviceBindingType.getRemoteClientConfigName();
+               }
+               //
+               // If we still don't have a remote client config name, let's use the default value.
+               //
+               if (Tools.isEmpty(remoteClientConfigName) == true) {
+                       remoteClientConfigName = DEFAULT_REMOTECLIENT_CONFIG_NAME;
+               }
+               
+               List<RemoteClientConfig> remoteClientConfigList = remoteClientConfigurations.getRemoteClientConfig();
+               for (RemoteClientConfig config : remoteClientConfigList) {
+                       if (config.getName().equalsIgnoreCase(remoteClientConfigName)) {
+                               result = config;
+                               break;
+                       }
+               }
+       } else {
+               String errMsg = String.format("No remote client configurations could be found in the tenant bindings for tenant named '%s'.",
+                               ctx.getTenantName());
+               logger.error(errMsg);
+               throw new Exception(errMsg);
+       }
+       
+       if (result == null) {
+               String errMsg = String.format("Could not find a remote client configuration named '%s' in the tenant bindings for tenant named '%s'",
+                               remoteClientConfigName, ctx.getTenantName());
+               logger.error(errMsg);
+               throw new Exception(errMsg);
+       }
+       
+       return result;
+    }
+    
     /**
      * Make a request to the SAS Server for an authority payload.
      * 
@@ -53,10 +112,12 @@ public class AuthorityServiceUtils {
      * @return
      * @throws Exception
      */
-    static public PoxPayloadIn requestPayloadIn(ServiceContext ctx, Specifier specifier, Class responseType) throws Exception {
+    static public PoxPayloadIn requestPayloadInFromRemoteServer(ServiceContext ctx, String remoteClientConfigName, Specifier specifier, Class responseType) throws Exception {
        PoxPayloadIn result = null;
        
-        AuthorityClient client = (AuthorityClient) ctx.getClient(CollectionSpaceClient.SAS_CLIENT_PROPERTIES_FILENAME);
+       RemoteClientConfig remoteClientConfig = getRemoteClientConfig(ctx, remoteClientConfigName);
+        AuthorityClient client = (AuthorityClient) ctx.getClient(remoteClientConfig);
+        
         Response res = client.read(specifier.getURNValue());
         try {
                int statusCode = res.getStatus();
@@ -76,13 +137,19 @@ public class AuthorityServiceUtils {
     }
     
     //
-    // Makes a call to the SAS server for a authority item payload
+    // Makes a call to the remote SAS server for a authority item payload
     //    
-    static public PoxPayloadIn requestPayloadIn(AuthorityItemSpecifier specifier, String serviceName, Class responseType, boolean syncHierarchicalRelationships) throws Exception {
+    static public PoxPayloadIn requestPayloadInFromRemoteServer(
+               AuthorityItemSpecifier specifier, 
+               String remoteClientConfigName, 
+               String serviceName, 
+               Class responseType, 
+               boolean syncHierarchicalRelationships) throws Exception {
        PoxPayloadIn result = null;
        
-       ServiceContext parentCtx = new MultipartServiceContextImpl(serviceName);
-        AuthorityClient client = (AuthorityClient) parentCtx.getClient(CollectionSpaceClient.SAS_CLIENT_PROPERTIES_FILENAME);
+       ServiceContext authorityCtx = new MultipartServiceContextImpl(serviceName);
+       RemoteClientConfig remoteClientConfig = getRemoteClientConfig(authorityCtx, remoteClientConfigName);
+        AuthorityClient client = (AuthorityClient) authorityCtx.getClient(remoteClientConfig);
         Response res = client.readItem(specifier.getParentSpecifier().getURNValue(), specifier.getItemSpecifier().getURNValue(),
                        AuthorityClient.INCLUDE_DELETED_ITEMS, syncHierarchicalRelationships);
         
index f7cf5993500d6327f91f3e8d347d46c97f66757f..87b6720f49f0b9132c87352cc353effa05df8782 100644 (file)
@@ -32,24 +32,19 @@ 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.PayloadInputPart;
-import org.collectionspace.services.client.VocabularyClient;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.client.XmlTools;
 import org.collectionspace.services.client.workflow.WorkflowClient;
 import org.collectionspace.services.common.ResourceMap;
-import org.collectionspace.services.common.api.CommonAPI;
 import org.collectionspace.services.common.api.RefName;
 import org.collectionspace.services.common.api.RefName.Authority;
 import org.collectionspace.services.common.api.RefNameUtils;
-import org.collectionspace.services.common.api.RefNameUtils.AuthorityInfo;
 import org.collectionspace.services.common.api.RefNameUtils.AuthorityTermInfo;
 import org.collectionspace.services.common.api.Tools;
 import org.collectionspace.services.common.context.ServiceContext;
 import org.collectionspace.services.common.document.DocumentException;
-import org.collectionspace.services.common.document.DocumentHandler;
 import org.collectionspace.services.common.document.DocumentNotFoundException;
 import org.collectionspace.services.common.document.DocumentReferenceException;
 import org.collectionspace.services.common.document.DocumentWrapper;
@@ -68,7 +63,7 @@ import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
 import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
 import org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl;
 import org.collectionspace.services.nuxeo.util.NuxeoUtils;
-import org.dom4j.Document;
+
 import org.dom4j.Element;
 import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.DocumentModel;
@@ -81,6 +76,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision: $
  * $LastChangedDate: $
  */
+@SuppressWarnings("rawtypes")
 public abstract class AuthorityDocumentModelHandler<AuthCommon>
         extends NuxeoDocumentModelHandler<AuthCommon> {
     
@@ -125,7 +121,7 @@ public abstract class AuthorityDocumentModelHandler<AuthCommon>
             return payloadInputPart;
     }
     
-    @Override
+       @Override
     public boolean handleSync(DocumentWrapper<Object> wrapDoc) throws Exception {
        boolean result = false;
        ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = getServiceContext();
@@ -137,11 +133,12 @@ public abstract class AuthorityDocumentModelHandler<AuthCommon>
         if (docModel != null) {
                Long localRev = (Long) NuxeoUtils.getProperyValue(docModel, AuthorityJAXBSchema.REV);
                String shortId = (String) NuxeoUtils.getProperyValue(docModel, AuthorityJAXBSchema.SHORT_IDENTIFIER);
+               String remoteClientConfigName = (String) NuxeoUtils.getProperyValue(docModel, AuthorityJAXBSchema.REMOTECLIENT_CONFIG_NAME); // If set, contains the name of the remote client configuration (remoteClientConfigName) from the tenant bindings
                //
                // Using the short ID of the local authority, create a URN specifier to retrieve the SAS authority
                //
                Specifier sasSpecifier = new Specifier(SpecifierForm.URN_NAME, shortId);
-               PoxPayloadIn sasPayloadIn = AuthorityServiceUtils.requestPayloadIn(ctx, sasSpecifier, getEntityResponseType());
+               PoxPayloadIn sasPayloadIn = AuthorityServiceUtils.requestPayloadInFromRemoteServer(ctx, remoteClientConfigName, sasSpecifier, getEntityResponseType());
                //
                // If the authority on the SAS is newer, synch all the items and then the authority record as well
                //
@@ -261,7 +258,6 @@ public abstract class AuthorityDocumentModelHandler<AuthCommon>
      * @return
      * @throws Exception
      */
-    @SuppressWarnings("rawtypes")
        private long deleteOrDeprecateItems(ServiceContext ctx, Specifier authoritySpecifier, ArrayList<String> itemShortIdList) throws Exception {
        long result = 0;
         AuthorityItemSpecifier authorityItemSpecificer = null;
@@ -362,9 +358,14 @@ public abstract class AuthorityDocumentModelHandler<AuthCommon>
         Specifier itemSpecifier = Specifier.getSpecifier(itemIdentifier);
         AuthorityItemSpecifier sasAuthorityItemSpecifier = new AuthorityItemSpecifier(authoritySpecifier, itemSpecifier);
         //
+        // Get the remote client configuration name
+        //
+        DocumentModel docModel = NuxeoUtils.getDocFromSpecifier(ctx, getRepositorySession(), authorityCommonSchemaName, authoritySpecifier);
+        String remoteClientConfigName = (String) NuxeoUtils.getProperyValue(docModel, AuthorityJAXBSchema.REMOTECLIENT_CONFIG_NAME); // If set, contains the name of the remote client configuration (remoteClientConfigName) from the tenant bindings
+        //
         // Get the remote payload
         //
-        PoxPayloadIn sasPayloadIn = AuthorityServiceUtils.requestPayloadIn(sasAuthorityItemSpecifier, 
+        PoxPayloadIn sasPayloadIn = AuthorityServiceUtils.requestPayloadInFromRemoteServer(sasAuthorityItemSpecifier, remoteClientConfigName,
                        ctx.getServiceName(), getEntityResponseType(), syncHierarchicalRelationships);
         sasPayloadIn = AuthorityServiceUtils.filterRefnameDomains(ctx, sasPayloadIn); // We need to filter domain name part of any and all refnames in the payload
         //
index 7f816c54cd92ba7b4e9d8b8164f0f3b0ec2944a4..2d6f74a3c0dd7af08ee76635251d681427008b39 100644 (file)
@@ -451,17 +451,16 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
         //
         DocumentModel authorityDocModel = NuxeoUtils.getDocFromSpecifier(ctx, getRepositorySession(), authorityCommonSchemaName,
                        authorityItemSpecifier.getParentSpecifier());
-        String authorityShortId = (String) NuxeoUtils.getProperyValue(authorityDocModel, AuthorityJAXBSchema.SHORT_IDENTIFIER);
+        String authorityShortId = (String)NuxeoUtils.getProperyValue(authorityDocModel, AuthorityJAXBSchema.SHORT_IDENTIFIER);
         String localParentCsid = authorityDocModel.getName();
+        String remoteClientConfigName = (String)NuxeoUtils.getProperyValue(authorityDocModel, AuthorityJAXBSchema.REMOTECLIENT_CONFIG_NAME);
         //
         // Using the short IDs of the local authority and item, create URN specifiers and retrieve the SAS authority item
         //
         AuthorityItemSpecifier sasAuthorityItemSpecifier = new AuthorityItemSpecifier(SpecifierForm.URN_NAME, authorityShortId, itemShortId);
         // Get the shared authority server's copy
-        PoxPayloadIn sasPayloadIn = AuthorityServiceUtils.requestPayloadIn(sasAuthorityItemSpecifier, 
-                       getAuthorityServicePath(), getEntityResponseType(), AuthorityClient.INCLUDE_RELATIONS);
-        Long sasRev = getRevision(sasPayloadIn);
-        String sasWorkflowState = getWorkflowState(sasPayloadIn);
+        PoxPayloadIn sasPayloadIn = AuthorityServiceUtils.requestPayloadInFromRemoteServer(sasAuthorityItemSpecifier, 
+                       remoteClientConfigName, getAuthorityServicePath(), getEntityResponseType(), AuthorityClient.INCLUDE_RELATIONS);
         
         //
         // Get the RelationsCommonList and remove the CSIDs since they are for remote items only. We'll use
@@ -556,13 +555,15 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
                        authorityItemSpecifier.getParentSpecifier());
         String authorityShortId = (String) NuxeoUtils.getProperyValue(authorityDocModel, AuthorityJAXBSchema.SHORT_IDENTIFIER);
         String localParentCsid = authorityDocModel.getName();
+        String remoteClientConfigName = (String)NuxeoUtils.getProperyValue(authorityDocModel, AuthorityJAXBSchema.REMOTECLIENT_CONFIG_NAME);
+
         //
         // Using the short IDs of the local authority and item, create URN specifiers and retrieve the SAS authority item
         //
         AuthorityItemSpecifier sasAuthorityItemSpecifier = new AuthorityItemSpecifier(SpecifierForm.URN_NAME, authorityShortId, itemShortId);
         // Get the shared authority server's copy
-        PoxPayloadIn sasPayloadIn = AuthorityServiceUtils.requestPayloadIn(sasAuthorityItemSpecifier, 
-                       getAuthorityServicePath(), getEntityResponseType(), AuthorityClient.DONT_INCLUDE_RELATIONS);
+        PoxPayloadIn sasPayloadIn = AuthorityServiceUtils.requestPayloadInFromRemoteServer(sasAuthorityItemSpecifier, 
+                       remoteClientConfigName, getAuthorityServicePath(), getEntityResponseType(), AuthorityClient.DONT_INCLUDE_RELATIONS);
         Long sasRev = getRevision(sasPayloadIn);
         String sasWorkflowState = getWorkflowState(sasPayloadIn);
         //
index 61e89d44d3793e8b6dde3601bc688ffeb1c285e8..442c23b88f7bb687a8837cab05bc6bae1bcf493c 100644 (file)
@@ -44,11 +44,11 @@ public class PermissionClient extends AbstractServiceClientImpl<PermissionsList,
        public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
        public static final String SERVICE_PATH_PROXY = SERVICE_PATH + "/";     
     
-       public PermissionClient() {
+       public PermissionClient() throws Exception {
                super();
        }
 
-       public PermissionClient(String clientPropertiesFilename) {
+       public PermissionClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
index 96d8d367dd10056dee16728e0c6863904c3d8822..93f888f8f6b77b22b0c31abded9f7f1969a999ef 100644 (file)
@@ -39,11 +39,11 @@ import org.collectionspace.services.description.ServiceDescription;
  */
 public class PermissionRoleClient extends AbstractServiceClientImpl<PermissionRole, PermissionRole, PermissionRole, PermissionRoleProxy> {
        
-       public PermissionRoleClient() {
+       public PermissionRoleClient() throws Exception {
                super();
        }
 
-       public PermissionRoleClient(String clientPropertiesFilename) {
+       public PermissionRoleClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
index edf0562e5f1e19e94fc1ae8c4535c11734c5c218..4a9755b605b067b2ea9f9103b4f2d9191c2ae519 100644 (file)
@@ -32,6 +32,10 @@ import javax.ws.rs.core.Response;
 
 
 
+
+
+
+
 import org.apache.http.HttpStatus;
 import org.collectionspace.services.authorization.AccountRole;
 import org.collectionspace.services.authorization.Role;
@@ -50,11 +54,11 @@ public class RoleClient extends AbstractServiceClientImpl<RolesList, Role, Role,
        public static final String SERVICE_PATH_PROXY = SERVICE_PATH + "/";     
        public final static String IMMUTABLE = "immutable";
 
-    public RoleClient() {
+    public RoleClient() throws Exception {
                super();
        }
 
-    public RoleClient(String clientPropertiesFilename) {
+    public RoleClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
index 6759755569ac53f708aabfcb07c19e9d62b59e34..78d7862b628708deacf5447e01eda967ffc98f06 100644 (file)
@@ -40,11 +40,11 @@ import org.collectionspace.services.description.ServiceDescription;
  */
 public class RolePermissionClient extends AbstractServiceClientImpl<PermissionRole, PermissionRole, PermissionRole, RolePermissionProxy> {
     
-       public RolePermissionClient() {
+       public RolePermissionClient() throws Exception {
                super();
        }
 
-    public RolePermissionClient(String clientPropertiesFilename) {
+    public RolePermissionClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
index 9873aa3f2b726d048144d482cbfedbba4378009b..b2a81d262427abd4e57ba388909a9608e4bc93e7 100644 (file)
@@ -44,7 +44,6 @@ import org.collectionspace.services.client.PermissionRoleFactory;
 import org.collectionspace.services.client.RoleClient;
 import org.collectionspace.services.client.RoleFactory;
 import org.collectionspace.services.client.test.AbstractServiceTestImpl;
-
 import org.testng.Assert;
 import org.testng.annotations.Test;
 import org.slf4j.Logger;
@@ -82,7 +81,7 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl<Permissio
      * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
      */
     @Override
-    protected String getServicePathComponent() {
+    protected String getServicePathComponent() throws Exception {
         return new PermissionRoleClient().getServicePathComponent();
     }
     
@@ -100,9 +99,10 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl<Permissio
        
     /**
      * Seed data.
+     * @throws Exception 
      */
     @BeforeClass(alwaysRun = true)
-    public void seedData() {
+    public void seedData() throws Exception {
         String ra = TEST_SERVICE_NAME + TEST_MARKER;
         String accPermId = createPermission(ra, EffectType.PERMIT);
         PermissionValue pva = new PermissionValue();
@@ -143,12 +143,12 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl<Permissio
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new PermissionRoleClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new PermissionRoleClient(clientPropertiesFilename);
        }
 
@@ -543,10 +543,11 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl<Permissio
 
     /**
      * Clean up.
+     * @throws Exception 
      */
     @AfterClass(alwaysRun = true)
     @Override
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         setupDelete();
         String noTest = System.getProperty("noTestCleanup");
         if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
@@ -573,8 +574,9 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl<Permissio
      * @param resName the res name
      * @param effect the effect
      * @return the string
+     * @throws Exception 
      */
-    private String createPermission(String resName, EffectType effect) {
+    private String createPermission(String resName, EffectType effect) throws Exception {
         if (logger.isDebugEnabled()) {
             logger.debug(getTestBanner("createPermission"));
         }
@@ -608,8 +610,9 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl<Permissio
      * Delete permission.
      *
      * @param permId the perm id
+     * @throws Exception 
      */
-    private void deletePermission(String permId) {
+    private void deletePermission(String permId) throws Exception {
         if (logger.isDebugEnabled()) {
             logger.debug(getTestBanner("deletePermission"));
         }
@@ -636,8 +639,9 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl<Permissio
      *
      * @param roleName the role name
      * @return the string
+     * @throws Exception 
      */
-    private String createRole(String roleName) {
+    private String createRole(String roleName) throws Exception {
         if (logger.isDebugEnabled()) {
             logger.debug(getTestBanner("createRole"));
         }
@@ -671,8 +675,9 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl<Permissio
      * Delete role.
      *
      * @param roleId the role id
+     * @throws Exception 
      */
-    private void deleteRole(String roleId) {
+    private void deleteRole(String roleId) throws Exception {
         if (logger.isDebugEnabled()) {
             logger.debug(getTestBanner("deleteRole"));
         }
index f89259cf7287951c944477de0d4e8765d23253e8..eea6502f5d15ea02dc59dc3dba3f6dba49655e7d 100644 (file)
@@ -27,6 +27,8 @@ import java.util.List;
 
 import javax.ws.rs.core.Response;
 
+
+
 //import org.collectionspace.services.authorization.ActionType;
 import org.collectionspace.services.authorization.perms.EffectType;
 import org.collectionspace.services.client.CollectionSpaceClient;
@@ -36,7 +38,6 @@ import org.collectionspace.services.authorization.perms.PermissionAction;
 import org.collectionspace.services.authorization.perms.PermissionsList;
 import org.collectionspace.services.client.PermissionFactory;
 import org.collectionspace.services.client.test.AbstractServiceTestImpl;
-
 import org.testng.Assert;
 import org.testng.annotations.Test;
 import org.slf4j.Logger;
@@ -76,12 +77,12 @@ public class PermissionServiceTest extends AbstractServiceTestImpl<PermissionsLi
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new PermissionClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new PermissionClient(clientPropertiesFilename);
        }
 
index 4616bba3a0feb09d1b54564a9617cd794621878e..d264fb28e1d6fc96ff4871728ddd2be58b81c995 100644 (file)
@@ -46,7 +46,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.testng.Assert;
 import org.testng.annotations.Test;
 import org.slf4j.Logger;
@@ -81,7 +80,7 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl<Permissio
      * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
      */
     @Override
-    protected String getServicePathComponent() {
+    protected String getServicePathComponent() throws Exception {
         return new RolePermissionClient().getServicePathComponent();
     }
     
@@ -103,9 +102,10 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl<Permissio
     
     /**
      * Seed data.
+     * @throws Exception 
      */
     @BeforeClass(alwaysRun = true)
-    public void seedData() {
+    public void seedData() throws Exception {
 
         String rn1 = getRoleName();
         String r1RoleId = createRole(rn1);
@@ -140,12 +140,12 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl<Permissio
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new RolePermissionClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new RolePermissionClient(clientPropertiesFilename);
        }       
 
@@ -538,10 +538,11 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl<Permissio
 
     /**
      * Clean up.
+     * @throws Exception 
      */
     @AfterClass(alwaysRun = true)
     @Override
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         setupDelete();
         String noTest = System.getProperty("noTestCleanup");
         if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
@@ -567,8 +568,9 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl<Permissio
      * @param resName the res name
      * @param effect the effect
      * @return the string
+     * @throws Exception 
      */
-    private String createPermission(String resName, EffectType effect) {
+    private String createPermission(String resName, EffectType effect) throws Exception {
         setupCreate();
         PermissionClient permClient = new PermissionClient();
         List<PermissionAction> actions = PermissionFactory.createDefaultActions();
@@ -600,8 +602,9 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl<Permissio
      * Delete permission.
      *
      * @param permId the perm id
+     * @throws Exception 
      */
-    private void deletePermission(String permId) {
+    private void deletePermission(String permId) throws Exception {
         setupDelete();
         PermissionClient permClient = new PermissionClient();
 
@@ -628,8 +631,9 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl<Permissio
      *
      * @param roleName the role name
      * @return the string
+     * @throws Exception 
      */
-    private String createRole(String roleName) {
+    private String createRole(String roleName) throws Exception {
         setupCreate();
         RoleClient roleClient = new RoleClient();
 
@@ -662,8 +666,9 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl<Permissio
      * Delete role.
      *
      * @param roleId the role id
+     * @throws Exception 
      */
-    private void deleteRole(String roleId) {
+    private void deleteRole(String roleId) throws Exception {
         setupDelete();
         RoleClient roleClient = new RoleClient();
         Response res = null;
index 5c00809686487f43bedc77c4e307bd72611e966e..5d37e19cdb83a99621ff33e527f2c69dd708fd2e 100644 (file)
@@ -69,7 +69,7 @@ public class RoleServiceTest extends AbstractServiceTestImpl<RolesList, Role, Ro
     }
     
     @Override
-    protected String getServicePathComponent() {
+    protected String getServicePathComponent() throws Exception {
         return new RoleClient().getServicePathComponent();
     }
 
@@ -84,12 +84,12 @@ public class RoleServiceTest extends AbstractServiceTestImpl<RolesList, Role, Ro
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new RoleClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new RoleClient(clientPropertiesFilename);
        }       
     
index 92578fc3e1fac7aeccd5cdf9298e9574bc2a4908..097bd972f37df2174a8c00e15de1719e6310f3e8 100644 (file)
@@ -31,11 +31,11 @@ public class BatchClient extends AbstractCommonListPoxServiceClientImpl<BatchPro
        public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
        public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME; 
 
-       public BatchClient() {
+       public BatchClient() throws Exception {
                super();
        }
 
-       public BatchClient(String clientPropertiesFilename) {
+       public BatchClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
index d8356c26215c4bbf1397a42258fa99d76474cf6e..aa8e2c0b2a859912d80b0f4572c543cebff00724 100644 (file)
@@ -30,7 +30,6 @@ import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.batch.BatchCommon;
-
 import org.testng.Assert;
 import org.testng.annotations.Test;
 import org.slf4j.Logger;
@@ -41,6 +40,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision:  $
  * $LastChangedDate:  $
  */
+@SuppressWarnings("rawtypes")
 public class BatchServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonList, BatchCommon> {
 
     private final String CLASS_NAME = BatchServiceTest.class.getName();
@@ -57,13 +57,13 @@ public class BatchServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonL
                return BatchClient.SERVICE_NAME;
        }
     
-    @Override
-    protected CollectionSpaceClient getClientInstance() {
+       @Override
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new BatchClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new BatchClient(clientPropertiesFilename);
        }       
 
@@ -72,18 +72,18 @@ public class BatchServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonL
     // ---------------------------------------------------------------
     
     @Override
-    protected PoxPayloadOut createInstance(String identifier) {
+    protected PoxPayloadOut createInstance(String identifier) throws Exception {
        return createBatchInstance(identifier);
     }
     
        @Override
        protected PoxPayloadOut createInstance(String commonPartName,
-                       String identifier) {
+                       String identifier) throws Exception {
                PoxPayloadOut result = createBatchInstance(identifier);
                return result;
        }
 
-    private PoxPayloadOut createBatchInstance(String exitNumber) {
+    private PoxPayloadOut createBatchInstance(String exitNumber) throws Exception {
         String identifier = "batchNumber-" + exitNumber;
         BatchCommon batch = new BatchCommon();
         batch.setName(identifier);
index d4ba6f7cd877b9b99f0234be017e0ff0090d2ac5..1d330f1512c6070d093a7ccada1ef25227d1d8f0 100644 (file)
@@ -46,11 +46,11 @@ public class BlobClient extends AbstractCommonListPoxServiceClientImpl<BlobProxy
        public static final String IMAGE_WIDTH_LABEL = "width";
        public static final String IMAGE_HEIGHT_LABEL = "height";       
 
-       public BlobClient() {
+       public BlobClient() throws Exception {
                super();
        }
 
-       public BlobClient(String clientPropertiesFilename) {
+       public BlobClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
index 9ad8c60ec059fa3641a926ab6ee97a3632f54ab3..04f97b9858bcda1e7ecaf2a024ded2115700bf95 100644 (file)
@@ -41,7 +41,6 @@ import org.collectionspace.services.common.authorityref.AuthorityRefList;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.blob.BlobsCommon;
 import org.collectionspace.services.person.PersonTermGroup;
-
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
@@ -90,7 +89,7 @@ public class BlobAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
         throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
 
-    private PoxPayloadOut createBlobInstance(String depositorRefName) {
+    private PoxPayloadOut createBlobInstance(String depositorRefName) throws Exception {
        BlobClient blobClient = new BlobClient();
         this.depositorRefName = depositorRefName;
         this.blobName = "testblob-"+createIdentifier();
@@ -125,7 +124,7 @@ public class BlobAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
         }
     }
 
-    protected void createPersonRefs() {
+    protected void createPersonRefs() throws Exception {
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         // 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());
@@ -151,7 +150,7 @@ public class BlobAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
         }
     }
 
-    protected String createPerson(String firstName, String surName, String shortId, String authRefName) {
+    protected String createPerson(String firstName, String surName, String shortId, String authRefName) throws Exception {
        String result = null;
        
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
@@ -241,9 +240,10 @@ public class BlobAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
      * 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.
+     * @throws Exception 
      */
     @AfterClass(alwaysRun = true)
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         String noTest = System.getProperty("noTestCleanup");
         if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
             logger.debug("Skipping Cleanup phase ...");
index c0caf6b2ebcb3f463c965d1675d064a1f3e3cf65..56cefc5aa4c3320ca392c923496ea552256b249a 100644 (file)
@@ -23,6 +23,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.Test;
 
+@SuppressWarnings("rawtypes")
 public class BlobScaleTest extends BaseServiceTest<AbstractCommonList> {
 
     private final Logger logger = LoggerFactory.getLogger(BlobScaleTest.class);
@@ -40,12 +41,12 @@ public class BlobScaleTest extends BaseServiceTest<AbstractCommonList> {
        private static Random generator = new Random(System.currentTimeMillis());
        
        @Override
-       protected CollectionSpaceClient getClientInstance() {
+       protected CollectionSpaceClient getClientInstance() throws Exception {
         return new BlobClient();
        }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new BlobClient(clientPropertiesFilename);
        }
 
@@ -79,7 +80,7 @@ public class BlobScaleTest extends BaseServiceTest<AbstractCommonList> {
        }
        
        @Test(dataProvider = "testName", dependsOnMethods = {"scaleTest"})
-       public void scaleGETTest(String testName) throws MalformedURLException, InterruptedException {
+       public void scaleGETTest(String testName) throws Exception {
                this.setupRead();
         BlobClient client = new BlobClient();
         
@@ -100,7 +101,7 @@ public class BlobScaleTest extends BaseServiceTest<AbstractCommonList> {
        }
        
        @Test(dataProvider = "testName")
-       public void scaleTest(String testName) throws MalformedURLException {
+       public void scaleTest(String testName) throws Exception {
                this.createDirectory(GENERATED_IMAGES);
                setupCreate();
                int imagesToCreate = getImagesToCreate();
index b767284daee15e3b98d2129cebef93fdaacd9f5a..368c3643e650df3dfd51651a61704ab56a0c2b1d 100644 (file)
@@ -38,12 +38,10 @@ import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.blob.BlobsCommon;
 import org.collectionspace.services.blob.DimensionSubGroup;
 import org.collectionspace.services.blob.MeasuredPartGroup;
-
 import org.testng.Assert;
 import org.testng.annotations.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataOutput;
 import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
 
@@ -52,6 +50,7 @@ import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
  * $LastChangedRevision:  $
  * $LastChangedDate:  $
  */
+@SuppressWarnings("rawtypes")
 public class BlobServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonList, BlobsCommon> {
 
     private final String CLASS_NAME = BlobServiceTest.class.getName();
@@ -82,12 +81,12 @@ public class BlobServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonLi
        }
     
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new BlobClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new BlobClient(clientPropertiesFilename);
        }
 
@@ -264,11 +263,11 @@ public class BlobServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonLi
     // ---------------------------------------------------------------
     
     @Override
-    protected PoxPayloadOut createInstance(String identifier) {
+    protected PoxPayloadOut createInstance(String identifier) throws Exception {
        return createBlobInstance(identifier);
     }    
     
-    private PoxPayloadOut createBlobInstance(String exitNumber) {
+    private PoxPayloadOut createBlobInstance(String exitNumber) throws Exception {
        BlobClient client = new BlobClient();
         String identifier = "blobNumber-" + exitNumber;
         BlobsCommon blob = new BlobsCommon();
@@ -286,7 +285,7 @@ public class BlobServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonLi
 
        @Override
        protected PoxPayloadOut createInstance(String commonPartName,
-                       String identifier) {
+                       String identifier) throws Exception {
                return createInstance(identifier);
        }
 
index 5bc99f70f01e715fc70c88d8f4a5113f0f190622..6bf858faada3bc57cf58f637985e93c5a79e118e 100644 (file)
@@ -46,11 +46,11 @@ public class CitationAuthorityClient extends AuthorityClientImpl<Citationauthori
     //
     // Constructors
     //
-    public CitationAuthorityClient() {
+    public CitationAuthorityClient() throws Exception {
        super();
     }
     
-    public CitationAuthorityClient(String clientPropertiesFilename) {
+    public CitationAuthorityClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
     
index 522fcbd9d68d5c6fda79bc493ef25b8a419d81e6..27182d96403e241e89e1efc16806dd25e9bfd0cd 100644 (file)
@@ -38,7 +38,6 @@ import org.collectionspace.services.client.CitationAuthorityClient;
 import org.collectionspace.services.client.CitationAuthorityClientUtils;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.jaxb.AbstractCommonList;
-
 import org.dom4j.DocumentException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -53,6 +52,7 @@ import org.testng.annotations.Test;
  * $LastChangedRevision: 753 $ $LastChangedDate: 2009-09-23 11:03:36 -0700 (Wed,
  * 23 Sep 2009) $
  */
+@SuppressWarnings("rawtypes")
 public class CitationAuthorityServiceTest extends AbstractAuthorityServiceTest<CitationauthoritiesCommon, CitationsCommon> {
 
     /**
@@ -91,12 +91,12 @@ public class CitationAuthorityServiceTest extends AbstractAuthorityServiceTest<C
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new CitationAuthorityClient();
     }
     
     @Override
-    protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+    protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new CitationAuthorityClient(clientPropertiesFilename);
     }
 
@@ -149,8 +149,9 @@ public class CitationAuthorityServiceTest extends AbstractAuthorityServiceTest<C
      *
      * @param vcsid the vcsid
      * @param name the name
+     * @throws Exception 
      */
-    private void readItemList(String vcsid, String shortId) {
+    private void readItemList(String vcsid, String shortId) throws Exception {
 
         String testName = "readItemList";
 
@@ -232,9 +233,10 @@ public class CitationAuthorityServiceTest extends AbstractAuthorityServiceTest<C
      * 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.
+     * @throws Exception 
      */
     @AfterClass(alwaysRun = true)
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         String noTest = System.getProperty("noTestCleanup");
         if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
             if (logger.isDebugEnabled()) {
@@ -314,7 +316,7 @@ public class CitationAuthorityServiceTest extends AbstractAuthorityServiceTest<C
     //
     @Override
     protected PoxPayloadOut createInstance(String commonPartName,
-            String identifier) {
+            String identifier) throws Exception {
         CitationAuthorityClient client = new CitationAuthorityClient();
         String shortId = identifier;
         String displayName = "displayName-" + shortId;
index 5edc6a2a2befb78e5dfba137088f7b197712c9c0..4a93e08092a123228b2870b0b68a4d154c897ffd 100644 (file)
@@ -16,11 +16,11 @@ public abstract class AbstractCommonListPoxServiceClientImpl<P extends Collectio
        // All clients returning AbstractCommonList types should extend this class.
        //
        
-       public AbstractCommonListPoxServiceClientImpl() {
+       public AbstractCommonListPoxServiceClientImpl() throws Exception {
                super();
        }
        
-       public AbstractCommonListPoxServiceClientImpl(String clientPropertiesFilename) {
+       public AbstractCommonListPoxServiceClientImpl(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 }
index 70cae8558bda5fa131b6ae69ae8c0fb598efbbc2..5ff9e7d33a9655104093731a03c69d7510a2837f 100644 (file)
@@ -20,11 +20,11 @@ public abstract class AbstractPoxServiceClientImpl<CLT extends AbstractCommonLis
        
     protected List<String> allResourceIdsCreated = new ArrayList<String>();
        
-    public AbstractPoxServiceClientImpl(String clientPropertiesFilename) {
+    public AbstractPoxServiceClientImpl(String clientPropertiesFilename) throws Exception {
        super(clientPropertiesFilename);
     }
 
-       public AbstractPoxServiceClientImpl() {
+       public AbstractPoxServiceClientImpl() throws Exception {
                super();
        }
        
index ad76e11aaf644779b89394026a02a6f23ef0c59c..bfb78d3198c43069ef4a722de0d80eb344189cea 100644 (file)
 package org.collectionspace.services.client;
 
 import java.io.IOException;
-import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Properties;
 
-import javax.ws.rs.PathParam;
 import javax.ws.rs.client.ClientBuilder;
 import javax.ws.rs.client.ClientRequestContext;
 import javax.ws.rs.client.ClientRequestFilter;
@@ -40,19 +38,22 @@ import javax.xml.bind.DatatypeConverter;
 
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.UsernamePasswordCredentials;
-import org.apache.commons.httpclient.auth.AuthScope; //import org.collectionspace.services.collectionobject.CollectionobjectsCommonList;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.collectionspace.services.common.authorityref.AuthorityRefList;
+import org.apache.commons.httpclient.auth.AuthScope;
+
+import org.collectionspace.services.common.api.Tools;
 import org.collectionspace.services.jaxb.AbstractCommonList;
-import org.jboss.resteasy.client.ClientResponse; //import org.collectionspace.services.common.context.ServiceContext;
-import org.jboss.resteasy.client.ProxyFactory;
-import org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor;
+
 import org.jboss.resteasy.client.jaxrs.ResteasyClient;
-//import org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor;
+import org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor;
 import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
 import org.jboss.resteasy.spi.ResteasyProviderFactory;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+// FIXME: Deprecated classes that need to be updated
+import org.jboss.resteasy.client.ProxyFactory;
+import org.apache.http.impl.client.DefaultHttpClient;
+
 
 /**
  * Private class for JAX-RS authentication
@@ -104,7 +105,7 @@ public abstract class AbstractServiceClientImpl<CLT, REQUEST_PT, RESPONSE_PT, P
        implements CollectionSpaceClient<CLT, REQUEST_PT, RESPONSE_PT, P> {
 
     /** The logger. */
-    protected final Logger logger = LoggerFactory.getLogger(AbstractServiceClientImpl.class);
+    static protected final Logger logger = LoggerFactory.getLogger(AbstractServiceClientImpl.class);
     /**
      * The character used to separate the words in a part label
      */
@@ -135,7 +136,7 @@ public abstract class AbstractServiceClientImpl<CLT, REQUEST_PT, RESPONSE_PT, P
      * Instantiates a new abstract service client impl.
      * @throws Exception 
      */
-    public AbstractServiceClientImpl() {
+    public AbstractServiceClientImpl() throws Exception {
        this(CollectionSpaceClient.DEFAULT_CLIENT_PROPERTIES_FILENAME);
     }
     
@@ -143,7 +144,7 @@ public abstract class AbstractServiceClientImpl<CLT, REQUEST_PT, RESPONSE_PT, P
      * Instantiates a new abstract service client impl.
      * @throws Exception 
      */
-    public AbstractServiceClientImpl(String propertiesFileName) {
+    public AbstractServiceClientImpl(String propertiesFileName) throws Exception {
         setClientProperties(propertiesFileName);
     }
     
@@ -152,7 +153,7 @@ public abstract class AbstractServiceClientImpl<CLT, REQUEST_PT, RESPONSE_PT, P
      * @throws Exception 
      */
     public AbstractServiceClientImpl(Properties properties) {
-        setClientProperties(properties);
+        setClientProperties(properties, false);
     }
     
     /**
@@ -333,91 +334,76 @@ public abstract class AbstractServiceClientImpl<CLT, REQUEST_PT, RESPONSE_PT, P
     /**
      * readProperties reads properties from system class path as well as it
      * overrides properties made available using command line
+     * @throws Exception 
      *
      * @exception RuntimeException
      */
     @Override
-    public void setClientProperties(String clientPropertiesFilename) {
-       Properties inProperties = new Properties();
-        ClassLoader cl = Thread.currentThread().getContextClassLoader();
-        InputStream is = null;
-        try {
-            is = cl.getResourceAsStream(clientPropertiesFilename);
-            inProperties.load(is);
-            setClientProperties(inProperties);
-        } catch (Exception e) {
-            logger.debug("Caught exception while reading properties", e);
-            throw new RuntimeException(e);
-        } finally {
-            if (is != null) {
-                try {
-                    is.close();
-                } catch (Exception e) {
-                    if (logger.isDebugEnabled() == true) {
-                        e.printStackTrace();
-                    }
-                }
-            }
-        }
+    public void setClientProperties(String clientPropertiesFilename) throws Exception {
+       Properties inProperties = Tools.loadProperties(clientPropertiesFilename, true);
+        setClientProperties(inProperties, true);
     }
     
+    @Override
+    public void setClientProperties(Properties inProperties) {
+       setClientProperties(inProperties, false);
+    }
+
     /**
-     * Set our instance's properties to the in coming value.  But only if the values don't already
-     * existing as System properties.
+     * Set our instance's properties to the in coming values.  But if 'overrideWithSyste' param is set to true then
+     * only use the incoming values if the values don't already exist as System properties.
      * 
      * @param inProperties
      * @throws Exception 
      */
-    protected void setClientProperties(Properties inProperties) {
+    protected void setClientProperties(Properties inProperties, boolean overrideWithSystemValues) {
         properties = inProperties;
         
-        if (logger.isDebugEnabled()) {
-               System.getenv();
-               System.getenv("An environment variable name");
-            printProperties();
-        }
-        
-        String spec = System.getProperty(URL_PROPERTY);
-        if (spec != null && !"".equals(spec)) {
-            properties.setProperty(URL_PROPERTY, spec);
+        if (overrideWithSystemValues == true) {
+               String spec = System.getProperty(URL_PROPERTY);
+               if (spec != null && !"".equals(spec)) {
+                   properties.setProperty(URL_PROPERTY, spec);
+               }
+               
+               String auth = System.getProperty(AUTH_PROPERTY);
+               if (auth != null && !"".equals(auth)) {
+                   properties.setProperty(AUTH_PROPERTY, auth);
+               }
+               String ssl = System.getProperty(SSL_PROPERTY);
+               if (ssl != null && !"".equals(ssl)) {
+                   properties.setProperty(AUTH_PROPERTY, ssl);
+               }
+               String user = System.getProperty(USER_PROPERTY);
+               if (user != null && !"".equals(user)) {
+                   properties.setProperty(USER_PROPERTY, user);
+               }
+               String password = System.getProperty(PASSWORD_PROPERTY);
+               if (password != null && !"".equals(password)) {
+                   properties.setProperty(PASSWORD_PROPERTY, password);
+               }
+               String tenant = System.getProperty(TENANT_NAME_PROPERTY);
+               if (tenant != null && !"".equals(tenant)) {
+                   properties.setProperty(TENANT_NAME_PROPERTY, tenant);
+               }
         }
-
-        spec = properties.getProperty(URL_PROPERTY);
+        //
+        // Verify the URL is well formed.
+        //
+        String urlString = properties.getProperty(URL_PROPERTY);
         try {
-                       url = new URL(spec);
-               logger.debug("readProperties() using url=" + url);
+                       url = new URL(urlString);
+               logger.debug("Client properties using url=" + url);
                } catch (MalformedURLException e) {
                        // TODO Auto-generated catch block
-                       e.printStackTrace();
+                       logger.error(String.format("Found malformed URL property value of '%s' for client URL settings.", urlString));
                        throw new RuntimeException(e.getMessage());
                }
-
-        String auth = System.getProperty(AUTH_PROPERTY);
-        if (auth != null && !"".equals(auth)) {
-            properties.setProperty(AUTH_PROPERTY, auth);
-        }
-        String ssl = System.getProperty(SSL_PROPERTY);
-        if (ssl != null && !"".equals(ssl)) {
-            properties.setProperty(AUTH_PROPERTY, ssl);
-        }
-        String user = System.getProperty(USER_PROPERTY);
-        if (user != null && !"".equals(user)) {
-            properties.setProperty(USER_PROPERTY, user);
-        }
-        String password = System.getProperty(PASSWORD_PROPERTY);
-        if (password != null && !"".equals(password)) {
-            properties.setProperty(PASSWORD_PROPERTY, password);
-        }
-        String tenant = System.getProperty(TENANT_PROPERTY);
-        if (tenant != null && !"".equals(tenant)) {
-            properties.setProperty(TENANT_PROPERTY, tenant);
-        }
         
         if (logger.isDebugEnabled()) {
             printProperties();
         }
         //
-        // How use the properties to initialize the HTTP client
+        // Now setup the connection.
         //
         init();
     }    
@@ -647,6 +633,6 @@ public abstract class AbstractServiceClientImpl<CLT, REQUEST_PT, RESPONSE_PT, P
     
     @Override
     public String getTenantName() {
-       return this.getProperty(TENANT_NAME_PROPERTY);
+       return this.getProperty(TENANT_ID_PROPERTY);
     }
 }
index d3041dc6a04fbba65c976f397580d744ccced028..0f720b839a55c65587cb75a83b7b23b2345958d3 100644 (file)
@@ -19,11 +19,11 @@ public abstract class AuthorityClientImpl<AUTHORITY_COMMON_TYPE, AUTHORITY_ITEM_
         * Basic CRUD proxied methods
         */
 
-       public AuthorityClientImpl(String clientPropertiesFilename) {
+       public AuthorityClientImpl(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
-       public AuthorityClientImpl() {
+       public AuthorityClientImpl() throws Exception {
                super();
        }
 
index 34a646095e810a0ff99979a19406f9ae10471a85..d2c7c5355cf7571190ae446e022b1bd8e1b7156d 100644 (file)
@@ -23,6 +23,8 @@
  */
 package org.collectionspace.services.client;
 
+import java.util.Properties;
+
 import javax.ws.rs.core.Response;
 
 import org.apache.commons.httpclient.HttpClient;
@@ -66,13 +68,14 @@ public interface CollectionSpaceClient<CLT, REQUEST_TYPE, RESPONSE_TYPE, P exten
     
     public static final String DEFAULT_CLIENT_PROPERTIES_FILENAME = "collectionspace-client.properties";
     public static final String SAS_CLIENT_PROPERTIES_FILENAME = "sas-collectionspace-client.properties";
-    public static final String AUTH_PROPERTY = "cspace.auth";
-    public static final String PASSWORD_PROPERTY = "cspace.password";
-    public static final String SSL_PROPERTY = "cspace.ssl";
+
     public static final String URL_PROPERTY = "cspace.url";
     public static final String USER_PROPERTY = "cspace.user";
-    public static final String TENANT_PROPERTY = "cspace.tenant";
-    public static final String TENANT_NAME_PROPERTY = "cspace.tenantID";
+    public static final String PASSWORD_PROPERTY = "cspace.password";
+    public static final String SSL_PROPERTY = "cspace.ssl";
+    public static final String AUTH_PROPERTY = "cspace.auth";
+    public static final String TENANT_NAME_PROPERTY = "cspace.tenant";
+    public static final String TENANT_ID_PROPERTY = "cspace.tenantID";
     
     // JAX-RS path for getting service description meta information
        public static final String SERVICE_DESCRIPTION_PATH = "description";
@@ -250,8 +253,11 @@ public interface CollectionSpaceClient<CLT, REQUEST_TYPE, RESPONSE_TYPE, P exten
      * Uses a properties files to set the url and credentials for an HTTP connection.
      * 
      * @param clientPropertiesFilename
+     * @throws Exception 
      */
-       public void setClientProperties(String clientPropertiesFilename);
+       public void setClientProperties(String clientPropertiesFilename) throws Exception;
+       
+       public void setClientProperties(Properties clientProperties);
        
        public String getTenantName();
 }
index 18fc7bc48d6bad8db6233c90fe92b1d5c7eb1010..bc039573d6f82beecf23d421c609a69a2ff8a287 100644 (file)
@@ -3,6 +3,10 @@ package org.collectionspace.services.client;
 public class GenericAuthorityClientImpl extends
                AuthorityClientImpl<Object, Object, AuthorityProxy> {
 
+       public GenericAuthorityClientImpl() throws Exception {
+               super();
+       }
+
        @Override
        public String getItemCommonPartName() {
                // TODO Auto-generated method stub
index 1aa33971e785d78f83e37582c24d571f806dbc60..38a73ed0cbf99f8932b17dcf08bce7d24c65f236 100644 (file)
@@ -44,11 +44,11 @@ public class RelationClient extends AbstractPoxServiceClientImpl<RelationsCommon
        public static final String SERVICE_COMMON_LIST_NAME = "relations-common-list";
     public static final String SERVICE_COMMONPART_NAME = IRelationsManager.SERVICE_COMMONPART_NAME;
     
-       public RelationClient() {
+       public RelationClient() throws Exception {
                super();
        }
 
-       public RelationClient(String clientPropertiesFilename) {
+       public RelationClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
index a575c393882bcb12bb91e6e1ac9e62b93533a87d..885623e9902a8376f594b679b2278de7571ae393 100644 (file)
@@ -36,7 +36,11 @@ import org.collectionspace.services.jaxb.AbstractCommonList;
 
 public final class TestServiceClient extends AbstractServiceClientImpl<AbstractCommonList, Object, Object, TestServiceProxy> {
 
-    /**
+    public TestServiceClient() throws Exception {
+               super();
+       }
+
+       /**
      *
      * Returning NULL since this class is a base-level client, used (only)
      * to obtain the base service URL.
index 6938e50654ed5d2773ecdb0521ed2824e929234d..3faba944eefd0df893057b2b1445591369a7dc4f 100644 (file)
@@ -29,6 +29,7 @@ import org.collectionspace.services.index.IndexCommon;
  *
  */
 public class IndexClient extends AbstractCommonListPoxServiceClientImpl<IndexProxy, IndexCommon> {
+
        public static final String SERVICE_NAME = "index";
        public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;       
        public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
@@ -37,6 +38,10 @@ public class IndexClient extends AbstractCommonListPoxServiceClientImpl<IndexPro
        public static final String SERVICE_AUTHZ_SUFFIX = "/*/" + SERVICE_PATH_COMPONENT + "/";
        public static final String INDEX_ID_PARAM = "indexid";
        
+       public IndexClient() throws Exception {
+               super();
+       }
+
        @Override
        public String getServiceName() {
                return SERVICE_NAME;
index 703a616354a8e7f35afb7f74ddb2d5058314e2aa..38e534d23e20be986388150e4e6e54d51ea51e64 100644 (file)
@@ -95,8 +95,9 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
         * @param client
         * @param vcsid
         * @return
+        * @throws Exception 
         */
-       abstract protected String createItemInAuthority(AuthorityClient client, String vcsid, String shortId);
+       abstract protected String createItemInAuthority(AuthorityClient client, String vcsid, String shortId) throws Exception;
        
     
     /**
@@ -209,8 +210,9 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
      * Gets a client to the SAS (Shared Authority Server)
      *
      * @return the client
+     * @throws Exception 
      */
-       protected AuthorityClient getSASClientInstance() {
+       protected AuthorityClient getSASClientInstance() throws Exception {
        return (AuthorityClient) this.getClientInstance(CollectionSpaceClient.SAS_CLIENT_PROPERTIES_FILENAME);
     }
 
@@ -344,7 +346,7 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
     }
     
        @Test(dataProvider = "testName", dependsOnMethods = {"CRUDTests"})
-    public void createItem(String testName) {
+    public void createItem(String testName) throws Exception {
         // Perform setup.
         setupCreate();
 
@@ -362,8 +364,9 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
     
     /**
      * Verify that we can test synchronization with this authority.  Otherwise, we skip the test.
+     * @throws Exception 
      */
-       private void assertSupportsSync() {
+       private void assertSupportsSync() throws Exception {
        //
        // Test to see if the authority on our locally tenant supports sync
        //
@@ -490,10 +493,11 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
     /**
      * Check to make sure the sync with the SAS returned the correct number of items as well as items
      * with the correct short IDs.
+     * @throws Exception 
      * 
      */
        @Test(dataProvider = "testName", dependsOnMethods = {"syncWithSAS", "CRUDTests"})
-    public void veryifySyncWithSAS(String testName) {
+    public void veryifySyncWithSAS(String testName) throws Exception {
         //
        // First check to see if we support sync.
        //
@@ -560,7 +564,7 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
     }
     
        @Test(dataProvider = "testName", dependsOnMethods = {"syncWithSASWithRelations", "CRUDTests"})
-    public void veryifySyncWithSASWithRelations(String testName) {
+    public void veryifySyncWithSASWithRelations(String testName) throws Exception {
         //
        // First check to see if we support sync.
        //
@@ -631,8 +635,9 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
      * @param subjectShortId
      * @param objectShortId
      * @param authorityItemDocumentType
+     * @throws Exception 
      */
-    private void verifyBroaderRelationship(AuthorityClient authorityClient, String authorityShortId, String subjectShortId, String objectShortId, String authorityItemDocumentType) {
+    private void verifyBroaderRelationship(AuthorityClient authorityClient, String authorityShortId, String subjectShortId, String objectShortId, String authorityItemDocumentType) throws Exception {
         setupReadList();
         RelationClient relationClient = new RelationClient();
         Response res = relationClient.readList(getCsidFromShortId(authorityClient, authorityShortId, subjectShortId),
@@ -665,9 +670,10 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
     /**
      * SAS - Create a new authority on the SAS server.
      * @param testName
+     * @throws Exception 
      */    
        @Test(dataProvider = "testName", dependsOnMethods = {"createItem", "CRUDTests"})
-    public void createSASAuthority(String testName) {
+    public void createSASAuthority(String testName) throws Exception {
         //
         // First check to see if the authority supports synchronization.
         //
@@ -689,7 +695,7 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
     }
     
        @Test(dataProvider = "testName", dependsOnMethods = {"deleteLocalItemWithSync", "CRUDTests"})
-    public void createSASAuthorityWithRelations(String testName) {
+    public void createSASAuthorityWithRelations(String testName) throws Exception {
         //
         // First check to see if the authority supports synchronization.
         //
@@ -778,9 +784,10 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
     /**
      * SAS - Create an item in the SAS authority on the SAS server.
      * @param testName
+     * @throws Exception 
      */
        @Test(dataProvider = "testName", dependsOnMethods = {"createSASAuthority", "CRUDTests"})
-    public void createSASItemList(String testName) {
+    public void createSASItemList(String testName) throws Exception {
         //
         // First check to see if the authority supports synchronization.
         //
@@ -929,7 +936,7 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
     
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
                dependsOnMethods = {"readItem"})
-    public void readItemNonExistent(String testName) {
+    public void readItemNonExistent(String testName) throws Exception {
         // Perform setup.
         setupReadNonExistent();
 
@@ -1010,7 +1017,7 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
         Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
     
-    protected void readItemListInt(String vcsid, String shortId, String testName) {
+    protected void readItemListInt(String vcsid, String shortId, String testName) throws Exception {
         // Perform setup.
         setupReadList();
 
@@ -1067,18 +1074,18 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
     }
     
     @Test(dataProvider = "testName", dependsOnMethods = {"createItemList"})
-    public void readItemList(String testName) {
+    public void readItemList(String testName) throws Exception {
         readItemListInt(knownAuthorityWithItems, null, testName);
     }
 
     @Test(dataProvider = "testName", dependsOnMethods = {"readItemList"})
-    public void readItemListByName(String testName) {
+    public void readItemListByName(String testName) throws Exception {
         readItemListInt(null, knownAuthorityWithItemsIdentifier, testName);
     }
 
     @Test(dataProvider = "testName",
                dependsOnMethods = {"deleteItem"})
-    public void deleteNonExistentItem(String testName) {
+    public void deleteNonExistentItem(String testName) throws Exception {
         // Perform setup.
         setupDeleteNonExistent();
 
@@ -1106,7 +1113,7 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
         return AuthorityClient.ITEMS;
     }
     
-       public PoxPayloadOut createItemRequestTypeInstance(AUTHORITY_ITEM_TYPE itemTypeInstance) {
+       public PoxPayloadOut createItemRequestTypeInstance(AUTHORITY_ITEM_TYPE itemTypeInstance) throws Exception {
                PoxPayloadOut result = null;
                
         AuthorityClient client = (AuthorityClient) getClientInstance();
@@ -1366,7 +1373,7 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
        }
         
     @Override
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         String noTest = System.getProperty("noTestCleanup");
         if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
             if (logger.isDebugEnabled()) {
index 9729892811a00f8ae2945e2d03ca1ca42fce9b1b..24a7eb1b93ba37f9555d6abe3ce910d148f8d5bc 100644 (file)
@@ -104,7 +104,7 @@ public abstract class AbstractPoxServiceTestImpl<CLT extends AbstractCommonList,
     }
                
        @Override
-       public PoxPayloadOut createRequestTypeInstance(CPT commonPartTypeInstance) {
+       public PoxPayloadOut createRequestTypeInstance(CPT commonPartTypeInstance) throws Exception {
                PoxPayloadOut result = null;
                
                CollectionSpaceClient client = this.getClientInstance();
index 486bc41973355d4ade3f07b2f9ef08ea59e1d416..182af836303c5d0d68f42f1cd0b299da5f69e61f 100644 (file)
@@ -35,11 +35,11 @@ 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.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
 import org.testng.annotations.Test;
+
 import javax.ws.rs.core.Response;
 
 /**
@@ -57,6 +57,7 @@ import javax.ws.rs.core.Response;
  * $LastChangedDate$
  */
 // FIXME: http://issues.collectionspace.org/browse/CSPACE-1685
+@SuppressWarnings("rawtypes")
 public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_TYPE>
                extends BaseServiceTest<CLT> implements ServiceTest {
     /** The logger. */
@@ -113,17 +114,18 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
     /*
      * Sub-classes can override for the workflow tests.
      */
-    protected REQUEST_TYPE createInstance(String identifier) {
+    protected REQUEST_TYPE createInstance(String identifier) throws Exception {
        String commonPartName = getClientInstance().getCommonPartName();
         return createInstance(commonPartName, identifier);
     }
     
     /**
      * Sub-classes must override this method for the "Create" tests to work properly
+     * @throws Exception 
      */
-    protected abstract REQUEST_TYPE createInstance(String commonPartName, String identifier);
+    protected abstract REQUEST_TYPE createInstance(String commonPartName, String identifier) throws Exception;
     
-    protected REQUEST_TYPE createNonExistenceInstance(String commonPartName, String identifier) {
+    protected REQUEST_TYPE createNonExistenceInstance(String commonPartName, String identifier) throws Exception {
        return createInstance(commonPartName, identifier);
     }
                     
@@ -190,7 +192,6 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
     
        abstract public Class<RESPONSE_TYPE> getEntityResponseType();
     
-    @SuppressWarnings("unchecked")
        @Override
     @Test(dataProvider = "testName", dependsOnMethods = {"create"})    
     public void read(String testName) throws Exception {
@@ -313,7 +314,7 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
        return (CPT)req;
     }
         
-    public REQUEST_TYPE createRequestTypeInstance(CPT commonPartTypeInstance) {
+    public REQUEST_TYPE createRequestTypeInstance(CPT commonPartTypeInstance) throws Exception {
        return (REQUEST_TYPE)commonPartTypeInstance;
     }
     
@@ -971,8 +972,8 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
         Assert.assertEquals(updatedWorkflowCommons.getCurrentLifeCycleState(), lifeCycleState);
     }
 
-    private CollectionSpacePoxClient assertPoxClient() {
-        CollectionSpaceClient clientCandidate = this.getClientInstance();
+    private CollectionSpacePoxClient assertPoxClient() throws Exception {
+               CollectionSpaceClient clientCandidate = this.getClientInstance();
         if (CollectionSpacePoxClient.class.isInstance(clientCandidate) != true) {  //FIXME: REM - We should remove this check and instead make CollectionSpaceClient support the readIncludeDeleted() method.
             String clientCandidateName = "Unknown";
             if (clientCandidate != null) {
@@ -994,7 +995,7 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
     /*
      * Return the number of items including those soft-deleted.
      */
-    protected long readIncludeDeleted(String testName, Boolean includeDeleted) {
+    protected long readIncludeDeleted(String testName, Boolean includeDeleted) throws Exception {
        long result = 0;
        // Perform setup.
        setupReadList();
@@ -1024,7 +1025,7 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
        return result;
     }
 
-    protected long readItemsIncludeDeleted(String testName, String parentCsid, Boolean includeDeleted) {
+    protected long readItemsIncludeDeleted(String testName, String parentCsid, Boolean includeDeleted) throws Exception {
         long result = 0;
         // Perform setup.
         setupReadList();
@@ -1087,7 +1088,7 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
         return result;
     }
 
-    protected PoxPayloadOut createItemInstance(String parentCsid, String identifier) {
+    protected PoxPayloadOut createItemInstance(String parentCsid, String identifier) throws Exception {
         logger.warn("Sub-class test clients should override this method");
         throw new UnsupportedOperationException();
     }
@@ -1178,8 +1179,7 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
         }
     }
 
-    @SuppressWarnings("unchecked")
-       protected void updateItemLifeCycleState(String testName, String parentCsid, String itemCsid, String workflowTransition, String lifeCycleState) throws Exception {
+    protected void updateItemLifeCycleState(String testName, String parentCsid, String itemCsid, String workflowTransition, String lifeCycleState) throws Exception {
         //
         // Read the existing object
         //
index 7581ed36b67457e4bbc2116a73b6b1efdf7dbd8f..95a7344425d30c2d40eb208e1149a9b3d04df74f 100644 (file)
@@ -81,6 +81,7 @@ import org.collectionspace.services.common.api.FileTools;
 /*
  * <CLT> - Common list type
  */
+@SuppressWarnings("rawtypes")
 public abstract class BaseServiceTest<CLT> {
        //A default MIME type result
     static protected final String DEFAULT_MIME = "application/octet-stream; charset=ISO-8859-1";
@@ -88,8 +89,16 @@ public abstract class BaseServiceTest<CLT> {
     protected static final String MAVEN_BASEDIR_PROPERTY = "maven.basedir";
     /** The Constant logger. */
     private static final Logger logger = LoggerFactory.getLogger(BaseServiceTest.class);
-    /** The Constant serviceClient. */
-    protected static final TestServiceClient serviceClient = new TestServiceClient();
+    
+    /** The static serviceClient for all instances */
+    protected static TestServiceClient serviceClient;
+    static {
+       try {
+                       serviceClient = new TestServiceClient();
+               } catch (Exception e) {
+                       throw new RuntimeException(e);
+               }
+    }
     
     protected String knownResourceIdentifier = null;
     /** Use this to keep track of a single known resource */
@@ -145,24 +154,26 @@ public abstract class BaseServiceTest<CLT> {
     //
     // Status constants
     //
-    protected static final int STATUS_BAD_REQUEST =
-        Response.Status.BAD_REQUEST.getStatusCode();
-    protected static final int STATUS_CREATED =
-        Response.Status.CREATED.getStatusCode();
-    protected static final int STATUS_INTERNAL_SERVER_ERROR =
-        Response.Status.INTERNAL_SERVER_ERROR.getStatusCode();
-    protected static final int STATUS_NOT_FOUND =
-        Response.Status.NOT_FOUND.getStatusCode();
-    protected static final int STATUS_OK =
-            Response.Status.OK.getStatusCode();
-    protected static final int STATUS_FORBIDDEN =
-            Response.Status.FORBIDDEN.getStatusCode();
+    protected static final int STATUS_BAD_REQUEST = Response.Status.BAD_REQUEST.getStatusCode();
+    protected static final int STATUS_CREATED = Response.Status.CREATED.getStatusCode();
+    protected static final int STATUS_INTERNAL_SERVER_ERROR = Response.Status.INTERNAL_SERVER_ERROR.getStatusCode();
+    protected static final int STATUS_NOT_FOUND = Response.Status.NOT_FOUND.getStatusCode();
+    protected static final int STATUS_OK = Response.Status.OK.getStatusCode();
+    protected static final int STATUS_FORBIDDEN = Response.Status.FORBIDDEN.getStatusCode();
     
     //
     // "Global flag to cancel cleanup() method
     //
     private static boolean cancelCleanup = false;
-    
+        
+    /**
+     * Instantiates a new base service test.
+     * @throws Exception 
+     */
+    public BaseServiceTest() {
+        super();
+    }
+
     //
     // Decide if cleanup should happen
     //
@@ -181,13 +192,6 @@ public abstract class BaseServiceTest<CLT> {
        cancelCleanup = true;
     }
 
-    /**
-     * Instantiates a new base service test.
-     */
-    public BaseServiceTest() {
-        super();
-    }
-
     /*
      * A getter for retrieving the tests logger
      */
@@ -204,15 +208,17 @@ public abstract class BaseServiceTest<CLT> {
      * Gets the client.
      *
      * @return the client
+     * @throws Exception 
      */
-    abstract protected CollectionSpaceClient getClientInstance();
+       abstract protected CollectionSpaceClient getClientInstance() throws Exception;
 
     /**
      * Gets the client.
      *
      * @return the client
+     * @throws Exception 
      */
-    abstract protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename);
+    abstract protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception;
 
     /*
      * Subclasses can override this method to return their AbstractCommonList subclass
@@ -248,8 +254,9 @@ public abstract class BaseServiceTest<CLT> {
      * base path, if any.
      *
      * @return The URL path component of the service.
+     * @throws Exception 
      */
-    protected abstract String getServicePathComponent();
+    protected abstract String getServicePathComponent() throws Exception;
     
     protected abstract String getServiceName();
 
@@ -759,9 +766,10 @@ public abstract class BaseServiceTest<CLT> {
      * 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.
+     * @throws Exception 
      */
     @AfterClass(alwaysRun = true)
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         if (cleanupCancelled() == true) {
             if (logger.isDebugEnabled()) {
                 logger.debug("Skipping Cleanup phase ...");
index de498b50f0cfbba53f2951f8fe27517ee9f8658f..622fe101a6e71e9eea2dcc59763034a8d9c7db26 100644 (file)
@@ -31,6 +31,7 @@ import org.collectionspace.services.workflow.WorkflowCommon;
  *
  */
 public class WorkflowClient extends AbstractCommonListPoxServiceClientImpl<WorkflowProxy, WorkflowCommon> {
+       
        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;
@@ -88,6 +89,10 @@ public class WorkflowClient extends AbstractCommonListPoxServiceClientImpl<Workf
        statesMappedToTransitions.put(WORKFLOWSTATE_DELETED, WORKFLOWTRANSITION_DELETE);
        statesMappedToTransitions.put("c", "d");
     }
+    
+       public WorkflowClient() throws Exception {
+               super();
+       }
        
        @Override
        public String getServiceName() {
@@ -101,7 +106,6 @@ public class WorkflowClient extends AbstractCommonListPoxServiceClientImpl<Workf
 
        @Override
        public Class<WorkflowProxy> getProxyClass() {
-               // TODO Auto-generated method stub
                return WorkflowProxy.class;
        }
 
index 79c8762cca2c8f2f0a35e00835f3e45eac1ad360..a4e2462131fb645478ef5ed0ff792f3e3ae69f6c 100644 (file)
@@ -1,13 +1,13 @@
 #
 # URL of the CollectionSpace server and user credentials
 #
-cspace.url=http://qa.collectionspace.org:8180/cspace-services/
+cspace.url=http://localhost:8180/cspace-services/
 cspace.ssl=false
 cspace.auth=true
-cspace.user=admin@materials.collectionspace.org
+cspace.user=admin@testsci.collectionspace.org
 cspace.password=Administrator
 #
 # default tenant information
 #
-cspace.tenant=2000
-cspace.tenantID=materials.collectionspace.org
\ No newline at end of file
+cspace.tenant=2
+cspace.tenantID=testsci.collectionspace.org
\ No newline at end of file
index f6cf4f6034e00edf7fe02dfc20110b1fc6aa38e9..3a8fca72de43bee3efd79402414509dcc7ce071f 100644 (file)
@@ -47,11 +47,11 @@ public class CollectionObjectClient extends AbstractCommonListPoxServiceClientIm
     public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME;
     public static final String SERVICE_COMMON_PART_NAME = SERVICE_NAME + PART_LABEL_SEPARATOR + PART_COMMON_LABEL;
 
-    public CollectionObjectClient() {
+    public CollectionObjectClient() throws Exception {
                super();
        }
 
-    public CollectionObjectClient(String clientPropertiesFilename) {
+    public CollectionObjectClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
index 9e7383129e1ee59e250323489996394e62fa0f79..e8fd9ded167ee973b19e9ce4fee66c3553e0a622 100644 (file)
@@ -55,7 +55,6 @@ import org.collectionspace.services.collectionobject.TitleGroupList;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.organization.OrgTermGroup;
 import org.collectionspace.services.person.PersonTermGroup;
-
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
@@ -220,8 +219,9 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest<AbstractCommon
      *
      * @param displayName the display name of the authority
      * @param shortIdentifier the short identifier for the authority
+     * @throws Exception 
      */
-    private void createPersonAuthority(String displayName, String shortIdentifier) {
+    private void createPersonAuthority(String displayName, String shortIdentifier) throws Exception {
         testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
        PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
@@ -246,8 +246,9 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest<AbstractCommon
      * @param surName the person's surname
      * @param shortIdentifier the short identifier for the item
      * @return the CSID of the newly-created person record
+     * @throws Exception 
      */
-    protected String createPerson(String firstName, String surName, String shortIdentifier ) {
+    protected String createPerson(String firstName, String surName, String shortIdentifier ) throws Exception {
        String result = null;
        
         Map<String, String> personInfo = new HashMap<String,String>();
@@ -281,8 +282,9 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest<AbstractCommon
     /**
      * Creates multiple Person items within a Person Authority,
      * and stores the refNames referring to each.
+     * @throws Exception 
      */
-    protected void createPersonRefs(){
+    protected void createPersonRefs() throws Exception{
 
         createPersonAuthority(PERSON_AUTHORITY_NAME_DISPLAY, PERSON_AUTHORITY_NAME);
 
@@ -330,8 +332,9 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest<AbstractCommon
      *
      * @param displayName the display name of the authority
      * @param shortIdentifier the short identifier for the authority
+     * @throws Exception 
      */
-    private void createOrgAuthority(String displayName, String shortIdentifier) {
+    private void createOrgAuthority(String displayName, String shortIdentifier) throws Exception {
         testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
         OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
         PoxPayloadOut multipart = OrgAuthorityClientUtils.createOrgAuthorityInstance(
@@ -357,8 +360,9 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest<AbstractCommon
      * @param foundingPlace the organization's founding place
      * @param shortIdentifier the short identifier for the item
      * @return the CSID of the newly-created organization record
+     * @throws Exception 
      */
-    protected String createOrganization(String shortName, String foundingPlace, String shortIdentifier ) {
+    protected String createOrganization(String shortName, String foundingPlace, String shortIdentifier ) throws Exception {
        String result = null;
        
         Map<String, String> orgInfo = new HashMap<String,String>();
@@ -392,13 +396,11 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest<AbstractCommon
    /**
      * Creates multiple Organization items within an Organization Authority,
      * and stores the refNames referring to each.
+ * @throws Exception 
      */
-    private void createOrganizationRefs() {
-
+    private void createOrganizationRefs() throws Exception {
         createOrgAuthority(ORG_AUTHORITY_NAME, ORG_AUTHORITY_NAME);
-
         String csid = "";
-
         csid = createOrganization("Content Org", "Content Org Town", "contentOrg");
         contentOrganizationRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, csid, null);
         orgIdsCreated.add(csid);
@@ -510,9 +512,10 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest<AbstractCommon
      * 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.
+     * @throws Exception 
      */
     @AfterClass(alwaysRun=true)
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         String noTest = System.getProperty("noTestCleanup");
        if(Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
             if (logger.isDebugEnabled()) {
@@ -567,6 +570,7 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest<AbstractCommon
     * @param contentPerson the content person
     * @param inscriber the inscriber
     * @return the multipart output
+ * @throws Exception 
     */
    private PoxPayloadOut createCollectionObjectInstance(
                 String title,
@@ -577,7 +581,7 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest<AbstractCommon
                 String assocEventPerson,
                 String owner,
                 String fieldCollectionSource,
-                String fieldCollector ) {
+                String fieldCollector ) throws Exception {
         CollectionobjectsCommon collectionObject = new CollectionobjectsCommon();
         TitleGroupList titleGroupList = new TitleGroupList();
         List<TitleGroup> titleGroups = titleGroupList.getTitleGroup();
index a673be7c3a6e6344c6c4233f5650a16e3623172c..4ff9cabf691cacf20cc9ec5a8ed5e9af55ff8542 100644 (file)
@@ -94,27 +94,14 @@ public class CollectionObjectSearchTest extends BaseServiceTest<AbstractCommonLi
 
        @Override
        protected String getServiceName() {
-               throw new UnsupportedOperationException(); // FIXME: REM - See
-                                                                                                       // http://issues.collectionspace.org/browse/CSPACE-3498
+               throw new UnsupportedOperationException(); // FIXME: REM - See // http://issues.collectionspace.org/browse/CSPACE-3498
        }
 
        @Override
        protected String getServicePathComponent() {
-               // TODO Auto-generated method stub
-               throw new UnsupportedOperationException(); // FIXME: REM - See
-                                                                                                       // http://issues.collectionspace.org/browse/CSPACE-3498
+               throw new UnsupportedOperationException(); // FIXME: REM - See // http://issues.collectionspace.org/browse/CSPACE-3498
        }
 
-       // /* (non-Javadoc)
-       // * @see
-       // org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
-       // */
-       // @Override
-       // protected String getServicePathComponent() {
-       // return new CollectionObjectClient().getServicePathComponent(); //FIXME:
-       // REM = Remove all refs to this method.
-       // }
-
        /*
         * (non-Javadoc)
         * 
@@ -123,12 +110,12 @@ public class CollectionObjectSearchTest extends BaseServiceTest<AbstractCommonLi
         * ()
         */
        @Override
-       protected CollectionSpaceClient getClientInstance() {
+       protected CollectionSpaceClient getClientInstance() throws Exception {
                return new CollectionObjectClient();
        }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
                return new CollectionObjectClient(clientPropertiesFilename);
        }
        
@@ -140,9 +127,10 @@ public class CollectionObjectSearchTest extends BaseServiceTest<AbstractCommonLi
         * database-specific constraint or otherwise, if the number of records
         * containing a particular keyword represent too high a proportion of the
         * total number of records.
+        * @throws Exception 
         */
        @BeforeClass(alwaysRun = true)
-       public void setup() {
+       public void setup() throws Exception {
                if (logger.isDebugEnabled()) {
                        logger.debug("Creating " + numNoiseWordResources
                                        + " 'noise word' resources ...");
@@ -380,7 +368,7 @@ public class CollectionObjectSearchTest extends BaseServiceTest<AbstractCommonLi
        // }
        // }
        @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, groups = { "utf8" })
-       public void searchWithUTF8Keyword(String testName) {
+       public void searchWithUTF8Keyword(String testName) throws Exception {
                // Create one or more keyword retrievable resources, each containing
                // two specified keywords.
                long numKeywordRetrievableResources = 2;
@@ -460,9 +448,10 @@ public class CollectionObjectSearchTest extends BaseServiceTest<AbstractCommonLi
         * 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.
+        * @throws Exception 
         */
        @AfterClass(alwaysRun = true)
-       public void cleanUp() {
+       public void cleanUp() throws Exception {
                String noTest = System.getProperty("noTestCleanup");
                if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
                        if (logger.isDebugEnabled()) {
@@ -483,7 +472,7 @@ public class CollectionObjectSearchTest extends BaseServiceTest<AbstractCommonLi
        // ---------------------------------------------------------------
        // Utility methods used by tests above
        // ---------------------------------------------------------------
-       private void createCollectionObjects(long numToCreate, String keyword) {
+       private void createCollectionObjects(long numToCreate, String keyword) throws Exception {
                List keywords = new ArrayList<String>();
                keywords.add(keyword);
                boolean keywordsInSameField = true;
@@ -491,7 +480,7 @@ public class CollectionObjectSearchTest extends BaseServiceTest<AbstractCommonLi
        }
 
        private void createCollectionObjects(long numToCreate,
-                       List<String> keywords, boolean keywordsInSameField) {
+                       List<String> keywords, boolean keywordsInSameField) throws Exception {
                testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
                CollectionObjectClient client = new CollectionObjectClient();
                for (long i = 0; i < numToCreate; i++) {
@@ -514,7 +503,7 @@ public class CollectionObjectSearchTest extends BaseServiceTest<AbstractCommonLi
        }
 
        private PoxPayloadOut createCollectionObjectInstance(long i,
-                       List<String> keywords, boolean keywordsInSameField) {
+                       List<String> keywords, boolean keywordsInSameField) throws Exception {
                CollectionobjectsCommon collectionObject = new CollectionobjectsCommon();
                collectionObject.setObjectNumber(createIdentifier());
                if (keywordsInSameField) {
@@ -550,13 +539,13 @@ public class CollectionObjectSearchTest extends BaseServiceTest<AbstractCommonLi
                return sb.toString();
        }
 
-       private Response doSearch(List<String> keywords) {
+       private Response doSearch(List<String> keywords) throws Exception {
                String searchParamValue = listToString(keywords, KEYWORD_SEPARATOR);
                return doSearch(searchParamValue);
        }
 
        private Response doAdvancedSearch(
-                       String propertyName, String propertyValue, String operator) {
+                       String propertyName, String propertyValue, String operator) throws Exception {
                if (logger.isDebugEnabled()) {
                        logger.debug("Searching on property: " + propertyName + "="
                                        + "'" + propertyValue + "'");
@@ -569,7 +558,7 @@ public class CollectionObjectSearchTest extends BaseServiceTest<AbstractCommonLi
                return res;
        }
 
-       private Response doSearch(String keyword) {
+       private Response doSearch(String keyword) throws Exception {
                String searchParamValue = keyword;
                if (logger.isDebugEnabled()) {
                        logger.debug("Searching on keyword(s): " + searchParamValue
index 1c64c7d8ddcef26892187999fba483962cfa59fc..f65752ce9edbfec1c71d9a65ae277754953b9da1 100644 (file)
@@ -30,6 +30,18 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
 
+
+
+
+
+
+
+
+
+
+
+
+
 //import org.collectionspace.services.client.AbstractServiceClientImpl;
 import org.collectionspace.services.client.CollectionObjectClient;
 import org.collectionspace.services.client.CollectionObjectFactory;
@@ -51,7 +63,6 @@ import org.collectionspace.services.collectionobject.ResponsibleDepartmentList;
 import org.collectionspace.services.collectionobject.TitleGroup;
 import org.collectionspace.services.collectionobject.TitleGroupList;
 import org.collectionspace.services.jaxb.AbstractCommonList;
-
 import org.testng.Assert;
 import org.testng.annotations.Test;
 import org.slf4j.Logger;
@@ -96,12 +107,12 @@ public class CollectionObjectServiceTest extends AbstractPoxServiceTestImpl<Abst
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
        return new CollectionObjectClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
        return new CollectionObjectClient(clientPropertiesFilename);
        }
      
@@ -535,8 +546,9 @@ public class CollectionObjectServiceTest extends AbstractPoxServiceTestImpl<Abst
      * @param testName the test name
      * @param id the id
      * @return the client response
+     * @throws Exception 
      */
-    private Response updateRetrieve(String testName, String id) {
+    private Response updateRetrieve(String testName, String id) throws Exception {
         setupRead();
         CollectionObjectClient client = new CollectionObjectClient();
         Response res = client.read(knownResourceId);
@@ -562,9 +574,10 @@ public class CollectionObjectServiceTest extends AbstractPoxServiceTestImpl<Abst
      * @param testName the test name
      * @param id the id
      * @return the client response
+     * @throws Exception 
      */
     private Response updateSend(String testName, String id,
-            CollectionobjectsCommon collectionObjectCommon) {
+            CollectionobjectsCommon collectionObjectCommon) throws Exception {
         setupUpdate();
         PoxPayloadOut output = new PoxPayloadOut(CollectionObjectClient.SERVICE_PAYLOAD_NAME);
         PayloadOutputPart commonPart = output.addPart(collectionObjectCommon, MediaType.APPLICATION_XML_TYPE);
@@ -860,7 +873,7 @@ public class CollectionObjectServiceTest extends AbstractPoxServiceTestImpl<Abst
     // Utility methods used by tests above
     // ---------------------------------------------------------------
         
-    private Response newCollectionObject() {
+    private Response newCollectionObject() throws Exception {
        Response result = null;
        
         CollectionObjectClient client = new CollectionObjectClient();
@@ -872,7 +885,7 @@ public class CollectionObjectServiceTest extends AbstractPoxServiceTestImpl<Abst
         return result;
     }
     
-    private String newCollectionObject(boolean assertStatus) {
+    private String newCollectionObject(boolean assertStatus) throws Exception {
        String result = null;
        
        Response res = newCollectionObject();
index 34d681b6d8524e551c746557e92caebba107ca5f..14043dd34bf11cb9936538e168de37ae9541f9e7 100644 (file)
@@ -24,6 +24,8 @@
 package org.collectionspace.services.common.api;
 
 import java.io.File;
+import java.io.InputStream;
+import java.util.Properties;
 import  java.util.regex.Pattern;
 import java.util.regex.Matcher;
 
@@ -255,5 +257,98 @@ public class Tools {
         return s;
     }
 
+    /**
+     * Return a set of properties from a properties file.
+     * 
+     * @param clientPropertiesFilename
+     * @return
+     */
+       static public Properties loadProperties(String clientPropertiesFilename) {
+               Properties inProperties = new Properties();
+               ClassLoader cl = Thread.currentThread().getContextClassLoader();
+               InputStream is = null;
+
+               try {
+                       is = cl.getResourceAsStream(clientPropertiesFilename);
+                       inProperties.load(is);
+               } catch (Exception e) {
+                       throw new RuntimeException(e);
+               } finally {
+                       if (is != null) {
+                               try {
+                                       is.close();
+                               } catch (Exception e) {
+                                       e.printStackTrace();
+                               }
+                       }
+               }
+
+               return inProperties;
+       }
+       
+       static public Properties loadProperties(String clientPropertiesFilename, boolean filterPasswords) throws Exception {
+               Properties result = loadProperties(clientPropertiesFilename);
+
+               if (filterPasswords) {
+                       result = filterPasswordsWithEnvVars(result);
+               }
+               
+               return result;
+       }
+       
+       static public Properties filterPasswordsWithEnvVars(Properties inProperties) throws Exception {
+               Properties result = inProperties;
+               
+               if (inProperties != null && inProperties.size() > 0) {
+                       for (String key : inProperties.stringPropertyNames()) {
+                               String propertyValue = inProperties.getProperty(key);
+                               String newPropertyValue = Tools.getPasswordFromEnv(propertyValue);
+                               if (newPropertyValue != null) { // non-null result means the property value was the name of an environment variable
+                                       inProperties.setProperty(key, newPropertyValue);
+                               }
+                       }
+               }
+               
+               return result;
+       }
+       
+       /**
+        * Try to find the value of a password variable in the system or JVM environment.  This code substitutes only environment variables formed
+        * like ${cspace.password.mysecret} or ${cspace_password_mysecret_secret}.  The corresponding environment variables would
+        * be "cspace.password.mysecret" and "cspace.password.mysecret.secret".
+        * 
+        * Returns null if the passed in propertyValue is not a password variable -i.e., not something of the form {$cspace.password.foo}
+        * 
+        * Throws an exception if the passed in propertyValue has a valid variable form but the corresponding environment variable is not
+        * set.
+        * 
+        * @param propertyValue
+        * @return
+        * @throws Exception
+        */
+       static private String getPasswordFromEnv(String propertyValue) throws Exception {
+               String result = null;
+               //
+               // Replace things like ${cspace.password.cow} with values from either the environment
+               // or from the JVM system properties.
+               //
+               Pattern pattern = Pattern.compile("\\$\\{([A-Za-z0-9_\\.]+)\\}");       // For example, "${cspace.password.mysecret}" or "${password_strong_longpassword}"
+               Matcher matcher = pattern.matcher(propertyValue);
+               String key = null;      
+               if (matcher.find()) {
+                       key = matcher.group(1);  // Gets the string inside the ${} enclosure.  For example, gets "cspace.password.mysecret" from "${cspace.password.mysecret}"
+                       result = System.getenv(key);
+                       if (result == null || result.isEmpty()) {
+                               // If we couldn't find a value in the environment, check the JVM system properties
+                               result = System.getProperty(key);
+                       }
 
+                       if (result == null || result.isEmpty()) {
+                               String errMsg = String.format("Could find neither an environment variable nor a systen variable named '%s'", key);
+                               throw new Exception(errMsg);
+                       }
+               }
+               
+               return result;
+       }
 }
index 75cfa1404017a7175e5d4d7e5d9f9909135ddbbf..791dcbb93066275668b71fed474420a264f0121c 100644 (file)
@@ -23,6 +23,7 @@
 package org.collectionspace.services.client.test;
 
 import java.io.IOException;
+
 import org.apache.commons.httpclient.Header;
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpException;
@@ -34,7 +35,6 @@ 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;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
@@ -53,8 +53,8 @@ public class ServiceLayerTest {
     private final String CLASS_NAME = ServiceLayerTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
     
-    private TestServiceClient serviceClient = new TestServiceClient();
-    private HttpClient httpClient = serviceClient.getHttpClient();
+    private TestServiceClient serviceClient;
+    private HttpClient httpClient;
 
     @BeforeSuite
     void printServiceClientProperties() {
@@ -73,6 +73,11 @@ public class ServiceLayerTest {
                     + serviceClient.getProperty(CollectionSpaceClient.PASSWORD_PROPERTY));
         }
     }
+    
+    public ServiceLayerTest() throws Exception {
+        serviceClient = new TestServiceClient();
+        httpClient = serviceClient.getHttpClient();
+    }
 
     @Test
     public void servicesExist() {
index 607186f154f4dd58b5823fea0d9a95bd64b72411..6e4d9470fda0083168d1484d932881aa1245c5a8 100644 (file)
@@ -27,6 +27,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.UriInfo;
@@ -38,6 +39,7 @@ import org.collectionspace.services.client.IClientQueryParams;
 import org.collectionspace.services.client.IQueryManager;
 import org.collectionspace.services.client.workflow.WorkflowClient;
 import org.collectionspace.services.common.ServiceMain;
+import org.collectionspace.services.common.api.Tools;
 import org.collectionspace.services.common.authorization_mgt.AuthorizationCommon;
 import org.collectionspace.services.common.config.PropertyItemUtils;
 import org.collectionspace.services.common.config.ServiceConfigUtils;
@@ -51,6 +53,7 @@ import org.collectionspace.services.common.security.UnauthorizedException;
 import org.collectionspace.services.config.ClientType;
 import org.collectionspace.services.config.service.ObjectPartType;
 import org.collectionspace.services.config.service.ServiceBindingType;
+import org.collectionspace.services.config.tenant.RemoteClientConfig;
 import org.collectionspace.services.config.tenant.RepositoryDomainType;
 import org.collectionspace.services.config.tenant.TenantBindingType;
 import org.collectionspace.services.config.types.PropertyItemType;
@@ -76,6 +79,7 @@ import org.slf4j.LoggerFactory;
  * @param <IT>
  * @param <OT>
  */
+@SuppressWarnings("rawtypes")
 public abstract class AbstractServiceContextImpl<IT, OT>
         implements ServiceContext<IT, OT> {
 
@@ -665,10 +669,19 @@ public abstract class AbstractServiceContextImpl<IT, OT>
      * (non-Javadoc)
      * @see org.collectionspace.services.common.context.ServiceContext#getClient(java.lang.String)
      */
-    @Override
+       @Override
     public AuthorityClient getClient(String clientPropertiesFilename) throws Exception {
        AuthorityClient result = null;
        
+        Properties inProperties = Tools.loadProperties(clientPropertiesFilename, true);
+        result = getClient(inProperties);
+        
+        return result;
+    }
+    
+    public AuthorityClient getClient(Properties inProperties) throws Exception {
+       AuthorityClient result = null;
+       
         String authorityClientClazz = getServiceBinding().getClientHandler();
         ClassLoader tccl = Thread.currentThread().getContextClassLoader();
         authorityClientClazz = authorityClientClazz.trim();
@@ -676,7 +689,7 @@ public abstract class AbstractServiceContextImpl<IT, OT>
             Class<?> c = tccl.loadClass(authorityClientClazz);
             if (AuthorityClient.class.isAssignableFrom(c)) {
                result = authorityClient = ((AuthorityClient) c.newInstance());
-               result.setClientProperties(clientPropertiesFilename);
+               result.setClientProperties(inProperties);
             } else {
                logger.error(String.format("The service binding clientHandler class '%s' for '%s' service was not of type AuthorityClient.",
                                authorityClientClazz, this.getServiceName()));
@@ -688,7 +701,24 @@ public abstract class AbstractServiceContextImpl<IT, OT>
         }
         
         return result;
-    }    
+    }
+    
+    @Override
+    public AuthorityClient getClient(RemoteClientConfig remoteClientConfig) throws Exception {
+       AuthorityClient result = null;
+       
+        Properties properties = new Properties();
+        properties.setProperty(AuthorityClient.URL_PROPERTY, remoteClientConfig.getUrl());
+        properties.setProperty(AuthorityClient.USER_PROPERTY, remoteClientConfig.getUser());
+        properties.setProperty(AuthorityClient.PASSWORD_PROPERTY, remoteClientConfig.getPassword());
+        properties.setProperty(AuthorityClient.SSL_PROPERTY, remoteClientConfig.getSsl());
+        properties.setProperty(AuthorityClient.AUTH_PROPERTY, remoteClientConfig.getAuth());
+        properties.setProperty(AuthorityClient.TENANT_ID_PROPERTY, remoteClientConfig.getTenantId());
+        properties.setProperty(AuthorityClient.TENANT_NAME_PROPERTY, remoteClientConfig.getTenantName());
+
+        result = getClient(properties);
+        return result;
+    }
     
     @Override
     public void addValidatorHandler(ValidatorHandler<IT, OT> validator) throws Exception {
index f72dbe648dabc2173a496751f4d2bfc787773818..eaff58c8cd2654c7c1f3af4fca8558ff98319f6f 100644 (file)
@@ -40,6 +40,7 @@ import org.collectionspace.services.common.security.SecurityContext;
 import org.collectionspace.services.config.ClientType;
 import org.collectionspace.services.config.service.ObjectPartType;
 import org.collectionspace.services.config.service.ServiceBindingType;
+import org.collectionspace.services.config.tenant.RemoteClientConfig;
 import org.collectionspace.services.config.tenant.RepositoryDomainType;
 
 /**
@@ -359,6 +360,8 @@ public interface ServiceContext<IT, OT> {
        public CollectionSpaceClient getClient() throws Exception;
        
        public CollectionSpaceClient getClient(String clientProperitesFilename) throws Exception;
+       
+       public CollectionSpaceClient getClient(RemoteClientConfig remoteClientConfig) throws Exception;
 
     /**
      * @return the JAX-RS resource of service for the current context.
index 028dd4cea81141cce845d0027e4425122cc91535..770289760dbc6f40c09a774130c519899724223c 100644 (file)
@@ -28,12 +28,9 @@ import java.util.List;
 import java.util.Map;
 import java.util.StringTokenizer;
 
-import org.collectionspace.services.client.PoxPayloadIn;
-import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.api.RefName;
 import org.collectionspace.services.common.context.ServiceContext;
 import org.collectionspace.services.common.query.QueryContext;
-import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.Specifier;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
index ecbeb4ef3c3c5e78acd3f7df0c42fecafcb9afae..dee2fb0696730bfc6290a08fc81366a28864b2ae 100644 (file)
@@ -24,6 +24,7 @@
 package org.collectionspace.services.nuxeo.client.java;
 
 import java.util.Hashtable;
+import java.util.List;
 
 import javax.security.auth.login.LoginContext;
 
@@ -34,9 +35,13 @@ import org.collectionspace.services.common.config.TenantBindingConfigReaderImpl;
 import org.collectionspace.services.config.ClientType;
 import org.collectionspace.services.config.RepositoryClientConfigType;
 import org.collectionspace.services.config.service.ServiceBindingType;
+import org.collectionspace.services.config.tenant.RemoteClientConfig;
+import org.collectionspace.services.config.tenant.RemoteClientConfigurations;
 import org.collectionspace.services.config.tenant.RepositoryDomainType;
 import org.collectionspace.services.config.tenant.TenantBindingType;
+
 import org.nuxeo.runtime.api.Framework;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
index ff1688fe4480183a7a2b1bee48d7340bd03450a4..7e0643c5af0b763373c89fa60dc6ba68f4ff1dc8 100644 (file)
@@ -52,11 +52,11 @@ public class ConceptAuthorityClient extends AuthorityClientImpl<Conceptauthoriti
     //
     // Constructors
     //
-    public ConceptAuthorityClient() {
+    public ConceptAuthorityClient() throws Exception {
        super();
     }
     
-    public ConceptAuthorityClient(String clientPropertiesFilename) {
+    public ConceptAuthorityClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
     
index 7c16b46770fdd53b2c15539d5f38bd1b5ecaf8b7..ede597ca5b9eefc3de4ca938bd7c31638e4ae013 100644 (file)
@@ -40,7 +40,6 @@ import org.collectionspace.services.concept.ConceptauthoritiesCommon;
 import org.collectionspace.services.concept.ConceptsCommon;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.dom4j.DocumentException;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
@@ -94,12 +93,12 @@ public class ConceptAuthorityServiceTest extends AbstractAuthorityServiceTest<Co
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
        return new ConceptAuthorityClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
        return new ConceptAuthorityClient(clientPropertiesFilename);
        }
     
@@ -152,8 +151,9 @@ public class ConceptAuthorityServiceTest extends AbstractAuthorityServiceTest<Co
      *
      * @param vcsid the vcsid
      * @param name the name
+     * @throws Exception 
      */
-    private void readItemList(String vcsid, String shortId) {
+    private void readItemList(String vcsid, String shortId) throws Exception {
 
         String testName = "readItemList";
 
@@ -238,10 +238,11 @@ public class ConceptAuthorityServiceTest extends AbstractAuthorityServiceTest<Co
     * 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.
+ * @throws Exception 
     */
 
    @AfterClass(alwaysRun=true)
-   public void cleanUp() {
+   public void cleanUp() throws Exception {
        String noTest = System.getProperty("noTestCleanup");
        if(Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
            if (logger.isDebugEnabled()) {
@@ -324,7 +325,7 @@ public class ConceptAuthorityServiceTest extends AbstractAuthorityServiceTest<Co
        
     @Override
        protected PoxPayloadOut createInstance(String commonPartName,
-                       String identifier) {
+                       String identifier) throws Exception {
        ConceptAuthorityClient client = new ConceptAuthorityClient();
         String shortId = identifier;
        String displayName = "displayName-" + shortId;
index c4f1cb28da39929a4a44179a6227e9ba24780e9a..1d9b88bd533fc3305eb74d59ec743ad4952fb942 100644 (file)
@@ -29,11 +29,11 @@ public class ConditioncheckClient extends AbstractCommonListPoxServiceClientImpl
     public static final String SERVICE_PATH_PROXY = SERVICE_PATH + "/";
     public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME;
 
-    public ConditioncheckClient() {
+    public ConditioncheckClient() throws Exception {
                super();
        }
 
-    public ConditioncheckClient(String clientPropertiesFilename) {
+    public ConditioncheckClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
index 1b12261b5279a5f57deb316bf92e180f508361c6..af8196de0870874fa82de7a4b6932a7ca5786c51 100644 (file)
@@ -41,7 +41,6 @@ import org.collectionspace.services.common.authorityref.AuthorityRefList;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.conditioncheck.ConditionchecksCommon;
 import org.collectionspace.services.person.PersonTermGroup;
-
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
@@ -146,7 +145,7 @@ public class ConditioncheckAuthRefsTest extends BaseServiceTest<AbstractCommonLi
         }
     }
     
-    protected void createPersonRefs(){
+    protected void createPersonRefs() throws Exception{
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         // Create a temporary PersonAuthority resource, and its corresponding
         // refName by which it can be identified.
@@ -171,7 +170,7 @@ public class ConditioncheckAuthRefsTest extends BaseServiceTest<AbstractCommonLi
         conditionCheckerRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
     }
     
-    protected String createPerson(String firstName, String surName, String shortId, String authRefName ) {
+    protected String createPerson(String firstName, String surName, String shortId, String authRefName ) throws Exception {
        String result = null;
        
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
@@ -287,9 +286,10 @@ public class ConditioncheckAuthRefsTest extends BaseServiceTest<AbstractCommonLi
      * 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.
+     * @throws Exception 
      */
     @AfterClass(alwaysRun=true)
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         String noTest = System.getProperty("noTestCleanup");
         if(Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
             if (logger.isDebugEnabled()) {
@@ -334,7 +334,7 @@ public class ConditioncheckAuthRefsTest extends BaseServiceTest<AbstractCommonLi
     }
 
     private PoxPayloadOut createConditioncheckInstance(String conditionCheckRefNumber,
-            String conditionChecker) {
+            String conditionChecker) throws Exception {
         ConditionchecksCommon conditioncheckCommon = new ConditionchecksCommon();
 
         conditioncheckCommon.setConditionCheckRefNumber(conditionCheckRefNumber);
index 81ce30976a1d7be5909ef78e9b17067f3c148300..ea14ee6aefc5b287ebb8fd6c86fd16dc62efdbe3 100644 (file)
@@ -39,7 +39,6 @@ import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.conditioncheck.ConditionchecksCommon;
 import org.collectionspace.services.conditioncheck.HazardGroupList;
 import org.collectionspace.services.conditioncheck.HazardGroup;
-
 import org.testng.Assert;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -69,12 +68,12 @@ public class ConditioncheckServiceTest extends AbstractPoxServiceTestImpl<Abstra
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new ConditioncheckClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new ConditioncheckClient(clientPropertiesFilename);
        }
 
@@ -648,7 +647,7 @@ public class ConditioncheckServiceTest extends AbstractPoxServiceTestImpl<Abstra
     }
 
     @Override
-    protected PoxPayloadOut createInstance(String identifier) {
+    protected PoxPayloadOut createInstance(String identifier) throws Exception {
         return createConditioncheckInstance(identifier);
     }
 
@@ -667,8 +666,9 @@ public class ConditioncheckServiceTest extends AbstractPoxServiceTestImpl<Abstra
      *
      * @param conditioncheckRefNumber the conditioncheck number
      * @return the multipart output
+     * @throws Exception 
      */
-    private PoxPayloadOut createConditioncheckInstance(String conditionCheckRefNumber) {
+    private PoxPayloadOut createConditioncheckInstance(String conditionCheckRefNumber) throws Exception {
 
         ConditionchecksCommon conditioncheckCommon = new ConditionchecksCommon();
         conditioncheckCommon.setConditionCheckRefNumber(conditionCheckRefNumber);
@@ -704,7 +704,7 @@ public class ConditioncheckServiceTest extends AbstractPoxServiceTestImpl<Abstra
 
     @Override
     protected PoxPayloadOut createInstance(String commonPartName,
-            String identifier) {
+            String identifier) throws Exception {
         PoxPayloadOut result = createConditioncheckInstance(identifier);
         return result;
     }
diff --git a/services/config/src/main/resources/instance1.xml b/services/config/src/main/resources/instance1.xml
new file mode 100644 (file)
index 0000000..5bfbcbe
--- /dev/null
@@ -0,0 +1,323 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tenant:TenantBindingConfig xmlns:types="http://collectionspace.org/services/config/types"
+ xmlns:service="http://collectionspace.org/services/config/service"
+ xmlns:remoteclientconfig="http://collectionspace.org/services/config/remoteclientconfig"
+ xmlns:tenant="http://collectionspace.org/services/config/tenant"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://collectionspace.org/services/config/tenant file:/C:/dev/src/cspace/services/services/config/src/main/resources/tenant.xsd">
+       <tenant:tenantBinding id="ID000" name="name0" displayName="displayName0" version="0.1" createDisabled="false">
+               <tenant:repositoryDomain name="name1" storageName="storageName0" repositoryName="default" repositoryClient="nuxeo-java"/>
+               <tenant:repositoryDomain name="name2" storageName="storageName1" repositoryName="default" repositoryClient="nuxeo-java"/>
+               <tenant:binaryStorePath>123</tenant:binaryStorePath>
+               <tenant:properties>
+                       <types:item>
+                               <types:key>123</types:key>
+                               <types:value>123</types:value>
+                       </types:item>
+                       <types:item>
+                               <types:key>123</types:key>
+                               <types:value>123</types:value>
+                       </types:item>
+               </tenant:properties>
+               <tenant:properties>
+                       <types:item>
+                               <types:key>123</types:key>
+                               <types:value>123</types:value>
+                       </types:item>
+                       <types:item>
+                               <types:key>123</types:key>
+                               <types:value>123</types:value>
+                       </types:item>
+               </tenant:properties>
+               <tenant:remoteClientConfigurations>
+                       <tenant:remoteClientConfig>
+                               <tenant:name>123</tenant:name>
+                               <tenant:url>123</tenant:url>
+                               <tenant:user>123</tenant:user>
+                               <tenant:password>123</tenant:password>
+                               <tenant:tenantId>123</tenant:tenantId>
+                               <tenant:tenantName>123</tenant:tenantName>
+                               <tenant:ssl>123</tenant:ssl>
+                               <tenant:auth>123</tenant:auth>
+                       </tenant:remoteClientConfig>
+                       <tenant:remoteClientConfig>
+                               <tenant:name>123</tenant:name>
+                               <tenant:url>123</tenant:url>
+                               <tenant:user>123</tenant:user>
+                               <tenant:password>123</tenant:password>
+                               <tenant:tenantId>123</tenant:tenantId>
+                               <tenant:tenantName>123</tenant:tenantName>
+                               <tenant:ssl>123</tenant:ssl>
+                               <tenant:auth>123</tenant:auth>
+                       </tenant:remoteClientConfig>
+               </tenant:remoteClientConfigurations>
+               <tenant:serviceBindings name="name3" type="type0" version="0.1" supportsReplicating="false" requiresUniqueShortId="false">
+                       <service:uriPath>123</service:uriPath>
+                       <service:uriPath>123</service:uriPath>
+                       <service:object name="name4" version="0.1">
+                               <service:property>
+                                       <types:item>
+                                               <types:key>123</types:key>
+                                               <types:value>123</types:value>
+                                       </types:item>
+                                       <types:item>
+                                               <types:key>123</types:key>
+                                               <types:value>123</types:value>
+                                       </types:item>
+                               </service:property>
+                               <service:property>
+                                       <types:item>
+                                               <types:key>123</types:key>
+                                               <types:value>123</types:value>
+                                       </types:item>
+                                       <types:item>
+                                               <types:key>123</types:key>
+                                               <types:value>123</types:value>
+                                       </types:item>
+                               </service:property>
+                               <service:part id="ID001" control_group="External" versionable="false" auditable="false" label="label0" updated="2006-05-04T18:13:51.0" order="0">
+                                       <service:properties>
+                                       </service:properties>
+                                       <service:properties>
+                                       </service:properties>
+                                       <service:content contentType="contentType0">
+<!--                                           <service:xmlContent schemaLocation="schemaLocation0" namespaceURI="namespaceURI0">
+                                               </service:xmlContent>-->
+<!--                                           <service:contentLocation type="internalId" ref="http://www.oxygenxml.com/"/>-->
+                                               <service:binaryContent>123</service:binaryContent>
+                                       </service:content>
+                               </service:part>
+                               <service:part id="ID002" control_group="External" versionable="false" auditable="false" label="label1" updated="2006-05-04T18:13:51.0" order="0">
+                                       <service:properties>
+                                       </service:properties>
+                                       <service:properties>
+                                       </service:properties>
+                                       <service:content contentType="contentType1">
+<!--                                           <service:xmlContent schemaLocation="schemaLocation1" namespaceURI="namespaceURI1">
+                                               </service:xmlContent>-->
+                                               <service:contentLocation type="internalId" ref="http://www.oxygenxml.com/"/>
+<!--                                           <service:binaryContent>123</service:binaryContent>-->
+                                       </service:content>
+                               </service:part>
+                               <service:serviceHandler>123</service:serviceHandler>
+                       </service:object>
+                       <service:documentHandler>123</service:documentHandler>
+                       <service:DocHandlerParams>
+                               <service:classname>123</service:classname>
+                               <service:params>
+                                       <service:SchemaName>123</service:SchemaName>
+                                       <service:RefnameDisplayNameField>
+                                               <service:setter>123</service:setter>
+                                               <service:element>123</service:element>
+                                               <service:schema>123</service:schema>
+                                               <service:xpath>123</service:xpath>
+                                       </service:RefnameDisplayNameField>
+                                       <service:SupportsHierarchy>123</service:SupportsHierarchy>
+                                       <service:SupportsVersioning>123</service:SupportsVersioning>
+                                       <service:DublinCoreTitle>123</service:DublinCoreTitle>
+                                       <service:SummaryFields>123</service:SummaryFields>
+                                       <service:AbstractCommonListClassname>123</service:AbstractCommonListClassname>
+                                       <service:CommonListItemClassname>123</service:CommonListItemClassname>
+                                       <service:ListResultsItemMethodName>123</service:ListResultsItemMethodName>
+                                       <service:ListResultsFields>
+                                               <service:Extended>123</service:Extended>
+                                       </service:ListResultsFields>
+                               </service:params>
+                       </service:DocHandlerParams>
+                       <service:validatorHandler>123</service:validatorHandler>
+                       <service:validatorHandler>123</service:validatorHandler>
+                       <service:clientHandler>123</service:clientHandler>
+                       <service:disableAsserts>123</service:disableAsserts>
+                       <service:initHandler>
+                               <service:classname>123</service:classname>
+                               <service:params>
+                                       <service:field>
+                                       </service:field>
+                                       <service:field>
+                                       </service:field>
+                                       <service:property>
+                                               <service:key>123</service:key>
+                                               <service:value>123</service:value>
+                                       </service:property>
+                                       <service:property>
+                                               <service:key>123</service:key>
+                                               <service:value>123</service:value>
+                                       </service:property>
+                               </service:params>
+                       </service:initHandler>
+                       <service:initHandler>
+                               <service:classname>123</service:classname>
+                               <service:params>
+                                       <service:field>
+                                       </service:field>
+                                       <service:field>
+                                       </service:field>
+                                       <service:property>
+                                               <service:key>123</service:key>
+                                               <service:value>123</service:value>
+                                       </service:property>
+                                       <service:property>
+                                               <service:key>123</service:key>
+                                               <service:value>123</service:value>
+                                       </service:property>
+                               </service:params>
+                       </service:initHandler>
+                       <service:repositoryDomain>123</service:repositoryDomain>
+                       <service:repositoryWorkspaceId>123</service:repositoryWorkspaceId>
+                       <service:properties>
+                               <types:item>
+                                       <types:key>123</types:key>
+                                       <types:value>123</types:value>
+                               </types:item>
+                               <types:item>
+                                       <types:key>123</types:key>
+                                       <types:value>123</types:value>
+                               </types:item>
+                       </service:properties>
+                       <service:properties>
+                               <types:item>
+                                       <types:key>123</types:key>
+                                       <types:value>123</types:value>
+                               </types:item>
+                               <types:item>
+                                       <types:key>123</types:key>
+                                       <types:value>123</types:value>
+                               </types:item>
+                       </service:properties>
+               </tenant:serviceBindings>
+               <tenant:serviceBindings name="name5" type="type3" version="0.1" supportsReplicating="false" requiresUniqueShortId="false">
+                       <service:uriPath>123</service:uriPath>
+                       <service:uriPath>123</service:uriPath>
+                       <service:object name="name6" version="0.1">
+                               <service:property>
+                                       <types:item>
+                                               <types:key>123</types:key>
+                                               <types:value>123</types:value>
+                                       </types:item>
+                                       <types:item>
+                                               <types:key>123</types:key>
+                                               <types:value>123</types:value>
+                                       </types:item>
+                               </service:property>
+                               <service:property>
+                                       <types:item>
+                                               <types:key>123</types:key>
+                                               <types:value>123</types:value>
+                                       </types:item>
+                                       <types:item>
+                                               <types:key>123</types:key>
+                                               <types:value>123</types:value>
+                                       </types:item>
+                               </service:property>
+                               <service:part id="ID003" control_group="External" versionable="false" auditable="false" label="label2" updated="2006-05-04T18:13:51.0" order="0">
+                                       <service:properties>
+                                       </service:properties>
+                                       <service:properties>
+                                       </service:properties>
+                                       <service:content contentType="contentType2">
+<!--                                           <service:xmlContent schemaLocation="schemaLocation2" namespaceURI="namespaceURI2">
+                                               </service:xmlContent>-->
+<!--                                           <service:contentLocation type="internalId" ref="http://www.oxygenxml.com/"/>-->
+                                               <service:binaryContent>123</service:binaryContent>
+                                       </service:content>
+                               </service:part>
+                               <service:part id="ID004" control_group="External" versionable="false" auditable="false" label="label3" updated="2006-05-04T18:13:51.0" order="0">
+                                       <service:properties>
+                                       </service:properties>
+                                       <service:properties>
+                                       </service:properties>
+                                       <service:content contentType="contentType3">
+                                               <service:xmlContent schemaLocation="schemaLocation3" namespaceURI="namespaceURI3">
+                                               </service:xmlContent>
+<!--                                           <service:contentLocation type="internalId" ref="http://www.oxygenxml.com/"/>-->
+<!--                                           <service:binaryContent>123</service:binaryContent>-->
+                                       </service:content>
+                               </service:part>
+                               <service:serviceHandler>123</service:serviceHandler>
+                       </service:object>
+                       <service:documentHandler>123</service:documentHandler>
+                       <service:DocHandlerParams>
+                               <service:classname>123</service:classname>
+                               <service:params>
+                                       <service:SchemaName>123</service:SchemaName>
+                                       <service:RefnameDisplayNameField>
+                                               <service:setter>123</service:setter>
+                                               <service:element>123</service:element>
+                                               <service:schema>123</service:schema>
+                                               <service:xpath>123</service:xpath>
+                                       </service:RefnameDisplayNameField>
+                                       <service:SupportsHierarchy>123</service:SupportsHierarchy>
+                                       <service:SupportsVersioning>123</service:SupportsVersioning>
+                                       <service:DublinCoreTitle>123</service:DublinCoreTitle>
+                                       <service:SummaryFields>123</service:SummaryFields>
+                                       <service:AbstractCommonListClassname>123</service:AbstractCommonListClassname>
+                                       <service:CommonListItemClassname>123</service:CommonListItemClassname>
+                                       <service:ListResultsItemMethodName>123</service:ListResultsItemMethodName>
+                                       <service:ListResultsFields>
+                                               <service:Extended>123</service:Extended>
+                                       </service:ListResultsFields>
+                               </service:params>
+                       </service:DocHandlerParams>
+                       <service:validatorHandler>123</service:validatorHandler>
+                       <service:validatorHandler>123</service:validatorHandler>
+                       <service:clientHandler>123</service:clientHandler>
+                       <service:disableAsserts>123</service:disableAsserts>
+                       <service:initHandler>
+                               <service:classname>123</service:classname>
+                               <service:params>
+                                       <service:field>
+                                       </service:field>
+                                       <service:field>
+                                       </service:field>
+                                       <service:property>
+                                               <service:key>123</service:key>
+                                               <service:value>123</service:value>
+                                       </service:property>
+                                       <service:property>
+                                               <service:key>123</service:key>
+                                               <service:value>123</service:value>
+                                       </service:property>
+                               </service:params>
+                       </service:initHandler>
+                       <service:initHandler>
+                               <service:classname>123</service:classname>
+                               <service:params>
+                                       <service:field>
+                                       </service:field>
+                                       <service:field>
+                                       </service:field>
+                                       <service:property>
+                                               <service:key>123</service:key>
+                                               <service:value>123</service:value>
+                                       </service:property>
+                                       <service:property>
+                                               <service:key>123</service:key>
+                                               <service:value>123</service:value>
+                                       </service:property>
+                               </service:params>
+                       </service:initHandler>
+                       <service:repositoryDomain>123</service:repositoryDomain>
+                       <service:repositoryWorkspaceId>123</service:repositoryWorkspaceId>
+                       <service:properties>
+                               <types:item>
+                                       <types:key>123</types:key>
+                                       <types:value>123</types:value>
+                               </types:item>
+                               <types:item>
+                                       <types:key>123</types:key>
+                                       <types:value>123</types:value>
+                               </types:item>
+                       </service:properties>
+                       <service:properties>
+                               <types:item>
+                                       <types:key>123</types:key>
+                                       <types:value>123</types:value>
+                               </types:item>
+                               <types:item>
+                                       <types:key>123</types:key>
+                                       <types:value>123</types:value>
+                               </types:item>
+                       </service:properties>
+               </tenant:serviceBindings>
+       </tenant:tenantBinding>
+</tenant:TenantBindingConfig>
index 158c1bb3fa6af1bfc79e29615442ff290fc8112f..0295f92e0fbd8aeeae107b2b7563b8be3196e6e4 100644 (file)
@@ -61,6 +61,7 @@
         <xs:attribute name="type" type="xs:string" use="optional"/>
         <xs:attribute name="version" type="types:VersionType" use="required"/>
         <xs:attribute name="supportsReplicating" type="xs:boolean" default="false"/>
+        <xs:attribute name="remoteClientConfigName" type="xs:string"/>
         <xs:attribute name="requiresUniqueShortId" type="xs:boolean" default="false"/>
     </xs:complexType>
 
index 5eb4e99c89be06be81b10dc5941374aba26ab707..f9bf0d4676345014cbc7c37aa6ef236ab918befb 100644 (file)
            xmlns="http://collectionspace.org/services/config/tenant"
            xmlns:types="http://collectionspace.org/services/config/types"
            xmlns:service="http://collectionspace.org/services/config/service"
+           xmlns:remoteclientconfig="http://collectionspace.org/services/config/remoteclientconfig"
            targetNamespace="http://collectionspace.org/services/config/tenant"
            version="0.1"
            elementFormDefault="qualified">
 
     <xs:import namespace="http://collectionspace.org/services/config/types" schemaLocation="types.xsd" />
-    <xs:import namespace="http://collectionspace.org/services/config/service" schemaLocation="service.xsd" />
-
+       <xs:import namespace="http://collectionspace.org/services/config/service" schemaLocation="service.xsd" />
+       
     <xs:element name="TenantBindingConfig">
         <xs:annotation>
             <xs:documentation/>
@@ -47,6 +48,7 @@
             <xs:element name="repositoryDomain" type="RepositoryDomainType" minOccurs="0" maxOccurs="unbounded"/>
             <xs:element name="binaryStorePath" type="xs:string" minOccurs="0" maxOccurs="1"/>
             <xs:element name="properties" type="types:PropertyType" minOccurs="0" maxOccurs="unbounded"/>
+               <xs:element name="remoteClientConfigurations" type="RemoteClientConfigurations" minOccurs="0" maxOccurs="1"/>
             <xs:element name="serviceBindings" type="service:ServiceBindingType" minOccurs="0" maxOccurs="unbounded"/>
         </xs:sequence>
         <!-- tenant id, a UUID -->
         <xs:attribute name="repositoryClient" type="xs:string" use="optional" default="nuxeo-java"/>
     </xs:complexType>
 
+       <xs:complexType name="RemoteClientConfigurations">
+               <xs:sequence>
+                       <xs:element name="remoteClientConfig" type="RemoteClientConfig" minOccurs="0" maxOccurs="unbounded"/>
+               </xs:sequence>
+       </xs:complexType>
+       
+       <xs:complexType name="RemoteClientConfig">
+               <xs:annotation>
+                       <xs:documentation>Connection details for a remote CollectionSpace instance.  Used for things like the Share Authority Server</xs:documentation>
+               </xs:annotation>
+               <xs:sequence>
+                       <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/>
+                       <xs:element name="url" type="xs:string" minOccurs="1" maxOccurs="1"/>
+                       <xs:element name="user" type="xs:string" minOccurs="1" maxOccurs="1"/>
+                       <xs:element name="password" type="xs:string" minOccurs="1" maxOccurs="1"/>
+                       <xs:element name="tenantId" type="xs:string" minOccurs="0" maxOccurs="1"/>
+                       <xs:element name="tenantName" type="xs:string" minOccurs="0" maxOccurs="1"/>
+                       <xs:element name="ssl" type="xs:string" minOccurs="0" maxOccurs="1"/>        
+                       <xs:element name="auth" type="xs:string" minOccurs="0" maxOccurs="1"/>
+               </xs:sequence>
+       </xs:complexType>
+
 </xs:schema>
index bdb76b2e9c58bffe79bf128e1e79e0b9a5cd88d8..2a816901f007dd54ac9a44599f2ef814a663d39d 100644 (file)
@@ -33,11 +33,11 @@ public class ConservationClient extends AbstractCommonListPoxServiceClientImpl<C
     public static final String SERVICE_PATH_PROXY = SERVICE_PATH + "/";
     public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME;
 
-    public ConservationClient() {
+    public ConservationClient() throws Exception {
                super();
        }
 
-    public ConservationClient(String clientPropertiesFilename) {
+    public ConservationClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
index 4d24ebd97e5aec94f64d1278329e91f5ddef2bec..9892a8c3de92f678826cb7298dd3bee82f7de377 100644 (file)
@@ -48,7 +48,6 @@ import org.collectionspace.services.conservation.ExaminationGroupList;
 import org.collectionspace.services.conservation.OtherPartyGroup;
 import org.collectionspace.services.conservation.OtherPartyGroupList;
 import org.collectionspace.services.person.PersonTermGroup;
-
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
@@ -164,7 +163,7 @@ public class ConservationAuthRefsTest extends BaseServiceTest<AbstractCommonList
         }
     }
     
-    protected void createPersonRefs(){
+    protected void createPersonRefs() throws Exception{
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         // Create a temporary PersonAuthority resource, and its corresponding
         // refName by which it can be identified.
@@ -209,7 +208,7 @@ public class ConservationAuthRefsTest extends BaseServiceTest<AbstractCommonList
         sampleByRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
     }
     
-    protected String createPerson(String firstName, String surName, String shortId, String authRefName ) {
+    protected String createPerson(String firstName, String surName, String shortId, String authRefName ) throws Exception {
         String result = null;
        
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
@@ -327,9 +326,10 @@ public class ConservationAuthRefsTest extends BaseServiceTest<AbstractCommonList
      * 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.
+     * @throws Exception 
      */
     @AfterClass(alwaysRun=true)
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         String noTest = System.getProperty("noTestCleanup");
        if(Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
             if (logger.isDebugEnabled()) {
@@ -379,7 +379,7 @@ public class ConservationAuthRefsTest extends BaseServiceTest<AbstractCommonList
             String examinationStaffRefName,
             String approvedByRefName,
             String researcherRefName,
-            String sampleByRefName) {
+            String sampleByRefName) throws Exception {
         ConservationCommon conservationCommon = new ConservationCommon();
         conservationCommon.setConservationNumber(conservationNumber);
 
index 1cdd51b2217768d3c693b056335f0d983cc292df..442aa6bcf3086b53187cc48fa3fc2b47657fceeb 100644 (file)
@@ -39,7 +39,6 @@ import org.collectionspace.services.conservation.ConservationCommon;
 import org.collectionspace.services.conservation.ConservatorsList;
 import org.collectionspace.services.conservation.ConservationStatusGroup;
 import org.collectionspace.services.conservation.ConservationStatusGroupList;
-
 import org.testng.Assert;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -68,12 +67,12 @@ public class ConservationServiceTest extends AbstractPoxServiceTestImpl<Abstract
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new ConservationClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new ConservationClient(clientPropertiesFilename);
        }
 
@@ -637,7 +636,7 @@ public class ConservationServiceTest extends AbstractPoxServiceTestImpl<Abstract
     }
 
     @Override
-    protected PoxPayloadOut createInstance(String identifier) {
+    protected PoxPayloadOut createInstance(String identifier) throws Exception {
         return createConservationInstance(identifier);
     }
 
@@ -647,8 +646,9 @@ public class ConservationServiceTest extends AbstractPoxServiceTestImpl<Abstract
      * @param conservationNumber the conservation number
      * @param returnDate the return date
      * @return the multipart output
+     * @throws Exception 
      */
-    private PoxPayloadOut createConservationInstance(String identifier) {
+    private PoxPayloadOut createConservationInstance(String identifier) throws Exception {
         ConservationCommon conservationCommon = new ConservationCommon();
         conservationCommon.setConservationNumber("conservationNumber-" + identifier);
         
@@ -684,7 +684,7 @@ public class ConservationServiceTest extends AbstractPoxServiceTestImpl<Abstract
 
        @Override
        protected PoxPayloadOut createInstance(String commonPartName,
-                       String identifier) {
+                       String identifier) throws Exception {
         PoxPayloadOut result = createConservationInstance(identifier);
         return result;
        }
index b69f4ce7805d435d07ea7461eb895dcdc630d6c5..b61eb24a2aeaead6304df6d4cb4c05425e4a2359 100644 (file)
@@ -2,9 +2,6 @@ package org.collectionspace.services.client;
 
 import javax.ws.rs.core.Response;
 
-import org.jboss.resteasy.client.ClientResponse;
-import org.collectionspace.services.jaxb.AbstractCommonList;
-
 /*
  * LT - List type
  * ILT - Authority item list type
@@ -14,11 +11,11 @@ public abstract class AuthorityWithContactsClientImpl<AUTHORITY_COMMON_TYPE, AUT
        extends AuthorityClientImpl<AUTHORITY_COMMON_TYPE, AUTHORITY_ITEM_TYPE, P>
        implements AuthorityWithContactsClient<AUTHORITY_COMMON_TYPE, AUTHORITY_ITEM_TYPE, P> {
        
-       public AuthorityWithContactsClientImpl(String clientPropertiesFilename) {
+       public AuthorityWithContactsClientImpl(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
-       public AuthorityWithContactsClientImpl() {
+       public AuthorityWithContactsClientImpl() throws Exception {
                super();
        }
 
index c2d165d6c4c7d9243121b70b26797b0f9ad52f94..f976fa29f095897aa8dfde092f63ab584c2bb798 100644 (file)
@@ -33,11 +33,11 @@ public class ContactClient extends AbstractCommonListPoxServiceClientImpl<Contac
     public static final String SERVICE_PATH_PROXY = SERVICE_PATH + "/";
     public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME;
 
-    public ContactClient() {
+    public ContactClient() throws Exception {
                super();
        }
 
-    public ContactClient(String clientPropertiesFilename) {
+    public ContactClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
index e365c0a0afd8328abcca2e12e098c8917526752a..b2940a57f44e4ad543eebdcfae342638c61259f5 100644 (file)
@@ -37,7 +37,9 @@ import org.collectionspace.services.contact.EmailGroupList;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 
 import java.util.List;
+
 import javax.ws.rs.core.Response;
+
 import org.testng.Assert;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -51,7 +53,6 @@ import org.slf4j.LoggerFactory;
  */
 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";
@@ -70,12 +71,12 @@ public class ContactServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new ContactClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new ContactClient(clientPropertiesFilename);
        }
        
index 12b3fae89b01e6699e03389437eab4308fd3718c..92deb3fb032e69b54ef5290d64e263d75f2e8394 100644 (file)
@@ -40,11 +40,11 @@ public class DimensionClient extends AbstractCommonListPoxServiceClientImpl<Dime
        public static final String SERVICE_PATH_PROXY = SERVICE_PATH + "/";     
        public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME;
 
-       public DimensionClient() {
+       public DimensionClient() throws Exception {
                super();
        }
 
-       public DimensionClient(String clientPropertiesFilename) {
+       public DimensionClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
index 3958bd9194ec02de12d2ab3b43eb83a3cb6c03ca..dacb1fca9501ffbe71a4a5b2d86e9b1af233fae7 100644 (file)
@@ -31,7 +31,6 @@ import org.collectionspace.services.client.DimensionFactory;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.dimension.DimensionsCommon;
 import org.collectionspace.services.jaxb.AbstractCommonList;
-
 import org.testng.Assert;
 import org.testng.annotations.Test;
 import org.slf4j.Logger;
@@ -68,12 +67,12 @@ public class DimensionServiceTest extends AbstractPoxServiceTestImpl<AbstractCom
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new DimensionClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new DimensionClient(clientPropertiesFilename);
        }       
     
@@ -106,7 +105,7 @@ public class DimensionServiceTest extends AbstractPoxServiceTestImpl<AbstractCom
     }
 
     @Override
-    protected PoxPayloadOut createInstance(String identifier) {
+    protected PoxPayloadOut createInstance(String identifier) throws Exception {
        DimensionClient client = new DimensionClient();
        return createInstance(client.getCommonPartName(), identifier);
     }
index 5f5c6dbdadb312e679217545bb0cf1c24a37e815..798766e9a905353ac618eafd16552933def0ba5e 100644 (file)
@@ -29,11 +29,11 @@ public class ExhibitionClient extends AbstractCommonListPoxServiceClientImpl<Exh
     public static final String SERVICE_PATH_PROXY = SERVICE_PATH + "/";
     public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME;
 
-    public ExhibitionClient() {
+    public ExhibitionClient() throws Exception {
                super();
        }
 
-    public ExhibitionClient(String clientPropertiesFilename) {
+    public ExhibitionClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
index b4d65cd1cf97a0ab6e6d2439b28c0d2270ba12eb..3e18da9125910dac84e80d849a22acc9752820b2 100644 (file)
@@ -33,6 +33,7 @@ import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.exhibition.ExhibitionsCommon;
 
 import javax.ws.rs.core.Response;
+
 import org.testng.Assert;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -55,12 +56,12 @@ public class ExhibitionServiceTest extends AbstractPoxServiceTestImpl<AbstractCo
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new ExhibitionClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new ExhibitionClient(clientPropertiesFilename);
        }
 
@@ -622,7 +623,7 @@ public class ExhibitionServiceTest extends AbstractPoxServiceTestImpl<AbstractCo
     }
 
     @Override
-    protected PoxPayloadOut createInstance(String identifier) {
+    protected PoxPayloadOut createInstance(String identifier) throws Exception {
         return createExhibitionInstance(identifier);
     }
 
@@ -641,8 +642,9 @@ public class ExhibitionServiceTest extends AbstractPoxServiceTestImpl<AbstractCo
      *
      * @param exhibitionNumber the exhibition number
      * @return the multipart output
+     * @throws Exception 
      */
-    private PoxPayloadOut createExhibitionInstance(String exhibitionNumber) {
+    private PoxPayloadOut createExhibitionInstance(String exhibitionNumber) throws Exception {
 
         ExhibitionsCommon exhibitionCommon = new ExhibitionsCommon();
         exhibitionCommon.setExhibitionNumber(exhibitionNumber);
@@ -668,7 +670,7 @@ public class ExhibitionServiceTest extends AbstractPoxServiceTestImpl<AbstractCo
 
     @Override
     protected PoxPayloadOut createInstance(String commonPartName,
-            String identifier) {
+            String identifier) throws Exception {
         PoxPayloadOut result = createExhibitionInstance(identifier);
         return result;
     }
index 1d19ebbe5468af070527515dd7e433b341b0b703..9adba5940410d4a8695fdb3c455b9cddd1e76bb9 100644 (file)
@@ -33,11 +33,11 @@ public class GroupClient extends AbstractCommonListPoxServiceClientImpl<GroupPro
        public static final String SERVICE_PATH_PROXY = SERVICE_PATH + "/";     
        public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME; 
 
-       public GroupClient() {
+       public GroupClient() throws Exception {
                super();
        }
 
-       public GroupClient(String clientPropertiesFilename) {
+       public GroupClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
index 6b5535bb98f4fecbb87b740aec2d0b01b55eb420..651beae1fdc2dcc148f01aaf29de321d21edc49f 100644 (file)
@@ -32,7 +32,6 @@ import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.group.GroupsCommon;
-
 import org.testng.Assert;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -60,12 +59,12 @@ public class GroupServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonL
        }
     
     @Override
-    protected CollectionSpaceClient<AbstractCommonList, PoxPayloadOut, String, GroupProxy> getClientInstance() {
+    protected CollectionSpaceClient<AbstractCommonList, PoxPayloadOut, String, GroupProxy> getClientInstance() throws Exception {
         return new GroupClient();
     }
     
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new GroupClient(clientPropertiesFilename);
        }
     
@@ -79,18 +78,18 @@ public class GroupServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonL
     // ---------------------------------------------------------------
     
     @Override
-    protected PoxPayloadOut createInstance(String identifier) {
+    protected PoxPayloadOut createInstance(String identifier) throws Exception {
        GroupClient client = new GroupClient();
        return createInstance(client.getCommonPartName(), identifier);
     }
 
        @Override
        protected PoxPayloadOut createInstance(String commonPartName,
-                       String identifier) {
+                       String identifier) throws Exception {
                return createGroupInstance(identifier);
        }
     
-    private PoxPayloadOut createGroupInstance(String uid) {
+    private PoxPayloadOut createGroupInstance(String uid) throws Exception {
         String identifier = "title-" + uid;
         GroupsCommon group = new GroupsCommon();
         group.setTitle(identifier);
index a40e512c79e32091536155b87aff26d646ce8c43..ca2da1a37813f9f82fe98f9ff3c688d61da02898 100644 (file)
@@ -15,11 +15,11 @@ public class IdClient extends AbstractServiceClientImpl<String, String, String,
 
     public static final String SERVICE_NAME = "idgenerators";
     
-    public IdClient() {
+    public IdClient() throws Exception {
                super();
        }
 
-    public IdClient(String clientPropertiesFilename) {
+    public IdClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
index 1005c7757e0bf211f07a8e97e9dd27dd5c106a87..4fe11b75da5698a79a00f9bab842ea5140d6c4f4 100644 (file)
@@ -24,6 +24,7 @@ package org.collectionspace.services.id;
 
 import java.util.ArrayList;
 import java.util.List;
+
 import javax.ws.rs.core.Response;
 
 import org.collectionspace.services.client.CollectionSpaceClient;
@@ -36,7 +37,6 @@ import org.collectionspace.services.id.IDGeneratorSerializer;
 import org.collectionspace.services.id.NumericIDGeneratorPart;
 import org.collectionspace.services.id.SettableIDGenerator;
 import org.collectionspace.services.id.StringIDGeneratorPart;
-
 import org.testng.Assert;
 import org.testng.annotations.Test;
 import org.slf4j.Logger;
@@ -62,12 +62,12 @@ public class IdServiceTest extends BaseServiceTest {
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
        return new IdClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
        return new IdClient(clientPropertiesFilename);
        }
 
@@ -283,7 +283,7 @@ public class IdServiceTest extends BaseServiceTest {
      * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
      */
     @Override
-    public String getServicePathComponent() {
+    public String getServicePathComponent() throws Exception {
         return new IdClient().getServicePathComponent();
     }
 
index 9055f12f376b43cee4a1371dad1bf27cbfa4c62d..738124846f8a3c6b3ce24b7c07ce1b583b6b9f7c 100644 (file)
@@ -38,11 +38,11 @@ public class IntakeClient extends AbstractCommonListPoxServiceClientImpl<IntakeP
     public static final String SERVICE_PATH_PROXY = SERVICE_PATH + "/";
     public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME;
 
-    public IntakeClient() {
+    public IntakeClient() throws Exception {
                super();
        }
 
-    public IntakeClient(String clientPropertiesFilename) {
+    public IntakeClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
index fcf1655c88d7b92d2c3050cc12e97c82b8ba7077..b71e41a0047b368b038364cd5bb8a9956d4eedba 100644 (file)
@@ -44,7 +44,6 @@ import org.collectionspace.services.intake.IntakesCommon;
 import org.collectionspace.services.intake.InsurerList;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.person.PersonTermGroup;
-
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
@@ -165,7 +164,7 @@ public class IntakeAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
         intakeIdsCreated.add(newId);
     }
     
-    protected void createPersonRefs() {
+    protected void createPersonRefs() throws Exception {
        //
        // First, create a new person authority
        //
@@ -205,7 +204,7 @@ public class IntakeAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
         personIdsCreated.add(csid);
     }
     
-    protected String createPerson(String firstName, String surName, String shortId, String authRefName ) {
+    protected String createPerson(String firstName, String surName, String shortId, String authRefName ) throws Exception {
        String result = null;
        
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
@@ -315,9 +314,10 @@ public class IntakeAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
      * 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.
+     * @throws Exception 
      */
     @AfterClass(alwaysRun=true)
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         String noTest = System.getProperty("noTestCleanup");
        if(Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
             if (logger.isDebugEnabled()) {
@@ -355,7 +355,7 @@ public class IntakeAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
                                String depositor,
                                String conditionCheckerAssessor,
                                String insurer,
-                               String Valuer ) {
+                               String Valuer ) throws Exception {
         IntakesCommon intake = new IntakesCommon();
         intake.setEntryNumber(entryNumber);
         intake.setEntryDate(entryDate);
index 0a13b8a4ac9440067a2ff676c91fe42198c6ec9c..9bac78c9c60947d24d44d67db223ad3d267baae3 100644 (file)
@@ -41,7 +41,6 @@ import org.collectionspace.services.intake.CurrentLocationGroup;
 import org.collectionspace.services.intake.CurrentLocationGroupList;
 import org.collectionspace.services.intake.IntakesCommon;
 import org.collectionspace.services.jaxb.AbstractCommonList;
-
 import org.testng.Assert;
 import org.testng.annotations.Test;
 import org.slf4j.Logger;
@@ -64,12 +63,12 @@ public class IntakeServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
             GregorianCalendarDateTimeUtils.currentDateUTC();
 
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new IntakeClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new IntakeClient(clientPropertiesFilename);
        }
 
@@ -496,9 +495,10 @@ public class IntakeServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
      *
      * @param identifier the identifier
      * @return the multipart output
+     * @throws Exception 
      */
     @Override
-    protected PoxPayloadOut createInstance(String identifier) {
+    protected PoxPayloadOut createInstance(String identifier) throws Exception {
         return createIntakeInstance(
                 "entryNumber-" + identifier,
                 CURRENT_DATE_UTC,
@@ -512,10 +512,11 @@ public class IntakeServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
      * @param entryDate the entry date
      * @param depositor the depositor
      * @return the multipart output
+     * @throws Exception 
      */
     private PoxPayloadOut createIntakeInstance(String entryNumber,
             String entryDate,
-            String depositor) {
+            String depositor) throws Exception {
         IntakesCommon intake = new IntakesCommon();
         intake.setEntryNumber(entryNumber);
         intake.setEntryDate(entryDate);
@@ -561,7 +562,7 @@ public class IntakeServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
 
        @Override
        protected PoxPayloadOut createInstance(String commonPartName,
-                       String identifier) {
+                       String identifier) throws Exception {
                return this.createInstance(identifier);
        }
 
index af857681d30383dbae8c7f11cfbad117f8bbfc5d..f75673788260bb480994b708f60b13677a5c1540 100644 (file)
@@ -43,7 +43,6 @@ import org.collectionspace.services.intake.IntakesCommon;
 import org.collectionspace.services.intake.InsurerList;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.organization.OrgTermGroup;
-
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
@@ -170,8 +169,9 @@ public class OrganizationAuthRefDocsTest extends BaseServiceTest<AbstractCommonL
     
     /**
      * Creates the organization refs.
+     * @throws Exception 
      */
-    protected void createOrgRefs(){
+    protected void createOrgRefs() throws Exception{
         OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
         //orgAuthRefName = 
        //      OrgAuthorityClientUtils.createOrgAuthRefName(ORGANIZATION_AUTHORITY_NAME, null);
@@ -215,7 +215,7 @@ public class OrganizationAuthRefDocsTest extends BaseServiceTest<AbstractCommonL
         orgIdsCreated.add(newOrgCSID);
     }
 
-    protected String createOrganization(String shortId, String shortName, String longName) {
+    protected String createOrganization(String shortId, String shortName, String longName) throws Exception {
        String result = null;
        
         OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
@@ -305,9 +305,10 @@ public class OrganizationAuthRefDocsTest extends BaseServiceTest<AbstractCommonL
      * 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.
+     * @throws Exception 
      */
     @AfterClass(alwaysRun=true)
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         String noTest = System.getProperty("noTestCleanup");
        if(Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
             if (logger.isDebugEnabled()) {
@@ -347,7 +348,7 @@ public class OrganizationAuthRefDocsTest extends BaseServiceTest<AbstractCommonL
                                String depositor,
                                String conditionCheckerAssessor,
                                String insurer,
-                               String Valuer ) {
+                               String Valuer ) throws Exception {
         IntakesCommon intake = new IntakesCommon();
         intake.setEntryNumber(entryNumber);
         intake.setEntryDate(entryDate);
index c632649975f1bbe344aee113772592662ec6fb66..14c411b105bd7ef21b40736dc6a4bc8d922bccd7 100644 (file)
@@ -43,7 +43,6 @@ import org.collectionspace.services.intake.IntakesCommon;
 import org.collectionspace.services.intake.InsurerList;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.person.PersonTermGroup;
-
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
@@ -168,8 +167,9 @@ public class PersonAuthRefDocsTest extends BaseServiceTest<AbstractCommonList> {
 
     /**
      * Creates the person refs.
+     * @throws Exception 
      */
-    protected void createPersonRefs() {
+    protected void createPersonRefs() throws Exception {
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
                 PERSON_AUTHORITY_NAME, PERSON_AUTHORITY_NAME, personAuthClient.getCommonPartName());
@@ -223,7 +223,7 @@ public class PersonAuthRefDocsTest extends BaseServiceTest<AbstractCommonList> {
         personIdsCreated.add(csid);
     }
 
-    protected String createPerson(String firstName, String surName, String shortId, String authRefName) {
+    protected String createPerson(String firstName, String surName, String shortId, String authRefName) throws Exception {
        String result = null;
        
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
@@ -405,9 +405,10 @@ public class PersonAuthRefDocsTest extends BaseServiceTest<AbstractCommonList> {
      * 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.
+     * @throws Exception 
      */
     @AfterClass(alwaysRun = true)
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         String noTest = System.getProperty("noTestCleanup");
         if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
             if (logger.isDebugEnabled()) {
@@ -447,7 +448,7 @@ public class PersonAuthRefDocsTest extends BaseServiceTest<AbstractCommonList> {
             String depositor,
             String conditionCheckerAssessor,
             String insurer,
-            String Valuer) {
+            String Valuer) throws Exception {
         IntakesCommon intake = new IntakesCommon();
         intake.setEntryNumber(entryNumber);
         intake.setEntryDate(entryDate);
index 32d36c1f0ee705f32330ab2a67c9ed725b4aff70..f99f4a3195e793daeac72281eddcbc4ec311f481 100644 (file)
@@ -33,11 +33,11 @@ public class LoaninClient extends AbstractCommonListPoxServiceClientImpl<LoaninP
     public static final String SERVICE_PATH_PROXY = SERVICE_PATH + "/";
     public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME;
 
-    public LoaninClient() {
+    public LoaninClient() throws Exception {
                super();
        }
 
-    public LoaninClient(String clientPropertiesFilename) {
+    public LoaninClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
index 3dc11bbbb9f652b5c2cc7f9e7a31d0c2f623987d..df8e25ba607407001ea091f8df8a30f7c77f07db 100644 (file)
@@ -44,7 +44,6 @@ import org.collectionspace.services.loanin.LenderGroup;
 import org.collectionspace.services.loanin.LenderGroupList;
 import org.collectionspace.services.loanin.LoansinCommon;
 import org.collectionspace.services.person.PersonTermGroup;
-
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
@@ -163,7 +162,7 @@ public class LoaninAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
         loaninIdsCreated.add(newId);
     }
     
-    protected void createPersonRefs(){
+    protected void createPersonRefs() throws Exception{
 
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         // Create a temporary PersonAuthority resource, and its corresponding
@@ -210,7 +209,7 @@ public class LoaninAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
         // repeatable / multivalued authority reference fields.  Be sure to
     }
     
-    protected String createPerson(String firstName, String surName, String shortId, String authRefName ) {
+    protected String createPerson(String firstName, String surName, String shortId, String authRefName ) throws Exception {
        String result = null;
        
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
@@ -332,9 +331,10 @@ public class LoaninAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
      * 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.
+     * @throws Exception 
      */
     @AfterClass(alwaysRun=true)
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         String noTest = System.getProperty("noTestCleanup");
        if(Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
             if (logger.isDebugEnabled()) {
@@ -384,7 +384,7 @@ public class LoaninAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
                String lendersAuthorizer,
                String lendersContact,
                String borrowersContact,
-               String borrowersAuthorizer) {
+               String borrowersAuthorizer) throws Exception {
        LoansinCommon loaninCommon = new LoansinCommon();
        loaninCommon.setLoanInNumber(loaninNumber);
        loaninCommon.setLoanInNumber(returnDate);
index 1eb2a74600b69b96b742f1ace8f0c76638ed5df9..848628189e8a8cc65d6be3783b898bc849c02f85 100644 (file)
@@ -39,7 +39,6 @@ import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.loanin.LenderGroup;
 import org.collectionspace.services.loanin.LenderGroupList;
 import org.collectionspace.services.loanin.LoansinCommon;
-
 import org.testng.Assert;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -69,12 +68,12 @@ public class LoaninServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new LoaninClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new LoaninClient(clientPropertiesFilename);
        }
 
@@ -633,7 +632,7 @@ public class LoaninServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
     }
 
     @Override
-    protected PoxPayloadOut createInstance(String identifier) {
+    protected PoxPayloadOut createInstance(String identifier) throws Exception {
         return createLoaninInstance(identifier);
     }
 
@@ -642,8 +641,9 @@ public class LoaninServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
      *
      * @param identifier the identifier
      * @return the multipart output
+     * @throws Exception 
      */
-    private PoxPayloadOut createLoaninInstance(String identifier) {
+    private PoxPayloadOut createLoaninInstance(String identifier) throws Exception {
         return createLoaninInstance(
                 "loaninNumber-" + identifier,
                 "returnDate-" + identifier);
@@ -655,9 +655,10 @@ public class LoaninServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
      * @param loaninNumber the loanin number
      * @param returnDate the return date
      * @return the multipart output
+     * @throws Exception 
      */
     private PoxPayloadOut createLoaninInstance(String loaninNumber,
-            String returnDate) {
+            String returnDate) throws Exception {
 
         LoansinCommon loaninCommon = new LoansinCommon();
         loaninCommon.setLoanInNumber(loaninNumber);
@@ -690,7 +691,7 @@ public class LoaninServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
 
        @Override
        protected PoxPayloadOut createInstance(String commonPartName,
-                       String identifier) {
+                       String identifier) throws Exception {
         PoxPayloadOut result = createLoaninInstance(identifier);
         return result;
        }
index 645928422c3ff2444196e73ab9ef754f9d2d97a6..e7f08b10e829995cb86b1ea86b86cdc96ef819aa 100644 (file)
@@ -32,11 +32,11 @@ public class LoanoutClient extends AbstractCommonListPoxServiceClientImpl<Loanou
     public static final String SERVICE_PATH_PROXY = SERVICE_PATH + "/";
     public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME;
 
-    public LoanoutClient() {
+    public LoanoutClient() throws Exception {
                super();
        }
 
-    public LoanoutClient(String clientPropertiesFilename) {
+    public LoanoutClient(String clientPropertiesFilename) throws Exception {
        super(clientPropertiesFilename);
        }
 
index bd84c581a41b7fb45e2e1010387833ae655a75d2..eac316a5ecda8e5a81d7054b0911b9c816939c48 100644 (file)
@@ -42,7 +42,6 @@ import org.collectionspace.services.common.authorityref.AuthorityRefList;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.loanout.LoansoutCommon;
 import org.collectionspace.services.person.PersonTermGroup;
-
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
@@ -166,7 +165,7 @@ public class LoanoutAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
         loanoutIdsCreated.add(newId);
     }
 
-    protected void createPersonRefs(){
+    protected void createPersonRefs() throws Exception{
 
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         // Create a temporary PersonAuthority resource, and its corresponding
@@ -206,7 +205,7 @@ public class LoanoutAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
         lendersContactRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
     }
     
-    protected String createPerson(String firstName, String surName, String shortId, String authRefName ) {
+    protected String createPerson(String firstName, String surName, String shortId, String authRefName ) throws Exception {
        String result = null;
        
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
@@ -323,9 +322,10 @@ public class LoanoutAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
      * 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.
+     * @throws Exception 
      */
     @AfterClass(alwaysRun=true)
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         String noTest = System.getProperty("noTestCleanup");
        if(Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
             if (logger.isDebugEnabled()) {
@@ -372,7 +372,7 @@ public class LoanoutAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
                String borrower,
                String borrowersContact,
                String lendersAuthorizer,
-               String lendersContact) {
+               String lendersContact) throws Exception {
        LoansoutCommon loanoutCommon = new LoansoutCommon();
        loanoutCommon.setLoanOutNumber(loanoutNumber);
        loanoutCommon.setLoanReturnDate(returnDate);
index d0779dbce4b82ea2ba57ba13c75b2e1ed826055e..7739b2016ec16c73f0e09ff186af7367e6d35d1c 100644 (file)
@@ -38,7 +38,6 @@ import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.loanout.LoanStatusGroup;
 import org.collectionspace.services.loanout.LoanStatusGroupList;
 import org.collectionspace.services.loanout.LoansoutCommon;
-
 import org.testng.Assert;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -63,12 +62,12 @@ public class LoanoutServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new LoanoutClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new LoanoutClient(clientPropertiesFilename);
        }
 
@@ -740,7 +739,7 @@ public class LoanoutServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
     }
 
     @Override
-    protected PoxPayloadOut createInstance(String identifier) {
+    protected PoxPayloadOut createInstance(String identifier) throws Exception {
        return createLoanoutInstance(identifier);
     }
     
@@ -749,8 +748,9 @@ public class LoanoutServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
      *
      * @param identifier the identifier
      * @return the multipart output
+     * @throws Exception 
      */
-    private PoxPayloadOut createLoanoutInstance(String identifier) {
+    private PoxPayloadOut createLoanoutInstance(String identifier) throws Exception {
         return createLoanoutInstance(
                 "loanoutNumber-" + identifier,
                 CURRENT_DATE_UTC);
@@ -762,9 +762,10 @@ public class LoanoutServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
      * @param loanOutNumber the loan out number
      * @param returnDate the return date
      * @return the multipart output
+     * @throws Exception 
      */
     private PoxPayloadOut createLoanoutInstance(String loanOutNumber,
-            String returnDate) {
+            String returnDate) throws Exception {
         LoansoutCommon loanoutCommon = new LoansoutCommon();
         loanoutCommon.setLoanOutNumber(loanOutNumber);
         loanoutCommon.setLoanReturnDate(returnDate);
@@ -808,7 +809,7 @@ public class LoanoutServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
 
        @Override
        protected PoxPayloadOut createInstance(String commonPartName,
-                       String identifier) {
+                       String identifier) throws Exception {
         PoxPayloadOut result = createLoanoutInstance(identifier);
         return result;
        }
index bb08ef00020168218a00ff9698717d8d79a146a7..2b2f35c86f2a5948d90ce97c39e453a501e155cb 100644 (file)
@@ -46,11 +46,11 @@ public class LocationAuthorityClient extends AuthorityClientImpl<Locationauthori
     //
     // Constructors
     //
-    public LocationAuthorityClient() {
+    public LocationAuthorityClient() throws Exception {
        super();
     }
     
-    public LocationAuthorityClient(String clientPropertiesFilename) {
+    public LocationAuthorityClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
index 53afd1721535e72b9c64a10d229e7c78be963017..1e65e3f418c58bb507572648fd298403407dc0b2 100644 (file)
@@ -30,7 +30,6 @@ import java.util.Map;
 import javax.ws.rs.core.Response;
 
 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;
@@ -39,11 +38,11 @@ import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.client.LocationAuthorityClient;
 import org.collectionspace.services.client.LocationAuthorityClientUtils;
 import org.collectionspace.services.common.api.GregorianCalendarDateTimeUtils;
-import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.location.LocTermGroup;
 import org.collectionspace.services.location.LocTermGroupList;
 import org.collectionspace.services.location.LocationauthoritiesCommon;
 import org.collectionspace.services.location.LocationsCommon;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
@@ -105,12 +104,12 @@ public class LocationAuthorityServiceTest extends AbstractAuthorityServiceTest<L
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
        return new LocationAuthorityClient();
     }
     
     @Override
-    protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+    protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
        return new LocationAuthorityClient(clientPropertiesFilename);
     }
     
@@ -255,10 +254,11 @@ public class LocationAuthorityServiceTest extends AbstractAuthorityServiceTest<L
      * 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.
+     * @throws Exception 
      */
 
     @AfterClass(alwaysRun=true)
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         String noTest = System.getProperty("noTestCleanup");
        if(Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
             if (logger.isDebugEnabled()) {
index 75cae9f9d7833a20d9d77bab91ac8f189f4209f1..aa48b0423b2ab881b5822017dbf9d8af2fb160fa 100644 (file)
@@ -44,11 +44,11 @@ public class MaterialAuthorityClient extends AuthorityClientImpl<Materialauthori
     //
     // Constructors
     //
-    public MaterialAuthorityClient() {
+    public MaterialAuthorityClient() throws Exception {
        super();
     }
     
-    public MaterialAuthorityClient(String clientPropertiesFilename) {
+    public MaterialAuthorityClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
     
index 5ebca491a32955d06744d71d240394ba2d5d3c9f..a41ad978bd06bba486c3eb85787cfae5a983e024 100644 (file)
@@ -43,7 +43,6 @@ import org.collectionspace.services.material.MaterialTermGroup;
 import org.collectionspace.services.material.MaterialTermGroupList;
 import org.collectionspace.services.material.MaterialauthoritiesCommon;
 import org.collectionspace.services.material.MaterialsCommon;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
@@ -93,12 +92,12 @@ public class MaterialAuthorityServiceTest extends AbstractAuthorityServiceTest<M
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new MaterialAuthorityClient();
     }
     
     @Override
-    protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+    protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new MaterialAuthorityClient(clientPropertiesFilename);
     }
 
@@ -241,40 +240,41 @@ public class MaterialAuthorityServiceTest extends AbstractAuthorityServiceTest<M
      * 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.
+     * @throws Exception 
      */
 
     @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 ...");
-        }
-        String parentResourceId;
-        String itemResourceId;
-        // Clean up contact resources.
-        MaterialAuthorityClient client = new MaterialAuthorityClient();
-        parentResourceId = knownResourceId;
-        // Clean up item resources.
-        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.
-            client.deleteItem(parentResourceId, itemResourceId).close();
-        }
-        // Clean up parent resources.
-        for (String resourceId : allResourceIdsCreated) {
-            // Note: Any non-success responses from the delete operation
-            // below are ignored and not reported.
-        client.delete(resourceId).close();
-        }
-    }
+       public void cleanUp() throws Exception {
+               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 ...");
+               }
+               String parentResourceId;
+               String itemResourceId;
+               // Clean up contact resources.
+               MaterialAuthorityClient client = new MaterialAuthorityClient();
+               parentResourceId = knownResourceId;
+               // Clean up item resources.
+               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.
+                       client.deleteItem(parentResourceId, itemResourceId).close();
+               }
+               // Clean up parent resources.
+               for (String resourceId : allResourceIdsCreated) {
+                       // Note: Any non-success responses from the delete operation
+                       // below are ignored and not reported.
+                       client.delete(resourceId).close();
+               }
+       }
 
     // ---------------------------------------------------------------
     // Utility methods used by tests above
index f0def69904fe70f593995b4da5f9f3eedfa36035..632cf2d704b20ec2db6ebf66435eb42e85089d36 100644 (file)
@@ -17,6 +17,7 @@
 package org.collectionspace.services.client;
 
 import javax.ws.rs.core.Response;
+
 import org.collectionspace.services.media.MediaCommon;
 import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataOutput;
 
@@ -33,11 +34,11 @@ public class MediaClient extends AbstractCommonListPoxServiceClientImpl<MediaPro
        public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
        public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME;
        
-       public MediaClient() {
+       public MediaClient() throws Exception {
                super();
        }
 
-       public MediaClient(String clientPropertiesFilename) {
+       public MediaClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
index 47d00854cb84c6f0db6948a9616d1ed042933d3c..86151b5c442465c28edc53156df8d42087b25cd5 100644 (file)
@@ -41,7 +41,6 @@ import org.collectionspace.services.common.authorityref.AuthorityRefList;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.media.MediaCommon;
 import org.collectionspace.services.person.PersonTermGroup;
-
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
@@ -89,7 +88,7 @@ public class MediaAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
         throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
 
-    private PoxPayloadOut createMediaInstance(String depositorRefName, String title) {
+    private PoxPayloadOut createMediaInstance(String depositorRefName, String title) throws Exception {
         this.title = title;
         this.depositorRefName = depositorRefName;
         MediaCommon media = new MediaCommon();
@@ -124,7 +123,7 @@ public class MediaAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
         }
     }
 
-    protected void createPersonRefs() {
+    protected void createPersonRefs() throws Exception {
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         // Create a temporary PersonAuthority resource, and its corresponding refName by which it can be identified.
         PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
@@ -151,7 +150,7 @@ public class MediaAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
         depositorRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
     }
 
-    protected String createPerson(String firstName, String surName, String shortId, String authRefName) {
+    protected String createPerson(String firstName, String surName, String shortId, String authRefName) throws Exception {
        String result = null;
        
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
@@ -246,9 +245,10 @@ public class MediaAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
      * 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.
+     * @throws Exception 
      */
     @AfterClass(alwaysRun = true)
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         String noTest = System.getProperty("noTestCleanup");
         if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
             logger.debug("Skipping Cleanup phase ...");
index 3986cc09a28808acfa3ce1be24e4f16d0d4a019d..adddada32f4dc5f10a4414e7069d20676277becf 100644 (file)
@@ -37,7 +37,6 @@ import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.media.LanguageList;
 import org.collectionspace.services.media.MediaCommon;
 import org.collectionspace.services.media.SubjectList;
-
 import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataOutput;
 import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
 import org.testng.Assert;
@@ -89,12 +88,12 @@ public class MediaServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonL
        }
     
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new MediaClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new MediaClient(clientPropertiesFilename);
        }
 
@@ -246,14 +245,14 @@ public class MediaServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonL
     // ---------------------------------------------------------------
 
     @Override
-    protected PoxPayloadOut createInstance(String identifier) {
+    protected PoxPayloadOut createInstance(String identifier) throws Exception {
        return createMediaInstance(identifier);
     }
     
     // ---------------------------------------------------------------
     // Utility methods used by tests above
     // ---------------------------------------------------------------
-    private PoxPayloadOut createMediaInstance(String title) {
+    private PoxPayloadOut createMediaInstance(String title) throws Exception {
         String identifier = "media.title-" + title;
         MediaCommon media = new MediaCommon();
         media.setTitle(identifier);
@@ -284,7 +283,7 @@ public class MediaServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonL
 
        @Override
        protected PoxPayloadOut createInstance(String commonPartName,
-                       String identifier) {
+                       String identifier) throws Exception {
                return createMediaInstance(identifier);
        }
 
index 9f2c18a6c0c8e7e784648b5d017fa699af5613f4..0cc2fa0092f230320dd0b3cd72858c936776d275 100644 (file)
@@ -26,7 +26,6 @@ package org.collectionspace.services.media;
 import org.collectionspace.services.blob.BlobResource;
 import org.collectionspace.services.client.BlobClient;
 import org.collectionspace.services.client.CollectionSpaceClientUtils;
-import org.collectionspace.services.client.IQueryManager;
 import org.collectionspace.services.client.MediaClient;
 import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadIn;
@@ -38,6 +37,7 @@ import org.collectionspace.services.common.blob.BlobInput;
 import org.collectionspace.services.common.blob.BlobUtil;
 import org.collectionspace.services.common.context.ServiceContext;
 import org.collectionspace.services.nuxeo.client.java.CommonList;
+
 import org.jboss.resteasy.util.HttpResponseCodes;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -61,8 +61,22 @@ import javax.ws.rs.core.UriInfo;
 @Consumes("application/xml")
 @Produces("application/xml")
 public class MediaResource extends NuxeoBasedResource {
-    final Logger logger = LoggerFactory.getLogger(MediaResource.class);
-    final static MediaClient mediaClient = new MediaClient();
+    final static Logger logger = LoggerFactory.getLogger(MediaResource.class);
+    final static MediaClient mediaClient = createMediaClient();
+    
+    private static MediaClient createMediaClient() {
+       MediaClient result = null;
+       
+       try {
+                       result = new MediaClient();
+               } catch (Exception e) {
+                       String errMsg = "Could not create a new media client for the Media resource.";
+                       logger.error(errMsg, e);
+                       throw new RuntimeException();
+               }
+       
+       return result;
+    }
 
     @Override
     public String getServiceName(){
index d3a8dabbbfc4743036e8e9552d9b09ac15427736..116d94d58118160788ac4a75bba7bb84e2fcf95f 100644 (file)
@@ -29,12 +29,16 @@ import org.collectionspace.services.movement.MovementsCommon;
  *
  */
 public class MovementClient extends AbstractCommonListPoxServiceClientImpl<MovementProxy, MovementsCommon> {
-    public static final String SERVICE_NAME = "movements";
+       public static final String SERVICE_NAME = "movements";
        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;
 
+    public MovementClient() throws Exception {
+               super();
+       }
+
     @Override
     public String getServiceName() {
         return SERVICE_NAME;
index 5eb255909d2dce87fa85921f1a6fc0ce70b20a8a..0ab86d94068436fa87df45282ba3d538115d377e 100644 (file)
@@ -44,7 +44,6 @@ import org.collectionspace.services.common.authorityref.AuthorityRefList;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.movement.MovementsCommon;
 import org.collectionspace.services.person.PersonTermGroup;
-
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
@@ -155,7 +154,7 @@ public class MovementAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
         movementIdsCreated.add(newId);
     }
 
-    protected void createPersonRefs(){
+    protected void createPersonRefs() throws Exception{
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         // Create a temporary PersonAuthority resource, and its corresponding
         // refName by which it can be identified.
@@ -182,7 +181,7 @@ public class MovementAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
         movementContactRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
     }
     
-    protected String createPerson(String firstName, String surName, String shortId, String authRefName ) {
+    protected String createPerson(String firstName, String surName, String shortId, String authRefName ) throws Exception {
        String result = null;
        
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
@@ -297,9 +296,10 @@ public class MovementAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
      * 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.
+     * @throws Exception 
      */
     @AfterClass(alwaysRun=true)
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         String noTest = System.getProperty("noTestCleanup");
        if(Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
             if (logger.isDebugEnabled()) {
@@ -345,7 +345,7 @@ public class MovementAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
 
    private PoxPayloadOut createMovementInstance(String movementReferenceNumber,
             String locationDate,
-            String movementContact) {
+            String movementContact) throws Exception {
         MovementsCommon movementCommon = new MovementsCommon();
         movementCommon.setMovementReferenceNumber(movementReferenceNumber);
         movementCommon.setLocationDate(locationDate);
index 8f48f2fa19f8b1ee309bbf1d415659aeb5de6d28..7d41dd3252633b3d1df076a2f039a00e11a69656 100644 (file)
@@ -32,7 +32,6 @@ import org.collectionspace.services.movement.MovementsCommon;
 import org.collectionspace.services.movement.MovementMethodsList;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.api.GregorianCalendarDateTimeUtils;
-
 import org.testng.Assert;
 import org.testng.annotations.Test;
 import org.slf4j.Logger;
@@ -65,7 +64,7 @@ public class MovementServiceTest extends
         * ()
         */
        @Override
-       protected CollectionSpaceClient getClientInstance() {
+       protected CollectionSpaceClient getClientInstance() throws Exception {
                return new MovementClient();
        }
 
@@ -95,14 +94,15 @@ public class MovementServiceTest extends
         * @param identifier
         *            the identifier
         * @return the multipart output
+        * @throws Exception 
         */
-       private PoxPayloadOut createMovementInstance(String identifier) {
+       private PoxPayloadOut createMovementInstance(String identifier) throws Exception {
                return createInstance("movementReferenceNumber-" + identifier);
        }
 
        @Override
        protected PoxPayloadOut createInstance(String commonPartName,
-                       String identifier) {
+                       String identifier) throws Exception {
                PoxPayloadOut result = createMovementInstance(identifier);
                return result;
        }
@@ -114,9 +114,10 @@ public class MovementServiceTest extends
         *            A movement reference number.
         * @return Multipart output suitable for use as a payload in a create or
         *         update request.
+        * @throws Exception 
         */
        @Override
-       protected PoxPayloadOut createInstance(String movementReferenceNumber) {
+       protected PoxPayloadOut createInstance(String movementReferenceNumber) throws Exception {
                MovementsCommon movementCommon = new MovementsCommon();
                // FIXME: Values of currentLocation, normalLocation,
                // and movementContact should be refNames.
index 0ce3a876e39348b2886119abe33cc200ed95598d..c11d5f4847a503bc6b551ce02b4d092d30954710 100644 (file)
@@ -40,7 +40,6 @@ import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.movement.MovementsCommon;
 import org.collectionspace.services.jaxb.AbstractCommonList;
-
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.DataProvider;
@@ -498,9 +497,10 @@ public class MovementSortByTest extends BaseServiceTest<AbstractCommonList> {
      * 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.
+     * @throws Exception 
      */
     @AfterClass(alwaysRun = true)
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         String noTest = System.getProperty("noTestCleanup");
         if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
             if (logger.isDebugEnabled()) {
@@ -653,7 +653,7 @@ public class MovementSortByTest extends BaseServiceTest<AbstractCommonList> {
     private PoxPayloadOut createMovementInstance(
             String movementReferenceNumber,
             String movementNote,
-            String locationDate) {
+            String locationDate) throws Exception {
         MovementsCommon movementCommon = new MovementsCommon();
         movementCommon.setMovementReferenceNumber(movementReferenceNumber);
         movementCommon.setMovementNote(movementNote);
index acd23cc49d27591f42d91ba92778681a0f1538b3..59d28e1ffd2e4068b33017dbbf8a9c9245879cdd 100644 (file)
@@ -33,11 +33,11 @@ public class ObjectExitClient extends AbstractCommonListPoxServiceClientImpl<Obj
     public static final String SERVICE_PATH_PROXY = SERVICE_PATH + "/";        
     public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME;
 
-    public ObjectExitClient() {
+    public ObjectExitClient() throws Exception {
                super();
        }
 
-    public ObjectExitClient(String clientPropertiesFilename) {
+    public ObjectExitClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
index 289370faec3257a05a6a02a602dbe595c752257e..ed4e8c4e4f85d8c1cef899ff7e4faf695800cff1 100644 (file)
@@ -43,7 +43,6 @@ import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.objectexit.StructuredDateGroup;
 import org.collectionspace.services.objectexit.ObjectexitCommon;
 import org.collectionspace.services.person.PersonTermGroup;
-
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
@@ -94,7 +93,7 @@ public class ObjectExitAuthRefsTest extends BaseServiceTest<AbstractCommonList>
         throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
 
-    private PoxPayloadOut createObjectExitInstance(String depositorRefName, String exitNumber, String exitDateDisplayDate) {
+    private PoxPayloadOut createObjectExitInstance(String depositorRefName, String exitNumber, String exitDateDisplayDate) throws Exception {
         this.exitNumber = exitNumber;
         this.depositorRefName = depositorRefName;
         this.exitDateGroup.setDateDisplayDate(exitDateDisplayDate);
@@ -143,7 +142,7 @@ public class ObjectExitAuthRefsTest extends BaseServiceTest<AbstractCommonList>
                objectexitIdsCreated.add(newId);// Store the IDs from every resource created; delete on cleanup
     }
 
-    protected void createPersonRefs() {
+    protected void createPersonRefs() throws Exception {
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         // Create a temporary PersonAuthority resource, and its corresponding refName by which it can be identified.
         PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
@@ -170,7 +169,7 @@ public class ObjectExitAuthRefsTest extends BaseServiceTest<AbstractCommonList>
         depositorRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
     }
 
-    protected String createPerson(String firstName, String surName, String shortId, String authRefName) {
+    protected String createPerson(String firstName, String surName, String shortId, String authRefName) throws Exception {
        String result = null;
        
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
@@ -258,9 +257,10 @@ public class ObjectExitAuthRefsTest extends BaseServiceTest<AbstractCommonList>
      * 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.
+     * @throws Exception 
      */
     @AfterClass(alwaysRun = true)
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         String noTest = System.getProperty("noTestCleanup");
         if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
             logger.debug("Skipping Cleanup phase ...");
index 824163f0673329d347515a98cd3e62d9e3a78255..11c2cf8084b10744eac723349f7655690ceff997 100644 (file)
@@ -31,7 +31,6 @@ import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.objectexit.ObjectexitCommon;
-
 import org.testng.Assert;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -58,12 +57,12 @@ public class ObjectExitServiceTest extends AbstractPoxServiceTestImpl<AbstractCo
        }
     
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new ObjectExitClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new ObjectExitClient(clientPropertiesFilename);
        }
 
@@ -77,12 +76,12 @@ public class ObjectExitServiceTest extends AbstractPoxServiceTestImpl<AbstractCo
     // ---------------------------------------------------------------
     
     @Override
-    protected PoxPayloadOut createInstance(String identifier) {
+    protected PoxPayloadOut createInstance(String identifier) throws Exception {
        ObjectExitClient client = new ObjectExitClient();
        return createObjectExitInstance(identifier);
     }
     
-    private PoxPayloadOut createObjectExitInstance(String exitNumber) {
+    private PoxPayloadOut createObjectExitInstance(String exitNumber) throws Exception {
         String identifier = "objectexitNumber-" + exitNumber;
         ObjectexitCommon objectexit = new ObjectexitCommon();
         objectexit.setExitNumber(identifier);
@@ -106,7 +105,7 @@ public class ObjectExitServiceTest extends AbstractPoxServiceTestImpl<AbstractCo
 
        @Override
        protected PoxPayloadOut createInstance(String commonPartName,
-                       String identifier) {
+                       String identifier) throws Exception {
         PoxPayloadOut result = createObjectExitInstance(createIdentifier());
                return result;
        }
index 5898a026bfa1a41596a450ca2947680a804b2e81..ddc46ba4b9ccbf2468b2d3dbf7c4aa0c24e52386 100644 (file)
@@ -53,11 +53,11 @@ public class OrgAuthorityClient extends AuthorityWithContactsClientImpl<Orgautho
     //
     // Constructors
     //
-    public OrgAuthorityClient() {
+    public OrgAuthorityClient() throws Exception {
        super();
     }
     
-    public OrgAuthorityClient(String clientPropertiesFilename) {
+    public OrgAuthorityClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
     
index ba52d76fdfe6fa9688c7064b033854d1aa596806..09f6f56d7ad50fa7bd234131dbb9a98c325d17d2 100644 (file)
@@ -21,9 +21,11 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
+
 import org.collectionspace.services.OrganizationJAXBSchema;
 import org.collectionspace.services.client.test.ServiceRequestType;
 import org.collectionspace.services.common.api.Tools;
@@ -38,7 +40,6 @@ import org.collectionspace.services.organization.OrgTermGroupList;
 import org.jboss.resteasy.client.ClientResponse;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import org.collectionspace.services.organization.StructuredDateGroup;
 
 /**
@@ -55,8 +56,9 @@ public class OrgAuthorityClientUtils {
      * @param csid the id of the OrgAuthority
      * @param client if null, creates a new client
      * @return
+     * @throws Exception 
      */
-    public static String getAuthorityRefName(String csid, OrgAuthorityClient client){
+    public static String getAuthorityRefName(String csid, OrgAuthorityClient client) throws Exception{
        if (client==null) {
                client = new OrgAuthorityClient();
        }
@@ -90,8 +92,9 @@ public class OrgAuthorityClientUtils {
      * @param csid the ID of the Organization
      * @param client if null, creates a new client
      * @return
+     * @throws Exception 
      */
-    public static String getOrgRefName(String inAuthority, String csid, OrgAuthorityClient client){
+    public static String getOrgRefName(String inAuthority, String csid, OrgAuthorityClient client) throws Exception{
        if (client == null) {
                client = new OrgAuthorityClient();
        }
index d6f06905b98d62f8f560ce68887b04a2619d651f..fe98e8d1dc78033fb3ef457377a23d1aed9b50a9 100644 (file)
@@ -43,7 +43,6 @@ import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.organization.OrganizationsCommon;
 import org.collectionspace.services.organization.OrgTermGroup;
 import org.collectionspace.services.person.PersonTermGroup;
-
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
@@ -210,8 +209,9 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest<AbstractCommonList
     
     /**
      * Creates the person refs.
+     * @throws Exception 
      */
-    protected void createPersonRefs() {
+    protected void createPersonRefs() throws Exception {
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         // Create a temporary PersonAuthority resource, and its corresponding
         // refName by which it can be identified.
@@ -252,8 +252,9 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest<AbstractCommonList
      * @param shortId
      * @param authRefName
      * @return the string
+     * @throws Exception 
      */
-    protected String createPerson(String personAuthCSID, String firstName, String surName, String shortId, String authRefName ) {
+    protected String createPerson(String personAuthCSID, String firstName, String surName, String shortId, String authRefName ) throws Exception {
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         Map<String, String> personInfo = new HashMap<String,String>();
         personInfo.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId);
@@ -376,9 +377,10 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest<AbstractCommonList
      * 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.
+     * @throws Exception 
      */
     @AfterClass(alwaysRun=true)
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         String noTest = System.getProperty("noTestCleanup");
        if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
             if (logger.isDebugEnabled()) {
index ea850f6882f3a034fedfa3a716d92c8312eb0886..287378632ece3228852bd4bcd29ce62ce1550d48 100644 (file)
@@ -49,7 +49,6 @@ import org.collectionspace.services.organization.OrgauthoritiesCommon;
 import org.collectionspace.services.organization.OrganizationsCommon;
 import org.collectionspace.services.organization.OrgTermGroup;
 import org.collectionspace.services.organization.OrgTermGroupList;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
@@ -113,17 +112,17 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new OrgAuthorityClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new OrgAuthorityClient(clientPropertiesFilename);
        }
 
     @Override
-    protected PoxPayloadOut createInstance(String identifier) {
+    protected PoxPayloadOut createInstance(String identifier) throws Exception {
         OrgAuthorityClient client = new OrgAuthorityClient();
         String displayName = "displayName-" + identifier;
         PoxPayloadOut multipart = OrgAuthorityClientUtils.createOrgAuthorityInstance(
@@ -132,7 +131,7 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
     }
 
     @Override
-    protected PoxPayloadOut createItemInstance(String parentCsid, String identifier) {
+    protected PoxPayloadOut createItemInstance(String parentCsid, String identifier) throws Exception {
         String headerLabel = new OrgAuthorityClient().getItemCommonPartName();
         
         String shortId = TEST_SHORTID + identifier;
@@ -212,10 +211,11 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
      * Creates the contact.
      *
      * @param testName the test name
+     * @throws Exception 
      */
     @Test(dataProvider = "testName", groups = {"create"},
                dependsOnMethods = {"createItem"})
-    public void createContact(String testName) {
+    public void createContact(String testName) throws Exception {
         setupCreate();
         String newID = createContactInItem(knownResourceId, knownItemResourceId);
     }
@@ -226,8 +226,9 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
      * @param parentcsid the parentcsid
      * @param itemcsid the itemcsid
      * @return the string
+     * @throws Exception 
      */
-    private String createContactInItem(String parentcsid, String itemcsid) {
+    private String createContactInItem(String parentcsid, String itemcsid) throws Exception {
 
         final String testName = "createContactInItem";
         if (logger.isDebugEnabled()) {
@@ -311,7 +312,7 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
         readInternal(testName, null, knownResourceShortIdentifer);
     }
 
-    protected void readInternal(String testName, String CSID, String shortId) {
+    protected void readInternal(String testName, String CSID, String shortId) throws Exception {
         // Perform setup.
         setupRead();
 
@@ -557,10 +558,11 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
      * Read contact non existent.
      *
      * @param testName the test name
+     * @throws Exception 
      */
     @Test(dataProvider = "testName", groups = {"readItem"},
                dependsOnMethods = {"readContact"})
-    public void readContactNonExistent(String testName) {
+    public void readContactNonExistent(String testName) throws Exception {
         // Perform setup.
         setupReadNonExistent();
 
@@ -587,20 +589,22 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
 
     /**
      * Read item list.
+     * @throws Exception 
      */
     @Override
 //     @Test(groups = {"readList"}, dependsOnMethods = {"readList"})
-    public void readItemList(String testName) {
+    public void readItemList(String testName) throws Exception {
         readItemList(knownAuthorityWithItems, null);
     }
 
     /**
      * Read item list by authority name.
+     * @throws Exception 
      */
     @Override
 //    @Test(dataProvider = "testName",
 //             dependsOnMethods = {"readItem"})
-    public void readItemListByName(String testName) {
+    public void readItemListByName(String testName) throws Exception {
         readItemList(null, READITEMS_SHORT_IDENTIFIER);
     }
 
@@ -609,8 +613,9 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
      *
      * @param vcsid the vcsid
      * @param name the name
+     * @throws Exception 
      */
-    private void readItemList(String vcsid, String name) {
+    private void readItemList(String vcsid, String name) throws Exception {
 
         final String testName = "readItemList";
         // Perform setup.
@@ -664,10 +669,11 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
 
     /**
      * Read contact list.
+     * @throws Exception 
      */
     @Test(groups = {"readList"},
                dependsOnMethods = {"org.collectionspace.services.client.test.AbstractAuthorityServiceTest.readItemList"})
-    public void readContactList() {
+    public void readContactList() throws Exception {
         readContactList(knownResourceId, knownItemResourceId);
     }
 
@@ -676,8 +682,9 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
      *
      * @param parentcsid the parentcsid
      * @param itemcsid the itemcsid
+     * @throws Exception 
      */
-    private void readContactList(String parentcsid, String itemcsid) {
+    private void readContactList(String parentcsid, String itemcsid) throws Exception {
         final String testName = "readContactList";
         // Perform setup.
         setupReadList();
@@ -870,10 +877,11 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
      * Delete non existent contact.
      *
      * @param testName the test name
+     * @throws Exception 
      */
     @Test(dataProvider = "testName", groups = {"delete"},
                dependsOnMethods = {"deleteContact"})
-    public void deleteNonExistentContact(String testName) {
+    public void deleteNonExistentContact(String testName) throws Exception {
         // Perform setup.
         setupDeleteNonExistent();
 
@@ -924,10 +932,11 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
      * 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.
+     * @throws Exception 
      */
     @AfterClass(alwaysRun = true)
     @Override
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         String noTest = System.getProperty("noTestCleanup");
         if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
             if (logger.isDebugEnabled()) {
index b16c5406c81c1ae881b11e12d61c5cea87b2da1e..482690fc6cd52bd70f79918b75616c503766944b 100644 (file)
@@ -46,11 +46,11 @@ public class PersonAuthorityClient extends AuthorityWithContactsClientImpl<Perso
     //
     // Constructors
     //
-    public PersonAuthorityClient() {
+    public PersonAuthorityClient() throws Exception {
        super();
     }
     
-    public PersonAuthorityClient(String clientPropertiesFilename) {
+    public PersonAuthorityClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
index cb9d6a388e48c7d6d76526d7afb5b140462fe3dd..f9b25752f7b127376c07256afe5e63b28acc3448 100644 (file)
@@ -44,7 +44,6 @@ import org.collectionspace.services.person.PersonsCommon;
 import org.collectionspace.services.person.PersonauthoritiesCommon;
 import org.collectionspace.services.person.SchoolOrStyleList;
 import org.collectionspace.services.person.StructuredDateGroup;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -63,8 +62,9 @@ public class PersonAuthorityClientUtils {
      * @param csid the id of the PersonAuthority
      * @param client if null, creates a new client
      * @return
+     * @throws Exception 
      */
-    public static String getAuthorityRefName(String csid, PersonAuthorityClient client){
+    public static String getAuthorityRefName(String csid, PersonAuthorityClient client) throws Exception{
        if (client == null) {
                client = new PersonAuthorityClient();
        }
@@ -97,8 +97,9 @@ public class PersonAuthorityClientUtils {
      * @param csid the id of the PersonAuthority
      * @param client if null, creates a new client
      * @return
+     * @throws Exception 
      */
-    public static String getPersonRefName(String inAuthority, String csid, PersonAuthorityClient client){
+    public static String getPersonRefName(String inAuthority, String csid, PersonAuthorityClient client) throws Exception{
        if ( client == null) {
                client = new PersonAuthorityClient();
        }
index b4bd638dab945a770f92d99a8036d73403107900..b010db4979256e66d6261b52bcb626fd3fb1d3be 100644 (file)
@@ -38,7 +38,6 @@ import org.collectionspace.services.client.PersonAuthorityClientUtils;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.person.PersonTermGroup;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
@@ -149,12 +148,12 @@ public class PersonAuthoritySearchTest extends BaseServiceTest<AbstractCommonLis
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
        return new PersonAuthorityClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
        return new PersonAuthorityClient(clientPropertiesFilename);
        }
 
@@ -228,9 +227,10 @@ public class PersonAuthoritySearchTest extends BaseServiceTest<AbstractCommonLis
 
     /**
      * Reads an item list by partial term.
+     * @throws Exception 
      */
     @Test(dataProvider="testName", groups = {"readListByPartialTerm"})
-    public void partialTermMatch(String testName) {
+    public void partialTermMatch(String testName) throws Exception {
         int numMatchesFound = 0;
         String partialTerm = getPartialTermCommon();
         if (logger.isDebugEnabled()) {
@@ -248,10 +248,11 @@ public class PersonAuthoritySearchTest extends BaseServiceTest<AbstractCommonLis
      * Reads an item list by partial term, with a partial term that consists
      * of an all-lowercase variation of the expected match, to test case-insensitive
      * matching.
+     * @throws Exception 
      */
     @Test(dataProvider="testName", groups = {"readListByPartialTerm"},
                dependsOnMethods = {"partialTermMatch"})
-    public void partialTermMatchCaseInsensitiveLowerCase(String testName) {
+    public void partialTermMatchCaseInsensitiveLowerCase(String testName) throws Exception {
         int numMatchesFound = 0;
 
         final String partialTerm = getPartialTermCommon().toLowerCase();
@@ -271,10 +272,11 @@ public class PersonAuthoritySearchTest extends BaseServiceTest<AbstractCommonLis
      * Reads an item list by partial term, with a partial term that consists
      * of an all-uppercase variation of the expected match, to test case-insensitive
      * matching.
+     * @throws Exception 
      */
     @Test(dataProvider="testName",
         groups = {"readListByPartialTerm"}, dependsOnMethods = {"partialTermMatch"})
-    public void partialTermMatchCaseInsensitiveUpperCase(String testName) {
+    public void partialTermMatchCaseInsensitiveUpperCase(String testName) throws Exception {
         int numMatchesFound = 0;
 
         final String partialTerm = getPartialTermCommon().toUpperCase();
@@ -293,10 +295,11 @@ public class PersonAuthoritySearchTest extends BaseServiceTest<AbstractCommonLis
     /**
      * 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.
+     * @throws Exception 
      */
     @Test(dataProvider="testName",
         groups = {"readListByPartialTerm"}, dependsOnMethods = {"partialTermMatch"})
-    public void partialTermMatchMinimumLength(String testName) {
+    public void partialTermMatchMinimumLength(String testName) throws Exception {
         int numMatchesFound = 0;
         String partialTerm = getPartialTermMinimumLength();
         if (logger.isDebugEnabled()) {
@@ -314,10 +317,11 @@ public class PersonAuthoritySearchTest extends BaseServiceTest<AbstractCommonLis
     /**
      * Reads an item list by partial term, with a partial term that contains
      * at least one Unicode UTF-8 character (outside the USASCII range).
+     * @throws Exception 
      */
     @Test(dataProvider="testName",
         groups = {"readListByPartialTerm"}, dependsOnMethods = {"partialTermMatch"})
-    public void partialTermMatchUTF8(String testName) {
+    public void partialTermMatchUTF8(String testName) throws Exception {
         int numMatchesFound = 0;
         String partialTerm = getPartialTermUtf8();
         String ptEncoded;
@@ -342,10 +346,11 @@ public class PersonAuthoritySearchTest extends BaseServiceTest<AbstractCommonLis
     /**
      * Reads an item list by partial term, with a partial term that contains
      * at least one Unicode UTF-8 character (outside the USASCII range).
+     * @throws Exception 
      */
     @Test(dataProvider="testName",
         groups = {"readListByPartialTerm"}, dependsOnMethods = {"partialTermMatch"})
-    public void partialTermMatchQuote(String testName) {
+    public void partialTermMatchQuote(String testName) throws Exception {
         int numMatchesFound = 0;
         String partialTerm = getPartialTermQuote();
         if (logger.isDebugEnabled()) {
@@ -362,9 +367,10 @@ public class PersonAuthoritySearchTest extends BaseServiceTest<AbstractCommonLis
 
     /**
      * Finds terms by keywords.
+     * @throws Exception 
      */
     @Test(dataProvider="testName", groups = {"readListByKwdTerm"})
-    public void keywordTermMatch(String testName) {
+    public void keywordTermMatch(String testName) throws Exception {
         int numMatchesFound = 0;
         String kwdTerm = getKwdTerm();
         if (logger.isDebugEnabled()) {
@@ -380,10 +386,11 @@ public class PersonAuthoritySearchTest extends BaseServiceTest<AbstractCommonLis
 
     /**
      * Finds terms by keywords.
+     * @throws Exception 
      */
     @Test(dataProvider="testName",
         groups = {"readListByKwdTerm"}, dependsOnMethods = {"keywordTermMatch"})
-    public void keywordTermMatchUTF8(String testName) {
+    public void keywordTermMatchUTF8(String testName) throws Exception {
         int numMatchesFound = 0;
         String kwdTerm = getKwdTermUTF8();
         if (logger.isDebugEnabled()) {
@@ -404,10 +411,11 @@ public class PersonAuthoritySearchTest extends BaseServiceTest<AbstractCommonLis
     /**
      * Reads an item list by partial term, with a partial term that is not
      * expected to be matched by any term in any resource.
+     * @throws Exception 
      */
     @Test(dataProvider="testName",
         groups = {"readListByPartialTerm"}, dependsOnMethods = {"partialTermMatch"})
-    public void partialTermMatchOnNonexistentTerm(String testName) {
+    public void partialTermMatchOnNonexistentTerm(String testName) throws Exception {
         int numMatchesFound = 0;
         int ZERO_MATCHES_EXPECTED = 0;
         String partialTerm = getPartialTermNonExistent();
@@ -426,10 +434,11 @@ public class PersonAuthoritySearchTest extends BaseServiceTest<AbstractCommonLis
     /**
      * Reads an item list by partial term, with a partial term that is not
      * expected to be matched by any term in any resource.
+     * @throws Exception 
      */
     @Test(dataProvider="testName", groups = {"readListByKwdTerm"},
                dependsOnMethods = {"keywordTermMatch"})
-    public void keywordTermMatchOnNonexistentTerm(String testName) {
+    public void keywordTermMatchOnNonexistentTerm(String testName) throws Exception {
         int numMatchesFound = 0;
         int ZERO_MATCHES_EXPECTED = 0;
         String kwdTerm = getKwdTermNonExistent();
@@ -456,9 +465,10 @@ public class PersonAuthoritySearchTest extends BaseServiceTest<AbstractCommonLis
      * @param partialTerm A partial term to match item resources.
      * @param partialTerm A keyword list to match item resources.
      * @return The number of item resources matched by the partial term.
+     * @throws Exception 
      */
     private int readItemListWithFilters(String testName, 
-               String authorityCsid, String partialTerm, String keywords) {
+               String authorityCsid, String partialTerm, String keywords) throws Exception {
 
         // Perform setup.
         int expectedStatusCode = Response.Status.OK.getStatusCode();
@@ -500,9 +510,10 @@ public class PersonAuthoritySearchTest extends BaseServiceTest<AbstractCommonLis
      * 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.
+     * @throws Exception 
      */
     @AfterClass(alwaysRun=true)
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         String noTest = System.getProperty("noTestCleanup");
        if(Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
             if (logger.isDebugEnabled()) {
index 274d41c264d2906e29949f3892fafb4d851ec434..15200e89aa2b3c03c8b54269b4c202be4201279b 100644 (file)
@@ -36,7 +36,6 @@ import org.collectionspace.services.client.PersonAuthorityClientUtils;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.person.PersonTermGroup;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
@@ -107,12 +106,12 @@ public class PersonAuthorityServicePerfTest extends BaseServiceTest<AbstractComm
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
        return new PersonAuthorityClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
        return new PersonAuthorityClient(clientPropertiesFilename);
        }
 
@@ -267,9 +266,10 @@ public class PersonAuthorityServicePerfTest extends BaseServiceTest<AbstractComm
     
     /**
      * Reads an item list by partial term.
+     * @throws Exception 
      */
     @Test(dataProvider="testName")
-    public void partialTermMatch(String testName) {
+    public void partialTermMatch(String testName) throws Exception {
         for(int i=0; i<partialTerms.length; i++) {
                long startTime = System.currentTimeMillis();
             int numMatchesFound = readItemListWithFilters(testName, authId, 
@@ -297,9 +297,10 @@ public class PersonAuthorityServicePerfTest extends BaseServiceTest<AbstractComm
      * @param partialTerm A partial term to match item resources.
      * @param partialTerm A keyword list to match item resources.
      * @return The number of item resources matched by the partial term.
+     * @throws Exception 
      */
     private int readItemListWithFilters(String testName, 
-               String authorityCsid, String partialTerm, String keywords) {
+               String authorityCsid, String partialTerm, String keywords) throws Exception {
 
         // Perform setup.
         int expectedStatusCode = Response.Status.OK.getStatusCode();
@@ -337,9 +338,10 @@ public class PersonAuthorityServicePerfTest extends BaseServiceTest<AbstractComm
      * 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.
+     * @throws Exception 
      */
     @AfterClass(alwaysRun=true)
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         String noTest = System.getProperty("noTestCleanup");
        if(Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
             if (logger.isDebugEnabled()) {
index bf67f0eb880d38716184a592f95bbc24f7d73558..185291047f1cd9b926133be96f9d185a924206e5 100644 (file)
@@ -128,12 +128,12 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new PersonAuthorityClient();
     }
     
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new PersonAuthorityClient(clientPropertiesFilename);
        }
 
@@ -187,7 +187,7 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
     }
 
     @Override
-    protected PoxPayloadOut createInstance(String identifier) {
+    protected PoxPayloadOut createInstance(String identifier) throws Exception {
         PersonAuthorityClient client = new PersonAuthorityClient();
         
         String displayName = "displayName-" + identifier;
@@ -198,7 +198,7 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
     }
 
     @Override
-    protected PoxPayloadOut createItemInstance(String parentCsid, String identifier) {
+    protected PoxPayloadOut createItemInstance(String parentCsid, String identifier) throws Exception {
         String headerLabel = new PersonAuthorityClient().getItemCommonPartName();
         
         HashMap<String, String> personInfo = new HashMap<String, String>();
@@ -236,9 +236,10 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
      * @param vcsid the vcsid
      * @param authRefName the auth ref name
      * @return the string
+     * @throws Exception 
      */
     @Override
-    protected String createItemInAuthority(AuthorityClient client, String vcsid, String shortId) {
+    protected String createItemInAuthority(AuthorityClient client, String vcsid, String shortId) throws Exception {
 
         final String testName = "createItemInAuthority";
         if (logger.isDebugEnabled()) {
@@ -287,9 +288,10 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
      * @param itemFieldProperties a set of properties specifying the values of fields.
      * @param itemRepeatableFieldProperties a set of properties specifying the values of repeatable fields.
      * @return the string
+     * @throws Exception 
      */
     private String createItemInAuthority(AuthorityClient client, String vcsid, String authRefName, String shortId,
-            Map<String, String> itemFieldProperties, List<PersonTermGroup> terms, Map<String, List<String>> itemRepeatableFieldProperties) {
+            Map<String, String> itemFieldProperties, List<PersonTermGroup> terms, Map<String, List<String>> itemRepeatableFieldProperties) throws Exception {
 
         final String testName = "createItemInAuthority";
         if (logger.isDebugEnabled()) {
@@ -356,10 +358,10 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
      * Creates the contact.
      *
      * @param testName the test name
+     * @throws Exception 
      */
-    @Test(dataProvider = "testName", groups = {"create"},
-               dependsOnMethods = {"createItem"})
-    public void createContact(String testName) {
+    @Test(dataProvider = "testName", groups = {"create"}, dependsOnMethods = {"createItem"})
+    public void createContact(String testName) throws Exception {
         setupCreate();
         createContactInItem(knownResourceId, knownItemResourceId);
     }
@@ -370,8 +372,9 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
      * @param parentcsid the parentcsid
      * @param itemcsid the itemcsid
      * @return the string
+     * @throws Exception 
      */
-    private String createContactInItem(String parentcsid, String itemcsid) {
+    private String createContactInItem(String parentcsid, String itemcsid) throws Exception {
 
         final String testName = "createContactInItem";
         if (logger.isDebugEnabled()) {
@@ -450,10 +453,11 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
      * non-word characters.
      *
      * @param testName the test name
+     * @throws Exception 
      */
     @Test(dataProvider = "testName", groups = {"create", "nonWordCharsInShortId"},
                dependsOnMethods = {"org.collectionspace.services.client.test.AbstractServiceTestImpl.create"})
-    public void createItemWithShortIdNonWordChars(String testName) {
+    public void createItemWithShortIdNonWordChars(String testName) throws Exception {
         testExpectedStatusCode = STATUS_BAD_REQUEST;
         testRequestType = ServiceRequestType.CREATE;
         testSetup(testExpectedStatusCode, testRequestType);
@@ -548,7 +552,7 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
         readInternal(testName, null, knownResourceShortIdentifer);
     }
 
-    protected void readInternal(String testName, String CSID, String shortId) {
+    protected void readInternal(String testName, String CSID, String shortId) throws Exception {
         // Submit the request to the service and store the response.
         PersonAuthorityClient client = new PersonAuthorityClient();
         Response res = null;
@@ -776,9 +780,10 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
      * Read contact non existent.
      *
      * @param testName the test name
+     * @throws Exception 
      */
     @Test(dataProvider = "testName", groups = {"readItem"}, dependsOnMethods = {"readContact"})
-    public void readContactNonExistent(String testName) {
+    public void readContactNonExistent(String testName) throws Exception {
         // Perform setup.
         setupReadNonExistent();
 
@@ -801,10 +806,11 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
 
     /**
      * Read contact list.
+     * @throws Exception 
      */
     @Test(groups = {"readList"},
                dependsOnMethods = {"org.collectionspace.services.client.test.AbstractAuthorityServiceTest.readItemList"})
-    public void readContactList() {
+    public void readContactList() throws Exception {
         readContactList(knownResourceId, knownItemResourceId);
     }
 
@@ -813,8 +819,9 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
      *
      * @param parentcsid the parentcsid
      * @param itemcsid the itemcsid
+     * @throws Exception 
      */
-    private void readContactList(String parentcsid, String itemcsid) {
+    private void readContactList(String parentcsid, String itemcsid) throws Exception {
         final String testName = "readContactList";
 
         // Perform setup.
@@ -1162,10 +1169,11 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
      * Delete non existent contact.
      *
      * @param testName the test name
+     * @throws Exception 
      */
     @Test(dataProvider = "testName", groups = {"delete"},
                dependsOnMethods = {"deleteContact"})
-    public void deleteNonExistentContact(String testName) {
+    public void deleteNonExistentContact(String testName) throws Exception {
         // Submit the request to the service and store the response.
         PersonAuthorityClient client = new PersonAuthorityClient();
         setupDeleteNonExistent();
@@ -1215,10 +1223,11 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
      * 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.
+     * @throws Exception 
      */
     @AfterClass(alwaysRun = true)
     @Override
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         String noTest = System.getProperty("noTestCleanup");
         if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
             if (logger.isDebugEnabled()) {
index 512cc54c0a589ed40cf3af16a5f8fd4f6daa6161..d1eaaefaa9b63888ed11c37c95dfe4af22964885 100644 (file)
@@ -44,11 +44,11 @@ public class PlaceAuthorityClient extends AuthorityClientImpl<PlaceauthoritiesCo
     //
     // Constructors
     //
-    public PlaceAuthorityClient() {
+    public PlaceAuthorityClient() throws Exception {
        super();
     }
     
-    public PlaceAuthorityClient(String clientPropertiesFilename) {
+    public PlaceAuthorityClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
     
index aeca7f95f4aeaf0d5634db8ac12bb0f6100c8b13..676d64cfab3f92b88de89148d6ee3695079e4c8d 100644 (file)
@@ -43,7 +43,6 @@ import org.collectionspace.services.place.PlaceTermGroup;
 import org.collectionspace.services.place.PlaceTermGroupList;
 import org.collectionspace.services.place.PlaceauthoritiesCommon;
 import org.collectionspace.services.place.PlacesCommon;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
@@ -102,12 +101,12 @@ public class PlaceAuthorityServiceTest extends AbstractAuthorityServiceTest<Plac
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new PlaceAuthorityClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new PlaceAuthorityClient(clientPropertiesFilename);
        }
        
@@ -249,10 +248,11 @@ public class PlaceAuthorityServiceTest extends AbstractAuthorityServiceTest<Plac
      * 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.
+     * @throws Exception 
      */
 
     @AfterClass(alwaysRun=true)
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         String noTest = System.getProperty("noTestCleanup");
        if(Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
             if (logger.isDebugEnabled()) {
index e4fa5d1d1882a98d9d76f955459b6acfad9c482a..1aef9d077d8dacda4c1713c9493382aa4efb5c31 100644 (file)
@@ -36,11 +36,11 @@ public class PublicItemClient extends AbstractCommonListPoxServiceClientImpl<Pub
     
     public static final String PUBLICITEMS_CONTENT_SUFFIX = "content";
 
-    public PublicItemClient() {
+    public PublicItemClient() throws Exception {
                super();
        }
 
-    public PublicItemClient(String clientPropertiesFilename) {
+    public PublicItemClient(String clientPropertiesFilename) throws Exception {
        super(clientPropertiesFilename);
        }
 
index 62a49cffed9121295b764b75cae1853a5d4028eb..b0ef5b88bfcefbc33a9b14a05b6665a91437fb76 100644 (file)
@@ -39,7 +39,6 @@ import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.publicitem.PublicitemsCommon;
-
 import org.testng.Assert;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -69,12 +68,12 @@ public class PublicItemServiceTest extends
         * ()
         */
        @Override
-       protected PublicItemClient getClientInstance() {
+       protected PublicItemClient getClientInstance() throws Exception {
                return new PublicItemClient();
        }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
                return new PublicItemClient(clientPropertiesFilename);
        }
 
@@ -578,7 +577,7 @@ public class PublicItemServiceTest extends
        }
 
        @Override
-       protected PoxPayloadOut createInstance(String identifier) {
+       protected PoxPayloadOut createInstance(String identifier) throws Exception {
                return createPublicItemInstance(identifier);
        }
 
@@ -588,8 +587,9 @@ public class PublicItemServiceTest extends
         * @param identifier
         *            the identifier
         * @return the multipart output
+        * @throws Exception 
         */
-       private PoxPayloadOut createPublicItemInstance(String identifier) {
+       private PoxPayloadOut createPublicItemInstance(String identifier) throws Exception {
                return createPublicItemInstance("itemNumber-" + identifier,
                                "contentCreationJobId-" + identifier);
        }
@@ -602,9 +602,10 @@ public class PublicItemServiceTest extends
         * @param contentCreationJobId
         *            the publicitem asynch job ID
         * @return the multipart output
+        * @throws Exception 
         */
        private PoxPayloadOut createPublicItemInstance(String itemNumber,
-                       String itemJobId) {
+                       String itemJobId) throws Exception {
 
                PublicitemsCommon publicItemsCommon = new PublicitemsCommon();
                publicItemsCommon.setItemNumber(itemNumber);
@@ -645,7 +646,7 @@ public class PublicItemServiceTest extends
 
        @Override
        protected PoxPayloadOut createInstance(String commonPartName,
-                       String identifier) {
+                       String identifier) throws Exception {
                PoxPayloadOut result = createPublicItemInstance(identifier);
                return result;
        }
index a91cab3fa8950be8c643a983ddcb22d4cdf5d2d6..eaf89ee7e48f2d3db93a6f61607ad99ef0305b53 100644 (file)
@@ -39,7 +39,6 @@ import org.collectionspace.services.client.RelationClient;
 import org.collectionspace.services.relation.RelationsCommon;
 import org.collectionspace.services.relation.RelationsCommonList;
 import org.collectionspace.services.relation.RelationshipType;
-
 import org.testng.Assert;
 import org.testng.annotations.AfterSuite;
 import org.testng.annotations.BeforeSuite;
@@ -83,12 +82,12 @@ public class RelationServiceTest extends AbstractPoxServiceTestImpl<RelationsCom
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
        return new RelationClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
        return new RelationClient(clientPropertiesFilename);
        }
      
@@ -98,9 +97,10 @@ public class RelationServiceTest extends AbstractPoxServiceTestImpl<RelationsCom
         
     /**
      * Creates the person refs as a precondition for running the tests in this class.
+     * @throws Exception 
      */
     @BeforeSuite
-    private void createPersonRefs() {
+    private void createPersonRefs() throws Exception {
         setupCreate();
 
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
@@ -135,7 +135,7 @@ public class RelationServiceTest extends AbstractPoxServiceTestImpl<RelationsCom
     }
     
     @AfterSuite
-    private void deletePersonRefs() {
+    private void deletePersonRefs() throws Exception {
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         for (String csid:personIdsCreated) {
                Response res = personAuthClient.deleteItem(personAuthCSID, csid);
@@ -165,7 +165,7 @@ public class RelationServiceTest extends AbstractPoxServiceTestImpl<RelationsCom
         
     }
 
-    private String createPerson(String firstName, String surName, String shortId, String authRefName) {
+    private String createPerson(String firstName, String surName, String shortId, String authRefName) throws Exception {
        String result = null;
        
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
@@ -261,7 +261,7 @@ public class RelationServiceTest extends AbstractPoxServiceTestImpl<RelationsCom
         return relationCommon;
     }
 
-    private PoxPayloadOut createRelationInstance(RelationsCommon relation) {
+    private PoxPayloadOut createRelationInstance(RelationsCommon relation) throws Exception {
         PoxPayloadOut result = new PoxPayloadOut(this.getServicePathComponent());
         PayloadOutputPart commonPart =
                result.addPart(new RelationClient().getCommonPartName(), relation);
@@ -277,8 +277,9 @@ public class RelationServiceTest extends AbstractPoxServiceTestImpl<RelationsCom
      *
      * @param identifier the identifier
      * @return the multipart output
+     * @throws Exception 
      */
-    private PoxPayloadOut createRelationInstance(String identifier) {
+    private PoxPayloadOut createRelationInstance(String identifier) throws Exception {
         RelationsCommon relation = createRelationsCommon(identifier);
         PoxPayloadOut result = createRelationInstance(relation);
         return result;
@@ -333,7 +334,7 @@ public class RelationServiceTest extends AbstractPoxServiceTestImpl<RelationsCom
 
        @Override
        protected PoxPayloadOut createInstance(String commonPartName,
-                       String identifier) {
+                       String identifier) throws Exception {
                return createRelationInstance(identifier);
        }
 
index 15f3b47944cdf2d1b1e50ec7a5beced87bca94a3..b8051a0816be99e61e0afae390dec3d201db71af 100644 (file)
@@ -55,11 +55,11 @@ public class ReportClient extends AbstractCommonListPoxServiceClientImpl<ReportP
     public static final String COMPILED_REPORT_EXTENSION = ".jasper";
     public static final String REPORT_DECSRIPTION_EXTENSION = ".jrxml";
 
-    public ReportClient() {
+    public ReportClient() throws Exception {
                super();
        }
 
-    public ReportClient(String clientPropertiesFilename) {
+    public ReportClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
index 79c0198e681c2a6d950e2504244695e9dd0149e6..b65e013a20e5bb5f6fc096dc0b55034bbeb9310a 100644 (file)
@@ -40,7 +40,6 @@ import org.collectionspace.services.common.invocable.InvocationContext;
 import org.collectionspace.services.report.ReportsCommon;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.client.AcquisitionClient;
-
 import org.testng.Assert;
 import org.testng.annotations.Test;
 import org.slf4j.Logger;
@@ -64,7 +63,7 @@ public class ReportServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
     // Instance variables specific to this test.    
     private String testDocType = "Acquisition";
 
-    private String createAquisitionResource() {
+    private String createAquisitionResource() throws Exception {
        String result = null;
        
        AcquisitionClient acquisitionClient = new AcquisitionClient();
@@ -149,12 +148,12 @@ public class ReportServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new ReportClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new ReportClient(clientPropertiesFilename);
        }
     
@@ -271,8 +270,9 @@ public class ReportServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
      *
      * @param identifier the identifier
      * @return the multipart output
+     * @throws Exception 
      */
-    private PoxPayloadOut createReportInstance(String identifier) {
+    private PoxPayloadOut createReportInstance(String identifier) throws Exception {
        List<String> docTypes = new ArrayList<String>();
        docTypes.add(testDocType);
         return createReportInstance(
@@ -289,13 +289,14 @@ public class ReportServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
      * @param filename the relative path to the report
      * @param outputMIME the MIME type we will return for this report
      * @return the multipart output
+     * @throws Exception 
      */
     private PoxPayloadOut createReportInstance(String name,
                List<String> forDocTypeList,
                boolean supportsSingle, boolean supportsList, 
                boolean supportsGroup, boolean supportsNoContext, 
             String filename,
-            String outputMIME) {
+            String outputMIME) throws Exception {
         ReportsCommon reportCommon = new ReportsCommon();
         reportCommon.setName(name);
         ReportsCommon.ForDocTypes forDocTypes = new ReportsCommon.ForDocTypes(); 
@@ -325,7 +326,7 @@ public class ReportServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
 
        @Override
        protected PoxPayloadOut createInstance(String commonPartName,
-                       String identifier) {
+                       String identifier) throws Exception {
         PoxPayloadOut result = createReportInstance(identifier);
                return result;
        }
index 5b3c83f768f7a9f9bbd128db8a1905b1c02bf66d..4834a349f68aab270a6281de446867b0c3ea6f39 100644 (file)
@@ -30,7 +30,6 @@ 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;
 import org.collectionspace.services.account.Status;
@@ -83,12 +82,12 @@ public class AuthenticationServiceTest extends BaseServiceTest<AbstractCommonLis
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new AccountClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new AccountClient(clientPropertiesFilename);
        }       
 
@@ -200,9 +199,8 @@ public class AuthenticationServiceTest extends BaseServiceTest<AbstractCommonLis
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.test.AbstractServiceTest#create()
      */
-    @Test(dataProvider = "testName",
-               dependsOnMethods = {"createActiveAccount"})
-    public void create(String testName) {
+    @Test(dataProvider = "testName", dependsOnMethods = {"createActiveAccount"})
+    public void create(String testName) throws Exception {
         setupCreate();
 
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
@@ -229,9 +227,8 @@ public class AuthenticationServiceTest extends BaseServiceTest<AbstractCommonLis
 
     }
 
-    @Test(dataProvider = "testName",
-               dependsOnMethods = {"createActiveAccount"})
-    public void createWithoutAuthn(String testName) {
+    @Test(dataProvider = "testName", dependsOnMethods = {"createActiveAccount"})
+    public void createWithoutAuthn(String testName) throws Exception {
         setupCreate();
         
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
@@ -254,9 +251,8 @@ public class AuthenticationServiceTest extends BaseServiceTest<AbstractCommonLis
         }
     }
 
-    @Test(dataProvider = "testName",
-               dependsOnMethods = {"createInactiveAccount"})
-    public void createWithInactiveAccount(String testName) {
+    @Test(dataProvider = "testName", dependsOnMethods = {"createInactiveAccount"})
+    public void createWithInactiveAccount(String testName) throws Exception {
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
         collectionObjectClient.setAuth(true, "george", true, "george08", true);
         String identifier = createIdentifier();
@@ -278,10 +274,10 @@ public class AuthenticationServiceTest extends BaseServiceTest<AbstractCommonLis
 
     /**
      * Creates the collection object instance without password.
+     * @throws Exception 
      */
-    @Test(dataProvider = "testName",
-               dependsOnMethods = {"createActiveAccount"})
-    public void createWithoutPassword(String testName) {
+    @Test(dataProvider = "testName", dependsOnMethods = {"createActiveAccount"})
+    public void createWithoutPassword(String testName) throws Exception {
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
         String user = collectionObjectClient.getProperty(collectionObjectClient.USER_PROPERTY);
         collectionObjectClient.setAuth(true, user, true, "", false);
@@ -301,10 +297,10 @@ public class AuthenticationServiceTest extends BaseServiceTest<AbstractCommonLis
 
     /**
      * Creates the collection object with unknown user
+     * @throws Exception 
      */
-    @Test(dataProvider = "testName",
-               dependsOnMethods = {"createActiveAccount"})
-    public void createWithUnknownUser(String testName) {
+    @Test(dataProvider = "testName", dependsOnMethods = {"createActiveAccount"})
+    public void createWithUnknownUser(String testName) throws Exception {
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
         collectionObjectClient.setAuth(true, "foo", true, "bar", true);
         String identifier = createIdentifier();
@@ -323,10 +319,10 @@ public class AuthenticationServiceTest extends BaseServiceTest<AbstractCommonLis
 
     /**
      * Creates the collection object instance with incorrect password.
+     * @throws Exception 
      */
-    @Test(dataProvider = "testName",
-               dependsOnMethods = {"createActiveAccount"})
-    public void createWithIncorrectPassword(String testName) {
+    @Test(dataProvider = "testName", dependsOnMethods = {"createActiveAccount"})
+    public void createWithIncorrectPassword(String testName) throws Exception {
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
         String user = collectionObjectClient.getProperty(collectionObjectClient.USER_PROPERTY);
         collectionObjectClient.setAuth(true, user, true, "bar", true);
@@ -346,9 +342,10 @@ public class AuthenticationServiceTest extends BaseServiceTest<AbstractCommonLis
 
     /**
      * Creates the collection object instance with incorrect user password.
+     * @throws Exception 
      */
     @Test(dataProvider = "testName", dependsOnMethods = {"createActiveAccount"})
-    public void createWithIncorrectUserPassword(String testName) {
+    public void createWithIncorrectUserPassword(String testName) throws Exception {
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
         collectionObjectClient.setAuth(true, "foo", true, "bar", true);
         String identifier = createIdentifier();
@@ -367,9 +364,10 @@ public class AuthenticationServiceTest extends BaseServiceTest<AbstractCommonLis
 
     /**
      * Creates the collection object instance with incorrect user password.
+     * @throws Exception 
      */
     @Test(dataProvider = "testName", dependsOnMethods = {"createActiveAccount"})
-    public void createWithoutTenant(String testName) {
+    public void createWithoutTenant(String testName) throws Exception {
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
         collectionObjectClient.setAuth(true, "babybop", true, "babybop09", true);
         String identifier = createIdentifier();
index 04e5bbf6d051867c1dd1ba09a6e41347d9e4498c..f05b7d83019d0d2e6201dfeec04d04545f6521ca 100644 (file)
@@ -76,163 +76,166 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * AuthorizationServiceTest, carries out tests against a
- * deployed and running Permission, Role, AccountRole, PermissionRole and
- * CollectionObject Services.
+ * AuthorizationServiceTest, carries out tests against a deployed and running
+ * Permission, Role, AccountRole, PermissionRole and CollectionObject Services.
  *
- * Pre-requisite : authorization-mgt/client tests seed some permissions used
- * by this test
+ * Pre-requisite : authorization-mgt/client tests seed some permissions used by
+ * this test
  *
- * $LastChangedRevision: 917 $
- * $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri, 06 Nov 2009) $
+ * $LastChangedRevision: 917 $ $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri,
+ * 06 Nov 2009) $
  */
 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 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>();
-    //key for roleValues is roleName
-    private Hashtable<String, RoleValue> roleValues = new Hashtable<String, RoleValue>();
-    private String bigbirdPermId;
-    private String elmoPermId;
-    private final static String TEST_SERVICE_NAME = "dimensions";
-    private boolean accountRolesFlipped = false;
-    /*
-     * This method is called only by the parent class, AbstractServiceTestImpl
-     */
-
-    @Override
+       private final String CLASS_NAME = AuthorizationServiceTest.class.getName();
+       private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+       // Instance variables specific to this test.
+       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>();
+       // key for roleValues is roleName
+       private Hashtable<String, RoleValue> roleValues = new Hashtable<String, RoleValue>();
+       private String bigbirdPermId;
+       private String elmoPermId;
+       private final static String TEST_SERVICE_NAME = "dimensions";
+       private boolean accountRolesFlipped = false;
+
+       /*
+        * This method is called only by the parent class, AbstractServiceTestImpl
+        */
+
+       @Override
        protected String getServiceName() {
-        // no need to return anything but null since no auth resources are
-        // accessed
-       throw new UnsupportedOperationException();
-       }
-       
-    @Override
-    protected String getServicePathComponent() {
-        // no need to return anything but null since no auth resources are
-        // accessed
-       throw new UnsupportedOperationException();
-    }
-
-    @BeforeClass(alwaysRun = true)
-    public void seedData() {
-        seedPermissions();
-        seedRoles();
-        seedAccounts();
-        seedAccountRoles();
-        seedPermissionRoles();
-    }
-
-    private void seedPermissions() {
-        String res = TEST_SERVICE_NAME;
-
-        PermissionAction pac = new PermissionAction();
-        pac.setName(ActionType.CREATE);
-        PermissionAction par = new PermissionAction();
-        par.setName(ActionType.READ);
-        PermissionAction pau = new PermissionAction();
-        pau.setName(ActionType.UPDATE);
-
-
-        //bigbird can create, read and update but not delete
-        List<PermissionAction> bbactions = new ArrayList<PermissionAction>();
-        bbactions.add(pac);
-        bbactions.add(par);
-        bbactions.add(pau);
-        bigbirdPermId = createPermission(res, bbactions, EffectType.PERMIT);
-        PermissionValue bbpv = new PermissionValue();
-        bbpv.setResourceName(res);
-        bbpv.setPermissionId(bigbirdPermId);
-        permValues.put(bbpv.getPermissionId(), bbpv);
-
-        //elmo can only read
-        List<PermissionAction> eactions = new ArrayList<PermissionAction>();
-        eactions.add(par);
-        elmoPermId = createPermission(res, eactions, EffectType.PERMIT);
-        PermissionValue epv = new PermissionValue();
-        epv.setResourceName(res);
-        epv.setPermissionId(elmoPermId);
-        permValues.put(epv.getPermissionId(), epv);
-    }
-
-    private void seedRoles() {
-        String rn1 = "ROLE_TEST_CM";
-        String r1RoleId = createRole(rn1);
-        RoleValue rv1 = new RoleValue();
-        rv1.setRoleId(r1RoleId);
-        rv1.setRoleName(rn1);
-        roleValues.put(rv1.getRoleName(), rv1);
-
-        String rn2 = "ROLE_TEST_INTERN";
-        String r2RoleId = createRole(rn2);
-        RoleValue rv2 = new RoleValue();
-        rv2.setRoleId(r2RoleId);
-        rv2.setRoleName(rn2);
-        roleValues.put(rv2.getRoleName(), rv2);
-    }
-
-    private void seedAccounts() {
-        String userId1 = "bigbird2010";
-        String accId1 = createAccount(userId1, "bigbird@cspace.org");
-        AccountValue av1 = new AccountValue();
-        av1.setScreenName(userId1);
-        av1.setUserId(userId1);
-        av1.setAccountId(accId1);
-        accValues.put(av1.getUserId(), av1);
-
-        String userId2 = "elmo2010";
-        String accId2 = createAccount(userId2, "elmo@cspace.org");
-        AccountValue av2 = new AccountValue();
-        av2.setScreenName(userId2);
-        av2.setUserId(userId2);
-        av2.setAccountId(accId2);
-        accValues.put(av2.getUserId(), av2);
-
-        String userId3 = "lockedOut";
-        String accId3 = createAccount(userId3, "lockedOut@cspace.org");
-        AccountValue av3 = new AccountValue();
-        av3.setScreenName(userId3);
-        av3.setUserId(userId3);
-        av3.setAccountId(accId3);
-        accValues.put(av3.getUserId(), av3);
-    }
-
-    private void seedAccountRoles() {
-
-        List<RoleValue> bigbirdRoleValues = new ArrayList<RoleValue>();
-        bigbirdRoleValues.add(roleValues.get("ROLE_TEST_CM"));
-        createAccountRole(accValues.get("bigbird2010"), bigbirdRoleValues);
-
-        List<RoleValue> elmoRoleValues = new ArrayList<RoleValue>();
-        elmoRoleValues.add(roleValues.get("ROLE_TEST_INTERN"));
-        createAccountRole(accValues.get("elmo2010"), elmoRoleValues);
-    }
-
-    private void seedPermissionRoles() {
-
-        List<RoleValue> bigbirdRoleValues = new ArrayList<RoleValue>();
-        bigbirdRoleValues.add(roleValues.get("ROLE_TEST_CM"));
-        createPermissionRole(permValues.get(bigbirdPermId), bigbirdRoleValues);
-
-        List<RoleValue> elmoRoleValues = new ArrayList<RoleValue>();
-        elmoRoleValues.add(roleValues.get("ROLE_TEST_INTERN"));
-        createPermissionRole(permValues.get(elmoPermId), elmoRoleValues);
-
-    }
-
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
-     */
-    @Override
-    protected CollectionSpaceClient getClientInstance() {
-       // This method is meaningless to this test.
-        return null;
-    }
+               // no need to return anything but null since no auth resources are
+               // accessed
+               throw new UnsupportedOperationException();
+       }
+
+       @Override
+       protected String getServicePathComponent() {
+               // no need to return anything but null since no auth resources are
+               // accessed
+               throw new UnsupportedOperationException();
+       }
+
+       @BeforeClass(alwaysRun = true)
+       public void seedData() throws Exception {
+               seedPermissions();
+               seedRoles();
+               seedAccounts();
+               seedAccountRoles();
+               seedPermissionRoles();
+       }
+
+       private void seedPermissions() throws Exception {
+               String res = TEST_SERVICE_NAME;
+
+               PermissionAction pac = new PermissionAction();
+               pac.setName(ActionType.CREATE);
+               PermissionAction par = new PermissionAction();
+               par.setName(ActionType.READ);
+               PermissionAction pau = new PermissionAction();
+               pau.setName(ActionType.UPDATE);
+
+               // bigbird can create, read and update but not delete
+               List<PermissionAction> bbactions = new ArrayList<PermissionAction>();
+               bbactions.add(pac);
+               bbactions.add(par);
+               bbactions.add(pau);
+               bigbirdPermId = createPermission(res, bbactions, EffectType.PERMIT);
+               PermissionValue bbpv = new PermissionValue();
+               bbpv.setResourceName(res);
+               bbpv.setPermissionId(bigbirdPermId);
+               permValues.put(bbpv.getPermissionId(), bbpv);
+
+               // elmo can only read
+               List<PermissionAction> eactions = new ArrayList<PermissionAction>();
+               eactions.add(par);
+               elmoPermId = createPermission(res, eactions, EffectType.PERMIT);
+               PermissionValue epv = new PermissionValue();
+               epv.setResourceName(res);
+               epv.setPermissionId(elmoPermId);
+               permValues.put(epv.getPermissionId(), epv);
+       }
+
+       private void seedRoles() throws Exception {
+               String rn1 = "ROLE_TEST_CM";
+               String r1RoleId = createRole(rn1);
+               RoleValue rv1 = new RoleValue();
+               rv1.setRoleId(r1RoleId);
+               rv1.setRoleName(rn1);
+               roleValues.put(rv1.getRoleName(), rv1);
+
+               String rn2 = "ROLE_TEST_INTERN";
+               String r2RoleId = createRole(rn2);
+               RoleValue rv2 = new RoleValue();
+               rv2.setRoleId(r2RoleId);
+               rv2.setRoleName(rn2);
+               roleValues.put(rv2.getRoleName(), rv2);
+       }
+
+       private void seedAccounts() throws Exception {
+               String userId1 = "bigbird2010";
+               String accId1 = createAccount(userId1, "bigbird@cspace.org");
+               AccountValue av1 = new AccountValue();
+               av1.setScreenName(userId1);
+               av1.setUserId(userId1);
+               av1.setAccountId(accId1);
+               accValues.put(av1.getUserId(), av1);
+
+               String userId2 = "elmo2010";
+               String accId2 = createAccount(userId2, "elmo@cspace.org");
+               AccountValue av2 = new AccountValue();
+               av2.setScreenName(userId2);
+               av2.setUserId(userId2);
+               av2.setAccountId(accId2);
+               accValues.put(av2.getUserId(), av2);
+
+               String userId3 = "lockedOut";
+               String accId3 = createAccount(userId3, "lockedOut@cspace.org");
+               AccountValue av3 = new AccountValue();
+               av3.setScreenName(userId3);
+               av3.setUserId(userId3);
+               av3.setAccountId(accId3);
+               accValues.put(av3.getUserId(), av3);
+       }
+
+       private void seedAccountRoles() throws Exception {
+
+               List<RoleValue> bigbirdRoleValues = new ArrayList<RoleValue>();
+               bigbirdRoleValues.add(roleValues.get("ROLE_TEST_CM"));
+               createAccountRole(accValues.get("bigbird2010"), bigbirdRoleValues);
+
+               List<RoleValue> elmoRoleValues = new ArrayList<RoleValue>();
+               elmoRoleValues.add(roleValues.get("ROLE_TEST_INTERN"));
+               createAccountRole(accValues.get("elmo2010"), elmoRoleValues);
+       }
+
+       private void seedPermissionRoles() throws Exception {
+
+               List<RoleValue> bigbirdRoleValues = new ArrayList<RoleValue>();
+               bigbirdRoleValues.add(roleValues.get("ROLE_TEST_CM"));
+               createPermissionRole(permValues.get(bigbirdPermId), bigbirdRoleValues);
+
+               List<RoleValue> elmoRoleValues = new ArrayList<RoleValue>();
+               elmoRoleValues.add(roleValues.get("ROLE_TEST_INTERN"));
+               createPermissionRole(permValues.get(elmoPermId), elmoRoleValues);
+
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * org.collectionspace.services.client.test.BaseServiceTest#getClientInstance
+        * ()
+        */
+       @Override
+       protected CollectionSpaceClient getClientInstance() {
+               // This method is meaningless to this test.
+               return null;
+       }
 
        @Override
        protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
@@ -240,606 +243,590 @@ public class AuthorizationServiceTest extends BaseServiceTest<AbstractCommonList
                return null;
        }
 
-    // ---------------------------------------------------------------
-    // CRUD tests : CREATE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-
-    @Test(dataProvider = "testName")
-    public void create(String testName) throws Exception {
-        int statusCode;
-        setupCreate();
-
-        // Submit the request to the service and store the response.
-        DimensionClient client = new DimensionClient();
-        //bigbird allowed to create
-        client.setAuth(true, "bigbird2010", true, "bigbird2010", true);
-        String identifier = createIdentifier();
-        DimensionsCommon dimension = new DimensionsCommon();
-        dimension.setDimension("dimensionType");
-        dimension.setMeasurementUnit("measurementUnit-" + identifier);
-        dimension.setValueDate(new Date().toString());
-        PoxPayloadOut multipart = DimensionFactory.createDimensionInstance(client.getCommonPartName(),
-                dimension);
-        Response res = client.create(multipart);
-        try {
-               statusCode = res.getStatus();
-               if (logger.isDebugEnabled()) {
-                   logger.debug(testName + ": status = " + statusCode);
-               }
-               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                       invalidStatusCodeMessage(testRequestType, statusCode));
-               Assert.assertEquals(statusCode, Response.Status.CREATED.getStatusCode());
-               knownResourceId = extractId(res);
-               if (logger.isDebugEnabled()) {
-                   logger.debug(testName + ": knownResourceId=" + knownResourceId);
-               }
-        } finally {
-               res.close();
-        }
-                
-        // Now verify that elmo cannot create
-        client = new DimensionClient();
-        client.setAuth(true, "elmo2010", true, "elmo2010", true);
-        res = client.create(multipart);
-        try {
-               statusCode = res.getStatus();
-               if (logger.isDebugEnabled()) {
-                   logger.debug(testName + " (verify not allowed): status = " + statusCode);
-               }
-               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                       invalidStatusCodeMessage(testRequestType, statusCode));
-               Assert.assertEquals(statusCode, Response.Status.FORBIDDEN.getStatusCode());
-        } finally {
-               res.close();
-        }
-        
-        //Finally, verify that elmo has no access to Intakes
-        // Submit the request to the service and store the response.
-        IntakeClient iclient = new IntakeClient();
-        iclient.setAuth(true, "elmo2010", true, "elmo2010", true);
-        multipart = createIntakeInstance(
-                "entryNumber-" + identifier,
-                "entryDate-" + identifier,
-                "depositor-" + identifier);
-        res = iclient.create(multipart);
-        try {
-               if (logger.isDebugEnabled()) {
-                   logger.debug(testName + " (verify create intake not allowed): status = " + statusCode);
-               }
-               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                       invalidStatusCodeMessage(testRequestType, statusCode));
-               Assert.assertEquals(statusCode, Response.Status.FORBIDDEN.getStatusCode());
-        } finally {
-               res.close();
-        }
-    }
-    
-    /**
-     * Creates the intake instance.
-     *
-     * @param entryNumber the entry number
-     * @param entryDate the entry date
-     * @param depositor the depositor
-     * @return the multipart output
-     */
-    private PoxPayloadOut createIntakeInstance(String entryNumber,
-               String entryDate,
-               String depositor) {
-        IntakesCommon intake = new IntakesCommon();
-        intake.setEntryNumber(entryNumber);
-        intake.setEntryDate(entryDate);
-        intake.setDepositor(depositor);
-
-        PoxPayloadOut multipart = new PoxPayloadOut(IntakeClient.SERVICE_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = multipart.addPart(intake, MediaType.APPLICATION_XML_TYPE);
-        commonPart.setLabel(new IntakeClient().getCommonPartName());
-
-        if(logger.isDebugEnabled()){
-            logger.debug("to be created, intake common");
-            logger.debug(objectAsXmlString(intake, IntakesCommon.class));
-        }
-
-        return multipart;
-    }
-    
-    @Test(dataProvider = "testName",
-           dependsOnMethods = {"delete"})
-    public void verifyCreateWithFlippedRoles(String testName) throws Exception {
-       int statusCode;
-        setupCreate();
-
-        // Submit the request to the service and store the response.
-        DimensionClient client = new DimensionClient();
-        flipInitialAccountRoles();
-
-        // Now verify that elmo can create
-        client.setAuth(true, "elmo2010", true, "elmo2010", true);
-        client = new DimensionClient();
-        
-        String identifier = createIdentifier();
-        DimensionsCommon dimension = new DimensionsCommon();
-        dimension.setDimension("dimensionType");
-        dimension.setMeasurementUnit("measurementUnit-" + identifier);
-        dimension.setValueDate(new Date().toString());
-        PoxPayloadOut multipart = DimensionFactory.createDimensionInstance(client.getCommonPartName(),
-                dimension);
-        Response res = client.create(multipart);
-        try {
-               statusCode = res.getStatus();
-       
-               if (logger.isDebugEnabled()) {
-                   logger.debug(testName + ": status = " + statusCode);
-               }
-               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                       invalidStatusCodeMessage(testRequestType, statusCode));
-               Assert.assertEquals(statusCode, Response.Status.CREATED.getStatusCode());
-               knownResourceId = extractId(res);
-               if (logger.isDebugEnabled()) {
-                   logger.debug(testName + ": knownResourceId=" + knownResourceId);
-               }
-        } finally {
-               res.close();
-        }
-        
-        //bigbird no longer allowed to create
-        client.setAuth(true, "bigbird2010", true, "bigbird2010", true);
-        res = client.create(multipart);
-        try {
-               statusCode = res.getStatus();
-               if (logger.isDebugEnabled()) {
-                   logger.debug(testName + " (verify not allowed): status = " + statusCode);
-               }
-               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                       invalidStatusCodeMessage(testRequestType, statusCode));
-               Assert.assertEquals(statusCode, Response.Status.FORBIDDEN.getStatusCode());
-        } finally {
-               res.close();
-        }
-        
-        restoreInitialAccountRoles();
-    }
-
-    // ---------------------------------------------------------------
-    // CRUD tests : READ tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    @Test(dataProvider = "testName",
-               dependsOnMethods = {"create"})
-    public void read(String testName) throws Exception {
-        // Perform setup.
-        setupRead();
-
-        // Submit the request to the service and store the response.
-        DimensionClient client = new DimensionClient();
-        //elmo allowed to read
-        client.setAuth(true, "elmo2010", true, "elmo2010", true);
-        Response res = client.read(knownResourceId);
-        try {
-               assertStatusCode(res, testName);
-               PoxPayloadIn input = new PoxPayloadIn(res.readEntity(String.class));
-               DimensionsCommon dimension = (DimensionsCommon) extractPart(input,
-                       client.getCommonPartName(), DimensionsCommon.class);
-               Assert.assertNotNull(dimension);
-        } finally {
-               if (res != null) {
-                res.close();
-            }
-        }
-    }
-
-    @Test(dataProvider = "testName",
-           dependsOnMethods = {"read"})
-    public void readLockedOut(String testName) throws Exception {
-        // Perform setup.
-       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);
-        Response res = client.read(knownResourceId);
-        try {
-               assertStatusCode(res, testName);
-        } finally {
-               if (res != null) {
-                res.close();
-            }
-        }
-    }
-
-    @Test(dataProvider = "testName",
-               dependsOnMethods = {"read"})
-    public void updateNotAllowed(String testName) throws Exception {
-        setupForbidden();
-
-        // 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());
-        //
-        // Create and submit the request to the service and store the response.
-        //
-        PoxPayloadOut output = new PoxPayloadOut(DimensionClient.SERVICE_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = output.addPart(client.getCommonPartName(), dimension);
-        Response res = client.update(knownResourceId, output);
-        try {
-               assertStatusCode(res, testName);
-        } finally {
-               if (res != null) {
-                res.close();
-            }
-        }
-        //
-        // 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);
-        try {
-               assertStatusCode(res, testName);
-        } finally {
-               if (res != null) {
-                res.close();
-            }
-        }
-        
-    }
-
-    // ---------------------------------------------------------------
-    // CRUD tests : DELETE tests
-    // ---------------------------------------------------------------
-    // Success outcomes
-    @Test(dataProvider = "testName",
-               dependsOnMethods = {"updateNotAllowed"})
-    public void deleteNotAllowed(String testName) throws Exception {
-        // Perform setup.
-        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
-        //
-        Response res = client.delete(knownResourceId);
-        try {
-               assertStatusCode(res, testName);
-        } finally {
-               if (res != null) {
-                res.close();
-            }
-        }
-    }
-
-    @Test(dataProvider = "testName",
-       dependsOnMethods = {"deleteNotAllowed"})
-    public void delete(String testName) throws Exception {
-        // Perform setup.
-        setupDelete();
-
-        // Submit the request to the service and store the response.
-        DimensionClient client = new DimensionClient();
-
-        Response res = client.delete(knownResourceId);
-        try {
-               assertStatusCode(res, testName);
-        } finally {
-               if (res != null) {
-                res.close();
-            }
-        }
-    }
-
-    // ---------------------------------------------------------------
-    // Utility methods used by tests above
-    // ---------------------------------------------------------------
-    @AfterClass(alwaysRun = true)
-    public void cleanUp() {
-        setupDelete();
-        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 ...");
-        }
-
-        deletePermissionRoles();
-        deleteAccountRoles();
-        //FIXME delete on permission deletes all associations with roles
-        //this would delete association with ROLE_ADMINISTRATOR too
-        //deletePermissions();
-               deleteRoles();
-        deleteAccounts();
-    }
-
-    private void deletePermissionRoles() {
-        List<RoleValue> bigbirdRoleValues = new ArrayList<RoleValue>();
-        bigbirdRoleValues.add(roleValues.get("ROLE_TEST_CM"));
-        deletePermissionRole(permValues.get(bigbirdPermId), bigbirdRoleValues);
-
-        List<RoleValue> elmoRoleValues = new ArrayList<RoleValue>();
-        elmoRoleValues.add(roleValues.get("ROLE_TEST_INTERN"));
-        deletePermissionRole(permValues.get(elmoPermId), elmoRoleValues);
-    }
-
-    private void deleteAccountRoles() {
-        List<RoleValue> bigbirdRoleValues = new ArrayList<RoleValue>();
-        bigbirdRoleValues.add(roleValues.get("ROLE_TEST_CM"));
-
-        List<RoleValue> elmoRoleValues = new ArrayList<RoleValue>();
-        elmoRoleValues.add(roleValues.get("ROLE_TEST_INTERN"));
-        if(!accountRolesFlipped) {
-               deleteAccountRole(accValues.get("bigbird2010"), bigbirdRoleValues);
-               deleteAccountRole(accValues.get("elmo2010"), elmoRoleValues);
-        } else {
-               deleteAccountRole(accValues.get("bigbird2010"), elmoRoleValues);
-               deleteAccountRole(accValues.get("elmo2010"),bigbirdRoleValues );
-        }
-    }
-    
-    private void flipInitialAccountRoles() {
-        if(!accountRolesFlipped) {
-               List<RoleValue> cmRoleValues = new ArrayList<RoleValue>();
-               List<RoleValue> internRoleValues = new ArrayList<RoleValue>();
-               cmRoleValues.add(roleValues.get("ROLE_TEST_CM"));
-               internRoleValues.add(roleValues.get("ROLE_TEST_INTERN"));
-               
-               deleteAccountRole(accValues.get("bigbird2010"), cmRoleValues);
-               deleteAccountRole(accValues.get("elmo2010"), internRoleValues);
-
-               createAccountRole(accValues.get("bigbird2010"), internRoleValues);
-               createAccountRole(accValues.get("elmo2010"), cmRoleValues);
-               
-               accountRolesFlipped = true;
-        }
-    }
-
-    private void restoreInitialAccountRoles() {
-        if(accountRolesFlipped) {
-               List<RoleValue> cmRoleValues = new ArrayList<RoleValue>();
-               List<RoleValue> internRoleValues = new ArrayList<RoleValue>();
-               cmRoleValues.add(roleValues.get("ROLE_TEST_CM"));
-               internRoleValues.add(roleValues.get("ROLE_TEST_INTERN"));
-               
-               deleteAccountRole(accValues.get("bigbird2010"), internRoleValues);
-               deleteAccountRole(accValues.get("elmo2010"), cmRoleValues);
-
-               createAccountRole(accValues.get("bigbird2010"), internRoleValues);
-               createAccountRole(accValues.get("elmo2010"), cmRoleValues);
-               accountRolesFlipped = false;
-        }
-    }
-
-    private void deletePermissions() {
-        //delete entities
-        for (PermissionValue pv : permValues.values()) {
-            deletePermission(pv.getPermissionId());
-        }
-    }
-
-    private void deleteRoles() {
-        for (RoleValue rv : roleValues.values()) {
-            deleteRole(rv.getRoleId());
-        }
-    }
-
-    private void deleteAccounts() {
-
-        for (AccountValue av1 : accValues.values()) {
-            deleteAccount(av1.getAccountId());
-        }
-    }
-
-    private String createPermission(String resName, EffectType effect) {
-        List<PermissionAction> actions = PermissionFactory.createDefaultActions();
-        return createPermission(resName, actions, effect);
-    }
-
-    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);
-        Response res = permClient.create(permission);
-        try {
-               assertStatusCode(res, "CreatePermission");
-               result = extractId(res);
-        } finally {
-               if (res != null) {
-                res.close();
-            }
-        }
-
-        return result;
-    }
-
-    private void deletePermission(String permId) {
-        setupDelete();
-        PermissionClient permClient = new PermissionClient();
-        Response res = permClient.delete(permId);
-        try {
-               assertStatusCode(res, "DeletePermission");
-        } finally {
-               if (res != null) {
-                res.close();
-            }
-        }
-    }
-
-    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);
-        Response res = roleClient.create(role);
-        try {
-               assertStatusCode(res, "CreateRole");
-               result = extractId(res);
-        } finally {
-               if (res != null) {
-                res.close();
-            }
-        }
-        
-        return result;
-    }
-
-    private void deleteRole(String roleId) {
-        setupDelete();
-        RoleClient roleClient = new RoleClient();
-        Response res = roleClient.delete(roleId);
-        try {
-               assertStatusCode(res, "DeleteRole");
-        } finally {
-               if (res != null) {
-                res.close();
-            }
-        }
-    }
-
-    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);
-        Response res = accountClient.create(account);
-        try {
-               assertStatusCode(res, "CreateAccount");
-               result = extractId(res);
-        } finally {
-               if (res != null) {
-                res.close();
-            }
-        }
-        
-        return result;
-    }
-
-    private void deleteAccount(String accId) {
-        setupDelete();
-        AccountClient accClient = new AccountClient();
-        Response res = accClient.delete(accId);
-        try {
-               assertStatusCode(res, "DeleteAccount");
-        } finally {
-               if (res != null) {
-                res.close();
-            }
-        }
-    }
-
-    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();
-        Response res = client.create(av.getAccountId(), accRole);
-        try {
-               assertStatusCode(res, "CreateAccountRole");
-               result = extractId(res);
-        } finally {
-               if (res != null) {
-                res.close();
-            }
-        }
-        
-        return result;
-    }
-
-    private void deleteAccountRole(AccountValue av,
-            Collection<RoleValue> rvs) {
-        // Perform setup.
-        setupDelete();
-
-        // Submit the request to the service and store the response.
-        AccountRoleClient client = new AccountRoleClient();
-        AccountRole accRole = AccountRoleFactory.createAccountRoleInstance(
-                av, rvs, true, true);
-        Response res = client.delete(av.getAccountId());
-        try {
-               assertStatusCode(res, "DeleteAccountRole");
-        } finally {
-               if (res != null) {
-                res.close();
-            }
-        }
-    }
-
-    private String createPermissionRole(PermissionValue pv, Collection<RoleValue> rvs) {
-       String result = null;
-       
-        setupCreate();
-        List<RoleValue> rvls = new ArrayList<RoleValue>();
-        rvls.addAll(rvs);
-        PermissionRole permRole = PermissionRoleFactory.createPermissionRoleInstance(
-                pv, rvls, true, true);
-        PermissionRoleClient client = new PermissionRoleClient();
-        Response res = client.create(pv.getPermissionId(), permRole);
-        try {
-               assertStatusCode(res, "CreatePermissionRole");
-               result = extractId(res);
-        } finally {
-               if (res != null) {
-                res.close();
-            }
-        }
-        
-        return result;
-    }
-
-    private void deletePermissionRole(PermissionValue pv,
-            Collection<RoleValue> rvs) {
-        List<RoleValue> rvls = new ArrayList<RoleValue>();
-        rvls.addAll(rvs);
-
-        // Perform setup.
-        setupDelete();
-
-        // Submit the request to the service and store the response.
-        PermissionRoleClient client = new PermissionRoleClient();
-        PermissionRole permRole = PermissionRoleFactory.createPermissionRoleInstance(
-                pv, rvls, true, true);
-        Response res = client.delete(pv.getPermissionId());
-        try {
-               assertStatusCode(res, "DeletePermissionRole");
-        } finally {
-               if (res != null) {
-                res.close();
-            }
-        }
-    }
+       // ---------------------------------------------------------------
+       // CRUD tests : CREATE tests
+       // ---------------------------------------------------------------
+       // Success outcomes
+
+       @Test(dataProvider = "testName")
+       public void create(String testName) throws Exception {
+               int statusCode;
+               setupCreate();
+
+               // Submit the request to the service and store the response.
+               DimensionClient client = new DimensionClient();
+               // bigbird allowed to create
+               client.setAuth(true, "bigbird2010", true, "bigbird2010", true);
+               String identifier = createIdentifier();
+               DimensionsCommon dimension = new DimensionsCommon();
+               dimension.setDimension("dimensionType");
+               dimension.setMeasurementUnit("measurementUnit-" + identifier);
+               dimension.setValueDate(new Date().toString());
+               PoxPayloadOut multipart = DimensionFactory.createDimensionInstance(client.getCommonPartName(), dimension);
+               Response res = client.create(multipart);
+               try {
+                       statusCode = res.getStatus();
+                       if (logger.isDebugEnabled()) {
+                               logger.debug(testName + ": status = " + statusCode);
+                       }
+                       Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                                       invalidStatusCodeMessage(testRequestType, statusCode));
+                       Assert.assertEquals(statusCode, Response.Status.CREATED.getStatusCode());
+                       knownResourceId = extractId(res);
+                       if (logger.isDebugEnabled()) {
+                               logger.debug(testName + ": knownResourceId=" + knownResourceId);
+                       }
+               } finally {
+                       res.close();
+               }
+
+               // Now verify that elmo cannot create
+               client = new DimensionClient();
+               client.setAuth(true, "elmo2010", true, "elmo2010", true);
+               res = client.create(multipart);
+               try {
+                       statusCode = res.getStatus();
+                       if (logger.isDebugEnabled()) {
+                               logger.debug(testName + " (verify not allowed): status = " + statusCode);
+                       }
+                       Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                                       invalidStatusCodeMessage(testRequestType, statusCode));
+                       Assert.assertEquals(statusCode, Response.Status.FORBIDDEN.getStatusCode());
+               } finally {
+                       res.close();
+               }
+
+               // Finally, verify that elmo has no access to Intakes
+               // Submit the request to the service and store the response.
+               IntakeClient iclient = new IntakeClient();
+               iclient.setAuth(true, "elmo2010", true, "elmo2010", true);
+               multipart = createIntakeInstance("entryNumber-" + identifier, "entryDate-" + identifier, "depositor-"
+                               + identifier);
+               res = iclient.create(multipart);
+               try {
+                       if (logger.isDebugEnabled()) {
+                               logger.debug(testName + " (verify create intake not allowed): status = " + statusCode);
+                       }
+                       Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                                       invalidStatusCodeMessage(testRequestType, statusCode));
+                       Assert.assertEquals(statusCode, Response.Status.FORBIDDEN.getStatusCode());
+               } finally {
+                       res.close();
+               }
+       }
+
+       /**
+        * Creates the intake instance.
+        *
+        * @param entryNumber
+        *            the entry number
+        * @param entryDate
+        *            the entry date
+        * @param depositor
+        *            the depositor
+        * @return the multipart output
+        * @throws Exception 
+        */
+       private PoxPayloadOut createIntakeInstance(String entryNumber, String entryDate, String depositor) throws Exception {
+               IntakesCommon intake = new IntakesCommon();
+               intake.setEntryNumber(entryNumber);
+               intake.setEntryDate(entryDate);
+               intake.setDepositor(depositor);
+
+               PoxPayloadOut multipart = new PoxPayloadOut(IntakeClient.SERVICE_PAYLOAD_NAME);
+               PayloadOutputPart commonPart = multipart.addPart(intake, MediaType.APPLICATION_XML_TYPE);
+               commonPart.setLabel(new IntakeClient().getCommonPartName());
+
+               if (logger.isDebugEnabled()) {
+                       logger.debug("to be created, intake common");
+                       logger.debug(objectAsXmlString(intake, IntakesCommon.class));
+               }
+
+               return multipart;
+       }
+
+       @Test(dataProvider = "testName", dependsOnMethods = { "delete" })
+       public void verifyCreateWithFlippedRoles(String testName) throws Exception {
+               int statusCode;
+               setupCreate();
+
+               // Submit the request to the service and store the response.
+               DimensionClient client = new DimensionClient();
+               flipInitialAccountRoles();
+
+               // Now verify that elmo can create
+               client.setAuth(true, "elmo2010", true, "elmo2010", true);
+               client = new DimensionClient();
+
+               String identifier = createIdentifier();
+               DimensionsCommon dimension = new DimensionsCommon();
+               dimension.setDimension("dimensionType");
+               dimension.setMeasurementUnit("measurementUnit-" + identifier);
+               dimension.setValueDate(new Date().toString());
+               PoxPayloadOut multipart = DimensionFactory.createDimensionInstance(client.getCommonPartName(), dimension);
+               Response res = client.create(multipart);
+               try {
+                       statusCode = res.getStatus();
+
+                       if (logger.isDebugEnabled()) {
+                               logger.debug(testName + ": status = " + statusCode);
+                       }
+                       Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                                       invalidStatusCodeMessage(testRequestType, statusCode));
+                       Assert.assertEquals(statusCode, Response.Status.CREATED.getStatusCode());
+                       knownResourceId = extractId(res);
+                       if (logger.isDebugEnabled()) {
+                               logger.debug(testName + ": knownResourceId=" + knownResourceId);
+                       }
+               } finally {
+                       res.close();
+               }
+
+               // bigbird no longer allowed to create
+               client.setAuth(true, "bigbird2010", true, "bigbird2010", true);
+               res = client.create(multipart);
+               try {
+                       statusCode = res.getStatus();
+                       if (logger.isDebugEnabled()) {
+                               logger.debug(testName + " (verify not allowed): status = " + statusCode);
+                       }
+                       Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                                       invalidStatusCodeMessage(testRequestType, statusCode));
+                       Assert.assertEquals(statusCode, Response.Status.FORBIDDEN.getStatusCode());
+               } finally {
+                       res.close();
+               }
+
+               restoreInitialAccountRoles();
+       }
+
+       // ---------------------------------------------------------------
+       // CRUD tests : READ tests
+       // ---------------------------------------------------------------
+       // Success outcomes
+       @Test(dataProvider = "testName", dependsOnMethods = { "create" })
+       public void read(String testName) throws Exception {
+               // Perform setup.
+               setupRead();
+
+               // Submit the request to the service and store the response.
+               DimensionClient client = new DimensionClient();
+               // elmo allowed to read
+               client.setAuth(true, "elmo2010", true, "elmo2010", true);
+               Response res = client.read(knownResourceId);
+               try {
+                       assertStatusCode(res, testName);
+                       PoxPayloadIn input = new PoxPayloadIn(res.readEntity(String.class));
+                       DimensionsCommon dimension = (DimensionsCommon) extractPart(input, client.getCommonPartName(),
+                                       DimensionsCommon.class);
+                       Assert.assertNotNull(dimension);
+               } finally {
+                       if (res != null) {
+                               res.close();
+                       }
+               }
+       }
+
+       @Test(dataProvider = "testName", dependsOnMethods = { "read" })
+       public void readLockedOut(String testName) throws Exception {
+               // Perform setup.
+               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);
+               Response res = client.read(knownResourceId);
+               try {
+                       assertStatusCode(res, testName);
+               } finally {
+                       if (res != null) {
+                               res.close();
+                       }
+               }
+       }
+
+       @Test(dataProvider = "testName", dependsOnMethods = { "read" })
+       public void updateNotAllowed(String testName) throws Exception {
+               setupForbidden();
+
+               // 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());
+               //
+               // Create and submit the request to the service and store the response.
+               //
+               PoxPayloadOut output = new PoxPayloadOut(DimensionClient.SERVICE_PAYLOAD_NAME);
+               PayloadOutputPart commonPart = output.addPart(client.getCommonPartName(), dimension);
+               Response res = client.update(knownResourceId, output);
+               try {
+                       assertStatusCode(res, testName);
+               } finally {
+                       if (res != null) {
+                               res.close();
+                       }
+               }
+               //
+               // 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);
+               try {
+                       assertStatusCode(res, testName);
+               } finally {
+                       if (res != null) {
+                               res.close();
+                       }
+               }
+
+       }
+
+       // ---------------------------------------------------------------
+       // CRUD tests : DELETE tests
+       // ---------------------------------------------------------------
+       // Success outcomes
+       @Test(dataProvider = "testName", dependsOnMethods = { "updateNotAllowed" })
+       public void deleteNotAllowed(String testName) throws Exception {
+               // Perform setup.
+               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
+               //
+               Response res = client.delete(knownResourceId);
+               try {
+                       assertStatusCode(res, testName);
+               } finally {
+                       if (res != null) {
+                               res.close();
+                       }
+               }
+       }
+
+       @Test(dataProvider = "testName", dependsOnMethods = { "deleteNotAllowed" })
+       public void delete(String testName) throws Exception {
+               // Perform setup.
+               setupDelete();
+
+               // Submit the request to the service and store the response.
+               DimensionClient client = new DimensionClient();
+
+               Response res = client.delete(knownResourceId);
+               try {
+                       assertStatusCode(res, testName);
+               } finally {
+                       if (res != null) {
+                               res.close();
+                       }
+               }
+       }
+
+       // ---------------------------------------------------------------
+       // Utility methods used by tests above
+       // ---------------------------------------------------------------
+       @AfterClass(alwaysRun = true)
+       public void cleanUp() throws Exception {
+               setupDelete();
+               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 ...");
+               }
+
+               deletePermissionRoles();
+               deleteAccountRoles();
+               // FIXME delete on permission deletes all associations with roles
+               // this would delete association with ROLE_ADMINISTRATOR too
+               // deletePermissions();
+               deleteRoles();
+               deleteAccounts();
+       }
+
+       private void deletePermissionRoles() throws Exception {
+               List<RoleValue> bigbirdRoleValues = new ArrayList<RoleValue>();
+               bigbirdRoleValues.add(roleValues.get("ROLE_TEST_CM"));
+               deletePermissionRole(permValues.get(bigbirdPermId), bigbirdRoleValues);
+
+               List<RoleValue> elmoRoleValues = new ArrayList<RoleValue>();
+               elmoRoleValues.add(roleValues.get("ROLE_TEST_INTERN"));
+               deletePermissionRole(permValues.get(elmoPermId), elmoRoleValues);
+       }
+
+       private void deleteAccountRoles() throws Exception {
+               List<RoleValue> bigbirdRoleValues = new ArrayList<RoleValue>();
+               bigbirdRoleValues.add(roleValues.get("ROLE_TEST_CM"));
+
+               List<RoleValue> elmoRoleValues = new ArrayList<RoleValue>();
+               elmoRoleValues.add(roleValues.get("ROLE_TEST_INTERN"));
+               if (!accountRolesFlipped) {
+                       deleteAccountRole(accValues.get("bigbird2010"), bigbirdRoleValues);
+                       deleteAccountRole(accValues.get("elmo2010"), elmoRoleValues);
+               } else {
+                       deleteAccountRole(accValues.get("bigbird2010"), elmoRoleValues);
+                       deleteAccountRole(accValues.get("elmo2010"), bigbirdRoleValues);
+               }
+       }
+
+       private void flipInitialAccountRoles() throws Exception {
+               if (!accountRolesFlipped) {
+                       List<RoleValue> cmRoleValues = new ArrayList<RoleValue>();
+                       List<RoleValue> internRoleValues = new ArrayList<RoleValue>();
+                       cmRoleValues.add(roleValues.get("ROLE_TEST_CM"));
+                       internRoleValues.add(roleValues.get("ROLE_TEST_INTERN"));
+
+                       deleteAccountRole(accValues.get("bigbird2010"), cmRoleValues);
+                       deleteAccountRole(accValues.get("elmo2010"), internRoleValues);
+
+                       createAccountRole(accValues.get("bigbird2010"), internRoleValues);
+                       createAccountRole(accValues.get("elmo2010"), cmRoleValues);
+
+                       accountRolesFlipped = true;
+               }
+       }
+
+       private void restoreInitialAccountRoles() throws Exception {
+               if (accountRolesFlipped) {
+                       List<RoleValue> cmRoleValues = new ArrayList<RoleValue>();
+                       List<RoleValue> internRoleValues = new ArrayList<RoleValue>();
+                       cmRoleValues.add(roleValues.get("ROLE_TEST_CM"));
+                       internRoleValues.add(roleValues.get("ROLE_TEST_INTERN"));
+
+                       deleteAccountRole(accValues.get("bigbird2010"), internRoleValues);
+                       deleteAccountRole(accValues.get("elmo2010"), cmRoleValues);
+
+                       createAccountRole(accValues.get("bigbird2010"), internRoleValues);
+                       createAccountRole(accValues.get("elmo2010"), cmRoleValues);
+                       accountRolesFlipped = false;
+               }
+       }
+
+       private void deletePermissions() throws Exception {
+               // delete entities
+               for (PermissionValue pv : permValues.values()) {
+                       deletePermission(pv.getPermissionId());
+               }
+       }
+
+       private void deleteRoles() throws Exception {
+               for (RoleValue rv : roleValues.values()) {
+                       deleteRole(rv.getRoleId());
+               }
+       }
+
+       private void deleteAccounts() throws Exception {
+
+               for (AccountValue av1 : accValues.values()) {
+                       deleteAccount(av1.getAccountId());
+               }
+       }
+
+       private String createPermission(String resName, EffectType effect) throws Exception {
+               List<PermissionAction> actions = PermissionFactory.createDefaultActions();
+               return createPermission(resName, actions, effect);
+       }
+
+       private String createPermission(String resName, List<PermissionAction> actions, EffectType effect) throws Exception {
+               String result = null;
+
+               setupCreate();
+               PermissionClient permClient = new PermissionClient();
+               Permission permission = PermissionFactory.createPermissionInstance(resName, "default permissions for "
+                               + resName, actions, effect, true, true, true);
+               Response res = permClient.create(permission);
+               try {
+                       assertStatusCode(res, "CreatePermission");
+                       result = extractId(res);
+               } finally {
+                       if (res != null) {
+                               res.close();
+                       }
+               }
+
+               return result;
+       }
+
+       private void deletePermission(String permId) throws Exception {
+               setupDelete();
+               PermissionClient permClient = new PermissionClient();
+               Response res = permClient.delete(permId);
+               try {
+                       assertStatusCode(res, "DeletePermission");
+               } finally {
+                       if (res != null) {
+                               res.close();
+                       }
+               }
+       }
+
+       private String createRole(String roleName) throws Exception {
+               String result = null;
+
+               setupCreate();
+               RoleClient roleClient = new RoleClient();
+               Role role = RoleFactory.createRoleInstance(roleName, roleName, // the
+                                                                                                                                               // display
+                                                                                                                                               // name
+                               "role for " + roleName, true);
+               Response res = roleClient.create(role);
+               try {
+                       assertStatusCode(res, "CreateRole");
+                       result = extractId(res);
+               } finally {
+                       if (res != null) {
+                               res.close();
+                       }
+               }
+
+               return result;
+       }
+
+       private void deleteRole(String roleId) throws Exception {
+               setupDelete();
+               RoleClient roleClient = new RoleClient();
+               Response res = roleClient.delete(roleId);
+               try {
+                       assertStatusCode(res, "DeleteRole");
+               } finally {
+                       if (res != null) {
+                               res.close();
+                       }
+               }
+       }
+
+       private String createAccount(String userName, String email) throws Exception {
+               String result = null;
+
+               setupCreate();
+               AccountClient accountClient = new AccountClient();
+               AccountsCommon account = AccountFactory.createAccountInstance(userName, userName, userName, email,
+                               accountClient.getTenantId(), true, false, true, true);
+               Response res = accountClient.create(account);
+               try {
+                       assertStatusCode(res, "CreateAccount");
+                       result = extractId(res);
+               } finally {
+                       if (res != null) {
+                               res.close();
+                       }
+               }
+
+               return result;
+       }
+
+       private void deleteAccount(String accId) throws Exception {
+               setupDelete();
+               AccountClient accClient = new AccountClient();
+               Response res = accClient.delete(accId);
+               try {
+                       assertStatusCode(res, "DeleteAccount");
+               } finally {
+                       if (res != null) {
+                               res.close();
+                       }
+               }
+       }
+
+       private String createAccountRole(AccountValue av, Collection<RoleValue> rvs) throws Exception {
+               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();
+               Response res = client.create(av.getAccountId(), accRole);
+               try {
+                       assertStatusCode(res, "CreateAccountRole");
+                       result = extractId(res);
+               } finally {
+                       if (res != null) {
+                               res.close();
+                       }
+               }
+
+               return result;
+       }
+
+       private void deleteAccountRole(AccountValue av, Collection<RoleValue> rvs) throws Exception {
+               // Perform setup.
+               setupDelete();
+
+               // Submit the request to the service and store the response.
+               AccountRoleClient client = new AccountRoleClient();
+               AccountRole accRole = AccountRoleFactory.createAccountRoleInstance(av, rvs, true, true);
+               Response res = client.delete(av.getAccountId());
+               try {
+                       assertStatusCode(res, "DeleteAccountRole");
+               } finally {
+                       if (res != null) {
+                               res.close();
+                       }
+               }
+       }
+
+       private String createPermissionRole(PermissionValue pv, Collection<RoleValue> rvs) throws Exception {
+               String result = null;
+
+               setupCreate();
+               List<RoleValue> rvls = new ArrayList<RoleValue>();
+               rvls.addAll(rvs);
+               PermissionRole permRole = PermissionRoleFactory.createPermissionRoleInstance(pv, rvls, true, true);
+               PermissionRoleClient client = new PermissionRoleClient();
+               Response res = client.create(pv.getPermissionId(), permRole);
+               try {
+                       assertStatusCode(res, "CreatePermissionRole");
+                       result = extractId(res);
+               } finally {
+                       if (res != null) {
+                               res.close();
+                       }
+               }
+
+               return result;
+       }
+
+       private void deletePermissionRole(PermissionValue pv, Collection<RoleValue> rvs) throws Exception {
+               List<RoleValue> rvls = new ArrayList<RoleValue>();
+               rvls.addAll(rvs);
+
+               // Perform setup.
+               setupDelete();
+
+               // Submit the request to the service and store the response.
+               PermissionRoleClient client = new PermissionRoleClient();
+               PermissionRole permRole = PermissionRoleFactory.createPermissionRoleInstance(pv, rvls, true, true);
+               Response res = client.delete(pv.getPermissionId());
+               try {
+                       assertStatusCode(res, "DeletePermissionRole");
+               } finally {
+                       if (res != null) {
+                               res.close();
+                       }
+               }
+       }
 
        @Override
        protected Class<AbstractCommonList> getCommonListType() {
index 9384ea8a4b22f3fb26be44553a221a0e3c522be7..e9b4efc2ce0caaeb20e3fe8420e97a22a09b5a62 100644 (file)
@@ -130,7 +130,7 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
     }
 
     @BeforeClass(alwaysRun = true)
-    public void seedData() {
+    public void seedData() throws Exception {
         //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));
@@ -143,12 +143,12 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
         seedPermissionRoles();
     }
 
-    private void seedAccounts() {
+    private void seedAccounts() throws Exception {
         seedAccount(TENANT_1, TENANT_1_USER);
         seedAccount(TENANT_2, TENANT_2_USER);
     }
 
-    private void seedAccount(String tenantId, String userId) {
+    private void seedAccount(String tenantId, String userId) throws Exception {
         //create account using default user in admin role but assign tenant id
         //create username, email and password same for simplicity
         String accId = createAccount(tenantId, userId, userId);
@@ -163,7 +163,7 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
         }
     }
 
-    private void seedPermissions() {
+    private void seedPermissions() throws Exception {
         String resource = TEST_SERVICE_A;
 
         PermissionAction pac = new PermissionAction();
@@ -187,7 +187,7 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
     }
 
     private void seedPermission(String tenantId,
-            String resource, List<PermissionAction> testActions, EffectType effect) {
+            String resource, List<PermissionAction> testActions, EffectType effect) throws Exception {
         //create permission using default user in admin role but assign tenant id
         String id = createPermission(tenantId, resource, testActions, effect);
         PermissionValue pv = new PermissionValue();
@@ -201,14 +201,14 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
         }
     }
 
-    private void seedRoles() {
+    private void seedRoles() throws Exception {
         //create role using default user in admin role but assign tenant id
         //use the same role name to check constraints
         seedRole(TENANT_1, TEST_ROLE_NAME);
         seedRole(TENANT_2, TEST_ROLE_NAME);
     }
 
-    private void seedRole(String tenantId, String roleName) {
+    private void seedRole(String tenantId, String roleName) throws Exception {
         String rid = createRole(tenantId, roleName);
         RoleValue rv = new RoleValue();
         rv.setRoleId(rid);
@@ -219,14 +219,14 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
         }
     }
 
-    private void seedAccountRoles() {
+    private void seedAccountRoles() throws Exception {
         for (String tenantId : tenantAccounts.keySet()) {
             AccountValue av = (AccountValue) tenantAccounts.get(tenantId);
             seedAccountRole(tenantId, av.getUserId());
         }
     }
 
-    private void seedAccountRole(String tenantId, String userId) {
+    private void seedAccountRole(String tenantId, String userId) throws Exception {
         List<RoleValue> tenantRoleValues = new ArrayList<RoleValue>();
         tenantRoleValues.add(tenantRoles.get(tenantId));
         createAccountRole(tenantId, userAccounts.get(userId), tenantRoleValues);
@@ -235,14 +235,14 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
         }
     }
 
-    private void seedPermissionRoles() {
+    private void seedPermissionRoles() throws Exception {
         for (String tenantId : tenantPermissions.keySet()) {
             PermissionValue pv = tenantPermissions.get(tenantId);
             seedPermissionRole(tenantId, pv.getPermissionId());
         }
     }
 
-    private void seedPermissionRole(String tenantId, String permId) {
+    private void seedPermissionRole(String tenantId, String permId) throws Exception {
         List<RoleValue> tenantRoleValues = new ArrayList<RoleValue>();
         tenantRoleValues.add(tenantRoles.get(tenantId));
         PermissionValue pv = permValues.get(permId);
@@ -300,7 +300,7 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
         }
     }
 
-    private String create(String testName, String userName, String tenatnId) {
+    private String create(String testName, String userName, String tenatnId) throws Exception {
        String result = null;
        
         setupCreate();
@@ -499,7 +499,7 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
     // Utility methods used by tests above
     // ---------------------------------------------------------------
     @AfterClass(alwaysRun = true)
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         setupDelete();
         String noTest = System.getProperty("noTestCleanup");
         if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
@@ -523,7 +523,7 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
         deleteAccounts();
     }
 
-    private void deletePermissionRoles() {
+    private void deletePermissionRoles() throws Exception {
         for (String tenantId : tenantPermissions.keySet()) {
             List<RoleValue> tenantRoleValues = new ArrayList<RoleValue>();
             tenantRoleValues.add(tenantRoles.get(tenantId));
@@ -532,7 +532,7 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
         }
     }
 
-    private void deleteAccountRoles() {
+    private void deleteAccountRoles() throws Exception {
         for (String tenantId : tenantAccounts.keySet()) {
             List<RoleValue> tenantRoleValues = new ArrayList<RoleValue>();
             tenantRoleValues.add(tenantRoles.get(tenantId));
@@ -541,21 +541,21 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
         }
     }
 
-    private void deletePermissions() {
+    private void deletePermissions() throws Exception {
         for (String tenantId : tenantPermissions.keySet()) {
             PermissionValue pv = tenantPermissions.get(tenantId);
             deletePermission(tenantId, pv.getPermissionId());
         }
     }
 
-    private void deleteRoles() {
+    private void deleteRoles() throws Exception {
         for (String tenantId : tenantRoles.keySet()) {
             RoleValue rv = tenantRoles.get(tenantId);
             deleteRole(tenantId, rv.getRoleId());
         }
     }
 
-    private void deleteAccounts() {
+    private void deleteAccounts() throws Exception {
         for (String tenantId : tenantAccounts.keySet()) {
             AccountValue av = tenantAccounts.get(tenantId);
             deleteAccount(tenantId, av.getAccountId());
@@ -563,7 +563,7 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
     }
 
     private String createPermission(String tenantId, String resName,
-            List<PermissionAction> actions, EffectType effect) {
+            List<PermissionAction> actions, EffectType effect) throws Exception {
        String result = null;
        
         setupCreate();
@@ -587,7 +587,7 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
         return result;
     }
 
-    private void deletePermission(String tenantId, String permId) {
+    private void deletePermission(String tenantId, String permId) throws Exception {
         setupDelete();
         PermissionClient permClient = new PermissionClient();
         UserInfo ui = tenantAdminUsers.get(tenantId);
@@ -602,7 +602,7 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
         }
     }
 
-    private String createRole(String tenantId, String roleName) {
+    private String createRole(String tenantId, String roleName) throws Exception {
        String result = null;
        
         setupCreate();
@@ -626,7 +626,7 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
         return result;
     }
 
-    private void deleteRole(String tenantId, String roleId) {
+    private void deleteRole(String tenantId, String roleId) throws Exception {
         setupDelete();
         RoleClient roleClient = new RoleClient();
         UserInfo ui = tenantAdminUsers.get(tenantId);
@@ -641,7 +641,7 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
         }
     }
 
-    private String createAccount(String tenantId, String userName, String email) {
+    private String createAccount(String tenantId, String userName, String email) throws Exception {
        String result = null;
        
         setupCreate();
@@ -664,7 +664,7 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
         return result;
     }
 
-    private void deleteAccount(String tenantId, String accId) {
+    private void deleteAccount(String tenantId, String accId) throws Exception {
         setupDelete();
         AccountClient accClient = new AccountClient();
         UserInfo ui = tenantAdminUsers.get(tenantId);
@@ -680,7 +680,7 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
     }
 
     private String createAccountRole(String tenantId, AccountValue av,
-            Collection<RoleValue> rvs) {
+            Collection<RoleValue> rvs) throws Exception {
        String result = null;
        
         setupCreate();
@@ -704,7 +704,7 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
     }
 
     private void deleteAccountRole(String tenantId, AccountValue av,
-            List<RoleValue> rvs) {
+            List<RoleValue> rvs) throws Exception {
         // Perform setup.
         setupDelete();
 
@@ -725,7 +725,7 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
     }
 
     private String createPermissionRole(String tenantId, PermissionValue pv,
-            Collection<RoleValue> rvs) {
+            Collection<RoleValue> rvs) throws Exception {
        String result = null;
        
         setupCreate();
@@ -749,7 +749,7 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
         return result;
     }
 
-    private void deletePermissionRole(String tenantId, PermissionValue pv, List<RoleValue> rvls) {
+    private void deletePermissionRole(String tenantId, PermissionValue pv, List<RoleValue> rvls) throws Exception {
         // Perform setup.
         setupDelete();
 
index 09eb8e1ae35d03219193919e6f6d66d04dea2292..391b80953fe8a5e2e9a705c4b39e8044b9f5607a 100644 (file)
@@ -33,11 +33,11 @@ public class ServiceGroupClient extends AbstractCommonListPoxServiceClientImpl<S
        public static final String SERVICE_PATH_PROXY = SERVICE_PATH + "/";     
        public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME; 
 
-       public ServiceGroupClient() {
+       public ServiceGroupClient() throws Exception {
                super();
        }
 
-       public ServiceGroupClient(String clientPropertiesFilename) {
+       public ServiceGroupClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
index 067d2e5997e72b8bb326ef16416f7fe7cb3b2a99..13715de7e94552fd9d5995fac89cdd6cb9f0dca1 100644 (file)
@@ -33,6 +33,7 @@ import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.servicegroup.ServicegroupsCommon;
 
 import javax.ws.rs.core.Response;
+
 import org.testng.Assert;
 import org.testng.annotations.Test;
 import org.slf4j.Logger;
@@ -61,12 +62,12 @@ public class ServiceGroupServiceTest extends BaseServiceTest<AbstractCommonList>
        }
     
     @Override
-    protected CollectionSpaceClient<AbstractCommonList, PoxPayloadOut, String, ServiceGroupProxy> getClientInstance() {
+    protected CollectionSpaceClient<AbstractCommonList, PoxPayloadOut, String, ServiceGroupProxy> getClientInstance() throws Exception {
         return new ServiceGroupClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new ServiceGroupClient(clientPropertiesFilename);
        }
 
index 1e5841a34b2c102c60d017224edfb8df41711e01..76e9a9b875800c62b4b8a3778df7f8a04bd4f615 100644 (file)
@@ -55,11 +55,11 @@ public class TaxonomyAuthorityClient extends AuthorityClientImpl<Taxonomyauthori
     //
     // Constructors
     //
-    public TaxonomyAuthorityClient() {
+    public TaxonomyAuthorityClient() throws Exception {
        super();
     }
     
-    public TaxonomyAuthorityClient(String clientPropertiesFilename) {
+    public TaxonomyAuthorityClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
     
index f35c152e377daef36149bc8c76dc2ba11187ebfb..1e3f4a27c36146c93720c9a29a680b46daa49e1b 100644 (file)
@@ -36,7 +36,6 @@ import org.collectionspace.services.client.TaxonomyAuthorityClient;
 import org.collectionspace.services.client.TaxonomyAuthorityClientUtils;
 import org.collectionspace.services.client.TaxonomyAuthorityProxy;
 import org.collectionspace.services.jaxb.AbstractCommonList;
-
 import org.collectionspace.services.taxonomy.CommonNameGroup;
 import org.collectionspace.services.taxonomy.CommonNameGroupList;
 import org.collectionspace.services.taxonomy.TaxonAuthorGroup;
@@ -112,12 +111,12 @@ public class TaxonomyAuthorityServiceTest extends AbstractAuthorityServiceTest<T
      * org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient<AbstractCommonList, PoxPayloadOut, String, TaxonomyAuthorityProxy> getClientInstance() {
+    protected CollectionSpaceClient<AbstractCommonList, PoxPayloadOut, String, TaxonomyAuthorityProxy> getClientInstance() throws Exception {
         return new TaxonomyAuthorityClient();
     }
 
        @Override
-       protected CollectionSpaceClient<AbstractCommonList, PoxPayloadOut, String, TaxonomyAuthorityProxy> getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient<AbstractCommonList, PoxPayloadOut, String, TaxonomyAuthorityProxy> getClientInstance(String clientPropertiesFilename) throws Exception {
         return new TaxonomyAuthorityClient(clientPropertiesFilename);
        }
        
@@ -280,9 +279,10 @@ public class TaxonomyAuthorityServiceTest extends AbstractAuthorityServiceTest<T
      * 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.
+     * @throws Exception 
      */
     @AfterClass(alwaysRun = true)
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
         String noTest = System.getProperty("noTestCleanup");
         if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
             if (logger.isDebugEnabled()) {
index a69f8b0d6a4d7e2ddc5ccb2cbf61fc7740639911..71519cbedbedcc9c4bf5155bc8ef087d846d1e70 100644 (file)
@@ -29,11 +29,11 @@ public class ValuationcontrolClient extends AbstractCommonListPoxServiceClientIm
     public static final String SERVICE_PATH_PROXY = SERVICE_PATH + "/";
     public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME;
 
-    public ValuationcontrolClient() {
+    public ValuationcontrolClient() throws Exception {
                super();
        }
 
-    public ValuationcontrolClient(String clientPropertiesFilename) {
+    public ValuationcontrolClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
 
index f9251bd492896898ec9becd725bb0bd68636c733..526d6c86df7df51c25a493899d6ae0078464f0ac 100644 (file)
@@ -33,6 +33,7 @@ import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.valuationcontrol.ValuationcontrolsCommon;
 
 import javax.ws.rs.core.Response;
+
 import org.testng.Assert;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -52,12 +53,12 @@ public class ValuationcontrolServiceTest extends AbstractPoxServiceTestImpl<Abst
     final String SERVICE_PATH_COMPONENT = "valuationcontrols";
 
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new ValuationcontrolClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new ValuationcontrolClient(clientPropertiesFilename);
        }
        
@@ -619,7 +620,7 @@ public class ValuationcontrolServiceTest extends AbstractPoxServiceTestImpl<Abst
     }
 
     @Override
-    protected PoxPayloadOut createInstance(String identifier) {
+    protected PoxPayloadOut createInstance(String identifier) throws Exception {
         return createValuationcontrolInstance(identifier);
     }
 
@@ -638,8 +639,9 @@ public class ValuationcontrolServiceTest extends AbstractPoxServiceTestImpl<Abst
      *
      * @param valuationcontrolRefNumber the valuationcontrol number
      * @return the multipart output
+     * @throws Exception 
      */
-    private PoxPayloadOut createValuationcontrolInstance(String valuationcontrolRefNumber) {
+    private PoxPayloadOut createValuationcontrolInstance(String valuationcontrolRefNumber) throws Exception {
 
         ValuationcontrolsCommon valuationcontrolCommon = new ValuationcontrolsCommon();
         valuationcontrolCommon.setValuationcontrolRefNumber(valuationcontrolRefNumber);
@@ -665,7 +667,7 @@ public class ValuationcontrolServiceTest extends AbstractPoxServiceTestImpl<Abst
 
     @Override
     protected PoxPayloadOut createInstance(String commonPartName,
-            String identifier) {
+            String identifier) throws Exception {
         PoxPayloadOut result = createValuationcontrolInstance(identifier);
         return result;
     }
index af335dabbfe4d29884e201f8c67097fbd5b092db..43b562ab257d91556aab7a534a3ddee5d0aea374 100644 (file)
@@ -53,11 +53,11 @@ public class VocabularyClient extends AuthorityClientImpl<VocabulariesCommon, Vo
     //
     // Constructors
     //
-    public VocabularyClient() {
+    public VocabularyClient() throws Exception {
        super();
     }
     
-    public VocabularyClient(String clientPropertiesFilename) {
+    public VocabularyClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
     
index 07d3a0641caf5a7e181b8aef98ce040d076b145c..a81f5d56d086282274dbe7d26edeca423ace9355 100644 (file)
@@ -76,12 +76,12 @@ public class VocabularyServiceTest extends AbstractAuthorityServiceTest<Vocabula
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new VocabularyClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new VocabularyClient(clientPropertiesFilename);
        }
     
@@ -311,7 +311,7 @@ public class VocabularyServiceTest extends AbstractAuthorityServiceTest<Vocabula
        }
     
     @Override
-    protected PoxPayloadOut createInstance(String identifier) {
+    protected PoxPayloadOut createInstance(String identifier) throws Exception {
        VocabularyClient client = new VocabularyClient();
         return createInstance(client.getCommonPartName(), identifier);
     }    
@@ -343,7 +343,7 @@ public class VocabularyServiceTest extends AbstractAuthorityServiceTest<Vocabula
     //
 
     @Override
-    protected PoxPayloadOut createItemInstance(String parentCsid, String identifier) {
+    protected PoxPayloadOut createItemInstance(String parentCsid, String identifier) throws Exception {
        String headerLabel = new VocabularyClient().getItemCommonPartName();
         HashMap<String, String> vocabItemInfo = new HashMap<String, String>();
         String shortId = identifier;
@@ -396,7 +396,7 @@ public class VocabularyServiceTest extends AbstractAuthorityServiceTest<Vocabula
        
     @AfterClass(alwaysRun = true)
     @Override
-    public void cleanUp() {
+    public void cleanUp() throws Exception {
        super.cleanUp();
     }  
 }
index 4c1d84183d38451691598e2412b4ebf3bdb20654..0209e4c2743669eb7a0b551146a63b8d9a5f1992 100644 (file)
@@ -44,11 +44,11 @@ public class WorkAuthorityClient extends AuthorityClientImpl<WorkauthoritiesComm
     //
     // Constructors
     //
-    public WorkAuthorityClient() {
+    public WorkAuthorityClient() throws Exception {
        super();
     }
     
-    public WorkAuthorityClient(String clientPropertiesFilename) {
+    public WorkAuthorityClient(String clientPropertiesFilename) throws Exception {
                super(clientPropertiesFilename);
        }
     
index 9db7ed5f65b8bc6a3b83e02f4b3488e10e8cf2b0..3c324a3882c414d9663fd95933e804d82f03aa84 100644 (file)
@@ -43,7 +43,6 @@ import org.collectionspace.services.work.WorkTermGroup;
 import org.collectionspace.services.work.WorkTermGroupList;
 import org.collectionspace.services.work.WorkauthoritiesCommon;
 import org.collectionspace.services.work.WorksCommon;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
@@ -107,12 +106,12 @@ public class WorkAuthorityServiceTest extends AbstractAuthorityServiceTest<Worka
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new WorkAuthorityClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new WorkAuthorityClient(clientPropertiesFilename);
        }
 
@@ -255,10 +254,11 @@ public class WorkAuthorityServiceTest extends AbstractAuthorityServiceTest<Worka
      * 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.
+     * @throws Exception 
      */
 
     @AfterClass(alwaysRun=true)
-       public void cleanUp() {
+       public void cleanUp() throws Exception {
                String noTest = System.getProperty("noTestCleanup");
                if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
                        if (logger.isDebugEnabled()) {
index 61f858207e38e1cbfa4acab124c654545b0a2a5b..d81b63a4c7e15cd22ba8bf4fa33475ae40477995 100644 (file)
@@ -60,12 +60,12 @@ public class WorkflowServiceTest extends AbstractPoxServiceTestImpl<AbstractComm
        }
     
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient getClientInstance() throws Exception {
         return new DimensionClient();
     }
 
        @Override
-       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+       protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
         return new DimensionClient(clientPropertiesFilename);
        }
 
@@ -166,7 +166,7 @@ public class WorkflowServiceTest extends AbstractPoxServiceTestImpl<AbstractComm
     // ---------------------------------------------------------------
     
     @Override
-    protected PoxPayloadOut createInstance(String identifier) {
+    protected PoxPayloadOut createInstance(String identifier) throws Exception {
         String dimensionsCommonPartName = new DimensionClient().getCommonPartName();
        return createInstance(identifier, dimensionsCommonPartName);
     }    
@@ -180,7 +180,7 @@ public class WorkflowServiceTest extends AbstractPoxServiceTestImpl<AbstractComm
        /*
         * We're using a DimensionsCommon instance to test the workflow service.
         */
-    private PoxPayloadOut createDimensionInstance(String dimensionValue) {
+    private PoxPayloadOut createDimensionInstance(String dimensionValue) throws Exception {
         String commonPartName = new DimensionClient().getCommonPartName();
         return createDimensionInstance(commonPartName, dimensionValue);
     }