use of org.graylog2.plugin.inputs.MessageInput 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);
}
use of org.graylog2.plugin.inputs.MessageInput in project graylog2-server by Graylog2.
the class InputEventListenerTest method inputCreatedStartsLocalInputOnLocalNode.
@Test
public void inputCreatedStartsLocalInputOnLocalNode() 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("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, times(1)).launch(messageInput);
}
use of org.graylog2.plugin.inputs.MessageInput in project graylog2-server by Graylog2.
the class InputEventListenerTest method inputUpdatedRestartsLocalInputOnLocalNode.
@Test
public void inputUpdatedRestartsLocalInputOnLocalNode() 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("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, times(1)).launch(messageInput);
}
use of org.graylog2.plugin.inputs.MessageInput in project graylog2-server by Graylog2.
the class InputEventListenerTest method inputCreatedStopsInputIfItIsRunning.
@Test
public void inputCreatedStopsInputIfItIsRunning() throws Exception {
final String inputId = "input-id";
final Input input = mock(Input.class);
@SuppressWarnings("unchecked") final IOState<MessageInput> inputState = mock(IOState.class);
when(inputService.find(inputId)).thenReturn(input);
when(inputRegistry.getInputState(inputId)).thenReturn(inputState);
listener.inputCreated(InputCreated.create(inputId));
verify(inputRegistry, times(1)).remove(inputState);
}
use of org.graylog2.plugin.inputs.MessageInput in project graylog2-server by Graylog2.
the class IOStateTest method testNotEqualIfDifferentState.
@Test
public void testNotEqualIfDifferentState() throws Exception {
EventBus eventBus = mock(EventBus.class);
MessageInput messageInput = mock(MessageInput.class);
IOState<MessageInput> inputState1 = new IOState<>(eventBus, messageInput, IOState.Type.RUNNING);
IOState<MessageInput> inputState2 = new IOState<>(eventBus, messageInput, IOState.Type.STOPPED);
assertTrue(inputState1.equals(inputState2));
assertTrue(inputState2.equals(inputState1));
}
Aggregations