From: Richard Millet Date: Wed, 16 Feb 2011 00:21:56 +0000 (+0000) Subject: CSPACE-3574: Merging Plain Old XML payload work into trunk. X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=67e4050608d564c6d2be236ed432838e5ea1bc32;p=tmp%2Fjakarta-migration.git CSPACE-3574: Merging Plain Old XML payload work into trunk. --- diff --git a/services/IntegrationTests/.classpath b/services/IntegrationTests/.classpath index 425cd1620..70ef55ca6 100644 --- a/services/IntegrationTests/.classpath +++ b/services/IntegrationTests/.classpath @@ -1,10 +1,325 @@ - - - - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/IntegrationTests/.project b/services/IntegrationTests/.project index 9117f83d1..bd19ccabb 100644 --- a/services/IntegrationTests/.project +++ b/services/IntegrationTests/.project @@ -1,31 +1,34 @@ - org.collectionspace.services.IntegrationTests - + NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + org.collectionspace.services.3rdparty.nuxeo.quote-api org.collectionspace.services.client org.collectionspace.services.collectionobject.client - org.collectionspace.services.jaxb org.collectionspace.services.collectionobject.jaxb org.collectionspace.services.common + org.collectionspace.services.contact.client + org.collectionspace.services.contact.jaxb + org.collectionspace.services.hyperjaxb org.collectionspace.services.intake.client org.collectionspace.services.intake.jaxb + org.collectionspace.services.jaxb + org.collectionspace.services.organization.client + org.collectionspace.services.organization.jaxb + org.collectionspace.services.person.client + org.collectionspace.services.person.jaxb org.collectionspace.services.relation.client org.eclipse.jdt.core.javabuilder - - org.maven.ide.eclipse.maven2Builder - - org.maven.ide.eclipse.maven2Nature org.eclipse.jdt.core.javanature - + \ No newline at end of file diff --git a/services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/CollectionSpaceIntegrationTest.java b/services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/CollectionSpaceIntegrationTest.java index 08f6eab47..7b3cf3715 100755 --- a/services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/CollectionSpaceIntegrationTest.java +++ b/services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/CollectionSpaceIntegrationTest.java @@ -34,6 +34,8 @@ import javax.ws.rs.core.Response; import javax.xml.bind.JAXBContext; import javax.xml.bind.Marshaller; +import org.collectionspace.services.client.PayloadInputPart; +import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.collectionobject.CollectionobjectsCommon; import org.collectionspace.services.collectionobject.TitleGroup; import org.collectionspace.services.collectionobject.TitleGroupList; @@ -171,21 +173,13 @@ public abstract class CollectionSpaceIntegrationTest { * @throws Exception * the exception */ - static Object extractPart(MultipartInput input, String label, Class clazz) { + static Object extractPart(PoxPayloadIn input, String label, Class clazz) { Object obj = null; - - try { - for (InputPart part : input.getParts()) { - String partLabel = part.getHeaders().getFirst("label"); - if (label.equalsIgnoreCase(partLabel)) { - String partStr = part.getBodyAsString(); - obj = part.getBody(clazz, null); - break; + + PayloadInputPart payloadInputPart = input.getPart(label); + if (payloadInputPart != null) { + obj = payloadInputPart.getBody(); } - } - } catch (Exception e) { - e.printStackTrace(); - } return obj; } diff --git a/services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/RelationIntegrationTest.java b/services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/RelationIntegrationTest.java index 78cde6fe7..a1b2e5eba 100755 --- a/services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/RelationIntegrationTest.java +++ b/services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/RelationIntegrationTest.java @@ -39,6 +39,9 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; import org.jboss.resteasy.plugins.providers.multipart.OutputPart; import org.collectionspace.services.client.CollectionObjectClient; +import org.collectionspace.services.client.PayloadOutputPart; +import org.collectionspace.services.client.PoxPayloadIn; +import org.collectionspace.services.client.PoxPayloadOut; import org.collectionspace.services.collectionobject.CollectionobjectsCommon; import org.collectionspace.services.client.IntakeClient; @@ -75,9 +78,9 @@ public class RelationIntegrationTest extends CollectionSpaceIntegrationTest { fillCollectionObject(co, createIdentifier()); // Next, create a part object - MultipartOutput multipart = new MultipartOutput(); - OutputPart commonPart = multipart.addPart(co, MediaType.APPLICATION_XML_TYPE); - commonPart.getHeaders().add("label", collectionObjectClient.getCommonPartName()); + PoxPayloadOut multipart = new PoxPayloadOut(CollectionObjectClient.SERVICE_PAYLOAD_NAME); + PayloadOutputPart commonPart = multipart.addPart(co, MediaType.APPLICATION_XML_TYPE); + commonPart.setLabel(collectionObjectClient.getCommonPartName()); // Make the create call and check the response ClientResponse response = collectionObjectClient.create(multipart); @@ -95,9 +98,9 @@ public class RelationIntegrationTest extends CollectionSpaceIntegrationTest { IntakesCommon intake = new IntakesCommon(); fillIntake(intake, createIdentifier()); // Create the a part object - multipart = new MultipartOutput(); + multipart = new PoxPayloadOut(IntakeClient.SERVICE_PAYLOAD_NAME); commonPart = multipart.addPart(intake, MediaType.APPLICATION_XML_TYPE); - commonPart.getHeaders().add("label", intakeClient.getCommonPartName()); + commonPart.setLabel(intakeClient.getCommonPartName()); // Make the call to create and check the response response = intakeClient.create(multipart); @@ -115,9 +118,9 @@ public class RelationIntegrationTest extends CollectionSpaceIntegrationTest { intakeCsid, IntakesCommon.class.getSimpleName(), RelationshipType.COLLECTIONOBJECT_INTAKE.toString()); // Create the part and fill it with the relation object - multipart = new MultipartOutput(); + multipart = new PoxPayloadOut(RelationClient.SERVICE_PAYLOAD_NAME); commonPart = multipart.addPart(relation, MediaType.APPLICATION_XML_TYPE); - commonPart.getHeaders().add("label", relationClient.getCommonPartName()); + commonPart.setLabel(relationClient.getCommonPartName()); // Make the call to crate response = relationClient.create(multipart); @@ -159,12 +162,12 @@ public class RelationIntegrationTest extends CollectionSpaceIntegrationTest { for(RelationsCommonList.RelationListItem listItem : relationListItems){ String foundCsid = listItem.getCsid(); - ClientResponse multiPartResponse = null; + ClientResponse multiPartResponse = null; try { multiPartResponse = relationClient.read(foundCsid); int responseStatus = multiPartResponse.getStatus(); Assert.assertEquals(responseStatus, Response.Status.OK.getStatusCode()); - MultipartInput input = (MultipartInput) multiPartResponse.getEntity(); + PoxPayloadIn input = new PoxPayloadIn(multiPartResponse.getEntity()); resultRelation = (RelationsCommon) extractPart(input, relationClient.getCommonPartName(), RelationsCommon.class); diff --git a/services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/XmlReplaySelfTest.java b/services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/XmlReplaySelfTest.java index b66b1b23c..7aaac5e47 100755 --- a/services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/XmlReplaySelfTest.java +++ b/services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/XmlReplaySelfTest.java @@ -76,6 +76,7 @@ public class XmlReplaySelfTest extends XmlReplayTest { logTest(list, "runTestGroup"); } +/* @Test public void runOneTest() throws Exception { XmlReplay replay = createXmlReplay(); @@ -112,6 +113,7 @@ public class XmlReplaySelfTest extends XmlReplayTest { logTest(deleteList, "runTwoTestsManualCleanup.cleanups"); } +*/ @Test diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/dimension-master.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/dimension-master.xml index 16baa30c2..e887f2f58 100755 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/dimension-master.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/dimension-master.xml @@ -14,7 +14,9 @@ --> + diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-config.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-config.xml index b1593c58e..9d4df10a4 100755 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-config.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-config.xml @@ -52,6 +52,8 @@ value to update the object posted by a POST test. --> + + diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-master-self-test.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-master-self-test.xml index e22bc0554..8c8a79036 100755 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-master-self-test.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-master-self-test.xml @@ -9,8 +9,7 @@ YWRtaW5AY29sbGVjdGlvbnNwYWNlLm9yZzpBZG1pbmlzdHJhdG9y - - + diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-master.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-master.xml index eb4cf3d13..af2ff30ac 100755 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-master.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-master.xml @@ -20,9 +20,9 @@ When the DB is cleaned with [ant create_db import] it runs OK. --> - - - + + + diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-self-test.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-self-test.xml index e786aed4a..aee2d4022 100755 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-self-test.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-self-test.xml @@ -1,5 +1,6 @@ +