Skip to content
Permalink
Browse files
CXF-5543 Fix continuationtests
git-svn-id: https://svn.apache.org/repos/asf/cxf/trunk@1567674 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
cschneider committed Feb 12, 2014
1 parent 7686ddb commit b1a2e7e12a9b8df61b2111c533c2e53d7353a7c0
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 131 deletions.
@@ -371,8 +371,9 @@ public synchronized void shutdownListeners() {
}
}
public synchronized void close() {
ResourceCloser.close(connection);
shutdownListeners();
ResourceCloser.close(connection);
connection = null;
LOG.log(Level.FINE, "JMSConduit closed ");
}

@@ -102,10 +102,10 @@ public void ensureProperlyConfigured() {
connectionFactory = JMSFactory.getConnectionFactoryFromJndi(this);
}
if (connectionFactory == null) {
throw new IllegalArgumentException("JMSConfiguration.connectionFactory may not be null");
throw new IllegalArgumentException("connectionFactory may not be null");
}
if (targetDestination == null) {
throw new IllegalArgumentException("JMSConfigruation.targetDestination may not be null");
throw new IllegalArgumentException("targetDestination may not be null");
}
}

@@ -19,9 +19,9 @@
package org.apache.cxf.systest.jms.continuations;

import java.net.URL;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

import javax.xml.namespace.QName;
@@ -33,17 +33,15 @@
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
import org.apache.cxf.testutil.common.EmbeddedJMSBrokerLauncher;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;

