Search in sources :

Example 16 with DecodingException

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

the class FieldDecoderTest method testCountRangeWithValue.

@Test
public void testCountRangeWithValue() throws DecodingException {
    ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.COUNT_RANGE_TYPE);
    json.putArray(JSONConstants.VALUE).add(COUNT_VALUE_START).add(COUNT_VALUE_END);
    SweField field = checkCommon(json, true);
    assertThat(field.getElement(), is(instanceOf(SweCountRange.class)));
    SweCountRange swe = (SweCountRange) field.getElement();
    assertThat(swe.getValue(), is(notNullValue()));
    errors.checkThat(swe.getValue().getRangeStart(), is(COUNT_VALUE_START));
    errors.checkThat(swe.getValue().getRangeEnd(), is(COUNT_VALUE_END));
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) SweField(org.n52.shetland.ogc.swe.SweField) SweCountRange(org.n52.shetland.ogc.swe.simpleType.SweCountRange) Test(org.junit.Test)

Example 17 with DecodingException

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

the class FieldDecoderTest method testCategory.

@Test
public void testCategory() throws DecodingException {
    ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.CATEGORY_TYPE).put(JSONConstants.CODESPACE, CODESPACE);
    SweField field = checkCommon(json, false);
    assertThat(field.getElement(), is(instanceOf(SweCategory.class)));
    SweCategory swe = (SweCategory) field.getElement();
    errors.checkThat(swe.getValue(), is(nullValue()));
    errors.checkThat(swe.getCodeSpace(), is(CODESPACE));
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) SweField(org.n52.shetland.ogc.swe.SweField) SweCategory(org.n52.shetland.ogc.swe.simpleType.SweCategory) Test(org.junit.Test)

Example 18 with DecodingException

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

the class FieldDecoderTest method time.

@Test
public void time() throws DecodingException {
    ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.TIME_TYPE).put(JSONConstants.UOM, UOM);
    SweField field = checkCommon(json, false);
    assertThat(field.getElement(), is(instanceOf(SweTime.class)));
    SweTime swe = (SweTime) field.getElement();
    errors.checkThat(swe.getValue(), is(nullValue()));
    errors.checkThat(swe.getUom(), is(UOM));
}
Also used : SweTime(org.n52.shetland.ogc.swe.simpleType.SweTime) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) SweField(org.n52.shetland.ogc.swe.SweField) Test(org.junit.Test)

Example 19 with DecodingException

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

the class FieldDecoderTest method testQuantity.

@Test
public void testQuantity() throws DecodingException {
    ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.QUANTITY_TYPE).put(JSONConstants.UOM, UOM);
    SweField field = checkCommon(json, false);
    assertThat(field.getElement(), is(instanceOf(SweQuantity.class)));
    SweQuantity swe = (SweQuantity) field.getElement();
    errors.checkThat(swe.getUom(), is(UOM));
}
Also used : SweQuantity(org.n52.shetland.ogc.swe.simpleType.SweQuantity) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) SweField(org.n52.shetland.ogc.swe.SweField) Test(org.junit.Test)

Example 20 with DecodingException

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

the class FieldDecoderTest method testCountRange.

@Test
public void testCountRange() throws DecodingException {
    ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.COUNT_RANGE_TYPE);
    SweField field = checkCommon(json, false);
    assertThat(field.getElement(), is(instanceOf(SweCountRange.class)));
    SweCountRange swe = (SweCountRange) field.getElement();
    assertThat(swe.getValue(), is(nullValue()));
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) SweField(org.n52.shetland.ogc.swe.SweField) SweCountRange(org.n52.shetland.ogc.swe.simpleType.SweCountRange) 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