use of org.n52.shetland.ogc.sos.request.InsertObservationRequest in project arctic-sea by 52North.
the class InsertObservationRequestEncoderTest method shouldThrowExceptionIfVersionIsMissing.
@Test
public void shouldThrowExceptionIfVersionIsMissing() throws EncodingException {
thrown.expect(UnsupportedEncoderInputException.class);
thrown.expectMessage(Is.is("Encoder " + InsertObservationRequestEncoder.class.getSimpleName() + " can not encode 'missing version'"));
encoder.create(new InsertObservationRequest("SOS", ""));
}
use of org.n52.shetland.ogc.sos.request.InsertObservationRequest in project arctic-sea by 52North.
the class InsertObservationRequestEncoderTest method shouldEncodeInsertObservationRequest.
@Test
public void shouldEncodeInsertObservationRequest() throws EncodingException, InvalidSridException, ParseException, DecodingException {
InsertObservationRequest request = createInsertObservationRequest();
XmlObject encodedRequest = encoder.create(request);
XmlHelper.validateDocument(encodedRequest);
Assert.assertThat(encodedRequest, Matchers.notNullValue());
Assert.assertThat(encodedRequest, Matchers.instanceOf(InsertObservationDocument.class));
InsertObservationType insertObservation = ((InsertObservationDocument) encodedRequest).getInsertObservation();
Assert.assertThat(insertObservation.getOfferingArray(), Matchers.notNullValue());
Assert.assertThat(insertObservation.getOfferingArray().length, Is.is(1));
Assert.assertThat(insertObservation.getOfferingArray(0), Is.is(OFFERING_ID));
Assert.assertThat(insertObservation.getObservationArray(), Matchers.notNullValue());
Assert.assertThat(insertObservation.getObservationArray().length, Is.is(1));
// no check for observation values, because that MUST be part of OmEncoderv20Test
}
use of org.n52.shetland.ogc.sos.request.InsertObservationRequest in project arctic-sea by 52North.
the class InsertObservationRequestEncoderTest method shouldThrowExceptionIfVersionIsNot200Missing.
@Test
public void shouldThrowExceptionIfVersionIsNot200Missing() throws EncodingException {
thrown.expect(UnsupportedEncoderInputException.class);
thrown.expectMessage(Is.is("Encoder " + InsertObservationRequestEncoder.class.getSimpleName() + " can not encode 'SOS 1.0.0 insert observation request'"));
encoder.create(new InsertObservationRequest("SOS", "1.0.0"));
}
use of org.n52.shetland.ogc.sos.request.InsertObservationRequest 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;
}
Aggregations