added action field and output field as optional

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-analysis/dataminer-invocation-model@174676 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2018-12-07 16:18:02 +00:00
parent c3cb701438
commit 8a4dd97789
5 changed files with 49 additions and 17 deletions

View File

@ -9,6 +9,7 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import lombok.AllArgsConstructor;
import lombok.Getter;
@ -39,6 +40,7 @@ public class DataMinerInvocation implements Serializable{
private String operatorId;
@XmlElement(name = "action")
@XmlTransient
private ActionType actionType = ActionType.RUN;
@XmlElement(name = "parameters")

View File

@ -9,6 +9,7 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import lombok.AllArgsConstructor;
import lombok.Getter;
@ -40,6 +41,7 @@ public class DataMinerParameters implements Serializable{
@XmlElement(name = "input")
private DataMinerInputParams input;
@XmlElement(name = "output")
@XmlTransient
private DataMinerOutputParams output;
}

View File

@ -22,7 +22,6 @@ import org.gcube.data.analysis.dminvocation.model.DataMinerOutputParams;
import org.gcube.data.analysis.dminvocation.model.DataMinerParam;
import org.gcube.data.analysis.dminvocation.model.DataMinerParameters;
import org.junit.Before;
import org.junit.Test;
/**
@ -44,7 +43,7 @@ public class DataMinerInvocationTest {
}
@Test
//@Test
public void marshallingTest() throws JAXBException {
//LOADING PARAMETERS
@ -69,10 +68,22 @@ public class DataMinerInvocationTest {
System.out.println(new String(outStreamXML.toByteArray()));
}
@Test
//@Test
public void unmarshallingXMLTest() throws JAXBException, FileNotFoundException{
FileInputStream dmInvocationXMLFile = new FileInputStream(new File("./src/test/resources/DataMinerInvocation.xml"));
DataMinerInvocation dmInvocation = DataMinerInvocationManager.unmarshaling(dmInvocationXMLFile, MediaType.ApplicationXML);
System.out.println(dmInvocation);
ByteArrayOutputStream outStreamJSON = DataMinerInvocationManager.marshaling(dmInvocation, MediaType.ApplicationJSON);
System.out.println(new String(outStreamJSON.toByteArray()));
}
//@Test
public void unmarshallingJSONTest() throws JAXBException, FileNotFoundException{
FileInputStream dmInvocationXMLFile = new FileInputStream(new File("./src/test/resources/DataMinerInvocation.json"));
DataMinerInvocation dmInvocation = DataMinerInvocationManager.unmarshaling(dmInvocationXMLFile, MediaType.ApplicationJSON);
System.out.println(dmInvocation);
}
}

View File

@ -0,0 +1,16 @@
{
"dataminer-invocation" : {
"operator-id" : "org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.MPA_INTERSECT",
"parameters" : {
"input" : {
"param" : [ {
"key" : "fileId",
"value" : "http://publicLinkToFile"
}, {
"key" : "param2",
"value" : "value2"
} ]
}
}
}
}

View File

@ -1,16 +1,17 @@
<dataminer-invocation>
<operator-id>THE_OPERATOR_ID</operator-id>
<parameters>
<input>
<param>
<key>key1</key>
<value>value1</value>
</param>
<param>
<key>key2</key>
<value>value2</value>
</param>
</input>
<output/>
</parameters>
<operator-id>org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.MPA_INTERSECT</operator-id>
<action>RUN</action>
<parameters>
<input>
<param>
<key>fileId</key>
<value>http://publicLinkToFile</value>
</param>
<param>
<key>param2</key>
<value>value2</value>
</param>
</input>
<output/>
</parameters>
</dataminer-invocation>