Search in sources :

Example 16 with ObservationValue

use of org.n52.shetland.ogc.om.ObservationValue in project arctic-sea by 52North.

the class MeasurementDecodingTest method testValue.

@Test
public void testValue() {
    assertThat(observation, is(notNullValue()));
    final ObservationValue<?> ov = observation.getValue();
    assertThat(ov, is(notNullValue()));
    assertThat(ov.getValue(), is(instanceOf(QuantityValue.class)));
    QuantityValue qv = (QuantityValue) ov.getValue();
    assertThat(qv.getUnit(), is(equalTo("testunit1")));
    assertThat(qv.getValue(), is(equalTo(new BigDecimal("123123"))));
}
Also used : QuantityValue(org.n52.shetland.ogc.om.values.QuantityValue) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 17 with ObservationValue

use of org.n52.shetland.ogc.om.ObservationValue in project arctic-sea by 52North.

the class MeasurementDecodingTest method testPhenomenonTime.

@Test
public void testPhenomenonTime() {
    assertThat(observation, is(notNullValue()));
    final ObservationValue<?> ov = observation.getValue();
    assertThat(ov, is(notNullValue()));
    final Time pt = ov.getPhenomenonTime();
    assertThat(pt, is(notNullValue()));
    assertThat(pt, is(instanceOf(TimeInstant.class)));
    TimeInstant ti = (TimeInstant) pt;
    assertThat(ti.getValue(), is(equalTo(phenomenonTime)));
}
Also used : Time(org.n52.shetland.ogc.gml.time.Time) DateTime(org.joda.time.DateTime) DateTimeHelper.parseIsoString2DateTime(org.n52.shetland.util.DateTimeHelper.parseIsoString2DateTime) TimeInstant(org.n52.shetland.ogc.gml.time.TimeInstant) Test(org.junit.Test)

Example 18 with ObservationValue

use of org.n52.shetland.ogc.om.ObservationValue in project arctic-sea by 52North.

the class TextObservationDecodingTest method testObservation.

@Test
public void testObservation() {
    assertThat(observation, is(notNullValue()));
    final String type = observation.getObservationConstellation().getObservationType();
    assertThat(type, is(equalTo(OmConstants.OBS_TYPE_TEXT_OBSERVATION)));
    final ObservationValue<?> value = observation.getValue();
    assertThat(value, is(instanceOf(SingleObservationValue.class)));
    assertThat(value.getPhenomenonTime(), is(instanceOf(TimeInstant.class)));
    TimeInstant pt = (TimeInstant) value.getPhenomenonTime();
    assertThat(pt.getValue(), is(equalTo(phenomenonTime)));
    assertThat(value.getValue(), is(instanceOf(TextValue.class)));
    TextValue v = (TextValue) value.getValue();
    assertThat(v.getValue(), is(equalTo("Some Value")));
    assertThat(v.getUnit(), is(nullValue()));
}
Also used : TextValue(org.n52.shetland.ogc.om.values.TextValue) TimeInstant(org.n52.shetland.ogc.gml.time.TimeInstant) Test(org.junit.Test)

Example 19 with ObservationValue

use of org.n52.shetland.ogc.om.ObservationValue in project arctic-sea by 52North.

the class CategoryObservationDecodingTest method testObservation.

@Test
public void testObservation() {
    assertThat(observation, is(notNullValue()));
    final String type = observation.getObservationConstellation().getObservationType();
    assertThat(type, is(equalTo(OmConstants.OBS_TYPE_CATEGORY_OBSERVATION)));
    final ObservationValue<?> value = observation.getValue();
    assertThat(value, is(instanceOf(SingleObservationValue.class)));
    assertThat(value.getPhenomenonTime(), is(instanceOf(TimeInstant.class)));
    TimeInstant pt = (TimeInstant) value.getPhenomenonTime();
    assertThat(pt.getValue(), is(equalTo(phenomenonTime)));
    assertThat(value.getValue(), is(instanceOf(CategoryValue.class)));
    CategoryValue v = (CategoryValue) value.getValue();
    assertThat(v.getValue(), is(equalTo("Some Value")));
    assertThat(v.getUnit(), is(equalTo("http://52north.org/")));
}
Also used : CategoryValue(org.n52.shetland.ogc.om.values.CategoryValue) TimeInstant(org.n52.shetland.ogc.gml.time.TimeInstant) Test(org.junit.Test)

