deki closed pull request #432: Bumps to latest Brave dependencies
URL: https://github.com/apache/cxf/pull/432
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/src/main/java/demo/jaxws/tracing/server/impl/CatalogServiceImpl.java
b/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/src/main/java/demo/jaxws/tracing/server/impl/CatalogServiceImpl.java
index ce108848ba0..7ec188365b5 100644
---
a/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/src/main/java/demo/jaxws/tracing/server/impl/CatalogServiceImpl.java
+++
b/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/src/main/java/demo/jaxws/tracing/server/impl/CatalogServiceImpl.java
@@ -18,13 +18,12 @@
*/
package demo.jaxws.tracing.server.impl;
+import brave.ScopedSpan;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import brave.Span;
-import brave.Tracer.SpanInScope;
import brave.Tracing;
import demo.jaxws.tracing.server.Book;
import demo.jaxws.tracing.server.CatalogService;
@@ -40,8 +39,8 @@ public CatalogServiceImpl(final Tracing brave) {
public void addBook(Book book) {
executor.submit(() -> {
- final Span span = brave.tracer().nextSpan().name("Inserting New
Book").start();
- try (SpanInScope scope = brave.tracer().withSpanInScope(span)) {
+ final ScopedSpan span = brave.tracer().startScopedSpan("Inserting
New Book");
+ try {
books.put(book.getId(), book);
} finally {
span.finish();
diff --git
a/integration/tracing/tracing-brave/src/test/java/org/apache/cxf/tracing/brave/BraveTraceTest.java
b/integration/tracing/tracing-brave/src/test/java/org/apache/cxf/tracing/brave/BraveTraceTest.java
index d575cda92f1..7a90ef67666 100644
---
a/integration/tracing/tracing-brave/src/test/java/org/apache/cxf/tracing/brave/BraveTraceTest.java
+++
b/integration/tracing/tracing-brave/src/test/java/org/apache/cxf/tracing/brave/BraveTraceTest.java
@@ -27,8 +27,8 @@
import org.apache.cxf.feature.Feature;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
-import zipkin.Span;
-import zipkin.reporter.Reporter;
+import zipkin2.Span;
+import zipkin2.reporter.Reporter;
import org.junit.After;
import org.junit.Assert;
@@ -85,12 +85,14 @@ private static MyService createProxy(Feature trace) {
}
private static BraveFeature createLoggingFeature(Reporter<Span> reporter) {
- Tracing brave =
Tracing.newBuilder().localServiceName("myservice").reporter(reporter).build();
+ Tracing brave =
+
Tracing.newBuilder().localServiceName("myservice").spanReporter(reporter).build();
return new BraveFeature(brave);
}
private static BraveClientFeature
createClientLoggingFeature(Reporter<Span> reporter) {
- Tracing brave =
Tracing.newBuilder().localServiceName("myservice").reporter(reporter).build();
+ Tracing brave =
+
Tracing.newBuilder().localServiceName("myservice").spanReporter(reporter).build();
return new BraveClientFeature(brave);
}
diff --git a/osgi/karaf/features/src/main/resources/features.xml
b/osgi/karaf/features/src/main/resources/features.xml
index 21ad3815cbc..ed0befb750a 100644
--- a/osgi/karaf/features/src/main/resources/features.xml
+++ b/osgi/karaf/features/src/main/resources/features.xml
@@ -294,8 +294,8 @@
<feature name="cxf-tracing-brave" version="${project.version}">
<feature version="${project.version}">cxf-core</feature>
<bundle start-level="10"
dependency="true">mvn:com.google.code.findbugs/jsr305/${cxf.findbugs.version}</bundle>
- <bundle
start-level="35">mvn:io.zipkin.java/zipkin/${cxf.brave.zipkin.version}</bundle>
- <bundle
start-level="35">mvn:io.zipkin.reporter/zipkin-reporter/${cxf.brave.reporter.version}</bundle>
+ <bundle
start-level="35">mvn:io.zipkin.zipkin2/zipkin/${cxf.brave.zipkin.version}</bundle>
+ <bundle
start-level="35">mvn:io.zipkin.reporter2/zipkin-reporter/${cxf.brave.reporter.version}</bundle>
<bundle
start-level="35">mvn:io.zipkin.brave/brave/${cxf.brave.version}</bundle>
<bundle
start-level="35">mvn:io.zipkin.brave/brave-instrumentation-http/${cxf.brave.version}</bundle>
<bundle
start-level="40">mvn:org.apache.cxf/cxf-integration-tracing-brave/${project.version}</bundle>
diff --git a/parent/pom.xml b/parent/pom.xml
index 1fccffd8dff..c1e27391f1f 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -227,9 +227,9 @@
<cxf.jexl.version>2.1.1</cxf.jexl.version>
<cxf.htrace.version>4.2.0-incubating</cxf.htrace.version>
<cxf.zest.version>2.1</cxf.zest.version>
- <cxf.brave.version>4.6.0</cxf.brave.version>
- <cxf.brave.zipkin.version>1.31.1</cxf.brave.zipkin.version>
- <cxf.brave.reporter.version>1.0.2</cxf.brave.reporter.version>
+ <cxf.brave.version>5.1.5</cxf.brave.version>
+ <cxf.brave.zipkin.version>2.10.4</cxf.brave.zipkin.version>
+ <cxf.brave.reporter.version>2.7.7</cxf.brave.reporter.version>
<cxf.opentracing.version>0.30.0</cxf.opentracing.version>
<cxf.jaeger.version>0.20.6</cxf.jaeger.version>
<cxf.findbugs.version>3.0.2</cxf.findbugs.version>
diff --git
a/systests/tracing/src/test/java/org/apache/cxf/systest/brave/TestSpanReporter.java
b/systests/tracing/src/test/java/org/apache/cxf/systest/brave/TestSpanReporter.java
index d6e426b9419..fe2413f3ade 100644
---
a/systests/tracing/src/test/java/org/apache/cxf/systest/brave/TestSpanReporter.java
+++
b/systests/tracing/src/test/java/org/apache/cxf/systest/brave/TestSpanReporter.java
@@ -21,8 +21,8 @@
import java.util.ArrayList;
import java.util.List;
-import zipkin.Span;
-import zipkin.reporter.Reporter;
+import zipkin2.Span;
+import zipkin2.reporter.Reporter;
public class TestSpanReporter implements Reporter<Span> {
private static List<Span> spans = new ArrayList<>();
diff --git
a/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/brave/BraveTracingTest.java
b/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/brave/BraveTracingTest.java
index d972d6d9f03..30486f97d35 100644
---
a/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/brave/BraveTracingTest.java
+++
b/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/brave/BraveTracingTest.java
@@ -63,11 +63,10 @@
import static org.apache.cxf.systest.brave.BraveTestSupport.TRACE_ID_NAME;
import static org.apache.cxf.systest.jaxrs.tracing.brave.HasSpan.hasSpan;
import static
org.apache.cxf.systest.jaxrs.tracing.brave.IsAnnotationContaining.hasItem;
-import static
org.apache.cxf.systest.jaxrs.tracing.brave.IsBinaryAnnotationContaining.hasItem;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
-
+import static org.hamcrest.collection.IsMapContaining.hasEntry;
public class BraveTracingTest extends AbstractBusClientServerTestBase {
public static final String PORT = allocatePort(BraveTracingTest.class);
@@ -81,7 +80,7 @@
protected void run() {
final Tracing brave = Tracing
.newBuilder()
- .reporter(new TestSpanReporter())
+ .spanReporter(new TestSpanReporter())
.sampler(Sampler.ALWAYS_SAMPLE)
.build();
@@ -109,7 +108,7 @@ public void setUp() {
brave = Tracing
.newBuilder()
- .reporter(new TestSpanReporter())
+ .spanReporter(new TestSpanReporter())
.sampler(Sampler.ALWAYS_SAMPLE)
.build();
@@ -123,8 +122,8 @@ public void testThatNewSpanIsCreatedWhenNotProvided() {
assertEquals(Status.OK.getStatusCode(), r.getStatus());
assertThat(TestSpanReporter.getAllSpans().size(), equalTo(2));
- assertThat(TestSpanReporter.getAllSpans().get(0).name, equalTo("get
books"));
- assertThat(TestSpanReporter.getAllSpans().get(1).name, equalTo("get
/bookstore/books"));
+ assertThat(TestSpanReporter.getAllSpans().get(0).name(), equalTo("get
books"));
+ assertThat(TestSpanReporter.getAllSpans().get(1).name(), equalTo("get
/bookstore/books"));
assertFalse(r.getHeaders().containsKey(SPAN_ID_NAME));
assertFalse(r.getHeaders().containsKey(TRACE_ID_NAME));
@@ -140,8 +139,8 @@ public void testThatNewInnerSpanIsCreated() {
assertEquals(Status.OK.getStatusCode(), r.getStatus());
assertThat(TestSpanReporter.getAllSpans().size(), equalTo(2));
- assertThat(TestSpanReporter.getAllSpans().get(0).name, equalTo("get
books"));
- assertThat(TestSpanReporter.getAllSpans().get(1).name, equalTo("get
/bookstore/books"));
+ assertThat(TestSpanReporter.getAllSpans().get(0).name(), equalTo("get
books"));
+ assertThat(TestSpanReporter.getAllSpans().get(1).name(), equalTo("get
/bookstore/books"));
assertThatTraceIsPresent(r, spanId);
}
@@ -154,8 +153,8 @@ public void testThatCurrentSpanIsAnnotatedWithKeyValue() {
assertEquals(Status.OK.getStatusCode(), r.getStatus());
assertThat(TestSpanReporter.getAllSpans().size(), equalTo(1));
- assertThat(TestSpanReporter.getAllSpans().get(0).name, equalTo("get
/bookstore/book/1"));
- assertThat(TestSpanReporter.getAllSpans().get(0).binaryAnnotations,
hasItem("book-id", "1"));
+ assertThat(TestSpanReporter.getAllSpans().get(0).name(), equalTo("get
/bookstore/book/1"));
+ assertThat(TestSpanReporter.getAllSpans().get(0).tags(),
hasEntry("book-id", "1"));
assertThatTraceIsPresent(r, spanId);
}
@@ -180,8 +179,8 @@ public void
testThatNewChildSpanIsCreatedWhenParentIsProvided() {
assertEquals(Status.OK.getStatusCode(), r.getStatus());
assertThat(TestSpanReporter.getAllSpans().size(), equalTo(3));
- assertThat(TestSpanReporter.getAllSpans().get(0).name, equalTo("get
books"));
- assertThat(TestSpanReporter.getAllSpans().get(0).parentId,
not(nullValue()));
+ assertThat(TestSpanReporter.getAllSpans().get(0).name(), equalTo("get
books"));
+ assertThat(TestSpanReporter.getAllSpans().get(0).parentId(),
not(nullValue()));
assertThatTraceHeadersArePresent(r, false);
}
@@ -194,11 +193,11 @@ public void
testThatNewInnerSpanIsCreatedUsingAsyncInvocation() {
assertEquals(Status.OK.getStatusCode(), r.getStatus());
assertThat(TestSpanReporter.getAllSpans().size(), equalTo(2));
- assertThat(TestSpanReporter.getAllSpans().get(1).name, equalTo("get
/bookstore/books/async"));
- assertThat(TestSpanReporter.getAllSpans().get(0).name,
equalTo("processing books"));
- assertThat(TestSpanReporter.getAllSpans().get(0).parentId,
not(nullValue()));
- assertThat(TestSpanReporter.getAllSpans().get(0).parentId,
- equalTo(TestSpanReporter.getAllSpans().get(1).id));
+ assertThat(TestSpanReporter.getAllSpans().get(1).name(), equalTo("get
/bookstore/books/async"));
+ assertThat(TestSpanReporter.getAllSpans().get(0).name(),
equalTo("processing books"));
+ assertThat(TestSpanReporter.getAllSpans().get(0).parentId(),
not(nullValue()));
+ assertThat(TestSpanReporter.getAllSpans().get(0).parentId(),
+ equalTo(TestSpanReporter.getAllSpans().get(1).id()));
assertThatTraceIsPresent(r, spanId);
}
@@ -211,7 +210,7 @@ public void
testThatOuterSpanIsCreatedUsingAsyncInvocation() {
assertEquals(Status.OK.getStatusCode(), r.getStatus());
assertThat(TestSpanReporter.getAllSpans().size(), equalTo(1));
- assertThat(TestSpanReporter.getAllSpans().get(0).name, equalTo("get
/bookstore/books/async/notrace"));
+ assertThat(TestSpanReporter.getAllSpans().get(0).name(), equalTo("get
/bookstore/books/async/notrace"));
assertThatTraceIsPresent(r, spanId);
}
@@ -222,8 +221,8 @@ public void testThatNewSpanIsCreatedUsingAsyncInvocation() {
assertEquals(Status.OK.getStatusCode(), r.getStatus());
assertThat(TestSpanReporter.getAllSpans().size(), equalTo(2));
- assertThat(TestSpanReporter.getAllSpans().get(1).name, equalTo("get
/bookstore/books/async"));
- assertThat(TestSpanReporter.getAllSpans().get(0).name,
equalTo("processing books"));
+ assertThat(TestSpanReporter.getAllSpans().get(1).name(), equalTo("get
/bookstore/books/async"));
+ assertThat(TestSpanReporter.getAllSpans().get(0).name(),
equalTo("processing books"));
}
@Test
@@ -235,9 +234,9 @@ public void
testThatNewSpanIsCreatedWhenNotProvidedUsingAsyncClient() throws Exc
assertEquals(Status.OK.getStatusCode(), r.getStatus());
assertThat(TestSpanReporter.getAllSpans().size(), equalTo(3));
- assertThat(TestSpanReporter.getAllSpans().get(0).name, equalTo("get
books"));
- assertThat(TestSpanReporter.getAllSpans().get(1).name, equalTo("get
/bookstore/books"));
- assertThat(TestSpanReporter.getAllSpans().get(2).name, equalTo("get "
+ client.getCurrentURI()));
+ assertThat(TestSpanReporter.getAllSpans().get(0).name(), equalTo("get
books"));
+ assertThat(TestSpanReporter.getAllSpans().get(1).name(), equalTo("get
/bookstore/books"));
+ assertThat(TestSpanReporter.getAllSpans().get(2).name(), equalTo("get
" + client.getCurrentURI()));
assertThatTraceHeadersArePresent(r, false);
}
@@ -265,11 +264,11 @@ public void
testThatNewSpansAreCreatedWhenNotProvidedUsingMultipleAsyncClients()
.range(0, 4)
.map(index -> index * 3)
.forEach(index -> {
- assertThat(TestSpanReporter.getAllSpans().get(index).name,
+ assertThat(TestSpanReporter.getAllSpans().get(index).name(),
equalTo("get books"));
- assertThat(TestSpanReporter.getAllSpans().get(index + 1).name,
+ assertThat(TestSpanReporter.getAllSpans().get(index +
1).name(),
equalTo("get /bookstore/books"));
- assertThat(TestSpanReporter.getAllSpans().get(index + 2).name,
+ assertThat(TestSpanReporter.getAllSpans().get(index +
2).name(),
equalTo("get " + client.getCurrentURI()));
});
}
@@ -296,11 +295,11 @@ public void
testThatNewSpansAreCreatedWhenNotProvidedUsingMultipleClients() thro
.range(0, 4)
.map(index -> index * 3)
.forEach(index -> {
- assertThat(TestSpanReporter.getAllSpans().get(index).name,
+ assertThat(TestSpanReporter.getAllSpans().get(index).name(),
equalTo("get books"));
- assertThat(TestSpanReporter.getAllSpans().get(index + 1).name,
+ assertThat(TestSpanReporter.getAllSpans().get(index +
1).name(),
equalTo("get /bookstore/books"));
- assertThat(TestSpanReporter.getAllSpans().get(index + 2).name,
+ assertThat(TestSpanReporter.getAllSpans().get(index +
2).name(),
equalTo("get " + client.getCurrentURI()));
});
}
@@ -316,10 +315,10 @@ public void testThatProvidedSpanIsNotClosedWhenActive()
throws MalformedURLExcep
assertEquals(Status.OK.getStatusCode(), r.getStatus());
assertThat(TestSpanReporter.getAllSpans().size(), equalTo(3));
- assertThat(TestSpanReporter.getAllSpans().get(0).name,
equalTo("get books"));
- assertThat(TestSpanReporter.getAllSpans().get(0).parentId,
not(nullValue()));
- assertThat(TestSpanReporter.getAllSpans().get(1).name,
equalTo("get /bookstore/books"));
- assertThat(TestSpanReporter.getAllSpans().get(2).name,
equalTo("get " + client.getCurrentURI()));
+ assertThat(TestSpanReporter.getAllSpans().get(0).name(),
equalTo("get books"));
+ assertThat(TestSpanReporter.getAllSpans().get(0).parentId(),
not(nullValue()));
+ assertThat(TestSpanReporter.getAllSpans().get(1).name(),
equalTo("get /bookstore/books"));
+ assertThat(TestSpanReporter.getAllSpans().get(2).name(),
equalTo("get " + client.getCurrentURI()));
assertThatTraceHeadersArePresent(r, true);
}
@@ -328,7 +327,7 @@ public void testThatProvidedSpanIsNotClosedWhenActive()
throws MalformedURLExcep
}
assertThat(TestSpanReporter.getAllSpans().size(), equalTo(4));
- assertThat(TestSpanReporter.getAllSpans().get(3).name, equalTo("test
span"));
+ assertThat(TestSpanReporter.getAllSpans().get(3).name(), equalTo("test
span"));
}
@Test
@@ -345,9 +344,9 @@ public void
testThatProvidedSpanIsNotDetachedWhenActiveUsingAsyncClient() throws
assertThat(brave.tracer().currentSpan().context().spanId(),
equalTo(span.context().spanId()));
assertThat(TestSpanReporter.getAllSpans().size(), equalTo(3));
- assertThat(TestSpanReporter.getAllSpans().get(0).name,
equalTo("get books"));
- assertThat(TestSpanReporter.getAllSpans().get(1).name,
equalTo("get /bookstore/books"));
- assertThat(TestSpanReporter.getAllSpans().get(2).name,
equalTo("get " + client.getCurrentURI()));
+ assertThat(TestSpanReporter.getAllSpans().get(0).name(),
equalTo("get books"));
+ assertThat(TestSpanReporter.getAllSpans().get(1).name(),
equalTo("get /bookstore/books"));
+ assertThat(TestSpanReporter.getAllSpans().get(2).name(),
equalTo("get " + client.getCurrentURI()));
assertThatTraceHeadersArePresent(r, true);
}
@@ -356,7 +355,7 @@ public void
testThatProvidedSpanIsNotDetachedWhenActiveUsingAsyncClient() throws
}
assertThat(TestSpanReporter.getAllSpans().size(), equalTo(4));
- assertThat(TestSpanReporter.getAllSpans().get(3).name, equalTo("test
span"));
+ assertThat(TestSpanReporter.getAllSpans().get(3).name(), equalTo("test
span"));
}
@Test
@@ -367,8 +366,8 @@ public void
testThatInnerSpanIsCreatedUsingPseudoAsyncInvocation() {
assertEquals(Status.OK.getStatusCode(), r.getStatus());
assertThat(TestSpanReporter.getAllSpans().size(), equalTo(2));
- assertThat(TestSpanReporter.getAllSpans().get(1).name, equalTo("get
/bookstore/books/pseudo-async"));
- assertThat(TestSpanReporter.getAllSpans().get(0).name,
equalTo("processing books"));
+ assertThat(TestSpanReporter.getAllSpans().get(1).name(), equalTo("get
/bookstore/books/pseudo-async"));
+ assertThat(TestSpanReporter.getAllSpans().get(0).name(),
equalTo("processing books"));
assertThatTraceIsPresent(r, spanId);
}
@@ -377,7 +376,7 @@ public void
testThatInnerSpanIsCreatedUsingPseudoAsyncInvocation() {
public void testThatNoSpansAreRecordedWhenNotSampled() {
final Tracing never = Tracing
.newBuilder()
- .reporter(new TestSpanReporter())
+ .spanReporter(new TestSpanReporter())
.sampler(Sampler.NEVER_SAMPLE)
.build();
diff --git
a/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/brave/HasSpan.java
b/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/brave/HasSpan.java
index 9a4a8efb49e..c4f1067b2c6 100644
---
a/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/brave/HasSpan.java
+++
b/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/brave/HasSpan.java
@@ -22,8 +22,8 @@
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
import org.hamcrest.core.IsCollectionContaining;
-import zipkin.Annotation;
-import zipkin.Span;
+import zipkin2.Annotation;
+import zipkin2.Span;
public class HasSpan extends IsCollectionContaining<Span> {
public HasSpan(final String name) {
@@ -47,12 +47,12 @@ public void describeTo(Description description) {
@Override
protected boolean matchesSafely(Span item) {
- if (!name.equals(item.name)) {
+ if (!name.equals(item.name())) {
return false;
}
if (matcher != null) {
- return matcher.matches(item.annotations);
+ return matcher.matches(item.annotations());
}
return true;
diff --git
a/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/brave/IsAnnotationContaining.java
b/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/brave/IsAnnotationContaining.java
index 816ebfdea79..775ceaa4da4 100644
---
a/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/brave/IsAnnotationContaining.java
+++
b/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/brave/IsAnnotationContaining.java
@@ -21,7 +21,7 @@
import org.hamcrest.Description;
import org.hamcrest.TypeSafeMatcher;
import org.hamcrest.core.IsCollectionContaining;
-import zipkin.Annotation;
+import zipkin2.Annotation;
public class IsAnnotationContaining extends IsCollectionContaining<Annotation>
{
public IsAnnotationContaining(final String value) {
@@ -35,7 +35,7 @@ public void describeTo(Description description) {
@Override
protected boolean matchesSafely(Annotation item) {
- return value.equals(item.value);
+ return value.equals(item.value());
}
});
}
diff --git
a/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/brave/IsBinaryAnnotationContaining.java
b/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/brave/IsBinaryAnnotationContaining.java
deleted file mode 100644
index 3d913b01cc4..00000000000
---
a/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/brave/IsBinaryAnnotationContaining.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.cxf.systest.jaxrs.tracing.brave;
-
-import java.nio.charset.StandardCharsets;
-
-import org.hamcrest.Description;
-import org.hamcrest.TypeSafeMatcher;
-import org.hamcrest.core.IsCollectionContaining;
-import zipkin.BinaryAnnotation;
-
-public class IsBinaryAnnotationContaining extends
IsCollectionContaining<BinaryAnnotation> {
- public IsBinaryAnnotationContaining(final String key, final String value) {
- super(new TypeSafeMatcher<BinaryAnnotation>() {
- @Override
- public void describeTo(Description description) {
- description
- .appendText("the key ")
- .appendValue(key)
- .appendText(" with value ")
- .appendValue(value);
- }
-
- @Override
- protected boolean matchesSafely(BinaryAnnotation item) {
- return value.equals(new String(item.value,
StandardCharsets.UTF_8)) && key.equals(item.key);
- }
- });
- }
-
- public static IsBinaryAnnotationContaining hasItem(final String key, final
String value) {
- return new IsBinaryAnnotationContaining(key, value);
- }
-}
\ No newline at end of file
diff --git
a/systests/tracing/src/test/java/org/apache/cxf/systest/jaxws/tracing/brave/BookStore.java
b/systests/tracing/src/test/java/org/apache/cxf/systest/jaxws/tracing/brave/BookStore.java
index 46624c55584..d239a6a99db 100644
---
a/systests/tracing/src/test/java/org/apache/cxf/systest/jaxws/tracing/brave/BookStore.java
+++
b/systests/tracing/src/test/java/org/apache/cxf/systest/jaxws/tracing/brave/BookStore.java
@@ -39,7 +39,7 @@
public BookStore() {
brave = Tracing.newBuilder()
.localServiceName("book-store")
- .reporter(new TestSpanReporter())
+ .spanReporter(new TestSpanReporter())
.build();
}
diff --git
a/systests/tracing/src/test/java/org/apache/cxf/systest/jaxws/tracing/brave/BraveTracingTest.java
b/systests/tracing/src/test/java/org/apache/cxf/systest/jaxws/tracing/brave/BraveTracingTest.java
index 6f000c7b8a7..b2fad83d924 100644
---
a/systests/tracing/src/test/java/org/apache/cxf/systest/jaxws/tracing/brave/BraveTracingTest.java
+++
b/systests/tracing/src/test/java/org/apache/cxf/systest/jaxws/tracing/brave/BraveTracingTest.java
@@ -69,7 +69,7 @@
protected void run() {
final Tracing brave = Tracing.newBuilder()
.localServiceName("book-store")
- .reporter(new TestSpanReporter())
+ .spanReporter(new TestSpanReporter())
.build();
final JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
@@ -102,8 +102,8 @@ public void testThatNewSpanIsCreatedWhenNotProvided()
throws MalformedURLExcepti
assertThat(service.getBooks().size(), equalTo(2));
assertThat(TestSpanReporter.getAllSpans().size(), equalTo(2));
- assertThat(TestSpanReporter.getAllSpans().get(0).name, equalTo("get
books"));
- assertThat(TestSpanReporter.getAllSpans().get(1).name, equalTo("post
/bookstore"));
+ assertThat(TestSpanReporter.getAllSpans().get(0).name(), equalTo("get
books"));
+ assertThat(TestSpanReporter.getAllSpans().get(1).name(), equalTo("post
/bookstore"));
final Map<String, List<String>> headers = getResponseHeaders(service);
assertFalse(headers.containsKey(TRACE_ID_NAME));
@@ -132,8 +132,8 @@ public void testThatNewInnerSpanIsCreated() throws
MalformedURLException {
assertThat(service.getBooks().size(), equalTo(2));
assertThat(TestSpanReporter.getAllSpans().size(), equalTo(2));
- assertThat(TestSpanReporter.getAllSpans().get(0).name, equalTo("get
books"));
- assertThat(TestSpanReporter.getAllSpans().get(1).name, equalTo("post
/bookstore"));
+ assertThat(TestSpanReporter.getAllSpans().get(0).name(), equalTo("get
books"));
+ assertThat(TestSpanReporter.getAllSpans().get(1).name(), equalTo("post
/bookstore"));
final Map<String, List<String>> response = getResponseHeaders(service);
assertThatTraceIsPresent(response, spanId);
@@ -143,7 +143,7 @@ public void testThatNewInnerSpanIsCreated() throws
MalformedURLException {
public void testThatNewChildSpanIsCreatedWhenParentIsProvided() throws
MalformedURLException {
final Tracing brave = Tracing.newBuilder()
.localServiceName("book-store")
- .reporter(new TestSpanReporter())
+ .spanReporter(new TestSpanReporter())
.build();
final BookStoreService service = createJaxWsService(new Configurator()
{
@@ -155,10 +155,10 @@ public void configure(final JaxWsProxyFactoryBean
factory) {
assertThat(service.getBooks().size(), equalTo(2));
assertThat(TestSpanReporter.getAllSpans().size(), equalTo(3));
- assertThat(TestSpanReporter.getAllSpans().get(0).name, equalTo("get
books"));
- assertThat(TestSpanReporter.getAllSpans().get(0).parentId,
not(nullValue()));
- assertThat(TestSpanReporter.getAllSpans().get(1).name, equalTo("post
/bookstore"));
- assertThat(TestSpanReporter.getAllSpans().get(2).name,
+ assertThat(TestSpanReporter.getAllSpans().get(0).name(), equalTo("get
books"));
+ assertThat(TestSpanReporter.getAllSpans().get(0).parentId(),
not(nullValue()));
+ assertThat(TestSpanReporter.getAllSpans().get(1).name(), equalTo("post
/bookstore"));
+ assertThat(TestSpanReporter.getAllSpans().get(2).name(),
equalTo("post http://localhost:" + PORT + "/bookstore"));
final Map<String, List<String>> response = getResponseHeaders(service);
@@ -169,7 +169,7 @@ public void configure(final JaxWsProxyFactoryBean factory) {
public void testThatProvidedSpanIsNotClosedWhenActive() throws
MalformedURLException {
final Tracing brave = Tracing.newBuilder()
.localServiceName("book-store")
- .reporter(new TestSpanReporter())
+ .spanReporter(new TestSpanReporter())
.build();
final BookStoreService service = createJaxWsService(new Configurator()
{
@@ -186,10 +186,10 @@ public void configure(final JaxWsProxyFactoryBean
factory) {
assertThat(brave.tracer().currentSpan(), not(nullValue()));
assertThat(TestSpanReporter.getAllSpans().size(), equalTo(3));
- assertThat(TestSpanReporter.getAllSpans().get(0).name,
equalTo("get books"));
- assertThat(TestSpanReporter.getAllSpans().get(0).parentId,
not(nullValue()));
- assertThat(TestSpanReporter.getAllSpans().get(1).name,
equalTo("post /bookstore"));
- assertThat(TestSpanReporter.getAllSpans().get(2).name,
+ assertThat(TestSpanReporter.getAllSpans().get(0).name(),
equalTo("get books"));
+ assertThat(TestSpanReporter.getAllSpans().get(0).parentId(),
not(nullValue()));
+ assertThat(TestSpanReporter.getAllSpans().get(1).name(),
equalTo("post /bookstore"));
+ assertThat(TestSpanReporter.getAllSpans().get(2).name(),
equalTo("post http://localhost:" + PORT + "/bookstore"));
final Map<String, List<String>> response =
getResponseHeaders(service);
@@ -202,7 +202,7 @@ public void configure(final JaxWsProxyFactoryBean factory) {
}
assertThat(TestSpanReporter.getAllSpans().size(), equalTo(4));
- assertThat(TestSpanReporter.getAllSpans().get(3).name, equalTo("test
span"));
+ assertThat(TestSpanReporter.getAllSpans().get(3).name(), equalTo("test
span"));
}
@Test
@@ -217,7 +217,7 @@ public void testThatNewSpanIsCreatedInCaseOfFault() throws
MalformedURLException
}
assertThat(TestSpanReporter.getAllSpans().size(), equalTo(1));
- assertThat(TestSpanReporter.getAllSpans().get(0).name, equalTo("post
/bookstore"));
+ assertThat(TestSpanReporter.getAllSpans().get(0).name(), equalTo("post
/bookstore"));
final Map<String, List<String>> headers = getResponseHeaders(service);
assertFalse(headers.containsKey(TRACE_ID_NAME));
@@ -230,7 +230,7 @@ public void testThatNewSpanIsCreatedInCaseOfFault() throws
MalformedURLException
public void
testThatNewChildSpanIsCreatedWhenParentIsProvidedInCaseOfFault() throws
MalformedURLException {
final Tracing brave = Tracing.newBuilder()
.localServiceName("book-store")
- .reporter(new TestSpanReporter())
+ .spanReporter(new TestSpanReporter())
.build();
final BookStoreService service = createJaxWsService(new Configurator()
{
@@ -250,8 +250,8 @@ public void configure(final JaxWsProxyFactoryBean factory) {
}
assertThat(TestSpanReporter.getAllSpans().size(), equalTo(2));
- assertThat(TestSpanReporter.getAllSpans().get(0).name, equalTo("post
/bookstore"));
- assertThat(TestSpanReporter.getAllSpans().get(1).name,
+ assertThat(TestSpanReporter.getAllSpans().get(0).name(), equalTo("post
/bookstore"));
+ assertThat(TestSpanReporter.getAllSpans().get(1).name(),
equalTo("post http://localhost:" + PORT + "/bookstore"));
final Map<String, List<String>> response = getResponseHeaders(service);
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services