Search in sources :

Example 1 with SensorMLDecoderV101

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);
}
Also used : InsertResultTemplateRequestDecoder(org.n52.svalbard.decode.json.InsertResultTemplateRequestDecoder) SensorMLDecoderV101(org.n52.svalbard.decode.SensorMLDecoderV101) BatchRequestDecoder(org.n52.svalbard.decode.json.BatchRequestDecoder) SweCommonDecoderV101(org.n52.svalbard.decode.SweCommonDecoderV101) InsertResultRequestDecoder(org.n52.svalbard.decode.json.InsertResultRequestDecoder) XmlOptions(org.apache.xmlbeans.XmlOptions) ObservationDecoder(org.n52.svalbard.decode.json.ObservationDecoder) InsertSensorRequestDecoder(org.n52.svalbard.decode.json.InsertSensorRequestDecoder) InsertObservationRequestDecoder(org.n52.svalbard.decode.json.InsertObservationRequestDecoder) DecoderRepository(org.n52.svalbard.decode.DecoderRepository) FieldDecoder(org.n52.svalbard.decode.json.FieldDecoder) GmlDecoderv311(org.n52.svalbard.decode.GmlDecoderv311) Before(org.junit.Before)

Example 2 with SensorMLDecoderV101

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);
}
Also used : SensorML(org.n52.shetland.ogc.sensorML.SensorML)

Example 3 with SensorMLDecoderV101

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()));
}
Also used : SensorMLDecoderV101(org.n52.svalbard.decode.SensorMLDecoderV101) SweCommonDecoderV101(org.n52.svalbard.decode.SweCommonDecoderV101) XmlOptions(org.apache.xmlbeans.XmlOptions) InsertSensorRequestDecoder(org.n52.svalbard.decode.json.InsertSensorRequestDecoder) JsonNode(com.fasterxml.jackson.databind.JsonNode) DecoderRepository(org.n52.svalbard.decode.DecoderRepository) GmlDecoderv311(org.n52.svalbard.decode.GmlDecoderv311) Before(org.junit.Before)

Aggregations

XmlOptions (org.apache.xmlbeans.XmlOptions)2 Before (org.junit.Before)2 DecoderRepository (org.n52.svalbard.decode.DecoderRepository)2 GmlDecoderv311 (org.n52.svalbard.decode.GmlDecoderv311)2 SensorMLDecoderV101 (org.n52.svalbard.decode.SensorMLDecoderV101)2 SweCommonDecoderV101 (org.n52.svalbard.decode.SweCommonDecoderV101)2 InsertSensorRequestDecoder (org.n52.svalbard.decode.json.InsertSensorRequestDecoder)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 SensorML (org.n52.shetland.ogc.sensorML.SensorML)1 BatchRequestDecoder (org.n52.svalbard.decode.json.BatchRequestDecoder)1 FieldDecoder (org.n52.svalbard.decode.json.FieldDecoder)1 InsertObservationRequestDecoder (org.n52.svalbard.decode.json.InsertObservationRequestDecoder)1 InsertResultRequestDecoder (org.n52.svalbard.decode.json.InsertResultRequestDecoder)1 InsertResultTemplateRequestDecoder (org.n52.svalbard.decode.json.InsertResultTemplateRequestDecoder)1 ObservationDecoder (org.n52.svalbard.decode.json.ObservationDecoder)1