Commit 2007e86b authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Allowed unknown JSON properties in JobSummary

parent af9345e9
Pipeline #962 passed with stages
in 31 seconds
......@@ -8,6 +8,7 @@
package net.ivoa.xml.uws.v1;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import it.inaf.oats.vospace.datamodel.JobInfoDeserializer;
......@@ -20,7 +21,6 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
......@@ -98,6 +98,7 @@ import org.w3c.dom.Element;
// <edit>
@XmlSeeAlso({Transfer.class}) // Necessary for setting a Transfer inside the jobInfo property.
@XmlRootElement(name = "job")
@JsonIgnoreProperties(ignoreUnknown = true)
// </edit>
public class JobSummary {
......
......@@ -52,6 +52,15 @@ public class JobSummaryTest {
verifyJobsAreEquals(deserialized);
}
/**
* Uses JSON extracted from real job executed by transfer service. Contains extra field jobType.
*/
@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\", \"param\": [{\"uri\": \"ia2:node-type\", \"value\": \"single\"}], \"endpoint\": null}]}}, \"results\": null}";
MAPPER.readValue(response, JobSummary.class);
}
private JobSummary getJobSummary() {
JobSummary job = new JobSummary();
......
Supports Markdown
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