Search in sources :

Example 26 with DecodingException

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

the class FieldDecoderTest method checkCommon.

protected SweField checkCommon(ObjectNode json, boolean withValue) throws DecodingException {
    SweField field = validateWithValueAndDecode(json, withValue);
    assertThat(field, is(notNullValue()));
    errors.checkThat(field.getName().getValue(), is(NAME));
    assertThat(field.getElement(), is(notNullValue()));
    errors.checkThat(field.getElement().getDefinition(), is(DEFINITION));
    errors.checkThat(field.getElement().getDescription(), is(DESCRIPTION));
    errors.checkThat(field.getElement().getIdentifier(), is(IDENTIFIER));
    errors.checkThat(field.getElement().getLabel(), is(LABEL));
    return field;
}
Also used : SweField(org.n52.shetland.ogc.swe.SweField)

Example 27 with DecodingException

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

the class GeometryObservationDecodingTest method before.

@Before
public void before() throws DecodingException {
    this.decoder = new ObservationDecoder();
    this.observation = decoder.decodeJSON(json, true);
}
Also used : ObservationDecoder(org.n52.svalbard.decode.json.ObservationDecoder) Before(org.junit.Before)

Example 28 with DecodingException

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

the class ODataFesParserTest method testEndswith.

@Test
public void testEndswith() throws DecodingException {
    Filter<?> filter = parser.decode("endswith(textValue,'asdf')");
    assertThat(filter, is(instanceOf(ComparisonFilter.class)));
    ComparisonFilter cf = (ComparisonFilter) filter;
    errors.checkThat(cf.getOperator(), is(ComparisonOperator.PropertyIsLike));
    errors.checkThat(cf.getValue(), is("%asdf"));
    errors.checkThat(cf.getValueReference(), is("om:result"));
}
Also used : ComparisonFilter(org.n52.shetland.ogc.filter.ComparisonFilter) Test(org.junit.Test)

Example 29 with DecodingException

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

the class ODataFesParserTest method testStartswith.

@Test
public void testStartswith() throws DecodingException {
    Filter<?> filter = parser.decode("startswith(textValue,'asdf')");
    assertThat(filter, is(instanceOf(ComparisonFilter.class)));
    ComparisonFilter cf = (ComparisonFilter) filter;
    errors.checkThat(cf.getOperator(), is(ComparisonOperator.PropertyIsLike));
    errors.checkThat(cf.getValue(), is("asdf%"));
    errors.checkThat(cf.getValueReference(), is("om:result"));
}
Also used : ComparisonFilter(org.n52.shetland.ogc.filter.ComparisonFilter) Test(org.junit.Test)

Example 30 with DecodingException

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

the class AbstractGmlDecoderv321 method parseNamedValueType.

protected NamedValue<?> parseNamedValueType(NamedValuePropertyType namedValueProperty) throws DecodingException {
    if (namedValueProperty.isSetNamedValue()) {
        NamedValueType namedValue = namedValueProperty.getNamedValue();
        NamedValue<?> sosNamedValue = parseNamedValueValue(namedValue.getValue());
        org.n52.shetland.ogc.gml.ReferenceType referenceType = (org.n52.shetland.ogc.gml.ReferenceType) decodeXmlObject(namedValue.getName());
        sosNamedValue.setName(referenceType);
        return sosNamedValue;
    } else if (namedValueProperty.isSetHref()) {
        NamedValue<org.n52.shetland.ogc.gml.ReferenceType> sosNamedValue = new NamedValue<>();
        org.n52.shetland.ogc.gml.ReferenceType referenceType = new org.n52.shetland.ogc.gml.ReferenceType(namedValueProperty.getHref());
        if (namedValueProperty.isSetTitle()) {
            referenceType.setTitle(namedValueProperty.getTitle());
        }
        sosNamedValue.setName(referenceType);
        return sosNamedValue;
    } else {
        throw new UnsupportedDecoderInputException(this, namedValueProperty);
    }
}
Also used : NamedValueType(net.opengis.om.x20.NamedValueType) NamedValue(org.n52.shetland.ogc.om.NamedValue) UnsupportedDecoderInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderInputException) ReferenceType(net.opengis.gml.x32.ReferenceType)

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