Search in sources :

Example 1 with FluencyBuilder

use of org.komamitsu.fluency.FluencyBuilder in project fluency by komamitsu.

the class FluencyTest method testBufferWithJacksonModule.

@ParameterizedTest
@MethodSource("sslFlagsProvider")
void testBufferWithJacksonModule() throws IOException {
    AtomicBoolean serialized = new AtomicBoolean();
    SimpleModule simpleModule = new SimpleModule();
    simpleModule.addSerializer(Foo.class, new FooSerializer(serialized));
    FluentdRecordFormatter.Config recordFormatterConfig = new FluentdRecordFormatter.Config();
    recordFormatterConfig.setJacksonModules(Collections.singletonList(simpleModule));
    Fluency fluency = new FluencyBuilder().buildFromIngester(new FluentdRecordFormatter(recordFormatterConfig), ingester);
    Map<String, Object> event = new HashMap<>();
    Foo foo = new Foo();
    foo.s = "Hello";
    event.put("foo", foo);
    fluency.emit("tag", event);
    assertThat(serialized.get(), is(true));
}
Also used : HashMap(java.util.HashMap) FluentdRecordFormatter(org.komamitsu.fluency.fluentd.recordformat.FluentdRecordFormatter) FluencyBuilder(org.komamitsu.fluency.FluencyBuilder) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Fluency(org.komamitsu.fluency.Fluency) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Aggregations

SimpleModule (com.fasterxml.jackson.databind.module.SimpleModule)1 HashMap (java.util.HashMap)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 MethodSource (org.junit.jupiter.params.provider.MethodSource)1 Fluency (org.komamitsu.fluency.Fluency)1 FluencyBuilder (org.komamitsu.fluency.FluencyBuilder)1 FluentdRecordFormatter (org.komamitsu.fluency.fluentd.recordformat.FluentdRecordFormatter)1