Commit d8c0ecf6 authored by Nicola Fulvio Calabria's avatar Nicola Fulvio Calabria
Browse files

Added support to param list in Transfer representation + tests

parent f70095c4
Pipeline #1321 passed with stages
in 32 seconds
......@@ -69,7 +69,8 @@ import javax.xml.bind.annotation.XmlType;
"direction",
"view",
"protocols",
"keepBytes"
"keepBytes",
"param"
})
// <edit>
@XmlRootElement
......@@ -88,6 +89,9 @@ public class Transfer {
@XmlAttribute
protected String version;
// </edit>
// <edit> Fix: param is missing in VOSpace XSD
@XmlElement(nillable = true)
protected List<Param> param;
/**
* Gets the value of the target property.
......@@ -223,5 +227,37 @@ public class Transfer {
this.version = version;
}
// </edit>
// <edit>
/**
* Gets the value of the param property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the param property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getParam().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Param }
*
*
*/
public List<Param> getParam() {
if (param == null) {
param = new ArrayList<Param>();
}
return this.param;
}
// </edit>
}
package net.ivoa.xml.vospace.v2;
import com.fasterxml.jackson.databind.ObjectMapper;
import it.inaf.oats.vospace.datamodel.NodeProperties;
import java.io.StringReader;
import java.io.StringWriter;
import javax.xml.bind.JAXB;
......@@ -37,13 +38,19 @@ public class TransferTest {
Transfer transfer = new Transfer();
transfer.setTarget(URI_PREFIX + "/mynode");
transfer.setDirection("pullFromVoSpace");
transfer.setDirection("pullFromVoSpace");
Protocol protocol = new Protocol();
protocol.setUri("ivo://ivoa.net/vospace/core#httpget");
protocol.setEndpoint("http://ia2.inaf.it/data?param1=value1&param2=value2");
transfer.getProtocols().add(protocol);
Param groupWriteParam = new Param();
groupWriteParam.setUri(NodeProperties.GROUP_WRITE_URI);
groupWriteParam.setValue("group1 group2");
transfer.getParam().add(groupWriteParam);
return transfer;
}
......@@ -53,6 +60,9 @@ public class TransferTest {
assertEquals(serialized.getTarget(), deserialized.getTarget());
assertEquals(serialized.getDirection(), deserialized.getDirection());
assertEquals(serialized.getProtocols().size(), deserialized.getProtocols().size());
assertEquals(serialized.getParam().size(), deserialized.getParam().size());
assertEquals(serialized.getProtocols().get(0).getEndpoint(), deserialized.getProtocols().get(0).getEndpoint());
assertEquals(serialized.getParam().get(0).getUri(), deserialized.getParam().get(0).getUri());
assertEquals(serialized.getParam().get(0).getValue(), deserialized.getParam().get(0).getValue());
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment