Search in sources :

Example 16 with Version

use of org.graylog2.plugin.Version in project graylog2-server by Graylog2.

the class UdpTransportTest method transportReceivesDataExactlyRecvBufferSize.

@Test
public void transportReceivesDataExactlyRecvBufferSize() throws Exception {
    final CountingChannelUpstreamHandler handler = new CountingChannelUpstreamHandler();
    final UdpTransport transport = launchTransportForBootStrapTest(handler);
    final InetSocketAddress localAddress = (InetSocketAddress) transport.getLocalAddress();
    // This will be variable depending on the version of the IP protocol and the UDP packet size.
    final int udpOverhead = 16;
    final int maxPacketSize = RECV_BUFFER_SIZE - udpOverhead;
    sendUdpDatagram(BIND_ADDRESS, localAddress.getPort(), maxPacketSize);
    await().atMost(5, TimeUnit.SECONDS).until(new Callable<Boolean>() {

        @Override
        public Boolean call() throws Exception {
            return !handler.getBytesWritten().isEmpty();
        }
    });
    transport.stop();
    assertThat(handler.getBytesWritten()).containsOnly(maxPacketSize);
}
Also used : InetSocketAddress(java.net.InetSocketAddress) MisfireException(org.graylog2.plugin.inputs.MisfireException) IOException(java.io.IOException) Test(org.junit.Test)

Example 17 with Version

use of org.graylog2.plugin.Version in project graylog2-server by Graylog2.

the class GettingStartedResource method dismissGettingStarted.

@POST
@Path("dismiss")
@ApiOperation("Dismiss auto-showing getting started guide for this version")
@AuditEvent(type = AuditEventTypes.GETTING_STARTED_GUIDE_OPT_OUT_CREATE)
public void dismissGettingStarted() {
    final GettingStartedState gettingStartedState = clusterConfigService.getOrDefault(GettingStartedState.class, GettingStartedState.create(Sets.<String>newHashSet()));
    gettingStartedState.dismissedInVersions().add(currentMinorVersionString());
    clusterConfigService.write(gettingStartedState);
}
Also used : GettingStartedState(org.graylog2.gettingstarted.GettingStartedState) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) ApiOperation(io.swagger.annotations.ApiOperation) AuditEvent(org.graylog2.audit.jersey.AuditEvent)

Aggregations

RawMessage (org.graylog2.plugin.journal.RawMessage)10 Message (org.graylog2.plugin.Message)9 Test (org.junit.Test)9 DateTime (org.joda.time.DateTime)5 IOException (java.io.IOException)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 ApiOperation (io.swagger.annotations.ApiOperation)2 Request (okhttp3.Request)2 Response (okhttp3.Response)2 GettingStartedState (org.graylog2.gettingstarted.GettingStartedState)2 Notification (org.graylog2.notifications.Notification)2 JsonParseException (com.fasterxml.jackson.core.JsonParseException)1 ServiceManager (com.google.common.util.concurrent.ServiceManager)1 ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)1 ProvisionException (com.google.inject.ProvisionException)1 File (java.io.File)1 InetSocketAddress (java.net.InetSocketAddress)1 URI (java.net.URI)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1