From 203dfc0f1e17b9a90f137cd79e584557462e6dff Mon Sep 17 00:00:00 2001 From: Aron Roberts Date: Wed, 20 Apr 2011 02:37:38 +0000 Subject: [PATCH] CSPACE-3782: Added client tests to ensure that keyword searches respect the value of the parameter on 'soft' deleted workflow state. --- .../client/test/AccountRoleServiceTest.java | 10 + .../client/test/AccountServiceTest.java | 10 + .../services/client/AcquisitionProxy.java | 9 +- .../test/PermissionRoleServiceTest.java | 11 + .../client/test/PermissionServiceTest.java | 10 + .../test/RolePermissionServiceTest.java | 10 + .../client/test/RoleServiceTest.java | 10 + .../services/client/BlobProxy.java | 7 + .../client/AbstractPoxServiceClientImpl.java | 14 +- .../client/CollectionSpacePoxClient.java | 2 + .../client/CollectionSpacePoxProxy.java | 17 + .../client/test/AbstractServiceTestImpl.java | 670 ++++++++++-------- .../client/CollectionObjectProxy.java | 7 + .../services/client/ContactProxy.java | 9 +- .../services/client/DimensionProxy.java | 7 + .../client/test/DimensionServiceTest.java | 10 + .../services/client/IntakeProxy.java | 7 + .../services/client/LoaninProxy.java | 9 +- .../services/client/LoanoutProxy.java | 9 +- .../client/LocationAuthorityProxy.java | 8 +- .../services/client/MediaProxy.java | 28 +- .../services/client/MovementProxy.java | 9 +- .../services/client/test/NoteServiceTest.java | 10 + .../services/client/ObjectExitProxy.java | 7 + .../services/client/OrgAuthorityProxy.java | 10 +- .../services/client/PersonAuthorityProxy.java | 9 +- .../services/client/RelationProxy.java | 7 + .../services/client/ReportProxy.java | 8 +- .../test/AuthenticationServiceTest.java | 10 + .../client/test/AuthorizationServiceTest.java | 10 + .../client/test/MultiTenancyTest.java | 10 + .../services/client/VocabularyProxy.java | 8 +- .../client/test/WorkflowServiceTest.java | 7 + 33 files changed, 669 insertions(+), 310 deletions(-) diff --git a/services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountRoleServiceTest.java b/services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountRoleServiceTest.java index b3fbbeef7..d0c553cb0 100644 --- a/services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountRoleServiceTest.java +++ b/services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountRoleServiceTest.java @@ -496,6 +496,16 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl { //ignoring this test as the service side returns 200 now even if it does //not find a record in the db } + + // --------------------------------------------------------------- + // Search tests + // --------------------------------------------------------------- + + @Override + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class) + public void searchWorkflowDeleted(String testName) throws Exception { + // Fixme: null test for now, overriding test in base class + } // --------------------------------------------------------------- // Utility tests : tests of code used in tests above 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 e0e96c801..dac8a3586 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 @@ -1172,6 +1172,16 @@ public class AccountServiceTest extends AbstractServiceTestImpl { Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); } + // --------------------------------------------------------------- + // Search tests + // --------------------------------------------------------------- + + @Override + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class) + public void searchWorkflowDeleted(String testName) throws Exception { + // Fixme: null test for now, overriding test in base class + } + // --------------------------------------------------------------- // Utility tests : tests of code used in tests above // --------------------------------------------------------------- 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 d6f676c51..c37c86a0d 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 @@ -24,5 +24,12 @@ public interface AcquisitionProxy extends CollectionSpacePoxProxy readIncludeDeleted( - @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + + @Override + @GET + @Produces({"application/xml"}) + ClientResponse keywordSearchIncludeDeleted( + @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords, + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); } diff --git a/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/PermissionRoleServiceTest.java b/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/PermissionRoleServiceTest.java index 6e60ccf78..b896bb862 100644 --- a/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/PermissionRoleServiceTest.java +++ b/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/PermissionRoleServiceTest.java @@ -529,6 +529,16 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl { //ignoring this test as the service side returns 200 now even if it does //not find a record in the db } + + // --------------------------------------------------------------- + // Search tests + // --------------------------------------------------------------- + + @Override + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class) + public void searchWorkflowDeleted(String testName) throws Exception { + // Fixme: null test for now, overriding test in base class + } // --------------------------------------------------------------- // Utility tests : tests of code used in tests above @@ -742,4 +752,5 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl { res.releaseConnection(); } } + } diff --git a/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/PermissionServiceTest.java b/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/PermissionServiceTest.java index 438213e6e..5965c49cc 100644 --- a/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/PermissionServiceTest.java +++ b/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/PermissionServiceTest.java @@ -697,6 +697,16 @@ public class PermissionServiceTest extends AbstractServiceTestImpl { invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); } + + // --------------------------------------------------------------- + // Search tests + // --------------------------------------------------------------- + + @Override + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class) + public void searchWorkflowDeleted(String testName) throws Exception { + // Fixme: null test for now, overriding test in base class + } // --------------------------------------------------------------- // Utility tests : tests of code used in tests above diff --git a/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/RolePermissionServiceTest.java b/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/RolePermissionServiceTest.java index 73fe14f62..5142e0eb3 100644 --- a/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/RolePermissionServiceTest.java +++ b/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/RolePermissionServiceTest.java @@ -504,6 +504,16 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl { //ignoring this test as the service side returns 200 now even if it does //not find a record in the db } + + // --------------------------------------------------------------- + // Search tests + // --------------------------------------------------------------- + + @Override + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class) + public void searchWorkflowDeleted(String testName) throws Exception { + // Fixme: null test for now, overriding test in base class + } // --------------------------------------------------------------- // Utility tests : tests of code used in tests above diff --git a/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/RoleServiceTest.java b/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/RoleServiceTest.java index f670f16a2..29c30f900 100644 --- a/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/RoleServiceTest.java +++ b/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/RoleServiceTest.java @@ -767,6 +767,16 @@ public class RoleServiceTest extends AbstractServiceTestImpl { invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); } + + // --------------------------------------------------------------- + // Search tests + // --------------------------------------------------------------- + + @Override + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class) + public void searchWorkflowDeleted(String testName) throws Exception { + // Fixme: null test for now, overriding test in base class + } // --------------------------------------------------------------- // Utility tests : tests of code used in tests above diff --git a/services/blob/client/src/main/java/org/collectionspace/services/client/BlobProxy.java b/services/blob/client/src/main/java/org/collectionspace/services/client/BlobProxy.java index e1c80a1f4..5dc06a0db 100644 --- a/services/blob/client/src/main/java/org/collectionspace/services/client/BlobProxy.java +++ b/services/blob/client/src/main/java/org/collectionspace/services/client/BlobProxy.java @@ -42,4 +42,11 @@ public interface BlobProxy extends CollectionSpacePoxProxy { @Produces({"application/xml"}) ClientResponse readIncludeDeleted( @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + + @Override + @GET + @Produces({"application/xml"}) + ClientResponse keywordSearchIncludeDeleted( + @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords, + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); } 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 5b59e3630..ea0d97363 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 @@ -12,8 +12,9 @@ import org.jboss.resteasy.client.ClientResponse; public abstract class AbstractPoxServiceClientImpl> extends AbstractServiceClientImpl implements CollectionSpacePoxClient { - @Override - public ClientResponse create(PoxPayloadOut xmlPayload) { + + @Override + public ClientResponse create(PoxPayloadOut xmlPayload) { return getProxy().create(xmlPayload.getBytes()); } @@ -36,5 +37,12 @@ public abstract class AbstractPoxServiceClientImpl readIncludeDeleted(Boolean includeDeleted) { CollectionSpacePoxProxy proxy = getProxy(); return proxy.readIncludeDeleted(includeDeleted.toString()); - } + } + + @Override + public ClientResponse keywordSearchIncludeDeleted(String keywords, Boolean includeDeleted) { + CollectionSpacePoxProxy proxy = getProxy(); + return proxy.keywordSearchIncludeDeleted(keywords, includeDeleted.toString()); + } + } 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 060b8d2e3..1ca54dfe1 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 @@ -29,4 +29,6 @@ public interface CollectionSpacePoxClient readIncludeDeleted(Boolean includeDeleted); + + public ClientResponse keywordSearchIncludeDeleted(String keywords, 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 79622d7d1..9de3e19a3 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 @@ -14,6 +14,7 @@ import org.collectionspace.services.jaxb.AbstractCommonList; import org.jboss.resteasy.client.ClientResponse; public interface CollectionSpacePoxProxy extends CollectionSpaceProxy { + //(C)reate @POST ClientResponse create(byte[] payload); @@ -39,4 +40,20 @@ public interface CollectionSpacePoxProxy extends @Produces({"application/xml"}) ClientResponse readIncludeDeleted( @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + + + /** + * Keyword search. + * + * @param keywords keywords on which to search + * @param includeDeleted + * @return the client response + */ + @GET + @Produces({"application/xml"}) + ClientResponse keywordSearchIncludeDeleted( + @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords, + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + + } 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 697f8fb6e..f48155d36 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 @@ -51,7 +51,6 @@ import org.testng.annotations.Test; import javax.activation.MimetypesFileTypeMap; import javax.ws.rs.core.Response; - /** * AbstractServiceTestImpl * @@ -63,39 +62,35 @@ import javax.ws.rs.core.Response; * $LastChangedRevision$ * $LastChangedDate$ */ - // FIXME: http://issues.collectionspace.org/browse/CSPACE-1685 - public abstract class AbstractServiceTestImpl extends BaseServiceTest implements ServiceTest { /** The logger. */ private final Logger logger = LoggerFactory.getLogger(AbstractServiceTestImpl.class); - // A non-existent logger. static private final Logger LOGGER_NULL = null; - /** The Constant DEFAULT_LIST_SIZE. */ static protected final int DEFAULT_LIST_SIZE = 10; static protected final int DEFAULT_PAGINATEDLIST_SIZE = 10; - static protected final String RESOURCE_PATH = "src" + File.separator + - "test" + File.separator + - "resources"; + static protected final String RESOURCE_PATH = "src" + File.separator + + "test" + File.separator + + "resources"; protected static final String BLOBS_DIR = "blobs"; - static protected final String DEFAULT_MIME = "application/octet-stream; charset=ISO-8859-1"; static private final String NO_TEST_CLEANUP = "noTestCleanup"; static protected final String NO_BLOB_CLEANUP = "noBlobCleanup"; static protected final String NO_MEDIA_CLEANUP = "noMediaCleanup"; + final static String NON_EXISTENT_KEYWORD = "jlmbsoqjlmbsoq"; protected String getMimeType(File theFile) { - String result = null; - result = new MimetypesFileTypeMap().getContentType(theFile); - if (result == null) { - logger.debug("Could not get MIME type for file at: " + theFile.getAbsolutePath()); - result = DEFAULT_MIME; - } - - return result; + String result = null; + result = new MimetypesFileTypeMap().getContentType(theFile); + if (result == null) { + logger.debug("Could not get MIME type for file at: " + theFile.getAbsolutePath()); + result = DEFAULT_MIME; + } + + return result; } /* Use this to keep track of resources to delete */ @@ -111,24 +106,21 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements * @return the logger */ private Logger getLogger() { - return this.logger; + return this.logger; } protected String getResourceDir() { - String result = null; + String result = null; String currentDirectory = System.getProperty("user.dir"); result = currentDirectory + File.separator + RESOURCE_PATH; return result; } - - - + // --------------------------------------------------------------- // CRUD tests : CREATE tests // // (See below for utility methods in support of create list tests.) // --------------------------------------------------------------- - // Success outcomes /* (non-Javadoc) @@ -145,7 +137,7 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements REQUEST_TYPE = ServiceRequestType.CREATE; testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE); } - + /** * Checks if 'theFile' is something we can turn into a Blob instance. It can't * be read-protected, hidden, or a directory. @@ -154,11 +146,11 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements * @return true, if is blobable */ protected boolean isBlobbable(File theFile) { - boolean result = true; - if (theFile.isDirectory() || theFile.isHidden() || !theFile.canRead()) { - result = false; - } - return result; + boolean result = true; + if (theFile.isDirectory() || theFile.isHidden() || !theFile.canRead()) { + result = false; + } + return result; } /* (non-Javadoc) @@ -169,7 +161,6 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements // Note: No setup is required for createList(), as it currently // just invokes create() multiple times. - // Failure outcomes /* (non-Javadoc) @@ -187,7 +178,7 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements REQUEST_TYPE = ServiceRequestType.CREATE; testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE); } - + /** * Sets up create tests with empty entity body. */ @@ -196,7 +187,7 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements REQUEST_TYPE = ServiceRequestType.CREATE; testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE); } - + /* (non-Javadoc) * @see org.collectionspace.services.client.test.ServiceTest#createWithMalformedXml(java.lang.String) @@ -231,7 +222,6 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements // --------------------------------------------------------------- // CRUD tests : READ tests // --------------------------------------------------------------- - // Success outcomes /* (non-Javadoc) @@ -271,12 +261,11 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements // // (See below for utility methods in support of list tests.) // --------------------------------------------------------------- - // Success outcomes /* (non-Javadoc) - * @see org.collectionspace.services.client.test.ServiceTest#readList(java.lang.String) - */ + * @see org.collectionspace.services.client.test.ServiceTest#readList(java.lang.String) + */ @Override public abstract void readList(String testName) throws Exception; @@ -290,13 +279,10 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements } // Failure outcomes - // None tested at present. - // --------------------------------------------------------------- // CRUD tests : UPDATE tests // --------------------------------------------------------------- - // Success outcomes /* (non-Javadoc) @@ -360,14 +346,13 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements REQUEST_TYPE = ServiceRequestType.UPDATE; testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE); } - + /* (non-Javadoc) * @see org.collectionspace.services.client.test.ServiceTest#updateNonExistent(java.lang.String) */ @Override public abstract void updateNonExistent(String testName) throws Exception; - /** * Sets up update non existent tests */ @@ -380,7 +365,6 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements // --------------------------------------------------------------- // CRUD tests : DELETE tests // --------------------------------------------------------------- - // Success outcomes /* (non-Javadoc) @@ -418,7 +402,6 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements // --------------------------------------------------------------- // Utility methods to clean up resources created during tests. // --------------------------------------------------------------- - /** * Deletes all resources created by tests, after all tests have been run. * @@ -427,15 +410,15 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements * at any point during testing, even if some of those resources * may be expected to be deleted by certain tests. */ - @AfterClass(alwaysRun=true) + @AfterClass(alwaysRun = true) public void cleanUp() { String noTestCleanup = System.getProperty(NO_TEST_CLEANUP); - if(Boolean.TRUE.toString().equalsIgnoreCase(noTestCleanup)) { + if (Boolean.TRUE.toString().equalsIgnoreCase(noTestCleanup)) { if (logger.isDebugEnabled()) { logger.debug("Skipping Cleanup phase ..."); } return; - } + } if (logger.isDebugEnabled()) { logger.debug("Cleaning up temporary resources created for testing ..."); } @@ -444,13 +427,13 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements // First, check to see if we need to cleanup any authority items // if (this.isAuthorityClient(client) == true) { - AuthorityClient authorityClient = (AuthorityClient)client; - for (Map.Entry entry : allResourceItemIdsCreated.entrySet()) { - String itemResourceId = entry.getKey(); - String authorityResourceId = entry.getValue(); - // Note: Any non-success responses are ignored and not reported. - authorityClient.deleteItem(authorityResourceId, itemResourceId).releaseConnection(); - } + AuthorityClient authorityClient = (AuthorityClient) client; + for (Map.Entry entry : allResourceItemIdsCreated.entrySet()) { + String itemResourceId = entry.getKey(); + String authorityResourceId = entry.getValue(); + // Note: Any non-success responses are ignored and not reported. + authorityClient.deleteItem(authorityResourceId, itemResourceId).releaseConnection(); + } } // // Next, delete all other entities include possible authorities. @@ -464,7 +447,6 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements // --------------------------------------------------------------- // Utility methods in support of list tests. // --------------------------------------------------------------- - /** * Read list. * @@ -476,14 +458,15 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements * @throws Exception the exception */ private AbstractCommonList readList(String testName, - CollectionSpaceClient client, - long pageSize, - long pageNumber, - int expectedStatus) throws Exception { + CollectionSpaceClient client, + long pageSize, + long pageNumber, + int expectedStatus) throws Exception { return readList(testName, client, EMPTY_SORT_BY_ORDER, pageSize, pageNumber, expectedStatus); } + /** * Read list. * @@ -496,11 +479,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, - int expectedStatus) throws Exception { + CollectionSpaceClient client, + String sortBy, + long pageSize, + long pageNumber, + int expectedStatus) throws Exception { ClientResponse response = client.readList(sortBy, pageSize, pageNumber); AbstractCommonList result = null; @@ -510,7 +493,7 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements // Check the status code of the response: does it match // the expected response(s)? if (getLogger().isDebugEnabled()) { - getLogger().debug(testName + ": status = " + statusCode); + getLogger().debug(testName + ": status = " + statusCode); } Assert.assertEquals(statusCode, expectedStatus); @@ -537,40 +520,39 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements /*@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class) public void leafCreate(String testName) throws Exception { - this.create(testName); + this.create(testName); }*/ - private void assertPaginationInfo(String testName, - AbstractCommonList list, - long expectedPageNum, - long expectedPageSize, - long expectedListSize, - long expectedTotalItems) { - Assert.assertNotNull(list); - - long pageNum = list.getPageNum(); - Assert.assertEquals(pageNum, expectedPageNum); - if (getLogger().isDebugEnabled() == true) { - getLogger().debug(testName + ":" + "page number is " + pageNum); - } - - long pageSizeReturned = list.getPageSize(); - Assert.assertEquals(pageSizeReturned, expectedPageSize); - if (getLogger().isDebugEnabled() == true) { - getLogger().debug(testName + ":" + "page size is " + list.getPageSize()); - } - - long itemsInPage = list.getItemsInPage(); - Assert.assertEquals(itemsInPage, expectedListSize); - if (getLogger().isDebugEnabled() == true) { - getLogger().debug(testName + ":" + "actual items in page was/were " + itemsInPage); - } - - long totalItemsReturned = list.getTotalItems(); - Assert.assertEquals(totalItemsReturned, expectedTotalItems); - if (getLogger().isDebugEnabled() == true) { - getLogger().debug(testName + ":" + "total number of items is " + list.getTotalItems()); - } + AbstractCommonList list, + long expectedPageNum, + long expectedPageSize, + long expectedListSize, + long expectedTotalItems) { + Assert.assertNotNull(list); + + long pageNum = list.getPageNum(); + Assert.assertEquals(pageNum, expectedPageNum); + if (getLogger().isDebugEnabled() == true) { + getLogger().debug(testName + ":" + "page number is " + pageNum); + } + + long pageSizeReturned = list.getPageSize(); + Assert.assertEquals(pageSizeReturned, expectedPageSize); + if (getLogger().isDebugEnabled() == true) { + getLogger().debug(testName + ":" + "page size is " + list.getPageSize()); + } + + long itemsInPage = list.getItemsInPage(); + Assert.assertEquals(itemsInPage, expectedListSize); + if (getLogger().isDebugEnabled() == true) { + getLogger().debug(testName + ":" + "actual items in page was/were " + itemsInPage); + } + + long totalItemsReturned = list.getTotalItems(); + Assert.assertEquals(totalItemsReturned, expectedTotalItems); + if (getLogger().isDebugEnabled() == true) { + getLogger().debug(testName + ":" + "total number of items is " + list.getTotalItems()); + } } /** @@ -580,7 +562,8 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements * @throws Exception the exception */ @Test(dataProvider = "testName") /*, dataProviderClass = AbstractServiceTestImpl.class, - dependsOnMethods = {"leafCreate"}) */ + dependsOnMethods = {"leafCreate"}) */ + public void readPaginatedList(String testName) throws Exception { // Perform setup. setupReadList(); @@ -589,18 +572,18 @@ 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*/, - EXPECTED_STATUS_CODE); + client, + 1 /*pgSz*/, + 0 /*pgNum*/, + EXPECTED_STATUS_CODE); if (list == null || list.getTotalItems() == 0) { - this.createPaginatedList(testName, DEFAULT_PAGINATEDLIST_SIZE); + this.createPaginatedList(testName, DEFAULT_PAGINATEDLIST_SIZE); setupReadList(); - list = (AbstractCommonList) this.readList(testName, - client, - 1 /*pgSz*/, - 0 /*pgNum*/, - EXPECTED_STATUS_CODE); + list = (AbstractCommonList) this.readList(testName, + client, + 1 /*pgSz*/, + 0 /*pgNum*/, + EXPECTED_STATUS_CODE); } // Print out the current list size to be paginated @@ -608,42 +591,42 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements long totalItems = list.getTotalItems(); Assert.assertFalse(totalItems == 0); if (getLogger().isDebugEnabled() == true) { - getLogger().debug(testName + ":" + "created list of " + - totalItems + " to be paginated."); + getLogger().debug(testName + ":" + "created list of " + + totalItems + " to be paginated."); } long pageSize = totalItems / 3; //create up to 3 pages to iterate over long pagesTotal = pageSize > 0 ? (totalItems / pageSize) : 0; for (int i = 0; i < pagesTotal; i++) { - list = (AbstractCommonList) this.readList(testName, client, pageSize, i, EXPECTED_STATUS_CODE); - assertPaginationInfo(testName, - list, - i, //expected page number - pageSize, //expected page size - pageSize, //expected num of items in page - totalItems);//expected total num of items + list = (AbstractCommonList) this.readList(testName, client, pageSize, i, EXPECTED_STATUS_CODE); + assertPaginationInfo(testName, + list, + i, //expected page number + pageSize, //expected page size + pageSize, //expected num of items in page + totalItems);//expected total num of items } // if there are any remainders be sure to paginate them as well long mod = pageSize != 0 ? totalItems % pageSize : totalItems; if (mod != 0) { - list = (AbstractCommonList) this.readList(testName, client, pageSize, pagesTotal, EXPECTED_STATUS_CODE); - assertPaginationInfo(testName, - list, - pagesTotal, //expected page number - pageSize, //expected page size - mod, //expected num of items in page - totalItems);//expected total num of items + list = (AbstractCommonList) this.readList(testName, client, pageSize, pagesTotal, EXPECTED_STATUS_CODE); + assertPaginationInfo(testName, + list, + pagesTotal, //expected page number + pageSize, //expected page size + mod, //expected num of items in page + totalItems);//expected total num of items } } - + @SuppressWarnings("rawtypes") - protected void updateLifeCycleState(String testName, String resourceId, String lifeCycleState) throws Exception { + protected void updateLifeCycleState(String testName, String resourceId, String lifeCycleState) throws Exception { // // Read the existing object // - CollectionSpaceClient client = this.getClientInstance(); - ClientResponse res = client.getWorkflow(resourceId); + CollectionSpaceClient client = this.getClientInstance(); + ClientResponse res = client.getWorkflow(resourceId); assertStatusCode(res, testName); logger.debug("Got object to update life cycle state with ID: " + resourceId); PoxPayloadIn input = new PoxPayloadIn(res.getEntity()); @@ -675,24 +658,24 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements Assert.assertNotNull(workflowCommons); Assert.assertEquals(updatedWorkflowCommons.getCurrentLifeCycleState(), lifeCycleState); } - + private CollectionSpacePoxClient assertPoxClient() { 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) { - clientCandidateName = clientCandidate.getClass().getName(); - } - String msg = "Workflow tests are incomplete because " + - clientCandidateName + " does not support readIncludeDeleted() method."; - logger.warn(msg); - throw new UnsupportedOperationException(); + String clientCandidateName = "Unknown"; + if (clientCandidate != null) { + clientCandidateName = clientCandidate.getClass().getName(); + } + String msg = "Workflow tests are incomplete because " + + clientCandidateName + " does not support readIncludeDeleted() method."; + logger.warn(msg); + throw new UnsupportedOperationException(); } - return (CollectionSpacePoxClient)clientCandidate; + return (CollectionSpacePoxClient) clientCandidate; } - - protected long readIncludeDeleted(String testName, Boolean includeDeleted) { - long result = 0; + + protected long readIncludeDeleted(String testName, Boolean includeDeleted) { + long result = 0; // Perform setup. setupReadList(); @@ -718,27 +701,27 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements // /* List items = - list.getListItem(); + list.getListItem(); result = items.size(); - */ + */ result = list.getTotalItems(); - + return result; - } - - protected long readItemsIncludeDeleted(String testName, String parentCsid, Boolean includeDeleted) { - long result = 0; + } + + protected long readItemsIncludeDeleted(String testName, String parentCsid, Boolean includeDeleted) { + long result = 0; // Perform setup. setupReadList(); // // Ask for a list of all resources filtered by the incoming 'includeDeleted' workflow param // - AuthorityClient client = (AuthorityClient)this.getClientInstance(); + AuthorityClient client = (AuthorityClient) this.getClientInstance(); ClientResponse res = client.readItemList(parentCsid, - null, /* partial terms */ - null, /* keywords */ - includeDeleted); + null, /* partial terms */ + null, /* keywords */ + includeDeleted); AbstractCommonList list = res.getEntity(); int statusCode = res.getStatus(); // @@ -753,63 +736,133 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); result = list.getTotalItems(); - + return result; - } - - /* - * This test assumes that no objects exist yet. - * - * http://localhost:8180/cspace-services/intakes?wf_deleted=false - */ + } + + /* + * This test assumes that no objects exist yet. + * + * http://localhost:8180/cspace-services/intakes?wf_deleted=false + */ @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class) - public void readWorkflow(String testName) throws Exception { - try { - // - // Get the total count of non-deleted existing records - // - long existingRecords = readIncludeDeleted(testName, Boolean.FALSE); - - // - // Create 3 new objects - // - final int OBJECTS_TO_CREATE = 3; - for (int i = 0; i < OBJECTS_TO_CREATE; i++) { - this.createWorkflowTarget(testName); - } - - // - // Mark one as soft deleted - // - int existingTestCreated = allResourceIdsCreated.size(); // assumption is that no other test created records were soft deleted - String csid = allResourceIdsCreated.get(existingTestCreated - 1); //0-based index to get the last one added - this.setupUpdate(); - this.updateLifeCycleState(testName, csid, WorkflowClient.WORKFLOWSTATE_DELETED); - // - // Read the list of existing non-deleted records - // - long updatedTotal = readIncludeDeleted(testName, Boolean.FALSE); - Assert.assertEquals(updatedTotal, existingRecords + OBJECTS_TO_CREATE - 1, "Deleted items seem to be returned in list results."); - - // - // Next, test that a GET with WorkflowClient.WORKFLOWSTATE_DELETED query param set to 'false' returns a 404 - // - CollectionSpacePoxClient client = this.assertPoxClient(); + public void readWorkflow(String testName) throws Exception { + try { + // + // Get the total count of non-deleted existing records + // + long existingRecords = readIncludeDeleted(testName, Boolean.FALSE); + + // + // Create 3 new objects + // + final int OBJECTS_TO_CREATE = 3; + for (int i = 0; i < OBJECTS_TO_CREATE; i++) { + this.createWorkflowTarget(testName); + } + + // + // Mark one as soft deleted + // + int existingTestCreated = allResourceIdsCreated.size(); // assumption is that no other test created records were soft deleted + String csid = allResourceIdsCreated.get(existingTestCreated - 1); //0-based index to get the last one added + this.setupUpdate(); + this.updateLifeCycleState(testName, csid, WorkflowClient.WORKFLOWSTATE_DELETED); + // + // Read the list of existing non-deleted records + // + long updatedTotal = readIncludeDeleted(testName, Boolean.FALSE); + Assert.assertEquals(updatedTotal, existingRecords + OBJECTS_TO_CREATE - 1, "Deleted items seem to be returned in list results."); + + // + // Next, test that a GET with WorkflowClient.WORKFLOWSTATE_DELETED query param set to 'false' returns a 404 + // + CollectionSpacePoxClient client = this.assertPoxClient(); ClientResponse 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; - } - } + + } catch (UnsupportedOperationException e) { + logger.warn(this.getClass().getName() + " did not implement createWorkflowTarget() method. No workflow tests performed."); + return; + } + } + + /* + * Test that searches honor the workflow deleted state. + */ + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class) + public void searchWorkflowDeleted(String testName) throws Exception { + + // FIXME: Temporarily avoid running test if client is of an authority service + CollectionSpacePoxClient client = this.assertPoxClient(); + if (isAuthorityClient(client)) { + return; + } + + try { + + // + // Create 3 new objects + // + final int OBJECTS_TO_CREATE = 3; + final String KEYWORD = NON_EXISTENT_KEYWORD + createIdentifier(); + for (int i = 0; i < OBJECTS_TO_CREATE; i++) { + this.createWorkflowTarget(testName, KEYWORD); + } + + // + // Mark one as soft deleted + // + int existingTestCreated = allResourceIdsCreated.size(); // assumption is that no other test created records were soft deleted + String csid = allResourceIdsCreated.get(existingTestCreated - 1); //0-based index to get the last one added + this.setupUpdate(); + this.updateLifeCycleState(testName, csid, WorkflowClient.WORKFLOWSTATE_DELETED); + + // + // Search for the newly-created records, excluding the soft deleted record. + // + // Send the search request and receive a response + ClientResponse res = client.keywordSearchIncludeDeleted(KEYWORD, Boolean.FALSE); + int result = res.getStatus(); + Assert.assertEquals(result, STATUS_OK); + + AbstractCommonList list = res.getEntity(); + long itemsMatchedBySearch = list.getTotalItems(); + Assert.assertEquals(itemsMatchedBySearch, OBJECTS_TO_CREATE - 1, + "Deleted items seem to be returned in list results."); + + // + // Search for the newly-created records, including the soft deleted record. + // + // Send the search request and receive a response + res = client.keywordSearchIncludeDeleted(KEYWORD, Boolean.TRUE); + result = res.getStatus(); + Assert.assertEquals(result, STATUS_OK); + + list = res.getEntity(); + itemsMatchedBySearch = list.getTotalItems(); + Assert.assertEquals(itemsMatchedBySearch, OBJECTS_TO_CREATE, + "Deleted item was not returned in list results, even though it was requested to be included."); + + } catch (UnsupportedOperationException e) { + logger.warn(this.getClass().getName() + " did not implement createWorkflowTarget() method. No workflow tests performed."); + return; + } + } protected String createTestObject(String testName) throws Exception { - String result = null; - - CollectionSpacePoxClient client = (CollectionSpacePoxClient)getClientInstance(); + String identifier = createIdentifier(); + String result = createTestObject(testName, identifier); + return result; + + } + + protected String createTestObject(String testName, String identifier) throws Exception { + String result = null; + + CollectionSpacePoxClient client = (CollectionSpacePoxClient) getClientInstance(); PoxPayloadOut multipart = createInstance(identifier); ClientResponse res = client.create(multipart); @@ -820,121 +873,162 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements allResourceIdsCreated.add(result); return result; - } - + } + protected String createWorkflowTarget(String testName) throws Exception { - String result = null; - - result = createTestObject(testName); - - return result; + String result = null; + result = createTestObject(testName); + return result; + } + + protected String createWorkflowTarget(String testName, String keyword) throws Exception { + String result = null; + result = createTestObject(testName, keyword); + return result; } - + /* * Sub-classes must override for the workflow tests. */ protected PoxPayloadOut createInstance(String identifier) { - logger.warn("Sub-class test clients should override this method"); - throw new UnsupportedOperationException(); + logger.warn("Sub-class test clients should override this method"); + + + throw new UnsupportedOperationException(); + + + } - + /* * Test classes for authority services should override these method and return 'true' */ protected boolean isAuthorityClient(CollectionSpaceClient theClient) { - return AuthorityClient.class.isInstance(theClient); + return AuthorityClient.class.isInstance(theClient); } - + protected PoxPayloadOut createItemInstance(String parentCsid, String identifier) { - logger.warn("Sub-class test clients should override this method"); - throw new UnsupportedOperationException(); - } - + logger.warn("Sub-class test clients should override this method"); + + + throw new UnsupportedOperationException(); + + + } + final protected String createWorkflowItemTarget(String testName, String parentCsid) throws Exception { - String result = null; - - result = createTestItemObject(testName, parentCsid); - - return result; + String result = null; + + result = createTestItemObject(testName, parentCsid); + + + + return result; + + } - + protected String createTestItemObject(String testName, String parentCsid) throws Exception { - String result = null; - - AuthorityClient client = (AuthorityClient)getClientInstance(); + String result = null; + + AuthorityClient client = (AuthorityClient) getClientInstance(); String identifier = createIdentifier(); PoxPayloadOut multipart = createItemInstance(parentCsid, identifier); ClientResponse res = client.createItem(parentCsid, multipart); + + int statusCode = res.getStatus(); Assert.assertEquals(statusCode, STATUS_CREATED); result = extractId(res); allResourceItemIdsCreated.put(result, parentCsid); + + return result; - } - - /* - * This test assumes that no objects exist yet. - * - * http://localhost:8180/cspace-services/intakes?wf_deleted=false - */ + + + } + + /* + * 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 readAuthorityItemWorkflow(String testName) throws Exception { - // - // Run this test only if the client is an AuthorityClient //FIXME: REM - Replace this will an AuthorityServiceTest class - // - if (this.isAuthorityClient(this.getClientInstance()) == true) { - try { - // - // Get the total count of non-deleted existing records - // - String parentCsid = this.createTestObject(testName); - - // - // Create 3 new items - // - final int OBJECTS_TO_CREATE = 3; - String lastCreatedItem = null; - for (int i = 0; i < OBJECTS_TO_CREATE; i++) { - lastCreatedItem = this.createWorkflowItemTarget(testName, parentCsid); - } - - // - // Mark one item as soft deleted - // - String csid = lastCreatedItem; - this.setupUpdate(); - this.updateItemLifeCycleState(testName, parentCsid, csid, WorkflowClient.WORKFLOWSTATE_DELETED); - // - // Read the list of existing non-deleted records - // - long updatedTotal = readItemsIncludeDeleted(testName, parentCsid, Boolean.FALSE); - Assert.assertEquals(updatedTotal, OBJECTS_TO_CREATE - 1, "Deleted items seem to be returned in list results."); - - // - // Next, test that a GET with WorkflowClient.WORKFLOWSTATE_DELETED query param set to 'false' returns a 404 - // - AuthorityClient client = (AuthorityClient)this.getClientInstance(); - ClientResponse res = client.readItem(parentCsid, csid, Boolean.FALSE); - int result = res.getStatus(); - Assert.assertEquals(result, STATUS_NOT_FOUND); - - } catch (UnsupportedOperationException e) { - logger.warn(this.getClass().getName() + " did not implement createWorkflowTarget() method. No workflow tests performed."); - return; - } - } - } - - protected void updateItemLifeCycleState(String testName, String parentCsid, String itemCsid, String lifeCycleState) throws Exception { + public void readAuthorityItemWorkflow(String testName) throws Exception { + // + // Run this test only if the client is an AuthorityClient //FIXME: REM - Replace this will an AuthorityServiceTest class + // + if (this.isAuthorityClient(this.getClientInstance()) == true) { + try { + // + // Get the total count of non-deleted existing records + // + String parentCsid = this.createTestObject(testName); + + // + // Create 3 new items + // + final int OBJECTS_TO_CREATE = 3; + String lastCreatedItem = null; + + + for (int i = 0; i + < OBJECTS_TO_CREATE; i++) { + lastCreatedItem = this.createWorkflowItemTarget(testName, parentCsid); + + + } // + // Mark one item as soft deleted + // + String csid = lastCreatedItem; + + + this.setupUpdate(); + + + this.updateItemLifeCycleState(testName, parentCsid, csid, WorkflowClient.WORKFLOWSTATE_DELETED); + // + // Read the list of existing non-deleted records + // + + + long updatedTotal = readItemsIncludeDeleted(testName, parentCsid, Boolean.FALSE); + Assert.assertEquals(updatedTotal, OBJECTS_TO_CREATE - 1, "Deleted items seem to be returned in list results."); + + // + // Next, test that a GET with WorkflowClient.WORKFLOWSTATE_DELETED query param set to 'false' returns a 404 + // + AuthorityClient client = (AuthorityClient) this.getClientInstance(); + ClientResponse res = client.readItem(parentCsid, csid, Boolean.FALSE); + + + int result = res.getStatus(); + Assert.assertEquals(result, STATUS_NOT_FOUND); + + + + } catch (UnsupportedOperationException e) { + logger.warn(this.getClass().getName() + " did not implement createWorkflowTarget() method. No workflow tests performed."); + + + return; + + + } + } + } + + protected void updateItemLifeCycleState(String testName, String parentCsid, String itemCsid, String lifeCycleState) throws Exception { // // Read the existing object // - AuthorityClient client = (AuthorityClient)this.getClientInstance(); - ClientResponse res = client.readItemWorkflow(parentCsid, itemCsid); - assertStatusCode(res, testName); + AuthorityClient client = (AuthorityClient) this.getClientInstance(); + ClientResponse res = client.readItemWorkflow(parentCsid, itemCsid); + assertStatusCode( + res, testName); logger.debug("Got object to update life cycle state with ID: " + itemCsid); PoxPayloadIn input = new PoxPayloadIn(res.getEntity()); WorkflowCommon workflowCommons = (WorkflowCommon) extractPart(input, WorkflowClient.SERVICE_COMMONPART_NAME, WorkflowCommon.class); @@ -942,7 +1036,8 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements // // Mark it for a soft delete. // - logger.debug("Current workflow state:" + objectAsXmlString(workflowCommons, WorkflowCommon.class)); + logger.debug( + "Current workflow state:" + objectAsXmlString(workflowCommons, WorkflowCommon.class)); workflowCommons.setCurrentLifeCycleState(lifeCycleState); PoxPayloadOut output = new PoxPayloadOut(WorkflowClient.SERVICE_PAYLOAD_NAME); PayloadOutputPart commonPart = output.addPart(WorkflowClient.SERVICE_COMMONPART_NAME, workflowCommons); @@ -959,12 +1054,13 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements // res = client.readItemWorkflow(parentCsid, itemCsid); assertStatusCode(res, testName); - logger.debug("Got workflow state of updated object with ID: " + itemCsid); + logger.debug( + "Got workflow state of updated object with ID: " + itemCsid); input = new PoxPayloadIn(res.getEntity()); updatedWorkflowCommons = (WorkflowCommon) extractPart(input, WorkflowClient.SERVICE_COMMONPART_NAME, WorkflowCommon.class); Assert.assertNotNull(workflowCommons); Assert.assertEquals(updatedWorkflowCommons.getCurrentLifeCycleState(), lifeCycleState); - } + } } diff --git a/services/collectionobject/client/src/main/java/org/collectionspace/services/client/CollectionObjectProxy.java b/services/collectionobject/client/src/main/java/org/collectionspace/services/client/CollectionObjectProxy.java index 8c5dadc66..517017ed1 100644 --- a/services/collectionobject/client/src/main/java/org/collectionspace/services/client/CollectionObjectProxy.java +++ b/services/collectionobject/client/src/main/java/org/collectionspace/services/client/CollectionObjectProxy.java @@ -83,5 +83,12 @@ public interface CollectionObjectProxy extends CollectionSpacePoxProxy keywordSearch( @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords); + + @Override + @GET + @Produces({"application/xml"}) + ClientResponse keywordSearchIncludeDeleted( + @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords, + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); } diff --git a/services/contact/client/src/main/java/org/collectionspace/services/client/ContactProxy.java b/services/contact/client/src/main/java/org/collectionspace/services/client/ContactProxy.java index 75d177049..274719c24 100644 --- a/services/contact/client/src/main/java/org/collectionspace/services/client/ContactProxy.java +++ b/services/contact/client/src/main/java/org/collectionspace/services/client/ContactProxy.java @@ -24,5 +24,12 @@ public interface ContactProxy extends CollectionSpacePoxProxy readIncludeDeleted( - @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + + @Override + @GET + @Produces({"application/xml"}) + ClientResponse keywordSearchIncludeDeleted( + @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords, + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); } diff --git a/services/dimension/client/src/main/java/org/collectionspace/services/client/DimensionProxy.java b/services/dimension/client/src/main/java/org/collectionspace/services/client/DimensionProxy.java index 63147349c..1e5c6a5dd 100644 --- a/services/dimension/client/src/main/java/org/collectionspace/services/client/DimensionProxy.java +++ b/services/dimension/client/src/main/java/org/collectionspace/services/client/DimensionProxy.java @@ -26,4 +26,11 @@ public interface DimensionProxy extends CollectionSpacePoxProxy readIncludeDeleted( @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + + @Override + @GET + @Produces({"application/xml"}) + ClientResponse keywordSearchIncludeDeleted( + @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords, + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); } diff --git a/services/dimension/client/src/test/java/org/collectionspace/services/client/test/DimensionServiceTest.java b/services/dimension/client/src/test/java/org/collectionspace/services/client/test/DimensionServiceTest.java index ad2878bd3..e546a0810 100644 --- a/services/dimension/client/src/test/java/org/collectionspace/services/client/test/DimensionServiceTest.java +++ b/services/dimension/client/src/test/java/org/collectionspace/services/client/test/DimensionServiceTest.java @@ -680,6 +680,16 @@ public class DimensionServiceTest extends AbstractServiceTestImpl { invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); } + + // --------------------------------------------------------------- + // Search tests + // --------------------------------------------------------------- + + @Override + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class) + public void searchWorkflowDeleted(String testName) throws Exception { + // Fixme: null test for now, overriding test in base class + } // --------------------------------------------------------------- // Utility tests : tests of code used in tests above 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 8bd496edf..35432ac5e 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 @@ -58,4 +58,11 @@ public interface IntakeProxy extends CollectionSpacePoxProxy @Produces({"application/xml"}) ClientResponse readIncludeDeleted( @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + + @Override + @GET + @Produces({"application/xml"}) + ClientResponse keywordSearchIncludeDeleted( + @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords, + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); } 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 6a9bd9159..8009531c7 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 @@ -25,5 +25,12 @@ public interface LoaninProxy extends CollectionSpacePoxProxy @GET @Produces({"application/xml"}) ClientResponse readIncludeDeleted( - @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + + @Override + @GET + @Produces({"application/xml"}) + ClientResponse keywordSearchIncludeDeleted( + @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords, + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); } diff --git a/services/loanout/client/src/main/java/org/collectionspace/services/client/LoanoutProxy.java b/services/loanout/client/src/main/java/org/collectionspace/services/client/LoanoutProxy.java index dfe92fae1..76bfa8fbe 100644 --- a/services/loanout/client/src/main/java/org/collectionspace/services/client/LoanoutProxy.java +++ b/services/loanout/client/src/main/java/org/collectionspace/services/client/LoanoutProxy.java @@ -27,5 +27,12 @@ public interface LoanoutProxy extends CollectionSpacePoxProxy readIncludeDeleted( - @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + + @Override + @GET + @Produces({"application/xml"}) + ClientResponse keywordSearchIncludeDeleted( + @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords, + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); } 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 6c00d76db..81168dcb6 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 @@ -57,5 +57,11 @@ public interface LocationAuthorityProxy extends AuthorityProxy readIncludeDeleted( @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); - + + @Override + @GET + @Produces({"application/xml"}) + ClientResponse keywordSearchIncludeDeleted( + @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords, + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); } diff --git a/services/media/client/src/main/java/org/collectionspace/services/client/MediaProxy.java b/services/media/client/src/main/java/org/collectionspace/services/client/MediaProxy.java index a2ac9fd37..ae38fb098 100644 --- a/services/media/client/src/main/java/org/collectionspace/services/client/MediaProxy.java +++ b/services/media/client/src/main/java/org/collectionspace/services/client/MediaProxy.java @@ -24,18 +24,30 @@ import org.collectionspace.services.client.workflow.WorkflowClient; @Consumes("application/xml") public interface MediaProxy extends CollectionSpacePoxProxy { - @POST - @Path("/{csid}") - @Consumes("multipart/form-data") - ClientResponse createBlobFromFormData(@PathParam("csid") String csid, - MultipartFormDataOutput formDataOutput); + // List + @GET + @Produces({"application/xml"}) + ClientResponse readList(); @Override @GET @Produces({"application/xml"}) ClientResponse readIncludeDeleted( - @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + + @Override + @GET + @Produces({"application/xml"}) + ClientResponse keywordSearchIncludeDeleted( + @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords, + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + @POST + @Path("/{csid}") + @Consumes("multipart/form-data") + ClientResponse createBlobFromFormData(@PathParam("csid") String csid, + MultipartFormDataOutput formDataOutput); + @POST @Path("/{csid}") @Produces("application/xml") @@ -43,8 +55,4 @@ public interface MediaProxy extends CollectionSpacePoxProxy ClientResponsecreateBlobFromUri(@PathParam("csid") String csid, @QueryParam(BlobClient.BLOB_URI_PARAM) String blobUri); - // List - @GET - @Produces({"application/xml"}) - ClientResponse readList(); } 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 ef0a39114..bdaf3a2c8 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 @@ -60,7 +60,14 @@ public interface MovementProxy extends CollectionSpacePoxProxy readIncludeDeleted( - @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + + @Override + @GET + @Produces({"application/xml"}) + ClientResponse keywordSearchIncludeDeleted( + @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords, + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); @GET @Produces({"application/xml"}) diff --git a/services/note/client/src/test/java/org/collectionspace/services/client/test/NoteServiceTest.java b/services/note/client/src/test/java/org/collectionspace/services/client/test/NoteServiceTest.java index 0c47c7f8f..f0a2ba32b 100644 --- a/services/note/client/src/test/java/org/collectionspace/services/client/test/NoteServiceTest.java +++ b/services/note/client/src/test/java/org/collectionspace/services/client/test/NoteServiceTest.java @@ -464,6 +464,16 @@ public class NoteServiceTest extends AbstractServiceTestImpl { invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); } + + // --------------------------------------------------------------- + // Search tests + // --------------------------------------------------------------- + + @Override + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class) + public void searchWorkflowDeleted(String testName) throws Exception { + // Fixme: null test for now, overriding test in base class + } // --------------------------------------------------------------- // Utility tests : tests of code used in tests above 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 c969f0a48..85ed676b0 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 @@ -26,4 +26,11 @@ public interface ObjectExitProxy extends CollectionSpacePoxProxy readIncludeDeleted( @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + + @Override + @GET + @Produces({"application/xml"}) + ClientResponse keywordSearchIncludeDeleted( + @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords, + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); } diff --git a/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityProxy.java b/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityProxy.java index f629829e8..43731b6d7 100644 --- a/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityProxy.java +++ b/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityProxy.java @@ -28,7 +28,15 @@ public interface OrgAuthorityProxy extends AuthorityWithContactsProxy readIncludeDeleted( - @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + + @Override + @GET + @Produces({"application/xml"}) + ClientResponse keywordSearchIncludeDeleted( + @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords, + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + /* * List results that must be overridden for the RESTEasy proxy generation to work correctly. diff --git a/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityProxy.java b/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityProxy.java index b193296cd..e39cdf1e4 100644 --- a/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityProxy.java +++ b/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityProxy.java @@ -29,7 +29,14 @@ public interface PersonAuthorityProxy extends AuthorityWithContactsProxy readIncludeDeleted( - @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + + @Override + @GET + @Produces({"application/xml"}) + ClientResponse keywordSearchIncludeDeleted( + @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords, + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); /* * List results that must be overridden for the RESTEasy proxy generation to work correctly. diff --git a/services/relation/client/src/main/java/org/collectionspace/services/client/RelationProxy.java b/services/relation/client/src/main/java/org/collectionspace/services/client/RelationProxy.java index debd053fd..e642644ec 100644 --- a/services/relation/client/src/main/java/org/collectionspace/services/client/RelationProxy.java +++ b/services/relation/client/src/main/java/org/collectionspace/services/client/RelationProxy.java @@ -30,6 +30,13 @@ public interface RelationProxy extends CollectionSpacePoxProxy readIncludeDeleted( @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + @Override + @GET + @Produces({"application/xml"}) + ClientResponse keywordSearchIncludeDeleted( + @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords, + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + @GET @Produces({"application/xml"}) ClientResponse readList( diff --git a/services/report/client/src/main/java/org/collectionspace/services/client/ReportProxy.java b/services/report/client/src/main/java/org/collectionspace/services/client/ReportProxy.java index 876eb4bea..11a8d1bae 100644 --- a/services/report/client/src/main/java/org/collectionspace/services/client/ReportProxy.java +++ b/services/report/client/src/main/java/org/collectionspace/services/client/ReportProxy.java @@ -59,5 +59,11 @@ public interface ReportProxy extends CollectionSpacePoxProxy @Produces({"application/xml"}) ClientResponse readIncludeDeleted( @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); - + + @Override + @GET + @Produces({"application/xml"}) + ClientResponse keywordSearchIncludeDeleted( + @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords, + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); } diff --git a/services/security/client/src/test/java/org/collectionspace/services/security/client/test/AuthenticationServiceTest.java b/services/security/client/src/test/java/org/collectionspace/services/security/client/test/AuthenticationServiceTest.java index be6b5888c..4995769f2 100644 --- a/services/security/client/src/test/java/org/collectionspace/services/security/client/test/AuthenticationServiceTest.java +++ b/services/security/client/src/test/java/org/collectionspace/services/security/client/test/AuthenticationServiceTest.java @@ -432,6 +432,16 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl { invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); res.releaseConnection(); } + + // --------------------------------------------------------------- + // Search tests + // --------------------------------------------------------------- + + @Override + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class) + public void searchWorkflowDeleted(String testName) throws Exception { + // Fixme: null test for now, overriding test in base class + } // --------------------------------------------------------------- // Utility methods used by tests above diff --git a/services/security/client/src/test/java/org/collectionspace/services/security/client/test/AuthorizationServiceTest.java b/services/security/client/src/test/java/org/collectionspace/services/security/client/test/AuthorizationServiceTest.java index 930ce12b1..8fad552e5 100644 --- a/services/security/client/src/test/java/org/collectionspace/services/security/client/test/AuthorizationServiceTest.java +++ b/services/security/client/src/test/java/org/collectionspace/services/security/client/test/AuthorizationServiceTest.java @@ -666,6 +666,16 @@ public class AuthorizationServiceTest extends AbstractServiceTestImpl { //ignoring this test as the service side returns 200 now even if it does //not find a record in the db } + + // --------------------------------------------------------------- + // Search tests + // --------------------------------------------------------------- + + @Override + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class) + public void searchWorkflowDeleted(String testName) throws Exception { + // Fixme: null test for now, overriding test in base class + } // --------------------------------------------------------------- // Utility tests : tests of code used in tests above diff --git a/services/security/client/src/test/java/org/collectionspace/services/security/client/test/MultiTenancyTest.java b/services/security/client/src/test/java/org/collectionspace/services/security/client/test/MultiTenancyTest.java index 5b4a18cec..69ffd03b6 100644 --- a/services/security/client/src/test/java/org/collectionspace/services/security/client/test/MultiTenancyTest.java +++ b/services/security/client/src/test/java/org/collectionspace/services/security/client/test/MultiTenancyTest.java @@ -599,6 +599,16 @@ public class MultiTenancyTest extends AbstractServiceTestImpl { //instead of giving FORBIDDEN Assert.assertEquals(statusCode, Response.Status.NOT_FOUND.getStatusCode()); } + + // --------------------------------------------------------------- + // Search tests + // --------------------------------------------------------------- + + @Override + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class) + public void searchWorkflowDeleted(String testName) throws Exception { + // Fixme: null test for now, overriding test in base class + } // --------------------------------------------------------------- // Utility tests : tests of code used in tests above diff --git a/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyProxy.java b/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyProxy.java index ec3d19c44..c6b082d07 100644 --- a/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyProxy.java +++ b/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyProxy.java @@ -31,7 +31,13 @@ public interface VocabularyProxy extends AuthorityProxy readIncludeDeleted( @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); - + @Override + @GET + @Produces({"application/xml"}) + ClientResponse keywordSearchIncludeDeleted( + @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords, + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + /* * List results that must be overridden for the RESTEasy proxy generation to work correctly. */ 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 5b42dc7f4..7f56bdfd2 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 @@ -205,6 +205,13 @@ public class WorkflowServiceTest extends AbstractServiceTestImpl { @Override public void updateWithWrongXmlSchema(String testName) throws Exception { } + + // --------------------------------------------------------------- + // Search tests + // --------------------------------------------------------------- + + public void searchWorkflowDeleted(String testName) throws Exception { + } // --------------------------------------------------------------- // Utility tests : tests of code used in tests above -- 2.47.3