]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-6909: All UCB botgarden service level procedures added and tested.
authorremillet <remillet@yahoo.com>
Mon, 3 Apr 2017 23:58:37 +0000 (16:58 -0700)
committerremillet <remillet@yahoo.com>
Mon, 3 Apr 2017 23:58:37 +0000 (16:58 -0700)
50 files changed:
3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/CreateVersionListener.java
3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/DeleteDeadLocationListener.java
3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateAccessCodeListener.java
3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateDeadFlagListener.java
3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateLocationListener.java
3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateRareFlagListener.java
3rdparty/nuxeo/nuxeo-platform-listener/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateStyledNameListener.java
3rdparty/nuxeo/nuxeo-platform-listener/naturalhistory/src/main/java/org/collectionspace/services/listener/naturalhistory/UpdateFormattedDisplayNameListener.java [moved from 3rdparty/nuxeo/nuxeo-platform-listener/naturalhistory/src/main/java/org/collectionspace/services/listener/ucb/UpdateFormattedDisplayNameListener.java with 97% similarity]
3rdparty/nuxeo/nuxeo-platform-listener/updateimagederivatives/src/main/java/org/collectionspace/services/listener/UpdateImageDerivatives.java
3rdparty/nuxeo/nuxeo-platform-listener/updateobjectlocationonmove/src/main/java/org/collectionspace/services/listener/AbstractUpdateObjectLocationValues.java
3rdparty/nuxeo/nuxeo-platform-listener/updaterelationsondelete/src/main/java/org/collectionspace/services/listener/UpdateRelationsOnDelete.java
services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java
services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountServiceTest.java
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java
services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/PermissionServiceTest.java
services/authorization/jaxb/src/main/resources/bindings.xjb [new file with mode: 0644]
services/authorization/jaxb/src/main/resources/roles.xsd
services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/schemas/batch_common.xsd
services/batch/build.xml
services/batch/pom.xml
services/batch/service/src/main/java/org/collectionspace/services/batch/AbstractBatchInvocable.java
services/batch/service/src/main/java/org/collectionspace/services/batch/BatchInvocable.java
services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/AbstractBatchJob.java
services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/ClearLocationLabelRequestBatchJob.java
services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/ClearPotTagLabelRequestBatchJob.java
services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/ClearVoucherLabelRequestBatchJob.java
services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/CreateVoucherBatchJob.java
services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/FormatTaxonBatchJob.java
services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/FormatVoucherNameBatchJob.java
services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/MergeAuthorityItemsBatchJob.java
services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/ReindexFullTextBatchJob.java
services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/UpdateDeadFlagBatchJob.java
services/client/src/main/java/org/collectionspace/services/client/test/AbstractAuthorityServiceTest.java
services/client/src/main/java/org/collectionspace/services/client/test/AbstractPoxServiceTestImpl.java
services/client/src/main/java/org/collectionspace/services/client/test/AbstractServiceTestImpl.java
services/client/src/main/java/org/collectionspace/services/client/test/BaseServiceTest.java
services/common/src/main/cspace/config/services/tenants/botgarden/botgarden-tenant-bindings.delta.xml [new file with mode: 0644]
services/common/src/main/java/org/collectionspace/services/common/CSWebApplicationException.java
services/common/src/main/java/org/collectionspace/services/common/NuxeoBasedResource.java
services/common/src/main/java/org/collectionspace/services/common/ResourceMapHolder.java
services/common/src/main/java/org/collectionspace/services/nuxeo/listener/AbstractCSEventListenerImpl.java
services/hyperjaxb/src/main/resources/bindings.xjb [new file with mode: 0644]
services/material/client/src/test/java/org/collectionspace/services/client/test/MaterialAuthorityServiceTest.java
services/pom.xml
services/pottag/client/src/main/resources/collectionspace-client.properties [new file with mode: 0644]
services/pottag/client/src/test/java/org/collectionspace/services/client/test/PottagServiceTest.java
services/propagation/client/src/main/resources/collectionspace-client.properties [new file with mode: 0644]
services/propagation/client/src/test/java/org/collectionspace/services/client/test/PropagationAuthRefsTest.java
services/propagation/jaxb/src/main/resources/propagations-common.xsd
services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java

