Search in sources :

Example 6 with SweField

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

the class FieldDecoderTest method testBooleanWithValueTrue.

@Test
public void testBooleanWithValueTrue() throws DecodingException {
    ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.BOOLEAN_TYPE).put(JSONConstants.VALUE, true);
    SweField field = checkCommon(json, true);
    assertThat(field.getElement(), is(instanceOf(SweBoolean.class)));
    SweBoolean swe = (SweBoolean) field.getElement();
    errors.checkThat(swe.getValue(), is(true));
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) SweField(org.n52.shetland.ogc.swe.SweField) SweBoolean(org.n52.shetland.ogc.swe.simpleType.SweBoolean) Test(org.junit.Test)

Example 7 with SweField

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

the class FieldDecoderTest method timeRange.

@Test
public void timeRange() throws DecodingException {
    ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.TIME_RANGE_TYPE).put(JSONConstants.UOM, UOM);
    SweField field = checkCommon(json, false);
    assertThat(field.getElement(), is(instanceOf(SweTimeRange.class)));
    SweTimeRange swe = (SweTimeRange) field.getElement();
    errors.checkThat(swe.getUom(), is(UOM));
    errors.checkThat(swe.getValue(), is(nullValue()));
}
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 8 with SweField

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

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

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

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