use of org.komamitsu.fluency.treasuredata.ingester.sender.TreasureDataSender in project fluency by komamitsu.
the class FluencyBuilderForTreasureDataTest method buildWithAllCustomConfig.
@Test
void buildWithAllCustomConfig() throws IOException {
String tmpdir = System.getProperty("java.io.tmpdir");
assertNotNull(tmpdir);
FluencyBuilderForTreasureData builder = new FluencyBuilderForTreasureData();
builder.setFlushAttemptIntervalMillis(200);
builder.setMaxBufferSize(Long.MAX_VALUE);
builder.setBufferChunkInitialSize(7 * 1024 * 1024);
builder.setBufferChunkRetentionSize(13 * 1024 * 1024);
builder.setBufferChunkRetentionTimeMillis(19 * 1000);
builder.setJvmHeapBufferMode(true);
builder.setWaitUntilBufferFlushed(42);
builder.setWaitUntilFlusherTerminated(24);
builder.setFileBackupDir(tmpdir);
builder.setSenderRetryIntervalMillis(1234);
builder.setSenderMaxRetryIntervalMillis(345678);
builder.setSenderRetryFactor(3.14f);
builder.setSenderRetryMax(17);
builder.setSenderWorkBufSize(123456);
;
try (Fluency fluency = builder.build(APIKEY)) {
assertEquals(Buffer.class, fluency.getBuffer().getClass());
Buffer buffer = fluency.getBuffer();
assertEquals(Long.MAX_VALUE, buffer.getMaxBufferSize());
assertEquals(tmpdir, buffer.getFileBackupDir());
assertEquals("packed_forward", buffer.bufferFormatType());
assertEquals(19 * 1000, buffer.getChunkRetentionTimeMillis());
assertEquals(2f, buffer.getChunkExpandRatio());
assertEquals(7 * 1024 * 1024, buffer.getChunkInitialSize());
assertEquals(13 * 1024 * 1024, buffer.getChunkRetentionSize());
assertTrue(buffer.getJvmHeapBufferMode());
Flusher flusher = fluency.getFlusher();
assertFalse(flusher.isTerminated());
assertEquals(200, flusher.getFlushAttemptIntervalMillis());
assertEquals(42, flusher.getWaitUntilBufferFlushed());
assertEquals(24, flusher.getWaitUntilTerminated());
assertEquals(TreasureDataSender.class, flusher.getIngester().getSender().getClass());
TreasureDataSender sender = (TreasureDataSender) flusher.getIngester().getSender();
assertEquals(1234, sender.getRetryInternalMs());
assertEquals(345678, sender.getMaxRetryInternalMs());
assertEquals(3.14f, sender.getRetryFactor());
assertEquals(17, sender.getRetryMax());
assertEquals(123456, sender.getWorkBufSize());
}
}
Aggregations