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 4E6B7C9D4 for ; Wed, 6 Jun 2012 17:58:06 +0000 (UTC) Received: (qmail 38913 invoked by uid 500); 6 Jun 2012 17:58:06 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 38866 invoked by uid 500); 6 Jun 2012 17:58:06 -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 38858 invoked by uid 99); 6 Jun 2012 17:58:06 -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 17:58:06 +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 17:58:02 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id D441D2388C1C; Wed, 6 Jun 2012 17:57:40 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1347011 [2/2] - in /cxf/branches/2.5.x-fixes/systests/transport-jms: ./ src/test/java/org/apache/cxf/jms/testsuite/services/ src/test/java/org/apache/cxf/jms/testsuite/testcases/ src/test/java/org/apache/cxf/jms/testsuite/util/ src/test/ja... Date: Wed, 06 Jun 2012 17:57:39 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120606175740.D441D2388C1C@eris.apache.org> Modified: cxf/branches/2.5.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/swa/ClientServerSwaTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/swa/ClientServerSwaTest.java?rev=1347011&r1=1347010&r2=1347011&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/swa/ClientServerSwaTest.java (original) +++ cxf/branches/2.5.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/swa/ClientServerSwaTest.java Wed Jun 6 17:57:38 2012 @@ -20,8 +20,6 @@ package org.apache.cxf.systest.jms.swa; import java.io.Closeable; import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; import javax.activation.DataHandler; import javax.mail.util.ByteArrayDataSource; @@ -31,33 +29,54 @@ import javax.xml.ws.Holder; import org.apache.cxf.helpers.IOUtils; import org.apache.cxf.interceptor.LoggingOutInterceptor; import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; +import org.apache.cxf.jaxws.JaxWsServerFactoryBean; 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.AfterClass; import org.junit.BeforeClass; import org.junit.Test; public class ClientServerSwaTest extends AbstractBusClientServerTestBase { - static String brokerPort = EmbeddedJMSBrokerLauncher.PORT; - static String serverPort = TestUtil.getPortNumber(Server.class); + public static final String ADDRESS + = "jms:jndi:dynamicQueues/test.cxf.jmstransport.swa.queue" + + "?jndiInitialContextFactory" + + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory" + + "&jndiConnectionFactoryName=ConnectionFactory&jndiURL="; + static EmbeddedJMSBrokerLauncher broker; + + public static class Server extends AbstractBusTestServerBase { + protected void run() { + try { + JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); + factory.setWsdlLocation("classpath:wsdl/swa-mime.wsdl"); + factory.setTransportId("http://cxf.apache.org/transports/jms"); + factory.setServiceName(new QName("http://cxf.apache.org/swa", "SwAService")); + factory.setEndpointName(new QName("http://cxf.apache.org/swa", "SwAServiceHttpPort")); + factory.setAddress(ADDRESS + broker.getBrokerURL()); + factory.setServiceBean(new SwAServiceImpl()); + factory.create().start(); + } catch (Exception e) { + e.printStackTrace(); + Thread.currentThread().interrupt(); + } + } + } + @BeforeClass public static void startServers() throws Exception { - Map props = new HashMap(); - if (System.getProperty("org.apache.activemq.default.directory.prefix") != null) { - props.put("org.apache.activemq.default.directory.prefix", - System.getProperty("org.apache.activemq.default.directory.prefix")); - } - props.put("java.util.logging.config.file", - System.getProperty("java.util.logging.config.file")); - - assertTrue("server did not launch correctly", - launchServer(EmbeddedJMSBrokerLauncher.class, props, null)); - - assertTrue("server did not launch correctly", launchServer(Server.class)); + broker = new EmbeddedJMSBrokerLauncher("vm://ClientServerSwaTest"); + System.setProperty("EmbeddedBrokerURL", broker.getBrokerURL()); + launchServer(broker); + launchServer(new Server()); createStaticBus(); } + @AfterClass + public static void clearProperty() { + System.clearProperty("EmbeddedBrokerURL"); + } @Test public void testSwa() throws Exception { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); @@ -65,7 +84,7 @@ public class ClientServerSwaTest extends factory.setTransportId("http://cxf.apache.org/transports/jms"); factory.setServiceName(new QName("http://cxf.apache.org/swa", "SwAService")); factory.setEndpointName(new QName("http://cxf.apache.org/swa", "SwAServiceHttpPort")); - factory.setAddress(Server.ADDRESS); + factory.setAddress(ADDRESS + broker.getBrokerURL()); factory.getOutInterceptors().add(new LoggingOutInterceptor()); SwAService port = factory.create(SwAService.class); Modified: cxf/branches/2.5.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/tx/GreeterImplWithTransaction.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/tx/GreeterImplWithTransaction.java?rev=1347011&r1=1347010&r2=1347011&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/tx/GreeterImplWithTransaction.java (original) +++ cxf/branches/2.5.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/tx/GreeterImplWithTransaction.java Wed Jun 6 17:57:38 2012 @@ -30,10 +30,10 @@ public class GreeterImplWithTransaction private AtomicBoolean flag = new AtomicBoolean(true); public String greetMe(String requestType) { - System.out.println("Reached here :" + requestType); + //System.out.println("Reached here :" + requestType); if ("Bad guy".equals(requestType)) { if (flag.getAndSet(false)) { - System.out.println("Throw exception here :" + requestType); + //System.out.println("Throw exception here :" + requestType); throw new RuntimeException("Got a bad guy call for greetMe"); } else { requestType = "[Bad guy]"; Modified: cxf/branches/2.5.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/tx/JMSTransactionClientServerTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/tx/JMSTransactionClientServerTest.java?rev=1347011&r1=1347010&r2=1347011&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/tx/JMSTransactionClientServerTest.java (original) +++ cxf/branches/2.5.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/tx/JMSTransactionClientServerTest.java Wed Jun 6 17:57:38 2012 @@ -20,49 +20,71 @@ package org.apache.cxf.systest.jms.tx; import java.lang.reflect.UndeclaredThrowableException; import java.net.URL; -import java.util.HashMap; -import java.util.Map; import javax.jms.ConnectionFactory; import javax.xml.namespace.QName; +import org.apache.cxf.jaxws.EndpointImpl; import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; 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.transport.jms.JMSConfigFeature; import org.apache.cxf.transport.jms.JMSConfiguration; import org.apache.hello_world_doc_lit.Greeter; import org.apache.hello_world_doc_lit.PingMeFault; import org.apache.hello_world_doc_lit.SOAPService2; -import org.junit.Before; +import org.junit.AfterClass; +import org.junit.BeforeClass; import org.junit.Test; +import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.jms.connection.JmsTransactionManager; -public class JMSTransactionClientServerTest extends AbstractBusClientServerTestBase { - protected static boolean serversStarted; - static final String JMS_PORT = EmbeddedJMSBrokerLauncher.PORT; +public class JMSTransactionClientServerTest extends AbstractBusClientServerTestBase { + static EmbeddedJMSBrokerLauncher broker; - @Before - public void startServers() throws Exception { - if (serversStarted) { - return; - } - Map props = new HashMap(); - if (System.getProperty("org.apache.activemq.default.directory.prefix") != null) { - props.put("org.apache.activemq.default.directory.prefix", - System.getProperty("org.apache.activemq.default.directory.prefix")); + public static class Server extends AbstractBusTestServerBase { + + protected void run() { + // create the application context + ClassPathXmlApplicationContext context = + new ClassPathXmlApplicationContext("org/apache/cxf/systest/jms/tx/jms_server_config.xml"); + context.start(); + + EndpointImpl endpoint = new EndpointImpl(new GreeterImplWithTransaction()); + endpoint.setAddress("jms://"); + JMSConfiguration jmsConfig = new JMSConfiguration(); + + ConnectionFactory connectionFactory + = context.getBean("jmsConnectionFactory", ConnectionFactory.class); + jmsConfig.setConnectionFactory(connectionFactory); + jmsConfig.setTargetDestination("greeter.queue.noaop"); + jmsConfig.setSessionTransacted(true); + jmsConfig.setPubSubDomain(false); + jmsConfig.setUseJms11(true); + jmsConfig.setTransactionManager(new JmsTransactionManager(connectionFactory)); + jmsConfig.setCacheLevel(3); + + JMSConfigFeature jmsConfigFeature = new JMSConfigFeature(); + jmsConfigFeature.setJmsConfig(jmsConfig); + endpoint.getFeatures().add(jmsConfigFeature); + endpoint.publish(); } - props.put("java.util.logging.config.file", - System.getProperty("java.util.logging.config.file")); - - assertTrue("server did not launch correctly", - launchServer(EmbeddedJMSBrokerLauncher.class, props, null)); + } - assertTrue("server did not launch correctly", - launchServer(Server.class, false)); - serversStarted = true; + @BeforeClass + public static void startServers() throws Exception { + broker = new EmbeddedJMSBrokerLauncher("vm://JMSTransactionClientServerTest"); + System.setProperty("EmbeddedBrokerURL", broker.getBrokerURL()); + launchServer(broker); + launchServer(new Server()); + createStaticBus(); + } + @AfterClass + public static void clearProperty() { + System.clearProperty("EmbeddedBrokerURL"); } - public URL getWSDLURL(String s) throws Exception { return getClass().getResource(s); } @@ -82,7 +104,7 @@ public class JMSTransactionClientServerT assertNotNull(wsdl); String wsdlString = wsdl.toString(); SOAPService2 service = new SOAPService2(wsdl, serviceName); - EmbeddedJMSBrokerLauncher.updateWsdlExtensors(getBus(), wsdlString); + broker.updateWsdl(getBus(), wsdlString); assertNotNull(service); Greeter greeter = service.getPort(portName, Greeter.class); @@ -96,7 +118,7 @@ public class JMSTransactionClientServerT JMSConfiguration jmsConfig = new JMSConfiguration(); ConnectionFactory connectionFactory - = new org.apache.activemq.ActiveMQConnectionFactory("tcp://localhost:" + JMS_PORT); + = new org.apache.activemq.ActiveMQConnectionFactory(broker.getBrokerURL()); jmsConfig.setConnectionFactory(connectionFactory); jmsConfig.setTargetDestination("greeter.queue.noaop"); jmsConfig.setPubSubDomain(false); Modified: cxf/branches/2.5.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/tx/jms_server_config.xml URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/tx/jms_server_config.xml?rev=1347011&r1=1347010&r2=1347011&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/tx/jms_server_config.xml (original) +++ cxf/branches/2.5.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/tx/jms_server_config.xml Wed Jun 6 17:57:38 2012 @@ -47,7 +47,7 @@ http://cxf.apache.org/jaxws http://cxf.a