use of org.n52.shetland.ogc.om.OmObservationConstellation in project arctic-sea by 52North.
the class OmEncoderv20Test method createComplexObservation.
protected OmObservation createComplexObservation() {
DateTime now = new DateTime(DateTimeZone.UTC);
TimeInstant resultTime = new TimeInstant(now);
TimeInstant phenomenonTime = new TimeInstant(now);
TimePeriod validTime = new TimePeriod(now.minusMinutes(5), now.plusMinutes(5));
OmObservation observation = new OmObservation();
OmObservationConstellation observationConstellation = new OmObservationConstellation();
observationConstellation.setFeatureOfInterest(new SamplingFeature(new CodeWithAuthority("feature", CODE_SPACE)));
OmCompositePhenomenon observableProperty = new OmCompositePhenomenon(PARENT_OBSERVABLE_PROPERTY);
observableProperty.addPhenomenonComponent(new OmObservableProperty(CHILD_OBSERVABLE_PROPERTY_1));
observableProperty.addPhenomenonComponent(new OmObservableProperty(CHILD_OBSERVABLE_PROPERTY_2));
observableProperty.addPhenomenonComponent(new OmObservableProperty(CHILD_OBSERVABLE_PROPERTY_3));
observableProperty.addPhenomenonComponent(new OmObservableProperty(CHILD_OBSERVABLE_PROPERTY_4));
observationConstellation.setObservableProperty(observableProperty);
observationConstellation.setObservationType(OmConstants.OBS_TYPE_COMPLEX_OBSERVATION);
observationConstellation.addOffering(OFFERING);
AbstractFeature procedure = new SosProcedureDescriptionUnknownType(PROCEDURE);
// procedure.setIdentifier(new CodeWithAuthority(PROCEDURE, CODE_SPACE));
observationConstellation.setProcedure(procedure);
observation.setObservationConstellation(observationConstellation);
observation.setParameter(null);
observation.setResultTime(resultTime);
observation.setTokenSeparator(TOKEN_SEPERATOR);
observation.setTupleSeparator(TUPLE_SEPERATOR);
observation.setValidTime(validTime);
ComplexValue complexValue = new ComplexValue();
SweDataRecord sweDataRecord = new SweDataRecord();
SweQuantity sweQuantity = new SweQuantity();
sweQuantity.setDefinition(CHILD_OBSERVABLE_PROPERTY_1);
sweQuantity.setUom("unit");
sweQuantity.setValue(42.0);
sweDataRecord.addField(new SweField(CHILD_OBSERVABLE_PROPERTY_1_NAME, sweQuantity));
SweBoolean sweBoolean = new SweBoolean();
sweBoolean.setValue(Boolean.TRUE);
sweBoolean.setDefinition(CHILD_OBSERVABLE_PROPERTY_2);
sweDataRecord.addField(new SweField(CHILD_OBSERVABLE_PROPERTY_2_NAME, sweBoolean));
SweCount sweCount = new SweCount();
sweCount.setDefinition(CHILD_OBSERVABLE_PROPERTY_3);
sweCount.setValue(42);
sweDataRecord.addField(new SweField(CHILD_OBSERVABLE_PROPERTY_3_NAME, sweCount));
SweText sweText = new SweText();
sweText.setDefinition(CHILD_OBSERVABLE_PROPERTY_4);
sweText.setValue("42");
sweDataRecord.addField(new SweField(CHILD_OBSERVABLE_PROPERTY_4_NAME, sweText));
SweCategory sweCategory = new SweCategory();
sweCategory.setDefinition(CHILD_OBSERVABLE_PROPERTY_5);
sweCategory.setCodeSpace(CODE_SPACE);
sweCategory.setValue("52");
sweDataRecord.addField(new SweField(CHILD_OBSERVABLE_PROPERTY_5_NAME, sweCategory));
complexValue.setValue(sweDataRecord);
observation.setValue(new SingleObservationValue<>(phenomenonTime, complexValue));
return observation;
}
use of org.n52.shetland.ogc.om.OmObservationConstellation 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.om.OmObservationConstellation in project arctic-sea by 52North.
the class MeasurementDecodingTest method testFeatureOfInterestName.
@Test
public void testFeatureOfInterestName() {
assertThat(observation, is(notNullValue()));
final OmObservationConstellation oc = observation.getObservationConstellation();
assertThat(oc, is(notNullValue()));
final AbstractFeature foi = oc.getFeatureOfInterest();
assertThat(foi, is(notNullValue()));
final List<CodeType> name = foi.getName();
assertThat(name, is(notNullValue()));
assertThat(name.size(), is(3));
assertThat(name.get(0), is(notNullValue()));
assertThat(name.get(0).getValue(), is(equalTo(FEATURE_NAME)));
assertThat(name.get(0).getCodeSpace().toString(), is(equalTo("http://x.y/z")));
assertThat(name.get(1), is(notNullValue()));
assertThat(name.get(1).getValue(), is(equalTo("othername1")));
assertThat(name.get(1).isSetCodeSpace(), is(false));
assertThat(name.get(2), is(notNullValue()));
assertThat(name.get(2).getValue(), is(equalTo("othername2")));
assertThat(name.get(2).isSetCodeSpace(), is(false));
}
use of org.n52.shetland.ogc.om.OmObservationConstellation in project arctic-sea by 52North.
the class MeasurementDecodingTest method testFeatureOfInterestIdentifier.
@Test
public void testFeatureOfInterestIdentifier() {
assertThat(observation, is(notNullValue()));
final OmObservationConstellation oc = observation.getObservationConstellation();
assertThat(oc, is(notNullValue()));
final AbstractFeature foi = oc.getFeatureOfInterest();
assertThat(foi, is(notNullValue()));
assertThat(foi.getIdentifierCodeWithAuthority(), is(notNullValue()));
assertThat(foi.getIdentifierCodeWithAuthority().getCodeSpace(), is(equalTo(UNKNOWN_CODESPACE)));
assertThat(foi.getIdentifierCodeWithAuthority().getValue(), is(equalTo(FEATURE_IDENTIFIER)));
}
use of org.n52.shetland.ogc.om.OmObservationConstellation in project arctic-sea by 52North.
the class MeasurementDecodingTest method testObservedProperty.
@Test
public void testObservedProperty() {
assertThat(observation, is(notNullValue()));
final OmObservationConstellation oc = observation.getObservationConstellation();
assertThat(oc, is(notNullValue()));
final AbstractPhenomenon op = oc.getObservableProperty();
assertThat(op, is(notNullValue()));
assertThat(op.getIdentifier(), is(equalTo(OBSERVED_PROPERTY)));
}
Aggregations