use of org.n52.shetland.ogc.om.values.TextValue in project arctic-sea by 52North.
the class SweCommonEncoderv20Test method shouldEncodeDataRecordWithSweTextField.
@Test
public void shouldEncodeDataRecordWithSweTextField() throws OwsExceptionReport, EncodingException {
final SweDataRecord record = new SweDataRecord();
record.addField(new SweField("text", new SweText().setValue("textValue").setDefinition("textDef")));
record.addField(new SweField("count", new SweCount().setValue(2).setDefinition("countDef")));
final XmlObject encoded = sweCommonEncoderv20.encode(record);
// validateDocument throws exceptions if the document is invalid
XmlHelper.validateDocument(encoded, EncodingException::new);
}
use of org.n52.shetland.ogc.om.values.TextValue in project arctic-sea by 52North.
the class SweCommonDecoderV101Test method should_decode_Count_with_Quality_Text.
@Test
public void should_decode_Count_with_Quality_Text() throws DecodingException {
final CountDocument xbCount = CountDocument.Factory.newInstance();
final String textValue = "quality-text";
xbCount.addNewCount().addNewQuality().addNewText().setValue(textValue);
final Object decodedObject = new SweCommonDecoderV101().decode(xbCount);
assertThat(decodedObject, is(instanceOf(SweCount.class)));
final SweCount sweCount = (SweCount) decodedObject;
assertThat(sweCount.isSetQuality(), is(true));
assertThat(sweCount.getQuality().size(), is(1));
assertThat(sweCount.getQuality().iterator().next(), is(instanceOf(SweText.class)));
assertThat(((SweText) sweCount.getQuality().iterator().next()).getValue(), is(textValue));
}
use of org.n52.shetland.ogc.om.values.TextValue in project arctic-sea by 52North.
the class WmlObservationProcessDecoderv20Test method getTextNamedValue.
private NamedValue<String> getTextNamedValue() {
NamedValue<String> nv = new NamedValue<String>();
nv.setName(getNameValueOfferingName());
nv.setValue(new TextValue(TEXT_OFFERING));
return nv;
}
use of org.n52.shetland.ogc.om.values.TextValue 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.TextValue in project arctic-sea by 52North.
the class BatchRequestDecoder method getDecoder.
private Decoder<OwsServiceRequest, JsonNode> getDecoder(JsonNode n) throws DecodingException {
String service = n.path(JSONConstants.SERVICE).textValue();
String version = n.path(JSONConstants.VERSION).textValue();
String request = n.path(JSONConstants.REQUEST).textValue();
OperationDecoderKey k = new OperationDecoderKey(service, version, request, MediaTypes.APPLICATION_JSON);
Decoder<OwsServiceRequest, JsonNode> decoder = getDecoder(k);
if (decoder == null) {
// TODO other exception?
throw new NoDecoderForKeyException(k);
}
return decoder;
}
Aggregations