Search in sources :

Example 11 with SweField

use of org.n52.shetland.ogc.swe.SweField 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 12 with SweField

use of org.n52.shetland.ogc.swe.SweField 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)

Example 13 with SweField

use of org.n52.shetland.ogc.swe.SweField in project arctic-sea by 52North.

the class FieldDecoderTest method timeWithValue.

@Test
public void timeWithValue() throws DecodingException {
    ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.TIME_TYPE).put(JSONConstants.UOM, UOM).put(JSONConstants.VALUE, TIME_START);
    SweField field = checkCommon(json, true);
    assertThat(field.getElement(), is(instanceOf(SweTime.class)));
    SweTime swe = (SweTime) field.getElement();
    errors.checkThat(swe.getValue(), is(timeStart));
    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 14 with SweField

use of org.n52.shetland.ogc.swe.SweField in project arctic-sea by 52North.

the class FieldDecoderTest method timeRangeWithValue.

@Test
public void timeRangeWithValue() throws DecodingException {
    ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.TIME_RANGE_TYPE).put(JSONConstants.UOM, UOM);
    json.putArray(JSONConstants.VALUE).add(TIME_START).add(TIME_END);
    SweField field = checkCommon(json, true);
    assertThat(field.getElement(), is(instanceOf(SweTimeRange.class)));
    SweTimeRange swe = (SweTimeRange) field.getElement();
    errors.checkThat(swe.getUom(), is(UOM));
    errors.checkThat(swe.getValue(), is(notNullValue()));
    errors.checkThat(swe.getValue().getRangeStart(), is(timeStart));
    errors.checkThat(swe.getValue().getRangeEnd(), is(timeEnd));
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) SweField(org.n52.shetland.ogc.swe.SweField) SweTimeRange(org.n52.shetland.ogc.swe.simpleType.SweTimeRange) Test(org.junit.Test)

Example 15 with SweField

use of org.n52.shetland.ogc.swe.SweField in project arctic-sea by 52North.

the class FieldDecoderTest method testCount.

@Test
public void testCount() throws DecodingException {
    ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.COUNT_TYPE);
    SweField field = checkCommon(json, false);
    assertThat(field.getElement(), is(instanceOf(SweCount.class)));
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) SweField(org.n52.shetland.ogc.swe.SweField) Test(org.junit.Test)

Aggregations

SweField (org.n52.shetland.ogc.swe.SweField)59 Test (org.junit.Test)42 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)34 XmlObject (org.apache.xmlbeans.XmlObject)20 SimpleDataRecordType (net.opengis.swe.x101.SimpleDataRecordType)19 SweDataRecord (org.n52.shetland.ogc.swe.SweDataRecord)19 SweBoolean (org.n52.shetland.ogc.swe.simpleType.SweBoolean)12 SweTime (org.n52.shetland.ogc.swe.simpleType.SweTime)12 AnyScalarPropertyType (net.opengis.swe.x101.AnyScalarPropertyType)11 SweQuantity (org.n52.shetland.ogc.swe.simpleType.SweQuantity)11 SweText (org.n52.shetland.ogc.swe.simpleType.SweText)11 SweAbstractDataComponent (org.n52.shetland.ogc.swe.SweAbstractDataComponent)10 SweSimpleDataRecord (org.n52.shetland.ogc.swe.SweSimpleDataRecord)10 DataComponentPropertyType (net.opengis.swe.x101.DataComponentPropertyType)9 DataRecordType (net.opengis.swe.x101.DataRecordType)9 SweCategory (org.n52.shetland.ogc.swe.simpleType.SweCategory)9 SweCount (org.n52.shetland.ogc.swe.simpleType.SweCount)9 SweTimeRange (org.n52.shetland.ogc.swe.simpleType.SweTimeRange)8 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)7 DateTime (org.joda.time.DateTime)4