From 2b34c26e383f089b75b38570138a65941f063c4d Mon Sep 17 00:00:00 2001 From: Jesse Martinez Date: Tue, 30 Sep 2014 23:03:21 -0400 Subject: [PATCH] CSPACE-6311: Adding valuationcontrol procedure. All unit tests pass. --- services/JaxRsServiceProvider/pom.xml | 15 +- .../CollectionSpaceJaxRsApplication.java | 2 + services/build.xml | 3 + .../tenants/tenant-bindings-proto.xml | 70 ++ .../db/postgresql/load_id_generators.sql | 36 + services/pom.xml | 1 + services/valuationcontrol/.project | 17 + services/valuationcontrol/3rdparty/.project | 17 + services/valuationcontrol/3rdparty/build.xml | 130 ++++ .../build.xml | 161 ++++ .../pom.xml | 55 ++ .../src/main/resources/OSGI-INF/README.txt | 16 + .../src/main/resources/schemas/README.txt | 16 + services/valuationcontrol/3rdparty/pom.xml | 24 + services/valuationcontrol/build.xml | 124 ++++ services/valuationcontrol/client/pom.xml | 95 +++ .../client/ValuationcontrolClient.java | 48 ++ .../client/ValuationcontrolProxy.java | 30 + .../test/ValuationcontrolServiceTest.java | 689 ++++++++++++++++++ .../src/test/resources/log4j.properties | 23 + services/valuationcontrol/jaxb/pom.xml | 34 + .../services/ValuationcontrolJAXBSchema.java | 15 + .../ValuationcontrolListItemJAXBSchema.java | 14 + .../resources/Valuationcontrols-common.xsd | 53 ++ services/valuationcontrol/pom.xml | 23 + services/valuationcontrol/service/pom.xml | 106 +++ .../valuationcontrol/service/profiles.xml | 4 + .../ValuationcontrolResource.java | 58 ++ .../nuxeo/ValuationcontrolConstants.java | 35 + .../ValuationcontrolDocumentModelHandler.java | 33 + .../ValuationcontrolValidatorHandler.java | 18 + .../test/ValuationcontrolServiceTest.java | 11 + .../service/src/test/resources/log4j.xml | 41 ++ 33 files changed, 2012 insertions(+), 5 deletions(-) create mode 100644 services/valuationcontrol/.project create mode 100644 services/valuationcontrol/3rdparty/.project create mode 100644 services/valuationcontrol/3rdparty/build.xml create mode 100644 services/valuationcontrol/3rdparty/nuxeo-platform-cs-valuationcontrol/build.xml create mode 100644 services/valuationcontrol/3rdparty/nuxeo-platform-cs-valuationcontrol/pom.xml create mode 100644 services/valuationcontrol/3rdparty/nuxeo-platform-cs-valuationcontrol/src/main/resources/OSGI-INF/README.txt create mode 100644 services/valuationcontrol/3rdparty/nuxeo-platform-cs-valuationcontrol/src/main/resources/schemas/README.txt create mode 100644 services/valuationcontrol/3rdparty/pom.xml create mode 100644 services/valuationcontrol/build.xml create mode 100644 services/valuationcontrol/client/pom.xml create mode 100644 services/valuationcontrol/client/src/main/java/org/collectionspace/services/client/ValuationcontrolClient.java create mode 100644 services/valuationcontrol/client/src/main/java/org/collectionspace/services/client/ValuationcontrolProxy.java create mode 100644 services/valuationcontrol/client/src/test/java/org/collectionspace/services/client/test/ValuationcontrolServiceTest.java create mode 100644 services/valuationcontrol/client/src/test/resources/log4j.properties create mode 100644 services/valuationcontrol/jaxb/pom.xml create mode 100644 services/valuationcontrol/jaxb/src/main/java/org/collectionspace/services/ValuationcontrolJAXBSchema.java create mode 100644 services/valuationcontrol/jaxb/src/main/java/org/collectionspace/services/ValuationcontrolListItemJAXBSchema.java create mode 100644 services/valuationcontrol/jaxb/src/main/resources/Valuationcontrols-common.xsd create mode 100644 services/valuationcontrol/pom.xml create mode 100644 services/valuationcontrol/service/pom.xml create mode 100644 services/valuationcontrol/service/profiles.xml create mode 100644 services/valuationcontrol/service/src/main/java/org/collectionspace/services/valuationcontrol/ValuationcontrolResource.java create mode 100644 services/valuationcontrol/service/src/main/java/org/collectionspace/services/valuationcontrol/nuxeo/ValuationcontrolConstants.java create mode 100644 services/valuationcontrol/service/src/main/java/org/collectionspace/services/valuationcontrol/nuxeo/ValuationcontrolDocumentModelHandler.java create mode 100644 services/valuationcontrol/service/src/main/java/org/collectionspace/services/valuationcontrol/nuxeo/ValuationcontrolValidatorHandler.java create mode 100644 services/valuationcontrol/service/src/test/java/org/collectionspace/services/test/ValuationcontrolServiceTest.java create mode 100644 services/valuationcontrol/service/src/test/resources/log4j.xml diff --git a/services/JaxRsServiceProvider/pom.xml b/services/JaxRsServiceProvider/pom.xml index 842dbf7e2..88da953d0 100644 --- a/services/JaxRsServiceProvider/pom.xml +++ b/services/JaxRsServiceProvider/pom.xml @@ -161,6 +161,11 @@ org.collectionspace.services.media.service ${project.version} + + org.collectionspace.services + org.collectionspace.services.valuationcontrol.service + ${project.version} + org.collectionspace.services org.collectionspace.services.location.service @@ -234,11 +239,11 @@ org.collectionspace.services org.collectionspace.services.person.service - ${project.version} - - - org.collectionspace.services - org.collectionspace.services.citation.service + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.citation.service ${project.version} diff --git a/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java b/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java index f9a1c656f..6f99c6854 100644 --- a/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java +++ b/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java @@ -32,6 +32,7 @@ import org.collectionspace.services.group.GroupResource; import org.collectionspace.services.intake.IntakeResource; import org.collectionspace.services.loanin.LoaninResource; import org.collectionspace.services.loanout.LoanoutResource; +import org.collectionspace.services.valuationcontrol.ValuationcontrolResource; import org.collectionspace.services.objectexit.ObjectExitResource; import org.collectionspace.services.batch.BatchResource; import org.collectionspace.services.imports.ImportsResource; @@ -115,6 +116,7 @@ public class CollectionSpaceJaxRsApplication extends Application addResourceToMapAndSingletons(new RelationResource()); addResourceToMapAndSingletons(new LoaninResource()); addResourceToMapAndSingletons(new LoanoutResource()); + addResourceToMapAndSingletons(new ValuationcontrolResource()); addResourceToMapAndSingletons(new ObjectExitResource()); addResourceToMapAndSingletons(new BatchResource()); addResourceToMapAndSingletons(new MediaResource()); diff --git a/services/build.xml b/services/build.xml index 5bba11747..f62382afd 100644 --- a/services/build.xml +++ b/services/build.xml @@ -170,6 +170,7 @@ + @@ -208,6 +209,7 @@ + @@ -263,6 +265,7 @@ + diff --git a/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto.xml b/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto.xml index 342333e6f..84f840a79 100644 --- a/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto.xml +++ b/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto.xml @@ -1016,6 +1016,76 @@ + + + + + + default-domain + org.collectionspace.services.valuationcontrol.nuxeo.ValuationcontrolDocumentModelHandler + + + + + valuationcontrolRefNumber + valuationcontrolRefNumber + + + valueType + valueType + + + + + org.collectionspace.services.valuationcontrol.nuxeo.ValuationcontrolValidatorHandler + + + objectNameProperty + valueType + + + objectNumberProperty + valuationcontrolRefNumber + + + + + + + + + + + + + authRef + valueSource + + + termRef + valueType + + + termRef + valueTypesList/*/valueCurrency + + + + + + + + + + + + + + diff --git a/services/common/src/main/resources/db/postgresql/load_id_generators.sql b/services/common/src/main/resources/db/postgresql/load_id_generators.sql index b4ec5495f..b64b986d2 100644 --- a/services/common/src/main/resources/db/postgresql/load_id_generators.sql +++ b/services/common/src/main/resources/db/postgresql/load_id_generators.sql @@ -721,3 +721,39 @@ purposes.', SELECT csid FROM id_generators ); + +-- VALUATION_CONTROL_REFERENCE_NUMBER + +INSERT INTO id_generators + (csid, displayname, description, priority, last_generated_id, id_generator_state) + SELECT + 'eafbc0cd-70fe-4802-8476-b931b1b0e381', + 'Valuation Control Reference Number', + 'Identifies the valuation control of an object record.', + '9', + '', +' + + + VC + VC + + + + + + . + . + + + 6 + 1 + -1 + + +' + WHERE 'eafbc0cd-70fe-4802-8476-b931b1b0e381' NOT IN + ( + SELECT csid + FROM id_generators + ); diff --git a/services/pom.xml b/services/pom.xml index f124559db..170fe9f04 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -61,6 +61,7 @@ intake loanin loanout + valuationcontrol objectexit batch imports diff --git a/services/valuationcontrol/.project b/services/valuationcontrol/.project new file mode 100644 index 000000000..981868e38 --- /dev/null +++ b/services/valuationcontrol/.project @@ -0,0 +1,17 @@ + + + org.collectionspace.services.valuationcontrol + + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.m2e.core.maven2Nature + + diff --git a/services/valuationcontrol/3rdparty/.project b/services/valuationcontrol/3rdparty/.project new file mode 100644 index 000000000..82282ff40 --- /dev/null +++ b/services/valuationcontrol/3rdparty/.project @@ -0,0 +1,17 @@ + + + org.collectionspace.services.valuationcontrol.3rdparty + + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.m2e.core.maven2Nature + + diff --git a/services/valuationcontrol/3rdparty/build.xml b/services/valuationcontrol/3rdparty/build.xml new file mode 100644 index 000000000..1a7397bdd --- /dev/null +++ b/services/valuationcontrol/3rdparty/build.xml @@ -0,0 +1,130 @@ + + + valuationcontrol service 3rdparty + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/valuationcontrol/3rdparty/nuxeo-platform-cs-valuationcontrol/build.xml b/services/valuationcontrol/3rdparty/nuxeo-platform-cs-valuationcontrol/build.xml new file mode 100644 index 000000000..35c9ef78e --- /dev/null +++ b/services/valuationcontrol/3rdparty/nuxeo-platform-cs-valuationcontrol/build.xml @@ -0,0 +1,161 @@ + + + + valuationcontrol nuxeo document type + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/valuationcontrol/3rdparty/nuxeo-platform-cs-valuationcontrol/pom.xml b/services/valuationcontrol/3rdparty/nuxeo-platform-cs-valuationcontrol/pom.xml new file mode 100644 index 000000000..048954ad0 --- /dev/null +++ b/services/valuationcontrol/3rdparty/nuxeo-platform-cs-valuationcontrol/pom.xml @@ -0,0 +1,55 @@ + + + + org.collectionspace.services + org.collectionspace.services.valuationcontrol.3rdparty + 4.1-SNAPSHOT + + + 4.0.0 + org.collectionspace.services + org.collectionspace.services.valuationcontrol.3rdparty.nuxeo + services.valuationcontrol.3rdparty.nuxeo + jar + + Valuationcontrol Nuxeo Document Type + + + + valuationcontrol + Valuationcontrol + valuationcontrols_common + cs_default + + + + + + src/main/resources + true + + + ../../../../3rdparty/nuxeo/nuxeo-doctype/src/main/resources + true + + + + + org.apache.maven.plugins + maven-jar-plugin + + + target/classes/META-INF/MANIFEST.MF + + ${eclipseVersion} + 2 + + + + + + + + diff --git a/services/valuationcontrol/3rdparty/nuxeo-platform-cs-valuationcontrol/src/main/resources/OSGI-INF/README.txt b/services/valuationcontrol/3rdparty/nuxeo-platform-cs-valuationcontrol/src/main/resources/OSGI-INF/README.txt new file mode 100644 index 000000000..5f304de86 --- /dev/null +++ b/services/valuationcontrol/3rdparty/nuxeo-platform-cs-valuationcontrol/src/main/resources/OSGI-INF/README.txt @@ -0,0 +1,16 @@ +Files formerly located in this directory are no longer needed +------------------------------------------------------------- + +In CollectionSpace versions 4.0 and higher, changes were introduced +which streamline and simplify the process through which you configure +fields in CollectionSpace's main record types. + +In most cases now, you will typically change the behavior of existing fields, +or create extension schemas to add new fields specific to your museum and/or +community of practice, merely by editing simpler XML-based configuration +files within CollectionSpace's Application layer. + +Services layer files that were formerly located in this directory and +other, similar directories - which you previously needed to manually +create or edit - are now generated automatically from your configuration +in the Application layer. diff --git a/services/valuationcontrol/3rdparty/nuxeo-platform-cs-valuationcontrol/src/main/resources/schemas/README.txt b/services/valuationcontrol/3rdparty/nuxeo-platform-cs-valuationcontrol/src/main/resources/schemas/README.txt new file mode 100644 index 000000000..5f304de86 --- /dev/null +++ b/services/valuationcontrol/3rdparty/nuxeo-platform-cs-valuationcontrol/src/main/resources/schemas/README.txt @@ -0,0 +1,16 @@ +Files formerly located in this directory are no longer needed +------------------------------------------------------------- + +In CollectionSpace versions 4.0 and higher, changes were introduced +which streamline and simplify the process through which you configure +fields in CollectionSpace's main record types. + +In most cases now, you will typically change the behavior of existing fields, +or create extension schemas to add new fields specific to your museum and/or +community of practice, merely by editing simpler XML-based configuration +files within CollectionSpace's Application layer. + +Services layer files that were formerly located in this directory and +other, similar directories - which you previously needed to manually +create or edit - are now generated automatically from your configuration +in the Application layer. diff --git a/services/valuationcontrol/3rdparty/pom.xml b/services/valuationcontrol/3rdparty/pom.xml new file mode 100644 index 000000000..45b98d120 --- /dev/null +++ b/services/valuationcontrol/3rdparty/pom.xml @@ -0,0 +1,24 @@ + + + org.collectionspace.services.valuationcontrol + org.collectionspace.services + 4.1-SNAPSHOT + + + 4.0.0 + org.collectionspace.services.valuationcontrol.3rdparty + services.valuationcontrol.3rdparty + pom + + + 3rd party build for valuationcontrol service + + + + + + diff --git a/services/valuationcontrol/build.xml b/services/valuationcontrol/build.xml new file mode 100644 index 000000000..c9bc8f931 --- /dev/null +++ b/services/valuationcontrol/build.xml @@ -0,0 +1,124 @@ + + + + valuationcontrol service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/valuationcontrol/client/pom.xml b/services/valuationcontrol/client/pom.xml new file mode 100644 index 000000000..8d3569e41 --- /dev/null +++ b/services/valuationcontrol/client/pom.xml @@ -0,0 +1,95 @@ + + + + org.collectionspace.services + org.collectionspace.services.valuationcontrol + 4.1-SNAPSHOT + + + 4.0.0 + org.collectionspace.services + org.collectionspace.services.valuationcontrol.client + services.valuationcontrol.client + + + + + org.slf4j + slf4j-api + test + + + org.slf4j + slf4j-log4j12 + test + + + + org.collectionspace.services + org.collectionspace.services.authority.jaxb + true + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.jaxb + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.common + true + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.client + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.valuationcontrol.jaxb + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.person.client + ${project.version} + + + + org.testng + testng + + + org.jboss.resteasy + resteasy-jaxrs + + + + tjws + webserver + + + + + org.jboss.resteasy + resteasy-jaxb-provider + + + org.jboss.resteasy + resteasy-multipart-provider + + + commons-httpclient + commons-httpclient + 3.1 + + + + + collectionspace-services-valuationcontrol-client + + diff --git a/services/valuationcontrol/client/src/main/java/org/collectionspace/services/client/ValuationcontrolClient.java b/services/valuationcontrol/client/src/main/java/org/collectionspace/services/client/ValuationcontrolClient.java new file mode 100644 index 000000000..58684eb8c --- /dev/null +++ b/services/valuationcontrol/client/src/main/java/org/collectionspace/services/client/ValuationcontrolClient.java @@ -0,0 +1,48 @@ +/** + * This document is a part of the source code and related artifacts + * for CollectionSpace, an open source collections management system + * for museums and related institutions: + * + * http://www.collectionspace.org + * http://wiki.collectionspace.org + * + * Copyright (c) 2009 Regents of the University of California + * + * Licensed under the Educational Community License (ECL), Version 2.0. + * You may not use this file except in compliance with this License. + * + * You may obtain a copy of the ECL 2.0 License at + * https://source.collectionspace.org/collection-space/LICENSE.txt + */ +package org.collectionspace.services.client; + +/** + * ValuationcontrolClient.java + */ +public class ValuationcontrolClient extends AbstractCommonListPoxServiceClientImpl { + + public static final String SERVICE_NAME = "valuationcontrols"; + public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME; + public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT; + public static final String SERVICE_PATH_PROXY = SERVICE_PATH + "/"; + public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME; + + /* (non-Javadoc) + * @see org.collectionspace.services.client.AbstractServiceClientImpl#getServicePathComponent() + */ + @Override + public String getServicePathComponent() { + return SERVICE_PATH_COMPONENT; + } + + @Override + public String getServiceName() { + return SERVICE_NAME; + } + + @Override + public Class getProxyClass() { + return ValuationcontrolProxy.class; + } + +} diff --git a/services/valuationcontrol/client/src/main/java/org/collectionspace/services/client/ValuationcontrolProxy.java b/services/valuationcontrol/client/src/main/java/org/collectionspace/services/client/ValuationcontrolProxy.java new file mode 100644 index 000000000..66659ac75 --- /dev/null +++ b/services/valuationcontrol/client/src/main/java/org/collectionspace/services/client/ValuationcontrolProxy.java @@ -0,0 +1,30 @@ +/** + * This document is a part of the source code and related artifacts + * for CollectionSpace, an open source collections management system + * for museums and related institutions: + * + * http://www.collectionspace.org + * http://wiki.collectionspace.org + * + * Copyright (c) 2009 Regents of the University of California + * + * Licensed under the Educational Community License (ECL), Version 2.0. + * You may not use this file except in compliance with this License. + * + * You may obtain a copy of the ECL 2.0 License at + * https://source.collectionspace.org/collection-space/LICENSE.txt + */ +package org.collectionspace.services.client; + +import javax.ws.rs.Consumes; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; + +/** + * ValuationcontrolProxy.java + */ +@Path(ValuationcontrolClient.SERVICE_PATH_PROXY) +@Produces({"application/xml"}) +@Consumes({"application/xml"}) +public interface ValuationcontrolProxy extends CollectionSpaceCommonListPoxProxy { +} diff --git a/services/valuationcontrol/client/src/test/java/org/collectionspace/services/client/test/ValuationcontrolServiceTest.java b/services/valuationcontrol/client/src/test/java/org/collectionspace/services/client/test/ValuationcontrolServiceTest.java new file mode 100644 index 000000000..7a49b8b36 --- /dev/null +++ b/services/valuationcontrol/client/src/test/java/org/collectionspace/services/client/test/ValuationcontrolServiceTest.java @@ -0,0 +1,689 @@ +/** + * This document is a part of the source code and related artifacts + * for CollectionSpace, an open source collections management system + * for museums and related institutions: + * + * http://www.collectionspace.org + * http://wiki.collectionspace.org + * + * Copyright © 2009 Regents of the University of California + * + * Licensed under the Educational Community License (ECL), Version 2.0. + * You may not use this file except in compliance with this License. + * + * You may obtain a copy of the ECL 2.0 License at + * https://source.collectionspace.org/collection-space/LICENSE.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.collectionspace.services.client.test; + +//import java.util.ArrayList; +import java.util.List; +import javax.ws.rs.core.Response; + +import org.collectionspace.services.client.AbstractCommonListUtils; +import org.collectionspace.services.client.CollectionSpaceClient; +import org.collectionspace.services.client.ValuationcontrolClient; +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.jaxb.AbstractCommonList; +import org.collectionspace.services.valuationcontrol.ValuationcontrolsCommon; + +import org.jboss.resteasy.client.ClientResponse; +import org.testng.Assert; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * ValuationcontrolServiceTest, carries out tests against a + * deployed and running Valuationcontrol Service. + */ +public class ValuationcontrolServiceTest extends AbstractPoxServiceTestImpl { + + /** The logger. */ + private final String CLASS_NAME = ValuationcontrolServiceTest.class.getName(); + private final Logger logger = LoggerFactory.getLogger(CLASS_NAME); + // Instance variables specific to this test. + /** The service path component. */ + final String SERVICE_NAME = "valuationcontrols"; + final String SERVICE_PATH_COMPONENT = "valuationcontrols"; + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() { + return new ValuationcontrolClient(); + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) + */ + @Override + protected AbstractCommonList getCommonList( + ClientResponse response) { + return response.getEntity(AbstractCommonList.class); + } + + // --------------------------------------------------------------- + // CRUD tests : CREATE tests + // --------------------------------------------------------------- + + // Success outcomes + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String) + */ + @Override + // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class) + public void create(String testName) throws Exception { + // Perform setup, such as initializing the type of service request + // (e.g. CREATE, DELETE), its valid and expected status codes, and + // its associated HTTP method name (e.g. POST, DELETE). + setupCreate(); + + // Submit the request to the service and store the response. + ValuationcontrolClient client = new ValuationcontrolClient(); + String identifier = createIdentifier(); + PoxPayloadOut multipart = createValuationcontrolInstance(identifier); + String newID = null; + ClientResponse res = client.create(multipart); + try { + int statusCode = res.getStatus(); + + // Check the status code of the response: does it match + // the expected response(s)? + // + // Specifically: + // Does it fall within the set of valid status codes? + // Does it exactly match the expected status code? + if (logger.isDebugEnabled()) { + logger.debug(testName + ": status = " + statusCode); + } + Assert.assertTrue(testRequestType.isValidStatusCode(statusCode), + invalidStatusCodeMessage(testRequestType, statusCode)); + Assert.assertEquals(statusCode, testExpectedStatusCode); + + newID = extractId(res); + } finally { + if (res != null) { + res.releaseConnection(); + } + } + + // Store the ID returned from the first resource created + // for additional tests below. + if (knownResourceId == null) { + knownResourceId = newID; + if (logger.isDebugEnabled()) { + logger.debug(testName + ": knownResourceId=" + knownResourceId); + } + } + + // Store the IDs from every resource created by tests, + // so they can be deleted after tests have been run. + allResourceIdsCreated.add(newID); + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String) + */ + @Override + // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, + // dependsOnMethods = {"create"}) + public void createList(String testName) throws Exception { + for (int i = 0; i < 3; i++) { + create(testName); + } + } + + + /* + @Override + @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class, + dependsOnMethods = {"create", "testSubmitRequest"}) + public void createWithEmptyEntityBody(String testName) throws Exception { + + if (logger.isDebugEnabled()) { + logger.debug(testBanner(testName, CLASS_NAME)); + } + // Perform setup. + setupCreateWithEmptyEntityBody(); + + // Submit the request to the service and store the response. + String method = REQUEST_TYPE.httpMethodName(); + String url = getServiceRootURL(); + String mediaType = MediaType.APPLICATION_XML; + final String entity = ""; + int statusCode = submitRequest(method, url, mediaType, entity); + + // Check the status code of the response: does it match + // the expected response(s)? + if(logger.isDebugEnabled()){ + logger.debug("createWithEmptyEntityBody url=" + url + + " status=" + statusCode); + } + Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode), + invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); + Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); + } + + @Override + @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class, + dependsOnMethods = {"create", "testSubmitRequest"}) + public void createWithMalformedXml(String testName) throws Exception { + + if (logger.isDebugEnabled()) { + logger.debug(testBanner(testName, CLASS_NAME)); + } + // Perform setup. + setupCreateWithMalformedXml(testName, logger); + + // Submit the request to the service and store the response. + String method = REQUEST_TYPE.httpMethodName(); + String url = getServiceRootURL(); + String mediaType = MediaType.APPLICATION_XML; + final String entity = MALFORMED_XML_DATA; // Constant from base class. + int statusCode = submitRequest(method, url, mediaType, entity); + + // Check the status code of the response: does it match + // the expected response(s)? + if(logger.isDebugEnabled()){ + logger.debug(testName + ": url=" + url + + " status=" + statusCode); + } + Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode), + invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); + Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); + } + + @Override + @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class, + dependsOnMethods = {"create", "testSubmitRequest"}) + public void createWithWrongXmlSchema(String testName) throws Exception { + + if (logger.isDebugEnabled()) { + logger.debug(testBanner(testName, CLASS_NAME)); + } + // Perform setup. + setupCreateWithWrongXmlSchema(testName, logger); + + // Submit the request to the service and store the response. + String method = REQUEST_TYPE.httpMethodName(); + String url = getServiceRootURL(); + String mediaType = MediaType.APPLICATION_XML; + final String entity = WRONG_XML_SCHEMA_DATA; + int statusCode = submitRequest(method, url, mediaType, entity); + + // Check the status code of the response: does it match + // the expected response(s)? + if(logger.isDebugEnabled()){ + logger.debug(testName + ": url=" + url + + " status=" + statusCode); + } + Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode), + invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); + Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); + } + */ + + // --------------------------------------------------------------- + // CRUD tests : READ tests + // --------------------------------------------------------------- + + // Success outcomes + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String) + */ + @Override + // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, + // dependsOnMethods = {"create"}) + public void read(String testName) throws Exception { + // Perform setup. + setupRead(); + + // Submit the request to the service and store the response. + ValuationcontrolClient client = new ValuationcontrolClient(); + ClientResponse res = client.read(knownResourceId); + PoxPayloadIn input = null; + try { + assertStatusCode(res, testName); + input = new PoxPayloadIn(res.getEntity()); + } finally { + if (res != null) { + res.releaseConnection(); + } + } + + // Get the common part of the response and verify that it is not null. + PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName()); + ValuationcontrolsCommon valuationcontrolCommon = null; + if (payloadInputPart != null) { + valuationcontrolCommon = (ValuationcontrolsCommon) payloadInputPart.getBody(); + } + Assert.assertNotNull(valuationcontrolCommon); + + // Check selected fields. + + // Check the values of fields containing Unicode UTF-8 (non-Latin-1) characters. + String valueNote = valuationcontrolCommon.getValueNote(); + + if (logger.isDebugEnabled()) { + logger.debug("UTF-8 data sent=" + getUTF8DataFragment() + "\n" + + "UTF-8 data received=" + valueNote); + } + + Assert.assertEquals(valueNote, getUTF8DataFragment(), + "UTF-8 data retrieved '" + valueNote + + "' does not match expected data '" + getUTF8DataFragment()); + } + + // Failure outcomes + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String) + */ + @Override + // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, + // dependsOnMethods = {"read"}) + public void readNonExistent(String testName) throws Exception { + // Perform setup. + setupReadNonExistent(); + + // Submit the request to the service and store the response. + ValuationcontrolClient client = new ValuationcontrolClient(); + ClientResponse res = client.read(NON_EXISTENT_ID); + try { + int statusCode = res.getStatus(); + + // Check the status code of the response: does it match + // the expected response(s)? + if (logger.isDebugEnabled()) { + logger.debug(testName + ": status = " + statusCode); + } + Assert.assertTrue(testRequestType.isValidStatusCode(statusCode), + invalidStatusCodeMessage(testRequestType, statusCode)); + Assert.assertEquals(statusCode, testExpectedStatusCode); + } finally { + if (res != null) { + res.releaseConnection(); + } + } + } + + // --------------------------------------------------------------- + // CRUD tests : READ_LIST tests + // --------------------------------------------------------------- + + // Success outcomes + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String) + */ + @Override + // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, + // dependsOnMethods = {"createList", "read"}) + public void readList(String testName) throws Exception { + // Perform setup. + setupReadList(); + + // Submit the request to the service and store the response. + AbstractCommonList list = null; + ValuationcontrolClient client = new ValuationcontrolClient(); + ClientResponse res = client.readList(); + assertStatusCode(res, testName); + try { + int statusCode = res.getStatus(); + + // Check the status code of the response: does it match + // the expected response(s)? + if (logger.isDebugEnabled()) { + logger.debug(testName + ": status = " + statusCode); + } + Assert.assertTrue(testRequestType.isValidStatusCode(statusCode), + invalidStatusCodeMessage(testRequestType, statusCode)); + Assert.assertEquals(statusCode, testExpectedStatusCode); + + list = res.getEntity(); + } finally { + if (res != null) { + res.releaseConnection(); + } + } + + // Optionally output additional data about list members for debugging. + boolean iterateThroughList = true; + if(iterateThroughList && logger.isDebugEnabled()){ + AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName); + } + + } + + // Failure outcomes + // None at present. + + // --------------------------------------------------------------- + // CRUD tests : UPDATE tests + // --------------------------------------------------------------- + + // Success outcomes + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String) + */ + @Override + // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, + // dependsOnMethods = {"read"}) + public void update(String testName) throws Exception { + // Perform setup. + setupRead(); + + // Retrieve the contents of a resource to update. + ValuationcontrolClient client = new ValuationcontrolClient(); + ClientResponse res = client.read(knownResourceId); + PoxPayloadIn input = null; + try { + assertStatusCode(res, testName); + input = new PoxPayloadIn(res.getEntity()); + if (logger.isDebugEnabled()) { + logger.debug("got object to update with ID: " + knownResourceId); + } + } finally { + if (res != null) { + res.releaseConnection(); + } + } + + // Extract the common part from the response. + PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName()); + ValuationcontrolsCommon valuationcontrolCommon = null; + if (payloadInputPart != null) { + valuationcontrolCommon = (ValuationcontrolsCommon) payloadInputPart.getBody(); + } + Assert.assertNotNull(valuationcontrolCommon); + + // Update the content of this resource. + valuationcontrolCommon.setValuationcontrolRefNumber("updated-" + valuationcontrolCommon.getValuationcontrolRefNumber()); + + String valueNote = valuationcontrolCommon.getValueNote(); + valuationcontrolCommon.setValueNote("updated-valueNote-" + valueNote); + + if (logger.isDebugEnabled()) { + logger.debug("to be updated object"); + logger.debug(objectAsXmlString(valuationcontrolCommon, ValuationcontrolsCommon.class)); + } + + setupUpdate(); + + // Submit the updated common part in an update request to the service + // and store the response. + PoxPayloadOut output = new PoxPayloadOut(this.getServicePathComponent()); + PayloadOutputPart commonPart = output.addPart(client.getCommonPartName(), valuationcontrolCommon); + res = client.update(knownResourceId, output); + try { + assertStatusCode(res, testName); + int statusCode = res.getStatus(); + // Check the status code of the response: does it match the expected response(s)? + if (logger.isDebugEnabled()) { + logger.debug(testName + ": status = " + statusCode); + } + Assert.assertTrue(testRequestType.isValidStatusCode(statusCode), + invalidStatusCodeMessage(testRequestType, statusCode)); + Assert.assertEquals(statusCode, testExpectedStatusCode); + input = new PoxPayloadIn(res.getEntity()); + } finally { + if (res != null) { + res.releaseConnection(); + } + } + + // Extract the updated common part from the response. + payloadInputPart = input.getPart(client.getCommonPartName()); + ValuationcontrolsCommon updatedValuationcontrolCommon = null; + if (payloadInputPart != null) { + updatedValuationcontrolCommon = (ValuationcontrolsCommon) payloadInputPart.getBody(); + } + Assert.assertNotNull(updatedValuationcontrolCommon); + + // Check selected fields in the updated common part. + Assert.assertEquals(updatedValuationcontrolCommon.getValuationcontrolRefNumber(), + valuationcontrolCommon.getValuationcontrolRefNumber(), + "Data in updated object did not match submitted data."); + + // Check the values of fields containing Unicode UTF-8 (non-Latin-1) characters. + String originalValueNote = valuationcontrolCommon.getValueNote(); + String updatedValueNote = updatedValuationcontrolCommon.getValueNote(); + + Assert.assertEquals(updatedValueNote, originalValueNote, + "Data in updated object did not match submitted data."); + + if(logger.isDebugEnabled()){ + logger.debug("UTF-8 data sent=" + originalValueNote + "\n" + + "UTF-8 data received=" + updatedValueNote); + } + Assert.assertTrue(updatedValueNote.contains(getUTF8DataFragment()), + "UTF-8 data retrieved '" + updatedValueNote + + "' does not match expected data '" + getUTF8DataFragment()); + } + + @Override + // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, + // dependsOnMethods = {"update", "testSubmitRequest"}) + public void updateNonExistent(String testName) throws Exception { + // Perform setup. + setupUpdateNonExistent(); + + // Submit the request to the service and store the response. + // Note: The ID used in this 'create' call may be arbitrary. + // The only relevant ID may be the one used in update(), below. + ValuationcontrolClient client = new ValuationcontrolClient(); + PoxPayloadOut multipart = createValuationcontrolInstance(NON_EXISTENT_ID); + ClientResponse res = client.update(NON_EXISTENT_ID, multipart); + try { + int statusCode = res.getStatus(); + + // Check the status code of the response: does it match + // the expected response(s)? + if (logger.isDebugEnabled()) { + logger.debug(testName + ": status = " + statusCode); + } + Assert.assertTrue(testRequestType.isValidStatusCode(statusCode), + invalidStatusCodeMessage(testRequestType, statusCode)); + Assert.assertEquals(statusCode, testExpectedStatusCode); + } finally { + if (res != null) { + res.releaseConnection(); + } + } + } + + // --------------------------------------------------------------- + // CRUD tests : DELETE tests + // --------------------------------------------------------------- + + // Success outcomes + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String) + */ + @Override + // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, + // dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"}) + public void delete(String testName) throws Exception { + // Perform setup. + setupDelete(); + + // Submit the request to the service and store the response. + ValuationcontrolClient client = new ValuationcontrolClient(); + ClientResponse res = client.delete(knownResourceId); + try { + int statusCode = res.getStatus(); + + // Check the status code of the response: does it match + // the expected response(s)? + if (logger.isDebugEnabled()) { + logger.debug(testName + ": status = " + statusCode); + } + Assert.assertTrue(testRequestType.isValidStatusCode(statusCode), + invalidStatusCodeMessage(testRequestType, statusCode)); + Assert.assertEquals(statusCode, testExpectedStatusCode); + } finally { + if (res != null) { + res.releaseConnection(); + } + } + } + + // Failure outcomes + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String) + */ + @Override + // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, + // dependsOnMethods = {"delete"}) + public void deleteNonExistent(String testName) throws Exception { + // Perform setup. + setupDeleteNonExistent(); + + // Submit the request to the service and store the response. + ValuationcontrolClient client = new ValuationcontrolClient(); + ClientResponse res = client.delete(NON_EXISTENT_ID); + try { + int statusCode = res.getStatus(); + + // Check the status code of the response: does it match + // the expected response(s)? + if (logger.isDebugEnabled()) { + logger.debug(testName + ": status = " + statusCode); + } + Assert.assertTrue(testRequestType.isValidStatusCode(statusCode), + invalidStatusCodeMessage(testRequestType, statusCode)); + Assert.assertEquals(statusCode, testExpectedStatusCode); + } finally { + if (res != null) { + res.releaseConnection(); + } + } + } + + // --------------------------------------------------------------- + // Utility tests : tests of code used in tests above + // --------------------------------------------------------------- + + /** + * Tests the code for manually submitting data that is used by several + * of the methods above. + */ + // @Test(dependsOnMethods = {"create", "read"}) + public void testSubmitRequest() { + + // Expected status code: 200 OK + final int EXPECTED_STATUS = Response.Status.OK.getStatusCode(); + + // Submit the request to the service and store the response. + String method = ServiceRequestType.READ.httpMethodName(); + String url = getResourceURL(knownResourceId); + int statusCode = submitRequest(method, url); + + // Check the status code of the response: does it match + // the expected response(s)? + if (logger.isDebugEnabled()) { + logger.debug("testSubmitRequest: url=" + url + + " status=" + statusCode); + } + Assert.assertEquals(statusCode, EXPECTED_STATUS); + + } + + // --------------------------------------------------------------- + // Utility methods used by tests above + // --------------------------------------------------------------- + + @Override + public String getServiceName() { + return SERVICE_NAME; + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent() + */ + @Override + public String getServicePathComponent() { + return SERVICE_PATH_COMPONENT; + } + + @Override + protected PoxPayloadOut createInstance(String identifier) { + return createValuationcontrolInstance(identifier); + } + + /** + * Creates the valuationcontrol instance. + * + * @param identifier the identifier + * @return the multipart output + */ + //private PoxPayloadOut createValuationcontrolInstance(String identifier) { + // return createValuationcontrolInstance("valuationcontrolRefNumber-" + identifier); + //} + + /** + * Creates the valuationcontrol instance. + * + * @param valuationcontrolRefNumber the valuationcontrol number + * @return the multipart output + */ + private PoxPayloadOut createValuationcontrolInstance(String valuationcontrolRefNumber) { + + ValuationcontrolsCommon valuationcontrolCommon = new ValuationcontrolsCommon(); + valuationcontrolCommon.setValuationcontrolRefNumber(valuationcontrolRefNumber); + valuationcontrolCommon.setValueNote(getUTF8DataFragment()); + + PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent()); + PayloadOutputPart commonPart = + multipart.addPart(new ValuationcontrolClient().getCommonPartName(), valuationcontrolCommon); + + if (logger.isDebugEnabled()) { + logger.debug("to be created, valuationcontrol common"); + logger.debug(objectAsXmlString(valuationcontrolCommon, ValuationcontrolsCommon.class)); + } + + return multipart; + } + + @Override + public void CRUDTests(String testName) { + // TODO Auto-generated method stub + + } + + @Override + protected PoxPayloadOut createInstance(String commonPartName, + String identifier) { + PoxPayloadOut result = createValuationcontrolInstance(identifier); + return result; + } + + @Override + protected ValuationcontrolsCommon updateInstance(ValuationcontrolsCommon commonPartObject) { + // TODO Auto-generated method stub + return null; + } + + @Override + protected void compareUpdatedInstances(ValuationcontrolsCommon original, + ValuationcontrolsCommon updated) throws Exception { + // TODO Auto-generated method stub + + } +} diff --git a/services/valuationcontrol/client/src/test/resources/log4j.properties b/services/valuationcontrol/client/src/test/resources/log4j.properties new file mode 100644 index 000000000..148a3e865 --- /dev/null +++ b/services/valuationcontrol/client/src/test/resources/log4j.properties @@ -0,0 +1,23 @@ +log4j.rootLogger=debug, stdout, R + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout + +# Pattern to output the caller's file name and line number. +log4j.appender.stdout.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n + +log4j.appender.R=org.apache.log4j.RollingFileAppender +log4j.appender.R.File=target/test-client.log + +log4j.appender.R.MaxFileSize=100KB +# Keep one backup file +log4j.appender.R.MaxBackupIndex=1 + +log4j.appender.R.layout=org.apache.log4j.PatternLayout +log4j.appender.R.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n + +#packages +log4j.logger.org.collectionspace=DEBUG +log4j.logger.org.apache=INFO +log4j.logger.httpclient=INFO +log4j.logger.org.jboss.resteasy=INFO diff --git a/services/valuationcontrol/jaxb/pom.xml b/services/valuationcontrol/jaxb/pom.xml new file mode 100644 index 000000000..9a92058b9 --- /dev/null +++ b/services/valuationcontrol/jaxb/pom.xml @@ -0,0 +1,34 @@ + + + + org.collectionspace.services.valuationcontrol + org.collectionspace.services + 4.1-SNAPSHOT + + + 4.0.0 + org.collectionspace.services + org.collectionspace.services.valuationcontrol.jaxb + services.valuationcontrol.jaxb + + + + org.collectionspace.services + org.collectionspace.services.jaxb + ${project.version} + + + + + collectionspace-services-valuationcontrol-jaxb + install + + + org.jvnet.jaxb2.maven2 + maven-jaxb2-plugin + + + + diff --git a/services/valuationcontrol/jaxb/src/main/java/org/collectionspace/services/ValuationcontrolJAXBSchema.java b/services/valuationcontrol/jaxb/src/main/java/org/collectionspace/services/ValuationcontrolJAXBSchema.java new file mode 100644 index 000000000..2c6671c36 --- /dev/null +++ b/services/valuationcontrol/jaxb/src/main/java/org/collectionspace/services/ValuationcontrolJAXBSchema.java @@ -0,0 +1,15 @@ +/** + * + */ +package org.collectionspace.services; + +public interface ValuationcontrolJAXBSchema { + final static String VALUATIONCONTROL_REF_NUMBER = "valuationcontrolRefNumber"; + final static String VALUE_CURRENCY = "valueCurrency"; + final static String VALUE_AMOUNT = "valueAmount"; + final static String VALUE_DATE = "valueDate"; + final static String VALUE_RENEWAL_DATE = "valueRenewalDate"; + final static String VALUE_SOURCE = "valueSource"; + final static String VALUE_TYPE = "valueType"; + final static String VALUE_NOTE = "valueNote"; +} diff --git a/services/valuationcontrol/jaxb/src/main/java/org/collectionspace/services/ValuationcontrolListItemJAXBSchema.java b/services/valuationcontrol/jaxb/src/main/java/org/collectionspace/services/ValuationcontrolListItemJAXBSchema.java new file mode 100644 index 000000000..b31ac5ac9 --- /dev/null +++ b/services/valuationcontrol/jaxb/src/main/java/org/collectionspace/services/ValuationcontrolListItemJAXBSchema.java @@ -0,0 +1,14 @@ +package org.collectionspace.services; + +public interface ValuationcontrolListItemJAXBSchema { + final static String VALUATIONCONTROL_REF_NUMBER = "valuationcontrolRefNumber"; + final static String VALUE_CURRENCY = "valueCurrency"; + final static String VALUE_AMOUNT = "valueAmount"; + final static String VALUE_DATE = "valueDate"; + final static String VALUE_RENEWAL_DATE = "valueRenewalDate"; + final static String VALUE_SOURCE = "valueSource"; + final static String VALUE_TYPE = "valueType"; + final static String VALUE_NOTE = "valueNote"; + final static String CSID = "csid"; + final static String URI = "url"; +} diff --git a/services/valuationcontrol/jaxb/src/main/resources/Valuationcontrols-common.xsd b/services/valuationcontrol/jaxb/src/main/resources/Valuationcontrols-common.xsd new file mode 100644 index 000000000..71764e02c --- /dev/null +++ b/services/valuationcontrol/jaxb/src/main/resources/Valuationcontrols-common.xsd @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/valuationcontrol/pom.xml b/services/valuationcontrol/pom.xml new file mode 100644 index 000000000..be62a1c0f --- /dev/null +++ b/services/valuationcontrol/pom.xml @@ -0,0 +1,23 @@ + + + + + org.collectionspace.services + org.collectionspace.services.main + 4.1-SNAPSHOT + + + 4.0.0 + org.collectionspace.services + org.collectionspace.services.valuationcontrol + services.valuationcontrol + pom + + + jaxb + service + 3rdparty + client + + + diff --git a/services/valuationcontrol/service/pom.xml b/services/valuationcontrol/service/pom.xml new file mode 100644 index 000000000..c2e63b1ad --- /dev/null +++ b/services/valuationcontrol/service/pom.xml @@ -0,0 +1,106 @@ + + + + + org.collectionspace.services + org.collectionspace.services.valuationcontrol + 4.1-SNAPSHOT + + + 4.0.0 + org.collectionspace.services + org.collectionspace.services.valuationcontrol.service + services.valuationcontrol.service + jar + + + + org.collectionspace.services + org.collectionspace.services.common + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.valuationcontrol.jaxb + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.valuationcontrol.client + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.collectionobject.jaxb + ${project.version} + + + + junit + junit + 4.1 + test + + + org.testng + testng + + + + + + javax.security + jaas + 1.0.01 + provided + + + + dom4j + dom4j + 1.6.1 + provided + + + + + + org.jboss.resteasy + resteasy-jaxrs + + + tjws + webserver + + + + + org.jboss.resteasy + resteasy-jaxb-provider + + + org.jboss.resteasy + resteasy-multipart-provider + + + + + + org.nuxeo.ecm.core + nuxeo-core-api + ${nuxeo.core.version} + + + jboss-remoting + jboss + + + + + + + + collectionspace-services-valuationcontrol + + + diff --git a/services/valuationcontrol/service/profiles.xml b/services/valuationcontrol/service/profiles.xml new file mode 100644 index 000000000..7c9dc966e --- /dev/null +++ b/services/valuationcontrol/service/profiles.xml @@ -0,0 +1,4 @@ + + + diff --git a/services/valuationcontrol/service/src/main/java/org/collectionspace/services/valuationcontrol/ValuationcontrolResource.java b/services/valuationcontrol/service/src/main/java/org/collectionspace/services/valuationcontrol/ValuationcontrolResource.java new file mode 100644 index 000000000..31de133f6 --- /dev/null +++ b/services/valuationcontrol/service/src/main/java/org/collectionspace/services/valuationcontrol/ValuationcontrolResource.java @@ -0,0 +1,58 @@ +/** + * This document is a part of the source code and related artifacts + * for CollectionSpace, an open source collections management system + * for museums and related institutions: + * + * http://www.collectionspace.org + * http://wiki.collectionspace.org + * + * Copyright 2009 University of California at Berkeley + * + * Licensed under the Educational Community License (ECL), Version 2.0. + * You may not use this file except in compliance with this License. + * + * You may obtain a copy of the ECL 2.0 License at + * + * https://source.collectionspace.org/collection-space/LICENSE.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.collectionspace.services.valuationcontrol; + +import org.collectionspace.services.client.ValuationcontrolClient; +import org.collectionspace.services.common.ResourceBase; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.ws.rs.Consumes; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; + +@Path(ValuationcontrolClient.SERVICE_PATH) +@Consumes("application/xml") +@Produces("application/xml") +public class ValuationcontrolResource extends ResourceBase { + + final Logger logger = LoggerFactory.getLogger(ValuationcontrolResource.class); + + @Override + protected String getVersionString() { + final String lastChangeRevision = "$LastChangedRevision$"; + return lastChangeRevision; + } + + @Override + public String getServiceName() { + return ValuationcontrolClient.SERVICE_NAME; + } + + @Override + public Class getCommonPartClass() { + return ValuationcontrolsCommon.class; + } +} + diff --git a/services/valuationcontrol/service/src/main/java/org/collectionspace/services/valuationcontrol/nuxeo/ValuationcontrolConstants.java b/services/valuationcontrol/service/src/main/java/org/collectionspace/services/valuationcontrol/nuxeo/ValuationcontrolConstants.java new file mode 100644 index 000000000..c1c6fe921 --- /dev/null +++ b/services/valuationcontrol/service/src/main/java/org/collectionspace/services/valuationcontrol/nuxeo/ValuationcontrolConstants.java @@ -0,0 +1,35 @@ +/** + * This document is a part of the source code and related artifacts + * for CollectionSpace, an open source collections management system + * for museums and related institutions: + * + * http://www.collectionspace.org + * http://wiki.collectionspace.org + * + * Copyright 2009 University of California at Berkeley + * + * Licensed under the Educational Community License (ECL), Version 2.0. + * You may not use this file except in compliance with this License. + * + * You may obtain a copy of the ECL 2.0 License at + * + * https://source.collectionspace.org/collection-space/LICENSE.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.collectionspace.services.valuationcontrol.nuxeo; + +/** + * ValuationcontrolConstants specifies constants for the Valuation Controls service + * + */ +public class ValuationcontrolConstants { + + public final static String NUXEO_DOCTYPE = "Valuationcontrol"; + public final static String NUXEO_SCHEMA_NAME = "valuationcontrol"; + public final static String NUXEO_DC_TITLE = "CollectionSpace-Valuationcontrol"; +} diff --git a/services/valuationcontrol/service/src/main/java/org/collectionspace/services/valuationcontrol/nuxeo/ValuationcontrolDocumentModelHandler.java b/services/valuationcontrol/service/src/main/java/org/collectionspace/services/valuationcontrol/nuxeo/ValuationcontrolDocumentModelHandler.java new file mode 100644 index 000000000..7c53a6910 --- /dev/null +++ b/services/valuationcontrol/service/src/main/java/org/collectionspace/services/valuationcontrol/nuxeo/ValuationcontrolDocumentModelHandler.java @@ -0,0 +1,33 @@ +/** + * This document is a part of the source code and related artifacts + * for CollectionSpace, an open source collections management system + * for museums and related institutions: + * + * http://www.collectionspace.org + * http://wiki.collectionspace.org + * + * Copyright 2009 University of California at Berkeley + * + * Licensed under the Educational Community License (ECL), Version 2.0. + * You may not use this file except in compliance with this License. + * + * You may obtain a copy of the ECL 2.0 License at + * + * https://source.collectionspace.org/collection-space/LICENSE.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.collectionspace.services.valuationcontrol.nuxeo; + +import org.collectionspace.services.valuationcontrol.ValuationcontrolsCommon; +import org.collectionspace.services.nuxeo.client.java.DocHandlerBase; + +/** ValuationcontrolDocumentModelHandler + */ +public class ValuationcontrolDocumentModelHandler + extends DocHandlerBase { +} diff --git a/services/valuationcontrol/service/src/main/java/org/collectionspace/services/valuationcontrol/nuxeo/ValuationcontrolValidatorHandler.java b/services/valuationcontrol/service/src/main/java/org/collectionspace/services/valuationcontrol/nuxeo/ValuationcontrolValidatorHandler.java new file mode 100644 index 000000000..da8d2a960 --- /dev/null +++ b/services/valuationcontrol/service/src/main/java/org/collectionspace/services/valuationcontrol/nuxeo/ValuationcontrolValidatorHandler.java @@ -0,0 +1,18 @@ +package org.collectionspace.services.valuationcontrol.nuxeo; + +import org.collectionspace.services.common.context.ServiceContext; +import org.collectionspace.services.common.document.InvalidDocumentException; +import org.collectionspace.services.common.document.ValidatorHandler; +import org.collectionspace.services.common.document.DocumentHandler.Action; + +public class ValuationcontrolValidatorHandler implements ValidatorHandler { + + @Override + public void validate(Action action, ServiceContext ctx) + throws InvalidDocumentException { + // TODO Auto-generated method stub + System.out.println("ValuationcontrolValidatorHandler executed."); + + } + +} diff --git a/services/valuationcontrol/service/src/test/java/org/collectionspace/services/test/ValuationcontrolServiceTest.java b/services/valuationcontrol/service/src/test/java/org/collectionspace/services/test/ValuationcontrolServiceTest.java new file mode 100644 index 000000000..684b7a5c5 --- /dev/null +++ b/services/valuationcontrol/service/src/test/java/org/collectionspace/services/test/ValuationcontrolServiceTest.java @@ -0,0 +1,11 @@ +package org.collectionspace.services.test; + +//import org.collectionspace.services.valuationcontrol.Valuationcontrol; +//import org.collectionspace.services.valuationcontrol.ValuationcontrolList; + +/** + * Placeholder for server-side testing of Valuation Control service code. + */ +public class ValuationcontrolServiceTest { + //empty +} diff --git a/services/valuationcontrol/service/src/test/resources/log4j.xml b/services/valuationcontrol/service/src/test/resources/log4j.xml new file mode 100644 index 000000000..3869b526d --- /dev/null +++ b/services/valuationcontrol/service/src/test/resources/log4j.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.47.3