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));
}
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();
}
}
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()));
}
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"));
}
}
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"));
}
}
Aggregations