setHeadersForValidRequest(true);
nodeServlet.doPut(request, response);
verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
- verifyEnteringExitCalled(listAppender);
}
@Test
setHeadersForValidRequest(false);
nodeServlet.doPut(request, response);
verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
- verifyEnteringExitCalled(listAppender);
}
@Test
public void Given_Request_Is_HTTP_PUT_On_Publish_On_AAF_Feed_And_Cadi_Enabled_And_No_Permissions_Then_Forbidden_Response_Is_Generated() throws Exception {
- when(config.getCadiEnabeld()).thenReturn(true);
+ when(config.getCadiEnabled()).thenReturn(true);
when(config.getAafInstance("1")).thenReturn("*");
when(request.getPathInfo()).thenReturn("/publish/1/fileName");
setHeadersForValidRequest(true);
setHeadersForValidRequest(false);
nodeServlet.doDelete(request, response);
verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
- verifyEnteringExitCalled(listAppender);
}
@Test
private void verifyEnteringExitCalled(ListAppender<ILoggingEvent> listAppender) {
assertEquals("EELF0004I Entering data router node component with RequestId and InvocationId", listAppender.list.get(0).getMessage());
- assertEquals("EELF0005I Exiting data router node component with RequestId and InvocationId", listAppender.list.get(2).getMessage());
- assertEquals(3, listAppender.list.size());
+ assertEquals("EELF0005I Exiting data router node component with RequestId and InvocationId", listAppender.list.get(listAppender.list.size() -1).getMessage());
}
private void setUpConfig() throws IllegalAccessException {
when(config.isDeletePermitted("1")).thenReturn(true);
when(config.getAllDests()).thenReturn(new DestInfo[0]);
FieldUtils.writeDeclaredStaticField(NodeServlet.class, "config", config, true);
- FieldUtils.writeDeclaredStaticField(NodeMain.class, "nodeConfigManager", config, true);
+ FieldUtils.writeDeclaredStaticField(NodeRunner.class, "nodeConfigManager", config, true);
PowerMockito.when(NodeConfigManager.getInstance()).thenReturn(config);
}
when(config.isConfigured()).thenReturn(true);
when(config.isDeletePermitted("1")).thenReturn(false);
FieldUtils.writeDeclaredStaticField(NodeServlet.class, "config", config, true);
- FieldUtils.writeDeclaredStaticField(NodeMain.class, "nodeConfigManager", config, true);
+ FieldUtils.writeDeclaredStaticField(NodeRunner.class, "nodeConfigManager", config, true);
PowerMockito.when(NodeConfigManager.getInstance()).thenReturn(config);
}
when(config.isConfigured()).thenReturn(true);
when(config.isDeletePermitted("1")).thenThrow(new NullPointerException());
FieldUtils.writeDeclaredStaticField(NodeServlet.class, "config", config, true);
- FieldUtils.writeDeclaredStaticField(NodeMain.class, "nodeConfigManager", config, true);
+ FieldUtils.writeDeclaredStaticField(NodeRunner.class, "nodeConfigManager", config, true);
PowerMockito.when(NodeConfigManager.getInstance()).thenReturn(config);
}
private void setUpNodeMainDelivery() throws IllegalAccessException{
Delivery delivery = mock(Delivery.class);
doNothing().when(delivery).resetQueue(anyObject());
- FieldUtils.writeDeclaredStaticField(NodeMain.class, "delivery", delivery, true);
+ FieldUtils.writeDeclaredStaticField(NodeServer.class, "delivery", delivery, true);
}
private void setNodeConfigManagerIsConfiguredToReturnFalse() throws IllegalAccessException{