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
Loading
Loading
Loading
Loading
Loading
+37 −1
Original line number Original line Diff line number Diff line
@@ -69,7 +69,8 @@ import javax.xml.bind.annotation.XmlType;
    "direction",
    "direction",
    "view",
    "view",
    "protocols",
    "protocols",
    "keepBytes"
    "keepBytes",
    "param"
})
})
// <edit>
// <edit>
@XmlRootElement
@XmlRootElement
@@ -88,6 +89,9 @@ public class Transfer {
    @XmlAttribute
    @XmlAttribute
    protected String version;
    protected String version;
    // </edit>
    // </edit>
    // <edit> Fix: param is missing in VOSpace XSD
    @XmlElement(nillable = true)
    protected List<Param> param;


    /**
    /**
     * Gets the value of the target property.
     * Gets the value of the target property.
@@ -224,4 +228,36 @@ public class Transfer {
    }
    }
    // </edit>
    // </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>
    

}
}
+11 −1
Original line number Original line Diff line number Diff line
package net.ivoa.xml.vospace.v2;
package net.ivoa.xml.vospace.v2;


import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import it.inaf.oats.vospace.datamodel.NodeProperties;
import java.io.StringReader;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.StringWriter;
import javax.xml.bind.JAXB;
import javax.xml.bind.JAXB;
@@ -45,6 +46,12 @@ public class TransferTest {


        transfer.getProtocols().add(protocol);
        transfer.getProtocols().add(protocol);
        
        
        Param groupWriteParam = new Param();
        groupWriteParam.setUri(NodeProperties.GROUP_WRITE_URI);
        groupWriteParam.setValue("group1 group2");
        
        transfer.getParam().add(groupWriteParam);

        return transfer;
        return transfer;
    }
    }


@@ -53,6 +60,9 @@ public class TransferTest {
        assertEquals(serialized.getTarget(), deserialized.getTarget());
        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.getProtocols().get(0).getEndpoint(), deserialized.getProtocols().get(0).getEndpoint());
        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());
    }
    }
}
}