use of org.n52.svalbard.decode.DecoderKey in project arctic-sea by 52North.
the class GetFeatureOfInterestResponseDecoderTest method testMultiCurve.
@Test
public void testMultiCurve() throws XmlException, IOException, DecodingException {
try {
XmlObject xml = XmlObject.Factory.parse(getClass().getResourceAsStream("/GetFeatureOfInterestResponse.xml"));
DecoderKey decoderKey = CodingHelper.getDecoderKey(xml);
System.out.println(decoderKey);
Decoder<GetFeatureOfInterestResponse, XmlObject> decoder = decoderRepository.getDecoder(decoderKey);
GetFeatureOfInterestResponse response = decoder.decode(xml);
assertThat(response, is(notNullValue()));
assertThat(response.getAbstractFeature(), is(instanceOf(FeatureCollection.class)));
FeatureCollection abstractFeature = (FeatureCollection) response.getAbstractFeature();
assertThat(abstractFeature.getMembers().size(), is(266));
System.out.println("feature: " + response.getAbstractFeature());
} catch (Throwable t) {
t.printStackTrace(System.out);
throw t;
}
}
use of org.n52.svalbard.decode.DecoderKey in project arctic-sea by 52North.
the class CodingHelper method xmlStringDecoderKeysForOperationAndMediaType.
public static Set<DecoderKey> xmlStringDecoderKeysForOperationAndMediaType(String service, String version, Enum<?>... operations) {
HashSet<DecoderKey> set = new HashSet<>(operations.length);
for (Enum<?> o : operations) {
set.add(new XmlStringOperationDecoderKey(service, version, o, MediaTypes.TEXT_XML));
set.add(new XmlStringOperationDecoderKey(service, version, o, MediaTypes.APPLICATION_XML));
}
return set;
}
use of org.n52.svalbard.decode.DecoderKey in project arctic-sea by 52North.
the class CodingHelper method xmlStringDecoderKeysForOperationAndMediaType.
public static Set<DecoderKey> xmlStringDecoderKeysForOperationAndMediaType(String service, String version, String... operations) {
HashSet<DecoderKey> set = new HashSet<>(operations.length);
for (String o : operations) {
set.add(new XmlStringOperationDecoderKey(service, version, o, MediaTypes.TEXT_XML));
set.add(new XmlStringOperationDecoderKey(service, version, o, MediaTypes.APPLICATION_XML));
}
return set;
}
use of org.n52.svalbard.decode.DecoderKey in project arctic-sea by 52North.
the class AbstractXmlBindingTest method test_SoapNoPrefix.
@Test
public void test_SoapNoPrefix() throws CodedException {
DecoderKey decoderKey = binding.getDecoderKey(xmlStringSoapNoPrefix, characterEncoding);
assertTrue(decoderKey instanceof XmlNamespaceOperationDecoderKey);
assertTrue(SoapConstants.NS_SOAP_12.equals(((XmlNamespaceOperationDecoderKey) decoderKey).getNamespace()));
}
use of org.n52.svalbard.decode.DecoderKey in project arctic-sea by 52North.
the class AbstractXmlBindingTest method test_GetObs.
@Test
public void test_GetObs() throws CodedException {
DecoderKey decoderKey = binding.getDecoderKey(xmlStringGetObs, characterEncoding);
if (decoderKey instanceof OperationDecoderKey) {
assertThat(((OperationDecoderKey) decoderKey).getService(), is("SOS"));
assertThat(((OperationDecoderKey) decoderKey).getVersion(), is("2.0.0"));
assertThat(((OperationDecoderKey) decoderKey).getOperation(), is("GetObservation"));
}
}
Aggregations