Skip to content
Snippets Groups Projects
Commit 241471ca authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Set transfer target element as string instead of list of strings again

parent c2bb5a0a
No related branches found
No related tags found
No related merge requests found
Pipeline #2160 passed
...@@ -87,7 +87,7 @@ public class Transfer { ...@@ -87,7 +87,7 @@ public class Transfer {
@XmlElement(required = true) @XmlElement(required = true)
}) })
@XmlSchemaType(name = "anyURI") @XmlSchemaType(name = "anyURI")
private List<String> target; private String target;
protected String direction; protected String direction;
protected View view; protected View view;
...@@ -110,7 +110,7 @@ public class Transfer { ...@@ -110,7 +110,7 @@ public class Transfer {
* {@link String } * {@link String }
* *
*/ */
public List<String> getTarget() { public String getTarget() {
return target; return target;
} }
...@@ -122,7 +122,7 @@ public class Transfer { ...@@ -122,7 +122,7 @@ public class Transfer {
* {@link String } * {@link String }
* *
*/ */
public void setTarget(List<String> value) { public void setTarget(String value) {
this.target = value; this.target = value;
} }
......
...@@ -63,7 +63,7 @@ public class JobSummaryTest { ...@@ -63,7 +63,7 @@ public class JobSummaryTest {
*/ */
@Test @Test
public void testDeserializeTransferServiceResponse() throws Exception { 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); MAPPER.readValue(response, JobSummary.class);
} }
...@@ -78,7 +78,7 @@ public class JobSummaryTest { ...@@ -78,7 +78,7 @@ public class JobSummaryTest {
Transfer transfer = new Transfer(); Transfer transfer = new Transfer();
transfer.setVersion("2.1"); transfer.setVersion("2.1");
transfer.setTarget(Arrays.asList("vos://example.com!vospace/mydata1")); transfer.setTarget("vos://example.com!vospace/mydata1");
transfer.setDirection("pullFromVoSpace"); transfer.setDirection("pullFromVoSpace");
Protocol protocol1 = new Protocol(); Protocol protocol1 = new Protocol();
protocol1.setUri("ivo://ivoa.net/vospace/core#httpget"); protocol1.setUri("ivo://ivoa.net/vospace/core#httpget");
...@@ -110,7 +110,7 @@ public class JobSummaryTest { ...@@ -110,7 +110,7 @@ public class JobSummaryTest {
Transfer transfer = (Transfer) deserializedJob.getJobInfo().getAny().get(0); Transfer transfer = (Transfer) deserializedJob.getJobInfo().getAny().get(0);
assertEquals("2.1", transfer.getVersion()); assertEquals("2.1", transfer.getVersion());
assertEquals("pullFromVoSpace", transfer.getDirection()); 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); Protocol protocol = transfer.getProtocols().get(0);
assertEquals("ivo://ivoa.net/vospace/core#httpget", protocol.getUri()); assertEquals("ivo://ivoa.net/vospace/core#httpget", protocol.getUri());
......
...@@ -26,21 +26,7 @@ public class TransferTest { ...@@ -26,21 +26,7 @@ public class TransferTest {
public void testSingleTarget() throws Exception { public void testSingleTarget() throws Exception {
Transfer transfer = getBaseTransfer(); Transfer transfer = getBaseTransfer();
transfer.setTarget(Arrays.asList(URI_PREFIX + "/mynode")); transfer.setTarget(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 {
String xml; String xml;
try ( StringWriter sw = new StringWriter()) { try ( StringWriter sw = new StringWriter()) {
...@@ -80,7 +66,7 @@ public class TransferTest { ...@@ -80,7 +66,7 @@ public class TransferTest {
private void verifyTransfersAreEquals(Transfer serialized, Transfer deserialized) { 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.getDirection(), deserialized.getDirection());
assertEquals(serialized.getProtocols().size(), deserialized.getProtocols().size()); assertEquals(serialized.getProtocols().size(), deserialized.getProtocols().size());
assertEquals(serialized.getParam().size(), deserialized.getParam().size()); assertEquals(serialized.getParam().size(), deserialized.getParam().size());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment