Search in sources :

Example 1 with BinaryCodec

use of io.jaegertracing.internal.propagation.BinaryCodec in project jaeger-client-java by jaegertracing.

the class ConfigurationTest method testCodecFromString.

@Test
public void testCodecFromString() {
    CodecConfiguration codecConfiguration = CodecConfiguration.fromString(String.format("%s,%s,%s", Propagation.B3.name(), Propagation.JAEGER.name(), Propagation.W3C.name()));
    assertEquals(2, codecConfiguration.getCodecs().size());
    assertEquals(3, codecConfiguration.getCodecs().get(Builtin.HTTP_HEADERS).size());
    assertEquals(3, codecConfiguration.getCodecs().get(Builtin.TEXT_MAP).size());
    assertEquals(1, codecConfiguration.getBinaryCodecs().get(Builtin.BINARY).size());
    assertTrue(codecConfiguration.getCodecs().get(Builtin.HTTP_HEADERS).get(0) instanceof B3TextMapCodec);
    assertTrue(codecConfiguration.getCodecs().get(Builtin.HTTP_HEADERS).get(1) instanceof TextMapCodec);
    assertTrue(codecConfiguration.getCodecs().get(Builtin.HTTP_HEADERS).get(2) instanceof TraceContextCodec);
    assertTrue(codecConfiguration.getCodecs().get(Builtin.TEXT_MAP).get(0) instanceof B3TextMapCodec);
    assertTrue(codecConfiguration.getCodecs().get(Builtin.TEXT_MAP).get(1) instanceof TextMapCodec);
    assertTrue(codecConfiguration.getCodecs().get(Builtin.TEXT_MAP).get(2) instanceof TraceContextCodec);
    assertTrue(codecConfiguration.getBinaryCodecs().get(Builtin.BINARY).get(0) instanceof BinaryCodec);
}
Also used : TraceContextCodec(io.jaegertracing.internal.propagation.TraceContextCodec) BinaryCodec(io.jaegertracing.internal.propagation.BinaryCodec) CodecConfiguration(io.jaegertracing.Configuration.CodecConfiguration) B3TextMapCodec(io.jaegertracing.internal.propagation.B3TextMapCodec) TextMapCodec(io.jaegertracing.internal.propagation.TextMapCodec) B3TextMapCodec(io.jaegertracing.internal.propagation.B3TextMapCodec) Test(org.junit.Test)

Example 2 with BinaryCodec

use of io.jaegertracing.internal.propagation.BinaryCodec in project jaeger-client-java by jaegertracing.

the class ConfigurationTest method testCodecWithPropagationJaeger.

@Test
public void testCodecWithPropagationJaeger() {
    CodecConfiguration codecConfiguration = new CodecConfiguration().withPropagation(Propagation.JAEGER);
    assertEquals(2, codecConfiguration.getCodecs().size());
    assertEquals(1, codecConfiguration.getCodecs().get(Builtin.HTTP_HEADERS).size());
    assertEquals(1, codecConfiguration.getCodecs().get(Builtin.TEXT_MAP).size());
    assertTrue(codecConfiguration.getCodecs().get(Builtin.HTTP_HEADERS).get(0) instanceof TextMapCodec);
    assertTrue(codecConfiguration.getCodecs().get(Builtin.TEXT_MAP).get(0) instanceof TextMapCodec);
    assertEquals(1, codecConfiguration.getBinaryCodecs().size());
    assertTrue(codecConfiguration.getBinaryCodecs().get(Builtin.BINARY).get(0) instanceof BinaryCodec);
}
Also used : BinaryCodec(io.jaegertracing.internal.propagation.BinaryCodec) CodecConfiguration(io.jaegertracing.Configuration.CodecConfiguration) B3TextMapCodec(io.jaegertracing.internal.propagation.B3TextMapCodec) TextMapCodec(io.jaegertracing.internal.propagation.TextMapCodec) Test(org.junit.Test)

Aggregations

CodecConfiguration (io.jaegertracing.Configuration.CodecConfiguration)2 B3TextMapCodec (io.jaegertracing.internal.propagation.B3TextMapCodec)2 BinaryCodec (io.jaegertracing.internal.propagation.BinaryCodec)2 TextMapCodec (io.jaegertracing.internal.propagation.TextMapCodec)2 Test (org.junit.Test)2 TraceContextCodec (io.jaegertracing.internal.propagation.TraceContextCodec)1