From 11f048fd9aebf336b451dc932693dd98a13004e3 Mon Sep 17 00:00:00 2001 From: Ray Lee Date: Tue, 6 Feb 2024 13:56:25 -0500 Subject: [PATCH] Revert "DRYD-1246: UCB Held In Trust Contribution (#363)" This reverts commit be7ea1191d540b8c793c5e6d49a2422e7908c41d. --- services/JaxRsServiceProvider/pom.xml | 5 - .../CollectionSpaceJaxRsApplication.java | 2 - services/build.xml | 3 - .../db/postgresql/load_id_generators.sql | 45 -- .../client/temp-testng-customsuite.xml | 8 + services/heldintrust/3rdparty/build.xml | 128 ------ .../nuxeo-platform-cs-heldintrust/build.xml | 160 ------- .../nuxeo-platform-cs-heldintrust/pom.xml | 55 --- .../src/main/resources/OSGI-INF/README.txt | 16 - .../src/main/resources/schemas/README.txt | 16 - services/heldintrust/3rdparty/pom.xml | 22 - services/heldintrust/build.xml | 120 ----- services/heldintrust/client/pom.xml | 81 ---- .../services/client/HeldintrustClient.java | 63 --- .../services/client/HeldintrustProxy.java | 40 -- .../src/main/resources/log4j2-surefire.xml | 34 -- .../client/test/HeldintrustAuthRefsTest.java | 346 -------------- .../test/HeldintrustClientTestUtil.java | 72 --- .../client/test/HeldintrustServiceTest.java | 274 ----------- .../test/OrganizationAuthRefDocsTest.java | 336 -------------- .../client/test/PersonAuthRefDocsTest.java | 430 ------------------ .../src/test/resources/log4j2-surefire.xml | 34 -- services/heldintrust/jaxb/.gitignore | 2 - services/heldintrust/jaxb/pom.xml | 37 -- .../services/HeldintrustJAXBSchema.java | 7 - .../HeldintrustListItemJAXBSchema.java | 6 - .../main/resources/heldintrusts-common.xsd | 150 ------ services/heldintrust/pom.xml | 22 - services/heldintrust/service/pom.xml | 90 ---- .../heldintrust/HeldintrustResource.java | 53 --- .../nuxeo/HeldintrustConstants.java | 35 -- .../HeldintrustDocumentModelHandler.java | 36 -- .../nuxeo/HeldintrustValidatorHandler.java | 60 --- .../services/test/HeldintrustServiceTest.java | 10 - .../intake/client/temp-testng-customsuite.xml | 8 + services/pom.xml | 1 - 36 files changed, 16 insertions(+), 2791 deletions(-) create mode 100644 services/dimension/client/temp-testng-customsuite.xml delete mode 100644 services/heldintrust/3rdparty/build.xml delete mode 100644 services/heldintrust/3rdparty/nuxeo-platform-cs-heldintrust/build.xml delete mode 100644 services/heldintrust/3rdparty/nuxeo-platform-cs-heldintrust/pom.xml delete mode 100644 services/heldintrust/3rdparty/nuxeo-platform-cs-heldintrust/src/main/resources/OSGI-INF/README.txt delete mode 100644 services/heldintrust/3rdparty/nuxeo-platform-cs-heldintrust/src/main/resources/schemas/README.txt delete mode 100644 services/heldintrust/3rdparty/pom.xml delete mode 100644 services/heldintrust/build.xml delete mode 100644 services/heldintrust/client/pom.xml delete mode 100644 services/heldintrust/client/src/main/java/org/collectionspace/services/client/HeldintrustClient.java delete mode 100644 services/heldintrust/client/src/main/java/org/collectionspace/services/client/HeldintrustProxy.java delete mode 100644 services/heldintrust/client/src/main/resources/log4j2-surefire.xml delete mode 100644 services/heldintrust/client/src/test/java/org/collectionspace/services/client/test/HeldintrustAuthRefsTest.java delete mode 100644 services/heldintrust/client/src/test/java/org/collectionspace/services/client/test/HeldintrustClientTestUtil.java delete mode 100644 services/heldintrust/client/src/test/java/org/collectionspace/services/client/test/HeldintrustServiceTest.java delete mode 100644 services/heldintrust/client/src/test/java/org/collectionspace/services/client/test/OrganizationAuthRefDocsTest.java delete mode 100644 services/heldintrust/client/src/test/java/org/collectionspace/services/client/test/PersonAuthRefDocsTest.java delete mode 100644 services/heldintrust/client/src/test/resources/log4j2-surefire.xml delete mode 100644 services/heldintrust/jaxb/.gitignore delete mode 100644 services/heldintrust/jaxb/pom.xml delete mode 100644 services/heldintrust/jaxb/src/main/java/org/collectionspace/services/HeldintrustJAXBSchema.java delete mode 100644 services/heldintrust/jaxb/src/main/java/org/collectionspace/services/HeldintrustListItemJAXBSchema.java delete mode 100644 services/heldintrust/jaxb/src/main/resources/heldintrusts-common.xsd delete mode 100644 services/heldintrust/pom.xml delete mode 100644 services/heldintrust/service/pom.xml delete mode 100644 services/heldintrust/service/src/main/java/org/collectionspace/services/heldintrust/HeldintrustResource.java delete mode 100644 services/heldintrust/service/src/main/java/org/collectionspace/services/heldintrust/nuxeo/HeldintrustConstants.java delete mode 100644 services/heldintrust/service/src/main/java/org/collectionspace/services/heldintrust/nuxeo/HeldintrustDocumentModelHandler.java delete mode 100644 services/heldintrust/service/src/main/java/org/collectionspace/services/heldintrust/nuxeo/HeldintrustValidatorHandler.java delete mode 100644 services/heldintrust/service/src/test/java/org/collectionspace/services/test/HeldintrustServiceTest.java create mode 100644 services/intake/client/temp-testng-customsuite.xml diff --git a/services/JaxRsServiceProvider/pom.xml b/services/JaxRsServiceProvider/pom.xml index a41bcb7bc..d68a5ef9c 100644 --- a/services/JaxRsServiceProvider/pom.xml +++ b/services/JaxRsServiceProvider/pom.xml @@ -199,11 +199,6 @@ org.collectionspace.services.intake.service ${project.version} - - org.collectionspace.services - org.collectionspace.services.heldintrust.service - ${project.version} - org.collectionspace.services org.collectionspace.services.group.service diff --git a/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java b/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java index 71efbe35f..0ef40bd9b 100644 --- a/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java +++ b/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java @@ -32,7 +32,6 @@ 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.heldintrust.HeldintrustResource; import org.collectionspace.services.intake.IntakeResource; import org.collectionspace.services.index.IndexResource; import org.collectionspace.services.loanin.LoaninResource; @@ -142,7 +141,6 @@ public class CollectionSpaceJaxRsApplication extends Application addResourceToMapAndSingletons(new GroupResource()); addResourceToMapAndSingletons(new InsuranceResource()); addResourceToMapAndSingletons(new IntakeResource()); - addResourceToMapAndSingletons(new HeldintrustResource()); addResourceToMapAndSingletons(new DimensionResource()); addResourceToMapAndSingletons(new RelationResource()); addResourceToMapAndSingletons(new LoaninResource()); diff --git a/services/build.xml b/services/build.xml index e0e63eae2..067d84b9b 100644 --- a/services/build.xml +++ b/services/build.xml @@ -168,7 +168,6 @@ - @@ -239,7 +238,6 @@ - @@ -283,7 +281,6 @@ - diff --git a/services/common/src/main/resources/db/postgresql/load_id_generators.sql b/services/common/src/main/resources/db/postgresql/load_id_generators.sql index c440bc4f5..554dab08a 100644 --- a/services/common/src/main/resources/db/postgresql/load_id_generators.sql +++ b/services/common/src/main/resources/db/postgresql/load_id_generators.sql @@ -236,51 +236,6 @@ INSERT INTO id_generators FROM id_generators ); --- HIT_NUMBER - -INSERT INTO id_generators - (csid, displayname, description, priority, last_generated_id, id_generator_state) - SELECT - '038b61f2-2975-4b33-ac93-ce8d8b6042f0', - 'Held-in-Trust Number', - 'Identifies a Held-in-Trust.', - '9', - '', -' - - - HIT - HIT - - - - - - . - . - - - 6 - 1 - -1 - - - . - . - - - 6 - 1 - -1 - - -' - WHERE '038b61f2-2975-4b33-ac93-ce8d8b6042f0' NOT IN - ( - SELECT csid - FROM id_generators - ); - -- CONDITIONCHECK_NUMBER INSERT INTO id_generators diff --git a/services/dimension/client/temp-testng-customsuite.xml b/services/dimension/client/temp-testng-customsuite.xml new file mode 100644 index 000000000..9f2480621 --- /dev/null +++ b/services/dimension/client/temp-testng-customsuite.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/services/heldintrust/3rdparty/build.xml b/services/heldintrust/3rdparty/build.xml deleted file mode 100644 index 005c44496..000000000 --- a/services/heldintrust/3rdparty/build.xml +++ /dev/null @@ -1,128 +0,0 @@ - - - held in trust service 3rdparty - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/services/heldintrust/3rdparty/nuxeo-platform-cs-heldintrust/build.xml b/services/heldintrust/3rdparty/nuxeo-platform-cs-heldintrust/build.xml deleted file mode 100644 index fa036746a..000000000 --- a/services/heldintrust/3rdparty/nuxeo-platform-cs-heldintrust/build.xml +++ /dev/null @@ -1,160 +0,0 @@ - - - - held in trust nuxeo document type - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/services/heldintrust/3rdparty/nuxeo-platform-cs-heldintrust/pom.xml b/services/heldintrust/3rdparty/nuxeo-platform-cs-heldintrust/pom.xml deleted file mode 100644 index 706aa5af2..000000000 --- a/services/heldintrust/3rdparty/nuxeo-platform-cs-heldintrust/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - org.collectionspace.services - org.collectionspace.services.heldintrust.3rdparty - ${revision} - - - 4.0.0 - org.collectionspace.services - org.collectionspace.services.heldintrust.3rdparty.nuxeo - services.heldintrust.3rdparty.nuxeo - jar - - Held In Trust Nuxeo Document Type - - - - heldintrust - Heldintrust - heldintrusts_common - cs_default - - - - - - src/main/resources - true - - - ../../../../3rdparty/nuxeo/nuxeo-doctype/src/main/resources - true - - - - - org.apache.maven.plugins - maven-jar-plugin - - - target/classes/META-INF/MANIFEST.MF - - ${eclipseVersion} - 2 - - - - - - - - diff --git a/services/heldintrust/3rdparty/nuxeo-platform-cs-heldintrust/src/main/resources/OSGI-INF/README.txt b/services/heldintrust/3rdparty/nuxeo-platform-cs-heldintrust/src/main/resources/OSGI-INF/README.txt deleted file mode 100644 index 5f8c5a6d0..000000000 --- a/services/heldintrust/3rdparty/nuxeo-platform-cs-heldintrust/src/main/resources/OSGI-INF/README.txt +++ /dev/null @@ -1,16 +0,0 @@ -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 diff --git a/services/heldintrust/3rdparty/nuxeo-platform-cs-heldintrust/src/main/resources/schemas/README.txt b/services/heldintrust/3rdparty/nuxeo-platform-cs-heldintrust/src/main/resources/schemas/README.txt deleted file mode 100644 index 5f8c5a6d0..000000000 --- a/services/heldintrust/3rdparty/nuxeo-platform-cs-heldintrust/src/main/resources/schemas/README.txt +++ /dev/null @@ -1,16 +0,0 @@ -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 diff --git a/services/heldintrust/3rdparty/pom.xml b/services/heldintrust/3rdparty/pom.xml deleted file mode 100644 index 93a95b37f..000000000 --- a/services/heldintrust/3rdparty/pom.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - org.collectionspace.services.heldintrust - org.collectionspace.services - ${revision} - - - 4.0.0 - org.collectionspace.services.heldintrust.3rdparty - services.heldintrust.3rdparty - pom - - - 3rd party build for held in trust service - - - - - - diff --git a/services/heldintrust/build.xml b/services/heldintrust/build.xml deleted file mode 100644 index df218de2c..000000000 --- a/services/heldintrust/build.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - held in trust service - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/services/heldintrust/client/pom.xml b/services/heldintrust/client/pom.xml deleted file mode 100644 index 54d03ce59..000000000 --- a/services/heldintrust/client/pom.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - org.collectionspace.services - org.collectionspace.services.heldintrust - ${revision} - - - 4.0.0 - org.collectionspace.services.heldintrust.client - services.heldintrust.client - - - - - org.collectionspace.services - org.collectionspace.services.authority.jaxb - true - ${project.version} - - - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - - - org.collectionspace.services - org.collectionspace.services.common - true - - - org.collectionspace.services - org.collectionspace.services.heldintrust.jaxb - ${project.version} - - - org.collectionspace.services - org.collectionspace.services.client - ${project.version} - - - org.collectionspace.services - org.collectionspace.services.person.client - ${project.version} - test - - - org.collectionspace.services - org.collectionspace.services.organization.client - ${project.version} - test - - - - org.testng - testng - - - org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider - - - org.jboss.resteasy - resteasy-multipart-provider - - - commons-httpclient - commons-httpclient - - - - - collectionspace-services-heldintrust-client - - diff --git a/services/heldintrust/client/src/main/java/org/collectionspace/services/client/HeldintrustClient.java b/services/heldintrust/client/src/main/java/org/collectionspace/services/client/HeldintrustClient.java deleted file mode 100644 index 59a62bb72..000000000 --- a/services/heldintrust/client/src/main/java/org/collectionspace/services/client/HeldintrustClient.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * 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 - * - * 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; - -import org.collectionspace.services.heldintrust.HeldintrustsCommon; - -/** - * HeldInTrustClient - * - * $LastChangedRevision: $ - * $LastChangedDate: $ - */ -public class HeldintrustClient extends AbstractCommonListPoxServiceClientImpl { - - public static final String SERVICE_NAME = "heldintrusts"; - 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 HeldintrustClient() throws Exception { - super(); - } - - public HeldintrustClient(String clientPropertiesFilename) throws Exception { - super(clientPropertiesFilename); - } - - @Override - public String getServiceName() { - return SERVICE_NAME; - } - - @Override - public String getServicePathComponent() { - return SERVICE_PATH_COMPONENT; - } - - @Override - public Class getProxyClass() { - return HeldintrustProxy.class; - } -} diff --git a/services/heldintrust/client/src/main/java/org/collectionspace/services/client/HeldintrustProxy.java b/services/heldintrust/client/src/main/java/org/collectionspace/services/client/HeldintrustProxy.java deleted file mode 100644 index 0d81e7e71..000000000 --- a/services/heldintrust/client/src/main/java/org/collectionspace/services/client/HeldintrustProxy.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * 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 - * - * 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; - -import javax.ws.rs.Consumes; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; - -/** - * HeldInTrustProxy - * - * $LastChangedRevision: $ - * $LastChangedDate: $ - */ -@Path(HeldintrustClient.SERVICE_PATH_PROXY) -@Produces({"application/xml"}) -@Consumes({"application/xml"}) -public interface HeldintrustProxy extends CollectionSpaceCommonListPoxProxy { - // Intentionally left blank -} diff --git a/services/heldintrust/client/src/main/resources/log4j2-surefire.xml b/services/heldintrust/client/src/main/resources/log4j2-surefire.xml deleted file mode 100644 index bf74484d1..000000000 --- a/services/heldintrust/client/src/main/resources/log4j2-surefire.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - %d %-5p [%t] [%c:%L] %m%n - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/services/heldintrust/client/src/test/java/org/collectionspace/services/client/test/HeldintrustAuthRefsTest.java b/services/heldintrust/client/src/test/java/org/collectionspace/services/client/test/HeldintrustAuthRefsTest.java deleted file mode 100644 index e1761b457..000000000 --- a/services/heldintrust/client/src/test/java/org/collectionspace/services/client/test/HeldintrustAuthRefsTest.java +++ /dev/null @@ -1,346 +0,0 @@ -/** - * 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.HeldintrustClient; -import org.collectionspace.services.client.PersonAuthorityClientUtils; -import org.collectionspace.services.client.PersonClient; -import org.collectionspace.services.client.PoxPayloadIn; -import org.collectionspace.services.client.PoxPayloadOut; -import org.collectionspace.services.common.authorityref.AuthorityRefList; -import org.collectionspace.services.heldintrust.HeldintrustsCommon; -import org.collectionspace.services.jaxb.AbstractCommonList; -import org.collectionspace.services.person.PersonTermGroup; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.Assert; -import org.testng.annotations.AfterClass; -import org.testng.annotations.Test; - -/** - * HitAuthRefsTest, carries out tests against a - * deployed and running Hit Service. - * - * $LastChangedRevision: 1327 $ - * $LastChangedDate: 2010-02-12 10:35:11 -0800 (Fri, 12 Feb 2010) $ - */ -public class HeldintrustAuthRefsTest extends BaseServiceTest { - - // Instance variables specific to this test. - final String SERVICE_PATH_COMPONENT = HeldintrustClient.SERVICE_PATH_COMPONENT; - final String PERSON_AUTHORITY_NAME = "TestPersonAuth"; - private final String CLASS_NAME = HeldintrustAuthRefsTest.class.getName(); - private final Logger logger = LoggerFactory.getLogger(CLASS_NAME); - - private final List hitIdsCreated = new ArrayList(); - private final List personIdsCreated = new ArrayList(); - private String personAuthCSID = null; - private String depositorContactRefName = null; - private String depositorRefName = null; - private String externalApprovalIndividualRefName = null; - private String correspondenceSenderRefName = null; - private String valuerRefName = null; - - @Override - protected String getServiceName() { - throw new UnsupportedOperationException(); //FIXME: REM - See http://issues.collectionspace.org/browse/CSPACE-3498 - } - - /* (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 - } - - @Override - protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) { - 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(); - - // Submit the request to the service and store the response. - HeldintrustClient heldInTrustClient = new HeldintrustClient(); - PoxPayloadOut multipart = createHitInstance( - "entryNumber-" + identifier, - depositorContactRefName, - depositorRefName, - externalApprovalIndividualRefName, - correspondenceSenderRefName); - - String newId; - Response res = heldInTrustClient.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? - logger.debug("{}: status = {}", testName, statusCode); - Assert.assertTrue(testRequestType.isValidStatusCode(statusCode), - invalidStatusCodeMessage(testRequestType, statusCode)); - Assert.assertEquals(statusCode, testExpectedStatusCode); - newId = extractId(res); - } finally { - res.close(); - } - - // Store the ID returned from the first resource created - // for additional tests below. - if (knownResourceId == null) { - knownResourceId = newId; - logger.debug("{}: knownResourceId={}", testName, knownResourceId); - } - - // Store the IDs from every resource created by tests, - // so they can be deleted after tests have been run. - hitIdsCreated.add(newId); - } - - protected void createPersonRefs() throws Exception { - // - // First, create a new person authority - // - PersonClient personAuthClient = new PersonClient(); - 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); - String csid = createPerson("Olivier", "Contact", "olivierContact", authRefName); - depositorContactRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null); - personIdsCreated.add(csid); - - csid = createPerson("Debbie", "Depositor", "debbieDepositor", authRefName); - depositorRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null); - personIdsCreated.add(csid); - - csid = createPerson("Andrew", "ApprovalIndividual", "andrewApprovalIndividual", authRefName); - externalApprovalIndividualRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null); - personIdsCreated.add(csid); - - csid = createPerson("Ingrid", "Sender", "ingridSender", authRefName); - correspondenceSenderRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null); - personIdsCreated.add(csid); - - csid = createPerson("Vince", "Valuer", "vinceValuer", authRefName); - valuerRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null); - personIdsCreated.add(csid); - } - - protected String createPerson(String firstName, String surName, String shortId, String authRefName) - throws Exception { - String result; - - PersonClient personAuthClient = new PersonClient(); - Map personInfo = new HashMap(); - personInfo.put(PersonJAXBSchema.FORE_NAME, firstName); - personInfo.put(PersonJAXBSchema.SUR_NAME, surName); - personInfo.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId); - List personTerms = new ArrayList(); - 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", 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. - HeldintrustClient heldInTrustClient = new HeldintrustClient(); - Response res = heldInTrustClient.read(knownResourceId); - try { - assertStatusCode(res, testName); - PoxPayloadIn input = new PoxPayloadIn(res.readEntity(String.class)); - HeldintrustsCommon hit = (HeldintrustsCommon) extractPart(input, heldInTrustClient.getCommonPartName(), - HeldintrustsCommon.class); - Assert.assertNotNull(hit); - // Check a couple of fields - } finally { - if (res != null) { - res.close(); - } - } - - // Get the auth refs and check them - res = heldInTrustClient.getAuthorityRefs(knownResourceId); - AuthorityRefList list; - try { - assertStatusCode(res, testName); - list = res.readEntity(AuthorityRefList.class); - } finally { - if (res != null) { - res.close(); - } - } - - List items = list.getAuthorityRefItem(); - int numAuthRefsFound = items.size(); - logger.debug("Expected {} authority references, found {}", personIdsCreated.size(), numAuthRefsFound); - - // output additional data about list members for debugging. - int i = 0; - for (AuthorityRefList.AuthorityRefItem item : items) { - logger.debug("{}: list-item[{}] Field:{}={}{}", testName, i, item.getSourceField(), - item.getAuthDisplayName(), item.getItemDisplayName()); - logger.debug("{}: list-item[{}] refName={}", testName, i, item.getRefName()); - logger.debug("{}: list-item[{}] URI={}", testName, i, item.getUri()); - i++; - } - - // - // Ensure we got the correct number of authRefs - Assert.assertEquals(numAuthRefsFound, personIdsCreated.size(), - "Did not find all expected authority references! " + "Expected " + personIdsCreated.size() + - ", 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. - * - * @throws Exception - */ - @AfterClass(alwaysRun = true) - public void cleanUp() throws Exception { - String noTest = System.getProperty("noTestCleanup"); - if (Boolean.parseBoolean(noTest)) { - logger.debug("Skipping Cleanup phase ..."); - return; - } - - logger.debug("Cleaning up temporary resources created for testing ..."); - HeldintrustClient heldInTrustClient = new HeldintrustClient(); - // Note: Any non-success responses are ignored and not reported. - for (String resourceId : hitIdsCreated) { - heldInTrustClient.delete(resourceId).close(); - } - // - // Delete all the person records then the parent resource - PersonClient personAuthClient = new PersonClient(); - for (String resourceId : personIdsCreated) { - personAuthClient.deleteItem(personAuthCSID, resourceId).close(); - } - personAuthClient.delete(personAuthCSID).close(); - } - - // --------------------------------------------------------------- - // Utility methods used by tests above - // --------------------------------------------------------------- - @Override - public String getServicePathComponent() { - return SERVICE_PATH_COMPONENT; - } - - private PoxPayloadOut createHitInstance(String heldInTrustNumber, - String depositorContact, - String depositor, - String externalApprovalIndividual, - String correspondenceSender) throws Exception { - HeldintrustsCommon hit = - HeldintrustClientTestUtil.createHitInstance(heldInTrustNumber, depositorContact, depositor, - externalApprovalIndividual, correspondenceSender); - hit.setHeldInTrustNumber(heldInTrustNumber); - - PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent()); - multipart.addPart(new HeldintrustClient().getCommonPartName(), hit); - - logger.debug("to be created, hit common"); - logger.debug("{}", objectAsXmlString(hit, HeldintrustsCommon.class)); - - return multipart; - } -} diff --git a/services/heldintrust/client/src/test/java/org/collectionspace/services/client/test/HeldintrustClientTestUtil.java b/services/heldintrust/client/src/test/java/org/collectionspace/services/client/test/HeldintrustClientTestUtil.java deleted file mode 100644 index 470b15aca..000000000 --- a/services/heldintrust/client/src/test/java/org/collectionspace/services/client/test/HeldintrustClientTestUtil.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.collectionspace.services.client.test; - -import java.util.List; - -import org.collectionspace.services.heldintrust.CorrespondenceGroup; -import org.collectionspace.services.heldintrust.CorrespondenceGroupList; -import org.collectionspace.services.heldintrust.ExternalApprovalGroup; -import org.collectionspace.services.heldintrust.ExternalApprovalGroupList; -import org.collectionspace.services.heldintrust.HeldInTrustDepositorGroup; -import org.collectionspace.services.heldintrust.HeldInTrustDepositorGroupList; -import org.collectionspace.services.heldintrust.HeldintrustsCommon; -import org.collectionspace.services.heldintrust.InternalApprovalGroup; -import org.collectionspace.services.heldintrust.InternalApprovalGroupList; - - -public class HeldintrustClientTestUtil { - - protected static HeldintrustsCommon createHitInstance( - String heldInTrustNumber, - String depositorContact, - String depositor, - String externalApprovalIndividual, - String correspondenceSender) { - HeldintrustsCommon heldInTrust = new HeldintrustsCommon(); - - heldInTrust.setHeldInTrustNumber(heldInTrustNumber); - - HeldInTrustDepositorGroupList tempHDGL = heldInTrust.getHeldInTrustDepositorGroupList(); - if (tempHDGL == null) { - tempHDGL = new HeldInTrustDepositorGroupList(); - } - List hitDepositorGroupList = tempHDGL.getHeldInTrustDepositorGroup(); - HeldInTrustDepositorGroup hitDepositorGroup = new HeldInTrustDepositorGroup(); - hitDepositorGroup.setDepositor(depositor); - hitDepositorGroup.setDepositorContact(depositorContact); - hitDepositorGroupList.add(hitDepositorGroup); - heldInTrust.setHeldInTrustDepositorGroupList(tempHDGL); - - InternalApprovalGroupList tempIAGL = heldInTrust.getInternalApprovalGroupList(); - if (tempIAGL == null) { - tempIAGL = new InternalApprovalGroupList(); - } - List internalApprovalGroupList = tempIAGL.getInternalApprovalGroup(); - InternalApprovalGroup internalApprovalGroup = new InternalApprovalGroup(); - internalApprovalGroup.setInternalApprovalIndividual(depositor); - internalApprovalGroupList.add(internalApprovalGroup); - heldInTrust.setInternalApprovalGroupList(tempIAGL); - - ExternalApprovalGroupList tempEAGL = heldInTrust.getExternalApprovalGroupList(); - if (tempEAGL == null) { - tempEAGL = new ExternalApprovalGroupList(); - } - List externalApprovalGroupList = tempEAGL.getExternalApprovalGroup(); - ExternalApprovalGroup externalApprovalGroup = new ExternalApprovalGroup(); - externalApprovalGroup.setExternalApprovalIndividual(externalApprovalIndividual); - externalApprovalGroupList.add(externalApprovalGroup); - heldInTrust.setExternalApprovalGroupList(tempEAGL); - - CorrespondenceGroupList tempCGL = heldInTrust.getCorrespondenceGroupList(); - if (tempCGL == null) { - tempCGL = new CorrespondenceGroupList(); - } - List correspondanceGroupList = tempCGL.getCorrespondenceGroup(); - CorrespondenceGroup correspondenceGroup = new CorrespondenceGroup(); - correspondenceGroup.setCorrespondenceSender(correspondenceSender); - correspondanceGroupList.add(correspondenceGroup); - heldInTrust.setCorrespondenceGroupList(tempCGL); - - return heldInTrust; - } - -} diff --git a/services/heldintrust/client/src/test/java/org/collectionspace/services/client/test/HeldintrustServiceTest.java b/services/heldintrust/client/src/test/java/org/collectionspace/services/client/test/HeldintrustServiceTest.java deleted file mode 100644 index 9197df8ff..000000000 --- a/services/heldintrust/client/src/test/java/org/collectionspace/services/client/test/HeldintrustServiceTest.java +++ /dev/null @@ -1,274 +0,0 @@ -/** - * 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 javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import org.collectionspace.services.client.CollectionSpaceClient; -import org.collectionspace.services.client.HeldintrustClient; -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.common.api.GregorianCalendarDateTimeUtils; -import org.collectionspace.services.heldintrust.HeldintrustsCommon; -import org.collectionspace.services.jaxb.AbstractCommonList; -import org.dom4j.Element; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.Assert; -import org.testng.annotations.Test; - -/** - * HeldintrustServiceTest, carries out tests against a deployed and running Hit Service. - * - * FIXME: http://issues.collectionspace.org/browse/CSPACE-1685 - * - * $LastChangedRevision$ - * $LastChangedDate$ - */ -public class HeldintrustServiceTest extends AbstractPoxServiceTestImpl { - - private final static String CURRENT_DATE_UTC = GregorianCalendarDateTimeUtils.currentDateUTC(); - - /** - * The logger - */ - private final Logger logger = LoggerFactory.getLogger(HeldintrustServiceTest.class); - - @Override - protected CollectionSpaceClient getClientInstance() throws Exception { - return new HeldintrustClient(); - } - - @Override - protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception { - return new HeldintrustClient(clientPropertiesFilename); - } - - @Override - protected String getServiceName() { - return HeldintrustClient.SERVICE_NAME; - } - - // --------------------------------------------------------------- - // CRUD tests : READ tests - // --------------------------------------------------------------- - @Override - protected void compareReadInstances(HeldintrustsCommon original, HeldintrustsCommon fromRead) { - // Add test here - } - - @Override - public void delete(String testName) { - // Do nothing because this test is not ready to delete the "knownResourceId". - // Instead, the method localDelete() will get called later in the dependency chain. The - // method localDelete() has a dependency on the test "verifyReadOnlyCoreFields". Once the - // "verifyReadOnlyCoreFields" - // test is run, the localDelete() test/method will get run. The localDelete() test/method in turn - // calls the inherited delete() test/method. - } - - @Test(dataProvider = "testName", dependsOnMethods = {"CRUDTests", "verifyReadOnlyCoreFields"}) - public void localDelete(String testName) throws Exception { - // Because of issues with TestNG not allowing @Test annotations on override methods, - // and because we want the "updateWrongUser" to run before the "delete" test, we need - // this method. This method will call super.delete() after all the dependencies have been - // met. - super.delete(testName); - } - - @Test(dataProvider = "testName", dependsOnMethods = {"CRUDTests"}) - public void verifyReadOnlyCoreFields(String testName) throws Exception { - // TODO These should be in some core client utils - final String COLLECTIONSPACE_CORE_SCHEMA = "collectionspace_core"; - final String COLLECTIONSPACE_CORE_TENANTID = "tenantId"; - final String COLLECTIONSPACE_CORE_URI = "uri"; - final String COLLECTIONSPACE_CORE_CREATED_AT = "createdAt"; - final String COLLECTIONSPACE_CORE_CREATED_BY = "createdBy"; - - // Perform setup. - setupUpdate(); - - // Retrieve the contents of a resource to update. - HeldintrustClient client = new HeldintrustClient(); - PoxPayloadIn input; - Response res = client.read(knownResourceId); - try { - logger.debug("{}: read status = {}", testName, res.getStatus()); - Assert.assertEquals(res.getStatus(), testExpectedStatusCode); - - input = new PoxPayloadIn(res.readEntity(String.class)); - } finally { - res.close(); - } - - PayloadInputPart payloadInputPart = input.getPart(COLLECTIONSPACE_CORE_SCHEMA); - Element coreAsElement = null; - if (payloadInputPart != null) { - coreAsElement = payloadInputPart.getElementBody(); - } - Assert.assertNotNull(coreAsElement); - logger.debug("Core part before update:"); - logger.debug("{}", coreAsElement.asXML()); - - // Update the read-only elements - Element tenantId = coreAsElement.element(COLLECTIONSPACE_CORE_TENANTID); - String originalTenantId = tenantId.getText(); - tenantId.setText("foo"); - Element uri = coreAsElement.element(COLLECTIONSPACE_CORE_URI); - String originalUri = uri.getText(); - uri.setText("foo"); - Element createdAt = coreAsElement.element(COLLECTIONSPACE_CORE_CREATED_AT); - String originalCreatedAt = createdAt.getText(); - String now = GregorianCalendarDateTimeUtils.timestampUTC(); - if (originalCreatedAt.equalsIgnoreCase(now)) { - logger.warn("Cannot check createdAt read-only; too fast!"); - } - createdAt.setText(now); - Element createdBy = coreAsElement.element(COLLECTIONSPACE_CORE_CREATED_BY); - String originalCreatedBy = createdBy.getText(); - createdBy.setText("foo"); - - logger.debug("Core part to be updated:"); - logger.debug("{}", coreAsElement.asXML()); - - // Create an output payload to send to the service, and add the common part - PoxPayloadOut output = new PoxPayloadOut(this.getServicePathComponent()); - output.addPart(COLLECTIONSPACE_CORE_SCHEMA, coreAsElement); - - // Submit the request to the service and store the response. - res = client.update(knownResourceId, output); - try { - int statusCode = res.getStatus(); - // Check the status code of the response: does it match the expected response(s)? - logger.debug("{}: status = {}", testName, statusCode); - Assert.assertTrue(testRequestType.isValidStatusCode(statusCode), - invalidStatusCodeMessage(testRequestType, statusCode)); - Assert.assertEquals(statusCode, testExpectedStatusCode); - - input = new PoxPayloadIn(res.readEntity(String.class)); - } finally { - res.close(); - } - - PayloadInputPart updatedCorePart = input.getPart(COLLECTIONSPACE_CORE_SCHEMA); - Element updatedCoreAsElement = null; - if (updatedCorePart != null) { - updatedCoreAsElement = updatedCorePart.getElementBody(); - } - Assert.assertNotNull(updatedCoreAsElement); - - tenantId = updatedCoreAsElement.element(COLLECTIONSPACE_CORE_TENANTID); - String updatedTenantId = tenantId.getText(); - Assert.assertEquals(updatedTenantId, originalTenantId, "CORE part TenantID was able to update!"); - uri = updatedCoreAsElement.element(COLLECTIONSPACE_CORE_URI); - String updatedUri = uri.getText(); - Assert.assertEquals(updatedUri, originalUri, "CORE part URI was able to update!"); - createdAt = updatedCoreAsElement.element(COLLECTIONSPACE_CORE_CREATED_AT); - String updatedCreatedAt = createdAt.getText(); - Assert.assertEquals(updatedCreatedAt, originalCreatedAt, "CORE part CreatedAt was able to update!"); - createdBy = updatedCoreAsElement.element(COLLECTIONSPACE_CORE_CREATED_BY); - String updatedCreatedBy = createdBy.getText(); - Assert.assertEquals(updatedCreatedBy, originalCreatedBy, "CORE part CreatedBy was able to update!"); - } - - // --------------------------------------------------------------- - // Utility tests : tests of code used in tests above - // --------------------------------------------------------------- - - /* (non-Javadoc) - * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent() - */ - @Override - public String getServicePathComponent() { - return HeldintrustClient.SERVICE_PATH_COMPONENT; - } - - /** - * Creates the hit instance. - * - * @param identifier the identifier - * @return the multipart output - * @throws Exception - */ - @Override - protected PoxPayloadOut createInstance(String identifier) throws Exception { - return createHitInstance("entryNumber-" + identifier); - } - - /** - * Creates the hit instance. - * - * @param entryNumber the entry number - * @return the multipart output - * @throws Exception - */ - private PoxPayloadOut createHitInstance(String entryNumber) throws Exception { - HeldintrustsCommon hit = new HeldintrustsCommon(); - hit.setHeldInTrustNumber(entryNumber); - - PoxPayloadOut multipart = new PoxPayloadOut(HeldintrustClient.SERVICE_PAYLOAD_NAME); - PayloadOutputPart commonPart = multipart.addPart(hit, MediaType.APPLICATION_XML_TYPE); - commonPart.setLabel(new HeldintrustClient().getCommonPartName()); - - logger.debug("to be created, HitsCommon instance"); - logger.debug("{}", objectAsXmlString(hit, HeldintrustsCommon.class)); - - return multipart; - } - - @Override - protected PoxPayloadOut createInstance(String commonPartName, String identifier) throws Exception { - return this.createInstance(identifier); - } - - @Override - protected HeldintrustsCommon updateInstance(HeldintrustsCommon hitsCommon) { - HeldintrustsCommon result = new HeldintrustsCommon(); - - result.setHeldInTrustNumber("hits"); - - return result; - } - - @Override - protected void compareUpdatedInstances(HeldintrustsCommon original, - HeldintrustsCommon updated) { - // put test here - } - - /* - * For convenience and terseness, this test method is the base of the test execution dependency chain. Other - * test methods may - * refer to this method in their @Test annotation declarations. - */ - @Override - @Test(dataProvider = "testName", - dependsOnMethods = { - "org.collectionspace.services.client.test.AbstractServiceTestImpl.baseCRUDTests"}) - public void CRUDTests(String testName) { - // Needed for TestNG dependency chain. - } -} diff --git a/services/heldintrust/client/src/test/java/org/collectionspace/services/client/test/OrganizationAuthRefDocsTest.java b/services/heldintrust/client/src/test/java/org/collectionspace/services/client/test/OrganizationAuthRefDocsTest.java deleted file mode 100644 index 5b361412b..000000000 --- a/services/heldintrust/client/src/test/java/org/collectionspace/services/client/test/OrganizationAuthRefDocsTest.java +++ /dev/null @@ -1,336 +0,0 @@ -/** - * 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.OrganizationJAXBSchema; -import org.collectionspace.services.client.CollectionSpaceClient; -import org.collectionspace.services.client.HeldintrustClient; -import org.collectionspace.services.client.OrgAuthorityClientUtils; -import org.collectionspace.services.client.OrganizationClient; -import org.collectionspace.services.client.PoxPayloadOut; -import org.collectionspace.services.common.authorityref.AuthorityRefDocList; -import org.collectionspace.services.heldintrust.HeldintrustsCommon; -import org.collectionspace.services.jaxb.AbstractCommonList; -import org.collectionspace.services.organization.OrgTermGroup; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.Assert; -import org.testng.annotations.AfterClass; -import org.testng.annotations.Test; - -/** - * OrganizationAuthRefDocsTest, carries out tests against a - * deployed and running Organization Service. - * - * $LastChangedRevision: 1327 $ - * $LastChangedDate: 2010-02-12 10:35:11 -0800 (Fri, 12 Feb 2010) $ - */ -public class OrganizationAuthRefDocsTest extends BaseServiceTest { - - private static final Logger logger = LoggerFactory.getLogger(OrganizationAuthRefDocsTest.class); - // Instance variables specific to this test. - final String SERVICE_PATH_COMPONENT = "hits"; - final String ORGANIZATION_AUTHORITY_NAME = "TestOrganizationAuth"; - private String knownHitId = null; - private final List hitIdsCreated = new ArrayList(); - private final List orgIdsCreated = new ArrayList(); - private String orgAuthCSID = null; - private String currentContactOrgCSID = null; - private String depositorContactRefName = null; - private String depositorRefName = null; - private String externalApprovalIndividualRefName = null; - private String correspondenceSenderRefName = null; - private String valuerRefName = null; - - @Override - protected String getServiceName() { - throw new UnsupportedOperationException(); //FIXME: REM - See http://issues.collectionspace.org/browse/CSPACE-3498 - } - - /* (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 - } - - @Override - protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) { - 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 = BaseServiceTest.class) - public void createHitWithAuthRefs(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 organization refs and entities - createOrgRefs(); - - HeldintrustClient heldInTrustClient = new HeldintrustClient(); - PoxPayloadOut hitPayload = createHitInstance( - "entryNumber-" + identifier, - depositorContactRefName, - // Use currentOwnerRefName twice to test fix for CSPACE-2863 - depositorContactRefName, - externalApprovalIndividualRefName, - correspondenceSenderRefName); - - Response res = heldInTrustClient.create(hitPayload); - 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? - logger.debug("{}: status = {}", testName, statusCode); - Assert.assertTrue(testRequestType.isValidStatusCode(statusCode), - invalidStatusCodeMessage(testRequestType, statusCode)); - Assert.assertEquals(statusCode, testExpectedStatusCode); - String newHitId = extractId(res); - Assert.assertNotNull(newHitId, "Could not create a new Hit record."); - - // Store the ID returned from the first resource created - // for additional tests below. - if (knownHitId == null) { - knownHitId = newHitId; - logger.debug("{}: knownHitId={}", testName, knownHitId); - } - - // Store the IDs from every resource created by tests, - // so they can be deleted after tests have been run. - hitIdsCreated.add(newHitId); - } finally { - res.close(); - } - - } - - /** - * Creates the organization refs. - * - * @throws Exception - */ - protected void createOrgRefs() throws Exception { - OrganizationClient orgAuthClient = new OrganizationClient(); - PoxPayloadOut multipart = OrgAuthorityClientUtils.createOrgAuthorityInstance( - ORGANIZATION_AUTHORITY_NAME, ORGANIZATION_AUTHORITY_NAME, orgAuthClient.getCommonPartName()); - Response res = orgAuthClient.create(multipart); - try { - int statusCode = res.getStatus(); - Assert.assertTrue(testRequestType.isValidStatusCode(statusCode), - invalidStatusCodeMessage(testRequestType, statusCode)); - Assert.assertEquals(statusCode, STATUS_CREATED); - orgAuthCSID = extractId(res); - Assert.assertNotNull(orgAuthCSID, "Could not create a new Organization authority record."); - } finally { - res.close(); - } - - currentContactOrgCSID = createOrganization("olivierContactCompany", "Olivier Contact Company", - "Olivier Contact Company"); - orgIdsCreated.add(currentContactOrgCSID); - depositorContactRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, - currentContactOrgCSID, orgAuthClient); - - String newOrgCSID = - createOrganization("debbieDepositorAssocs", "Debbie Depositor & Associates", - "Debbie Depositor & Associates"); - depositorRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, newOrgCSID, orgAuthClient); - orgIdsCreated.add(newOrgCSID); - - newOrgCSID = createOrganization("andrewExternalApprovalLtd", "Andrew External-Approval Ltd.", - "Andrew External-Approval Ltd."); - externalApprovalIndividualRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, - newOrgCSID, orgAuthClient); - orgIdsCreated.add(newOrgCSID); - - newOrgCSID = createOrganization("ingridCorrespondenceSender", "Ingrid Correspondence Sender", - "Ingrid Correspondence Sender"); - correspondenceSenderRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, newOrgCSID, orgAuthClient); - orgIdsCreated.add(newOrgCSID); - - newOrgCSID = createOrganization("vinceValuerLLC", "Vince Valuer LLC", "Vince Valuer LLC"); - valuerRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, newOrgCSID, orgAuthClient); - orgIdsCreated.add(newOrgCSID); - } - - protected String createOrganization(String shortId, String shortName, String longName) throws Exception { - String result; - - OrganizationClient orgAuthClient = new OrganizationClient(); - Map orgInfo = new HashMap(); - orgInfo.put(OrganizationJAXBSchema.SHORT_IDENTIFIER, shortId); - - List orgTerms = new ArrayList(); - OrgTermGroup term = new OrgTermGroup(); - term.setTermDisplayName(shortName); - term.setTermName(shortName); - term.setMainBodyName(longName); - orgTerms.add(term); - PoxPayloadOut multipart = - OrgAuthorityClientUtils.createOrganizationInstance(null, - orgInfo, orgTerms, - orgAuthClient.getItemCommonPartName()); - - Response res = orgAuthClient.createItem(orgAuthCSID, 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 here - @Test(dataProvider = "testName", dataProviderClass = BaseServiceTest.class, - dependsOnMethods = {"createHitWithAuthRefs"}) - public void readAndCheckAuthRefDocs(String testName) throws Exception { - // Perform setup. - testSetup(STATUS_OK, ServiceRequestType.READ); - - // Get the auth ref docs and check them - OrganizationClient orgAuthClient = new OrganizationClient(); - Response refDocListResp = orgAuthClient.getReferencingObjects(orgAuthCSID, currentContactOrgCSID); - AuthorityRefDocList list; - try { - assertStatusCode(refDocListResp, testName); - list = refDocListResp.readEntity(AuthorityRefDocList.class); - Assert.assertNotNull(list); - } finally { - if (refDocListResp != null) { - refDocListResp.close(); - } - } - - // Optionally output additional data about list members for debugging. - int nHitsFound = 0; - final int EXPECTED_HITS = 3; - int i = 0; - logger.debug("{}: Docs that use: {}", testName, depositorContactRefName); - for (AuthorityRefDocList.AuthorityRefDocItem item : list.getAuthorityRefDocItem()) { - logger.debug("{}: list-item[{}] {} ({}) Name:[{}] Number:[{}] in field:[{}]", testName, i, - item.getDocType(), item.getDocId(), item.getDocName(), item.getDocNumber(), - item.getSourceField()); - if (knownHitId.equalsIgnoreCase(item.getDocId())) { - nHitsFound++; - } - i++; - } - Assert.assertTrue((nHitsFound == EXPECTED_HITS), "Did not find Hit (twice more) with authref!"); - } - - - // --------------------------------------------------------------- - // 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. - * - * @throws Exception - */ - @AfterClass(alwaysRun = true) - public void cleanUp() throws Exception { - String noTest = System.getProperty("noTestCleanup"); - if (Boolean.parseBoolean(noTest)) { - logger.debug("Skipping Cleanup phase ..."); - return; - } - - logger.debug("Cleaning up temporary resources created for testing ..."); - HeldintrustClient heldInTrustClient = new HeldintrustClient(); - // Note: Any non-success responses are ignored and not reported. - for (String resourceId : hitIdsCreated) { - heldInTrustClient.delete(resourceId).close(); - } - // Delete persons before PersonAuth - OrganizationClient personAuthClient = new OrganizationClient(); - for (String resourceId : orgIdsCreated) { - personAuthClient.deleteItem(orgAuthCSID, resourceId).close(); - } - if (orgAuthCSID != null) { - personAuthClient.delete(orgAuthCSID).close(); - } - } - - // --------------------------------------------------------------- - // Utility methods used by tests above - // --------------------------------------------------------------- - @Override - public String getServicePathComponent() { - return SERVICE_PATH_COMPONENT; - } - - private PoxPayloadOut createHitInstance(String heldInTrustNumber, - String depositorContact, - String depositor, - String externalApprovalIndividual, - String correspondenceSender) throws Exception { - HeldintrustsCommon hit = - HeldintrustClientTestUtil.createHitInstance(heldInTrustNumber, depositorContact, depositor, - externalApprovalIndividual, correspondenceSender); - - PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent()); - multipart.addPart(new HeldintrustClient().getCommonPartName(), hit); - - logger.debug("to be created, hit common"); - logger.debug("{}", objectAsXmlString(hit, HeldintrustsCommon.class)); - - return multipart; - } -} diff --git a/services/heldintrust/client/src/test/java/org/collectionspace/services/client/test/PersonAuthRefDocsTest.java b/services/heldintrust/client/src/test/java/org/collectionspace/services/client/test/PersonAuthRefDocsTest.java deleted file mode 100644 index fccb0867d..000000000 --- a/services/heldintrust/client/src/test/java/org/collectionspace/services/client/test/PersonAuthRefDocsTest.java +++ /dev/null @@ -1,430 +0,0 @@ -/** - * 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.HeldintrustClient; -import org.collectionspace.services.client.PersonAuthorityClientUtils; -import org.collectionspace.services.client.PersonClient; -import org.collectionspace.services.client.PoxPayloadOut; -import org.collectionspace.services.common.authorityref.AuthorityRefDocList; -import org.collectionspace.services.heldintrust.HeldintrustsCommon; -import org.collectionspace.services.jaxb.AbstractCommonList; -import org.collectionspace.services.person.PersonTermGroup; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.Assert; -import org.testng.annotations.AfterClass; -import org.testng.annotations.Test; - -/** - * PersonAuthRefDocsTest, carries out tests against a - * deployed and running Person Service. - * - * $LastChangedRevision: 1327 $ - * $LastChangedDate: 2010-02-12 10:35:11 -0800 (Fri, 12 Feb 2010) $ - */ -public class PersonAuthRefDocsTest extends BaseServiceTest { - - // Instance variables specific to this test. - final String SERVICE_PATH_COMPONENT = "hits"; - final String PERSON_AUTHORITY_NAME = "TestPersonAuth"; - private final String CLASS_NAME = PersonAuthRefDocsTest.class.getName(); - private final Logger logger = LoggerFactory.getLogger(CLASS_NAME); - private String knownHitId = null; - private final List hitIdsCreated = new ArrayList(); - private final List personIdsCreated = new ArrayList(); - private String personAuthCSID = null; - private String currentContactPersonCSID = null; - private String depositorPersonCSID = null; - private String insurerPersonCSID = null; - private String depositorContactRefName = null; - private String depositorRefName = null; - private String externalApprovalIndividualRefName = null; - private String correspondenceSenderRefName = null; - private String valuerRefName = null; - private final String valuerShortId = null; - - @Override - public String getServiceName() { - throw new UnsupportedOperationException(); //FIXME: REM - http://issues.collectionspace.org/browse/CSPACE-3498 - } - - /* (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 - } - - @Override - protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) { - 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") - public void createHitWithAuthRefs(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(); - - HeldintrustClient heldInTrustClient = new HeldintrustClient(); - PoxPayloadOut multipart = createHitInstance( - "entryNumber-" + identifier, - depositorContactRefName, - depositorRefName, - externalApprovalIndividualRefName, - correspondenceSenderRefName); - - Response res = heldInTrustClient.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? - logger.debug("{}: status = {}", testName, statusCode); - Assert.assertTrue(testRequestType.isValidStatusCode(statusCode), - invalidStatusCodeMessage(testRequestType, statusCode)); - Assert.assertEquals(statusCode, testExpectedStatusCode); - } finally { - res.close(); - } - - // Store the ID returned from the first resource created - // for additional tests below. - if (knownHitId == null) { - knownHitId = extractId(res); - logger.debug("{}: knownHitId={}", testName, knownHitId); - } - - // Store the IDs from every resource created by tests, - // so they can be deleted after tests have been run. - hitIdsCreated.add(extractId(res)); - } - - /** - * Creates the person refs. - * - * @throws Exception - */ - protected void createPersonRefs() throws Exception { - PersonClient personAuthClient = new PersonClient(); - 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); - - String csid = createPerson("Olivier", "Contact", "olivierContact", authRefName); - Assert.assertNotNull(csid); - currentContactPersonCSID = csid; - depositorContactRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null); - Assert.assertNotNull(depositorContactRefName); - personIdsCreated.add(csid); - - csid = createPerson("Debbie", "Depositor", "debbieDepositor", authRefName); - Assert.assertNotNull(csid); - depositorRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null); - depositorPersonCSID = csid; - Assert.assertNotNull(depositorRefName); - personIdsCreated.add(csid); - - csid = createPerson("Andrew", "ApprovalIndividual", "andrewApprovalIndividual", authRefName); - Assert.assertNotNull(csid); - externalApprovalIndividualRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null); - Assert.assertNotNull(externalApprovalIndividualRefName); - personIdsCreated.add(csid); - - csid = createPerson("Ingrid", "Sender", "ingridSender", authRefName); - Assert.assertNotNull(csid); - insurerPersonCSID = csid; - correspondenceSenderRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null); - Assert.assertNotNull(correspondenceSenderRefName); - personIdsCreated.add(csid); - - csid = createPerson("Vince", "Valuer", "vinceValuer", authRefName); - Assert.assertNotNull(csid); - valuerRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null); - logger.debug("valuerShortId={}", valuerShortId); - Assert.assertNotNull(valuerRefName); - personIdsCreated.add(csid); - } - - protected String createPerson(String firstName, String surName, String shortId, String authRefName) - throws Exception { - String result; - - PersonClient personAuthClient = new PersonClient(); - Map personInfo = new HashMap(); - personInfo.put(PersonJAXBSchema.FORE_NAME, firstName); - personInfo.put(PersonJAXBSchema.SUR_NAME, surName); - personInfo.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId); - List personTerms = new ArrayList(); - 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", dependsOnMethods = {"createHitWithAuthRefs"}) - public void readAndCheckAuthRefDocs(String testName) throws Exception { - // Perform setup. - testSetup(STATUS_OK, ServiceRequestType.READ); - - // Get the auth ref docs and check them - - PersonClient personAuthClient = new PersonClient(); - Response res = personAuthClient.getReferencingObjects(personAuthCSID, currentContactPersonCSID); - AuthorityRefDocList list; - try { - assertStatusCode(res, testName); - list = res.readEntity(AuthorityRefDocList.class); - } finally { - if (res != null) { - res.close(); - } - } - - List items = list.getAuthorityRefDocItem(); - Assert.assertNotNull(items); - Assert.assertFalse(items.isEmpty()); - - // output additional data about list members for debugging. - boolean fFoundHit = false; - int i = 0; - logger.debug("{}: Docs that use: {}", testName, depositorContactRefName); - for (AuthorityRefDocList.AuthorityRefDocItem item : items) { - logger.debug("{}: list-item[{}] {} ({}) Name:[{}] Number:[{}] in field:[{}]", testName, i, - item.getDocType(), item.getDocId(), item.getDocName(), item.getDocNumber(), - item.getSourceField()); - if (!fFoundHit && knownHitId.equalsIgnoreCase(item.getDocId())) { - fFoundHit = true; - } - i++; - } - Assert.assertTrue(fFoundHit, "Did not find Hit with authref!"); - - // - // Get the referencing objects - // - personAuthClient = new PersonClient(); - res = personAuthClient.getReferencingObjects(personAuthCSID, depositorPersonCSID); - try { - assertStatusCode(res, testName); - list = res.readEntity(AuthorityRefDocList.class); - } finally { - if (res != null) { - res.close(); - } - } - - items = list.getAuthorityRefDocItem(); - Assert.assertNotNull(items); - Assert.assertFalse(items.isEmpty()); - Assert.assertNotNull(items.get(0)); - - // Optionally output additional data about list members for debugging. - fFoundHit = false; - logger.debug("{}: Docs that use: {}", testName, depositorRefName); - i = 0; - for (AuthorityRefDocList.AuthorityRefDocItem item : items) { - logger.debug("{}: list-item[{}] {} ({}) Name:[{}] Number:[{}] in field:[{}]", testName, i, - item.getDocType(), item.getDocId(), item.getDocName(), item.getDocNumber(), - item.getSourceField()); - if (!fFoundHit && knownHitId.equalsIgnoreCase(item.getDocId())) { - fFoundHit = true; - } - i++; - } - Assert.assertTrue(fFoundHit, "Did not find Hit with authref!"); - } - - /* - * Read and check the list of referencing objects, where the authRef field - * is a value instance of a repeatable scalar field. - */ - @Test(dataProvider = "testName", dependsOnMethods = {"createHitWithAuthRefs"}, - groups = {"repeatableScalar"}) - public void readAndCheckAuthRefDocsRepeatableScalar(String testName) throws Exception { - // Perform setup. - testSetup(STATUS_OK, ServiceRequestType.READ); - - // Get the auth ref docs and check them - - // Single scalar field - PersonClient personAuthClient = new PersonClient(); - Response res = personAuthClient.getReferencingObjects(personAuthCSID, insurerPersonCSID); - AuthorityRefDocList list; - try { - assertStatusCode(res, testName); - list = res.readEntity(AuthorityRefDocList.class); - } finally { - if (res != null) { - res.close(); - } - } - - List items = list.getAuthorityRefDocItem(); - Assert.assertNotNull(items); - Assert.assertFalse(items.isEmpty()); - Assert.assertNotNull(items.get(0)); - - // Optionally output additional data about list members for debugging. - boolean fFoundHit = false; - int i = 0; - logger.debug("{}: Docs that use: {}", testName, correspondenceSenderRefName); - for (AuthorityRefDocList.AuthorityRefDocItem item : items) { - logger.debug("{}: list-item[{}] {} ({}) Name:[{}] Number:[{}] in field:[{}]", testName, i, - item.getDocType(), item.getDocId(), item.getDocName(), item.getDocNumber(), - item.getSourceField()); - if (!fFoundHit && knownHitId.equalsIgnoreCase(item.getDocId())) { - fFoundHit = true; - } - i++; - } - Assert.assertTrue(fFoundHit, "Did not find Hit with authref!"); - } - - - // --------------------------------------------------------------- - // 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. - * - * @throws Exception - */ - @AfterClass(alwaysRun = true) - public void cleanUp() throws Exception { - String noTest = System.getProperty("noTestCleanup"); - if (Boolean.parseBoolean(noTest)) { - logger.debug("Skipping Cleanup phase ..."); - return; - } - - logger.debug("Cleaning up temporary resources created for testing ..."); - HeldintrustClient heldInTrustClient = new HeldintrustClient(); - // Note: Any non-success responses are ignored and not reported. - for (String resourceId : hitIdsCreated) { - heldInTrustClient.delete(resourceId).close(); - } - // Delete persons before PersonAuth - PersonClient personAuthClient = new PersonClient(); - for (String resourceId : personIdsCreated) { - personAuthClient.deleteItem(personAuthCSID, resourceId).close(); - } - if (personAuthCSID != null) { - personAuthClient.delete(personAuthCSID).close(); - } - } - - // --------------------------------------------------------------- - // Utility methods used by tests above - // --------------------------------------------------------------- - @Override - public String getServicePathComponent() { - return SERVICE_PATH_COMPONENT; - } - - private PoxPayloadOut createHitInstance(String heldInTrustNumber, - String depositorContact, - String depositor, - String externalApprovalIndividual, - String correspondenceSender) throws Exception { - HeldintrustsCommon hit = - HeldintrustClientTestUtil.createHitInstance(heldInTrustNumber, depositorContact, depositor, - externalApprovalIndividual, correspondenceSender); - hit.setHeldInTrustNumber(heldInTrustNumber); - - PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent()); - multipart.addPart(new HeldintrustClient().getCommonPartName(), hit); - - logger.debug("to be created, hit common"); - logger.debug("{}", objectAsXmlString(hit, HeldintrustsCommon.class)); - - return multipart; - } -} diff --git a/services/heldintrust/client/src/test/resources/log4j2-surefire.xml b/services/heldintrust/client/src/test/resources/log4j2-surefire.xml deleted file mode 100644 index bf74484d1..000000000 --- a/services/heldintrust/client/src/test/resources/log4j2-surefire.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - %d %-5p [%t] [%c:%L] %m%n - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/services/heldintrust/jaxb/.gitignore b/services/heldintrust/jaxb/.gitignore deleted file mode 100644 index 1dd333108..000000000 --- a/services/heldintrust/jaxb/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/target/ -/target/ diff --git a/services/heldintrust/jaxb/pom.xml b/services/heldintrust/jaxb/pom.xml deleted file mode 100644 index 0baad6f19..000000000 --- a/services/heldintrust/jaxb/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - org.collectionspace.services.heldintrust - org.collectionspace.services - ${revision} - - - 4.0.0 - org.collectionspace.services.heldintrust.jaxb - services.heldintrust.jaxb - - - - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - - - - - collectionspace-services-heldintrust-jaxb - install - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - - org.codehaus.mojo - build-helper-maven-plugin - - - - diff --git a/services/heldintrust/jaxb/src/main/java/org/collectionspace/services/HeldintrustJAXBSchema.java b/services/heldintrust/jaxb/src/main/java/org/collectionspace/services/HeldintrustJAXBSchema.java deleted file mode 100644 index 1f4401811..000000000 --- a/services/heldintrust/jaxb/src/main/java/org/collectionspace/services/HeldintrustJAXBSchema.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.collectionspace.services; - -/** - * @author remillet - */ -public interface HeldintrustJAXBSchema { -} diff --git a/services/heldintrust/jaxb/src/main/java/org/collectionspace/services/HeldintrustListItemJAXBSchema.java b/services/heldintrust/jaxb/src/main/java/org/collectionspace/services/HeldintrustListItemJAXBSchema.java deleted file mode 100644 index ab51d31f1..000000000 --- a/services/heldintrust/jaxb/src/main/java/org/collectionspace/services/HeldintrustListItemJAXBSchema.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.collectionspace.services; - -public interface HeldintrustListItemJAXBSchema { - String CSID = "csid"; - -} diff --git a/services/heldintrust/jaxb/src/main/resources/heldintrusts-common.xsd b/services/heldintrust/jaxb/src/main/resources/heldintrusts-common.xsd deleted file mode 100644 index 598c8411f..000000000 --- a/services/heldintrust/jaxb/src/main/resources/heldintrusts-common.xsd +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/services/heldintrust/pom.xml b/services/heldintrust/pom.xml deleted file mode 100644 index 69a664813..000000000 --- a/services/heldintrust/pom.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - org.collectionspace.services - org.collectionspace.services.main - ${revision} - - - 4.0.0 - org.collectionspace.services.heldintrust - services.heldintrust - pom - - - jaxb - service - client - - - diff --git a/services/heldintrust/service/pom.xml b/services/heldintrust/service/pom.xml deleted file mode 100644 index b94b3a219..000000000 --- a/services/heldintrust/service/pom.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - - org.collectionspace.services - org.collectionspace.services.heldintrust - ${revision} - - - 4.0.0 - org.collectionspace.services.heldintrust.service - services.heldintrust.service - jar - - - - org.collectionspace.services - org.collectionspace.services.common - - - org.collectionspace.services - org.collectionspace.services.client - ${project.version} - - - org.collectionspace.services - org.collectionspace.services.heldintrust.jaxb - ${project.version} - - - org.collectionspace.services - org.collectionspace.services.heldintrust.client - ${project.version} - - - - junit - junit - test - - - org.testng - testng - - - - - - javax.security - jaas - 1.0.01 - provided - - - - - - org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider - - - org.jboss.resteasy - resteasy-multipart-provider - - - - - - org.nuxeo.ecm.core - nuxeo-core-api - - - jboss-remoting - jboss - - - - - - - - collectionspace-services-heldintrust - - diff --git a/services/heldintrust/service/src/main/java/org/collectionspace/services/heldintrust/HeldintrustResource.java b/services/heldintrust/service/src/main/java/org/collectionspace/services/heldintrust/HeldintrustResource.java deleted file mode 100644 index 04d98130e..000000000 --- a/services/heldintrust/service/src/main/java/org/collectionspace/services/heldintrust/HeldintrustResource.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * 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.heldintrust; - -import javax.ws.rs.Consumes; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; - -import org.collectionspace.services.client.HeldintrustClient; -import org.collectionspace.services.common.NuxeoBasedResource; - -@Path(HeldintrustClient.SERVICE_PATH) -@Consumes("application/xml") -@Produces("application/xml") -public class HeldintrustResource extends NuxeoBasedResource { - - @Override - protected String getVersionString() { - return "$LastChangedRevision$"; - } - - @Override - public String getServiceName() { - return HeldintrustClient.SERVICE_NAME; - } - - @Override - public Class getCommonPartClass() { - return HeldintrustsCommon.class; - } - -} diff --git a/services/heldintrust/service/src/main/java/org/collectionspace/services/heldintrust/nuxeo/HeldintrustConstants.java b/services/heldintrust/service/src/main/java/org/collectionspace/services/heldintrust/nuxeo/HeldintrustConstants.java deleted file mode 100644 index 2cdcd54da..000000000 --- a/services/heldintrust/service/src/main/java/org/collectionspace/services/heldintrust/nuxeo/HeldintrustConstants.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * 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.heldintrust.nuxeo; - -/** - * HeldintrustConstants processes CollectionObject document - */ -public class HeldintrustConstants { - - public final static String NUXEO_DOCTYPE = "Heldintrust"; - public final static String NUXEO_SCHEMA_NAME = "heldintrust"; - public final static String NUXEO_DC_TITLE = "CollectionSpace-Heldintrust"; - -} diff --git a/services/heldintrust/service/src/main/java/org/collectionspace/services/heldintrust/nuxeo/HeldintrustDocumentModelHandler.java b/services/heldintrust/service/src/main/java/org/collectionspace/services/heldintrust/nuxeo/HeldintrustDocumentModelHandler.java deleted file mode 100644 index 081599c71..000000000 --- a/services/heldintrust/service/src/main/java/org/collectionspace/services/heldintrust/nuxeo/HeldintrustDocumentModelHandler.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * 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.heldintrust.nuxeo; - -import org.collectionspace.services.heldintrust.HeldintrustsCommon; -import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler; - -/** - * HeldintrustDocumentModelHandler - * - * $LastChangedRevision: $ - * $LastChangedDate: $ - */ -public class HeldintrustDocumentModelHandler extends NuxeoDocumentModelHandler { -} diff --git a/services/heldintrust/service/src/main/java/org/collectionspace/services/heldintrust/nuxeo/HeldintrustValidatorHandler.java b/services/heldintrust/service/src/main/java/org/collectionspace/services/heldintrust/nuxeo/HeldintrustValidatorHandler.java deleted file mode 100644 index 934842b74..000000000 --- a/services/heldintrust/service/src/main/java/org/collectionspace/services/heldintrust/nuxeo/HeldintrustValidatorHandler.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.collectionspace.services.heldintrust.nuxeo; - -import org.collectionspace.services.client.PoxPayloadIn; -import org.collectionspace.services.client.PoxPayloadOut; -import org.collectionspace.services.common.document.InvalidDocumentException; -import org.collectionspace.services.common.document.ValidatorHandlerImpl; -import org.collectionspace.services.heldintrust.HeldintrustsCommon; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class HeldintrustValidatorHandler extends ValidatorHandlerImpl { - - /** - * Error Message - */ - private static final String VALIDATION_ERROR = - "The heldintrust record payload was invalid. See log file for more details."; - - /** - * The logger. - */ - private final Logger logger = LoggerFactory.getLogger(HeldintrustValidatorHandler.class); - - @Override - protected Class getCommonPartClass() { - return HeldintrustsCommon.class; - } - - @Override - protected void handleCreate() throws InvalidDocumentException { - try { - HeldintrustsCommon hitsCommon = (HeldintrustsCommon) getCommonPart(); - assert (hitsCommon != null); - } catch (AssertionError e) { - logger.error(e.getMessage(), e); - throw new InvalidDocumentException(VALIDATION_ERROR, e); - } - } - - @Override - protected void handleGet() { - // TODO Auto-generated method stub - } - - @Override - protected void handleGetAll() { - // TODO Auto-generated method stub - } - - @Override - protected void handleUpdate() { - // TODO Auto-generated method stub - } - - @Override - protected void handleDelete() { - // TODO Auto-generated method stub - } - -} diff --git a/services/heldintrust/service/src/test/java/org/collectionspace/services/test/HeldintrustServiceTest.java b/services/heldintrust/service/src/test/java/org/collectionspace/services/test/HeldintrustServiceTest.java deleted file mode 100644 index 615007c4c..000000000 --- a/services/heldintrust/service/src/test/java/org/collectionspace/services/test/HeldintrustServiceTest.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.collectionspace.services.test; - -/** - * A HeldInTrustServiceTest. - * - * @version $Revision:$ - */ -public class HeldintrustServiceTest { - //empty -} diff --git a/services/intake/client/temp-testng-customsuite.xml b/services/intake/client/temp-testng-customsuite.xml new file mode 100644 index 000000000..9f2480621 --- /dev/null +++ b/services/intake/client/temp-testng-customsuite.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/services/pom.xml b/services/pom.xml index 383ccb5b1..3a6f8319d 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -65,7 +65,6 @@ group insurance intake - heldintrust loanin loanout claim -- 2.47.3