@Test public void longDrainTimeout() throws Exception { String token = "soTestingIsSuperImportant"; String type = random(8); String loggerName = "longDrainTimeout"; int drainTimeout = 10; String message1 = "Sending one log - " + random(5); String message2 = "And one more important one - " + random(5); LogzioSender.Builder testSenderBuilder = getLogzioSenderBuilder(token, type, drainTimeout, 10 * 1000, 10 * 1000, tasks, false); LogzioSender testSender = createLogzioSender(testSenderBuilder); testSender.send(createJsonMessage(loggerName, message1)); testSender.send(createJsonMessage(loggerName, message2)); mockListener.assertNumberOfReceivedMsgs(0); sleepSeconds(drainTimeout + 1); mockListener.assertNumberOfReceivedMsgs(2); mockListener.assertLogReceivedIs(message1, token, type, loggerName, LOGLEVEL); mockListener.assertLogReceivedIs(message2, token, type, loggerName, LOGLEVEL); }
public void send(JsonObject jsonMessage) { logsQueue.enqueue(jsonMessage.toString().getBytes(StandardCharsets.UTF_8)); }
LogzioSender { public void send(JsonObject jsonMessage) { logsQueue.enqueue(jsonMessage.toString().getBytes(StandardCharsets.UTF_8)); } }
LogzioSender { public void send(JsonObject jsonMessage) { logsQueue.enqueue(jsonMessage.toString().getBytes(StandardCharsets.UTF_8)); } private  LogzioSender(HttpsRequestConfiguration httpsRequestConfiguration, int drainTimeout, boolean debug,
                         SenderStatusReporter reporter, ScheduledExecutorService tasksExecutor,
                         LogsQueue logsQueue); }
LogzioSender { public void send(JsonObject jsonMessage) { logsQueue.enqueue(jsonMessage.toString().getBytes(StandardCharsets.UTF_8)); } private  LogzioSender(HttpsRequestConfiguration httpsRequestConfiguration, int drainTimeout, boolean debug,
                         SenderStatusReporter reporter, ScheduledExecutorService tasksExecutor,
                         LogsQueue logsQueue); void start(); void stop(); void drainQueueAndSend(); void send(JsonObject jsonMessage); void send(byte[] jsonStringAsUTF8ByteArray); static Builder builder(); }
LogzioSender { public void send(JsonObject jsonMessage) { logsQueue.enqueue(jsonMessage.toString().getBytes(StandardCharsets.UTF_8)); } private  LogzioSender(HttpsRequestConfiguration httpsRequestConfiguration, int drainTimeout, boolean debug,
                         SenderStatusReporter reporter, ScheduledExecutorService tasksExecutor,
                         LogsQueue logsQueue); void start(); void stop(); void drainQueueAndSend(); void send(JsonObject jsonMessage); void send(byte[] jsonStringAsUTF8ByteArray); static Builder builder();  }