Search in sources :

Example 6 with DecoderKey

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;
    }
}
Also used : GetFeatureOfInterestResponse(org.n52.shetland.ogc.sos.response.GetFeatureOfInterestResponse) FeatureCollection(org.n52.shetland.ogc.om.features.FeatureCollection) XmlObject(org.apache.xmlbeans.XmlObject) Test(org.junit.Test)

Example 7 with DecoderKey

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;
}
Also used : DecoderKey(org.n52.svalbard.decode.DecoderKey) OperationDecoderKey(org.n52.svalbard.decode.OperationDecoderKey) XmlStringOperationDecoderKey(org.n52.svalbard.decode.XmlStringOperationDecoderKey) XmlNamespaceDecoderKey(org.n52.svalbard.decode.XmlNamespaceDecoderKey) XmlStringOperationDecoderKey(org.n52.svalbard.decode.XmlStringOperationDecoderKey) HashSet(java.util.HashSet)

Example 8 with DecoderKey

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;
}
Also used : DecoderKey(org.n52.svalbard.decode.DecoderKey) OperationDecoderKey(org.n52.svalbard.decode.OperationDecoderKey) XmlStringOperationDecoderKey(org.n52.svalbard.decode.XmlStringOperationDecoderKey) XmlNamespaceDecoderKey(org.n52.svalbard.decode.XmlNamespaceDecoderKey) XmlStringOperationDecoderKey(org.n52.svalbard.decode.XmlStringOperationDecoderKey) HashSet(java.util.HashSet)

Example 9 with DecoderKey

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()));
}
Also used : XmlNamespaceOperationDecoderKey(org.n52.svalbard.decode.XmlNamespaceOperationDecoderKey) OperationDecoderKey(org.n52.svalbard.decode.OperationDecoderKey) XmlNamespaceOperationDecoderKey(org.n52.svalbard.decode.XmlNamespaceOperationDecoderKey) DecoderKey(org.n52.svalbard.decode.DecoderKey) Test(org.junit.Test)

Example 10 with DecoderKey

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"));
    }
}
Also used : OperationDecoderKey(org.n52.svalbard.decode.OperationDecoderKey) XmlNamespaceOperationDecoderKey(org.n52.svalbard.decode.XmlNamespaceOperationDecoderKey) DecoderKey(org.n52.svalbard.decode.DecoderKey) OperationDecoderKey(org.n52.svalbard.decode.OperationDecoderKey) XmlNamespaceOperationDecoderKey(org.n52.svalbard.decode.XmlNamespaceOperationDecoderKey) Test(org.junit.Test)

Aggregations

DecoderKey (org.n52.svalbard.decode.DecoderKey)9 OperationDecoderKey (org.n52.svalbard.decode.OperationDecoderKey)8 XmlStringOperationDecoderKey (org.n52.svalbard.decode.XmlStringOperationDecoderKey)6 Test (org.junit.Test)5 XmlNamespaceOperationDecoderKey (org.n52.svalbard.decode.XmlNamespaceOperationDecoderKey)5 HashSet (java.util.HashSet)4 XmlNamespaceDecoderKey (org.n52.svalbard.decode.XmlNamespaceDecoderKey)4 XmlObject (org.apache.xmlbeans.XmlObject)2 NoApplicableCodeException (org.n52.shetland.ogc.ows.exception.NoApplicableCodeException)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 OwsDecodingException (org.n52.iceland.coding.decode.OwsDecodingException)1 FeatureCollection (org.n52.shetland.ogc.om.features.FeatureCollection)1 InvalidParameterValueException (org.n52.shetland.ogc.ows.exception.InvalidParameterValueException)1 MissingParameterValueException (org.n52.shetland.ogc.ows.exception.MissingParameterValueException)1 OwsOperationKey (org.n52.shetland.ogc.ows.service.OwsOperationKey)1 OwsServiceCommunicationObject (org.n52.shetland.ogc.ows.service.OwsServiceCommunicationObject)1 GetFeatureOfInterestResponse (org.n52.shetland.ogc.sos.response.GetFeatureOfInterestResponse)1