public class HelloWorldContinuationsClientServerTest extends AbstractBusClientServerTestBase {
static EmbeddedJMSBrokerLauncher broker;

private static final String CONFIG_FILE =
"org/apache/cxf/systest/jms/continuations/jms_test_config.xml";
private static final String WSDL_PATH = "org/apache/cxf/systest/jms/continuations/test.wsdl";
private static final String CONFIG_FILE = "org/apache/cxf/systest/jms/continuations/jms_test_config.xml";

private static EmbeddedJMSBrokerLauncher broker;

public static class Server extends AbstractBusTestServerBase {
EmbeddedJMSBrokerLauncher broker;
@@ -53,9 +51,10 @@ public Server(EmbeddedJMSBrokerLauncher b) {
}

protected void run() {
setBus(BusFactory.getDefaultBus());
broker.updateWsdl(getBus(),
"org/apache/cxf/systest/jms/continuations/test.wsdl");
SpringBusFactory bf = new SpringBusFactory();
Bus bus = bf.createBus(CONFIG_FILE);
BusFactory.setDefaultBus(bus);
broker.updateWsdl(getBus(), WSDL_PATH);
Object implementor = new HelloWorldWithContinuationsJMS();
String address = "jms://";
ep = Endpoint.publish(address, implementor);
@@ -87,14 +86,13 @@ public void testHttpWrappedContinuations() throws Exception {

QName serviceName = new QName("http://cxf.apache.org/systest/jaxws", "HelloContinuationService");

URL wsdlURL = getClass().getResource("/org/apache/cxf/systest/jms/continuations/test.wsdl");
URL wsdlURL = getClass().getClassLoader().getResource(WSDL_PATH);

HelloContinuationService service = new HelloContinuationService(wsdlURL, serviceName);
assertNotNull(service);
final HelloContinuation helloPort = service.getHelloContinuationPort();

ThreadPoolExecutor executor = new ThreadPoolExecutor(5, 5, 0, TimeUnit.SECONDS,
new ArrayBlockingQueue<Runnable>(10));
ExecutorService executor = Executors.newCachedThreadPool();
CountDownLatch startSignal = new CountDownLatch(1);
CountDownLatch helloDoneSignal = new CountDownLatch(5);

@@ -108,7 +106,7 @@ public void testHttpWrappedContinuations() throws Exception {
helloDoneSignal.await(60, TimeUnit.SECONDS);
executor.shutdownNow();
((java.io.Closeable)helloPort).close();
assertEquals("Not all invocations have completed", 0, helloDoneSignal.getCount());
assertEquals("Some invocations are still running", 0, helloDoneSignal.getCount());
bus.shutdown(true);
}

@@ -33,16 +33,16 @@
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
import org.apache.cxf.testutil.common.EmbeddedJMSBrokerLauncher;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;

public class HelloWorldContinuationsThrottleTest extends AbstractBusClientServerTestBase {
static EmbeddedJMSBrokerLauncher broker;
private static final String WSDL_PATH = "org/apache/cxf/systest/jms/continuations/test.wsdl";
private static final String CONFIG_FILE = "org/apache/cxf/systest/jms/continuations/jms_test_config.xml";

private static EmbeddedJMSBrokerLauncher broker;

private static final String CONFIG_FILE =
"org/apache/cxf/systest/jms/continuations/jms_test_config.xml";

public static class Server extends AbstractBusTestServerBase {
public static final String PORT = allocatePort(Server.class);
@@ -51,7 +51,7 @@ protected void run() {
SpringBusFactory bf = new SpringBusFactory();
Bus bus = bf.createBus(CONFIG_FILE);
BusFactory.setDefaultBus(bus);
broker.updateWsdl(bus, "org/apache/cxf/systest/jms/continuations/test2.wsdl");
broker.updateWsdl(bus, WSDL_PATH);
Object implementor = new HelloWorldWithContinuationsJMS2();
String address = "http://localhost:" + PORT + "/SoapContext/SoapPort";
Endpoint.publish(address, implementor);
@@ -70,14 +70,14 @@ public static void clearProperty() {
}

@Test
public void testHttpWrappedContinuatuions() throws Exception {
public void testHttpWrappedContinuations() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
Bus bus = bf.createBus(CONFIG_FILE);
BusFactory.setDefaultBus(bus);

QName serviceName = new QName("http://cxf.apache.org/systest/jaxws", "HelloContinuationService");

URL wsdlURL = getClass().getResource("/org/apache/cxf/systest/jms/continuations/test2.wsdl");
URL wsdlURL = getClass().getClassLoader().getResource(WSDL_PATH);
String wsdlString = wsdlURL.toString().intern();
broker.updateWsdl(getBus(), wsdlString);
HelloContinuationService service = new HelloContinuationService(wsdlURL, serviceName);
@@ -102,7 +102,7 @@ public void testHttpWrappedContinuatuions() throws Exception {

helloDoneSignal.await(60, TimeUnit.SECONDS);
executor.shutdownNow();
assertEquals("Not all invocations have completed", 0, helloDoneSignal.getCount());
assertEquals("Some invocations are still running", 0, helloDoneSignal.getCount());
((java.io.Closeable)helloPort).close();

bus.shutdown(true);
@@ -39,7 +39,7 @@
portName = "HelloContinuationPort",
targetNamespace = "http://cxf.apache.org/systest/jaxws",
endpointInterface = "org.apache.cxf.systest.jms.continuations.HelloContinuation",
wsdlLocation = "org/apache/cxf/systest/jms/continuations/test2.wsdl")
wsdlLocation = "org/apache/cxf/systest/jms/continuations/test.wsdl")
public class HelloWorldWithContinuationsJMS2 implements HelloContinuation {

private Map<String, Continuation> suspended =
@@ -20,31 +20,28 @@
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ct="http://cxf.apache.org/configuration/types" xmlns:jms="http://cxf.apache.org/transports/jms" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation=" http://cxf.apache.org/transports/jms http://cxf.apache.org/schemas/configuration/jms.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
<jms:conduit name="{http://cxf.apache.org/systest/jaxws}HelloContinuationPort.jms-conduit">
<jms:clientConfig clientReceiveTimeout="10000" messageTimeToLive="10000"/>
<jms:address jndiConnectionFactoryName="ConnectionFactory" jndiDestinationName="dynamicQueues/test.jmstransport.text">
<jms:JMSNamingProperty name="java.naming.factory.initial" value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>
<jms:JMSNamingProperty name="java.naming.provider.url" value="${EmbeddedBrokerURL}"/>
</jms:address>
<jms:jmsConfig-ref>jmsConf1</jms:jmsConfig-ref>
</jms:conduit>
<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"
p:brokerURL="${EmbeddedBrokerURL}"/>
<bean id="jmsConf1" class="org.apache.cxf.transport.jms.JMSConfiguration"
p:connectionFactory-ref="jmsConnectionFactory"
p:targetDestination="test.jmstransport.text"
p:replyDestination="test.jmstransport.text.reply"
p:concurrentConsumers="1"
p:maxConcurrentConsumers="1"/>
p:maxConcurrentConsumers="1"
p:usingEndpointInfo="false"/>
<jms:destination name="{http://cxf.apache.org/systest/jaxws}HelloContinuationPort.jms-destination">
<jms:address jndiConnectionFactoryName="ConnectionFactory" jndiDestinationName="dynamicQueues/test.jmstransport.text">
<jms:JMSNamingProperty name="java.naming.factory.initial" value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>
<jms:JMSNamingProperty name="java.naming.provider.url" value="${EmbeddedBrokerURL}"/>
</jms:address>
<jms:jmsConfig-ref>jmsConf2</jms:jmsConfig-ref>
</jms:destination>
<bean id="jmsConf2" class="org.apache.cxf.transport.jms.JMSConfiguration"
p:connectionFactory-ref="jmsConnectionFactory"
p:targetDestination="test.jmstransport.text"
p:replyDestination="test.jmstransport.text.reply"
p:timeToLive="10000"
p:concurrentConsumers="1"
p:maxConcurrentConsumers="1"
p:maxSuspendedContinuations="1"
p:cacheLevel="2"/>
p:cacheLevel="2"
p:usingEndpointInfo="false"/>
</beans>
@@ -80,14 +80,6 @@
</operation>
</binding>
<service name="HelloContinuationService">
<port binding="tns:HelloContinuationServiceSoapBinding" name="HelloContinuationPort">
<jms:clientConfig clientReceiveTimeout="500000" messageTimeToLive="500000"/>
<jms:serverConfig serverReceiveTimeout="500" messageTimeToLive="500000"/>
<jms:address jndiConnectionFactoryName="ConnectionFactory" jndiDestinationName="dynamicQueues/test.jmstransport.text">
<jms:JMSNamingProperty name="java.naming.factory.initial" value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>
<jms:JMSNamingProperty name="java.naming.provider.url" value="tcp://localhost:61500"/>
</jms:address>
<jms:server durableSubscriberName="CXF_subscriber"/>
</port>
<port binding="tns:HelloContinuationServiceSoapBinding" name="HelloContinuationPort"/>
</service>
</definitions>

This file was deleted.

0 comments on commit b1a2e7e

Please sign in to comment.