[jboss-cvs] JBossAS SVN: r68633 - in branches/JBPAPP_4_2_0_GA_CP/ejb3/src: resources/test/mdb and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jan 4 14:13:22 EST 2008
Author: bdecoste
Date: 2008-01-04 14:13:22 -0500 (Fri, 04 Jan 2008)
New Revision: 68633
Added:
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/MismatchedQueueMDB.java
Modified:
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/mdb/MDB.java
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/mdb/MessagingContainer.java
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/mdb/mdbtest-service.xml
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/OverrideTestMDB.java
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/QueueTestMDB.java
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/TestStatus.java
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/TestStatusBean.java
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/TransactionQueueTestMDB.java
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/unit/MDBUnitTestCase.java
Log:
[JBPAPP-519] merged @PoolClass changed from Branch_4_2
Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/mdb/MDB.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/mdb/MDB.java 2008-01-04 19:03:49 UTC (rev 68632)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/mdb/MDB.java 2008-01-04 19:13:22 UTC (rev 68633)
@@ -160,20 +160,12 @@
public int getMinPoolSize()
{
- String minSession = activationSpec.get("minSession");
- if (minSession != null)
- return Integer.parseInt(minSession);
- else
- return 1;
+ return 1;
}
public int getMaxPoolSize()
{
- String maxSession = activationSpec.get("maxSession");
- if (maxSession != null)
- return Integer.parseInt(maxSession);
- else
- return 15;
+ return pool.getMaxSize();
}
public int getMaxMessages()
Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/mdb/MessagingContainer.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/mdb/MessagingContainer.java 2008-01-04 19:03:49 UTC (rev 68632)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/mdb/MessagingContainer.java 2008-01-04 19:13:22 UTC (rev 68633)
@@ -307,12 +307,6 @@
protected void initializePool() throws Exception
{
super.initializePool();
-
- String maxSession = getMaxSession();
- if (maxSession != null)
- {
- pool.setMaxSize(Integer.parseInt(maxSession));
- }
}
protected String getProviderAdapterJNDI()
Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/mdb/mdbtest-service.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/mdb/mdbtest-service.xml 2008-01-04 19:03:49 UTC (rev 68632)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/mdb/mdbtest-service.xml 2008-01-04 19:13:22 UTC (rev 68633)
@@ -82,5 +82,11 @@
<attribute name="JNDIName">queue/concurrentmdbtest</attribute>
<depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
</mbean>
+
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.mq.destination:service=Queue,name=mismatchedqueuetest">
+ <attribute name="JNDIName">queue/mismatchedmdbtest</attribute>
+ <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+ </mbean>
</server>
Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/MismatchedQueueMDB.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/MismatchedQueueMDB.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/MismatchedQueueMDB.java 2008-01-04 19:13:22 UTC (rev 68633)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.ejb3.test.mdb;
+
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.TextMessage;
+
+import org.jboss.annotation.ejb.PoolClass;
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+ at MessageDriven(activationConfig =
+ {
+ @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
+ @ActivationConfigProperty(propertyName="destination", propertyValue="queue/mismatchedmdbtest"),
+ @ActivationConfigProperty(propertyName="maxSession", propertyValue="100")
+ })
+ at PoolClass(value=org.jboss.ejb3.StrictMaxPool.class, maxSize=1, timeout=10000)
+public class MismatchedQueueMDB
+implements MessageListener
+{
+ private static final Logger log = Logger.getLogger(MismatchedQueueMDB.class);
+
+ private int count = 0;
+
+ public void onMessage(Message recvMsg)
+ {
+ ++TestStatusBean.mismatchedQueueRan;
+ ++count;
+
+ try
+ {
+ System.out.println("+++ MismatchedQueueMDB onMessage " + TestStatusBean.mismatchedQueueRan + " " + count + " " + ((TextMessage)recvMsg).getText());
+ }
+ catch (Exception e){}
+ }
+}
Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/OverrideTestMDB.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/OverrideTestMDB.java 2008-01-04 19:03:49 UTC (rev 68632)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/OverrideTestMDB.java 2008-01-04 19:13:22 UTC (rev 68633)
@@ -28,6 +28,7 @@
import javax.jms.MessageListener;
import javax.annotation.Resource;
+import org.jboss.annotation.ejb.PoolClass;
import org.jboss.logging.Logger;
/**
@@ -39,6 +40,7 @@
@ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Bogus"),
@ActivationConfigProperty(propertyName="destination", propertyValue="queue/bogus")
})
+ at PoolClass(value=org.jboss.ejb3.StrictMaxPool.class, maxSize=100, timeout=10000)
public class OverrideTestMDB implements MessageListener
{
private static final Logger log = Logger.getLogger(OverrideTestMDB.class);
Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/QueueTestMDB.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/QueueTestMDB.java 2008-01-04 19:03:49 UTC (rev 68632)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/QueueTestMDB.java 2008-01-04 19:13:22 UTC (rev 68633)
@@ -36,6 +36,7 @@
import javax.annotation.security.RunAs;
+import org.jboss.annotation.ejb.PoolClass;
import org.jboss.annotation.security.SecurityDomain;
import org.jboss.logging.Logger;
@@ -51,6 +52,7 @@
@ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
@ActivationConfigProperty(propertyName="destination", propertyValue="queue/mdbtest")
})
+ at PoolClass(value=org.jboss.ejb3.StrictMaxPool.class, maxSize=1, timeout=10000)
@RunAs("TestRole")
@SecurityDomain("other")
public class QueueTestMDB
Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/TestStatus.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/TestStatus.java 2008-01-04 19:03:49 UTC (rev 68632)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/TestStatus.java 2008-01-04 19:13:22 UTC (rev 68633)
@@ -36,6 +36,8 @@
int queueFired();
+ int mismatchedQueueFired();
+
int concurrentQueueFired();
int overrideQueueFired();
Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/TestStatusBean.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/TestStatusBean.java 2008-01-04 19:03:49 UTC (rev 68632)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/TestStatusBean.java 2008-01-04 19:13:22 UTC (rev 68633)
@@ -40,6 +40,7 @@
private static final Logger log = Logger.getLogger(TestStatusBean.class);
public static int queueRan = 0;
+ public static int mismatchedQueueRan = 0;
public static int concurrentQueueRan = 0;
public static int overrideQueueRan = 0;
public static int defaultedQueueRan = 0;
@@ -60,6 +61,7 @@
public void clear()
{
queueRan = 0;
+ mismatchedQueueRan = 0;
concurrentQueueRan = 0;
topicRan = 0;
bmtQueueRan = 0;
@@ -82,6 +84,11 @@
return queueRan;
}
+ public int mismatchedQueueFired()
+ {
+ return mismatchedQueueRan;
+ }
+
public int concurrentQueueFired()
{
return concurrentQueueRan;
Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/TransactionQueueTestMDB.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/TransactionQueueTestMDB.java 2008-01-04 19:03:49 UTC (rev 68632)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/TransactionQueueTestMDB.java 2008-01-04 19:13:22 UTC (rev 68633)
@@ -34,6 +34,7 @@
import javax.annotation.security.RunAs;
import javax.annotation.Resource;
+import org.jboss.annotation.ejb.PoolClass;
import org.jboss.annotation.ejb.TransactionTimeout;
import org.jboss.annotation.security.SecurityDomain;
import org.jboss.logging.Logger;
@@ -52,6 +53,7 @@
// Wolf: this is NOT supported, use the proper activation config property
//@TransactionTimeout(1)
@TransactionAttribute(TransactionAttributeType.REQUIRED)
+ at PoolClass(value=org.jboss.ejb3.StrictMaxPool.class, maxSize=1, timeout=10000)
public class TransactionQueueTestMDB implements MessageListener
{
private static final Logger log = Logger.getLogger(TransactionQueueTestMDB.class);
Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/unit/MDBUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/unit/MDBUnitTestCase.java 2008-01-04 19:03:49 UTC (rev 68632)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/mdb/unit/MDBUnitTestCase.java 2008-01-04 19:13:22 UTC (rev 68633)
@@ -243,7 +243,34 @@
String state = stateless.getState();
assertEquals("Set", state);
}
+
+ public void testMismatchedMDB() throws Exception
+ {
+ TestStatus status = (TestStatus) getInitialContext().lookup(
+ "TestStatusBean/remote");
+ clear(status);
+ QueueConnection cnn = null;
+ QueueSender sender = null;
+ QueueSession session = null;
+ Queue queue = (Queue) getInitialContext().lookup("queue/mismatchedmdbtest");
+ QueueConnectionFactory factory = getQueueConnectionFactory();
+ cnn = factory.createQueueConnection();
+ session = cnn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+
+ sender = session.createSender(queue);
+ for (int i = 0; i < 100 ; ++i)
+ {
+ TextMessage msg = session.createTextMessage("Hello World " + i);
+ sender.send(msg);
+ }
+ session.close();
+ cnn.close();
+
+ Thread.sleep(5000);
+ assertEquals(100, status.mismatchedQueueFired());
+ }
+
public void testTopic() throws Exception
{
TestStatus status = (TestStatus) getInitialContext().lookup(
More information about the jboss-cvs-commits
mailing list