]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-2933: Added client tests for repeatable currentLocation group in Intake servic...
authorAron Roberts <aron@socrates.berkeley.edu>
Thu, 11 Nov 2010 06:30:30 +0000 (06:30 +0000)
committerAron Roberts <aron@socrates.berkeley.edu>
Thu, 11 Nov 2010 06:30:30 +0000 (06:30 +0000)
services/intake/3rdparty/nuxeo-platform-cs-intake/src/main/resources/schemas/intakes_common.xsd
services/intake/client/src/test/java/org/collectionspace/services/client/test/IntakeServiceTest.java
services/intake/jaxb/src/main/resources/intakes-common.xsd

index 39ef60777ed4b75555bd7eb5b4d50068938d1680..8f8b62f249153732db1169425dbdc190de941ac5 100644 (file)
@@ -92,7 +92,7 @@
     \r
     <!-- Object Location Information Group -->\r
 \r
-    <xs:element name="currentLocationList" type="currentLocationList"/>\r
+    <xs:element name="currentLocationGroupList" type="currentLocationGroupList"/>\r
 \r
     <xs:element name="locationDate" type="xs:string"/>\r
     <xs:element name="normalLocation" type="xs:string"/>\r
         </xs:complexType>\r
     </xs:element>\r
 \r
-    <xs:complexType name="currentLocationList">\r
+    <xs:complexType name="currentLocationGroupList">\r
         <xs:sequence>\r
             <xs:element name="currentLocationGroup" type="currentLocationGroup" minOccurs="0" maxOccurs="unbounded"/>\r
         </xs:sequence>\r
index cbce6264073c407378cc96d73016d4a2a7ab997e..f53896fec7d342418a0bcccbecf872770b488c41 100644 (file)
@@ -30,6 +30,8 @@ import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.IntakeClient;
 import org.collectionspace.services.intake.EntryMethodList;
 import org.collectionspace.services.intake.FieldCollectionEventNameList;
+import org.collectionspace.services.intake.CurrentLocationGroup;
+import org.collectionspace.services.intake.CurrentLocationGroupList;
 import org.collectionspace.services.intake.IntakesCommon;
 import org.collectionspace.services.intake.IntakesCommonList;
 import org.collectionspace.services.jaxb.AbstractCommonList;
@@ -313,6 +315,15 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
                 intake.getFieldCollectionEventNames().getFieldCollectionEventName();
         Assert.assertTrue(fieldCollectionEventNames.size() > 0);
         Assert.assertNotNull(fieldCollectionEventNames.get(0));
+
+        CurrentLocationGroupList currentLocationGroupList = intake.getCurrentLocationGroupList();
+        Assert.assertNotNull(currentLocationGroupList);
+        List<CurrentLocationGroup> currentLocationGroups = currentLocationGroupList.getCurrentLocationGroup();
+        Assert.assertNotNull(currentLocationGroups);
+        Assert.assertTrue(currentLocationGroups.size() > 0);
+        CurrentLocationGroup currentLocationGroup = currentLocationGroups.get(0);
+        Assert.assertNotNull(currentLocationGroup);
+        Assert.assertNotNull(currentLocationGroup.getCurrentLocationNote());
     }
 
     // Failure outcomes
@@ -434,7 +445,6 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
                 client.getCommonPartName(), IntakesCommon.class);
         Assert.assertNotNull(intake);
 
-        // Update the content of this resource.
         // Update the content of this resource.
         intake.setEntryNumber("updated-" + intake.getEntryNumber());
         intake.setEntryDate("updated-" + intake.getEntryDate());
@@ -442,6 +452,20 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
             logger.debug("to be updated object");
             logger.debug(objectAsXmlString(intake, IntakesCommon.class));
         }
