use of org.apache.felix.http.base.internal.runtime.dto.FailedDTOHolder in project felix by apache.
the class HandlerRegistryTest method testInitialSetup.
@Test
public void testInitialSetup() {
final FailedDTOHolder holder = new FailedDTOHolder();
final ServletContextDTO dto = new ServletContextDTO();
dto.serviceId = HttpServiceFactory.HTTP_SERVICE_CONTEXT_SERVICE_ID;
assertFalse(registry.getRuntimeInfo(dto, holder));
registry.init();
assertTrue(registry.getRuntimeInfo(dto, holder));
registry.shutdown();
assertFalse(registry.getRuntimeInfo(dto, holder));
}
use of org.apache.felix.http.base.internal.runtime.dto.FailedDTOHolder in project felix by apache.
the class FailureStateHandlerTest method testAddRemoveNoContext.
@Test
public void testAddRemoveNoContext() {
final ServletInfo info = new ServletInfo("test", "/test", Collections.<String, String>emptyMap());
final FailureStateHandler handler = new FailureStateHandler();
handler.addFailure(info, DTOConstants.FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE);
final FailedDTOHolder holder = new FailedDTOHolder();
handler.getRuntimeInfo(holder);
assertEquals(1, holder.failedServletDTOs.size());
assertEquals(DTOConstants.FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE, holder.failedServletDTOs.get(0).failureReason);
holder.failedServletDTOs.clear();
handler.remove(info);
handler.getRuntimeInfo(holder);
assertEquals(0, holder.failedServletDTOs.size());
}
use of org.apache.felix.http.base.internal.runtime.dto.FailedDTOHolder in project felix by apache.
the class FailureStateHandlerTest method testAddRemoveContext.
@Test
public void testAddRemoveContext() {
final ServletInfo info1 = new ServletInfo("test", "/test", Collections.<String, String>emptyMap());
final ServletInfo info2 = new ServletInfo("test", "/test", Collections.<String, String>emptyMap());
final FailureStateHandler handler = new FailureStateHandler();
handler.addFailure(info1, 1L, DTOConstants.FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE);
handler.addFailure(info2, 2L, DTOConstants.FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE);
final FailedDTOHolder holder = new FailedDTOHolder();
handler.getRuntimeInfo(holder);
assertEquals(2, holder.failedServletDTOs.size());
assertEquals(DTOConstants.FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE, holder.failedServletDTOs.get(0).failureReason);
assertEquals(DTOConstants.FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE, holder.failedServletDTOs.get(1).failureReason);
assertContainsExactly(holder.failedServletDTOs, new long[] { 1L, 2L });
handler.remove(info1, 1L);
handler.remove(info2, 2L);
holder.failedServletDTOs.clear();
handler.getRuntimeInfo(holder);
assertEquals(0, holder.failedServletDTOs.size());
}
Aggregations