use of net.opengis.sos.x20.ResultTemplateType.ObservationTemplate in project arctic-sea by 52North.
the class InsertResultTemplateRequestEncoderTest method shouldEncodeObservationTemplate.
@Test
public void shouldEncodeObservationTemplate() throws EncodingException, XmlException, IOException {
ResultTemplateType template = ((InsertResultTemplateDocument) encoder.create(request)).getInsertResultTemplate().getProposedTemplate().getResultTemplate();
ObservationTemplate observationTemplate = template.getObservationTemplate();
Assert.assertThat(observationTemplate, Matchers.notNullValue());
Assert.assertThat(observationTemplate, Matchers.instanceOf(ObservationTemplate.class));
OMObservationType omObservation = observationTemplate.getOMObservation();
Assert.assertThat(omObservation, Matchers.instanceOf(OMObservationType.class));
Assert.assertThat(omObservation.getType().getHref(), Is.is(OmConstants.OBS_TYPE_MEASUREMENT));
Assert.assertThat(omObservation.getPhenomenonTime().isNil(), Is.is(false));
Assert.assertThat(omObservation.getPhenomenonTime().isSetNilReason(), Is.is(true));
Assert.assertThat(omObservation.getPhenomenonTime().getNilReason(), Is.is("template"));
Assert.assertThat(omObservation.getResultTime().isNil(), Is.is(false));
Assert.assertThat(omObservation.getResultTime().isSetNilReason(), Is.is(true));
Assert.assertThat(omObservation.getResultTime().getNilReason(), Is.is("template"));
Assert.assertThat(omObservation.getProcedure().isNil(), Is.is(false));
Assert.assertThat(omObservation.getProcedure().getHref(), Is.is(procedureIdentifier));
Assert.assertThat(omObservation.getObservedProperty().isNil(), Is.is(false));
Assert.assertThat(omObservation.getObservedProperty().getHref(), Is.is(observedProperty));
Assert.assertThat(omObservation.getFeatureOfInterest(), Matchers.notNullValue());
XmlObject xmlObject = XmlObject.Factory.parse(omObservation.getFeatureOfInterest().newInputStream());
Assert.assertThat(xmlObject, Matchers.instanceOf(SFSamplingFeatureDocument.class));
SFSamplingFeatureType feature = ((SFSamplingFeatureDocument) xmlObject).getSFSamplingFeature();
Assert.assertThat(feature.getIdentifier().getStringValue(), Is.is(featureIdentifier));
Assert.assertThat(feature.getNameArray().length, Is.is(1));
Assert.assertThat(feature.getNameArray(0).getStringValue(), Is.is(featureName));
}
Aggregations