]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-3770: Adding "wf_deleted" query param on GET for most services. If wf_deleted...
authorRichard Millet <richard.millet@berkeley.edu>
Mon, 11 Apr 2011 01:52:06 +0000 (01:52 +0000)
committerRichard Millet <richard.millet@berkeley.edu>
Mon, 11 Apr 2011 01:52:06 +0000 (01:52 +0000)
27 files changed:
services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionServiceTest.java
services/acquisition/service/src/main/java/org/collectionspace/services/acquisition/AcquisitionResource.java
services/authority/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java
services/blob/client/src/test/java/org/collectionspace/services/client/test/BlobServiceTest.java
services/client/src/main/java/org/collectionspace/services/client/AbstractPoxServiceClientImpl.java
services/client/src/main/java/org/collectionspace/services/client/CollectionSpacePoxClient.java
services/client/src/main/java/org/collectionspace/services/client/CollectionSpacePoxProxy.java
services/client/src/main/java/org/collectionspace/services/client/test/AbstractServiceTestImpl.java
services/collectionobject/service/src/main/java/org/collectionspace/services/collectionobject/CollectionObjectResource.java
services/common/src/main/java/org/collectionspace/services/common/ResourceBase.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java
services/contact/client/src/test/java/org/collectionspace/services/client/test/ContactServiceTest.java
services/contact/service/src/main/java/org/collectionspace/services/contact/ContactResource.java
services/dimension/client/src/test/java/org/collectionspace/services/client/test/DimensionServiceTest.java
services/intake/service/src/main/java/org/collectionspace/services/intake/IntakeResource.java
services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninServiceTest.java
services/loanin/service/src/main/java/org/collectionspace/services/loanin/LoaninResource.java
services/loanout/client/src/test/java/org/collectionspace/services/client/test/LoanoutServiceTest.java
services/loanout/service/src/main/java/org/collectionspace/services/loanout/LoanoutResource.java
services/location/client/src/test/java/org/collectionspace/services/client/test/LocationAuthorityServiceTest.java
services/media/client/src/test/java/org/collectionspace/services/client/test/MediaServiceTest.java
services/movement/service/src/main/java/org/collectionspace/services/movement/MovementResource.java
services/objectexit/client/src/test/java/org/collectionspace/services/client/test/ObjectExitServiceTest.java
services/report/client/src/test/java/org/collectionspace/services/client/test/ReportServiceTest.java
services/report/service/src/main/java/org/collectionspace/services/report/ReportResource.java
services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java
services/workflow/client/src/test/java/org/collectionspace/services/client/test/WorkflowServiceTest.java

index 799678179101163fa77ee23b3e8de9c38ab51d81..9c9b4349a957bb4bd966c53dd11cd68f167a11ff 100644 (file)
@@ -35,14 +35,10 @@ import org.collectionspace.services.jaxb.AbstractCommonList;
 
 import org.collectionspace.services.acquisition.AcquisitionsCommon;
 import org.collectionspace.services.acquisition.AcquisitionDateList;
-import org.collectionspace.services.acquisition.AcquisitionFunding;
-import org.collectionspace.services.acquisition.AcquisitionFundingList;
 import org.collectionspace.services.acquisition.AcquisitionSourceList;
 import org.collectionspace.services.acquisition.OwnerList;
 import org.jboss.resteasy.client.ClientResponse;
-import org.collectionspace.services.jaxb.AbstractCommonList;
 
-import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
@@ -792,6 +788,11 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
     // Utility methods used by tests above
     // ---------------------------------------------------------------
 
+    @Override
+    protected PoxPayloadOut createInstance(String identifier) {
+       return createAcquisitionInstance(identifier);
+    }
+        
     /**
      * Creates the acquisition instance.
      *
index 2351e2dd043068a5606d81ff421519023200359f..16759e3983c02bce5a85cfd97f7225f8d25f93f0 100644 (file)
@@ -170,6 +170,7 @@ public class AcquisitionResource
     @GET
     @Path("{csid}")
     public byte[] getAcquisition(
+               @Context UriInfo ui,
             @PathParam("csid") String csid) {
         if (logger.isDebugEnabled()) {
             logger.debug("getAcquisition with csid=" + csid);
@@ -182,7 +183,8 @@ public class AcquisitionResource
         }
         PoxPayloadOut result = null;
         try {
-            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext();
+            MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(queryParams);
             DocumentHandler handler = createDocumentHandler(ctx);
             getRepositoryClient(ctx).get(ctx, csid, handler);
             result = ctx.getOutput();
index a5fce2fe39c0bdd83da77812d7455c84654a35a7..85caae4eaec6a5f3084dc3e861593b59c6dd5b53 100644 (file)
@@ -259,11 +259,14 @@ public abstract class AuthorityResource<AuthCommon, AuthCommonList, AuthItemComm
         */
        @GET
        @Path("{csid}")
