use of org.n52.shetland.ogc.om.values.CategoryValue 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));
}
use of org.n52.shetland.ogc.om.values.CategoryValue in project arctic-sea by 52North.
the class SweCommonDecoderV101Test method should_decode_Category_with_Quality_QuantityRange.
@Test
public void should_decode_Category_with_Quality_QuantityRange() throws DecodingException {
final CategoryDocument xbQuantity = CategoryDocument.Factory.newInstance();
final BigDecimal rangeStart = BigDecimal.valueOf(1.0);
final BigDecimal rangeEnd = BigDecimal.valueOf(2.0);
final ArrayList<BigDecimal> categoryValue = Lists.newArrayList(rangeStart, rangeEnd);
xbQuantity.addNewCategory().addNewQuality().addNewQuantityRange().setValue(categoryValue);
final Object decodedObject = new SweCommonDecoderV101().decode(xbQuantity);
assertThat(decodedObject, is(instanceOf(SweCategory.class)));
final SweCategory sweCategory = (SweCategory) decodedObject;
assertThat(sweCategory.isSetQuality(), is(true));
assertThat(sweCategory.getQuality().size(), is(1));
assertThat(sweCategory.getQuality().iterator().next(), is(instanceOf(SweQuantityRange.class)));
assertThat(((SweQuantityRange) sweCategory.getQuality().iterator().next()).getValue(), is(new RangeValue<BigDecimal>(rangeStart, rangeEnd)));
}
use of org.n52.shetland.ogc.om.values.CategoryValue in project arctic-sea by 52North.
the class GWGeologyLogCoveragePropertyEncoderTest method createProfileLevel.
private List<Value<?>> createProfileLevel() {
List<Value<?>> list = Lists.newArrayList();
CategoryValue category = new CategoryValue("weathered grey brown basalt", "unknown");
category.setDefinition("http://www.opengis.net/def/gwml/2.0/observedProperty/earthMaterial");
category.addName(new CodeType("lithology"));
list.add(category);
TextValue text = new TextValue("weathered grey brown basalt");
text.setDefinition("http://www.opengis.net/def/gwml/2.0/observedProperty/earthMaterial");
text.addName(new CodeType("text"));
list.add(text);
return list;
}
use of org.n52.shetland.ogc.om.values.CategoryValue in project arctic-sea by 52North.
the class ProfileValueTest method createProfileLevel.
private List<Value<?>> createProfileLevel() {
List<Value<?>> list = Lists.newArrayList();
CategoryValue category = new CategoryValue("weathered grey brown basalt", "unknown");
category.setDefinition("http://www.opengis.net/def/gwml/2.0/observedProperty/earthMaterial");
category.addName(new CodeType("lithology"));
list.add(category);
return list;
}
use of org.n52.shetland.ogc.om.values.CategoryValue in project arctic-sea by 52North.
the class CategoryObservationDecodingTest method testObservation.
@Test
public void testObservation() {
assertThat(observation, is(notNullValue()));
final String type = observation.getObservationConstellation().getObservationType();
assertThat(type, is(equalTo(OmConstants.OBS_TYPE_CATEGORY_OBSERVATION)));
final ObservationValue<?> value = observation.getValue();
assertThat(value, is(instanceOf(SingleObservationValue.class)));
assertThat(value.getPhenomenonTime(), is(instanceOf(TimeInstant.class)));
TimeInstant pt = (TimeInstant) value.getPhenomenonTime();
assertThat(pt.getValue(), is(equalTo(phenomenonTime)));
assertThat(value.getValue(), is(instanceOf(CategoryValue.class)));
CategoryValue v = (CategoryValue) value.getValue();
assertThat(v.getValue(), is(equalTo("Some Value")));
assertThat(v.getUnit(), is(equalTo("http://52north.org/")));
}
Aggregations