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 {
@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;
}
......
......@@ -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());
......
......@@ -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());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment