use of org.n52.shetland.ogc.ows.exception.OwsExceptionReport in project arctic-sea by 52North.
the class SosDecoderv20Test method should_decode_text_swesExtensions.
@Test
public void should_decode_text_swesExtensions() throws XmlException, OwsExceptionReport, DecodingException {
final GetObservationDocument doc = GetObservationDocument.Factory.parse("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<sos:GetObservation service=\"SOS\" version=\"2.0.0\"\n" + " xmlns:sos=\"http://www.opengis.net/sos/2.0\"\n" + " xmlns:swe=\"http://www.opengis.net/swe/2.0\"\n" + " xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n" + " xmlns:swes=\"http://www.opengis.net/swes/2.0\"\n" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.opengis.net/sos/2.0 http://schemas.opengis.net/sos/2.0/sos.xsd\">\n" + " <swes:extension>\n" + " <swe:Text definition=\"my-text-extension\">\n" + " <swe:value>true</swe:value>\n" + " </swe:Text>\n" + " </swes:extension>\n" + "</sos:GetObservation>");
final OwsServiceCommunicationObject decodedObject = decoder.decode(doc);
assertThat(decodedObject, instanceOf(GetObservationRequest.class));
final GetObservationRequest request = (GetObservationRequest) decodedObject;
assertThat(request.getExtension("my-text-extension").map(e -> e.getValue()).map(v -> (SweText) v).map(v -> v.getValue()).orElse(null), is("true"));
}
use of org.n52.shetland.ogc.ows.exception.OwsExceptionReport in project arctic-sea by 52North.
the class FesDecoderV20Test method should_parse_PropertyIsEqualTo_Filter.
/**
* Test PropertyIsEqualTo filter decoding
*
* @throws OwsExceptionReport
*/
@Test
public void should_parse_PropertyIsEqualTo_Filter() throws DecodingException {
PropertyIsEqualToDocument propertyIsEqualToDoc = PropertyIsEqualToDocument.Factory.newInstance();
BinaryComparisonOpType propertyIsEqualToType = propertyIsEqualToDoc.addNewPropertyIsEqualTo();
// valueReference
XmlString valueReference = (XmlString) propertyIsEqualToType.addNewExpression().substitute(FilterConstants.QN_VALUE_REFERENCE, XmlString.type);
valueReference.setStringValue(TEST_VALUE_REFERENCE);
// literal
LiteralType literalType = (LiteralType) propertyIsEqualToType.addNewExpression().substitute(FilterConstants.QN_LITERAL, LiteralType.type);
XmlString newInstance = XmlString.Factory.newInstance();
newInstance.setStringValue(TEST_LITERAL);
literalType.set(newInstance);
// create document
FilterDocument filterDoc = FilterDocument.Factory.newInstance();
FilterType filterType = filterDoc.addNewFilter();
filterType.setComparisonOps(propertyIsEqualToType);
filterType.getComparisonOps().substitute(FilterConstants.QN_PROPERTY_IS_EQUAL_TO, BinaryComparisonOpType.type);
ComparisonFilter comparisonFilter = (ComparisonFilter) decoder.decode(filterDoc);
// test
assertThat(comparisonFilter.getOperator(), is(FilterConstants.ComparisonOperator.PropertyIsEqualTo));
assertThat(comparisonFilter.getValueReference(), is(TEST_VALUE_REFERENCE));
assertThat(comparisonFilter.getValue(), is(TEST_LITERAL));
}
Aggregations