Skip to content

Commit f14c3bb

Browse files
committed
Remove opencensus-impl dependency.
1 parent aec2843 commit f14c3bb

3 files changed

Lines changed: 18 additions & 10 deletions

File tree

google-cloud-bom/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,11 +1047,6 @@
10471047
<artifactId>opencensus-api</artifactId>
10481048
<version>${opencensus.version}</version>
10491049
</dependency>
1050-
<dependency>
1051-
<groupId>io.opencensus</groupId>
1052-
<artifactId>opencensus-impl</artifactId>
1053-
<version>${opencensus.version}</version>
1054-
</dependency>
10551050
<dependency>
10561051
<groupId>io.opencensus</groupId>
10571052
<artifactId>opencensus-contrib-grpc-util</artifactId>

google-cloud-core-http/pom.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,6 @@
127127
<groupId>io.opencensus</groupId>
128128
<artifactId>opencensus-api</artifactId>
129129
</dependency>
130-
<dependency>
131-
<groupId>io.opencensus</groupId>
132-
<artifactId>opencensus-impl</artifactId>
133-
</dependency>
134130
<dependency>
135131
<groupId>io.opencensus</groupId>
136132
<artifactId>opencensus-contrib-http-util</artifactId>

google-cloud-core-http/src/test/java/com/google/cloud/http/CensusHttpModuleTest.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import static com.google.common.truth.Truth.assertThat;
2020

2121
import static org.easymock.EasyMock.createMock;
22+
import static org.easymock.EasyMock.createMockBuilder;
2223
import static org.easymock.EasyMock.replay;
2324
import static org.easymock.EasyMock.verify;
2425

@@ -30,11 +31,18 @@
3031
import com.google.api.client.http.javanet.NetHttpTransport;
3132

3233
import io.opencensus.common.Scope;
34+
import io.opencensus.trace.Span;
35+
import io.opencensus.trace.SpanContext;
36+
import io.opencensus.trace.SpanId;
37+
import io.opencensus.trace.TraceId;
38+
import io.opencensus.trace.TraceOptions;
3339
import io.opencensus.trace.Tracer;
3440
import io.opencensus.trace.Tracing;
3541
import io.opencensus.trace.propagation.TextFormat;
3642

3743
import java.io.IOException;
44+
import java.util.EnumSet;
45+
import java.util.Random;
3846

3947
import org.junit.Before;
4048
import org.junit.Rule;
@@ -105,7 +113,16 @@ public void censusHttpExecuteInterceptorShouldExecuteOriginal() throws IOExcepti
105113

106114
@Test
107115
public void censusHttpExecuteInterceptorShouldInjectHeader() throws IOException {
108-
Scope scope = censusHttpModule.getTracer().spanBuilder("Test span").startScopedSpan();
116+
Random random = new Random();
117+
SpanContext spanContext = SpanContext.create(
118+
TraceId.generateRandomId(random),
119+
SpanId.generateRandomId(random),
120+
TraceOptions.DEFAULT);
121+
Span mockSpan = createMockBuilder(Span.class)
122+
.withConstructor(SpanContext.class, EnumSet.class)
123+
.withArgs(spanContext, null)
124+
.createMock();
125+
Scope scope = tracer.withSpan(mockSpan);
109126
try {
110127
HttpExecuteInterceptor interceptor = censusHttpModule.new CensusHttpExecuteInterceptor(null);
111128
interceptor.intercept(httpRequest);

0 commit comments

Comments
 (0)