cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [1/2] cxf git commit: CXF-7164: Support tracing using OpenZipkin Brave. Implemented JAX-RS support.
Date Tue, 27 Dec 2016 00:29:29 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 2103bc595 -> c194254d6


http://git-wip-us.apache.org/repos/asf/cxf/blob/c194254d/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/brave/IsAnnotationContaining.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..54d877b
--- /dev/null
+++ b/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/brave/IsAnnotationContaining.java
@@ -0,0 +1,45 @@
+/**
+ * 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 org.hamcrest.Description;
+import org.hamcrest.TypeSafeMatcher;
+import org.hamcrest.core.IsCollectionContaining;
+
+import zipkin.Annotation;
+
+public class IsAnnotationContaining extends IsCollectionContaining<Annotation> {
+    public IsAnnotationContaining(final String value) {
+        super(new TypeSafeMatcher<Annotation>() {
+            @Override
+            public void describeTo(Description description) {
+                description.appendValue(value);
+            }
+
+            @Override
+            protected boolean matchesSafely(Annotation item) {
+                return value.equals(item.value);
+            }
+        });
+    }
+    
+    public static IsAnnotationContaining hasItem(final String value) {
+        return new IsAnnotationContaining(value);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf/blob/c194254d/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/brave/IsBinaryAnnotationContaining.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..c9ed3fa
--- /dev/null
+++ b/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/brave/IsBinaryAnnotationContaining.java
@@ -0,0 +1,51 @@
+/**
+ * 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

http://git-wip-us.apache.org/repos/asf/cxf/blob/c194254d/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/htrace/HTraceTracingCustomHeadersTest.java
----------------------------------------------------------------------
diff --git a/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/htrace/HTraceTracingCustomHeadersTest.java
b/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/htrace/HTraceTracingCustomHeadersTest.java
index b7c5b32..fae555b 100644
--- a/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/htrace/HTraceTracingCustomHeadersTest.java
+++ b/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/htrace/HTraceTracingCustomHeadersTest.java
@@ -43,6 +43,7 @@ import org.apache.htrace.core.AlwaysSampler;
 import org.apache.htrace.core.HTraceConfiguration;
 import org.apache.htrace.core.SpanId;
 import org.apache.htrace.core.StandardOutSpanReceiver;
+import org.apache.htrace.core.TraceScope;
 import org.apache.htrace.core.Tracer;
 import org.junit.Before;
 import org.junit.BeforeClass;
@@ -72,7 +73,7 @@ public class HTraceTracingCustomHeadersTest extends AbstractBusClientServerTestB
             
             final JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
             sf.setResourceClasses(BookStore.class);
-            sf.setResourceProvider(BookStore.class, new SingletonResourceProvider(new BookStore()));
+            sf.setResourceProvider(BookStore.class, new SingletonResourceProvider(new BookStore<TraceScope>()));
             sf.setAddress("http://localhost:" + PORT);
             sf.setProvider(new JacksonJsonProvider());
             sf.setFeatures(Arrays.asList(new HTraceFeature(HTraceConfiguration.fromMap(properties),
"test-tracer")));

http://git-wip-us.apache.org/repos/asf/cxf/blob/c194254d/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/htrace/HTraceTracingTest.java
----------------------------------------------------------------------
diff --git a/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/htrace/HTraceTracingTest.java
b/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/htrace/HTraceTracingTest.java
index d4f84ba..b46b422 100644
--- a/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/htrace/HTraceTracingTest.java
+++ b/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/htrace/HTraceTracingTest.java
@@ -70,7 +70,7 @@ public class HTraceTracingTest extends AbstractBusClientServerTestBase {
             
             final JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
             sf.setResourceClasses(BookStore.class);
-            sf.setResourceProvider(BookStore.class, new SingletonResourceProvider(new BookStore()));
+            sf.setResourceProvider(BookStore.class, new SingletonResourceProvider(new BookStore<TraceScope>()));
             sf.setAddress("http://localhost:" + PORT);
             sf.setProvider(new JacksonJsonProvider());
             sf.setFeatures(Arrays.asList(new HTraceFeature(HTraceConfiguration.fromMap(properties),
"tracer")));


Mime
View raw message