@Test public void fsPercentDrop() throws Exception { String token = "droppingLogsDueToFSOveruse"; String type = random(8); String loggerName = "fsPercentDrop"; int drainTimeoutSec = 1; File tempDirectoryThatWillBeInTheSameFsAsTheQueue = TestEnvironment.createTempDirectory(); tempDirectoryThatWillBeInTheSameFsAsTheQueue.deleteOnExit(); String message1 = "First log that will be dropped - " + random(5); String message2 = "And a second drop - " + random(5); LogzioSender.Builder testSenderBuilder = getLogzioSenderBuilder(token, type, drainTimeoutSec, 10 * 1000, 10 * 1000, tasks, false); setZeroThresholdQueue(testSenderBuilder); LogzioSender testSender = createLogzioSender(testSenderBuilder); sleepSeconds(2 * drainTimeoutSec); testSender.send(createJsonMessage(loggerName, message1)); testSender.send(createJsonMessage(loggerName, message2)); sleepSeconds(2 * drainTimeoutSec); mockListener.assertNumberOfReceivedMsgs(0); tempDirectoryThatWillBeInTheSameFsAsTheQueue.delete(); }
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();  }