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 8D595C1AD for ; Fri, 18 May 2012 22:40:29 +0000 (UTC) Received: (qmail 47765 invoked by uid 500); 18 May 2012 22:40:29 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 47720 invoked by uid 500); 18 May 2012 22:40:29 -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 47711 invoked by uid 99); 18 May 2012 22:40:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 May 2012 22:40:29 +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; Fri, 18 May 2012 22:40:25 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id D5D9723889E0; Fri, 18 May 2012 22:40:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1340294 - in /cxf/trunk: rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/ systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/ systests/jaxws/src/test/ja... Date: Fri, 18 May 2012 22:40:03 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120518224004.D5D9723889E0@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dkulp Date: Fri May 18 22:40:02 2012 New Revision: 1340294 URL: http://svn.apache.org/viewvc?rev=1340294&view=rev Log: More cleanup towards trying to get more forkmode once stuff ready Added: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/managed-bus.xml - copied, changed from r1340168, cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/managed-spring.xml Modified: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultInInterceptor.java cxf/trunk/rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/AbstractDOMProvider.java cxf/trunk/rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/ProviderFactory.java cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/HttpNumberFactoryImpl.java cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/ManualHttpMulitplexClientServerTest.java cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/ManualNumberFactoryImpl.java cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/MultiplexClientServerTest.java cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/MultiplexHttpAddressClientServerTest.java cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/NumberFactoryImpl.java cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/cxf_multiplex.xml cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/fault/GreeterImpl.java cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/fault/IntFaultClientServerTest.java cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/fault/Server.java cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/jca/OutBoundConnectionTest.java cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/js/JSClientServerTest.java cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/js/Server.java cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/CountersClientServerTest.java cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/ManagedBusTest.java cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/ManagedClientServerTest.java cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/counter-spring.xml cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/managed-spring.xml cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/wsdl/CrossSchemaImportsTests.java cxf/trunk/testutils/pom.xml cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractBusClientServerTestBase.java Modified: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultInInterceptor.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultInInterceptor.java?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultInInterceptor.java (original) +++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultInInterceptor.java Fri May 18 22:40:02 2012 @@ -48,7 +48,7 @@ public class Soap11FaultInInterceptor ex public static SoapFault unmarshalFault(SoapMessage message, XMLStreamReader reader) { - String exMessage = null; + String exMessage = ""; QName faultCode = null; String role = null; Element detail = null; Modified: cxf/trunk/rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/AbstractDOMProvider.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/AbstractDOMProvider.java?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/AbstractDOMProvider.java (original) +++ cxf/trunk/rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/AbstractDOMProvider.java Fri May 18 22:40:02 2012 @@ -61,6 +61,7 @@ public abstract class AbstractDOMProvide private boolean isBaseAddr; private boolean isE4X; private Function invokeFunc; + private Endpoint ep; protected AbstractDOMProvider(Scriptable scope, Scriptable wspVar, String epAddr, @@ -144,9 +145,16 @@ public abstract class AbstractDOMProvide factory.setBindingId(binding); factory.setServiceName(new QName(tgtNmspc, svcNm)); factory.setEndpointName(new QName(tgtNmspc, portNm)); - Endpoint ep = new EndpointImpl(bus, this, factory); + ep = new EndpointImpl(bus, this, factory); ep.publish(addr); } + + public void stop() { + if (ep != null) { + ep.stop(); + ep = null; + } + } public DOMSource invoke(DOMSource request) { DOMSource response = new DOMSource(); Modified: cxf/trunk/rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/ProviderFactory.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/ProviderFactory.java?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/ProviderFactory.java (original) +++ cxf/trunk/rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/ProviderFactory.java Fri May 18 22:40:02 2012 @@ -23,6 +23,8 @@ import java.io.BufferedReader; import java.io.File; import java.io.FileReader; +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; import java.util.logging.Level; import java.util.logging.Logger; @@ -44,6 +46,7 @@ public class ProviderFactory { private String epAddress; private boolean isBaseAddr; + private List providers = new CopyOnWriteArrayList(); static { ContextFactory.initGlobal(new RhinoContextFactory()); @@ -124,6 +127,7 @@ public class ProviderFactory { epAddr, isBase, isE4X); try { provider.publish(); + providers.add(provider); } catch (AbstractDOMProvider.JSDOMProviderException ex) { StringBuilder msg = new StringBuilder(f.getPath()); msg.append(": ").append(ex.getMessage()); @@ -138,6 +142,13 @@ public class ProviderFactory { throw new Exception(f.getPath() + NO_PROVIDER); } } + + public void stop() { + while (!providers.isEmpty()) { + AbstractDOMProvider p = providers.remove(0); + p.stop(); + } + } protected AbstractDOMProvider createProvider(Service.Mode mode, Scriptable scope, Scriptable wsp, String epAddr, Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java (original) +++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java Fri May 18 22:40:02 2012 @@ -55,10 +55,8 @@ import org.w3c.dom.Node; import org.xml.sax.InputSource; -import org.apache.cxf.Bus; import org.apache.cxf.BusFactory; import org.apache.cxf.binding.soap.saaj.SAAJUtils; -import org.apache.cxf.bus.spring.SpringBusFactory; import org.apache.cxf.helpers.DOMUtils; import org.apache.cxf.helpers.XMLUtils; import org.apache.cxf.jaxws.DispatchImpl; @@ -584,9 +582,7 @@ public class DispatchClientServerTest ex @Test public void testJAXBObjectPAYLOADWithFeature() throws Exception { - this.configFileName = "org/apache/cxf/systest/dispatch/client-config.xml"; - SpringBusFactory bf = (SpringBusFactory)SpringBusFactory.newInstance(); - Bus bus = bf.createBus(configFileName, false); + createBus("org/apache/cxf/systest/dispatch/client-config.xml"); BusFactory.setThreadDefaultBus(bus); URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl"); Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java (original) +++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java Fri May 18 22:40:02 2012 @@ -106,9 +106,8 @@ public class ClientServerTest extends Ab // set up configuration to enable schema validation URL url = ClientServerTest.class.getResource("fault-stack-trace.xml"); assertNotNull("cannot find test resource", url); - defaultConfigFileName = url.toString(); - assertTrue("server did not launch correctly", launchServer(Server.class, true)); + createStaticBus(url.toString()); } @Test public void testCXF2419() throws Exception { Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/HttpNumberFactoryImpl.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/HttpNumberFactoryImpl.java?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/HttpNumberFactoryImpl.java (original) +++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/HttpNumberFactoryImpl.java Fri May 18 22:40:02 2012 @@ -35,8 +35,8 @@ import org.apache.cxf.wsdl.EndpointRefer targetNamespace = "http://cxf.apache.org/factory_pattern") public class HttpNumberFactoryImpl extends NumberFactoryImpl { - public HttpNumberFactoryImpl(Bus bus) { - super(bus); + public HttpNumberFactoryImpl(Bus bus, String p) { + super(bus, p); // do servant creation up front so manual epr creation test has endpoint to talk to. // the manual epr will not come from create() // @@ -63,7 +63,7 @@ public class HttpNumberFactoryImpl exten EndpointImpl ep = new EndpointImpl(bus, servant, bindingId, wsdlLocation); ep.setEndpointName(new QName(NUMBER_SERVICE_QNAME.getNamespaceURI(), "NumberPort")); - ep.publish(NUMBER_SERVANT_ADDRESS_ROOT); + ep.publish(getServantAddressRoot()); templateEpr = ep.getServer().getDestination().getAddress(); } } Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/ManualHttpMulitplexClientServerTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/ManualHttpMulitplexClientServerTest.java?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/ManualHttpMulitplexClientServerTest.java (original) +++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/ManualHttpMulitplexClientServerTest.java Fri May 18 22:40:02 2012 @@ -41,6 +41,7 @@ import org.apache.cxf.jaxws.spi.Provider import org.apache.cxf.jaxws.support.ServiceDelegateAccessor; import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase; import org.apache.cxf.testutil.common.AbstractBusTestServerBase; +import org.apache.cxf.testutil.common.TestUtil; import org.apache.cxf.ws.addressing.EndpointReferenceType; import org.apache.cxf.wsdl.EndpointReferenceUtils; import org.junit.BeforeClass; @@ -48,14 +49,16 @@ import org.junit.Test; public class ManualHttpMulitplexClientServerTest extends AbstractBusClientServerTestBase { - static final String FACTORY_ADDRESS = NumberFactoryImpl.FACTORY_ADDRESS; - + public static final String PORT = TestUtil.getPortNumber(ManualHttpMulitplexClientServerTest.class); + public static final String FACTORY_ADDRESS = + "http://localhost:" + PORT + "/NumberFactoryService/NumberFactoryPort"; + public static class Server extends AbstractBusTestServerBase { Endpoint ep; protected void run() { setBus(BusFactory.getDefaultBus()); - Object implementor = new ManualNumberFactoryImpl(getBus()); - ep = Endpoint.publish(NumberFactoryImpl.FACTORY_ADDRESS, implementor); + Object implementor = new ManualNumberFactoryImpl(getBus(), PORT); + ep = Endpoint.publish(FACTORY_ADDRESS, implementor); } public void tearDown() { ep.stop(); @@ -88,7 +91,7 @@ public class ManualHttpMulitplexClientSe NumberFactoryService service = new NumberFactoryService(); NumberFactory nfact = service.getNumberFactoryPort(); - updateAddressPort(nfact, NumberFactoryImpl.PORT); + updateAddressPort(nfact, PORT); W3CEndpointReference w3cEpr = nfact.create("2"); assertNotNull("reference", w3cEpr); @@ -130,7 +133,7 @@ public class ManualHttpMulitplexClientSe NumberFactoryService service = new NumberFactoryService(); NumberFactory factory = service.getNumberFactoryPort(); - updateAddressPort(factory, NumberFactoryImpl.PORT); + updateAddressPort(factory, PORT); W3CEndpointReference w3cEpr = factory.create("20"); Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/ManualNumberFactoryImpl.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/ManualNumberFactoryImpl.java?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/ManualNumberFactoryImpl.java (original) +++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/ManualNumberFactoryImpl.java Fri May 18 22:40:02 2012 @@ -35,8 +35,8 @@ import org.apache.cxf.wsdl.EndpointRefer targetNamespace = "http://cxf.apache.org/factory_pattern") public class ManualNumberFactoryImpl extends NumberFactoryImpl { - public ManualNumberFactoryImpl(Bus b) { - super(b); + public ManualNumberFactoryImpl(Bus b, String p) { + super(b, p); } public W3CEndpointReference create(String id) { @@ -57,7 +57,7 @@ public class ManualNumberFactoryImpl ext EndpointImpl ep = new EndpointImpl(bus, servant, bindingId, wsdlLocation); ep.setEndpointName(new QName(NUMBER_SERVICE_QNAME.getNamespaceURI(), "NumberPort")); - ep.publish(NUMBER_SERVANT_ADDRESS_ROOT); + ep.publish(getServantAddressRoot()); templateEpr = ep.getServer().getDestination().getAddress(); } } Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/MultiplexClientServerTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/MultiplexClientServerTest.java?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/MultiplexClientServerTest.java (original) +++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/MultiplexClientServerTest.java Fri May 18 22:40:02 2012 @@ -20,6 +20,8 @@ package org.apache.cxf.systest.factory_pattern; +import java.io.Closeable; +import java.io.IOException; import java.util.HashMap; import java.util.Map; @@ -37,6 +39,7 @@ import org.apache.cxf.jaxws.support.Serv import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase; import org.apache.cxf.testutil.common.AbstractBusTestServerBase; import org.apache.cxf.testutil.common.EmbeddedJMSBrokerLauncher; +import org.apache.cxf.testutil.common.TestUtil; import org.junit.BeforeClass; import org.junit.Test; @@ -44,15 +47,16 @@ import org.junit.Test; public class MultiplexClientServerTest extends AbstractBusClientServerTestBase { - static final String PORT = NumberFactoryImpl.PORT; + public static final String PORT = TestUtil.getPortNumber(MultiplexClientServerTest.class); + public static final String FACTORY_ADDRESS = + "http://localhost:" + PORT + "/NumberFactoryService/NumberFactoryPort"; static final String JMS_PORT = EmbeddedJMSBrokerLauncher.PORT; public static class Server extends AbstractBusTestServerBase { Endpoint ep; protected void run() { - setBus(BusFactory.getDefaultBus()); - Object implementor = new NumberFactoryImpl(getBus()); - ep = Endpoint.publish(NumberFactoryImpl.FACTORY_ADDRESS, implementor); + Object implementor = new NumberFactoryImpl(BusFactory.getDefaultBus(), PORT); + ep = Endpoint.publish(FACTORY_ADDRESS, implementor); } public void tearDown() { ep.stop(); @@ -74,8 +78,8 @@ public class MultiplexClientServerTest e @BeforeClass public static void startServers() throws Exception { - // requires ws-a support to propagate reference parameters createStaticBus("org/apache/cxf/systest/factory_pattern/cxf_multiplex.xml"); + // requires ws-a support to propagate reference parameters Map props = new HashMap(); if (System.getProperty("org.apache.activemq.default.directory.prefix") != null) { props.put("org.apache.activemq.default.directory.prefix", @@ -88,11 +92,15 @@ public class MultiplexClientServerTest e assertTrue("server did not launch correctly", launchServer(EmbeddedJMSBrokerLauncher.class, props, null, true)); - props.put("cxf.config.file", defaultConfigFileName); assertTrue("server did not launch correctly", - launchServer(Server.class, props, null, true)); + launchServer(Server.class, true)); } + private void close(Object o) throws IOException { + if (o instanceof Closeable) { + ((Closeable)o).close(); + } + } @Test public void testWithGetPortExtensionHttp() throws Exception { @@ -110,14 +118,14 @@ public class MultiplexClientServerTest e Number num = serviceImpl.getPort(numberTwoRef, Number.class); assertTrue("20 is even", num.isEven().isEven()); - ClientProxy.getClient(num).getConduit().close(); + close(num); W3CEndpointReference numberTwentyThreeRef = factory.create("23"); num = serviceImpl.getPort(numberTwentyThreeRef, Number.class); assertTrue("23 is not even", !num.isEven().isEven()); - ClientProxy.getClient(num).getConduit().close(); - ClientProxy.getClient(factory).getConduit().close(); + close(num); + close(factory); } @Test Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/MultiplexHttpAddressClientServerTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/MultiplexHttpAddressClientServerTest.java?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/MultiplexHttpAddressClientServerTest.java (original) +++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/MultiplexHttpAddressClientServerTest.java Fri May 18 22:40:02 2012 @@ -26,15 +26,13 @@ import java.lang.reflect.InvocationHandl import java.lang.reflect.Proxy; import java.net.URL; import java.net.URLConnection; -import java.util.HashMap; -import java.util.Map; import javax.xml.ws.BindingProvider; import javax.xml.ws.Endpoint; import javax.xml.ws.Service; import javax.xml.ws.wsaddressing.W3CEndpointReference; -import org.apache.cxf.BusFactory; +import org.apache.cxf.bus.spring.SpringBusFactory; import org.apache.cxf.factory_pattern.IsEvenResponse; import org.apache.cxf.factory_pattern.Number; import org.apache.cxf.factory_pattern.NumberFactory; @@ -44,6 +42,7 @@ import org.apache.cxf.jaxws.ServiceImpl; import org.apache.cxf.jaxws.support.ServiceDelegateAccessor; import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase; import org.apache.cxf.testutil.common.AbstractBusTestServerBase; +import org.apache.cxf.testutil.common.TestUtil; import org.junit.BeforeClass; import org.junit.Test; @@ -52,14 +51,18 @@ import org.junit.Test; * exercise with multiplexWithAddress config rather than ws-a headers */ public class MultiplexHttpAddressClientServerTest extends AbstractBusClientServerTestBase { - static final String FACTORY_ADDRESS = NumberFactoryImpl.FACTORY_ADDRESS; + public static final String PORT = TestUtil.getPortNumber(MultiplexHttpAddressClientServerTest.class); + public static final String FACTORY_ADDRESS = + "http://localhost:" + PORT + "/NumberFactoryService/NumberFactoryPort"; + public static final String NUMBER_SERVANT_ADDRESS_ROOT = + "http://localhost:" + PORT + "/NumberService/NumberPort/"; public static class Server extends AbstractBusTestServerBase { Endpoint ep; protected void run() { - setBus(BusFactory.getDefaultBus()); - Object implementor = new HttpNumberFactoryImpl(getBus()); - ep = Endpoint.publish(NumberFactoryImpl.FACTORY_ADDRESS, implementor); + setBus(new SpringBusFactory().createBus("org/apache/cxf/systest/factory_pattern/cxf.xml")); + Object implementor = new HttpNumberFactoryImpl(getBus(), PORT); + ep = Endpoint.publish(FACTORY_ADDRESS, implementor); } public void tearDown() { ep.stop(); @@ -82,10 +85,9 @@ public class MultiplexHttpAddressClientS @BeforeClass public static void startServers() throws Exception { // no need for ws-a, just enable multiplexWithAddress on server - Map props = new HashMap(); - props.put("cxf.config.file", "org/apache/cxf/systest/factory_pattern/cxf.xml"); assertTrue("server did not launch correctly", - launchServer(Server.class, props, null, false)); + launchServer(Server.class, true)); + createStaticBus(); } @@ -94,7 +96,7 @@ public class MultiplexHttpAddressClientS NumberFactoryService service = new NumberFactoryService(); NumberFactory factory = service.getNumberFactoryPort(); - updateAddressPort(factory, NumberFactoryImpl.PORT); + updateAddressPort(factory, PORT); NumberService numService = new NumberService(); ServiceImpl serviceImpl = ServiceDelegateAccessor.get(numService); @@ -118,8 +120,8 @@ public class MultiplexHttpAddressClientS InvocationHandler handler = Proxy.getInvocationHandler(num); BindingProvider bp = (BindingProvider)handler; - bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, - NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT + "103"); + bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, + NUMBER_SERVANT_ADDRESS_ROOT + "103"); IsEvenResponse numResp = num.isEven(); assertTrue("103 is not even", Boolean.FALSE.equals(numResp.isEven())); @@ -128,11 +130,11 @@ public class MultiplexHttpAddressClientS @Test public void testWithGetWsdlOnServant() throws Exception { - int firstChar = new URL(NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT + int firstChar = new URL(NUMBER_SERVANT_ADDRESS_ROOT + "?wsdl").openStream().read(); assertTrue("firstChar :" + String.valueOf(firstChar), firstChar == '<'); - firstChar = new URL(NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT + firstChar = new URL(NUMBER_SERVANT_ADDRESS_ROOT + "103?wsdl").openStream().read(); assertTrue("firstChar :" + String.valueOf(firstChar), firstChar == '<'); } @@ -141,20 +143,20 @@ public class MultiplexHttpAddressClientS public void testSoapAddressLocation() throws Exception { assertTrue("Should have received the soap:address location " - + NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT, - checkSoapAddressLocation(NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT)); + + NUMBER_SERVANT_ADDRESS_ROOT, + checkSoapAddressLocation(NUMBER_SERVANT_ADDRESS_ROOT)); assertTrue("Should have received the soap:address location " - + NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT + "20", - checkSoapAddressLocation(NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT + "20")); + + NUMBER_SERVANT_ADDRESS_ROOT + "20", + checkSoapAddressLocation(NUMBER_SERVANT_ADDRESS_ROOT + "20")); assertTrue("Should have received the soap:address location " - + NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT + "22", - checkSoapAddressLocation(NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT + "22")); + + NUMBER_SERVANT_ADDRESS_ROOT + "22", + checkSoapAddressLocation(NUMBER_SERVANT_ADDRESS_ROOT + "22")); assertTrue("Should have received the soap:address location " - + NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT + "20", - checkSoapAddressLocation(NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT + "20")); + + NUMBER_SERVANT_ADDRESS_ROOT + "20", + checkSoapAddressLocation(NUMBER_SERVANT_ADDRESS_ROOT + "20")); assertTrue("Should have received the soap:address location " - + NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT, - checkSoapAddressLocation(NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT)); + + NUMBER_SERVANT_ADDRESS_ROOT, + checkSoapAddressLocation(NUMBER_SERVANT_ADDRESS_ROOT)); } private boolean checkSoapAddressLocation(String address) Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/NumberFactoryImpl.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/NumberFactoryImpl.java?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/NumberFactoryImpl.java (original) +++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/NumberFactoryImpl.java Fri May 18 22:40:02 2012 @@ -30,7 +30,6 @@ import org.apache.cxf.interceptor.Loggin import org.apache.cxf.interceptor.LoggingOutInterceptor; import org.apache.cxf.jaxws.EndpointImpl; import org.apache.cxf.testutil.common.EmbeddedJMSBrokerLauncher; -import org.apache.cxf.testutil.common.TestUtil; import org.apache.cxf.ws.addressing.EndpointReferenceType; import org.apache.cxf.wsdl.EndpointReferenceUtils; @@ -39,13 +38,6 @@ import org.apache.cxf.wsdl.EndpointRefer endpointInterface = "org.apache.cxf.factory_pattern.NumberFactory", targetNamespace = "http://cxf.apache.org/factory_pattern") public class NumberFactoryImpl implements NumberFactory { - public static final String PORT = TestUtil.getPortNumber(NumberFactoryImpl.class); - - - public static final String FACTORY_ADDRESS = - "http://localhost:" + PORT + "/NumberFactoryService/NumberFactoryPort"; - public static final String NUMBER_SERVANT_ADDRESS_ROOT = - "http://localhost:" + PORT + "/NumberService/NumberPort/"; public static final String FACTORY_NS = "http://cxf.apache.org/factory_pattern"; public static final String NUMBER_SERVICE_NAME = "NumberService"; public static final String NUMBER_PORT_NAME = "NumberPort"; @@ -56,9 +48,11 @@ public class NumberFactoryImpl implement protected EndpointReferenceType templateEpr; protected NumberImpl servant; protected Bus bus; + protected String port; - public NumberFactoryImpl(Bus b) { + public NumberFactoryImpl(Bus b, String p) { bus = b; + port = p; } public W3CEndpointReference create(String id) { @@ -85,7 +79,9 @@ public class NumberFactoryImpl implement } return templateEpr; } - + protected String getServantAddressRoot() { + return "http://localhost:" + port + "/NumberService/NumberPort/"; + } protected void initDefaultServant() { servant = new NumberImpl(); @@ -95,7 +91,7 @@ public class NumberFactoryImpl implement EndpointImpl ep = new EndpointImpl(bus, servant, bindingId, wsdlLocation); ep.setEndpointName(new QName(NUMBER_SERVICE_QNAME.getNamespaceURI(), "NumberPort")); - ep.publish(NUMBER_SERVANT_ADDRESS_ROOT); + ep.publish(getServantAddressRoot()); templateEpr = ep.getServer().getDestination().getAddress(); // jms port Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/cxf_multiplex.xml URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/cxf_multiplex.xml?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/cxf_multiplex.xml (original) +++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/factory_pattern/cxf_multiplex.xml Fri May 18 22:40:02 2012 @@ -29,8 +29,10 @@ http://cxf.apache.org/jaxws http://cxf.a http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> + + - + Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/fault/GreeterImpl.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/fault/GreeterImpl.java?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/fault/GreeterImpl.java (original) +++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/fault/GreeterImpl.java Fri May 18 22:40:02 2012 @@ -39,7 +39,7 @@ public class GreeterImpl { protected WebServiceContext context; public BareDocumentResponse testDocLitFault(String in) throws BadRecordLitFault { - System.out.println("Executing testDocLitFault sayHi\n"); + //System.out.println("Executing testDocLitFault sayHi\n"); List
headers = new ArrayList
(); Header header = null; try { Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/fault/IntFaultClientServerTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/fault/IntFaultClientServerTest.java?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/fault/IntFaultClientServerTest.java (original) +++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/fault/IntFaultClientServerTest.java Fri May 18 22:40:02 2012 @@ -46,6 +46,7 @@ public class IntFaultClientServerTest ex "SOAPService"); @BeforeClass public static void startServers() throws Exception { + createStaticBus(); assertTrue("server did not launch correctly", launchServer(Server.class, true)); } Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/fault/Server.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/fault/Server.java?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/fault/Server.java (original) +++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/fault/Server.java Fri May 18 22:40:02 2012 @@ -26,12 +26,15 @@ import org.apache.cxf.testutil.common.Ab public class Server extends AbstractBusTestServerBase { public static final String PORT = allocatePort(Server.class); + Endpoint ep; protected void run() { - GreeterImpl implementor = new GreeterImpl(); String address = "http://localhost:" + PORT + "/SoapContext/SoapPort"; - Endpoint.publish(address, implementor); - + ep = Endpoint.publish(address, implementor); + } + public void tearDown() { + ep.stop(); + ep = null; } public static void main(String[] args) { Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java (original) +++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java Fri May 18 22:40:02 2012 @@ -47,7 +47,6 @@ import org.apache.cxf.greeter_control.ty import org.apache.cxf.phase.Phase; import org.apache.cxf.phase.PhaseComparator; import org.apache.cxf.phase.PhaseManager; -import org.apache.cxf.test.TestUtilities; import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase; import org.apache.cxf.testutil.common.AbstractBusTestServerBase; import org.apache.cxf.transport.http.HTTPConduit; @@ -88,6 +87,7 @@ public class InterceptorFaultTest extend */ public static class Server extends AbstractBusTestServerBase { + Endpoint ep; protected void run() { SpringBusFactory factory = new SpringBusFactory(); Bus bus = factory.createBus(); @@ -100,9 +100,13 @@ public class InterceptorFaultTest extend greeterImplementor.setThrowAlways(true); greeterImplementor.useLastOnewayArg(true); implementor.setImplementor(greeterImplementor); - Endpoint.publish(CONTROL_PORT_ADDRESS, implementor); + ep = Endpoint.publish(CONTROL_PORT_ADDRESS, implementor); LOG.fine("Published control endpoint."); } + public void tearDown() { + ep.stop(); + ep = null; + } public static void main(String[] args) { try { @@ -129,24 +133,34 @@ public class InterceptorFaultTest extend @BeforeClass public static void startServers() throws Exception { - TestUtilities.setKeepAliveSystemProperty(false); + System.setProperty("org.apache.cxf.transports.http_jetty.DontClosePort." + PORT, "true"); assertTrue("server did not launch correctly", launchServer(Server.class, true)); + createStaticBus(); } - @AfterClass - public static void cleanup() { - TestUtilities.recoverKeepAliveSystemProperty(); + public static void reset() { + System.clearProperty("org.apache.cxf.transports.http_jetty.DontClosePort." + PORT); + Bus b = BusFactory.getDefaultBus(false); + if (b == null) { + b = BusFactory.getThreadDefaultBus(false); + } + if (b == null) { + b = BusFactory.getDefaultBus(); + } + b.shutdown(true); } @After - public void tearDown() { + public void tearDown() throws Exception { if (null != greeter) { + ((java.io.Closeable)greeter).close(); assertTrue("Failed to stop greeter.", control.stopGreeter(null)); greeterBus.shutdown(true); greeterBus = null; } if (null != control) { assertTrue("Failed to stop greeter", control.stopGreeter(null)); + ((java.io.Closeable)control).close(); controlBus.shutdown(true); } } Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/jca/OutBoundConnectionTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/jca/OutBoundConnectionTest.java?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/jca/OutBoundConnectionTest.java (original) +++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/jca/OutBoundConnectionTest.java Fri May 18 22:40:02 2012 @@ -28,6 +28,7 @@ import javax.xml.namespace.QName; import javax.xml.ws.Endpoint; import javax.xml.ws.WebServiceException; +import org.apache.cxf.BusFactory; import org.apache.cxf.connector.Connection; import org.apache.cxf.jca.cxf.CXFConnectionRequestInfo; import org.apache.cxf.jca.cxf.ManagedConnectionFactoryImpl; @@ -49,11 +50,17 @@ public class OutBoundConnectionTest exte public static class Server extends AbstractBusTestServerBase { public static final String PORT = allocatePort(Server.class); + + Endpoint ep; protected void run() { + setBus(BusFactory.getDefaultBus()); Object implementor = new GreeterImpl(); String address = "http://localhost:" + PORT + "/SoapContext/SoapPort"; - Endpoint.publish(address, implementor); - + ep = Endpoint.publish(address, implementor); + } + public void tearDown() { + ep.stop(); + ep = null; } public static void main(String[] args) { @@ -72,6 +79,7 @@ public class OutBoundConnectionTest exte @BeforeClass public static void startServers() throws Exception { assertTrue("server did not launch correctly", launchServer(Server.class, true)); + createStaticBus(); } @Test @@ -130,5 +138,6 @@ public class OutBoundConnectionTest exte assertNotNull("no response received from service", reply); assertEquals(response, reply); } + ((Connection)o).close(); } } Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/js/JSClientServerTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/js/JSClientServerTest.java?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/js/JSClientServerTest.java (original) +++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/js/JSClientServerTest.java Fri May 18 22:40:02 2012 @@ -43,6 +43,7 @@ public class JSClientServerTest extends @BeforeClass public static void startServers() throws Exception { assertTrue("server did not launch correctly", launchServer(Server.class, true)); + createStaticBus(); } @Test Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/js/Server.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/js/Server.java?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/js/Server.java (original) +++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/js/Server.java Fri May 18 22:40:02 2012 @@ -28,10 +28,10 @@ import org.apache.cxf.testutil.common.Ab public class Server extends AbstractBusTestServerBase { public static final String JS_PORT = allocatePort(Server.class); public static final String JSX_PORT = allocatePort(Server.class, 1); + + ProviderFactory pf = new ProviderFactory(); protected void run() { - try { - ProviderFactory pf = new ProviderFactory(); String f = getClass().getResource("resources/hello_world.js").toURI().getPath(); f = URLDecoder.decode(f, "UTF-8"); pf.createAndPublish(new File(f), "http://localhost:" + JS_PORT @@ -43,7 +43,10 @@ public class Server extends AbstractBusT ex.printStackTrace(); } } - + public void tearDown() { + pf.stop(); + pf = null; + } public static void main(String[] args) { try { System.err.println("Server main"); Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/CountersClientServerTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/CountersClientServerTest.java?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/CountersClientServerTest.java (original) +++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/CountersClientServerTest.java Fri May 18 22:40:02 2012 @@ -29,7 +29,6 @@ import javax.xml.ws.Endpoint; import org.apache.cxf.Bus; import org.apache.cxf.BusFactory; -import org.apache.cxf.bus.spring.SpringBusFactory; import org.apache.cxf.management.InstrumentationManager; import org.apache.cxf.management.ManagementConstants; import org.apache.cxf.management.counters.CounterRepository; @@ -40,56 +39,40 @@ import org.apache.cxf.workqueue.WorkQueu import org.apache.hello_world_soap_http.Greeter; import org.apache.hello_world_soap_http.GreeterImpl; import org.apache.hello_world_soap_http.SOAPService; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; public class CountersClientServerTest extends AbstractBusClientServerTestBase { - public static final String PORT = allocatePort(Server.class); - public static final String JMX_PORT = allocatePort(Server.class, 1); + public static final String PORT = allocatePort(CountersClientServerTest.class); + public static final String JMX_PORT = allocatePort(CountersClientServerTest.class, 1); private final QName portName = new QName("http://apache.org/hello_world_soap_http", "SoapPort"); public static class Server extends AbstractBusTestServerBase { - + Endpoint ep; protected void run() { - SpringBusFactory bf = new SpringBusFactory(); - Bus bus = bf.createBus("org/apache/cxf/systest/management/counter-spring.xml", true); - BusFactory.setDefaultBus(bus); Object implementor = new GreeterImpl(); - Endpoint.publish("http://localhost:" + PORT + "/SoapContext/SoapPort", implementor); + ep = Endpoint.publish("http://localhost:" + PORT + "/SoapContext/SoapPort", implementor); } - - public static void main(String[] args) { - try { - Server s = new Server(); - s.start(); - } catch (Exception ex) { - ex.printStackTrace(); - System.exit(-1); - } finally { - System.out.println("done!"); - } + public void tearDown() { + ep.stop(); } } @BeforeClass public static void startServers() throws Exception { + createStaticBus("org/apache/cxf/systest/management/counter-spring.xml"); assertTrue("server did not launch correctly", launchServer(Server.class, true)); } - @AfterClass - public static void shutdownBus() throws Exception { - BusFactory.getDefaultBus().shutdown(true); - } - @Test public void testCountersWithInstrumentationManager() throws Exception { // create Client with other bus - Bus bus = BusFactory.getDefaultBus(); + Bus bus = getStaticBus(); + BusFactory.setDefaultBus(bus); bus.getExtension(WorkQueueManager.class); CounterRepository cr = bus.getExtension(CounterRepository.class); Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/ManagedBusTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/ManagedBusTest.java?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/ManagedBusTest.java (original) +++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/ManagedBusTest.java Fri May 18 22:40:02 2012 @@ -42,7 +42,7 @@ import org.junit.Assert; import org.junit.Test; public class ManagedBusTest extends Assert { - public static final String JMX_PORT1 = TestUtil.getPortNumber("Server.1"); + public static final String JMX_PORT1 = TestUtil.getPortNumber(ManagedBusTest.class, 1); public static final String JMX_PORT2 = TestUtil.getPortNumber(ManagedBusTest.class, 3); public static final String SERVICE_PORT = TestUtil.getPortNumber(ManagedBusTest.class, 4); @@ -107,7 +107,7 @@ public class ManagedBusTest extends Asse @Test public void testManagedBusWithTransientId() throws Exception { SpringBusFactory factory = new SpringBusFactory(); - Bus bus = factory.createBus("org/apache/cxf/systest/management/managed-spring.xml", true); + Bus bus = factory.createBus("org/apache/cxf/systest/management/managed-bus.xml", true); doManagedBusTest(bus, bus.getId(), "cxf_managed_bus_test", Integer.parseInt(JMX_PORT1)); } Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/ManagedClientServerTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/ManagedClientServerTest.java?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/ManagedClientServerTest.java (original) +++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/ManagedClientServerTest.java Fri May 18 22:40:02 2012 @@ -29,7 +29,6 @@ import javax.xml.ws.Endpoint; import org.apache.cxf.Bus; import org.apache.cxf.BusFactory; -import org.apache.cxf.bus.spring.SpringBusFactory; import org.apache.cxf.management.InstrumentationManager; import org.apache.cxf.management.ManagementConstants; import org.apache.cxf.management.jmx.InstrumentationManagerImpl; @@ -38,14 +37,13 @@ import org.apache.cxf.testutil.common.Ab import org.apache.hello_world_soap_http.Greeter; import org.apache.hello_world_soap_http.GreeterImpl; import org.apache.hello_world_soap_http.SOAPService; -import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; public class ManagedClientServerTest extends AbstractBusClientServerTestBase { - public static final String PORT = allocatePort(Server.class); - public static final String JMX_PORT = allocatePort(Server.class, 1); + public static final String PORT = allocatePort(ManagedClientServerTest.class); + public static final String JMX_PORT = allocatePort(ManagedClientServerTest.class, 1); private final QName portName = @@ -53,42 +51,28 @@ public class ManagedClientServerTest ext "SoapPort"); public static class Server extends AbstractBusTestServerBase { - + Endpoint ep; protected void run() { - SpringBusFactory bf = new SpringBusFactory(); - Bus bus = bf.createBus("org/apache/cxf/systest/management/managed-spring.xml", true); - BusFactory.setDefaultBus(bus); Object implementor = new GreeterImpl(); - Endpoint.publish("http://localhost:" + PORT + "/SoapContext/SoapPort", + ep = Endpoint.publish("http://localhost:" + PORT + "/SoapContext/SoapPort", implementor); } - - public static void main(String[] args) { - try { - Server s = new Server(); - s.start(); - } catch (Exception ex) { - ex.printStackTrace(); - System.exit(-1); - } finally { - System.out.println("done!"); - } + public void tearDown() { + ep.stop(); } + } @BeforeClass public static void startServers() throws Exception { + createStaticBus("org/apache/cxf/systest/management/managed-spring.xml"); assertTrue("server did not launch correctly", launchServer(Server.class, true)); } - @AfterClass - public static void shutdownBus() throws Exception { - BusFactory.getDefaultBus().shutdown(false); - } - @Test public void testManagedEndpoint() throws Exception { - Bus bus = SpringBusFactory.getDefaultBus(); + Bus bus = getStaticBus(); + BusFactory.setDefaultBus(bus); InstrumentationManager im = bus.getExtension(InstrumentationManager.class); assertNotNull(im); InstrumentationManagerImpl impl = (InstrumentationManagerImpl)im; Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/counter-spring.xml URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/counter-spring.xml?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/counter-spring.xml (original) +++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/counter-spring.xml Fri May 18 22:40:02 2012 @@ -26,7 +26,7 @@ http://www.springframework.org/schema/be - + Copied: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/managed-bus.xml (from r1340168, cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/managed-spring.xml) URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/managed-bus.xml?p2=cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/managed-bus.xml&p1=cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/managed-spring.xml&r1=1340168&r2=1340294&rev=1340294&view=diff ============================================================================== --- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/managed-spring.xml (original) +++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/managed-bus.xml Fri May 18 22:40:02 2012 @@ -28,7 +28,7 @@ http://www.springframework.org/schema/be + value="service:jmx:rmi:///jndi/rmi://localhost:${testutil.ports.ManagedBusTest.1}/jmxrmi" /> Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/managed-spring.xml URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/managed-spring.xml?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/managed-spring.xml (original) +++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/management/managed-spring.xml Fri May 18 22:40:02 2012 @@ -28,7 +28,7 @@ http://www.springframework.org/schema/be + value="service:jmx:rmi:///jndi/rmi://localhost:${testutil.ports.ManagedClientServerTest.1}/jmxrmi" /> Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java (original) +++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java Fri May 18 22:40:02 2012 @@ -38,10 +38,8 @@ import javax.xml.ws.soap.SOAPFaultExcept import org.w3c.dom.Node; -import org.apache.cxf.BusFactory; import org.apache.cxf.binding.soap.SoapHeader; -import org.apache.cxf.bus.spring.SpringBusFactory; import org.apache.cxf.headers.Header; import org.apache.cxf.jaxb.JAXBDataBinding; @@ -74,10 +72,7 @@ public class OOBHeaderTest extends Abstr System.setProperty("org.apache.cxf.bus.factory", "org.apache.cxf.bus.CXFBusFactory"); System.setProperty("cxf.config.file", "org/apache/cxf/systest/outofband/header/cxf.xml"); - defaultConfigFileName = CONFIG_FILE; - SpringBusFactory bf = new SpringBusFactory(); - staticBus = bf.createBus(defaultConfigFileName); - BusFactory.setDefaultBus(staticBus); + createStaticBus(CONFIG_FILE); assertTrue("server did not launch correctly", launchServer(Server.class, true)); } Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/wsdl/CrossSchemaImportsTests.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/wsdl/CrossSchemaImportsTests.java?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/wsdl/CrossSchemaImportsTests.java (original) +++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/wsdl/CrossSchemaImportsTests.java Fri May 18 22:40:02 2012 @@ -44,6 +44,7 @@ public class CrossSchemaImportsTests ext @Test public void testJaxbCrossSchemaImport() throws Exception { + Thread.sleep(100000); testUtilities.setBus((Bus)applicationContext.getBean("cxf")); testUtilities.addDefaultNamespaces(); Server s = testUtilities.getServerForService(new QName("http://apache.org/type_test/doc", Modified: cxf/trunk/testutils/pom.xml URL: http://svn.apache.org/viewvc/cxf/trunk/testutils/pom.xml?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/testutils/pom.xml (original) +++ cxf/trunk/testutils/pom.xml Fri May 18 22:40:02 2012 @@ -45,7 +45,7 @@ org.apache.cxf - cxf-api + cxf-rt-core ${project.version} Modified: cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractBusClientServerTestBase.java URL: http://svn.apache.org/viewvc/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractBusClientServerTestBase.java?rev=1340294&r1=1340293&r2=1340294&view=diff ============================================================================== --- cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractBusClientServerTestBase.java (original) +++ cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractBusClientServerTestBase.java Fri May 18 22:40:02 2012 @@ -30,46 +30,44 @@ import java.util.concurrent.TimeUnit; import org.apache.cxf.Bus; import org.apache.cxf.BusFactory; +import org.apache.cxf.bus.spring.SpringBusFactory; + import org.junit.After; import org.junit.AfterClass; public abstract class AbstractBusClientServerTestBase extends AbstractClientServerTestBase { - protected static String defaultConfigFileName; protected static Bus staticBus; - - protected String configFileName = defaultConfigFileName; protected Bus bus; public void createBus(String config) throws Exception { - configFileName = config; - createBus(); + if (config != null) { + bus = new SpringBusFactory().createBus(config); + } else { + bus = BusFactory.newInstance().createBus(); + } + BusFactory.setDefaultBus(bus); } public void createBus() throws Exception { - if (configFileName != null) { - System.setProperty("cxf.config.file", configFileName); - } - BusFactory bf = BusFactory.newInstance(); - bus = bf.createBus(); - BusFactory.setDefaultBus(bus); + createBus(null); } + public static Bus getStaticBus() { return staticBus; } public static Bus createStaticBus(String config) throws Exception { - defaultConfigFileName = config; - return createStaticBus(); - } - public static Bus createStaticBus() throws Exception { - if (defaultConfigFileName != null) { - System.setProperty("cxf.config.file", defaultConfigFileName); + if (config != null) { + staticBus = new SpringBusFactory().createBus(config); + } else { + staticBus = BusFactory.newInstance().createBus(); } - BusFactory bf = BusFactory.newInstance(); - staticBus = bf.createBus(); BusFactory.setDefaultBus(staticBus); return staticBus; } + public static Bus createStaticBus() throws Exception { + return createStaticBus(null); + } @After public void deleteBus() throws Exception { @@ -77,9 +75,6 @@ public abstract class AbstractBusClientS bus.shutdown(true); bus = null; } - if (configFileName != null) { - System.clearProperty("cxf.config.file"); - } } @AfterClass public static void deleteStaticBus() throws Exception { @@ -87,9 +82,6 @@ public abstract class AbstractBusClientS staticBus.shutdown(true); staticBus = null; } - if (defaultConfigFileName != null) { - System.clearProperty("cxf.config.file"); - } }