use of org.n52.svalbard.decode.SensorMLDecoderV101 in project arctic-sea by 52North.
the class BatchRequestDecodingTest method before.
@Before
public void before() throws DecodingException {
DecoderRepository decoderRepository = new DecoderRepository();
this.decoder = new BatchRequestDecoder();
this.decoder.setDecoderRepository(decoderRepository);
InsertSensorRequestDecoder insertSensorRequestDecoder = new InsertSensorRequestDecoder();
insertSensorRequestDecoder.setDecoderRepository(decoderRepository);
InsertObservationRequestDecoder insertObservationRequestDecoder = new InsertObservationRequestDecoder();
insertObservationRequestDecoder.setDecoderRepository(decoderRepository);
SensorMLDecoderV101 sensorMLDecoder = new SensorMLDecoderV101();
sensorMLDecoder.setXmlOptions(XmlOptions::new);
sensorMLDecoder.setDecoderRepository(decoderRepository);
SweCommonDecoderV101 sweCommonDecoder = new SweCommonDecoderV101();
sweCommonDecoder.setXmlOptions(XmlOptions::new);
sweCommonDecoder.setDecoderRepository(decoderRepository);
GmlDecoderv311 gmlDecoderv311 = new GmlDecoderv311();
ObservationDecoder observationDecoder = new ObservationDecoder();
observationDecoder.setDecoderRepository(decoderRepository);
InsertResultTemplateRequestDecoder insertResultTemplateRequestDecoder = new InsertResultTemplateRequestDecoder();
insertResultTemplateRequestDecoder.setDecoderRepository(decoderRepository);
InsertResultRequestDecoder insertResultRequestDecoder = new InsertResultRequestDecoder();
insertResultRequestDecoder.setDecoderRepository(decoderRepository);
FieldDecoder fieldDecoder = new FieldDecoder();
fieldDecoder.setDecoderRepository(decoderRepository);
decoderRepository.setDecoders(Arrays.asList(decoder, insertSensorRequestDecoder, insertObservationRequestDecoder, insertResultTemplateRequestDecoder, insertResultRequestDecoder, sensorMLDecoder, sweCommonDecoder, observationDecoder, fieldDecoder, gmlDecoderv311));
decoderRepository.init();
this.request = decoder.decodeJSON(json, true);
}
use of org.n52.svalbard.decode.SensorMLDecoderV101 in project arctic-sea by 52North.
the class SensorMLDecoderV101Test method decodeAbstractProcess.
private AbstractProcess decodeAbstractProcess(SensorMLDocument xbSmlDoc) throws DecodingException {
// FIXME
// Object decoded = CodingHelper.decodeXmlObject(xbSmlDoc);
Object decoded = sensorMLDecoderV101.decode(xbSmlDoc);
assertThat(decoded, instanceOf(SensorML.class));
SensorML sml = (SensorML) decoded;
assertThat(sml.getMembers().size(), is(1));
return sml.getMembers().get(0);
}
use of org.n52.svalbard.decode.SensorMLDecoderV101 in project arctic-sea by 52North.
the class InsertSensorRequestDecoderTest method setUp.
@Before
public void setUp() throws DecodingException, IOException {
DecoderRepository decoderRepository = new DecoderRepository();
this.decoder = new InsertSensorRequestDecoder();
this.decoder.setDecoderRepository(decoderRepository);
SensorMLDecoderV101 sensorMLDecoder = new SensorMLDecoderV101();
sensorMLDecoder.setXmlOptions(XmlOptions::new);
sensorMLDecoder.setDecoderRepository(decoderRepository);
SweCommonDecoderV101 sweCommonDecoder = new SweCommonDecoderV101();
sweCommonDecoder.setXmlOptions(XmlOptions::new);
sweCommonDecoder.setDecoderRepository(decoderRepository);
GmlDecoderv311 gmlDecoderv311 = new GmlDecoderv311();
decoderRepository.setDecoders(Arrays.asList(decoder, sensorMLDecoder, sweCommonDecoder, gmlDecoderv311));
decoderRepository.init();
final JsonNode json = JsonLoader.fromResource("/examples/sos/InsertSensorRequest.json");
this.req = decoder.decode(json);
assertThat(req, is(notNullValue()));
}
Aggregations