Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B4FAD200B13 for ; Tue, 31 May 2016 08:25:46 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id B39CC160A39; Tue, 31 May 2016 06:25:46 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 8B38A160A23 for ; Tue, 31 May 2016 08:25:45 +0200 (CEST) Received: (qmail 19660 invoked by uid 500); 31 May 2016 06:25:44 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 19631 invoked by uid 99); 31 May 2016 06:25:44 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 May 2016 06:25:44 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id AFCB0DF9F1; Tue, 31 May 2016 06:25:43 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ffang@apache.org To: commits@cxf.apache.org Date: Tue, 31 May 2016 06:25:44 -0000 Message-Id: <1273b73e2def4f8182d0c292f063807f@git.apache.org> In-Reply-To: <5f1fa911986b4cbfac2e640863ae7a22@git.apache.org> References: <5f1fa911986b4cbfac2e640863ae7a22@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/3] cxf git commit: [CXF-6923] Fix test execution for different ORB implementations archived-at: Tue, 31 May 2016 06:25:46 -0000 [CXF-6923] Fix test execution for different ORB implementations (cherry picked from commit 08c2c22439dcd85c19b21e555d45692135faae43) Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/76f7fad3 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/76f7fad3 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/76f7fad3 Branch: refs/heads/master Commit: 76f7fad3558a129e1e34352b0188eced086d8c36 Parents: 0865c3a Author: Grzegorz Grzybek Authored: Mon May 30 20:57:15 2016 +0200 Committer: Freeman Fang Committed: Tue May 31 14:22:46 2016 +0800 ---------------------------------------------------------------------- .../systest/corba/BaseGreeterTimeoutImpl.java | 25 +-- .../cxf/systest/corba/CorbaTimeoutTest.java | 24 ++- .../apache/cxf/systest/corba/ServerTimeout.java | 2 +- .../wsdl_systest/hello_world_corba_timeout.wsdl | 191 +++++++++++++++++++ 4 files changed, 214 insertions(+), 28 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/76f7fad3/systests/uncategorized/src/test/java/org/apache/cxf/systest/corba/BaseGreeterTimeoutImpl.java ---------------------------------------------------------------------- diff --git a/systests/uncategorized/src/test/java/org/apache/cxf/systest/corba/BaseGreeterTimeoutImpl.java b/systests/uncategorized/src/test/java/org/apache/cxf/systest/corba/BaseGreeterTimeoutImpl.java index efa0503..b89b993 100644 --- a/systests/uncategorized/src/test/java/org/apache/cxf/systest/corba/BaseGreeterTimeoutImpl.java +++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/corba/BaseGreeterTimeoutImpl.java @@ -18,13 +18,8 @@ */ package org.apache.cxf.systest.corba; -import java.util.ResourceBundle; - -import org.apache.cxf.common.i18n.Message; import org.apache.cxf.hello_world_corba.Greeter; import org.apache.cxf.hello_world_corba.PingMeFault; -import org.apache.cxf.hello_world_corba.types.FaultDetail; -import org.apache.cxf.interceptor.Fault; import org.junit.Assert; /** @@ -46,14 +41,13 @@ import org.junit.Assert; * under the License. */ -@javax.jws.WebService(portName = "GreeterCORBAPort", - serviceName = "GreeterCORBAService", +@javax.jws.WebService(portName = "GreeterTimeoutCORBAPort", + serviceName = "GreeterTimeoutCORBAService", targetNamespace = "http://cxf.apache.org/hello_world_corba", - wsdlLocation = "classpath:/wsdl_systest/hello_world_corba.wsdl", + wsdlLocation = "classpath:/wsdl_systest/hello_world_corba_timeout.wsdl", endpointInterface = "org.apache.cxf.hello_world_corba.Greeter") public class BaseGreeterTimeoutImpl extends Assert implements Greeter { - public static final String GREETME_IN = "test in"; public static final String GREETME_OUT = "test out"; static final String EX_STRING = "CXF RUNTIME EXCEPTION"; @@ -72,7 +66,6 @@ public class BaseGreeterTimeoutImpl extends Assert implements Greeter { } public void greetMeOneWay(String me) { - assertEquals("William", me); } public String sayHi() { @@ -80,17 +73,5 @@ public class BaseGreeterTimeoutImpl extends Assert implements Greeter { } public void pingMe(String faultType) throws PingMeFault { - if ("USER".equals(faultType)) { - - FaultDetail detail = new FaultDetail(); - detail.setMajor((short)1); - detail.setMinor((short)2); - throw new PingMeFault("USER FAULT TEST", detail); - } else if ("SYSTEM".equals(faultType)) { - throw new Fault(new Message(EX_STRING, (ResourceBundle)null, - new Object[]{"FAULT TEST"})); - } else { - throw new IllegalArgumentException(EX_STRING); - } } } http://git-wip-us.apache.org/repos/asf/cxf/blob/76f7fad3/systests/uncategorized/src/test/java/org/apache/cxf/systest/corba/CorbaTimeoutTest.java ---------------------------------------------------------------------- diff --git a/systests/uncategorized/src/test/java/org/apache/cxf/systest/corba/CorbaTimeoutTest.java b/systests/uncategorized/src/test/java/org/apache/cxf/systest/corba/CorbaTimeoutTest.java index db7fb34..a52c0d8 100644 --- a/systests/uncategorized/src/test/java/org/apache/cxf/systest/corba/CorbaTimeoutTest.java +++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/corba/CorbaTimeoutTest.java @@ -20,10 +20,12 @@ package org.apache.cxf.systest.corba; import java.io.File; +import java.lang.reflect.Field; import java.net.URL; import javax.xml.namespace.QName; import javax.xml.ws.WebServiceException; +import org.apache.cxf.binding.corba.utils.CorbaBindingHelper; import org.apache.cxf.bus.spring.SpringBusFactory; import org.apache.cxf.hello_world_corba.Greeter; import org.apache.cxf.hello_world_corba.GreeterCORBAService; @@ -34,7 +36,7 @@ import org.junit.Test; import org.omg.CORBA.TIMEOUT; /** - * + * This test uses Jacorb implementation, but cleans after itself. */ public class CorbaTimeoutTest extends AbstractBusClientServerTestBase { @@ -42,10 +44,12 @@ public class CorbaTimeoutTest extends AbstractBusClientServerTestBase { private static final QName SERVICE_NAME = new QName("http://cxf.apache.org/hello_world_corba", - "GreeterCORBAService"); + "GreeterTimeoutCORBAService"); @BeforeClass public static void startServers() throws Exception { + cleanDefaultORB(); + assertTrue( "Server failed to launch", launchServer(ServerTimeout.class) @@ -54,7 +58,8 @@ public class CorbaTimeoutTest extends AbstractBusClientServerTestBase { @AfterClass public static void cleanupFile() throws Exception { - File file = new File("./HelloWorld.ref"); + cleanDefaultORB(); + File file = new File("./HelloWorldTimeout.ref"); if (file.exists()) { file.delete(); } @@ -68,18 +73,27 @@ public class CorbaTimeoutTest extends AbstractBusClientServerTestBase { System.setProperty("org.omg.CORBA.ORBSingletonClass", "org.jacorb.orb.ORBSingleton"); System.setProperty("jacorb.connection.client.pending_reply_timeout", "1000"); - URL wsdlUrl = this.getClass().getResource("/wsdl_systest/hello_world_corba.wsdl"); + URL wsdlUrl = this.getClass().getResource("/wsdl_systest/hello_world_corba_timeout.wsdl"); new SpringBusFactory().createBus("org/apache/cxf/systest/corba/hello_world_client.xml"); GreeterCORBAService gcs = new GreeterCORBAService(wsdlUrl, SERVICE_NAME); - Greeter port = gcs.getGreeterCORBAPort(); + Greeter port = gcs.getPort(new QName("http://cxf.apache.org/hello_world_corba", "GreeterTimeoutCORBAPort"), GreeterCORBAService.GreeterProxy.class); try { port.greetMe("Betty"); fail("Should throw org.omg.CORBA.TIMEOUT exception"); } catch (WebServiceException e) { assertTrue(e.getCause() instanceof TIMEOUT); + } finally { + System.getProperties().remove("org.omg.CORBA.ORBClass"); + System.getProperties().remove("org.omg.CORBA.ORBSingletonClass"); } } + private static void cleanDefaultORB() throws NoSuchFieldException, IllegalAccessException { + Field f = CorbaBindingHelper.class.getDeclaredField("defaultORB"); + f.setAccessible(true); + f.set(null, null); + } + } http://git-wip-us.apache.org/repos/asf/cxf/blob/76f7fad3/systests/uncategorized/src/test/java/org/apache/cxf/systest/corba/ServerTimeout.java ---------------------------------------------------------------------- diff --git a/systests/uncategorized/src/test/java/org/apache/cxf/systest/corba/ServerTimeout.java b/systests/uncategorized/src/test/java/org/apache/cxf/systest/corba/ServerTimeout.java index a1bb2c5..4e62771 100644 --- a/systests/uncategorized/src/test/java/org/apache/cxf/systest/corba/ServerTimeout.java +++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/corba/ServerTimeout.java @@ -33,7 +33,7 @@ public class ServerTimeout extends AbstractBusTestServerBase { System.setProperty("com.sun.CORBA.POA.ORBPersistentServerPort", PERSIST_PORT); new SpringBusFactory().createBus("org/apache/cxf/systest/corba/hello_world_server.xml"); Object implementor = new BaseGreeterTimeoutImpl(); - String address = "file:./HelloWorld.ref"; + String address = "file:./HelloWorldTimeout.ref"; Endpoint.publish(address, implementor); } http://git-wip-us.apache.org/repos/asf/cxf/blob/76f7fad3/systests/uncategorized/src/test/resources/wsdl_systest/hello_world_corba_timeout.wsdl ---------------------------------------------------------------------- diff --git a/systests/uncategorized/src/test/resources/wsdl_systest/hello_world_corba_timeout.wsdl b/systests/uncategorized/src/test/resources/wsdl_systest/hello_world_corba_timeout.wsdl new file mode 100644 index 0000000..3a1ef56 --- /dev/null +++ b/systests/uncategorized/src/test/resources/wsdl_systest/hello_world_corba_timeout.wsdl @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +