Search in sources :

Example 6 with CodedException

use of org.n52.shetland.ogc.ows.exception.CodedException in project arctic-sea by 52North.

the class EventHandlerFinderTest method findSubclassAsHandler.

@Test
public void findSubclassAsHandler() {
    Map<String, StatisticsServiceEventHandler<?>> handlers = new HashMap<>();
    CodedExceptionEventHandler handler = new CodedExceptionEventHandler();
    OperationNotSupportedException exception = new OperationNotSupportedException("GetCapabilities");
    handlers.put("CodedException", handler);
    Assert.assertNotNull(EventHandlerFinder.findHandler(exception, handlers));
}
Also used : OperationNotSupportedException(org.n52.shetland.ogc.ows.exception.OperationNotSupportedException) HashMap(java.util.HashMap) CodedExceptionEventHandler(org.n52.iceland.statistics.impl.handlers.exceptions.CodedExceptionEventHandler) StatisticsServiceEventHandler(org.n52.iceland.statistics.api.interfaces.StatisticsServiceEventHandler) Test(org.junit.Test)

Example 7 with CodedException

use of org.n52.shetland.ogc.ows.exception.CodedException in project arctic-sea by 52North.

the class CodedExceptionEventHandler method resolveAsMap.

@Override
public Map<String, Object> resolveAsMap(Exception rawException) {
    if (rawException instanceof CodedException) {
        CodedException exception = (CodedException) rawException;
        put(ServiceEventDataMapping.EX_CLASSTYPE, exception.getClass().getSimpleName());
        if (exception.getStatus() != null) {
            put(ServiceEventDataMapping.EX_STATUS, exception.getStatus().getCode());
        }
        put(ServiceEventDataMapping.CEX_LOCATOR, exception.getLocator());
        put(ServiceEventDataMapping.EX_VERSION, exception.getVersion());
        if (exception.getCode() != null) {
            put(ServiceEventDataMapping.CEX_SOAP_FAULT, exception.getCode().getSoapFaultReason());
        }
        put(ServiceEventDataMapping.EX_MESSAGE, exception.getMessage());
        return dataMap;
    } else {
        return Collections.emptyMap();
    }
}
Also used : CodedException(org.n52.shetland.ogc.ows.exception.CodedException)

Example 8 with CodedException

use of org.n52.shetland.ogc.ows.exception.CodedException 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 9 with CodedException

use of org.n52.shetland.ogc.ows.exception.CodedException 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)

Example 10 with CodedException

use of org.n52.shetland.ogc.ows.exception.CodedException in project arctic-sea by 52North.

the class AbstractXmlBindingTest method test_GetCaps.

@Test
public void test_GetCaps() throws CodedException {
    DecoderKey decoderKey = binding.getDecoderKey(xmlStringGetCaps, characterEncoding);
    if (decoderKey instanceof OperationDecoderKey) {
        assertThat(((OperationDecoderKey) decoderKey).getService(), is("SOS"));
        assertThat(((OperationDecoderKey) decoderKey).getOperation(), is("GetCapabilities"));
    }
}
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

CodedException (org.n52.shetland.ogc.ows.exception.CodedException)6 Test (org.junit.Test)5 DecoderKey (org.n52.svalbard.decode.DecoderKey)4 OperationDecoderKey (org.n52.svalbard.decode.OperationDecoderKey)4 XmlNamespaceOperationDecoderKey (org.n52.svalbard.decode.XmlNamespaceOperationDecoderKey)4 QName (javax.xml.namespace.QName)2 ExceptionType (net.opengis.ows.x11.ExceptionType)2 DefaultTVPMeasurementMetadataDocument (net.opengis.waterml.x20.DefaultTVPMeasurementMetadataDocument)2 MeasurementTimeseriesDocument (net.opengis.waterml.x20.MeasurementTimeseriesDocument)2 MeasurementTimeseriesType (net.opengis.waterml.x20.MeasurementTimeseriesType)2 TVPDefaultMetadataPropertyType (net.opengis.waterml.x20.TVPDefaultMetadataPropertyType)2 TVPMeasurementMetadataType (net.opengis.waterml.x20.TVPMeasurementMetadataType)2 MeasurementTimeseriesMetadata (org.n52.shetland.ogc.om.series.wml.MeasurementTimeseriesMetadata)2 TimeseriesMetadata (org.n52.shetland.ogc.om.series.wml.TimeseriesMetadata)2 InterpolationType (org.n52.shetland.ogc.om.series.wml.WaterMLConstants.InterpolationType)2 TVPValue (org.n52.shetland.ogc.om.values.TVPValue)2 NoApplicableCodeException (org.n52.shetland.ogc.ows.exception.NoApplicableCodeException)2 SoapFault (org.n52.shetland.w3c.soap.SoapFault)2 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1