You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2020/01/23 01:55:01 UTC

[cxf] branch master updated: CXF-8102: Update to Dropwizard Metrics 4.x (#628)

This is an automated email from the ASF dual-hosted git repository.

reta pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new 3dfe11c  CXF-8102: Update to Dropwizard Metrics 4.x (#628)
3dfe11c is described below

commit 3dfe11c866073ff93951dac2b94e0f8e8e464b27
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Wed Jan 22 20:54:54 2020 -0500

    CXF-8102: Update to Dropwizard Metrics 4.x (#628)
---
 osgi/karaf/features/src/main/resources/features.xml          |  5 +++--
 parent/pom.xml                                               | 10 ++++++++--
 rt/features/metrics/pom.xml                                  |  6 ++++++
 .../apache/cxf/metrics/codahale/CodahaleMetricsProvider.java |  4 ++--
 .../cxf/systest/jaxrs/metrics/JAXRSClientMetricsTest.java    | 10 +++++-----
 .../cxf/systest/jaxrs/metrics/JAXRSServerMetricsTest.java    | 12 ++++++------
 systests/jaxws/pom.xml                                       |  4 ++++
 7 files changed, 34 insertions(+), 17 deletions(-)

diff --git a/osgi/karaf/features/src/main/resources/features.xml b/osgi/karaf/features/src/main/resources/features.xml
index 00829d7..239ce65 100644
--- a/osgi/karaf/features/src/main/resources/features.xml
+++ b/osgi/karaf/features/src/main/resources/features.xml
@@ -64,7 +64,7 @@
         <bundle start-level="25" dependency="true">mvn:commons-codec/commons-codec/${cxf.commons-codec.version}</bundle>
         <bundle start-level="25" dependency="true">mvn:org.apache.santuario/xmlsec/${cxf.xmlsec.bundle.version}</bundle>
         <bundle start-level="25" dependency="true">mvn:com.google.guava/guava/${cxf.guava.version}</bundle>
-        <bundle start-level="25" dependency='true'>mvn:io.dropwizard.metrics/metrics-core/${cxf.dropwizard.version}</bundle>
+        <bundle start-level="25" dependency='true'>mvn:io.dropwizard.metrics/metrics-core/${cxf.dropwizard3.version}</bundle>
         <bundle start-level="25" dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.opensaml/${cxf.opensaml.osgi.version}</bundle>
         <bundle start-level="25">mvn:org.jvnet.staxex/stax-ex/${cxf.stax-ex.version}</bundle>
         <bundle start-level="25">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.saaj-impl/${cxf.saaj-impl.bundle.version}</bundle>
@@ -366,7 +366,8 @@
     </feature>
     <feature name="cxf-features-metrics" version="${project.version}">
         <feature version="${project.version}">cxf-core</feature>
-        <bundle start-level="40" dependency='true'>mvn:io.dropwizard.metrics/metrics-core/${cxf.dropwizard.version}</bundle>
+        <bundle start-level="40" dependency='true'>mvn:io.dropwizard.metrics/metrics-core/${cxf.dropwizard4.version}</bundle>
+        <bundle start-level="40" dependency='true'>mvn:io.dropwizard.metrics/metrics-jmx/${cxf.dropwizard4.version}</bundle>
         <bundle start-level="40">mvn:org.apache.cxf/cxf-rt-features-metrics/${project.version}</bundle>
     </feature>
     <feature name="cxf-bindings-corba" version="${project.version}">
diff --git a/parent/pom.xml b/parent/pom.xml
index ea67e73..e3815cf 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -103,7 +103,8 @@
         <cxf.commons-text.version>1.8</cxf.commons-text.version>
         <cxf.derby.version>10.14.2.0</cxf.derby.version>
         <cxf.dom4j.version>2.1.1</cxf.dom4j.version>
-        <cxf.dropwizard.version>3.2.6</cxf.dropwizard.version>
+        <cxf.dropwizard3.version>3.2.6</cxf.dropwizard3.version>
+        <cxf.dropwizard4.version>4.1.2</cxf.dropwizard4.version>
         <cxf.ehcache.version>2.10.6</cxf.ehcache.version>
         <cxf.ehcache3.version>3.8.1</cxf.ehcache3.version>
         <cxf.findbugs.version>3.0.2</cxf.findbugs.version>
@@ -2450,7 +2451,12 @@
             <dependency>
                 <groupId>io.dropwizard.metrics</groupId>
                 <artifactId>metrics-core</artifactId>
-                <version>${cxf.dropwizard.version}</version>
+                <version>${cxf.dropwizard4.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>io.dropwizard.metrics</groupId>
+                <artifactId>metrics-jmx</artifactId>
+                <version>${cxf.dropwizard4.version}</version>
             </dependency>
             <dependency>
                  <groupId>io.zipkin.brave</groupId>
diff --git a/rt/features/metrics/pom.xml b/rt/features/metrics/pom.xml
index 5c17ecf..622c6ea 100644
--- a/rt/features/metrics/pom.xml
+++ b/rt/features/metrics/pom.xml
@@ -29,6 +29,12 @@
         </dependency>
 
         <dependency>
+            <groupId>io.dropwizard.metrics</groupId>
+            <artifactId>metrics-jmx</artifactId>
+            <optional>true</optional>
+        </dependency>
+
+        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <scope>test</scope>
diff --git a/rt/features/metrics/src/main/java/org/apache/cxf/metrics/codahale/CodahaleMetricsProvider.java b/rt/features/metrics/src/main/java/org/apache/cxf/metrics/codahale/CodahaleMetricsProvider.java
index cd500ad..92ac76a 100644
--- a/rt/features/metrics/src/main/java/org/apache/cxf/metrics/codahale/CodahaleMetricsProvider.java
+++ b/rt/features/metrics/src/main/java/org/apache/cxf/metrics/codahale/CodahaleMetricsProvider.java
@@ -22,9 +22,9 @@ package org.apache.cxf.metrics.codahale;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 
-import com.codahale.metrics.JmxReporter;
 import com.codahale.metrics.MetricRegistry;
-import com.codahale.metrics.ObjectNameFactory;
+import com.codahale.metrics.jmx.JmxReporter;
+import com.codahale.metrics.jmx.ObjectNameFactory;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.injection.NoJSR250Annotations;
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/metrics/JAXRSClientMetricsTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/metrics/JAXRSClientMetricsTest.java
index 6f635e5..fb50adc 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/metrics/JAXRSClientMetricsTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/metrics/JAXRSClientMetricsTest.java
@@ -112,7 +112,7 @@ public class JAXRSClientMetricsTest {
             Mockito.verify(resourceContext, times(1)).stop(anyLong(), anyLong(), anyLong(), any(Exchange.class));
             Mockito.verify(endpointContext, times(1)).start(any(Exchange.class));
             Mockito.verify(endpointContext, times(1)).stop(anyLong(), anyLong(), anyLong(), any(Exchange.class));
-            Mockito.verifyZeroInteractions(operationContext);
+            Mockito.verifyNoInteractions(operationContext);
         }
     }
    
@@ -138,7 +138,7 @@ public class JAXRSClientMetricsTest {
             Mockito.verify(resourceContext, times(1)).stop(anyLong(), anyLong(), anyLong(), any(Exchange.class));
             Mockito.verify(endpointContext, times(1)).start(any(Exchange.class));
             Mockito.verify(endpointContext, times(1)).stop(anyLong(), anyLong(), anyLong(), any(Exchange.class));
-            Mockito.verifyZeroInteractions(operationContext);
+            Mockito.verifyNoInteractions(operationContext);
         }
     }
 
@@ -163,7 +163,7 @@ public class JAXRSClientMetricsTest {
             Mockito.verify(resourceContext, times(1)).stop(anyLong(), anyLong(), anyLong(), any(Exchange.class));
             Mockito.verify(endpointContext, times(1)).start(any(Exchange.class));
             Mockito.verify(endpointContext, times(1)).stop(anyLong(), anyLong(), anyLong(), any(Exchange.class));
-            Mockito.verifyZeroInteractions(operationContext);
+            Mockito.verifyNoInteractions(operationContext);
         }
     }
 
@@ -192,7 +192,7 @@ public class JAXRSClientMetricsTest {
             Mockito.verify(resourceContext, times(1)).stop(anyLong(), anyLong(), anyLong(), any(Exchange.class));
             Mockito.verify(endpointContext, times(1)).start(any(Exchange.class));
             Mockito.verify(endpointContext, times(1)).stop(anyLong(), anyLong(), anyLong(), any(Exchange.class));
-            Mockito.verifyZeroInteractions(operationContext);
+            Mockito.verifyNoInteractions(operationContext);
         }
     }
     
