use of org.n52.shetland.ogc.om.OmObservationConstellation in project arctic-sea by 52North.
the class MeasurementDecodingTest method testFeatureOfInterestGeometry.
@Test
public void testFeatureOfInterestGeometry() {
assertThat(observation, is(notNullValue()));
final OmObservationConstellation oc = observation.getObservationConstellation();
assertThat(oc, is(notNullValue()));
assertThat(oc.getFeatureOfInterest(), is(notNullValue()));
assertThat(oc.getFeatureOfInterest(), is(instanceOf(SamplingFeature.class)));
SamplingFeature foi = (SamplingFeature) oc.getFeatureOfInterest();
assertThat(foi.getGeometry(), is(notNullValue()));
assertThat(foi.getGeometry(), is(instanceOf(Point.class)));
assertThat(foi.getGeometry().getCoordinate().x, is(52.0));
assertThat(foi.getGeometry().getCoordinate().y, is(7.0));
}
use of org.n52.shetland.ogc.om.OmObservationConstellation in project arctic-sea by 52North.
the class ObservationEncoder method encodeFeatureOfInterest.
private void encodeFeatureOfInterest(OmObservation o, ObjectNode json) throws EncodingException {
OmObservationConstellation oc = o.getObservationConstellation();
json.set(JSONConstants.FEATURE_OF_INTEREST, encodeObjectToJson(oc.getFeatureOfInterest()));
}
use of org.n52.shetland.ogc.om.OmObservationConstellation in project arctic-sea by 52North.
the class InsertObservationRequestEncoderTest method createInsertObservationRequest.
private InsertObservationRequest createInsertObservationRequest() throws InvalidSridException, ParseException {
SamplingFeature samplingFeature = new SamplingFeature(new CodeWithAuthority("test-feature-uri"));
samplingFeature.setName(new CodeType("test-feature-name"));
samplingFeature.setSampledFeatures(Arrays.asList(new SamplingFeature(new CodeWithAuthority("test-parent-feature-uri"))));
samplingFeature.setGeometry(JTSHelper.createGeometryFromWKT("POINT(52.0 42.0)", 4326));
PhysicalSystem procedure = new PhysicalSystem();
procedure.setIdentifier("test-procedure");
OmObservationConstellation observationConstellation = new OmObservationConstellation();
observationConstellation.setGmlId("o1");
observationConstellation.setObservationType(OmConstants.OBS_TYPE_MEASUREMENT);
observationConstellation.setObservableProperty(new OmObservableProperty("test-property"));
observationConstellation.setFeatureOfInterest(samplingFeature);
observationConstellation.setProcedure(procedure);
TimeInstant time = new TimeInstant(new Date(0));
QuantityValue quantity = new QuantityValue(23.0, "test-uom");
ObservationValue<?> value = new SingleObservationValue<>(time, quantity);
OmObservation omObservation = new OmObservation();
omObservation.setObservationConstellation(observationConstellation);
omObservation.setResultTime(time);
omObservation.setValue(value);
InsertObservationRequest request = new InsertObservationRequest("SOS", "2.0.0");
request.setOfferings(Arrays.asList(OFFERING_ID));
request.addObservation(omObservation);
return request;
}
use of org.n52.shetland.ogc.om.OmObservationConstellation in project arctic-sea by 52North.
the class InsertResultTemplateRequestEncoderTest method shouldThrowExceptionWhenOfferingIsMissing.
@Test
public void shouldThrowExceptionWhenOfferingIsMissing() throws EncodingException {
thrown.expect(UnsupportedEncoderInputException.class);
thrown.expectMessage(Is.is("Encoder " + InsertResultTemplateRequestEncoder.class.getSimpleName() + " can not encode 'missing offering'"));
request = new InsertResultTemplateRequest("service", "version");
request.setObservationTemplate(new OmObservationConstellation());
encoder.create(request);
}
use of org.n52.shetland.ogc.om.OmObservationConstellation in project arctic-sea by 52North.
the class OmEncoderv20Test method shouldThrowExceptionWhenReceivedInvalidObservationTypeInObservationTemplate.
@Test
public void shouldThrowExceptionWhenReceivedInvalidObservationTypeInObservationTemplate() throws EncodingException {
thrown.expect(UnsupportedEncoderInputException.class);
thrown.expectMessage(Is.is("Encoder " + OmEncoderv20.class.getSimpleName() + " can not encode 'missing type in OM_Observation'"));
omEncoderv20.encode(new OmObservationConstellation());
}
Aggregations