<artifactId>org.collectionspace.services.conditioncheck.service</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.conservation.service</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.objectexit.service</artifactId>
import org.collectionspace.services.citation.CitationAuthorityResource;
import org.collectionspace.services.exhibition.ExhibitionResource;
import org.collectionspace.services.conditioncheck.ConditioncheckResource;
+import org.collectionspace.services.conservation.ConservationResource;
import javax.servlet.ServletContext;
import javax.ws.rs.core.Application;
addResourceToMapAndSingletons(new LoanoutResource());
addResourceToMapAndSingletons(new ExhibitionResource());
addResourceToMapAndSingletons(new ConditioncheckResource());
+ addResourceToMapAndSingletons(new ConservationResource());
addResourceToMapAndSingletons(new ValuationcontrolResource());
addResourceToMapAndSingletons(new ObjectExitResource());
addResourceToMapAndSingletons(new BatchResource());
<ant antfile="loanout/build.xml" target="deploy" inheritAll="false"/>
<ant antfile="exhibition/build.xml" target="deploy" inheritAll="false"/>
<ant antfile="conditioncheck/build.xml" target="deploy" inheritAll="false"/>
+ <ant antfile="conservation/build.xml" target="deploy" inheritAll="false"/>
<ant antfile="valuationcontrol/build.xml" target="deploy" inheritAll="false"/>
<ant antfile="objectexit/build.xml" target="deploy" inheritAll="false"/>
<ant antfile="batch/build.xml" target="deploy" inheritAll="false"/>
<ant antfile="valuationcontrol/build.xml" target="undeploy" inheritAll="false"/>
<ant antfile="exhibition/build.xml" target="undeploy" inheritAll="false"/>
<ant antfile="conditioncheck/build.xml" target="undeploy" inheritAll="false"/>
+ <ant antfile="conservation/build.xml" target="undeploy" inheritAll="false"/>
<ant antfile="batch/build.xml" target="undeploy" inheritAll="false"/>
<ant antfile="report/build.xml" target="undeploy" inheritAll="false"/>
<ant antfile="movement/build.xml" target="undeploy" inheritAll="false"/>
<ant antfile="taxonomy/build.xml" target="dist" inheritAll="false"/>
<ant antfile="exhibition/build.xml" target="dist" inheritAll="false"/>
<ant antfile="conditioncheck/build.xml" target="dist" inheritAll="false"/>
+ <ant antfile="conservation/build.xml" target="dist" inheritAll="false"/>
<ant antfile="valuationcontrol/build.xml" target="dist" inheritAll="false"/>
<ant antfile="objectexit/build.xml" target="dist" inheritAll="false"/>
<ant antfile="batch/build.xml" target="dist" inheritAll="false"/>
SELECT csid
FROM id_generators
);
+
+-- CONSERVATION_TREATMENT_REFERENCE_NUMBER
+
+INSERT INTO id_generators
+ (csid, displayname, description, priority, last_generated_id, id_generator_state)
+ SELECT
+ 'aad54202-404d-4f19-ada9-8b1e378ad1b2',
+ 'Conservation Treatment Reference Number',
+ 'Identifies a conservation treatment.',
+ '9',
+ '',
+'<org.collectionspace.services.id.SettableIDGenerator>
+ <parts>
+ <org.collectionspace.services.id.StringIDGeneratorPart>
+ <initialValue>CT</initialValue>
+ <currentValue>CT</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 'aad54202-404d-4f19-ada9-8b1e378ad1b2' NOT IN
+ (
+ SELECT csid
+ FROM id_generators
+ );
--- /dev/null
+
+<project name="conservation.3rdparty" default="package" basedir=".">
+ <description>
+ conservation service 3rdparty
+ </description>
+ <!-- set global properties for this build -->
+ <property name="services.trunk" value="../../.."/>
+ <!-- enviornment 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="init" >
+ <!-- Create the time stamp -->
+ <tstamp/>
+ </target>
+
+ <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.bat" />
+ <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.bat" />
+ <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.bat" />
+ <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.bat" />
+ <arg value="test" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="deploy" depends="install"
+ description="deploy conservation in ${jee.server.nuxeo}">
+ <!-- This target is obsolete. The Nuxeo artifacts are now created and deployed using the "csmake" tool
+ <ant antfile="nuxeo-platform-cs-conservation/build.xml" target="deploy" inheritall="false"/>
+ -->
+ </target>
+
+ <target name="undeploy"
+ description="undeploy conservation from ${jee.server.nuxeo}">
+ <!-- This target is obsolete. The Nuxeo artifacts are now created and deployed using the "csmake" tool
+ leaving this only for backwards compatibility reasons. -->
+ <ant antfile="nuxeo-platform-cs-conservation/build.xml" target="undeploy" inheritall="false"/>
+ </target>
+
+ <target name="dist"
+ description="generate distribution for conservation" depends="package">
+ <ant antfile="nuxeo-platform-cs-conservation/build.xml" target="dist" inheritall="false"/>
+ </target>
+
+
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="nuxeo-platform-cs-conservation" default="package" basedir=".">
+ <description>
+ conservation nuxeo document type
+ </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"/>
+
+ <!-- JAR files used by CollectionSpace 4.0 and later -->
+ <property name="nuxeo.conservation.doctype.jars.all"
+ value="collectionspace.conservation.doctype.*.jar"/>
+ <property name="nuxeo.conservation.schema.jars.all"
+ value="collectionspace.conservation.schema.*.jar"/>
+ <!-- Legacy JAR files used by CollectionSpace 3.3 and earlier -->
+ <property name="nuxeo.conservation.legacy.jars.all"
+ value="org.collectionspace.services.conservation.3rdparty.nuxeo-*.jar"/>
+ <property name="nuxeo.conservation.legacy.jar"
+ value="org.collectionspace.services.conservation.3rdparty.nuxeo-${cspace.release}.jar"/>
+
+ <condition property="osfamily-unix">
+ <os family="unix" />
+ </condition>
+ <condition property="osfamily-windows">
+ <os family="windows" />
+ </condition>
+
+ <target name="init" >
+ <!-- Create the time stamp -->
+ <tstamp/>
+ </target>
+
+ <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.bat" />
+ <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.bat" />
+ <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.bat" />
+ <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.bat" />
+ <arg value="test" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="deploy" depends="install"
+ description="deploy conservation doctype in ${jee.server.nuxeo}">
+ <!-- This target is obsolete. The Nuxeo artifacts are now created and deployed using the "csmake" tool
+ leaving this only for backwards compatibility reasons. -->
+ <copy file="${basedir}/target/${nuxeo.conservation.legacy.jar}"
+ todir="${jee.deploy.nuxeo.plugins}"/>
+ </target>
+
+ <target name="undeploy"
+ description="undeploy conservation doctype from ${jee.server.nuxeo}">
+ <delete>
+ <!-- Undeploy doctype and schema artifacts -->
+ <fileset dir="${jee.deploy.nuxeo.plugins}">
+ <include name="${nuxeo.conservation.doctype.jars.all}"/>
+ </fileset>
+ <fileset dir="${jee.deploy.nuxeo.plugins}">
+ <include name="${nuxeo.conservation.schema.jars.all}"/>
+ </fileset>
+ <!-- Undeploy legacy artifacts -->
+ <fileset dir="${jee.deploy.nuxeo.plugins}">
+ <include name="${nuxeo.conservation.legacy.jars.all}"/>
+ </fileset>
+ </delete>
+ <!-- Undeploy legacy artifacts from old deployment location through release 0.6 -->
+ <delete quiet="true">
+ <fileset dir="${jee.deploy.nuxeo.system}">
+ <include name="${nuxeo.conservation.legacy.jars.all}"/>
+ </fileset>
+ </delete>
+ </target>
+
+ <target name="dist"
+ description="generate distribution for conservation doctype" depends="package">
+ <copy todir="${services.trunk}/${dist.deploy.nuxeo.plugins}">
+ <fileset file="${basedir}/target/${nuxeo.conservation.legacy.jar}"/>
+ </copy>
+ </target>
+
+</project>
+
--- /dev/null
+
+<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.conservation.3rdparty</artifactId>
+ <version>4.4-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.conservation.3rdparty.nuxeo</artifactId>
+ <name>services.conservation.3rdparty.nuxeo</name>
+ <packaging>jar</packaging>
+ <description>
+ Conservation Nuxeo Document Type
+ </description>
+
+ <properties>
+ <ServiceName>conservation</ServiceName>
+ <NuxeoDocTypeName>Conservation</NuxeoDocTypeName>
+ <CommonSchemaName>conservation_common</CommonSchemaName>
+ <Lifecycle>cs_default</Lifecycle>
+ </properties>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ <resource>
+ <directory>../../../../3rdparty/nuxeo/nuxeo-doctype/src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>target/classes/META-INF/MANIFEST.MF</manifestFile>
+ <manifestEntries>
+ <Bundle-Version>${eclipseVersion}</Bundle-Version>
+ <Bundle-ManifestVersion>2</Bundle-ManifestVersion>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
--- /dev/null
+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.
\ No newline at end of file
--- /dev/null
+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.
\ No newline at end of file
--- /dev/null
+
+<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.conservation</artifactId>
+ <groupId>org.collectionspace.services</groupId>
+ <version>4.4-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.collectionspace.services.conservation.3rdparty</artifactId>
+ <name>services.conservation.3rdparty</name>
+ <packaging>pom</packaging>
+
+ <description>
+ 3rd party build for conservation service
+ </description>
+
+ <modules>
+ <!-- This module is obsolete. The Nuxeo artifacts are now created and deployed using the "csmake" tool
+ <module>nuxeo-platform-cs-conservation</module>
+ -->
+ </modules>
+</project>
--- /dev/null
+
+<project name="conservation" default="package" basedir=".">
+ <description>
+ conservation service
+ </description>
+ <!-- set global properties for this build -->
+ <property name="services.trunk" value="../.."/>
+ <!-- enviornment 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.bat" />
+ <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.bat" />
+ <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.bat" />
+ <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.bat" />
+ <arg value="test" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="deploy" depends="install"
+ description="deploy conservation service">
+ <ant antfile="3rdparty/build.xml" target="deploy" inheritall="false"/>
+ </target>
+
+ <target name="undeploy"
+ description="undeploy conservation service">
+ <ant antfile="3rdparty/build.xml" target="undeploy" inheritall="false"/>
+ </target>
+
+ <target name="dist" depends="package"
+ description="distribute conservation 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.conservation</artifactId>
+ <version>4.4-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.collectionspace.services.conservation.client</artifactId>
+ <name>services.conservation.client</name>
+
+ <dependencies>
+ <!-- keep slf4j dependencies on the top -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+<!-- CollectionSpace dependencies -->
+ <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.conservation.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>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.authority.jaxb</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-conservation-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
+ *
+ * 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;
+
+/**
+ * ConservationClient.java
+ *
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ *
+ */
+public class ConservationClient extends AbstractCommonListPoxServiceClientImpl<ConservationProxy> {
+
+ public static final String SERVICE_NAME = "conservation";
+ 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<ConservationProxy> getProxyClass() {
+ return ConservationProxy.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
+ *
+ * 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;
+
+/**
+ * ConservationProxy.java
+ *
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ *
+ */
+@Path(ConservationClient.SERVICE_PATH_PROXY)
+@Produces({"application/xml"})
+@Consumes({"application/xml"})
+public interface ConservationProxy 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
+ *
+ * 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.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.services.PersonJAXBSchema;
+import org.collectionspace.services.client.CollectionSpaceClient;
+import org.collectionspace.services.client.ConservationClient;
+import org.collectionspace.services.client.PersonAuthorityClient;
+import org.collectionspace.services.client.PersonAuthorityClientUtils;
+import org.collectionspace.services.client.PayloadOutputPart;
+import org.collectionspace.services.client.PoxPayloadIn;
+import org.collectionspace.services.client.PoxPayloadOut;
+import org.collectionspace.services.common.authorityref.AuthorityRefList;
+import org.collectionspace.services.jaxb.AbstractCommonList;
+import org.collectionspace.services.conservation.ConservationCommon;
+import org.collectionspace.services.conservation.ConservatorsList;
+import org.collectionspace.services.conservation.DestAnalysisGroup;
+import org.collectionspace.services.conservation.DestAnalysisGroupList;
+import org.collectionspace.services.conservation.ExaminationGroup;
+import org.collectionspace.services.conservation.ExaminationGroupList;
+import org.collectionspace.services.conservation.OtherPartyGroup;
+import org.collectionspace.services.conservation.OtherPartyGroupList;
+
+import org.collectionspace.services.person.PersonTermGroup;
+
+import org.jboss.resteasy.client.ClientResponse;
+
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.Test;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * ConservationAuthRefsTest, carries out Authority References tests against a
+ * deployed and running Conservation Service.
+ *
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ */
+public class ConservationAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
+
+ private final String CLASS_NAME = ConservationAuthRefsTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+
+ // Instance variables specific to this test.
+ final String SERVICE_NAME = "conservation";
+ final String SERVICE_PATH_COMPONENT = "conservation";
+ final String PERSON_AUTHORITY_NAME = "TestPersonAuthForConservation";
+ private String knownResourceId = null;
+ private List<String> conservationIdsCreated = new ArrayList<String>();
+ private List<String> personIdsCreated = new ArrayList<String>();
+ private String personAuthCSID = null;
+ private String conservatorRefName = null;
+ private String otherPartyRefName = null;
+ private String examinationStaffRefName = null;
+ private String approvedByRefName = null;
+ private String researcherRefName = null;
+ private String sampleByRefName = null;
+ private final int NUM_AUTH_REFS_EXPECTED = 6;
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
+ */
+ @Override
+ protected CollectionSpaceClient getClientInstance() {
+ throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
+ }
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
+ */
+ @Override
+ protected AbstractCommonList getCommonList(Response response) {
+ throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
+ }
+
+ // ---------------------------------------------------------------
+ // CRUD tests : CREATE tests
+ // ---------------------------------------------------------------
+ // Success outcomes
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
+ public void createWithAuthRefs(String testName) throws Exception {
+ testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
+
+ // Submit the request to the service and store the response.
+ String identifier = createIdentifier();
+
+ // Create all the person refs and entities
+ createPersonRefs();
+
+ // Create a new Conservation resource.
+ //
+ // One or more fields in this resource will be PersonAuthority
+ // references, and will refer to Person resources by their refNames.
+ ConservationClient conservationClient = new ConservationClient();
+ PoxPayloadOut multipart = createConservationInstance(
+ "conservationNumber-" + identifier,
+ conservatorRefName,
+ otherPartyRefName,
+ examinationStaffRefName,
+ approvedByRefName,
+ researcherRefName,
+ sampleByRefName);
+ Response response = conservationClient.create(multipart);
+ int statusCode = response.getStatus();
+ try {
+ // 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);
+
+ // Store the ID returned from the first resource created
+ // for additional tests below.
+ if (knownResourceId == null){
+ knownResourceId = extractId(response);
+ 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.
+ conservationIdsCreated.add(extractId(response));
+ } finally {
+ response.close();
+ }
+ }
+
+ protected void createPersonRefs(){
+ PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+ // Create a temporary PersonAuthority resource, and its corresponding
+ // refName by which it can be identified.
+ PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
+ PERSON_AUTHORITY_NAME, PERSON_AUTHORITY_NAME, personAuthClient.getCommonPartName());
+ Response res = personAuthClient.create(multipart);
+ try {
+ int statusCode = res.getStatus();
+ Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(testRequestType, statusCode));
+ Assert.assertEquals(statusCode, STATUS_CREATED);
+ personAuthCSID = extractId(res);
+ } finally {
+ res.close();
+ }
+
+ String authRefName = PersonAuthorityClientUtils.getAuthorityRefName(personAuthCSID, null);
+ // Create temporary Person resources, and their corresponding refNames
+ // by which they can be identified.
+ String csid = createPerson("Connie", "Conservator", "connieConservator", authRefName);
+ personIdsCreated.add(csid);
+ conservatorRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+
+ csid = createPerson("Oliver", "Otherparty", "oliverOtherparty", authRefName);
+ personIdsCreated.add(csid);
+ otherPartyRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+
+ csid = createPerson("Steven", "Staff", "stevenStaff", authRefName);
+ personIdsCreated.add(csid);
+ examinationStaffRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+
+ csid = createPerson("Allison", "Approver", "allisonApprover", authRefName);
+ personIdsCreated.add(csid);
+ approvedByRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+
+ csid = createPerson("Rachel", "Researcher", "rachelResearcher", authRefName);
+ personIdsCreated.add(csid);
+ researcherRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+
+ csid = createPerson("Sabrina", "Sampler", "sabrinaSampler", authRefName);
+ personIdsCreated.add(csid);
+ sampleByRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+ }
+
+ protected String createPerson(String firstName, String surName, String shortId, String authRefName ) {
+ String result = null;
+
+ PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+ Map<String, String> personInfo = new HashMap<String,String>();
+ personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
+ personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
+ personInfo.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId);
+ List<PersonTermGroup> personTerms = new ArrayList<PersonTermGroup>();
+ PersonTermGroup term = new PersonTermGroup();
+ String termName = firstName + " " + surName;
+ term.setTermDisplayName(termName);
+ term.setTermName(termName);
+ personTerms.add(term);
+ PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonInstance(personAuthCSID,
+ authRefName, personInfo, personTerms, personAuthClient.getItemCommonPartName());
+
+ Response res = personAuthClient.createItem(personAuthCSID, multipart);
+ try {
+ int statusCode = res.getStatus();
+ Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(testRequestType, statusCode));
+ Assert.assertEquals(statusCode, STATUS_CREATED);
+ result = extractId(res);
+ } finally {
+ res.close();
+ }
+
+ return result;
+ }
+
+ // Success outcomes
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+ dependsOnMethods = {"createWithAuthRefs"})
+ public void readAndCheckAuthRefs(String testName) throws Exception {
+ // Perform setup.
+ testSetup(STATUS_OK, ServiceRequestType.READ);
+
+ // Submit the request to the service and store the response.
+ ConservationClient conservationClient = new ConservationClient();
+ Response res = conservationClient.read(knownResourceId);
+ ConservationCommon conservationCommon = null;
+ try {
+ assertStatusCode(res, testName);
+ // Extract the common part from the response.
+ PoxPayloadIn input = new PoxPayloadIn(res.readEntity(String.class));
+ conservationCommon = (ConservationCommon) extractPart(input,
+ conservationClient.getCommonPartName(), ConservationCommon.class);
+ Assert.assertNotNull(conservationCommon);
+ if(logger.isDebugEnabled()){
+ logger.debug(objectAsXmlString(conservationCommon, ConservationCommon.class));
+ }
+ } finally {
+ if (res != null) {
+ res.close();
+ }
+ }
+ //
+ // Check a couple of fields
+ //
+ Assert.assertEquals(conservationCommon.getApprovedBy(), approvedByRefName);
+ Assert.assertEquals(conservationCommon.getResearcher(), researcherRefName);
+
+ // Get the auth refs and check them
+ Response res2 = conservationClient.getAuthorityRefs(knownResourceId);
+ AuthorityRefList list = null;
+ try {
+ assertStatusCode(res2, testName);
+ list = res2.readEntity(AuthorityRefList.class);
+ Assert.assertNotNull(list);
+ } finally {
+ if (res2 != null) {
+ res2.close();
+ }
+ }
+
+ List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
+ int numAuthRefsFound = items.size();
+ if(logger.isDebugEnabled()){
+ logger.debug("Expected " + NUM_AUTH_REFS_EXPECTED +
+ " authority references, found " + numAuthRefsFound);
+ }
+
+ // Optionally output additional data about list members for debugging.
+ boolean iterateThroughList = true;
+ if(iterateThroughList && logger.isDebugEnabled()){
+ int i = 0;
+ for(AuthorityRefList.AuthorityRefItem item : items){
+ logger.debug(testName + ": list-item[" + i + "] Field:" +
+ item.getSourceField() + "= " +
+ item.getAuthDisplayName() +
+ item.getItemDisplayName());
+ logger.debug(testName + ": list-item[" + i + "] refName=" +
+ item.getRefName());
+ logger.debug(testName + ": list-item[" + i + "] URI=" +
+ item.getUri());
+ i++;
+ }
+ }
+
+ Assert.assertEquals(numAuthRefsFound, NUM_AUTH_REFS_EXPECTED,
+ "Did not find all expected authority references! " +
+ "Expected " + NUM_AUTH_REFS_EXPECTED + ", found " + numAuthRefsFound);
+
+ }
+
+
+ // ---------------------------------------------------------------
+ // Cleanup of resources created during testing
+ // ---------------------------------------------------------------
+
+ /**
+ * Deletes all resources created by tests, after all tests have been run.
+ *
+ * This cleanup method will always be run, even if one or more tests fail.
+ * For this reason, it attempts to remove all resources created
+ * at any point during testing, even if some of those resources
+ * may be expected to be deleted by certain tests.
+ */
+ @AfterClass(alwaysRun=true)
+ public void cleanUp() {
+ String noTest = System.getProperty("noTestCleanup");
+ if(Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Skipping Cleanup phase ...");
+ }
+ return;
+ }
+ if (logger.isDebugEnabled()) {
+ logger.debug("Cleaning up temporary resources created for testing ...");
+ }
+ PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+ // Delete Person resource(s) (before PersonAuthority resources).
+
+ for (String resourceId : personIdsCreated) {
+ // Note: Any non-success responses are ignored and not reported.
+ personAuthClient.deleteItem(personAuthCSID, resourceId).close();
+ }
+
+ // Delete PersonAuthority resource(s).
+ // Note: Any non-success response is ignored and not reported.
+ if (personAuthCSID != null) {
+ personAuthClient.delete(personAuthCSID);
+ // Delete Conservation resource(s).
+ ConservationClient conservationClient = new ConservationClient();
+ for (String resourceId : conservationIdsCreated) {
+ // Note: Any non-success responses are ignored and not reported.
+ conservationClient.delete(resourceId).close();
+ }
+ }
+ }
+
+ // ---------------------------------------------------------------
+ // Utility methods used by tests above
+ // ---------------------------------------------------------------
+ public String getServiceName() {
+ return SERVICE_NAME;
+ }
+
+ @Override
+ public String getServicePathComponent() {
+ return SERVICE_PATH_COMPONENT;
+ }
+
+ private PoxPayloadOut createConservationInstance(String conservationNumber,
+ String conservatorRefName,
+ String otherPartyRefName,
+ String examinationStaffRefName,
+ String approvedByRefName,
+ String researcherRefName,
+ String sampleByRefName) {
+ ConservationCommon conservationCommon = new ConservationCommon();
+ conservationCommon.setConservationNumber(conservationNumber);
+
+ ConservatorsList conservatorsList = new ConservatorsList();
+ conservatorsList.getConservator().add(conservatorRefName);
+
+ OtherPartyGroupList otherPartyGroupList = new OtherPartyGroupList();
+ OtherPartyGroup otherPartyGroup = new OtherPartyGroup();
+ otherPartyGroup.setOtherParty(otherPartyRefName);
+ otherPartyGroupList.getOtherPartyGroup().add(otherPartyGroup);
+
+ ExaminationGroupList examinationGroupList = new ExaminationGroupList();
+ ExaminationGroup examinationGroup = new ExaminationGroup();
+ examinationGroup.setExaminationStaff(examinationStaffRefName);
+ examinationGroupList.getExaminationGroup().add(examinationGroup);
+
+ DestAnalysisGroupList destAnalysisGroupList = new DestAnalysisGroupList();
+ DestAnalysisGroup destAnalysisGroup = new DestAnalysisGroup();
+ destAnalysisGroup.setSampleBy(sampleByRefName);
+ destAnalysisGroupList.getDestAnalysisGroup().add(destAnalysisGroup);
+
+ conservationCommon.setConservators(conservatorsList);
+ conservationCommon.setOtherPartyGroupList(otherPartyGroupList);
+ conservationCommon.setExaminationGroupList(examinationGroupList);
+ conservationCommon.setApprovedBy(approvedByRefName);
+ conservationCommon.setResearcher(researcherRefName);
+ conservationCommon.setDestAnalysisGroupList(destAnalysisGroupList);
+
+ PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent());
+ PayloadOutputPart commonPart =
+ multipart.addPart(new ConservationClient().getCommonPartName(), conservationCommon);
+
+ if(logger.isDebugEnabled()){
+ logger.debug("to be created, conservation common");
+ logger.debug(objectAsXmlString(conservationCommon, ConservationCommon.class));
+ }
+
+ return multipart;
+ }
+
+ @Override
+ protected Class<AbstractCommonList> getCommonListType() {
+ return AbstractCommonList.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
+ *
+ * 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.ConservationClient;
+
+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.conservation.ConservationCommon;
+import org.collectionspace.services.conservation.ConservatorsList;
+import org.collectionspace.services.conservation.ConservationStatusGroup;
+import org.collectionspace.services.conservation.ConservationStatusGroupList;
+
+import org.jboss.resteasy.client.ClientResponse;
+import org.testng.Assert;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * ConservationServiceTest, carries out tests against a
+ * deployed and running Conservation Service.
+ *
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ */
+public class ConservationServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonList, ConservationCommon> {
+
+ /** The logger. */
+ private final String CLASS_NAME = ConservationServiceTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+ // Instance variables specific to this test.
+ /** The service path component. */
+ final String SERVICE_NAME = "conservation";
+ final String SERVICE_PATH_COMPONENT = "conservation";
+ private String CONSERVATOR_REF_NAME =
+ "urn:cspace:org.collectionspace.demo:personauthorities:name(TestPersonAuth):item:name(CarlaConservator)'Carla Conservator'";
+ private String STATUS = "Treatment proposed";
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
+ */
+ @Override
+ protected CollectionSpaceClient getClientInstance() {
+ return new ConservationClient();
+ }
+
+ /* (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.
+ ConservationClient client = new ConservationClient();
+ String identifier = createIdentifier();
+ PoxPayloadOut multipart = createConservationInstance(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);
+ }
+ }
+
+
+ /*
+ @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.
+ ConservationClient client = new ConservationClient();
+ 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());
+ ConservationCommon conservationCommon = null;
+ if (payloadInputPart != null) {
+ conservationCommon = (ConservationCommon) payloadInputPart.getBody();
+ }
+ Assert.assertNotNull(conservationCommon);
+
+ // Check selected fields.
+ ConservatorsList conservatorsList = conservationCommon.getConservators();
+ Assert.assertNotNull(conservatorsList);
+ List<String> conservators = conservatorsList.getConservator();
+ Assert.assertTrue(conservators.size() > 0);
+ Assert.assertEquals(conservators.get(0), CONSERVATOR_REF_NAME);
+ ConservationStatusGroupList conservationStatusGroupList = conservationCommon.getConservationStatusGroupList();
+ Assert.assertNotNull(conservationStatusGroupList);
+ List<ConservationStatusGroup> conservationStatusGroups = conservationStatusGroupList.getConservationStatusGroup();
+ Assert.assertNotNull(conservationStatusGroups);
+ Assert.assertTrue(conservationStatusGroups.size() > 0);
+ String status = conservationStatusGroups.get(0).getStatus();
+ Assert.assertEquals(status, STATUS);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("UTF-8 data sent=" + getUTF8DataFragment() + "\n"
+ + "UTF-8 data received=" + conservationCommon.getFabricationNote());
+ }
+
+ Assert.assertEquals(conservationCommon.getFabricationNote(), getUTF8DataFragment(),
+ "UTF-8 data retrieved '" + conservationCommon.getFabricationNote()
+ + "' 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.
+ ConservationClient client = new ConservationClient();
+ 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;
+ ConservationClient client = new ConservationClient();
+ 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.
+ ConservationClient client = new ConservationClient();
+ 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());
+ ConservationCommon conservationCommon = null;
+ if (payloadInputPart != null) {
+ conservationCommon = (ConservationCommon) payloadInputPart.getBody();
+ }
+ Assert.assertNotNull(conservationCommon);
+
+ // Update the content of this resource.
+ conservationCommon.setConservationNumber("updated-" + conservationCommon.getConservationNumber());
+ conservationCommon.setFabricationNote("updated-" + conservationCommon.getFabricationNote());
+ if (logger.isDebugEnabled()) {
+ logger.debug("to be updated object");
+ logger.debug(objectAsXmlString(conservationCommon, ConservationCommon.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(), conservationCommon);
+ 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());
+ ConservationCommon updatedConservationCommon = null;
+ if (payloadInputPart != null) {
+ updatedConservationCommon = (ConservationCommon) payloadInputPart.getBody();
+ }
+ Assert.assertNotNull(updatedConservationCommon);
+
+ // Check selected fields in the updated common part.
+ Assert.assertEquals(updatedConservationCommon.getConservationNumber(),
+ conservationCommon.getConservationNumber(),
+ "Data in updated object did not match submitted data.");
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("UTF-8 data sent=" + conservationCommon.getFabricationNote() + "\n"
+ + "UTF-8 data received=" + updatedConservationCommon.getFabricationNote());
+ }
+ Assert.assertTrue(updatedConservationCommon.getFabricationNote().contains(getUTF8DataFragment()),
+ "UTF-8 data retrieved '" + updatedConservationCommon.getFabricationNote()
+ + "' does not contain expected data '" + getUTF8DataFragment());
+ Assert.assertEquals(updatedConservationCommon.getFabricationNote(),
+ conservationCommon.getFabricationNote(),
+ "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.
+ ConservationClient client = new ConservationClient();
+ PoxPayloadOut multipart = createConservationInstance(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.
+ ConservationClient client = new ConservationClient();
+ 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.
+ ConservationClient client = new ConservationClient();
+ 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
+ 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 createConservationInstance(identifier);
+ }
+
+ /**
+ * Creates the conservation instance.
+ *
+ * @param conservationNumber the conservation number
+ * @param returnDate the return date
+ * @return the multipart output
+ */
+ private PoxPayloadOut createConservationInstance(String identifier) {
+ ConservationCommon conservationCommon = new ConservationCommon();
+ conservationCommon.setConservationNumber("conservationNumber-" + identifier);
+
+ ConservatorsList conservatorsList = new ConservatorsList();
+ conservatorsList.getConservator().add(CONSERVATOR_REF_NAME);
+
+ ConservationStatusGroupList conservationStatusGroupList = new ConservationStatusGroupList();
+ ConservationStatusGroup conservationStatusGroup = new ConservationStatusGroup();
+ conservationStatusGroup.setStatus(STATUS);
+ conservationStatusGroupList.getConservationStatusGroup().add(conservationStatusGroup);
+
+ conservationCommon.setConservators(conservatorsList);
+ conservationCommon.setConservationStatusGroupList(conservationStatusGroupList);
+ conservationCommon.setFabricationNote(getUTF8DataFragment());
+
+ PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent());
+ PayloadOutputPart commonPart =
+ multipart.addPart(new ConservationClient().getCommonPartName(), conservationCommon);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("to be created, conservation common");
+ logger.debug(objectAsXmlString(conservationCommon, ConservationCommon.class));
+ }
+
+ return multipart;
+ }
+
+ @Override
+ public void CRUDTests(String testName) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ protected PoxPayloadOut createInstance(String commonPartName,
+ String identifier) {
+ PoxPayloadOut result = createConservationInstance(identifier);
+ return result;
+ }
+
+ @Override
+ protected ConservationCommon updateInstance(ConservationCommon commonPartObject) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected void compareUpdatedInstances(ConservationCommon original,
+ ConservationCommon updated) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+}
--- /dev/null
+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
--- /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.conservation</artifactId>
+ <groupId>org.collectionspace.services</groupId>
+ <version>4.4-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.collectionspace.services.conservation.jaxb</artifactId>
+ <name>services.conservation.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-conservation-jaxb</finalName>
+ <defaultGoal>install</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.jvnet.jaxb2.maven2</groupId>
+ <artifactId>maven-jaxb2-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
+
--- /dev/null
+/**
+ *
+ */
+package org.collectionspace.services;
+
+public interface ConservationJAXBSchema {
+ final static String CONSERVATION_NUMBER = "conservationNumber";
+}
+
+
--- /dev/null
+package org.collectionspace.services;
+
+public interface ConservationListItemJAXBSchema {
+ final static String CONSERVATION_NUMBER = "conservationNumber";
+ final static String CSID = "csid";
+ final static String URI = "url";
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+ Conservation schema (XSD)
+
+ Entity : Conservation
+ Part : Common
+ Used for: JAXB binding between XML and Java objects
+
+ $LastChangedRevision$
+ $LastChangedDate$
+-->
+
+<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/conservation"
+ xmlns="http://collectionspace.org/services/conservation"
+ targetNamespace="http://collectionspace.org/services/conservation"
+ version="0.1"
+>
+
+<!--
+ Avoid XmlRootElement nightmare:
+ See http://weblogs.java.net/blog/kohsuke/archive/2006/03/why_does_jaxb_p.html
+-->
+<!-- See http://wiki.collectionspace.org/display/collectionspace/Conservation+Schema -->
+
+ <!-- Conservation Information Group -->
+ <xs:element name="conservation_common">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="conservationNumber" type="xs:string"/>
+ <xs:element name="conservationStatusGroupList" type="conservationStatusGroupList"/>
+ <xs:element name="treatmentPurpose" type="xs:string"/>
+ <xs:element name="conservators" type="conservatorsList"/>
+ <xs:element name="otherPartyGroupList" type="otherPartyGroupList"/>
+ <xs:element name="examinationGroupList" type="examinationGroupList"/>
+ <xs:element name="fabricationNote" type="xs:string"/>
+ <xs:element name="proposedTreatment" type="xs:string"/>
+ <xs:element name="approvedBy" type="xs:string"/>
+ <xs:element name="approvedDate" type="xs:date"/>
+ <xs:element name="treatmentStartDate" type="xs:date"/>
+ <xs:element name="treatmentEndDate" type="xs:date"/>
+ <xs:element name="treatmentSummary" type="xs:string"/>
+ <xs:element name="researcher" type="xs:string"/>
+ <xs:element name="proposedAnalysis" type="xs:string"/>
+ <xs:element name="proposedAnalysisDate" type="xs:date"/>
+ <xs:element name="destAnalysisGroupList" type="destAnalysisGroupList"/>
+ <xs:element name="analysisMethod" type="xs:string"/>
+ <xs:element name="analysisResults" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="conservatorsList">
+ <xs:sequence>
+ <xs:element name="conservator" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="conservationStatusGroupList">
+ <xs:sequence>
+ <xs:element name="conservationStatusGroup" type="conservationStatusGroup" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="conservationStatusGroup">
+ <xs:sequence>
+ <xs:element name="status" type="xs:string"/>
+ <xs:element name="statusDate" type="xs:date"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="otherPartyGroupList">
+ <xs:sequence>
+ <xs:element name="otherPartyGroup" type="otherPartyGroup" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="otherPartyGroup">
+ <xs:sequence>
+ <xs:element name="otherParty" type="xs:string"/>
+ <xs:element name="otherPartyRole" type="xs:string"/>
+ <xs:element name="otherPartyNote" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="examinationGroupList">
+ <xs:sequence>
+ <xs:element name="examinationGroup" type="examinationGroup" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="examinationGroup">
+ <xs:sequence>
+ <xs:element name="examinationStaff" type="xs:string"/>
+ <xs:element name="examinationPhase" type="xs:string"/>
+ <xs:element name="examinationDate" type="xs:date"/>
+ <xs:element name="examinationNote" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="destAnalysisGroupList">
+ <xs:sequence>
+ <xs:element name="destAnalysisGroup" type="destAnalysisGroup" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="destAnalysisGroup">
+ <xs:sequence>
+ <xs:element name="destAnalysisApprovedDate" type="xs:date"/>
+ <xs:element name="destAnalysisApprovalNote" type="xs:string"/>
+ <xs:element name="sampleBy" type="xs:string"/>
+ <xs:element name="sampleDate" type="xs:date"/>
+ <xs:element name="sampleDescription" type="xs:string"/>
+ <xs:element name="sampleReturned" type="xs:boolean"/>
+ <xs:element name="sampleReturnedLocation" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+</xs:schema>
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- A comment. -->
+<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>4.4-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.collectionspace.services.conservation</artifactId>
+ <name>services.conservation</name>
+ <packaging>pom</packaging>
+
+ <dependencies>
+ </dependencies>
+
+ <modules>
+ <module>jaxb</module>
+ <module>service</module>
+ <module>3rdparty</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.conservation</artifactId>
+ <version>4.4-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.collectionspace.services.conservation.service</artifactId>
+ <name>services.conservation.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.conservation.jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.conservation.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>
+
+ <dependency>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ <version>1.6.1</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-conservation</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
+
+ * 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.conservation;
+
+import org.collectionspace.services.client.ConservationClient;
+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(ConservationClient.SERVICE_PATH)
+@Consumes("application/xml")
+@Produces("application/xml")
+public class ConservationResource extends NuxeoBasedResource {
+
+ final Logger logger = LoggerFactory.getLogger(ConservationResource.class);
+
+ @Override
+ protected String getVersionString() {
+ final String lastChangeRevision = "$LastChangedRevision$";
+ return lastChangeRevision;
+ }
+
+ @Override
+ public String getServiceName() {
+ return ConservationClient.SERVICE_NAME;
+ }
+
+ @Override
+ public Class<ConservationCommon> getCommonPartClass() {
+ return ConservationCommon.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
+
+ * 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.conservation.nuxeo;
+
+/**
+ * ConservationConstants specifies constants for the Conservation service
+ *
+ */
+public class ConservationConstants {
+
+ public final static String NUXEO_DOCTYPE = "Conservation";
+ public final static String NUXEO_SCHEMA_NAME = "conservation";
+ public final static String NUXEO_DC_TITLE = "CollectionSpace-Conservation";
+}
--- /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
+
+ * 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.conservation.nuxeo;
+
+import org.collectionspace.services.conservation.ConservationCommon;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
+
+/** ConservationDocumentModelHandler
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ */
+public class ConservationDocumentModelHandler
+ extends NuxeoDocumentModelHandler<ConservationCommon> {
+}
+
--- /dev/null
+package org.collectionspace.services.conservation.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 ConservationValidatorHandler implements ValidatorHandler {
+
+ @Override
+ public void validate(Action action, ServiceContext ctx)
+ throws InvalidDocumentException {
+ // TODO Auto-generated method stub
+ System.out.println("ConservationValidatorHandler executed.");
+
+ }
+
+}
--- /dev/null
+package org.collectionspace.services.test;
+
+//import org.collectionspace.services.conservation.Conservation;
+//import org.collectionspace.services.conservation.ConservationList;
+
+/**
+ * Placeholder for server-side testing of Conservation service code.
+ *
+ * @version $Revision$
+ */
+public class ConservationServiceTest {
+ //empty
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+ <appender name="console" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out" />
+ <layout class="org.apache.log4j.TTCCLayout">
+ <param name="DateFormat" value="ISO8601" />
+ </layout>
+ </appender>
+
+
+ <appender name="unit-tests"
+ class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="./target/unit-tests.log" />
+ <param name="MaxFileSize" value="10240KB" />
+ <param name="MaxBackupIndex" value="6" />
+ <layout class="org.apache.log4j.TTCCLayout">
+ <param name="DateFormat" value="ISO8601" />
+ </layout>
+ </appender>
+
+ <logger name="org.apache.commons.httpclient" additivity="false">
+ <level value="warn" />
+ <appender-ref ref="console" />
+ <appender-ref ref="unit-tests" />
+ </logger>
+
+ <logger name="httpclient.wire" additivity="false">
+ <level value="info" />
+ <appender-ref ref="console" />
+ <appender-ref ref="unit-tests" />
+ </logger>
+
+ <root>
+ <priority value="debug" />
+ <appender-ref ref="console" />
+ <appender-ref ref="unit-tests" />
+ </root>
+
+</log4j:configuration>
+
+
+
+
<module>loanout</module>
<module>exhibition</module>
<module>conditioncheck</module>
+ <module>conservation</module>
<module>valuationcontrol</module>
<module>objectexit</module>
<module>batch</module>