@@ -213,7 +213,7 @@ public class JAXRSClientMetricsTest {
             Mockito.verify(resourceContext, times(1)).stop(anyLong(), anyLong(), anyLong(), any(Exchange.class));
             Mockito.verify(endpointContext, times(1)).start(any(Exchange.class));
             Mockito.verify(endpointContext, times(1)).stop(anyLong(), anyLong(), anyLong(), any(Exchange.class));
-            Mockito.verifyZeroInteractions(operationContext);
+            Mockito.verifyNoInteractions(operationContext);
         }
     }
 }
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/metrics/JAXRSServerMetricsTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/metrics/JAXRSServerMetricsTest.java
index 53f999a..9bd6342 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/metrics/JAXRSServerMetricsTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/metrics/JAXRSServerMetricsTest.java
@@ -156,7 +156,7 @@ public class JAXRSServerMetricsTest extends AbstractBusClientServerTestBase {
             Mockito.verify(resourceContext, times(1)).stop(anyLong(), anyLong(), anyLong(), any(Exchange.class));
             Mockito.verify(endpointContext, times(1)).start(any(Exchange.class));
             Mockito.verify(endpointContext, times(1)).stop(anyLong(), anyLong(), anyLong(), any(Exchange.class));
-            Mockito.verifyZeroInteractions(operationContext);
+            Mockito.verifyNoInteractions(operationContext);
         }
     }
    
