Search in sources :

Example 1 with StatisticsServiceEventHandler

use of org.n52.iceland.statistics.api.interfaces.StatisticsServiceEventHandler in project arctic-sea by 52North.

the class EventHandlerFinderTest method findDirectDefaultServiceEvent.

@Test
public void findDirectDefaultServiceEvent() {
    Map<String, StatisticsServiceEventHandler<?>> handlers = new HashMap<>();
    CountingOutputStreamEventHandler handler = new CountingOutputStreamEventHandler();
    CountingOutputStreamEvent request = new CountingOutputStreamEvent();
    handlers.put(request.getClass().getSimpleName(), handler);
    Assert.assertNotNull(EventHandlerFinder.findHandler(request, handlers));
}
Also used : HashMap(java.util.HashMap) CountingOutputStreamEvent(org.n52.iceland.event.events.CountingOutputStreamEvent) CountingOutputStreamEventHandler(org.n52.iceland.statistics.impl.handlers.CountingOutputStreamEventHandler) StatisticsServiceEventHandler(org.n52.iceland.statistics.api.interfaces.StatisticsServiceEventHandler) Test(org.junit.Test)

Example 2 with StatisticsServiceEventHandler

use of org.n52.iceland.statistics.api.interfaces.StatisticsServiceEventHandler in project arctic-sea by 52North.

the class EventHandlerFinderTest method findNoHandlers.

@Test(expected = NullPointerException.class)
public void findNoHandlers() {
    Map<String, StatisticsServiceEventHandler<?>> handlers = new HashMap<>();
    DefaultServiceEventHandler handler = new DefaultServiceEventHandler();
    handlers.put("morpheus", handler);
    GetCapabilitiesRequest request = new GetCapabilitiesRequest("SOS");
    EventHandlerFinder.findHandler(request, handlers);
}
Also used : GetCapabilitiesRequest(org.n52.shetland.ogc.ows.service.GetCapabilitiesRequest) HashMap(java.util.HashMap) StatisticsServiceEventHandler(org.n52.iceland.statistics.api.interfaces.StatisticsServiceEventHandler) DefaultServiceEventHandler(org.n52.iceland.statistics.impl.handlers.DefaultServiceEventHandler) Test(org.junit.Test)

Example 3 with StatisticsServiceEventHandler

use of org.n52.iceland.statistics.api.interfaces.StatisticsServiceEventHandler 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)

Aggregations

HashMap (java.util.HashMap)3 Test (org.junit.Test)3 StatisticsServiceEventHandler (org.n52.iceland.statistics.api.interfaces.StatisticsServiceEventHandler)3 CountingOutputStreamEvent (org.n52.iceland.event.events.CountingOutputStreamEvent)1 CountingOutputStreamEventHandler (org.n52.iceland.statistics.impl.handlers.CountingOutputStreamEventHandler)1 DefaultServiceEventHandler (org.n52.iceland.statistics.impl.handlers.DefaultServiceEventHandler)1 CodedExceptionEventHandler (org.n52.iceland.statistics.impl.handlers.exceptions.CodedExceptionEventHandler)1 OperationNotSupportedException (org.n52.shetland.ogc.ows.exception.OperationNotSupportedException)1 GetCapabilitiesRequest (org.n52.shetland.ogc.ows.service.GetCapabilitiesRequest)1