use of org.geotoolkit.sml.xml.v100.ProcessMethodType in project geotoolkit by Geomatys.
the class SmlXMLBindingTest method marshallMarshalingTest.
/**
* Test simple Record Marshalling.
*
* @throws java.lang.Exception
*/
@Test
public void marshallMarshalingTest() throws Exception {
ObjectFactory factory = new ObjectFactory();
List<DataComponentPropertyType> fields = new ArrayList<DataComponentPropertyType>();
TimeType time = new TimeType("urn:x-ogc:def:phenomenon:observationTime", new UomPropertyType(null, "urn:x-ogc:def:unit:ISO8601"));
fields.add(new DataComponentPropertyType("time", null, time));
QuantityType q = new QuantityType("urn:x-ogc:def:phenomenon:OGC:depth", new UomPropertyType("m", null), null);
fields.add(new DataComponentPropertyType("depth", null, q));
BooleanType b = new BooleanType("urn:x-ogc:def:phenomenon:BRGM:validity", null);
fields.add(new DataComponentPropertyType("validity", null, b));
DataRecordType outRecord = new DataRecordType(null, fields);
IoComponentPropertyType io2 = new IoComponentPropertyType("piezoMeasurements", swe100Factory.createDataRecord(outRecord));
OutputList outputList = new OutputList(Arrays.asList(io2));
Outputs outputs = new Outputs(outputList);
Marshaller marshaller = SensorMLMarshallerPool.getInstance().acquireMarshaller();
StringWriter sw = new StringWriter();
marshaller.marshal(outputs, sw);
String result = sw.toString();
// System.out.println("result:" + result);
ComponentType component = new ComponentType();
ProcessMethodType process = new ProcessMethodType();
component.setMethod(new MethodPropertyType(process));
List<ComponentPropertyType> cpl = new ArrayList<ComponentPropertyType>();
ComponentList cl = new ComponentList(cpl);
sw = new StringWriter();
marshaller.marshal(factory.createComponent(component), sw);
result = sw.toString();
// System.out.println("result:" + result);
SensorMLMarshallerPool.getInstance().recycle(marshaller);
}
Aggregations