]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-1030: Ensure that Contact common part label is set correctly, when populating...
authorAron Roberts <aron@socrates.berkeley.edu>
Fri, 19 Feb 2010 18:45:18 +0000 (18:45 +0000)
committerAron Roberts <aron@socrates.berkeley.edu>
Fri, 19 Feb 2010 18:45:18 +0000 (18:45 +0000)
services/contact/client/src/main/java/org/collectionspace/services/client/ContactClientUtils.java
services/contact/client/src/test/java/org/collectionspace/services/client/test/ContactServiceTest.java

index 39c851ecbf387e2b81a04e3a3c5c15d643d62af1..30c2d3182b3bb4f5744fd24a9d5d7deceee154c5 100644 (file)
@@ -11,10 +11,11 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class ContactClientUtils {
+
     private static final Logger logger =
         LoggerFactory.getLogger(ContactClientUtils.class);
 
-    public static MultipartOutput createContactInstance(String identifier) {
+    public static MultipartOutput createContactInstance(String identifier, String headerLabel) {
         String inAuthority = "";
         String inItem = "";
         return createContactInstance(
@@ -22,22 +23,24 @@ public class ContactClientUtils {
             inItem,
             "addressText1-" + identifier,
             "postcode-" + identifier,
-            "addressType1-" + identifier);
+            "addressType1-" + identifier,
+            headerLabel);
     }
 
     public static MultipartOutput createContactInstance(
-        String inAuthority, String inItem, String identifier) {
+        String inAuthority, String inItem, String identifier, String headerLabel) {
         return createContactInstance(
             inAuthority,
             inItem,
             "addressText1-" + identifier,
             "postcode-" + identifier,
-            "addressType1-" + identifier);
+            "addressType1-" + identifier,
+            headerLabel);
     }
 
     public static MultipartOutput createContactInstance(
         String inAuthority, String inItem, String addressText,
-        String postcode, String addressType) {
+        String postcode, String addressType, String headerLabel) {
         ContactsCommon contact = new ContactsCommon();
         contact.setInAuthority(inAuthority);
         contact.setInItem(inItem);
@@ -48,7 +51,7 @@ public class ContactClientUtils {
         OutputPart commonPart =
             multipart.addPart(contact, MediaType.APPLICATION_XML_TYPE);
         ContactClient client = new ContactClient();
-        commonPart.getHeaders().add("label", client.getCommonPartName());
+        commonPart.getHeaders().add("label", headerLabel);
 
         if(logger.isDebugEnabled()){
             logger.debug("to be created, contact common");
index f36b281224c7c0812f0998e3e9d20e08013a1aca..91b5e6fa2bceaf4ef7c0ed367395170abbc718ba 100644 (file)
@@ -78,7 +78,8 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
         // Submit the request to the service and store the response.
         String identifier = createIdentifier();
 
-        MultipartOutput multipart = ContactClientUtils.createContactInstance(identifier);
+        MultipartOutput multipart =
+            ContactClientUtils.createContactInstance(identifier, client.getCommonPartName());
         ClientResponse<Response> res = client.create(multipart);
 
         int statusCode = res.getStatus();
@@ -483,7 +484,8 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
         // The only relevant ID may be the one used in update(), below.
 
         // The only relevant ID may be the one used in update(), below.
-        MultipartOutput multipart = ContactClientUtils.createContactInstance(NON_EXISTENT_ID);
+        MultipartOutput multipart =
+                ContactClientUtils.createContactInstance(NON_EXISTENT_ID, client.getCommonPartName());
         ClientResponse<MultipartInput> res =
                 client.update(NON_EXISTENT_ID, multipart);
         int statusCode = res.getStatus();