[jboss-cvs] JBoss Messaging SVN: r3382 - in branches/Branch_MC_Integration_New: src/etc/server/default/deploy and 39 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Nov 28 14:18:56 EST 2007
Author: ataylor
Date: 2007-11-28 14:18:54 -0500 (Wed, 28 Nov 2007)
New Revision: 3382
Added:
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/admin/
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/admin/JmsServerInvocationHandler.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/admin/JmsServerStatisticsInvocationHandler.java
branches/Branch_MC_Integration_New/tests/etc/database-clearer.xml
branches/Branch_MC_Integration_New/tests/etc/datasource.xml
branches/Branch_MC_Integration_New/tests/etc/invm-beans.xml
branches/Branch_MC_Integration_New/tests/etc/persistencemanager.xml
branches/Branch_MC_Integration_New/tests/etc/remote.xml
branches/Branch_MC_Integration_New/tests/etc/transaction-manager.xml
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/JBMBaseTestCase.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/JBMServerTestCase.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/ConfigurationHelper.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/DatabaseClearer.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/JBMPropertyKernelConfig.java
Removed:
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/HTTPTransportTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/util/ServiceContainerTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/ClientInvokerTimeoutTest.java
Modified:
branches/Branch_MC_Integration_New/build-thirdparty.xml
branches/Branch_MC_Integration_New/src/etc/server/default/deploy/jbm-beans.xml
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/FailoverCommandCenter.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/container/ClientConsumer.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/container/ConsumerAspect.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/container/SessionAspect.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/delegate/ConnectionDelegate.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/message/JBossMessage.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/Configuration.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/JmsServer.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/ServerPeer.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/ServerPeerStatistics.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/bridge/Bridge.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/bridge/BridgeService.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryDeployer.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/connectionmanager/SimpleConnectionManager.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/destination/DestinationDeployer.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/destination/ManagedDestination.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/messagecounter/MessageCounterManager.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/microcontainer/JBMBootstrapServer.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/microcontainer/JndiBinder.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/microcontainer/NonSerializableFactory.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/security/SecurityMetadata.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/security/SecurityMetadataStore.java
branches/Branch_MC_Integration_New/src/main/org/jboss/jms/tx/MessagingXAResource.java
branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/ChannelSupport.java
branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/FailoverWaiter.java
branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java
branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/MessagingQueue.java
branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/clusterconnection/ClusterConnectionManager.java
branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/clusterconnection/MessageSucker.java
branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/postoffice/GroupMember.java
branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/tx/TransactionRepository.java
branches/Branch_MC_Integration_New/tests/build.sh
branches/Branch_MC_Integration_New/tests/build.xml
branches/Branch_MC_Integration_New/tests/etc/log4j.info.xml
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/DropTablesTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/NonRecoverableMessagingQueueTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/RecoverableMessagingQueueTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/RoundRobinDistributorTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_2PCTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_NTTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_TTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_2PCTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_NTTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_TTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_2PCTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_NTTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_TTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_2PCTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_NTTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_TTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/postoffice/ClusteredPostOfficeTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/postoffice/PostOfficeTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/AOPStackInitializationTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/AcknowledgementTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/BrowserTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ClientInRestrictedSecurityEnvironmentTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ConnectionConsumerTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ConnectionTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ConsumerClosedTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/DLQTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/DurableSubscriptionTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ExpiryQueueTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/GracefulClient.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/JMSTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/MemLeakTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/MessageCleanupTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/PersistenceTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/QueueTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ScheduledDeliveryTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/SecurityTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/SessionTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/TransactedSessionTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/XAResourceRecoveryTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/XATest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/bridge/BridgeMBeanTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/bridge/ReconnectTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/bridge/ReconnectWithRecoveryTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/ChangeFailoverNodeTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/ClusterConnectionManagerTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/ClusterViewUpdateTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/DisableLoadBalancingAndFailoverTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/DistributedQueueTestBase.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/DistributedTopicTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/GroupManagementTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/LargeClusterTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/LoadBalancingTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/MergeQueueTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/MultiThreadFailoverTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/MultipleFailoverTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/NoFailoverTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/RecoverDeliveriesTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/XAFailoverTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/manual/FailoverTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/message/JMSExpirationHeaderTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/message/JMSReplyToHeaderTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/message/ObjectMessageTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/message/StreamMessageTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/message/TextMessageTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/server/connectionfactory/ConnectionFactoryTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/server/connectionmanager/SimpleConnectionManagerTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/stress/ConcurrentCloseStressTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/stress/CorruptMessageStressTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/stress/ManyConnectionsStressTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/stress/OpenCloseStressTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/stress/RelayStressTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/stress/SeveralClientsStressTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/TestJMSProviderAdaptor.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/Example.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/InVMContext.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/MBeanServerBuilder.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/MockJBossSecurityManager.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/NoopInvoker.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/RemoteInitialContextFactory.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/RemoteTestServer.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/StopRMIServer.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/util/JNDIUtilTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/CallbackServerTimeoutTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/InvokerReferenceCountTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/PureAsynchronousCallTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/RemotingTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/SocketTransportCausalityTest.java
branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/util/RemotingTestSubsystemService.java
Log:
new test framework
Modified: branches/Branch_MC_Integration_New/build-thirdparty.xml
===================================================================
--- branches/Branch_MC_Integration_New/build-thirdparty.xml 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/build-thirdparty.xml 2007-11-28 19:18:54 UTC (rev 3382)
@@ -121,7 +121,7 @@
<componentref name="jboss/test14" version="1.0.0.GA"/>
<!-- This is a non declared dependency of jboss/test14 -->
- <!--<componentref name="jboss/jbossretro-rt" version="1.0.5.GA"/>-->
+ <componentref name="jboss/jboss-retro" version="1.1.2"/>
<!-- This is a non declared dependency of jboss/test14 -->
<componentref name="jboss/backport-concurrent" version="2.1.0.GA"/>
Modified: branches/Branch_MC_Integration_New/src/etc/server/default/deploy/jbm-beans.xml
===================================================================
--- branches/Branch_MC_Integration_New/src/etc/server/default/deploy/jbm-beans.xml 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/etc/server/default/deploy/jbm-beans.xml 2007-11-28 19:18:54 UTC (rev 3382)
@@ -3,13 +3,19 @@
<deployment xmlns="urn:jboss:bean-deployer:2.0">
<bean name="Configuration" class="org.jboss.jms.server.Configuration"/>
-
+
<bean name="ServiceLocator" class="org.jboss.jms.server.microcontainer.ServiceLocator">
<demand>jboss.jca:name=DefaultDS,service=DataSourceBinding</demand>
<depends>jboss:service=TransactionManager</depends>
<!-- <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>-->
</bean>
+ <bean name="ServerPeerStatistics" class="org.jboss.jms.server.ServerPeerStatistics">
+ <property name="serverPeer">
+ <inject bean="ServerPeer"/>
+ </property>
+ </bean>
+
<bean name="ServerPeer" class="org.jboss.jms.server.ServerPeer">
<depends>Remoting</depends>
<property name="persistenceManager">
@@ -32,7 +38,7 @@
</property>
</bean>
-
+
<bean name="PersistenceManager" class="org.jboss.messaging.core.impl.JDBCPersistenceManager">
<property name="tm">
<inject bean="ServiceLocator" property="transactionManager"/>
@@ -42,6 +48,233 @@
</property>
<property name="createTablesOnStartup">true</property>
<property name="maxParams">500</property>
+ <property name="sqlProperties">
+ <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
+ <entry>
+ <key>CREATE_DUAL</key>
+ <value>CREATE TABLE JBM_DUAL (DUMMY INTEGER, PRIMARY KEY (DUMMY)) ENGINE = INNODB</value>
+ </entry>
+ <entry>
+ <key>CREATE_MESSAGE_REFERENCE</key>
+ <value>CREATE TABLE JBM_MSG_REF (CHANNEL_ID BIGINT, MESSAGE_ID BIGINT, TRANSACTION_ID BIGINT, STATE
+ CHAR(1), ORD BIGINT, PAGE_ORD BIGINT, DELIVERY_COUNT INTEGER, SCHED_DELIVERY BIGINT, PRIMARY
+ KEY(CHANNEL_ID, MESSAGE_ID)) ENGINE = INNODB
+ </value>
+ </entry>
+ <entry>
+ <key>CREATE_IDX_MESSAGE_REF_TX</key>
+ <value>CREATE INDEX JBM_MSG_REF_TX ON JBM_MSG_REF (TRANSACTION_ID)</value>
+ </entry>
+ <entry>
+ <key>CREATE_IDX_MESSAGE_REF_ORD</key>
+ <value>CREATE INDEX JBM_MSG_REF_ORD ON JBM_MSG_REF (ORD)</value>
+ </entry>
+ <entry>
+ <key>CREATE_IDX_MESSAGE_REF_PAGE_ORD</key>
+ <value>CREATE INDEX JBM_MSG_REF_PAGE_ORD ON JBM_MSG_REF (PAGE_ORD)</value>
+ </entry>
+ <entry>
+ <key>CREATE_IDX_MESSAGE_REF_MESSAGE_ID</key>
+ <value>CREATE INDEX JBM_MSG_REF_MESSAGE_ID ON JBM_MSG_REF (MESSAGE_ID)</value>
+ </entry>
+ <entry>
+ <key>CREATE_IDX_MESSAGE_REF_SCHED_DELIVERY</key>
+ <value>CREATE INDEX JBM_MSG_REF_SCHED_DELIVERY ON JBM_MSG_REF (SCHED_DELIVERY)</value>
+ </entry>
+ <entry>
+ <key>CREATE_MESSAGE</key>
+ <value>CREATE TABLE JBM_MSG (MESSAGE_ID BIGINT, RELIABLE CHAR(1), EXPIRATION BIGINT, TIMESTAMP BIGINT,
+ PRIORITY TINYINT, TYPE TINYINT, HEADERS MEDIUMBLOB, PAYLOAD LONGBLOB, PRIMARY KEY (MESSAGE_ID)) ENGINE
+ = INNODB
+ </value>
+ </entry>
+ <entry>
+ <key>CREATE_TRANSACTION</key>
+ <value>CREATE TABLE JBM_TX (NODE_ID INTEGER, TRANSACTION_ID BIGINT, BRANCH_QUAL VARBINARY(254), FORMAT_ID
+ INTEGER, GLOBAL_TXID VARBINARY(254), PRIMARY KEY (TRANSACTION_ID)) ENGINE = INNODB
+ </value>
+ </entry>
+ <entry>
+ <key>CREATE_COUNTER</key>
+ <value>CREATE TABLE JBM_COUNTER (NAME VARCHAR(255), NEXT_ID BIGINT, PRIMARY KEY(NAME)) ENGINE = INNODB
+ </value>
+ </entry>
+ <entry>
+ <key>INSERT_DUAL</key>
+ <value>INSERT INTO JBM_DUAL VALUES (1)</value>
+ </entry>
+ <entry>
+ <key>CHECK_DUAL</key>
+ <value>SELECT 1 FROM JBM_DUAL</value>
+ </entry>
+ <entry>
+ <key>INSERT_MESSAGE_REF</key>
+ <value>INSERT INTO JBM_MSG_REF (CHANNEL_ID, MESSAGE_ID, TRANSACTION_ID, STATE, ORD, PAGE_ORD,
+ DELIVERY_COUNT, SCHED_DELIVERY) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+ </value>
+ </entry>
+ <entry>
+ <key>DELETE_MESSAGE_REF</key>
+ <value>DELETE FROM JBM_MSG_REF WHERE MESSAGE_ID=? AND CHANNEL_ID=? AND STATE='C'</value>
+ </entry>
+ <entry>
+ <key>UPDATE_MESSAGE_REF</key>
+ <value>UPDATE JBM_MSG_REF SET TRANSACTION_ID=?, STATE='-' WHERE MESSAGE_ID=? AND CHANNEL_ID=? AND
+ STATE='C'
+ </value>
+ </entry>
+ <entry>
+ <key>UPDATE_PAGE_ORDER</key>
+ <value>UPDATE JBM_MSG_REF SET PAGE_ORD = ? WHERE MESSAGE_ID=? AND CHANNEL_ID=?</value>
+ </entry>
+ <entry>
+ <key>COMMIT_MESSAGE_REF1</key>
+ <value>UPDATE JBM_MSG_REF SET STATE='C', TRANSACTION_ID = NULL WHERE TRANSACTION_ID=? AND STATE='+'
+ </value>
+ </entry>
+ <entry>
+ <key>COMMIT_MESSAGE_REF2</key>
+ <value>DELETE FROM JBM_MSG_REF WHERE TRANSACTION_ID=? AND STATE='-'</value>
+ </entry>
+ <entry>
+ <key>ROLLBACK_MESSAGE_REF1</key>
+ <value>DELETE FROM JBM_MSG_REF WHERE TRANSACTION_ID=? AND STATE='+'</value>
+ </entry>
+ <entry>
+ <key>ROLLBACK_MESSAGE_REF2</key>
+ <value>UPDATE JBM_MSG_REF SET STATE='C', TRANSACTION_ID = NULL WHERE TRANSACTION_ID=? AND STATE='-'
+ </value>
+ </entry>
+ <entry>
+ <key>LOAD_PAGED_REFS</key>
+ <value>SELECT MESSAGE_ID, DELIVERY_COUNT, PAGE_ORD, SCHED_DELIVERY FROM JBM_MSG_REF WHERE CHANNEL_ID = ?
+ AND PAGE_ORD BETWEEN ? AND ? ORDER BY PAGE_ORD
+ </value>
+ </entry>
+ <entry>
+ <key>LOAD_UNPAGED_REFS</key>
+ <value>SELECT MESSAGE_ID, DELIVERY_COUNT, SCHED_DELIVERY FROM JBM_MSG_REF WHERE STATE = 'C' AND
+ CHANNEL_ID = ? AND PAGE_ORD IS NULL ORDER BY ORD
+ </value>
+ </entry>
+ <entry>
+ <key>LOAD_REFS</key>
+ <value>SELECT MESSAGE_ID, DELIVERY_COUNT, SCHED_DELIVERY FROM JBM_MSG_REF WHERE STATE = 'C' AND
+ CHANNEL_ID = ? ORDER BY ORD
+ </value>
+ </entry>
+ <entry>
+ <key>UPDATE_REFS_NOT_PAGED</key>
+ <value>UPDATE JBM_MSG_REF SET PAGE_ORD = NULL WHERE PAGE_ORD BETWEEN ? AND ? AND CHANNEL_ID=?</value>
+ </entry>
+ <entry>
+ <key>SELECT_MIN_MAX_PAGE_ORD</key>
+ <value>SELECT MIN(PAGE_ORD), MAX(PAGE_ORD) FROM JBM_MSG_REF WHERE CHANNEL_ID = ?</value>
+ </entry>
+ <entry>
+ <key>SELECT_EXISTS_REF_MESSAGE_ID</key>
+ <value>SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE MESSAGE_ID = ?</value>
+ </entry>
+ <entry>
+ <key>UPDATE_DELIVERY_COUNT</key>
+ <value>UPDATE JBM_MSG_REF SET DELIVERY_COUNT = ? WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?</value>
+ </entry>
+ <entry>
+ <key>UPDATE_CHANNEL_ID</key>
+ <value>UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE CHANNEL_ID = ?</value>
+ </entry>
+ <entry>
+ <key>MOVE_REFERENCE</key>
+ <value>UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?</value>
+ </entry>
+ <entry>
+ <key>LOAD_MESSAGES</key>
+ <value>SELECT MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, TYPE FROM JBM_MSG
+ </value>
+ </entry>
+ <entry>
+ <key>INSERT_MESSAGE</key>
+ <value>INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, TYPE, HEADERS,
+ PAYLOAD) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+ </value>
+ </entry>
+ <entry>
+ <key>INSERT_MESSAGE_CONDITIONAL</key>
+ <value>INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, TYPE) SELECT ?, ?, ?,
+ ?, ?, ? FROM JBM_DUAL WHERE NOT EXISTS (SELECT MESSAGE_ID FROM JBM_MSG WHERE MESSAGE_ID = ?)
+ </value>
+ </entry>
+ <entry>
+ <key>UPDATE_MESSAGE_4CONDITIONAL</key>
+ <value>UPDATE JBM_MSG SET HEADERS=?, PAYLOAD=? WHERE MESSAGE_ID=?</value>
+ </entry>
+ <entry>
+ <key>INSERT_MESSAGE_CONDITIONAL_FULL</key>
+ <value>INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, TYPE, HEADERS,
+ PAYLOAD) SELECT ?, ?, ?, ?, ?, ?, ?, ? FROM JBM_DUAL WHERE NOT EXISTS (SELECT MESSAGE_ID FROM JBM_MSG
+ WHERE MESSAGE_ID = ?)
+ </value>
+ </entry>
+ <entry>
+ <key>MESSAGE_ID_COLUMN</key>
+ <value>
+ MESSAGE_ID
+ </value>
+ </entry>
+ <entry>
+ <key>DELETE_MESSAGE</key>
+ <value>DELETE FROM JBM_MSG WHERE MESSAGE_ID = ? AND NOT EXISTS (SELECT * FROM JBM_MSG_REF WHERE
+ JBM_MSG_REF.MESSAGE_ID = ?)
+ </value>
+ </entry>
+ <entry>
+ <key>INSERT_TRANSACTION</key>
+ <value>INSERT INTO JBM_TX (NODE_ID, TRANSACTION_ID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID) VALUES(?, ?, ?,
+ ?, ?)
+ </value>
+ </entry>
+ <entry>
+ <key>DELETE_TRANSACTION</key>
+ <value>DELETE FROM JBM_TX WHERE NODE_ID = ? AND TRANSACTION_ID = ?</value>
+ </entry>
+ <entry>
+ <key>SELECT_PREPARED_TRANSACTIONS</key>
+ <value>SELECT TRANSACTION_ID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID FROM JBM_TX WHERE NODE_ID = ?</value>
+ </entry>
+ <entry>
+ <key>SELECT_MESSAGE_ID_FOR_REF</key>
+ <value>SELECT MESSAGE_ID, CHANNEL_ID FROM JBM_MSG_REF WHERE TRANSACTION_ID = ? AND STATE = '+' ORDER BY
+ ORD
+ </value>
+ </entry>
+ <entry>
+ <key>SELECT_MESSAGE_ID_FOR_ACK</key>
+ <value>SELECT MESSAGE_ID, CHANNEL_ID FROM JBM_MSG_REF WHERE TRANSACTION_ID = ? AND STATE = '-' ORDER BY
+ ORD
+ </value>
+ </entry>
+ <entry>
+ <key>UPDATE_COUNTER</key>
+ <value>UPDATE JBM_COUNTER SET NEXT_ID = ? WHERE NAME=?</value>
+ </entry>
+ <entry>
+ <key>SELECT_COUNTER</key>
+ <value>SELECT NEXT_ID FROM JBM_COUNTER WHERE NAME=? FOR UPDATE</value>
+ </entry>
+ <entry>
+ <key>INSERT_COUNTER</key>
+ <value>INSERT INTO JBM_COUNTER (NAME, NEXT_ID) VALUES (?, ?)</value>
+ </entry>
+ <entry>
+ <key>SELECT_ALL_CHANNELS</key>
+ <value>SELECT DISTINCT(CHANNEL_ID) FROM JBM_MSG_REF</value>
+ </entry>
+ <entry>
+ <key>UPDATE_TX</key>
+ <value>UPDATE JBM_TX SET NODE_ID=? WHERE NODE_ID=?</value>
+ </entry>
+ </map>
+ </property>
</bean>
<bean name="JMSUserManager" class="org.jboss.jms.server.plugin.JDBCJMSUserManager">
@@ -79,7 +312,9 @@
<property name="configuration">
<inject bean="Configuration"/>
</property>
- <property name="channelFactory"><inject bean="JChannelFactory"/></property>
+ <property name="channelFactory">
+ <inject bean="JChannelFactory"/>
+ </property>
<property name="createTablesOnStartup">true</property>
<property name="sqlProperties">
@@ -130,8 +365,10 @@
<constructor>
<parameter>bisocket</parameter>
<parameter>localhost</parameter>
- <parameter><inject bean="Configuration" property="remotingBindAddress"/> </parameter>
<parameter>
+ <inject bean="Configuration" property="remotingBindAddress"/>
+ </parameter>
+ <parameter>
<null/>
</parameter>
<parameter class="java.util.Map">
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/FailoverCommandCenter.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/FailoverCommandCenter.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/FailoverCommandCenter.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -6,10 +6,6 @@
*/
package org.jboss.jms.client;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
import org.jboss.jms.client.delegate.ClientConnectionDelegate;
import org.jboss.jms.client.remoting.JMSRemotingConnection;
import org.jboss.jms.client.state.ConnectionState;
@@ -17,6 +13,10 @@
import org.jboss.jms.delegate.CreateConnectionResult;
import org.jboss.logging.Logger;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
/**
* The class in charge with performing the failover.
*
@@ -146,11 +146,11 @@
log.trace("Synchronized state");
//Now restart the connection if appropriate
- //Note! we mus start the connection while the valve is still closed
+ //Note! we mus startServerPeer the connection while the valve is still closed
//Otherwise If a consumer closing is waiting on failover to complete
//Then on failover complete the valve will be opened and closing retried on a
//different thread
- //but the next line will re-start the connection so there is a race between the two
+ //but the next line will re-startServerPeer the connection so there is a race between the two
//If the restart hits after closing then messages can get delivered after consumer
//is closed
Added: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/admin/JmsServerInvocationHandler.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/admin/JmsServerInvocationHandler.java (rev 0)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/admin/JmsServerInvocationHandler.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jms.client.admin;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+
+/**
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public class JmsServerInvocationHandler implements InvocationHandler
+{
+ private MBeanServerConnection mBeanServer;
+ private InitialContext initialContext;
+
+ public JmsServerInvocationHandler(InitialContext initialContext)
+ {
+ this.initialContext = initialContext;
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+ {
+ if (mBeanServer == null)
+ {
+ mBeanServer = (MBeanServerConnection) initialContext.lookup("jmx/invoker/RMIAdaptor");
+ }
+ String[] types = null;
+ if (args != null)
+ {
+ types = new String[args.length];
+ for (int i = 0; i < types.length; i++)
+ {
+ types[i] = args[i].getClass().getName();
+ }
+ }
+
+ ObjectName serverObjectName = new ObjectName("jboss.messaging:service=ServerPeer");
+ String methodName = method.getName();
+ if (methodName.startsWith("get"))
+ {
+ methodName = methodName.substring(3);
+ return mBeanServer.getAttribute(serverObjectName, methodName);
+ }
+ return mBeanServer.invoke(serverObjectName, methodName,
+ args,
+ types);
+ }
+}
Added: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/admin/JmsServerStatisticsInvocationHandler.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/admin/JmsServerStatisticsInvocationHandler.java (rev 0)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/admin/JmsServerStatisticsInvocationHandler.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jms.client.admin;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+
+/**
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public class JmsServerStatisticsInvocationHandler implements InvocationHandler
+{
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+}
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/container/ClientConsumer.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/container/ClientConsumer.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/container/ClientConsumer.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,20 +21,8 @@
*/
package org.jboss.jms.client.container;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.jms.IllegalStateException;
-import javax.jms.JMSException;
-import javax.jms.MessageListener;
-import javax.jms.Session;
-
-import org.jboss.jms.delegate.Cancel;
-import org.jboss.jms.delegate.ConsumerDelegate;
-import org.jboss.jms.delegate.DefaultCancel;
-import org.jboss.jms.delegate.DeliveryInfo;
-import org.jboss.jms.delegate.SessionDelegate;
+import EDU.oswego.cs.dl.util.concurrent.QueuedExecutor;
+import org.jboss.jms.delegate.*;
import org.jboss.jms.message.MessageProxy;
import org.jboss.logging.Logger;
import org.jboss.messaging.core.contract.Message;
@@ -42,7 +30,13 @@
import org.jboss.messaging.util.prioritylinkedlist.BasicPriorityLinkedList;
import org.jboss.messaging.util.prioritylinkedlist.PriorityLinkedList;
-import EDU.oswego.cs.dl.util.concurrent.QueuedExecutor;
+import javax.jms.IllegalStateException;
+import javax.jms.JMSException;
+import javax.jms.MessageListener;
+import javax.jms.Session;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
@@ -637,7 +631,7 @@
if (serverSending && size >= maxBufferSize)
{
- //Our buffer is full - we need to tell the server to stop sending if we haven't
+ //Our buffer is full - we need to tell the server to stopServerPeer sending if we haven't
//done so already
sendChangeRateMessage(0f);
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/container/ConsumerAspect.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/container/ConsumerAspect.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/container/ConsumerAspect.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,8 +21,7 @@
*/
package org.jboss.jms.client.container;
-import javax.jms.MessageListener;
-
+import EDU.oswego.cs.dl.util.concurrent.QueuedExecutor;
import org.jboss.aop.joinpoint.Invocation;
import org.jboss.aop.joinpoint.MethodInvocation;
import org.jboss.jms.client.delegate.DelegateSupport;
@@ -37,7 +36,7 @@
import org.jboss.logging.Logger;
import org.jboss.messaging.util.MessageQueueNameHelper;
-import EDU.oswego.cs.dl.util.concurrent.QueuedExecutor;
+import javax.jms.MessageListener;
/**
*
@@ -58,7 +57,7 @@
private static final Logger log = Logger.getLogger(ConsumerAspect.class);
- // Static ---------------------------------------------------------------------------------------
+ // Static ----------------------------------------------------------------------------------------
// Attributes -----------------------------------------------------------------------------------
@@ -205,7 +204,7 @@
return null;
}
- public MessageListener handleGetMessageListener(Invocation invocation) throws Throwable
+ public Object handleGetMessageListener(Invocation invocation) throws Throwable
{
return getClientConsumer(invocation).getMessageListener();
}
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/container/SessionAspect.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/container/SessionAspect.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/container/SessionAspect.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,19 +21,6 @@
*/
package org.jboss.jms.client.container;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.jms.IllegalStateException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.ServerSessionPool;
-import javax.jms.Session;
-import javax.jms.TransactionInProgressException;
-
import org.jboss.aop.joinpoint.Invocation;
import org.jboss.aop.joinpoint.MethodInvocation;
import org.jboss.jms.client.JBossConnectionConsumer;
@@ -46,22 +33,19 @@
import org.jboss.jms.delegate.DeliveryInfo;
import org.jboss.jms.delegate.SessionDelegate;
import org.jboss.jms.destination.JBossDestination;
-import org.jboss.jms.message.BytesMessageProxy;
-import org.jboss.jms.message.JBossBytesMessage;
-import org.jboss.jms.message.JBossMapMessage;
-import org.jboss.jms.message.JBossMessage;
-import org.jboss.jms.message.JBossObjectMessage;
-import org.jboss.jms.message.JBossStreamMessage;
-import org.jboss.jms.message.JBossTextMessage;
-import org.jboss.jms.message.MapMessageProxy;
-import org.jboss.jms.message.MessageProxy;
-import org.jboss.jms.message.ObjectMessageProxy;
-import org.jboss.jms.message.StreamMessageProxy;
-import org.jboss.jms.message.TextMessageProxy;
+import org.jboss.jms.message.*;
import org.jboss.jms.tx.LocalTx;
import org.jboss.jms.tx.ResourceManager;
import org.jboss.logging.Logger;
+import javax.jms.IllegalStateException;
+import javax.jms.*;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
/**
* This aspect handles JMS session related logic
*
@@ -466,7 +450,7 @@
*
* 1) When session.recover() is called (JMS1.1 4.4.11)
*
- * "A session's recover method is used to stop a session and restart it with its first
+ * "A session's recover method is used to stopServerPeer a session and restart it with its first
* unacknowledged message. In effect, the session's series of delivered messages is reset to the
* point after its last acknowledged message."
*
@@ -591,7 +575,7 @@
}
finally
{
- // start new local tx
+ // startServerPeer new local tx
Object xid = rm.createLocalTx();
state.setCurrentTxId(xid);
}
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,11 +21,6 @@
*/
package org.jboss.jms.client.remoting;
-import java.security.AccessController;
-import java.security.PrivilegedExceptionAction;
-import java.util.HashMap;
-import java.util.Map;
-
import org.jboss.jms.server.ServerPeer;
import org.jboss.jms.wireformat.JMSWireFormat;
import org.jboss.logging.Logger;
@@ -41,6 +36,10 @@
import org.jboss.remoting.transport.socket.SocketServerInvoker;
import org.jboss.util.id.GUID;
+import java.security.AccessController;
+import java.security.PrivilegedExceptionAction;
+import java.util.HashMap;
+import java.util.Map;
/**
@@ -316,7 +315,7 @@
public void stop()
{
- log.trace(this + " stop");
+ log.trace(this + " stopServerPeer");
// explicitly remove the callback listener, to avoid race conditions on server
// (http://jira.jboss.org/jira/browse/JBMESSAGING-535)
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/delegate/ConnectionDelegate.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/delegate/ConnectionDelegate.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/delegate/ConnectionDelegate.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,15 +21,11 @@
*/
package org.jboss.jms.delegate;
-import javax.jms.ConnectionMetaData;
-import javax.jms.Destination;
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.ServerSessionPool;
-
import org.jboss.jms.client.FailoverListener;
import org.jboss.jms.client.JBossConnectionConsumer;
+import javax.jms.*;
+
/**
* Represents the minimal set of operations to provide connection functionality.
* Some of the methods may be implemented on the server, others will be handled in the advice stack.
@@ -58,7 +54,7 @@
boolean unregisterFailoverListener(FailoverListener failoverListener);
- //Special start method that doesn't get intercepted to allow connection to be restarted
+ //Special startServerPeer method that doesn't get intercepted to allow connection to be restarted
//after failover when the valve is still held
void startAfterFailover() throws JMSException;
}
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/message/JBossMessage.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/message/JBossMessage.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/message/JBossMessage.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,27 +21,6 @@
*/
package org.jboss.jms.message;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.jms.BytesMessage;
-import javax.jms.DeliveryMode;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.MapMessage;
-import javax.jms.Message;
-import javax.jms.MessageFormatException;
-import javax.jms.ObjectMessage;
-import javax.jms.StreamMessage;
-import javax.jms.TextMessage;
-
import org.jboss.jms.destination.JBossDestination;
import org.jboss.jms.exception.MessagingJMSException;
import org.jboss.logging.Logger;
@@ -49,6 +28,12 @@
import org.jboss.util.Primitives;
import org.jboss.util.Strings;
+import javax.jms.*;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.Serializable;
+import java.util.*;
+
/**
*
* Implementation of a JMS Message
@@ -397,7 +382,7 @@
{
if (jmsMessageID != null && !jmsMessageID.startsWith("ID:"))
{
- throw new JMSException("JMSMessageID must start with ID:");
+ throw new JMSException("JMSMessageID must startServerPeer with ID:");
}
if (jmsMessageID == null)
{
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/Configuration.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/Configuration.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/Configuration.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -28,13 +28,14 @@
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
+import java.io.Serializable;
import java.net.URL;
import java.util.HashSet;
/**
* @author <a href="ataylor at redhat.com">Andy Taylor</a>
*/
-public class Configuration
+public class Configuration implements Serializable
{
private static final String READ_ATTR = "read";
private static final String WRITE_ATTR = "write";
@@ -120,7 +121,7 @@
_defaultExpiryQueue = getString(e, "default-expiry-queue", _defaultExpiryQueue);
_defaultRedeliveryDelay = getLong(e, "default-redelivery-delay", _defaultRedeliveryDelay);
_messageCounterSamplePeriod = getLong(e, "message-counter-sample-period", _messageCounterSamplePeriod);
- _failoverStartTimeout = getLong(e, "failover-start-timeout", _failoverStartTimeout);
+ _failoverStartTimeout = getLong(e, "failover-startServerPeer-timeout", _failoverStartTimeout);
_failoverCompleteTimeout = getLong(e, "failover-complete-timeout", _failoverCompleteTimeout);
_defaultMessageCounterHistoryDayLimit = getInteger(e, "default-message-counter-history-day-limit", _defaultMessageCounterHistoryDayLimit);
_clusterPullConnectionFactoryName = getString(e, "cluster-pull-connection-factory-name", _clusterPullConnectionFactoryName);
@@ -211,12 +212,12 @@
propertyChangeSupport.addPropertyChangeListener(listener);
}
- public int getServerPeerID()
+ public Integer getServerPeerID()
{
return _serverPeerID;
}
- public void setServerPeerID(int serverPeerID)
+ public void setServerPeerID(Integer serverPeerID)
{
_serverPeerID = serverPeerID;
}
@@ -261,6 +262,7 @@
public void setSecurityConfig(HashSet<Role> securityConfig)
{
+ propertyChangeSupport.firePropertyChange("securityConfig", _securityConfig, securityConfig);
_securityConfig = securityConfig;
}
@@ -276,12 +278,12 @@
}
- public int getDefaultMaxDeliveryAttempts()
+ public Integer getDefaultMaxDeliveryAttempts()
{
return _defaultMaxDeliveryAttempts;
}
- public void setDefaultMaxDeliveryAttempts(int defaultMaxDeliveryAttempts)
+ public void setDefaultMaxDeliveryAttempts(Integer defaultMaxDeliveryAttempts)
{
_defaultMaxDeliveryAttempts = defaultMaxDeliveryAttempts;
}
@@ -325,34 +327,34 @@
}
- public long getFailoverStartTimeout()
+ public Long getFailoverStartTimeout()
{
return _failoverStartTimeout;
}
- public void setFailoverStartTimeout(long failoverStartTimeout)
+ public void setFailoverStartTimeout(Long failoverStartTimeout)
{
_failoverStartTimeout = failoverStartTimeout;
}
- public long getFailoverCompleteTimeout()
+ public Long getFailoverCompleteTimeout()
{
return _failoverCompleteTimeout;
}
- public void setFailoverCompleteTimeout(long failoverCompleteTimeout)
+ public void setFailoverCompleteTimeout(Long failoverCompleteTimeout)
{
_failoverCompleteTimeout = failoverCompleteTimeout;
}
- public int getDefaultMessageCounterHistoryDayLimit()
+ public Integer getDefaultMessageCounterHistoryDayLimit()
{
return _defaultMessageCounterHistoryDayLimit;
}
- public void setDefaultMessageCounterHistoryDayLimit(int defaultMessageCounterHistoryDayLimit)
+ public void setDefaultMessageCounterHistoryDayLimit(Integer defaultMessageCounterHistoryDayLimit)
{
if (defaultMessageCounterHistoryDayLimit < -1)
{
@@ -373,34 +375,34 @@
}
- public boolean isUseXAForMessagePull()
+ public Boolean isUseXAForMessagePull()
{
return _useXAForMessagePull;
}
- public void setUseXAForMessagePull(boolean useXAForMessagePull)
+ public void setUseXAForMessagePull(Boolean useXAForMessagePull)
{
_useXAForMessagePull = useXAForMessagePull;
}
- public boolean isDefaultPreserveOrdering()
+ public Boolean isDefaultPreserveOrdering()
{
return _defaultPreserveOrdering;
}
- public void setDefaultPreserveOrdering(boolean defaultPreserveOrdering)
+ public void setDefaultPreserveOrdering(Boolean defaultPreserveOrdering)
{
_defaultPreserveOrdering = defaultPreserveOrdering;
}
- public long getRecoverDeliveriesTimeout()
+ public Long getRecoverDeliveriesTimeout()
{
return _recoverDeliveriesTimeout;
}
- public void setRecoverDeliveriesTimeout(long recoverDeliveriesTimeout)
+ public void setRecoverDeliveriesTimeout(Long recoverDeliveriesTimeout)
{
_recoverDeliveriesTimeout = recoverDeliveriesTimeout;
}
@@ -417,12 +419,12 @@
}
- public boolean isStrictTck()
+ public Boolean isStrictTck()
{
return _strictTck || _strictTckProperty;
}
- public void setStrictTck(boolean strictTck)
+ public void setStrictTck(Boolean strictTck)
{
_strictTck = strictTck || _strictTckProperty;
}
@@ -439,34 +441,34 @@
}
- public boolean isClustered()
+ public Boolean isClustered()
{
return _clustered;
}
- public void setClustered(boolean clustered)
+ public void setClustered(Boolean clustered)
{
_clustered = clustered;
}
- public long getStateTimeout()
+ public Long getStateTimeout()
{
return _stateTimeout;
}
- public void setStateTimeout(long stateTimeout)
+ public void setStateTimeout(Long stateTimeout)
{
_stateTimeout = stateTimeout;
}
- public long getCastTimeout()
+ public Long getCastTimeout()
{
return _castTimeout;
}
- public void setCastTimeout(long castTimeout)
+ public void setCastTimeout(Long castTimeout)
{
_castTimeout = castTimeout;
}
@@ -516,23 +518,23 @@
}
- public int getMaxConcurrentReplications()
+ public Integer getMaxConcurrentReplications()
{
return _maxConcurrentReplications;
}
- public void setMaxConcurrentReplications(int maxConcurrentReplications)
+ public void setMaxConcurrentReplications(Integer maxConcurrentReplications)
{
_maxConcurrentReplications = maxConcurrentReplications;
}
- public boolean isUseJGroupsWorkaround()
+ public Boolean isUseJGroupsWorkaround()
{
return _useJGroupsWorkaround;
}
- public void setUseJGroupsWorkaround(boolean useJGroupsWorkaround)
+ public void setUseJGroupsWorkaround(Boolean useJGroupsWorkaround)
{
_useJGroupsWorkaround = useJGroupsWorkaround;
}
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/JmsServer.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/JmsServer.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/JmsServer.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -51,6 +51,8 @@
*/
int getProviderMinorVersion();
+ public Configuration getConfiguration();
+
/**
* deploys a new queue
* @param name the name of the queue
@@ -151,5 +153,8 @@
*/
List retrievePreparedTransactions();
+ public void removeAllMessagesForQueue(String queueName) throws Exception;
+ public void removeAllMessagesForTopic(String queueName) throws Exception;
+
}
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/ServerPeer.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/ServerPeer.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/ServerPeer.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -30,6 +30,7 @@
import org.jboss.jms.server.connectormanager.SimpleConnectorManager;
import org.jboss.jms.server.destination.DestinationDeployer;
import org.jboss.jms.server.destination.ManagedQueue;
+import org.jboss.jms.server.destination.ManagedTopic;
import org.jboss.jms.server.endpoint.ServerSessionEndpoint;
import org.jboss.jms.server.messagecounter.MessageCounter;
import org.jboss.jms.server.messagecounter.MessageCounterManager;
@@ -133,6 +134,7 @@
private Connector connector;
private Configuration configuration;
+ private static boolean aopLoaded =false;
// Constructors ---------------------------------------------------------------------------------
@@ -167,8 +169,12 @@
log.debug(this + " starting");
- loadClientAOPConfig();
- loadServerAOPConfig();
+ if(!aopLoaded)
+ {
+ loadClientAOPConfig();
+ loadServerAOPConfig();
+ aopLoaded = true;
+ }
((JDBCPersistenceManager) persistenceManager).injectNodeID(configuration.getServerPeerID());
@@ -195,7 +201,8 @@
{
public void propertyChange(PropertyChangeEvent evt)
{
- messageCounterManager.reschedule(configuration.getMessageCounterSamplePeriod());
+ if(evt.getPropertyName().equals("messageCounterSamplePeriod"))
+ messageCounterManager.reschedule(configuration.getMessageCounterSamplePeriod());
}
});
//inverted dependancy, post office will now inject this
@@ -232,10 +239,8 @@
securityStore.start();
txRepository.start();
clusterConnectionManager.start();
- connectionFactoryDeployer.start();
- destinationDeployer.start();
- // Note we do not start the message counter manager by default. This must be done
+ // Note we do not startServerPeer the message counter manager by default. This must be done
// explicitly by the user by calling enableMessageCounters(). This is because message
// counter history takes up growing memory to store the stats and could theoretically
// eventually cause the server to run out of RAM
@@ -245,8 +250,8 @@
JMSWireFormat wf = new JMSWireFormat();
MarshalFactory.addMarshaller("jms", wf, wf);
- //Now everything is started we can tell the invocation handler to start handling invocations
- //We do this right at the end otherwise it can start handling invocations before we are properly started
+ //Now everything is started we can tell the invocation handler to startServerPeer handling invocations
+ //We do this right at the end otherwise it can startServerPeer handling invocations before we are properly started
JMSServerInvocationHandler.setClosed(false);
if (configuration.isClustered())
@@ -263,12 +268,18 @@
this.connectionManager.injectReplicator((Replicator) postOffice);
- ((MessagingPostOffice) postOffice).injectServerPeer(this);
+
}
-
+ //we inject the server peer because the post office needs it for clustering and the tx repository.
+ // This is crap and needs changing
+ ((MessagingPostOffice) postOffice).injectServerPeer(this);
// Also need to inject into txRepository
txRepository.injectPostOffice(postOffice);
+
+ connectionFactoryDeployer.start();
+ destinationDeployer.start();
+
started = true;
log.info("JBoss Messaging " + getVersion().getProviderVersion() + " server [" +
configuration.getServerPeerID() + "] started");
@@ -319,14 +330,14 @@
memoryManager.stop();
memoryManager = null;
securityStore.stop();
- //securityStore = null; - if securitySTore is set to null, The ServerPeer won't survive a restart of the service (stop/start)
+ //securityStore = null; - if securitySTore is set to null, The ServerPeer won't survive a restart of the service (stopServerPeer/startServerPeer)
txRepository.stop();
txRepository = null;
messageCounterManager.stop();
messageCounterManager = null;
clusterConnectionManager.stop();
clusterConnectionManager = null;
- postOffice = null;
+ //postOffice = null;
unloadServerAOPConfig();
@@ -491,6 +502,30 @@
return txRepository.getPreparedTransactions();
}
+ public void removeAllMessagesForQueue(String queueName) throws Exception
+ {
+ try
+ {
+ ((ManagedQueue)getDestinationManager().getDestination(queueName, true)).removeAllMessages();
+ }
+ catch (Throwable throwable)
+ {
+ throw new Exception(throwable);
+ }
+ }
+
+ public void removeAllMessagesForTopic(String queueName) throws Exception
+ {
+ try
+ {
+ ((ManagedTopic)getDestinationManager().getDestination(queueName, false)).removeAllMessages();
+ }
+ catch (Throwable throwable)
+ {
+ throw new Exception(throwable);
+ }
+ }
+
// Public ---------------------------------------------------------------------------------------
public void resetAllSuckers()
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/ServerPeerStatistics.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/ServerPeerStatistics.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/ServerPeerStatistics.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -369,7 +369,7 @@
}
else
{
- // start new destination data
+ // startServerPeer new destination data
if (strDestLast != null)
{
// store last destination data string
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/bridge/Bridge.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/bridge/Bridge.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/bridge/Bridge.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,30 +21,6 @@
*/
package org.jboss.jms.server.bridge;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.Map;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.Destination;
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.Topic;
-import javax.jms.XAConnection;
-import javax.jms.XAConnectionFactory;
-import javax.jms.XASession;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-import javax.transaction.xa.XAResource;
-
import org.jboss.jms.client.JBossSession;
import org.jboss.jms.client.delegate.DelegateSupport;
import org.jboss.jms.client.state.SessionState;
@@ -53,6 +29,12 @@
import org.jboss.messaging.core.contract.MessagingComponent;
import org.jboss.tm.TransactionManagerLocator;
+import javax.jms.*;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import javax.transaction.xa.XAResource;
+import java.util.*;
+
/**
*
* A Bridge
@@ -284,7 +266,7 @@
{
if (started)
{
- log.warn("Attempt to start, but is already started");
+ log.warn("Attempt to startServerPeer, but is already started");
return;
}
@@ -315,7 +297,7 @@
if (ok)
{
- //start the source connection
+ //startServerPeer the source connection
sourceConn.start();
@@ -340,7 +322,7 @@
}
else
{
- log.warn("Failed to start bridge");
+ log.warn("Failed to startServerPeer bridge");
handleFailureOnStartup();
}
}
@@ -349,7 +331,7 @@
{
if (!started)
{
- log.warn("Attempt to stop, but is already stopped");
+ log.warn("Attempt to stopServerPeer, but is already stopped");
return;
}
@@ -882,7 +864,7 @@
* -------------------------------------
* If the source and target destinations are on a different servers (different resource managers) then:
*
- * If desired QoS is QOS_ONCE_AND_ONLY_ONCE, then we start a JTA transaction and enlist the consuming and sending
+ * If desired QoS is QOS_ONCE_AND_ONLY_ONCE, then we startServerPeer a JTA transaction and enlist the consuming and sending
* XAResources in that.
*
* If desired QoS is QOS_DUPLICATES_OK then, we use CLIENT_ACKNOWLEDGE for the consuming session and
@@ -1231,7 +1213,7 @@
{
sendMessages();
- //Commit the JTA transaction and start another
+ //Commit the JTA transaction and startServerPeer another
delistResources(tx);
@@ -1356,9 +1338,9 @@
{
failed = true;
- //Failure must be handled on a separate thread to the calling thread (either onMessage or start).
+ //Failure must be handled on a separate thread to the calling thread (either onMessage or startServerPeer).
//In the case of onMessage we can't close the connection from inside the onMessage method
- //since it will block waiting for onMessage to complete. In the case of start we want to return
+ //since it will block waiting for onMessage to complete. In the case of startServerPeer we want to return
//from the call before the connections are reestablished so that the caller is not blocked unnecessarily.
Thread t = new Thread(failureHandler);
@@ -1456,7 +1438,7 @@
}
catch (JMSException e)
{
- log.error("Failed to start source connection", e);
+ log.error("Failed to startServerPeer source connection", e);
}
}
@@ -1545,7 +1527,7 @@
}
catch (JMSException e)
{
- log.error("Failed to start source connection", e);
+ log.error("Failed to startServerPeer source connection", e);
}
}
}
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/bridge/BridgeService.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/bridge/BridgeService.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/bridge/BridgeService.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -342,7 +342,7 @@
bridge.setTargetDestinationFactory(targetDestinationFactory);
- bridge.start();
+ bridge.startServerPeer();
log.info("Started bridge " + this.getName() + ". Source: " + sourceDestinationLookup + " Target: " + targetDestinationLookup);*/
}
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryDeployer.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryDeployer.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryDeployer.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -155,7 +155,7 @@
}
/**
- * lifecycle method to stop factories
+ * lifecycle method to stopServerPeer factories
*
* @throws Exception
*/
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/connectionmanager/SimpleConnectionManager.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/connectionmanager/SimpleConnectionManager.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/connectionmanager/SimpleConnectionManager.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,18 +21,6 @@
*/
package org.jboss.jms.server.connectionmanager;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.jms.JMSException;
-
import org.jboss.jms.delegate.ConnectionEndpoint;
import org.jboss.jms.server.ConnectionManager;
import org.jboss.logging.Logger;
@@ -46,6 +34,10 @@
import org.jboss.remoting.ConnectionListener;
import org.jboss.remoting.callback.ServerInvokerCallbackHandler;
+import javax.jms.JMSException;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+
/**
* @author <a href="tim.fox at jboss.com">Tim Fox</a>
* @author <a href="ovidiu at feodorov.com">Ovidiu Feodorov</a>
@@ -269,7 +261,7 @@
}
catch (Exception e)
{
- log.error("Failed to process failover start", e);
+ log.error("Failed to process failover startServerPeer", e);
}
}
}
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/destination/DestinationDeployer.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/destination/DestinationDeployer.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/destination/DestinationDeployer.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -40,7 +40,8 @@
import java.util.HashSet;
import java.util.Iterator;
-/** Destination Deployer. This class will administrate the deployment, undeployment and registration of Queue's and Topics.
+/**
+ * Destination Deployer. This class will administrate the deployment, undeployment and registration of Queue's and Topics.
* Some of these methods will be exposed via the ServerPeer
*
* @author <a href="ataylor at redhat.com">Andy Taylor</a>
@@ -158,6 +159,7 @@
/**
* creates the default security from the security element
+ *
* @param attributes
* @param j
* @return
@@ -169,7 +171,7 @@
NodeList roles = attributes.item(j).getChildNodes();
for (int k = 0; k < roles.getLength(); k++)
{
- if ("roles".equalsIgnoreCase(roles.item(k).getNodeName()))
+ if ("role".equalsIgnoreCase(roles.item(k).getNodeName()))
{
Boolean read = roles.item(k).getAttributes().getNamedItem(READ_ATTR) != null && Boolean.valueOf(roles.item(k).getAttributes().getNamedItem(READ_ATTR).getNodeValue());
Boolean write = roles.item(k).getAttributes().getNamedItem(WRITE_ATTR) != null && Boolean.valueOf(roles.item(k).getAttributes().getNamedItem(WRITE_ATTR).getNodeValue());
@@ -186,6 +188,7 @@
/**
* creates a queue and deploys it.
+ *
* @param name
* @param clustered
* @param delay
@@ -204,32 +207,56 @@
destination.setDLQ(dlq);
destination.setExpiryQueue(expq);
destination.setSecurityConfig(securityConfig);
- destination.setCreatedProgrammatically(true);
- MessagingQueue queue = new MessagingQueue(serverPeer.getConfiguration().getServerPeerID(), destination.getName(),
- serverPeer.getChannelIDManager().getID(),
- serverPeer.getMessageStore(), serverPeer.getPersistenceManagerInstance(),
- true,
- destination.getMaxSize(), null,
- destination.getFullSize(), destination.getPageSize(),
- destination.getDownCacheSize(), destination.isClustered(),
- serverPeer.getConfiguration().getRecoverDeliveriesTimeout());
- boolean added = getServerPeer().getPostOffice().addBinding(new Binding(queueCond, queue, false), false);
-
- if (added)
+ destination.setServerPeer(serverPeer);
+ MessagingQueue queue;
+ if (serverPeer.getPostOffice().getBindingForQueueName(name) == null)
{
- queue.activate();
+ queue = new MessagingQueue(serverPeer.getConfiguration().getServerPeerID(), destination.getName(),
+ serverPeer.getChannelIDManager().getID(),
+ serverPeer.getMessageStore(), serverPeer.getPersistenceManagerInstance(),
+ true,
+ destination.getMaxSize(), null,
+ destination.getFullSize(), destination.getPageSize(),
+ destination.getDownCacheSize(), destination.isClustered(),
+ serverPeer.getConfiguration().getRecoverDeliveriesTimeout());
+ boolean added = getServerPeer().getPostOffice().addBinding(new Binding(queueCond, queue, false), false);
}
else
{
- getServerPeer().getPostOffice().getBindingForQueueName(name).queue.activate();
+ queue = (MessagingQueue) serverPeer.getPostOffice().getBindingForQueueName(name).queue;
+ queue.load();
}
+
+ queue.activate();
+
createCounter(queue, destination);
destination.setQueue(queue);
getServerPeer().getDestinationManager().registerDestination(destination);
+ // http://jira.jboss.com/jira/browse/JBMESSAGING-976
+ if (destination.getSecurityConfig() != null)
+ {
+ serverPeer.getSecurityManager().setSecurityConfig(true, destination.getName(), destination.getSecurityConfig());
+ }
+ //Now we need to trigger a delivery - this is because message suckers might have
+ //been create *before* the queue was deployed - this is because message suckers can be
+ //created when the clusterpullconnectionfactory deploy is detected which then causes
+ //the clusterconnectionmanager to inspect the bindings for queues to create suckers
+ //to - but these bindings will exist before the queue or topic is deployed and before
+ //it has had its messages loaded
+ //Therefore we need to trigger a delivery now so remote suckers get messages
+ //See http://jira.jboss.org/jira/browse/JBMESSAGING-1136
+ //For JBM we should remove the distinction between activation and deployment to
+ //remove these annoyances and edge cases.
+ //The post office should load(=deploy) all bindings on startup including loading their
+ //state before adding the binding - there should be no separate deployment stage
+ //If the queue can be undeployed there should be a separate flag for this on the
+ //binding
+ queue.deliver();
}
/**
* creates a topic and deploys it
+ *
* @param name
* @param clustered
* @param delay
@@ -247,7 +274,7 @@
destination.setDLQ(dlq);
destination.setExpiryQueue(expq);
destination.setSecurityConfig(securityConfig);
- destination.setCreatedProgrammatically(true);
+ destination.setServerPeer(serverPeer);
PostOffice po = serverPeer.getPostOffice();
// We deploy any queues corresponding to pre-existing durable subscriptions
@@ -272,11 +299,16 @@
//Create a counter
createCounter(queue, destination);
+
}
serverPeer.getDestinationManager().registerDestination(destination);
+ // http://jira.jboss.com/jira/browse/JBMESSAGING-976
+ if (destination.getSecurityConfig() != null)
+ {
+ serverPeer.getSecurityManager().setSecurityConfig(false, destination.getName(), destination.getSecurityConfig());
+ }
-
}
private void createCounter(Queue queue, ManagedQueue destination)
@@ -316,8 +348,10 @@
serverPeer.getMessageCounterManager().registerMessageCounter(counterName, counter);
}
+
/**
* deploys a new queue
+ *
* @param name
* @param jndiName
* @return
@@ -335,6 +369,7 @@
/**
* deploys a new queue
+ *
* @param name
* @param jndiName
* @param fullSize
@@ -347,6 +382,7 @@
{
JMSCondition queueCond = new JMSCondition(true, name);
ManagedQueue destination = new ManagedQueue();
+ destination.setServerPeer(serverPeer);
destination.setName(name);
if (params)
{
@@ -355,32 +391,61 @@
destination.setFullSize(fullSize);
}
destination.setJndiName(jndiName);
- MessagingQueue queue = new MessagingQueue(serverPeer.getConfiguration().getServerPeerID(), destination.getName(),
- serverPeer.getChannelIDManager().getID(),
- serverPeer.getMessageStore(), serverPeer.getPersistenceManagerInstance(),
- true,
- destination.getMaxSize(), null,
- destination.getFullSize(), destination.getPageSize(),
- destination.getDownCacheSize(), destination.isClustered(),
- serverPeer.getConfiguration().getRecoverDeliveriesTimeout());
- boolean added = serverPeer.getPostOffice().addBinding(new Binding(queueCond, queue, false), false);
+ MessagingQueue queue;
+ if (serverPeer.getPostOffice().getBindingForQueueName(name) == null)
+ {
+ queue = new MessagingQueue(serverPeer.getConfiguration().getServerPeerID(), destination.getName(),
+ serverPeer.getChannelIDManager().getID(),
+ serverPeer.getMessageStore(), serverPeer.getPersistenceManagerInstance(),
+ true,
+ destination.getMaxSize(), null,
+ destination.getFullSize(), destination.getPageSize(),
+ destination.getDownCacheSize(), destination.isClustered(),
+ serverPeer.getConfiguration().getRecoverDeliveriesTimeout());
- if (added)
- {
- queue.activate();
+ serverPeer.getPostOffice().addBinding(new Binding(queueCond, queue, false), false);
}
else
{
- serverPeer.getPostOffice().getBindingForQueueName(name).queue.activate();
+ queue = (MessagingQueue) serverPeer.getPostOffice().getBindingForQueueName(name).queue;
+ queue.load();
}
+ if (queue.isActive())
+ {
+ throw new javax.jms.IllegalStateException("Cannot deploy queue " + destination.getName() + " it is already deployed");
+ }
+
+ queue.activate();
+
createCounter(queue, destination);
destination.setQueue(queue);
serverPeer.getDestinationManager().registerDestination(destination);
+ //Now we need to trigger a delivery - this is because message suckers might have
+ //been create *before* the queue was deployed - this is because message suckers can be
+ //created when the clusterpullconnectionfactory deploy is detected which then causes
+ //the clusterconnectionmanager to inspect the bindings for queues to create suckers
+ //to - but these bindings will exist before the queue or topic is deployed and before
+ //it has had its messages loaded
+ //Therefore we need to trigger a delivery now so remote suckers get messages
+ //See http://jira.jboss.org/jira/browse/JBMESSAGING-1136
+ //For JBM we should remove the distinction between activation and deployment to
+ //remove these annoyances and edge cases.
+ //The post office should load(=deploy) all bindings on startup including loading their
+ //state before adding the binding - there should be no separate deployment stage
+ //If the queue can be undeployed there should be a separate flag for this on the
+ //binding
+ queue.deliver();
+ // http://jira.jboss.com/jira/browse/JBMESSAGING-976
+ if (destination.getSecurityConfig() != null)
+ {
+ serverPeer.getSecurityManager().setSecurityConfig(true, destination.getName(), destination.getSecurityConfig());
+ }
return destination.getJndiName();
}
/**
* deploys a new topic
+ *
* @param name
* @param jndiName
* @return
@@ -393,6 +458,7 @@
/**
* returns a new topic
+ *
* @param name
* @param jndiName
* @param fullSize
@@ -403,8 +469,20 @@
*/
public String deployTopic(String name, String jndiName, int fullSize, int pageSize, int downCacheSize) throws Exception
{
+ if (serverPeer.getDestinationManager().getDestination(name, false) != null)
+ {
+ throw new Exception("Destination " + name + " is already registered");
+ }
ManagedTopic destination = new ManagedTopic();
destination.setName(name);
+ destination.setServerPeer(serverPeer);
+ destination.setJndiName(jndiName);
+ if (fullSize >= 0)
+ destination.setFullSize(fullSize);
+ if (pageSize >= 0)
+ destination.setPageSize(pageSize);
+ if (downCacheSize >= 0)
+ destination.setDownCacheSize(downCacheSize);
PostOffice po = serverPeer.getPostOffice();
// We deploy any queues corresponding to pre-existing durable subscriptions
@@ -432,11 +510,17 @@
}
serverPeer.getDestinationManager().registerDestination(destination);
+ // http://jira.jboss.com/jira/browse/JBMESSAGING-976
+ if (destination.getSecurityConfig() != null)
+ {
+ serverPeer.getSecurityManager().setSecurityConfig(true, destination.getName(), destination.getSecurityConfig());
+ }
return destination.getJndiName();
}
/**
* undeploys a queue
+ *
* @param name
* @return
* @throws Exception
@@ -444,9 +528,8 @@
public boolean undeployQueue(String name) throws Exception
{
ManagedDestination destination = serverPeer.getDestinationManager().getDestination(name, true);
- if(destination.isCreatedProgrammatically())
+ if (destination == null)
{
- log.warn("Cannot undeploy a destination that has not been created programatically");
return false;
}
serverPeer.getDestinationManager().unregisterDestination(destination);
@@ -466,13 +549,14 @@
queue.unload();
- log.info(this + " stopped");
+ log.debug(name + " stopped");
return true;
}
/**
* undeploys a topic
+ *
* @param name
* @return
* @throws Exception
@@ -480,9 +564,9 @@
public boolean undeployTopic(String name) throws Exception
{
ManagedDestination destination = serverPeer.getDestinationManager().getDestination(name, false);
- if(destination.isCreatedProgrammatically())
+ if (destination == null)
{
- log.warn("Cannot undeploy a destination that has not been created programatically");
+ log.warn("destination being destroyed does not exist");
return false;
}
serverPeer.getDestinationManager().unregisterDestination(destination);
@@ -527,13 +611,14 @@
serverPeer.getMessageCounterManager().unregisterMessageCounter(counterName);
}
- log.info(this + " stopped");
+ log.debug(this + " stopped");
return true;
}
/**
* destroys a queue
+ *
* @param name
* @return
* @throws Throwable
@@ -545,13 +630,14 @@
/**
* destroys a topic
+ *
* @param name
* @return
* @throws Throwable
*/
public boolean destroyTopic(String name) throws Throwable
{
- return destroyDestination(true, name);
+ return destroyDestination(false, name);
}
private boolean destroyDestination(boolean isQueue, String name) throws Throwable
@@ -564,7 +650,7 @@
while (iter.hasNext())
{
- Queue queue = (Queue)iter.next();
+ Queue queue = (Queue) iter.next();
queue.removeAllReferences();
}
@@ -579,7 +665,7 @@
while (iter.hasNext())
{
- Queue queue = (Queue)iter.next();
+ Queue queue = (Queue) iter.next();
queue.removeAllReferences();
@@ -591,8 +677,23 @@
return true;
}
- public void stop()
+ public void stop() throws Exception
{
+ Collection queues = serverPeer.getPostOffice().getAllBindings();
+ for (Object queue : queues)
+ {
+ Queue q = ((Binding) queue).queue;
+ q.deactivate();
+ q.unload();
+ /*try
+ {
+ serverPeer.getPostOffice().removeBinding(q.getName(), true);
+ }
+ catch (Throwable throwable)
+ {
+ throwable.printStackTrace();
+ }*/
+ }
}
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/destination/ManagedDestination.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/destination/ManagedDestination.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/destination/ManagedDestination.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -89,8 +89,6 @@
public static final String SUBSCRIPTION_MESSAGECOUNTER_PREFIX = "Subscription.";
- private boolean createdProgrammatically;
-
public ManagedDestination()
{
}
@@ -307,17 +305,6 @@
this.maxDeliveryAttempts = maxDeliveryAttempts;
}
-
- public boolean isCreatedProgrammatically()
- {
- return createdProgrammatically;
- }
-
- public void setCreatedProgrammatically(boolean createdProgrammatically)
- {
- this.createdProgrammatically = createdProgrammatically;
- }
-
public abstract boolean isQueue();
public void start() throws Exception
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -320,7 +320,7 @@
}
catch (Throwable t)
{
- throw ExceptionUtil.handleJMSInvocation(t, this + " start");
+ throw ExceptionUtil.handleJMSInvocation(t, this + " startServerPeer");
}
}
@@ -339,7 +339,7 @@
}
catch (Throwable t)
{
- throw ExceptionUtil.handleJMSInvocation(t, this + " stop");
+ throw ExceptionUtil.handleJMSInvocation(t, this + " stopServerPeer");
}
}
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -138,7 +138,7 @@
this.maxDeliveryAttempts = maxDeliveryAttempts;
- // Always start as false - wait for consumer to initiate.
+ // Always startServerPeer as false - wait for consumer to initiate.
this.clientAccepting = false;
this.remote = remote;
@@ -589,7 +589,7 @@
// 1) ClientConsumer::close() - any messages in buffer are cancelled to the server
// session, and any subsequent receive messages will be ignored.
//
- // 2) ServerConsumerEndpoint::closing() causes stop() this flushes any deliveries yet to
+ // 2) ServerConsumerEndpoint::closing() causes stopServerPeer() this flushes any deliveries yet to
// deliver to the client callback handler.
//
// 3) ClientConsumer waits for all deliveries to arrive at client side
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -982,7 +982,7 @@
//This is ok - may happen at failover
// This can happen when the failover node is being changed
- // E.g. failover node changes, replicates start getting sent to the new failover node,
+ // E.g. failover node changes, replicates startServerPeer getting sent to the new failover node,
// then the new node requests to collect the deliveries from this node, at which point we deliver
// all waiting deliveries. Then the responses to the original ones come back.
// So we can ignore them
@@ -1023,7 +1023,7 @@
if (!delivered)
{
// Response has come back out of order - this can happen when the failover node is being changed
- // E.g. failover node changes, replicates start getting sent to the new failover node,
+ // E.g. failover node changes, replicates startServerPeer getting sent to the new failover node,
// then the new node requests to collect the deliveries from this node, at which point we deliver
// all waiting deliveries. Then the responses to the original ones come back.
// So we can ignore them
@@ -1474,7 +1474,7 @@
log.trace(this + " failed to handle callback", t);
- //We stop the consumer - some time later the lease will expire and the connection will be closed
+ //We stopServerPeer the consumer - some time later the lease will expire and the connection will be closed
//which will remove the consumer
consumer.setStarted(false);
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/messagecounter/MessageCounterManager.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/messagecounter/MessageCounterManager.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/messagecounter/MessageCounterManager.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,17 +21,11 @@
*/
package org.jboss.jms.server.messagecounter;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.Timer;
-import java.util.TimerTask;
-
import org.jboss.logging.Logger;
import org.jboss.messaging.core.contract.MessagingComponent;
+import java.util.*;
+
/**
*
* A MessageCounterManager
@@ -91,7 +85,7 @@
return;
}
- //Wait for timer task to stop
+ //Wait for timer task to stopServerPeer
task.stop();
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/microcontainer/JBMBootstrapServer.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/microcontainer/JBMBootstrapServer.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/microcontainer/JBMBootstrapServer.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -135,8 +135,8 @@
public JBMBootstrapServer(String[] args, KernelConfig kernelConfig) throws Exception
{
super(kernelConfig);
- System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.LocalOnlyContextFactory");
- System.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
+ //System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.LocalOnlyContextFactory");
+ //System.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
this.args = args;
}
public void bootstrap() throws Throwable
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/microcontainer/JndiBinder.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/microcontainer/JndiBinder.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/microcontainer/JndiBinder.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -37,6 +37,7 @@
private String bindTo;
private Object target;
private Hashtable properties;
+
public JndiBinder()
{
}
@@ -67,13 +68,13 @@
try
{
- if(target.getClass().isAssignableFrom(Serializable.class))
+ if (target.getClass().isAssignableFrom(Serializable.class))
{
Util.rebind(ctx, bindTo, target);
}
else
{
- NonSerializableFactory.bind(ctx, bindTo, target);
+ bindToNonSerializableFactory(ctx);
}
}
@@ -87,16 +88,36 @@
}
}
+
+
public void stop()
throws Exception
{
InitialContext ctx = getInitialContext(properties);
- Util.unbind(ctx, bindTo);
+ if (target.getClass().isAssignableFrom(Serializable.class))
+ {
+ Util.unbind(ctx, bindTo);
+ }
+ else
+ {
+ unbindFromSerializableFactory(ctx);
+ }
}
+ private void unbindFromSerializableFactory(InitialContext ctx)
+ throws NamingException
+ {
+ NonSerializableFactory.unbind(ctx, bindTo);
+ }
+ protected void bindToNonSerializableFactory(InitialContext ctx)
+ throws NamingException
+ {
+ NonSerializableFactory.bind(ctx, bindTo, target);
+ }
+
private static InitialContext getInitialContext(Hashtable props)
throws NamingException
{
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/microcontainer/NonSerializableFactory.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/microcontainer/NonSerializableFactory.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/microcontainer/NonSerializableFactory.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -48,7 +48,7 @@
String atom = name.get(size - 1);
Context parentCtx = Util.createSubcontext(ctx, name.getPrefix(size - 1));
String key = (new StringBuilder()).append(parentCtx.getNameInNamespace()).append("/").append(atom).toString();
- wrapperMap.remove(key);
+ getWrapperMap().remove(key);
Util.unbind(ctx, strName);
}
@@ -61,7 +61,7 @@
String atom = name.get(size - 1);
Context parentCtx = Util.createSubcontext(ctx, name.getPrefix(size - 1));
String key = (new StringBuilder()).append(parentCtx.getNameInNamespace()).append("/").append(atom).toString();
- wrapperMap.put(key, value);
+ getWrapperMap().put(key, value);
String className = value.getClass().getName();
String factory = NonSerializableFactory.class.getName();
StringRefAddr addr = new StringRefAddr("nns", key);
@@ -77,7 +77,7 @@
String atom = name.get(size - 1);
Context parentCtx = Util.createSubcontext(ctx, name.getPrefix(size - 1));
String key = (new StringBuilder()).append(parentCtx.getNameInNamespace()).append("/").append(atom).toString();
- wrapperMap.put(key, value);
+ getWrapperMap().put(key, value);
String className = value.getClass().getName();
String factory = NonSerializableFactory.class.getName();
StringRefAddr addr = new StringRefAddr("nns", key);
@@ -88,11 +88,11 @@
public static Object lookup(String name) throws NamingException
{
- if(wrapperMap.get(name) == null)
+ if(getWrapperMap().get(name) == null)
{
throw new NamingException(name + " not found");
}
- return wrapperMap.get(name);
+ return getWrapperMap().get(name);
}
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable env)
@@ -101,9 +101,13 @@
Reference ref = (Reference) obj;
RefAddr addr = ref.get("nns");
String key = (String) addr.getContent();
- return wrapperMap.get(key);
+ return getWrapperMap().get(key);
}
+ public static Map getWrapperMap()
+ {
+ return wrapperMap;
+ }
+
private static Map wrapperMap = Collections.synchronizedMap(new HashMap());
-
}
\ No newline at end of file
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/security/SecurityMetadata.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/security/SecurityMetadata.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/security/SecurityMetadata.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -59,7 +59,7 @@
* @param roles
* @throws Exception
*/
- public SecurityMetadata(HashSet<Role> roles) throws Exception
+ public SecurityMetadata(HashSet<Role> roles)
{
setRoles(roles);
}
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/security/SecurityMetadataStore.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/security/SecurityMetadataStore.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/server/security/SecurityMetadataStore.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -33,6 +33,8 @@
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.security.auth.Subject;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.security.Principal;
import java.util.HashMap;
import java.util.HashSet;
@@ -56,7 +58,7 @@
// Constants -----------------------------------------------------
private static final Logger log = Logger.getLogger(SecurityMetadataStore.class);
-
+
public static final String SUCKER_USER = "JBM.SUCKER";
public static final String DEFAULT_SUCKER_USER_PASSWORD = "CHANGE ME!!";
@@ -65,8 +67,8 @@
private boolean trace = log.isTraceEnabled();
- private Map queueSecurityConf;
- private Map topicSecurityConf;
+ private Map<String, SecurityMetadata> queueSecurityConf;
+ private Map<String, SecurityMetadata> topicSecurityConf;
private AuthenticationManager authenticationManager;
private RealmMapping realmMapping;
@@ -82,44 +84,72 @@
public SecurityMetadataStore(ServerPeer serverPeer)
{
this.serverPeer = serverPeer;
- queueSecurityConf = new HashMap();
- topicSecurityConf = new HashMap();
+ queueSecurityConf = new HashMap<String, SecurityMetadata>();
+ topicSecurityConf = new HashMap<String, SecurityMetadata>();
+ //add a property change listener then we can update the default security config
+ serverPeer.getConfiguration().addPropertyChangeListener(new PropertyChangeListener()
+ {
+ public void propertyChange(PropertyChangeEvent evt)
+ {
+ if(evt.getPropertyName().equals("securityConfig"))
+ {
+ HashSet<Role> roles = (HashSet<Role>) evt.getNewValue();
+ for (String key : queueSecurityConf.keySet())
+ {
+ if(evt.getNewValue() != null)
+ queueSecurityConf.put(key, new SecurityMetadata(roles));
+ else
+ queueSecurityConf.put(key, new SecurityMetadata());
+ }
+ for (String key : topicSecurityConf.keySet())
+ {
+ if(evt.getNewValue() != null)
+ topicSecurityConf.put(key, new SecurityMetadata(roles));
+ else
+ topicSecurityConf.put(key, new SecurityMetadata());
+ }
+ }
+ }
+ });
}
// SecurityManager implementation --------------------------------
public SecurityMetadata getSecurityMetadata(boolean isQueue, String destName)
{
- SecurityMetadata m = (SecurityMetadata)
- (isQueue ? queueSecurityConf.get(destName) : topicSecurityConf.get(destName));
+ SecurityMetadata m = (isQueue ? queueSecurityConf.get(destName) : topicSecurityConf.get(destName));
if (m == null)
{
// No SecurityMetadata was configured for the destination, apply the default
- if (serverPeer.getConfiguration().getSecurityConfig() != null)
+ m = getDefaultSecurityConfig(destName);
+
+ }
+ return m;
+ }
+
+ private SecurityMetadata getDefaultSecurityConfig(String destName)
+ {
+ SecurityMetadata m;
+ if (serverPeer.getConfiguration().getSecurityConfig() != null)
+ {
+ log.debug("No SecurityMetadadata was available for " + destName + ", using default security config");
+ try
{
- log.debug("No SecurityMetadadata was available for " + destName + ", using default security config");
- try
- {
- m = new SecurityMetadata(serverPeer.getConfiguration().getSecurityConfig());
- }
- catch (Exception e)
- {
- log.warn("Unable to apply default security for destName, using guest " + destName, e);
- m = new SecurityMetadata();
- }
+ m = new SecurityMetadata(serverPeer.getConfiguration().getSecurityConfig());
}
- else
+ catch (Exception e)
{
- // default to guest
- log.warn("No SecurityMetadadata was available for " + destName + ", adding guest");
+ log.warn("Unable to apply default security for destName, using guest " + destName, e);
m = new SecurityMetadata();
}
-
- // don't cache it! this way the callers will be able to take advantage of default security
- // configuration updates
- // securityConf.put(destName, m);
}
+ else
+ {
+ // default to guest
+ log.warn("No SecurityMetadadata was available for " + destName + ", adding guest");
+ m = new SecurityMetadata();
+ }
return m;
}
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/jms/tx/MessagingXAResource.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/jms/tx/MessagingXAResource.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/jms/tx/MessagingXAResource.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,15 +21,15 @@
*/
package org.jboss.jms.tx;
-import javax.transaction.xa.XAException;
-import javax.transaction.xa.XAResource;
-import javax.transaction.xa.Xid;
-
import org.jboss.jms.client.state.SessionState;
import org.jboss.jms.delegate.ConnectionDelegate;
import org.jboss.jms.exception.MessagingXAException;
import org.jboss.logging.Logger;
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
/**
* An XAResource implementation.
*
@@ -152,7 +152,7 @@
if (convertTx)
{
// If I commit/rollback the tx, then there is a short period of time between the
- // AS (or whoever) calling commit on the tx and calling start to enrolling the
+ // AS (or whoever) calling commit on the tx and calling startServerPeer to enrolling the
// session in a new tx. If the session has any listeners then in that period,
// messages can be received asychronously but we want them to be received in the
// context of a tx, so we convert.
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/ChannelSupport.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/ChannelSupport.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/ChannelSupport.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -466,7 +466,7 @@
if (del == null)
{
- // No receiver, broken receiver or full receiver so we stop delivering
+ // No receiver, broken receiver or full receiver so we stopServerPeer delivering
if (trace) { log.trace(this + " got no delivery for " + ref + " so no receiver got the message. Stopping delivery."); }
break;
@@ -543,7 +543,7 @@
if (del == null)
{
- // No receiver, broken receiver or full receiver so we stop delivering
+ // No receiver, broken receiver or full receiver so we stopServerPeer delivering
if (trace) { log.trace(this + ": no delivery returned for message" + ref + " so no receiver got the message. Delivery is now complete"); }
return false;
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/FailoverWaiter.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/FailoverWaiter.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/FailoverWaiter.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -79,7 +79,7 @@
// TODO deal with multiple failover cascades
- //First wait for failover to start
+ //First wait for failover to startServerPeer
synchronized (failoverStatusLock)
{
long startToWait = failoverStartTimeout;
@@ -89,7 +89,7 @@
long start = System.currentTimeMillis();
try
{
- log.debug(this + " blocking on the failover lock, waiting for failover to start");
+ log.debug(this + " blocking on the failover lock, waiting for failover to startServerPeer");
failoverStatusLock.wait(startToWait);
log.debug(this + " releasing the failover lock, checking again whether failover started ...");
}
@@ -102,7 +102,7 @@
if (failingOverFor != failedNodeID && failedOverFor != failedNodeID)
{
//Timed out
- log.debug("Timed out waiting for failover to start");
+ log.debug("Timed out waiting for failover to startServerPeer");
return -1;
}
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -1107,7 +1107,12 @@
return null;
}
- finally
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ throw e;
+ }
+ finally
{
closeStatement(psReference);
closeStatement(psInsertMessage);
@@ -1784,25 +1789,24 @@
ps.setLong(4, m.getTimestamp());
ps.setByte(5, m.getPriority());
ps.setByte(6, m.getType());
- ps.setLong(7, System.currentTimeMillis());
if (bindBlobs)
{
- bindBlobs(m, ps, 8, 9);
+ bindBlobs(m, ps, 7,8);
}
}
/** Stores the message using the Conditional update */
protected int storeMessage(Message message, PreparedStatement psInsertMessage, PreparedStatement psUpdateMessage)
- throws Exception
+ throws Exception
{
int rows;
if (!supportsBlobSelect)
{
- //Need to store in two phases
+ // Need to store in two phases
storeMessage(message, psInsertMessage, false);
- psInsertMessage.setLong(8, message.getMessageID());
+ psInsertMessage.setLong(7, message.getMessageID());
rows = psInsertMessage.executeUpdate();
if (rows == 1)
@@ -1810,18 +1814,16 @@
bindBlobs(message, psUpdateMessage, 1, 2);
psUpdateMessage.setLong(3, message.getMessageID());
rows = psUpdateMessage.executeUpdate();
- if (rows != 1)
- {
- throw new IllegalStateException("Couldn't update messageId=" +
- message.getMessageID() + " on paging");
- }
+ if (rows != 1) { throw new IllegalStateException(
+ "Couldn't update messageId=" + message.getMessageID()
+ + " on paging"); }
}
}
else
{
- //Can store in one go
+ // Can store in one go
storeMessage(message, psInsertMessage, true);
- psInsertMessage.setLong(10, message.getMessageID());
+ psInsertMessage.setLong(9, message.getMessageID());
rows = psInsertMessage.executeUpdate();
}
return rows;
@@ -1996,103 +1998,127 @@
{
Map<String, String> map = new LinkedHashMap<String, String>();
map.put("CREATE_DUAL", "CREATE TABLE JBM_DUAL (DUMMY INTEGER)");
- //Message reference
+ // Message reference
map.put("CREATE_MESSAGE_REFERENCE",
- "CREATE TABLE JBM_MSG_REF (CHANNEL_ID BIGINT, " +
- "MESSAGE_ID BIGINT, TRANSACTION_ID BIGINT, STATE CHAR(1), ORD BIGINT, PAGE_ORD BIGINT, " +
- "DELIVERY_COUNT INTEGER, SCHED_DELIVERY BIGINT, PRIMARY KEY(CHANNEL_ID, MESSAGE_ID))");
- map.put("CREATE_IDX_MESSAGE_REF_TX", "CREATE INDEX JBM_MSG_REF_TX ON JBM_MSG_REF (TRANSACTION_ID)");
- map.put("CREATE_IDX_MESSAGE_REF_ORD", "CREATE INDEX JBM_MSG_REF_ORD ON JBM_MSG_REF (ORD)");
- map.put("CREATE_IDX_MESSAGE_REF_PAGE_ORD", "CREATE INDEX JBM_MSG_REF__PAGE_ORD ON JBM_MSG_REF (PAGE_ORD)");
- map.put("CREATE_IDX_MESSAGE_REF_MESSAGE_ID", "CREATE INDEX JBM_MSG_REF_MESSAGE_ID ON JBM_MSG_REF (MESSAGE_ID)");
- map.put("CREATE_IDX_MESSAGE_REF_SCHED_DELIVERY", "CREATE INDEX JBM_MSG_REF_SCHED_DELIVERY ON JBM_MSG_REF (SCHED_DELIVERY)");
- //Message
+ "CREATE TABLE JBM_MSG_REF (CHANNEL_ID BIGINT, "
+ + "MESSAGE_ID BIGINT, TRANSACTION_ID BIGINT, STATE CHAR(1), ORD BIGINT, PAGE_ORD BIGINT, "
+ + "DELIVERY_COUNT INTEGER, SCHED_DELIVERY BIGINT, PRIMARY KEY(CHANNEL_ID, MESSAGE_ID))");
+ map.put("CREATE_IDX_MESSAGE_REF_TX",
+ "CREATE INDEX JBM_MSG_REF_TX ON JBM_MSG_REF (TRANSACTION_ID)");
+ map.put("CREATE_IDX_MESSAGE_REF_ORD",
+ "CREATE INDEX JBM_MSG_REF_ORD ON JBM_MSG_REF (ORD)");
+ map.put("CREATE_IDX_MESSAGE_REF_PAGE_ORD",
+ "CREATE INDEX JBM_MSG_REF__PAGE_ORD ON JBM_MSG_REF (PAGE_ORD)");
+ map.put("CREATE_IDX_MESSAGE_REF_MESSAGE_ID",
+ "CREATE INDEX JBM_MSG_REF_MESSAGE_ID ON JBM_MSG_REF (MESSAGE_ID)");
+ map.put("CREATE_IDX_MESSAGE_REF_SCHED_DELIVERY",
+ "CREATE INDEX JBM_MSG_REF_SCHED_DELIVERY ON JBM_MSG_REF (SCHED_DELIVERY)");
+ // Message
map.put("CREATE_MESSAGE",
- "CREATE TABLE JBM_MSG (MESSAGE_ID BIGINT, RELIABLE CHAR(1), " +
- "EXPIRATION BIGINT, TIMESTAMP BIGINT, PRIORITY TINYINT, TYPE TINYINT, INS_TIME BIGINT, HEADERS LONGVARBINARY, " +
- "PAYLOAD LONGVARBINARY, " +
- "PRIMARY KEY (MESSAGE_ID))");
- map.put("CREATE_IDX_MESSAGE_TIMESTAMP", "CREATE INDEX JBM_MSG_REF_TIMESTAMP ON JBM_MSG (TIMESTAMP)");
- //Transaction
+ "CREATE TABLE JBM_MSG (MESSAGE_ID BIGINT, RELIABLE CHAR(1), "
+ + "EXPIRATION BIGINT, TIMESTAMP BIGINT, PRIORITY TINYINT, TYPE TINYINT, HEADERS LONGVARBINARY, "
+ + "PAYLOAD LONGVARBINARY, "
+ + "PRIMARY KEY (MESSAGE_ID))");
+ // Transaction
map.put("CREATE_TRANSACTION",
- "CREATE TABLE JBM_TX (" +
- "NODE_ID INTEGER, TRANSACTION_ID BIGINT, BRANCH_QUAL VARBINARY(254), " +
- "FORMAT_ID INTEGER, GLOBAL_TXID VARBINARY(254), PRIMARY KEY (TRANSACTION_ID))");
- //Counter
+ "CREATE TABLE JBM_TX ("
+ + "NODE_ID INTEGER, TRANSACTION_ID BIGINT, BRANCH_QUAL VARBINARY(254), "
+ + "FORMAT_ID INTEGER, GLOBAL_TXID VARBINARY(254), PRIMARY KEY (TRANSACTION_ID))");
+ // Counter
map.put("CREATE_COUNTER",
"CREATE TABLE JBM_COUNTER (NAME VARCHAR(255), NEXT_ID BIGINT, PRIMARY KEY(NAME))");
return map;
}
protected Map getDefaultDMLStatements()
- {
+ {
Map<String, String> map = new LinkedHashMap<String, String>();
map.put("INSERT_DUAL", "INSERT INTO JBM_DUAL VALUES (1)");
map.put("CHECK_DUAL", "SELECT 1 FROM JBM_DUAL");
- //Message reference
+ // Message reference
map.put("INSERT_MESSAGE_REF",
- "INSERT INTO JBM_MSG_REF (CHANNEL_ID, MESSAGE_ID, TRANSACTION_ID, STATE, ORD, PAGE_ORD, DELIVERY_COUNT, SCHED_DELIVERY) " +
- "VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
- map.put("DELETE_MESSAGE_REF", "DELETE FROM JBM_MSG_REF WHERE MESSAGE_ID=? AND CHANNEL_ID=? AND STATE='C'");
+ "INSERT INTO JBM_MSG_REF (CHANNEL_ID, MESSAGE_ID, TRANSACTION_ID, STATE, ORD, PAGE_ORD, DELIVERY_COUNT, SCHED_DELIVERY) "
+ + "VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
+ map.put("DELETE_MESSAGE_REF",
+ "DELETE FROM JBM_MSG_REF WHERE MESSAGE_ID=? AND CHANNEL_ID=? AND STATE='C'");
map.put("UPDATE_MESSAGE_REF",
- "UPDATE JBM_MSG_REF SET TRANSACTION_ID=?, STATE='-' " +
- "WHERE MESSAGE_ID=? AND CHANNEL_ID=? AND STATE='C'");
- map.put("UPDATE_PAGE_ORDER", "UPDATE JBM_MSG_REF SET PAGE_ORD = ? WHERE MESSAGE_ID=? AND CHANNEL_ID=?");
- map.put("COMMIT_MESSAGE_REF1", "UPDATE JBM_MSG_REF SET STATE='C', TRANSACTION_ID = NULL WHERE TRANSACTION_ID=? AND STATE='+'");
- map.put("COMMIT_MESSAGE_REF2", "DELETE FROM JBM_MSG_REF WHERE TRANSACTION_ID=? AND STATE='-'");
- map.put("ROLLBACK_MESSAGE_REF1", "DELETE FROM JBM_MSG_REF WHERE TRANSACTION_ID=? AND STATE='+'");
- map.put("ROLLBACK_MESSAGE_REF2", "UPDATE JBM_MSG_REF SET STATE='C', TRANSACTION_ID = NULL WHERE TRANSACTION_ID=? AND STATE='-'");
+ "UPDATE JBM_MSG_REF SET TRANSACTION_ID=?, STATE='-' "
+ + "WHERE MESSAGE_ID=? AND CHANNEL_ID=? AND STATE='C'");
+ map.put("UPDATE_PAGE_ORDER",
+ "UPDATE JBM_MSG_REF SET PAGE_ORD = ? WHERE MESSAGE_ID=? AND CHANNEL_ID=?");
+ map.put("COMMIT_MESSAGE_REF1",
+ "UPDATE JBM_MSG_REF SET STATE='C', TRANSACTION_ID = NULL WHERE TRANSACTION_ID=? AND STATE='+'");
+ map.put("COMMIT_MESSAGE_REF2",
+ "DELETE FROM JBM_MSG_REF WHERE TRANSACTION_ID=? AND STATE='-'");
+ map.put("ROLLBACK_MESSAGE_REF1",
+ "DELETE FROM JBM_MSG_REF WHERE TRANSACTION_ID=? AND STATE='+'");
+ map.put("ROLLBACK_MESSAGE_REF2",
+ "UPDATE JBM_MSG_REF SET STATE='C', TRANSACTION_ID = NULL WHERE TRANSACTION_ID=? AND STATE='-'");
map.put("LOAD_PAGED_REFS",
- "SELECT MESSAGE_ID, DELIVERY_COUNT, PAGE_ORD, SCHED_DELIVERY FROM JBM_MSG_REF " +
- "WHERE CHANNEL_ID = ? AND PAGE_ORD BETWEEN ? AND ? ORDER BY PAGE_ORD");
+ "SELECT MESSAGE_ID, DELIVERY_COUNT, PAGE_ORD, SCHED_DELIVERY FROM JBM_MSG_REF "
+ + "WHERE CHANNEL_ID = ? AND PAGE_ORD BETWEEN ? AND ? ORDER BY PAGE_ORD");
map.put("LOAD_UNPAGED_REFS",
- "SELECT MESSAGE_ID, DELIVERY_COUNT, SCHED_DELIVERY FROM JBM_MSG_REF WHERE STATE = 'C' " +
- "AND CHANNEL_ID = ? AND PAGE_ORD IS NULL ORDER BY ORD");
+ "SELECT MESSAGE_ID, DELIVERY_COUNT, SCHED_DELIVERY FROM JBM_MSG_REF WHERE STATE = 'C' "
+ + "AND CHANNEL_ID = ? AND PAGE_ORD IS NULL ORDER BY ORD");
map.put("LOAD_REFS",
- "SELECT MESSAGE_ID, DELIVERY_COUNT, SCHED_DELIVERY FROM JBM_MSG_REF WHERE STATE = 'C' " +
- "AND CHANNEL_ID = ? ORDER BY ORD");
-
- map.put("UPDATE_REFS_NOT_PAGED", "UPDATE JBM_MSG_REF SET PAGE_ORD = NULL WHERE PAGE_ORD BETWEEN ? AND ? AND CHANNEL_ID=?");
- map.put("SELECT_MIN_MAX_PAGE_ORD", "SELECT MIN(PAGE_ORD), MAX(PAGE_ORD) FROM JBM_MSG_REF WHERE CHANNEL_ID = ?");
- map.put("SELECT_EXISTS_REF_MESSAGE_ID", "SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE MESSAGE_ID = ?");
- map.put("UPDATE_DELIVERY_COUNT", "UPDATE JBM_MSG_REF SET DELIVERY_COUNT = ? WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?");
- map.put("UPDATE_CHANNEL_ID", "UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE CHANNEL_ID = ?");
-
- //Message
+ "SELECT MESSAGE_ID, DELIVERY_COUNT, SCHED_DELIVERY FROM JBM_MSG_REF WHERE STATE = 'C' "
+ + "AND CHANNEL_ID = ? ORDER BY ORD");
+ map.put("UPDATE_REFS_NOT_PAGED",
+ "UPDATE JBM_MSG_REF SET PAGE_ORD = NULL WHERE PAGE_ORD BETWEEN ? AND ? AND CHANNEL_ID=?");
+ map.put("SELECT_MIN_MAX_PAGE_ORD",
+ "SELECT MIN(PAGE_ORD), MAX(PAGE_ORD) FROM JBM_MSG_REF WHERE CHANNEL_ID = ?");
+ map.put("SELECT_EXISTS_REF_MESSAGE_ID",
+ "SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE MESSAGE_ID = ?");
+ map.put("UPDATE_DELIVERY_COUNT",
+ "UPDATE JBM_MSG_REF SET DELIVERY_COUNT = ? WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?");
+ map.put("UPDATE_CHANNEL_ID",
+ "UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE CHANNEL_ID = ?");
+ map.put("MOVE_REFERENCE",
+ "UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?");
+
+ // Message
map.put("LOAD_MESSAGES",
- "SELECT MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, " +
- "PRIORITY, HEADERS, PAYLOAD, TYPE " +
- "FROM JBM_MSG");
+ "SELECT MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, "
+ + "PRIORITY, HEADERS, PAYLOAD, TYPE " + "FROM JBM_MSG");
map.put("INSERT_MESSAGE",
- "INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, " +
- "TIMESTAMP, PRIORITY, TYPE, INS_TIME, HEADERS, PAYLOAD) " +
- "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)" );
+ "INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, "
+ + "TIMESTAMP, PRIORITY, TYPE, HEADERS, PAYLOAD) "
+ + "VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
map.put("INSERT_MESSAGE_CONDITIONAL",
- "INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, " +
- "TIMESTAMP, PRIORITY, TYPE, INS_TIME) " +
- "SELECT ?, ?, ?, ?, ?, ?, ? " +
- "FROM JBM_DUAL WHERE NOT EXISTS (SELECT MESSAGE_ID FROM JBM_MSG WHERE MESSAGE_ID = ?)");
- map.put("INSERT_MESSAGE_CONDITIONAL_FULL", "INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, TYPE, INS_TIME, HEADERS, PAYLOAD) SELECT ?, ?, ?, ?, ?, ?, ?, ?, ? FROM JBM_DUAL WHERE NOT EXISTS (SELECT MESSAGE_ID FROM JBM_MSG WHERE MESSAGE_ID = ?)");
- map.put("UPDATE_MESSAGE_4CONDITIONAL", "UPDATE JBM_MSG SET HEADERS=?, PAYLOAD=? WHERE MESSAGE_ID=?");
+ "INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, "
+ + "TIMESTAMP, PRIORITY, TYPE) "
+ + "SELECT ?, ?, ?, ?, ?, ? "
+ + "FROM JBM_DUAL WHERE NOT EXISTS (SELECT MESSAGE_ID FROM JBM_MSG WHERE MESSAGE_ID = ?)");
+ map.put("INSERT_MESSAGE_CONDITIONAL_FULL",
+ "INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, TYPE, HEADERS, PAYLOAD) SELECT ?, ?, ?, ?, ?, ?, ?, ? FROM JBM_DUAL WHERE NOT EXISTS (SELECT MESSAGE_ID FROM JBM_MSG WHERE MESSAGE_ID = ?)");
+ map.put("UPDATE_MESSAGE_4CONDITIONAL",
+ "UPDATE JBM_MSG SET HEADERS=?, PAYLOAD=? WHERE MESSAGE_ID=?");
map.put("MESSAGE_ID_COLUMN", "MESSAGE_ID");
- map.put("REAP_MESSAGES", "DELETE FROM JBM_MSG WHERE INS_TIME <= ? AND NOT EXISTS (SELECT * FROM JBM_MSG_REF WHERE JBM_MSG_REF.MESSAGE_ID = JBM_MSG.MESSAGE_ID)");
- map.put("DELETE_MESSAGE", "DELETE FROM JBM_MSG WHERE MESSAGE_ID = ? AND NOT EXISTS (SELECT * FROM JBM_MSG_REF WHERE JBM_MSG_REF.MESSAGE_ID = ?)");
- //Transaction
+ map.put("DELETE_MESSAGE",
+ "DELETE FROM JBM_MSG WHERE MESSAGE_ID = ? AND NOT EXISTS (SELECT * FROM JBM_MSG_REF WHERE JBM_MSG_REF.MESSAGE_ID = ?)");
+ // Transaction
map.put("INSERT_TRANSACTION",
- "INSERT INTO JBM_TX (NODE_ID, TRANSACTION_ID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID) " +
- "VALUES(?, ?, ?, ?, ?)");
- map.put("DELETE_TRANSACTION", "DELETE FROM JBM_TX WHERE NODE_ID = ? AND TRANSACTION_ID = ?");
- map.put("SELECT_PREPARED_TRANSACTIONS", "SELECT TRANSACTION_ID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID FROM JBM_TX WHERE NODE_ID = ?");
- map.put("SELECT_MESSAGE_ID_FOR_REF", "SELECT MESSAGE_ID, CHANNEL_ID FROM JBM_MSG_REF WHERE TRANSACTION_ID = ? AND STATE = '+' ORDER BY ORD");
- map.put("SELECT_MESSAGE_ID_FOR_ACK", "SELECT MESSAGE_ID, CHANNEL_ID FROM JBM_MSG_REF WHERE TRANSACTION_ID = ? AND STATE = '-' ORDER BY ORD");
+ "INSERT INTO JBM_TX (NODE_ID, TRANSACTION_ID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID) "
+ + "VALUES(?, ?, ?, ?, ?)");
+ map.put("DELETE_TRANSACTION",
+ "DELETE FROM JBM_TX WHERE NODE_ID = ? AND TRANSACTION_ID = ?");
+ map.put("SELECT_PREPARED_TRANSACTIONS",
+ "SELECT TRANSACTION_ID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID FROM JBM_TX WHERE NODE_ID = ?");
+ map.put("SELECT_MESSAGE_ID_FOR_REF",
+ "SELECT MESSAGE_ID, CHANNEL_ID FROM JBM_MSG_REF WHERE TRANSACTION_ID = ? AND STATE = '+' ORDER BY ORD");
+ map.put("SELECT_MESSAGE_ID_FOR_ACK",
+ "SELECT MESSAGE_ID, CHANNEL_ID FROM JBM_MSG_REF WHERE TRANSACTION_ID = ? AND STATE = '-' ORDER BY ORD");
map.put("UPDATE_TX", "UPDATE JBM_TX SET NODE_ID=? WHERE NODE_ID=?");
-
- //Counter
- map.put("UPDATE_COUNTER", "UPDATE JBM_COUNTER SET NEXT_ID = ? WHERE NAME=?");
+
+ // Counter
+ map.put("UPDATE_COUNTER",
+ "UPDATE JBM_COUNTER SET NEXT_ID = ? WHERE NAME=?");
map.put("SELECT_COUNTER", "SELECT NEXT_ID FROM JBM_COUNTER WHERE NAME=?");
- map.put("INSERT_COUNTER", "INSERT INTO JBM_COUNTER (NAME, NEXT_ID) VALUES (?, ?)");
- //Other
- map.put("SELECT_ALL_CHANNELS", "SELECT DISTINCT(CHANNEL_ID) FROM JBM_MSG_REF");
+ map.put("INSERT_COUNTER",
+ "INSERT INTO JBM_COUNTER (NAME, NEXT_ID) VALUES (?, ?)");
+ // Other
+ map.put("SELECT_ALL_CHANNELS",
+ "SELECT DISTINCT(CHANNEL_ID) FROM JBM_MSG_REF");
return map;
}
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/MessagingQueue.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/MessagingQueue.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/MessagingQueue.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,35 +21,18 @@
*/
package org.jboss.messaging.core.impl;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
+import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
+import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
import org.jboss.jms.server.MessagingTimeoutFactory;
import org.jboss.logging.Logger;
-import org.jboss.messaging.core.contract.Delivery;
-import org.jboss.messaging.core.contract.DeliveryObserver;
-import org.jboss.messaging.core.contract.Distributor;
-import org.jboss.messaging.core.contract.Filter;
-import org.jboss.messaging.core.contract.Message;
-import org.jboss.messaging.core.contract.MessageReference;
-import org.jboss.messaging.core.contract.MessageStore;
-import org.jboss.messaging.core.contract.PersistenceManager;
+import org.jboss.messaging.core.contract.*;
import org.jboss.messaging.core.contract.Queue;
-import org.jboss.messaging.core.contract.Receiver;
import org.jboss.messaging.core.impl.clusterconnection.MessageSucker;
import org.jboss.messaging.core.impl.tx.Transaction;
import org.jboss.util.timeout.Timeout;
import org.jboss.util.timeout.TimeoutTarget;
-import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
-import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
+import java.util.*;
/**
*
@@ -511,7 +494,7 @@
{
if (trace) { log.trace("Informing suckers"); }
//The receivers are still ready for more messages but there is nothing left in the local queue
- //so we inform the message suckers to start consuming (if they aren't already)
+ //so we inform the message suckers to startServerPeer consuming (if they aren't already)
informSuckers(true);
}
}
@@ -524,7 +507,7 @@
if (handleFlowControlForConsumers && receiversReady == false)
{
- //No receivers are ready to accept message so tell the suckers to stop consuming
+ //No receivers are ready to accept message so tell the suckers to stopServerPeer consuming
informSuckers(false);
}
}
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/clusterconnection/ClusterConnectionManager.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/clusterconnection/ClusterConnectionManager.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/clusterconnection/ClusterConnectionManager.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -22,28 +22,17 @@
package org.jboss.messaging.core.impl.clusterconnection;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.jms.JMSException;
-
+import EDU.oswego.cs.dl.util.concurrent.Callable;
+import EDU.oswego.cs.dl.util.concurrent.TimedCallable;
import org.jboss.jms.client.JBossConnection;
import org.jboss.jms.client.JBossConnectionFactory;
import org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate;
import org.jboss.logging.Logger;
-import org.jboss.messaging.core.contract.Binding;
-import org.jboss.messaging.core.contract.ClusterNotification;
-import org.jboss.messaging.core.contract.ClusterNotificationListener;
-import org.jboss.messaging.core.contract.PostOffice;
+import org.jboss.messaging.core.contract.*;
import org.jboss.messaging.core.contract.Queue;
-import org.jboss.messaging.core.contract.Replicator;
-import EDU.oswego.cs.dl.util.concurrent.Callable;
-import EDU.oswego.cs.dl.util.concurrent.TimedCallable;
+import javax.jms.JMSException;
+import java.util.*;
/**
*
@@ -428,7 +417,7 @@
}
catch (Exception e)
{
- log.error("Failed to start connection info ", e);
+ log.error("Failed to startServerPeer connection info ", e);
}
}
}
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/clusterconnection/MessageSucker.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/clusterconnection/MessageSucker.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/clusterconnection/MessageSucker.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -22,14 +22,6 @@
package org.jboss.messaging.core.impl.clusterconnection;
-import javax.jms.DeliveryMode;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.Session;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-import javax.transaction.xa.XAResource;
-
import org.jboss.jms.client.JBossConnection;
import org.jboss.jms.client.JBossSession;
import org.jboss.jms.delegate.ConsumerDelegate;
@@ -42,6 +34,14 @@
import org.jboss.messaging.core.contract.Queue;
import org.jboss.tm.TransactionManagerLocator;
+import javax.jms.DeliveryMode;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.Session;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import javax.transaction.xa.XAResource;
+
/**
*
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -211,7 +211,7 @@
{
if (consume && !consuming)
{
- //Send a changeRate(1) message - to start consumption
+ //Send a changeRate(1) message - to startServerPeer consumption
consumer.changeRate(1f);
@@ -221,7 +221,7 @@
}
else if (!consume && consuming)
{
- //Send a changeRate(0) message to stop consumption
+ //Send a changeRate(0) message to stopServerPeer consumption
consumer.changeRate(0f);
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/postoffice/GroupMember.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/postoffice/GroupMember.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/postoffice/GroupMember.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,6 +21,15 @@
*/
package org.jboss.messaging.core.impl.postoffice;
+import org.jboss.logging.Logger;
+import org.jboss.messaging.core.contract.ChannelFactory;
+import org.jgroups.*;
+import org.jgroups.blocks.GroupRequest;
+import org.jgroups.blocks.MessageDispatcher;
+import org.jgroups.blocks.RequestHandler;
+import org.jgroups.util.Rsp;
+import org.jgroups.util.RspList;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
@@ -30,21 +39,6 @@
import java.util.List;
import java.util.Vector;
-import org.jboss.logging.Logger;
-import org.jboss.messaging.core.contract.ChannelFactory;
-import org.jgroups.Address;
-import org.jgroups.Channel;
-import org.jgroups.MembershipListener;
-import org.jgroups.Message;
-import org.jgroups.MessageListener;
-import org.jgroups.Receiver;
-import org.jgroups.View;
-import org.jgroups.blocks.GroupRequest;
-import org.jgroups.blocks.MessageDispatcher;
-import org.jgroups.blocks.RequestHandler;
-import org.jgroups.util.Rsp;
-import org.jgroups.util.RspList;
-
/**
*
* This class handles the interface with JGroups
@@ -147,7 +141,7 @@
//The first thing that happens after connect is a view change arrives
//Then the state will arrive (if we are not the first member)
- //Then the control messages will start arriving.
+ //Then the control messages will startServerPeer arriving.
//We can guarantee that messages won't arrive until after the state is set because we use
//the FLUSH protocol on the control channel
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -27,6 +27,7 @@
import org.jboss.jms.server.JMSConditionFactory;
import org.jboss.jms.server.ServerPeer;
import org.jboss.jms.server.endpoint.ServerSessionEndpoint;
+import org.jboss.jms.server.selector.SelectorFactory;
import org.jboss.logging.Logger;
import org.jboss.messaging.core.contract.*;
import org.jboss.messaging.core.contract.Queue;
@@ -36,7 +37,6 @@
import org.jboss.messaging.core.impl.jchannelfactory.MultiplexerChannelFactory;
import org.jboss.messaging.core.impl.message.SimpleMessageStore;
import org.jboss.messaging.core.impl.tx.Transaction;
-import org.jboss.messaging.core.impl.tx.TransactionRepository;
import org.jboss.messaging.core.impl.tx.TxCallback;
import org.jboss.messaging.util.ClearableSemaphore;
import org.jboss.messaging.util.ConcurrentHashSet;
@@ -125,8 +125,6 @@
private PersistenceManager pm;
- private TransactionRepository tr;
-
private FilterFactory filterFactory;
private ConditionFactory conditionFactory;
@@ -205,6 +203,8 @@
waitForBindUnbindLock = new Object();
ms = new SimpleMessageStore();
+
+ filterFactory = new SelectorFactory();
}
@@ -245,7 +245,7 @@
//Sanity check - we check there aren't any other nodes already in the cluster with the same node id
if (knowAboutNodeId(configuration.getServerPeerID()))
{
- throw new IllegalArgumentException("Cannot start post office since there is already a post office in the " +
+ throw new IllegalArgumentException("Cannot startServerPeer post office since there is already a post office in the " +
"cluster with the same node id (" + configuration.getServerPeerID() + "). " +
"Are you sure you have given each node a unique node id during installation?");
}
@@ -271,7 +271,7 @@
started = true;
- log.debug(this + " started");
+ log.debug(this + " started");
}
public synchronized void stop() throws Exception
@@ -2063,7 +2063,7 @@
{
if (trace) { log.trace("Starting internal tx, reliableCount = " + localReliableCount); }
- tx = tr.createTransaction();
+ tx = serverPeer.getTxRepository().createTransaction();
startedTx = true;
}
Modified: branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/tx/TransactionRepository.java
===================================================================
--- branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/tx/TransactionRepository.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/src/main/org/jboss/messaging/core/impl/tx/TransactionRepository.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,28 +21,18 @@
*/
package org.jboss.messaging.core.impl.tx;
+import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
+import org.jboss.logging.Logger;
+import org.jboss.messaging.core.contract.*;
+import org.jboss.messaging.core.impl.IDManager;
+import org.jboss.messaging.core.impl.SimpleDelivery;
+
+import javax.transaction.xa.Xid;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import javax.transaction.xa.Xid;
-
-import org.jboss.logging.Logger;
-import org.jboss.messaging.core.contract.Binding;
-import org.jboss.messaging.core.contract.Delivery;
-import org.jboss.messaging.core.contract.Message;
-import org.jboss.messaging.core.contract.MessageReference;
-import org.jboss.messaging.core.contract.MessageStore;
-import org.jboss.messaging.core.contract.MessagingComponent;
-import org.jboss.messaging.core.contract.PersistenceManager;
-import org.jboss.messaging.core.contract.PostOffice;
-import org.jboss.messaging.core.contract.Queue;
-import org.jboss.messaging.core.impl.IDManager;
-import org.jboss.messaging.core.impl.SimpleDelivery;
-
-import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
-
/**
* This class maintains JMS Server local transactions.
*
@@ -110,7 +100,7 @@
public void stop() throws Exception
{
- //NOOP
+ map.clear();
}
// Public --------------------------------------------------------
Modified: branches/Branch_MC_Integration_New/tests/build.sh
===================================================================
--- branches/Branch_MC_Integration_New/tests/build.sh 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/build.sh 2007-11-28 19:18:54 UTC (rev 3382)
@@ -3,7 +3,7 @@
reldir=`dirname $0`
-#export ANT_OPTS="-Xmx1024m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=ant"
+#export ANT_OPTS="-Xmx1024m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"
export ANT_OPTS=-Xmx1024m
$ANT_HOME/bin/ant -lib $reldir/../thirdparty/junit/lib/junit.jar "$@"
Modified: branches/Branch_MC_Integration_New/tests/build.xml
===================================================================
--- branches/Branch_MC_Integration_New/tests/build.xml 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/build.xml 2007-11-28 19:18:54 UTC (rev 3382)
@@ -150,7 +150,7 @@
<path refid="hsqldb.hsqldb.classpath"/>
<path refid="jboss.profiler.jvmti.classpath"/>
<path refid="jboss.test14.classpath"/>
- <!--<path refid="jboss.jbossretro.rt.classpath"/>-->
+ <path refid="jboss.jboss.retro.classpath"/>
</path>
<!--
@@ -175,6 +175,18 @@
<path refid="hsqldb.hsqldb.classpath"/>
<path refid="apache.tomcat.classpath"/>
<path refid="apache.logging.classpath"/>
+ <path refid="jboss.aop.classpath"/>
+ <path refid="jboss.microcontainer.classpath"/>
+ <path refid="jboss.jboss.security.spi.classpath"/>
+ <path refid="jboss.jboss.jaspi.api.classpath"/>
+ <path refid="jboss.integration.classpath"/>
+ <path refid="jboss.jbosssx.client.classpath"/>
+ <path refid="jboss.jboss.javaee.classpath"/>
+ <path refid="jboss.jbossts14.classpath"/>
+ <path refid="jboss.remoting.classpath"/>
+ <path refid="jboss.jbossxb.classpath"/>
+ <path refid="jboss.common.classpath"/>
+ <path refid="jboss.common.core.classpath"/>
</path>
<path id="stress.test.execution.classpath">
@@ -289,7 +301,7 @@
<target name="short-tests" depends="tests-jar, prepare-testdirs, clear-test-logs">
- <antcall target="invm-tests"/>
+ <!--<antcall target="invm-tests"/>-->
<antcall target="remote-tests"/>
@@ -338,9 +350,7 @@
<sysproperty key="build.lib" value="${build.lib}"/>
<sysproperty key="objectstore.dir" value="${objectstore.dir}"/>
<jvmarg value="-Xmx512M"/>
- <!--
- <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=antjunit"/>
- -->
+ <!--<jvmarg line="-Xmx512M -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/>-->
<classpath refid="test.execution.classpath"/>
<formatter type="xml" usefile="${junit.formatter.usefile}"/>
<batchtest todir="${junit.batchtest.todir}"
@@ -359,6 +369,11 @@
<exclude name="**/jms/bridge/**"/>
<exclude name="**/jms/manual/**"/>
<exclude name="**/jms/clustering/**"/>
+ <exclude name="**/jms/ExpiryQueueTest.class"/>
+ <exclude name="**/jms/DLQTest.class"/>
+ <exclude name="**/postoffice/**"/>
+ <exclude name="**/jms/JCAWrapperTest.class"/>
+ <exclude name="**/jms/server/ServerPeerTest.class"/>
</fileset>
</batchtest>
</junit>
Added: branches/Branch_MC_Integration_New/tests/etc/database-clearer.xml
===================================================================
--- branches/Branch_MC_Integration_New/tests/etc/database-clearer.xml (rev 0)
+++ branches/Branch_MC_Integration_New/tests/etc/database-clearer.xml 2007-11-28 19:18:54 UTC (rev 3382)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+ <bean name="DatabaseClearer" class="org.jboss.test.messaging.tools.container.DatabaseClearer">
+ <property name="dataSource"><inject bean="jboss.jca:name=DefaultDS,service=DataSourceBinding"/></property>
+ <property name="transactionManager"><inject bean="jboss:service=TransactionManager"/></property>
+ </bean>
+</deployment>
\ No newline at end of file
Added: branches/Branch_MC_Integration_New/tests/etc/datasource.xml
===================================================================
--- branches/Branch_MC_Integration_New/tests/etc/datasource.xml (rev 0)
+++ branches/Branch_MC_Integration_New/tests/etc/datasource.xml 2007-11-28 19:18:54 UTC (rev 3382)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+ <!--<bean name="jboss.jca:name=DefaultDS,service=DataSourceBinding" class="org.hsqldb.jdbc.jdbcDataSource">
+ <property name="database">jdbc:hsqldb:file:myHSQLDBInstance</property>
+ <property name="user">sa</property>
+ </bean>-->
+ <bean name="jboss.jca:name=DefaultDS,service=DataSourceBinding" class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource">
+ <property name="url">jdbc:mysql://localhost/messaging</property>
+ <property name="user">andy</property>
+ </bean>
+</deployment>
\ No newline at end of file
Added: branches/Branch_MC_Integration_New/tests/etc/invm-beans.xml
===================================================================
--- branches/Branch_MC_Integration_New/tests/etc/invm-beans.xml (rev 0)
+++ branches/Branch_MC_Integration_New/tests/etc/invm-beans.xml 2007-11-28 19:18:54 UTC (rev 3382)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+ <bean name="ConfigurationHelper" class="org.jboss.test.messaging.tools.ConfigurationHelper">
+ <property name="configuration"><inject bean="Configuration"/> </property>
+ </bean>
+
+
+ <bean name="JaasBinding" class="org.jboss.jms.server.microcontainer.JndiBinder">
+ <property name="jndiProperties">
+ <inject bean="ConfigurationHelper" property="environment"/>
+ </property>
+ <property name="target">
+ <inject bean="Jaas"/>
+ </property>
+ <property name="bindTo">java:/jaas/messaging</property>
+ </bean>
+
+ <bean name="Jaas" class="org.jboss.test.messaging.tools.container.MockJBossSecurityManager"/>
+
+ <bean name="DSBinding" class="org.jboss.jms.server.microcontainer.JndiBinder">
+ <property name="jndiProperties">
+ <inject bean="ConfigurationHelper" property="environment"/>
+ </property>
+ <property name="target">
+ <inject bean="jboss.jca:name=DefaultDS,service=DataSourceBinding"/>
+ </property>
+ <property name="bindTo">java:/DefaultDS</property>
+ </bean>
+
+ <bean name="TMBinding" class="org.jboss.jms.server.microcontainer.JndiBinder">
+ <property name="jndiProperties">
+ <inject bean="ConfigurationHelper" property="environment"/>
+ </property>
+ <property name="target">
+ <inject bean="jboss:service=TransactionManager"/>
+ </property>
+ <property name="bindTo">java:/TransactionManager</property>
+ </bean>
+
+ <bean class="org.jgroups.JChannelFactory" name="JChannelFactory">
+ <!--mbean code="org.jgroups.JChannelFactory" name="jgroups.mux:name=Multiplexer" xmbean-dd="resource:META-INF/multiplexer-xmbean.xml" -->
+ <property name="domain">jgroups.mux</property>
+ <property name="multiplexerConfig">multiplexer-stacks.xml</property>
+ <property name="exposeChannels">false</property>
+ <property name="exposeProtocols">false</property>
+
+ <!-- The address used to determine the node name -->
+ <!-- <attribute name="NodeAddress">${jboss.bind.address}</attribute> -->
+
+ </bean>
+
+</deployment>
\ No newline at end of file
Modified: branches/Branch_MC_Integration_New/tests/etc/log4j.info.xml
===================================================================
--- branches/Branch_MC_Integration_New/tests/etc/log4j.info.xml 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/etc/log4j.info.xml 2007-11-28 19:18:54 UTC (rev 3382)
@@ -32,7 +32,7 @@
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
<param name="Target" value="System.out"/>
- <param name="Threshold" value="INFO"/>
+ <param name="Threshold" value="TRACE"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%t %d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
</layout>
@@ -43,7 +43,7 @@
</category>
<category name="org.jgroups">
- <priority value="WARN"/>
+ <priority value="TRACE"/>
</category>
<category name="org.jboss">
Added: branches/Branch_MC_Integration_New/tests/etc/persistencemanager.xml
===================================================================
--- branches/Branch_MC_Integration_New/tests/etc/persistencemanager.xml (rev 0)
+++ branches/Branch_MC_Integration_New/tests/etc/persistencemanager.xml 2007-11-28 19:18:54 UTC (rev 3382)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+ <bean name="Configuration" class="org.jboss.jms.server.Configuration"/>
+
+ <bean name="ServiceLocator" class="org.jboss.jms.server.microcontainer.ServiceLocator">
+ <demand>jboss.jca:name=DefaultDS,service=DataSourceBinding</demand>
+ <depends>jboss:service=TransactionManager</depends>
+ <!-- <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>-->
+ </bean>
+ <bean name="PersistenceManager" class="org.jboss.messaging.core.impl.JDBCPersistenceManager">
+ <property name="tm">
+ <inject bean="ServiceLocator" property="transactionManager"/>
+ </property>
+ <property name="ds">
+ <inject bean="ServiceLocator" property="dataSource"/>
+ </property>
+ <property name="createTablesOnStartup">true</property>
+ <property name="maxParams">500</property>
+ </bean>
+</deployment>
Added: branches/Branch_MC_Integration_New/tests/etc/remote.xml
===================================================================
--- branches/Branch_MC_Integration_New/tests/etc/remote.xml (rev 0)
+++ branches/Branch_MC_Integration_New/tests/etc/remote.xml 2007-11-28 19:18:54 UTC (rev 3382)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="ServerPeerBinding" class="org.jboss.jms.server.microcontainer.JndiBinder">
+ <property name="jndiProperties">
+ <inject bean="ConfigurationHelper" property="environment"/>
+ </property>
+ <property name="target">
+ <inject bean="ServerPeer"/>
+ </property>
+ <property name="bindTo">java:/ServerPeer</property>
+ </bean>
+
+ <bean name="ServerPeerStatisticsBinding" class="org.jboss.jms.server.microcontainer.JndiBinder">
+ <property name="jndiProperties">
+ <inject bean="ConfigurationHelper" property="environment"/>
+ </property>
+ <property name="target">
+ <inject bean="ServerPeerStatistics"/>
+ </property>
+ <property name="bindTo">java:/ServerPeerStatistics</property>
+ </bean>
+
+</deployment>
\ No newline at end of file
Added: branches/Branch_MC_Integration_New/tests/etc/transaction-manager.xml
===================================================================
--- branches/Branch_MC_Integration_New/tests/etc/transaction-manager.xml (rev 0)
+++ branches/Branch_MC_Integration_New/tests/etc/transaction-manager.xml 2007-11-28 19:18:54 UTC (rev 3382)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+ <bean name="jboss:service=TransactionManager"
+ class="com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple"/>
+</deployment>
\ No newline at end of file
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/DropTablesTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/DropTablesTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/DropTablesTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -1,7 +1,5 @@
package org.jboss.test.messaging;
-import org.jboss.test.messaging.tools.container.ServiceContainer;
-
/**
*
* This test only exists so we have a way of dropping the tables on Hudson for QA runs
@@ -12,7 +10,7 @@
* $Id: $
*
*/
-public class DropTablesTest extends MessagingTestCase
+public class DropTablesTest extends JBMServerTestCase
{
public DropTablesTest(String name)
@@ -22,23 +20,9 @@
public void testDropTables() throws Exception
{
- ServiceContainer sc = null;
-
- try
- {
- sc = new ServiceContainer("all");
-
- sc.start();
-
- sc.dropTables();
- }
- finally
- {
- if (sc != null)
- {
- sc.stop();
- }
- }
+
+ dropTables();
+
}
}
Added: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/JBMBaseTestCase.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/JBMBaseTestCase.java (rev 0)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/JBMBaseTestCase.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -0,0 +1,374 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.messaging;
+
+import org.jboss.jms.client.JBossConnection;
+import org.jboss.jms.server.microcontainer.JBMBootstrapServer;
+import org.jboss.logging.Logger;
+import org.jboss.test.messaging.util.ProxyAssertSupport;
+import org.jboss.tm.TransactionManagerLocator;
+
+import javax.jms.*;
+import javax.naming.InitialContext;
+import javax.sql.DataSource;
+import javax.transaction.TransactionManager;
+import java.lang.IllegalStateException;
+import java.lang.ref.WeakReference;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public class JBMBaseTestCase extends ProxyAssertSupport
+{
+ private JBMBootstrapServer bootstrap;
+
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ protected Logger log = Logger.getLogger(getClass());
+
+ // Constructors --------------------------------------------------
+
+ public JBMBaseTestCase()
+ {
+ super(); //To change body of overridden methods use File | Settings | File Templates.
+ }
+
+ public JBMBaseTestCase(String string)
+ {
+ super(string); //To change body of overridden methods use File | Settings | File Templates.
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ System.setProperty("java.naming.factory.initial", getContextFactory());
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ protected List getMessageIds() throws Exception
+ {
+ InitialContext ctx = getInitialContext();
+
+ TransactionManager mgr = TransactionManagerLocator.locateTransactionManager();
+ DataSource ds = (DataSource)ctx.lookup("java:/DefaultDS");
+
+ javax.transaction.Transaction txOld = mgr.suspend();
+ mgr.begin();
+
+ java.sql.Connection conn = ds.getConnection();
+ String sql = "SELECT MESSAGE_ID FROM JBM_MSG ORDER BY MESSAGE_ID";
+ PreparedStatement ps = conn.prepareStatement(sql);
+
+ ResultSet rs = ps.executeQuery();
+
+ List msgIds = new ArrayList();
+
+ while (rs.next())
+ {
+ long msgId = rs.getLong(1);
+ msgIds.add(new Long(msgId));
+ }
+ rs.close();
+ ps.close();
+ conn.close();
+
+ mgr.commit();
+
+ if (txOld != null)
+ {
+ mgr.resume(txOld);
+ }
+
+ return msgIds;
+ }
+
+ protected List getReferenceIds() throws Exception
+ {
+ InitialContext ctx = getInitialContext();
+
+ TransactionManager mgr = TransactionManagerLocator.locateTransactionManager();
+ DataSource ds = (DataSource)ctx.lookup("java:/DefaultDS");
+
+ javax.transaction.Transaction txOld = mgr.suspend();
+ mgr.begin();
+
+ java.sql.Connection conn = ds.getConnection();
+ String sql = "SELECT MESSAGE_ID, ORD FROM JBM_MSG_REF";
+ PreparedStatement ps = conn.prepareStatement(sql);
+
+ ResultSet rs = ps.executeQuery();
+
+ List msgIds = new ArrayList();
+
+ while (rs.next())
+ {
+ long msgId = rs.getLong(1);
+ msgIds.add(new Long(msgId));
+ }
+ rs.close();
+ ps.close();
+ conn.close();
+
+ mgr.commit();
+
+ if (txOld != null)
+ {
+ mgr.resume(txOld);
+ }
+
+ return msgIds;
+ }
+
+ protected List getReferenceIds(long channelId) throws Throwable
+ {
+ InitialContext ctx = getInitialContext();
+
+ TransactionManager mgr = TransactionManagerLocator.locateTransactionManager();
+ DataSource ds = (DataSource)ctx.lookup("java:/DefaultDS");
+
+ javax.transaction.Transaction txOld = mgr.suspend();
+ mgr.begin();
+
+ java.sql.Connection conn = ds.getConnection();
+ String sql = "SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE CHANNEL_ID=? ORDER BY ORD";
+ PreparedStatement ps = conn.prepareStatement(sql);
+ ps.setLong(1, channelId);
+
+ ResultSet rs = ps.executeQuery();
+
+ List msgIds = new ArrayList();
+
+ while (rs.next())
+ {
+ long msgId = rs.getLong(1);
+ msgIds.add(new Long(msgId));
+ }
+ rs.close();
+ ps.close();
+ conn.close();
+
+ mgr.commit();
+
+ if (txOld != null)
+ {
+ mgr.resume(txOld);
+ }
+
+ return msgIds;
+ }
+
+ protected boolean checkNoBindingData() throws Exception
+ {
+ InitialContext ctx = getInitialContext();
+
+ TransactionManager mgr = TransactionManagerLocator.locateTransactionManager();
+ DataSource ds = (DataSource)ctx.lookup("java:/DefaultDS");
+
+ javax.transaction.Transaction txOld = mgr.suspend();
+ mgr.begin();
+
+ java.sql.Connection conn = null;
+
+ PreparedStatement ps = null;
+
+ ResultSet rs = null;
+
+ try
+ {
+ conn = ds.getConnection();
+ String sql = "SELECT * FROM JBM_POSTOFFICE";
+ ps = conn.prepareStatement(sql);
+
+ rs = ps.executeQuery();
+
+ return rs.next();
+ }
+ finally
+ {
+ if (rs != null) rs.close();
+
+ if (ps != null) ps.close();
+
+ if (conn != null) conn.close();
+
+ mgr.commit();
+
+ if (txOld != null)
+ {
+ mgr.resume(txOld);
+ }
+
+ }
+ }
+
+ protected XAConnection createXAConnectionOnServer(XAConnectionFactory factory, int serverId)
+ throws Exception
+ {
+ int count=0;
+
+ while (true)
+ {
+ if (count++>10)
+ return null;
+
+ XAConnection connection = factory.createXAConnection();
+
+ if (getServerId(connection) == serverId)
+ {
+ return connection;
+ }
+ else
+ {
+ connection.close();
+ }
+ }
+ }
+
+ /**
+ * @param conn a JMS connection
+ * @return the ID of the ServerPeer the connection is communicating with.
+ */
+ protected static int getServerId(Connection conn)
+ {
+ return ((JBossConnection) conn).getServerID();
+ }
+ protected Connection createConnectionOnServer(ConnectionFactory factory, int serverId)
+ throws Exception
+ {
+ int count=0;
+
+ while (true)
+ {
+ if (count++>10)
+ throw new IllegalStateException("Cannot make connection to node " + serverId);
+
+ Connection connection = factory.createConnection();
+
+ if (getServerId(connection) == serverId)
+ {
+ return connection;
+ }
+ else
+ {
+ connection.close();
+ }
+ }
+ }
+
+ protected Connection createConnectionOnServer(ConnectionFactory factory, int serverId, String user, String password)
+ throws Exception
+ {
+ int count=0;
+
+ while (true)
+ {
+ if (count++>10)
+ throw new IllegalStateException("Cannot make connection to node " + serverId);
+
+ Connection connection = factory.createConnection(user, password);
+
+ if (getServerId(connection) == serverId)
+ {
+ return connection;
+ }
+ else
+ {
+ connection.close();
+ }
+ }
+ }
+
+ protected void checkNoSubscriptions(Topic topic) throws Exception
+ {
+
+ }
+
+ protected void checkNoSubscriptions(Topic topic, int server) throws Exception
+ {
+
+ }
+
+ public InitialContext getInitialContext() throws Exception
+ {
+ Properties props = new Properties();
+ props.setProperty("java.naming.factory.initial", getContextFactory());
+ //props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
+ return new InitialContext(props);
+ }
+
+ public String getContextFactory()
+ {
+ return "org.jboss.test.messaging.tools.container.InVMInitialContextFactory";
+ }
+ protected void drainDestination(ConnectionFactory cf, Destination dest) throws Exception
+ {
+ Connection conn = null;
+ try
+ {
+ conn = cf.createConnection();
+ Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer cons = sess.createConsumer(dest);
+ Message m = null;
+ conn.start();
+ log.trace("Draining messages from " + dest);
+ while (true)
+ {
+ m = cons.receive(500);
+ if (m == null) break;
+ log.trace("Drained message");
+ }
+ }
+ finally
+ {
+ if (conn!= null) conn.close();
+ }
+ }
+
+ /** Some testcases are time sensitive, and we need to make sure a GC would happen before certain scenarios*/
+ protected void forceGC()
+ {
+ WeakReference dumbReference = new WeakReference(new Object());
+ // A loopt that will wait GC, using the minimal time as possible
+ while (dumbReference.get() != null)
+ {
+ System.gc();
+ try
+ {
+ Thread.sleep(500);
+ } catch (InterruptedException e)
+ {
+ }
+ }
+ }
+}
Added: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/JBMServerTestCase.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/JBMServerTestCase.java (rev 0)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/JBMServerTestCase.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -0,0 +1,731 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.messaging;
+
+import org.jboss.jms.client.JBossConnectionFactory;
+import org.jboss.jms.message.MessageIdGeneratorFactory;
+import org.jboss.jms.server.JmsServer;
+import org.jboss.jms.server.JmsServerStatistics;
+import org.jboss.jms.server.ServerPeer;
+import org.jboss.jms.server.microcontainer.JBMBootstrapServer;
+import org.jboss.jms.server.security.Role;
+import org.jboss.jms.tx.ResourceManagerFactory;
+import org.jboss.messaging.core.contract.PersistenceManager;
+import org.jboss.test.messaging.tools.ServerManagement;
+import org.jboss.test.messaging.tools.container.DatabaseClearer;
+import org.jboss.test.messaging.tools.container.Server;
+import org.jboss.tm.TransactionManagerLocator;
+
+import javax.jms.Queue;
+import javax.jms.Topic;
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+import javax.sql.DataSource;
+import javax.transaction.TransactionManager;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+
+/**
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public class JBMServerTestCase extends JBMBaseTestCase
+{
+ // Constants -----------------------------------------------------
+
+ public final static int MAX_TIMEOUT = 1000 * 10 /* seconds */;
+
+ public final static int MIN_TIMEOUT = 1000 * 1 /* seconds */;
+
+ protected static List<Server> servers = new ArrayList<Server>();
+
+ protected static Topic topic1;
+
+ protected static Topic topic2;
+
+ protected static Topic topic3;
+
+ protected static Queue queue1;
+
+ protected static Queue queue2;
+
+ protected static Queue queue3;
+
+ protected static Queue queue4;
+ private static DatabaseClearer databaseClearer;
+
+
+ public JBMServerTestCase()
+ {
+ super(); //To change body of overridden methods use File | Settings | File Templates.
+ }
+
+ public JBMServerTestCase(String string)
+ {
+ super(string); //To change body of overridden methods use File | Settings | File Templates.
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ if (getClearDatabase())
+ {
+ clearDatabase();
+ }
+ try
+ {
+ for (int i = servers.size(); i < getServerCount(); i++)
+ {
+ servers.add(ServerManagement.create(i));
+ }
+ for (int i = 0; i < getServerCount(); i++)
+ {
+ if (!servers.get(i).isStarted())
+ {
+ servers.get(i).start(getContainerConfig(), getConfiguration(), getClearDatabase() && i == 0);
+ deployAndLookupAdministeredObjects();
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ for (int i = 0; i < getServerCount(); i++)
+ {
+ servers.get(i).stop();
+ }
+ throw e;
+ }
+ //undeployAdministeredObjects();
+ checkEmpty(queue1);
+ checkEmpty(queue2);
+ checkEmpty(queue3);
+ checkEmpty(queue4);
+
+ // Check no subscriptions left lying around
+
+ checkNoSubscriptions(topic1);
+ checkNoSubscriptions(topic2);
+ checkNoSubscriptions(topic3);
+
+ ResourceManagerFactory.instance.clear();
+ MessageIdGeneratorFactory.instance.clear();
+ ((ServerPeer) getJmsServer()).getTxRepository().stop();
+ ((ServerPeer) getJmsServer()).getTxRepository().start();
+ }
+
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ assertEquals(0, ResourceManagerFactory.instance.size());
+ }
+
+ public void stop() throws Exception
+ {
+ for (int i = 0; i < getServerCount(); i++)
+ {
+ servers.get(i).stop();
+ }
+ }
+
+ public void start() throws Exception
+ {
+ System.setProperty("java.naming.factory.initial", getContextFactory());
+ for (int i = 0; i < getServerCount(); i++)
+ {
+ servers.get(i).start(getContainerConfig(), getConfiguration(), i != 0);
+ }
+ //deployAndLookupAdministeredObjects();
+ }
+
+ public void stopServerPeer() throws Exception
+ {
+ for (int i = 0; i < getServerCount(); i++)
+ {
+ servers.get(i).stopServerPeer();
+ }
+ }
+
+ public void startServerPeer() throws Exception
+ {
+ System.setProperty("java.naming.factory.initial", getContextFactory());
+ for (int i = 0; i < getServerCount(); i++)
+ {
+ servers.get(i).startServerPeer(i, null, null, null, false);
+ }
+ //deployAndLookupAdministeredObjects();
+ }
+
+ public synchronized void stopDestinationManager() throws Exception
+ {
+ for (int i = 0; i < getServerCount(); i++)
+ {
+ servers.get(i).stopDestinationManager();
+ }
+ }
+
+ public synchronized void startDestinationManager() throws Exception
+ {
+ for (int i = 0; i < getServerCount(); i++)
+ {
+ servers.get(i).startDestinationManager();
+ }
+ }
+
+ protected boolean getClearDatabase()
+ {
+ return true;
+ }
+
+ protected HashMap<String, Object> getConfiguration()
+ {
+ return new HashMap<String, Object>();
+ }
+
+ protected void deployAndLookupAdministeredObjects() throws Exception
+ {
+ deployTopic("Topic1");
+ deployTopic("Topic2");
+ deployTopic("Topic3");
+ deployQueue("Queue1");
+ deployQueue("Queue2");
+ deployQueue("Queue3");
+ deployQueue("Queue4");
+
+ InitialContext ic = getInitialContext();
+ topic1 = (Topic) ic.lookup("/topic/Topic1");
+ topic2 = (Topic) ic.lookup("/topic/Topic2");
+ topic3 = (Topic) ic.lookup("/topic/Topic3");
+ queue1 = (Queue) ic.lookup("/queue/Queue1");
+ queue2 = (Queue) ic.lookup("/queue/Queue2");
+ queue3 = (Queue) ic.lookup("/queue/Queue3");
+ queue4 = (Queue) ic.lookup("/queue/Queue4");
+ }
+
+ protected void undeployAdministeredObjects() throws Exception
+ {
+ removeAllMessages("Topic1", false);
+ removeAllMessages("Topic2", false);
+ removeAllMessages("Topic3", false);
+ removeAllMessages("Queue1", true);
+ removeAllMessages("Queue2", true);
+ removeAllMessages("Queue3", true);
+ removeAllMessages("Queue4", true);
+
+ undeployTopic("Topic1");
+ undeployTopic("Topic2");
+ undeployTopic("Topic3");
+ undeployQueue("Queue1");
+ undeployQueue("Queue2");
+ undeployQueue("Queue3");
+ undeployQueue("Queue4");
+ }
+
+ public String[] getContainerConfig()
+ {
+ if(ServerManagement.isLocal())
+ return new String[]{"datasource.xml", "transaction-manager.xml", "invm-beans.xml", "jbm-beans.xml"};
+ else
+ return new String[]{"datasource.xml", "transaction-manager.xml", "invm-beans.xml", "jbm-beans.xml", "remote.xml"};
+ }
+
+ protected JmsServer getJmsServer() throws Exception
+ {
+ return servers.get(0).getJmsServer();
+ }
+
+ protected JmsServerStatistics getJmsServerStatistics() throws Exception
+ {
+ return servers.get(0).getJmsServerStatistics();
+ }
+
+ protected JmsServerStatistics getJmsServerStatistics(int serverId) throws Exception
+ {
+ return servers.get(serverId).getJmsServerStatistics();
+ }
+
+ /*protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ //undeployAdministeredObjects();
+ for (int i = 0; i < getServerCount(); i++)
+ {
+ servers.get(i).stopServerPeer();
+ }
+ }*/
+
+ public int getServerCount()
+ {
+ return 1;
+ }
+
+ public InitialContext getInitialContext() throws Exception
+ {
+ return getInitialContext(0);
+ }
+
+ public JBossConnectionFactory getConnectionFactory() throws Exception
+ {
+ return (JBossConnectionFactory) getInitialContext().lookup("/ConnectionFactory");
+ }
+
+
+ public InitialContext getInitialContext(int serverid) throws Exception
+ {
+ return new InitialContext(ServerManagement.getJNDIEnvironment(serverid));
+ }
+
+ public void configureSecurityForDestination(String destName, boolean isQueue, HashSet<Role> roles) throws Exception
+ {
+ servers.get(0).configureSecurityForDestination(destName, isQueue, roles);
+ }
+
+ public void deployQueue(String name) throws Exception
+ {
+ for (int i = 0; i < getServerCount(); i++)
+ {
+ servers.get(i).deployQueue(name, null, i != 0);
+ }
+ }
+
+ public void deployQueue(String name, String jndiName) throws Exception
+ {
+ for (int i = 0; i < getServerCount(); i++)
+ {
+ servers.get(i).deployQueue(name, jndiName, i != 0);
+ }
+ }
+
+ public void deployQueue(String name, int server) throws Exception
+ {
+ servers.get(server).deployQueue(name, null, true);
+
+ }
+
+ public void deployQueue(String name, int fullSize, int pageSize, int downCacheSize) throws Exception
+ {
+ for (int i = 0; i < getServerCount(); i++)
+ {
+ servers.get(i).deployQueue(name, null, fullSize, pageSize, downCacheSize, i != 0);
+ }
+ }
+
+ public void deployQueue(String name, String jndiName, int fullSize, int pageSize,
+ int downCacheSize, int serverIndex, boolean clustered) throws Exception
+ {
+ servers.get(serverIndex).deployQueue(name, jndiName, fullSize, pageSize, downCacheSize, clustered);
+
+ }
+
+ public void deployTopic(String name) throws Exception
+ {
+ for (int i = 0; i < getServerCount(); i++)
+ {
+ servers.get(i).deployTopic(name, null, i != 0);
+ }
+ }
+
+ public void deployTopic(String name, String jndiName) throws Exception
+ {
+ for (int i = 0; i < getServerCount(); i++)
+ {
+ servers.get(i).deployTopic(name, jndiName, i != 0);
+ }
+ }
+
+ public void deployTopic(String name, int server) throws Exception
+ {
+ servers.get(server).deployTopic(name, null, server != 0);
+
+ }
+
+ public void deployTopic(String name, int fullSize, int pageSize, int downCacheSize) throws Exception
+ {
+ for (int i = 0; i < getServerCount(); i++)
+ {
+ servers.get(i).deployTopic(name, null, fullSize, pageSize, downCacheSize, i != 0);
+ }
+ }
+
+ public void deployTopic(String name, String jndiName, int fullSize, int pageSize,
+ int downCacheSize, int serverIndex, boolean clustered) throws Exception
+ {
+ servers.get(serverIndex).deployTopic(name, jndiName, fullSize, pageSize, downCacheSize, clustered);
+
+ }
+
+ public void undeployQueue(String name) throws Exception
+ {
+ for (int i = 0; i < getServerCount(); i++)
+ {
+ try
+ {
+ servers.get(i).undeployDestination(true, name);
+ }
+ catch (Exception e)
+ {
+ log.info("did not undeploy " + name);
+ }
+ }
+ }
+
+ public void undeployQueue(String name, int server) throws Exception
+ {
+ servers.get(server).undeployDestination(true, name);
+
+ }
+
+ public void undeployTopic(String name) throws Exception
+ {
+ for (int i = 0; i < getServerCount(); i++)
+ {
+ try
+ {
+ servers.get(i).undeployDestination(false, name);
+ }
+ catch (Exception e)
+ {
+ log.info("did not undeploy " + name);
+ }
+ }
+ }
+
+ public void undeployTopic(String name, int server) throws Exception
+ {
+ servers.get(server).undeployDestination(false, name);
+
+ }
+
+ public static boolean destroyTopic(String name) throws Exception
+ {
+ return servers.get(0).undeployDestinationProgrammatically(false, name);
+ }
+
+ public static boolean destroyQueue(String name) throws Exception
+ {
+ return servers.get(0).undeployDestinationProgrammatically(true, name);
+ }
+
+
+ public boolean checkNoMessageData()
+ {
+ return false;
+ }
+
+ public boolean checkEmpty(Queue queue) throws Exception
+ {
+ Integer messageCount = getJmsServerStatistics().getMessageCountForQueue(queue.getQueueName());
+ if (messageCount > 0)
+ {
+ removeAllMessages(queue.getQueueName(), true);
+ }
+ return true;
+ }
+
+ public boolean checkEmpty(Queue queue, int i)
+ {
+ return true;
+ }
+
+ public boolean checkEmpty(Topic topic)
+ {
+ return true;
+ }
+
+ public boolean checkEmpty(Topic topic, int i)
+ {
+ return true;
+ }
+
+ protected void removeAllMessages(String destName, boolean isQueue) throws Exception
+ {
+ for (int i = 0; i < getServerCount(); i++)
+ {
+ try
+ {
+ removeAllMessages(destName, isQueue, i);
+ }
+ catch (Exception e)
+ {
+ log.info("did not clear messages for " + destName);
+ }
+ }
+ }
+
+ protected void removeAllMessages(String destName, boolean isQueue, int server) throws Exception
+ {
+ if (isQueue)
+ servers.get(server).getJmsServer().removeAllMessagesForQueue(destName);
+ else
+ servers.get(server).getJmsServer().removeAllMessagesForTopic(destName);
+ }
+
+ public void dropTables() throws Exception
+ {
+ dropAllTables();
+ }
+
+
+ public PersistenceManager getPersistenceManager()
+ {
+ try
+ {
+ return servers.get(0).getPersistenceManager();
+ }
+ catch (Exception e)
+ {
+ //will never happen as always is local
+ return null;
+ }
+ }
+
+ protected void dropAllTables() throws Exception
+ {
+ log.info("DROPPING ALL TABLES FROM DATABASE!");
+
+ InitialContext ctx = new InitialContext();
+
+ // We need to execute each drop in its own transaction otherwise postgresql will not execute
+ // further commands after one fails
+
+ TransactionManager mgr = TransactionManagerLocator.locateTransactionManager();
+ DataSource ds = (DataSource) ctx.lookup("java:/DefaultDS");
+
+ javax.transaction.Transaction txOld = mgr.suspend();
+
+ executeStatement(mgr, ds, "DROP TABLE JBM_POSTOFFICE");
+
+ executeStatement(mgr, ds, "DROP TABLE JBM_MSG_REF");
+
+ executeStatement(mgr, ds, "DROP TABLE JBM_MSG");
+
+ executeStatement(mgr, ds, "DROP TABLE JBM_TX");
+
+ executeStatement(mgr, ds, "DROP TABLE JBM_COUNTER");
+
+ executeStatement(mgr, ds, "DROP TABLE JBM_USER");
+
+ executeStatement(mgr, ds, "DROP TABLE JBM_ROLE");
+
+ executeStatement(mgr, ds, "DROP TABLE JBM_DUAL");
+
+ if (txOld != null)
+ {
+ mgr.resume(txOld);
+ }
+
+ log.debug("done with dropping tables");
+ }
+
+ private void executeStatement(TransactionManager mgr, DataSource ds, String statement) throws Exception
+ {
+ Connection conn = null;
+ boolean exception = false;
+
+ try
+ {
+ try
+ {
+ mgr.begin();
+
+ conn = ds.getConnection();
+
+ log.debug("executing " + statement);
+
+ PreparedStatement ps = conn.prepareStatement(statement);
+
+ ps.executeUpdate();
+
+ log.debug(statement + " executed");
+
+ ps.close();
+ }
+ catch (SQLException e)
+ {
+ // Ignore
+ log.debug("Failed to execute statement", e);
+ exception = true;
+ }
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+
+ if (exception)
+ {
+ mgr.rollback();
+ }
+ else
+ {
+ mgr.commit();
+ }
+ }
+
+
+ }
+
+ protected int getNoSubscriptions(Topic topic)
+ throws Exception
+ {
+ return getNoSubscriptions(topic, 0);
+ }
+
+ protected int getNoSubscriptions(Topic topic, int server)
+ throws Exception
+ {
+ ObjectName destObjectName = new ObjectName("jboss.messaging.destination:service=Topic,name=" + topic.getTopicName());
+
+ Integer messageCount = (Integer) ServerManagement.getAttribute(server, destObjectName, "AllSubscriptionsCount");
+ return messageCount.intValue();
+ }
+
+ protected boolean assertRemainingMessages(int expected) throws Exception
+ {
+ Integer messageCount = getJmsServerStatistics().getMessageCountForQueue("Queue1");
+ log.trace("There are " + messageCount + " messages");
+
+ assertEquals(expected, messageCount.intValue());
+ return expected == messageCount.intValue();
+ }
+
+ public static void deployConnectionFactory(String clientId, String objectName,
+ String[] jndiBindings)
+ throws Exception
+ {
+ servers.get(0).deployConnectionFactory(clientId, objectName, jndiBindings);
+ }
+
+ public static void deployConnectionFactory(String objectName,
+ String[] jndiBindings,
+ int prefetchSize)
+ throws Exception
+ {
+ servers.get(0).deployConnectionFactory(objectName, jndiBindings, prefetchSize);
+ }
+
+ public static void deployConnectionFactory(String objectName,
+ String[] jndiBindings)
+ throws Exception
+ {
+ servers.get(0).deployConnectionFactory(objectName, jndiBindings);
+ }
+
+ public static void deployConnectionFactory(int server,
+ String objectName,
+ String[] jndiBindings,
+ int prefetchSize)
+ throws Exception
+ {
+ servers.get(server).deployConnectionFactory(objectName, jndiBindings, prefetchSize);
+ }
+
+ public static void deployConnectionFactory(int server,
+ String objectName,
+ String[] jndiBindings)
+ throws Exception
+ {
+ servers.get(server).deployConnectionFactory(objectName, jndiBindings);
+ }
+
+ public void deployConnectionFactory(String objectName, String[] jndiBindings, boolean strictTck) throws Exception
+ {
+ servers.get(0).deployConnectionFactory(objectName, jndiBindings, strictTck);
+ }
+
+ public void deployConnectionFactory(String clientId,
+ String objectName,
+ String[] jndiBindings,
+ int prefetchSize,
+ int defaultTempQueueFullSize,
+ int defaultTempQueuePageSize,
+ int defaultTempQueueDownCacheSize,
+ boolean supportsFailover,
+ boolean supportsLoadBalancing,
+ boolean strictTck,
+ int dupsOkBatchSize) throws Exception
+ {
+ servers.get(0).deployConnectionFactory(clientId, objectName, jndiBindings, prefetchSize, defaultTempQueueFullSize,
+ defaultTempQueuePageSize, defaultTempQueueDownCacheSize, supportsFailover, supportsLoadBalancing, strictTck, dupsOkBatchSize);
+ }
+
+ public static void deployConnectionFactory(String objectName,
+ String[] jndiBindings,
+ int prefetchSize,
+ int defaultTempQueueFullSize,
+ int defaultTempQueuePageSize,
+ int defaultTempQueueDownCacheSize)
+ throws Exception
+ {
+ servers.get(0).deployConnectionFactory(objectName,
+ jndiBindings,
+ prefetchSize,
+ defaultTempQueueFullSize,
+ defaultTempQueuePageSize,
+ defaultTempQueueDownCacheSize);
+ }
+
+ public static void undeployConnectionFactory(String objectName) throws Exception
+ {
+ servers.get(0).undeployConnectionFactory(objectName);
+ }
+
+ public static void undeployConnectionFactory(int server, String objectName) throws Exception
+ {
+ servers.get(server).undeployConnectionFactory(objectName);
+ }
+
+ public void resetAllSuckers() throws Exception
+ {
+ for (int i = 0; i < getServerCount(); i++)
+ {
+ resetAllSuckers(i);
+ }
+ }
+
+ public void resetAllSuckers(int server) throws Exception
+ {
+ servers.get(server).resetAllSuckers();
+ }
+
+ private void clearDatabase() throws Exception
+ {
+ if (databaseClearer == null)
+ {
+ JBMBootstrapServer bootstrap = new JBMBootstrapServer(new String[]{"datasource.xml", "transaction-manager.xml", "database-clearer.xml"});
+ bootstrap.run();
+ databaseClearer = (DatabaseClearer) bootstrap.getKernel().getRegistry().getEntry("DatabaseClearer").getTarget();
+ databaseClearer.deleteAllData();
+ }
+ else
+ {
+ databaseClearer.deleteData();
+ }
+ }
+}
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/NonRecoverableMessagingQueueTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/NonRecoverableMessagingQueueTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/NonRecoverableMessagingQueueTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -52,7 +52,7 @@
{
super.setUp();
- queue = new MessagingQueue(1, "queue1", 1, ms, pm, false, -1, null, false);
+ queue = new MessagingQueue(1, "queue1", 1, ms, getPersistenceManager(), false, -1, null, false);
queue.activate();
}
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/RecoverableMessagingQueueTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/RecoverableMessagingQueueTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/RecoverableMessagingQueueTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -51,7 +51,7 @@
{
super.setUp();
- queue = new MessagingQueue(1, "queue1", 1, ms, pm, true, -1, null, false);
+ queue = new MessagingQueue(1, "queue1", 1, ms, getPersistenceManager(), true, -1, null, false);
queue.activate();
}
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/RoundRobinDistributorTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/RoundRobinDistributorTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/RoundRobinDistributorTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,13 +21,7 @@
*/
package org.jboss.test.messaging.core;
-import org.jboss.messaging.core.contract.Delivery;
-import org.jboss.messaging.core.contract.DeliveryObserver;
-import org.jboss.messaging.core.contract.Distributor;
-import org.jboss.messaging.core.contract.Message;
-import org.jboss.messaging.core.contract.MessageReference;
-import org.jboss.messaging.core.contract.MessageStore;
-import org.jboss.messaging.core.contract.Receiver;
+import org.jboss.messaging.core.contract.*;
import org.jboss.messaging.core.impl.RoundRobinDistributor;
import org.jboss.messaging.core.impl.SimpleDelivery;
import org.jboss.messaging.core.impl.message.SimpleMessageStore;
@@ -435,7 +429,7 @@
}
}, "Message sending thread");
- // start the sending tread, which will immediately grab the router's "receivers" lock, and it
+ // startServerPeer the sending tread, which will immediately grab the router's "receivers" lock, and it
// will sleep for 3 seconds before attempting to grab LockingReceiver's lock.
t.start();
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_2PCTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_2PCTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_2PCTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,15 +21,15 @@
*/
package org.jboss.test.messaging.core.paging;
-import java.util.List;
-
import org.jboss.messaging.core.contract.Message;
import org.jboss.messaging.core.contract.MessageReference;
import org.jboss.messaging.core.impl.MessagingQueue;
import org.jboss.messaging.core.impl.tx.Transaction;
import org.jboss.test.messaging.util.CoreMessageFactory;
+import java.util.List;
+
/**
*
* A ChannelShare_NP_2PC_Recoverable.
@@ -61,10 +61,10 @@
public void testChannelShareNP_2PC() throws Throwable
{
- MessagingQueue queue1 = new MessagingQueue(1, "queue1", 1, ms, pm, true, -1, null, 100, 20, 10, false, 300000);
+ MessagingQueue queue1 = new MessagingQueue(1, "queue1", 1, ms, getPersistenceManager(), true, -1, null, 100, 20, 10, false, 300000);
queue1.activate();
- MessagingQueue queue2 = new MessagingQueue(1, "queue2", 2, ms, pm, true, -1, null, 50, 10, 5, false, 300000);
+ MessagingQueue queue2 = new MessagingQueue(1, "queue2", 2, ms, getPersistenceManager(), true, -1, null, 50, 10, 5, false, 300000);
queue2.activate();
Message[] msgs = new Message[150];
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_NTTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_NTTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_NTTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,14 +21,14 @@
*/
package org.jboss.test.messaging.core.paging;
-import java.util.List;
-
import org.jboss.messaging.core.contract.Message;
import org.jboss.messaging.core.contract.MessageReference;
import org.jboss.messaging.core.impl.MessagingQueue;
import org.jboss.test.messaging.util.CoreMessageFactory;
+import java.util.List;
+
/**
*
* A ChannelShare_NP_NT_Recoverable.
@@ -60,10 +60,10 @@
public void test1() throws Throwable
{
- MessagingQueue queue1 = new MessagingQueue(1, "queue1", 1, ms, pm, true, -1, null, 100, 20, 10, false, 300000);
+ MessagingQueue queue1 = new MessagingQueue(1, "queue1", 1, ms, getPersistenceManager(), true, -1, null, 100, 20, 10, false, 300000);
queue1.activate();
- MessagingQueue queue2 = new MessagingQueue(1, "queue2", 2, ms, pm, true, -1, null, 50, 10, 5, false, 300000);
+ MessagingQueue queue2 = new MessagingQueue(1, "queue2", 2, ms, getPersistenceManager(), true, -1, null, 50, 10, 5, false, 300000);
queue2.activate();
Message[] msgs = new Message[150];
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_TTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_TTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_TTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,15 +21,15 @@
*/
package org.jboss.test.messaging.core.paging;
-import java.util.List;
-
import org.jboss.messaging.core.contract.Message;
import org.jboss.messaging.core.contract.MessageReference;
import org.jboss.messaging.core.impl.MessagingQueue;
import org.jboss.messaging.core.impl.tx.Transaction;
import org.jboss.test.messaging.util.CoreMessageFactory;
+import java.util.List;
+
/**
*
* A ChannelShare_NP_T_Recoverable.
@@ -61,10 +61,10 @@
public void testChannelShareNP_Transactional() throws Throwable
{
- MessagingQueue queue1 = new MessagingQueue(1, "queue1", 1, ms, pm, true, -1, null, 100, 20, 10, false, 300000);
+ MessagingQueue queue1 = new MessagingQueue(1, "queue1", 1, ms, getPersistenceManager(), true, -1, null, 100, 20, 10, false, 300000);
queue1.activate();
- MessagingQueue queue2 = new MessagingQueue(1, "queue2", 2, ms, pm, true, -1, null, 50, 10, 5, false, 300000);
+ MessagingQueue queue2 = new MessagingQueue(1, "queue2", 2, ms, getPersistenceManager(), true, -1, null, 50, 10, 5, false, 300000);
queue2.activate();
Message[] msgs = new Message[150];
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_2PCTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_2PCTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_2PCTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,15 +21,15 @@
*/
package org.jboss.test.messaging.core.paging;
-import java.util.List;
-
import org.jboss.messaging.core.contract.Message;
import org.jboss.messaging.core.contract.MessageReference;
import org.jboss.messaging.core.impl.MessagingQueue;
import org.jboss.messaging.core.impl.tx.Transaction;
import org.jboss.test.messaging.util.CoreMessageFactory;
+import java.util.List;
+
/**
*
* A ChannelShare_P_2PCTest
@@ -56,10 +56,10 @@
public void test1() throws Throwable
{
- MessagingQueue queue1 = new MessagingQueue(1, "queue1", 1, ms, pm, true, -1, null, 100, 20, 10, false, 300000);
+ MessagingQueue queue1 = new MessagingQueue(1, "queue1", 1, ms, getPersistenceManager(), true, -1, null, 100, 20, 10, false, 300000);
queue1.activate();
- MessagingQueue queue2 = new MessagingQueue(1, "queue2", 2, ms, pm, true, -1, null, 50, 10, 5, false, 300000);
+ MessagingQueue queue2 = new MessagingQueue(1, "queue2", 2, ms, getPersistenceManager(), true, -1, null, 50, 10, 5, false, 300000);
queue2.activate();
Message[] msgs = new Message[150];
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_NTTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_NTTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_NTTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,13 +21,13 @@
*/
package org.jboss.test.messaging.core.paging;
-import java.util.List;
-
import org.jboss.messaging.core.contract.Message;
import org.jboss.messaging.core.contract.MessageReference;
import org.jboss.messaging.core.impl.MessagingQueue;
import org.jboss.test.messaging.util.CoreMessageFactory;
+import java.util.List;
+
/**
*
* A ChannelShare_P_NT_Recoverable.
@@ -60,10 +60,10 @@
public void test1() throws Throwable
{
- MessagingQueue queue1 = new MessagingQueue(1, "queue1", 1, ms, pm, true, -1, null, 100, 20, 10, false, 300000);
+ MessagingQueue queue1 = new MessagingQueue(1, "queue1", 1, ms, getPersistenceManager(), true, -1, null, 100, 20, 10, false, 300000);
queue1.activate();
- MessagingQueue queue2 = new MessagingQueue(1, "queue2", 2, ms, pm, true, -1, null, 50, 10, 5, false, 300000);
+ MessagingQueue queue2 = new MessagingQueue(1, "queue2", 2, ms, getPersistenceManager(), true, -1, null, 50, 10, 5, false, 300000);
queue2.activate();
Message[] msgs = new Message[150];
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_TTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_TTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_TTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,14 +21,14 @@
*/
package org.jboss.test.messaging.core.paging;
-import java.util.List;
-
import org.jboss.messaging.core.contract.Message;
import org.jboss.messaging.core.contract.MessageReference;
import org.jboss.messaging.core.impl.MessagingQueue;
import org.jboss.messaging.core.impl.tx.Transaction;
import org.jboss.test.messaging.util.CoreMessageFactory;
+import java.util.List;
+
/**
*
* A ChannelShare_P_T_Recoverable.
@@ -60,10 +60,10 @@
public void test1() throws Throwable
{
- MessagingQueue queue1 = new MessagingQueue(1, "queue1", 1, ms, pm, true, -1, null, 100, 20, 10, false, 300000);
+ MessagingQueue queue1 = new MessagingQueue(1, "queue1", 1, ms, getPersistenceManager(), true, -1, null, 100, 20, 10, false, 300000);
queue1.activate();
- MessagingQueue queue2 = new MessagingQueue(1, "queue2", 2, ms, pm, true, -1, null, 50, 10, 5, false, 300000);
+ MessagingQueue queue2 = new MessagingQueue(1, "queue2", 2, ms, getPersistenceManager(), true, -1, null, 50, 10, 5, false, 300000);
queue2.activate();
Message[] msgs = new Message[150];
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_2PCTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_2PCTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_2PCTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,8 +21,6 @@
*/
package org.jboss.test.messaging.core.paging;
-import java.util.List;
-
import org.jboss.messaging.core.contract.Message;
import org.jboss.messaging.core.contract.MessageReference;
import org.jboss.messaging.core.impl.MessagingQueue;
@@ -30,6 +28,8 @@
import org.jboss.messaging.core.impl.tx.Transaction;
import org.jboss.test.messaging.util.CoreMessageFactory;
+import java.util.List;
+
/**
*
* A PagingTest_NP_2PC_Recoverable.
@@ -63,7 +63,7 @@
public void test1() throws Throwable
{
- MessagingQueue queue = new MessagingQueue(1, "queue1", 1, ms, pm, true, -1, null, 100, 20, 10, false, 300000);
+ MessagingQueue queue = new MessagingQueue(1, "queue1", 1, ms, getPersistenceManager(), true, -1, null, 100, 20, 10, false, 300000);
queue.activate();
Message[] msgs = new Message[241];
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_NTTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_NTTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_NTTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,14 +21,14 @@
*/
package org.jboss.test.messaging.core.paging;
-import java.util.List;
-
import org.jboss.messaging.core.contract.Message;
import org.jboss.messaging.core.contract.MessageReference;
import org.jboss.messaging.core.impl.MessagingQueue;
import org.jboss.messaging.core.impl.SimpleDelivery;
import org.jboss.test.messaging.util.CoreMessageFactory;
+import java.util.List;
+
/**
*
* A PagingTest_NP_NT_Recoverable.
@@ -62,7 +62,7 @@
public void test1() throws Throwable
{
- MessagingQueue queue = new MessagingQueue(1, "queue1", 1, ms, pm, true, -1, null, 100, 20, 10, false, 300000);
+ MessagingQueue queue = new MessagingQueue(1, "queue1", 1, ms, getPersistenceManager(), true, -1, null, 100, 20, 10, false, 300000);
queue.activate();
Message[] msgs = new Message[241];
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_TTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_TTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_TTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,8 +21,6 @@
*/
package org.jboss.test.messaging.core.paging;
-import java.util.List;
-
import org.jboss.messaging.core.contract.Message;
import org.jboss.messaging.core.contract.MessageReference;
import org.jboss.messaging.core.impl.MessagingQueue;
@@ -30,6 +28,8 @@
import org.jboss.messaging.core.impl.tx.Transaction;
import org.jboss.test.messaging.util.CoreMessageFactory;
+import java.util.List;
+
/**
*
* A PagingTest_NP_T_Recoverable.
@@ -63,7 +63,7 @@
public void test1() throws Throwable
{
- MessagingQueue queue = new MessagingQueue(1, "queue1", 1, ms, pm, true, -1, null, 100, 20, 10, false, 300000);
+ MessagingQueue queue = new MessagingQueue(1, "queue1", 1, ms, getPersistenceManager(), true, -1, null, 100, 20, 10, false, 300000);
queue.activate();
Message[] msgs = new Message[241];
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_2PCTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_2PCTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_2PCTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,8 +21,6 @@
*/
package org.jboss.test.messaging.core.paging;
-import java.util.List;
-
import org.jboss.messaging.core.contract.Message;
import org.jboss.messaging.core.contract.MessageReference;
import org.jboss.messaging.core.impl.MessagingQueue;
@@ -30,6 +28,8 @@
import org.jboss.messaging.core.impl.tx.Transaction;
import org.jboss.test.messaging.util.CoreMessageFactory;
+import java.util.List;
+
/**
*
* A PagingTest_P_2PC_Recoverable.
@@ -63,7 +63,7 @@
public void test1() throws Throwable
{
- MessagingQueue queue = new MessagingQueue(1, "queue1", 1, ms, pm, true, -1, null, 100, 20, 10, false, 300000);
+ MessagingQueue queue = new MessagingQueue(1, "queue1", 1, ms, getPersistenceManager(), true, -1, null, 100, 20, 10, false, 300000);
queue.activate();
Message[] msgs = new Message[241];
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_NTTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_NTTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_NTTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,14 +21,14 @@
*/
package org.jboss.test.messaging.core.paging;
-import java.util.List;
-
import org.jboss.messaging.core.contract.Message;
import org.jboss.messaging.core.contract.MessageReference;
import org.jboss.messaging.core.impl.MessagingQueue;
import org.jboss.messaging.core.impl.SimpleDelivery;
import org.jboss.test.messaging.util.CoreMessageFactory;
+import java.util.List;
+
/**
*
* A PagingTest_P_NT_Recoverable.
@@ -62,7 +62,7 @@
public void test1() throws Throwable
{
- MessagingQueue queue = new MessagingQueue(1, "queue1", 1, ms, pm, true, -1, null, 100, 20, 10, false, 300000);
+ MessagingQueue queue = new MessagingQueue(1, "queue1", 1, ms, getPersistenceManager(), true, -1, null, 100, 20, 10, false, 300000);
queue.activate();
Message[] msgs = new Message[241];
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_TTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_TTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_TTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,8 +21,6 @@
*/
package org.jboss.test.messaging.core.paging;
-import java.util.List;
-
import org.jboss.messaging.core.contract.Message;
import org.jboss.messaging.core.contract.MessageReference;
import org.jboss.messaging.core.impl.MessagingQueue;
@@ -30,6 +28,8 @@
import org.jboss.messaging.core.impl.tx.Transaction;
import org.jboss.test.messaging.util.CoreMessageFactory;
+import java.util.List;
+
/**
*
* A PagingTest_P_T_Recoverable.
@@ -63,7 +63,7 @@
public void test1() throws Throwable
{
- MessagingQueue queue = new MessagingQueue(1, "queue1", 1, ms, pm, true, -1, null, 100, 20, 10, false, 300000);
+ MessagingQueue queue = new MessagingQueue(1, "queue1", 1, ms, getPersistenceManager(), true, -1, null, 100, 20, 10, false, 300000);
queue.activate();
Message[] msgs = new Message[241];
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/postoffice/ClusteredPostOfficeTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/postoffice/ClusteredPostOfficeTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/postoffice/ClusteredPostOfficeTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,17 +21,7 @@
*/
package org.jboss.test.messaging.core.postoffice;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.messaging.core.contract.Binding;
-import org.jboss.messaging.core.contract.Condition;
-import org.jboss.messaging.core.contract.Message;
-import org.jboss.messaging.core.contract.MessageReference;
-import org.jboss.messaging.core.contract.PostOffice;
+import org.jboss.messaging.core.contract.*;
import org.jboss.messaging.core.contract.Queue;
import org.jboss.messaging.core.impl.MessagingQueue;
import org.jboss.messaging.core.impl.tx.Transaction;
@@ -41,6 +31,8 @@
import org.jboss.test.messaging.core.SimpleReceiver;
import org.jboss.test.messaging.util.CoreMessageFactory;
+import java.util.*;
+
/**
*
* A DefaultClusteredPostOfficeTest
@@ -198,7 +190,7 @@
// Add a couple of queues
- Queue queue1 = new MessagingQueue(1, "sub1", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue1 = new MessagingQueue(1, "sub1", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue1.activate();
Condition condition1 = new SimpleCondition("condition1");
@@ -206,7 +198,7 @@
boolean added = office1.addBinding(new Binding(condition1, queue1, false), false);
assertTrue(added);
- Queue queue2 = new MessagingQueue(1, "sub2", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue2 = new MessagingQueue(1, "sub2", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue2.activate();
added = office1.addBinding(new Binding(condition1, queue2, false), false);
@@ -226,7 +218,7 @@
// Add another queue on node 2
- Queue queue3 = new MessagingQueue(2, "sub3", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue3 = new MessagingQueue(2, "sub3", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue3.activate();
added = office2.addBinding(new Binding(condition1, queue3, false), false);
@@ -251,7 +243,7 @@
// Add another binding on node 2
- Queue queue4 = new MessagingQueue(2, "sub4", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue4 = new MessagingQueue(2, "sub4", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue4.activate();
added = office2.addBinding(new Binding(condition1, queue4, false), false);
@@ -311,7 +303,7 @@
// Add another binding on node 3
- Queue queue5 = new MessagingQueue(3, "sub5", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue5 = new MessagingQueue(3, "sub5", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue5.activate();
added = office3.addBinding(new Binding(condition1, queue5, false), false);
@@ -342,13 +334,13 @@
// Add a durable and a non durable binding on node 1
- Queue queue6 = new MessagingQueue(1, "sub6", channelIDManager.getID(), ms, pm, true, -1, null, true);
+ Queue queue6 = new MessagingQueue(1, "sub6", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, true);
queue6.activate();
added = office1.addBinding(new Binding(condition1, queue6, false), false);
assertTrue(added);
- Queue queue7 = new MessagingQueue(1, "sub7", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue7 = new MessagingQueue(1, "sub7", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue7.activate();
added = office1.addBinding(new Binding(condition1, queue7, false), false);
@@ -490,13 +482,13 @@
//Bind another few more clustered
- Queue queue8 = new MessagingQueue(1, "sub8", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue8 = new MessagingQueue(1, "sub8", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue8.activate();
- Queue queue9 = new MessagingQueue(2, "sub9", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue9 = new MessagingQueue(2, "sub9", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue9.activate();
- Queue queue10 = new MessagingQueue(2, "sub10", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue10 = new MessagingQueue(2, "sub10", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue10.activate();
//Bind on different conditions
@@ -532,10 +524,10 @@
//Now a couple of non clustered queues
- Queue queue11 = new MessagingQueue(1, "sub11", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ Queue queue11 = new MessagingQueue(1, "sub11", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queue11.activate();
- Queue queue12 = new MessagingQueue(2, "sub12", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ Queue queue12 = new MessagingQueue(2, "sub12", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queue12.activate();
added = office1.addBinding(new Binding(condition1, queue11, false), false);
@@ -619,7 +611,7 @@
* c) verify all nodes get queue
* d) unbind - verify unbound from all nodes
* e) close down all nodes
- * f) start all nodes
+ * f) startServerPeer all nodes
* g) verify queue is not known
* */
@@ -634,7 +626,7 @@
office3 = createClusteredPostOffice(3);
//Durable
- Queue queue1 = new MessagingQueue(1, "sub1", channelIDManager.getID(), ms, pm, true, -1, null, true);
+ Queue queue1 = new MessagingQueue(1, "sub1", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, true);
queue1.activate();
Condition condition1 = new SimpleCondition("condition1");
@@ -671,7 +663,7 @@
assertTrue(bindings.isEmpty());
//Bind again different node
- Queue queue2 = new MessagingQueue(2, "sub2", channelIDManager.getID(), ms, pm, true, -1, null, true);
+ Queue queue2 = new MessagingQueue(2, "sub2", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, true);
queue2.activate();
added = office2.addBinding(new Binding(condition1, queue2, true), true);
@@ -791,7 +783,7 @@
office3 = createClusteredPostOffice(3);
//Durable
- Queue queue1 = new MessagingQueue(1, "sub1", channelIDManager.getID(), ms, pm, true, -1, null, true);
+ Queue queue1 = new MessagingQueue(1, "sub1", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, true);
queue1.activate();
Condition condition1 = new SimpleCondition("condition1");
@@ -884,10 +876,10 @@
public void testBindUnbindAll3() throws Throwable
{
- /* a) start one node
+ /* a) startServerPeer one node
* b) queue is not known to cluster
* c) bind all
- * d) start other nodes
+ * d) startServerPeer other nodes
* d) verify other nodes pick it up
*/
@@ -900,7 +892,7 @@
office1 = createClusteredPostOffice(1);
//Durable
- Queue queue1 = new MessagingQueue(1, "sub1", channelIDManager.getID(), ms, pm, true, -1, null, true);
+ Queue queue1 = new MessagingQueue(1, "sub1", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, true);
queue1.activate();
Condition condition1 = new SimpleCondition("condition1");
@@ -980,7 +972,7 @@
public void testBindUnbindAll4() throws Throwable
{
- /* a) start one node
+ /* a) startServerPeer one node
* b) queue is not known to cluster
* c) bind all
* d) shutdown all nodes
@@ -997,7 +989,7 @@
office1 = createClusteredPostOffice(1);
//Durable
- Queue queue1 = new MessagingQueue(1, "sub1", channelIDManager.getID(), ms, pm, true, -1, null, true);
+ Queue queue1 = new MessagingQueue(1, "sub1", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, true);
queue1.activate();
Condition condition1 = new SimpleCondition("condition1");
@@ -1082,11 +1074,11 @@
public void testBindUnbindAll5() throws Throwable
{
/*
- * a) start one node
+ * a) startServerPeer one node
* b) queue is not known
* c) bind all
* d) shutdown node
- * e) start other nodes
+ * e) startServerPeer other nodes
* f) verify queue is not known
* g) restart first node, verify queue is now known
* */
@@ -1100,7 +1092,7 @@
office1 = createClusteredPostOffice(1);
//Durable
- Queue queue1 = new MessagingQueue(1, "sub1", channelIDManager.getID(), ms, pm, true, -1, null, true);
+ Queue queue1 = new MessagingQueue(1, "sub1", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, true);
queue1.activate();
Condition condition1 = new SimpleCondition("condition1");
@@ -1214,7 +1206,7 @@
office3 = createClusteredPostOffice(3);
//Durable
- Queue queue1 = new MessagingQueue(1, "sub1", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue1 = new MessagingQueue(1, "sub1", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue1.activate();
Condition condition1 = new SimpleCondition("condition1");
@@ -1393,22 +1385,22 @@
{
office1 = createClusteredPostOffice(1);
- Queue queue1 = new MessagingQueue(1, "queue1", channelIDManager.getID(), ms, pm, true, -1, null, true);
+ Queue queue1 = new MessagingQueue(1, "queue1", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, true);
queue1.activate();
boolean added = office1.addBinding(new Binding(new SimpleCondition("condition1"), queue1, false), false);
assertTrue(added);
- Queue queue2 = new MessagingQueue(1, "queue2", channelIDManager.getID(), ms, pm, true, -1, null, true);
+ Queue queue2 = new MessagingQueue(1, "queue2", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, true);
queue2.activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition1"), queue2, false), false);
assertTrue(added);
- Queue queue3 = new MessagingQueue(1, "queue3", channelIDManager.getID(), ms, pm, true, -1, null, true);
+ Queue queue3 = new MessagingQueue(1, "queue3", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, true);
queue3.activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition1"), queue3, false), false);
assertTrue(added);
- Queue queue4 = new MessagingQueue(1, "queue4", channelIDManager.getID(), ms, pm, true, -1, null, true);
+ Queue queue4 = new MessagingQueue(1, "queue4", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, true);
queue4.activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition1"), queue4, false), false);
assertTrue(added);
@@ -1535,7 +1527,7 @@
office2 = createClusteredPostOffice(2);
- Queue queue1 = new MessagingQueue(1, "queue1", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue1 = new MessagingQueue(1, "queue1", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue1.activate();
Condition condition1 = new SimpleCondition("queue1");
@@ -1543,19 +1535,19 @@
boolean added = office1.addBinding(new Binding(condition1, queue1, false), false);
assertTrue(added);
- Queue queue2 = new MessagingQueue(2, "queue1", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue2 = new MessagingQueue(2, "queue1", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue2.activate();
added = office2.addBinding(new Binding(condition1, queue2, false), false);
assertTrue(added);
- Queue queue3 = new MessagingQueue(1, "queue1", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue3 = new MessagingQueue(1, "queue1", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue3.activate();
added = office1.addBinding(new Binding(condition1, queue3, false), false);
assertFalse(added);
- Queue queue4 = new MessagingQueue(2, "queue1", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue4 = new MessagingQueue(2, "queue1", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue4.activate();
added = office2.addBinding(new Binding(condition1, queue4, false), false);
@@ -1618,84 +1610,84 @@
//condition1
- queues[0] = new MessagingQueue(1, "sub1", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ queues[0] = new MessagingQueue(1, "sub1", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queues[0].activate();
boolean added = office1.addBinding(new Binding(new SimpleCondition("condition1"), queues[0], false), false);
assertTrue(added);
- queues[1] = new MessagingQueue(1, "sub2", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ queues[1] = new MessagingQueue(1, "sub2", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queues[1].activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition1"), queues[1], false), false);
assertTrue(added);
- queues[2] = new MessagingQueue(2, "sub3", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ queues[2] = new MessagingQueue(2, "sub3", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queues[2].activate();
added = office2.addBinding(new Binding(new SimpleCondition("condition1"), queues[2], false), false);
assertTrue(added);
- queues[3] = new MessagingQueue(2, "sub4", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ queues[3] = new MessagingQueue(2, "sub4", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queues[3].activate();
added = office2.addBinding(new Binding(new SimpleCondition("condition1"), queues[3], false), false);
assertTrue(added);
- queues[4] = new MessagingQueue(2, "sub5", channelIDManager.getID(), ms, pm, true, -1, null, true);
+ queues[4] = new MessagingQueue(2, "sub5", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, true);
queues[4].activate();
added = office2.addBinding(new Binding(new SimpleCondition("condition1"), queues[4], false), false);
assertTrue(added);
- queues[5] = new MessagingQueue(1, "sub6", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ queues[5] = new MessagingQueue(1, "sub6", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queues[5].activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition1"), queues[5], false), false);
assertTrue(added);
- queues[6] = new MessagingQueue(1, "sub7", channelIDManager.getID(), ms, pm, true, -1, null, true);
+ queues[6] = new MessagingQueue(1, "sub7", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, true);
queues[6].activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition1"), queues[6], false), false);
assertTrue(added);
- queues[7] = new MessagingQueue(1, "sub8", channelIDManager.getID(), ms, pm, true, -1, null, true);
+ queues[7] = new MessagingQueue(1, "sub8", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, true);
queues[7].activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition1"), queues[7], false), false);
assertTrue(added);
//condition2
- queues[8] = new MessagingQueue(1, "sub9", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ queues[8] = new MessagingQueue(1, "sub9", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queues[8].activate();
added= office1.addBinding(new Binding(new SimpleCondition("condition2"), queues[8], false), false);
assertTrue(added);
- queues[9] = new MessagingQueue(1, "sub10", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ queues[9] = new MessagingQueue(1, "sub10", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queues[9].activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition2"), queues[9], false), false);
assertTrue(added);
- queues[10] = new MessagingQueue(2, "sub11", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ queues[10] = new MessagingQueue(2, "sub11", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queues[10].activate();
added = office2.addBinding(new Binding(new SimpleCondition("condition2"), queues[10], false), false);
assertTrue(added);
- queues[11] = new MessagingQueue(2, "sub12", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ queues[11] = new MessagingQueue(2, "sub12", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queues[11].activate();
added = office2.addBinding(new Binding(new SimpleCondition("condition2"), queues[11], false), false);
assertTrue(added);
- queues[12] = new MessagingQueue(2, "sub13", channelIDManager.getID(), ms, pm, true, -1, null, true);
+ queues[12] = new MessagingQueue(2, "sub13", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, true);
queues[12].activate();
added = office2.addBinding(new Binding(new SimpleCondition("condition2"), queues[12], false), false);
assertTrue(added);
- queues[13] = new MessagingQueue(1, "sub14", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ queues[13] = new MessagingQueue(1, "sub14", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queues[13].activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition2"), queues[13], false), false);
assertTrue(added);
- queues[14] = new MessagingQueue(1, "sub15", channelIDManager.getID(), ms, pm, true, -1, null, true);
+ queues[14] = new MessagingQueue(1, "sub15", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, true);
queues[14].activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition2"), queues[14], false), false);
assertTrue(added);
- queues[15] = new MessagingQueue(1, "sub16", channelIDManager.getID(), ms, pm, true, -1, null, true);
+ queues[15] = new MessagingQueue(1, "sub16", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, true);
queues[15].activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition2"), queues[15], false), false);
assertTrue(added);
@@ -1961,17 +1953,17 @@
SimpleFilter filter1 = new SimpleFilter(2);
SimpleFilter filter2 = new SimpleFilter(3);
- Queue queue1 = new MessagingQueue(1, "queue1", channelIDManager.getID(), ms, pm, false, -1, filter1, true);
+ Queue queue1 = new MessagingQueue(1, "queue1", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, filter1, true);
queue1.activate();
boolean added = office1.addBinding(new Binding(new SimpleCondition("condition1"), queue1, false), false);
assertTrue(added);
- Queue queue2 = new MessagingQueue(2, "queue2", channelIDManager.getID(), ms, pm, false, -1, filter2, true);
+ Queue queue2 = new MessagingQueue(2, "queue2", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, filter2, true);
queue2.activate();
added = office2.addBinding(new Binding(new SimpleCondition("condition1"), queue2, false), false);
assertTrue(added);
- Queue queue3 = new MessagingQueue(2, "queue3", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue3 = new MessagingQueue(2, "queue3", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue3.activate();
added = office2.addBinding(new Binding(new SimpleCondition("condition1"), queue3, false), false);
assertTrue(added);
@@ -2072,22 +2064,22 @@
office3 = createClusteredPostOffice(3);
office4 = createClusteredPostOffice(4);
- Queue queue1 = new MessagingQueue(1, "queue1", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue1 = new MessagingQueue(1, "queue1", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue1.activate();
boolean added = office1.addBinding(new Binding(new SimpleCondition("condition1"), queue1, false), false);
assertTrue(added);
- Queue queue2 = new MessagingQueue(2, "queue2", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue2 = new MessagingQueue(2, "queue2", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue2.activate();
added = office2.addBinding(new Binding(new SimpleCondition("condition1"), queue2, false), false);
assertTrue(added);
- Queue queue3 = new MessagingQueue(3, "queue3", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue3 = new MessagingQueue(3, "queue3", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue3.activate();
added = office3.addBinding(new Binding(new SimpleCondition("condition1"), queue3, false), false);
assertTrue(added);
- Queue queue4 = new MessagingQueue(4, "queue4", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue4 = new MessagingQueue(4, "queue4", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue4.activate();
added = office4.addBinding(new Binding(new SimpleCondition("condition1"), queue4, false), false);
assertTrue(added);
@@ -2233,48 +2225,48 @@
//condition1
- queues[0] = new MessagingQueue(1, "sub1", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ queues[0] = new MessagingQueue(1, "sub1", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queues[0].activate();
boolean added = office1.addBinding(new Binding(new SimpleCondition("condition1"), queues[0], false), false);
assertTrue(added);
- queues[1] = new MessagingQueue(1, "sub2", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ queues[1] = new MessagingQueue(1, "sub2", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queues[1].activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition1"), queues[1], false), false);
assertTrue(added);
- queues[2] = new MessagingQueue(2, "sub3", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ queues[2] = new MessagingQueue(2, "sub3", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queues[2].activate();
added = office2.addBinding(new Binding(new SimpleCondition("condition1"), queues[2], false), false);
assertTrue(added);
- queues[3] = new MessagingQueue(2, "sub4", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ queues[3] = new MessagingQueue(2, "sub4", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queues[3].activate();
added = office2.addBinding(new Binding(new SimpleCondition("condition1"), queues[3], false), false);
assertTrue(added);
//durable
- queues[4] = new MessagingQueue(2, "sub5", channelIDManager.getID(), ms, pm, true, -1, null, true);
+ queues[4] = new MessagingQueue(2, "sub5", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, true);
queues[4].activate();
added = office2.addBinding(new Binding(new SimpleCondition("condition1"), queues[4], false), false);
assertTrue(added);
- queues[5] = new MessagingQueue(1, "sub6", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ queues[5] = new MessagingQueue(1, "sub6", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queues[5].activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition1"), queues[5], false), false);
assertTrue(added);
//durable
- queues[6] = new MessagingQueue(1, "sub7", channelIDManager.getID(), ms, pm, true, -1, null, true);
+ queues[6] = new MessagingQueue(1, "sub7", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, true);
queues[6].activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition1"), queues[6], false), false);
assertTrue(added);
//durable
- queues[7] = new MessagingQueue(1, "sub8", channelIDManager.getID(), ms, pm, true, -1, null, true);
+ queues[7] = new MessagingQueue(1, "sub8", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, true);
queues[7].activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition1"), queues[7], false), false);
assertTrue(added);
@@ -2282,46 +2274,46 @@
//condition2
- queues[8] = new MessagingQueue(1, "sub9", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ queues[8] = new MessagingQueue(1, "sub9", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queues[8].activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition2"), queues[8], false), false);
assertTrue(added);
- queues[9] = new MessagingQueue(1, "sub10", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ queues[9] = new MessagingQueue(1, "sub10", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queues[9].activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition2"), queues[9], false), false);
assertTrue(added);
- queues[10] = new MessagingQueue(2, "sub11", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ queues[10] = new MessagingQueue(2, "sub11", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queues[10].activate();
added = office2.addBinding(new Binding(new SimpleCondition("condition2"), queues[10], false), false);
assertTrue(added);
- queues[11] = new MessagingQueue(2, "sub12", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ queues[11] = new MessagingQueue(2, "sub12", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queues[11].activate();
added = office2.addBinding(new Binding(new SimpleCondition("condition2"), queues[11], false), false);
assertTrue(added);
//durable
- queues[12] = new MessagingQueue(2, "sub13", channelIDManager.getID(), ms, pm, true, -1, null, true);
+ queues[12] = new MessagingQueue(2, "sub13", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, true);
queues[12].activate();
added = office2.addBinding(new Binding(new SimpleCondition("condition2"), queues[12], false), false);
assertTrue(added);
- queues[13] = new MessagingQueue(1, "sub14", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ queues[13] = new MessagingQueue(1, "sub14", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queues[13].activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition2"), queues[13], false), false);
assertTrue(added);
//durable
- queues[14] = new MessagingQueue(1, "sub15", channelIDManager.getID(), ms, pm, true, -1, null, true);
+ queues[14] = new MessagingQueue(1, "sub15", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, true);
queues[14].activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition2"), queues[14], false), false);
assertTrue(added);
- queues[15] = new MessagingQueue(1, "sub16", channelIDManager.getID(), ms, pm, true, -1, null, true);
+ queues[15] = new MessagingQueue(1, "sub16", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, true);
queues[15].activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition2"), queues[15], false), false);
assertTrue(added);
@@ -2436,42 +2428,42 @@
//condition1
- queues[0] = new MessagingQueue(1, "sub1", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ queues[0] = new MessagingQueue(1, "sub1", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queues[0].activate();
boolean added = office1.addBinding(new Binding(new SimpleCondition("condition1"), queues[0], false), false);
assertTrue(added);
- queues[1] = new MessagingQueue(1, "sub2", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ queues[1] = new MessagingQueue(1, "sub2", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queues[1].activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition1"), queues[1], false), false);
assertTrue(added);
- queues[2] = new MessagingQueue(2, "sub3", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ queues[2] = new MessagingQueue(2, "sub3", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queues[2].activate();
added = office2.addBinding(new Binding(new SimpleCondition("condition1"), queues[2], false), false);
assertTrue(added);
- queues[3] = new MessagingQueue(2, "sub4", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ queues[3] = new MessagingQueue(2, "sub4", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queues[3].activate();
added = office2.addBinding(new Binding(new SimpleCondition("condition1"), queues[3], false), false);
assertTrue(added);
- queues[4] = new MessagingQueue(2, "sub5", channelIDManager.getID(), ms, pm, true, -1, null, false);
+ queues[4] = new MessagingQueue(2, "sub5", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, false);
queues[4].activate();
added = office2.addBinding(new Binding(new SimpleCondition("condition1"), queues[4], false), false);
assertTrue(added);
- queues[5] = new MessagingQueue(1, "sub6", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ queues[5] = new MessagingQueue(1, "sub6", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queues[5].activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition1"), queues[5], false), false);
assertTrue(added);
- queues[6] = new MessagingQueue(1, "sub7", channelIDManager.getID(), ms, pm, true, -1, null, false);
+ queues[6] = new MessagingQueue(1, "sub7", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, false);
queues[6].activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition1"), queues[6], false), false);
assertTrue(added);
- queues[7] = new MessagingQueue(1, "sub8", channelIDManager.getID(), ms, pm, true, -1, null, true);
+ queues[7] = new MessagingQueue(1, "sub8", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, true);
queues[7].activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition1"), queues[7], false), false);
assertTrue(added);
@@ -2479,42 +2471,42 @@
//condition2
- queues[8] = new MessagingQueue(1, "sub9", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ queues[8] = new MessagingQueue(1, "sub9", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queues[8].activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition2"), queues[8], false), false);
assertTrue(added);
- queues[9] = new MessagingQueue(1, "sub10", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ queues[9] = new MessagingQueue(1, "sub10", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queues[9].activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition2"), queues[9], false), false);
assertTrue(added);
- queues[10] = new MessagingQueue(2, "sub11", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ queues[10] = new MessagingQueue(2, "sub11", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queues[10].activate();
added = office2.addBinding(new Binding(new SimpleCondition("condition2"), queues[10], false), false);
assertTrue(added);
- queues[11] = new MessagingQueue(2, "sub12", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ queues[11] = new MessagingQueue(2, "sub12", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queues[11].activate();
added = office2.addBinding(new Binding(new SimpleCondition("condition2"), queues[11], false), false);
assertTrue(added);
- queues[12] = new MessagingQueue(2, "sub13", channelIDManager.getID(), ms, pm, true, -1, null, false);
+ queues[12] = new MessagingQueue(2, "sub13", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, false);
queues[12].activate();
added = office2.addBinding(new Binding(new SimpleCondition("condition2"), queues[12], false), false);
assertTrue(added);
- queues[13] = new MessagingQueue(1, "sub14", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ queues[13] = new MessagingQueue(1, "sub14", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queues[13].activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition2"), queues[13], false), false);
assertTrue(added);
- queues[14] = new MessagingQueue(1, "sub15", channelIDManager.getID(), ms, pm, true, -1, null, false);
+ queues[14] = new MessagingQueue(1, "sub15", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, false);
queues[14].activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition2"), queues[14], false), false);
assertTrue(added);
- queues[15] = new MessagingQueue(1, "sub16", channelIDManager.getID(), ms, pm, true, -1, null, true);
+ queues[15] = new MessagingQueue(1, "sub16", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, true);
queues[15].activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition2"), queues[15], false), false);
assertTrue(added);
@@ -2634,12 +2626,12 @@
//queue1
- Queue queue0 = new MessagingQueue(1, "myqueue1", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue0 = new MessagingQueue(1, "myqueue1", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue0.activate();
boolean added = office1.addBinding(new Binding(new SimpleCondition("myqueue1"), queue0, false), false);
assertTrue(added);
- Queue queue1 = new MessagingQueue(2, "myqueue1", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue1 = new MessagingQueue(2, "myqueue1", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue1.activate();
added = office2.addBinding(new Binding(new SimpleCondition("myqueue1"), queue1, false), false);
assertTrue(added);
@@ -2647,12 +2639,12 @@
//queue2
- Queue queue2 = new MessagingQueue(1, "myqueue2", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue2 = new MessagingQueue(1, "myqueue2", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue2.activate();
added = office1.addBinding(new Binding(new SimpleCondition("myqueue2"), queue2, false), false);
assertTrue(added);
- Queue queue3 = new MessagingQueue(2, "myqueue2", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue3 = new MessagingQueue(2, "myqueue2", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue3.activate();
added = office2.addBinding(new Binding(new SimpleCondition("myqueue2"), queue3, false), false);
assertTrue(added);
@@ -2779,23 +2771,23 @@
office2 = createClusteredPostOffice(2);
- Queue queue0 = new MessagingQueue(1, "sub1", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue0 = new MessagingQueue(1, "sub1", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue0.activate();
boolean added = office1.addBinding(new Binding(new SimpleCondition("condition1"), queue0, false), false);
assertTrue(added);
- Queue queue1 = new MessagingQueue(2, "sub2", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue1 = new MessagingQueue(2, "sub2", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue1.activate();
added = office2.addBinding(new Binding(new SimpleCondition("condition1"), queue1, false), false);
assertTrue(added);
- Queue queue2 = new MessagingQueue(1, "sub3", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue2 = new MessagingQueue(1, "sub3", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue2.activate();
added = office1.addBinding(new Binding(new SimpleCondition("condition2"), queue2, false), false);
assertTrue(added);
- Queue queue3 = new MessagingQueue(2, "sub4", channelIDManager.getID(), ms, pm, false, -1, null, true);
+ Queue queue3 = new MessagingQueue(2, "sub4", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, true);
queue3.activate();
added = office2.addBinding(new Binding(new SimpleCondition("condition2"), queue3, false), false);
assertTrue(added);
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/postoffice/PostOfficeTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/postoffice/PostOfficeTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/core/postoffice/PostOfficeTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,15 +21,7 @@
*/
package org.jboss.test.messaging.core.postoffice;
-import java.util.Collection;
-import java.util.List;
-
-import org.jboss.messaging.core.contract.Binding;
-import org.jboss.messaging.core.contract.Condition;
-import org.jboss.messaging.core.contract.Message;
-import org.jboss.messaging.core.contract.MessageReference;
-import org.jboss.messaging.core.contract.PostOffice;
-import org.jboss.messaging.core.contract.Queue;
+import org.jboss.messaging.core.contract.*;
import org.jboss.messaging.core.impl.MessagingQueue;
import org.jboss.messaging.core.impl.tx.Transaction;
import org.jboss.test.messaging.core.PostOfficeTestBase;
@@ -38,6 +30,9 @@
import org.jboss.test.messaging.core.SimpleReceiver;
import org.jboss.test.messaging.util.CoreMessageFactory;
+import java.util.Collection;
+import java.util.List;
+
/**
*
* A PostOfficeTest
@@ -80,7 +75,7 @@
//Bind one durable
MessagingQueue queue1 =
- new MessagingQueue(1, "durableQueue", channelIDManager.getID(), ms, pm, true, -1, null, false);
+ new MessagingQueue(1, "durableQueue", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, false);
queue1.activate();
Condition condition1 = new SimpleCondition("condition1");
@@ -98,7 +93,7 @@
{
MessagingQueue queuexx =
- new MessagingQueue(777, "durableQueue", channelIDManager.getID(), ms, pm, true, -1, null, false);
+ new MessagingQueue(777, "durableQueue", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, false);
queuexx.activate();
office1.addBinding(new Binding(condition1, queuexx, false), false);
fail();
@@ -111,7 +106,7 @@
//Bind one non durable
MessagingQueue queue2 =
- new MessagingQueue(1, "nonDurableQueue", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ new MessagingQueue(1, "nonDurableQueue", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queue2.activate();
Condition condition2 = new SimpleCondition("condition2");
@@ -163,7 +158,7 @@
office2.stop();
- //Throw away office and start another
+ //Throw away office and startServerPeer another
office3 = createNonClusteredPostOffice();
//Make sure not there
@@ -206,44 +201,44 @@
Condition condition1 = new SimpleCondition("condition1");
- MessagingQueue queue1 = new MessagingQueue(1, "queue1", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ MessagingQueue queue1 = new MessagingQueue(1, "queue1", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queue1.activate();
office.addBinding(new Binding(condition1, queue1, false), false);
- MessagingQueue queue2 = new MessagingQueue(1, "queue2", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ MessagingQueue queue2 = new MessagingQueue(1, "queue2", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queue2.activate();
office.addBinding(new Binding(condition1, queue2, false), false);
- MessagingQueue queue3 = new MessagingQueue(1, "queue3", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ MessagingQueue queue3 = new MessagingQueue(1, "queue3", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queue3.activate();
office.addBinding(new Binding(condition1, queue3, false), false);
- MessagingQueue queue4 = new MessagingQueue(1, "queue4", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ MessagingQueue queue4 = new MessagingQueue(1, "queue4", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queue4.activate();
office.addBinding(new Binding(condition1, queue4, false), false);
- MessagingQueue queue5 = new MessagingQueue(1, "queue5", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ MessagingQueue queue5 = new MessagingQueue(1, "queue5", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queue5.activate();
Condition condition2 = new SimpleCondition("condition2");
office.addBinding(new Binding(condition2, queue5, false), false);
- MessagingQueue queue6 = new MessagingQueue(1, "queue6", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ MessagingQueue queue6 = new MessagingQueue(1, "queue6", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queue6.activate();
office.addBinding(new Binding(condition2, queue6, false), false);
- MessagingQueue queue7 = new MessagingQueue(1, "queue7", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ MessagingQueue queue7 = new MessagingQueue(1, "queue7", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queue7.activate();
office.addBinding(new Binding(condition2, queue7, false), false);
- MessagingQueue queue8 = new MessagingQueue(1, "queue8", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ MessagingQueue queue8 = new MessagingQueue(1, "queue8", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queue8.activate();
office.addBinding(new Binding(condition2, queue8, false), false);
@@ -324,15 +319,15 @@
Condition condition1 = new SimpleCondition("condition1");
- MessagingQueue queue1 = new MessagingQueue(1, "queue1", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ MessagingQueue queue1 = new MessagingQueue(1, "queue1", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
office.addBinding(new Binding(condition1, queue1, false), false);
- MessagingQueue queue2 = new MessagingQueue(1, "queue2", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ MessagingQueue queue2 = new MessagingQueue(1, "queue2", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
office.addBinding(new Binding(condition1, queue2, false), false);
Condition condition2 = new SimpleCondition("condition2");
- MessagingQueue queue3 = new MessagingQueue(1, "queue3", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ MessagingQueue queue3 = new MessagingQueue(1, "queue3", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
office.addBinding(new Binding(condition2, queue3, false), false);
Binding b1 = office.getBindingForQueueName("queue1");
@@ -397,15 +392,15 @@
Condition condition1 = new SimpleCondition("condition1");
- MessagingQueue queue1 = new MessagingQueue(1, "queue1", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ MessagingQueue queue1 = new MessagingQueue(1, "queue1", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
office.addBinding(new Binding(condition1, queue1, false), false);
- MessagingQueue queue2 = new MessagingQueue(1, "queue2", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ MessagingQueue queue2 = new MessagingQueue(1, "queue2", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
office.addBinding(new Binding(condition1, queue2, false), false);
Condition condition2 = new SimpleCondition("condition2");
- MessagingQueue queue3 = new MessagingQueue(1, "queue3", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ MessagingQueue queue3 = new MessagingQueue(1, "queue3", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
office.addBinding(new Binding(condition2, queue3, false), false);
Binding b1 = office.getBindingForChannelID(queue1.getChannelID());
@@ -502,22 +497,22 @@
Condition condition1 = new SimpleCondition("topic1");
- MessagingQueue queue1 = new MessagingQueue(1, "queue1", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ MessagingQueue queue1 = new MessagingQueue(1, "queue1", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queue1.activate();
postOffice.addBinding(new Binding(condition1, queue1, false), false);
- MessagingQueue queue2 = new MessagingQueue(1, "queue2", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ MessagingQueue queue2 = new MessagingQueue(1, "queue2", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queue2.activate();
postOffice.addBinding(new Binding(condition1, queue2, false), false);
- MessagingQueue queue3 = new MessagingQueue(1, "queue3", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ MessagingQueue queue3 = new MessagingQueue(1, "queue3", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queue3.activate();
postOffice.addBinding(new Binding(condition1, queue3, false), false);
- MessagingQueue queue4 = new MessagingQueue(1, "queue4", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ MessagingQueue queue4 = new MessagingQueue(1, "queue4", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queue4.activate();
Condition condition2 = new SimpleCondition("topic2");
@@ -525,12 +520,12 @@
postOffice.addBinding(new Binding(condition2, queue4, false), false);
- MessagingQueue queue5 = new MessagingQueue(1, "queue5", channelIDManager.getID(), ms, pm, false,-1, null, false);
+ MessagingQueue queue5 = new MessagingQueue(1, "queue5", channelIDManager.getID(), ms, getPersistenceManager(), false,-1, null, false);
queue5.activate();
postOffice.addBinding(new Binding(condition2, queue5, false), false);
- MessagingQueue queue6 = new MessagingQueue(1, "queue6", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ MessagingQueue queue6 = new MessagingQueue(1, "queue6", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queue6.activate();
postOffice.addBinding(new Binding(condition2, queue6, false), false);
@@ -653,7 +648,7 @@
{
postOffice = createNonClusteredPostOffice();
- MessagingQueue queue1 = new MessagingQueue(1, "queue1", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ MessagingQueue queue1 = new MessagingQueue(1, "queue1", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queue1.activate();
postOffice.addBinding(new Binding(new SimpleCondition("condition1"), queue1, false), false);
@@ -716,34 +711,34 @@
Condition condition1 = new SimpleCondition("topic1");
- MessagingQueue queue1 = new MessagingQueue(1, "queue1", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ MessagingQueue queue1 = new MessagingQueue(1, "queue1", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queue1.activate();
postOffice.addBinding(new Binding(condition1, queue1, false), false);
- MessagingQueue queue2 = new MessagingQueue(1, "queue2", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ MessagingQueue queue2 = new MessagingQueue(1, "queue2", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queue2.activate();
postOffice.addBinding(new Binding(condition1, queue2, false), false);
- MessagingQueue queue3 = new MessagingQueue(1, "queue3", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ MessagingQueue queue3 = new MessagingQueue(1, "queue3", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queue3.activate();
postOffice.addBinding(new Binding(condition1, queue3, false), false);
- MessagingQueue queue4 = new MessagingQueue(1, "queue4", channelIDManager.getID(), ms, pm, true, -1, null, false);
+ MessagingQueue queue4 = new MessagingQueue(1, "queue4", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, false);
queue4.activate();
Condition condition2 = new SimpleCondition("topic2");
postOffice.addBinding(new Binding(condition2, queue4, false), false);
- MessagingQueue queue5 = new MessagingQueue(1, "queue5", channelIDManager.getID(), ms, pm, true, -1, null, false);
+ MessagingQueue queue5 = new MessagingQueue(1, "queue5", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, false);
queue5.activate();
postOffice.addBinding(new Binding(condition2, queue5, false), false);
- MessagingQueue queue6 = new MessagingQueue(1, "queue6", channelIDManager.getID(), ms, pm, true, -1, null, false);
+ MessagingQueue queue6 = new MessagingQueue(1, "queue6", channelIDManager.getID(), ms, getPersistenceManager(), true, -1, null, false);
queue6.activate();
postOffice.addBinding(new Binding(condition2, queue6, false), false);
@@ -896,12 +891,12 @@
Condition condition1 = new SimpleCondition("topic1");
- MessagingQueue queue1 = new MessagingQueue(1, "queue1", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ MessagingQueue queue1 = new MessagingQueue(1, "queue1", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queue1.activate();
postOffice.addBinding(new Binding(condition1, queue1, false), false);
- MessagingQueue queue2 = new MessagingQueue(1, "queue2", channelIDManager.getID(), ms, pm, true,-1, null, false);
+ MessagingQueue queue2 = new MessagingQueue(1, "queue2", channelIDManager.getID(), ms, getPersistenceManager(), true,-1, null, false);
queue2.activate();
postOffice.addBinding(new Binding(condition1, queue2, false), false);
@@ -1148,17 +1143,17 @@
Condition condition1 = new SimpleCondition("topic1");
- MessagingQueue queue1 = new MessagingQueue(1, "queue1", channelIDManager.getID(), ms, pm, false, -1, filter, false);
+ MessagingQueue queue1 = new MessagingQueue(1, "queue1", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, filter, false);
queue1.activate();
postOffice.addBinding(new Binding(condition1, queue1, false), false);
- MessagingQueue queue2 = new MessagingQueue(1, "queue2", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ MessagingQueue queue2 = new MessagingQueue(1, "queue2", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queue2.activate();
postOffice.addBinding(new Binding(condition1, queue2, false), false);
- MessagingQueue queue3 = new MessagingQueue(1, "queue3", channelIDManager.getID(), ms, pm, false, -1, null, false);
+ MessagingQueue queue3 = new MessagingQueue(1, "queue3", channelIDManager.getID(), ms, getPersistenceManager(), false, -1, null, false);
queue3.activate();
postOffice.addBinding(new Binding(condition1, queue3, false), false);
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/AOPStackInitializationTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/AOPStackInitializationTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/AOPStackInitializationTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -6,13 +6,12 @@
*/
package org.jboss.test.messaging.jms;
+import org.jboss.test.messaging.JBMServerTestCase;
+
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.naming.InitialContext;
-import org.jboss.test.messaging.MessagingTestCase;
-import org.jboss.test.messaging.tools.ServerManagement;
-
/**
* Tests the very first server invocation, when the client-side AOP stack is initialized.
*
@@ -21,7 +20,7 @@
*
* $Id: JMSTest.java 1843 2006-12-21 23:41:19Z timfox $
*/
-public class AOPStackInitializationTest extends MessagingTestCase
+public class AOPStackInitializationTest extends JBMServerTestCase
{
// Constants -----------------------------------------------------
@@ -57,10 +56,8 @@
{
super.setUp();
- ServerManagement.start("all");
+ ic = getInitialContext();
- ic = new InitialContext(ServerManagement.getJNDIEnvironment());
-
log.debug("setup done");
}
@@ -68,7 +65,6 @@
{
ic.close();
- ServerManagement.stop();
super.tearDown();
}
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/AcknowledgementTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/AcknowledgementTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/AcknowledgementTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,26 +21,11 @@
*/
package org.jboss.test.messaging.jms;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.DeliveryMode;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.TopicConnection;
-import javax.jms.TopicPublisher;
-import javax.jms.TopicSession;
-import javax.jms.TopicSubscriber;
-import javax.management.ObjectName;
-
+import EDU.oswego.cs.dl.util.concurrent.Latch;
import org.jboss.jms.client.JBossSession;
import org.jboss.jms.client.delegate.ClientSessionDelegate;
-import org.jboss.test.messaging.tools.ServerManagement;
-import EDU.oswego.cs.dl.util.concurrent.Latch;
+import javax.jms.*;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -706,25 +691,8 @@
public void testDupsOKAcknowledgeQueue() throws Exception
{
final int BATCH_SIZE = 10;
-
- String mbeanConfig =
- "<mbean code=\"org.jboss.jms.server.connectionfactory.ConnectionFactory\"\n" +
- " name=\"jboss.messaging.destination:service=MyConnectionFactory\"\n" +
- " xmbean-dd=\"xmdesc/ConnectionFactory-xmbean.xml\">\n" +
- " <depends optional-attribute-name=\"ServerPeer\">jboss.messaging:service=ServerPeer</depends>\n" +
- " <depends optional-attribute-name=\"Connector\">jboss.messaging:service=Connector,transport=bisocket</depends>\n" +
- " <attribute name=\"JNDIBindings\">\n" +
- " <bindings>\n" +
- " <binding>/mycf</binding>\n" +
- " </bindings>\n" +
- " </attribute>\n" +
- " <attribute name=\"DupsOKBatchSize\">" + BATCH_SIZE + "</attribute>" +
- " </mbean>";
- ObjectName on = ServerManagement.deploy(mbeanConfig);
- ServerManagement.invoke(on, "create", new Object[0], new String[0]);
- ServerManagement.invoke(on, "start", new Object[0], new String[0]);
-
+ deployConnectionFactory(null,"mycf", new String[]{"mycf"}, -1, -1, -1, -1, false, false, false, BATCH_SIZE);
Connection conn = null;
try
@@ -791,9 +759,7 @@
{
conn.close();
}
-
- ServerManagement.invoke(on, "stop", new Object[0], new String[0]);
- ServerManagement.invoke(on, "destroy", new Object[0], new String[0]);
+ undeployConnectionFactory("mycf");
}
@@ -803,25 +769,8 @@
public void testDupsOKAcknowledgeTopic() throws Exception
{
final int BATCH_SIZE = 10;
-
- String mbeanConfig =
- "<mbean code=\"org.jboss.jms.server.connectionfactory.ConnectionFactory\"\n" +
- " name=\"jboss.messaging.destination:service=MyConnectionFactory2\"\n" +
- " xmbean-dd=\"xmdesc/ConnectionFactory-xmbean.xml\">\n" +
- " <depends optional-attribute-name=\"ServerPeer\">jboss.messaging:service=ServerPeer</depends>\n" +
- " <depends optional-attribute-name=\"Connector\">jboss.messaging:service=Connector,transport=bisocket</depends>\n" +
- " <attribute name=\"JNDIBindings\">\n" +
- " <bindings>\n" +
- " <binding>/mycf</binding>\n" +
- " </bindings>\n" +
- " </attribute>\n" +
- " <attribute name=\"DupsOKBatchSize\">" + BATCH_SIZE + "</attribute>" +
- " </mbean>";
- ObjectName on = ServerManagement.deploy(mbeanConfig);
- ServerManagement.invoke(on, "create", new Object[0], new String[0]);
- ServerManagement.invoke(on, "start", new Object[0], new String[0]);
-
+ deployConnectionFactory(null,"mycf", new String[]{"mycf"}, -1, -1, -1, -1, false, false, false, BATCH_SIZE);
Connection conn = null;
try
@@ -865,8 +814,7 @@
conn.close();
}
- ServerManagement.invoke(on, "stop", new Object[0], new String[0]);
- ServerManagement.invoke(on, "destroy", new Object[0], new String[0]);
+ undeployConnectionFactory("mycf");
}
@@ -1069,7 +1017,7 @@
{
conn.close();
}
- ServerManagement.undeployQueue("MyQueue2");
+ undeployQueue("MyQueue2");
}
}
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/BrowserTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/BrowserTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/BrowserTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,20 +21,13 @@
*/
package org.jboss.test.messaging.jms;
-import java.util.Enumeration;
-
-import javax.jms.Connection;
-import javax.jms.InvalidDestinationException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.QueueBrowser;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
import org.jboss.jms.destination.JBossQueue;
+import org.jboss.test.messaging.JBMServerTestCase;
+import javax.jms.*;
+import java.util.Enumeration;
+
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
@@ -42,7 +35,7 @@
*
* $Id$
*/
-public class BrowserTest extends JMSTestCase
+public class BrowserTest extends JBMServerTestCase
{
// Constants -----------------------------------------------------------------------------------
@@ -66,7 +59,7 @@
try
{
- conn = cf.createConnection();
+ conn = getConnectionFactory().createConnection();
Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -91,7 +84,7 @@
public void testCreateBrowserOnNonExistentQueue() throws Exception
{
- Connection pconn = cf.createConnection();
+ Connection pconn = getConnectionFactory().createConnection();
try
{
@@ -122,7 +115,7 @@
try
{
- conn = cf.createConnection();
+ conn = getConnectionFactory().createConnection();
Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -196,7 +189,7 @@
try
{
- conn = cf.createConnection();
+ conn = getConnectionFactory().createConnection();
Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -243,7 +236,7 @@
try
{
- conn = cf.createConnection();
+ conn = getConnectionFactory().createConnection();
Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,32 +21,15 @@
*/
package org.jboss.test.messaging.jms;
-import javax.jms.BytesMessage;
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.InvalidSelectorException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.QueueConnection;
-import javax.jms.QueueReceiver;
-import javax.jms.QueueSender;
-import javax.jms.QueueSession;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.TopicConnection;
-import javax.jms.TopicSession;
-import javax.naming.InitialContext;
-import javax.management.ObjectName;
-
+import org.jboss.jms.client.JBossConnectionFactory;
+import org.jboss.test.messaging.JBMServerTestCase;
import org.jboss.test.messaging.jms.message.SimpleJMSBytesMessage;
import org.jboss.test.messaging.jms.message.SimpleJMSMessage;
import org.jboss.test.messaging.jms.message.SimpleJMSTextMessage;
import org.jboss.test.messaging.tools.container.ServiceAttributeOverrides;
-import org.jboss.test.messaging.tools.container.ServiceContainer;
-import org.jboss.test.messaging.tools.ServerManagement;
-import org.jboss.jms.client.JBossConnectionFactory;
+import javax.jms.*;
+
/**
* Safeguards for previously detected TCK failures.
*
@@ -56,7 +39,7 @@
*
* $Id$
*/
-public class CTSMiscellaneousTest extends JMSTestCase
+public class CTSMiscellaneousTest extends JBMServerTestCase
{
// Constants -----------------------------------------------------
@@ -65,7 +48,7 @@
// Attributes ----------------------------------------------------
protected static JBossConnectionFactory cf;
protected ServiceAttributeOverrides overrides;
- private static final String ORG_JBOSS_MESSAGING_SERVICE_LBCONNECTION_FACTORY = "org.jboss.messaging:service=StrictTckConnectionFactory";
+ private static final String ORG_JBOSS_MESSAGING_SERVICE_LBCONNECTION_FACTORY = "StrictTCKConnectionFactory";
// Constructors --------------------------------------------------
@@ -80,9 +63,8 @@
{
super.setUp();
//Deploy a connection factory with load balancing but no failover on node0
- ServerManagement.getServer(0).deployConnectionFactory(ORG_JBOSS_MESSAGING_SERVICE_LBCONNECTION_FACTORY,
- new String[] { "/StrictTCKConnectionFactory" }, true);
- cf = (JBossConnectionFactory) ic.lookup("/StrictTCKConnectionFactory");
+ deployConnectionFactory("StrictTCKConnectionFactory", new String[]{"StrictTCKConnectionFactory"}, true);
+ cf = (JBossConnectionFactory) getInitialContext().lookup("/StrictTCKConnectionFactory");
}
catch (Exception e)
{
@@ -337,7 +319,7 @@
protected void tearDown() throws Exception
{
super.tearDown();
- ServerManagement.undeployConnectionFactory(new ObjectName(ORG_JBOSS_MESSAGING_SERVICE_LBCONNECTION_FACTORY));
+ undeployConnectionFactory(ORG_JBOSS_MESSAGING_SERVICE_LBCONNECTION_FACTORY);
}
// Package protected ---------------------------------------------
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ClientInRestrictedSecurityEnvironmentTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ClientInRestrictedSecurityEnvironmentTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ClientInRestrictedSecurityEnvironmentTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,17 +21,12 @@
*/
package org.jboss.test.messaging.jms;
-import java.net.SocketPermission;
-
-import javax.jms.Connection;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
import org.jboss.test.messaging.tools.ServerManagement;
import org.jboss.test.messaging.tools.misc.ConfigurableSecurityManager;
+import javax.jms.*;
+import java.net.SocketPermission;
+
/**
* This test runs the JMS client in a restricted security environments.
*
@@ -93,7 +88,7 @@
// MessageProducer p = s.createProducer(queue);
// MessageConsumer c = s.createConsumer(queue);
//
-// conn.start();
+// conn.startServerPeer();
//
// p.send(s.createTextMessage("payload"));
//
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ConnectionConsumerTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ConnectionConsumerTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ConnectionConsumerTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,20 +21,11 @@
*/
package org.jboss.test.messaging.jms;
-import javax.jms.Connection;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.ServerSession;
-import javax.jms.ServerSessionPool;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
+import EDU.oswego.cs.dl.util.concurrent.Latch;
import org.jboss.jms.client.JBossConnectionConsumer;
import org.jboss.test.messaging.tools.ServerManagement;
-import EDU.oswego.cs.dl.util.concurrent.Latch;
+import javax.jms.*;
/**
@@ -314,7 +305,8 @@
}
}
- public void testStopWhileProcessing() throws Exception
+ //todo this test needs replacing
+ /*public void testStopWhileProcessing() throws Exception
{
if (ServerManagement.isRemote()) return;
@@ -337,15 +329,16 @@
JBossConnectionConsumer cc = (JBossConnectionConsumer)connConsumer.createConnectionConsumer(queue1, null, pool, 1);
- ServerManagement.stop();
+ stopServerPeer();
connConsumer.close();
+ startServerPeer();
connConsumer = null;
}
finally
{
if (connConsumer != null) connConsumer.close();
}
- }
+ }*/
class SimpleMessageListener implements MessageListener
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,27 +21,8 @@
*/
package org.jboss.test.messaging.jms;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.jms.TopicConnection;
-import javax.jms.TopicConnectionFactory;
-import javax.management.ObjectName;
+import javax.jms.*;
-import org.jboss.jms.client.JBossConnectionFactory;
-import org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate;
-import org.jboss.test.messaging.tools.ServerManagement;
-import org.jboss.test.messaging.tools.container.ServiceContainer;
-
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -64,6 +45,11 @@
super(name);
}
+ protected void setUp() throws Exception
+ {
+ super.setUp(); //To change body of overridden methods use File | Settings | File Templates.
+ }
+
// Public --------------------------------------------------------
/**
@@ -94,26 +80,8 @@
{
// deploy a connection factory that has an administatively configured clientID
- String mbeanConfig =
- "<mbean code=\"org.jboss.jms.server.connectionfactory.ConnectionFactory\"\n" +
- " name=\"jboss.messaging.connectionfactory:service=TestConnectionFactory\"\n" +
- " xmbean-dd=\"xmdesc/ConnectionFactory-xmbean.xml\">\n" +
- " <constructor>\n" +
- " <arg type=\"java.lang.String\" value=\"sofiavergara\"/>\n" +
- " </constructor>\n" +
- " <depends optional-attribute-name=\"ServerPeer\">jboss.messaging:service=ServerPeer</depends>\n" +
- " <depends optional-attribute-name=\"Connector\">jboss.messaging:service=Connector,transport=bisocket</depends>\n" +
- " <attribute name=\"JNDIBindings\">\n" +
- " <bindings>\n" +
- " <binding>/TestConnectionFactory</binding>\n" +
- " </bindings>\n" +
- " </attribute>\n" +
- " </mbean>";
+ deployConnectionFactory("sofiavergara", "TestConnectionFactory", new String[]{"TestConnectionFactory"} );
- ObjectName on = ServerManagement.deploy(mbeanConfig);
- ServerManagement.invoke(on, "create", new Object[0], new String[0]);
- ServerManagement.invoke(on, "start", new Object[0], new String[0]);
-
ConnectionFactory cf = (ConnectionFactory)ic.lookup("/TestConnectionFactory");
Connection c = cf.createConnection();
@@ -129,114 +97,9 @@
{
// OK
}
-
- //Now try and deploy another one with the same client id
-
- mbeanConfig =
- "<mbean code=\"org.jboss.jms.server.connectionfactory.ConnectionFactory\"\n" +
- " name=\"jboss.messaging.connectionfactory:service=TestConnectionFactory2\"\n" +
- " xmbean-dd=\"xmdesc/ConnectionFactory-xmbean.xml\">\n" +
- " <constructor>\n" +
- " <arg type=\"java.lang.String\" value=\"sofiavergara\"/>\n" +
- " </constructor>\n" +
- " <depends optional-attribute-name=\"ServerPeer\">jboss.messaging:service=ServerPeer</depends>\n" +
- " <depends optional-attribute-name=\"Connector\">jboss.messaging:service=Connector,transport=bisocket</depends>\n" +
- " <attribute name=\"JNDIBindings\">\n" +
- " <bindings>\n" +
- " <binding>/TestConnectionFactory2</binding>\n" +
- " </bindings>\n" +
- " </attribute>\n" +
- " </mbean>";
-
- ObjectName on2 = ServerManagement.deploy(mbeanConfig);
- ServerManagement.invoke(on2, "create", new Object[0], new String[0]);
- ServerManagement.invoke(on2, "start", new Object[0], new String[0]);
-
-
- ServerManagement.invoke(on2, "stop", new Object[0], new String[0]);
- ServerManagement.invoke(on2, "destroy", new Object[0], new String[0]);
- ServerManagement.undeploy(on2);
-
- cf = (ConnectionFactory)ic.lookup("/TestConnectionFactory");
- Connection c2 = null;
- try
- {
- c2 = cf.createConnection();
- }
- catch (JMSException e)
- {
- //Ok
- }
-
- if (c2 != null) c2.close();
-
c.close();
-
- ServerManagement.invoke(on, "stop", new Object[0], new String[0]);
- ServerManagement.invoke(on, "destroy", new Object[0], new String[0]);
- ServerManagement.undeploy(on);
+ undeployConnectionFactory("TestConnectionFactory");
}
-
- public void testAdministrativelyConfiguredConnectors() throws Exception
- {
- //Deploy a few connectors
- String name1 = "jboss.messaging:service=Connector1,transport=bisocket";
-
- String name2 = "jboss.messaging:service=Connector2,transport=bisocket";
-
- String name3 = "jboss.messaging:service=Connector3,transport=bisocket";
-
- ObjectName c1 = deployConnector(1234, name1);
- ObjectName c2 = deployConnector(1235, name2);
- ObjectName c3 = deployConnector(1236, name3);
-
- ObjectName cf1 = deployConnectionFactory("jboss.messaging.destination:service=TestConnectionFactory1", name1, "/TestConnectionFactory1", "clientid1", false);
- ObjectName cf2 = deployConnectionFactory("jboss.messaging.destination:service=TestConnectionFactory2", name2, "/TestConnectionFactory2", "clientid2", false);
- ObjectName cf3 = deployConnectionFactory("jboss.messaging.destination:service=TestConnectionFactory3", name3, "/TestConnectionFactory3", "clientid3", false);
- //Last one shares the same connector
- ObjectName cf4 = deployConnectionFactory("jboss.messaging.destination:service=TestConnectionFactory4", name3, "/TestConnectionFactory4", "clientid4", false);
-
-
- JBossConnectionFactory f1 = (JBossConnectionFactory)ic.lookup("/TestConnectionFactory1");
- ClientConnectionFactoryDelegate del1 = (ClientConnectionFactoryDelegate)f1.getDelegate();
-
- assertTrue(del1.getServerLocatorURI().startsWith("bisocket://localhost:1234"));
-
- JBossConnectionFactory f2 = (JBossConnectionFactory)ic.lookup("/TestConnectionFactory2");
- ClientConnectionFactoryDelegate del2 = (ClientConnectionFactoryDelegate)f2.getDelegate();
- assertTrue(del2.getServerLocatorURI().startsWith("bisocket://localhost:1235"));
-
- JBossConnectionFactory f3 = (JBossConnectionFactory)ic.lookup("/TestConnectionFactory3");
- ClientConnectionFactoryDelegate del3 = (ClientConnectionFactoryDelegate)f3.getDelegate();
- assertTrue(del3.getServerLocatorURI().startsWith("bisocket://localhost:1236"));
-
- JBossConnectionFactory f4 = (JBossConnectionFactory)ic.lookup("/TestConnectionFactory4");
- ClientConnectionFactoryDelegate del4 = (ClientConnectionFactoryDelegate)f4.getDelegate();
- assertTrue(del4.getServerLocatorURI().startsWith("bisocket://localhost:1236"));
-
- Connection con1 = f1.createConnection();
- Connection con2 = f2.createConnection();
- Connection con3 = f3.createConnection();
- Connection con4 = f4.createConnection();
- con1.close();
- con2.close();
- con3.close();
- con4.close();
-
- stopService(cf1);
- stopService(cf2);
- stopService(cf3);
-
- //Check f4 is still ok
- Connection conn5 = f4.createConnection();
- conn5.close();
-
- stopService(cf4);
-
- stopService(c1);
- stopService(c2);
- stopService(c3);
- }
public void testNoClientIDConfigured_1() throws Exception
{
@@ -270,9 +133,9 @@
// Added for http://jira.jboss.org/jira/browse/JBMESSAGING-939
public void testDurableSubscriptionOnPreConfiguredConnectionFactory() throws Exception
{
- ObjectName cf1 = deployConnectionFactory("jboss.messaging.destination:service=TestConnectionFactory1", ServiceContainer.REMOTING_OBJECT_NAME.getCanonicalName(), "/TestDurableCF", "cfTest", false);
+ deployConnectionFactory("TestConnectionFactory1","cfTest", new String[]{"/TestDurableCF"});
- ServerManagement.deployTopic("TestSubscriber");
+ deployTopic("TestSubscriber");
Connection conn = null;
@@ -309,28 +172,18 @@
try
{
- stopService(cf1);
+ destroyTopic("TestSubscriber");
}
catch (Exception e)
{
log.warn(e.toString(), e);
}
- try
- {
- ServerManagement.destroyTopic("TestSubscriber");
- }
- catch (Exception e)
- {
- log.warn(e.toString(), e);
- }
-
}
}
-
- public void testSlowConsumers() throws Exception
+ /* public void testSlowConsumers() throws Exception
{
ObjectName cf1 = deployConnectionFactory("jboss.messaging.destination:service=TestConnectionFactorySlowConsumers",
ServiceContainer.REMOTING_OBJECT_NAME.getCanonicalName(), "/TestSlowConsumersCF", null, true);
@@ -430,7 +283,7 @@
MessageProducer prod = sessSend.createProducer(queue1);
- conn.start();
+ conn.startServerPeer();
for (int i = 0; i < numMessages; i++)
{
@@ -483,7 +336,7 @@
}
- }
+ }*/
// Package protected ---------------------------------------------
@@ -491,90 +344,8 @@
// Protected -----------------------------------------------------
// Private -------------------------------------------------------
-
- private ObjectName deployConnector(int port, String name) throws Exception
- {
- String mbeanConfig =
- "<mbean code=\"org.jboss.remoting.transport.Connector\"\n" +
- " name=\"" +name + "\"\n" +
- " display-name=\"BiSocket transport Connector\">\n" +
- "</mbean>";
-
- String config =
- "<attribute name=\"Configuration\">\n" +
- "<config>" +
- "<invoker transport=\"bisocket\">" +
-
- "<attribute name=\"marshaller\" isParam=\"true\">org.jboss.jms.wireformat.JMSWireFormat</attribute>" +
- "<attribute name=\"unmarshaller\" isParam=\"true\">org.jboss.jms.wireformat.JMSWireFormat</attribute>" +
- "<attribute name=\"dataType\" isParam=\"true\">jms</attribute>" +
- "<attribute name=\"socket.check_connection\" isParam=\"true\">false</attribute>" +
- "<attribute name=\"timeout\" isParam=\"true\">0</attribute>" +
- "<attribute name=\"serverBindAddress\">localhost</attribute>" +
- "<attribute name=\"serverBindPort\">" + port + "</attribute>" +
- "<attribute name=\"clientSocketClass\" isParam=\"true\">org.jboss.jms.client.remoting.ClientSocketWrapper</attribute>"+
- "<attribute name=\"serverSocketClass\" isParam=\"true\">org.jboss.jms.server.remoting.ServerSocketWrapper</attribute>" +
- "<attribute name=\"numberOfCallRetries\" isParam=\"true\">1</attribute>" +
- "<attribute name=\"pingFrequency\" isParam=\"true\">214748364</attribute>" +
- "<attribute name=\"pingWindowFactor\" isParam=\"true\">10</attribute>" +
- "<attribute name=\"onewayThreadPool\">org.jboss.jms.server.remoting.DirectThreadPool</attribute>" +
-
- "<attribute name=\"clientLeasePeriod\" isParam=\"true\">10000</attribute>" +
-
- "<attribute name=\"numberOfRetries\" isParam=\"true\">10</attribute>" +
- "<attribute name=\"clientMaxPoolSize\" isParam=\"true\">200</attribute>" +
-
- "</invoker>" +
- "<handlers>" +
- "<handler subsystem=\"JMS\">org.jboss.jms.server.remoting.JMSServerInvocationHandler</handler>" +
- "</handlers>" +
- "</config>" +
- "</attribute>\n";
-
- ObjectName on = ServerManagement.deploy(mbeanConfig);
-
- ServerManagement.setAttribute(on, "Configuration", config);
-
- ServerManagement.invoke(on, "create", new Object[0], new String[0]);
-
- ServerManagement.invoke(on, "start", new Object[0], new String[0]);
-
- return on;
- }
-
- private ObjectName deployConnectionFactory(String name, String connectorName, String binding, String clientID, boolean slowConsumers) throws Exception
- {
- String mbeanConfig =
- "<mbean code=\"org.jboss.jms.server.connectionfactory.ConnectionFactory\"\n" +
- " name=\"" + name + "\"\n" +
- " xmbean-dd=\"xmdesc/ConnectionFactory-xmbean.xml\">\n" +
- " <constructor>\n" +
- " <arg type=\"java.lang.String\" value=\"" + clientID + "\"/>\n" +
- " </constructor>\n" +
- " <depends optional-attribute-name=\"ServerPeer\">jboss.messaging:service=ServerPeer</depends>\n" +
- " <depends optional-attribute-name=\"Connector\">" + connectorName + "</depends>\n" +
- " <attribute name=\"JNDIBindings\">\n" +
- " <bindings>\n" +
- " <binding>" + binding + " </binding>\n" +
- " </bindings>\n" +
- " </attribute>\n" +
- " <attribute name=\"SlowConsumers\">" + slowConsumers + "</attribute>\n" +
- " </mbean>";
- ObjectName on = ServerManagement.deploy(mbeanConfig);
- ServerManagement.invoke(on, "create", new Object[0], new String[0]);
- ServerManagement.invoke(on, "start", new Object[0], new String[0]);
-
- return on;
- }
- private void stopService(ObjectName on) throws Exception
- {
- ServerManagement.invoke(on, "stop", new Object[0], new String[0]);
- ServerManagement.invoke(on, "destroy", new Object[0], new String[0]);
- ServerManagement.undeploy(on);
- }
-
// Inner classes -------------------------------------------------
}
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ConnectionTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ConnectionTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ConnectionTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,18 +21,6 @@
*/
package org.jboss.test.messaging.jms;
-import javax.jms.Connection;
-import javax.jms.ConnectionMetaData;
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.ServerSessionPool;
-import javax.jms.Session;
-import javax.jms.Topic;
-import javax.jms.TopicConnection;
-import javax.jms.TopicConnectionFactory;
-
import org.jboss.jms.client.JBossConnection;
import org.jboss.jms.client.delegate.ClientConnectionDelegate;
import org.jboss.jms.client.state.ConnectionState;
@@ -42,7 +30,9 @@
import org.jboss.jms.tx.ResourceManagerFactory;
import org.jboss.logging.Logger;
+import javax.jms.*;
+
/**
* Connection tests. Contains all connection tests, except tests relating to closing a connection,
* which go to ConnectionClosedTest.
@@ -237,7 +227,7 @@
{
connection = cf.createConnection();
- //we start the connection
+ //we startServerPeer the connection
connection.start();
// an attempt to set the client ID now should throw a IllegalStateException
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ConsumerClosedTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ConsumerClosedTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ConsumerClosedTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -75,7 +75,7 @@
c.close();
}
- removeAllMessages(queue1.getQueueName(), true, 0);
+ //removeAllMessages(queue1.getQueueName(), true, 0);
}
}
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/DLQTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/DLQTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/DLQTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,34 +21,23 @@
*/
package org.jboss.test.messaging.jms;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.Destination;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.management.ObjectName;
-import javax.naming.NameNotFoundException;
-
import org.jboss.jms.destination.JBossQueue;
import org.jboss.jms.message.JBossMessage;
+import org.jboss.jms.server.ServerPeer;
import org.jboss.test.messaging.tools.ServerManagement;
+import javax.jms.*;
+import javax.management.ObjectName;
+import java.util.HashMap;
+import java.util.Map;
+
/**
* A DLQTest
*
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @version <tt>$Revision$</tt>
- *
- * $Id$
- *
+ * <p/>
+ * $Id$
*/
public class DLQTest extends JMSTestCase
{
@@ -73,209 +62,165 @@
{
return;
}
-
- try
- {
- ServerManagement.deployQueue("DLQ");
-
- ObjectName serverPeerObjectName = ServerManagement.getServerPeerObjectName();
-
- ObjectName dlqObjectName = (ObjectName)ServerManagement.getAttribute(serverPeerObjectName, "DefaultDLQ");
-
- assertNotNull(dlqObjectName);
-
- String name = (String)ServerManagement.getAttribute(dlqObjectName, "Name");
-
- assertNotNull(name);
-
- assertEquals("DLQ", name);
- String jndiName = (String)ServerManagement.getAttribute(dlqObjectName, "JNDIName");
-
- assertNotNull(jndiName);
-
- assertEquals("/queue/DLQ", jndiName);
-
- org.jboss.messaging.core.contract.Queue dlq = ServerManagement.getServer().getServerPeer().getDefaultDLQInstance();
- assertNotNull(dlq);
+ assertNotNull(((ServerPeer)getJmsServer()).getDefaultDLQInstance());
- JBossQueue q = (JBossQueue)ic.lookup("/queue/DLQ");
+ String name = getJmsServer().getConfiguration().getDefaultDLQ();
- assertNotNull(q);
+ assertNotNull(name);
- assertEquals("DLQ", q.getName());
- }
- finally
- {
- ServerManagement.undeployQueue("DLQ");
- }
- }
+ assertEquals("DLQ", name);
- public void testDLQNotAlreadyDeployed() throws Exception
- {
- if (ServerManagement.isRemote())
- {
- return;
- }
-
- org.jboss.messaging.core.contract.Queue dlq = ServerManagement.getServer().getServerPeer().getDefaultDLQInstance();
+ JBossQueue q = (JBossQueue) ic.lookup("/queue/DLQ");
- assertNull(dlq);
+ assertNotNull(q);
- try
- {
- ic.lookup("/queue/DLQ");
-
- fail();
- }
- catch (NameNotFoundException e)
- {
- //Ok
- }
+ assertEquals("DLQ", q.getName());
}
-
+
+
public void testDefaultAndOverrideDLQ() throws Exception
{
if (ServerManagement.isRemote())
{
return;
}
-
+
final int NUM_MESSAGES = 5;
-
+
final int MAX_DELIVERIES = 8;
-
- ObjectName serverPeerObjectName = ServerManagement.getServerPeerObjectName();
-
- String testQueueObjectName = "jboss.messaging.destination:service=Queue,name=Queue1";
-
- Connection conn = null;
-
+
+ ObjectName serverPeerObjectName = ServerManagement.getServerPeerObjectName();
+
+ String testQueueObjectName = "jboss.messaging.destination:service=Queue,name=Queue1";
+
+ Connection conn = null;
+
try
- {
- String defaultDLQObjectName = "jboss.messaging.destination:service=Queue,name=Queue2";
-
- String overrideDLQObjectName = "jboss.messaging.destination:service=Queue,name=Queue3";
-
- ServerManagement.setAttribute(serverPeerObjectName, "DefaultMaxDeliveryAttempts", String.valueOf(MAX_DELIVERIES));
-
- ServerManagement.setAttribute(serverPeerObjectName, "DefaultDLQ", defaultDLQObjectName);
-
- ServerManagement.setAttribute(new ObjectName(testQueueObjectName), "DLQ", "");
-
+ {
+ String defaultDLQObjectName = "jboss.messaging.destination:service=Queue,name=Queue2";
+
+ String overrideDLQObjectName = "jboss.messaging.destination:service=Queue,name=Queue3";
+
+ ServerManagement.setAttribute(serverPeerObjectName, "DefaultMaxDeliveryAttempts", String.valueOf(MAX_DELIVERIES));
+
+ ServerManagement.setAttribute(serverPeerObjectName, "DefaultDLQ", defaultDLQObjectName);
+
+ ServerManagement.setAttribute(new ObjectName(testQueueObjectName), "DLQ", "");
+
conn = cf.createConnection();
-
- {
+
+ {
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
+
MessageProducer prod = sess.createProducer(queue1);
-
+
for (int i = 0; i < NUM_MESSAGES; i++)
{
TextMessage tm = sess.createTextMessage("Message:" + i);
-
+
prod.send(tm);
}
-
+
Session sess2 = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
-
+
MessageConsumer cons = sess2.createConsumer(queue1);
-
+
conn.start();
-
- for (int i = 0; i < MAX_DELIVERIES; i++)
+
+ for (int i = 0; i < MAX_DELIVERIES; i++)
{
for (int j = 0; j < NUM_MESSAGES; j++)
{
- TextMessage tm = (TextMessage)cons.receive(1000);
-
+ TextMessage tm = (TextMessage) cons.receive(1000);
+
assertNotNull(tm);
-
+
assertEquals("Message:" + j, tm.getText());
}
-
+
sess2.recover();
}
-
+
//Prompt them to go to DLQ
cons.receive(100);
-
+
//At this point all the messages have been delivered exactly MAX_DELIVERIES times
-
+
checkEmpty(queue1);
-
+
//Now should be in default dlq
-
+
MessageConsumer cons3 = sess.createConsumer(queue2);
-
+
for (int i = 0; i < NUM_MESSAGES; i++)
{
- TextMessage tm = (TextMessage)cons3.receive(1000);
-
+ TextMessage tm = (TextMessage) cons3.receive(1000);
+
assertNotNull(tm);
-
+
assertEquals("Message:" + i, tm.getText());
}
-
+
conn.close();
}
-
-
+
+
{
//Now try with overriding the default dlq
-
+
conn = cf.createConnection();
-
+
ServerManagement.setAttribute(new ObjectName(testQueueObjectName), "DLQ", overrideDLQObjectName);
-
+
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
+
MessageProducer prod = sess.createProducer(queue1);
-
+
for (int i = 0; i < NUM_MESSAGES; i++)
{
TextMessage tm = sess.createTextMessage("Message:" + i);
-
+
prod.send(tm);
}
-
+
Session sess2 = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
-
+
MessageConsumer cons = sess2.createConsumer(queue1);
-
+
conn.start();
-
- for (int i = 0; i < MAX_DELIVERIES; i++)
+
+ for (int i = 0; i < MAX_DELIVERIES; i++)
{
for (int j = 0; j < NUM_MESSAGES; j++)
{
- TextMessage tm = (TextMessage)cons.receive(1000);
-
+ TextMessage tm = (TextMessage) cons.receive(1000);
+
assertNotNull(tm);
-
+
assertEquals("Message:" + j, tm.getText());
}
-
+
sess2.recover();
}
-
+
cons.receive(100);
-
+
//At this point all the messages have been delivered exactly MAX_DELIVERIES times
-
+
checkEmpty(queue1);
-
+
//Now should be in override dlq
-
+
MessageConsumer cons3 = sess.createConsumer(queue3);
-
+
for (int i = 0; i < NUM_MESSAGES; i++)
{
- TextMessage tm = (TextMessage)cons3.receive(1000);
-
+ TextMessage tm = (TextMessage) cons3.receive(1000);
+
assertNotNull(tm);
-
+
assertEquals("Message:" + i, tm.getText());
}
}
@@ -283,17 +228,17 @@
finally
{
ServerManagement.setAttribute(serverPeerObjectName, "DefaultDLQ", "jboss.messaging.destination:service=Queue,name=DLQ");
-
- ServerManagement.setAttribute(new ObjectName(testQueueObjectName), "DLQ", "");
-
+
+ ServerManagement.setAttribute(new ObjectName(testQueueObjectName), "DLQ", "");
+
if (conn != null)
{
conn.close();
}
}
}
-
+
public void testWithMessageListenerPersistent() throws Exception
{
testWithMessageListener(true);
@@ -313,7 +258,7 @@
{
testWithReceiveClientAck(false);
}
-
+
public void testWithReceiveTransactionalPersistent() throws Exception
{
this.testWithReceiveTransactional(true);
@@ -322,43 +267,43 @@
public void testWithReceiveTransactionalNonPersistent() throws Exception
{
testWithReceiveTransactional(false);
- }
-
+ }
+
public void testHeadersSet() throws Exception
{
Connection conn = null;
-
+
try
- {
- ObjectName serverPeerObjectName = ServerManagement.getServerPeerObjectName();
-
- ServerManagement.setAttribute(serverPeerObjectName, "DefaultDLQ", "jboss.messaging.destination:service=Queue,name=Queue2");
+ {
+ ObjectName serverPeerObjectName = ServerManagement.getServerPeerObjectName();
- final int MAX_DELIVERIES = 16;
-
- final int NUM_MESSAGES = 5;
-
- ServerManagement.setAttribute(serverPeerObjectName, "DefaultMaxDeliveryAttempts", String.valueOf(MAX_DELIVERIES));
-
- int maxRedeliveryAttempts =
- ((Integer)ServerManagement.getAttribute(serverPeerObjectName, "DefaultMaxDeliveryAttempts")).intValue();
-
- assertEquals(MAX_DELIVERIES, maxRedeliveryAttempts);
+ ServerManagement.setAttribute(serverPeerObjectName, "DefaultDLQ", "jboss.messaging.destination:service=Queue,name=Queue2");
+ final int MAX_DELIVERIES = 16;
+
+ final int NUM_MESSAGES = 5;
+
+ ServerManagement.setAttribute(serverPeerObjectName, "DefaultMaxDeliveryAttempts", String.valueOf(MAX_DELIVERIES));
+
+ int maxRedeliveryAttempts =
+ ((Integer) ServerManagement.getAttribute(serverPeerObjectName, "DefaultMaxDeliveryAttempts")).intValue();
+
+ assertEquals(MAX_DELIVERIES, maxRedeliveryAttempts);
+
conn = cf.createConnection();
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer prod = sess.createProducer(queue1);
-
- Map origIds = new HashMap();
+ Map origIds = new HashMap();
+
for (int i = 0; i < NUM_MESSAGES; i++)
{
TextMessage tm = sess.createTextMessage("Message:" + i);
prod.send(tm);
-
+
origIds.put(tm.getText(), tm.getJMSMessageID());
}
@@ -368,11 +313,11 @@
conn.start();
- for (int i = 0; i < MAX_DELIVERIES; i++)
+ for (int i = 0; i < MAX_DELIVERIES; i++)
{
for (int j = 0; j < NUM_MESSAGES; j++)
{
- TextMessage tm = (TextMessage)cons.receive(1000);
+ TextMessage tm = (TextMessage) cons.receive(1000);
assertNotNull(tm);
@@ -381,41 +326,41 @@
sess2.rollback();
}
-
+
//At this point all the messages have been delivered exactly MAX_DELIVERIES times - this is ok
//they haven't exceeded max delivery attempts so shouldn't be in the DLQ - let's check
-
+
checkEmpty(queue2);
-
+
// So let's try and consume them - this should cause them to go to the DLQ - since they
// will then exceed max delivery attempts
Message m = cons.receive(100);
-
+
assertNull(m);
-
+
//All the messages should now be in the DLQ
-
- MessageConsumer cons3 = sess.createConsumer(queue2);
-
+
+ MessageConsumer cons3 = sess.createConsumer(queue2);
+
for (int i = 0; i < NUM_MESSAGES; i++)
{
- TextMessage tm = (TextMessage)cons3.receive(1000);
-
+ TextMessage tm = (TextMessage) cons3.receive(1000);
+
assertNotNull(tm);
assertEquals("Message:" + i, tm.getText());
-
+
// Check the headers
String origDest =
- tm.getStringProperty(JBossMessage.JBOSS_MESSAGING_ORIG_DESTINATION);
-
+ tm.getStringProperty(JBossMessage.JBOSS_MESSAGING_ORIG_DESTINATION);
+
String origMessageId =
- tm.getStringProperty(JBossMessage.JBOSS_MESSAGING_ORIG_MESSAGE_ID);
-
+ tm.getStringProperty(JBossMessage.JBOSS_MESSAGING_ORIG_MESSAGE_ID);
+
assertEquals(queue1.toString(), origDest);
-
- String origId = (String)origIds.get(tm.getText());
-
+
+ String origId = (String) origIds.get(tm.getText());
+
assertEquals(origId, origMessageId);
}
}
@@ -426,88 +371,88 @@
}
public void testOverrideDefaultMaxDeliveryAttemptsForQueue() throws Exception
- {
- int md = getDefaultMaxDeliveryAttempts();
- try
- {
- int maxDeliveryAttempts = md - 5;
- setMaxDeliveryAttempts(
- new ObjectName("jboss.messaging.destination:service=Queue,name=Queue1"),
- maxDeliveryAttempts);
- testMaxDeliveryAttempts(queue1, maxDeliveryAttempts, true);
- }
- finally
- {
- setMaxDeliveryAttempts(
- new ObjectName("jboss.messaging.destination:service=Queue,name=Queue1"),
- md);
- }
+ {
+ int md = getDefaultMaxDeliveryAttempts();
+ try
+ {
+ int maxDeliveryAttempts = md - 5;
+ setMaxDeliveryAttempts(
+ new ObjectName("jboss.messaging.destination:service=Queue,name=Queue1"),
+ maxDeliveryAttempts);
+ testMaxDeliveryAttempts(queue1, maxDeliveryAttempts, true);
+ }
+ finally
+ {
+ setMaxDeliveryAttempts(
+ new ObjectName("jboss.messaging.destination:service=Queue,name=Queue1"),
+ md);
+ }
}
public void testOverrideDefaultMaxDeliveryAttemptsForTopic() throws Exception
{
- int md = getDefaultMaxDeliveryAttempts();
- try
- {
- int maxDeliveryAttempts = md - 5;
- setMaxDeliveryAttempts(
- new ObjectName("jboss.messaging.destination:service=Topic,name=Topic1"),
- maxDeliveryAttempts);
-
- testMaxDeliveryAttempts(topic1, maxDeliveryAttempts, false);
- }
- finally
- {
- setMaxDeliveryAttempts(
- new ObjectName("jboss.messaging.destination:service=Queue,name=Queue1"),
- md);
- }
+ int md = getDefaultMaxDeliveryAttempts();
+ try
+ {
+ int maxDeliveryAttempts = md - 5;
+ setMaxDeliveryAttempts(
+ new ObjectName("jboss.messaging.destination:service=Topic,name=Topic1"),
+ maxDeliveryAttempts);
+
+ testMaxDeliveryAttempts(topic1, maxDeliveryAttempts, false);
+ }
+ finally
+ {
+ setMaxDeliveryAttempts(
+ new ObjectName("jboss.messaging.destination:service=Queue,name=Queue1"),
+ md);
+ }
}
-
+
public void testUseDefaultMaxDeliveryAttemptsForQueue() throws Exception
{
- int md = getDefaultMaxDeliveryAttempts();
- try
- {
- setMaxDeliveryAttempts(
- new ObjectName("jboss.messaging.destination:service=Queue,name=Queue1"),
- -1);
-
- // Check that defaultMaxDeliveryAttempts takes effect
- testMaxDeliveryAttempts(queue1, getDefaultMaxDeliveryAttempts(), true);
- }
- finally
- {
- setMaxDeliveryAttempts(
- new ObjectName("jboss.messaging.destination:service=Queue,name=Queue1"),
- md);
- }
+ int md = getDefaultMaxDeliveryAttempts();
+ try
+ {
+ setMaxDeliveryAttempts(
+ new ObjectName("jboss.messaging.destination:service=Queue,name=Queue1"),
+ -1);
+
+ // Check that defaultMaxDeliveryAttempts takes effect
+ testMaxDeliveryAttempts(queue1, getDefaultMaxDeliveryAttempts(), true);
+ }
+ finally
+ {
+ setMaxDeliveryAttempts(
+ new ObjectName("jboss.messaging.destination:service=Queue,name=Queue1"),
+ md);
+ }
}
public void testUseDefaultMaxDeliveryAttemptsForTopic() throws Exception
{
- int md = getDefaultMaxDeliveryAttempts();
- try
- {
- setMaxDeliveryAttempts(
- new ObjectName("jboss.messaging.destination:service=Topic,name=Topic1"),
- -1);
-
- // Check that defaultMaxDeliveryAttempts takes effect
- testMaxDeliveryAttempts(topic1, getDefaultMaxDeliveryAttempts(), false);
- }
- finally
- {
- setMaxDeliveryAttempts(
- new ObjectName("jboss.messaging.destination:service=Queue,name=Queue1"),
- md);
- }
+ int md = getDefaultMaxDeliveryAttempts();
+ try
+ {
+ setMaxDeliveryAttempts(
+ new ObjectName("jboss.messaging.destination:service=Topic,name=Topic1"),
+ -1);
+
+ // Check that defaultMaxDeliveryAttempts takes effect
+ testMaxDeliveryAttempts(topic1, getDefaultMaxDeliveryAttempts(), false);
+ }
+ finally
+ {
+ setMaxDeliveryAttempts(
+ new ObjectName("jboss.messaging.destination:service=Queue,name=Queue1"),
+ md);
+ }
}
-
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
-
+
protected void testWithMessageListener(boolean persistent) throws Exception
{
Connection conn = null;
@@ -515,22 +460,22 @@
try
{
ObjectName serverPeerObjectName = ServerManagement.getServerPeerObjectName();
-
+
final int MAX_DELIVERIES = 16;
-
+
final int NUM_MESSAGES = 5;
-
+
ServerManagement.setAttribute(serverPeerObjectName, "DefaultMaxDeliveryAttempts", String.valueOf(MAX_DELIVERIES));
-
- String defaultDLQObjectName = "jboss.messaging.destination:service=Queue,name=Queue2";
-
+
+ String defaultDLQObjectName = "jboss.messaging.destination:service=Queue,name=Queue2";
+
ServerManagement.setAttribute(serverPeerObjectName, "DefaultDLQ", defaultDLQObjectName);
-
+
int maxRedeliveryAttempts =
- ((Integer)ServerManagement.getAttribute(serverPeerObjectName, "DefaultMaxDeliveryAttempts")).intValue();
-
+ ((Integer) ServerManagement.getAttribute(serverPeerObjectName, "DefaultMaxDeliveryAttempts")).intValue();
+
assertEquals(MAX_DELIVERIES, maxRedeliveryAttempts);
-
+
conn = cf.createConnection();
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -538,7 +483,7 @@
MessageProducer prod = sess.createProducer(queue1);
prod.setDeliveryMode(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
-
+
for (int i = 0; i < NUM_MESSAGES; i++)
{
TextMessage tm = sess.createTextMessage("Message:" + i);
@@ -547,9 +492,9 @@
}
MessageConsumer cons = sess.createConsumer(queue1);
-
- FailingMessageListener listener = new FailingMessageListener(MAX_DELIVERIES * NUM_MESSAGES);
+ FailingMessageListener listener = new FailingMessageListener(MAX_DELIVERIES * NUM_MESSAGES);
+
cons.setMessageListener(listener);
conn.start();
@@ -557,31 +502,31 @@
listener.waitForMessages();
assertEquals(MAX_DELIVERIES * NUM_MESSAGES, listener.deliveryCount);
-
+
//Message should all be in the dlq - let's check
MessageConsumer cons2 = sess.createConsumer(queue2);
for (int i = 0; i < NUM_MESSAGES; i++)
{
- TextMessage tm = (TextMessage)cons2.receive(1000);
+ TextMessage tm = (TextMessage) cons2.receive(1000);
assertNotNull(tm);
-
+
log.info("Got mnessage" + tm);
assertEquals("Message:" + i, tm.getText());
}
-
- checkEmpty(queue1);
+
+ checkEmpty(queue1);
}
finally
{
if (conn != null) conn.close();
}
}
-
+
protected void testWithReceiveClientAck(boolean persistent) throws Exception
{
Connection conn = null;
@@ -589,22 +534,22 @@
try
{
ObjectName serverPeerObjectName = ServerManagement.getServerPeerObjectName();
-
+
final int MAX_DELIVERIES = 16;
-
- final int NUM_MESSAGES = 5;
-
- String defaultDLQObjectName = "jboss.messaging.destination:service=Queue,name=Queue2";
-
- ServerManagement.setAttribute(serverPeerObjectName, "DefaultDLQ", defaultDLQObjectName);
-
+
+ final int NUM_MESSAGES = 5;
+
+ String defaultDLQObjectName = "jboss.messaging.destination:service=Queue,name=Queue2";
+
+ ServerManagement.setAttribute(serverPeerObjectName, "DefaultDLQ", defaultDLQObjectName);
+
ServerManagement.setAttribute(serverPeerObjectName, "DefaultMaxDeliveryAttempts", String.valueOf(MAX_DELIVERIES));
-
+
int maxRedeliveryAttempts =
- ((Integer)ServerManagement.getAttribute(serverPeerObjectName, "DefaultMaxDeliveryAttempts")).intValue();
-
+ ((Integer) ServerManagement.getAttribute(serverPeerObjectName, "DefaultMaxDeliveryAttempts")).intValue();
+
assertEquals(MAX_DELIVERIES, maxRedeliveryAttempts);
-
+
conn = cf.createConnection();
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -612,7 +557,7 @@
MessageProducer prod = sess.createProducer(queue1);
prod.setDeliveryMode(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
-
+
for (int i = 0; i < NUM_MESSAGES; i++)
{
TextMessage tm = sess.createTextMessage("Message:" + i);
@@ -626,11 +571,11 @@
conn.start();
- for (int i = 0; i < MAX_DELIVERIES; i++)
+ for (int i = 0; i < MAX_DELIVERIES; i++)
{
for (int j = 0; j < NUM_MESSAGES; j++)
{
- TextMessage tm = (TextMessage)cons.receive(1000);
+ TextMessage tm = (TextMessage) cons.receive(1000);
assertNotNull(tm);
@@ -639,46 +584,46 @@
sess2.recover();
}
-
+
//At this point all the messages have been delivered exactly MAX_DELIVERIES times - this is ok
//they haven't exceeded max delivery attempts so shouldn't be in the DLQ - let's check
-
+
checkEmpty(queue2);
-
+
//So let's try and consume them - this should cause them to go to the DLQ - since they will then exceed max
//delivery attempts
-
+
Message m = cons.receive(100);
-
+
assertNull(m);
-
+
//Now, all the messages should now be in the DLQ
-
+
MessageConsumer cons3 = sess.createConsumer(queue2);
-
+
for (int i = 0; i < NUM_MESSAGES; i++)
{
- TextMessage tm = (TextMessage)cons3.receive(1000);
-
+ TextMessage tm = (TextMessage) cons3.receive(1000);
+
assertNotNull(tm);
assertEquals("Message:" + i, tm.getText());
}
//No more should be available
-
+
cons.close();
-
+
checkEmpty(queue1);
}
finally
{
- ServerManagement.undeployQueue("DLQ");
+ undeployQueue("DLQ");
if (conn != null) conn.close();
}
}
-
+
protected void testWithReceiveTransactional(boolean persistent) throws Exception
{
Connection conn = null;
@@ -686,22 +631,22 @@
try
{
ObjectName serverPeerObjectName = ServerManagement.getServerPeerObjectName();
-
+
final int MAX_DELIVERIES = 16;
-
- final int NUM_MESSAGES = 5;
-
+
+ final int NUM_MESSAGES = 5;
+
ServerManagement.setAttribute(serverPeerObjectName, "DefaultMaxDeliveryAttempts", String.valueOf(MAX_DELIVERIES));
-
- String defaultDLQObjectName = "jboss.messaging.destination:service=Queue,name=Queue2";
-
- ServerManagement.setAttribute(serverPeerObjectName, "DefaultDLQ", defaultDLQObjectName);
-
+
+ String defaultDLQObjectName = "jboss.messaging.destination:service=Queue,name=Queue2";
+
+ ServerManagement.setAttribute(serverPeerObjectName, "DefaultDLQ", defaultDLQObjectName);
+
int maxRedeliveryAttempts =
- ((Integer)ServerManagement.getAttribute(serverPeerObjectName, "DefaultMaxDeliveryAttempts")).intValue();
-
+ ((Integer) ServerManagement.getAttribute(serverPeerObjectName, "DefaultMaxDeliveryAttempts")).intValue();
+
assertEquals(MAX_DELIVERIES, maxRedeliveryAttempts);
-
+
conn = cf.createConnection();
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -709,7 +654,7 @@
MessageProducer prod = sess.createProducer(queue1);
prod.setDeliveryMode(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
-
+
for (int i = 0; i < NUM_MESSAGES; i++)
{
TextMessage tm = sess.createTextMessage("Message:" + i);
@@ -723,11 +668,11 @@
conn.start();
- for (int i = 0; i < MAX_DELIVERIES; i++)
+ for (int i = 0; i < MAX_DELIVERIES; i++)
{
for (int j = 0; j < NUM_MESSAGES; j++)
{
- TextMessage tm = (TextMessage)cons.receive(1000);
+ TextMessage tm = (TextMessage) cons.receive(1000);
assertNotNull(tm);
@@ -736,86 +681,86 @@
sess2.rollback();
}
-
+
//At this point all the messages have been delivered exactly MAX_DELIVERIES times - this is ok
//they haven't exceeded max delivery attempts so shouldn't be in the DLQ - let's check
-
+
checkEmpty(queue2);
-
+
//So let's try and consume them - this should cause them to go to the DLQ - since they will then exceed max
//delivery attempts
Message m = cons.receive(100);
-
+
assertNull(m);
-
+
//All the messages should now be in the DLQ
-
- MessageConsumer cons3 = sess.createConsumer(queue2);
-
+
+ MessageConsumer cons3 = sess.createConsumer(queue2);
+
for (int i = 0; i < NUM_MESSAGES; i++)
{
- TextMessage tm = (TextMessage)cons3.receive(1000);
-
+ TextMessage tm = (TextMessage) cons3.receive(1000);
+
assertNotNull(tm);
assertEquals("Message:" + i, tm.getText());
}
//No more should be available
-
+
checkEmpty(queue1);
}
finally
{
- ServerManagement.undeployQueue("DLQ");
+ undeployQueue("DLQ");
if (conn != null) conn.close();
}
}
-
+
protected int getDefaultMaxDeliveryAttempts() throws Exception
{
return ((Integer) ServerManagement.getAttribute(
- ServerManagement.getServerPeerObjectName(),
- "DefaultMaxDeliveryAttempts"))
- .intValue();
+ ServerManagement.getServerPeerObjectName(),
+ "DefaultMaxDeliveryAttempts"))
+ .intValue();
}
protected void setMaxDeliveryAttempts(ObjectName dest, int maxDeliveryAttempts) throws Exception
{
ServerManagement.setAttribute(dest, "MaxDeliveryAttempts",
- Integer.toString(maxDeliveryAttempts));
+ Integer.toString(maxDeliveryAttempts));
}
-
+
protected void testMaxDeliveryAttempts(Destination destination, int destMaxDeliveryAttempts, boolean queue) throws Exception
{
Connection conn = cf.createConnection();
-
+
if (!queue)
{
- conn.setClientID("wib123");
+ conn.setClientID("wib123");
}
-
+
try
{
- ServerManagement.setAttribute(ServerManagement.getServerPeerObjectName(),
- "DefaultDLQ", "jboss.messaging.destination:service=Queue,name=Queue2");
-
+ ServerManagement.setAttribute(ServerManagement.getServerPeerObjectName(),
+ "DefaultDLQ", "jboss.messaging.destination:service=Queue,name=Queue2");
+
// Create the consumer before the producer so that the message we send doesn't
// get lost if the destination is a Topic.
- Session consumingSession = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+ Session consumingSession = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
MessageConsumer destinationConsumer;
-
+
if (queue)
{
destinationConsumer = consumingSession.createConsumer(destination);
}
else
{
- //For topics we only keep a delivery record on the server side for durable subs
- destinationConsumer = consumingSession.createDurableSubscriber((Topic)destination, "testsub1");
+ //For topics we only keep a delivery record on the server side for durable subs
+ destinationConsumer = consumingSession.createDurableSubscriber((Topic) destination, "testsub1");
}
-
+
{
Session producingSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer prod = producingSession.createProducer(destination);
@@ -827,8 +772,8 @@
// Make delivery attempts up to the maximum. The message should not end up in the DLQ.
for (int i = 0; i < destMaxDeliveryAttempts; i++)
- {
- TextMessage tm = (TextMessage)destinationConsumer.receive(1000);
+ {
+ TextMessage tm = (TextMessage) destinationConsumer.receive(1000);
assertNotNull("No message received on delivery attempt number " + (i + 1), tm);
assertEquals("Message", tm.getText());
consumingSession.recover();
@@ -836,26 +781,26 @@
// At this point the message should not yet be in the DLQ
checkEmpty(queue2);
-
+
// Now we try to consume the message again from the destination, which causes it
// to go to the DLQ instead.
Message m = destinationConsumer.receive(100);
assertNull(m);
-
+
// The message should be in the DLQ now
MessageConsumer dlqConsumer = consumingSession.createConsumer(queue2);
m = dlqConsumer.receive(1000);
assertNotNull(m);
assertTrue(m instanceof TextMessage);
assertEquals("Message", ((TextMessage) m).getText());
-
+
m.acknowledge();
-
+
if (!queue)
{
- destinationConsumer.close();
-
- consumingSession.unsubscribe("testsub1");
+ destinationConsumer.close();
+
+ consumingSession.unsubscribe("testsub1");
}
}
finally
@@ -870,35 +815,35 @@
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
-
+
class FailingMessageListener implements MessageListener
{
volatile int deliveryCount;
-
+
int numMessages;
-
+
FailingMessageListener(int numMessages)
{
- this.numMessages = numMessages;
+ this.numMessages = numMessages;
}
-
+
synchronized void waitForMessages() throws Exception
{
- while (deliveryCount != numMessages)
+ while (deliveryCount != numMessages)
{
- this.wait();
+ this.wait();
}
}
-
+
public synchronized void onMessage(Message msg)
{
deliveryCount++;
-
+
this.notify();
-
+
throw new RuntimeException("Your mum!");
}
-
+
}
}
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/DurableSubscriptionTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/DurableSubscriptionTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/DurableSubscriptionTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,28 +21,14 @@
*/
package org.jboss.test.messaging.jms;
-import java.util.List;
+import org.jboss.jms.server.destination.SubscriptionInfo;
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
+import javax.jms.*;
import javax.jms.IllegalStateException;
-import javax.jms.InvalidDestinationException;
-import javax.jms.InvalidSelectorException;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.jms.TopicSubscriber;
-import javax.management.ObjectName;
import javax.naming.NamingException;
+import java.util.List;
-import org.jboss.jms.server.destination.SubscriptionInfo;
-import org.jboss.test.messaging.tools.ServerManagement;
-
/**
* Tests focused on durable subscription behavior. More durable subscription tests can be found in
* MessageConsumerTest.
@@ -84,10 +70,8 @@
prod.setDeliveryMode(DeliveryMode.PERSISTENT);
s.createDurableSubscriber(topic1, "monicabelucci");
-
- ObjectName destObjectName =
- new ObjectName("jboss.messaging.destination:service=Topic,name=Topic1");
- List subs = (List)ServerManagement.invoke(destObjectName, "listAllSubscriptions", null, null);
+
+ List subs = getJmsServerStatistics().listAllSubscriptionsForTopic("Topic1");
assertNotNull(subs);
@@ -101,7 +85,7 @@
conn.close();
- subs = (List)ServerManagement.invoke(destObjectName, "listAllSubscriptions", null, null);
+ subs = getJmsServerStatistics().listAllSubscriptionsForTopic("Topic1");
assertEquals(1, subs.size());
@@ -324,7 +308,7 @@
// OK
}
- ServerManagement.deployTopic("TopicToBeRedeployed");
+ deployTopic("TopicToBeRedeployed");
Topic topic = (Topic)ic.lookup("/topic/TopicToBeRedeployed");
@@ -349,7 +333,7 @@
assertEquals("one", tm.getText());
conn.close();
- ServerManagement.undeployTopic("TopicToBeRedeployed");
+ undeployTopic("TopicToBeRedeployed");
log.debug("topic undeployed");
try
@@ -377,7 +361,7 @@
// OK
}
- ServerManagement.deployTopic("TopicToBeRedeployed");
+ deployTopic("TopicToBeRedeployed");
log.debug("topic redeployed");
// since redeployment has an activation semantic, I expect to find the messages there
@@ -399,7 +383,7 @@
{
conn.close();
}
- ServerManagement.undeployTopic("TopicToBeRedeployed");
+ undeployTopic("TopicToBeRedeployed");
}
}
@@ -559,8 +543,8 @@
TopicSubscriber subscriber = s.createDurableSubscriber(topic1, ".subscription.name.with.periods.");
- ServerManagement.undeployTopic("Topic1");
- ServerManagement.deployTopic("Topic1");
+ undeployTopic("Topic1");
+ deployTopic("Topic1");
topic1 = (Topic)ic.lookup("/topic/Topic1");
s.createProducer(topic1).send(s.createTextMessage("Subscription test"));
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ExpiryQueueTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ExpiryQueueTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ExpiryQueueTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,35 +21,22 @@
*/
package org.jboss.test.messaging.jms;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.DeliveryMode;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.management.ObjectName;
-import javax.naming.NameNotFoundException;
-
import org.jboss.jms.destination.JBossQueue;
import org.jboss.jms.message.JBossMessage;
import org.jboss.test.messaging.tools.ServerManagement;
+import javax.jms.*;
+import javax.management.ObjectName;
+import java.util.HashMap;
+import java.util.Map;
+
/**
- *
* A ExpiryQueueTest
*
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @version <tt>$Revision$</tt>
- *
- * $Id$
- *
+ * <p/>
+ * $Id$
*/
public class ExpiryQueueTest extends JMSTestCase
{
@@ -74,259 +61,230 @@
{
return;
}
-
- try
- {
- ServerManagement.deployQueue("ExpiryQueue");
-
- ObjectName serverPeerObjectName = ServerManagement.getServerPeerObjectName();
-
- ObjectName expiryQueueObjectName = (ObjectName)ServerManagement.getAttribute(serverPeerObjectName, "DefaultExpiryQueue");
-
- assertNotNull(expiryQueueObjectName);
-
- String name = (String)ServerManagement.getAttribute(expiryQueueObjectName, "Name");
-
- assertNotNull(name);
-
- assertEquals("ExpiryQueue", name);
-
- String jndiName = (String)ServerManagement.getAttribute(expiryQueueObjectName, "JNDIName");
-
- assertNotNull(jndiName);
-
- assertEquals("/queue/ExpiryQueue", jndiName);
-
- org.jboss.messaging.core.contract.Queue expiryQueue = ServerManagement.getServer().getServerPeer().getDefaultExpiryQueueInstance();
-
- assertNotNull(expiryQueue);
-
- JBossQueue q = (JBossQueue)ic.lookup("/queue/ExpiryQueue");
- assertNotNull(q);
+ //deployQueue("ExpiryQueue");
- assertEquals("ExpiryQueue", q.getName());
- }
- finally
- {
- ServerManagement.undeployQueue("ExpiryQueue");
- }
- }
+ /*ObjectName serverPeerObjectName = ServerManagement.getServerPeerObjectName();
- public void testExpiryQueueNotAlreadyDeployed() throws Exception
- {
- if (ServerManagement.isRemote())
- {
- return;
- }
-
+ ObjectName expiryQueueObjectName = (ObjectName)ServerManagement.getAttribute(serverPeerObjectName, "DefaultExpiryQueue");
+
+ assertNotNull(expiryQueueObjectName);
+
+ String name = (String)ServerManagement.getAttribute(expiryQueueObjectName, "Name");
+
+ assertNotNull(name);
+
+ assertEquals("ExpiryQueue", name);
+
+ String jndiName = (String)ServerManagement.getAttribute(expiryQueueObjectName, "JNDIName");
+
+ assertNotNull(jndiName);
+
+ assertEquals("/queue/ExpiryQueue", jndiName);
+
org.jboss.messaging.core.contract.Queue expiryQueue = ServerManagement.getServer().getServerPeer().getDefaultExpiryQueueInstance();
- assertNull(expiryQueue);
+ assertNotNull(expiryQueue);*/
- try
- {
- ic.lookup("/queue/ExpiryQueue");
+ JBossQueue q = (JBossQueue) ic.lookup("/queue/ExpiryQueue");
- fail();
- }
- catch (NameNotFoundException e)
- {
- //Ok
- }
+ assertNotNull(q);
+
+ assertEquals("ExpiryQueue", q.getName());
+
}
-
+
+
public void testDefaultAndOverrideExpiryQueue() throws Exception
{
final int NUM_MESSAGES = 5;
-
+
Connection conn = null;
-
- ObjectName serverPeerObjectName = ServerManagement.getServerPeerObjectName();
-
+
+ //ObjectName serverPeerObjectName = ServerManagement.getServerPeerObjectName();
+
try
- {
- ServerManagement.deployQueue("DefaultExpiry");
-
- ServerManagement.deployQueue("OverrideExpiry");
-
- ServerManagement.deployQueue("TestQueue");
-
- String defaultExpiryObjectName = "jboss.messaging.destination:service=Queue,name=DefaultExpiry";
-
- String overrideExpiryObjectName = "jboss.messaging.destination:service=Queue,name=OverrideExpiry";
-
- String testQueueObjectName = "jboss.messaging.destination:service=Queue,name=TestQueue";
-
- ServerManagement.setAttribute(serverPeerObjectName, "DefaultExpiryQueue", defaultExpiryObjectName);
-
- ServerManagement.setAttribute(new ObjectName(testQueueObjectName), "ExpiryQueue", "");
-
- Queue testQueue = (Queue)ic.lookup("/queue/TestQueue");
-
- Queue defaultExpiry = (Queue)ic.lookup("/queue/DefaultExpiry");
-
- Queue overrideExpiry = (Queue)ic.lookup("/queue/OverrideExpiry");
-
+ {
+ deployQueue("DefaultExpiry");
+
+ deployQueue("OverrideExpiry");
+
+ deployQueue("expTestQueue");
+
+ String defaultExpiryObjectName = "DefaultExpiry";
+
+ String overrideExpiryObjectName = "OverrideExpiry";
+
+ String testQueueObjectName = "expTestQueue";
+
+ //ServerManagement.setAttribute(serverPeerObjectName, "DefaultExpiryQueue", defaultExpiryObjectName);
+
+ //ServerManagement.setAttribute(new ObjectName(testQueueObjectName), "ExpiryQueue", "");
+
+ Queue testQueue = (Queue) ic.lookup("/queue/expTestQueue");
+
+ Queue defaultExpiry = (Queue) ic.lookup("/queue/DefaultExpiry");
+
+ Queue overrideExpiry = (Queue) ic.lookup("/queue/OverrideExpiry");
+
conn = cf.createConnection();
-
- {
+
+ {
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
+
MessageProducer prod = sess.createProducer(testQueue);
-
+
conn.start();
-
+
for (int i = 0; i < NUM_MESSAGES; i++)
{
TextMessage tm = sess.createTextMessage("Message:" + i);
-
+
//Send messages with time to live of 2000 enough time to get to client consumer - so
//they won't be expired on the server side
prod.send(tm, DeliveryMode.PERSISTENT, 4, 2000);
}
-
+
Session sess2 = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
-
+
MessageConsumer cons = sess2.createConsumer(testQueue);
-
+
//The messages should now be sitting in the consumer buffer
-
+
//Now give them enough time to expire
-
+
Thread.sleep(2500);
-
+
//Now try and receive
-
+
Message m = cons.receive(1000);
assertNull(m);
//Message should all be in the default expiry queue - let's check
-
+
MessageConsumer cons3 = sess.createConsumer(defaultExpiry);
-
+
for (int i = 0; i < NUM_MESSAGES; i++)
{
- TextMessage tm = (TextMessage)cons3.receive(1000);
-
+ TextMessage tm = (TextMessage) cons3.receive(1000);
+
assertNotNull(tm);
-
+
assertEquals("Message:" + i, tm.getText());
}
-
+
conn.close();
}
-
-
+
//now try with overriding the default expiry queue
- {
+ {
ServerManagement.setAttribute(new ObjectName(testQueueObjectName), "ExpiryQueue", overrideExpiryObjectName);
-
+
conn = cf.createConnection();
-
+
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
+
MessageProducer prod = sess.createProducer(testQueue);
-
+
conn.start();
-
+
for (int i = 0; i < NUM_MESSAGES; i++)
{
TextMessage tm = sess.createTextMessage("Message:" + i);
-
+
//Send messages with time to live of 2000 enough time to get to client consumer - so
//they won't be expired on the server side
prod.send(tm, DeliveryMode.PERSISTENT, 4, 2000);
}
-
+
Session sess2 = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
-
+
MessageConsumer cons = sess2.createConsumer(testQueue);
-
+
//The messages should now be sitting in the consumer buffer
-
+
//Now give them enough time to expire
-
+
Thread.sleep(2500);
-
+
//Now try and receive
-
+
Message m = cons.receive(1000);
assertNull(m);
//Message should all be in the override expiry queue - let's check
-
+
MessageConsumer cons3 = sess.createConsumer(overrideExpiry);
-
+
for (int i = 0; i < NUM_MESSAGES; i++)
{
- TextMessage tm = (TextMessage)cons3.receive(1000);
-
+ TextMessage tm = (TextMessage) cons3.receive(1000);
+
assertNotNull(tm);
-
+
assertEquals("Message:" + i, tm.getText());
}
}
}
finally
- {
- ServerManagement.setAttribute(serverPeerObjectName, "DefaultExpiryQueue", "jboss.messaging.destination:service=Queue,name=ExpiryQueue");
-
- ServerManagement.undeployQueue("DefaultDLQ");
-
- ServerManagement.undeployQueue("OverrideDLQ");
-
- ServerManagement.undeployQueue("TestQueue");
-
+ { //
+ //ServerManagement.setAttribute(serverPeerObjectName, "DefaultExpiryQueue", "jboss.messaging.destination:service=Queue,name=ExpiryQueue");
+
+ undeployQueue("DefaultDLQ");
+
+ undeployQueue("OverrideDLQ");
+
+ undeployQueue("TestQueue");
+
if (conn != null)
{
conn.close();
}
}
}
-
+
public void testExpireSameMessagesMultiple() throws Exception
{
final int NUM_MESSAGES = 5;
-
+
Connection conn = null;
-
+
try
- {
- ServerManagement.deployQueue("ExpiryQueue");
-
+ {
+ deployQueue("ExpiryQueue");
+
String defaultExpiryObjectName = "jboss.messaging.destination:service=Queue,name=ExpiryQueue";
-
+
ObjectName serverPeerObjectName = ServerManagement.getServerPeerObjectName();
-
+
ServerManagement.setAttribute(serverPeerObjectName, "DefaultExpiryQueue", defaultExpiryObjectName);
-
- Queue defaultExpiry = (Queue)ic.lookup("/queue/ExpiryQueue");
-
+
+ Queue defaultExpiry = (Queue) ic.lookup("/queue/ExpiryQueue");
+
conn = cf.createConnection();
-
+
conn.setClientID("wib1");
-
+
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
+
MessageProducer prod = sess.createProducer(topic1);
-
+
conn.start();
-
+
//Create 3 durable subscriptions
-
+
MessageConsumer sub1 = sess.createDurableSubscriber(topic1, "sub1");
-
+
MessageConsumer sub2 = sess.createDurableSubscriber(topic1, "sub2");
-
+
MessageConsumer sub3 = sess.createDurableSubscriber(topic1, "sub3");
-
+
Map origIds = new HashMap();
-
+
long now = System.currentTimeMillis();
-
+
for (int i = 0; i < NUM_MESSAGES; i++)
{
TextMessage tm = sess.createTextMessage("Message:" + i);
@@ -334,79 +292,78 @@
//Send messages with time to live of 3000 enough time to get to client consumer - so
//they won't be expired on the server side
prod.send(tm, DeliveryMode.PERSISTENT, 4, 3000);
-
+
origIds.put(tm.getText(), tm.getJMSMessageID());
}
-
+
long approxExpiry = now + 3000;
-
-
+
//Now sleep. This wil give them enough time to expire
-
+
Thread.sleep(3500);
-
+
//Now try and consume from each - this should force the message to the expiry queue
-
+
Message m = sub1.receive(500);
assertNull(m);
-
+
m = sub2.receive(500);
assertNull(m);
-
+
m = sub3.receive(500);
assertNull(m);
-
+
//Now the messages should all be in the expiry queue
-
+
MessageConsumer cons2 = sess.createConsumer(defaultExpiry);
-
+
while (true)
{
- TextMessage tm = (TextMessage)cons2.receive(500);
-
+ TextMessage tm = (TextMessage) cons2.receive(500);
+
if (tm == null)
{
break;
}
-
+
// Check the headers
String origDest =
- tm.getStringProperty(JBossMessage.JBOSS_MESSAGING_ORIG_DESTINATION);
-
+ tm.getStringProperty(JBossMessage.JBOSS_MESSAGING_ORIG_DESTINATION);
+
String origMessageId =
- tm.getStringProperty(JBossMessage.JBOSS_MESSAGING_ORIG_MESSAGE_ID);
-
+ tm.getStringProperty(JBossMessage.JBOSS_MESSAGING_ORIG_MESSAGE_ID);
+
long actualExpiryTime =
- tm.getLongProperty(JBossMessage.JBOSS_MESSAGING_ACTUAL_EXPIRY_TIME);
-
+ tm.getLongProperty(JBossMessage.JBOSS_MESSAGING_ACTUAL_EXPIRY_TIME);
+
assertEquals(topic1.toString(), origDest);
-
- String origId = (String)origIds.get(tm.getText());
-
+
+ String origId = (String) origIds.get(tm.getText());
+
assertEquals(origId, origMessageId);
-
+
assertTrue(actualExpiryTime >= approxExpiry);
}
-
+
cons2.close();
-
+
sub1.close();
-
+
sub2.close();
-
+
sub3.close();
-
+
sess.unsubscribe("sub1");
-
+
sess.unsubscribe("sub2");
-
+
sess.unsubscribe("sub3");
-
+
}
finally
- {
- ServerManagement.undeployQueue("ExpiryQueue");
-
+ {
+ undeployQueue("ExpiryQueue");
+
if (conn != null)
{
conn.close();
@@ -432,103 +389,93 @@
public void testWithReceiveNonPersistent() throws Exception
{
testWithReceive(false);
- }
+ }
public void testWithMessageListener(boolean persistent) throws Exception
- {
+ {
Connection conn = null;
-
- try
+
+
+ Queue expiryQueue = (Queue) ic.lookup("/queue/ExpiryQueue");
+
+ final int NUM_MESSAGES = 5;
+
+ conn = cf.createConnection();
+
+ conn.start();
+
+ Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageProducer prod = sess.createProducer(queue1);
+
+ int deliveryMode = persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT;
+
+ for (int i = 0; i < NUM_MESSAGES; i++)
{
- ServerManagement.deployQueue("ExpiryQueue");
-
- Queue expiryQueue = (Queue)ic.lookup("/queue/ExpiryQueue");
-
- final int NUM_MESSAGES = 5;
+ TextMessage tm = sess.createTextMessage("Message:" + i);
- conn = cf.createConnection();
-
- conn.start();
+ //Send messages with time to live of 2000 enough time to get to client consumer - so
+ //they won't be expired on the server side
+ prod.send(tm, deliveryMode, 4, 2000);
+ }
- Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer cons = sess.createConsumer(queue1);
- MessageProducer prod = sess.createProducer(queue1);
+ //The messages should now be sitting in the consumer buffer
- int deliveryMode = persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT;
-
- for (int i = 0; i < NUM_MESSAGES; i++)
- {
- TextMessage tm = sess.createTextMessage("Message:" + i);
-
- //Send messages with time to live of 2000 enough time to get to client consumer - so
- //they won't be expired on the server side
- prod.send(tm, deliveryMode, 4, 2000);
- }
+ //Now give them enough time to expire
- MessageConsumer cons = sess.createConsumer(queue1);
-
- //The messages should now be sitting in the consumer buffer
-
- //Now give them enough time to expire
-
- Thread.sleep(2500);
-
- //Now set a listener
-
- FailingMessageListener listener = new FailingMessageListener();
+ Thread.sleep(2500);
- cons.setMessageListener(listener);
-
- Thread.sleep(1000);
+ //Now set a listener
- cons.setMessageListener(null);
-
- //No messages should have been received
- assertEquals(0, listener.deliveryCount);
-
- //Shouldn't be able to receive any more
-
- Message m = cons.receive(1000);
+ FailingMessageListener listener = new FailingMessageListener();
- assertNull(m);
+ cons.setMessageListener(listener);
- //Message should all be in the expiry queue - let's check
-
- MessageConsumer cons2 = sess.createConsumer(expiryQueue);
-
- for (int i = 0; i < NUM_MESSAGES; i++)
- {
- TextMessage tm = (TextMessage)cons2.receive(1000);
-
- assertNotNull(tm);
+ Thread.sleep(1000);
- assertEquals("Message:" + i, tm.getText());
- }
+ cons.setMessageListener(null);
- }
- finally
+ //No messages should have been received
+ assertEquals(0, listener.deliveryCount);
+
+ //Shouldn't be able to receive any more
+
+ Message m = cons.receive(1000);
+
+ assertNull(m);
+
+ //Message should all be in the expiry queue - let's check
+
+ MessageConsumer cons2 = sess.createConsumer(expiryQueue);
+
+ for (int i = 0; i < NUM_MESSAGES; i++)
{
- ServerManagement.undeployQueue("ExpiryQueue");
+ TextMessage tm = (TextMessage) cons2.receive(1000);
- if (conn != null) conn.close();
+ assertNotNull(tm);
+
+ assertEquals("Message:" + i, tm.getText());
}
+
}
-
+
public void testWithReceive(boolean persistent) throws Exception
{
Connection conn = null;
-
+
try
{
- ServerManagement.deployQueue("ExpiryQueue");
-
- Queue expiryQueue = (Queue)ic.lookup("/queue/ExpiryQueue");
-
+ deployQueue("ExpiryQueue");
+
+ Queue expiryQueue = (Queue) ic.lookup("/queue/ExpiryQueue");
+
final int NUM_MESSAGES = 5;
conn = cf.createConnection();
-
+
conn.start();
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -536,38 +483,38 @@
MessageProducer prod = sess.createProducer(queue1);
int deliveryMode = persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT;
-
+
for (int i = 0; i < NUM_MESSAGES; i++)
{
TextMessage tm = sess.createTextMessage("Message:" + i);
-
+
//Send messages with time to live of 2000 enough time to get to client consumer - so
//they won't be expired on the server side
prod.send(tm, deliveryMode, 4, 2000);
}
MessageConsumer cons = sess.createConsumer(queue1);
-
+
//The messages should now be sitting in the consumer buffer
-
+
//Now give them enough time to expire
-
+
Thread.sleep(2500);
-
+
//Now try and receive
-
+
Message m = cons.receive(1000);
assertNull(m);
//Message should all be in the expiry queue - let's check
-
+
MessageConsumer cons2 = sess.createConsumer(expiryQueue);
-
+
for (int i = 0; i < NUM_MESSAGES; i++)
{
- TextMessage tm = (TextMessage)cons2.receive(1000);
-
+ TextMessage tm = (TextMessage) cons2.receive(1000);
+
assertNotNull(tm);
assertEquals("Message:" + i, tm.getText());
@@ -576,15 +523,15 @@
}
finally
{
- ServerManagement.undeployQueue("ExpiryQueue");
+ undeployQueue("ExpiryQueue");
if (conn != null) conn.close();
}
}
-
+
public void testExpirationTransfer() throws Exception
{
- ServerManagement.deployQueue("ExpiryQueue");
+ deployQueue("ExpiryQueue");
Object originalValue = ServerManagement.getAttribute(ServerManagement.getServerPeerObjectName(), "DefaultExpiryQueue");
@@ -594,8 +541,8 @@
try
{
- ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
-
+ ConnectionFactory cf = (ConnectionFactory) ic.lookup("/ConnectionFactory");
+
conn = cf.createConnection();
Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -615,9 +562,9 @@
MessageConsumer cons = session.createConsumer(queue1);
assertNull(cons.receive(3000));
-
- Queue queueExpiryQueue = (Queue)ic.lookup("/queue/ExpiryQueue");
+ Queue queueExpiryQueue = (Queue) ic.lookup("/queue/ExpiryQueue");
+
MessageConsumer consumerExpiredQueue = session.createConsumer(queueExpiryQueue);
TextMessage txt = (TextMessage) consumerExpiredQueue.receive(1000);
@@ -632,14 +579,13 @@
{
conn.close();
}
-
- ServerManagement.destroyQueue("ExpiryQueue");
-
+
+ destroyQueue("ExpiryQueue");
+
ServerManagement.setAttribute(ServerManagement.getServerPeerObjectName(), "DefaultExpiryQueue", originalValue.toString());
}
}
-
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
@@ -647,7 +593,7 @@
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
-
+
class FailingMessageListener implements MessageListener
{
volatile int deliveryCount;
@@ -655,10 +601,10 @@
public void onMessage(Message msg)
{
deliveryCount++;
-
+
throw new RuntimeException("Your mum!");
}
-
+
}
}
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/GracefulClient.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/GracefulClient.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/GracefulClient.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,16 +21,10 @@
*/
package org.jboss.test.messaging.jms;
+import javax.jms.*;
import java.io.FileInputStream;
import java.io.ObjectInputStream;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-
/**
* Code to be run in an external VM, via main().
*
@@ -92,7 +86,7 @@
// }
// }
// }
-// }, "Spinner").start();
+// }, "Spinner").startServerPeer();
}
// Attributes -----------------------------------------------------------------------------------
Deleted: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/HTTPTransportTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/HTTPTransportTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/HTTPTransportTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -1,97 +0,0 @@
-/**
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.test.messaging.jms;
-
-import javax.jms.Connection;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
-import org.jboss.test.messaging.tools.ServerManagement;
-
-/**
- * This class contain tests that only make sense for a HTTP transport. They will be ignored for
- * any other kind of transport.
- *
- * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt>
- * $Id$
- */
-public class HTTPTransportTest extends JMSTestCase
-{
- // Constants ------------------------------------------------------------------------------------
-
- // Static ---------------------------------------------------------------------------------------
-
- // Attributes -----------------------------------------------------------------------------------
-
- // Constructors ---------------------------------------------------------------------------------
-
- public HTTPTransportTest(String name)
- {
- super(name);
- }
-
- // Public ---------------------------------------------------------------------------------------
-
- public void testCallbackList() throws Exception
- {
- if (!"http".equals(ServerManagement.getRemotingTransport(0)))
- {
- log.warn("The server we are connecting to did not start its remoting service " +
- "with HTTP transport enabled, skipping test ...");
- return;
- }
-
- // send a bunch of messages and let them accumulate in the queue
- Connection conn = cf.createConnection();
- Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageProducer prod = session.createProducer(queue1);
-
- int messageCount = 20;
-
- for(int i = 0; i < messageCount; i++)
- {
- Message m = session.createTextMessage("krakatau" + i);
- prod.send(m);
- }
-
- conn.close();
-
- // make sure messages made it to the queue
- assertRemainingMessages(messageCount);
-
- conn = cf.createConnection();
- session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageConsumer cons = session.createConsumer(queue1);
-
- conn.start();
-
- // messages will be sent in bulk from server side, on the next HTTP client listener poll
-
- for(int i = 0; i < messageCount; i++)
- {
- TextMessage t = (TextMessage)cons.receive(2000);
- assertNotNull(t);
- assertEquals("krakatau" + i, t.getText());
- }
-
- conn.close();
-
- }
-
- // Package protected ----------------------------------------------------------------------------
-
- // Protected ------------------------------------------------------------------------------------
-
- // Private --------------------------------------------------------------------------------------
-
- // Inner classes --------------------------------------------------------------------------------
-}
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/JMSTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/JMSTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/JMSTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,18 +21,11 @@
*/
package org.jboss.test.messaging.jms;
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.naming.InitialContext;
-
import EDU.oswego.cs.dl.util.concurrent.Slot;
+import javax.jms.*;
+import javax.naming.InitialContext;
+
/**
* The most comprehensive, yet simple, unit test.
*
@@ -93,7 +86,7 @@
conn.start();
- TextMessage rm = (TextMessage)cons.receive();
+ TextMessage rm = (TextMessage)cons.receive(2000);
assertEquals("message one", rm.getText());
}
@@ -135,7 +128,7 @@
conn.start();
- TextMessage rm = (TextMessage)cons.receive();
+ TextMessage rm = (TextMessage)cons.receive(2000);
assertEquals("message one", rm.getText());
}
@@ -175,7 +168,7 @@
conn.start();
- TextMessage rm = (TextMessage)cons.receive();
+ TextMessage rm = (TextMessage)cons.receive(2000);
assertEquals("message one", rm.getText());
}
@@ -218,9 +211,9 @@
conn.start();
- TextMessage rm = (TextMessage)cons.receive();
+ TextMessage rm = (TextMessage)cons.receive(2000);
assertEquals("message one", rm.getText());
- rm = (TextMessage)cons.receive();
+ rm = (TextMessage)cons.receive(2000);
assertEquals("message two", rm.getText());
}
finally
@@ -262,9 +255,9 @@
conn.start();
- TextMessage rm = (TextMessage)cons.receive();
+ TextMessage rm = (TextMessage)cons.receive(2000);
assertEquals("message one", rm.getText());
- rm = (TextMessage)cons.receive();
+ rm = (TextMessage)cons.receive(2000);
assertEquals("message two", rm.getText());
}
finally
@@ -302,7 +295,7 @@
conn.start();
- TextMessage rm = (TextMessage)cons.receive();
+ TextMessage rm = (TextMessage)cons.receive(2000);
assertEquals("one", rm.getText());
session.commit();
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/MemLeakTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/MemLeakTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/MemLeakTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,38 +21,22 @@
*/
package org.jboss.test.messaging.jms;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Map;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.DeliveryMode;
-import javax.jms.JMSException;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.management.MBeanServer;
-import javax.naming.InitialContext;
-
import org.jboss.jms.client.JBossConnectionFactory;
import org.jboss.logging.Logger;
import org.jboss.profiler.jvmti.InventoryDataPoint;
import org.jboss.profiler.jvmti.JVMTIInterface;
-import org.jboss.remoting.Client;
-import org.jboss.remoting.ConnectionListener;
-import org.jboss.remoting.InvocationRequest;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.ServerInvocationHandler;
-import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.*;
import org.jboss.remoting.callback.InvokerCallbackHandler;
import org.jboss.remoting.transport.Connector;
-import org.jboss.test.messaging.MessagingTestCase;
-import org.jboss.test.messaging.tools.ServerManagement;
+import org.jboss.test.messaging.JBMServerTestCase;
+import javax.jms.*;
+import javax.management.MBeanServer;
+import javax.naming.InitialContext;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Map;
+
/**
*
* These tests should be run manually with a profiler running.
@@ -64,7 +48,7 @@
*
* $Id$
*/
-public class MemLeakTest extends MessagingTestCase
+public class MemLeakTest extends JBMServerTestCase
{
// Constants -----------------------------------------------------
@@ -100,24 +84,24 @@
// TestCase overrides -------------------------------------------
- public void setUp() throws Exception
+ /*public void setUp() throws Exception
{
super.setUp();
log.info("Setting up");
log.info("starting sc");
- ServerManagement.start("all");
+ ServerManagement.startServerPeer("all");
log.info("started serviceconatiner");
log.debug("setup done");
- }
+ }*/
- public void tearDown() throws Exception {
+ /*public void tearDown() throws Exception {
super.tearDown();
- ServerManagement.stop();
+ ServerManagement.stopServerPeer();
- }
+ }*/
/** @todo I can't execute this test if executed with testExpressionParginMessages. That's why I renamed it. */
public void renamedtestNonTxSendReceiveNP() throws Exception
@@ -125,10 +109,10 @@
log.info("testNonTxSendReceiveNP");
//Thread.sleep(10000);
- InitialContext initialContext = new InitialContext(ServerManagement.getJNDIEnvironment());
+ InitialContext initialContext = getInitialContext();
ConnectionFactory cf = (JBossConnectionFactory)initialContext.lookup("/ConnectionFactory");
- ServerManagement.deployQueue("Queue", 10000, 1000, 1000);
+ deployQueue("Queue", 10000, 1000, 1000);
Queue queue = (Queue)initialContext.lookup("/queue/Queue");
@@ -204,10 +188,10 @@
log.info("testExpressionParsingMessages");
//Thread.sleep(10000);
- InitialContext initialContext = new InitialContext(ServerManagement.getJNDIEnvironment());
+ InitialContext initialContext = getInitialContext();
ConnectionFactory cf = (JBossConnectionFactory)initialContext.lookup("/ConnectionFactory");
- ServerManagement.deployQueue("Queue", 10000, 1000, 1000);
+ deployQueue("Queue", 10000, 1000, 1000);
Queue queue = (Queue)initialContext.lookup("/queue/Queue");
@@ -337,7 +321,7 @@
//
// log.info("Sent " + i);
//
-// conn.start();
+// conn.startServerPeer();
//
// MessageConsumer cons = sess.createConsumer(queue);
//
@@ -394,7 +378,7 @@
//
// }
//
-// conn.start();
+// conn.startServerPeer();
//
// MessageConsumer cons = sess.createConsumer(queue);
//
@@ -479,7 +463,7 @@
//
// sess.commit();
//
-// conn.start();
+// conn.startServerPeer();
//
// MessageConsumer cons = sess.createConsumer(queue);
//
@@ -576,7 +560,7 @@
//
// sess.commit();
//
-// conn.start();
+// conn.startServerPeer();
//
// MessageConsumer cons = sess.createConsumer(queue);
//
@@ -657,7 +641,7 @@
//
// }
//
-// conn.start();
+// conn.startServerPeer();
//
// MessageConsumer cons = sess.createConsumer(queue);
//
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/MessageCleanupTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/MessageCleanupTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/MessageCleanupTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,19 +21,10 @@
*/
package org.jboss.test.messaging.jms;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.DeliveryMode;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TemporaryQueue;
-import javax.jms.TemporaryTopic;
-import javax.jms.Topic;
-
-import org.jboss.messaging.core.impl.message.SimpleMessageStore;
import org.jboss.test.messaging.tools.ServerManagement;
+import javax.jms.*;
+
/**
*
* A MessageCleanupTest
@@ -67,7 +58,7 @@
{
super.setUp();
- ServerManagement.deployTopic("TestTopic", 100, 10, 10);
+ deployTopic("TestTopic", 100, 10, 10);
ourTopic = (Topic)ic.lookup("/topic/TestTopic");
}
@@ -76,7 +67,7 @@
{
super.tearDown();
- ServerManagement.undeployTopic("TestTopic");
+ undeployTopic("TestTopic");
}
/*
@@ -86,7 +77,7 @@
{
if (ServerManagement.isRemote()) return;
- SimpleMessageStore ms = (SimpleMessageStore)ServerManagement.getMessageStore();
+ //SimpleMessageStore ms = (SimpleMessageStore)ServerManagement.getMessageStore();
Connection conn = cf.createConnection();
@@ -183,7 +174,7 @@
String objectName = "somedomain:service=TempQueueConnectionFactory";
String[] jndiBindings = new String[] { "/TempQueueConnectionFactory" };
- ServerManagement.deployConnectionFactory(objectName, jndiBindings, 150, 100, 10, 10);
+ deployConnectionFactory(objectName, jndiBindings, 150, 100, 10, 10);
ConnectionFactory cf2 = (ConnectionFactory)ic.lookup("/TempQueueConnectionFactory");
@@ -204,7 +195,7 @@
prod.send(sess.createMessage());
}
- SimpleMessageStore ms = (SimpleMessageStore)ServerManagement.getMessageStore();
+ //SimpleMessageStore ms = (SimpleMessageStore)ServerManagement.getMessageStore();
assertEquals(50, getReferenceIds().size());
@@ -229,7 +220,7 @@
String objectName = "somedomain:service=TempTopicConnectionFactory";
String[] jndiBindings = new String[] { "/TempTopicConnectionFactory" };
- ServerManagement.deployConnectionFactory(objectName, jndiBindings, 150, 100, 10, 10);
+ deployConnectionFactory(objectName, jndiBindings, 150, 100, 10, 10);
ConnectionFactory cf2 = (ConnectionFactory)ic.lookup("/TempTopicConnectionFactory");
@@ -247,14 +238,14 @@
sess.createConsumer(topic);
- //Don't start the connection
+ //Don't startServerPeer the connection
for (int i = 0; i < 150; i++)
{
prod.send(sess.createMessage());
}
- SimpleMessageStore ms = (SimpleMessageStore)ServerManagement.getMessageStore();
+ //SimpleMessageStore ms = (SimpleMessageStore)ServerManagement.getMessageStore();
assertEquals(100, getReferenceIds().size());
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,34 +21,15 @@
*/
package org.jboss.test.messaging.jms;
+import EDU.oswego.cs.dl.util.concurrent.Latch;
+import org.jboss.jms.destination.JBossTopic;
+
+import javax.jms.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
-import javax.jms.BytesMessage;
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.InvalidDestinationException;
-import javax.jms.JMSException;
-import javax.jms.MapMessage;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.QueueReceiver;
-import javax.jms.Session;
-import javax.jms.StreamMessage;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.jms.TopicSubscriber;
-
-import org.jboss.jms.destination.JBossTopic;
-
-import EDU.oswego.cs.dl.util.concurrent.Latch;
-
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -173,7 +154,7 @@
{
while (count < numMessages)
{
- this.wait();
+ this.wait(2000);
}
}
}
@@ -242,7 +223,7 @@
prod.send(tm);
- TextMessage tm2 = (TextMessage)cons1.receive();
+ TextMessage tm2 = (TextMessage)cons1.receive(2000);
assertNotNull(tm2);
@@ -279,7 +260,7 @@
/**
- * The simplest possible receive() test for a non-persistent message.
+ * The simplest possible receive(2000) test for a non-persistent message.
*/
public void testReceive() throws Exception
{
@@ -301,7 +282,7 @@
MessageConsumer queueConsumer = consumerSession.createConsumer(queue1);
- // start consumer connection before the message is submitted
+ // startServerPeer consumer connection before the message is submitted
consumerConnection.start();
TextMessage tm = producerSession.createTextMessage("someText");
@@ -310,7 +291,7 @@
queueProducer.send(tm);
- TextMessage m = (TextMessage)queueConsumer.receive();
+ TextMessage m = (TextMessage)queueConsumer.receive(2000);
assertEquals(tm.getText(), m.getText());
}
@@ -348,7 +329,7 @@
MessageConsumer queueConsumer = consumerSession.createConsumer(queue1);
- // start consumer connection before the message is submitted
+ // startServerPeer consumer connection before the message is submitted
consumerConnection.start();
TextMessage tm = producerSession.createTextMessage("someText");
@@ -357,7 +338,7 @@
queueProducer.send(tm);
- TextMessage m = (TextMessage)queueConsumer.receive();
+ TextMessage m = (TextMessage)queueConsumer.receive(2000);
assertEquals(tm.getText(), m.getText());
}
@@ -402,7 +383,7 @@
queueProducer.send(tm);
- // start consumer connection after the message is submitted
+ // startServerPeer consumer connection after the message is submitted
consumerConnection.start();
TextMessage m = (TextMessage)queueConsumer.receive(2000);
@@ -449,7 +430,7 @@
queueProducer.send(tm);
- // start consumer connection after the message is submitted
+ // startServerPeer consumer connection after the message is submitted
consumerConnection.start();
//NOTE! There semantics of receiveNoWait do not guarantee the message is available
@@ -509,7 +490,7 @@
queueConsumer.setMessageListener(l);
- // start consumer connection after the message is submitted
+ // startServerPeer consumer connection after the message is submitted
consumerConnection.start();
// wait for the listener to receive the message
@@ -830,7 +811,7 @@
MessageConsumer cons1 = sess.createConsumer(queue1);
- TextMessage rm1 = (TextMessage)cons1.receive();
+ TextMessage rm1 = (TextMessage)cons1.receive(2000);
assertNotNull(rm1);
assertEquals("a", rm1.getText());
@@ -1240,7 +1221,7 @@
MessageConsumer cons1 = sess.createConsumer(queue1);
- TextMessage r1 = (TextMessage)cons1.receive();
+ TextMessage r1 = (TextMessage)cons1.receive(2000);
assertEquals(tm1.getText(), r1.getText());
@@ -1249,11 +1230,11 @@
MessageConsumer cons2 = sess.createConsumer(queue1);
- TextMessage r2 = (TextMessage)cons2.receive();
+ TextMessage r2 = (TextMessage)cons2.receive(2000);
assertEquals(tm2.getText(), r2.getText());
- TextMessage r3 = (TextMessage)cons2.receive();
+ TextMessage r3 = (TextMessage)cons2.receive(2000);
assertEquals(tm3.getText(), r3.getText());
@@ -1300,9 +1281,9 @@
MessageConsumer cons2 = sess.createConsumer(queue1);
- Message r1 = cons2.receive();
- Message r2 = cons2.receive();
- Message r3 = cons2.receive();
+ Message r1 = cons2.receive(2000);
+ Message r2 = cons2.receive(2000);
+ Message r3 = cons2.receive(2000);
//Messages should be received?
assertNotNull(r1);
@@ -2288,7 +2269,7 @@
//// MessageListenerImpl l = new MessageListenerImpl();
//// topicConsumer.setMessageListener(l);
////
-//// consumerConnection.start();
+//// consumerConnection.startServerPeer();
////
//// int NUM_MESSAGES = 10;
//// for(int i = 0; i < NUM_MESSAGES; i++)
@@ -2322,7 +2303,7 @@
//// MessageListenerImpl l = new MessageListenerImpl();
//// QueueConsumer.setMessageListener(l);
////
-//// consumerConnection.start();
+//// consumerConnection.startServerPeer();
////
//// int NUM_MESSAGES = 10;
//// for(int i = 0; i < NUM_MESSAGES; i++)
@@ -2479,7 +2460,7 @@
// queueConsumer.setMessageListener(myListener);
//
// log.trace("Starting consumer connection");
-// consumerConnection.start();
+// consumerConnection.startServerPeer();
//
// final int MESSAGE_COUNT = 100;
//
@@ -2493,7 +2474,7 @@
// Thread.sleep(500L);
//
// log.trace("Stopping consumer connection");
-// consumerConnection.stop();
+// consumerConnection.stopServerPeer();
//
// int countAfterStop = messagesReceived.get();
// assertTrue("Should have received some messages before stopping", countAfterStop > 0);
@@ -2510,14 +2491,14 @@
// assertEquals("Should not receive any messages after the connection has been stopped", countAfterStop, messagesReceived.get());
//
// log.trace("Restarting consumer connection");
-// consumerConnection.start();
+// consumerConnection.startServerPeer();
//
// log.trace("Sleeping to allow remaining messages to arrive");
// Thread.sleep(15000);
// assertEquals("Should have received all messages after restarting", MESSAGE_COUNT, messagesReceived.get());
// }
- // Test that stop doesn't in any way break subsequent close
+ // Test that stopServerPeer doesn't in any way break subsequent close
public void testCloseAfterStop() throws Exception
{
Connection producerConnection = null;
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/PersistenceTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/PersistenceTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/PersistenceTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,16 +21,8 @@
*/
package org.jboss.test.messaging.jms;
-import javax.jms.BytesMessage;
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
+import javax.jms.*;
-import org.jboss.test.messaging.tools.ServerManagement;
-
/**
*
* A PersistenceTest
@@ -50,7 +42,7 @@
// Attributes ----------------------------------------------------
// Constructors --------------------------------------------------
-
+ private Queue queue1;
public PersistenceTest(String name)
{
super(name);
@@ -58,6 +50,12 @@
// TestCase overrides -------------------------------------------
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ queue1 = (Queue) getInitialContext().lookup("/queue/testQueue");
+ }
+
// Public --------------------------------------------------------
/**
@@ -83,9 +81,9 @@
conn.close();
- ServerManagement.stopServerPeer();
+ stop();
- ServerManagement.startServerPeer();
+ start();
// Messaging server restart implies new ConnectionFactory lookup
deployAndLookupAdministeredObjects();
@@ -96,7 +94,7 @@
MessageConsumer cons = sess.createConsumer(queue1);
for (int i = 0; i < 10; i++)
{
- TextMessage tm = (TextMessage)cons.receive(3000);
+ TextMessage tm = (TextMessage)cons.receive(10000);
assertNotNull(tm);
if (tm == null)
{
@@ -171,11 +169,11 @@
}
conn.close();
-
- ServerManagement.stopServerPeer();
+
+ stop();
+
+ start();
- ServerManagement.startServerPeer();
-
// Messaging server restart implies new ConnectionFactory lookup
deployAndLookupAdministeredObjects();
@@ -185,7 +183,7 @@
cons = sess.createConsumer(queue1);
for (int i = 0; i < 10; i++)
{
- TextMessage tm = (TextMessage)cons.receive(3000);
+ TextMessage tm = (TextMessage)cons.receive(10000);
assertNotNull(tm);
@@ -242,11 +240,11 @@
prod.send(m9, DeliveryMode.PERSISTENT, 9, 0);
conn.close();
-
- ServerManagement.stopServerPeer();
+
+ stop();
+
+ start();
- ServerManagement.startServerPeer();
-
// Messaging server restart implies new ConnectionFactory lookup
deployAndLookupAdministeredObjects();
@@ -358,10 +356,10 @@
conn.close();
- ServerManagement.stopServerPeer();
+ stop();
+
+ start();
- ServerManagement.startServerPeer();
-
deployAndLookupAdministeredObjects();
conn = cf.createConnection();
@@ -458,10 +456,10 @@
conn.close();
- ServerManagement.stopServerPeer();
-
- ServerManagement.startServerPeer();
+ stop();
+ start();
+
deployAndLookupAdministeredObjects();
conn = cf.createConnection();
@@ -472,7 +470,7 @@
ds = s.createDurableSubscriber(topic1, "sub", null, false);
- TextMessage rm = (TextMessage)ds.receive(3000);
+ TextMessage rm = (TextMessage)ds.receive(10000);
assertNotNull(rm);
assertEquals("thebody", rm.getText());
@@ -520,11 +518,11 @@
conn.close();
- ServerManagement.stopServerPeer();
-
- ServerManagement.startServerPeer();
-
- // Messaging server restart implies new ConnectionFactory lookup
+ stop();
+
+ start();
+
+ // Messaging server restart implies new ConnectionFactory lookup
deployAndLookupAdministeredObjects();
conn = cf.createConnection();
@@ -539,7 +537,7 @@
for (int i = 0; i < 10; i++)
{
- TextMessage tm1 = (TextMessage)sub1.receive(3000);
+ TextMessage tm1 = (TextMessage)sub1.receive(10000);
assertNotNull(tm1);
if (tm1 == null)
{
@@ -547,7 +545,7 @@
}
assertEquals("message" + i, tm1.getText());
- TextMessage tm2 = (TextMessage)sub2.receive(3000);
+ TextMessage tm2 = (TextMessage)sub2.receive(10000);
assertNotNull(tm2);
if (tm2 == null)
{
@@ -555,7 +553,7 @@
}
assertEquals("message" + i, tm2.getText());
- TextMessage tm3 = (TextMessage)sub3.receive(3000);
+ TextMessage tm3 = (TextMessage)sub3.receive(10000);
assertNotNull(tm3);
if (tm3 == null)
{
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/QueueTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/QueueTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/QueueTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,19 +21,10 @@
*/
package org.jboss.test.messaging.jms;
+import javax.jms.*;
import java.util.HashSet;
import java.util.Set;
-import javax.jms.BytesMessage;
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
-import org.jboss.test.messaging.tools.ServerManagement;
-
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
* @version <tt>$Revision$</tt>
@@ -99,7 +90,8 @@
{
conn = cf.createConnection();
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageProducer prod = sess.createProducer(queue1);
+ Queue queue1 = (Queue) getInitialContext().lookup("/queue/testQueue");
+ MessageProducer prod = sess.createProducer(queue1);
prod.setDeliveryMode(DeliveryMode.PERSISTENT);
for (int i = 0; i < 1; i++)
@@ -113,9 +105,9 @@
conn.close();
- ServerManagement.stopServerPeer();
+ stop();
- ServerManagement.startServerPeer();
+ start();
// Messaging server restart implies new ConnectionFactory lookup
deployAndLookupAdministeredObjects();
@@ -184,7 +176,7 @@
Session s2 = conn2.createSession(true, Session.AUTO_ACKNOWLEDGE);
- // Create a consumer, start the session, close the consumer..
+ // Create a consumer, startServerPeer the session, close the consumer..
// This shouldn't cause any message to be lost
MessageConsumer c2 = s2.createConsumer(queue1);
conn2.start();
@@ -236,6 +228,7 @@
conn = cf.createConnection();
Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ Queue queue1 = (Queue) getInitialContext().lookup("/queue/testQueue");
MessageProducer p = s.createProducer(queue1);
MessageConsumer c = s.createConsumer(queue1);
conn.start();
@@ -247,9 +240,9 @@
conn.close();
- ServerManagement.stop(0);
+ stop();
- ServerManagement.start(0, "all", false);
+ start();
deployAndLookupAdministeredObjects();
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ScheduledDeliveryTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ScheduledDeliveryTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/ScheduledDeliveryTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,16 +21,11 @@
*/
package org.jboss.test.messaging.jms;
-import javax.jms.Connection;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.management.ObjectName;
-
import org.jboss.jms.message.JBossMessage;
-import org.jboss.test.messaging.tools.ServerManagement;
+import org.jboss.jms.server.ServerPeer;
+import javax.jms.*;
+
/**
*
* A ScheduledDeliveryTest
@@ -77,7 +72,7 @@
conn = cf.createConnection();
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
+ Queue queue1 = (Queue) getInitialContext().lookup("/queue/testQueue");
MessageProducer prod = sess.createProducer(queue1);
//Send one scheduled
@@ -124,13 +119,13 @@
tm8.setLongProperty(JBossMessage.JMS_JBOSS_SCHEDULED_DELIVERY_PROP_NAME, -3);
prod.send(tm9);
- //Now stop the server and restart it
+ //Now stopServerPeer the server and restart it
conn.close();
- ServerManagement.stopServerPeer();
+ stop();
- ServerManagement.startServerPeer();
+ start();
// Messaging server restart implies new ConnectionFactory lookup
deployAndLookupAdministeredObjects();
@@ -219,44 +214,38 @@
}
public void testDelayedRedeliveryDefault() throws Exception
- {
- ObjectName serverPeerObjectName = ServerManagement.getServerPeerObjectName();
+ {
try
- {
- ObjectName queueObjectName = new ObjectName("jboss.messaging.destination:service=Queue,name=Queue1");
-
- ServerManagement.setAttribute(queueObjectName, "RedeliveryDelay", "-1");
-
- long delay = 3000;
-
- ServerManagement.setAttribute(serverPeerObjectName, "DefaultRedeliveryDelay", String.valueOf(delay));
-
+ {
+
+ ((ServerPeer)getJmsServer()).getDestinationManager().getDestination("Queue1", true).setRedeliveryDelay(-1);
+
+ long delay = 3000;
+
+ getJmsServer().getConfiguration().setDefaultRedeliveryDelay(delay);
this.delayedRedeliveryDefaultOnClose(delay);
this.delayedRedeliveryDefaultOnRollback(delay);
}
finally
{
- ServerManagement.setAttribute(serverPeerObjectName, "DefaultRedeliveryDelay", "0");
+ getJmsServer().getConfiguration().setDefaultRedeliveryDelay(0);
removeAllMessages(queue1.getQueueName(), true, 0);
}
}
public void testDelayedRedeliveryOverride() throws Exception
- {
- ObjectName serverPeerObjectName = ServerManagement.getServerPeerObjectName();
-
- ObjectName queueObjectName = new ObjectName("jboss.messaging.destination:service=Queue,name=Queue1");
+ {
try
{
long delay = 6000;
- ServerManagement.setAttribute(queueObjectName, "RedeliveryDelay", String.valueOf(delay));
+ ((ServerPeer)getJmsServer()).getDestinationManager().getDestination("Queue1", true).setRedeliveryDelay(delay);
- ServerManagement.setAttribute(serverPeerObjectName, "DefaultRedeliveryDelay", "3000");
+ getJmsServer().getConfiguration().setDefaultRedeliveryDelay(3000);
this.delayedRedeliveryDefaultOnClose(delay);
@@ -264,9 +253,9 @@
}
finally
{
- ServerManagement.setAttribute(serverPeerObjectName, "DefaultRedeliveryDelay", "0");
+ getJmsServer().getConfiguration().setDefaultRedeliveryDelay(0);
- ServerManagement.setAttribute(queueObjectName, "RedeliveryDelay", "-1");
+ ((ServerPeer)getJmsServer()).getDestinationManager().getDestination("Queue1", true).setRedeliveryDelay(-1);
removeAllMessages(queue1.getQueueName(), true, 0);
}
@@ -283,8 +272,7 @@
// Some tests here are changing this attribute.. what would affect tests later
// Instead of restart the ServerPeer I'm just restoring the default
- ServerManagement.setAttribute(ServerManagement.getServerPeerObjectName(),
- "DefaultRedeliveryDelay", "0");
+ getJmsServer().getConfiguration().setDefaultRedeliveryDelay(0);
}
// Private -------------------------------------------------------
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/SecurityTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/SecurityTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/SecurityTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,28 +21,18 @@
*/
package org.jboss.test.messaging.jms;
-import javax.jms.Connection;
-import javax.jms.Destination;
-import javax.jms.IllegalStateException;
-import javax.jms.JMSSecurityException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.Topic;
-import javax.jms.XAConnection;
-import javax.jms.XAConnectionFactory;
-import javax.jms.XASession;
-import javax.management.ObjectName;
-import javax.transaction.xa.XAResource;
-
import org.jboss.jms.exception.MessagingXAException;
+import org.jboss.jms.server.ServerPeer;
+import org.jboss.jms.server.security.Role;
import org.jboss.jms.tx.MessagingXid;
import org.jboss.logging.Logger;
-import org.jboss.messaging.util.XMLUtil;
import org.jboss.test.messaging.tools.ServerManagement;
+import javax.jms.*;
+import javax.jms.IllegalStateException;
+import javax.transaction.xa.XAResource;
+import java.util.HashSet;
+
/**
* Test JMS Security.
*
@@ -64,13 +54,17 @@
private static final Logger log = Logger.getLogger(SecurityTest.class);
- private static final String defConfig = "<security><role name=\"def\" read=\"true\" write=\"true\" create=\"true\"/></security>";
+ private static final HashSet<Role> defConfig = new HashSet<Role>();
+ static
+ {
+ defConfig.add(new Role("def", true, true, true));
+ }
// Static --------------------------------------------------------
// Attributes ----------------------------------------------------
- private String oldDefaultConfig;
+ private HashSet<Role> oldDefaultConfig;
// Constructors --------------------------------------------------
@@ -173,6 +167,8 @@
Connection conn = null;
try
{
+ deployConnectionFactory("dilbert-id", "preConfcf", new String[]{"preConfcf"});
+ ConnectionFactory cf = (ConnectionFactory) getInitialContext().lookup("preConfcf");
conn = cf.createConnection("dilbert", "dogbert");
String clientID = conn.getClientID();
assertEquals("Invalid ClientID", "dilbert-id", clientID);
@@ -181,6 +177,7 @@
{
if (conn != null)
conn.close();
+ undeployConnectionFactory("preConfcf");
}
}
@@ -211,6 +208,8 @@
Connection conn = null;
try
{
+ deployConnectionFactory("dilbert-id", "preConfcf", new String[]{"preConfcf"});
+ ConnectionFactory cf = (ConnectionFactory) getInitialContext().lookup("preConfcf");
conn = cf.createConnection("dilbert", "dogbert");
conn.setClientID("myID");
fail();
@@ -223,6 +222,7 @@
{
if (conn != null)
conn.close();
+ undeployConnectionFactory("preConfcf");
}
}
@@ -258,6 +258,7 @@
Connection conn = null;
try
{
+ getJmsServer().getConfiguration().setSecurityConfig(oldDefaultConfig);
conn = cf.createConnection();
assertTrue(canWriteDestination(conn, queue1));
}
@@ -434,6 +435,9 @@
Connection conn = null;
try
{
+ deployConnectionFactory("dilbert-id", "preConfcf", new String[]{"preConfcf"});
+ ConnectionFactory cf = (ConnectionFactory) getInitialContext().lookup("preConfcf");
+ getJmsServer().getConfiguration().setSecurityConfig(oldDefaultConfig);
conn = cf.createConnection("dilbert", "dogbert");
assertTrue(this.canCreateDurableSub(conn, topic1, "sub2"));
}
@@ -441,6 +445,7 @@
{
if (conn != null)
conn.close();
+ undeployConnectionFactory("preConfcf");
}
}
@@ -539,12 +544,8 @@
*/
public void testDefaultSecurityUpdate() throws Exception
{
- String defSecConf = ServerManagement.getDefaultSecurityConfig();
+ HashSet<Role> defSecConf = getJmsServer().getConfiguration().getSecurityConfig();
- // Make sure it is the default security configuration I rely on
-
- XMLUtil.assertEquivalent(XMLUtil.stringToElement(defConfig),
- XMLUtil.stringToElement(defSecConf));
// "john" has the role def, so he should be able to create a producer and a consumer on a queue
Connection conn = null;
@@ -555,20 +556,20 @@
assertTrue(canReadDestination(conn, queue2));
assertTrue(canWriteDestination(conn, queue2));
- String newSecurityConfig =
- "<security><role name=\"someotherrole\" read=\"true\" write=\"true\" create=\"false\"/></security>";
+ HashSet<Role> newSecurityConfig = new HashSet<Role>();
+ newSecurityConfig.add(new Role("someotherrole", true, true, false));
- ServerManagement.setDefaultSecurityConfig(newSecurityConfig);
+ getJmsServer().getConfiguration().setSecurityConfig(newSecurityConfig);
assertFalse(canReadDestination(conn, queue2));
// we should only look non transacted, as looking on connection would require the test
// to wait 15s (eviction timeout)
assertFalse(canWriteDestination(conn, queue2, false));
- newSecurityConfig =
- "<security><role name=\"def\" read=\"true\" write=\"false\" create=\"false\"/></security>";
+ newSecurityConfig = new HashSet<Role>();
+ newSecurityConfig.add(new Role("def", true, false, false));
- ServerManagement.setDefaultSecurityConfig(newSecurityConfig);
+ getJmsServer().getConfiguration().setSecurityConfig(newSecurityConfig);
assertTrue(canReadDestination(conn, queue2));
// to avoid cache evict timeout
@@ -580,133 +581,12 @@
{
conn.close();
}
+ getJmsServer().getConfiguration().setSecurityConfig(defSecConf);
}
}
/**
* This test makes sure that changing the queue security configuration on the server has effect
- * over destinations when they are stopped (this is what happens in a real deployment - the security config
- * gets set before the queue/topic is started
- * See http://jira.jboss.com/jira/browse/JBMESSAGING-976
- */
- public void testQueueSecurityUpdateStopped() throws Exception
- {
- // "john" has the role def, so he should be able to create a producer and a consumer on a queue
-
- ObjectName on = new ObjectName("jboss.messaging.destination:service=Queue,name=Queue2");
-
- Connection conn = null;
-
- try
- {
- conn = cf.createConnection("john", "needle");
- assertTrue(canReadDestination(conn, queue2));
- assertTrue(canWriteDestination(conn, queue2));
-
- String newSecurityConfig =
- "<security><role name=\"someotherrole\" read=\"true\" write=\"true\" create=\"false\"/></security>";
-
- ServerManagement.invoke(on, "stop", null, null);
- ServerManagement.configureSecurityForDestination("Queue2", newSecurityConfig);
- ServerManagement.invoke(on, "start", null, null);
-
- assertFalse(canReadDestination(conn, queue2));
- // non transacted to avoid evict timeout
- assertFalse(canWriteDestination(conn, queue2, false));
-
-
- newSecurityConfig =
- "<security><role name=\"def\" read=\"true\" write=\"false\" create=\"false\"/></security>";
-
- ServerManagement.invoke(on, "stop", null, null);
- ServerManagement.configureSecurityForDestination("Queue2", newSecurityConfig);
- ServerManagement.invoke(on, "start", null, null);
-
- assertTrue(canReadDestination(conn, queue2));
- assertFalse(canWriteDestination(conn, queue2, false));
-
- newSecurityConfig =
- "<security><role name=\"def\" read=\"true\" write=\"true\" create=\"false\"/></security>";
-
- ServerManagement.invoke(on, "stop", null, null);
- ServerManagement.configureSecurityForDestination("Queue2", newSecurityConfig);
- ServerManagement.invoke(on, "start", null, null);
-
- assertTrue(canReadDestination(conn, queue2));
- assertTrue(canWriteDestination(conn, queue2, false));
- }
- finally
- {
- if (conn != null)
- {
- conn.close();
- }
- }
- }
-
- /**
- * This test makes sure that changing the topic security configuration on the server has effect
- * over destinations when they are stopped (this is what happens in a real deployment - the security config
- * gets set before the queue/topic is started
- * See http://jira.jboss.com/jira/browse/JBMESSAGING-976
- */
- public void testTopicSecurityUpdateStopped() throws Exception
- {
- // "john" has the role def, so he should be able to create a producer and a consumer on a queue
-
- ObjectName on = new ObjectName("jboss.messaging.destination:service=Topic,name=Topic2");
-
- Connection conn = null;
-
- try
- {
- conn = cf.createConnection("john", "needle");
- assertTrue(canReadDestination(conn, topic2));
- assertTrue(canWriteDestination(conn, topic2));
-
-
- String newSecurityConfig =
- "<security><role name=\"someotherrole\" read=\"true\" write=\"true\" create=\"false\"/></security>";
-
- ServerManagement.invoke(on, "stop", null, null);
- ServerManagement.configureSecurityForDestination("Topic2", newSecurityConfig);
- ServerManagement.invoke(on, "start", null, null);
-
- assertFalse(canReadDestination(conn, topic2));
- assertFalse(canWriteDestination(conn, topic2, false));
-
-
- newSecurityConfig =
- "<security><role name=\"def\" read=\"true\" write=\"false\" create=\"false\"/></security>";
-
- ServerManagement.invoke(on, "stop", null, null);
- ServerManagement.configureSecurityForDestination("Topic2", newSecurityConfig);
- ServerManagement.invoke(on, "start", null, null);
-
- assertTrue(canReadDestination(conn, topic2));
- assertFalse(canWriteDestination(conn, topic2, false));
-
- newSecurityConfig =
- "<security><role name=\"def\" read=\"true\" write=\"true\" create=\"false\"/></security>";
-
- ServerManagement.invoke(on, "stop", null, null);
- ServerManagement.configureSecurityForDestination("Topic2", newSecurityConfig);
- ServerManagement.invoke(on, "start", null, null);
-
- assertTrue(canReadDestination(conn, topic2));
- assertTrue(canWriteDestination(conn, topic2, false));
- }
- finally
- {
- if (conn != null)
- {
- conn.close();
- }
- }
- }
-
- /**
- * This test makes sure that changing the queue security configuration on the server has effect
* over already deployed destinations.
*/
public void testQueueSecurityUpdate() throws Exception
@@ -720,27 +600,27 @@
assertTrue(canReadDestination(conn, queue2));
assertTrue(canWriteDestination(conn, queue2));
- String newSecurityConfig =
- "<security><role name=\"someotherrole\" read=\"true\" write=\"true\" create=\"false\"/></security>";
+ HashSet<Role> newSecurityConfig = new HashSet<Role>();
+ newSecurityConfig.add(new Role("someotherrole", true, true, false));
- ServerManagement.configureSecurityForDestination("Queue2", newSecurityConfig);
+ configureSecurityForDestination("Queue2", true, newSecurityConfig);
assertFalse(canReadDestination(conn, queue2));
assertFalse(canWriteDestination(conn, queue2, false));
- newSecurityConfig =
- "<security><role name=\"def\" read=\"true\" write=\"false\" create=\"false\"/></security>";
+ newSecurityConfig = new HashSet<Role>();
+ newSecurityConfig.add(new Role("def", true, false, false));
- ServerManagement.configureSecurityForDestination("Queue2", newSecurityConfig);
+ configureSecurityForDestination("Queue2", true, newSecurityConfig);
assertTrue(canReadDestination(conn, queue2));
assertFalse(canWriteDestination(conn, queue2, false));
- newSecurityConfig =
- "<security><role name=\"def\" read=\"true\" write=\"true\" create=\"false\"/></security>";
+ newSecurityConfig = new HashSet<Role>();
+ newSecurityConfig.add(new Role("def", true, true, false));
- ServerManagement.configureSecurityForDestination("Queue2", newSecurityConfig);
+ configureSecurityForDestination("Queue2", true, newSecurityConfig);
assertTrue(canReadDestination(conn, queue2));
assertTrue(canWriteDestination(conn, queue2, false));
@@ -750,14 +630,15 @@
ServerManagement.configureSecurityForDestination("Queue2", null);
//Should fall back to the default config
- String lockedConf = "<security><role name=\"alien\" read=\"true\" write=\"true\" create=\"true\"/></security>";
+ HashSet<Role> lockedConf = new HashSet<Role>();
+ lockedConf.add(new Role("alien", true, true, true));
- ServerManagement.setDefaultSecurityConfig(lockedConf);
+ ((ServerPeer)getJmsServer()).getSecurityManager().setSecurityConfig(true, "Queue2", lockedConf);
assertFalse(canReadDestination(conn, queue2));
assertFalse(canWriteDestination(conn, queue2, false));
- ServerManagement.setDefaultSecurityConfig(defConfig);
+ ((ServerPeer)getJmsServer()).getSecurityManager().setSecurityConfig(true, "Queue2", defConfig);
assertTrue(canReadDestination(conn, queue2));
assertTrue(canWriteDestination(conn, queue2, false));
@@ -787,44 +668,45 @@
assertTrue(canWriteDestination(conn, topic2));
- String newSecurityConfig =
- "<security><role name=\"someotherrole\" read=\"true\" write=\"true\" create=\"false\"/></security>";
+ HashSet<Role> newSecurityConfig = new HashSet<Role>();
+ newSecurityConfig.add(new Role("someotherrole", true, true, false)) ;
- ServerManagement.configureSecurityForDestination("Topic2", newSecurityConfig);
+ configureSecurityForDestination("Topic2", false, newSecurityConfig);
assertFalse(canReadDestination(conn, topic2));
assertFalse(canWriteDestination(conn, topic2, false));
- newSecurityConfig =
- "<security><role name=\"def\" read=\"true\" write=\"false\" create=\"false\"/></security>";
+ newSecurityConfig = new HashSet<Role>();
+ newSecurityConfig.add(new Role("def", true, false, false)) ;
- ServerManagement.configureSecurityForDestination("Topic2", newSecurityConfig);
+ configureSecurityForDestination("Topic2", false, newSecurityConfig);
assertTrue(canReadDestination(conn, topic2));
assertFalse(canWriteDestination(conn, topic2, false));
- newSecurityConfig =
- "<security><role name=\"def\" read=\"true\" write=\"true\" create=\"false\"/></security>";
+ newSecurityConfig = new HashSet<Role>();
+ newSecurityConfig.add(new Role("def", true, true, false)) ;
- ServerManagement.configureSecurityForDestination("Topic2", newSecurityConfig);
+ configureSecurityForDestination("Topic2", false, newSecurityConfig);
assertTrue(canReadDestination(conn, topic2));
assertTrue(canWriteDestination(conn, topic2, false));
//Now set to null
- ServerManagement.configureSecurityForDestination("Topic2", null);
+ configureSecurityForDestination("Topic2", false, null);
//Should fall back to the default config
- String lockedConf = "<security><role name=\"alien\" read=\"true\" write=\"true\" create=\"true\"/></security>";
+ HashSet<Role> lockedConf = new HashSet<Role>();
+ lockedConf.add(new Role("alien", true, true, true)) ;
- ServerManagement.setDefaultSecurityConfig(lockedConf);
+ getJmsServer().getConfiguration().setSecurityConfig(lockedConf);
assertFalse(canReadDestination(conn, topic2));
assertFalse(canWriteDestination(conn, topic2, false));
- ServerManagement.setDefaultSecurityConfig(defConfig);
+ getJmsServer().getConfiguration().setSecurityConfig(defConfig);
assertTrue(canReadDestination(conn, topic2));
assertTrue(canWriteDestination(conn, topic2, false));
@@ -840,23 +722,23 @@
public void testSecurityForQueuesAndTopicsWithTheSameName() throws Exception
{
- ServerManagement.deployQueue("Accounting");
- ServerManagement.deployTopic("Accounting");
+ deployQueue("Accounting");
+ deployTopic("Accounting");
Connection conn = null;
try
{
// configure the queue to allow "def" to read
- String config = "<security><role name=\"def\" read=\"true\" write=\"false\" create=\"false\"/></security>";
- ObjectName on = new ObjectName("jboss.messaging.destination:service=Queue,name=Accounting");
- ServerManagement.setAttribute(on, "SecurityConfig", config);
+ HashSet<Role> config = new HashSet<Role>();
+ config.add(new Role("def", true, false, false));
+ configureSecurityForDestination("Accounting", true, config );
// configure the topic to prevent "def" from reading
- config = "<security><role name=\"def\" read=\"false\" write=\"false\" create=\"false\"/></security>";
- on = new ObjectName("jboss.messaging.destination:service=Topic,name=Accounting");
- ServerManagement.setAttribute(on, "SecurityConfig", config);
-
+ HashSet<Role> config2 = new HashSet<Role>();
+ config2.add(new Role("def", false, false, false));
+ configureSecurityForDestination("Accounting", false, config2);
+
Queue queue = (Queue)ic.lookup("/queue/Accounting");
Topic topic = (Topic)ic.lookup("/topic/Accounting");
@@ -867,8 +749,8 @@
}
finally
{
- ServerManagement.undeployQueue("Accounting");
- ServerManagement.undeployTopic("Accounting");
+ undeployQueue("Accounting");
+ undeployTopic("Accounting");
if (conn != null)
{
conn.close();
@@ -893,47 +775,38 @@
protected void setUp() throws Exception
{
super.setUp();
-
- oldDefaultConfig = ServerManagement.getDefaultSecurityConfig();
-
- final String queueConf =
- "<security>" +
- "<role name=\"guest\" read=\"true\" write=\"true\"/>" +
- "<role name=\"publisher\" read=\"true\" write=\"true\" create=\"false\"/>" +
- "<role name=\"noacc\" read=\"false\" write=\"false\" create=\"false\"/>" +
- "</security>";
- ServerManagement.configureSecurityForDestination("Queue1", queueConf);
+ oldDefaultConfig = getJmsServer().getConfiguration().getSecurityConfig();
- final String topicConf =
- "<security>" +
- "<role name=\"guest\" read=\"true\" write=\"true\"/>" +
- "<role name=\"publisher\" read=\"true\" write=\"true\" create=\"false\"/>" +
- "<role name=\"durpublisher\" read=\"true\" write=\"true\" create=\"true\"/>" +
- "</security>";
+ HashSet<Role> roles = new HashSet<Role>();
+ roles.add(new Role("guest", true, true, false));
+ roles.add(new Role("publisher", true, true, false));
+ roles.add(new Role("noacc", false, false, false));
+ configureSecurityForDestination("Queue1", true, roles);
- ServerManagement.configureSecurityForDestination("Topic1", topicConf);
+ HashSet<Role> roles2 = new HashSet<Role>();
+ roles2.add(new Role("guest", true, true, false));
+ roles2.add(new Role("publisher", true, true, false));
+ roles2.add(new Role("durpublisher", true, true, true));
+ configureSecurityForDestination("Topic1", false, roles2);
- final String testSecuredTopicConf =
- "<security>" +
- "<role name=\"publisher\" read=\"true\" write=\"true\" create=\"false\"/>" +
- "</security>";
+ HashSet<Role> roles3 = new HashSet<Role>();
+ roles3.add(new Role("publisher", true, true, false));
+ configureSecurityForDestination("Topic2", false, roles3);
- ServerManagement.configureSecurityForDestination("Topic2", testSecuredTopicConf);
-
- ServerManagement.setDefaultSecurityConfig(defConfig);
+ getJmsServer().getConfiguration().setSecurityConfig(defConfig);
}
protected void tearDown() throws Exception
{
super.tearDown();
-
- ServerManagement.setDefaultSecurityConfig(oldDefaultConfig);
- ServerManagement.configureSecurityForDestination("Queue1", null);
- ServerManagement.configureSecurityForDestination("Queue2", null);
- ServerManagement.configureSecurityForDestination("Topic1", null);
- ServerManagement.configureSecurityForDestination("Topic2", null);
+
+ getJmsServer().getConfiguration().setSecurityConfig(oldDefaultConfig);
+ configureSecurityForDestination("Queue1",true, null);
+ configureSecurityForDestination("Queue2", true, null);
+ configureSecurityForDestination("Topic1", false, null);
+ configureSecurityForDestination("Topic2", false, null);
}
// Private -------------------------------------------------------
@@ -1145,7 +1018,7 @@
{
xaconn.close();
}
- ServerManagement.undeployQueue("MyQueue2");
+ undeployQueue("MyQueue2");
}
catch (Throwable ignored)
{
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/SessionTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/SessionTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/SessionTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,29 +21,15 @@
*/
package org.jboss.test.messaging.jms;
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueSession;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.jms.TopicConnection;
-import javax.jms.TopicSession;
-import javax.jms.XAConnection;
-import javax.jms.XASession;
-
import org.jboss.jms.client.JBossSession;
import org.jboss.jms.client.delegate.ClientSessionDelegate;
import org.jboss.jms.client.state.ConnectionState;
import org.jboss.jms.client.state.SessionState;
import org.jboss.jms.tx.ResourceManagerFactory;
+import org.jboss.test.messaging.JBMServerTestCase;
+import javax.jms.*;
+
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
@@ -51,7 +37,7 @@
*
* $Id$
*/
-public class SessionTest extends JMSTestCase
+public class SessionTest extends JBMServerTestCase
{
// Constants -----------------------------------------------------
@@ -70,7 +56,7 @@
public void testNoTransactionAfterClose() throws Exception
{
- Connection conn = cf.createConnection();
+ Connection conn = getConnectionFactory().createConnection();
conn.start();
Session sess = conn.createSession(true, Session.SESSION_TRANSACTED);
MessageProducer prod = sess.createProducer(queue1);
@@ -104,7 +90,7 @@
public void testCreateProducer() throws Exception
{
- Connection conn = cf.createConnection();
+ Connection conn = getConnectionFactory().createConnection();
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
sess.createProducer(topic1);
conn.close();
@@ -112,7 +98,7 @@
public void testCreateProducerOnNullQueue() throws Exception
{
- Connection conn = cf.createConnection();
+ Connection conn = getConnectionFactory().createConnection();
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
Message m = sess.createTextMessage("something");
@@ -133,7 +119,7 @@
public void testCreateConsumer() throws Exception
{
- Connection conn = cf.createConnection();
+ Connection conn = getConnectionFactory().createConnection();
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
sess.createConsumer(topic1);
@@ -142,7 +128,7 @@
public void testGetSession1() throws Exception
{
- Connection conn = cf.createConnection();
+ Connection conn = getConnectionFactory().createConnection();
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
try
@@ -157,7 +143,7 @@
public void testGetSession2() throws Exception
{
- XAConnection conn = cf.createXAConnection();
+ XAConnection conn = getConnectionFactory().createXAConnection();
XASession sess = conn.createXASession();
sess.getSession();
@@ -171,7 +157,7 @@
public void testCreateNonExistentQueue() throws Exception
{
- Connection conn = cf.createConnection();
+ Connection conn = getConnectionFactory().createConnection();
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
try
{
@@ -185,7 +171,7 @@
public void testCreateQueueOnATopicSession() throws Exception
{
- TopicConnection c = (TopicConnection)cf.createConnection();
+ TopicConnection c = (TopicConnection)getConnectionFactory().createConnection();
TopicSession s = c.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
try
@@ -202,7 +188,7 @@
public void testCreateQueueWhileTopicWithSameNameExists() throws Exception
{
- Connection conn = cf.createConnection();
+ Connection conn = getConnectionFactory().createConnection();
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
try
{
@@ -218,7 +204,7 @@
public void testCreateQueue() throws Exception
{
- Connection conn = cf.createConnection();
+ Connection conn = getConnectionFactory().createConnection();
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
Queue queue = sess.createQueue("Queue1");
@@ -237,7 +223,7 @@
public void testCreateNonExistentTopic() throws Exception
{
- Connection conn = cf.createConnection();
+ Connection conn = getConnectionFactory().createConnection();
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
try
{
@@ -253,7 +239,7 @@
public void testCreateTopicOnAQueueSession() throws Exception
{
- QueueConnection c = (QueueConnection)cf.createConnection();
+ QueueConnection c = (QueueConnection)getConnectionFactory().createConnection();
QueueSession s = c.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
try
@@ -270,7 +256,7 @@
public void testCreateTopicWhileQueueWithSameNameExists() throws Exception
{
- Connection conn = cf.createConnection();
+ Connection conn = getConnectionFactory().createConnection();
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
try
{
@@ -286,7 +272,7 @@
public void testCreateTopic() throws Exception
{
- Connection conn = cf.createConnection();
+ Connection conn = getConnectionFactory().createConnection();
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
Topic topic = sess.createTopic("Topic1");
@@ -338,7 +324,7 @@
public void testGetXAResource() throws Exception
{
- Connection conn = cf.createConnection();
+ Connection conn = getConnectionFactory().createConnection();
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
((XASession)sess).getXAResource();
@@ -348,7 +334,7 @@
public void testGetXAResource2() throws Exception
{
- XAConnection conn = cf.createXAConnection();
+ XAConnection conn = getConnectionFactory().createXAConnection();
XASession sess = conn.createXASession();
sess.getXAResource();
@@ -360,7 +346,7 @@
{
//IllegalStateException should be thrown if commit or rollback
//is invoked on a non transacted session
- Connection conn = cf.createConnection();
+ Connection conn = getConnectionFactory().createConnection();
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer prod = sess.createProducer(queue1);
@@ -396,7 +382,7 @@
public void testCreateTwoSessions() throws Exception
{
- Connection conn = cf.createConnection();
+ Connection conn = getConnectionFactory().createConnection();
Session sessionOne = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
assertFalse(sessionOne.getTransacted());
Session sessionTwo = conn.createSession(true, -1);
@@ -411,7 +397,7 @@
public void testCloseAndCreateSession() throws Exception
{
- Connection c = cf.createConnection();
+ Connection c = getConnectionFactory().createConnection();
Session s = c.createSession(false, Session.AUTO_ACKNOWLEDGE);
s.close();
@@ -428,12 +414,12 @@
{
// send a message to the queue
- Connection conn = cf.createConnection();
+ Connection conn = getConnectionFactory().createConnection();
Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
s.createProducer(queue1).send(s.createTextMessage("wont_ack"));
conn.close();
- conn = cf.createConnection();
+ conn = getConnectionFactory().createConnection();
s = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
conn.start();
@@ -458,12 +444,12 @@
{
// send a message to the queue
- Connection conn = cf.createConnection();
+ Connection conn = getConnectionFactory().createConnection();
Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
s.createProducer(queue1).send(s.createTextMessage("bex"));
conn.close();
- conn = cf.createConnection();
+ conn = getConnectionFactory().createConnection();
Session session = conn.createSession(true, -1);
conn.start();
@@ -485,7 +471,7 @@
// make sure I can still get the right message
- conn = cf.createConnection();
+ conn = getConnectionFactory().createConnection();
s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
conn.start();
TextMessage rm = (TextMessage)s.createConsumer(queue1).receive(1000);
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/TransactedSessionTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/TransactedSessionTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/TransactedSessionTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,21 +21,15 @@
*/
package org.jboss.test.messaging.jms;
-import javax.jms.Connection;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.management.ObjectName;
-
import org.jboss.jms.client.JBossConnection;
import org.jboss.jms.client.delegate.ClientConnectionDelegate;
import org.jboss.jms.client.state.ConnectionState;
import org.jboss.jms.tx.ResourceManager;
import org.jboss.jms.tx.ResourceManagerFactory;
-import org.jboss.test.messaging.tools.ServerManagement;
+import javax.jms.*;
+import javax.management.ObjectName;
+
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
*
@@ -163,7 +157,7 @@
s = conn.createSession(true, Session.SESSION_TRANSACTED);
MessageConsumer c = s.createConsumer(queue1);
conn.start();
- Message m = c.receive();
+ Message m = c.receive(2000);
assertEquals("one", ((TextMessage)m).getText());
assertFalse(m.getJMSRedelivered());
@@ -172,16 +166,16 @@
s.rollback();
// get the message again
- m = c.receive();
+ m = c.receive(2000);
assertTrue(m.getJMSRedelivered());
assertEquals(2, m.getIntProperty("JMSXDeliveryCount"));
conn.close();
ObjectName on = new ObjectName("jboss.messaging.destination:service=Queue,name=Queue1");
- Integer i = (Integer)ServerManagement.getAttribute(on, "MessageCount");
-
- assertEquals(1, i.intValue());
+ Integer i = getJmsServerStatistics().getMessageCountForQueue("Queue1");
+
+ assertEquals(1, i.intValue());
}
finally
{
@@ -599,7 +593,7 @@
conn.start();
- TextMessage tm = (TextMessage)cons.receive();
+ TextMessage tm = (TextMessage)cons.receive(2000);
assertEquals("a message", tm.getText());
@@ -613,7 +607,7 @@
cons = sess2.createConsumer(queue1);
- tm = (TextMessage)cons.receive();
+ tm = (TextMessage)cons.receive(2000);
assertEquals("a message", tm.getText());
@@ -647,7 +641,7 @@
sess.commit();
- TextMessage mRec = (TextMessage)consumer.receive();
+ TextMessage mRec = (TextMessage)consumer.receive(2000);
log.trace("Got 1");
assertNotNull(mRec);
assertEquals("igloo", mRec.getText());
@@ -660,14 +654,14 @@
sess.commit();
log.trace("Receiving 2");
- mRec = (TextMessage)consumer.receive();
+ mRec = (TextMessage)consumer.receive(2000);
log.trace("Received 2");
assertNotNull(mRec);
assertEquals("rollback", mRec.getText());
sess.rollback();
- TextMessage mRec2 = (TextMessage)consumer.receive();
+ TextMessage mRec2 = (TextMessage)consumer.receive(2000);
assertNotNull(mRec2);
assertEquals("rollback", mRec2.getText());
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,25 +21,14 @@
*/
package org.jboss.test.messaging.jms;
-import javax.jms.Connection;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.jms.XAConnection;
-import javax.jms.XASession;
-import javax.transaction.xa.XAResource;
-import javax.transaction.xa.Xid;
-
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.jta.xa.XidImple;
import org.jboss.jms.tx.MessagingXid;
import org.jboss.jms.tx.ResourceManagerFactory;
-import org.jboss.test.messaging.tools.ServerManagement;
-import org.jboss.test.messaging.tools.container.ServiceContainer;
-import com.arjuna.ats.arjuna.common.Uid;
-import com.arjuna.ats.jta.xa.XidImple;
+import javax.jms.*;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
/**
*
@@ -73,7 +62,7 @@
protected void setUp() throws Exception
{
// if this is not set testMockCoordinatorRecoveryWithJBossTSXids will create an invalid ObjectStore
- ServiceContainer.setupObjectStoreDir();
+ //ServiceContainer.setupObjectStoreDir();
super.setUp();
}
@@ -712,9 +701,9 @@
// Now "crash" the server
- ServerManagement.stopServerPeer();
+ stopServerPeer();
- ServerManagement.startServerPeer();
+ startServerPeer();
log.info("Restarted the server");
@@ -979,9 +968,9 @@
// Now "crash" the server
- ServerManagement.stopServerPeer();
+ stopServerPeer();
- ServerManagement.startServerPeer();
+ startServerPeer();
deployAndLookupAdministeredObjects();
@@ -1527,9 +1516,9 @@
// Now "crash" the server
- ServerManagement.stopServerPeer();
+ stopServerPeer();
- ServerManagement.startServerPeer();
+ startServerPeer();
deployAndLookupAdministeredObjects();
@@ -1826,9 +1815,9 @@
// Now "crash" the server
- ServerManagement.stopServerPeer();
+ stopServerPeer();
- ServerManagement.startServerPeer();
+ startServerPeer();
deployAndLookupAdministeredObjects();
@@ -2305,9 +2294,9 @@
// Now "crash" the server
- ServerManagement.stopServerPeer();
+ stopServerPeer();
- ServerManagement.startServerPeer();
+ startServerPeer();
deployAndLookupAdministeredObjects();
@@ -2529,9 +2518,9 @@
conn2 = null;
- ServerManagement.stopServerPeer();
+ stopServerPeer();
- ServerManagement.startServerPeer();
+ startServerPeer();
deployAndLookupAdministeredObjects();
@@ -2712,9 +2701,9 @@
//Now "crash" the server
- ServerManagement.stopServerPeer();
+ stopServerPeer();
- ServerManagement.startServerPeer();
+ startServerPeer();
deployAndLookupAdministeredObjects();
@@ -2872,9 +2861,9 @@
//Now "crash" the server
- ServerManagement.stopServerPeer();
+ stopServerPeer();
- ServerManagement.startServerPeer();
+ startServerPeer();
deployAndLookupAdministeredObjects();
@@ -3014,9 +3003,9 @@
//Now "crash" the server
- ServerManagement.stopServerPeer();
+ stopServerPeer();
- ServerManagement.startServerPeer();
+ startServerPeer();
deployAndLookupAdministeredObjects();
@@ -3158,9 +3147,9 @@
//Now "crash" the server
- ServerManagement.stopServerPeer();
+ stopServerPeer();
- ServerManagement.startServerPeer();
+ startServerPeer();
deployAndLookupAdministeredObjects();
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/XAResourceRecoveryTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/XAResourceRecoveryTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/XAResourceRecoveryTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,35 +21,21 @@
*/
package org.jboss.test.messaging.jms;
-import java.util.Hashtable;
-import java.util.Properties;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.XAConnection;
-import javax.jms.XASession;
-import javax.management.ObjectName;
-import javax.naming.InitialContext;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-import javax.transaction.xa.XAResource;
-
+import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple;
import org.jboss.jms.client.JBossConnectionFactory;
-import org.jboss.jms.jndi.JMSProviderAdapter;
import org.jboss.jms.tx.ResourceManagerFactory;
+import org.jboss.test.messaging.JBMServerTestCase;
import org.jboss.test.messaging.tools.ServerManagement;
-import org.jboss.test.messaging.tools.TestJMSProviderAdaptor;
import org.jboss.test.messaging.tools.aop.PoisonInterceptor;
-import org.jboss.test.messaging.tools.container.InVMInitialContextFactory;
import org.jboss.test.messaging.tools.container.ServiceContainer;
import org.jboss.tm.TxUtils;
-import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple;
+import javax.jms.*;
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import javax.transaction.xa.XAResource;
/**
*
@@ -61,7 +47,7 @@
* $Id$
*
*/
-public class XAResourceRecoveryTest extends JMSTestCase
+public class XAResourceRecoveryTest extends JBMServerTestCase
{
protected ServiceContainer sc;
@@ -82,35 +68,29 @@
{
super.setUp();
- // Now start another remote server
- ServerManagement.start(1, "all", false);
+ // Now startServerPeer another remote server
+ //ServerManagement.startServerPeer(1, "all", false);
ResourceManagerFactory.instance.clear();
// We need a local transaction and recovery manager
- // We must start this after the remote servers have been created or it
+ // We must startServerPeer this after the remote servers have been created or it
// won't
// have deleted the database and the recovery manager may attempt to
// recover transactions
- sc = new ServiceContainer("all");
- // Don't drop the tables again!
+ InitialContext localIc = getInitialContext();
- sc.start(false);
-
- InitialContext localIc = new InitialContext(InVMInitialContextFactory
- .getJNDIEnvironment());
-
tm = (TransactionManager) localIc
.lookup(ServiceContainer.TRANSACTION_MANAGER_JNDI_NAME);
assertTrue(tm instanceof TransactionManagerImple);
- ServerManagement.deployQueue("OtherQueue", 1);
+ deployQueue("OtherQueue");
- Hashtable props1 = ServerManagement.getJNDIEnvironment(1);
+ //Hashtable props1 = ServerManagement.getJNDIEnvironment(1);
- InitialContext ic1 = new InitialContext(props1);
+ InitialContext ic1 = getInitialContext();
cf1 = (JBossConnectionFactory) ic1.lookup("/XAConnectionFactory");
@@ -120,16 +100,16 @@
// Now install local JMSProviderAdaptor classes
- Properties p1 = new Properties();
- p1.putAll(ServerManagement.getJNDIEnvironment(1));
+ //Properties p1 = new Properties();
+ //p1.putAll(ServerManagement.getJNDIEnvironment(1));
- JMSProviderAdapter targetAdaptor = new TestJMSProviderAdaptor(p1,
+ /*JMSProviderAdapter targetAdaptor = new TestJMSProviderAdaptor(p1,
"/XAConnectionFactory", "adaptor1");
sc.installJMSProviderAdaptor("adaptor1", targetAdaptor);
+*/
+ //sc.startRecoveryManager();
- sc.startRecoveryManager();
-
suspendedTx = tm.suspend();
}
@@ -137,7 +117,7 @@
{
try
{
- ServerManagement.undeployQueue("OtherQueue", 1);
+ undeployQueue("OtherQueue", 1);
} catch (Exception ignore)
{
}
@@ -167,11 +147,11 @@
tm.resume(suspendedTx);
}
- sc.uninstallJMSProviderAdaptor("adaptor1");
+ /*sc.uninstallJMSProviderAdaptor("adaptor1");
sc.stopRecoveryManager();
- sc.stop();
+ sc.stopServerPeer();*/
// We explicitly clear the resource manager factory since the recovery
// manager will keep a connection open, and
@@ -194,7 +174,7 @@
try
{
- conn0 = cf.createXAConnection();
+ conn0 = getConnectionFactory().createXAConnection();
XASession sess0 = conn0.createXASession();
@@ -246,19 +226,19 @@
// Now restart the server
- ServerManagement.start(1, "all", false);
+ //ServerManagement.startServerPeer(1, "all", false);
- ServerManagement.deployQueue("OtherQueue", 1);
+ deployQueue("OtherQueue");
- Hashtable props1 = ServerManagement.getJNDIEnvironment(1);
+ //Hashtable props1 = ServerManagement.getJNDIEnvironment(1);
- InitialContext ic1 = new InitialContext(props1);
+ InitialContext ic1 = getInitialContext();
cf1 = (JBossConnectionFactory) ic1.lookup("/XAConnectionFactory");
otherQueue = (Queue) ic1.lookup("/queue/OtherQueue");
- conn2 = cf.createConnection();
+ conn2 = getConnectionFactory().createConnection();
Session sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -327,7 +307,7 @@
try
{
- conn0 = cf.createXAConnection();
+ conn0 = getConnectionFactory().createXAConnection();
XASession sess0 = conn0.createXASession();
@@ -403,19 +383,19 @@
// Now restart the server
- ServerManagement.start(1, "all", false);
+ //ServerManagement.startServerPeer(1, "all", false);
- ServerManagement.deployQueue("OtherQueue", 1);
+ deployQueue("OtherQueue");
- Hashtable props1 = ServerManagement.getJNDIEnvironment(1);
+ //Hashtable props1 = getInitialContext();
- InitialContext ic1 = new InitialContext(props1);
+ InitialContext ic1 = getInitialContext();
cf1 = (JBossConnectionFactory) ic1.lookup("/XAConnectionFactory");
otherQueue = (Queue) ic1.lookup("/queue/OtherQueue");
- conn2 = cf.createConnection();
+ conn2 = getConnectionFactory().createConnection();
sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/XATest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/XATest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/XATest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,49 +21,30 @@
*/
package org.jboss.test.messaging.jms;
-import java.util.ArrayList;
-
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.ServerSession;
-import javax.jms.ServerSessionPool;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.XAConnection;
-import javax.jms.XAConnectionFactory;
-import javax.jms.XASession;
-import javax.management.ObjectName;
-import javax.naming.InitialContext;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-import javax.transaction.xa.XAException;
-import javax.transaction.xa.XAResource;
-import javax.transaction.xa.Xid;
-
+import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple;
import org.jboss.jms.client.JBossConnection;
+import org.jboss.jms.client.JBossConnectionFactory;
import org.jboss.jms.client.JBossSession;
import org.jboss.jms.client.delegate.ClientConnectionDelegate;
import org.jboss.jms.client.delegate.DelegateSupport;
import org.jboss.jms.client.state.ConnectionState;
import org.jboss.jms.client.state.SessionState;
-import org.jboss.jms.tx.LocalTx;
-import org.jboss.jms.tx.MessagingXAResource;
-import org.jboss.jms.tx.MessagingXid;
-import org.jboss.jms.tx.ResourceManager;
-import org.jboss.jms.tx.ResourceManagerFactory;
+import org.jboss.jms.tx.*;
import org.jboss.logging.Logger;
+import org.jboss.test.messaging.JBMServerTestCase;
import org.jboss.test.messaging.tools.ServerManagement;
-import org.jboss.test.messaging.tools.container.InVMInitialContextFactory;
import org.jboss.test.messaging.tools.container.ServiceContainer;
import org.jboss.tm.TransactionManagerLocator;
import org.jboss.tm.TxUtils;
-import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple;
+import javax.jms.*;
+import javax.naming.InitialContext;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+import java.util.ArrayList;
/**
*
@@ -76,7 +57,7 @@
* $Id$
*
*/
-public class XATest extends JMSTestCase
+public class XATest extends JBMServerTestCase
{
// Constants -----------------------------------------------------
@@ -88,7 +69,7 @@
protected Transaction suspendedTx;
- protected ServiceContainer sc;
+ protected JBossConnectionFactory cf;
// Constructors --------------------------------------------------
@@ -103,19 +84,19 @@
public void setUp() throws Exception
{
super.setUp();
-
+ cf = getConnectionFactory();
ResourceManagerFactory.instance.clear();
//Also need a local tx mgr if test is running remote
if (ServerManagement.isRemote())
{
- sc = new ServiceContainer("transaction");
+ //sc = new ServiceContainer("transaction");
//Don't drop the tables again!
- sc.start(false);
+ //sc.startServerPeer(false);
}
- InitialContext localIc = new InitialContext(InVMInitialContextFactory.getJNDIEnvironment());
+ InitialContext localIc = getInitialContext();
tm = (TransactionManager)localIc.lookup(ServiceContainer.TRANSACTION_MANAGER_JNDI_NAME);
@@ -155,7 +136,7 @@
if (ServerManagement.isRemote())
{
- sc.stop();
+ //sc.stopServerPeer();
}
super.tearDown();
@@ -164,7 +145,7 @@
// Public --------------------------------------------------------
/* If there is no global tx present the send must behave as non transacted.
- * See http://www.jboss.com/index.html?module=bb&op=viewtopic&t=98577&postdays=0&postorder=asc&start=0
+ * See http://www.jboss.com/index.html?module=bb&op=viewtopic&t=98577&postdays=0&postorder=asc&startServerPeer=0
* http://jira.jboss.com/jira/browse/JBMESSAGING-410
* http://jira.jboss.com/jira/browse/JBMESSAGING-721
* http://jira.jboss.org/jira/browse/JBMESSAGING-946
@@ -232,7 +213,7 @@
*
* We are testing the exceptional case here without a global tx here
*
- * See http://www.jboss.com/index.html?module=bb&op=viewtopic&t=98577&postdays=0&postorder=asc&start=0
+ * See http://www.jboss.com/index.html?module=bb&op=viewtopic&t=98577&postdays=0&postorder=asc&startServerPeer=0
* http://jira.jboss.com/jira/browse/JBMESSAGING-410
* http://jira.jboss.com/jira/browse/JBMESSAGING-721
* http://jira.jboss.org/jira/browse/JBMESSAGING-946
@@ -257,8 +238,7 @@
XAConnection xaconn = null;
try
{
- ObjectName queueMBean = new ObjectName("jboss.messaging.destination:service=Queue,name=Queue1");
- Integer count = (Integer) ServerManagement.getAttribute(queueMBean, "MessageCount");
+ Integer count = getJmsServerStatistics().getMessageCountForQueue("Queue1");
assertEquals(1, count.intValue());
// using XA with a ConnectionConsumer (testing the transaction behavior under MDBs)
@@ -278,7 +258,7 @@
assertEquals(1, listener.messages.size());
// Message should still be on server
- count = (Integer) ServerManagement.getAttribute(queueMBean, "MessageCount");
+ count = getJmsServerStatistics().getMessageCountForQueue("Queue1");
assertEquals(1, count.intValue());
XAResource resource = xasession.getXAResource();
@@ -306,7 +286,7 @@
trans.commit();
// After commit the message should be consumed
- count = (Integer) ServerManagement.getAttribute(queueMBean, "MessageCount");
+ count = getJmsServerStatistics().getMessageCountForQueue("Queue1");
assertEquals(0, count.intValue());
}
finally
@@ -340,7 +320,7 @@
*
* We are testing the standard case without a global tx here
*
- * See http://www.jboss.com/index.html?module=bb&op=viewtopic&t=98577&postdays=0&postorder=asc&start=0
+ * See http://www.jboss.com/index.html?module=bb&op=viewtopic&t=98577&postdays=0&postorder=asc&startServerPeer=0
* http://jira.jboss.com/jira/browse/JBMESSAGING-410
* http://jira.jboss.com/jira/browse/JBMESSAGING-721
* http://jira.jboss.org/jira/browse/JBMESSAGING-946
@@ -364,8 +344,7 @@
try
{
- ObjectName queueMBean = new ObjectName("jboss.messaging.destination:service=Queue,name=Queue1");
- Integer count = (Integer)ServerManagement.getAttribute(queueMBean, "MessageCount");
+ Integer count = getJmsServerStatistics().getMessageCountForQueue("Queue1");
assertEquals(1, count.intValue());
XAConnectionFactory xcf = (XAConnectionFactory)cf;
@@ -384,7 +363,7 @@
assertEquals("one", rm.getText());
// messages should be acked
- count = (Integer)ServerManagement.getAttribute(queueMBean, "MessageCount");
+ count = getJmsServerStatistics().getMessageCountForQueue("Queue1");
assertEquals(0, count.intValue());
xconn.close();
@@ -417,7 +396,7 @@
*
* We are testing the case with a global tx here
*
- * See http://www.jboss.com/index.html?module=bb&op=viewtopic&t=98577&postdays=0&postorder=asc&start=0
+ * See http://www.jboss.com/index.html?module=bb&op=viewtopic&t=98577&postdays=0&postorder=asc&startServerPeer=0
* http://jira.jboss.com/jira/browse/JBMESSAGING-410
* http://jira.jboss.com/jira/browse/JBMESSAGING-721
* http://jira.jboss.org/jira/browse/JBMESSAGING-946
@@ -439,8 +418,7 @@
p.send(m);
conn.close();
- ObjectName queueMBean = new ObjectName("jboss.messaging.destination:service=Queue,name=Queue1");
- Integer count = (Integer)ServerManagement.getAttribute(queueMBean, "MessageCount");
+ Integer count = getJmsServerStatistics().getMessageCountForQueue("Queue1");
assertEquals(1, count.intValue());
tm.begin();
@@ -469,7 +447,7 @@
assertNull(consumer.receive(1000));
- count = (Integer)ServerManagement.getAttribute(queueMBean, "MessageCount");
+ count = getJmsServerStatistics().getMessageCountForQueue("Queue1");
assertEquals(1, count.intValue());
@@ -487,12 +465,12 @@
assertEquals("one", messageReceived.getText());
- count = (Integer)ServerManagement.getAttribute(queueMBean, "MessageCount");
+ count = getJmsServerStatistics().getMessageCountForQueue("Queue1");
assertEquals(1, count.intValue());
trans.commit();
- count = (Integer)ServerManagement.getAttribute(queueMBean, "MessageCount");
+ count = getJmsServerStatistics().getMessageCountForQueue("Queue1");
assertEquals(0, count.intValue());
}
@@ -537,8 +515,7 @@
p.send(m);
conn.close();
- ObjectName queueMBean = new ObjectName("jboss.messaging.destination:service=Queue,name=Queue1");
- Integer count = (Integer)ServerManagement.getAttribute(queueMBean, "MessageCount");
+ Integer count = getJmsServerStatistics().getMessageCountForQueue("Queue1");
assertEquals(2, count.intValue());
XAConnectionFactory xacf = (XAConnectionFactory)cf;
@@ -569,7 +546,7 @@
// So.. keep this close commented!
//xasession.close();
- count = (Integer)ServerManagement.getAttribute(queueMBean, "MessageCount");
+ count = getJmsServerStatistics().getMessageCountForQueue("Queue1");
assertEquals(0, count.intValue());
}
finally
@@ -717,8 +694,7 @@
//First send some messages to a queue
- ObjectName queueMBean = new ObjectName("jboss.messaging.destination:service=Queue,name=Queue1");
- Integer count = (Integer) ServerManagement.getAttribute(queueMBean, "MessageCount");
+ Integer count = getJmsServerStatistics().getMessageCountForQueue("Queue1");
assertEquals(0, count.intValue());
conn = cf.createConnection();
@@ -735,7 +711,7 @@
prod.send(tm2);
- count = (Integer) ServerManagement.getAttribute(queueMBean, "MessageCount");
+ count = getJmsServerStatistics().getMessageCountForQueue("Queue1");
assertEquals(2, count.intValue());
xaConn = cf.createXAConnection();
@@ -759,7 +735,7 @@
assertEquals("message1", ((TextMessage)(listener.messages.get(0))).getText());
assertEquals("message2", ((TextMessage)(listener.messages.get(1))).getText());
- count = (Integer) ServerManagement.getAttribute(queueMBean, "MessageCount");
+ count = getJmsServerStatistics().getMessageCountForQueue("Queue1");
assertEquals(2, count.intValue());
listener.messages.clear();
@@ -791,7 +767,7 @@
//Now rollback the tx - this should cause redelivery of the two messages
tm.rollback();
- count = (Integer) ServerManagement.getAttribute(queueMBean, "MessageCount");
+ count = getJmsServerStatistics().getMessageCountForQueue("Queue1");
assertEquals(2, count.intValue());
Thread.sleep(1000);
@@ -811,7 +787,7 @@
assertEquals(0, listener.messages.size());
- count = (Integer) ServerManagement.getAttribute(queueMBean, "MessageCount");
+ count = getJmsServerStatistics().getMessageCountForQueue("Queue1");
assertEquals(0, count.intValue());
assertNull(tm.getTransaction());
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/bridge/BridgeMBeanTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/bridge/BridgeMBeanTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/bridge/BridgeMBeanTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,23 +21,16 @@
*/
package org.jboss.test.messaging.jms.bridge;
-import java.io.ByteArrayOutputStream;
-import java.util.Properties;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.Destination;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.management.ObjectName;
-import javax.naming.InitialContext;
-
import org.jboss.jms.server.bridge.Bridge;
import org.jboss.logging.Logger;
import org.jboss.test.messaging.tools.ServerManagement;
+import javax.jms.*;
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+import java.io.ByteArrayOutputStream;
+import java.util.Properties;
+
/**
* A BridgeMBeanTest
*
@@ -142,7 +135,7 @@
//Start it
log.info("Starting bridge");
- ServerManagement.getServer(0).invoke(on, "start", new Object[0], new String[0]);
+ ServerManagement.getServer(0).invoke(on, "startServerPeer", new Object[0], new String[0]);
log.info("Started bridge");
//Now should receive the messages
@@ -224,7 +217,7 @@
//Stop
- ServerManagement.getServer(0).invoke(on, "stop", new Object[0], new String[0]);
+ ServerManagement.getServer(0).invoke(on, "stopServerPeer", new Object[0], new String[0]);
boolean isStarted = ((Boolean)ServerManagement.getAttribute(on, "Started")).booleanValue();
@@ -246,7 +239,7 @@
{
if (on != null)
{
- ServerManagement.getServer(0).invoke(on, "stop", new Object[0], new String[0]);
+ ServerManagement.getServer(0).invoke(on, "stopServerPeer", new Object[0], new String[0]);
ServerManagement.getServer(0).invoke(on, "destroy", new Object[0], new String[0]);
}
}
@@ -420,9 +413,9 @@
ServerManagement.setAttribute(on, "MaxRetries", "-1");
}
- ServerManagement.getServer(0).invoke(on, "start", new Object[0], new String[0]);
+ ServerManagement.getServer(0).invoke(on, "startServerPeer", new Object[0], new String[0]);
- //Should not be able to change attributes when bridge is started - need to stop first
+ //Should not be able to change attributes when bridge is started - need to stopServerPeer first
{
ObjectName sourceProviderLoader2 = (ObjectName)ServerManagement.getAttribute(on, "SourceProviderLoader");
@@ -557,8 +550,8 @@
props1.putAll(ServerManagement.getJNDIEnvironment(0));
Properties props2 = new Properties();
props2.putAll(ServerManagement.getJNDIEnvironment(1));
- InitialContext icSource = new InitialContext(props1);
- InitialContext icTarget = new InitialContext(props2);
+ InitialContext icSource = getInitialContext(0);
+ InitialContext icTarget = getInitialContext(1);
log.trace("Checking bridged bridge");
@@ -574,7 +567,7 @@
{
if (on != null)
{
- ServerManagement.getServer(0).invoke(on, "stop", new Object[0], new String[0]);
+ ServerManagement.getServer(0).invoke(on, "stopServerPeer", new Object[0], new String[0]);
ServerManagement.getServer(0).invoke(on, "destroy", new Object[0], new String[0]);
}
}
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,32 +21,18 @@
*/
package org.jboss.test.messaging.jms.bridge;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Set;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.DeliveryMode;
-import javax.jms.Destination;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.naming.InitialContext;
-
-import org.jboss.jms.server.bridge.Bridge;
-import org.jboss.jms.server.bridge.ConnectionFactoryFactory;
-import org.jboss.jms.server.bridge.DestinationFactory;
-import org.jboss.jms.server.bridge.JNDIConnectionFactoryFactory;
-import org.jboss.jms.server.bridge.JNDIDestinationFactory;
+import org.jboss.jms.server.bridge.*;
import org.jboss.logging.Logger;
-import org.jboss.test.messaging.MessagingTestCase;
+import org.jboss.test.messaging.JBMServerTestCase;
import org.jboss.test.messaging.tools.ServerManagement;
import org.jboss.test.messaging.tools.container.ServiceContainer;
+import javax.jms.*;
+import javax.naming.InitialContext;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Set;
+
/**
*
* A BridgeTestBase
@@ -57,7 +43,7 @@
* $Id$
*
*/
-public class BridgeTestBase extends MessagingTestCase
+public class BridgeTestBase extends JBMServerTestCase
{
private static final Logger log = Logger.getLogger(BridgeTestBase.class);
@@ -88,26 +74,24 @@
{
//Start the servers
- ServerManagement.start(0, "all", true);
+ //ServerManagement.startServerPeer(0, "all", true);
- ServerManagement.start(1, "all", false);
+ //ServerManagement.startServerPeer(1, "all", false);
- ServerManagement.deployQueue("sourceQueue", 0);
+ deployQueue("sourceQueue", 0);
- ServerManagement.deployTopic("sourceTopic", 0);
+ deployTopic("sourceTopic", 0);
- ServerManagement.deployQueue("localTargetQueue", 0);
+ deployQueue("localTargetQueue", 0);
- ServerManagement.deployQueue("targetQueue", 1);
+ deployQueue("targetQueue", 1);
setUpAdministeredObjects();
//We need a local transaction and recovery manager
- //We must start this after the remote servers have been created or it won't
+ //We must startServerPeer this after the remote servers have been created or it won't
//have deleted the database and the recovery manager may attempt to recover transactions
- sc = new ServiceContainer("transaction");
-
- sc.start(false);
+
firstTime = false;
}
@@ -141,9 +125,9 @@
cff1 = new JNDIConnectionFactoryFactory(props1, "/ConnectionFactory");
- ic0 = new InitialContext(props0);
+ ic0 = getInitialContext(0);
- ic1 = new InitialContext(props1);
+ ic1 = getInitialContext(1);
cf0 = (ConnectionFactory)ic0.lookup("/ConnectionFactory");
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/bridge/ReconnectTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/bridge/ReconnectTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/bridge/ReconnectTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -110,7 +110,7 @@
assertTrue(bridge.isFailed());
ServerManagement.start(1, "all", false);
- ServerManagement.deployQueue("targetQueue", 1);
+ deployQueue("targetQueue", 1);
setUpAdministeredObjects();
Thread.sleep(3000);
@@ -126,7 +126,7 @@
}
catch (Exception e)
{
- log.error("Failed to stop bridge", e);
+ log.error("Failed to stopServerPeer bridge", e);
}
}
}
@@ -179,7 +179,7 @@
ServerManagement.start(1, "all", false);
- ServerManagement.deployQueue("targetQueue", 1);
+ deployQueue("targetQueue", 1);
setUpAdministeredObjects();
@@ -204,7 +204,7 @@
}
catch (Exception e)
{
- log.error("Failed to stop bridge", e);
+ log.error("Failed to stopServerPeer bridge", e);
}
}
}
@@ -256,7 +256,7 @@
ServerManagement.start(1, "all", false);
- ServerManagement.deployQueue("targetQueue", 1);
+ deployQueue("targetQueue", 1);
setUpAdministeredObjects();
@@ -275,7 +275,7 @@
}
catch (Exception e)
{
- log.error("Failed to stop bridge", e);
+ log.error("Failed to stopServerPeer bridge", e);
}
}
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/bridge/ReconnectWithRecoveryTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/bridge/ReconnectWithRecoveryTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/bridge/ReconnectWithRecoveryTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,15 +21,13 @@
*/
package org.jboss.test.messaging.jms.bridge;
-import java.util.Properties;
-
-import org.jboss.jms.jndi.JMSProviderAdapter;
import org.jboss.jms.server.bridge.Bridge;
import org.jboss.logging.Logger;
import org.jboss.test.messaging.tools.ServerManagement;
-import org.jboss.test.messaging.tools.TestJMSProviderAdaptor;
import org.jboss.test.messaging.tools.aop.PoisonInterceptor;
+import java.util.Properties;
+
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @version <tt>$Revision: 1.1 $</tt>
@@ -55,21 +53,21 @@
Properties props1 = new Properties();
props1.putAll(ServerManagement.getJNDIEnvironment(1));
- JMSProviderAdapter targetAdaptor =
+ /*JMSProviderAdapter targetAdaptor =
new TestJMSProviderAdaptor(props1, "/XAConnectionFactory", "adaptor1");
sc.installJMSProviderAdaptor("adaptor1", targetAdaptor);
- sc.startRecoveryManager();
+ sc.startRecoveryManager();*/
}
protected void tearDown() throws Exception
{
super.tearDown();
- sc.stopRecoveryManager();
+ /*sc.stopRecoveryManager();
- sc.uninstallJMSProviderAdaptor("adaptor1");
+ sc.uninstallJMSProviderAdaptor("adaptor1");*/
log.debug(this + " torn down");
}
@@ -123,7 +121,7 @@
log.info("Restarted server");
- ServerManagement.deployQueue("targetQueue", 1);
+ deployQueue("targetQueue", 1);
this.setUpAdministeredObjects();
@@ -144,7 +142,7 @@
}
catch (Exception e)
{
- log.error("Failed to stop bridge", e);
+ log.error("Failed to stopServerPeer bridge", e);
}
}
}
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/ChangeFailoverNodeTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/ChangeFailoverNodeTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/ChangeFailoverNodeTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -22,20 +22,15 @@
package org.jboss.test.messaging.jms.clustering;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.jms.Connection;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
import org.jboss.jms.client.FailoverEvent;
import org.jboss.jms.client.JBossConnection;
import org.jboss.jms.client.JBossConnectionFactory;
import org.jboss.test.messaging.tools.ServerManagement;
+import javax.jms.*;
+import java.util.Iterator;
+import java.util.Map;
+
/**
*
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -171,7 +166,7 @@
assertNotNull(ids);
assertEquals(numMessages, ids.size());
- // Now kill/stop the failover node
+ // Now kill/stopServerPeer the failover node
log.info("killing/stoppin node " + failoverNodeId);
if (failoverNodeId != 0)
@@ -242,7 +237,7 @@
ServerManagement.start(4, "all", false);
- ServerManagement.deployQueue("testDistributedQueue", 4);
+ deployQueue("testDistributedQueue", 4);
Thread.sleep(8000);
@@ -409,7 +404,7 @@
ServerManagement.start(4, "all", false);
- ServerManagement.deployQueue("testDistributedQueue", 4);
+ deployQueue("testDistributedQueue", 4);
Thread.sleep(8000);
@@ -744,7 +739,7 @@
// Don't ack
- // We stop the failover node for node 1
+ // We stopServerPeer the failover node for node 1
int failoverNodeId = this.getFailoverNodeForNode(factory, 1);
int recoveryMapSize = ServerManagement.getServer(failoverNodeId)
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/ClusterConnectionManagerTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/ClusterConnectionManagerTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/ClusterConnectionManagerTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -22,17 +22,8 @@
package org.jboss.test.messaging.jms.clustering;
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.management.ObjectName;
+import javax.jms.*;
-import org.jboss.test.messaging.tools.ServerManagement;
-
/**
*
* We test every combination of the order of deployment of connection factory, local and remote queue
@@ -298,12 +289,10 @@
private void undeployAll() throws Exception
{
- ServerManagement.undeployQueue("suckQueue", 0);
+ undeployQueue("suckQueue", 0);
- ServerManagement.undeployQueue("suckQueue", 1);
-
- String cfName =
- (String)ServerManagement.getServer(1).getAttribute(ServerManagement.getServerPeerObjectName(), "ClusterPullConnectionFactoryName");
+ undeployQueue("suckQueue", 1);
+ String cfName = getJmsServer().getConfiguration().getClusterPullConnectionFactoryName();
log.info("CF name is " + cfName);
@@ -311,48 +300,48 @@
//undeploy cf on node 0
try
{
- ServerManagement.getServer(0).undeployConnectionFactory(new ObjectName(cfName));
+ undeployConnectionFactory(0,cfName);
}
catch (Exception ignore)
- {}
+ {
+ //ignore.printStackTrace();
+ }
//undeploy cf on node 0
try
{
- ServerManagement.getServer(1).undeployConnectionFactory(new ObjectName(cfName));
+ undeployConnectionFactory(1, cfName);
}
catch (Exception ignore)
- {}
+ {
+ //ignore.printStackTrace();
+ }
}
// Private --------------------------------------------------------------------------------------
private void deployCFRemote() throws Exception
{
- String cfName =
- (String)ServerManagement.getServer(1).getAttribute(ServerManagement.getServerPeerObjectName(), "ClusterPullConnectionFactoryName");
-
+ String cfName = getJmsServer().getConfiguration().getClusterPullConnectionFactoryName();
//Deploy cf on node 1
- ServerManagement.getServer(1).deployConnectionFactory(cfName, null, 150);
+ deployConnectionFactory(1, cfName, null, 150);
}
private void deployCFLocal() throws Exception
{
- String cfName =
- (String)ServerManagement.getServer(0).getAttribute(ServerManagement.getServerPeerObjectName(), "ClusterPullConnectionFactoryName");
-
+ String cfName = getJmsServer().getConfiguration().getClusterPullConnectionFactoryName();
//Deploy cf on node 0
- ServerManagement.getServer(0).deployConnectionFactory(cfName, null, 150);
+ deployConnectionFactory(0,cfName, null, 150);
}
private void deployLocal() throws Exception
{
- ServerManagement.deployQueue("suckQueue", 0);
+ deployQueue("suckQueue", 0);
}
private void deployRemote() throws Exception
{
- ServerManagement.deployQueue("suckQueue", 1);
+ deployQueue("suckQueue", 1);
}
private void suck() throws Exception
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/ClusterViewUpdateTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/ClusterViewUpdateTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/ClusterViewUpdateTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -22,9 +22,6 @@
package org.jboss.test.messaging.jms.clustering;
-import javax.jms.Connection;
-import javax.jms.Session;
-
import org.jboss.jms.client.JBossConnectionFactory;
import org.jboss.jms.client.delegate.ClientClusteredConnectionFactoryDelegate;
import org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate;
@@ -32,6 +29,9 @@
import org.jboss.jms.delegate.TopologyResult;
import org.jboss.test.messaging.tools.ServerManagement;
+import javax.jms.Connection;
+import javax.jms.Session;
+
/**
* @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
* @version <tt>$Revision$</tt>
@@ -108,7 +108,7 @@
// // Using a separate block, as everything on this block has to be released (no references from the method)
// {
// Connection conn = cf.createConnection();
-// conn.start();
+// conn.startServerPeer();
// Session session = conn.createSession(true, Session.SESSION_TRANSACTED);
// MessageProducer prod = session.createProducer(queue[0]);
// MessageConsumer cons = session.createConsumer(queue[0]);
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/DisableLoadBalancingAndFailoverTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/DisableLoadBalancingAndFailoverTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/DisableLoadBalancingAndFailoverTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -6,21 +6,12 @@
*/
package org.jboss.test.messaging.jms.clustering;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.management.ObjectName;
-
+import EDU.oswego.cs.dl.util.concurrent.Latch;
import org.jboss.jms.client.FailoverEvent;
import org.jboss.jms.client.JBossConnection;
import org.jboss.test.messaging.tools.ServerManagement;
-import EDU.oswego.cs.dl.util.concurrent.Latch;
+import javax.jms.*;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -421,7 +412,7 @@
{
try
{
- ServerManagement.getServer(0).undeployConnectionFactory(new ObjectName("org.jboss.messaging:service=LBConnectionFactory"));
+ undeployConnectionFactory("LBConnectionFactory");
}
catch (Exception ignore)
{
@@ -429,7 +420,7 @@
try
{
- ServerManagement.getServer(1).undeployConnectionFactory(new ObjectName("org.jboss.messaging:service=LBConnectionFactory"));
+ undeployConnectionFactory("LBConnectionFactory");
}
catch (Exception ignore)
{
@@ -437,7 +428,7 @@
try
{
- ServerManagement.getServer(2).undeployConnectionFactory(new ObjectName("org.jboss.messaging:service=LBConnectionFactory"));
+ undeployConnectionFactory("LBConnectionFactory");
}
catch (Exception ignore)
{
@@ -445,7 +436,7 @@
try
{
- ServerManagement.getServer(0).undeployConnectionFactory(new ObjectName("org.jboss.messaging:service=FOConnectionFactory"));
+ undeployConnectionFactory("FOConnectionFactory");
}
catch (Exception ignore)
{
@@ -453,7 +444,7 @@
try
{
- ServerManagement.getServer(1).undeployConnectionFactory(new ObjectName("org.jboss.messaging:service=FOConnectionFactory"));
+ undeployConnectionFactory("FOConnectionFactory");
}
catch (Exception ignore)
{
@@ -461,7 +452,7 @@
try
{
- ServerManagement.getServer(2).undeployConnectionFactory(new ObjectName("org.jboss.messaging:service=FOConnectionFactory"));
+ undeployConnectionFactory("org.jboss.messaging:service=FOConnectionFactory");
}
catch (Exception ignore)
{
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/DistributedQueueTestBase.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/DistributedQueueTestBase.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/DistributedQueueTestBase.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,23 +21,11 @@
*/
package org.jboss.test.messaging.jms.clustering;
+import javax.jms.*;
import java.util.HashSet;
import java.util.Set;
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import org.jboss.test.messaging.tools.ServerManagement;
-import org.jboss.jms.message.JBossMessage;
-import org.jboss.jms.message.TextMessageProxy;
-
-
/**
*
* A DistributedQueueTest
@@ -715,7 +703,7 @@
msgs.clear();
- //as above but start consumers AFTER sending
+ //as above but startServerPeer consumers AFTER sending
cons1.close();
@@ -982,11 +970,11 @@
try
{
- ServerManagement.deployQueue("nonClusteredQueue", "nonClusteredQueue", 200000, 2000, 2000, 0, false);
+ deployQueue("nonClusteredQueue", "nonClusteredQueue", 200000, 2000, 2000, 0, false);
- ServerManagement.deployQueue("nonClusteredQueue", "nonClusteredQueue", 200000, 2000, 2000, 1, false);
+ deployQueue("nonClusteredQueue", "nonClusteredQueue", 200000, 2000, 2000, 1, false);
- ServerManagement.deployQueue("nonClusteredQueue", "nonClusteredQueue", 200000, 2000, 2000, 2, false);
+ deployQueue("nonClusteredQueue", "nonClusteredQueue", 200000, 2000, 2000, 2, false);
Queue queue0 = (Queue)ic[0].lookup("/nonClusteredQueue");
Queue queue1 = (Queue)ic[1].lookup("/nonClusteredQueue");
@@ -1187,11 +1175,11 @@
conn2.close();
}
- ServerManagement.undeployQueue("nonClusteredQueue", 0);
+ undeployQueue("nonClusteredQueue", 0);
- ServerManagement.undeployQueue("nonClusteredQueue", 1);
+ undeployQueue("nonClusteredQueue", 1);
- ServerManagement.undeployQueue("nonClusteredQueue", 2);
+ undeployQueue("nonClusteredQueue", 2);
}
}
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/DistributedTopicTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/DistributedTopicTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/DistributedTopicTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,17 +21,7 @@
*/
package org.jboss.test.messaging.jms.clustering;
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.InvalidDestinationException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-
-import org.jboss.test.messaging.tools.ServerManagement;
+import javax.jms.*;
import java.util.ArrayList;
@@ -257,11 +247,11 @@
super.setUp();
- ServerManagement.deployTopic("nonClusteredTopic", "nonClusteredTopic", 300000, 3000, 3000, 0, false);
+ deployTopic("nonClusteredTopic", "nonClusteredTopic", 300000, 3000, 3000, 0, false);
- ServerManagement.deployTopic("nonClusteredTopic", "nonClusteredTopic", 300000, 3000, 3000, 1, false);
+ deployTopic("nonClusteredTopic", "nonClusteredTopic", 300000, 3000, 3000, 1, false);
- ServerManagement.deployTopic("nonClusteredTopic", "nonClusteredTopic", 300000, 3000, 3000, 2, false);
+ deployTopic("nonClusteredTopic", "nonClusteredTopic", 300000, 3000, 3000, 2, false);
}
protected void tearDown() throws Exception
@@ -270,7 +260,7 @@
try
{
- ServerManagement.undeployTopic("nonClusteredTopic", 0);
+ undeployTopic("nonClusteredTopic", 0);
}
catch (Exception ignore)
{
@@ -278,7 +268,7 @@
try
{
- ServerManagement.undeployTopic("nonClusteredTopic", 1);
+ undeployTopic("nonClusteredTopic", 1);
}
catch (Exception ignore)
{
@@ -286,7 +276,7 @@
try
{
- ServerManagement.undeployTopic("nonClusteredTopic", 2);
+ undeployTopic("nonClusteredTopic", 2);
}
catch (Exception ignore)
{
@@ -1437,11 +1427,11 @@
conn2.close();
}
- ServerManagement.undeployQueue("nonClusteredTopic", 0);
+ undeployQueue("nonClusteredTopic", 0);
- ServerManagement.undeployQueue("nonClusteredTopic", 1);
+ undeployQueue("nonClusteredTopic", 1);
- ServerManagement.undeployQueue("nonClusteredTopic", 2);
+ undeployQueue("nonClusteredTopic", 2);
}
}
@@ -1672,11 +1662,11 @@
conn2.close();
}
- ServerManagement.undeployQueue("nonClusteredTopic", 0);
+ undeployQueue("nonClusteredTopic", 0);
- ServerManagement.undeployQueue("nonClusteredTopic", 1);
+ undeployQueue("nonClusteredTopic", 1);
- ServerManagement.undeployQueue("nonClusteredTopic", 2);
+ undeployQueue("nonClusteredTopic", 2);
}
}
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -6,20 +6,6 @@
*/
package org.jboss.test.messaging.jms.clustering;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.DeliveryMode;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.QueueBrowser;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
import org.jboss.jms.client.FailoverEvent;
import org.jboss.jms.client.JBossConnection;
import org.jboss.jms.client.delegate.ClientConnectionDelegate;
@@ -27,6 +13,11 @@
import org.jboss.test.messaging.tools.ServerManagement;
import org.jboss.test.messaging.tools.aop.PoisonInterceptor;
+import javax.jms.*;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Set;
+
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
* @version <tt>$Revision$</tt>
@@ -276,7 +267,7 @@
MessageConsumer cons = session.createConsumer(queue[1]);
MessageProducer prod = session.createProducer(queue[1]);
- // start the connection, so the message makes it to the client-side MessageCallbackHandler
+ // startServerPeer the connection, so the message makes it to the client-side MessageCallbackHandler
// buffer
conn.start();
@@ -1177,7 +1168,7 @@
}
}
- // start to receive the very next moment the failure is detected. This way, we also
+ // startServerPeer to receive the very next moment the failure is detected. This way, we also
// test the client-side failover valve
TextMessage tm = (TextMessage)cons.receive(60000);
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/GroupManagementTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/GroupManagementTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/GroupManagementTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -6,20 +6,19 @@
*/
package org.jboss.test.messaging.jms.clustering;
-import java.util.Set;
+import org.jboss.test.messaging.JBMServerTestCase;
+import org.jboss.test.messaging.tools.ServerManagement;
import javax.management.ObjectName;
+import java.util.Set;
-import org.jboss.test.messaging.MessagingTestCase;
-import org.jboss.test.messaging.tools.ServerManagement;
-
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
* @version <tt>$Revision$</tt>
*
* $Id$
*/
-public class GroupManagementTest extends MessagingTestCase
+public class GroupManagementTest extends JBMServerTestCase
{
// Constants -----------------------------------------------------
@@ -34,13 +33,18 @@
super(name);
}
+ public int getServerCount()
+ {
+ return super.getServerCount();
+ }
+
// Public --------------------------------------------------------
public void testOneNodeCluster() throws Exception
{
try
{
- ServerManagement.start(0, "all");
+ //ServerManagement.startServerPeer(0, "all");
Set view = ServerManagement.getServer(0).getNodeIDView();
assertEquals(1, view.size());
@@ -59,13 +63,13 @@
try
{
- ServerManagement.start(0, "all");
+ //ServerManagement.startServerPeer(0, "all");
log.info("Started server 0");
ServerManagement.addNotificationListener(0, postOfficeObjectName, listener);
- ServerManagement.start(1, "all");
+ //ServerManagement.startServerPeer(1, "all");
log.info("Blocking to receive notification ...");
@@ -91,13 +95,13 @@
{
try
{
- ServerManagement.start(0, "all");
+ //ServerManagement.startServerPeer(0, "all");
Set view = ServerManagement.getServer(0).getNodeIDView();
assertEquals(1, view.size());
assertTrue(view.contains(new Integer(0)));
- ServerManagement.start(1, "all");
+ //ServerManagement.startServerPeer(1, "all");
view = ServerManagement.getServer(0).getNodeIDView();
assertEquals(2, view.size());
@@ -121,13 +125,13 @@
{
try
{
- ServerManagement.start(0, "all");
+ //ServerManagement.startServerPeer(0, "all");
Set view = ServerManagement.getServer(0).getNodeIDView();
assertEquals(1, view.size());
assertTrue(view.contains(new Integer(0)));
- ServerManagement.start(1, "all");
+ //ServerManagement.startServerPeer(1, "all");
view = ServerManagement.getServer(0).getNodeIDView();
assertEquals(2, view.size());
@@ -139,7 +143,7 @@
assertTrue(view.contains(new Integer(0)));
assertTrue(view.contains(new Integer(1)));
- ServerManagement.start(3, "all");
+ //ServerManagement.startServerPeer(3, "all");
view = ServerManagement.getServer(0).getNodeIDView();
assertEquals(3, view.size());
@@ -172,9 +176,9 @@
{
try
{
- ServerManagement.start(0, "all");
- ServerManagement.start(1, "all");
- ServerManagement.start(2, "all");
+ //ServerManagement.startServerPeer(0, "all");
+ //ServerManagement.startServerPeer(1, "all");
+ //ServerManagement.startServerPeer(2, "all");
Set view = ServerManagement.getServer(0).getNodeIDView();
assertEquals(3, view.size());
@@ -199,9 +203,9 @@
assertEquals(1, view.size());
assertTrue(view.contains(new Integer(1)));
- // Reuse the "hollow" RMI server 0 to start another cluster node
+ // Reuse the "hollow" RMI server 0 to startServerPeer another cluster node
- ServerManagement.start(0, "all");
+ //ServerManagement.startServerPeer(0, "all");
view = ServerManagement.getServer(0).getNodeIDView();
assertEquals(2, view.size());
@@ -209,9 +213,9 @@
assertTrue(view.contains(new Integer(1)));
- // Reuse the "hollow" RMI server 2 to start another cluster node
+ // Reuse the "hollow" RMI server 2 to startServerPeer another cluster node
- ServerManagement.start(2, "all");
+ //ServerManagement.startServerPeer(2, "all");
view = ServerManagement.getServer(2).getNodeIDView();
assertEquals(3, view.size());
@@ -237,8 +241,8 @@
{
// Start with a 2 node cluster
- ServerManagement.start(0, "all");
- ServerManagement.start(1, "all");
+ //ServerManagement.startServerPeer(0, "all");
+ //ServerManagement.startServerPeer(1, "all");
Set view = ServerManagement.getServer(0).getNodeIDView();
assertEquals(2, view.size());
@@ -283,9 +287,9 @@
{
// Start with a 3 node cluster
- ServerManagement.start(0, "all");
- ServerManagement.start(1, "all");
- ServerManagement.start(2, "all");
+ //ServerManagement.startServerPeer(0, "all");
+ //ServerManagement.startServerPeer(1, "all");
+ //ServerManagement.startServerPeer(2, "all");
Set view = ServerManagement.getServer(0).getNodeIDView();
assertEquals(3, view.size());
@@ -358,7 +362,7 @@
{
// Start with a 1 node cluster
- ServerManagement.start(0, "all");
+ //ServerManagement.startServerPeer(0, "all");
Set view = ServerManagement.getServer(0).getNodeIDView();
assertEquals(1, view.size());
@@ -366,8 +370,8 @@
ServerManagement.addNotificationListener(0, postOfficeObjectName, clusterEvent);
- // start the ninth node, as there is no chance to be started by scripts
- ServerManagement.start(9, "all");
+ // startServerPeer the ninth node, as there is no chance to be started by scripts
+ //ServerManagement.startServerPeer(9, "all");
if (!clusterEvent.viewChanged(30000))
{
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/LargeClusterTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/LargeClusterTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/LargeClusterTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -6,21 +6,15 @@
*/
package org.jboss.test.messaging.jms.clustering;
-import java.util.Set;
-
-import javax.jms.Connection;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.management.ObjectName;
-
+import EDU.oswego.cs.dl.util.concurrent.Slot;
import org.jboss.jms.client.JBossConnection;
import org.jboss.jms.client.delegate.ClientConnectionDelegate;
import org.jboss.jms.tx.ResourceManagerFactory;
import org.jboss.test.messaging.tools.ServerManagement;
-import EDU.oswego.cs.dl.util.concurrent.Slot;
+import javax.jms.*;
+import javax.management.ObjectName;
+import java.util.Set;
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
@@ -69,7 +63,7 @@
ServerManagement.addNotificationListener(4, postOfficeObjectName, clusterEvent);
- // We start programatically the eighth node.
+ // We startServerPeer programatically the eighth node.
ServerManagement.start(7, "all", false);
@@ -258,8 +252,8 @@
// We get the first node to re-join
ServerManagement.start(0, "all", false);
- ServerManagement.deployQueue("testDistributedQueue", 0);
- ServerManagement.deployTopic("testDistributedTopic", 0);
+ deployQueue("testDistributedQueue", 0);
+ deployTopic("testDistributedTopic", 0);
if (!clusterEvent.viewChanged(30000))
{
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/LoadBalancingTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/LoadBalancingTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/LoadBalancingTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -6,10 +6,6 @@
*/
package org.jboss.test.messaging.jms.clustering;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.naming.InitialContext;
-
import org.jboss.jms.client.JBossConnection;
import org.jboss.jms.client.JBossConnectionFactory;
import org.jboss.jms.client.delegate.ClientClusteredConnectionFactoryDelegate;
@@ -17,8 +13,11 @@
import org.jboss.jms.client.plugin.RoundRobinLoadBalancingPolicy;
import org.jboss.jms.client.state.ConnectionState;
import org.jboss.jms.tx.ResourceManagerFactory;
-import org.jboss.test.messaging.tools.ServerManagement;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.naming.InitialContext;
+
/**
* This test DOESN'T extend ClusteringTestBase because I want to have control over first invocations
* to the server (which are outside of of my control if I use ClusteringTestBase).
@@ -125,7 +124,7 @@
for (int i = 0; i < 10; i++)
{
- InitialContext ic = new InitialContext(ServerManagement.getJNDIEnvironment(0));
+ InitialContext ic = getInitialContext();
ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ClusteredConnectionFactory");
Connection firstConnection = cf.createConnection();
int serverPeerID = getServerId(firstConnection);
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/MergeQueueTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/MergeQueueTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/MergeQueueTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -6,19 +6,12 @@
*/
package org.jboss.test.messaging.jms.clustering;
+import org.jboss.test.messaging.tools.ServerManagement;
+
+import javax.jms.*;
import java.util.HashSet;
import java.util.Set;
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
-import org.jboss.test.messaging.tools.ServerManagement;
-
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @version <tt>$Revision: 1.1 $</tt>
@@ -487,9 +480,9 @@
{
//Deploy queue with fullSize of 10
- ServerManagement.deployQueue("constrainedQueue", "queue/constrainedQueue",full0, 2, 2, 0, true);
+ deployQueue("constrainedQueue", "queue/constrainedQueue",full0, 2, 2, 0, true);
- ServerManagement.deployQueue("constrainedQueue", "queue/constrainedQueue",full1, 2, 2, 1, true);
+ deployQueue("constrainedQueue", "queue/constrainedQueue",full1, 2, 2, 1, true);
Queue queue0 = (Queue)ic[0].lookup("queue/constrainedQueue");
@@ -598,7 +591,7 @@
{
try
{
- ServerManagement.undeployQueue("constrainedQueue", 0);
+ undeployQueue("constrainedQueue", 0);
}
catch (Exception ignore)
{
@@ -606,7 +599,7 @@
try
{
- ServerManagement.undeployQueue("constrainedQueue", 1);
+ undeployQueue("constrainedQueue", 1);
}
catch (Exception ignore)
{
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/MultiThreadFailoverTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/MultiThreadFailoverTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/MultiThreadFailoverTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -22,25 +22,15 @@
package org.jboss.test.messaging.jms.clustering;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.Destination;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
import org.jboss.jms.client.JBossConnection;
-import org.jboss.jms.client.remoting.JMSRemotingConnection;
import org.jboss.jms.client.delegate.ClientConnectionDelegate;
import org.jboss.logging.Logger;
import org.jboss.test.messaging.tools.ServerManagement;
-import org.jboss.test.messaging.tools.aop.PoisonInterceptor;
+import javax.jms.*;
+import java.util.ArrayList;
+import java.util.Iterator;
+
/**
* @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
* @version <tt>$Revision$</tt>
@@ -188,12 +178,12 @@
// // poison the server
// ServerManagement.poisonTheServer(1, PoisonInterceptor.FAIL_SYNCHRONIZED_SEND_RECEIVE);
//
-// conn1.start();
+// conn1.startServerPeer();
//
// Session sessionConsumer2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
//
// MessageConsumer consumer2 = sessionConsumer2.createConsumer(queue[0]);
-// conn2.start();
+// conn2.startServerPeer();
//
// final Session sessionProducer = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
//
@@ -244,9 +234,9 @@
// }
// };
//
-// t2.start();
+// t2.startServerPeer();
// Thread.sleep(500);
-// t1.start();
+// t1.startServerPeer();
//
// t1.join();
// t2.join();
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/MultipleFailoverTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/MultipleFailoverTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/MultipleFailoverTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,22 +21,14 @@
*/
package org.jboss.test.messaging.jms.clustering;
+import org.jboss.jms.client.JBossConnection;
+import org.jboss.test.messaging.tools.ServerManagement;
+
+import javax.jms.*;
import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
-import org.jboss.jms.client.JBossConnection;
-import org.jboss.test.messaging.tools.ServerManagement;
-
/**
* A test where we kill multiple nodes and make sure the failover works correctly in these condtions
* too.
@@ -103,8 +95,8 @@
log.info("########");
ServerManagement.start(3, "all", false);
- ServerManagement.deployQueue("testDistributedQueue", 3);
- ServerManagement.deployTopic("testDistributedTopic", 3);
+ deployQueue("testDistributedQueue", 3);
+ deployTopic("testDistributedTopic", 3);
// send/receive message
prod.send(s.createTextMessage("step3"));
@@ -132,8 +124,8 @@
ServerManagement.start(4, "all", false);
log.info("deploying queue on4");
- ServerManagement.deployQueue("testDistributedQueue", 4);
- ServerManagement.deployTopic("testDistributedTopic", 4);
+ deployQueue("testDistributedQueue", 4);
+ deployTopic("testDistributedTopic", 4);
log.info("deployed it");
// send/receive message
@@ -161,8 +153,8 @@
log.info("########");
ServerManagement.start(1, "all", false);
- ServerManagement.deployQueue("testDistributedQueue", 1);
- ServerManagement.deployTopic("testDistributedTopic", 1);
+ deployQueue("testDistributedQueue", 1);
+ deployTopic("testDistributedTopic", 1);
// send/receive message
prod.send(s.createTextMessage("step7"));
@@ -353,9 +345,9 @@
ServerManagement.start(1, "all", false);
log.info("server 1 started");
log.info("*** TRYING TO DEPLOY QUEUE");
- ServerManagement.deployQueue("testDistributedQueue", 1);
+ deployQueue("testDistributedQueue", 1);
log.info("DEPLOYED QUEUE");
- ServerManagement.deployTopic("testDistributedTopic", 1);
+ deployTopic("testDistributedTopic", 1);
log.info("Deployed destinations");
Thread.sleep(5000);
@@ -368,8 +360,8 @@
log.info("Starting server 2");
ServerManagement.start(2, "all", false);
log.info("server 2 started");
- ServerManagement.deployQueue("testDistributedQueue", 2);
- ServerManagement.deployTopic("testDistributedTopic", 2);
+ deployQueue("testDistributedQueue", 2);
+ deployTopic("testDistributedTopic", 2);
log.info("Deployed destinations");
Thread.sleep(5000);
@@ -382,8 +374,8 @@
log.info("Starting server 1");
ServerManagement.start(1, "all", false);
log.info("server 1 started");
- ServerManagement.deployQueue("testDistributedQueue", 1);
- ServerManagement.deployTopic("testDistributedTopic", 1);
+ deployQueue("testDistributedQueue", 1);
+ deployTopic("testDistributedTopic", 1);
log.info("Deployed destinations");
@@ -396,8 +388,8 @@
log.info("Starting server 2");
ServerManagement.start(2, "all", false);
- ServerManagement.deployQueue("testDistributedQueue", 2);
- ServerManagement.deployTopic("testDistributedTopic", 2);
+ deployQueue("testDistributedQueue", 2);
+ deployTopic("testDistributedTopic", 2);
Thread.sleep(5000);
@@ -408,8 +400,8 @@
log.info("Starting server 1");
ServerManagement.start(1, "all", false);
- ServerManagement.deployQueue("testDistributedQueue", 1);
- ServerManagement.deployTopic("testDistributedTopic", 1);
+ deployQueue("testDistributedQueue", 1);
+ deployTopic("testDistributedTopic", 1);
Thread.sleep(10000);
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/NoFailoverTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/NoFailoverTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/NoFailoverTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -22,16 +22,7 @@
package org.jboss.test.messaging.jms.clustering;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.naming.InitialContext;
-
+import EDU.oswego.cs.dl.util.concurrent.Latch;
import org.jboss.jms.client.JBossConnectionFactory;
import org.jboss.jms.client.delegate.ClientClusteredConnectionFactoryDelegate;
import org.jboss.jms.tx.ResourceManagerFactory;
@@ -39,7 +30,8 @@
import org.jboss.test.messaging.tools.container.ServiceAttributeOverrides;
import org.jboss.test.messaging.tools.container.ServiceContainer;
-import EDU.oswego.cs.dl.util.concurrent.Latch;
+import javax.jms.*;
+import javax.naming.InitialContext;
/**
* Test situations where supports failover is marked false
@@ -143,9 +135,9 @@
// Restarting the server
ServerManagement.start(1, "all", false);
- ServerManagement.deployQueue("testDistributedQueue", 1);
- ServerManagement.deployTopic("testDistributedTopic", 1);
- InitialContext ic = new InitialContext(ServerManagement.getJNDIEnvironment(1));
+ deployQueue("testDistributedQueue", 1);
+ deployTopic("testDistributedTopic", 1);
+ InitialContext ic = getInitialContext();
ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ClusteredConnectionFactory");
conn = createConnectionOnServer(cf, 1);
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/RecoverDeliveriesTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/RecoverDeliveriesTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/RecoverDeliveriesTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -22,18 +22,6 @@
package org.jboss.test.messaging.jms.clustering;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.jms.Connection;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
import org.jboss.jms.client.FailoverEvent;
import org.jboss.jms.client.JBossConnection;
import org.jboss.jms.client.delegate.ClientClusteredConnectionFactoryDelegate;
@@ -41,7 +29,12 @@
import org.jboss.test.messaging.tools.ServerManagement;
import org.jboss.test.messaging.tools.container.Server;
+import javax.jms.*;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
/**
*
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -161,9 +154,9 @@
}
}
- ServerManagement.deployQueue("timeoutQueue", 0);
- ServerManagement.deployQueue("timeoutQueue", 1);
- ServerManagement.deployQueue("timeoutQueue", 2);
+ deployQueue("timeoutQueue", 0);
+ deployQueue("timeoutQueue", 1);
+ deployQueue("timeoutQueue", 2);
Queue timeoutQueue = (Queue)ic[1].lookup("/queue/timeoutQueue");
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/XAFailoverTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/XAFailoverTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/clustering/XAFailoverTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -6,31 +6,21 @@
*/
package org.jboss.test.messaging.jms.clustering;
-import java.util.HashSet;
+import org.jboss.jms.client.FailoverEvent;
+import org.jboss.jms.client.JBossConnection;
+import org.jboss.test.messaging.tools.ServerManagement;
+import org.jboss.test.messaging.tools.aop.PoisonInterceptor;
+import org.jboss.test.messaging.tools.container.ServiceContainer;
-import javax.jms.Connection;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.XAConnection;
-import javax.jms.XAConnectionFactory;
-import javax.jms.XASession;
+import javax.jms.*;
import javax.naming.InitialContext;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
+import java.util.HashSet;
-import org.jboss.jms.client.FailoverEvent;
-import org.jboss.jms.client.JBossConnection;
-import org.jboss.test.messaging.tools.ServerManagement;
-import org.jboss.test.messaging.tools.aop.PoisonInterceptor;
-import org.jboss.test.messaging.tools.container.InVMInitialContextFactory;
-import org.jboss.test.messaging.tools.container.ServiceContainer;
-
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @version <tt>$Revision: 1.1 $</tt>
@@ -67,12 +57,8 @@
super.setUp();
- sc = new ServiceContainer("transaction");
-
- //Don't drop the tables again!
- sc.start(false);
- InitialContext localIc = new InitialContext(InVMInitialContextFactory.getJNDIEnvironment());
+ InitialContext localIc = getInitialContext();
tm = (TransactionManager)localIc.lookup(ServiceContainer.TRANSACTION_MANAGER_JNDI_NAME);
@@ -84,9 +70,8 @@
protected void tearDown() throws Exception
{
super.tearDown();
+
- sc.stop();
-
if (suspended != null)
{
tm.resume(suspended);
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/manual/FailoverTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/manual/FailoverTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/manual/FailoverTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,24 +21,13 @@
*/
package org.jboss.test.messaging.jms.manual;
-import java.util.Hashtable;
+import junit.framework.TestCase;
+import org.jboss.logging.Logger;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.DeliveryMode;
import javax.jms.Message;
-import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
import javax.jms.TextMessage;
-import javax.naming.InitialContext;
-import junit.framework.TestCase;
-
-import org.jboss.logging.Logger;
-
public class FailoverTest extends TestCase
{
private static final Logger log = Logger.getLogger(FailoverTest.class);
@@ -66,7 +55,7 @@
public void testSendReceive() throws Exception
{
- Hashtable properties = new Hashtable();
+ /*Hashtable properties = new Hashtable();
properties.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
@@ -106,7 +95,7 @@
cons.setMessageListener(list);
- conn.start();
+ conn.startServerPeer();
MessageProducer prod = sessSend.createProducer(queue);
@@ -148,7 +137,7 @@
}
log.info("closed connection");
}
- }
+ }*/
}
class MyListener implements MessageListener
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/message/JMSExpirationHeaderTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/message/JMSExpirationHeaderTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/message/JMSExpirationHeaderTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,13 +21,12 @@
*/
package org.jboss.test.messaging.jms.message;
-import javax.jms.DeliveryMode;
-import javax.jms.Message;
-
+import EDU.oswego.cs.dl.util.concurrent.Latch;
import org.jboss.jms.message.JBossMessage;
import org.jboss.jms.message.MessageProxy;
-import EDU.oswego.cs.dl.util.concurrent.Latch;
+import javax.jms.DeliveryMode;
+import javax.jms.Message;
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
@@ -121,7 +120,7 @@
// Delivery is asynch - need to give enough time to get to the consumer
Thread.sleep(2000);
- // start the receiver thread
+ // startServerPeer the receiver thread
final Latch latch = new Latch();
Thread receiverThread = new Thread(new Runnable()
{
@@ -153,7 +152,7 @@
final Latch receiverLatch = new Latch();
- // start the receiver thread
+ // startServerPeer the receiver thread
Thread receiverThread = new Thread(new Runnable()
{
public void run()
@@ -178,7 +177,7 @@
final Latch senderLatch = new Latch();
- // start the sender thread
+ // startServerPeer the sender thread
Thread senderThread = new Thread(new Runnable()
{
public void run()
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/message/JMSReplyToHeaderTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/message/JMSReplyToHeaderTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/message/JMSReplyToHeaderTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -59,7 +59,7 @@
m.setJMSReplyTo(tempQ);
queueProducer.send(m);
- queueConsumer.receive();
+ queueConsumer.receive(10000);
assertEquals(tempQ, m.getJMSReplyTo());
}
@@ -69,7 +69,7 @@
m.setJMSReplyTo(null);
queueProducer.send(m);
- queueConsumer.receive();
+ queueConsumer.receive(10000);
assertNull(m.getJMSReplyTo());
}
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/message/ObjectMessageTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/message/ObjectMessageTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/message/ObjectMessageTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,17 +21,16 @@
*/
package org.jboss.test.messaging.jms.message;
+import javax.jms.DeliveryMode;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.ObjectMessage;
import java.io.File;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.StringTokenizer;
-import javax.jms.DeliveryMode;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.ObjectMessage;
-
/**
* A test that sends/receives object messages to the JMS provider and verifies their integrity.
*
@@ -91,7 +90,7 @@
Thread.currentThread().setContextClassLoader(testClassLoader);
- ObjectMessage r = (ObjectMessage) queueCons.receive();
+ ObjectMessage r = (ObjectMessage) queueCons.receive(2000);
Object testObject2 = r.getObject();
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/message/StreamMessageTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/message/StreamMessageTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/message/StreamMessageTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -73,7 +73,7 @@
conn.start();
- StreamMessage rm = (StreamMessage)queueCons.receive();
+ StreamMessage rm = (StreamMessage)queueCons.receive(2000);
assertNull(rm.readString());
}
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/message/TextMessageTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/message/TextMessageTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/message/TextMessageTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -68,7 +68,7 @@
((TextMessage)message).setText("something");
queueProd.send(message);
- TextMessage rm = (TextMessage)queueCons.receive();
+ TextMessage rm = (TextMessage)queueCons.receive(2000);
rm.clearProperties();
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/server/connectionfactory/ConnectionFactoryTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/server/connectionfactory/ConnectionFactoryTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/server/connectionfactory/ConnectionFactoryTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,21 +21,15 @@
*/
package org.jboss.test.messaging.jms.server.connectionfactory;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.Session;
-import javax.jms.TopicConnectionFactory;
-import javax.jms.XAConnectionFactory;
-import javax.management.ObjectName;
-import javax.naming.NameNotFoundException;
-
import org.jboss.jms.client.JBossMessageConsumer;
import org.jboss.jms.client.delegate.ClientConsumerDelegate;
import org.jboss.jms.client.state.ConsumerState;
-import org.jboss.test.messaging.jms.JMSTestCase;
-import org.jboss.test.messaging.tools.ServerManagement;
+import org.jboss.test.messaging.JBMServerTestCase;
+import javax.jms.*;
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+
/**
* Tests a deployed ConnectionFactory service.
*
@@ -44,7 +38,7 @@
*
* $Id$
*/
-public class ConnectionFactoryTest extends JMSTestCase
+public class ConnectionFactoryTest extends JBMServerTestCase
{
// Constants -----------------------------------------------------
@@ -53,12 +47,18 @@
// Attributes ----------------------------------------------------
// Constructors --------------------------------------------------
-
+ InitialContext ic;
public ConnectionFactoryTest(String name)
{
super(name);
}
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ ic = getInitialContext();
+ }
+
// Public --------------------------------------------------------
public void testDefaultConnectionFactory() throws Exception
@@ -92,10 +92,10 @@
public void testDeployment() throws Exception
{
- String objectName = "somedomain:service=SomeConnectionFactory";
+ String objectName = "SomeConnectionFactory";
String[] jndiBindings = new String[] { "/SomeConnectionFactory" };
- ServerManagement.deployConnectionFactory(objectName, jndiBindings);
+ deployConnectionFactory(objectName, jndiBindings);
ConnectionFactory cf = (ConnectionFactory)ic.lookup("/SomeConnectionFactory");
@@ -103,7 +103,7 @@
assertTrue(cf instanceof QueueConnectionFactory);
assertTrue(cf instanceof TopicConnectionFactory);
- ServerManagement.undeployConnectionFactory(new ObjectName(objectName));
+ undeployConnectionFactory(objectName);
try
{
@@ -118,12 +118,12 @@
public void testDeploymentWithPrefetch() throws Exception
{
- String objectName = "somedomain:service=SomeConnectionFactory";
+ String objectName = "SomeConnectionFactory";
String[] jndiBindings = new String[] { "/SomeConnectionFactory" };
final int prefetchSize = 777777;
- ServerManagement.deployConnectionFactory(objectName, jndiBindings, prefetchSize);
+ deployConnectionFactory(objectName, jndiBindings, prefetchSize);
ConnectionFactory cf = (ConnectionFactory)ic.lookup("/SomeConnectionFactory");
@@ -150,9 +150,9 @@
assertEquals(prefetchSize, size);
- ServerManagement.undeployConnectionFactory(new ObjectName(objectName));
+ undeployConnectionFactory(objectName);
- ServerManagement.undeployQueue("testQueue");
+ undeployQueue("testQueue");
try
{
@@ -177,7 +177,7 @@
{
String objectName = "somedomain:service=SomeConnectionFactory";
String[] jndiBindings = new String[] { "/name1", "/name2", "/name3" };
- ServerManagement.deployConnectionFactory(objectName, jndiBindings);
+ deployConnectionFactory(objectName, jndiBindings);
ConnectionFactory cf = (ConnectionFactory)ic.lookup("/name1");
assertNotNull(cf);
@@ -188,7 +188,7 @@
cf = (ConnectionFactory)ic.lookup("/name2");
assertNotNull(cf);
- ServerManagement.undeployConnectionFactory(new ObjectName(objectName));
+ undeployConnectionFactory(objectName);
try
{
@@ -225,12 +225,12 @@
{
String objectName = "somedomain:service=SomeConnectionFactory";
String[] jndiBindings = new String[] { "/a/compound/jndi/name" };
- ServerManagement.deployConnectionFactory(objectName, jndiBindings);
+ deployConnectionFactory(objectName, jndiBindings);
ConnectionFactory cf = (ConnectionFactory)ic.lookup("/a/compound/jndi/name");
assertNotNull(cf);
- ServerManagement.undeployConnectionFactory(new ObjectName(objectName));
+ undeployConnectionFactory(objectName);
}
// Package protected ---------------------------------------------
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/server/connectionmanager/SimpleConnectionManagerTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/server/connectionmanager/SimpleConnectionManagerTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/server/connectionmanager/SimpleConnectionManagerTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,13 +21,6 @@
*/
package org.jboss.test.messaging.jms.server.connectionmanager;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.Session;
-
import org.jboss.jms.client.JBossConnection;
import org.jboss.jms.client.JBossConnectionFactory;
import org.jboss.jms.delegate.ConnectionEndpoint;
@@ -39,8 +32,13 @@
import org.jboss.jms.tx.MessagingXid;
import org.jboss.jms.tx.TransactionRequest;
import org.jboss.test.messaging.jms.JMSTestCase;
-import org.jboss.test.messaging.tools.ServerManagement;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.Session;
+import java.util.Iterator;
+import java.util.Map;
+
/**
*
* A SimpleConnectionManagerTest.
@@ -85,7 +83,7 @@
conn2 = (JBossConnection)cf.createConnection();
Session sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
- ServerPeer peer = ServerManagement.getServer().getServerPeer();
+ ServerPeer peer = (ServerPeer) getJmsServer();
SimpleConnectionManager cm = (SimpleConnectionManager)peer.getConnectionManager();
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/stress/ConcurrentCloseStressTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/stress/ConcurrentCloseStressTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/stress/ConcurrentCloseStressTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -22,31 +22,23 @@
package org.jboss.test.messaging.jms.stress;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import javax.jms.Connection;
-import javax.jms.Destination;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.naming.InitialContext;
-
import org.jboss.jms.client.JBossConnectionFactory;
import org.jboss.logging.Logger;
-import org.jboss.test.messaging.MessagingTestCase;
+import org.jboss.test.messaging.JBMServerTestCase;
import org.jboss.test.messaging.jms.ConnectionTest;
-import org.jboss.test.messaging.tools.ServerManagement;
+import javax.jms.*;
+import javax.naming.InitialContext;
+import java.util.ArrayList;
+import java.util.Iterator;
+
/**
* This test was added to test regression on http://jira.jboss.com/jira/browse/JBMESSAGING-660
* @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
* @version <tt>$Revision$</tt>
* $Id$
*/
-public class ConcurrentCloseStressTest extends MessagingTestCase
+public class ConcurrentCloseStressTest extends JBMServerTestCase
{
private static final Logger log = Logger.getLogger(ConnectionTest.class);
@@ -63,14 +55,14 @@
{
super.setUp();
- ServerManagement.start("all");
+ //ServerManagement.startServerPeer("all");
- ic = new InitialContext(ServerManagement.getJNDIEnvironment());
+ ic = getInitialContext();
cf = (JBossConnectionFactory)ic.lookup("/ConnectionFactory");
- ServerManagement.undeployQueue("TestQueue");
- ServerManagement.deployQueue("TestQueue");
+ undeployQueue("TestQueue");
+ deployQueue("TestQueue");
queue = (Queue) ic.lookup("queue/TestQueue");
@@ -79,7 +71,7 @@
public void tearDown() throws Exception
{
- ServerManagement.undeployQueue("TestQueue");
+ undeployQueue("TestQueue");
super.tearDown();
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/stress/CorruptMessageStressTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/stress/CorruptMessageStressTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/stress/CorruptMessageStressTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -6,19 +6,12 @@
*/
package org.jboss.test.messaging.jms.stress;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.DeliveryMode;
-import javax.jms.Message;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.naming.InitialContext;
-
import org.jboss.logging.Logger;
-import org.jboss.test.messaging.MessagingTestCase;
-import org.jboss.test.messaging.tools.ServerManagement;
+import org.jboss.test.messaging.JBMServerTestCase;
+import javax.jms.*;
+import javax.naming.InitialContext;
+
/**
* A stress test written to investigate http://jira.jboss.org/jira/browse/JBMESSAGING-362
*
@@ -26,7 +19,7 @@
* @version <tt>$Revision$</tt>
* $Id$
*/
-public class CorruptMessageStressTest extends MessagingTestCase
+public class CorruptMessageStressTest extends JBMServerTestCase
{
// Constants -----------------------------------------------------
@@ -94,16 +87,16 @@
{
super.setUp();
- ServerManagement.start("all");
- ic = new InitialContext(ServerManagement.getJNDIEnvironment());
- ServerManagement.deployQueue("StressTestQueue");
+ //ServerManagement.startServerPeer("all");
+ ic = getInitialContext();
+ deployQueue("StressTestQueue");
log.debug("setup done");
}
protected void tearDown() throws Exception
{
- ServerManagement.undeployQueue("StressTestQueue");
+ undeployQueue("StressTestQueue");
ic.close();
super.tearDown();
}
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/stress/ManyConnectionsStressTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/stress/ManyConnectionsStressTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/stress/ManyConnectionsStressTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -6,26 +6,15 @@
*/
package org.jboss.test.messaging.jms.stress;
+import org.jboss.logging.Logger;
+import org.jboss.test.messaging.JBMServerTestCase;
+
+import javax.jms.*;
+import javax.naming.InitialContext;
import java.util.HashSet;
import java.util.Set;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.naming.InitialContext;
-import org.jboss.logging.Logger;
-import org.jboss.test.messaging.MessagingTestCase;
-import org.jboss.test.messaging.tools.ServerManagement;
-
-
/**
*
* Create 500 connections each with a consumer, consuming from a topic
@@ -36,7 +25,7 @@
* $Id: $
*
*/
-public class ManyConnectionsStressTest extends MessagingTestCase
+public class ManyConnectionsStressTest extends JBMServerTestCase
{
// Constants -----------------------------------------------------
@@ -71,18 +60,18 @@
{
super.setUp();
- ServerManagement.start("all");
+ //ServerManagement.startServerPeer("all");
- ic = new InitialContext(ServerManagement.getJNDIEnvironment());
+ ic = getInitialContext();
- ServerManagement.deployTopic("StressTestTopic");
+ deployTopic("StressTestTopic");
log.debug("setup done");
}
protected void tearDown() throws Exception
{
- ServerManagement.undeployTopic("StressTestTopic");
+ undeployTopic("StressTestTopic");
ic.close();
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/stress/OpenCloseStressTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/stress/OpenCloseStressTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/stress/OpenCloseStressTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,24 +21,13 @@
*/
package org.jboss.test.messaging.jms.stress;
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.naming.InitialContext;
-
import org.jboss.jms.client.JBossConnectionFactory;
-import org.jboss.test.messaging.MessagingTestCase;
-import org.jboss.test.messaging.tools.ServerManagement;
+import org.jboss.test.messaging.JBMServerTestCase;
import org.jboss.util.id.GUID;
+import javax.jms.*;
+import javax.naming.InitialContext;
+
/**
*
* A OpenCloseStressTest.
@@ -56,7 +45,7 @@
*
* $Id: StressTest.java 2349 2007-02-19 14:15:53Z timfox $
*/
-public class OpenCloseStressTest extends MessagingTestCase
+public class OpenCloseStressTest extends JBMServerTestCase
{
public OpenCloseStressTest(String name)
{
@@ -71,13 +60,13 @@
{
super.setUp();
- ServerManagement.start("all");
+ //ServerManagement.startServerPeer("all");
- ic = new InitialContext(ServerManagement.getJNDIEnvironment());
+ ic = getInitialContext();
cf = (JBossConnectionFactory)ic.lookup("/ConnectionFactory");
- ServerManagement.undeployTopic("TestTopic");
- ServerManagement.deployTopic("TestTopic");
+ undeployTopic("TestTopic");
+ deployTopic("TestTopic");
topic = (Topic) ic.lookup("topic/TestTopic");
@@ -86,7 +75,7 @@
public void tearDown() throws Exception
{
- ServerManagement.undeployQueue("TestQueue");
+ undeployQueue("TestQueue");
super.tearDown();
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/stress/RelayStressTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/stress/RelayStressTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/stress/RelayStressTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -6,22 +6,12 @@
*/
package org.jboss.test.messaging.jms.stress;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.DeliveryMode;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.Topic;
-import javax.naming.InitialContext;
-
import org.jboss.logging.Logger;
-import org.jboss.test.messaging.MessagingTestCase;
-import org.jboss.test.messaging.tools.ServerManagement;
+import org.jboss.test.messaging.JBMServerTestCase;
+import javax.jms.*;
+import javax.naming.InitialContext;
+
/**
* Send messages to a topic with selector1, consumer them with multiple consumers and relay them
* back to the topic with a different selector, then consume that with more consumers.
@@ -32,7 +22,7 @@
* $Id$
*
*/
-public class RelayStressTest extends MessagingTestCase
+public class RelayStressTest extends JBMServerTestCase
{
// Constants -----------------------------------------------------
@@ -58,16 +48,16 @@
{
super.setUp();
- ServerManagement.start("all");
- ic = new InitialContext(ServerManagement.getJNDIEnvironment());
- ServerManagement.deployTopic("StressTestTopic");
+ //ServerManagement.startServerPeer("all");
+ ic = getInitialContext();
+ deployTopic("StressTestTopic");
log.debug("setup done");
}
protected void tearDown() throws Exception
{
- ServerManagement.undeployTopic("StressTestTopic");
+ undeployTopic("StressTestTopic");
ic.close();
super.tearDown();
}
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/stress/SeveralClientsStressTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/stress/SeveralClientsStressTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/jms/stress/SeveralClientsStressTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -22,28 +22,18 @@
package org.jboss.test.messaging.jms.stress;
+import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
+import EDU.oswego.cs.dl.util.concurrent.SynchronizedInt;
+import org.jboss.logging.Logger;
+import org.jboss.test.messaging.JBMServerTestCase;
+import org.jboss.test.messaging.tools.ServerManagement;
+
+import javax.jms.*;
+import javax.naming.Context;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Random;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.DeliveryMode;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-
-import org.jboss.logging.Logger;
-import org.jboss.test.messaging.MessagingTestCase;
-import org.jboss.test.messaging.tools.ServerManagement;
-
-import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
-import EDU.oswego.cs.dl.util.concurrent.SynchronizedInt;
-
/**
* In order for this test to run, you will need to edit /etc/security/limits.conf and change your max sockets to something bigger than 1024
*
@@ -61,7 +51,7 @@
* @version <tt>$Revision$</tt>
* $Id$
*/
-public class SeveralClientsStressTest extends MessagingTestCase
+public class SeveralClientsStressTest extends JBMServerTestCase
{
// Constants ------------------------------------------------------------------------------------
@@ -88,7 +78,7 @@
protected Context createContext() throws Exception
{
- return new InitialContext(ServerManagement.getJNDIEnvironment());
+ return getInitialContext();
}
// Constructors ---------------------------------------------------------------------------------
@@ -226,7 +216,7 @@
if (startServer)
{
ServerManagement.start(0, "all", null, true);
- ServerManagement.deployQueue("testQueue");
+ deployQueue("testQueue");
}
clearMessages();
Added: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/ConfigurationHelper.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/ConfigurationHelper.java (rev 0)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/ConfigurationHelper.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -0,0 +1,108 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.messaging.tools;
+
+import org.jboss.jms.server.Configuration;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.kernel.spi.dependency.KernelControllerContextAware;
+import org.jboss.test.messaging.tools.container.JBMPropertyKernelConfig;
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Set;
+
+/**
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public class ConfigurationHelper implements KernelControllerContextAware
+{
+ private Configuration configuration;
+ private KernelControllerContext kernelControllerContext;
+ private static HashMap<Integer, HashMap<String, Object>> configs;
+
+ public void setKernelControllerContext(KernelControllerContext kernelControllerContext) throws Exception
+ {
+ this.kernelControllerContext = kernelControllerContext;
+ }
+
+ public void unsetKernelControllerContext(KernelControllerContext kernelControllerContext) throws Exception
+ {
+ this.kernelControllerContext = null;
+ }
+
+ public Configuration getConfiguration()
+ {
+ return configuration;
+ }
+
+ public void setConfiguration(Configuration configuration)
+ {
+ this.configuration = configuration;
+ }
+
+ public void start()
+ {
+ JBMPropertyKernelConfig config = (JBMPropertyKernelConfig) kernelControllerContext.getKernel().getConfig();
+ HashMap<String, Object> configuration = configs.get(config.getServerID());
+ Configuration actualConfiguration = (Configuration) kernelControllerContext.getKernel().getRegistry().getEntry("Configuration").getTarget();
+ actualConfiguration.setServerPeerID(config.getServerID());
+ actualConfiguration.setRemotingBindAddress(actualConfiguration.getRemotingBindAddress() + config.getServerID());
+ alterConfig(actualConfiguration, configuration);
+ }
+
+ public static void addServerConfig(int serverID, HashMap<String, Object> configuration)
+ {
+ configs = new HashMap<Integer, HashMap<String, Object>>();
+ configs.put(serverID, configuration);
+ }
+
+ public Hashtable<String, Serializable> getEnvironment()
+ {
+ Hashtable<String, Serializable> env = new Hashtable<String, Serializable>();
+ env.put("java.naming.factory.initial", "org.jboss.test.messaging.tools.container.InVMInitialContextFactory");
+ env.put("jboss.messaging.test.server.index", "" + configuration.getServerPeerID());
+ return env;
+ }
+
+ private void alterConfig(Configuration origConf, HashMap<String, Object> newConf)
+ {
+ Set<String> keys = newConf.keySet();
+ for (String key : keys)
+ {
+ try
+ {
+ Method m = null;
+
+ m = origConf.getClass().getMethod(key, newConf.get(key).getClass());
+
+
+ m.invoke(configuration, newConf.get(key));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+}
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/TestJMSProviderAdaptor.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/TestJMSProviderAdaptor.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/TestJMSProviderAdaptor.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,13 +21,12 @@
*/
package org.jboss.test.messaging.tools;
-import java.util.Properties;
-
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
+import java.util.Properties;
-import org.jboss.jms.jndi.JMSProviderAdapter;
+//import org.jboss.jms.jndi.JMSProviderAdapter;
/**
* A TestJMSProviderAdaptor
@@ -38,7 +37,7 @@
* $Id$
*
*/
-public class TestJMSProviderAdaptor implements JMSProviderAdapter
+public class TestJMSProviderAdaptor //implements JMSProviderAdapter
{
private static final long serialVersionUID = 8064613007110300720L;
Added: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/DatabaseClearer.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/DatabaseClearer.java (rev 0)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/DatabaseClearer.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -0,0 +1,177 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.messaging.tools.container;
+
+import org.jboss.logging.Logger;
+
+import javax.sql.DataSource;
+import javax.transaction.TransactionManager;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+
+/**
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public class DatabaseClearer
+{
+ private static final Logger log = Logger.getLogger(DatabaseClearer.class);
+ private DataSource dataSource;
+ private TransactionManager transactionManager;
+
+ public DataSource getDataSource()
+ {
+ return dataSource;
+ }
+
+ public void setDataSource(DataSource dataSource)
+ {
+ this.dataSource = dataSource;
+ }
+
+ public TransactionManager getTransactionManager()
+ {
+ return transactionManager;
+ }
+
+ public void setTransactionManager(TransactionManager transactionManager)
+ {
+ this.transactionManager = transactionManager;
+ }
+
+
+ public void deleteAllData() throws Exception
+ {
+ log.debug("DELETING ALL DATA FROM DATABASE!");
+
+
+ // We need to execute each drop in its own transaction otherwise postgresql will not execute
+ // further commands after one fails
+
+
+ javax.transaction.Transaction txOld = transactionManager.suspend();
+
+ executeStatement(transactionManager, dataSource, "DELETE FROM JBM_POSTOFFICE");
+
+ executeStatement(transactionManager, dataSource, "DELETE FROM JBM_MSG_REF");
+
+ executeStatement(transactionManager, dataSource, "DELETE FROM JBM_MSG");
+
+ executeStatement(transactionManager, dataSource, "DELETE FROM JBM_TX");
+
+ executeStatement(transactionManager, dataSource, "DELETE FROM JBM_COUNTER");
+
+ executeStatement(transactionManager, dataSource, "DELETE FROM JBM_USER");
+
+ executeStatement(transactionManager, dataSource, "DELETE FROM JBM_ROLE");
+
+ if (txOld != null)
+ {
+ transactionManager.resume(txOld);
+ }
+
+ log.debug("done with the deleting data");
+ }
+
+ public void deleteData() throws Exception
+ {
+ log.debug("DELETING ALL DATA FROM DATABASE!");
+
+
+ // We need to execute each drop in its own transaction otherwise postgresql will not execute
+ // further commands after one fails
+
+
+ javax.transaction.Transaction txOld = transactionManager.suspend();
+
+ //executeStatement(transactionManager, dataSource, "DELETE FROM JBM_POSTOFFICE");
+
+ executeStatement(transactionManager, dataSource, "DELETE FROM JBM_MSG_REF");
+
+ executeStatement(transactionManager, dataSource, "DELETE FROM JBM_MSG");
+
+ executeStatement(transactionManager, dataSource, "DELETE FROM JBM_TX");
+
+ //executeStatement(transactionManager, dataSource, "DELETE FROM JBM_COUNTER");
+
+ executeStatement(transactionManager, dataSource, "DELETE FROM JBM_USER");
+
+ executeStatement(transactionManager, dataSource, "DELETE FROM JBM_ROLE");
+
+ if (txOld != null)
+ {
+ transactionManager.resume(txOld);
+ }
+
+ log.debug("done with the deleting data");
+ }
+
+ private void executeStatement(TransactionManager mgr, DataSource ds, String statement) throws Exception
+ {
+ Connection conn = null;
+ boolean exception = false;
+
+ try
+ {
+ try
+ {
+ mgr.begin();
+
+ conn = ds.getConnection();
+
+ log.debug("executing " + statement);
+
+ PreparedStatement ps = conn.prepareStatement(statement);
+
+ ps.executeUpdate();
+
+ log.debug(statement + " executed");
+
+ ps.close();
+ }
+ catch (SQLException e)
+ {
+ // Ignore
+ log.debug("Failed to execute statement", e);
+ exception = true;
+ }
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+
+ if (exception)
+ {
+ mgr.rollback();
+ }
+ else
+ {
+ mgr.commit();
+ }
+ }
+
+
+ }
+}
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/Example.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/Example.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/Example.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,12 +21,11 @@
*/
package org.jboss.test.messaging.tools.container;
-import java.sql.Connection;
-import java.sql.ResultSet;
-
import javax.naming.InitialContext;
import javax.sql.DataSource;
import javax.transaction.TransactionManager;
+import java.sql.Connection;
+import java.sql.ResultSet;
/**
* An example how to use ServiceContainer to get access to an in-memory database.
@@ -44,8 +43,8 @@
public static void main(String[] args) throws Exception
{
- ServiceContainer sc = new ServiceContainer("transaction, jca, database");
- sc.start();
+ /*ServiceContainer sc = new ServiceContainer("transaction, jca, database");
+ sc.startServerPeer();*/
InitialContext ic = new InitialContext();
@@ -84,7 +83,7 @@
c.close();
- sc.stop();
+ //sc.stopServerPeer();
}
// Attributes ----------------------------------------------------
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/InVMContext.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/InVMContext.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/InVMContext.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,31 +21,15 @@
*/
package org.jboss.test.messaging.tools.container;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.naming.Binding;
-import javax.naming.Context;
-import javax.naming.Name;
-import javax.naming.NameAlreadyBoundException;
-import javax.naming.NameNotFoundException;
-import javax.naming.NameParser;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.RefAddr;
-import javax.naming.Reference;
-
+import org.jboss.jms.server.microcontainer.NonSerializableFactory;
import org.jboss.logging.Logger;
import org.jboss.messaging.util.NotYetImplementedException;
-import org.jboss.util.naming.NonSerializableFactory;
+import javax.naming.*;
+import java.io.Serializable;
+import java.util.*;
+
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
* @version <tt>$Revision: 2868 $</tt>
@@ -67,6 +51,7 @@
protected Map map;
protected NameParser parser = new InVMNameParser();
+ private String nameInNamespace = "";
// Constructors --------------------------------------------------
@@ -75,6 +60,11 @@
map = Collections.synchronizedMap(new HashMap());
}
+ public InVMContext(String nameInNamespace)
+ {
+ this();
+ this.nameInNamespace = nameInNamespace;
+ }
// Context implementation ----------------------------------------
public Object lookup(Name name) throws NamingException
@@ -133,7 +123,7 @@
public void unbind(Name name) throws NamingException
{
- throw new NotYetImplementedException();
+ unbind(name.toString());
}
public void unbind(String name) throws NamingException
@@ -209,7 +199,7 @@
public void destroySubcontext(Name name) throws NamingException
{
- throw new NotYetImplementedException();
+ destroySubcontext(name.toString());
}
public void destroySubcontext(String name) throws NamingException
@@ -229,7 +219,7 @@
{
throw new NameAlreadyBoundException(name);
}
- InVMContext c = new InVMContext();
+ InVMContext c = new InVMContext(getNameInNamespace());
map.put(name, c);
return c;
}
@@ -285,7 +275,7 @@
public String getNameInNamespace() throws NamingException
{
- throw new NotYetImplementedException();
+ return nameInNamespace;
}
// Public --------------------------------------------------------
@@ -322,7 +312,7 @@
private void internalBind(String name, Object obj, boolean rebind) throws NamingException
{
- log.info("Binding " + name + " obj " + obj + " rebind " + rebind);
+ log.debug("Binding " + name + " obj " + obj + " rebind " + rebind);
name = trimSlashes(name);
int i = name.lastIndexOf("/");
InVMContext c = this;
Added: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/JBMPropertyKernelConfig.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/JBMPropertyKernelConfig.java (rev 0)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/JBMPropertyKernelConfig.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.messaging.tools.container;
+
+import org.jboss.kernel.plugins.config.property.PropertyKernelConfig;
+
+import java.util.Properties;
+
+/**
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public class JBMPropertyKernelConfig extends PropertyKernelConfig
+{
+ private int serverID = -1;
+ public JBMPropertyKernelConfig(Properties properties)
+ {
+ super(properties); //To change body of overridden methods use File | Settings | File Templates.
+ }
+
+
+ public int getServerID()
+ {
+ return serverID;
+ }
+
+ public void setServerID(int serverID)
+ {
+ this.serverID = serverID;
+ }
+}
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/MBeanServerBuilder.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/MBeanServerBuilder.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/MBeanServerBuilder.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -6,10 +6,9 @@
*/
package org.jboss.test.messaging.tools.container;
-import javax.management.MBeanServer;
import javax.management.MBeanServerDelegate;
-import org.jboss.mx.server.MBeanServerImpl;
+//import org.jboss.mx.server.MBeanServerImpl;
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
@@ -33,13 +32,13 @@
// MBeanServerBuilder overrides ----------------------------------
- public MBeanServer newMBeanServer(String defaultDomain,
+ /*public MBeanServer newMBeanServer(String defaultDomain,
MBeanServer outer,
MBeanServerDelegate delegate)
{
return new MBeanServerImpl("jboss", outer, delegate);
}
-
+*/
public MBeanServerDelegate newMBeanServerDelegate()
{
return new MBeanServerDelegate();
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/MockJBossSecurityManager.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/MockJBossSecurityManager.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/MockJBossSecurityManager.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,24 +21,19 @@
*/
package org.jboss.test.messaging.tools.container;
+import org.jboss.logging.Logger;
+import org.jboss.security.*;
+
+import javax.security.auth.Subject;
+import javax.security.auth.message.MessageInfo;
import java.security.Principal;
import java.security.acl.Group;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.Map;
import java.util.Set;
-import javax.security.auth.Subject;
-import org.jboss.logging.Logger;
-import org.jboss.security.AnybodyPrincipal;
-import org.jboss.security.AuthenticationManager;
-import org.jboss.security.NobodyPrincipal;
-import org.jboss.security.RealmMapping;
-import org.jboss.security.SecurityAssociation;
-import org.jboss.security.SimpleGroup;
-import org.jboss.security.SimplePrincipal;
-
-
/**
* Mock Security manager for testing JMS security.
*
@@ -262,6 +257,17 @@
throw new UnsupportedOperationException();
}
+
+ public boolean isValid(MessageInfo messageInfo, Subject subject, String string)
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public Principal getTargetPrincipal(Principal principal, Map<String, Object> map)
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
public void setSimulateJBossJaasSecurityManager(boolean b)
{
simulateJBossJaasSecurityManager = b;
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/NoopInvoker.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/NoopInvoker.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/NoopInvoker.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -23,8 +23,8 @@
import java.io.Serializable;
-import org.jboss.invocation.Invocation;
-import org.jboss.invocation.Invoker;
+//import org.jboss.invocation.Invocation;
+//import org.jboss.invocation.Invoker;
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
@@ -32,7 +32,7 @@
*
* $Id$
*/
-class NoopInvoker implements Serializable, Invoker
+class NoopInvoker implements Serializable//, Invoker
{
// Constants -----------------------------------------------------
@@ -51,10 +51,10 @@
return "localhost";
}
- public Object invoke(Invocation invocation) throws Exception
+ /*public Object invoke(Invocation invocation) throws Exception
{
return null;
- }
+ }*/
// Public --------------------------------------------------------
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/RemoteInitialContextFactory.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/RemoteInitialContextFactory.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/RemoteInitialContextFactory.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,14 +21,13 @@
*/
package org.jboss.test.messaging.tools.container;
-import java.util.Hashtable;
+import org.jboss.logging.Logger;
import javax.naming.Context;
import javax.naming.NamingException;
import javax.naming.spi.InitialContextFactory;
+import java.util.Hashtable;
-import org.jboss.logging.Logger;
-
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
* @version <tt>$Revision: 2868 $</tt>
@@ -52,7 +51,7 @@
env.put("java.naming.factory.initial",
"org.jboss.test.messaging.tools.container.RemoteInitialContextFactory");
env.put("java.naming.provider.url", "");
- env.put("java.naming.factory.url.pkgs", "");
+ //env.put("java.naming.factory.url.pkgs", "");
env.put(Constants.SERVER_INDEX_PROPERTY_NAME, Integer.toString(serverIndex));
return env;
}
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/RemoteTestServer.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/RemoteTestServer.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/RemoteTestServer.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -68,11 +68,12 @@
/**
* Only for in-VM use!
*/
- public PersistenceManager getPersistenceManager() throws Exception
+ public PersistenceManager getPersistenceManager()
{
throw new UnsupportedOperationException("This method shouldn't be invoked on a remote server");
}
+
// Public ---------------------------------------------------------------------------------------
// Package protected ----------------------------------------------------------------------------
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/StopRMIServer.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/StopRMIServer.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/tools/container/StopRMIServer.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,13 +21,13 @@
*/
package org.jboss.test.messaging.tools.container;
-import java.rmi.Naming;
-
import org.jboss.logging.Logger;
import org.jboss.test.messaging.tools.ServerManagement;
+import java.rmi.Naming;
+
/**
- * A utility to stop runaway rmi servers.
+ * A utility to stopServerPeer runaway rmi servers.
*
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
* @version <tt>$Revision: 2876 $</tt>
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/util/JNDIUtilTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/util/JNDIUtilTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/util/JNDIUtilTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,19 +21,18 @@
*/
package org.jboss.test.messaging.util;
+import org.jboss.messaging.util.JNDIUtil;
+import org.jboss.test.messaging.JBMServerTestCase;
+
import javax.naming.InitialContext;
import javax.naming.NameNotFoundException;
-import org.jboss.messaging.util.JNDIUtil;
-import org.jboss.test.messaging.MessagingTestCase;
-import org.jboss.test.messaging.tools.ServerManagement;
-
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
* @version <tt>$Revision$</tt>
*/
-public class JNDIUtilTest extends MessagingTestCase
+public class JNDIUtilTest extends JBMServerTestCase
{
// Constants -----------------------------------------------------
@@ -117,22 +116,14 @@
{
super.setUp();
- ServerManagement.start("none");
+ //ServerManagement.startServerPeer("none");
- ic = new InitialContext(ServerManagement.getJNDIEnvironment());
+ ic = getInitialContext();
log.debug("setup done");
}
- public void tearDown() throws Exception
- {
- super.tearDown();
- ic.close();
-
- ServerManagement.stop();
- }
-
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
Deleted: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/util/ServiceContainerTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/util/ServiceContainerTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/messaging/util/ServiceContainerTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -1,128 +0,0 @@
-/**
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.test.messaging.util;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.naming.InitialContext;
-
-import org.jboss.jms.client.JBossConnectionFactory;
-import org.jboss.test.messaging.MessagingTestCase;
-import org.jboss.test.messaging.tools.ServerManagement;
-
-/**
- * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
- * @version <tt>$Revision$</tt>
- * $Id$
- */
-public class ServiceContainerTest extends MessagingTestCase
-{
- // Constants -----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private ConnectionFactory cf;
- private Queue queue;
-
- // Constructors --------------------------------------------------
-
- public ServiceContainerTest(String name)
- {
- super(name);
- }
-
- // Public --------------------------------------------------------
-
- public void test1() throws Exception
- {
-
- Connection conn = cf.createConnection();
- Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageProducer prod = sess.createProducer(queue);
- for (int i = 0; i < 100; i++)
- {
- prod.send(sess.createMessage());
- }
- conn.close();
- }
-
- public void test2() throws Exception
- {
-
- Connection conn = cf.createConnection();
- Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageProducer prod = sess.createProducer(queue);
- for (int i = 0; i < 100; i++)
- {
- prod.send(sess.createMessage());
- }
- conn.close();
- }
-
- public void test3() throws Exception
- {
-
- Connection conn = cf.createConnection();
- Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageProducer prod = sess.createProducer(queue);
- for (int i = 0; i < 100; i++)
- {
- prod.send(sess.createMessage());
- }
- conn.close();
- }
-
- public void test4() throws Exception
- {
-
- Connection conn = cf.createConnection();
- Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageProducer prod = sess.createProducer(queue);
- for (int i = 0; i < 100; i++)
- {
- prod.send(sess.createMessage());
- }
- conn.close();
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- protected void setUp() throws Exception
- {
- super.setUp();
-
- ServerManagement.start("all");
-
- InitialContext ic = new InitialContext(ServerManagement.getJNDIEnvironment());
- cf = (JBossConnectionFactory)ic.lookup("/ConnectionFactory");
-
- ServerManagement.deployQueue("Queue");
- queue = (Queue)ic.lookup("/queue/Queue");
-
- ic.close();
- }
-
- protected void tearDown() throws Exception
- {
- ServerManagement.stop();
-
- super.tearDown();
- }
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
-
-
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/CallbackServerTimeoutTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/CallbackServerTimeoutTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/CallbackServerTimeoutTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -6,8 +6,8 @@
*/
package org.jboss.test.thirdparty.remoting;
-import javax.management.ObjectName;
-
+import EDU.oswego.cs.dl.util.concurrent.Channel;
+import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
import org.jboss.jms.client.remoting.JMSRemotingConnection;
import org.jboss.jms.wireformat.JMSWireFormat;
import org.jboss.logging.Logger;
@@ -25,8 +25,7 @@
import org.jboss.test.thirdparty.remoting.util.OnewayCallbackTrigger;
import org.jboss.test.thirdparty.remoting.util.RemotingTestSubsystemService;
-import EDU.oswego.cs.dl.util.concurrent.Channel;
-import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
+import javax.management.ObjectName;
/**
* An extra test for the same root problem that causes
@@ -208,7 +207,7 @@
ServerManagement.stop();
}
- // start a "standard" (messaging-enabled) remoting, we need to strip off the
+ // startServerPeer a "standard" (messaging-enabled) remoting, we need to strip off the
// marshaller/unmarshaller, though, since it can only bring trouble to this test ...
ServiceAttributeOverrides sao = new ServiceAttributeOverrides();
sao.put(ServiceContainer.REMOTING_OBJECT_NAME,
Deleted: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/ClientInvokerTimeoutTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/ClientInvokerTimeoutTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/ClientInvokerTimeoutTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -1,231 +0,0 @@
-/**
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.test.thirdparty.remoting;
-
-import org.jboss.logging.Logger;
-import org.jboss.remoting.Client;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.transport.PortUtil;
-import org.jboss.test.messaging.MessagingTestCase;
-import org.jboss.test.messaging.tools.ServerManagement;
-import org.jboss.test.messaging.tools.container.ServiceAttributeOverrides;
-import org.jboss.test.messaging.tools.container.ServiceContainer;
-import org.jboss.test.thirdparty.remoting.util.RemotingTestSubsystemService;
-import org.jboss.test.thirdparty.remoting.util.SimpleConnectionListener;
-
-/**
- * Tests for http://jira.jboss.org/jira/browse/JBMESSAGING-787,
- * http://jira.jboss.org/jira/browse/JBREM-691. Test written entirely at the Remoting level. If
- * fails with Remoting 2.2.0.Alpha6.
- *
- * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
- *
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class ClientInvokerTimeoutTest extends MessagingTestCase
-{
- // Constants ------------------------------------------------------------------------------------
-
- private static final Logger log = Logger.getLogger(ClientInvokerTimeoutTest.class);
-
- // Static ---------------------------------------------------------------------------------------
-
- // Attributes -----------------------------------------------------------------------------------
-
- private InvokerLocator serverLocator;
-
- // Constructors ---------------------------------------------------------------------------------
-
- public ClientInvokerTimeoutTest(String name)
- {
- super(name);
- }
-
- // Public ---------------------------------------------------------------------------------------
-
- /**
- * A remoting client created for "business use" will throw an unexpected SocketTimeoutException
- * after 1000 ms during a long invocation, even if it's not supposed to. If fails with Remoting
- * 2.2.0.Alpha6.
- */
- public void testUnexpectedSocketTimeoutException() throws Throwable
- {
- // This test doesn't make sense for HTTP, so shortcut it
-
- if (!"socket".equals(ServerManagement.getRemotingTransport(0)))
- {
- return;
- }
-
- Client client = null;
-
- try
- {
- client = new Client(serverLocator, RemotingTestSubsystemService.SUBSYSTEM_LABEL);
-
- client.connect();
-
- SimpleConnectionListener connListener = new SimpleConnectionListener();
- client.addConnectionListener(connListener, 3333);
-
- log.info("connection listener added, pinging will start in 3.3 secs");
-
- Thread.sleep(5000);
-
- log.info("first ping is done, send a long running invocation");
-
- // in 2.2.0.Alpha6 the client will send the invocation over a socket configured to time
- // out after 1000 ms, so this will throw java.net.SocketTimeoutException
-
- client.invoke(new Long(5000));
-
- Thread.sleep(7000);
- }
- finally
- {
- if (client != null)
- {
- client.disconnect();
- }
- }
- }
-
- /**
- * Same as testUnexpectedSocketTimeoutException(), slightly different setup.
- */
- public void testUnexpectedSocketTimeoutException2() throws Throwable
- {
- // This test doesn't make sense for HTTP, so shortcut it
-
- if (!"socket".equals(ServerManagement.getRemotingTransport(0)))
- {
- return;
- }
-
- Client client = null;
-
- try
- {
- // create a "business" client
-
- client = new Client(serverLocator, RemotingTestSubsystemService.SUBSYSTEM_LABEL);
-
- client.connect();
-
- final Client clientCopy = client;
-
- // send a "long running" invocation first on a separate thread, so we can setup the
- // connection validator at the same time
-
- new Thread(new Runnable()
- {
- public void run()
- {
- try
- {
- // this invocation will take 5 secs to complete
- clientCopy.invoke(new Long(5000));
- }
- catch(Throwable t)
- {
- log.error("invocation failed", t);
- }
-
- }
- }, "Lazy Invocation Thread").start();
-
- Thread.sleep(1000);
-
- SimpleConnectionListener connListener = new SimpleConnectionListener();
- client.addConnectionListener(connListener, 3333);
-
- log.info("connection listener added, pinging will start in 3.3 secs");
-
- Thread.sleep(4000);
-
- log.info("first ping is done, the answer to the first invocation should be back already");
-
- // in 2.2.0.Alpha6 the client will send the invocation over a socket configured to time
- // out after 1000 ms, so this will throw java.net.SocketTimeoutException
-
- client.invoke(new Long(5000));
-
- Thread.sleep(7000);
-
- }
- finally
- {
- if (client != null)
- {
- client.disconnect();
- }
- }
- }
-
- // Package protected ----------------------------------------------------------------------------
-
- // Protected ------------------------------------------------------------------------------------
-
- protected void setUp() throws Exception
- {
- super.setUp();
-
- if (!isRemote())
- {
- fail("This test should be run in a remote configuration!");
- }
-
- // Start the Remoting service in a configuration similar to the one in which the bug shows up
-
- String addr = ServiceContainer.getCurrentAddress();
- int port = PortUtil.findFreePort(addr);
-
- String serviceLocatorString =
- "socket://" + addr + ":" + port + "/?" +
- "clientSocketClass=org.jboss.jms.client.remoting.ClientSocketWrapper&" +
- "dataType=jms&" +
- "marshaller=org.jboss.jms.wireformat.JMSWireFormat&" +
- "serializationtype=jboss&" +
- "socket.check_connection=false&" +
- "unmarshaller=org.jboss.jms.wireformat.JMSWireFormat";
-
- ServiceAttributeOverrides sao = new ServiceAttributeOverrides();
- sao.put(ServiceContainer.REMOTING_OBJECT_NAME, "LocatorURI", serviceLocatorString);
-
- ServerManagement.start(0, "remoting", sao, true, false);
-
- // obtain the server locator from the service itself, so we won't have any doubts we use
- // the right one
-
- serverLocator = new InvokerLocator((String)ServerManagement.
- getAttribute(ServiceContainer.REMOTING_OBJECT_NAME, "InvokerLocator"));
-
- // deploy a "lazy subsystem", that will delay invocations as long is it told to; used to
- // simulate long running invocations
-
- RemotingTestSubsystemService.
- deployService("org.jboss.test.thirdparty.remoting.LazySubsystem");
-
- log.debug("setup done");
- }
-
- protected void tearDown() throws Exception
- {
- serverLocator = null;
-
- ServerManagement.stop();
-
- super.tearDown();
- }
-
- // Private --------------------------------------------------------------------------------------
-
- // Inner classes --------------------------------------------------------------------------------
-
-}
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/InvokerReferenceCountTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/InvokerReferenceCountTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/InvokerReferenceCountTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,14 +21,14 @@
*/
package org.jboss.test.thirdparty.remoting;
+import org.jboss.test.messaging.JBMServerTestCase;
+import org.jboss.test.messaging.tools.ServerManagement;
+
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Queue;
import javax.naming.InitialContext;
-import org.jboss.test.messaging.MessagingTestCase;
-import org.jboss.test.messaging.tools.ServerManagement;
-
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @version <tt>$Revision: 1.1 $</tt>
@@ -36,7 +36,7 @@
* $Id$
*
*/
-public class InvokerReferenceCountTest extends MessagingTestCase
+public class InvokerReferenceCountTest extends JBMServerTestCase
{
public InvokerReferenceCountTest(String name)
{
@@ -49,9 +49,9 @@
{
super.setUp();
- ServerManagement.start("all");
+ //ServerManagement.startServerPeer("all");
- ServerManagement.deployQueue("testQueue");
+ deployQueue("testQueue");
InitialContext ic = new InitialContext(ServerManagement.getJNDIEnvironment());
@@ -66,7 +66,7 @@
{
super.tearDown();
- ServerManagement.undeployQueue("testQueue");
+ undeployQueue("testQueue");
ServerManagement.stop();
}
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/PureAsynchronousCallTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/PureAsynchronousCallTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/PureAsynchronousCallTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -6,8 +6,8 @@
*/
package org.jboss.test.thirdparty.remoting;
-import javax.management.ObjectName;
-
+import EDU.oswego.cs.dl.util.concurrent.Channel;
+import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
import org.jboss.logging.Logger;
import org.jboss.remoting.Client;
import org.jboss.remoting.InvocationRequest;
@@ -23,8 +23,7 @@
import org.jboss.test.thirdparty.remoting.util.OnewayCallbackTrigger;
import org.jboss.test.thirdparty.remoting.util.RemotingTestSubsystemService;
-import EDU.oswego.cs.dl.util.concurrent.Channel;
-import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
+import javax.management.ObjectName;
/**
* A test case in which we play with "pure" remoting asynchronous calls.
@@ -191,7 +190,7 @@
{
super.setUp();
- // start "raw" remoting, don't use JBM configuration
+ // startServerPeer "raw" remoting, don't use JBM configuration
String addr = ServiceContainer.getCurrentAddress();
int port = PortUtil.findFreePort(addr);
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/RemotingTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/RemotingTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/RemotingTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -21,33 +21,17 @@
*/
package org.jboss.test.thirdparty.remoting;
-import java.util.HashMap;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.Destination;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.management.MBeanServer;
-import javax.naming.InitialContext;
-
+import EDU.oswego.cs.dl.util.concurrent.Slot;
import org.jboss.logging.Logger;
-import org.jboss.remoting.Client;
-import org.jboss.remoting.ConnectionListener;
-import org.jboss.remoting.InvocationRequest;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.ServerInvocationHandler;
-import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.*;
import org.jboss.remoting.callback.InvokerCallbackHandler;
import org.jboss.remoting.transport.Connector;
-import org.jboss.test.messaging.MessagingTestCase;
-import org.jboss.test.messaging.tools.ServerManagement;
+import org.jboss.test.messaging.JBMServerTestCase;
-import EDU.oswego.cs.dl.util.concurrent.Slot;
+import javax.jms.*;
+import javax.management.MBeanServer;
+import javax.naming.InitialContext;
+import java.util.HashMap;
/**
* @author <a href="tim.fox at jboss.com">Tim Fox</a>
@@ -57,7 +41,7 @@
*
* $Id: RemotingTest.java 1935 2007-01-09 23:29:20Z clebert.suconic at jboss.com $
*/
-public class RemotingTest extends MessagingTestCase
+public class RemotingTest extends JBMServerTestCase
{
// Constants ------------------------------------------------------------------------------------
@@ -263,11 +247,11 @@
{
super.setUp();
- ServerManagement.start("all");
+ //ServerManagement.startServerPeer("all");
- ic = new InitialContext(ServerManagement.getJNDIEnvironment());
+ ic = getInitialContext();
- ServerManagement.deployTopic("ATopic");
+ deployTopic("ATopic");
log.debug("setup done");
@@ -275,7 +259,7 @@
protected void tearDown() throws Exception
{
- ServerManagement.undeployTopic("ATopic");
+ undeployTopic("ATopic");
ic.close();
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/SocketTransportCausalityTest.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/SocketTransportCausalityTest.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/SocketTransportCausalityTest.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -6,8 +6,6 @@
*/
package org.jboss.test.thirdparty.remoting;
-import java.io.Serializable;
-
import org.jboss.logging.Logger;
import org.jboss.remoting.Client;
import org.jboss.remoting.InvokerLocator;
@@ -17,6 +15,8 @@
import org.jboss.test.messaging.tools.container.ServiceAttributeOverrides;
import org.jboss.test.messaging.tools.container.ServiceContainer;
+import java.io.Serializable;
+
/**
*
* A SocketTransportCausalityTest
@@ -87,7 +87,7 @@
//
// for (int i = 0; i < NUM_THREADS; i++)
// {
-// threads[i].start();
+// threads[i].startServerPeer();
// }
//
// for (int i = 0; i < NUM_THREADS; i++)
@@ -134,7 +134,7 @@
{
super.setUp();
- // start "raw" remoting, don't use JBM configuration, with one exception: make sure the
+ // startServerPeer "raw" remoting, don't use JBM configuration, with one exception: make sure the
// server uses DirectThreadPool
String addr = ServiceContainer.getCurrentAddress();
Modified: branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/util/RemotingTestSubsystemService.java
===================================================================
--- branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/util/RemotingTestSubsystemService.java 2007-11-28 16:49:59 UTC (rev 3381)
+++ branches/Branch_MC_Integration_New/tests/src/org/jboss/test/thirdparty/remoting/util/RemotingTestSubsystemService.java 2007-11-28 19:18:54 UTC (rev 3382)
@@ -6,17 +6,16 @@
*/
package org.jboss.test.thirdparty.remoting.util;
-import java.lang.reflect.Constructor;
-
-import javax.management.MBeanRegistration;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
import org.jboss.logging.Logger;
import org.jboss.remoting.InvocationRequest;
import org.jboss.test.messaging.tools.ServerManagement;
import org.jboss.test.messaging.tools.container.ServiceContainer;
+import javax.management.MBeanRegistration;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import java.lang.reflect.Constructor;
+
/**
* A standard MBean service to be used when testing remoting.
*
@@ -50,14 +49,14 @@
"</mbean>";
ObjectName on = ServerManagement.deploy(testSubsystemConfig);
- ServerManagement.invoke(on, "start", new Object[0], new String[0]);
+ ServerManagement.invoke(on, "startServerPeer", new Object[0], new String[0]);
return on;
}
public static void undeployService(ObjectName on) throws Exception
{
- ServerManagement.invoke(on, "stop", new Object[0], new String[0]);
+ ServerManagement.invoke(on, "stopServerPeer", new Object[0], new String[0]);
ServerManagement.undeploy(on);
}
More information about the jboss-cvs-commits
mailing list