use of org.graylog2.shared.inputs.InputLauncher in project graylog2-server by Graylog2.
the class InputEventListenerTest method inputCreatedDoesNotStartLocalInputOnAnyNode.
@Test
public void inputCreatedDoesNotStartLocalInputOnAnyNode() throws Exception {
final String inputId = "input-id";
final Input input = mock(Input.class);
when(inputService.find(inputId)).thenReturn(input);
when(nodeId.toString()).thenReturn("node-id");
when(input.getNodeId()).thenReturn("other-node-id");
when(input.isGlobal()).thenReturn(false);
final MessageInput messageInput = mock(MessageInput.class);
when(inputService.getMessageInput(input)).thenReturn(messageInput);
listener.inputCreated(InputCreated.create(inputId));
verify(inputLauncher, never()).launch(messageInput);
}
use of org.graylog2.shared.inputs.InputLauncher in project graylog2-server by Graylog2.
the class InputEventListenerTest method inputUpdatedDoesNotStartLocalInputOnLocalNodeIfItWasNotRunning.
@Test
public void inputUpdatedDoesNotStartLocalInputOnLocalNodeIfItWasNotRunning() throws Exception {
final String inputId = "input-id";
final Input input = mock(Input.class);
@SuppressWarnings("unchecked") final IOState<MessageInput> inputState = mock(IOState.class);
when(inputState.getState()).thenReturn(IOState.Type.STOPPED);
when(inputService.find(inputId)).thenReturn(input);
when(inputRegistry.getInputState(inputId)).thenReturn(inputState);
when(nodeId.toString()).thenReturn("node-id");
when(input.getNodeId()).thenReturn("node-id");
when(input.isGlobal()).thenReturn(false);
final MessageInput messageInput = mock(MessageInput.class);
when(inputService.getMessageInput(input)).thenReturn(messageInput);
listener.inputUpdated(InputUpdated.create(inputId));
verify(inputLauncher, never()).launch(messageInput);
}
use of org.graylog2.shared.inputs.InputLauncher in project graylog2-server by Graylog2.
the class InputEventListenerTest method inputUpdatedDoesNotStartLocalInputOnOtherNode.
@Test
public void inputUpdatedDoesNotStartLocalInputOnOtherNode() throws Exception {
final String inputId = "input-id";
final Input input = mock(Input.class);
@SuppressWarnings("unchecked") final IOState<MessageInput> inputState = mock(IOState.class);
when(inputState.getState()).thenReturn(IOState.Type.RUNNING);
when(inputService.find(inputId)).thenReturn(input);
when(nodeId.toString()).thenReturn("node-id");
when(input.getNodeId()).thenReturn("other-node-id");
when(input.isGlobal()).thenReturn(false);
final MessageInput messageInput = mock(MessageInput.class);
when(inputService.getMessageInput(input)).thenReturn(messageInput);
listener.inputUpdated(InputUpdated.create(inputId));
verify(inputLauncher, never()).launch(messageInput);
}
use of org.graylog2.shared.inputs.InputLauncher in project graylog2-server by Graylog2.
the class InputEventListenerTest method inputCreatedStartsGlobalInputOnOtherNode.
@Test
public void inputCreatedStartsGlobalInputOnOtherNode() throws Exception {
final String inputId = "input-id";
final Input input = mock(Input.class);
when(inputService.find(inputId)).thenReturn(input);
when(nodeId.toString()).thenReturn("node-id");
when(input.getNodeId()).thenReturn("other-node-id");
when(input.isGlobal()).thenReturn(true);
final MessageInput messageInput = mock(MessageInput.class);
when(inputService.getMessageInput(input)).thenReturn(messageInput);
listener.inputCreated(InputCreated.create(inputId));
verify(inputLauncher, times(1)).launch(messageInput);
}
use of org.graylog2.shared.inputs.InputLauncher in project graylog2-server by Graylog2.
the class InputEventListenerTest method inputUpdatedRestartsGlobalInputOnAnyNode.
@Test
public void inputUpdatedRestartsGlobalInputOnAnyNode() throws Exception {
final String inputId = "input-id";
final Input input = mock(Input.class);
@SuppressWarnings("unchecked") final IOState<MessageInput> inputState = mock(IOState.class);
when(inputState.getState()).thenReturn(IOState.Type.RUNNING);
when(inputService.find(inputId)).thenReturn(input);
when(inputRegistry.getInputState(inputId)).thenReturn(inputState);
when(nodeId.toString()).thenReturn("node-id");
when(input.getNodeId()).thenReturn("other-node-id");
when(input.isGlobal()).thenReturn(true);
final MessageInput messageInput = mock(MessageInput.class);
when(inputService.getMessageInput(input)).thenReturn(messageInput);
listener.inputUpdated(InputUpdated.create(inputId));
verify(inputLauncher, times(1)).launch(messageInput);
}
Aggregations