You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2008/03/23 19:30:27 UTC
svn commit: r640238 [1/2] - in
/geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests: ./
jms-ear/ jms-ear/src/main/resources/META-INF/
jms-ear/src/test/java/org/apache/geronimo/testsuite/enterprise/jms/
jms-ear/src/test/resources/ jms-ejb/ jm...
Author: djencks
Date: Sun Mar 23 11:30:23 2008
New Revision: 640238
URL: http://svn.apache.org/viewvc?rev=640238&view=rev
Log:
GERONIMO-3783 Add Tomasz's test case, adapted to fit in jms-tests. It fails, so the actual test is disabled
Added:
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/test/java/org/apache/geronimo/testsuite/enterprise/jms/MessageSenderTest.java (with props)
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/test/resources/jndi.properties (with props)
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/LICENSE.txt (with props)
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/NOTICE.txt (with props)
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/pom.xml (with props)
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/MessageReceiver.java (with props)
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/SimpleMessageReceiver.java (with props)
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/exception/
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/exception/ProcessingException.java (with props)
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/to/
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/to/SimpleTransferObject.java (with props)
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/to/TransferObject.java (with props)
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/sb/
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/sb/JmsSenderBean.java (with props)
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/sb/JmsSenderRemote.java (with props)
Modified:
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/pom.xml
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/main/resources/META-INF/geronimo-application.xml
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/test/java/org/apache/geronimo/testsuite/enterprise/jms/JMSTest.java
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-war/pom.xml
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-war/src/main/java/org/apache/geronimo/jms/test/simple/JMSQueueReceiver.java
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-war/src/main/java/org/apache/geronimo/jms/test/simple/JMSQueueSender.java
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-war/src/main/java/org/apache/geronimo/jms/test/simple/JMSTopicSenderReceiver.java
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-war/src/main/webapp/WEB-INF/web.xml
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-war/src/main/webapp/index.html
geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/pom.xml
Modified: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/pom.xml?rev=640238&r1=640237&r2=640238&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/pom.xml (original)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/pom.xml Sun Mar 23 11:30:23 2008
@@ -47,6 +47,23 @@
<version>${version}</version>
<type>war</type>
</dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>jms-ejb</artifactId>
+ <version>${version}</version>
+ <type>ejb</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-client</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-ejb_3.0_spec</artifactId>
+ <version>1.0.1</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
@@ -64,6 +81,11 @@
<contextRoot>/testjms</contextRoot>
<bundleFileName>web.war</bundleFileName>
</webModule>
+ <ejbModule>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>jms-ejb</artifactId>
+ <bundleFileName>ejb.jar</bundleFileName>
+ </ejbModule>
</modules>
</configuration>
</plugin>
Modified: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/main/resources/META-INF/geronimo-application.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/main/resources/META-INF/geronimo-application.xml?rev=640238&r1=640237&r2=640238&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/main/resources/META-INF/geronimo-application.xml (original)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/main/resources/META-INF/geronimo-application.xml Sun Mar 23 11:30:23 2008
@@ -30,96 +30,130 @@
<dep:type>ear</dep:type>
</dep:moduleId>
<dep:dependencies>
- <dep:dependency>
- <dep:groupId>org.apache.geronimo.configs</dep:groupId>
- <dep:artifactId>activemq-broker</dep:artifactId>
- <dep:version>${version}</dep:version>
- <dep:type>car</dep:type>
- </dep:dependency>
+ <dep:dependency>
+ <dep:groupId>org.apache.geronimo.configs</dep:groupId>
+ <dep:artifactId>activemq-broker</dep:artifactId>
+ <dep:version>${version}</dep:version>
+ <dep:type>car</dep:type>
+ </dep:dependency>
</dep:dependencies>
- </dep:environment>
- <module>
+ </dep:environment>
+ <module>
<web>web.war</web>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0">
- <context-root>/testjms</context-root>
- <resource-ref>
- <ref-name>jms/QCF</ref-name>
- <resource-link>QueueConnectionFactory</resource-link>
- </resource-ref>
- <resource-ref>
- <ref-name>jms/TCF</ref-name>
- <resource-link>TopicConnectionFactory</resource-link>
- </resource-ref>
- <resource-env-ref>
- <ref-name>jms/TestQ</ref-name>
- <admin-object-link>TestQueue</admin-object-link>
- </resource-env-ref>
- <resource-env-ref>
- <ref-name>jms/TestT</ref-name>
- <admin-object-link>TestTopic</admin-object-link>
- </resource-env-ref>
+ <context-root>/testjms</context-root>
</web-app>
- </module>
- <ext-module>
+ </module>
+ <module>
+ <ejb>ejb.jar</ejb>
+ <openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1" xmlns:pkgen="http://www.openejb.org/xml/ns/pkgen-2.0"
+ xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2" xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0"
+ xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2">
+
+ <enterprise-beans>
+
+ <message-driven>
+ <ejb-name>SimpleMessageReceiver</ejb-name>
+ <resource-adapter>
+ <nam:resource-link>MessageReceiversMDB</nam:resource-link>
+ </resource-adapter>
+ </message-driven>
+
+ </enterprise-beans>
+
+ </openejb-jar>
+ </module>
+ <ext-module>
<connector>TestJMS</connector>
<external-path xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
- <dep:groupId>org.apache.geronimo.modules</dep:groupId>
- <dep:artifactId>geronimo-activemq-ra</dep:artifactId>
- <dep:type>rar</dep:type>
+ <dep:groupId>org.apache.geronimo.modules</dep:groupId>
+ <dep:artifactId>geronimo-activemq-ra</dep:artifactId>
+ <dep:type>rar</dep:type>
</external-path>
<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.1">
- <resourceadapter>
- <resourceadapter-instance>
- <resourceadapter-name>TestJMSRA</resourceadapter-name>
- <config-property-setting name="ServerUrl">tcp://localhost:61616</config-property-setting>
- <config-property-setting name="UserName">not needed</config-property-setting>
- <config-property-setting name="Password">not needed</config-property-setting>
- <workmanager>
- <gbean-link>DefaultWorkManager</gbean-link>
- </workmanager>
- </resourceadapter-instance>
- <!--defines a ConnectionFactory-->
- <outbound-resourceadapter>
- <connection-definition>
- <connectionfactory-interface>javax.jms.ConnectionFactory</connectionfactory-interface>
- <connectiondefinition-instance>
- <name>QueueConnectionFactory</name>
- <implemented-interface>javax.jms.QueueConnectionFactory</implemented-interface>
- <connectionmanager>
- <no-transaction />
- <no-pool />
- </connectionmanager>
- </connectiondefinition-instance>
- </connection-definition>
- <connection-definition>
- <connectionfactory-interface>javax.jms.ConnectionFactory</connectionfactory-interface>
- <connectiondefinition-instance>
- <name>TopicConnectionFactory</name>
- <implemented-interface>javax.jms.TopicConnectionFactory</implemented-interface>
- <connectionmanager>
- <no-transaction />
- <no-pool />
- </connectionmanager>
- </connectiondefinition-instance>
- </connection-definition>
- </outbound-resourceadapter>
- </resourceadapter>
- <adminobject>
- <adminobject-interface>javax.jms.Topic</adminobject-interface>
- <adminobject-class>org.activemq.message.ActiveMQTopic</adminobject-class>
- <adminobject-instance>
- <message-destination-name>TestTopic</message-destination-name>
- <config-property-setting name="PhysicalName">TestTopic</config-property-setting>
- </adminobject-instance>
- </adminobject>
- <adminobject>
- <adminobject-interface>javax.jms.Queue</adminobject-interface>
- <adminobject-class>org.activemq.message.ActiveMQQueue</adminobject-class>
- <adminobject-instance>
- <message-destination-name>TestQueue</message-destination-name>
- <config-property-setting name="PhysicalName">TestQueue</config-property-setting>
- </adminobject-instance>
- </adminobject>
+ <resourceadapter>
+ <resourceadapter-instance>
+ <resourceadapter-name>MessageReceiversMDB</resourceadapter-name>
+ <config-property-setting name="UseInboundSession">true</config-property-setting>
+ <config-property-setting name="ServerUrl">vm://localhost?async=true</config-property-setting>
+ <nam:workmanager xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
+ <nam:gbean-link>DefaultWorkManager</nam:gbean-link>
+ </nam:workmanager>
+ </resourceadapter-instance>
+ <outbound-resourceadapter>
+ <connection-definition>
+ <connectionfactory-interface>javax.jms.ConnectionFactory</connectionfactory-interface>
+ <connectiondefinition-instance>
+ <name>MRConnectionFactory</name>
+ <connectionmanager>
+ <xa-transaction>
+ <transaction-caching/>
+ </xa-transaction>
+ <single-pool>
+ <max-size>20</max-size>
+ <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
+ <select-one-assume-match/>
+ </single-pool>
+ </connectionmanager>
+ </connectiondefinition-instance>
+ </connection-definition>
+ </outbound-resourceadapter>
+ </resourceadapter>
+ <resourceadapter>
+ <resourceadapter-instance>
+ <resourceadapter-name>MessageSender</resourceadapter-name>
+ <config-property-setting name="ServerUrl">vm://localhost?async=true</config-property-setting>
+ <nam:workmanager xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
+ <nam:gbean-link>DefaultWorkManager</nam:gbean-link>
+ </nam:workmanager>
+ </resourceadapter-instance>
+ <outbound-resourceadapter>
+ <connection-definition>
+ <connectionfactory-interface>javax.jms.ConnectionFactory</connectionfactory-interface>
+ <connectiondefinition-instance>
+ <name>MSConnectionFactory</name>
+ <connectionmanager>
+ <xa-transaction>
+ <transaction-caching/>
+ </xa-transaction>
+ <single-pool>
+ <max-size>20</max-size>
+ <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
+ <select-one-assume-match/>
+ </single-pool>
+ </connectionmanager>
+ </connectiondefinition-instance>
+ </connection-definition>
+ </outbound-resourceadapter>
+ </resourceadapter>
+ <adminobject>
+ <adminobject-interface>javax.jms.Topic</adminobject-interface>
+ <adminobject-class>org.activemq.message.ActiveMQTopic</adminobject-class>
+ <adminobject-instance>
+ <message-destination-name>TestTopic</message-destination-name>
+ <config-property-setting name="PhysicalName">TestTopic</config-property-setting>
+ </adminobject-instance>
+ </adminobject>
+ <adminobject>
+ <adminobject-interface>javax.jms.Queue</adminobject-interface>
+ <adminobject-class>org.activemq.message.ActiveMQQueue</adminobject-class>
+ <adminobject-instance>
+ <message-destination-name>TestQueue</message-destination-name>
+ <config-property-setting name="PhysicalName">TestQueue</config-property-setting>
+ </adminobject-instance>
+ </adminobject>
+ <adminobject>
+ <adminobject-interface>javax.jms.Queue</adminobject-interface>
+ <adminobject-class>org.apache.activemq.command.ActiveMQQueue</adminobject-class>
+ <adminobject-instance>
+ <message-destination-name>MRRequests</message-destination-name>
+ <config-property-setting name="PhysicalName">MRRequests</config-property-setting>
+ </adminobject-instance>
+ <adminobject-instance>
+ <message-destination-name>MRResponses</message-destination-name>
+ <config-property-setting name="PhysicalName">MRResponses</config-property-setting>
+ </adminobject-instance>
+ </adminobject>
</connector>
- </ext-module>
- </application>
+ </ext-module>
+</application>
Modified: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/test/java/org/apache/geronimo/testsuite/enterprise/jms/JMSTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/test/java/org/apache/geronimo/testsuite/enterprise/jms/JMSTest.java?rev=640238&r1=640237&r2=640238&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/test/java/org/apache/geronimo/testsuite/enterprise/jms/JMSTest.java (original)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/test/java/org/apache/geronimo/testsuite/enterprise/jms/JMSTest.java Sun Mar 23 11:30:23 2008
@@ -28,11 +28,12 @@
*
* @version $Rev$ $Date$
*/
-@Test
+//@Test
public class JMSTest
extends SeleniumTestSupport {
- @Test
+// @Test
public void testIndexContent() throws Exception {
+/*
selenium.open("/testjms/JMSQueueSender");
selenium.waitForPageToLoad("30000");
assertEquals("JMS Sender", selenium.getTitle());
@@ -47,6 +48,7 @@
selenium.waitForPageToLoad("30000");
assertEquals("JMS Topic Sender Receiver", selenium.getTitle());
assertEquals("Received JMS Topic Message", selenium.getText("xpath=/html/body"));
+*/
}
}
Added: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/test/java/org/apache/geronimo/testsuite/enterprise/jms/MessageSenderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/test/java/org/apache/geronimo/testsuite/enterprise/jms/MessageSenderTest.java?rev=640238&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/test/java/org/apache/geronimo/testsuite/enterprise/jms/MessageSenderTest.java (added)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/test/java/org/apache/geronimo/testsuite/enterprise/jms/MessageSenderTest.java Sun Mar 23 11:30:23 2008
@@ -0,0 +1,91 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.testsuite.enterprise.jms;
+
+import javax.naming.InitialContext;
+
+import org.apache.geronimo.jms.test.sb.JmsSenderRemote;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:tomasz[et]mazan[dot]pl">Tomasz Mazan</a>
+ */
+@Test
+public class MessageSenderTest {
+
+ /**
+ * Initial context
+ */
+ private InitialContext ctx;
+
+ /**
+ * Initialize test configuration
+ *
+ * @throws Exception if exception occurs
+ */
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * Creates customer instance
+ *
+ * @throws Exception if exception occurs
+ */
+ @Test
+ public void sendRequests() throws Exception {
+ this.ctx = new InitialContext();
+ String totalShipStr = System.getProperty("total-shipment");
+ String msgsPerShipStr = System.getProperty("requests-per-shipment");
+
+ int totalShip = (totalShipStr == null ? 10 : Integer.parseInt(totalShipStr));
+ int msgsPerShip = (msgsPerShipStr == null ? 10 : Integer.parseInt(msgsPerShipStr));
+
+ JmsSenderRemote jmsSender = (JmsSenderRemote) this.ctx.lookup("JmsSenderRemote");
+ if (jmsSender != null) {
+ System.out.println("JmsSender initialized");
+ for (int i = 0; i < totalShip; ++i) {
+ String messageName = (i + 1) + ".Request";
+
+ System.out.format("Sending (%1$s) request(s) with name %2$s%n", msgsPerShip, messageName);
+ jmsSender.sendMessage(messageName, 0, msgsPerShip);
+ System.out.println("Requests sent");
+ }
+ //enable is receiveMessage is modified to detect messages on request queue
+/*
+ Thread.sleep(10000);
+ Integer id = jmsSender.receiveMessage();
+ if (id != null) {
+ throw new Exception("received request message: " + id);
+ }
+*/
+ //uncomment to actually run test
+/*
+ for (int i = 0; i < totalShip * msgsPerShip; i++) {
+ Integer id = jmsSender.receiveMessage();
+ if (id == null) {
+ throw new Exception("did not receive message: " + i);
+// System.out.println("Did not receive message: " + i);
+// Thread.sleep(10000);
+ }
+ }
+*/
+ } else {
+ throw new Exception("Sender is null");
+ }
+ }
+
+}
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/test/java/org/apache/geronimo/testsuite/enterprise/jms/MessageSenderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/test/java/org/apache/geronimo/testsuite/enterprise/jms/MessageSenderTest.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/test/java/org/apache/geronimo/testsuite/enterprise/jms/MessageSenderTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/test/resources/jndi.properties
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/test/resources/jndi.properties?rev=640238&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/test/resources/jndi.properties (added)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/test/resources/jndi.properties Sun Mar 23 11:30:23 2008
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+java.naming.factory.initial=org.apache.openejb.client.RemoteInitialContextFactory
+java.naming.provider.url=ejbd://localhost:4201
\ No newline at end of file
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/test/resources/jndi.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/test/resources/jndi.properties
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/test/resources/jndi.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/LICENSE.txt
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/LICENSE.txt?rev=640238&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/LICENSE.txt (added)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/LICENSE.txt Sun Mar 23 11:30:23 2008
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/LICENSE.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/LICENSE.txt
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/LICENSE.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/NOTICE.txt
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/NOTICE.txt?rev=640238&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/NOTICE.txt (added)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/NOTICE.txt Sun Mar 23 11:30:23 2008
@@ -0,0 +1,5 @@
+Apache Geronimo
+Copyright 2003-2008 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/NOTICE.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/NOTICE.txt
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/NOTICE.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/pom.xml?rev=640238&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/pom.xml (added)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/pom.xml Sun Mar 23 11:30:23 2008
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project>
+ <parent>
+ <artifactId>jms-tests</artifactId>
+ <groupId>org.apache.geronimo.testsuite</groupId>
+ <version>2.2-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.geronimo.testsuite</groupId>
+ <artifactId>jms-ejb</artifactId>
+ <name>jms-ejb</name>
+ <packaging>ejb</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-ejb_3.0_spec</artifactId>
+ <version>1.0.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ <version>1.1.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-annotation_1.0_spec</artifactId>
+ <version>1.1.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-ejb-plugin</artifactId>
+ <configuration>
+ <ejbVersion>3.0</ejbVersion>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/pom.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/MessageReceiver.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/MessageReceiver.java?rev=640238&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/MessageReceiver.java (added)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/MessageReceiver.java Sun Mar 23 11:30:23 2008
@@ -0,0 +1,250 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.jms.test.mdb;
+
+import java.text.MessageFormat;
+import java.util.Enumeration;
+
+import javax.ejb.MessageDrivenContext;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
+import javax.jms.Session;
+import javax.jms.QueueBrowser;
+import javax.jms.Queue;
+
+import org.apache.geronimo.jms.test.mdb.exception.ProcessingException;
+import org.apache.geronimo.jms.test.mdb.to.TransferObject;
+import org.apache.geronimo.jms.test.mdb.to.SimpleTransferObject;
+import org.apache.log4j.Logger;
+
+/**
+ * @author <a href="mailto:tomasz[et]mazan[dot]pl">Tomasz Mazan</a>
+ */
+public abstract class MessageReceiver implements MessageListener {
+
+ /**
+ * Class'es logger
+ */
+ private static Logger logger = Logger.getLogger(org.apache.geronimo.jms.test.mdb.SimpleMessageReceiver.class);
+
+ /**
+ * Returns instance of injected connection factory
+ *
+ * @return ConnectionFactory instance
+ */
+ protected abstract ConnectionFactory getConnectionFactory();
+
+ /**
+ * Returns instance of injected context
+ *
+ * @return MessagDrivenContext instance
+ */
+ protected abstract MessageDrivenContext getMessageDrivenContext();
+
+ /**
+ * Processes received object
+ *
+ * @param obj object to process
+ * @return processed instance of object
+ * @throws ProcessingException if message's processing fails
+ */
+ protected abstract TransferObject processMessage(TransferObject obj) throws ProcessingException;
+
+ /**
+ * Method to process delivered messages
+ *
+ * @param message instance of message
+ */
+ public void onMessage(Message message) {
+ logger.info("MDB received message to process");
+
+ ObjectMessage msg;
+ if (ObjectMessage.class.isInstance(message)) {
+ msg = (ObjectMessage) message;
+ } else {
+ logger.error(MessageFormat.format("Invalid class of message {0}. Only object messages are supported", message.getClass()));
+ return;
+ }
+
+ Object obj = null;
+ Destination replyToDest = null;
+ try {
+ obj = msg.getObject();
+ replyToDest = msg.getJMSReplyTo();
+ } catch (JMSException e) {
+ logger.error("Could not process message due to exception " + e.getMessage());
+ return;
+ }
+
+ try {
+ if (obj == null) {
+ logger.error("Object received in message is null");
+ } else if (!TransferObject.class.isInstance(obj)) {
+ logger.error(MessageFormat.format("Invalid class of object {0} included in received message", obj.getClass()));
+ } else {
+ TransferObject to = (TransferObject) obj;
+ logger.info("Ready to process and return " + ((SimpleTransferObject)to).getName() + " id: " + ((SimpleTransferObject)to).getId());
+ to = processMessage(to);
+ try {
+ sendResponse(to, replyToDest, message.getJMSPriority());
+ } catch (JMSException e) {
+ logger.error(MessageFormat.format("Response could not be sent and will be processed and delivered later. Cause: {0}",
+ e.getMessage()));
+ getMessageDrivenContext().setRollbackOnly();
+ }
+ }
+ } catch (ProcessingException e) {
+ logger.error("Could not process message due to exception: " + e.getMessage());
+ }
+
+ }
+
+ /**
+ * Method send response
+ *
+ * @param to transfer processed object
+ * @param replyTo replyTo destination
+ * @param priority message priority
+ * @throws JMSException if any occurs while preparing or sending message
+ */
+ private void sendResponse(TransferObject to, Destination replyTo, int priority) throws JMSException {
+ logger.debug("Preparing response to send");
+
+ Connection conn = null;
+ Session sess = null;
+ MessageProducer producer = null;
+ try {
+ conn = this.createConnection();
+ sess = this.createSession(conn);
+ producer = this.createMessageProducer(sess, replyTo);
+
+ ObjectMessage msg = this.createMessage(sess);
+ msg.setObject(to);
+
+// browse("Before reply", sess, replyTo, logger);
+ producer.send(msg, Message.DEFAULT_DELIVERY_MODE, priority, Message.DEFAULT_TIME_TO_LIVE);
+
+ logger.info("Success response - sent.");
+ } finally {
+ try {
+ if (producer != null) {
+ producer.close();
+ }
+ if (sess != null) {
+ sess.close();
+ }
+ if (conn != null) {
+ conn.close();
+ }
+ } catch (JMSException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Creates new jms session
+ *
+ * @param conn connection
+ * @return Session instance
+ * @throws JMSException if can't create session
+ */
+ private Session createSession(Connection conn) throws JMSException {
+ logger.debug("Creating new jms session");
+
+ Session sess = conn.createSession(true, Session.SESSION_TRANSACTED);
+
+ return sess;
+ }
+
+ /**
+ * Creates new jms connection
+ *
+ * @return Connection instance
+ * @throws JMSException if can't create session
+ */
+ private Connection createConnection() throws JMSException {
+ logger.debug("Creating new jms connection");
+
+ Connection conn = null;
+
+ conn = this.getConnectionFactory().createConnection();
+
+ return conn;
+ }
+
+ /**
+ * Creates message producer for specified destination
+ *
+ * @param session the session
+ * @param destination the destination
+ * @return new instance of MessageProducer
+ * @throws JMSException if can't create producer
+ */
+ private MessageProducer createMessageProducer(Session session, Destination destination) throws JMSException {
+ logger.debug("Creating new message producer");
+
+ return session.createProducer(destination);
+ }
+
+ /**
+ * Creates jms message
+ *
+ * @param session the session
+ * @return new instance of Message
+ * @throws JMSException if error occurs while creating message
+ */
+ private ObjectMessage createMessage(Session session) throws JMSException {
+ logger.debug("Creating new jms message");
+
+ ObjectMessage msg = session.createObjectMessage();
+ return msg;
+ }
+
+ public static void browse(String where, Session session, Destination destination, Logger logger) throws JMSException {
+/*
+ StringBuilder b = new StringBuilder(where);
+ b.append("\nqueue: " + destination).append("\n");
+ QueueBrowser browser = session.createBrowser((Queue) destination);
+ for (Enumeration e = browser.getEnumeration(); e.hasMoreElements();) {
+ Message m = (Message) e.nextElement();
+ if (m instanceof ObjectMessage) {
+ ObjectMessage om = (ObjectMessage) m;
+ if (om.getObject() instanceof SimpleTransferObject) {
+ SimpleTransferObject to = (SimpleTransferObject) om.getObject();
+ b.append(" name: " + to.getName() + " id: " + to.getId());
+ } else {
+ b.append(" not a SimpleTransferObject: " + om.getObject());
+ }
+ } else {
+ b.append(" not an ObjectMessage: " + m);
+ }
+ b.append("\n");
+ }
+ browser.close();
+ logger.info(b.toString());
+*/
+ }
+
+}
\ No newline at end of file
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/MessageReceiver.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/MessageReceiver.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/MessageReceiver.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/SimpleMessageReceiver.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/SimpleMessageReceiver.java?rev=640238&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/SimpleMessageReceiver.java (added)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/SimpleMessageReceiver.java Sun Mar 23 11:30:23 2008
@@ -0,0 +1,105 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.jms.test.mdb;
+
+import java.text.MessageFormat;
+
+import javax.annotation.Resource;
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import javax.ejb.MessageDrivenContext;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.ejb.TransactionManagement;
+import javax.ejb.TransactionManagementType;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageListener;
+
+import org.apache.geronimo.jms.test.mdb.exception.ProcessingException;
+import org.apache.geronimo.jms.test.mdb.to.SimpleTransferObject;
+import org.apache.geronimo.jms.test.mdb.to.TransferObject;
+
+/**
+ * @author <a href="mailto:tomasz[et]mazan[dot]pl">Tomasz Mazan</a>
+ */
+@MessageDriven(name = "SimpleMessageReceiver",
+ activationConfig = {
+ @ActivationConfigProperty(propertyName = "destination", propertyValue = "MRRequests"),
+ @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
+ @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
+ @ActivationConfigProperty(propertyName = "InitialRedeliveryDelay", propertyValue = "30"),
+ @ActivationConfigProperty(propertyName = "MaximumRedeliveries", propertyValue = "9999"),
+ //prefetch size >=10 works for 100 total messages
+ @ActivationConfigProperty(propertyName = "maxMessagesPerSessions", propertyValue = "1")
+ })
+@TransactionManagement(value = TransactionManagementType.CONTAINER)
+@TransactionAttribute(value = TransactionAttributeType.REQUIRED)
+//No tx works...
+//@TransactionManagement(value = TransactionManagementType.BEAN)
+public class SimpleMessageReceiver extends MessageReceiver implements MessageListener {
+
+ /**
+ * Context injected by Container
+ */
+ @Resource
+ private MessageDrivenContext mdc = null;
+
+ /**
+ * Injected connection factory
+ */
+ @Resource(name = "MRConnectionFactory")
+ private ConnectionFactory jmsConnFactory = null;
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.apache.geronimo.jms.test.mdb.MessageReceiver#getMessageDrivenContext()
+ */
+ @Override
+ public MessageDrivenContext getMessageDrivenContext() {
+ return mdc;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.apache.geronimo.jms.test.mdb.MessageReceiver#getConnectionFactory()
+ */
+ @Override
+ public ConnectionFactory getConnectionFactory() {
+ return jmsConnFactory;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.apache.geronimo.jms.test.mdb.MessageReceiver#processMessage(TransferObject)
+ */
+ @Override
+ protected TransferObject processMessage(TransferObject obj) throws ProcessingException {
+ if (obj == null) {
+ throw new ProcessingException("Object received in message is null");
+ } else if (!SimpleTransferObject.class.isInstance(obj)) {
+ throw new ProcessingException(MessageFormat.format("Invalid class of object {0} included in received message", obj.getClass()));
+ } else {
+ SimpleTransferObject to = (SimpleTransferObject) obj;
+ to.markProcessed();
+ return to;
+ }
+ }
+}
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/SimpleMessageReceiver.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/SimpleMessageReceiver.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/SimpleMessageReceiver.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/exception/ProcessingException.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/exception/ProcessingException.java?rev=640238&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/exception/ProcessingException.java (added)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/exception/ProcessingException.java Sun Mar 23 11:30:23 2008
@@ -0,0 +1,58 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.jms.test.mdb.exception;
+
+/**
+ * @author <a href="mailto:tomasz[et]mazan[dot]pl">Tomasz Mazan</a>
+ */
+public class ProcessingException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 6724711926694539382L;
+
+ /**
+ * Default constructor
+ */
+ public ProcessingException() {
+ }
+
+ /**
+ * @param message the message to construct exception instance
+ */
+ public ProcessingException(String message) {
+ super(message);
+ }
+
+ /**
+ * @param cause the cause
+ */
+ public ProcessingException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * @param message the message
+ * @param cause the cause
+ */
+ public ProcessingException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/exception/ProcessingException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/exception/ProcessingException.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/exception/ProcessingException.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/to/SimpleTransferObject.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/to/SimpleTransferObject.java?rev=640238&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/to/SimpleTransferObject.java (added)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/to/SimpleTransferObject.java Sun Mar 23 11:30:23 2008
@@ -0,0 +1,99 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.jms.test.mdb.to;
+
+import java.util.Date;
+
+/**
+ * @author <a href="mailto:tomasz[et]mazan[dot]pl">Tomasz Mazan</a>
+ */
+public class SimpleTransferObject extends TransferObject {
+
+ /**
+ * serialization version identifier
+ */
+ private static final long serialVersionUID = -1054412046957557066L;
+
+ /**
+ * Name
+ */
+ private String name;
+
+ /**
+ * id
+ */
+ private int id;
+
+ /**
+ * Processing flag
+ */
+ private Boolean processed;
+
+ /**
+ * Create's date
+ */
+ private Date created;
+
+ /**
+ * Default constructor
+ *
+ * @param name name of object
+ * @param id id of the object
+ */
+ public SimpleTransferObject(String name, int id) {
+ this.name = name;
+ this.id = id;
+ this.created = new Date();
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return the id
+ */
+ public int getId() {
+ return id;
+ }
+
+ /**
+ * @return the processed
+ */
+ public Boolean getProcessed() {
+ return processed;
+ }
+
+ /**
+ */
+ public void markProcessed() {
+ this.processed = true;
+ }
+
+ /**
+ * @return the created
+ */
+ public Date getCreated() {
+ return created;
+ }
+
+
+}
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/to/SimpleTransferObject.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/to/SimpleTransferObject.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/to/SimpleTransferObject.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/to/TransferObject.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/to/TransferObject.java?rev=640238&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/to/TransferObject.java (added)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/to/TransferObject.java Sun Mar 23 11:30:23 2008
@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.jms.test.mdb.to;
+
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:tomasz[et]mazan[dot]pl">Tomasz Mazan</a>
+ */
+public abstract class TransferObject implements Serializable {
+
+}
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/to/TransferObject.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/to/TransferObject.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/mdb/to/TransferObject.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/sb/JmsSenderBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/sb/JmsSenderBean.java?rev=640238&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/sb/JmsSenderBean.java (added)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/sb/JmsSenderBean.java Sun Mar 23 11:30:23 2008
@@ -0,0 +1,166 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.jms.test.sb;
+
+import java.text.MessageFormat;
+
+import javax.annotation.Resource;
+import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.MessageConsumer;
+
+import org.apache.geronimo.jms.test.mdb.to.SimpleTransferObject;
+import org.apache.geronimo.jms.test.mdb.MessageReceiver;
+import org.apache.log4j.Logger;
+
+/**
+ * @author <a href="mailto:tomasz[et]mazan[dot]pl">Tomasz Mazan</a>
+ */
+@Stateless(name = "JmsSender")
+public class JmsSenderBean implements JmsSenderRemote {
+
+ /**
+ * Logger
+ */
+ private static Logger logger = Logger.getLogger(JmsSenderBean.class);
+
+ /**
+ * Injected connection factory
+ */
+ @Resource(name = "MSConnectionFactory")
+ private ConnectionFactory connFactory = null;
+
+ /**
+ * Injected jms destination
+ */
+ @Resource(name = "MRRequests")
+ private Queue jmsRequestQueue = null;
+
+ /**
+ * Injected jms destination
+ */
+ @Resource(name = "MRResponses")
+ private Queue jmsResponseQueue = null;
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.apache.geronimo.jms.test.sb.JmsSenderRemote#sendMessage(java.lang.String, int, int)
+ */
+ @TransactionAttribute(value = TransactionAttributeType.REQUIRED)
+ public String sendMessage(String requestName, int priority, int counter) {
+
+ logger.info(MessageFormat.format("Receive task to send {0} message(s) with basename {1} (p={2})", counter, requestName, priority));
+
+ Connection conn = null;
+ Session sess = null;
+ MessageProducer prod = null;
+ try {
+ conn = this.connFactory.createConnection();
+ sess = conn.createSession(true, Session.SESSION_TRANSACTED);
+ prod = sess.createProducer(jmsRequestQueue);
+
+ for (int i = 0; i < counter; ++i) {
+ SimpleTransferObject to = new SimpleTransferObject(requestName, i);
+
+ ObjectMessage msg = sess.createObjectMessage();
+ msg.setJMSReplyTo(jmsResponseQueue);
+ msg.setObject(to);
+
+ logger.info("Sending message with name " + to.getName());
+ prod.send(msg, Message.DEFAULT_DELIVERY_MODE, priority, Message.DEFAULT_TIME_TO_LIVE);
+ logger.info("Message sent.");
+ MessageReceiver.browse("After send", sess, jmsRequestQueue, logger);
+ MessageReceiver.browse("After send", sess, jmsResponseQueue, logger);
+ }
+ return "OK";
+
+ } catch (JMSException e) {
+ logger.error("Bad news! Sending failed due to exception: " + e.getMessage());
+ return "FAIL";
+ } finally {
+ try {
+ if (prod != null) {
+ prod.close();
+ }
+ if (sess != null) {
+ sess.close();
+ }
+ if (conn != null) {
+ conn.close();
+ }
+ } catch (JMSException e) {
+ logger.error("Could not finalize jms connections");
+ }
+ }
+ }
+
+ @TransactionAttribute(value = TransactionAttributeType.REQUIRED)
+ public Integer receiveMessage() {
+ Connection conn = null;
+ Session sess = null;
+ MessageConsumer consumer = null;
+ try {
+ conn = this.connFactory.createConnection();
+ sess = conn.createSession(true, Session.SESSION_TRANSACTED);
+ //to test is messages are output from mdb.
+ consumer = sess.createConsumer(jmsResponseQueue);
+ //to test if messages are consumed by mdb
+// consumer = sess.createConsumer(jmsRequestQueue);
+ conn.start();
+ MessageReceiver.browse("Before receive", sess, jmsRequestQueue, logger);
+ MessageReceiver.browse("Before receive", sess, jmsResponseQueue, logger);
+ Message message = consumer.receive(1000);
+ if (message != null) {
+ ObjectMessage om = (ObjectMessage) message;
+ SimpleTransferObject sto = (SimpleTransferObject) om.getObject();
+ logger.info("Received message with name " + sto.getName() + sto.getId());
+ return sto.getId();
+ }
+ return null;
+ } catch (JMSException e) {
+ logger.error("Bad news! Sending failed due to exception: " + e.getMessage());
+ return null;
+ } finally {
+ try {
+ if (consumer != null) {
+ consumer.close();
+ }
+ if (sess != null) {
+ sess.close();
+ }
+ if (conn != null) {
+ conn.close();
+ }
+ } catch (JMSException e) {
+ logger.error("Could not finalize jms connections");
+ }
+ }
+
+ }
+
+}
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/sb/JmsSenderBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/sb/JmsSenderBean.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/sb/JmsSenderBean.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/sb/JmsSenderRemote.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/sb/JmsSenderRemote.java?rev=640238&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/sb/JmsSenderRemote.java (added)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/sb/JmsSenderRemote.java Sun Mar 23 11:30:23 2008
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.jms.test.sb;
+
+import javax.ejb.Remote;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+
+/**
+ * @author <a href="mailto:tomasz[et]mazan[dot]pl">Tomasz Mazan</a>
+ */
+@Remote
+public interface JmsSenderRemote {
+
+ /**
+ * Sends request with specified <code>requestName</code> indexed with current number between 0 (inclusive) and <code>counter</code> (exclusive)
+ *
+ * @param requestName name of request
+ * @param priority message priority
+ * @param counter number of requests to send
+ * @return return confirmation code
+ */
+ String sendMessage(String requestName, int priority, int counter);
+
+ /**
+ * receives one message, returning its id
+ * @return id of message received.
+ */
+ Integer receiveMessage();
+}
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/sb/JmsSenderRemote.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/sb/JmsSenderRemote.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/sb/JmsSenderRemote.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-war/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-war/pom.xml?rev=640238&r1=640237&r2=640238&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-war/pom.xml (original)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-war/pom.xml Sun Mar 23 11:30:23 2008
@@ -61,6 +61,13 @@
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-annotation_1.0_spec</artifactId>
+ <version>1.1.1</version>
+ <scope>provided</scope>
+ </dependency>
+
</dependencies>
</project>
Modified: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-war/src/main/java/org/apache/geronimo/jms/test/simple/JMSQueueReceiver.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-war/src/main/java/org/apache/geronimo/jms/test/simple/JMSQueueReceiver.java?rev=640238&r1=640237&r2=640238&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-war/src/main/java/org/apache/geronimo/jms/test/simple/JMSQueueReceiver.java (original)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-war/src/main/java/org/apache/geronimo/jms/test/simple/JMSQueueReceiver.java Sun Mar 23 11:30:23 2008
@@ -17,34 +17,31 @@
package org.apache.geronimo.jms.test.simple;
import java.io.IOException;
+import java.io.PrintWriter;
+import javax.annotation.Resource;
import javax.jms.Message;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueReceiver;
-import javax.jms.QueueSender;
import javax.jms.QueueSession;
import javax.jms.Session;
-import javax.jms.MessageListener;
-import javax.jms.JMSException;
import javax.jms.TextMessage;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
+import javax.jms.Connection;
+import javax.jms.MessageConsumer;
import javax.servlet.Servlet;
-import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import java.io.PrintWriter;
public class JMSQueueReceiver extends HttpServlet implements Servlet {
- Context initialContext = null;
+ @Resource(name="MSConnectionFactory")
QueueConnectionFactory qcf = null;
+ @Resource(name="TestQueue")
Queue queue = null;
/* (non-Java-doc)
@@ -69,11 +66,11 @@
try {
PrintWriter out = arg1.getWriter();
- QueueConnection connection = qcf.createQueueConnection();
- connection.start();
- QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
- QueueReceiver queueReceiver = session.createReceiver(queue);
- Message msg = queueReceiver.receiveNoWait();
+ Connection conn = qcf.createConnection();
+ Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer consumer = sess.createConsumer(queue);
+ conn.start();
+ Message msg = consumer.receive(1000);
out.println("<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>");
out.println("<head><title>JMS Receiver</title></head>");
@@ -86,27 +83,11 @@
System.out.println("No Message");
out.println("<body>Did Not Receive JMS Queue Message</body></html>");
}
-
- queueReceiver.close();
- session.close();
- connection.stop();
-
+ consumer.close();
+ sess.close();
+ conn.close();
}
catch ( Exception e ) {
- e.printStackTrace();
- }
- }
-
- /* (non-Java-doc)
- * @see javax.servlet.Servlet#init(ServletConfig arg0)
- */
- public void init(ServletConfig arg0) throws ServletException {
- try {
- initialContext = new InitialContext();
- qcf = (QueueConnectionFactory) initialContext.lookup("java:comp/env/jms/QCF");
- queue = (Queue) initialContext.lookup("java:comp/env/jms/TestQ");
- }
- catch ( NamingException e ) {
e.printStackTrace();
}
}
Modified: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-war/src/main/java/org/apache/geronimo/jms/test/simple/JMSQueueSender.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-war/src/main/java/org/apache/geronimo/jms/test/simple/JMSQueueSender.java?rev=640238&r1=640237&r2=640238&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-war/src/main/java/org/apache/geronimo/jms/test/simple/JMSQueueSender.java (original)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-war/src/main/java/org/apache/geronimo/jms/test/simple/JMSQueueSender.java Sun Mar 23 11:30:23 2008
@@ -17,7 +17,9 @@
package org.apache.geronimo.jms.test.simple;
import java.io.IOException;
-import javax.jms.Message;
+import java.io.PrintWriter;
+
+import javax.annotation.Resource;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
@@ -25,21 +27,17 @@
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.jms.TextMessage;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
import javax.servlet.Servlet;
-import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import java.io.PrintWriter;
public class JMSQueueSender extends HttpServlet implements Servlet {
- Context initialContext = null;
+ @Resource(name="MSConnectionFactory")
QueueConnectionFactory qcf = null;
+ @Resource(name="TestQueue")
Queue queue = null;
/* (non-Java-doc)
@@ -65,34 +63,18 @@
PrintWriter out = arg1.getWriter();
QueueConnection connection = qcf.createQueueConnection();
connection.start();
- QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
- QueueSender queueSender = session.createSender(queue);
- TextMessage tmsg = session.createTextMessage("JMS - Test Queue Message");
+ QueueSession sess = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+ QueueSender queueSender = sess.createSender(queue);
+ TextMessage tmsg = sess.createTextMessage("JMS - Test Queue Message");
queueSender.send(tmsg);
queueSender.close();
- session.close();
+ sess.close();
connection.stop();
out.println("<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>");
out.println("<head><title>JMS Sender</title></head>");
out.println("<body>Sent JMS Queue Message</body></html>");
}
catch ( Exception e ) {
- e.printStackTrace();
- }
-
- }
-
- /* (non-Java-doc)
- * @see javax.servlet.Servlet#init(ServletConfig arg0)
- */
- public void init(ServletConfig arg0) throws ServletException {
-
- try {
- initialContext = new InitialContext();
- qcf = (QueueConnectionFactory) initialContext.lookup("java:comp/env/jms/QCF");
- queue = (Queue) initialContext.lookup("java:comp/env/jms/TestQ");
- }
- catch ( NamingException e ) {
e.printStackTrace();
}