use of org.apache.skywalking.apm.toolkit.opentracing.TextMapContext in project incubator-skywalking by apache.
the class SkywalkingSpanActivationTest method testInject.
@Test
public void testInject() throws Throwable {
spanBuilder.withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_CLIENT).withTag(Tags.PEER_HOST_IPV4.getKey(), "127.0.0.1").withTag(Tags.PEER_PORT.getKey(), 8080);
startSpan();
final Map<String, String> values = new HashMap<String, String>();
TextMap carrier = new TextMap() {
@Override
public Iterator<Map.Entry<String, String>> iterator() {
return null;
}
@Override
public void put(String key, String value) {
values.put(key, value);
}
};
injectInterceptor.afterMethod(enhancedInstance, null, new Object[] { new TextMapContext(), Format.Builtin.TEXT_MAP, carrier }, null, null);
String[] parts = values.get(SW3CarrierItem.HEADER_NAME).split("\\|", 8);
Assert.assertEquals("0", parts[1]);
Assert.assertEquals("#127.0.0.1:8080", parts[4]);
Assert.assertTrue(new ID(parts[7]).isValid());
stopSpan();
}
Aggregations