-       public byte[] getAuthority(@PathParam("csid") String specifier) {
+       public byte[] getAuthority(
+               @Context UriInfo ui,
+                       @PathParam("csid") String specifier) {
                PoxPayloadOut result = null;
                try {
+            MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
                        Specifier spec = getSpecifier(specifier, "getAuthority", "GET");
-                       ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext();
+                       ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(queryParams);
                        DocumentHandler handler = createDocumentHandler(ctx);
                        if(spec.form == SpecifierForm.CSID) {
                                if (logger.isDebugEnabled()) {
index e78a1ca66e1992380441fdc537c48c651c89f3c4..b9c732cb00464f82685a0dac47437e2bbc1a0e78 100644 (file)
@@ -29,6 +29,7 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
 
+import org.collectionspace.services.client.BlobProxy;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.BlobClient;
 import org.collectionspace.services.client.PayloadOutputPart;
@@ -71,7 +72,7 @@ public class BlobServiceTest extends AbstractServiceTestImpl {
        }
     
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient<AbstractCommonList, BlobProxy> getClientInstance() {
         return new BlobClient();
     }
 
@@ -336,6 +337,12 @@ public class BlobServiceTest extends AbstractServiceTestImpl {
     // ---------------------------------------------------------------
     // Utility methods used by tests above
     // ---------------------------------------------------------------
+    
+    @Override
+    protected PoxPayloadOut createInstance(String identifier) {
+       return createBlobInstance(identifier);
+    }    
+    
     private PoxPayloadOut createBlobInstance(String exitNumber) {
         String identifier = "blobNumber-" + exitNumber;
         BlobsCommon blob = new BlobsCommon();
index 7224d5039498087ebc9ed09e3b438a38b9be693e..5b59e3630f35c93b44c742436f491fac00d0b4ff 100644 (file)
@@ -22,6 +22,11 @@ public abstract class AbstractPoxServiceClientImpl<LT extends AbstractCommonList
         return getProxy().read(csid);\r
     }\r
 \r
+    @Override\r
+       public ClientResponse<String> readIncludeDeleted(String csid, Boolean includeDeleted) {\r
+        return getProxy().readIncludeDeleted(csid, includeDeleted.toString());\r
+    }\r
+\r
     @Override\r
     public ClientResponse<String> update(String csid, PoxPayloadOut xmlPayload) {\r
         return getProxy().update(csid, xmlPayload.getBytes());\r
index a0dbb2fbca8612c6c1ca4d02c1a6b8c3f15625e4..060b8d2e3e983afa078f3ef5f7216124c119da8c 100644 (file)
@@ -15,10 +15,18 @@ public interface CollectionSpacePoxClient<LT extends AbstractCommonList, P exten
         * Common service calls\r
         */\r
        public ClientResponse<Response> create(PoxPayloadOut xmlPayload);\r
-               \r
+       \r
+       /*\r
+        * GET resource with workflow 'deleted' state\r
+        */\r
     public ClientResponse<String> read(String csid);\r
+    \r
+    public ClientResponse<String> readIncludeDeleted(String csid, Boolean includeDeleted);    \r
 \r
     public ClientResponse<String> update(String csid, PoxPayloadOut xmlPayload);\r
     \r
+    /*\r
+     * GET list with workflow 'deleted' state\r
+     */\r
     public ClientResponse<LT> readIncludeDeleted(Boolean includeDeleted);\r
 }\r
index bc1630a550ab72eb2e5060ac2e35c3c133f28f5a..79622d7d19d28420c374560b49301917307eab16 100644 (file)
@@ -23,6 +23,12 @@ public interface CollectionSpacePoxProxy<LT extends AbstractCommonList> extends
     @Path("/{csid}")\r
     ClientResponse<String> read(@PathParam("csid") String csid);\r
 \r
+    //(R)ead\r
+    @GET\r
+    @Path("/{csid}")\r
+    ClientResponse<String> readIncludeDeleted(@PathParam("csid") String csid,\r
+               @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);\r
+\r
     //(U)pdate\r
     @PUT\r
     @Path("/{csid}")\r
index 1fde7f6a03df72cfa00d01bb79246790b6ed5bb6..dead5ac26590979e4c28f3c2e10c431c2c5933e1 100644 (file)
@@ -655,14 +655,7 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements
         Assert.assertEquals(updatedWorkflowCommons.getCurrentLifeCycleState(), lifeCycleState);
     }
     
-       protected long readIncludeDeleted(String testName, Boolean includeDeleted) {
-               long result = 0;
-        // Perform setup.
-        setupReadList();
-
-        //
-        // Check to see if we have a POX client
-        //
+    private CollectionSpacePoxClient assertPoxCandidate() {
         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";
@@ -674,11 +667,18 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements
                logger.warn(msg);
                throw new UnsupportedOperationException();
         }
-        
+        return (CollectionSpacePoxClient)clientCandidate;
+    }
+    
+       protected long readIncludeDeleted(String testName, Boolean includeDeleted) {
+               long result = 0;
+        // Perform setup.
+        setupReadList();
+
         //
         // Ask for a list of all resources filtered by the incoming 'includeDeleted' workflow param
         //
-        CollectionSpacePoxClient client = (CollectionSpacePoxClient)clientCandidate;
+        CollectionSpacePoxClient client = assertPoxCandidate();
         ClientResponse<AbstractCommonList> res = client.readIncludeDeleted(includeDeleted);
         AbstractCommonList list = res.getEntity();
         int statusCode = res.getStatus();
@@ -738,6 +738,15 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements
                //
                long updatedTotal = readIncludeDeleted(testName, Boolean.FALSE);
                Assert.assertEquals(updatedTotal, existingRecords + OBJECTS_TO_CREATE - 1, "Deleted items seem to be returned in list results.");
+               
+               //
+               // Next, test that a GET with WorkflowClient.WORKFLOWSTATE_DELETED query param set to 'false' returns a 404
+               //
+               CollectionSpacePoxClient client = this.assertPoxCandidate();
+            ClientResponse<String> res = client.readIncludeDeleted(csid, Boolean.FALSE);
+            int result = res.getStatus();
+            Assert.assertEquals(result, STATUS_NOT_FOUND);
+            
        } catch (UnsupportedOperationException e) {
                logger.warn(this.getClass().getName() + " did not implement createWorkflowTarget() method.  No workflow tests performed.");
                return;
@@ -772,7 +781,6 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements
     /*
      * Sub-classes must override for the workflow tests.
      */
-    
     protected PoxPayloadOut createInstance(String identifier) {
        logger.warn("Sub-class test clients should override this method");
        throw new UnsupportedOperationException();
index d7791c7b64208abbdc6f861245c5ffae3816179c..dacf30e4382b5b5c231fecb74d86c64665315758 100644 (file)
@@ -184,6 +184,7 @@ public class CollectionObjectResource
     @GET
     @Path("{csid}")
     public byte[] getCollectionObject(
+               @Context UriInfo ui,
             @PathParam("csid") String csid) {
         if (logger.isDebugEnabled()) {
             logger.debug("getCollectionObject with csid=" + csid);
@@ -197,7 +198,8 @@ public class CollectionObjectResource
         }
         PoxPayloadOut result = null;
         try {
-            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext();
+            MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(queryParams);
             DocumentHandler handler = createDocumentHandler(ctx);
             getRepositoryClient(ctx).get(ctx, csid, handler);
             result = ctx.getOutput();
index c6a43e101f83368d20182b961c0441a44c338068..9b6e6f51f4b2bb0fae040e426cb48166cdf7c17f 100644 (file)
@@ -192,11 +192,14 @@ extends AbstractMultiPartCollectionSpaceResourceImpl {
 \r
     @GET\r
     @Path("{csid}")\r
-    public byte[] get(@PathParam("csid") String csid) {\r
+    public byte[] get(\r
+               @Context UriInfo ui,                    \r
+               @PathParam("csid") String csid) {\r
        PoxPayloadOut result = null;\r
         ensureCSID(csid, READ);\r
         try {\r
-               ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext();\r
+            MultivaluedMap<String, String> queryParams = ui.getQueryParameters();\r
+               ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(queryParams);\r
                result = get(csid, ctx);// ==> CALL implementation method, which subclasses may override.\r
             if (result == null) {\r
                 Response response = Response.status(Response.Status.NOT_FOUND).entity(\r
index 5324fab52204b8b8065e111c06c69d89779bec58..b4b8ff4eedd9bdba5c9dff60c3302c4f9bd40149 100644 (file)
@@ -93,7 +93,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
                //
                String currentState = docModel.getCurrentLifeCycleState();
                String includeDeletedStr = queryParams.getFirst(WorkflowClient.WORKFLOW_QUERY_NONDELETED);
-               boolean includeDeleted = Boolean.parseBoolean(includeDeletedStr);
+               boolean includeDeleted = includeDeletedStr == null ? true : Boolean.parseBoolean(includeDeletedStr);
                if (includeDeleted == false) {
                        //
                        // We don't wanted soft-deleted object, so throw an exception if this one is soft-deleted.
index b70255bc50ef83dc9436274376d6ce078925c004..3999e93e204874ea9181daae9a237d0fec9da2ed 100644 (file)
@@ -89,6 +89,14 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
         return response.getEntity(ContactsCommonList.class);
     }
 
+//    @Override
+//    protected PoxPayloadOut createInstance(String identifier) {
+//     ContactClient client = new ContactClient();
+//        PoxPayloadOut multipart =
+//            ContactClientUtils.createContactInstance(identifier, client.getCommonPartName());
+//        return multipart;
+//    }
+        
     // ---------------------------------------------------------------
     // CRUD tests : CREATE tests
     // ---------------------------------------------------------------
index 774b19ba0f8ddb38fd328b1333331311c1c9833f..c4be6619dc348e991dc509eb949602cc1b437084 100644 (file)
@@ -152,6 +152,7 @@ public class ContactResource extends
     @GET
     @Path("{csid}")
     public String getContact(
+               @Context UriInfo ui,
             @PathParam("csid") String csid) {
         if (logger.isDebugEnabled()) {
             logger.debug("getContact with csid=" + csid);
@@ -165,7 +166,8 @@ public class ContactResource extends
         }
         PoxPayloadOut result = null;
         try {
-            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext();
+            MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(queryParams);
             DocumentHandler handler = createDocumentHandler(ctx);
             getRepositoryClient(ctx).get(ctx, csid, handler);
             result = ctx.getOutput();
index b66866c7abeee213309aa2b6d7af640bd6cdd59b..ad2878bd3efeedb1c9d60c46ae9bac61f5c9c294 100644 (file)
@@ -627,7 +627,7 @@ public class DimensionServiceTest extends AbstractServiceTestImpl {
      */
     @Override
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
+    dependsOnMethods = {"create", "readList", "testSubmitRequest", "update", "readWorkflow"})
     public void delete(String testName) throws Exception {
 
         if (logger.isDebugEnabled()) {
@@ -720,6 +720,12 @@ public class DimensionServiceTest extends AbstractServiceTestImpl {
         return DimensionClient.SERVICE_PATH_COMPONENT;
     }
 
+    @Override
+    protected PoxPayloadOut createInstance(String identifier) {
+       DimensionClient client = new DimensionClient();
+       return createDimensionInstance(client.getCommonPartName(), identifier);
+    }
+    
     /**
      * Creates the dimension instance.
      *
@@ -758,52 +764,52 @@ public class DimensionServiceTest extends AbstractServiceTestImpl {
         return multipart;
     }
        
-       @Override
-    protected String createTestObject(String testName) throws Exception {
-               String result = null;
-               
-        DimensionClient client = new DimensionClient();
-        String identifier = createIdentifier();
-        PoxPayloadOut multipart = createDimensionInstance(client.getCommonPartName(),
-                identifier);
-        ClientResponse<Response> res = client.create(multipart);
-
-        int statusCode = res.getStatus();
-        Assert.assertEquals(statusCode, STATUS_CREATED);
-
-        result = extractId(res);
-        allResourceIdsCreated.add(result);
-
-        return result;
-       }
+//     @Override
+//    protected String createTestObject(String testName) throws Exception {
+//             String result = null;
+//             
+//        DimensionClient client = new DimensionClient();
+//        String identifier = createIdentifier();
+//        PoxPayloadOut multipart = createDimensionInstance(client.getCommonPartName(),
+//                identifier);
+//        ClientResponse<Response> res = client.create(multipart);
+//
+//        int statusCode = res.getStatus();
+//        Assert.assertEquals(statusCode, STATUS_CREATED);
+//
+//        result = extractId(res);
+//        allResourceIdsCreated.add(result);
+//
+//        return result;
+//     }
        
-       /*
-        * This test assumes that no objects exist yet.
-        * 
-        * http://localhost:8180/cspace-services/intakes?wf_deleted=false
-        */
-    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"update"})
-       public void readWorkflowList(String testName) throws Exception {
-       //
-       // Create 3 new objects
-       //
-       final int OBJECTS_TOTAL = 3;
-       for (int i = 0; i < OBJECTS_TOTAL; i++) {
-               this.createWorkflowTarget(testName);
-       }
-       //
-       // Mark one as soft deleted
-       //
-       int currentTotal = allResourceIdsCreated.size();
-       String csid = allResourceIdsCreated.get(currentTotal - 1); //0-based index to get the last one added
-       this.setupUpdate();
-       this.updateLifeCycleState(testName, csid, WorkflowClient.WORKFLOWSTATE_DELETED);
-       //
-       // Read the list back.  The deleted item should not be in the list
-       //
-//     int updatedTotal = readIncludeDeleted(testName, Boolean.FALSE);
-//     Assert.assertEquals(updatedTotal, currentTotal - 1, "Deleted items seem to be returned in list results.");
-       }
+//     /*
+//      * This test assumes that no objects exist yet.
+//      * 
+//      * http://localhost:8180/cspace-services/intakes?wf_deleted=false
+//      */
+//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"update"})
+//     public void readWorkflowList(String testName) throws Exception {
+//     //
+//     // Create 3 new objects
+//     //
+//     final int OBJECTS_TOTAL = 3;
+//     for (int i = 0; i < OBJECTS_TOTAL; i++) {
+//             this.createWorkflowTarget(testName);
+//     }
+//     //
+//     // Mark one as soft deleted
+//     //
+//     int currentTotal = allResourceIdsCreated.size();
+//     String csid = allResourceIdsCreated.get(currentTotal - 1); //0-based index to get the last one added
+//     this.setupUpdate();
+//     this.updateLifeCycleState(testName, csid, WorkflowClient.WORKFLOWSTATE_DELETED);
+//     //
+//     // Read the list back.  The deleted item should not be in the list
+//     //
+////           int updatedTotal = readIncludeDeleted(testName, Boolean.FALSE);
+////           Assert.assertEquals(updatedTotal, currentTotal - 1, "Deleted items seem to be returned in list results.");
+//     }
     
     protected void updateLifeCycleState(String testName, String resourceId, String lifeCycleState) throws Exception {
         //
index cd90ca77d1e36b7927bb88659975ac935c9553f5..1ee1dbee44d58b8812edce09cf4ebf6bce0b8bbb 100644 (file)
@@ -172,6 +172,7 @@ public class IntakeResource extends
     @GET
     @Path("{csid}")
     public byte[] getIntake(
+               @Context UriInfo ui,
             @PathParam("csid") String csid) {
         if (logger.isDebugEnabled()) {
             logger.debug("getIntake with csid=" + csid);
@@ -185,7 +186,8 @@ public class IntakeResource extends
         }
         PoxPayloadOut result = null;
         try {
-               ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext();
+            MultivaluedMap<String, String> queryParams = ui.getQueryParameters();              
+               ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(queryParams);
             DocumentHandler handler = createDocumentHandler(ctx);
             getRepositoryClient(ctx).get(ctx, csid, handler);
             result = ctx.getOutput();
index 0bf6b010af6f2906ada82f1ac5498a01cd2bdaea..b8595a3a1fe7d83689ab4123d2385e60f62a3471 100644 (file)
@@ -37,11 +37,9 @@ 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.collectionspace.services.loanin.LoansinCommonList;
 
 import org.jboss.resteasy.client.ClientResponse;
 import org.testng.Assert;
-//import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
 
 import org.slf4j.Logger;
@@ -797,6 +795,11 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
         return SERVICE_PATH_COMPONENT;
     }
 
+    @Override
+    protected PoxPayloadOut createInstance(String identifier) {
+       return createLoaninInstance(identifier);
+    }
+    
     /**
      * Creates the loanin instance.
      *
index 54dcd6931d0a6c3600fa24b88b8b507761de0a1f..256bd251e5560cead655b720a024743a86c47887 100644 (file)
@@ -180,6 +180,7 @@ public class LoaninResource extends
     @GET
     @Path("{csid}")
     public byte[] getLoanin(
+               @Context UriInfo ui,
             @PathParam("csid") String csid) {
         if (logger.isDebugEnabled()) {
             logger.debug("getLoanin with csid=" + csid);
@@ -193,7 +194,8 @@ public class LoaninResource extends
         }
         PoxPayloadOut result = null;
         try {
-            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext();
+            MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(queryParams);
             DocumentHandler handler = createDocumentHandler(ctx);
             getRepositoryClient(ctx).get(ctx, csid, handler);
             result = ctx.getOutput();
index 12b144b9429d7e1599d9456d883e18489fac7b13..bb3975981d63e55b2a55f4f91baf3b5336572499 100644 (file)
@@ -770,6 +770,11 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
         return LoanoutClient.SERVICE_PATH_COMPONENT;
     }
 
+    @Override
+    protected PoxPayloadOut createInstance(String identifier) {
+       return createLoanoutInstance(identifier);
+    }
+    
     /**
      * Creates the loanout instance.
      *
index 556ea41fbe7f0b3591612d51eacc7dc8fca9cb37..b27c484e1caa50b89b453ff43880eed35eabe099 100644 (file)
@@ -174,6 +174,7 @@ public class LoanoutResource extends
     @GET
     @Path("{csid}")
     public byte[] getLoanout(
+               @Context UriInfo ui,
             @PathParam("csid") String csid) {
         if (logger.isDebugEnabled()) {
             logger.debug("getLoanout with csid=" + csid);
@@ -187,7 +188,8 @@ public class LoanoutResource extends
         }
         PoxPayloadOut result = null;
         try {
-            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext();
+            MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(queryParams);
             DocumentHandler handler = createDocumentHandler(ctx);
             getRepositoryClient(ctx).get(ctx, csid, handler);
             result = ctx.getOutput();
index 0507a42769feafd6581809afd332a3153107d05e..81b3bababd5c2d38d42a73e55cf1905ca5db8657 100644 (file)
@@ -153,6 +153,18 @@ public class LocationAuthorityServiceTest extends AbstractServiceTestImpl { //FI
         return response.getEntity(LocationsCommonList.class);
     }
 
+    @Override
+    protected PoxPayloadOut createInstance(String identifier) {
+       LocationAuthorityClient client = new LocationAuthorityClient();
+        String shortId = createIdentifier();
+       String displayName = "displayName-" + shortId;
+       String baseRefName = LocationAuthorityClientUtils.createLocationAuthRefName(shortId, null);
+       PoxPayloadOut multipart = 
+            LocationAuthorityClientUtils.createLocationAuthorityInstance(
+           displayName, shortId, client.getCommonPartName());
+       return multipart;
+    }
+        
     // ---------------------------------------------------------------
     // CRUD tests : CREATE tests
     // ---------------------------------------------------------------
index 62f22858498cbc37a6eeb2c7ec8cd8ff09b42bfe..a3d87e112b1838b139e69b9ad12a92d3b46ad0da 100644 (file)
@@ -366,6 +366,12 @@ public class MediaServiceTest extends AbstractServiceTestImpl {
         Assert.assertEquals(statusCode, EXPECTED_STATUS);
     }
 
+    @Override
+    protected PoxPayloadOut createInstance(String identifier) {
+       return createMediaInstance(identifier);
+    }
+    
+    
     // ---------------------------------------------------------------
     // Utility methods used by tests above
     // ---------------------------------------------------------------
index ad709a4f71acc8f3d09a7158e0ebe8c2fb31362f..308d6ec717742fc16e943eab3107e4506923690b 100644 (file)
@@ -182,6 +182,7 @@ public class MovementResource extends AbstractMultiPartCollectionSpaceResourceIm
     @GET
     @Path("{csid}")
     public byte[] getMovement(
+               @Context UriInfo ui,
             @PathParam("csid") String csid) {
         if (logger.isDebugEnabled()) {
             logger.debug("getMovement with csid=" + csid);
@@ -194,7 +195,8 @@ public class MovementResource extends AbstractMultiPartCollectionSpaceResourceIm
         }
         PoxPayloadOut result = null;
         try {
-            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext();
+            MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(queryParams);
             DocumentHandler handler = createDocumentHandler(ctx);
             getRepositoryClient(ctx).get(ctx, csid, handler);
             result = ctx.getOutput();
index de4564317e44be21e073277cee11a5a48ebd7bc8..b886aedaedf1bcbe8b34a46e18db1557744ae7d6 100644 (file)
@@ -27,8 +27,8 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
 import org.collectionspace.services.client.CollectionSpaceClient;
-import org.collectionspace.services.client.ContactClient;
 import org.collectionspace.services.client.ObjectExitClient;
+import org.collectionspace.services.client.ObjectExitProxy;
 import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
@@ -37,7 +37,6 @@ import org.collectionspace.services.objectexit.ObjectexitCommon;
 
 import org.jboss.resteasy.client.ClientResponse;
 
-import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
@@ -67,7 +66,7 @@ public class ObjectExitServiceTest extends AbstractServiceTestImpl {
        }
     
     @Override
-    protected CollectionSpaceClient getClientInstance() {
+    protected CollectionSpaceClient<AbstractCommonList, ObjectExitProxy> getClientInstance() {
         return new ObjectExitClient();
     }
 
@@ -254,6 +253,13 @@ public class ObjectExitServiceTest extends AbstractServiceTestImpl {
     // ---------------------------------------------------------------
     // Utility methods used by tests above
     // ---------------------------------------------------------------
+    
+    @Override
+    protected PoxPayloadOut createInstance(String identifier) {
+       ObjectExitClient client = new ObjectExitClient();
+       return createObjectExitInstance(identifier);
+    }
+    
     private PoxPayloadOut createObjectExitInstance(String exitNumber) {
         String identifier = "objectexitNumber-" + exitNumber;
         ObjectexitCommon objectexit = new ObjectexitCommon();
index 3b5fbc9dd906eb38ed42065f1d0bb5eb6eb92dae..220a318d34a5af1b491f163b5d7d1f1574144f94 100644 (file)
@@ -80,6 +80,12 @@ public class ReportServiceTest extends AbstractServiceTestImpl {
         return response.getEntity(ReportsCommonList.class);
     }
 
+//    @Override
+//    protected PoxPayloadOut createInstance(String identifier) {
+//        PoxPayloadOut multipart = createReportInstance(identifier);
+//        return multipart;
+//    }
+        
     // ---------------------------------------------------------------
     // CRUD tests : CREATE tests
     // ---------------------------------------------------------------
@@ -469,7 +475,7 @@ public class ReportServiceTest extends AbstractServiceTestImpl {
      */
     @Override
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
-    dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
+    dependsOnMethods = {"create", "readList", "testSubmitRequest", "update", "readWorkflow"})
     public void delete(String testName) throws Exception {
 
         if (logger.isDebugEnabled()) {
index ae63afe19514e2e1aa70b4d3ee873612aa7b0aac..80db4a2be2e0905d311defca2467b018adbffbcd 100644 (file)
@@ -186,6 +186,7 @@ public class ReportResource extends
     @GET
     @Path("{csid}")
     public byte[] getReport(
+               @Context UriInfo ui,
             @PathParam("csid") String csid) {
         if (logger.isDebugEnabled()) {
             logger.debug("getReport with csid=" + csid);
@@ -199,7 +200,8 @@ public class ReportResource extends
         }
         PoxPayloadOut result = null;
         try {
-            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext();
+            MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(queryParams);
             DocumentHandler handler = createDocumentHandler(ctx);
             getRepositoryClient(ctx).get(ctx, csid, handler);
             result = ctx.getOutput();
index f5bc4b6b3f1805e455baa6a253e44dc2713bd74e..a65b361d85042ab99b95a2d3c5877eeea49853d2 100644 (file)
@@ -100,6 +100,16 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
         return response.getEntity(VocabulariesCommonList.class);
     }
 
+    @Override
+    protected PoxPayloadOut createInstance(String identifier) {
+       VocabularyClient client = new VocabularyClient();
+        String displayName = "displayName-" + identifier;
+        PoxPayloadOut multipart = VocabularyClientUtils.createEnumerationInstance(
+                displayName, identifier, client.getCommonPartName());
+        return multipart;
+    }
+    
+    
     // ---------------------------------------------------------------
     // CRUD tests : CREATE tests
     // ---------------------------------------------------------------
index 63e4967f78e6757eda19131e9687b6d4ddd3aa7a..5b42dc7f4b78527a7c68f9d5df9a2c7db45dda89 100644 (file)
@@ -78,57 +78,6 @@ public class WorkflowServiceTest extends AbstractServiceTestImpl {
         return response.getEntity(AbstractCommonList.class);
     }
 
-//    @Override
-//    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
-//    public void create(String testName) throws Exception {
-//        logger.debug(testBanner(testName, CLASS_NAME));
-//        setupCreate();
-//        WorkflowClient client = new WorkflowClient();
-//        PoxPayloadOut multipart = createObjectExitInstance(createIdentifier());
-//        ClientResponse<Response> res = client.create(multipart);
-//        assertStatusCode(res, testName);
-//        if (knownResourceId == null) {
-//            knownResourceId = extractId(res);  // Store the ID returned from the first resource created for additional tests below.
-//            logger.debug(testName + ": knownResourceId=" + knownResourceId);
-//        }
-//        allResourceIdsCreated.add(extractId(res)); // Store the IDs from every resource created by tests so they can be deleted after tests have been run.
-//    }
-    
-    
-    /*
-     * Create a Dimension instance to use as our test target.
-     */
-    @Override
-    protected String createWorkflowTarget(String testName) throws Exception {
-       String result = null;
-       
-       result = createTestObject(testName);
-       
-       return result;
-    }
-    
-    /*
-     * Create a Dimension instance to use as our test target.
-     */
-    protected String createTestObject(String testName) throws Exception {
-       String result = null;
-       
-       logger.debug(testBanner(testName, CLASS_NAME));
-       setupCreate();
-       DimensionClient client = new DimensionClient();
-       PoxPayloadOut multipart = createDimensionInstance(createIdentifier());
-       ClientResponse<Response> res = client.create(multipart);
-       assertStatusCode(res, testName);
-       if (knownResourceId == null) {
-               knownResourceId = extractId(res);  // Store the ID returned from the first resource created for additional tests below.
-               logger.debug(testName + ": knownResourceId=" + knownResourceId);
-       }
-       result = extractId(res);
-       allResourceIdsCreated.add(result); // Store the IDs from every resource created by tests so they can be deleted after tests have been run.
-       
-       return result;
-    }
-
     @Override
     public void createList(String testName) throws Exception {
        //empty N/A
@@ -274,6 +223,12 @@ public class WorkflowServiceTest extends AbstractServiceTestImpl {
     // ---------------------------------------------------------------
     // Utility methods used by tests above
     // ---------------------------------------------------------------
+    
+    @Override
+    protected PoxPayloadOut createInstance(String identifier) {
+       return createDimensionInstance(identifier);
+    }    
+    
     private PoxPayloadOut createDimensionInstance(String dimensionValue) {
         String value = "dimensionValue-" + dimensionValue;
         String dimensionsCommonPartName = new DimensionClient().getCommonPartName();
@@ -294,7 +249,10 @@ public class WorkflowServiceTest extends AbstractServiceTestImpl {
        @Override
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
        public void create(String testName) throws Exception {
-               this.createTestObject(testName);
+               String csid = this.createTestObject(testName);
+               if (this.knownResourceId == null) {
+                       this.knownResourceId = csid;
+               }
        }