<artifactId>org.collectionspace.services.workflow.service</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.iterationreport.service</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<!--dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.query.service</artifactId>
import org.collectionspace.services.collectionobject.CollectionObjectResource;
import org.collectionspace.services.id.IDResource;
import org.collectionspace.services.insurance.InsuranceResource;
+import org.collectionspace.services.iterationreport.IterationreportResource;
import org.collectionspace.services.media.MediaResource;
import org.collectionspace.services.group.GroupResource;
import org.collectionspace.services.intake.IntakeResource;
addResourceToMapAndSingletons(new ReportResource());
addResourceToMapAndSingletons(new PublicItemResource());
addResourceToMapAndSingletons(new TransportResource());
+ addResourceToMapAndSingletons(new IterationreportResource());
singletons.add(new IDResource());
SELECT csid
FROM id_generators
);
+
+-- ITERATIONREPORT_REFERENCE_NUMBER
+
+INSERT INTO id_generators
+ (csid, displayname, description, priority, last_generated_id, id_generator_state)
+ SELECT
+ '4f0f36f6-643c-4a3e-89f4-012837852b04',
+ 'Iteration Report Reference Number',
+ 'Identifies an iterationreport.',
+ '9',
+ '',
+'<org.collectionspace.services.id.SettableIDGenerator>
+ <parts>
+ <org.collectionspace.services.id.StringIDGeneratorPart>
+ <initialValue>IR</initialValue>
+ <currentValue>IR</currentValue>
+ </org.collectionspace.services.id.StringIDGeneratorPart>
+ <org.collectionspace.services.id.YearIDGeneratorPart>
+ <currentValue></currentValue>
+ </org.collectionspace.services.id.YearIDGeneratorPart>
+ <org.collectionspace.services.id.StringIDGeneratorPart>
+ <initialValue>.</initialValue>
+ <currentValue>.</currentValue>
+ </org.collectionspace.services.id.StringIDGeneratorPart>
+ <org.collectionspace.services.id.NumericIDGeneratorPart>
+ <maxLength>6</maxLength>
+ <initialValue>1</initialValue>
+ <currentValue>-1</currentValue>
+ </org.collectionspace.services.id.NumericIDGeneratorPart>
+ </parts>
+</org.collectionspace.services.id.SettableIDGenerator>'
+ WHERE '4f0f36f6-643c-4a3e-89f4-012837852b04' NOT IN
+ (
+ SELECT csid
+ FROM id_generators
+ );
--- /dev/null
+
+<project name="iterationreport" default="package" basedir=".">
+ <description>
+ iterationreport service
+ </description>
+ <!-- set global properties for this build -->
+ <property name="services.trunk" value="../.."/>
+ <!-- environment should be declared before reading build.properties -->
+ <property environment="env" />
+ <property file="${services.trunk}/build.properties" />
+ <property name="mvn.opts" value="-V" />
+ <property name="src" location="src"/>
+
+ <condition property="osfamily-unix">
+ <os family="unix" />
+ </condition>
+ <condition property="osfamily-windows">
+ <os family="windows" />
+ </condition>
+
+ <target name="package" depends="package-unix,package-windows"
+ description="Package CollectionSpace Services" />
+
+ <target name="package-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="package" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="package-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn" />
+ <arg value="package" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+
+ <target name="install" depends="install-unix,install-windows"
+ description="Install" />
+ <target name="install-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="install" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="install-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn" />
+ <arg value="install" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="clean" depends="clean-unix,clean-windows"
+ description="Delete target directories" >
+ <delete dir="${build}"/>
+ </target>
+ <target name="clean-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="clean" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="clean-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn" />
+ <arg value="clean" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="test" depends="test-unix,test-windows" description="Run tests" />
+ <target name="test-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="test" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="test-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn" />
+ <arg value="test" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="deploy" depends="install"
+ description="deploy iterationreport service">
+ <ant antfile="3rdparty/build.xml" target="deploy" inheritall="false"/>
+ </target>
+
+ <target name="undeploy"
+ description="undeploy iterationreport service">
+ <ant antfile="3rdparty/build.xml" target="undeploy" inheritall="false"/>
+ </target>
+
+ <target name="dist" depends="package"
+ description="distribute iterationreport service">
+ <ant antfile="3rdparty/build.xml" target="dist" inheritall="false"/>
+ </target>
+
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.iterationreport</artifactId>
+ <version>${revision}</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.collectionspace.services.iterationreport.client</artifactId>
+ <name>services.iterationreport.client</name>
+
+ <dependencies>
+<!-- CollectionSpace dependencies -->
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>
+ <optional>true</optional>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.common</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.iterationreport.jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.person.client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+<!-- External dependencies -->
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ <!-- filter out unwanted jars -->
+ <exclusions>
+ <exclusion>
+ <groupId>tjws</groupId>
+ <artifactId>webserver</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxb-provider</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-multipart-provider</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>collectionspace-services-iterationreport-client</finalName>
+ </build>
+</project>
--- /dev/null
+/**
+ * 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
+ *
+ * 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 org.collectionspace.services.iterationreport.IterationreportsCommon;
+
+/**
+ * IterationreportClient.java
+ */
+public class IterationreportClient extends AbstractCommonListPoxServiceClientImpl<IterationreportProxy, IterationreportsCommon> {
+
+ public static final String SERVICE_NAME = "iterationreports";
+ 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;
+
+ public IterationreportClient() throws Exception {
+ super();
+ }
+
+ public IterationreportClient(String clientPropertiesFilename) throws Exception {
+ super(clientPropertiesFilename);
+ }
+
+ @Override
+ public String getServicePathComponent() {
+ return SERVICE_PATH_COMPONENT;
+ }
+
+ @Override
+ public String getServiceName() {
+ return SERVICE_NAME;
+ }
+
+ @Override
+ public Class<IterationreportProxy> getProxyClass() {
+ return IterationreportProxy.class;
+ }
+
+}
--- /dev/null
+/**
+ * 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
+ *
+ * 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;
+
+/**
+ * IterationreportProxy.java
+ */
+@Path(IterationreportClient.SERVICE_PATH_PROXY)
+@Produces({"application/xml"})
+@Consumes({"application/xml"})
+public interface IterationreportProxy extends CollectionSpaceCommonListPoxProxy {
+}
--- /dev/null
+/*
+ * 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
+
+ * 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 javax.ws.rs.core.Response;
+
+import org.collectionspace.services.client.AbstractCommonListUtils;
+import org.collectionspace.services.client.CollectionSpaceClient;
+import org.collectionspace.services.client.IterationreportClient;
+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.iterationreport.IterationreportsCommon;
+import org.collectionspace.services.jaxb.AbstractCommonList;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+
+public class IterationreportServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonList, IterationreportsCommon> {
+
+ /** The logger. */
+ private final String CLASS_NAME = IterationreportServiceTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+ // Instance variables specific to this test.
+ /** The service path component. */
+ final String SERVICE_NAME = "transports";
+ final String SERVICE_PATH_COMPONENT = "transports";
+
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
+ */
+ @Override
+ protected AbstractCommonList getCommonList(Response response) {
+ return response.readEntity(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.
+ IterationreportClient client = new IterationreportClient();
+ String identifier = createIdentifier();
+ PoxPayloadOut multipart = createIterationreportInstance(identifier);
+ String newID = null;
+ Response 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.close();
+ }
+ }
+
+ // 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);
+ }
+ }
+
+ // ---------------------------------------------------------------
+ // 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.
+ IterationreportClient client = new IterationreportClient();
+ Response res = client.read(knownResourceId);
+ PoxPayloadIn input = null;
+ try {
+ assertStatusCode(res, testName);
+ input = new PoxPayloadIn(res.readEntity(String.class));
+ } finally {
+ if (res != null) {
+ res.close();
+ }
+ }
+
+ // Get the common part of the response and verify that it is not null.
+ PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
+ IterationreportsCommon transportCommon = null;
+ if (payloadInputPart != null) {
+ transportCommon = (IterationreportsCommon) payloadInputPart.getBody();
+ }
+ Assert.assertNotNull(transportCommon);
+ }
+
+ // 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.
+ IterationreportClient client = new IterationreportClient();
+ Response 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.close();
+ }
+ }
+ }
+
+ // ---------------------------------------------------------------
+ // 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;
+ IterationreportClient client = new IterationreportClient();
+ Response 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.readEntity(getCommonListType());
+ } finally {
+ if (res != null) {
+ res.close();
+ }
+ }
+
+ // 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.
+ IterationreportClient client = new IterationreportClient();
+ Response res = client.read(knownResourceId);
+ PoxPayloadIn input = null;
+ try {
+ assertStatusCode(res, testName);
+ input = new PoxPayloadIn(res.readEntity(String.class));
+ if (logger.isDebugEnabled()) {
+ logger.debug("got object to update with ID: " + knownResourceId);
+ }
+ } finally {
+ if (res != null) {
+ res.close();
+ }
+ }
+
+ // Extract the common part from the response.
+ PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
+ IterationreportsCommon transportCommon = null;
+ if (payloadInputPart != null) {
+ transportCommon = (IterationreportsCommon) payloadInputPart.getBody();
+ }
+ Assert.assertNotNull(transportCommon);
+
+ // Update the content of this resource.
+ transportCommon.setIterationreportReferenceNumber("updated-" + transportCommon.getIterationreportReferenceNumber());
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("to be updated object");
+ logger.debug(objectAsXmlString(transportCommon, IterationreportsCommon.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(), transportCommon);
+ 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.readEntity(String.class));
+ } finally {
+ if (res != null) {
+ res.close();
+ }
+ }
+
+ // Extract the updated common part from the response.
+ payloadInputPart = input.getPart(client.getCommonPartName());
+ IterationreportsCommon updatedIterationreportCommon = null;
+ if (payloadInputPart != null) {
+ updatedIterationreportCommon = (IterationreportsCommon) payloadInputPart.getBody();
+ }
+ Assert.assertNotNull(updatedIterationreportCommon);
+
+ // Check selected fields in the updated common part.
+ Assert.assertEquals(updatedIterationreportCommon.getIterationreportReferenceNumber(),
+ transportCommon.getIterationreportReferenceNumber(),
+ "Data in updated object did not match submitted data.");
+ }
+
+ @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.
+ IterationreportClient client = new IterationreportClient();
+ PoxPayloadOut multipart = createIterationreportInstance(NON_EXISTENT_ID);
+ Response 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.close();
+ }
+ }
+ }
+
+ // ---------------------------------------------------------------
+ // 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.
+ IterationreportClient client = new IterationreportClient();
+ Response 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.close();
+ }
+ }
+ }
+
+ // 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.
+ IterationreportClient client = new IterationreportClient();
+ Response 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.close();
+ }
+ }
+ }
+
+ // ---------------------------------------------------------------
+ // 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
+ protected PoxPayloadOut createInstance(String identifier) throws Exception {
+ return createIterationreportInstance(identifier);
+ }
+
+ /**
+ * Creates the transport instance.
+ *
+ * @param transportNumber the transport number
+ * @return the multipart output
+ * @throws Exception
+ */
+ private PoxPayloadOut createIterationreportInstance(String transportNumber) throws Exception {
+
+ IterationreportsCommon transportCommon = new IterationreportsCommon();
+ transportCommon.setIterationreportReferenceNumber(transportNumber);
+ // transportCommon.setDestination(getUTF8DataFragment());
+
+ PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent());
+ PayloadOutputPart commonPart =
+ multipart.addPart(new IterationreportClient().getCommonPartName(), transportCommon);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("to be created, transport common");
+ logger.debug(objectAsXmlString(transportCommon, IterationreportsCommon.class));
+ }
+
+ return multipart;
+ }
+
+ @Override
+ public void CRUDTests(String testName) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ protected PoxPayloadOut createInstance(String commonPartName,
+ String identifier) throws Exception {
+ PoxPayloadOut result = createIterationreportInstance(identifier);
+ return result;
+ }
+
+ @Override
+ protected IterationreportsCommon updateInstance(IterationreportsCommon commonPartObject) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected void compareUpdatedInstances(IterationreportsCommon original,
+ IterationreportsCommon updated) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
+ */
+ @Override
+ protected CollectionSpaceClient getClientInstance() throws Exception {
+ return new IterationreportClient();
+ }
+
+ @Override
+ protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
+ return new IterationreportClient(clientPropertiesFilename);
+ }
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
+ */
+ @Override
+ protected String getServicePathComponent() throws Exception {
+ return SERVICE_PATH_COMPONENT;
+ }
+
+ @Override
+ protected String getServiceName() {
+ return SERVICE_NAME;
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>org.collectionspace.services.iterationreport</artifactId>
+ <groupId>org.collectionspace.services</groupId>
+ <version>${revision}</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.collectionspace.services.iterationreport.jaxb</artifactId>
+ <name>services.iterationreport.jaxb</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>collectionspace-services-iterationreport-jaxb</finalName>
+ <defaultGoal>install</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.jvnet.jaxb2.maven2</groupId>
+ <artifactId>maven-jaxb2-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
--- /dev/null
+/**
+ * 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
+ *
+ * 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;
+
+public interface IterationreportJAXBSchema {
+}
--- /dev/null
+/**
+ * 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
+ *
+ * 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;
+
+public interface IterationreportListItemJAXBSchema {
+ final static String CSID = "csid";
+ final static String URI = "url";
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+ Iterationreport schema (XSD)
+
+ Entity : Iterationreport
+ Part : Common
+ Used for: JAXB binding between XML and Java objects
+-->
+
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+ jaxb:version="1.0" elementFormDefault="unqualified"
+ xmlns:ns="http://collectionspace.org/services/iterationreport"
+ xmlns="http://collectionspace.org/services/iterationreport"
+ targetNamespace="http://collectionspace.org/services/iterationreport"
+ version="0.1"
+>
+
+<!--
+ Avoid XmlRootElement nightmare:
+ See http://weblogs.java.net/blog/kohsuke/archive/2006/03/why_does_jaxb_p.html
+-->
+
+ <!-- Iterationreport Information Group -->
+ <xs:element name="iterationreports_common">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="iterationreportReferenceNumber" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.main</artifactId>
+ <version>${revision}</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.collectionspace.services.iterationreport</artifactId>
+ <name>services.iterationreport</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>jaxb</module>
+ <module>service</module>
+ <module>client</module>
+ </modules>
+
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.iterationreport</artifactId>
+ <version>${revision}</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.collectionspace.services.iterationreport.service</artifactId>
+ <name>services.iterationreport.service</name>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.iterationreport.jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.iterationreport.client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.collectionobject.jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <!-- External dependencies -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ </dependency>
+
+ <!-- javax -->
+
+ <dependency>
+ <groupId>javax.security</groupId>
+ <artifactId>jaas</artifactId>
+ <version>1.0.01</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- jboss -->
+
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>tjws</groupId>
+ <artifactId>webserver</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxb-provider</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-multipart-provider</artifactId>
+ </dependency>
+
+ <!-- nuxeo -->
+
+ <dependency>
+ <groupId>org.nuxeo.ecm.core</groupId>
+ <artifactId>nuxeo-core-api</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>jboss-remoting</artifactId>
+ <groupId>jboss</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>collectionspace-services-iterationreport</finalName>
+ </build>
+</project>
--- /dev/null
+/**
+ * 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
+ *
+ * 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.iterationreport;
+
+import org.collectionspace.services.client.IterationreportClient;
+import org.collectionspace.services.common.NuxeoBasedResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+@Path(IterationreportClient.SERVICE_PATH)
+@Consumes("application/xml")
+@Produces("application/xml")
+public class IterationreportResource extends NuxeoBasedResource {
+
+ final Logger logger = LoggerFactory.getLogger(IterationreportResource.class);
+
+ @Override
+ protected String getVersionString() {
+ final String lastChangeRevision = "$LastChangedRevision$";
+ return lastChangeRevision;
+ }
+
+ @Override
+ public String getServiceName() {
+ return IterationreportClient.SERVICE_NAME;
+ }
+
+ @Override
+ public Class<IterationreportsCommon> getCommonPartClass() {
+ return IterationreportsCommon.class;
+ }
+}
+
--- /dev/null
+/**
+ * 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
+ *
+ * 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.iterationreport.nuxeo;
+
+/**
+ * IterationreportConstants specifies constants for the Iterationreport service
+ *
+ */
+public class IterationreportConstants {
+
+ public final static String NUXEO_DOCTYPE = "Iterationreport";
+ public final static String NUXEO_SCHEMA_NAME = "iterationreport";
+ public final static String NUXEO_DC_TITLE = "CollectionSpace-Iterationreport";
+}
--- /dev/null
+/**
+ * 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
+ *
+ * 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.iterationreport.nuxeo;
+
+import org.collectionspace.services.iterationreport.IterationreportsCommon;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
+
+/**
+ * IterationreportDocumentModelHandler
+ */
+public class IterationreportDocumentModelHandler
+ extends NuxeoDocumentModelHandler<IterationreportsCommon> {
+}
--- /dev/null
+/**
+ * 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
+ *
+ * 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.iterationreport.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 IterationreportValidatorHandler implements ValidatorHandler {
+
+ @Override
+ public void validate(Action action, ServiceContext ctx)
+ throws InvalidDocumentException {
+ // TODO Auto-generated method stub
+ System.out.println("IterationreportValidatorHandler executed.");
+
+ }
+
+}
--- /dev/null
+/*
+ * 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
+
+ * 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.test;
+
+/**
+ * Placeholder for server-side testing of Transport service cod
+ */
+public class IterationreportServiceTest {
+ // empty
+}
<module>media</module>
<module>uoc</module>
<module>publicitem</module>
+ <module>iterationreport</module>
<module>IntegrationTests</module>
<module>PerformanceTests</module>
<module>security</module>