Buffer implements Closeable { public void flush(Ingester ingester, boolean force) throws IOException { LOG.trace("flush(): force={}, bufferUsage={}", force, getBufferUsage()); flushInternal(ingester, force); } Buffer(RecordFormatter recordFormatter);  Buffer(final Config config, RecordFormatter recordFormatter); void flush(Ingester ingester, boolean force); @Override void close(); float getBufferUsage(); void clearBackupFiles(); long getMaxBufferSize(); String getFileBackupPrefix(); String getFileBackupDir(); void append(String tag, long timestamp, Map<String, Object> data); void append(String tag, EventTime timestamp, Map<String, Object> data); void appendMessagePackMapValue(String tag, long timestamp, byte[] mapValue, int offset, int len); void appendMessagePackMapValue(String tag, EventTime timestamp, byte[] mapValue, int offset, int len); void appendMessagePackMapValue(String tag, long timestamp, ByteBuffer mapValue); void appendMessagePackMapValue(String tag, EventTime timestamp, ByteBuffer mapValue); long getAllocatedSize(); long getBufferedDataSize(); boolean getJvmHeapBufferMode(); String bufferFormatType(); int getChunkInitialSize(); float getChunkExpandRatio(); int getChunkRetentionSize(); int getChunkRetentionTimeMillis(); @Override String toString();  }
@Test void flush() throws IOException { Buffer buffer = new Buffer(bufferConfig, recordFormatter); Ingester ingester = mock(Ingester.class); buffer.flush(ingester, false); verify(ingester, times(0)).ingest(anyString(), any(ByteBuffer.class)); Map<String, Object> data = new HashMap<>(); data.put("name", "komamitsu"); buffer.append("foodb.bartbl", 1420070400, data); buffer.flush(ingester, false); verify(ingester, times(0)).ingest(anyString(), any(ByteBuffer.class)); buffer.flush(ingester, true); verify(ingester, times(1)).ingest(eq("foodb.bartbl"), any(ByteBuffer.class)); }