use of org.geotoolkit.sml.xml.v101.DataDefinition in project geotoolkit by Geomatys.
the class SmlXMLBindingTest method DataSourceMarshalingTest.
@Test
public void DataSourceMarshalingTest() throws Exception {
final SystemType system = new SystemType();
final List<DataComponentPropertyType> fields = new ArrayList<>();
fields.add(DataComponentPropertyType.LATITUDE_FIELD);
fields.add(DataComponentPropertyType.LONGITUDE_FIELD);
fields.add(DataComponentPropertyType.TIME_FIELD);
final DataRecordType posRecord = new DataRecordType(null, fields);
final DataBlockDefinitionType definition = new DataBlockDefinitionType(null, Arrays.asList(posRecord), TextBlockType.DEFAULT_ENCODING);
final DataDefinition dataDefinition = new DataDefinition(definition);
final org.geotoolkit.sml.xml.v101.Values trajValues = new org.geotoolkit.sml.xml.v101.Values();
trajValues.setAny("test");
final DataSourceType datasource = new DataSourceType(dataDefinition, trajValues, null);
final Position pos = new Position(null, datasource);
system.setPosition(pos);
DataSourceType expds = (DataSourceType) pos.getAbstractProcess();
DataSourceType resds = (DataSourceType) system.getPosition().getAbstractProcess();
assertEquals(expds.getDataDefinition(), resds.getDataDefinition());
assertEquals(expds, resds);
assertEquals(pos.getAbstractProcess(), system.getPosition().getAbstractProcess());
assertEquals(pos.getPosition(), system.getPosition().getPosition());
assertEquals(pos, system.getPosition());
final SensorML sml = new SensorML("1.0.1", Arrays.asList(new SensorML.Member(system)));
Marshaller m = SensorMLMarshallerPool.getInstance().acquireMarshaller();
ObjectFactory factory = new ObjectFactory();
// m.marshal(factory.createPosition(pos), System.out);
// m.marshal(factory.createSystem(system), System.out);
// m.marshal(sml, System.out);
SensorMLMarshallerPool.getInstance().recycle(m);
}
Aggregations