This repository has been archived by the owner on Jul 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support OpenTracing 0.32.0 and 0.33.0 (#623)
* Support opentracing 0.32.0 and 0.33.0 Signed-off-by: Pavol Loffay <[email protected]> * unify messages Signed-off-by: Pavol Loffay <[email protected]> * Test 0.32.0 Signed-off-by: Pavol Loffay <[email protected]> * Simplify gradle Signed-off-by: Pavol Loffay <[email protected]> * remove line Signed-off-by: Pavol Loffay <[email protected]> * Add one more test Signed-off-by: Pavol Loffay <[email protected]>
- Loading branch information
1 parent
0d4c675
commit cf9f993
Showing
13 changed files
with
311 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
description = 'Test module for compatibility with opentracing-api:0.32.0' | ||
|
||
dependencies { | ||
testCompile group: 'io.opentracing', name: 'opentracing-api', version: "0.32.0" | ||
testCompile group: 'io.opentracing', name: 'opentracing-util', version: "0.32.0" | ||
testCompile group: 'com.google.code.gson', name: 'gson', version: gsonVersion | ||
testCompile group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion | ||
|
||
testCompile group: 'junit', name: 'junit', version: junitVersion | ||
testCompile group: 'org.mockito', name: 'mockito-core', version: mockitoVersion | ||
|
||
testCompile files(this.project(':jaeger-core').sourceSets.test.output) | ||
testCompile files(this.project(':jaeger-core').sourceSets.main.output) | ||
} | ||
|
||
|
18 changes: 18 additions & 0 deletions
18
jaeger-core-ot-0.32.0-itest/src/test/java/io/jaegertracing/internal/ActiveSpan032Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright (c) 2016, Uber Technologies, Inc | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
package io.jaegertracing.internal; | ||
|
||
public class ActiveSpan032Test extends ActiveSpanTest { | ||
} |
119 changes: 119 additions & 0 deletions
119
jaeger-core-ot-0.32.0-itest/src/test/java/io/jaegertracing/internal/RemovedFrom032Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
/* | ||
* Copyright (c) 2016, Uber Technologies, Inc | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
package io.jaegertracing.internal; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
|
||
import io.jaegertracing.internal.reporters.InMemoryReporter; | ||
import io.jaegertracing.internal.samplers.ConstSampler; | ||
import io.opentracing.Scope; | ||
import io.opentracing.Span; | ||
import io.opentracing.Tracer; | ||
import io.opentracing.util.AutoFinishScopeManager; | ||
import java.util.Collections; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
/** | ||
* Tests for removed deprecated APIs from 0.32.0 to 0.33.0. | ||
*/ | ||
@SuppressWarnings("deprecation") | ||
public class RemovedFrom032Test { | ||
private static final String SPAN_NAME = "foo"; | ||
|
||
private InMemoryReporter reporter; | ||
private Tracer tracer; | ||
|
||
@Before | ||
public void setUp() { | ||
reporter = new InMemoryReporter(); | ||
tracer = | ||
new JaegerTracer.Builder("TracerTestService") | ||
.withReporter(reporter) | ||
.withSampler(new ConstSampler(true)) | ||
.build(); | ||
} | ||
|
||
@Test | ||
public void testScopeManager_active() { | ||
Span span = tracer.buildSpan(SPAN_NAME).start(); | ||
Scope scope = tracer.activateSpan(span); | ||
try { | ||
assertEquals(scope, tracer.scopeManager().active()); | ||
} finally { | ||
scope.close(); | ||
} | ||
} | ||
|
||
@Test | ||
public void testScopeManager_activate_and_not_finish() { | ||
Span span = tracer.buildSpan(SPAN_NAME).start(); | ||
Scope scope = tracer.scopeManager().activate(span, false); | ||
try { | ||
assertEquals(scope, tracer.scopeManager().active()); | ||
} finally { | ||
scope.close(); | ||
} | ||
assertEquals(0, reporter.getSpans().size()); | ||
} | ||
|
||
@Test | ||
public void testScopeManager_activate_and_finish() { | ||
Span span = tracer.buildSpan(SPAN_NAME).start(); | ||
Scope scope = tracer.scopeManager().activate(span, true); | ||
try { | ||
assertEquals(scope, tracer.scopeManager().active()); | ||
} finally { | ||
scope.close(); | ||
} | ||
assertEquals(Collections.singletonList(span), reporter.getSpans()); | ||
} | ||
|
||
@Test | ||
public void testScope_span() { | ||
Span span = tracer.buildSpan(SPAN_NAME).start(); | ||
Scope scope = tracer.scopeManager().activate(span); | ||
try { | ||
assertEquals(span, scope.span()); | ||
} finally { | ||
scope.close(); | ||
} | ||
} | ||
|
||
@Test | ||
public void testSpanBuilder_startActive() { | ||
Scope scope = tracer.buildSpan(SPAN_NAME).startActive(true); | ||
try { | ||
assertEquals(scope.span(), tracer.activeSpan()); | ||
} finally { | ||
scope.close(); | ||
} | ||
assertEquals(Collections.singletonList(scope.span()), reporter.getSpans()); | ||
} | ||
|
||
@Test | ||
public void testTracer_startManual() { | ||
Span span = tracer.buildSpan(SPAN_NAME).startManual(); | ||
assertEquals(null, tracer.activeSpan()); | ||
span.finish(); | ||
assertEquals(Collections.singletonList(span), reporter.getSpans()); | ||
} | ||
|
||
@Test | ||
public void testAutoFinishScopeManager() { | ||
assertNotNull(new AutoFinishScopeManager()); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
jaeger-core-ot-0.32.0-itest/src/test/java/io/jaegertracing/internal/Tracer032Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright (c) 2016, Uber Technologies, Inc | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
package io.jaegertracing.internal; | ||
|
||
public class Tracer032Test extends JaegerTracerTest { | ||
} |
30 changes: 30 additions & 0 deletions
30
jaeger-core-ot-0.32.0-itest/src/test/java/io/jaegertracing/internal/Version032Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright (c) 2016, Uber Technologies, Inc | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
package io.jaegertracing.internal; | ||
|
||
import static org.junit.Assert.assertNotNull; | ||
|
||
import io.opentracing.ScopeManager; | ||
import io.opentracing.Span; | ||
import org.junit.Test; | ||
|
||
public class Version032Test { | ||
|
||
@Test | ||
public void testVersion_0_32() throws NoSuchMethodException { | ||
assertNotNull(ScopeManager.class.getMethod("activate", Span.class, boolean.class) | ||
.getAnnotation(Deprecated.class)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.