Search in sources :

Example 6 with InsertResultTemplateRequest

use of org.n52.shetland.ogc.sos.request.InsertResultTemplateRequest in project arctic-sea by 52North.

the class InsertResultTemplateRequestEncoderTest method shouldThrowExceptionWhenResultStructureIsMissing.

@Test
public void shouldThrowExceptionWhenResultStructureIsMissing() throws EncodingException {
    thrown.expect(UnsupportedEncoderInputException.class);
    thrown.expectMessage(Is.is("Encoder " + InsertResultTemplateRequestEncoder.class.getSimpleName() + " can not encode 'missing resultStructure'"));
    request = new InsertResultTemplateRequest("service", "version");
    request.setObservationTemplate(new OmObservationConstellation());
    OmObservationConstellation observationTemplate = new OmObservationConstellation();
    observationTemplate.addOffering(offering);
    request.setObservationTemplate(observationTemplate);
    encoder.create(request);
}
Also used : OmObservationConstellation(org.n52.shetland.ogc.om.OmObservationConstellation) InsertResultTemplateRequest(org.n52.shetland.ogc.sos.request.InsertResultTemplateRequest) Test(org.junit.Test)

Example 7 with InsertResultTemplateRequest

use of org.n52.shetland.ogc.sos.request.InsertResultTemplateRequest in project arctic-sea by 52North.

the class InsertResultTemplateRequestEncoderTest method shouldThrowExceptionWhenResultEncodingIsMissing.

@Test
public void shouldThrowExceptionWhenResultEncodingIsMissing() throws EncodingException {
    thrown.expect(UnsupportedEncoderInputException.class);
    thrown.expectMessage(Is.is("Encoder " + InsertResultTemplateRequestEncoder.class.getSimpleName() + " can not encode 'missing resultEncoding'"));
    request = new InsertResultTemplateRequest("service", "version");
    request.setObservationTemplate(new OmObservationConstellation());
    request.setResultStructure(new SosResultStructure(new SweDataRecord()));
    OmObservationConstellation observationTemplate = new OmObservationConstellation();
    observationTemplate.addOffering(offering);
    request.setObservationTemplate(observationTemplate);
    encoder.create(request);
}
Also used : SweDataRecord(org.n52.shetland.ogc.swe.SweDataRecord) OmObservationConstellation(org.n52.shetland.ogc.om.OmObservationConstellation) SosResultStructure(org.n52.shetland.ogc.sos.SosResultStructure) InsertResultTemplateRequest(org.n52.shetland.ogc.sos.request.InsertResultTemplateRequest) Test(org.junit.Test)

Example 8 with InsertResultTemplateRequest

use of org.n52.shetland.ogc.sos.request.InsertResultTemplateRequest in project arctic-sea by 52North.

the class InsertResultTemplateRequestDecoder method decodeRequest.

@Override
public InsertResultTemplateRequest decodeRequest(JsonNode node) throws DecodingException {
    InsertResultTemplateRequest irtr = new InsertResultTemplateRequest();
    if (!node.path(JSONConstants.IDENTIFIER).isMissingNode()) {
        irtr.setIdentifier(node.path(JSONConstants.IDENTIFIER).textValue());
    }
    irtr.setObservationTemplate(parseObservationTemplate(node));
    irtr.setResultStructure(parseResultStructure(node.path(JSONConstants.RESULT_STRUCTURE)));
    irtr.setResultEncoding(parseResultEncoding(node.path(JSONConstants.RESULT_ENCODING)));
    return irtr;
}
Also used : InsertResultTemplateRequest(org.n52.shetland.ogc.sos.request.InsertResultTemplateRequest)

Example 9 with InsertResultTemplateRequest

use of org.n52.shetland.ogc.sos.request.InsertResultTemplateRequest in project arctic-sea by 52North.

the class InsertResultTemplateRequestDecoderTest method observationTemplate.

@Test
public void observationTemplate() throws IOException, DecodingException {
    InsertResultTemplateRequest req = load();
    OmObservationConstellation oc = req.getObservationTemplate();
    assertThat(oc, is(notNullValue()));
    assertThat(oc.getObservationType(), is("http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement"));
    assertThat(oc.getProcedure(), is(notNullValue()));
    assertThat(oc.getProcedure().getIdentifier(), is("http://52north.org/example/procedure/6"));
    assertThat(oc.getObservableProperty(), is(notNullValue()));
    assertThat(oc.getObservableProperty().getIdentifier(), is("http://52north.org/example/observedProperty/6"));
    assertThat(oc.getFeatureOfInterest(), is(notNullValue()));
    assertThat(oc.getFeatureOfInterest().getIdentifierCodeWithAuthority(), is(notNullValue()));
    assertThat(oc.getFeatureOfInterest().getIdentifierCodeWithAuthority().getCodeSpace(), is("http://www.opengis.net/def/nil/OGC/0/unknown"));
    assertThat(oc.getFeatureOfInterest().getIdentifierCodeWithAuthority().getValue(), is("http://52north.org/example/feature/6"));
}
Also used : OmObservationConstellation(org.n52.shetland.ogc.om.OmObservationConstellation) InsertResultTemplateRequest(org.n52.shetland.ogc.sos.request.InsertResultTemplateRequest) Test(org.junit.Test)

Example 10 with InsertResultTemplateRequest

use of org.n52.shetland.ogc.sos.request.InsertResultTemplateRequest in project arctic-sea by 52North.

the class InsertResultTemplateRequestDecoderTest method load.

protected InsertResultTemplateRequest load() throws IOException, DecodingException {
    final JsonNode json = JsonLoader.fromResource("/examples/sos/InsertResultTemplateRequest.json");
    final InsertResultTemplateRequest req = decoder.decodeJSON(json, true);
    assertThat(req, is(notNullValue()));
    return req;
}
Also used : JsonNode(com.fasterxml.jackson.databind.JsonNode) InsertResultTemplateRequest(org.n52.shetland.ogc.sos.request.InsertResultTemplateRequest)

Aggregations

InsertResultTemplateRequest (org.n52.shetland.ogc.sos.request.InsertResultTemplateRequest)14 Test (org.junit.Test)10 OmObservationConstellation (org.n52.shetland.ogc.om.OmObservationConstellation)6 SweDataRecord (org.n52.shetland.ogc.swe.SweDataRecord)3 SosResultStructure (org.n52.shetland.ogc.sos.SosResultStructure)2 SweField (org.n52.shetland.ogc.swe.SweField)2 SweTextEncoding (org.n52.shetland.ogc.swe.encoding.SweTextEncoding)2 SweTime (org.n52.shetland.ogc.swe.simpleType.SweTime)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 GetResultTemplateType (net.opengis.sos.x20.GetResultTemplateType)1 InsertResultTemplateType (net.opengis.sos.x20.InsertResultTemplateType)1 ResultTemplateType (net.opengis.sos.x20.ResultTemplateType)1 XmlException (org.apache.xmlbeans.XmlException)1 XmlOptions (org.apache.xmlbeans.XmlOptions)1 Before (org.junit.Before)1 CodeType (org.n52.shetland.ogc.gml.CodeType)1 CodeWithAuthority (org.n52.shetland.ogc.gml.CodeWithAuthority)1 OmObservableProperty (org.n52.shetland.ogc.om.OmObservableProperty)1 SamplingFeature (org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeature)1 SensorML (org.n52.shetland.ogc.sensorML.SensorML)1