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);
}
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);
}
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;
}
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"));
}
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;
}
Aggregations