Search in sources :

Example 36 with DecodingException

use of org.n52.svalbard.decode.exception.DecodingException in project arctic-sea by 52North.

the class GetObservationRequestDecoderTest method hasMergeObservationsIntoDataArrayExtension.

@Test
public void hasMergeObservationsIntoDataArrayExtension() throws IOException, DecodingException {
    final GetObservationRequest req = loadMergeIntoArray();
    assertThat(req.getBooleanExtension("MergeObservationsIntoDataArray"), is(true));
}
Also used : GetObservationRequest(org.n52.shetland.ogc.sos.request.GetObservationRequest) Test(org.junit.Test)

Example 37 with DecodingException

use of org.n52.svalbard.decode.exception.DecodingException in project arctic-sea by 52North.

the class GetObservationRequestDecoderTest method hasSingleTemporalFilter.

@Test
public void hasSingleTemporalFilter() throws IOException, DecodingException {
    final GetObservationRequest req = loadSingle();
    assertThat(req.getTemporalFilters(), is(notNullValue()));
    assertThat(req.getTemporalFilters(), hasSize(1));
    assertThat(req.getTemporalFilters().get(0), is(notNullValue()));
    assertThat(req.getTemporalFilters().get(0).getOperator(), is(TimeOperator.TM_Equals));
    assertThat(req.getTemporalFilters().get(0).getValueReference(), is("om:phenomenonTime"));
    assertThat(req.getTemporalFilters().get(0).getTime(), is(instanceOf(TimePeriod.class)));
    final TimePeriod time = (TimePeriod) req.getTemporalFilters().get(0).getTime();
    assertThat(time.getStart(), is(equalTo(new DateTime(2013, 01, 01, 00, 00, 00, 00, DateTimeZone.forOffsetHours(2)))));
    assertThat(time.getEnd(), is(equalTo(new DateTime(2013, 01, 01, 01, 00, 00, 00, DateTimeZone.forOffsetHours(2)))));
}
Also used : GetObservationRequest(org.n52.shetland.ogc.sos.request.GetObservationRequest) TimePeriod(org.n52.shetland.ogc.gml.time.TimePeriod) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Example 38 with DecodingException

use of org.n52.svalbard.decode.exception.DecodingException in project arctic-sea by 52North.

the class GetObservationRequestDecoderTest method hasMultipleTemporalFilters.

@Test
public void hasMultipleTemporalFilters() throws IOException, DecodingException {
    final GetObservationRequest req = loadMultiple();
    assertThat(req.getTemporalFilters(), is(notNullValue()));
    assertThat(req.getTemporalFilters(), hasSize(2));
    assertThat(req.getTemporalFilters().get(0), is(notNullValue()));
    assertThat(req.getTemporalFilters().get(0).getOperator(), is(TimeOperator.TM_Equals));
    assertThat(req.getTemporalFilters().get(0).getValueReference(), is("om:phenomenonTime"));
    assertThat(req.getTemporalFilters().get(0).getTime(), is(instanceOf(TimePeriod.class)));
    final TimePeriod time1 = (TimePeriod) req.getTemporalFilters().get(0).getTime();
    assertThat(time1.getStart(), is(equalTo(new DateTime(2013, 01, 01, 00, 00, 00, 00, DateTimeZone.forOffsetHours(2)))));
    assertThat(time1.getEnd(), is(equalTo(new DateTime(2013, 01, 01, 01, 00, 00, 00, DateTimeZone.forOffsetHours(2)))));
    assertThat(req.getTemporalFilters().get(1), is(notNullValue()));
    assertThat(req.getTemporalFilters().get(1).getOperator(), is(TimeOperator.TM_Equals));
    assertThat(req.getTemporalFilters().get(1).getValueReference(), is("om:phenomenonTime"));
    assertThat(req.getTemporalFilters().get(1).getTime(), is(instanceOf(TimePeriod.class)));
    final TimePeriod time2 = (TimePeriod) req.getTemporalFilters().get(1).getTime();
    assertThat(time2.getStart(), is(equalTo(new DateTime(2013, 01, 01, 20, 00, 00, 00, DateTimeZone.forOffsetHours(2)))));
    assertThat(time2.getEnd(), is(equalTo(new DateTime(2013, 01, 01, 22, 00, 00, 00, DateTimeZone.forOffsetHours(2)))));
}
Also used : GetObservationRequest(org.n52.shetland.ogc.sos.request.GetObservationRequest) TimePeriod(org.n52.shetland.ogc.gml.time.TimePeriod) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Example 39 with DecodingException

use of org.n52.svalbard.decode.exception.DecodingException in project arctic-sea by 52North.

the class GetObservationRequestDecoderTest method hasFeatureOfInterest.

@Test
public void hasFeatureOfInterest() throws IOException, DecodingException {
    final GetObservationRequest req = loadSingle();
    assertThat(req.getFeatureIdentifiers(), is(notNullValue()));
    assertThat(req.getFeatureIdentifiers(), hasSize(1));
    assertThat(req.getFeatureIdentifiers().get(0), is(notNullValue()));
    assertThat(req.getFeatureIdentifiers().get(0), is(equalTo("featureOfInterest1")));
}
Also used : GetObservationRequest(org.n52.shetland.ogc.sos.request.GetObservationRequest) Test(org.junit.Test)

Example 40 with DecodingException

use of org.n52.svalbard.decode.exception.DecodingException in project arctic-sea by 52North.

the class GetObservationRequestDecoderTest method hasOffering.

@Test
public void hasOffering() throws IOException, DecodingException {
    final GetObservationRequest req = loadSingle();
    assertThat(req.getOfferings(), is(notNullValue()));
    assertThat(req.getOfferings(), hasSize(1));
    assertThat(req.getOfferings().get(0), is(notNullValue()));
    assertThat(req.getOfferings().get(0), is(equalTo("offering1")));
}
Also used : GetObservationRequest(org.n52.shetland.ogc.sos.request.GetObservationRequest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)92 DecodingException (org.n52.svalbard.decode.exception.DecodingException)63 XmlObject (org.apache.xmlbeans.XmlObject)52 JsonNode (com.fasterxml.jackson.databind.JsonNode)25 SweField (org.n52.shetland.ogc.swe.SweField)25 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)23 XmlException (org.apache.xmlbeans.XmlException)23 GetObservationRequest (org.n52.shetland.ogc.sos.request.GetObservationRequest)22 UnsupportedDecoderInputException (org.n52.svalbard.decode.exception.UnsupportedDecoderInputException)21 AbstractProcess (org.n52.shetland.ogc.sensorML.AbstractProcess)13 SystemType (net.opengis.sensorML.x101.SystemType)12 TimeInstant (org.n52.shetland.ogc.gml.time.TimeInstant)12 Before (org.junit.Before)11 AbstractFeature (org.n52.shetland.ogc.gml.AbstractFeature)11 SensorMLDocument (net.opengis.sensorML.x101.SensorMLDocument)10 DateTime (org.joda.time.DateTime)10 SweAbstractDataComponent (org.n52.shetland.ogc.swe.SweAbstractDataComponent)10 XmlString (org.apache.xmlbeans.XmlString)9 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)8 Geometry (org.locationtech.jts.geom.Geometry)8