From 241471ca52edf681b576f32b9b20595742564d24 Mon Sep 17 00:00:00 2001
From: Sonia Zorba <sonia.zorba@inaf.it>
Date: Wed, 28 Jul 2021 15:24:36 +0200
Subject: [PATCH] Set transfer target element as string instead of list of
 strings again

---
 .../java/net/ivoa/xml/vospace/v2/Transfer.java |  6 +++---
 .../net/ivoa/xml/uws/v1/JobSummaryTest.java    |  6 +++---
 .../net/ivoa/xml/vospace/v2/TransferTest.java  | 18 ++----------------
 3 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/src/main/java/net/ivoa/xml/vospace/v2/Transfer.java b/src/main/java/net/ivoa/xml/vospace/v2/Transfer.java
index d85c6ad..7fad3f0 100644
--- a/src/main/java/net/ivoa/xml/vospace/v2/Transfer.java
+++ b/src/main/java/net/ivoa/xml/vospace/v2/Transfer.java
@@ -87,7 +87,7 @@ public class Transfer {
         @XmlElement(required = true)
     })
     @XmlSchemaType(name = "anyURI")
-    private List<String> target;
+    private String target;
 
     protected String direction;
     protected View view;
@@ -110,7 +110,7 @@ public class Transfer {
      *     {@link String }
      *     
      */
-    public List<String> getTarget() {
+    public String getTarget() {
         return target;
     }
 
@@ -122,7 +122,7 @@ public class Transfer {
      *     {@link String }
      *     
      */
-    public void setTarget(List<String> value) {
+    public void setTarget(String value) {
         this.target = value;
     }
 
diff --git a/src/test/java/net/ivoa/xml/uws/v1/JobSummaryTest.java b/src/test/java/net/ivoa/xml/uws/v1/JobSummaryTest.java
index 6d87f6f..0422036 100644
--- a/src/test/java/net/ivoa/xml/uws/v1/JobSummaryTest.java
+++ b/src/test/java/net/ivoa/xml/uws/v1/JobSummaryTest.java
@@ -63,7 +63,7 @@ public class JobSummaryTest {
      */
     @Test
     public void testDeserializeTransferServiceResponse() throws Exception {
-        String response = "{\"jobId\": \"917c784f814c4a1a91a9d5d1af07dbe9\", \"ownerId\": \"2386\", \"jobType\": \"pullToVoSpace\", \"phase\": \"PENDING\", \"startTime\": null, \"endTime\": null, \"creationTime\": \"2021-02-03T15:05:57.233602\", \"jobInfo\": {\"transfer\": {\"view\": null, \"target\": [\"vos://example.com!vospace/szorba/aaa\"], \"version\": null, \"direction\": \"pullToVoSpace\", \"keepBytes\": null, \"protocols\": [{\"uri\": \"ia2:async-recall\", \"endpoint\": null}]}}, \"results\": null}";
+        String response = "{\"jobId\": \"917c784f814c4a1a91a9d5d1af07dbe9\", \"ownerId\": \"2386\", \"jobType\": \"pullToVoSpace\", \"phase\": \"PENDING\", \"startTime\": null, \"endTime\": null, \"creationTime\": \"2021-02-03T15:05:57.233602\", \"jobInfo\": {\"transfer\": {\"view\": null, \"target\": \"vos://example.com!vospace/user/aaa\", \"version\": null, \"direction\": \"pullToVoSpace\", \"keepBytes\": null, \"protocols\": [], \"view\": {\"uri\": \"ivo://ia2.inaf.it/vospace/views#async-recall\"}}}, \"results\": null}";
         MAPPER.readValue(response, JobSummary.class);
     }
 
@@ -78,7 +78,7 @@ public class JobSummaryTest {
 
         Transfer transfer = new Transfer();
         transfer.setVersion("2.1");
-        transfer.setTarget(Arrays.asList("vos://example.com!vospace/mydata1"));
+        transfer.setTarget("vos://example.com!vospace/mydata1");
         transfer.setDirection("pullFromVoSpace");
         Protocol protocol1 = new Protocol();
         protocol1.setUri("ivo://ivoa.net/vospace/core#httpget");
@@ -110,7 +110,7 @@ public class JobSummaryTest {
         Transfer transfer = (Transfer) deserializedJob.getJobInfo().getAny().get(0);
         assertEquals("2.1", transfer.getVersion());
         assertEquals("pullFromVoSpace", transfer.getDirection());
-        assertArrayEquals(new String[]{"vos://example.com!vospace/mydata1"}, transfer.getTarget().toArray(String[]::new));
+        assertEquals("vos://example.com!vospace/mydata1", transfer.getTarget());
 
         Protocol protocol = transfer.getProtocols().get(0);
         assertEquals("ivo://ivoa.net/vospace/core#httpget", protocol.getUri());
diff --git a/src/test/java/net/ivoa/xml/vospace/v2/TransferTest.java b/src/test/java/net/ivoa/xml/vospace/v2/TransferTest.java
index 4f4af51..80fdc2f 100644
--- a/src/test/java/net/ivoa/xml/vospace/v2/TransferTest.java
+++ b/src/test/java/net/ivoa/xml/vospace/v2/TransferTest.java
@@ -26,21 +26,7 @@ public class TransferTest {
     public void testSingleTarget() throws Exception {
 
         Transfer transfer = getBaseTransfer();
-        transfer.setTarget(Arrays.asList(URI_PREFIX + "/mynode"));
-
-        testXmlSerialization(transfer);
-    }
-
-    @Test
-    public void testMultipleTargets() throws Exception {
-
-        Transfer transfer = getBaseTransfer();
-        transfer.setTarget(Arrays.asList(URI_PREFIX + "/mynode1", URI_PREFIX + "/mynode2"));
-
-        testXmlSerialization(transfer);
-    }
-
-    private void testXmlSerialization(Transfer transfer) throws Exception {
+        transfer.setTarget(URI_PREFIX + "/mynode");
 
         String xml;
         try ( StringWriter sw = new StringWriter()) {
@@ -80,7 +66,7 @@ public class TransferTest {
 
     private void verifyTransfersAreEquals(Transfer serialized, Transfer deserialized) {
 
-        assertArrayEquals(serialized.getTarget().toArray(String[]::new), deserialized.getTarget().toArray(String[]::new));
+        assertEquals(serialized.getTarget(), deserialized.getTarget());
         assertEquals(serialized.getDirection(), deserialized.getDirection());
         assertEquals(serialized.getProtocols().size(), deserialized.getProtocols().size());
         assertEquals(serialized.getParam().size(), deserialized.getParam().size());
-- 
GitLab