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 d85c6ad3ca0467473206c7870152932ebbff6d91..7fad3f07c2514c666ed27aa83143554bea26885b 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 6d87f6f6d97225ce23096463e4e3fbf180d8212c..04220363e21346667c89d0f298b8eee52c8d803a 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 4f4af5187ccba4af1e05d173eabacddbefffa83b..80fdc2f5472bb3e9579491f470ce7fada345052c 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());