Search in sources :

Example 51 with SweField

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

the class FieldDecoderTest method testText.

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

Example 52 with SweField

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

the class FieldDecoderTest method testCategoryWithValue.

@Test
public void testCategoryWithValue() throws DecodingException {
    ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.CATEGORY_TYPE).put(JSONConstants.CODESPACE, CODESPACE).put(JSONConstants.VALUE, CATEGORY_VALUE);
    SweField field = checkCommon(json, true);
    assertThat(field.getElement(), is(instanceOf(SweCategory.class)));
    SweCategory swe = (SweCategory) field.getElement();
    errors.checkThat(swe.getValue(), is(CATEGORY_VALUE));
    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 53 with SweField

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

the class FieldDecoderTest method testObservablePropertyWithValue.

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

Example 54 with SweField

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

the class FieldDecoderTest method testObservableProperty.

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

Example 55 with SweField

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

the class FieldDecoderTest method testTextWithValue.

@Test
public void testTextWithValue() throws DecodingException {
    ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.TEXT_TYPE).put(JSONConstants.VALUE, TEXT_VALUE);
    SweField field = checkCommon(json, true);
    assertThat(field.getElement(), is(instanceOf(SweText.class)));
    SweText swe = (SweText) field.getElement();
    errors.checkThat(swe.getValue(), is(TEXT_VALUE));
}
Also used : SweText(org.n52.shetland.ogc.swe.simpleType.SweText) 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