Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C299FCA75 for ; Wed, 6 Jun 2012 18:16:26 +0000 (UTC) Received: (qmail 92180 invoked by uid 500); 6 Jun 2012 18:16:26 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 92131 invoked by uid 500); 6 Jun 2012 18:16:26 -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 92124 invoked by uid 99); 6 Jun 2012 18:16:26 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Jun 2012 18:16:26 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Jun 2012 18:16:23 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 019A42388860; Wed, 6 Jun 2012 18:16:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1347023 - in /cxf/branches/2.4.x-fixes: ./ testutils/src/main/java/org/apache/cxf/testutil/common/ Date: Wed, 06 Jun 2012 18:16:01 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120606181602.019A42388860@eris.apache.org> Author: dkulp Date: Wed Jun 6 18:16:01 2012 New Revision: 1347023 URL: http://svn.apache.org/viewvc?rev=1347023&view=rev Log: Merged revisions 1347010 via svn merge from https://svn.apache.org/repos/asf/cxf/branches/2.5.x-fixes ........ r1347010 | dkulp | 2012-06-06 13:57:29 -0400 (Wed, 06 Jun 2012) | 9 lines Merged revisions 1346927 via git cherry-pick from https://svn.apache.org/repos/asf/cxf/trunk ........ r1346927 | dkulp | 2012-06-06 10:58:32 -0400 (Wed, 06 Jun 2012) | 2 lines Add ability to launch in-process brokers with vm: URL's ........ ........ Modified: cxf/branches/2.4.x-fixes/ (props changed) cxf/branches/2.4.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java cxf/branches/2.4.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java cxf/branches/2.4.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java Propchange: cxf/branches/2.4.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.4.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java?rev=1347023&r1=1347022&r2=1347023&view=diff ============================================================================== --- cxf/branches/2.4.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java (original) +++ cxf/branches/2.4.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java Wed Jun 6 18:16:01 2012 @@ -63,6 +63,21 @@ public abstract class AbstractClientServ assertTrue("server failed", passed); } + public static boolean launchServer(AbstractTestServerBase base) { + boolean ok = false; + try { + ServerLauncher sl = new ServerLauncher(base); + ok = sl.launchServer(); + assertTrue("server failed to launch", ok); + launchers.add(0, sl); + } catch (IOException ex) { + ex.printStackTrace(); + fail("failed to launch server " + base); + } + + return ok; + } + public static boolean launchServer(Class clz) { boolean ok = false; try { Modified: cxf/branches/2.4.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java?rev=1347023&r1=1347022&r2=1347023&view=diff ============================================================================== --- cxf/branches/2.4.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java (original) +++ cxf/branches/2.4.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java Wed Jun 6 18:16:01 2012 @@ -36,12 +36,35 @@ import org.apache.cxf.wsdl.WSDLManager; public class EmbeddedJMSBrokerLauncher extends AbstractBusTestServerBase { public static final String PORT = allocatePort(EmbeddedJMSBrokerLauncher.class); - + + String brokerUrl1; BrokerService broker; - final String brokerUrl1 = "tcp://localhost:" + PORT; - + String brokerName; - public static void updateWsdlExtensors(Bus bus, String wsdlLocation) { + public EmbeddedJMSBrokerLauncher() { + this(null); + } + public EmbeddedJMSBrokerLauncher(String url) { + if (url == null) { + url = "tcp://localhost:" + PORT; + } + brokerUrl1 = url; + } + + public String getBrokerURL() { + return brokerUrl1; + } + public void updateWsdl(Bus b, String wsdlLocation) { + updateWsdlExtensors(b, wsdlLocation, brokerUrl1); + } + + public static void updateWsdlExtensors(Bus bus, + String wsdlLocation) { + updateWsdlExtensors(bus, wsdlLocation, "tcp://localhost:" + PORT); + } + public static void updateWsdlExtensors(Bus bus, + String wsdlLocation, + String url) { try { if (bus == null) { bus = BusFactory.getThreadDefaultBus(); @@ -62,7 +85,7 @@ public class EmbeddedJMSBrokerLauncher e if (idx != -1) { int idx2 = add.indexOf("&", idx); add = add.substring(0, idx) - + "jndiURL=tcp://localhost:" + PORT + + "jndiURL=" + url + (idx2 == -1 ? "" : add.substring(idx2)); ((SOAPAddress)e).setLocationURI(add); } @@ -77,7 +100,7 @@ public class EmbeddedJMSBrokerLauncher e if ("java.naming.provider.url".equals(f.get(prop))) { f = prop.getClass().getDeclaredField("value"); f.setAccessible(true); - f.set(prop, "tcp://localhost:" + PORT); + f.set(prop, url); } } } catch (Exception ex) { @@ -92,6 +115,9 @@ public class EmbeddedJMSBrokerLauncher e } } + public void stop() throws Exception { + tearDown(); + } public void tearDown() throws Exception { if (broker != null) { broker.stop(); @@ -99,13 +125,17 @@ public class EmbeddedJMSBrokerLauncher e } //START SNIPPET: broker - public void run() { - try { + public final void run() { + try { broker = new BrokerService(); broker.setPersistenceAdapter(new MemoryPersistenceAdapter()); broker.setTmpDataDirectory(new File("./target")); - broker.addConnector(brokerUrl1); - broker.start(); + broker.setUseJmx(false); + if (brokerName != null) { + broker.setBrokerName(brokerName); + } + broker.addConnector(brokerUrl1 + "?daemon=true"); + broker.start(); } catch (Exception e) { e.printStackTrace(); } @@ -114,7 +144,11 @@ public class EmbeddedJMSBrokerLauncher e public static void main(String[] args) { try { - EmbeddedJMSBrokerLauncher s = new EmbeddedJMSBrokerLauncher(); + String url = null; + if (args.length > 0) { + url = args[0]; + } + EmbeddedJMSBrokerLauncher s = new EmbeddedJMSBrokerLauncher(url); s.start(); } catch (Exception ex) { ex.printStackTrace(); Modified: cxf/branches/2.4.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java?rev=1347023&r1=1347022&r2=1347023&view=diff ============================================================================== --- cxf/branches/2.4.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java (original) +++ cxf/branches/2.4.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java Wed Jun 6 18:16:01 2012 @@ -69,6 +69,12 @@ public class ServerLauncher { public ServerLauncher(String theClassName) { this(theClassName, DEFAULT_IN_PROCESS); } + public ServerLauncher(AbstractTestServerBase b) { + inProcess = true; + inProcessServer = b; + javaExe = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java"; + className = null; + } public ServerLauncher(String theClassName, boolean inprocess) { inProcess = inprocess; className = theClassName; @@ -174,16 +180,17 @@ public class ServerLauncher { } } } - - cls = Class.forName(className); - Class svcls = - cls.asSubclass(AbstractTestServerBase.class); - if (null == serverArgs) { - inProcessServer = svcls.newInstance(); - } else { - Constructor ctor - = svcls.getConstructor(serverArgs.getClass()); - inProcessServer = ctor.newInstance(new Object[] {serverArgs}); + if (inProcessServer == null) { + cls = Class.forName(className); + Class svcls = + cls.asSubclass(AbstractTestServerBase.class); + if (null == serverArgs) { + inProcessServer = svcls.newInstance(); + } else { + Constructor ctor + = svcls.getConstructor(serverArgs.getClass()); + inProcessServer = ctor.newInstance(new Object[] {serverArgs}); + } } inProcessServer.startInProcess(); serverIsReady = true;