adding unsupported exceptions
MODIFY
src/main/java/com/datadoghq/trace/impl/Tracer.java
src/main/java/com/datadoghq/trace/impl/Tracer.java
@@ -15,19 +15,19 @@ public class Tracer implements io.opentracing.Tracer {
return new SpanBuilder(operationName);
}
-
public <C> void inject(SpanContext spanContext, Format<C> format, C c) {
+ throw new UnsupportedOperationException();
}
public <C> SpanContext extract(Format<C> format, C c) {
- return null;
+ throw new UnsupportedOperationException();
}
public class SpanBuilder implements io.opentracing.Tracer.SpanBuilder {
private final String operationName;
- private Map<String, Object> tags = new HashMap<String, Object>();
+ private Map<String, Object> tags = new HashMap<>();
private Long timestamp;
private SpanContext parent;
private String serviceName;
@@ -49,13 +49,7 @@ public class Tracer implements io.opentracing.Tracer {
}
public Tracer.SpanBuilder addReference(String referenceType, SpanContext spanContext) {
-
- if (References.CHILD_OF.equals(referenceType) || References.FOLLOWS_FROM.equals(referenceType)) {
- // @todo: implements the notion of referenceType, currently only link a span to a parent one
- return asChildOf(spanContext);
- } else {
- throw new IllegalArgumentException();
- }
+ throw new UnsupportedOperationException();
}
public Tracer.SpanBuilder withTag(String tag, Number number) {

MODIFY
src/test/java/com/datadoghq/trace/impl/DDSpanBuilderTest.java
src/test/java/com/datadoghq/trace/impl/DDSpanBuilderTest.java
@@ -136,56 +136,8 @@ public class DDSpanBuilderTest {
assertThat(actualContext.getParentId()).isEqualTo(expectedParentId);
-
}
- @Test
- public void shouldLinkViaReferenceType() {
-
-
- final long spanId = 223L;
- final long expectedParentId = spanId;
-
- DDSpanContext mockedContext = mock(DDSpanContext.class);
- when(mockedContext.getSpanId()).thenReturn(spanId);
-
- final String expectedName = "fakeName";
-
-
- // case 1, using a CHILD_OF ref
- DDSpan span = (DDSpan) tracer
- .buildSpan(expectedName)
- .addReference(References.CHILD_OF, mockedContext)
- .start();
-
- DDSpanContext actualContext = (DDSpanContext) span.context();
- assertThat(actualContext.getParentId()).isEqualTo(expectedParentId);
-
-
- // case 2, using a FOLLOW_FROM ref
- span = (DDSpan) tracer
- .buildSpan(expectedName)
- .addReference(References.FOLLOWS_FROM, mockedContext)
- .start();
-
- actualContext = (DDSpanContext) span.context();
- assertThat(actualContext.getParentId()).isEqualTo(expectedParentId);
-
-
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void shouldErrorUnknownReferenceType() {
-
- DDSpanContext mockedContext = mock(DDSpanContext.class);
- when(mockedContext.getSpanId()).thenReturn(123L);
-
- // case 2, using a WFT ref, should not be linked to the previous
- DDSpan span = (DDSpan) tracer
- .buildSpan("fakeName")
- .addReference("WTF", mockedContext)
- .start();
- }
@Test
public void shouldInheritOfTheDDParentAttributes() {

adding unsupported exceptions