index b380ae4e209a11e67b2ad701f8b5bfef5171ba0b..a30c848e70b74534efe6daaff0269cbcaecaf995 100644 (file)
@@ -17,10 +17,11 @@ public class CreateVersionListener extends AbstractCSEventListenerImpl {
 
        final Log logger = LogFactory.getLog(CreateVersionListener.class);
 
+       @Override
        public void handleEvent(Event event) {
                EventContext ec = event.getContext();
 
-               if (ec instanceof DocumentEventContext) {
+               if (isRegistered(event) && ec instanceof DocumentEventContext) {
                        DocumentEventContext context = (DocumentEventContext) ec;
 
                        if (ec.hasProperty(SKIP_PROPERTY) && ((Boolean) ec.getProperty(SKIP_PROPERTY))) {
index e8d14949b2561cc9d4fa1c7f9055d2fc84a874ae..45436ad9b21d626d0d3232f569dabfa94939192a 100644 (file)
@@ -18,10 +18,11 @@ public class DeleteDeadLocationListener extends AbstractCSEventListenerImpl {
     /* 
      * Delete dead locations. 
      */
-    public void handleEvent(Event event) {
+    @Override
+       public void handleEvent(Event event) {
         EventContext ec = event.getContext();
 
-        if (ec instanceof DocumentEventContext) {
+        if (isRegistered(event) && ec instanceof DocumentEventContext) {
             DocumentEventContext context = (DocumentEventContext) ec;
             DocumentModel doc = context.getSourceDocument();
 
index 36beffc0a16f593f89879d701be88c876ddf934f..64989d1adde41c330240a9163e24e56149e72618 100644 (file)
@@ -48,10 +48,11 @@ public class UpdateAccessCodeListener extends AbstractCSEventListenerImpl {
        private static final String TAXONOMIC_IDENT_GROUP_LIST_FIELD_NAME = TAXON_PATH_ELEMENTS[0];
        private static final String TAXON_FIELD_NAME = TAXON_PATH_ELEMENTS[2];
 
+       @Override
        public void handleEvent(Event event) {
                EventContext ec = event.getContext();
                
-               if (ec instanceof DocumentEventContext) {
+               if (isRegistered(event) && ec instanceof DocumentEventContext) {
                        DocumentEventContext context = (DocumentEventContext) ec;
                        DocumentModel doc = context.getSourceDocument();
 
index 751ab8e932a3672083b2a64e381ad62bae4ecc50..58c61f25e5d03272de30dc2ca3f67acd1c13b0c8 100644 (file)
@@ -24,10 +24,11 @@ public class UpdateDeadFlagListener extends AbstractCSEventListenerImpl {
        /* 
         * Set the dead flag and dead date on collectionobjects related to a new or modified movement record.
         */
+       @Override
        public void handleEvent(Event event) {
                EventContext ec = event.getContext();
 
-               if (ec instanceof DocumentEventContext) {
+               if (isRegistered(event) && ec instanceof DocumentEventContext) {
                        DocumentEventContext context = (DocumentEventContext) ec;
                        DocumentModel doc = context.getSourceDocument();
 
index c07711e89f1b5a6c7bd9e0dd7dc532d6219467b2..49e2f3aca48645a9fe4e345e65bb16af0ec440e2 100644 (file)
@@ -25,10 +25,11 @@ public class UpdateLocationListener extends AbstractCSEventListenerImpl {
         * <li>Set the previousLocation field to the previous value of the currentLocation field</li>
         * </ui>
         */
+       @Override
        public void handleEvent(Event event) {
                EventContext ec = event.getContext();
 
-               if (ec instanceof DocumentEventContext) {
+               if (isRegistered(event) && ec instanceof DocumentEventContext) {
                        DocumentEventContext context = (DocumentEventContext) ec;
                        DocumentModel doc = context.getSourceDocument();
 
index 3c7129ac8c24999c032a31e66d11ec2c1b4ea4cd..1f04c532041923213525383f00d2149f93c3a1f1 100644 (file)
@@ -6,8 +6,6 @@ import java.util.Map;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.collectionspace.services.batch.nuxeo.UpdateRareFlagBatchJob;
-import org.collectionspace.services.client.PoxPayloadIn;
-import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.client.workflow.WorkflowClient;
 import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectBotGardenConstants;
 import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectConstants;
@@ -42,10 +40,11 @@ public class UpdateRareFlagListener extends AbstractCSEventListenerImpl {
        private static final String PLANT_ATTRIBUTES_GROUP_LIST_FIELD_NAME = CONSERVATION_CATEGORY_PATH_ELEMENTS[0];
        private static final String CONSERVATION_CATEGORY_FIELD_NAME = CONSERVATION_CATEGORY_PATH_ELEMENTS[2];
 
+       @Override
        public void handleEvent(Event event) {
                EventContext ec = event.getContext();
 
-               if (ec instanceof DocumentEventContext) {
+               if (isRegistered(event) && ec instanceof DocumentEventContext) {
                        DocumentEventContext context = (DocumentEventContext) ec;
                        DocumentModel doc = context.getSourceDocument();
 
@@ -191,7 +190,7 @@ public class UpdateRareFlagListener extends AbstractCSEventListenerImpl {
        }
 
        private UpdateRareFlagBatchJob createUpdater() {
-               ResourceMap<PoxPayloadIn, PoxPayloadOut> resourceMap = ResteasyProviderFactory.getContextData(ResourceMap.class);
+               ResourceMap resourceMap = ResteasyProviderFactory.getContextData(ResourceMap.class);
 
                UpdateRareFlagBatchJob updater = new UpdateRareFlagBatchJob();
                updater.setResourceMap(resourceMap);
index 7208e89ad1e4f0986e53a21cccace233fca3f518..1952efc321e6e4969b7d2f5cafcc7ce4a86c0545 100644 (file)
@@ -5,8 +5,6 @@ import org.apache.commons.logging.LogFactory;
 import org.jboss.resteasy.spi.ResteasyProviderFactory;
 
 import org.collectionspace.services.batch.nuxeo.FormatVoucherNameBatchJob;
-import org.collectionspace.services.client.PoxPayloadIn;
-import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.client.workflow.WorkflowClient;
 import org.collectionspace.services.common.ResourceMap;
 import org.collectionspace.services.loanout.nuxeo.LoanoutBotGardenConstants;
@@ -24,10 +22,11 @@ public class UpdateStyledNameListener extends AbstractCSEventListenerImpl {
 
        final Log logger = LogFactory.getLog(UpdateStyledNameListener.class);
 
+       @Override
        public void handleEvent(Event event) {
                EventContext ec = event.getContext();
 
-               if (ec instanceof DocumentEventContext) {
+               if (isRegistered(event) && ec instanceof DocumentEventContext) {
                        DocumentEventContext context = (DocumentEventContext) ec;
                        DocumentModel doc = context.getSourceDocument();
 
@@ -83,7 +82,7 @@ public class UpdateStyledNameListener extends AbstractCSEventListenerImpl {
        }
        
        private FormatVoucherNameBatchJob createFormatter() {
-               ResourceMap<PoxPayloadIn, PoxPayloadOut> resourceMap = ResteasyProviderFactory.getContextData(ResourceMap.class);
+               ResourceMap resourceMap = ResteasyProviderFactory.getContextData(ResourceMap.class);
 
                FormatVoucherNameBatchJob formatter = new FormatVoucherNameBatchJob();
                formatter.setResourceMap(resourceMap);
@@ -1,4 +1,4 @@
-package org.collectionspace.services.listener.ucb;
+package org.collectionspace.services.listener.naturalhistory;
 
 import java.util.HashMap;
 import java.util.List;
@@ -36,7 +36,7 @@ public class UpdateFormattedDisplayNameListener extends AbstractCSEventListenerI
        public void handleEvent(Event event) {
                EventContext ec = event.getContext();
 
-               if (ec instanceof DocumentEventContext) {
+               if (isRegistered(event) && ec instanceof DocumentEventContext) {
                        DocumentEventContext context = (DocumentEventContext) ec;
                        DocumentModel doc = context.getSourceDocument();
 
index 2403628662bc94e7efdc153a6ae7b47b67797b63..2d2164e126c84aafa6dbe58bde7429287bdeafad 100644 (file)
@@ -113,7 +113,7 @@ public class UpdateImageDerivatives extends AbstractCSEventListenerImpl {
 
                EventContext eventContext = event.getContext();
                if (eventContext != null) {
-                       if (eventContext instanceof DocumentEventContext) {
+                       if (isRegistered(event) && eventContext instanceof DocumentEventContext) {
                                result = true;
                        }
                }
index 9430b3e925f364f3026684e75a393665181ba95a..68cb1432a9e628e80848767e06ba9ab493fe49bd 100644 (file)
@@ -7,6 +7,7 @@ import java.util.Set;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.collectionspace.services.client.LocationAuthorityClient;
 import org.collectionspace.services.client.workflow.WorkflowClient;
 import org.collectionspace.services.collectionobject.nuxeo.CollectionObjectConstants;
@@ -18,9 +19,7 @@ import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
 import org.collectionspace.services.nuxeo.client.java.CoreSessionWrapper;
 import org.collectionspace.services.nuxeo.listener.AbstractCSEventListenerImpl;
 import org.collectionspace.services.nuxeo.util.NuxeoUtils;
-import org.nuxeo.common.collections.ScopeType;
-import org.nuxeo.common.collections.ScopedMap;
-import org.nuxeo.ecm.core.api.ClientException;
+
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.DocumentModelList;
 import org.nuxeo.ecm.core.api.event.DocumentEventTypes;
@@ -138,7 +137,7 @@ public abstract class AbstractUpdateObjectLocationValues extends AbstractCSEvent
     }
 
     @Override
-    public void handleEvent(Event event) throws ClientException {
+    public void handleEvent(Event event) {
         // Ensure we have all the event data we need to proceed.
         if (isRegistered(event) == false || !(event.getContext() instanceof DocumentEventContext)) {
                if (logger.isTraceEnabled() == true) {
@@ -147,7 +146,7 @@ public abstract class AbstractUpdateObjectLocationValues extends AbstractCSEvent
             return;
         }
 
-        Map<String, String> params = this.getParams(event);
+        Map<String, String> params = this.getParams(event);  // Will be null if no params were configured.
         logEvent(event, "Update Location");
 
         DocumentEventContext docEventContext = (DocumentEventContext) event.getContext();
@@ -302,7 +301,7 @@ public abstract class AbstractUpdateObjectLocationValues extends AbstractCSEvent
      * related to the Movement record.
      */
     private Set<String> getCollectionObjectCsidsRelatedToMovement(String movementCsid,
-            CoreSessionInterface coreSession) throws ClientException {
+            CoreSessionInterface coreSession) {
 
         Set<String> csids = new HashSet<>();
 
@@ -387,13 +386,9 @@ public abstract class AbstractUpdateObjectLocationValues extends AbstractCSEvent
         boolean isActiveDocument = false;
 
         if (docModel != null) {                
-               try {
-                   if (!docModel.getCurrentLifeCycleState().contains(WorkflowClient.WORKFLOWSTATE_DELETED)) {
-                       isActiveDocument = true;
-                   }
-               } catch (ClientException ce) {
-                   logger.warn("Error while identifying whether document is an active document: ", ce);
-               }
+            if (!docModel.getCurrentLifeCycleState().contains(WorkflowClient.WORKFLOWSTATE_DELETED)) {
+                isActiveDocument = true;
+            }
                //
                // If doc model is the target of the "aboutToBeRemoved" event, mark it as not active.
                //
@@ -495,8 +490,7 @@ public abstract class AbstractUpdateObjectLocationValues extends AbstractCSEvent
      */
     protected String getMostRecentLocation(Event event,
                CoreSessionInterface session, String collectionObjectCsid,
-            boolean isAboutToBeRemovedEvent, String eventMovementCsid)
-            throws ClientException {
+            boolean isAboutToBeRemovedEvent, String eventMovementCsid) {
        //
        // Assume we can determine the most recent location by creating an indeterminate result
        //
@@ -739,7 +733,7 @@ public abstract class AbstractUpdateObjectLocationValues extends AbstractCSEvent
      * and related document types.
      */
     protected static String getCsidForDesiredDocTypeFromRelation(DocumentModel relationDocModel,
-            String desiredDocType, String relatedDocType) throws ClientException {
+            String desiredDocType, String relatedDocType) {
         String csid = null;
         String subjectDocType = (String) relationDocModel.getProperty(RELATIONS_COMMON_SCHEMA, SUBJECT_DOCTYPE_PROPERTY);
         String objectDocType = (String) relationDocModel.getProperty(RELATIONS_COMMON_SCHEMA, OBJECT_DOCTYPE_PROPERTY);
@@ -768,6 +762,5 @@ public abstract class AbstractUpdateObjectLocationValues extends AbstractCSEvent
      */
     protected abstract boolean updateCollectionObjectLocation(DocumentModel collectionObjectDocModel,
                DocumentModel movmentDocModel,
-               String movementRecordsLocation)
-            throws ClientException;
+               String movementRecordsLocation);
 }
\ No newline at end of file
index 2e1477d5e6f4ea7dc08d2573cbe7cf06858d5554..861838cbe9607e2568d24b7208847fb8d143ee3a 100644 (file)
@@ -15,7 +15,6 @@ import org.nuxeo.ecm.core.api.DocumentModelList;
 import org.nuxeo.ecm.core.api.impl.LifeCycleFilter;
 import org.nuxeo.ecm.core.event.Event;
 import org.nuxeo.ecm.core.event.EventContext;
-import org.nuxeo.ecm.core.event.EventListener;
 import org.nuxeo.ecm.core.event.impl.DocumentEventContext;
 
 public class UpdateRelationsOnDelete extends AbstractCSEventListenerImpl {
@@ -35,7 +34,7 @@ public class UpdateRelationsOnDelete extends AbstractCSEventListenerImpl {
         
         EventContext eventContext = event.getContext();
 
-        if (isDocumentSoftDeletedEvent(eventContext)) {
+        if (isRegistered(event) && isDocumentSoftDeletedEvent(eventContext)) {
             
             logger.trace("A soft deletion event was received by UpdateRelationsOnDelete ...");
             
index 112e365a4b3db2bde42d237ca3a2830c3fa7c266..067d2fae078bbbe8713a9285a38f9cd3cf997f34 100644 (file)
@@ -25,8 +25,6 @@ package org.collectionspace.services.jaxrs;
 import org.collectionspace.services.account.AccountResource;
 import org.collectionspace.services.account.TenantResource;
 import org.collectionspace.services.blob.BlobResource;
-import org.collectionspace.services.client.PoxPayloadIn;
-import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.collectionobject.CollectionObjectResource;
 import org.collectionspace.services.id.IDResource;
 import org.collectionspace.services.media.MediaResource;
@@ -168,7 +166,7 @@ public class CollectionSpaceJaxRsApplication extends Application
     }
 
     @Override
-    public ResourceMap<PoxPayloadIn, PoxPayloadOut> getResourceMap() {
+    public ResourceMap getResourceMap() {
         return resourceMap;
     }
     
index 3887bbcc77bc5467c18f88d38f42ce85ee4d699a..e1ae0fffa4918ab475d3b18101e1338fbb32e14d 100644 (file)
@@ -384,32 +384,6 @@ public class AccountServiceTest extends AbstractServiceTestImpl<AccountsCommonLi
         }
     }
 
-    //
-    // Tests with expected failure outcomes
-    //
-    // Placeholders until the three tests below can be uncommented.
-    // See Issue CSPACE-401.
-    @Override
-    public void createWithEmptyEntityBody(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
-     */
-    @Override
-    public void createWithMalformedXml(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
-     */
-    @Override
-    public void createWithWrongXmlSchema(String testName) throws Exception {
-        //FIXME: Should this test really be empty?  If so, please comment accordingly.
-    }
-
     // ---------------------------------------------------------------
     // CRUD tests : READ_LIST tests
     // ---------------------------------------------------------------
index 58ddcc3bfd0c0d939670649fc3c53b3067f73371..15fa80f258dc5e398c3dfcebc6461143307a3936 100644 (file)
@@ -227,7 +227,7 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
                return tempResult.CSID;
        }
        
-       protected String lookupParentCSID(ServiceContext ctx, String parentspecifier, String method,
+       protected String lookupParentCSID(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx, String parentspecifier, String method,
                        String op, UriInfo uriInfo) throws Exception {
                CsidAndShortIdentifier tempResult = lookupParentCSIDAndShortIdentifer(ctx,
                                parentspecifier, method, op, uriInfo);
@@ -236,7 +236,7 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
 
 
     private CsidAndShortIdentifier lookupParentCSIDAndShortIdentifer(
-               ServiceContext existingCtx, // Ok to be null
+               ServiceContext<PoxPayloadIn, PoxPayloadOut> existingCtx, // Ok to be null
                String parentIdentifier,
                String method,
                String op,
@@ -630,7 +630,7 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
      * @return
      * @throws Exception
      */
-    protected Response createAuthorityItem(ServiceContext ctx, String parentIdentifier,
+    protected Response createAuthorityItem(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx, String parentIdentifier,
                boolean shouldUpdateRevNumber,
                boolean isProposed,
                boolean isSasItem) throws Exception {
@@ -662,7 +662,7 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
      * @return
      * @throws Exception
      */
-    public Response createAuthorityItemWithParentContext(ServiceContext parentCtx,
+    public Response createAuthorityItemWithParentContext(ServiceContext<PoxPayloadIn, PoxPayloadOut> parentCtx,
                String parentIdentifier,
                PoxPayloadIn input,
                boolean shouldUpdateRevNumber,
@@ -742,7 +742,7 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
         PoxPayloadOut result = null;
         
         try {
-            ServiceContext ctx = createServiceContext(getItemServiceName(), uriInfo);
+            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(getItemServiceName(), uriInfo);
             result = updateItemWorkflowWithTransition(ctx, 
                        parentIdentifier, itemIdentifier, transition, AuthorityServiceUtils.UPDATE_REV);
         } catch (Exception e) {
@@ -761,7 +761,7 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
      * @return
      * @throws DocumentReferenceException 
      */
-    public PoxPayloadOut updateItemWorkflowWithTransition(ServiceContext existingContext,
+    public PoxPayloadOut updateItemWorkflowWithTransition(ServiceContext<PoxPayloadIn, PoxPayloadOut> existingContext,
             String parentIdentifier,
             String itemIdentifier,
             String transition,
@@ -818,7 +818,7 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
     }
     
     private PoxPayloadOut getAuthorityItem(
-               ServiceContext ctx,
+               ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
             String parentIdentifier,
             String itemIdentifier) throws Exception {
        PoxPayloadOut result = null;
@@ -852,12 +852,12 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
     }
 
     public PoxPayloadOut getAuthorityItemWithExistingContext(
-               ServiceContext existingCtx,
+               ServiceContext<PoxPayloadIn, PoxPayloadOut> existingCtx,
             String parentIdentifier,
             String itemIdentifier) throws Exception {
        PoxPayloadOut result = null;
        
-        ServiceContext ctx = createServiceContext(getItemServiceName(), existingCtx.getResourceMap(), existingCtx.getUriInfo());
+        ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(getItemServiceName(), existingCtx.getResourceMap(), existingCtx.getUriInfo());
         if (existingCtx.getCurrentRepositorySession() != null) {
                ctx.setCurrentRepositorySession(existingCtx.getCurrentRepositorySession()); // Reuse the current repo session if one exists
                ctx.setProperties(existingCtx.getProperties());
@@ -938,7 +938,7 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
      * @param ui passed to include additional parameters, like pagination controls
      *
      */
-    public AbstractCommonList getAuthorityItemList(ServiceContext existingContext,
+    public AbstractCommonList getAuthorityItemList(ServiceContext<PoxPayloadIn, PoxPayloadOut> existingContext,
                String authorityIdentifier,
             UriInfo uriInfo) throws Exception {
        AbstractCommonList result = null;
@@ -1061,7 +1061,7 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
     }
     
     public AuthorityRefDocList getReferencingObjects(
-               ServiceContext existingContext,
+               ServiceContext<PoxPayloadIn, PoxPayloadOut> existingContext,
             String parentspecifier,
             String itemspecifier,
             UriTemplateRegistry uriTemplateRegistry,
@@ -1116,7 +1116,6 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
         try {
             // Note that we have to create the service context for the Items, not the main service
             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(getItemServiceName(), uriInfo);
-            MultivaluedMap<String, String> queryParams = ctx.getQueryParams();
             String parentcsid = lookupParentCSID(parentspecifier, "getAuthorityItemAuthRefs(parent)", "GET_ITEM_AUTH_REFS", uriInfo);
             // We omit the parentShortId, only needed when doing a create...
             DocumentModelHandler<?, AbstractCommonList> handler =
@@ -1141,9 +1140,8 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
      * @return
      * @throws Exception
      */
-    @SuppressWarnings("unchecked")
-       private PoxPayloadOut synchronizeItem(
-               ServiceContext ctx,
+    private PoxPayloadOut synchronizeItem(
+               ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
             String parentIdentifier,
             String itemIdentifier,
             boolean syncHierarchicalRelationships) throws Exception {
@@ -1180,7 +1178,7 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
      * @throws Exception
      */
     public PoxPayloadOut synchronizeItemWithExistingContext(
-               ServiceContext existingCtx,
+               ServiceContext<PoxPayloadIn, PoxPayloadOut> existingCtx,
             String parentIdentifier,
             String itemIdentifier,
             boolean syncHierarchicalRelationships
@@ -1276,7 +1274,7 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
     }
     
     public PoxPayloadOut updateAuthorityItem(
-               ServiceContext itemServiceCtx, // Ok to be null.  Will be null on PUT calls, but not on sync calls
+               ServiceContext<PoxPayloadIn, PoxPayloadOut> itemServiceCtx, // Ok to be null.  Will be null on PUT calls, but not on sync calls
                ResourceMap resourceMap, 
             UriInfo uriInfo,
             String parentspecifier,
@@ -1342,7 +1340,7 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
         }
         
         try {
-            ServiceContext ctx = createServiceContext(getItemServiceName(), uriInfo);
+            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(getItemServiceName(), uriInfo);
             deleteAuthorityItem(ctx, parentIdentifier, itemIdentifier, AuthorityServiceUtils.UPDATE_REV);
             result = Response.status(HttpResponseCodes.SC_OK).build();
         } catch (Exception e) {
@@ -1360,7 +1358,7 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
      * @throws Exception
      */
     @SuppressWarnings("rawtypes")
-       public boolean deleteAuthorityItem(ServiceContext existingCtx,
+       public boolean deleteAuthorityItem(ServiceContext<PoxPayloadIn, PoxPayloadOut> existingCtx,
             String parentIdentifier,
             String itemIdentifier,
             boolean shouldUpdateRevNumber
@@ -1452,7 +1450,8 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
     /**
      * 
      */
-    public ServiceDescription getDescription(ServiceContext ctx) {
+    @Override
+       public ServiceDescription getDescription(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx) {
        ServiceDescription result = super.getDescription(ctx);
        result.setSubresourceDocumentType(this.getItemDocType(ctx.getTenantId()));
        return result;
index eea6502f5d15ea02dc59dc3dba3f6dba49655e7d..b6871cdf98cfae6ef4e7b8d79039d489a85c03f4 100644 (file)
@@ -38,6 +38,7 @@ import org.collectionspace.services.authorization.perms.PermissionAction;
 import org.collectionspace.services.authorization.perms.PermissionsList;
 import org.collectionspace.services.client.PermissionFactory;
 import org.collectionspace.services.client.test.AbstractServiceTestImpl;
+import org.collectionspace.services.client.test.ServiceRequestType;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 import org.slf4j.Logger;
@@ -89,7 +90,8 @@ public class PermissionServiceTest extends AbstractServiceTestImpl<PermissionsLi
     /**
      * The entity type expected from the JAX-RS Response object
      */
-    public Class<Permission> getEntityResponseType() {
+    @Override
+       public Class<Permission> getEntityResponseType() {
        return Permission.class;
     }
     
@@ -107,6 +109,36 @@ public class PermissionServiceTest extends AbstractServiceTestImpl<PermissionsLi
        return knownResource;
     }
     
+    /**
+     * Sets up create tests with empty entity body.
+     */
+    @Override
+       protected void setupCreateWithEmptyEntityBody() {
+        testExpectedStatusCode = STATUS_INTERNAL_SERVER_ERROR;  // Empty payload never gets past RESTEasy filter
+        testRequestType = ServiceRequestType.CREATE;
+        testSetup(testExpectedStatusCode, testRequestType);
+    }
+    
+    /**
+     * Sets up create tests with malformed xml.
+     */
+    @Override
+       protected void setupCreateWithMalformedXml() {
+        testExpectedStatusCode = STATUS_INTERNAL_SERVER_ERROR;  // Malformed payload never gets past RESTEasy filter
+        testRequestType = ServiceRequestType.CREATE;
+        testSetup(testExpectedStatusCode, testRequestType);
+    }
+
+    /**
+     * Sets up create tests with wrong xml schema.
+     */
+    @Override
+       protected void setupCreateWithWrongXmlSchema() {
+        testExpectedStatusCode = STATUS_INTERNAL_SERVER_ERROR;  // Empty payload never gets past RESTEasy filter
+        testRequestType = ServiceRequestType.CREATE;
+        testSetup(testExpectedStatusCode, testRequestType);
+    }    
+    
     /**
      * Creates the without resource name.
      *
@@ -430,23 +462,23 @@ public class PermissionServiceTest extends AbstractServiceTestImpl<PermissionsLi
        // Do nothing.  Simply here to for a TestNG execution order for our tests
     }
 
-       @Override
-       public void updateWithEmptyEntityBody(String testName) throws Exception {
-               // TODO Auto-generated method stub
-               
-       }
-
-       @Override
-       public void updateWithMalformedXml(String testName) throws Exception {
-               // TODO Auto-generated method stub
-               
-       }
-
-       @Override
-       public void updateWithWrongXmlSchema(String testName) throws Exception {
-               // TODO Auto-generated method stub
-               
-       }
+//     @Override
+//     public void updateWithEmptyEntityBody(String testName) throws Exception {
+//             // TODO Auto-generated method stub
+//             
+//     }
+//
+//     @Override
+//     public void updateWithMalformedXml(String testName) throws Exception {
+//             // TODO Auto-generated method stub
+//             
+//     }
+//
+//     @Override
+//     public void updateWithWrongXmlSchema(String testName) throws Exception {
+//             // TODO Auto-generated method stub
+//             
+//     }
 
        @Override
        protected long getSizeOfList(PermissionsList list) {
diff --git a/services/authorization/jaxb/src/main/resources/bindings.xjb b/services/authorization/jaxb/src/main/resources/bindings.xjb
new file mode 100644 (file)
index 0000000..8dbc3ef
--- /dev/null
@@ -0,0 +1,29 @@
+<jaxb:bindings version="1.0"
+  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+  xmlns:annox="http://annox.dev.java.net"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema">
+  <!--
+    <jaxb:bindings schemaLocation="permissions_roles.xsd" node="/xs:schema">
+        <jaxb:bindings node="xs:complexType[@name='permission_role']">
+            <annox:annotate>
+                <annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement" name="permission_role" />
+            </annox:annotate>
+        </jaxb:bindings>
+    </jaxb:bindings>
+       <jaxb:bindings schemaLocation="accounts_roles.xsd" node="/xs:schema">
+        <jaxb:bindings node="xs:complexType[@name='account_role']">
+            <annox:annotate>
+                <annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement" name="account_role" />
+            </annox:annotate>
+        </jaxb:bindings>
+    </jaxb:bindings>
+       <jaxb:bindings schemaLocation="accounts_permissions.xsd" node="/xs:schema">
+        <jaxb:bindings node="xs:complexType[@name='account_permission']">
+            <annox:annotate>
+                <annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement" name="account_permission" />
+            </annox:annotate>
+        </jaxb:bindings>
+    </jaxb:bindings>
+    -->
+</jaxb:bindings>
\ No newline at end of file
index ee3103d238deaeef5e9bdacad43e5fd87139b4f0..e9d9492abfc3ca9cb45b1896638bf1f4270c63f5 100644 (file)
@@ -1,15 +1,4 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-
-<!--
-    CollectionSpace default (security) authorization provider schema (XSD)
-
-    Entity(s)  : role
-    Used for:
-
-    $LastChangedRevision: 916 $
-    $LastChangedDate: 2009-11-05 16:59:20 -0800 (Thu, 05 Nov 2009) $
--->
-
 <xs:schema 
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
@@ -41,7 +30,7 @@
        <xs:annotation>
                <xs:appinfo>
                        <jaxb:globalBindings generateIsSetMethod="true" localScoping="toplevel">
-                               <jaxb:serializable/>
+                               <jaxb:serializable uid="1966"/>
                        </jaxb:globalBindings>
                </xs:appinfo>
        </xs:annotation>
index d0e5c17298e943cf5b3977472c1bdfb173e70d98..ac277ba6857e5f71187aaeb7f261ecaf643461ab 100644 (file)
     <xs:element name="forDocTypes">
                <xs:complexType>
                        <xs:sequence>
-                               <xs:element name="forDocType" type="xs:string" minOccurs="1" maxOccurs="unbounded" />
+                               <xs:element name="forDocType" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
                        </xs:sequence>
                </xs:complexType>
        </xs:element>
     <xs:element name="forRoles">
         <xs:complexType>
             <xs:sequence>
-                <xs:element name="roleDisplayName" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
+                <xs:element name="roleDisplayName" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
             </xs:sequence>
         </xs:complexType>
     </xs:element>
@@ -46,7 +46,7 @@
     
     <xs:complexType name="resourceActionGroupList">
         <xs:sequence>
-            <xs:element name="resourceActionGroup" type="resourceActionGroup" minOccurs="3" maxOccurs="unbounded"/>
+            <xs:element name="resourceActionGroup" type="resourceActionGroup" minOccurs="0" maxOccurs="unbounded"/>
         </xs:sequence>
     </xs:complexType>
     
index 6984ff89bfbf26518b58f5dbbe4d07044f44f346..b672c881b58156d40641b3b5711e285dbfa8a0c3 100644 (file)
     </target>
 
     <target name="deploy" depends="install" description="deploy batch service">
-        <!-- Now obsolete since the Nuxeo artifact is now created and deployed from config in the Application Layer -->
+        <!-- Now obsolete since the Nuxeo artifact is now created and deployed using config from the Application Layer -->
         <!--
         <ant antfile="3rdparty/build.xml" target="deploy" inheritall="false"/>
         -->
index 7e5fd97f39ba3629efaf24dcf500d5bfecf2b6fc..2ca7ff38c728dea4fb4c4a029e3a26e28a853b04 100644 (file)
@@ -8,7 +8,6 @@
     </parent>
     
     <modelVersion>4.0.0</modelVersion>
-    <groupId>org.collectionspace.services</groupId>
     <artifactId>org.collectionspace.services.batch</artifactId>
     <name>services.batch</name>
     <packaging>pom</packaging>
index a61886197e3f8de96e9ee62339e437ad3bcd40b9..92b9507de0c5919f18fa330e32545fd5529b725a 100644 (file)
@@ -41,7 +41,7 @@ public abstract class AbstractBatchInvocable implements BatchInvocable {
     
     private ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx;
     private List<String> invocationModes;
-    private ResourceMap<PoxPayloadIn, PoxPayloadOut> resourceMap;
+    private ResourceMap resourceMap;
 
     protected InvocationContext invocationCtx;
     protected int completionStatus;
@@ -70,12 +70,12 @@ public abstract class AbstractBatchInvocable implements BatchInvocable {
         this.invocationModes = invocationModes;
     }
 
-    public ResourceMap<PoxPayloadIn, PoxPayloadOut> getResourceMap() {
+    public ResourceMap getResourceMap() {
         return resourceMap;
     }
 
     @Override
-    public void setResourceMap(ResourceMap<PoxPayloadIn, PoxPayloadOut> resourceMap) {
+    public void setResourceMap(ResourceMap resourceMap) {
         this.resourceMap = resourceMap;
     }
 
index 2ddc5a12a6b55e6ce719cd92f492740f1e35427f..d608b39f5ec399619d361061bdcd170ce6912f16 100644 (file)
@@ -1,7 +1,5 @@
 package org.collectionspace.services.batch;
 
-import org.collectionspace.services.client.PoxPayloadIn;
-import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.ResourceMap;
 import org.collectionspace.services.common.invocable.Invocable;
 import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
@@ -12,7 +10,7 @@ public interface BatchInvocable extends Invocable {
         * Sets the invocation context for the batch job. Called before run().
         * @param context an instance of InvocationContext.
         */
-       public void setResourceMap(ResourceMap<PoxPayloadIn, PoxPayloadOut> resourceMap);
+       public void setResourceMap(ResourceMap resourceMap);
 
        public CoreSessionInterface getRepoSession();
 
index e37ce40a8e1eec6b5c767cb6badbfdaba8b94937..a99ece77b04162a6a4ff2faef1f883aa55272118 100644 (file)
@@ -14,6 +14,7 @@ import javax.ws.rs.core.UriInfo;
 
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.lang.StringUtils;
+
 import org.collectionspace.services.batch.AbstractBatchInvocable;
 import org.collectionspace.services.client.CollectionObjectClient;
 import org.collectionspace.services.client.CollectionSpaceClient;
@@ -33,6 +34,7 @@ import org.collectionspace.services.common.UriTemplateRegistry;
 import org.collectionspace.services.common.api.RefName;
 import org.collectionspace.services.common.authorityref.AuthorityRefDocList;
 import org.collectionspace.services.common.context.ServiceBindingUtils;
+import org.collectionspace.services.common.query.UriInfoImpl;
 import org.collectionspace.services.common.relation.RelationResource;
 import org.collectionspace.services.common.vocabulary.AuthorityResource;
 import org.collectionspace.services.jaxb.AbstractCommonList;
@@ -45,23 +47,16 @@ import org.dom4j.Element;
 import org.dom4j.Node;
 
 import org.jboss.resteasy.specimpl.PathSegmentImpl;
-//import org.jboss.resteasy.specimpl.UriInfoImpl;
-import org.collectionspace.services.batch.UriInfoImpl;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public abstract class AbstractBatchJob extends AbstractBatchInvocable {
-       public final int CREATED_STATUS = Response.Status.CREATED.getStatusCode();
-       public final int BAD_REQUEST_STATUS = Response.Status.BAD_REQUEST.getStatusCode();
-       public final int INT_ERROR_STATUS = Response.Status.INTERNAL_SERVER_ERROR.getStatusCode();
 
        final Logger logger = LoggerFactory.getLogger(AbstractBatchJob.class);
 
        private Map<String, String> authorityServiceNamesByDocType;
-       
-       public abstract void run();
-       
+               
        protected String getFieldXml(Map<String, String> fields, String fieldName) {
                return getFieldXml(fieldName, fields.get(fieldName));
        }
index 8be238954486353419d8ca6907ebc258820f97e3..0d726d4c3dfbcbb4140c71c8d8e62020a64f696f 100644 (file)
@@ -24,6 +24,7 @@ public class ClearLocationLabelRequestBatchJob extends AbstractBatchJob {
                setSupportedInvocationModes(Arrays.asList(INVOCATION_MODE_SINGLE, INVOCATION_MODE_LIST, INVOCATION_MODE_NO_CONTEXT));
        }
        
+       @Override
        public void run() {
                setCompletionStatus(STATUS_MIN_PROGRESS);
                
index 41821d3b38fea1642d28b270051706b86f241636..3da909574d92db503aa439a2ea238e3857e4a1a9 100644 (file)
@@ -23,6 +23,7 @@ public class ClearPotTagLabelRequestBatchJob extends AbstractBatchJob {
                setSupportedInvocationModes(Arrays.asList(INVOCATION_MODE_SINGLE, INVOCATION_MODE_LIST, INVOCATION_MODE_NO_CONTEXT));
        }
        
+       @Override
        public void run() {
                setCompletionStatus(STATUS_MIN_PROGRESS);
                
index 98b8a4040883f77120ca1866a6661a91ad2c3239..c48c5d338200007a5c896b20deea542f0f620abf 100644 (file)
@@ -23,6 +23,7 @@ public class ClearVoucherLabelRequestBatchJob extends AbstractBatchJob {
                this.setSupportedInvocationModes(Arrays.asList(INVOCATION_MODE_SINGLE, INVOCATION_MODE_LIST, INVOCATION_MODE_NO_CONTEXT));
        }
        
+       @Override
        public void run() {
                setCompletionStatus(STATUS_MIN_PROGRESS);
                
index b6c7af9dadc3ea9032ea7779d6b0c961dfe93768..6a23c190c80a29c3a24cb7715a0516475168f446 100644 (file)
@@ -35,6 +35,7 @@ public class CreateVoucherBatchJob extends AbstractBatchJob {
                setSupportedInvocationModes(Arrays.asList(INVOCATION_MODE_SINGLE));
        }
 
+       @Override
        public void run() {
                setCompletionStatus(STATUS_MIN_PROGRESS);
 
index f796940923487db47ff00cf7bc52a39a48929d3e..b745018f128b27a0c241718b8636f842b4cce3d7 100644 (file)
@@ -30,6 +30,7 @@ public class FormatTaxonBatchJob extends AbstractBatchJob {
                this.taxonFormatter = new TaxonFormatter();
        }
 
+       @Override
        public void run() {
                setCompletionStatus(STATUS_MIN_PROGRESS);
 
index afab83b22b827170cbc096d8155887603aa9562f..eb7be0a42d14eff033ac9c06b9ce142861d232de 100644 (file)
@@ -36,6 +36,7 @@ public class FormatVoucherNameBatchJob extends AbstractBatchJob {
                this.taxonFormatter = new TaxonFormatter();
        }
 
+       @Override
        public void run() {
                setCompletionStatus(STATUS_MIN_PROGRESS);
 
index cc23a47c5883915f45be8b780de4c3cc83e47cea..4a2df3a6ceb06ac3e57e4a4dcc6c80e38cd5a918 100644 (file)
@@ -25,12 +25,13 @@ import org.collectionspace.services.common.invocable.InvocationResults;
 import org.collectionspace.services.common.relation.RelationResource;
 import org.collectionspace.services.common.vocabulary.AuthorityResource;
 import org.collectionspace.services.relation.RelationsCommonList;
-import org.collectionspace.services.relation.RelationsCommonList.RelationListItem;
+
 import org.dom4j.Document;
 import org.dom4j.DocumentException;
 import org.dom4j.DocumentHelper;
 import org.dom4j.Element;
 import org.dom4j.Node;
+
 import org.nuxeo.common.utils.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
index d4350e085e5c6124f76f9f912e56396e1bc2ac32..bd388c7f236704584a593caa583c0017d2d033b3 100644 (file)
@@ -20,8 +20,6 @@ import java.util.Map;
 import java.util.Set;
 
 import org.apache.commons.lang.StringUtils;
-import org.collectionspace.services.client.PoxPayloadIn;
-import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.CollectionSpaceResource;
 import org.collectionspace.services.common.NuxeoBasedResource;
 import org.collectionspace.services.common.StoredValuesUriTemplate;
@@ -33,7 +31,6 @@ import org.collectionspace.services.common.invocable.InvocationResults;
 import org.collectionspace.services.common.vocabulary.AuthorityResource;
 import org.collectionspace.services.nuxeo.util.ReindexFulltextRoot.ReindexInfo;
 import org.nuxeo.ecm.core.api.AbstractSession;
-import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.CoreSession;
 import org.nuxeo.ecm.core.api.IterableQueryResult;
 import org.nuxeo.ecm.core.api.NuxeoException;
@@ -222,7 +219,7 @@ public class ReindexFullTextBatchJob extends AbstractBatchJob {
        private void initResourceMap() {
                resourcesByDocType = new HashMap<String, NuxeoBasedResource>();
 
-               for (CollectionSpaceResource<PoxPayloadIn, PoxPayloadOut> resource : getResourceMap().values()) {
+               for (CollectionSpaceResource<?, ?> resource : getResourceMap().values()) {
                        Map<UriTemplateRegistryKey, StoredValuesUriTemplate> entries = resource.getUriRegistryEntries();
                        
                        for (UriTemplateRegistryKey key : entries.keySet()) {
index 0e5397da921b5e4fa63fe30a1fc5c518372dac9d..c1b2f3849332c92417f3401951b0c54dc82b8625 100644 (file)
@@ -26,6 +26,7 @@ public class UpdateDeadFlagBatchJob extends AbstractBatchJob {
                this.setSupportedInvocationModes(Arrays.asList(INVOCATION_MODE_SINGLE));
        }
 
+       @Override
        public void run() {
                setCompletionStatus(STATUS_MIN_PROGRESS);
                
index 5f65c036cc48c582a3d40765fe3f11541a2044ab..13493d78ea25ee2939ac3e6861d1aec00097106e 100644 (file)
@@ -12,7 +12,6 @@ import org.collectionspace.services.client.AbstractCommonListUtils;
 import org.collectionspace.services.client.AuthorityClient;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.PayloadInputPart;
-import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.client.RelationClient;
@@ -1467,4 +1466,35 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
                
                return result;
        }
+       
+    /**
+     * Sets up create tests with empty entity body.
+     */
+    @Override
+       protected void setupCreateWithEmptyEntityBody() {
+        testExpectedStatusCode = STATUS_INTERNAL_SERVER_ERROR;
+        testRequestType = ServiceRequestType.CREATE;
+        testSetup(testExpectedStatusCode, testRequestType);
+    }
+       
+    /**
+     * Sets up create tests with malformed xml.
+     */
+    @Override
+       protected void setupCreateWithMalformedXml() {
+        testExpectedStatusCode = STATUS_INTERNAL_SERVER_ERROR;  // Malformed payload never gets past RESTEasy filter
+        testRequestType = ServiceRequestType.CREATE;
+        testSetup(testExpectedStatusCode, testRequestType);
+    }
+
+    /**
+     * Sets up create tests with wrong xml schema.
+     */
+    @Override
+       protected void setupCreateWithWrongXmlSchema() {
+        testExpectedStatusCode = STATUS_INTERNAL_SERVER_ERROR;  // Empty payload never gets past RESTEasy filter
+        testRequestType = ServiceRequestType.CREATE;
+        testSetup(testExpectedStatusCode, testRequestType);
+    }    
+    
 }
index 25465527f14436d603aa855cd9e4c72ef536d956..4aaa34adbf9550559df367e680977ba555b36f5a 100644 (file)
@@ -41,7 +41,8 @@ public abstract class AbstractPoxServiceTestImpl<CLT extends AbstractCommonList,
                return result;
        }
        
-    protected void printList(String testName, CLT list) {
+    @Override
+       protected void printList(String testName, CLT list) {
         if (getLogger().isDebugEnabled()){
                AbstractCommonListUtils.ListItemsInAbstractCommonList(list, getLogger(), testName);
         }
@@ -87,7 +88,8 @@ public abstract class AbstractPoxServiceTestImpl<CLT extends AbstractCommonList,
     /**
      * The entity type expected from the JAX-RS Response object
      */
-    public Class<String> getEntityResponseType() {
+    @Override
+       public Class<String> getEntityResponseType() {
        return String.class;
     }
        
@@ -130,4 +132,54 @@ public abstract class AbstractPoxServiceTestImpl<CLT extends AbstractCommonList,
             return payloadInputPart;
     }
     
+    /**
+     * Sets up create tests with empty entity body.
+     */
+    @Override
+       protected void setupCreateWithEmptyEntityBody() {
+        testExpectedStatusCode = STATUS_INTERNAL_SERVER_ERROR;
+        testRequestType = ServiceRequestType.CREATE;
+        testSetup(testExpectedStatusCode, testRequestType);
+    }
+
+    /**
+     * Sets up create tests with empty entity body.
+     */
+    @Override
+       protected void setupCreateWithInvalidBody() {
+        testExpectedStatusCode = STATUS_INTERNAL_SERVER_ERROR;
+        testRequestType = ServiceRequestType.CREATE;
+        testSetup(testExpectedStatusCode, testRequestType);
+    }
+    
+    /**
+     * Sets up create tests with empty entity body.
+     */
+    @Override
+       protected void setupUpdateWithInvalidBody() {
+        testExpectedStatusCode = STATUS_BAD_REQUEST;
+        testRequestType = ServiceRequestType.UPDATE;
+        testSetup(testExpectedStatusCode, testRequestType);
+    }
+    
+    /**
+     * Sets up create tests with malformed xml.
+     */
+    @Override
+       protected void setupCreateWithMalformedXml() {
+        testExpectedStatusCode = STATUS_INTERNAL_SERVER_ERROR;
+        testRequestType = ServiceRequestType.CREATE;
+        testSetup(testExpectedStatusCode, testRequestType);
+    }
+
+    /**
+     * Sets up create tests with wrong xml schema.
+     */
+    @Override
+       protected void setupCreateWithWrongXmlSchema() {
+        testExpectedStatusCode = STATUS_INTERNAL_SERVER_ERROR;
+        testRequestType = ServiceRequestType.CREATE;
+        testSetup(testExpectedStatusCode, testRequestType);
+    }
+    
 }
index 94c494a5f432e9b27bcd7dc21cc45bd5e14d8f4e..be41761003a4c2637ab5735f5c229195abf8eaf1 100644 (file)
@@ -101,6 +101,7 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
     /*
      * We use this method to force a TestNG execution order for our tests
      */
+       @Override
        public abstract void CRUDTests(String testName);
     
     /*
@@ -658,7 +659,8 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
     /*
      * Test that searches honor the workflow deleted state.
      */
-    @Test(dataProvider = "testName")
+    @Override
+       @Test(dataProvider = "testName")
     public void searchWorkflowDeleted(String testName) throws Exception {
 
         // FIXME: Temporarily avoid running test if client is of an authority service
@@ -1307,6 +1309,47 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
            invalidStatusCodeMessage(testRequestType, statusCode));
            Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
+    
+    /**
+     * Sets up create tests with empty entity body.
+     */
+    @Override
+       protected void setupCreateWithEmptyEntityBody() {
+        testExpectedStatusCode = STATUS_INTERNAL_SERVER_ERROR;
+        testRequestType = ServiceRequestType.CREATE;
+        testSetup(testExpectedStatusCode, testRequestType);
+    }
+
+    /**
+     * Sets up create tests with empty entity body.
+     */
+    @Override
+       protected void setupCreateWithInvalidBody() {
+        testExpectedStatusCode = STATUS_INTERNAL_SERVER_ERROR;
+        testRequestType = ServiceRequestType.CREATE;
+        testSetup(testExpectedStatusCode, testRequestType);
+    }
+    
+    /**
+     * Sets up create tests with malformed xml.
+     */
+    @Override
+       protected void setupCreateWithMalformedXml() {
+        testExpectedStatusCode = STATUS_INTERNAL_SERVER_ERROR;
+        testRequestType = ServiceRequestType.CREATE;
+        testSetup(testExpectedStatusCode, testRequestType);
+    }
+
+    /**
+     * Sets up create tests with wrong xml schema.
+     */
+    @Override
+       protected void setupCreateWithWrongXmlSchema() {
+        testExpectedStatusCode = STATUS_INTERNAL_SERVER_ERROR;
+        testRequestType = ServiceRequestType.CREATE;
+        testSetup(testExpectedStatusCode, testRequestType);
+    }
+    
 }
 
 
index 9243703dd630c013a4d207a481e13c20dd463440..ac6d33aaa9f66737f9433b8131f7851e701cf080 100644 (file)
@@ -37,9 +37,12 @@ import javax.activation.MimetypesFileTypeMap;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
 import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
 import javax.xml.bind.JAXBException;
+import javax.xml.bind.MarshalException;
 import javax.xml.bind.Marshaller;
 import javax.xml.bind.Unmarshaller;
+import javax.xml.namespace.QName;
 import javax.xml.parsers.DocumentBuilderFactory;
 
 import org.apache.commons.httpclient.HttpMethodBase;
@@ -572,33 +575,33 @@ public abstract class BaseServiceTest<CLT> {
      * @param clazz the clazz
      * @return the string
      */
-    static protected String objectAsXmlString(Object o, Class<?> clazz) {
-        StringWriter sw = new StringWriter();
-        try {
-            JAXBContext jc = JAXBContext.newInstance(clazz);
-            Marshaller m = jc.createMarshaller();
-            m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
-                    Boolean.TRUE);
-            m.marshal(o, sw);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return sw.toString();
-    }
+       static protected String objectAsXmlString(Object o, Class<?> clazz) {
+               StringWriter sw = new StringWriter();
+               JAXBContext jc;
+               try {
+                       jc = JAXBContext.newInstance(clazz);
+                       Marshaller m = jc.createMarshaller();
+                       try {
+                               m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+                               m.marshal(o, sw);
+                       } catch (MarshalException e) {
+                               sw = new StringWriter(); // reset the StringWriter value
+                               JAXBElement root = new JAXBElement(new QName("uri", "local"), clazz, o);
+                               m.marshal(root, sw);
+                       } catch (Exception e) {
+                               e.printStackTrace();
+                       }
+               } catch (JAXBException e1) {
+                       // TODO Auto-generated catch block
+                       e1.printStackTrace();
+               }
+
+               return sw.toString();
+       }
     
     static protected String objectAsXmlString(Object o) {
-        StringWriter sw = new StringWriter();
-        try {
-            JAXBContext jc = JAXBContext.newInstance(o.getClass());
-            Marshaller m = jc.createMarshaller();
-            m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
-                    Boolean.TRUE);
-            m.marshal(o, sw);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return sw.toString();
-    }    
+        return objectAsXmlString(o, o.getClass());
+    }
 
     /**
      * getObjectFromFile get object of given class from given file (in classpath)
@@ -806,6 +809,24 @@ public abstract class BaseServiceTest<CLT> {
        // Status code setup methods for tests
        //
        
+    /**
+     * Sets up create tests with empty entity body.
+     */
+    protected void setupCreateWithEmptyEntityBody() {
+        testExpectedStatusCode = STATUS_BAD_REQUEST;
+        testRequestType = ServiceRequestType.CREATE;
+        testSetup(testExpectedStatusCode, testRequestType);
+    }
+
+    /**
+     * Sets up create tests with empty entity body.
+     */
+    protected void setupCreateWithInvalidBody() {
+        testExpectedStatusCode = STATUS_BAD_REQUEST;
+        testRequestType = ServiceRequestType.CREATE;
+        testSetup(testExpectedStatusCode, testRequestType);
+    }
+    
     /**
      * Sets up create tests with malformed xml.
      */
@@ -913,6 +934,15 @@ public abstract class BaseServiceTest<CLT> {
         testRequestType = ServiceRequestType.DELETE;
         testSetup(testExpectedStatusCode, testRequestType);
     }
+        
+    /**
+     * Sets up create tests with empty entity body.
+     */
+    protected void setupUpdateWithInvalidBody() {
+        testExpectedStatusCode = STATUS_BAD_REQUEST;
+        testRequestType = ServiceRequestType.UPDATE;
+        testSetup(testExpectedStatusCode, testRequestType);
+    }    
 
     // Failure outcomes
 
@@ -924,34 +954,7 @@ public abstract class BaseServiceTest<CLT> {
         testRequestType = ServiceRequestType.DELETE;
         testSetup(testExpectedStatusCode, testRequestType);
     }
-    
-    /**
-     * Sets up create tests with empty entity body.
-     */
-    protected void setupCreateWithEmptyEntityBody() {
-        testExpectedStatusCode = STATUS_BAD_REQUEST;
-        testRequestType = ServiceRequestType.CREATE;
-        testSetup(testExpectedStatusCode, testRequestType);
-    }
-
-    /**
-     * Sets up create tests with empty entity body.
-     */
-    protected void setupCreateWithInvalidBody() {
-        testExpectedStatusCode = STATUS_BAD_REQUEST;
-        testRequestType = ServiceRequestType.CREATE;
-        testSetup(testExpectedStatusCode, testRequestType);
-    }
-    
-    /**
-     * Sets up create tests with empty entity body.
-     */
-    protected void setupUpdateWithInvalidBody() {
-        testExpectedStatusCode = STATUS_BAD_REQUEST;
-        testRequestType = ServiceRequestType.UPDATE;
-        testSetup(testExpectedStatusCode, testRequestType);
-    }
-    
+        
     public void updateWithEmptyEntityBody(String testName) throws Exception {
         //FIXME: Should this test really be empty?  If so, please comment accordingly.
     }
diff --git a/services/common/src/main/cspace/config/services/tenants/botgarden/botgarden-tenant-bindings.delta.xml b/services/common/src/main/cspace/config/services/tenants/botgarden/botgarden-tenant-bindings.delta.xml
new file mode 100644 (file)
index 0000000..65f3b3d
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tenant:TenantBindingConfig
+        xmlns:merge="http://xmlmerge.el4j.elca.ch"
+        xmlns:tenant="http://collectionspace.org/services/config/tenant">
+
+    <!-- Add your changes, if any, within the following tag pair. -->
+    <!-- The value of the 'id' attribute, below, should match the corresponding -->
+    <!-- value in cspace/config/services/tenants/testsci-tenant-bindings-proto.xml -->
+
+    <tenant:tenantBinding id="3500">
+               <tenant:eventListenerConfigurations id="default" merge:matcher="id">
+                   <tenant:eventListenerConfig id="UpdateObjectLocationOnMove" merge:matcher="id">
+                       <tenant:paramList id="default" merge:matcher="id" merge:action="delete"/>
+            </tenant:eventListenerConfig>
+            <tenant:eventListenerConfig id="UpdateObjectLocationAndCrateOnMove" merge:matcher="id" merge:action="delete"/>
+        </tenant:eventListenerConfigurations>
+    </tenant:tenantBinding>
+</tenant:TenantBindingConfig>
index 11718744c07f3af5e6c14fb77e511b7f63c7d027..c1341b15770e1a11c2f3fe37e2530278308c42af 100644 (file)
@@ -36,7 +36,7 @@ public class CSWebApplicationException extends WebApplicationException {
        }
 
        public CSWebApplicationException(Throwable cause, Response response) {
-               super(cause);
+               super(cause, response);
                this.response = getFinalResponse(cause, response);
        }
 
index ccfc4344a6f20e9a9d9f22679433e9523cda63b5..ae2f1f355db579aa607969c4cdeeecd9bca246c4 100644 (file)
@@ -643,7 +643,7 @@ public abstract class NuxeoBasedResource
        }
     
     @Override
-    public ServiceDescription getDescription(ServiceContext ctx) {
+    public ServiceDescription getDescription(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx) {
        ServiceDescription result = new ServiceDescription();
        
        result.setDocumentType(getDocType(ctx.getTenantId()));
@@ -656,7 +656,7 @@ public abstract class NuxeoBasedResource
      * for all inheriting resource classes. Just use ServiceContext.getResourceMap() to get
      * the map, and pass it in.
      */
-    public static DocumentModel getDocModelForRefName(ServiceContext ctx, String refName, ResourceMap resourceMap) 
+    public static DocumentModel getDocModelForRefName(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx, String refName, ResourceMap resourceMap) 
                        throws Exception, DocumentNotFoundException {
        return NuxeoUtils.getDocModelForRefName(ctx, refName, resourceMap);
     }
index 4e81e5a0e6ca67e393be93b8e758ad472977ca6f..950ec7c3a993459f0443a6d1b2c165ea010934b1 100644 (file)
@@ -1,8 +1,5 @@
 package org.collectionspace.services.common;
 
-import org.collectionspace.services.client.PoxPayloadIn;
-import org.collectionspace.services.client.PoxPayloadOut;
-
 public interface ResourceMapHolder {
-       public ResourceMap<PoxPayloadIn, PoxPayloadOut> getResourceMap();
+       public ResourceMap getResourceMap();
 }
index ed6579b7769edc1c8da2755ec9a8274a435096fe..9805c531155cb01be0e472f51bdd9e777f548c3f 100644 (file)
@@ -15,7 +15,7 @@ import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.event.Event;
 
 public abstract class AbstractCSEventListenerImpl implements CSEventListener {
-       private static List<String> repositoryNameList = new ArrayList<String>();
+       private static Map<String, List<String>> mapOfrepositoryNames = new HashMap<String, List<String>>(); // <className, repositoryName>
        private static Map<String, Map<String, Map<String, String>>> eventListenerParamsMap = new HashMap<String, Map<String, Map<String, String>>>();  // <repositoryName, Map<EventListenerId, Map<key, value>>>
        private static Map<String, String> nameMap = new HashMap<String, String>();
        
@@ -25,25 +25,44 @@ public abstract class AbstractCSEventListenerImpl implements CSEventListener {
                // Intentionally left blank
        }
        
-       protected List<String> getRepositoryNameList() {
-               return repositoryNameList;
-       }
-       
-       protected Map<String, Map<String, Map<String, String>>> getEventListenerParamsMap() {
-               return eventListenerParamsMap;
-       }
-
+       /**
+        * Find out if we (the event listener) are registered (via tenant bindings config) to respond events.
+        */
        @Override
        public boolean isRegistered(Event event) {
                boolean result = false;
                
                if (event != null && event.getContext() != null) {
-                       result = repositoryNameList.contains(event.getContext().getRepositoryName());
+                       result = getRepositoryNameList().contains(event.getContext().getRepositoryName());
                }
                
                return result;
        }
-
+       
+       /**
+        * An event listener can be registered by multiple tenants, so we keep track of that here.
+        * 
+        * @return - the list of tenants/repositories that an event listener is registered with.
+        */
+       protected List<String> getRepositoryNameList() {
+               String key = this.getClass().getName();
+               List<String> result = mapOfrepositoryNames.get(key);
+               
+               if (result == null) synchronized(this) {
+                       result = new ArrayList<String>();
+                       mapOfrepositoryNames.put(key, result);
+               }
+               
+               return result;
+       }
+       
+       /**
+        * The list of parameters (specified in a tenant's bindings) for event listeners
+        * @return
+        */
+       protected Map<String, Map<String, Map<String, String>>> getEventListenerParamsMap() {
+               return eventListenerParamsMap;
+       }
 
        /**
         * Returns 'true' if this collection changed as a result of the call. 
@@ -60,34 +79,36 @@ public abstract class AbstractCSEventListenerImpl implements CSEventListener {
                        result = true;
                }
                
-               // Set this event listeners parameters, if any.  Params are qualified with the repositoryName since multiple tenants might be registering the same event listener but with different params.
-               List<Param> paramList = eventListenerConfig.getParamList().getParam(); // values from the tenant bindings that we need to copy into the event listener
-               if (paramList != null) {
-                       //
-                       // Get the list of event listeners for a given repository
-                       Map<String, Map<String, String>> eventListenerRepoParams = getEventListenerParamsMap().get(respositoryName); // Get the set of event listers for a given repository
-                       if (eventListenerRepoParams == null) {
-                               eventListenerRepoParams = new HashMap<String, Map<String, String>>();
-                               getEventListenerParamsMap().put(respositoryName, eventListenerRepoParams); // create and put an empty map
-                               result = true;
-                       }
-                       //
-                       // Get the list of params for a given event listener for a given repository
-                       Map<String, String> eventListenerParams = eventListenerRepoParams.get(eventListenerConfig.getId()); // Get the set of params for a given event listener for a given repository
-                       if (eventListenerParams == null) {
-                               eventListenerParams = new HashMap<String, String>();
-                               eventListenerRepoParams.put(eventListenerConfig.getId(), eventListenerParams); // create and put an empty map
-                               result = true;
-                       }
-                       //
-                       // copy all the values from the tenant bindings into the event listener
-                       for (Param params : paramList) {
-                               String key = params.getKey();
-                               String value = params.getValue();
-                               if (Tools.notBlank(key)) {
-                                       eventListenerParams.put(key, value);
+               if (eventListenerConfig.getParamList() != null) {
+                       // Set this event listeners parameters, if any.  Params are qualified with the repositoryName since multiple tenants might be registering the same event listener but with different params.
+                       List<Param> paramList = eventListenerConfig.getParamList().getParam(); // values from the tenant bindings that we need to copy into the event listener
+                       if (paramList != null) {
+                               //
+                               // Get the list of event listeners for a given repository
+                               Map<String, Map<String, String>> eventListenerRepoParams = getEventListenerParamsMap().get(respositoryName); // Get the set of event listers for a given repository
+                               if (eventListenerRepoParams == null) {
+                                       eventListenerRepoParams = new HashMap<String, Map<String, String>>();
+                                       getEventListenerParamsMap().put(respositoryName, eventListenerRepoParams); // create and put an empty map
+                                       result = true;
+                               }
+                               //
+                               // Get the list of params for a given event listener for a given repository
+                               Map<String, String> eventListenerParams = eventListenerRepoParams.get(eventListenerConfig.getId()); // Get the set of params for a given event listener for a given repository
+                               if (eventListenerParams == null) {
+                                       eventListenerParams = new HashMap<String, String>();
+                                       eventListenerRepoParams.put(eventListenerConfig.getId(), eventListenerParams); // create and put an empty map
                                        result = true;
                                }
+                               //
+                               // copy all the values from the tenant bindings into the event listener
+                               for (Param params : paramList) {
+                                       String key = params.getKey();
+                                       String value = params.getValue();
+                                       if (Tools.notBlank(key)) {
+                                               eventListenerParams.put(key, value);
+                                               result = true;
+                                       }
+                               }
                        }
                }
                
@@ -100,8 +121,14 @@ public abstract class AbstractCSEventListenerImpl implements CSEventListener {
 
        @Override
        public Map<String, String> getParams(Event event) {
-               String repositoryName = event.getContext().getRepositoryName();
-               return getEventListenerParamsMap().get(repositoryName).get(getName(repositoryName));  // We need to qualify with the repositoryName since this event listener might be register by multiple tenants using different params
+               Map<String, String> result = null;
+               try {
+                       String repositoryName = event.getContext().getRepositoryName();
+                       result = getEventListenerParamsMap().get(repositoryName).get(getName(repositoryName));  // We need to qualify with the repositoryName since this event listener might be register by multiple tenants using different params
+               } catch (NullPointerException e) {
+                       // Do nothing.  Just means no params were configured.
+               }
+               return result;
        }
        
        @Override
diff --git a/services/hyperjaxb/src/main/resources/bindings.xjb b/services/hyperjaxb/src/main/resources/bindings.xjb
new file mode 100644 (file)
index 0000000..ce5cc40
--- /dev/null
@@ -0,0 +1,18 @@
+<jaxb:bindings version="1.0" 
+       xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+       xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+       xmlns:annox="http://annox.dev.java.net"
+       xmlns:xs="http://www.w3.org/2001/XMLSchema">
+       <jaxb:bindings schemaLocation="permissions.xsd" node="/xs:schema">
+               <jaxb:globalBindings localScoping="toplevel">
+                       <jaxb:serializable uid="1338" />
+               </jaxb:globalBindings>
+               <!--
+               <jaxb:bindings node="xs:complexType[@name='permission']">
+                       <annox:annotate>
+                               <annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement" name="permission" />
+                       </annox:annotate>
+               </jaxb:bindings>
+               -->
+       </jaxb:bindings>
+</jaxb:bindings>
\ No newline at end of file
index a41ad978bd06bba486c3eb85787cfae5a983e024..6e4103ef6aaa0154b7e897d931b8b45548f3fd98 100644 (file)
@@ -243,7 +243,8 @@ public class MaterialAuthorityServiceTest extends AbstractAuthorityServiceTest<M
      * @throws Exception 
      */
 
-    @AfterClass(alwaysRun=true)
+    @Override
+       @AfterClass(alwaysRun=true)
        public void cleanUp() throws Exception {
                String noTest = System.getProperty("noTestCleanup");
                if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
@@ -295,7 +296,8 @@ public class MaterialAuthorityServiceTest extends AbstractAuthorityServiceTest<M
      *
      * @return The root URL for the item service.
      */
-    protected String getItemServiceRootURL(String parentResourceIdentifier) {
+    @Override
+       protected String getItemServiceRootURL(String parentResourceIdentifier) {
         return getResourceURL(parentResourceIdentifier) + "/" + getItemServicePathComponent();
     }
 
@@ -311,7 +313,8 @@ public class MaterialAuthorityServiceTest extends AbstractAuthorityServiceTest<M
      *
      * @return The URL of a specific item resource managed by a service.
      */
-    protected String getItemResourceURL(String parentResourceIdentifier, String itemResourceIdentifier) {
+    @Override
+       protected String getItemResourceURL(String parentResourceIdentifier, String itemResourceIdentifier) {
         return getItemServiceRootURL(parentResourceIdentifier) + "/" + itemResourceIdentifier;
     }
 
@@ -364,7 +367,8 @@ public class MaterialAuthorityServiceTest extends AbstractAuthorityServiceTest<M
                 "Display name in updated object did not match submitted data.");
     }
 
-    protected void compareReadInstances(MaterialauthoritiesCommon original,
+    @Override
+       protected void compareReadInstances(MaterialauthoritiesCommon original,
             MaterialauthoritiesCommon fromRead) throws Exception {
         Assert.assertNotNull(fromRead.getDisplayName());
         Assert.assertNotNull(fromRead.getShortIdentifier());
index fc2300ce880fa318137d8bfd65fde10e61f44fb5..18db60a1ef591a2acc54e7dee5d7e927caf5453e 100644 (file)
                        <bindingIncludes>
                                        <include>bindings.xjb</include>
                                </bindingIncludes>
+                        <args>
+                            <arg>-Xannotate</arg> 
+                        </args>
                         <extension>true</extension>
                         <jdk5>true</jdk5>
                         <ejb3>false</ejb3>
diff --git a/services/pottag/client/src/main/resources/collectionspace-client.properties b/services/pottag/client/src/main/resources/collectionspace-client.properties
new file mode 100644 (file)
index 0000000..12a5aa4
--- /dev/null
@@ -0,0 +1,6 @@
+#url of the collectionspace server
+cspace.url=http://localhost:8180/cspace-services/
+cspace.ssl=false
+cspace.auth=true
+cspace.user=admin@botgarden.collectionspace.org
+cspace.password=Administrator
index fcd0b7de83d6fbc2b9a33bbae19b27fc08ea1e6f..5439757b499e6906640eb0f4671be7519499e61d 100644 (file)
@@ -24,9 +24,7 @@ package org.collectionspace.services.client.test;
 
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.PottagClient;
-import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadOut;
-import org.collectionspace.services.common.api.GregorianCalendarDateTimeUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.pottag.PottagsCommon;
 
@@ -47,9 +45,6 @@ public class PottagServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
     /** The logger. */
     private final String CLASS_NAME = PottagServiceTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
-    // Instance variables specific to this test.
-    private final static String CURRENT_DATE_UTC = GregorianCalendarDateTimeUtils.currentDateUTC();
-
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
@@ -70,22 +65,12 @@ public class PottagServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
                 + "' does not match expected data '" + getUTF8DataFragment());         
        }    
      
-       @Override
-       protected void compareUpdatedInstances(PottagsCommon pottagCommon,
-                       PottagsCommon updatedPottagCommon) throws Exception {
-        // Check selected fields in the updated common part.
-        Assert.assertEquals(updatedPottagCommon.getFamily(), pottagCommon.getFamily(),
-                "Data in updated object did not match submitted data.");
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("UTF-8 data sent=" + pottagCommon.getLabelData() + "\n"
-                    + "UTF-8 data received=" + updatedPottagCommon.getLabelData());
-        }
-        Assert.assertTrue(updatedPottagCommon.getLabelData().contains(getUTF8DataFragment()),
-                "UTF-8 data retrieved '" + updatedPottagCommon.getLabelData() + "' does not contain expected data '" + getUTF8DataFragment());
-        Assert.assertEquals(updatedPottagCommon.getLabelData(),
-                pottagCommon.getLabelData(), "Data in updated object did not match submitted data.");
-       }
+    @Override
+    protected void compareUpdatedInstances(PottagsCommon requestedUpdate,
+               PottagsCommon actualUpdate) throws Exception {
+        Assert.assertEquals(requestedUpdate.getFamily(), actualUpdate.getFamily(),
+                "Display name in updated object did not match submitted data.");
+    }
     
     // ---------------------------------------------------------------
     // Utility methods used by tests above
@@ -139,8 +124,7 @@ public class PottagServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
         pottagCommon.setLabelData(getUTF8DataFragment());
 
         PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent());
-        PayloadOutputPart commonPart =
-                multipart.addPart(new PottagClient().getCommonPartName(), pottagCommon);
+        multipart.addPart(new PottagClient().getCommonPartName(), pottagCommon);
 
         if (logger.isDebugEnabled()) {
             logger.debug("to be created, pottag common");
@@ -162,16 +146,18 @@ public class PottagServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
         PoxPayloadOut result = createPottagInstance(identifier);
         return result;
        }
-
+       
        @Override
        protected PottagsCommon updateInstance(PottagsCommon commonPartObject) {
-               // TODO Auto-generated method stub
-               return null;
+               
+               String updatedFamily = "Updated-" + commonPartObject.getFamily();
+               commonPartObject.setFamily(updatedFamily);
+               
+               return commonPartObject;
        }
 
        @Override
        protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
-               // TODO Auto-generated method stub
-               return null;
+               return new PottagClient();
        }
 }
diff --git a/services/propagation/client/src/main/resources/collectionspace-client.properties b/services/propagation/client/src/main/resources/collectionspace-client.properties
new file mode 100644 (file)
index 0000000..12a5aa4
--- /dev/null
@@ -0,0 +1,6 @@
+#url of the collectionspace server
+cspace.url=http://localhost:8180/cspace-services/
+cspace.ssl=false
+cspace.auth=true
+cspace.user=admin@botgarden.collectionspace.org
+cspace.password=Administrator
index 274c427fd0bc2a998da4cd4c408dc38b103ba4d0..b34b6f32cc649415b3496b377689086003c56cf8 100644 (file)
@@ -220,7 +220,7 @@ public class PropagationAuthRefsTest extends BaseServiceTest<AbstractCommonList>
         AuthorityRefList list = null;
         try {
                assertStatusCode(res, testName);
-               list = (AuthorityRefList) res.getEntity();
+               list = (AuthorityRefList)res.readEntity(AuthorityRefList.class);
                Assert.assertNotNull(list);
         } finally {
                if (res != null) {
@@ -270,7 +270,8 @@ public class PropagationAuthRefsTest extends BaseServiceTest<AbstractCommonList>
      * may be expected to be deleted by certain tests.
      * @throws Exception 
      */
-    @AfterClass(alwaysRun=true)
+    @Override
+       @AfterClass(alwaysRun=true)
     public void cleanUp() throws Exception {
         String noTest = System.getProperty("noTestCleanup");
        if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
@@ -306,7 +307,8 @@ public class PropagationAuthRefsTest extends BaseServiceTest<AbstractCommonList>
     // ---------------------------------------------------------------
     // Utility methods used by tests above
     // ---------------------------------------------------------------
-    public String getServiceName() {
+    @Override
+       public String getServiceName() {
         return PropagationClient.SERVICE_NAME;
     }
 
index 69cb7cfaad0b222b43e5ae7f4eb81f58a775f5c5..2b98fec5ef75e2c6fc975baaa4a336e0cce645e9 100644 (file)
@@ -35,6 +35,7 @@
                 <xs:element name="propDate" type="structuredDateGroup"/>
                 <xs:element name="propReason" type="xs:string"/>
                 <xs:element name="propType" type="xs:string"/>
+                <xs:element name="taggedBy" type="xs:string"/>
                 <xs:element name="propBy" type="xs:string"/>
                 <xs:element name="propComments" type="xs:string"/>
                 <xs:element name="numStarted" type="xs:integer"/>
index a81f5d56d086282274dbe7d26edeca423ace9355..2d7883a16f7a2b249de13dcd04e79d4dfe2ccc77 100644 (file)
@@ -158,11 +158,19 @@ public class VocabularyServiceTest extends AbstractAuthorityServiceTest<Vocabula
         }
     }
     
+    /**
+     * Sets up create tests with malformed xml.
+     */
+       protected void setupcreateItemWithBadShortId() {
+        testExpectedStatusCode = STATUS_BAD_REQUEST;  // Malformed payload never gets past RESTEasy filter
+        testRequestType = ServiceRequestType.CREATE;
+        testSetup(testExpectedStatusCode, testRequestType);
+    }    
 
     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
                dependsOnMethods = {"authorityTests"})
     public void createItemWithBadShortId(String testName) throws Exception {
-        setupCreateWithMalformedXml();
+       setupcreateItemWithBadShortId();
 
         // Submit the request to the service and store the response.
         VocabularyClient client = new VocabularyClient();