From b704039fe604df96a4b96683e418d4dd490eb73a Mon Sep 17 00:00:00 2001 From: Richard Millet Date: Fri, 8 Apr 2011 21:51:04 +0000 Subject: [PATCH] CSPACE-3779, CSPACE-3770: Adding "wf_delete" workflow deleted query param. Also, moving sources to new authority module. --- services/JaxRsServiceProvider/pom.xml | 6 + .../services/client/AccountProxy.java | 8 +- .../services/client/AccountRoleProxy.java | 2 +- .../client/test/AccountServiceTest.java | 3 +- services/acquisition/client/pom.xml | 6 + .../services/client/AcquisitionProxy.java | 8 + .../services/client/PermissionProxy.java | 2 +- .../services/client/PermissionRoleProxy.java | 2 +- .../services/client/RolePermissionProxy.java | 2 +- .../services/client/RoleProxy.java | 2 +- services/blob/client/pom.xml | 6 + services/build.xml | 3 + .../client/AbstractPoxServiceClientImpl.java | 6 + .../client/AbstractServiceClientImpl.java | 2 +- .../client/CollectionSpaceClient.java | 2 +- .../client/CollectionSpacePoxClient.java | 2 + .../client/CollectionSpacePoxProxy.java | 2 +- .../services/client/CollectionSpaceProxy.java | 4 +- .../services/client/TestServiceProxy.java | 2 +- .../client/test/AbstractServiceTestImpl.java | 152 ++++++++++++++++-- services/collectionobject/client/pom.xml | 6 + .../client/CollectionObjectClient.java | 1 + .../client/CollectionObjectProxy.java | 7 + .../test/CollectionObjectServiceTest.java | 6 + .../collectionspace/tenant-bindings.xml | 3 + .../common/vocabulary/RefNameUtils.java | 0 .../nuxeo/WorkflowDocumentModelHandler.java | 8 +- .../client/java/RepositoryJavaClientImpl.java | 39 ++++- services/contact/service/pom.xml | 6 + .../services/client/DimensionClient.java | 7 +- .../client/test/DimensionServiceTest.java | 9 -- .../services/dimension/DimensionResource.java | 4 +- .../services/client/IdProxy.java | 2 +- services/intake/client/pom.xml | 6 + .../services/client/IntakeProxy.java | 8 + .../client/test/IntakeServiceTest.java | 9 +- .../services/client/LoaninProxy.java | 8 + services/loanin/pom.xml | 9 ++ services/loanout/client/pom.xml | 6 + .../client/LocationAuthorityProxy.java | 7 + services/location/pom.xml | 9 ++ services/media/client/pom.xml | 6 + services/movement/client/pom.xml | 6 + .../services/client/MovementProxy.java | 7 + .../client/test/MovementServiceTest.java | 3 +- services/note/client/pom.xml | 6 + .../services/client/NoteProxy.java | 2 +- services/objectexit/client/pom.xml | 6 + .../services/client/ObjectExitProxy.java | 8 + services/organization/client/pom.xml | 6 + services/organization/jaxb/pom.xml | 6 + services/organization/service/pom.xml | 6 + services/person/pom.xml | 9 ++ services/pom.xml | 1 + services/report/service/pom.xml | 6 + services/vocabulary/client/pom.xml | 6 + services/vocabulary/pom.xml | 9 ++ .../client/test/WorkflowServiceTest.java | 65 +------- 58 files changed, 410 insertions(+), 130 deletions(-) rename services/{authority => common}/src/main/java/org/collectionspace/services/common/vocabulary/RefNameUtils.java (100%) diff --git a/services/JaxRsServiceProvider/pom.xml b/services/JaxRsServiceProvider/pom.xml index c3a862683..5be05bf91 100644 --- a/services/JaxRsServiceProvider/pom.xml +++ b/services/JaxRsServiceProvider/pom.xml @@ -50,6 +50,12 @@ test + + org.collectionspace.services + org.collectionspace.services.authority + true + ${project.version} + org.collectionspace.services org.collectionspace.services.authorization.service diff --git a/services/account/client/src/main/java/org/collectionspace/services/client/AccountProxy.java b/services/account/client/src/main/java/org/collectionspace/services/client/AccountProxy.java index 2988a7f94..dd13fe7c0 100644 --- a/services/account/client/src/main/java/org/collectionspace/services/client/AccountProxy.java +++ b/services/account/client/src/main/java/org/collectionspace/services/client/AccountProxy.java @@ -27,7 +27,6 @@ package org.collectionspace.services.client; import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; @@ -37,20 +36,17 @@ import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Response; - import org.collectionspace.services.account.AccountsCommon; import org.collectionspace.services.account.AccountsCommonList; import org.jboss.resteasy.client.ClientResponse; - - /** * @version $Revision:$ */ @Path("/accounts/") @Produces({"application/xml"}) @Consumes({"application/xml"}) -public interface AccountProxy extends CollectionSpaceProxy { +public interface AccountProxy extends CollectionSpaceProxy { @GET @Produces({"application/xml"}) @@ -72,5 +68,5 @@ public interface AccountProxy extends CollectionSpaceProxy { //(U)pdate @PUT @Path("/{csid}") - ClientResponse update(@PathParam("csid") String csid, AccountsCommon multipart); + ClientResponse update(@PathParam("csid") String csid, AccountsCommon multipart); } diff --git a/services/account/client/src/main/java/org/collectionspace/services/client/AccountRoleProxy.java b/services/account/client/src/main/java/org/collectionspace/services/client/AccountRoleProxy.java index d757d32aa..4ad266d31 100644 --- a/services/account/client/src/main/java/org/collectionspace/services/client/AccountRoleProxy.java +++ b/services/account/client/src/main/java/org/collectionspace/services/client/AccountRoleProxy.java @@ -46,7 +46,7 @@ import org.jboss.resteasy.client.ClientResponse; @Path("/accounts") @Produces({"application/xml"}) @Consumes({"application/xml"}) -public interface AccountRoleProxy extends CollectionSpaceProxy { +public interface AccountRoleProxy extends CollectionSpaceProxy { //(C)reate @POST diff --git a/services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountServiceTest.java b/services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountServiceTest.java index 9e75092ac..e0e96c801 100644 --- a/services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountServiceTest.java +++ b/services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountServiceTest.java @@ -99,7 +99,8 @@ public class AccountServiceTest extends AbstractServiceTestImpl { /* (non-Javadoc) * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readPaginatedList(java.lang.String) */ - @Test(dataProvider = "testName") + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, + dependsOnMethods = {"readList"}) @Override public void readPaginatedList(String testName) throws Exception { //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697 diff --git a/services/acquisition/client/pom.xml b/services/acquisition/client/pom.xml index 962a2619c..c79526a90 100644 --- a/services/acquisition/client/pom.xml +++ b/services/acquisition/client/pom.xml @@ -27,6 +27,12 @@ test + + org.collectionspace.services + org.collectionspace.services.authority + true + ${project.version} + org.collectionspace.services org.collectionspace.services.jaxb diff --git a/services/acquisition/client/src/main/java/org/collectionspace/services/client/AcquisitionProxy.java b/services/acquisition/client/src/main/java/org/collectionspace/services/client/AcquisitionProxy.java index db55b3b28..d6f676c51 100644 --- a/services/acquisition/client/src/main/java/org/collectionspace/services/client/AcquisitionProxy.java +++ b/services/acquisition/client/src/main/java/org/collectionspace/services/client/AcquisitionProxy.java @@ -4,7 +4,9 @@ import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import org.collectionspace.services.client.workflow.WorkflowClient; import org.collectionspace.services.jaxb.AbstractCommonList; import org.jboss.resteasy.client.ClientResponse; @@ -17,4 +19,10 @@ import org.jboss.resteasy.client.ClientResponse; public interface AcquisitionProxy extends CollectionSpacePoxProxy { @GET ClientResponse readList(); + + @Override + @GET + @Produces({"application/xml"}) + ClientResponse readIncludeDeleted( + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); } diff --git a/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/PermissionProxy.java b/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/PermissionProxy.java index dae1aa475..54eb5c43e 100644 --- a/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/PermissionProxy.java +++ b/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/PermissionProxy.java @@ -46,7 +46,7 @@ import org.jboss.resteasy.client.ClientResponse; @Path("/authorization/permissions") @Produces({"application/xml"}) @Consumes({"application/xml"}) -public interface PermissionProxy extends CollectionSpaceProxy { +public interface PermissionProxy extends CollectionSpaceProxy { @GET @Produces({"application/xml"}) diff --git a/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/PermissionRoleProxy.java b/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/PermissionRoleProxy.java index 8bbd98310..bfaa5a316 100644 --- a/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/PermissionRoleProxy.java +++ b/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/PermissionRoleProxy.java @@ -46,7 +46,7 @@ import org.jboss.resteasy.client.ClientResponse; @Path("/authorization/permissions") @Produces({"application/xml"}) @Consumes({"application/xml"}) -public interface PermissionRoleProxy extends CollectionSpaceProxy { +public interface PermissionRoleProxy extends CollectionSpaceProxy { //(C)reate @POST @Path("/{csid}/permroles") diff --git a/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/RolePermissionProxy.java b/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/RolePermissionProxy.java index 757a99ea9..08623912f 100644 --- a/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/RolePermissionProxy.java +++ b/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/RolePermissionProxy.java @@ -46,7 +46,7 @@ import org.jboss.resteasy.client.ClientResponse; @Path("/authorization/roles") @Produces({"application/xml"}) @Consumes({"application/xml"}) -public interface RolePermissionProxy extends CollectionSpaceProxy { +public interface RolePermissionProxy extends CollectionSpaceProxy { //(C)reate @POST diff --git a/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/RoleProxy.java b/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/RoleProxy.java index e6004143f..8360bee95 100644 --- a/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/RoleProxy.java +++ b/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/RoleProxy.java @@ -47,7 +47,7 @@ import org.jboss.resteasy.client.ClientResponse; @Path("/authorization/roles") @Produces({"application/xml"}) @Consumes({"application/xml"}) -public interface RoleProxy extends CollectionSpaceProxy { +public interface RoleProxy extends CollectionSpaceProxy { @GET @Produces({"application/xml"}) diff --git a/services/blob/client/pom.xml b/services/blob/client/pom.xml index 4beda62d2..ccf91ec6e 100644 --- a/services/blob/client/pom.xml +++ b/services/blob/client/pom.xml @@ -26,6 +26,12 @@ test + + org.collectionspace.services + org.collectionspace.services.authority + true + ${project.version} + org.collectionspace.services org.collectionspace.services.jaxb diff --git a/services/build.xml b/services/build.xml index d814e0b7b..b1176efc1 100644 --- a/services/build.xml +++ b/services/build.xml @@ -149,6 +149,7 @@ description="deploy services in ${jboss.server.cspace}"> + @@ -201,6 +202,7 @@ + @@ -215,6 +217,7 @@ description="create distribution for services"> + diff --git a/services/client/src/main/java/org/collectionspace/services/client/AbstractPoxServiceClientImpl.java b/services/client/src/main/java/org/collectionspace/services/client/AbstractPoxServiceClientImpl.java index a3b9f2dc4..7224d5039 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/AbstractPoxServiceClientImpl.java +++ b/services/client/src/main/java/org/collectionspace/services/client/AbstractPoxServiceClientImpl.java @@ -26,4 +26,10 @@ public abstract class AbstractPoxServiceClientImpl update(String csid, PoxPayloadOut xmlPayload) { return getProxy().update(csid, xmlPayload.getBytes()); } + + @Override + public ClientResponse readIncludeDeleted(Boolean includeDeleted) { + CollectionSpacePoxProxy proxy = getProxy(); + return proxy.readIncludeDeleted(includeDeleted.toString()); + } } diff --git a/services/client/src/main/java/org/collectionspace/services/client/AbstractServiceClientImpl.java b/services/client/src/main/java/org/collectionspace/services/client/AbstractServiceClientImpl.java index 84e01ee70..15f958f8e 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/AbstractServiceClientImpl.java +++ b/services/client/src/main/java/org/collectionspace/services/client/AbstractServiceClientImpl.java @@ -53,7 +53,7 @@ import org.slf4j.LoggerFactory; * @param * @param */ -public abstract class AbstractServiceClientImpl +public abstract class AbstractServiceClientImpl> implements CollectionSpaceClient { /** The logger. */ diff --git a/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceClient.java b/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceClient.java index b20be1d4d..68d6601e6 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceClient.java +++ b/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceClient.java @@ -32,7 +32,7 @@ import org.jboss.resteasy.client.ClientResponse; /** * */ -public interface CollectionSpaceClient { +public interface CollectionSpaceClient> { public static final String AUTH_PROPERTY = "cspace.auth"; public static final String PASSWORD_PROPERTY = "cspace.password"; diff --git a/services/client/src/main/java/org/collectionspace/services/client/CollectionSpacePoxClient.java b/services/client/src/main/java/org/collectionspace/services/client/CollectionSpacePoxClient.java index 71918c937..a0dbb2fbc 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/CollectionSpacePoxClient.java +++ b/services/client/src/main/java/org/collectionspace/services/client/CollectionSpacePoxClient.java @@ -19,4 +19,6 @@ public interface CollectionSpacePoxClient read(String csid); public ClientResponse update(String csid, PoxPayloadOut xmlPayload); + + public ClientResponse readIncludeDeleted(Boolean includeDeleted); } diff --git a/services/client/src/main/java/org/collectionspace/services/client/CollectionSpacePoxProxy.java b/services/client/src/main/java/org/collectionspace/services/client/CollectionSpacePoxProxy.java index 4518e3af8..bc1630a55 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/CollectionSpacePoxProxy.java +++ b/services/client/src/main/java/org/collectionspace/services/client/CollectionSpacePoxProxy.java @@ -13,7 +13,7 @@ import org.collectionspace.services.client.workflow.WorkflowClient; import org.collectionspace.services.jaxb.AbstractCommonList; import org.jboss.resteasy.client.ClientResponse; -public interface CollectionSpacePoxProxy extends CollectionSpaceProxy { +public interface CollectionSpacePoxProxy extends CollectionSpaceProxy { //(C)reate @POST ClientResponse create(byte[] payload); diff --git a/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceProxy.java b/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceProxy.java index fd1f667ba..df3b30ade 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceProxy.java +++ b/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceProxy.java @@ -46,7 +46,7 @@ import org.jboss.resteasy.client.ClientResponse; * The Interface CollectionSpaceProxy. * FIXME: http://issues.collectionspace.org/browse/CSPACE-1684 */ -public interface CollectionSpaceProxy { +public interface CollectionSpaceProxy { //(D)elete @DELETE @@ -87,7 +87,7 @@ public interface CollectionSpaceProxy { ClientResponse readList( @QueryParam(IClientQueryParams.PAGE_SIZE_PARAM) Long pageSize, @QueryParam(IClientQueryParams.START_PAGE_PARAM) Long pageNumber); - + /** * Read list. * @param sortBy diff --git a/services/client/src/main/java/org/collectionspace/services/client/TestServiceProxy.java b/services/client/src/main/java/org/collectionspace/services/client/TestServiceProxy.java index 2483ee826..2d3f53c44 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/TestServiceProxy.java +++ b/services/client/src/main/java/org/collectionspace/services/client/TestServiceProxy.java @@ -1,5 +1,5 @@ package org.collectionspace.services.client; -public interface TestServiceProxy extends CollectionSpaceProxy { +public interface TestServiceProxy extends CollectionSpaceProxy { } diff --git a/services/client/src/main/java/org/collectionspace/services/client/test/AbstractServiceTestImpl.java b/services/client/src/main/java/org/collectionspace/services/client/test/AbstractServiceTestImpl.java index 9f2a66869..6aff198ce 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/test/AbstractServiceTestImpl.java +++ b/services/client/src/main/java/org/collectionspace/services/client/test/AbstractServiceTestImpl.java @@ -31,6 +31,7 @@ import org.collectionspace.services.jaxb.AbstractCommonList; import org.collectionspace.services.workflow.WorkflowCommon; import org.collectionspace.services.client.AbstractPoxServiceClientImpl; import org.collectionspace.services.client.CollectionSpaceClient; +import org.collectionspace.services.client.CollectionSpacePoxClient; import org.collectionspace.services.client.PayloadOutputPart; import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; @@ -455,9 +456,11 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements */ private AbstractCommonList readList(String testName, CollectionSpaceClient client, - long pageSize, long pageNumber) throws Exception { + long pageSize, + long pageNumber, + int expectedStatus) throws Exception { - return readList(testName, client, EMPTY_SORT_BY_ORDER, pageSize, pageNumber); + return readList(testName, client, EMPTY_SORT_BY_ORDER, pageSize, pageNumber, expectedStatus); } /** @@ -472,8 +475,11 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements * @throws Exception the exception */ private AbstractCommonList readList(String testName, - CollectionSpaceClient client, String sortBy, - long pageSize, long pageNumber) throws Exception { + CollectionSpaceClient client, + String sortBy, + long pageSize, + long pageNumber, + int expectedStatus) throws Exception { ClientResponse response = client.readList(sortBy, pageSize, pageNumber); AbstractCommonList result = null; @@ -485,9 +491,7 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements if (getLogger().isDebugEnabled()) { getLogger().debug(testName + ": status = " + statusCode); } - Assert.assertTrue(this.REQUEST_TYPE.isValidStatusCode(statusCode), - invalidStatusCodeMessage(this.REQUEST_TYPE, statusCode)); - Assert.assertEquals(statusCode, this.EXPECTED_STATUS_CODE); + Assert.assertEquals(statusCode, expectedStatus); result = this.getAbstractCommonList(response); } finally { @@ -563,10 +567,19 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements // Get the current total number of items. // If there are no items then create some - AbstractCommonList list = (AbstractCommonList) this.readList(testName, client, 1 /*pgSz*/, 0 /*pgNum*/); + AbstractCommonList list = (AbstractCommonList) this.readList(testName, + client, + 1 /*pgSz*/, + 0 /*pgNum*/, + EXPECTED_STATUS_CODE); if (list == null || list.getTotalItems() == 0) { this.createPaginatedList(testName, DEFAULT_PAGINATEDLIST_SIZE); - list = (AbstractCommonList) this.readList(testName, client, 1 /*pgSz*/, 0 /*pgNum*/); + setupReadList(); + list = (AbstractCommonList) this.readList(testName, + client, + 1 /*pgSz*/, + 0 /*pgNum*/, + EXPECTED_STATUS_CODE); } // Print out the current list size to be paginated @@ -581,7 +594,7 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements long pageSize = totalItems / 3; //create up to 3 pages to iterate over long pagesTotal = pageSize > 0 ? (totalItems / pageSize) : 0; for (int i = 0; i < pagesTotal; i++) { - list = (AbstractCommonList) this.readList(testName, client, pageSize, i); + list = (AbstractCommonList) this.readList(testName, client, pageSize, i, EXPECTED_STATUS_CODE); assertPaginationInfo(testName, list, i, //expected page number @@ -593,7 +606,7 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements // if there are any remainders be sure to paginate them as well long mod = pageSize != 0 ? totalItems % pageSize : totalItems; if (mod != 0) { - list = (AbstractCommonList) this.readList(testName, client, pageSize, pagesTotal); + list = (AbstractCommonList) this.readList(testName, client, pageSize, pagesTotal, EXPECTED_STATUS_CODE); assertPaginationInfo(testName, list, pagesTotal, //expected page number @@ -642,16 +655,121 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements Assert.assertEquals(updatedWorkflowCommons.getCurrentLifeCycleState(), lifeCycleState); } - /* - * Sub-classes must override for the workflow tests. - */ + protected long readIncludeDeleted(String testName, Boolean includeDeleted) { + long result = 0; + // Perform setup. + setupReadList(); + + // + // Check to see if we have a POX client + // + 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 msg = "Workflow tests are incomplete because " + + clientCandidate.getClass().getName() + " does not support readIncludeDeleted() method."; + logger.warn(msg); + throw new UnsupportedOperationException(); + } + + // + // Ask for a list of all resources filtered by the incoming 'includeDeleted' workflow param + // + CollectionSpacePoxClient client = (CollectionSpacePoxClient)clientCandidate; + ClientResponse res = client.readIncludeDeleted(includeDeleted); + AbstractCommonList list = res.getEntity(); + int statusCode = res.getStatus(); + // + // Check the status code of the response: does it match + // the expected response(s)? + // + if (logger.isDebugEnabled()) { + logger.debug(testName + ": status = " + statusCode); + } + Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode), + invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); + Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); + // + // Now check that list size is correct + // + /* + List items = + list.getListItem(); + result = items.size(); + */ + result = list.getTotalItems(); + + return result; + } + + /* + * This test assumes that no objects exist yet. + * + * http://localhost:8180/cspace-services/intakes?wf_deleted=false + */ + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class) + public void readWorkflow(String testName) throws Exception { + try { + // + // Get the total count of non-deleted existing records + // + long existingRecords = readIncludeDeleted(testName, Boolean.FALSE); + + // + // Create 3 new objects + // + final int OBJECTS_TO_CREATE = 3; + for (int i = 0; i < OBJECTS_TO_CREATE; i++) { + this.createWorkflowTarget(testName); + } + + // + // Mark one as soft deleted + // + int existingTestCreated = allResourceIdsCreated.size(); // assumption is that no other test created records were soft deleted + String csid = allResourceIdsCreated.get(existingTestCreated - 1); //0-based index to get the last one added + this.setupUpdate(); + this.updateLifeCycleState(testName, csid, WorkflowClient.WORKFLOWSTATE_DELETED); + // + // Read the list of existing non-deleted records + // + long updatedTotal = readIncludeDeleted(testName, Boolean.FALSE); + Assert.assertEquals(updatedTotal, existingRecords + OBJECTS_TO_CREATE - 1, "Deleted items seem to be returned in list results."); + } catch (UnsupportedOperationException e) { + logger.warn(this.getClass().getName() + " did not implement createWorkflowTarget() method. No workflow tests performed."); + return; + } + } + + protected String createTestObject(String testName) throws Exception { + String result = null; + + CollectionSpacePoxClient client = (CollectionSpacePoxClient)getClientInstance(); + String identifier = createIdentifier(); + PoxPayloadOut multipart = createInstance(identifier); + ClientResponse res = client.create(multipart); + + int statusCode = res.getStatus(); + Assert.assertEquals(statusCode, STATUS_CREATED); + + result = extractId(res); + allResourceIdsCreated.add(result); + + return result; + } protected String createWorkflowTarget(String testName) throws Exception { - logger.warn("Sub-class test clients should override this method"); - throw new UnsupportedOperationException(); + String result = null; + + result = createTestObject(testName); + + return result; } - protected String createTestObject(String testName) throws Exception { + /* + * 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(); } diff --git a/services/collectionobject/client/pom.xml b/services/collectionobject/client/pom.xml index ade79135e..2e41a3309 100644 --- a/services/collectionobject/client/pom.xml +++ b/services/collectionobject/client/pom.xml @@ -35,6 +35,12 @@ true ${project.version} + + org.collectionspace.services + org.collectionspace.services.authority + true + ${project.version} + org.collectionspace.services org.collectionspace.services.client diff --git a/services/collectionobject/client/src/main/java/org/collectionspace/services/client/CollectionObjectClient.java b/services/collectionobject/client/src/main/java/org/collectionspace/services/client/CollectionObjectClient.java index f61514c8f..0f3ffdc26 100644 --- a/services/collectionobject/client/src/main/java/org/collectionspace/services/client/CollectionObjectClient.java +++ b/services/collectionobject/client/src/main/java/org/collectionspace/services/client/CollectionObjectClient.java @@ -40,6 +40,7 @@ public class CollectionObjectClient extends AbstractPoxServiceClientImpl readList(); + @Override + @GET + @Produces({"application/xml"}) + ClientResponse readIncludeDeleted( + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + /** * Keyword search. * diff --git a/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectServiceTest.java b/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectServiceTest.java index 6175bb650..037820678 100644 --- a/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectServiceTest.java +++ b/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectServiceTest.java @@ -1208,6 +1208,12 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { "objectNumber-" + identifier, "objectName-" + identifier); } + + @Override + protected PoxPayloadOut createInstance(String identifier) { + String commonPartName = CollectionObjectClient.SERVICE_COMMON_PART_NAME; + return createCollectionObjectInstance(commonPartName, identifier); + } /** * Creates the collection object instance. diff --git a/services/common/src/main/cspace/config/services/tenants/collectionspace/tenant-bindings.xml b/services/common/src/main/cspace/config/services/tenants/collectionspace/tenant-bindings.xml index e2644c407..f1ee390f0 100644 --- a/services/common/src/main/cspace/config/services/tenants/collectionspace/tenant-bindings.xml +++ b/services/common/src/main/cspace/config/services/tenants/collectionspace/tenant-bindings.xml @@ -941,6 +941,9 @@ Repository workspace so we have to configure that. --> + + /vocabularyitems/*/workflow/ + + + org.collectionspace.services + org.collectionspace.services.authority + true + ${project.version} + org.collectionspace.services org.collectionspace.services.jaxb diff --git a/services/intake/client/src/main/java/org/collectionspace/services/client/IntakeProxy.java b/services/intake/client/src/main/java/org/collectionspace/services/client/IntakeProxy.java index 829205834..8bd496edf 100644 --- a/services/intake/client/src/main/java/org/collectionspace/services/client/IntakeProxy.java +++ b/services/intake/client/src/main/java/org/collectionspace/services/client/IntakeProxy.java @@ -31,7 +31,9 @@ import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import org.collectionspace.services.client.workflow.WorkflowClient; import org.collectionspace.services.intake.IntakesCommonList; /** @@ -50,4 +52,10 @@ public interface IntakeProxy extends CollectionSpacePoxProxy @GET @Produces({"application/xml"}) ClientResponse readList(); + + @Override + @GET + @Produces({"application/xml"}) + ClientResponse readIncludeDeleted( + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); } diff --git a/services/intake/client/src/test/java/org/collectionspace/services/client/test/IntakeServiceTest.java b/services/intake/client/src/test/java/org/collectionspace/services/client/test/IntakeServiceTest.java index 33432c500..ca97537e7 100644 --- a/services/intake/client/src/test/java/org/collectionspace/services/client/test/IntakeServiceTest.java +++ b/services/intake/client/src/test/java/org/collectionspace/services/client/test/IntakeServiceTest.java @@ -108,7 +108,7 @@ public class IntakeServiceTest extends AbstractServiceTestImpl { // Submit the request to the service and store the response. IntakeClient client = new IntakeClient(); String identifier = createIdentifier(); - PoxPayloadOut multipart = createIntakeInstance(identifier); + PoxPayloadOut multipart = createInstance(identifier); ClientResponse res = client.create(multipart); int statusCode = res.getStatus(); @@ -668,7 +668,7 @@ public class IntakeServiceTest extends AbstractServiceTestImpl { // Note: The ID used in this 'create' call may be arbitrary. // The only relevant ID may be the one used in update(), below. IntakeClient client = new IntakeClient(); - PoxPayloadOut multipart = createIntakeInstance(NON_EXISTENT_ID); + PoxPayloadOut multipart = createInstance(NON_EXISTENT_ID); ClientResponse res = client.update(NON_EXISTENT_ID, multipart); int statusCode = res.getStatus(); @@ -715,7 +715,7 @@ public class IntakeServiceTest extends AbstractServiceTestImpl { invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); } - + // Failure outcomes /* (non-Javadoc) * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String) @@ -791,7 +791,8 @@ public class IntakeServiceTest extends AbstractServiceTestImpl { * @param identifier the identifier * @return the multipart output */ - private PoxPayloadOut createIntakeInstance(String identifier) { + @Override + protected PoxPayloadOut createInstance(String identifier) { return createIntakeInstance( "entryNumber-" + identifier, "entryDate-" + identifier, diff --git a/services/loanin/client/src/main/java/org/collectionspace/services/client/LoaninProxy.java b/services/loanin/client/src/main/java/org/collectionspace/services/client/LoaninProxy.java index 00fb97df0..6a9bd9159 100644 --- a/services/loanin/client/src/main/java/org/collectionspace/services/client/LoaninProxy.java +++ b/services/loanin/client/src/main/java/org/collectionspace/services/client/LoaninProxy.java @@ -5,7 +5,9 @@ import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import org.collectionspace.services.client.workflow.WorkflowClient; import org.collectionspace.services.jaxb.AbstractCommonList; /** @@ -18,4 +20,10 @@ public interface LoaninProxy extends CollectionSpacePoxProxy // List @GET ClientResponse readList(); + + @Override + @GET + @Produces({"application/xml"}) + ClientResponse readIncludeDeleted( + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); } diff --git a/services/loanin/pom.xml b/services/loanin/pom.xml index a2bfe225f..6d3d397a3 100644 --- a/services/loanin/pom.xml +++ b/services/loanin/pom.xml @@ -13,6 +13,15 @@ services.loanin pom + + + org.collectionspace.services + org.collectionspace.services.authority + true + ${project.version} + + + jaxb service diff --git a/services/loanout/client/pom.xml b/services/loanout/client/pom.xml index c207af9be..b9c7d79ca 100644 --- a/services/loanout/client/pom.xml +++ b/services/loanout/client/pom.xml @@ -26,6 +26,12 @@ test + + org.collectionspace.services + org.collectionspace.services.authority + true + ${project.version} + org.collectionspace.services org.collectionspace.services.jaxb diff --git a/services/location/client/src/main/java/org/collectionspace/services/client/LocationAuthorityProxy.java b/services/location/client/src/main/java/org/collectionspace/services/client/LocationAuthorityProxy.java index 2beea9c96..02bd6ce02 100644 --- a/services/location/client/src/main/java/org/collectionspace/services/client/LocationAuthorityProxy.java +++ b/services/location/client/src/main/java/org/collectionspace/services/client/LocationAuthorityProxy.java @@ -8,6 +8,7 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; +import org.collectionspace.services.client.workflow.WorkflowClient; import org.collectionspace.services.location.LocationauthoritiesCommonList; import org.collectionspace.services.location.LocationsCommonList; @@ -49,4 +50,10 @@ public interface LocationAuthorityProxy extends AuthorityProxy readIncludeDeleted( + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + } diff --git a/services/location/pom.xml b/services/location/pom.xml index cf37dd3a4..82f0e1f23 100644 --- a/services/location/pom.xml +++ b/services/location/pom.xml @@ -12,6 +12,15 @@ services.location pom + + + org.collectionspace.services + org.collectionspace.services.authority + true + ${project.version} + + + jaxb service diff --git a/services/media/client/pom.xml b/services/media/client/pom.xml index 511e1df38..06050975d 100644 --- a/services/media/client/pom.xml +++ b/services/media/client/pom.xml @@ -26,6 +26,12 @@ test + + org.collectionspace.services + org.collectionspace.services.authority + true + ${project.version} + org.collectionspace.services org.collectionspace.services.jaxb diff --git a/services/movement/client/pom.xml b/services/movement/client/pom.xml index 6b00acfe3..849004b6a 100644 --- a/services/movement/client/pom.xml +++ b/services/movement/client/pom.xml @@ -26,6 +26,12 @@ provided + + org.collectionspace.services + org.collectionspace.services.authority + true + ${project.version} + org.collectionspace.services org.collectionspace.services.jaxb diff --git a/services/movement/client/src/main/java/org/collectionspace/services/client/MovementProxy.java b/services/movement/client/src/main/java/org/collectionspace/services/client/MovementProxy.java index cadf819df..ef0a39114 100644 --- a/services/movement/client/src/main/java/org/collectionspace/services/client/MovementProxy.java +++ b/services/movement/client/src/main/java/org/collectionspace/services/client/MovementProxy.java @@ -31,6 +31,7 @@ import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; +import org.collectionspace.services.client.workflow.WorkflowClient; import org.collectionspace.services.movement.MovementsCommonList; /** @@ -54,6 +55,12 @@ public interface MovementProxy extends CollectionSpacePoxProxy readListSortedBy( @QueryParam(IClientQueryParams.SORT_BY_PARAM) String sortFieldName); + + @Override + @GET + @Produces({"application/xml"}) + ClientResponse readIncludeDeleted( + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); @GET @Produces({"application/xml"}) diff --git a/services/movement/client/src/test/java/org/collectionspace/services/client/test/MovementServiceTest.java b/services/movement/client/src/test/java/org/collectionspace/services/client/test/MovementServiceTest.java index 181f4f2b7..c550bedb3 100644 --- a/services/movement/client/src/test/java/org/collectionspace/services/client/test/MovementServiceTest.java +++ b/services/movement/client/src/test/java/org/collectionspace/services/client/test/MovementServiceTest.java @@ -808,7 +808,8 @@ public class MovementServiceTest extends AbstractServiceTestImpl { * @return Multipart output suitable for use as a payload * in a create or update request. */ - private PoxPayloadOut createInstance(String movementReferenceNumber) { + @Override + public PoxPayloadOut createInstance(String movementReferenceNumber) { MovementsCommon movementCommon = new MovementsCommon(); // FIXME: Values of currentLocation, normalLocation, // and movementContact should be refNames. diff --git a/services/note/client/pom.xml b/services/note/client/pom.xml index 79807417a..0d84e671e 100644 --- a/services/note/client/pom.xml +++ b/services/note/client/pom.xml @@ -24,6 +24,12 @@ slf4j-log4j12 + + org.collectionspace.services + org.collectionspace.services.authority + true + ${project.version} + org.collectionspace.services org.collectionspace.services.note.jaxb diff --git a/services/note/client/src/main/java/org/collectionspace/services/client/NoteProxy.java b/services/note/client/src/main/java/org/collectionspace/services/client/NoteProxy.java index b5788776a..a3f9da4c8 100644 --- a/services/note/client/src/main/java/org/collectionspace/services/client/NoteProxy.java +++ b/services/note/client/src/main/java/org/collectionspace/services/client/NoteProxy.java @@ -19,7 +19,7 @@ import org.jboss.resteasy.client.ClientResponse; @Path("/notes/") @Produces({"application/xml;charset=UTF-8"}) @Consumes({"application/xml"}) -public interface NoteProxy extends CollectionSpaceProxy { +public interface NoteProxy extends CollectionSpaceProxy { @GET @Produces({"application/xml"}) diff --git a/services/objectexit/client/pom.xml b/services/objectexit/client/pom.xml index ee0861c31..db7a0d18c 100644 --- a/services/objectexit/client/pom.xml +++ b/services/objectexit/client/pom.xml @@ -26,6 +26,12 @@ test + + org.collectionspace.services + org.collectionspace.services.authority + true + ${project.version} + org.collectionspace.services org.collectionspace.services.jaxb diff --git a/services/objectexit/client/src/main/java/org/collectionspace/services/client/ObjectExitProxy.java b/services/objectexit/client/src/main/java/org/collectionspace/services/client/ObjectExitProxy.java index 4c1f362d8..c969f0a48 100644 --- a/services/objectexit/client/src/main/java/org/collectionspace/services/client/ObjectExitProxy.java +++ b/services/objectexit/client/src/main/java/org/collectionspace/services/client/ObjectExitProxy.java @@ -5,7 +5,9 @@ import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import org.collectionspace.services.client.workflow.WorkflowClient; import org.collectionspace.services.jaxb.AbstractCommonList; /** @@ -18,4 +20,10 @@ public interface ObjectExitProxy extends CollectionSpacePoxProxy readList(); + + @Override + @GET + @Produces({"application/xml"}) + ClientResponse readIncludeDeleted( + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); } diff --git a/services/organization/client/pom.xml b/services/organization/client/pom.xml index 72507768b..beee66b47 100644 --- a/services/organization/client/pom.xml +++ b/services/organization/client/pom.xml @@ -26,6 +26,12 @@ provided + + org.collectionspace.services + org.collectionspace.services.authority + true + ${project.version} + org.collectionspace.services org.collectionspace.services.organization.jaxb diff --git a/services/organization/jaxb/pom.xml b/services/organization/jaxb/pom.xml index b6b970922..f6564b2fa 100644 --- a/services/organization/jaxb/pom.xml +++ b/services/organization/jaxb/pom.xml @@ -14,6 +14,12 @@ services.organization.jaxb + + org.collectionspace.services + org.collectionspace.services.authority + true + ${project.version} + org.collectionspace.services org.collectionspace.services.common diff --git a/services/organization/service/pom.xml b/services/organization/service/pom.xml index 4e465b829..f20c688f4 100644 --- a/services/organization/service/pom.xml +++ b/services/organization/service/pom.xml @@ -22,6 +22,12 @@ slf4j-log4j12 + + org.collectionspace.services + org.collectionspace.services.authority + true + ${project.version} + org.collectionspace.services org.collectionspace.services.common diff --git a/services/person/pom.xml b/services/person/pom.xml index 522dd54e0..414054fe3 100644 --- a/services/person/pom.xml +++ b/services/person/pom.xml @@ -12,6 +12,15 @@ services.person pom + + + org.collectionspace.services + org.collectionspace.services.authority + true + ${project.version} + + + jaxb service diff --git a/services/pom.xml b/services/pom.xml index c25091c14..4af57ba5d 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -28,6 +28,7 @@ jaxb hyperjaxb common + authority authorization-mgt common-test account diff --git a/services/report/service/pom.xml b/services/report/service/pom.xml index 1fb1fb161..6dc7700ea 100644 --- a/services/report/service/pom.xml +++ b/services/report/service/pom.xml @@ -14,6 +14,12 @@ jar + + org.collectionspace.services + org.collectionspace.services.authority + true + ${project.version} + org.collectionspace.services org.collectionspace.services.common diff --git a/services/vocabulary/client/pom.xml b/services/vocabulary/client/pom.xml index 9019091f2..8569a57ed 100644 --- a/services/vocabulary/client/pom.xml +++ b/services/vocabulary/client/pom.xml @@ -25,6 +25,12 @@ slf4j-log4j12 + + org.collectionspace.services + org.collectionspace.services.authority + true + ${project.version} + org.collectionspace.services org.collectionspace.services.vocabulary.jaxb diff --git a/services/vocabulary/pom.xml b/services/vocabulary/pom.xml index 2daec72ef..2ac08fc50 100644 --- a/services/vocabulary/pom.xml +++ b/services/vocabulary/pom.xml @@ -14,6 +14,15 @@ services.vocabulary pom + + + org.collectionspace.services + org.collectionspace.services.authority + true + ${project.version} + + + jaxb service diff --git a/services/workflow/client/src/test/java/org/collectionspace/services/client/test/WorkflowServiceTest.java b/services/workflow/client/src/test/java/org/collectionspace/services/client/test/WorkflowServiceTest.java index 30f23585b..63e4967f7 100644 --- a/services/workflow/client/src/test/java/org/collectionspace/services/client/test/WorkflowServiceTest.java +++ b/services/workflow/client/src/test/java/org/collectionspace/services/client/test/WorkflowServiceTest.java @@ -297,74 +297,11 @@ public class WorkflowServiceTest extends AbstractServiceTestImpl { this.createTestObject(testName); } - private int readIncludeDeleted(String testName, Boolean includeDeleted) { - int result = 0; - // Perform setup. - setupReadList(); - - // Submit the request to the service and store the response. - DimensionClient client = new DimensionClient(); - ClientResponse res = client.readIncludeDeleted(includeDeleted); - DimensionsCommonList list = res.getEntity(); - int statusCode = res.getStatus(); - // - // Check the status code of the response: does it match - // the expected response(s)? - // - if (logger.isDebugEnabled()) { - logger.debug(testName + ": status = " + statusCode); - } - Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode), - invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); - Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); - // - // Now check that list size is correct - // - List items = - list.getDimensionListItem(); - result = items.size(); - - return result; - } @Override public void readList(String testName) throws Exception { } - - /* - * 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 readWorkflow(String testName) throws Exception { - // - // Get the total count of non-deleted existing records - // - int existingRecords = readIncludeDeleted(testName, Boolean.FALSE); - - // - // Create 3 new objects - // - final int OBJECTS_TO_CREATE = 3; - for (int i = 0; i < OBJECTS_TO_CREATE; i++) { - this.createWorkflowTarget(testName); - } - - // - // Mark one as soft deleted - // - int existingTestCreated = allResourceIdsCreated.size(); // assumption is that no other test created records were soft deleted - String csid = allResourceIdsCreated.get(existingTestCreated - 1); //0-based index to get the last one added - this.setupUpdate(); - this.updateLifeCycleState(testName, csid, WorkflowClient.WORKFLOWSTATE_DELETED); - // - // Read the list of existing non-deleted records - // - int updatedTotal = readIncludeDeleted(testName, Boolean.FALSE); - Assert.assertEquals(updatedTotal, existingRecords + OBJECTS_TO_CREATE - 1, "Deleted items seem to be returned in list results."); - } - + @Override public void readPaginatedList(String testName) throws Exception { //empty N/A -- 2.47.3