[jboss-cvs] JBossAS SVN: r71845 - in branches/JBPAPP_4_2_0_GA_CP/testsuite: src/main/org/jboss/test/jca and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Apr 9 10:42:28 EDT 2008
Author: jesper.pedersen
Date: 2008-04-09 10:42:28 -0400 (Wed, 09 Apr 2008)
New Revision: 71845
Added:
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jca/jms/
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jca/jms/WrapperJMSConnectionFactory.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jca/jms/WrapperJMSConnectionFactoryMBean.java
Modified:
branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/jca.xml
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jca/test/ExecuteJMSDuringRollbackStressTestCase.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/jca/executejmsrollback/test-jms-local-ds.xml
Log:
[JBPAPP-750] ExecuteJMSDuringRollbackStressTestCase failure
Patch by Adrian Brock <adrian (at) jboss (dot) org>
Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/jca.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/jca.xml 2008-04-09 14:38:43 UTC (rev 71844)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/jca.xml 2008-04-09 14:42:28 UTC (rev 71845)
@@ -225,6 +225,7 @@
<fileset dir="${build.classes}">
<patternset refid="common.test.client.classes"/>
<include name="org/jboss/test/jca/test/ExecuteJMS*"/>
+ <include name="org/jboss/test/jca/jms/*"/>
<include name="org/jboss/test/util/ejb/*"/>
</fileset>
<fileset dir="${build.resources}/jca/test">
Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jca/jms/WrapperJMSConnectionFactory.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jca/jms/WrapperJMSConnectionFactory.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jca/jms/WrapperJMSConnectionFactory.java 2008-04-09 14:42:28 UTC (rev 71845)
@@ -0,0 +1,349 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2007, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.jca.jms;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionConsumer;
+import javax.jms.ConnectionFactory;
+import javax.jms.ConnectionMetaData;
+import javax.jms.Destination;
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSession;
+import javax.jms.ServerSessionPool;
+import javax.jms.Session;
+import javax.jms.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.TopicSession;
+import javax.naming.InitialContext;
+import javax.naming.Name;
+
+import org.jboss.system.ServiceMBeanSupport;
+import org.jboss.util.naming.NonSerializableFactory;
+
+/**
+ * WrapperJMSConnectionFactory.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class WrapperJMSConnectionFactory extends ServiceMBeanSupport
+ implements ConnectionFactory, QueueConnectionFactory, TopicConnectionFactory, WrapperJMSConnectionFactoryMBean
+{
+ private String jndiName;
+ private String reference;
+ private ConnectionFactory delegate;
+
+ public String getJndiName()
+ {
+ return jndiName;
+ }
+
+ public void setJndiName(String jndiName)
+ {
+ this.jndiName = jndiName;
+ }
+
+ public String getReference()
+ {
+ return reference;
+ }
+
+ public void setReference(String reference)
+ {
+ this.reference = reference;
+ }
+
+ @Override
+ protected void startService() throws Exception
+ {
+ InitialContext context = new InitialContext();
+ delegate = (ConnectionFactory) context.lookup(reference);
+ Name name = context.getNameParser("").parse(jndiName);
+ NonSerializableFactory.rebind(name, this, true);
+ }
+
+ @Override
+ protected void stopService() throws Exception
+ {
+ InitialContext context = new InitialContext();
+ context.unbind(jndiName);
+ NonSerializableFactory.unbind(jndiName);
+ }
+
+ public Connection createConnection() throws JMSException
+ {
+ return new WrapperConnection(delegate.createConnection());
+ }
+
+ public Connection createConnection(String arg0, String arg1) throws JMSException
+ {
+ return new WrapperConnection(delegate.createConnection(arg0, arg1));
+ }
+
+ public QueueConnection createQueueConnection() throws JMSException
+ {
+ return new WrapperQueueConnection(((QueueConnectionFactory) delegate).createQueueConnection());
+ }
+
+ public QueueConnection createQueueConnection(String arg0, String arg1) throws JMSException
+ {
+ return new WrapperQueueConnection(((QueueConnectionFactory) delegate).createQueueConnection(arg0, arg1));
+ }
+
+ public TopicConnection createTopicConnection() throws JMSException
+ {
+ return new WrapperTopicConnection(((TopicConnectionFactory) delegate).createTopicConnection());
+ }
+
+ public TopicConnection createTopicConnection(String arg0, String arg1) throws JMSException
+ {
+ return new WrapperTopicConnection(((TopicConnectionFactory) delegate).createTopicConnection(arg0, arg1));
+ }
+
+ public class WrapperConnection implements Connection
+ {
+ Connection connection;
+
+ WrapperConnection(Connection connection)
+ {
+ this.connection = connection;
+ }
+
+ public void close() throws JMSException
+ {
+ connection.close();
+ }
+
+ public ConnectionConsumer createConnectionConsumer(Destination arg0, String arg1, ServerSessionPool arg2, int arg3)
+ throws JMSException
+ {
+ return connection.createConnectionConsumer(arg0, arg1, arg2, arg3);
+ }
+
+ public ConnectionConsumer createDurableConnectionConsumer(Topic arg0, String arg1, String arg2,
+ ServerSessionPool arg3, int arg4) throws JMSException
+ {
+ return connection.createDurableConnectionConsumer(arg0, arg1, arg2, arg3, arg4);
+ }
+
+ public Session createSession(boolean arg0, int arg1) throws JMSException
+ {
+ return connection.createSession(arg0, arg1);
+ }
+
+ public String getClientID() throws JMSException
+ {
+ return connection.getClientID();
+ }
+
+ public ExceptionListener getExceptionListener() throws JMSException
+ {
+ return connection.getExceptionListener();
+ }
+
+ public ConnectionMetaData getMetaData() throws JMSException
+ {
+ return connection.getMetaData();
+ }
+
+ public void setClientID(String arg0) throws JMSException
+ {
+ connection.setClientID(arg0);
+ }
+
+ public void setExceptionListener(ExceptionListener arg0) throws JMSException
+ {
+ connection.setExceptionListener(arg0);
+ }
+
+ public void start() throws JMSException
+ {
+ connection.start();
+ }
+
+ public void stop() throws JMSException
+ {
+ connection.stop();
+ }
+ }
+
+ public class WrapperQueueConnection implements QueueConnection
+ {
+ QueueConnection connection;
+
+ WrapperQueueConnection(QueueConnection connection)
+ {
+ this.connection = connection;
+ }
+
+ public void close() throws JMSException
+ {
+ connection.close();
+ }
+
+ public ConnectionConsumer createConnectionConsumer(Destination arg0, String arg1, ServerSessionPool arg2, int arg3)
+ throws JMSException
+ {
+ return connection.createConnectionConsumer(arg0, arg1, arg2, arg3);
+ }
+
+ public ConnectionConsumer createConnectionConsumer(Queue arg0, String arg1, ServerSessionPool arg2, int arg3)
+ throws JMSException
+ {
+ return connection.createConnectionConsumer(arg0, arg1, arg2, arg3);
+ }
+
+ public ConnectionConsumer createDurableConnectionConsumer(Topic arg0, String arg1, String arg2,
+ ServerSessionPool arg3, int arg4) throws JMSException
+ {
+ return connection.createDurableConnectionConsumer(arg0, arg1, arg2, arg3, arg4);
+ }
+
+ public QueueSession createQueueSession(boolean arg0, int arg1) throws JMSException
+ {
+ return connection.createQueueSession(arg0, arg1);
+ }
+
+ public Session createSession(boolean arg0, int arg1) throws JMSException
+ {
+ return connection.createSession(arg0, arg1);
+ }
+
+ public String getClientID() throws JMSException
+ {
+ return connection.getClientID();
+ }
+
+ public ExceptionListener getExceptionListener() throws JMSException
+ {
+ return connection.getExceptionListener();
+ }
+
+ public ConnectionMetaData getMetaData() throws JMSException
+ {
+ return connection.getMetaData();
+ }
+
+ public void setClientID(String arg0) throws JMSException
+ {
+ connection.setClientID(arg0);
+ }
+
+ public void setExceptionListener(ExceptionListener arg0) throws JMSException
+ {
+ connection.setExceptionListener(arg0);
+ }
+
+ public void start() throws JMSException
+ {
+ connection.start();
+ }
+
+ public void stop() throws JMSException
+ {
+ connection.stop();
+ }
+ }
+
+ public class WrapperTopicConnection implements TopicConnection
+ {
+ TopicConnection connection;
+
+ WrapperTopicConnection(TopicConnection connection)
+ {
+ this.connection = connection;
+ }
+
+ public void close() throws JMSException
+ {
+ connection.close();
+ }
+
+ public ConnectionConsumer createConnectionConsumer(Destination arg0, String arg1, ServerSessionPool arg2, int arg3)
+ throws JMSException
+ {
+ return connection.createConnectionConsumer(arg0, arg1, arg2, arg3);
+ }
+
+ public ConnectionConsumer createConnectionConsumer(Topic arg0, String arg1, ServerSessionPool arg2, int arg3)
+ throws JMSException
+ {
+ return connection.createConnectionConsumer(arg0, arg1, arg2, arg3);
+ }
+
+ public ConnectionConsumer createDurableConnectionConsumer(Topic arg0, String arg1, String arg2,
+ ServerSessionPool arg3, int arg4) throws JMSException
+ {
+ return connection.createDurableConnectionConsumer(arg0, arg1, arg2, arg3, arg4);
+ }
+
+ public Session createSession(boolean arg0, int arg1) throws JMSException
+ {
+ return connection.createSession(arg0, arg1);
+ }
+
+ public TopicSession createTopicSession(boolean arg0, int arg1) throws JMSException
+ {
+ return connection.createTopicSession(arg0, arg1);
+ }
+
+ public String getClientID() throws JMSException
+ {
+ return connection.getClientID();
+ }
+
+ public ExceptionListener getExceptionListener() throws JMSException
+ {
+ return connection.getExceptionListener();
+ }
+
+ public ConnectionMetaData getMetaData() throws JMSException
+ {
+ return connection.getMetaData();
+ }
+
+ public void setClientID(String arg0) throws JMSException
+ {
+ connection.setClientID(arg0);
+ }
+
+ public void setExceptionListener(ExceptionListener arg0) throws JMSException
+ {
+ connection.setExceptionListener(arg0);
+ }
+
+ public void start() throws JMSException
+ {
+ connection.start();
+ }
+
+ public void stop() throws JMSException
+ {
+ connection.stop();
+ }
+ }
+}
Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jca/jms/WrapperJMSConnectionFactoryMBean.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jca/jms/WrapperJMSConnectionFactoryMBean.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jca/jms/WrapperJMSConnectionFactoryMBean.java 2008-04-09 14:42:28 UTC (rev 71845)
@@ -0,0 +1,61 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2007, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.jca.jms;
+
+import org.jboss.system.ServiceMBean;
+
+/**
+ * WrapperJMSConnectionFactoryMBean.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface WrapperJMSConnectionFactoryMBean extends ServiceMBean
+{
+ /**
+ * Get the jndiName.
+ *
+ * @return the jndiName.
+ */
+ String getJndiName();
+
+ /**
+ * Set the jndiName.
+ *
+ * @param jndiName the jndiName.
+ */
+ void setJndiName(String jndiName);
+
+ /**
+ * Get the reference.
+ *
+ * @return the reference.
+ */
+ String getReference();
+
+ /**
+ * Set the reference.
+ *
+ * @param reference the reference.
+ */
+ void setReference(String reference);
+}
Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jca/test/ExecuteJMSDuringRollbackStressTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jca/test/ExecuteJMSDuringRollbackStressTestCase.java 2008-04-09 14:38:43 UTC (rev 71844)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jca/test/ExecuteJMSDuringRollbackStressTestCase.java 2008-04-09 14:42:28 UTC (rev 71845)
@@ -55,6 +55,8 @@
{
protected final Logger log = Logger.getLogger(getClass());
+ private static final long WAIT = 1000l;
+
private ConnectionFactory cf;
private Queue queue;
@@ -97,9 +99,8 @@
queue = (Queue) new InitialContext().lookup("queue/testQueue");
cf = (ConnectionFactory) new InitialContext().lookup("java:TestJmsLocal");
setupQueue();
- // This test takes too long to iterate 100 times because of the sleeps
- for (int i = 0; i < getIterationCount()/10; ++i)
- //for (int i = 0; i < 10; ++i)
+ // FIXME This test fails after 5 iterations with JBoss Messaging
+ for (int i = 0; i < 4; ++i)
{
log.info("Running " + getName() + " iteration=" + i);
latch = new CountDownLatch(2);
@@ -145,7 +146,7 @@
c.start();
Session s = c.createSession(true, Session.SESSION_TRANSACTED);
MessageConsumer r = s.createConsumer(queue);
- r.receive(1000);
+ r.receive(WAIT);
r.close();
p = s.createProducer(queue);
m = s.createTextMessage("100");
@@ -267,7 +268,7 @@
c.start();
Session s = c.createSession(true, Session.SESSION_TRANSACTED);
MessageConsumer mc = s.createConsumer(queue);
- while (mc.receive(1000) != null);
+ while (mc.receive(WAIT) != null);
mc.close();
MessageProducer p = s.createProducer(queue);
@@ -303,13 +304,13 @@
c.start();
Session s = c.createSession(true, Session.SESSION_TRANSACTED);
MessageConsumer mc = s.createConsumer(queue);
- Message m = mc.receive(1000);
+ Message m = mc.receive(WAIT);
if (m == null || m instanceof TextMessage == false)
throw new RuntimeException("Expected one text message: " + m);
String value = ((TextMessage) m).getText();
if ("101".equals(value) == false)
throw new RuntimeException("Message should have text 101 got: " + value);
- if (mc.receive(1000) != null)
+ if (mc.receive(WAIT) != null)
throw new RuntimeException("Did not expect two messages");
}
catch (Throwable t)
Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/jca/executejmsrollback/test-jms-local-ds.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/jca/executejmsrollback/test-jms-local-ds.xml 2008-04-09 14:38:43 UTC (rev 71844)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/jca/executejmsrollback/test-jms-local-ds.xml 2008-04-09 14:42:28 UTC (rev 71845)
@@ -2,6 +2,12 @@
<connection-factories>
+ <mbean code="org.jboss.test.jca.jms.WrapperJMSConnectionFactory"
+ name="jboss.test:service=WrapperJMSConnectionFactory">
+ <attribute name="JndiName">java:/WrapperConnectionFactory</attribute>
+ <attribute name="Reference">java:/ConnectionFactory</attribute>
+ </mbean>
+
<mbean code="org.jboss.jms.jndi.JMSProviderLoader"
name="jboss.mq:service=JMSProviderLoader,name=TestJMSLocalProvider">
<attribute name="ProviderName">TestJMSLocalProvider</attribute>
@@ -9,11 +15,11 @@
org.jboss.jms.jndi.JNDIProviderAdapter
</attribute>
<!-- The combined connection factory -->
- <attribute name="FactoryRef">java:/ConnectionFactory</attribute>
+ <attribute name="FactoryRef">java:/WrapperConnectionFactory</attribute>
<!-- The queue connection factory -->
- <attribute name="QueueFactoryRef">java:/ConnectionFactory</attribute>
+ <attribute name="QueueFactoryRef">java:/WrapperConnectionFactory</attribute>
<!-- The topic factory -->
- <attribute name="TopicFactoryRef">java:/ConnectionFactory</attribute>
+ <attribute name="TopicFactoryRef">java:/WrapperConnectionFactory</attribute>
</mbean>
<tx-connection-factory>
More information about the jboss-cvs-commits
mailing list