use of org.graylog2.plugin.inputs.util.ThroughputCounter in project graylog2-server by Graylog2.
the class UdpTransportTest method setUp.
@Before
@SuppressForbidden("Executors#newSingleThreadExecutor() is okay for tests")
public void setUp() throws Exception {
eventLoopGroupFactory = new EventLoopGroupFactory(nettyTransportConfiguration);
localMetricRegistry = new LocalMetricRegistry();
eventLoopGroup = eventLoopGroupFactory.create(1, localMetricRegistry, "test");
throughputCounter = new ThroughputCounter(eventLoopGroup);
udpTransport = new UdpTransport(CONFIGURATION, eventLoopGroupFactory, nettyTransportConfiguration, throughputCounter, localMetricRegistry);
}
use of org.graylog2.plugin.inputs.util.ThroughputCounter in project graylog2-server by Graylog2.
the class UdpTransportTest method launchTransportForBootStrapTest.
private UdpTransport launchTransportForBootStrapTest(final ChannelInboundHandler channelHandler) throws MisfireException {
final UdpTransport transport = new UdpTransport(CONFIGURATION, eventLoopGroupFactory, nettyTransportConfiguration, throughputCounter, new LocalMetricRegistry()) {
@Override
protected LinkedHashMap<String, Callable<? extends ChannelHandler>> getChannelHandlers(MessageInput input) {
final LinkedHashMap<String, Callable<? extends ChannelHandler>> handlers = new LinkedHashMap<>();
handlers.put("logging", () -> new LoggingHandler(LogLevel.INFO));
handlers.put("counter", () -> channelHandler);
handlers.putAll(super.getChannelHandlers(input));
return handlers;
}
};
final MessageInput messageInput = mock(MessageInput.class);
when(messageInput.getId()).thenReturn("TEST");
when(messageInput.getName()).thenReturn("TEST");
transport.launch(messageInput);
return transport;
}
use of org.graylog2.plugin.inputs.util.ThroughputCounter in project graylog2-server by Graylog2.
the class UdpTransportTest method receiveBufferSizeIsNotLimited.
@Test
public void receiveBufferSizeIsNotLimited() {
final int recvBufferSize = Ints.saturatedCast(Size.megabytes(1L).toBytes());
ImmutableMap<String, Object> source = ImmutableMap.of(NettyTransport.CK_BIND_ADDRESS, BIND_ADDRESS, NettyTransport.CK_PORT, PORT, NettyTransport.CK_RECV_BUFFER_SIZE, recvBufferSize);
Configuration config = new Configuration(source);
UdpTransport udpTransport = new UdpTransport(config, eventLoopGroupFactory, nettyTransportConfiguration, throughputCounter, new LocalMetricRegistry());
assertThat(udpTransport.getBootstrap(mock(MessageInput.class)).config().options().get(ChannelOption.SO_RCVBUF)).isEqualTo(recvBufferSize);
}
use of org.graylog2.plugin.inputs.util.ThroughputCounter in project graylog2-server by Graylog2.
the class UdpTransportTest method launchTransportForBootStrapTest.
private UdpTransport launchTransportForBootStrapTest(final ChannelHandler channelHandler) throws MisfireException {
final UdpTransport transport = new UdpTransport(CONFIGURATION, throughputCounter, new LocalMetricRegistry()) {
@Override
protected LinkedHashMap<String, Callable<? extends ChannelHandler>> getBaseChannelHandlers(MessageInput input) {
final LinkedHashMap<String, Callable<? extends ChannelHandler>> handlers = new LinkedHashMap<>();
handlers.put("counter", Callables.returning(channelHandler));
handlers.putAll(super.getFinalChannelHandlers(input));
return handlers;
}
};
final MessageInput messageInput = mock(MessageInput.class);
when(messageInput.getId()).thenReturn("TEST");
when(messageInput.getName()).thenReturn("TEST");
transport.launch(messageInput);
return transport;
}
use of org.graylog2.plugin.inputs.util.ThroughputCounter in project graylog2-server by Graylog2.
the class AbstractTcpTransportTest method getChildChannelHandlersGeneratesSelfSignedCertificates.
@Test
public void getChildChannelHandlersGeneratesSelfSignedCertificates() {
final Configuration configuration = new Configuration(ImmutableMap.of("bind_address", "localhost", "port", 12345, "tls_enable", true));
final AbstractTcpTransport transport = new AbstractTcpTransport(configuration, throughputCounter, localRegistry, eventLoopGroup, eventLoopGroupFactory, nettyTransportConfiguration, tlsConfiguration) {
};
final MessageInput input = mock(MessageInput.class);
assertThat(transport.getChildChannelHandlers(input)).containsKey("tls");
}
Aggregations