+
+        CurrentLocationGroupList currentLocationGroupList = intake.getCurrentLocationGroupList();
+        Assert.assertNotNull(currentLocationGroupList);
+        List<CurrentLocationGroup> currentLocationGroups = currentLocationGroupList.getCurrentLocationGroup();
+        Assert.assertNotNull(currentLocationGroups);
+        Assert.assertTrue(currentLocationGroups.size() > 0);
+        CurrentLocationGroup currentLocationGroup = currentLocationGroups.get(0);
+        Assert.assertNotNull(currentLocationGroup);
+        String currentLocationNote = currentLocationGroup.getCurrentLocationNote();
+        Assert.assertNotNull(currentLocationNote);
+        String updatedCurrentLocationNote = "updated-" + currentLocationNote;
+        currentLocationGroups.get(0).setCurrentLocationNote(updatedCurrentLocationNote);
+        intake.setCurrentLocationGroupList(currentLocationGroupList);
+
         // Submit the request to the service and store the response.
         MultipartOutput output = new MultipartOutput();
         OutputPart commonPart = output.addPart(intake, MediaType.APPLICATION_XML_TYPE);
@@ -457,17 +481,27 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
 
-
         input = (MultipartInput) res.getEntity();
         IntakesCommon updatedIntake =
                 (IntakesCommon) extractPart(input,
                         client.getCommonPartName(), IntakesCommon.class);
+
         Assert.assertNotNull(updatedIntake);
 
         Assert.assertEquals(updatedIntake.getEntryDate(),
                 intake.getEntryDate(),
                 "Data in updated object did not match submitted data.");
 
+        currentLocationGroupList = updatedIntake.getCurrentLocationGroupList();
+        Assert.assertNotNull(currentLocationGroupList);
+        currentLocationGroups = currentLocationGroupList.getCurrentLocationGroup();
+        Assert.assertNotNull(currentLocationGroups);
+        Assert.assertTrue(currentLocationGroups.size() > 0);
+        Assert.assertNotNull(currentLocationGroups.get(0));
+        Assert.assertEquals(updatedCurrentLocationNote,
+                currentLocationGroups.get(0).getCurrentLocationNote(),
+                "Data in updated object did not match submitted data.");
+
     }
 
     // Failure outcomes
@@ -764,6 +798,15 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
         eventNames.add("Field Collection Event Name-2");
         intake.setFieldCollectionEventNames(eventNamesList);
 
+        CurrentLocationGroupList currentLocationGroupList = new CurrentLocationGroupList();
+        List<CurrentLocationGroup> currentLocationGroups = currentLocationGroupList.getCurrentLocationGroup();
+        CurrentLocationGroup currentLocationGroup = new CurrentLocationGroup();
+        currentLocationGroup.setCurrentLocation("upstairs");
+        currentLocationGroup.setCurrentLocationFitness("suitable");
+        currentLocationGroup.setCurrentLocationNote("A most suitable location.");
+        currentLocationGroups.add(currentLocationGroup);
+        intake.setCurrentLocationGroupList(currentLocationGroupList);
+
         MultipartOutput multipart = new MultipartOutput();
         OutputPart commonPart =
             multipart.addPart(intake, MediaType.APPLICATION_XML_TYPE);
index 4a8f70569a72b6a8f78f65d84194254d8c9d460e..fe567f4bba5ba13d563d039ba8672db22b851c03 100644 (file)
@@ -67,7 +67,7 @@
                 <xs:element name="insurers" type="insurerList"/>
 
                 <!-- Object Location Information Group -->
-                <xs:element name="currentLocationList" type="currentLocationList"/>
+                <xs:element name="currentLocationGroupList" type="currentLocationGroupList"/>
                 <xs:element name="locationDate" type="xs:string"/>
                 <xs:element name="normalLocation" type="xs:string"/>
 
         </xs:sequence>
     </xs:complexType>
 
-    <xs:complexType name="currentLocationList">
+    <xs:complexType name="currentLocationGroupList">
         <xs:sequence>
             <xs:element name="currentLocationGroup" type="currentLocationGroup" minOccurs="0" maxOccurs="unbounded"/>
         </xs:sequence>