Search in sources :

Example 1 with Category

use of net.opengis.swe.x101.CategoryDocument.Category in project arctic-sea by 52North.

the class SweCommonDecoderV101Test method should_decode_Quantity_with_Quality_Category.

@Test
public void should_decode_Quantity_with_Quality_Category() throws DecodingException {
    final QuantityDocument xbQuantity = QuantityDocument.Factory.newInstance();
    final String categoryValue = "quality-category";
    xbQuantity.addNewQuantity().addNewQuality().addNewCategory().setValue(categoryValue);
    final Object decodedObject = new SweCommonDecoderV101().decode(xbQuantity);
    assertThat(decodedObject, is(instanceOf(SweQuantity.class)));
    final SweQuantity sweQuantity = (SweQuantity) decodedObject;
    assertThat(sweQuantity.isSetQuality(), is(true));
    assertThat(sweQuantity.getQuality().size(), is(1));
    assertThat(sweQuantity.getQuality().iterator().next(), is(instanceOf(SweCategory.class)));
    assertThat(((SweCategory) sweQuantity.getQuality().iterator().next()).getValue(), is(categoryValue));
}
Also used : SweQuantity(org.n52.shetland.ogc.swe.simpleType.SweQuantity) QuantityDocument(net.opengis.swe.x101.QuantityDocument) Test(org.junit.Test)

Example 2 with Category

use of net.opengis.swe.x101.CategoryDocument.Category in project arctic-sea by 52North.

the class SweCommonEncoderv101Test method should_encode_count_with_quality_Category.

@Test
public void should_encode_count_with_quality_Category() throws EncodingException {
    final String qualityCategoryValue = "quality-category-value";
    final SweCount sosCount = (SweCount) new SweCount().setQuality(Lists.newArrayList((SweQuality) new SweCategory().setValue(qualityCategoryValue)));
    final XmlObject encode = sweCommonEncoderv101.encode(sosCount);
    assertThat(encode, instanceOf(Count.class));
    final Count xbCount = (Count) encode;
    assertThat(xbCount.getQualityArray(), is(not(nullValue())));
    assertThat(xbCount.getQualityArray().length, is(1));
    assertThat(xbCount.getQualityArray(0).isSetCategory(), is(true));
    assertThat(xbCount.getQualityArray(0).getCategory().getValue(), is(qualityCategoryValue));
}
Also used : SweCategory(org.n52.shetland.ogc.swe.simpleType.SweCategory) SweCount(org.n52.shetland.ogc.swe.simpleType.SweCount) XmlObject(org.apache.xmlbeans.XmlObject) SweCount(org.n52.shetland.ogc.swe.simpleType.SweCount) Count(net.opengis.swe.x101.CountDocument.Count) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 Count (net.opengis.swe.x101.CountDocument.Count)1 QuantityDocument (net.opengis.swe.x101.QuantityDocument)1 XmlObject (org.apache.xmlbeans.XmlObject)1 SweCategory (org.n52.shetland.ogc.swe.simpleType.SweCategory)1 SweCount (org.n52.shetland.ogc.swe.simpleType.SweCount)1 SweQuantity (org.n52.shetland.ogc.swe.simpleType.SweQuantity)1