use of org.n52.shetland.ogc.om.values.QuantityValue in project arctic-sea by 52North.
the class SweCommonDecoderV101Test method should_decode_Boolean_with_Quality_Quantity.
@Test
public void should_decode_Boolean_with_Quality_Quantity() throws DecodingException {
final BooleanDocument xbBoolean = BooleanDocument.Factory.newInstance();
final BigDecimal quantityValue = BigDecimal.valueOf(42.5);
xbBoolean.addNewBoolean().addNewQuality().addNewQuantity().setValue(quantityValue.doubleValue());
final Object decodedObject = new SweCommonDecoderV101().decode(xbBoolean);
assertThat(decodedObject, is(instanceOf(SweBoolean.class)));
final SweBoolean sweBoolean = (SweBoolean) decodedObject;
assertThat(sweBoolean.isSetQuality(), is(true));
assertThat(sweBoolean.getQuality().size(), is(1));
assertThat(sweBoolean.getQuality().iterator().next(), is(instanceOf(SweQuantity.class)));
assertThat(((SweQuantity) sweBoolean.getQuality().iterator().next()).getValue(), is(quantityValue));
}
use of org.n52.shetland.ogc.om.values.QuantityValue in project arctic-sea by 52North.
the class GWGeologyLogCoveragePropertyEncoderTest method createQuantity.
private QuantityValue createQuantity(String definition, double value, String unit) {
QuantityValue quantity = new QuantityValue(value, unit);
quantity.setValue(value).setUom(unit).setDefinition(definition);
return quantity;
}
use of org.n52.shetland.ogc.om.values.QuantityValue in project arctic-sea by 52North.
the class TrajectoryObservationTypeEncoderTest method getQuantityObservation.
private OmObservation getQuantityObservation() throws EncodingException, ParseException, DecodingException, XmlException, IOException {
MultiObservationValues<List<TimeLocationValueTriple>> multiObservationValues = new MultiObservationValues<List<TimeLocationValueTriple>>();
TLVTValue tlvtValue = new TLVTValue();
tlvtValue.addValue(getTimeLocationValueTriple(new QuantityValue(15.6, "C")));
tlvtValue.addValue(getTimeLocationValueTriple(new QuantityValue(16.5, "C")));
tlvtValue.addValue(getTimeLocationValueTriple(new QuantityValue(17.6, "C")));
tlvtValue.addValue(getTimeLocationValueTriple(new QuantityValue(18.7, "C")));
multiObservationValues.setValue(tlvtValue);
OmObservation observation = createObservation();
observation.setValue(multiObservationValues);
return observation;
}
use of org.n52.shetland.ogc.om.values.QuantityValue in project arctic-sea by 52North.
the class WmlTVPEncoderv20Test method initObjects.
@Before
public void initObjects() {
encoder = new WmlTVPEncoderv20();
MultiValue<List<TimeValuePair>> value = new TVPValue();
String unit = "test-unit";
value.setUnit(unit);
TimeValuePair tvp1 = new TimeValuePair(new TimeInstant(new Date(UTC_TIMESTAMP)), new QuantityValue(52.1234567890));
List<TimeValuePair> valueList = CollectionHelper.list(tvp1);
value.setValue(valueList);
mv = new MultiObservationValues<>();
mv.setValue(value);
}
use of org.n52.shetland.ogc.om.values.QuantityValue in project arctic-sea by 52North.
the class MeasurementDecodingTest method testValue.
@Test
public void testValue() {
assertThat(observation, is(notNullValue()));
final ObservationValue<?> ov = observation.getValue();
assertThat(ov, is(notNullValue()));
assertThat(ov.getValue(), is(instanceOf(QuantityValue.class)));
QuantityValue qv = (QuantityValue) ov.getValue();
assertThat(qv.getUnit(), is(equalTo("testunit1")));
assertThat(qv.getValue(), is(equalTo(new BigDecimal("123123"))));
}
Aggregations