@@ -177,7 +177,7 @@ public class JAXRSServerMetricsTest extends AbstractBusClientServerTestBase {
             Mockito.verify(resourceContext, times(1)).stop(anyLong(), anyLong(), anyLong(), any(Exchange.class));
             Mockito.verify(endpointContext, times(1)).start(any(Exchange.class));
             Mockito.verify(endpointContext, times(1)).stop(anyLong(), anyLong(), anyLong(), any(Exchange.class));
-            Mockito.verifyZeroInteractions(operationContext);
+            Mockito.verifyNoInteractions(operationContext);
         }
     }
 
@@ -198,7 +198,7 @@ public class JAXRSServerMetricsTest extends AbstractBusClientServerTestBase {
             Mockito.verify(resourceContext, times(1)).stop(anyLong(), anyLong(), anyLong(), any(Exchange.class));
             Mockito.verify(endpointContext, times(1)).start(any(Exchange.class));
             Mockito.verify(endpointContext, times(1)).stop(anyLong(), anyLong(), anyLong(), any(Exchange.class));
-            Mockito.verifyZeroInteractions(operationContext);
+            Mockito.verifyNoInteractions(operationContext);
         }
     }
     
@@ -215,7 +215,7 @@ public class JAXRSServerMetricsTest extends AbstractBusClientServerTestBase {
             Mockito.verify(resourceContext, times(1)).stop(anyLong(), anyLong(), anyLong(), any(Exchange.class));
             Mockito.verify(endpointContext, times(1)).start(any(Exchange.class));
             Mockito.verify(endpointContext, times(1)).stop(anyLong(), anyLong(), anyLong(), any(Exchange.class));
-            Mockito.verifyZeroInteractions(operationContext);
+            Mockito.verifyNoInteractions(operationContext);
         }
     }
     
@@ -230,8 +230,8 @@ public class JAXRSServerMetricsTest extends AbstractBusClientServerTestBase {
         } finally {
             Mockito.verify(endpointContext, times(1)).start(any(Exchange.class));
             Mockito.verify(endpointContext, times(1)).stop(anyLong(), anyLong(), anyLong(), any(Exchange.class));
-            Mockito.verifyZeroInteractions(resourceContext);
-            Mockito.verifyZeroInteractions(operationContext);
+            Mockito.verifyNoInteractions(resourceContext);
+            Mockito.verifyNoInteractions(operationContext);
         }
     }
 }
diff --git a/systests/jaxws/pom.xml b/systests/jaxws/pom.xml
index 156a78d..739a5e5 100644
--- a/systests/jaxws/pom.xml
+++ b/systests/jaxws/pom.xml
@@ -155,6 +155,10 @@
             <artifactId>metrics-core</artifactId>
         </dependency>
         <dependency>
+            <groupId>io.dropwizard.metrics</groupId>
+            <artifactId>metrics-jmx</artifactId>
+        </dependency>
+        <dependency>
             <groupId>org.eclipse.jetty.websocket</groupId>
             <artifactId>websocket-server</artifactId>
             <version>${cxf.jetty9.version}</version>