cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [05/29] cxf git commit: Check other locations for the FaultMode
Date Mon, 29 Aug 2016 23:22:51 GMT
Check other locations for the FaultMode


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/ce9332b7
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/ce9332b7
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/ce9332b7

Branch: refs/heads/master-jaxrs-2.1
Commit: ce9332b717be75e4500d1456a926b6cc468d3c0c
Parents: 65b0f60
Author: Daniel Kulp <dkulp@apache.org>
Authored: Thu Aug 25 13:55:09 2016 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Thu Aug 25 13:55:09 2016 -0400

----------------------------------------------------------------------
 .../codahale/CodahaleMetricsContext.java        |  6 ++++++
 systests/jaxws/pom.xml                          |  9 +++++++++
 .../cxf/systest/jaxws/ClientServerMiscTest.java |  7 +++++++
 .../DocLitWrappedCodeFirstServiceImpl.java      |  3 +++
 .../apache/cxf/systest/jaxws/ServerMisc.java    | 21 ++++++++++++++++++++
 5 files changed, 46 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/ce9332b7/rt/features/metrics/src/main/java/org/apache/cxf/metrics/codahale/CodahaleMetricsContext.java
----------------------------------------------------------------------
diff --git a/rt/features/metrics/src/main/java/org/apache/cxf/metrics/codahale/CodahaleMetricsContext.java
b/rt/features/metrics/src/main/java/org/apache/cxf/metrics/codahale/CodahaleMetricsContext.java
index 9670b55..27dbc80 100644
--- a/rt/features/metrics/src/main/java/org/apache/cxf/metrics/codahale/CodahaleMetricsContext.java
+++ b/rt/features/metrics/src/main/java/org/apache/cxf/metrics/codahale/CodahaleMetricsContext.java
@@ -89,6 +89,12 @@ public class CodahaleMetricsContext implements MetricsContext, Closeable
{
             outgoingData.mark(outSize);
         }
         FaultMode fm = ex.get(FaultMode.class);
+        if (fm == null && ex.getOutFaultMessage() != null) { 
+            fm = ex.getOutFaultMessage().get(FaultMode.class);
+        }
+        if (fm == null && ex.getInMessage() != null) {
+            fm = ex.getInMessage().get(FaultMode.class);
+        }
         if (fm != null) {
             switch (fm) {
             case CHECKED_APPLICATION_FAULT:

http://git-wip-us.apache.org/repos/asf/cxf/blob/ce9332b7/systests/jaxws/pom.xml
----------------------------------------------------------------------
diff --git a/systests/jaxws/pom.xml b/systests/jaxws/pom.xml
index f8e17a3..9806ee4 100644
--- a/systests/jaxws/pom.xml
+++ b/systests/jaxws/pom.xml
@@ -139,6 +139,15 @@
             <version>${project.version}</version>
         </dependency>
         <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-features-metrics</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.dropwizard.metrics</groupId>
+            <artifactId>metrics-core</artifactId>
+        </dependency>
+        <dependency>
             <groupId>org.eclipse.jetty.websocket</groupId>
             <artifactId>websocket-server</artifactId>
             <version>${cxf.jetty9.version}</version>

http://git-wip-us.apache.org/repos/asf/cxf/blob/ce9332b7/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
b/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
index 0ae5a02..0635b73 100644
--- a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
+++ b/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
@@ -39,6 +39,7 @@ import javax.xml.namespace.QName;
 import javax.xml.ws.BindingProvider;
 import javax.xml.ws.Holder;
 import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceException;
 import javax.xml.ws.soap.SOAPBinding;
 import javax.xml.ws.soap.SOAPFaultException;
 import javax.xml.xpath.XPathConstants;
@@ -622,6 +623,12 @@ public class ClientServerMiscTest extends AbstractBusClientServerTestBase
{
         }    
         
         try {
+            port.throwException(-4);
+            fail("Expected exception not found");
+        } catch (WebServiceException ex) {
+            assertEquals("RuntimeException!!", ex.getMessage());
+        }    
+        try {
             Foo foo = new Foo();
             foo.setNameIgnore("DoNoName");
             port.modifyFoo(foo);

http://git-wip-us.apache.org/repos/asf/cxf/blob/ce9332b7/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java
----------------------------------------------------------------------
diff --git a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java
b/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java
index 7d195e2..344e679 100644
--- a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java
+++ b/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java
@@ -190,6 +190,9 @@ public class DocLitWrappedCodeFirstServiceImpl implements DocLitWrappedCodeFirst
             ex.setInts(new int[] {1, 2, 3});
             throw ex;
         }
+        case -4: {
+            throw new RuntimeException("RuntimeException!!");
+        }
         default:
             throw new ServiceTestFault(new ServiceTestFault.ServiceTestDetails(i));
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/ce9332b7/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java
----------------------------------------------------------------------
diff --git a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java b/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java
index d3b62ed..597abfe 100644
--- a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java
+++ b/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java
@@ -19,17 +19,26 @@
 
 package org.apache.cxf.systest.jaxws;
 
+import java.util.Arrays;
+import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 
 import javax.xml.ws.Endpoint;
 
+import com.codahale.metrics.MetricRegistry;
+
+import org.apache.cxf.Bus;
 import org.apache.cxf.anonymous_complex_type.AnonymousComplexTypeImpl;
 import org.apache.cxf.binding.soap.saaj.SAAJInInterceptor;
+import org.apache.cxf.bus.CXFBusFactory;
 import org.apache.cxf.jaxb_element_test.JaxbElementTestImpl;
 import org.apache.cxf.jaxws.EndpointImpl;
 import org.apache.cxf.jaxws.JAXWSMethodInvoker;
 import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.apache.cxf.metrics.MetricsFeature;
+import org.apache.cxf.metrics.codahale.CodahaleMetricsProvider;
 import org.apache.cxf.ordered_param_holder.OrderedParamHolderImpl;
 import org.apache.cxf.service.invoker.Factory;
 import org.apache.cxf.service.invoker.PerRequestFactory;
@@ -80,9 +89,21 @@ public class ServerMisc extends AbstractBusTestServerBase {
         JAXWSMethodInvoker invoker = new JAXWSMethodInvoker(factory);
         JaxWsServerFactoryBean factoryBean;
         
+        Map<String, Object> properties = new HashMap<>();
+        properties.put("bus.jmx.usePlatformMBeanServer", Boolean.TRUE);
+        properties.put("bus.jmx.enabled", Boolean.TRUE);
+        Bus b = new CXFBusFactory().createBus(null, properties);
+        setBus(b);
+        MetricRegistry registry = new MetricRegistry();
+        CodahaleMetricsProvider.setupJMXReporter(b, registry);
+        b.setExtension(registry, MetricRegistry.class);
+        
+        
         factoryBean = new JaxWsServerFactoryBean();
+        factoryBean.setBus(b);
         factoryBean.setAddress(DOCLIT_CODEFIRST_URL);
         factoryBean.setServiceClass(DocLitWrappedCodeFirstServiceImpl.class);
+        factoryBean.setFeatures(Arrays.asList(new MetricsFeature()));
         factoryBean.setInvoker(invoker);
         servers.add(factoryBean.create());
         


Mime
View raw message