Example 20 with ObservationValue

use of org.n52.shetland.ogc.om.ObservationValue in project arctic-sea by 52North.

the class GeometryObservationDecodingTest method testObservation.

@Test
public void testObservation() {
    assertThat(observation, is(notNullValue()));
    final String type = observation.getObservationConstellation().getObservationType();
    assertThat(type, is(equalTo(OmConstants.OBS_TYPE_GEOMETRY_OBSERVATION)));
    final ObservationValue<?> value = observation.getValue();
    assertThat(value, is(instanceOf(SingleObservationValue.class)));
    assertThat(value.getPhenomenonTime(), is(instanceOf(TimeInstant.class)));
    TimeInstant pt = (TimeInstant) value.getPhenomenonTime();
    assertThat(pt.getValue(), is(equalTo(phenomenonTime)));
    assertThat(value.getValue(), is(instanceOf(GeometryValue.class)));
    GeometryValue v = (GeometryValue) value.getValue();
    assertThat(v.getUnit(), is(nullValue()));
    Geometry g = v.getValue();
    assertThat(g, is(instanceOf(LineString.class)));
    assertThat(g.getSRID(), is(2000));
    assertThat(g.getNumPoints(), is(2));
    assertThat(g.getCoordinates()[0], is(equalTo(new Coordinate(52, 7))));
    assertThat(g.getCoordinates()[1], is(equalTo(new Coordinate(51, 7))));
}
Also used : Geometry(org.locationtech.jts.geom.Geometry) GeometryValue(org.n52.shetland.ogc.om.values.GeometryValue) Coordinate(org.locationtech.jts.geom.Coordinate) LineString(org.locationtech.jts.geom.LineString) TimeInstant(org.n52.shetland.ogc.gml.time.TimeInstant) Test(org.junit.Test)

Aggregations

MultiObservationValues (org.n52.shetland.ogc.om.MultiObservationValues)9 SingleObservationValue (org.n52.shetland.ogc.om.SingleObservationValue)9 Test (org.junit.Test)7 TimeInstant (org.n52.shetland.ogc.gml.time.TimeInstant)7 QuantityValue (org.n52.shetland.ogc.om.values.QuantityValue)6 List (java.util.List)5 TimeValuePair (org.n52.shetland.ogc.om.TimeValuePair)5 TVPValue (org.n52.shetland.ogc.om.values.TVPValue)5 Geometry (org.locationtech.jts.geom.Geometry)4 StreamingValue (org.n52.shetland.ogc.om.StreamingValue)4 TimeLocationValueTriple (org.n52.shetland.ogc.om.TimeLocationValueTriple)4 CountValue (org.n52.shetland.ogc.om.values.CountValue)4 GeometryValue (org.n52.shetland.ogc.om.values.GeometryValue)4 TVPDefaultMetadataPropertyType (net.opengis.waterml.x20.TVPDefaultMetadataPropertyType)3 OmObservableProperty (org.n52.shetland.ogc.om.OmObservableProperty)3 BooleanValue (org.n52.shetland.ogc.om.values.BooleanValue)3 TLVTValue (org.n52.shetland.ogc.om.values.TLVTValue)3 SweDataArray (org.n52.shetland.ogc.swe.SweDataArray)3 MeasureOrNilReasonListType (net.opengis.gml.x32.MeasureOrNilReasonListType)2 QuantityListDocument (net.opengis.gml.x32.QuantityListDocument)2