use of org.n52.shetland.ogc.om.values.Value in project arctic-sea by 52North.
the class SweCommonEncoderv101Test method should_encode_Datarecord_with_fieldCategory.
@Test
public void should_encode_Datarecord_with_fieldCategory() throws EncodingException {
final String field1Name = "test-name";
final String field1Value = "test-value";
final String codeSpace = "test-codespace";
final XmlObject encode = sweCommonEncoderv101.encode(new SweDataRecord().addField(new SweField(field1Name, new SweCategory().setCodeSpace(codeSpace).setValue(field1Value))));
assertThat(encode, is(instanceOf(DataRecordType.class)));
final DataRecordType xbDataRecord = (DataRecordType) encode;
final DataComponentPropertyType field1 = xbDataRecord.getFieldArray(0);
assertThat(xbDataRecord.getFieldArray().length, is(1));
assertThat(field1.isSetCategory(), is(TRUE));
assertThat(field1.getName(), is(field1Name));
assertThat(field1.getCategory().getValue(), is(field1Value));
assertThat(field1.getCategory().getCodeSpace().getHref(), is(codeSpace));
}
use of org.n52.shetland.ogc.om.values.Value in project arctic-sea by 52North.
the class OmDecoderV20Test method testComplexObservation.
@Test
public void testComplexObservation() throws XmlException, DecodingException {
XmlObject xml = XmlObject.Factory.parse(getComplexObservationXml());
// FIXME
// Object decoded = CodingHelper.decodeXmlObject(xml);
Object decoded = omDecoderv20.decode(xml);
assertThat(decoded, is(instanceOf(OmObservation.class)));
OmObservation observation = (OmObservation) decoded;
assertThat(observation.getValue(), is(instanceOf(SingleObservationValue.class)));
assertThat(observation.getValue().getValue(), is(instanceOf(ComplexValue.class)));
ComplexValue value = (ComplexValue) observation.getValue().getValue();
assertThat(value.getValue(), is(notNullValue()));
SweAbstractDataRecord dataRecord = value.getValue();
assertThat(dataRecord.getFields(), hasSize(5));
SweField field1 = dataRecord.getFields().get(0);
SweField field2 = dataRecord.getFields().get(1);
SweField field3 = dataRecord.getFields().get(2);
SweField field4 = dataRecord.getFields().get(3);
SweField field5 = dataRecord.getFields().get(4);
errors.checkThat(field1.getElement().getDefinition(), is("http://example.tld/phenomenon/child/1"));
errors.checkThat(field2.getElement().getDefinition(), is("http://example.tld/phenomenon/child/2"));
errors.checkThat(field3.getElement().getDefinition(), is("http://example.tld/phenomenon/child/3"));
errors.checkThat(field4.getElement().getDefinition(), is("http://example.tld/phenomenon/child/4"));
errors.checkThat(field5.getElement().getDefinition(), is("http://example.tld/phenomenon/child/5"));
errors.checkThat(field1.getElement().getDataComponentType(), is(SweDataComponentType.Quantity));
errors.checkThat(field2.getElement().getDataComponentType(), is(SweDataComponentType.Boolean));
errors.checkThat(field3.getElement().getDataComponentType(), is(SweDataComponentType.Count));
errors.checkThat(field4.getElement().getDataComponentType(), is(SweDataComponentType.Text));
errors.checkThat(field5.getElement().getDataComponentType(), is(SweDataComponentType.Category));
}
use of org.n52.shetland.ogc.om.values.Value 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.Value 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.Value 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);
}
Aggregations