diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerManagerImpl.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerManagerImpl.java index 8edcde4330..23a4444a52 100644 --- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerManagerImpl.java +++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerManagerImpl.java @@ -436,7 +436,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback } // We have to perform the server.stop outside of the lock because of backup activation issues. // See https://bugzilla.redhat.com/show_bug.cgi?id=959616 - // And org.apache.activemq.byteman.tests.StartStopDeadlockTest which is validating for this case here + // And org.apache.activemq.extras.tests.StartStopDeadlockTest which is validating for this case here server.stop(); } diff --git a/examples/core/embedded-remote/pom.xml b/examples/core/embedded-remote/pom.xml index 93044ebe9e..91ec60ef78 100644 --- a/examples/core/embedded-remote/pom.xml +++ b/examples/core/embedded-remote/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.core core-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-core-embedded-remote-example diff --git a/examples/core/embedded/pom.xml b/examples/core/embedded/pom.xml index bcd878f0ee..697101bdd6 100644 --- a/examples/core/embedded/pom.xml +++ b/examples/core/embedded/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.core core-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-core-embedded-example diff --git a/examples/core/perf/pom.xml b/examples/core/perf/pom.xml index f8bc523d11..1ef4dcc19e 100644 --- a/examples/core/perf/pom.xml +++ b/examples/core/perf/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.core core-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-core-perf-example diff --git a/examples/core/vertx-connector/pom.xml b/examples/core/vertx-connector/pom.xml index 0b94b507d7..8c500f1022 100644 --- a/examples/core/vertx-connector/pom.xml +++ b/examples/core/vertx-connector/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.core core-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-vertx-example diff --git a/examples/jms/activemq-ra-rar/pom.xml b/examples/jms/activemq-ra-rar/pom.xml index c3a56cc146..d3f2026c51 100644 --- a/examples/jms/activemq-ra-rar/pom.xml +++ b/examples/jms/activemq-ra-rar/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-rar diff --git a/examples/jms/aerogear/pom.xml b/examples/jms/aerogear/pom.xml index 155a38b37c..c9cf4c92c1 100644 --- a/examples/jms/aerogear/pom.xml +++ b/examples/jms/aerogear/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT diff --git a/examples/jms/applet/pom.xml b/examples/jms/applet/pom.xml index 6380dbb96d..c09ec623ef 100644 --- a/examples/jms/applet/pom.xml +++ b/examples/jms/applet/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-applet-example diff --git a/examples/jms/application-layer-failover/pom.xml b/examples/jms/application-layer-failover/pom.xml index 643c002ef3..6092f88d9d 100644 --- a/examples/jms/application-layer-failover/pom.xml +++ b/examples/jms/application-layer-failover/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-application-layer-failover-example diff --git a/examples/jms/bridge/pom.xml b/examples/jms/bridge/pom.xml index 5e543c2ce4..d5cb9ea53d 100644 --- a/examples/jms/bridge/pom.xml +++ b/examples/jms/bridge/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-bridge-example diff --git a/examples/jms/browser/pom.xml b/examples/jms/browser/pom.xml index f399c7194b..51892e07d9 100644 --- a/examples/jms/browser/pom.xml +++ b/examples/jms/browser/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-browser-example diff --git a/examples/jms/client-kickoff/pom.xml b/examples/jms/client-kickoff/pom.xml index 0f088b7ef8..442d88a2cc 100644 --- a/examples/jms/client-kickoff/pom.xml +++ b/examples/jms/client-kickoff/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-client-kickoff-example diff --git a/examples/jms/client-side-failoverlistener/pom.xml b/examples/jms/client-side-failoverlistener/pom.xml index 1498db83a2..2e116e9cd0 100644 --- a/examples/jms/client-side-failoverlistener/pom.xml +++ b/examples/jms/client-side-failoverlistener/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-client-side-fileoverlistener-example diff --git a/examples/jms/client-side-load-balancing/pom.xml b/examples/jms/client-side-load-balancing/pom.xml index 72dc7d3a32..b1896a9895 100644 --- a/examples/jms/client-side-load-balancing/pom.xml +++ b/examples/jms/client-side-load-balancing/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-client-side-load-balancing-example diff --git a/examples/jms/clustered-durable-subscription/pom.xml b/examples/jms/clustered-durable-subscription/pom.xml index 3044c71031..43d8ae707e 100644 --- a/examples/jms/clustered-durable-subscription/pom.xml +++ b/examples/jms/clustered-durable-subscription/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-clustered-durable-subscription-example diff --git a/examples/jms/clustered-grouping/pom.xml b/examples/jms/clustered-grouping/pom.xml index d84dc90a20..ffd3ea52d6 100644 --- a/examples/jms/clustered-grouping/pom.xml +++ b/examples/jms/clustered-grouping/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-clustered-grouping-example diff --git a/examples/jms/clustered-jgroups/pom.xml b/examples/jms/clustered-jgroups/pom.xml index 6c5b79be87..61dd54e55d 100644 --- a/examples/jms/clustered-jgroups/pom.xml +++ b/examples/jms/clustered-jgroups/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT clustered-jgroups diff --git a/examples/jms/clustered-queue/pom.xml b/examples/jms/clustered-queue/pom.xml index e637561fd2..d6d0aa3123 100644 --- a/examples/jms/clustered-queue/pom.xml +++ b/examples/jms/clustered-queue/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT clustered-queue diff --git a/examples/jms/clustered-standalone/pom.xml b/examples/jms/clustered-standalone/pom.xml index 323f94e407..6542869361 100644 --- a/examples/jms/clustered-standalone/pom.xml +++ b/examples/jms/clustered-standalone/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-clustered-standalone-example diff --git a/examples/jms/clustered-static-discovery/pom.xml b/examples/jms/clustered-static-discovery/pom.xml index c8e17c447d..48c0d4d0ed 100644 --- a/examples/jms/clustered-static-discovery/pom.xml +++ b/examples/jms/clustered-static-discovery/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-clustered-static-discovery-example diff --git a/examples/jms/clustered-static-oneway/pom.xml b/examples/jms/clustered-static-oneway/pom.xml index 0ff0e61c68..ec9af39194 100644 --- a/examples/jms/clustered-static-oneway/pom.xml +++ b/examples/jms/clustered-static-oneway/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-clustered-static-oneway-example diff --git a/examples/jms/clustered-topic/pom.xml b/examples/jms/clustered-topic/pom.xml index 415b5ca156..f28b58ab8a 100644 --- a/examples/jms/clustered-topic/pom.xml +++ b/examples/jms/clustered-topic/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-clustered-topic-example diff --git a/examples/jms/colocated-failover-scale-down/pom.xml b/examples/jms/colocated-failover-scale-down/pom.xml index ace154d237..64238e693c 100644 --- a/examples/jms/colocated-failover-scale-down/pom.xml +++ b/examples/jms/colocated-failover-scale-down/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT colocated-failover-scale-down diff --git a/examples/jms/colocated-failover/pom.xml b/examples/jms/colocated-failover/pom.xml index 7a0e91518e..11c28a9fdb 100644 --- a/examples/jms/colocated-failover/pom.xml +++ b/examples/jms/colocated-failover/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT colocated-failover diff --git a/examples/jms/consumer-rate-limit/pom.xml b/examples/jms/consumer-rate-limit/pom.xml index ebd38e1265..2269fd7b56 100644 --- a/examples/jms/consumer-rate-limit/pom.xml +++ b/examples/jms/consumer-rate-limit/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-consumer-rate-limit-example diff --git a/examples/jms/dead-letter/pom.xml b/examples/jms/dead-letter/pom.xml index 48e83b204e..4fa9bcac97 100644 --- a/examples/jms/dead-letter/pom.xml +++ b/examples/jms/dead-letter/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-dead-letter-example diff --git a/examples/jms/delayed-redelivery/pom.xml b/examples/jms/delayed-redelivery/pom.xml index aaa243dddd..eb24e1d9b7 100644 --- a/examples/jms/delayed-redelivery/pom.xml +++ b/examples/jms/delayed-redelivery/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-delayed-redelivery-example diff --git a/examples/jms/divert/pom.xml b/examples/jms/divert/pom.xml index 51c139ffc7..2651264656 100644 --- a/examples/jms/divert/pom.xml +++ b/examples/jms/divert/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-divert-example diff --git a/examples/jms/durable-subscription/pom.xml b/examples/jms/durable-subscription/pom.xml index 1ec4173e98..ab00230f46 100644 --- a/examples/jms/durable-subscription/pom.xml +++ b/examples/jms/durable-subscription/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-durable-subscription-example diff --git a/examples/jms/embedded-simple/pom.xml b/examples/jms/embedded-simple/pom.xml index 8ee8f0050f..f988743e74 100644 --- a/examples/jms/embedded-simple/pom.xml +++ b/examples/jms/embedded-simple/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-embedded-simple-example diff --git a/examples/jms/embedded/pom.xml b/examples/jms/embedded/pom.xml index ee662b6464..0ed98b3377 100644 --- a/examples/jms/embedded/pom.xml +++ b/examples/jms/embedded/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-embedded-example diff --git a/examples/jms/expiry/pom.xml b/examples/jms/expiry/pom.xml index fc53819336..470ce6493f 100644 --- a/examples/jms/expiry/pom.xml +++ b/examples/jms/expiry/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-expiry-example diff --git a/examples/jms/ha-policy-autobackup/pom.xml b/examples/jms/ha-policy-autobackup/pom.xml index 1d95ce9e6a..34e537f659 100644 --- a/examples/jms/ha-policy-autobackup/pom.xml +++ b/examples/jms/ha-policy-autobackup/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT ha-policy-autobackup diff --git a/examples/jms/http-transport/pom.xml b/examples/jms/http-transport/pom.xml index a98c42ede1..e50d33b3eb 100644 --- a/examples/jms/http-transport/pom.xml +++ b/examples/jms/http-transport/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-http-transport-example diff --git a/examples/jms/instantiate-connection-factory/pom.xml b/examples/jms/instantiate-connection-factory/pom.xml index 0feefe7df9..5c5b146834 100644 --- a/examples/jms/instantiate-connection-factory/pom.xml +++ b/examples/jms/instantiate-connection-factory/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-instantiate-connection-factory-example diff --git a/examples/jms/interceptor/pom.xml b/examples/jms/interceptor/pom.xml index 7542c97311..7eb9bd2f26 100644 --- a/examples/jms/interceptor/pom.xml +++ b/examples/jms/interceptor/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-interceptor-example diff --git a/examples/jms/jms-auto-closeable/pom.xml b/examples/jms/jms-auto-closeable/pom.xml index 08cb5c5882..07ff9c7a7c 100644 --- a/examples/jms/jms-auto-closeable/pom.xml +++ b/examples/jms/jms-auto-closeable/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-auto-closeable-example diff --git a/examples/jms/jms-bridge/pom.xml b/examples/jms/jms-bridge/pom.xml index b1f5657820..ba67817ad7 100644 --- a/examples/jms/jms-bridge/pom.xml +++ b/examples/jms/jms-bridge/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-jms-bridge-example diff --git a/examples/jms/jms-completion-listener/pom.xml b/examples/jms/jms-completion-listener/pom.xml index 016ed96dc6..bc3d2a5731 100644 --- a/examples/jms/jms-completion-listener/pom.xml +++ b/examples/jms/jms-completion-listener/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-completion-listener-example diff --git a/examples/jms/jms-context/pom.xml b/examples/jms/jms-context/pom.xml index b26dbe6d79..9005f2867f 100644 --- a/examples/jms/jms-context/pom.xml +++ b/examples/jms/jms-context/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-context-example diff --git a/examples/jms/jms-shared-consumer/pom.xml b/examples/jms/jms-shared-consumer/pom.xml index 160514fc22..68c258177c 100644 --- a/examples/jms/jms-shared-consumer/pom.xml +++ b/examples/jms/jms-shared-consumer/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-shared-consumer-example diff --git a/examples/jms/jmx/pom.xml b/examples/jms/jmx/pom.xml index 6f94acc491..dbf0d95f13 100644 --- a/examples/jms/jmx/pom.xml +++ b/examples/jms/jmx/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-jmx-example diff --git a/examples/jms/large-message/pom.xml b/examples/jms/large-message/pom.xml index 94a9177005..eb7a06a403 100644 --- a/examples/jms/large-message/pom.xml +++ b/examples/jms/large-message/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-large-message-example diff --git a/examples/jms/last-value-queue/pom.xml b/examples/jms/last-value-queue/pom.xml index fd1c984aea..24acc7533d 100644 --- a/examples/jms/last-value-queue/pom.xml +++ b/examples/jms/last-value-queue/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-last-value-queue-example diff --git a/examples/jms/management-notifications/pom.xml b/examples/jms/management-notifications/pom.xml index d9d3adaca9..c9fd2fa030 100644 --- a/examples/jms/management-notifications/pom.xml +++ b/examples/jms/management-notifications/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-management-notifications-example diff --git a/examples/jms/management/pom.xml b/examples/jms/management/pom.xml index 24c995fd6d..d6e70cace4 100644 --- a/examples/jms/management/pom.xml +++ b/examples/jms/management/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-management-example diff --git a/examples/jms/message-counters/pom.xml b/examples/jms/message-counters/pom.xml index 84a3b304cf..a429a78814 100644 --- a/examples/jms/message-counters/pom.xml +++ b/examples/jms/message-counters/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-message-counters-example diff --git a/examples/jms/message-group/pom.xml b/examples/jms/message-group/pom.xml index bea5966961..575f0e6c8f 100644 --- a/examples/jms/message-group/pom.xml +++ b/examples/jms/message-group/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-message-group-example diff --git a/examples/jms/message-group2/pom.xml b/examples/jms/message-group2/pom.xml index 514d2fcdc2..081a8280db 100644 --- a/examples/jms/message-group2/pom.xml +++ b/examples/jms/message-group2/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-message-group2-example diff --git a/examples/jms/message-priority/pom.xml b/examples/jms/message-priority/pom.xml index 0e69b563aa..acceb38578 100644 --- a/examples/jms/message-priority/pom.xml +++ b/examples/jms/message-priority/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-message-priority-example diff --git a/examples/jms/multiple-failover-failback/pom.xml b/examples/jms/multiple-failover-failback/pom.xml index 4340245b74..98b4cfb263 100644 --- a/examples/jms/multiple-failover-failback/pom.xml +++ b/examples/jms/multiple-failover-failback/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-multiple-failover-failback-example diff --git a/examples/jms/multiple-failover/pom.xml b/examples/jms/multiple-failover/pom.xml index e94d855bc4..b908ab3862 100644 --- a/examples/jms/multiple-failover/pom.xml +++ b/examples/jms/multiple-failover/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-multiple-failover-example diff --git a/examples/jms/no-consumer-buffering/pom.xml b/examples/jms/no-consumer-buffering/pom.xml index 68eea6be2e..c52775db3d 100644 --- a/examples/jms/no-consumer-buffering/pom.xml +++ b/examples/jms/no-consumer-buffering/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-no-consumer-buffering-example diff --git a/examples/jms/non-transaction-failover/pom.xml b/examples/jms/non-transaction-failover/pom.xml index ce21ab6780..ac560750ba 100644 --- a/examples/jms/non-transaction-failover/pom.xml +++ b/examples/jms/non-transaction-failover/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT non-transaction-failover diff --git a/examples/jms/openwire/pom.xml b/examples/jms/openwire/pom.xml index 7db1b2d27e..4457a6f246 100644 --- a/examples/jms/openwire/pom.xml +++ b/examples/jms/openwire/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-openwire-example diff --git a/examples/jms/paging/pom.xml b/examples/jms/paging/pom.xml index 24f152185b..9f4ca092ce 100644 --- a/examples/jms/paging/pom.xml +++ b/examples/jms/paging/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-paging-example diff --git a/examples/jms/perf/pom.xml b/examples/jms/perf/pom.xml index fe4fc0184d..77bff21ee0 100644 --- a/examples/jms/perf/pom.xml +++ b/examples/jms/perf/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-perf-example diff --git a/examples/jms/pre-acknowledge/pom.xml b/examples/jms/pre-acknowledge/pom.xml index 9acf23534d..5ef6f0c819 100644 --- a/examples/jms/pre-acknowledge/pom.xml +++ b/examples/jms/pre-acknowledge/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-pre-acknowledge-example diff --git a/examples/jms/producer-rate-limit/pom.xml b/examples/jms/producer-rate-limit/pom.xml index ffb7104781..32b45ca253 100644 --- a/examples/jms/producer-rate-limit/pom.xml +++ b/examples/jms/producer-rate-limit/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-producer-rate-limit-example diff --git a/examples/jms/proton-cpp/pom.xml b/examples/jms/proton-cpp/pom.xml index f060cef575..a8141bb52e 100644 --- a/examples/jms/proton-cpp/pom.xml +++ b/examples/jms/proton-cpp/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-protoncpp diff --git a/examples/jms/proton-j/pom.xml b/examples/jms/proton-j/pom.xml index a461ebf70b..455c6004df 100644 --- a/examples/jms/proton-j/pom.xml +++ b/examples/jms/proton-j/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-proton-j-example diff --git a/examples/jms/proton-ruby/pom.xml b/examples/jms/proton-ruby/pom.xml index 46ca0917ae..8f1f6481f2 100644 --- a/examples/jms/proton-ruby/pom.xml +++ b/examples/jms/proton-ruby/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-proton-ruby-example diff --git a/examples/jms/queue-message-redistribution/pom.xml b/examples/jms/queue-message-redistribution/pom.xml index 1aff7e0a2c..7b17a27832 100644 --- a/examples/jms/queue-message-redistribution/pom.xml +++ b/examples/jms/queue-message-redistribution/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-queue-message-redistribution-example diff --git a/examples/jms/queue-requestor/pom.xml b/examples/jms/queue-requestor/pom.xml index a5beffc00d..59d4413c89 100644 --- a/examples/jms/queue-requestor/pom.xml +++ b/examples/jms/queue-requestor/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-queue-requestor-example diff --git a/examples/jms/queue-selector/pom.xml b/examples/jms/queue-selector/pom.xml index 50bb7ec53d..0f4f2d3113 100644 --- a/examples/jms/queue-selector/pom.xml +++ b/examples/jms/queue-selector/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-queue-selector-example diff --git a/examples/jms/queue/pom.xml b/examples/jms/queue/pom.xml index cb922118a3..412c6a62ba 100644 --- a/examples/jms/queue/pom.xml +++ b/examples/jms/queue/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-queue-example diff --git a/examples/jms/reattach-node/pom.xml b/examples/jms/reattach-node/pom.xml index 13c6547c0b..9ca8b32aee 100644 --- a/examples/jms/reattach-node/pom.xml +++ b/examples/jms/reattach-node/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-reattach-node-example diff --git a/examples/jms/replicated-failback-static/pom.xml b/examples/jms/replicated-failback-static/pom.xml index ec6b1bb73b..8c668dfcdd 100644 --- a/examples/jms/replicated-failback-static/pom.xml +++ b/examples/jms/replicated-failback-static/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-replicated-failback-static-example diff --git a/examples/jms/replicated-failback/pom.xml b/examples/jms/replicated-failback/pom.xml index 498bc1a5e1..f8b87fe257 100644 --- a/examples/jms/replicated-failback/pom.xml +++ b/examples/jms/replicated-failback/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-replicated-failback-example diff --git a/examples/jms/replicated-multiple-failover/pom.xml b/examples/jms/replicated-multiple-failover/pom.xml index 8f57a01f7a..c22a131572 100644 --- a/examples/jms/replicated-multiple-failover/pom.xml +++ b/examples/jms/replicated-multiple-failover/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-replicated-multiple-failover-example diff --git a/examples/jms/replicated-transaction-failover/pom.xml b/examples/jms/replicated-transaction-failover/pom.xml index 3aa787e0e6..4e6481bcfa 100644 --- a/examples/jms/replicated-transaction-failover/pom.xml +++ b/examples/jms/replicated-transaction-failover/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-replicated-transaction-failover-example diff --git a/examples/jms/request-reply/pom.xml b/examples/jms/request-reply/pom.xml index 0ed6707d35..1efced55f4 100644 --- a/examples/jms/request-reply/pom.xml +++ b/examples/jms/request-reply/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-request-reply-example diff --git a/examples/jms/rest/dup-send/pom.xml b/examples/jms/rest/dup-send/pom.xml index 666f41080b..e4d011fb40 100644 --- a/examples/jms/rest/dup-send/pom.xml +++ b/examples/jms/rest/dup-send/pom.xml @@ -24,7 +24,7 @@ under the License. org.apache.activemq.rest.examples activemq-rest-examples-pom - 6.0.0 + 6.0.1-SNAPSHOT dup-send war diff --git a/examples/jms/rest/javascript-chat/pom.xml b/examples/jms/rest/javascript-chat/pom.xml index 7221ea42a6..34b62bdf41 100644 --- a/examples/jms/rest/javascript-chat/pom.xml +++ b/examples/jms/rest/javascript-chat/pom.xml @@ -24,7 +24,7 @@ under the License. org.apache.activemq.rest.examples activemq-rest-examples-pom - 6.0.0 + 6.0.1-SNAPSHOT javascript-chat war diff --git a/examples/jms/rest/jms-to-rest/pom.xml b/examples/jms/rest/jms-to-rest/pom.xml index 54131dd2e1..f8af591f27 100644 --- a/examples/jms/rest/jms-to-rest/pom.xml +++ b/examples/jms/rest/jms-to-rest/pom.xml @@ -24,7 +24,7 @@ under the License. org.apache.activemq.rest.examples activemq-rest-examples-pom - 6.0.0 + 6.0.1-SNAPSHOT mixed-jms-rest war diff --git a/examples/jms/rest/pom.xml b/examples/jms/rest/pom.xml index 345387a2a1..d4496cadb3 100644 --- a/examples/jms/rest/pom.xml +++ b/examples/jms/rest/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT org.apache.activemq.rest.examples diff --git a/examples/jms/rest/push/pom.xml b/examples/jms/rest/push/pom.xml index 22fe50cbe2..26b63159d0 100644 --- a/examples/jms/rest/push/pom.xml +++ b/examples/jms/rest/push/pom.xml @@ -24,7 +24,7 @@ under the License. org.apache.activemq.rest.examples activemq-rest-examples-pom - 6.0.0 + 6.0.1-SNAPSHOT push war diff --git a/examples/jms/scale-down/pom.xml b/examples/jms/scale-down/pom.xml index dbccd495a0..96568724ee 100644 --- a/examples/jms/scale-down/pom.xml +++ b/examples/jms/scale-down/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT scale-down diff --git a/examples/jms/scheduled-message/pom.xml b/examples/jms/scheduled-message/pom.xml index f3fd1bdffc..285b6caf94 100644 --- a/examples/jms/scheduled-message/pom.xml +++ b/examples/jms/scheduled-message/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-scheduled-message-example diff --git a/examples/jms/security/pom.xml b/examples/jms/security/pom.xml index db98baa4e1..2b014298f3 100644 --- a/examples/jms/security/pom.xml +++ b/examples/jms/security/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-security-example diff --git a/examples/jms/send-acknowledgements/pom.xml b/examples/jms/send-acknowledgements/pom.xml index 95b6aa670a..6e62ebcbf7 100644 --- a/examples/jms/send-acknowledgements/pom.xml +++ b/examples/jms/send-acknowledgements/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-send-acknowledgements-example diff --git a/examples/jms/spring-integration/pom.xml b/examples/jms/spring-integration/pom.xml index c24bfa7fb7..424eda75ee 100644 --- a/examples/jms/spring-integration/pom.xml +++ b/examples/jms/spring-integration/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-spring-integration-example diff --git a/examples/jms/ssl-enabled/pom.xml b/examples/jms/ssl-enabled/pom.xml index 015b72df95..1327824eb6 100644 --- a/examples/jms/ssl-enabled/pom.xml +++ b/examples/jms/ssl-enabled/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-ssl-enabled-example diff --git a/examples/jms/static-selector-jms/pom.xml b/examples/jms/static-selector-jms/pom.xml index 16824ba28d..122ad5f77b 100644 --- a/examples/jms/static-selector-jms/pom.xml +++ b/examples/jms/static-selector-jms/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-static-selector-jms-example diff --git a/examples/jms/static-selector/pom.xml b/examples/jms/static-selector/pom.xml index 80380a5c4a..680cb78ae9 100644 --- a/examples/jms/static-selector/pom.xml +++ b/examples/jms/static-selector/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-static-selector-example diff --git a/examples/jms/stomp-websockets/pom.xml b/examples/jms/stomp-websockets/pom.xml index d05748e62f..a93e6654d9 100644 --- a/examples/jms/stomp-websockets/pom.xml +++ b/examples/jms/stomp-websockets/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-stomp-websockets-example diff --git a/examples/jms/stomp/pom.xml b/examples/jms/stomp/pom.xml index e8c1cdc56d..19d404865a 100644 --- a/examples/jms/stomp/pom.xml +++ b/examples/jms/stomp/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-stomp-example diff --git a/examples/jms/stomp1.1/pom.xml b/examples/jms/stomp1.1/pom.xml index d1cc80165d..a7ca522f3a 100644 --- a/examples/jms/stomp1.1/pom.xml +++ b/examples/jms/stomp1.1/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-stomp1.1-example diff --git a/examples/jms/stomp1.2/pom.xml b/examples/jms/stomp1.2/pom.xml index 6ef423b6ab..0375a48d09 100644 --- a/examples/jms/stomp1.2/pom.xml +++ b/examples/jms/stomp1.2/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-stomp1.2-example diff --git a/examples/jms/stop-server-failover/pom.xml b/examples/jms/stop-server-failover/pom.xml index 2e2deae82b..c1fce775cf 100644 --- a/examples/jms/stop-server-failover/pom.xml +++ b/examples/jms/stop-server-failover/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-stop-server-failover-example diff --git a/examples/jms/symmetric-cluster/pom.xml b/examples/jms/symmetric-cluster/pom.xml index 913a8e6a41..200c4be076 100644 --- a/examples/jms/symmetric-cluster/pom.xml +++ b/examples/jms/symmetric-cluster/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-symmetric-cluster-example diff --git a/examples/jms/temp-queue/pom.xml b/examples/jms/temp-queue/pom.xml index 8d14ba3489..6574b3e03f 100644 --- a/examples/jms/temp-queue/pom.xml +++ b/examples/jms/temp-queue/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-temp-queue-example diff --git a/examples/jms/topic-hierarchies/pom.xml b/examples/jms/topic-hierarchies/pom.xml index 52eba52296..0787010ee0 100644 --- a/examples/jms/topic-hierarchies/pom.xml +++ b/examples/jms/topic-hierarchies/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-topic-hierarchies-example diff --git a/examples/jms/topic-selector-example1/pom.xml b/examples/jms/topic-selector-example1/pom.xml index d57cdebe26..65ad547bbb 100644 --- a/examples/jms/topic-selector-example1/pom.xml +++ b/examples/jms/topic-selector-example1/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-topic-selector-example1-example diff --git a/examples/jms/topic-selector-example2/pom.xml b/examples/jms/topic-selector-example2/pom.xml index a7f1ecd6f1..f7d8afbdfc 100644 --- a/examples/jms/topic-selector-example2/pom.xml +++ b/examples/jms/topic-selector-example2/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-topic-selector-example2-example diff --git a/examples/jms/topic/pom.xml b/examples/jms/topic/pom.xml index 2c8d91f7b3..47afc561b4 100644 --- a/examples/jms/topic/pom.xml +++ b/examples/jms/topic/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-topic-example diff --git a/examples/jms/transaction-failover/pom.xml b/examples/jms/transaction-failover/pom.xml index 3730318d9e..b7887ab360 100644 --- a/examples/jms/transaction-failover/pom.xml +++ b/examples/jms/transaction-failover/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-transaction-failover-example diff --git a/examples/jms/transactional/pom.xml b/examples/jms/transactional/pom.xml index 7dfb9b82b5..c66afe04d2 100644 --- a/examples/jms/transactional/pom.xml +++ b/examples/jms/transactional/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-transactional-example diff --git a/examples/jms/xa-heuristic/pom.xml b/examples/jms/xa-heuristic/pom.xml index 167cc5448c..df9144d3e3 100644 --- a/examples/jms/xa-heuristic/pom.xml +++ b/examples/jms/xa-heuristic/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-xa-heuristic-example diff --git a/examples/jms/xa-receive/pom.xml b/examples/jms/xa-receive/pom.xml index fff7652c6f..fc7c3e5f4a 100644 --- a/examples/jms/xa-receive/pom.xml +++ b/examples/jms/xa-receive/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-xa-receive-example diff --git a/examples/jms/xa-send/pom.xml b/examples/jms/xa-send/pom.xml index 6f97c07eaf..1e3e7d97e4 100644 --- a/examples/jms/xa-send/pom.xml +++ b/examples/jms/xa-send/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples.jms jms-examples - 6.0.0 + 6.0.1-SNAPSHOT activemq-jms-xa-send-example diff --git a/examples/soak/normal/pom.xml b/examples/soak/normal/pom.xml index 61ee70ef38..0913e654a2 100644 --- a/examples/soak/normal/pom.xml +++ b/examples/soak/normal/pom.xml @@ -29,7 +29,7 @@ under the License. org.apache.activemq.example.soak soak-examples - 6.0.0 + 6.0.1-SNAPSHOT diff --git a/examples/soak/pom.xml b/examples/soak/pom.xml index c23f290417..aa6961be5b 100644 --- a/examples/soak/pom.xml +++ b/examples/soak/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.activemq.examples activemq-examples - 6.0.0 + 6.0.1-SNAPSHOT org.apache.activemq.example.soak diff --git a/pom.xml b/pom.xml index 6122b1d589..77ae86f6dd 100644 --- a/pom.xml +++ b/pom.xml @@ -63,7 +63,7 @@ 3.0.9.Final true true - true + true true true true @@ -517,7 +517,7 @@ true true true - false + false @@ -552,7 +552,7 @@ false false false - false + false false diff --git a/tests/concurrent-tests/pom.xml b/tests/concurrent-tests/pom.xml deleted file mode 100644 index 773c7d0ae4..0000000000 --- a/tests/concurrent-tests/pom.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - 4.0.0 - - org.apache.activemq.tests - activemq-tests-pom - 6.0.0 - - - concurrent-tests - jar - ActiveMQ6 concurrent Tests - - - ${project.basedir}/../.. - - - - - org.apache.activemq - activemq-core-client - ${project.version} - test - test-jar - - - org.apache.activemq - activemq-server - ${project.version} - test - test-jar - - - org.apache.activemq.tests - unit-tests - ${project.version} - test - test-jar - - - org.apache.activemq.tests - integration-tests - ${project.version} - test - test-jar - - - org.apache.activemq - activemq-jms-client - ${project.version} - - - org.apache.activemq - activemq-ra - ${project.version} - - - org.apache.activemq - activemq-bootstrap - ${project.version} - - - junit - junit - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - ${skipConcurrentTests} - - **/*Test.java - - ${activemq-surefire-argline} - - - - - - diff --git a/tests/byteman-tests/pom.xml b/tests/extra-tests/pom.xml similarity index 90% rename from tests/byteman-tests/pom.xml rename to tests/extra-tests/pom.xml index 5002c5c1ea..3329bf31c4 100644 --- a/tests/byteman-tests/pom.xml +++ b/tests/extra-tests/pom.xml @@ -14,18 +14,23 @@ See the License for the specific language governing permissions and limitations under the License. --> + + 4.0.0 org.apache.activemq.tests activemq-tests-pom - 6.0.0 + 6.0.1-SNAPSHOT - byteman-tests + extra-tests jar - ActiveMQ6 ByteMan Tests + ActiveMQ6 Extra Tests ${java.home}/../lib/tools.jar @@ -163,6 +168,21 @@ junit junit + + + + + + org.jboss.jbossts.jts + jbossjts-jacorb + 4.17.13.Final + + + org.jboss + jboss-transaction-spi + 7.1.0.Final + + @@ -183,10 +203,7 @@ org.apache.maven.plugins maven-surefire-plugin - ${skipBytemanTests} - - org.apache.activemq/byteman/tests/*.java - + ${skipExtraTests} diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/ExtrasTestLogger.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/ExtrasTestLogger.java new file mode 100644 index 0000000000..c97d01a270 --- /dev/null +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/ExtrasTestLogger.java @@ -0,0 +1,34 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.activemq.tests.extras; + +import org.jboss.logging.BasicLogger; +import org.jboss.logging.Logger; +import org.jboss.logging.annotations.MessageLogger; + +/** + * @author Andy Taylor + * 4/18/12 + */ +@MessageLogger(projectCode = "HQTEST") +public interface ExtrasTestLogger extends BasicLogger +{ + /** + * The integration test logger. + */ + ExtrasTestLogger LOGGER = Logger.getMessageLogger(ExtrasTestLogger.class, ExtrasTestLogger.class.getPackage().getName()); +} diff --git a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ActiveMQMessageHandlerTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/ActiveMQMessageHandlerTest.java similarity index 98% rename from tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ActiveMQMessageHandlerTest.java rename to tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/ActiveMQMessageHandlerTest.java index fe07bd09e7..0914295322 100644 --- a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ActiveMQMessageHandlerTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/ActiveMQMessageHandlerTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.byteman.tests; +package org.apache.activemq.tests.extras.byteman; import com.arjuna.ats.arjuna.coordinator.TransactionReaper; import com.arjuna.ats.arjuna.coordinator.TxControl; @@ -81,7 +81,7 @@ public class ActiveMQMessageHandlerTest extends ActiveMQRATestBase targetClass = "org.apache.activemq.core.protocol.core.impl.ActiveMQSessionContext", targetMethod = "xaEnd", targetLocation = "ENTRY", - action = "org.apache.activemq.byteman.tests.ActiveMQMessageHandlerTest.interrupt();" + action = "org.apache.activemq.tests.extras.byteman.ActiveMQMessageHandlerTest.interrupt();" ) } ) @@ -158,7 +158,7 @@ public class ActiveMQMessageHandlerTest extends ActiveMQRATestBase targetClass = "org.apache.activemq.core.protocol.core.impl.ActiveMQSessionContext", targetMethod = "xaEnd", targetLocation = "ENTRY", - action = "org.apache.activemq.byteman.tests.ActiveMQMessageHandlerTest.interrupt();" + action = "org.apache.activemq.tests.extras.byteman.ActiveMQMessageHandlerTest.interrupt();" ) } ) diff --git a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/BMFailoverTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/BMFailoverTest.java similarity index 96% rename from tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/BMFailoverTest.java rename to tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/BMFailoverTest.java index 49f101f82d..fb91994b18 100644 --- a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/BMFailoverTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/BMFailoverTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.byteman.tests; +package org.apache.activemq.tests.extras.byteman; import javax.transaction.xa.XAException; import javax.transaction.xa.XAResource; @@ -115,7 +115,7 @@ public class BMFailoverTest extends FailoverTestBase targetClass = "org.apache.activemq.core.protocol.core.impl.ActiveMQSessionContext", targetMethod = "xaEnd", targetLocation = "AT EXIT", - action = "org.apache.activemq.byteman.tests.BMFailoverTest.stopAndThrow()" + action = "org.apache.activemq.tests.extras.byteman.BMFailoverTest.stopAndThrow()" ) } ) @@ -206,7 +206,7 @@ public class BMFailoverTest extends FailoverTestBase targetClass = "org.apache.activemq.core.client.impl.ClientSessionImpl", targetMethod = "start(javax.transaction.xa.Xid, int)", targetLocation = "AT EXIT", - action = "org.apache.activemq.byteman.tests.BMFailoverTest.serverToStop.getServer().stop(true)" + action = "org.apache.activemq.tests.extras.byteman.BMFailoverTest.serverToStop.getServer().stop(true)" ) } ) @@ -309,7 +309,7 @@ public class BMFailoverTest extends FailoverTestBase targetClass = "org.apache.activemq.core.client.impl.ClientSessionImpl", targetMethod = "commit", targetLocation = "ENTRY", - action = "org.apache.activemq.byteman.tests.BMFailoverTest.serverToStop.getServer().stop(true)" + action = "org.apache.activemq.tests.extras.byteman.BMFailoverTest.serverToStop.getServer().stop(true)" ) } ) @@ -350,7 +350,7 @@ public class BMFailoverTest extends FailoverTestBase targetClass = "org.apache.activemq.core.client.impl.ClientSessionImpl", targetMethod = "commit", targetLocation = "ENTRY", - action = "org.apache.activemq.byteman.tests.BMFailoverTest.serverToStop.getServer().stop(true)" + action = "org.apache.activemq.tests.extras.byteman.BMFailoverTest.serverToStop.getServer().stop(true)" ) } ) diff --git a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/BridgeServerLocatorConfigurationTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/BridgeServerLocatorConfigurationTest.java similarity index 97% rename from tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/BridgeServerLocatorConfigurationTest.java rename to tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/BridgeServerLocatorConfigurationTest.java index 9e166f9b3e..bf97f5a46d 100644 --- a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/BridgeServerLocatorConfigurationTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/BridgeServerLocatorConfigurationTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.byteman.tests; +package org.apache.activemq.tests.extras.byteman; import java.util.ArrayList; import java.util.HashMap; @@ -57,7 +57,7 @@ public class BridgeServerLocatorConfigurationTest extends ServiceTestBase @Test @BMRule(name = "check connection ttl", - targetClass = "org.apache.activemq.byteman.tests.BridgeServerLocatorConfigurationTest", + targetClass = "org.apache.activemq.tests.extras.byteman.BridgeServerLocatorConfigurationTest", targetMethod = "getBridgeTTL(ActiveMQServer, String)", targetLocation = "EXIT", action = "$! = $0.getConfiguredBridge($1).serverLocator.getConnectionTTL();") /** diff --git a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ClosingConnectionTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/ClosingConnectionTest.java similarity index 97% rename from tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ClosingConnectionTest.java rename to tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/ClosingConnectionTest.java index cd804e1a8f..cd3ee24999 100644 --- a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ClosingConnectionTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/ClosingConnectionTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.byteman.tests; +package org.apache.activemq.tests.extras.byteman; import javax.management.MBeanServer; import javax.management.MBeanServerFactory; @@ -128,7 +128,7 @@ public class ClosingConnectionTest extends ServiceTestBase targetClass = "org.apache.activemq.core.journal.impl.NIOSequentialFile", targetMethod = "open(int, boolean)", targetLocation = "AT INVOKE java.nio.channels.FileChannel.size()", - action = "org.apache.activemq.byteman.tests.ClosingConnectionTest.killConnection();" + action = "org.apache.activemq.tests.extras.byteman.ClosingConnectionTest.killConnection();" ) } diff --git a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ClusteredGroupingTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/ClusteredGroupingTest.java similarity index 94% rename from tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ClusteredGroupingTest.java rename to tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/ClusteredGroupingTest.java index f74d816222..bc9f85319b 100644 --- a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ClusteredGroupingTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/ClusteredGroupingTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.byteman.tests; +package org.apache.activemq.tests.extras.byteman; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -54,7 +54,7 @@ public class ClusteredGroupingTest extends ClusterTestBase targetClass = "org.apache.activemq.core.server.group.impl.LocalGroupingHandler", targetMethod = "removeGrouping", targetLocation = "ENTRY", - action = "org.apache.activemq.byteman.tests.ClusteredGroupingTest.pause($1);" + action = "org.apache.activemq.tests.extras.byteman.ClusteredGroupingTest.pause($1);" ), @BMRule ( @@ -62,7 +62,7 @@ public class ClusteredGroupingTest extends ClusterTestBase targetClass = "org.apache.activemq.core.server.group.impl.GroupHandlingAbstract", targetMethod = "forceRemove", targetLocation = "ENTRY", - action = "org.apache.activemq.byteman.tests.ClusteredGroupingTest.restart2();" + action = "org.apache.activemq.tests.extras.byteman.ClusteredGroupingTest.restart2();" ) } ) @@ -131,13 +131,13 @@ public class ClusteredGroupingTest extends ClusterTestBase targetClass = "org.apache.activemq.core.server.group.impl.RemoteGroupingHandler", targetMethod = "onNotification", targetLocation = "ENTRY", - action = "org.apache.activemq.byteman.tests.ClusteredGroupingTest.pause2($1);" + action = "org.apache.activemq.tests.extras.byteman.ClusteredGroupingTest.pause2($1);" ), @BMRule(name = "blow-up2", targetClass = "org.apache.activemq.core.server.group.impl.RemoteGroupingHandler", targetMethod = "remove", targetLocation = "ENTRY", - action = "org.apache.activemq.byteman.tests.ClusteredGroupingTest.restart2();") + action = "org.apache.activemq.tests.extras.byteman.ClusteredGroupingTest.restart2();") } ) public void test3serversLocalGoesDown() throws Exception @@ -216,13 +216,13 @@ public class ClusteredGroupingTest extends ClusterTestBase targetClass = "org.apache.activemq.core.server.group.impl.LocalGroupingHandler", targetMethod = "onNotification", targetLocation = "ENTRY", - action = "org.apache.activemq.byteman.tests.ClusteredGroupingTest.pause2($1);" + action = "org.apache.activemq.tests.extras.byteman.ClusteredGroupingTest.pause2($1);" ), @BMRule(name = "blow-up2", targetClass = "org.apache.activemq.core.server.group.impl.LocalGroupingHandler", targetMethod = "remove", targetLocation = "ENTRY", - action = "org.apache.activemq.byteman.tests.ClusteredGroupingTest.restart2();") + action = "org.apache.activemq.tests.extras.byteman.ClusteredGroupingTest.restart2();") } ) public void testLocal3serversLocalGoesDown() throws Exception @@ -301,13 +301,13 @@ public class ClusteredGroupingTest extends ClusterTestBase targetClass = "org.apache.activemq.core.server.group.impl.LocalGroupingHandler", targetMethod = "onNotification", targetLocation = "ENTRY", - action = "org.apache.activemq.byteman.tests.ClusteredGroupingTest.pause2($1);" + action = "org.apache.activemq.tests.extras.byteman.ClusteredGroupingTest.pause2($1);" ), @BMRule(name = "blow-up2", targetClass = "org.apache.activemq.core.server.group.impl.LocalGroupingHandler", targetMethod = "remove", targetLocation = "ENTRY", - action = "org.apache.activemq.byteman.tests.ClusteredGroupingTest.restart2();") + action = "org.apache.activemq.tests.extras.byteman.ClusteredGroupingTest.restart2();") } ) public void testLocal4serversLocalGoesDown() throws Exception diff --git a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/GroupingTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/GroupingTest.java similarity index 97% rename from tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/GroupingTest.java rename to tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/GroupingTest.java index 31d2ba8efc..34f58f7473 100644 --- a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/GroupingTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/GroupingTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.byteman.tests; +package org.apache.activemq.tests.extras.byteman; import javax.jms.Connection; import javax.jms.ConnectionFactory; @@ -81,7 +81,7 @@ public class GroupingTest extends JMSTestBase targetClass = "org.apache.activemq.core.server.impl.ServerSessionImpl", targetMethod = "rollback", targetLocation = "EXIT", - action = "org.apache.activemq.byteman.tests.GroupingTest.pause();" + action = "org.apache.activemq.tests.extras.byteman.GroupingTest.pause();" ) } ) diff --git a/tests/byteman-tests/src/test/java/org/apache/activemq/core/settings/impl/HierarchicalObjectRepositoryTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/HierarchicalObjectRepositoryTest.java similarity index 94% rename from tests/byteman-tests/src/test/java/org/apache/activemq/core/settings/impl/HierarchicalObjectRepositoryTest.java rename to tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/HierarchicalObjectRepositoryTest.java index 4698bb0854..e1b5b72bbc 100644 --- a/tests/byteman-tests/src/test/java/org/apache/activemq/core/settings/impl/HierarchicalObjectRepositoryTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/HierarchicalObjectRepositoryTest.java @@ -14,13 +14,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.core.settings.impl; +package org.apache.activemq.tests.extras.byteman; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; +import org.apache.activemq.core.settings.impl.HierarchicalObjectRepository; import org.jboss.byteman.contrib.bmunit.BMRule; import org.jboss.byteman.contrib.bmunit.BMRules; import org.jboss.byteman.contrib.bmunit.BMUnitRunner; @@ -34,7 +35,7 @@ import org.junit.runner.RunWith; @BMRules(rules = { @BMRule(name = "modify map during iteration", targetClass = "org.apache.activemq.core.settings.impl.HierarchicalObjectRepository", targetMethod = "getPossibleMatches(String)", targetLocation = "AT INVOKE java.util.HashMap.put", - action = "org.apache.activemq.core.settings.impl.HierarchicalObjectRepositoryTest.bum()"), }) + action = "org.apache.activemq.tests.extras.byteman.HierarchicalObjectRepositoryTest.bum()"), }) public class HierarchicalObjectRepositoryTest { private static final String A = "a."; diff --git a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/JMSBridgeReconnectionTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/JMSBridgeReconnectionTest.java similarity index 95% rename from tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/JMSBridgeReconnectionTest.java rename to tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/JMSBridgeReconnectionTest.java index 249e70c3a7..3be3f73ddc 100644 --- a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/JMSBridgeReconnectionTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/JMSBridgeReconnectionTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.byteman.tests; +package org.apache.activemq.tests.extras.byteman; import org.apache.activemq.core.client.impl.ClientProducerCredits; import org.apache.activemq.core.message.impl.MessageInternal; @@ -25,7 +25,7 @@ import org.apache.activemq.jms.bridge.ConnectionFactoryFactory; import org.apache.activemq.jms.bridge.QualityOfServiceMode; import org.apache.activemq.jms.bridge.impl.JMSBridgeImpl; import org.apache.activemq.jms.server.JMSServerManager; -import org.apache.activemq.tests.integration.jms.bridge.BridgeTestBase; +import org.apache.activemq.tests.extras.jms.bridge.BridgeTestBase; import org.jboss.byteman.contrib.bmunit.BMRule; import org.jboss.byteman.contrib.bmunit.BMRules; import org.jboss.byteman.contrib.bmunit.BMUnitRunner; @@ -49,7 +49,7 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase targetClass = "org.apache.activemq.core.protocol.core.impl.ChannelImpl", targetMethod = "send", targetLocation = "ENTRY", - action = "org.apache.activemq.byteman.tests.JMSBridgeReconnectionTest.pause($1);" + action = "org.apache.activemq.tests.extras.byteman.JMSBridgeReconnectionTest.pause($1);" ), @BMRule ( @@ -57,7 +57,7 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase targetClass = "org.apache.activemq.core.client.impl.ClientProducerImpl", targetMethod = "sendRegularMessage", targetLocation = "ENTRY", - action = "org.apache.activemq.byteman.tests.JMSBridgeReconnectionTest.pause2($1,$2,$3);" + action = "org.apache.activemq.tests.extras.byteman.JMSBridgeReconnectionTest.pause2($1,$2,$3);" ) } ) diff --git a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/LatencyTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/LatencyTest.java similarity index 98% rename from tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/LatencyTest.java rename to tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/LatencyTest.java index 1286cd1b6e..68914fe69a 100644 --- a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/LatencyTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/LatencyTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.byteman.tests; +package org.apache.activemq.tests.extras.byteman; import org.apache.activemq.api.core.client.ClientSession; import org.apache.activemq.api.core.client.ClientSessionFactory; diff --git a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/MessageCopyTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/MessageCopyTest.java similarity index 97% rename from tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/MessageCopyTest.java rename to tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/MessageCopyTest.java index 861497100e..18b00d502d 100644 --- a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/MessageCopyTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/MessageCopyTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.byteman.tests; +package org.apache.activemq.tests.extras.byteman; import java.util.ArrayList; import java.util.concurrent.CountDownLatch; @@ -71,7 +71,7 @@ public class MessageCopyTest ), @BMRule( name = "JMSServer.stop wait-init", - targetClass = "org.apache.activemq.byteman.tests.MessageCopyTest", + targetClass = "org.apache.activemq.tests.extras.byteman.MessageCopyTest", targetMethod = "simulateRead", targetLocation = "EXIT", action = "signalWake(\"finish-read\", true)" diff --git a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/OrphanedConsumerTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/OrphanedConsumerTest.java similarity index 92% rename from tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/OrphanedConsumerTest.java rename to tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/OrphanedConsumerTest.java index d90a002cfb..6826704df9 100644 --- a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/OrphanedConsumerTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/OrphanedConsumerTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.byteman.tests; +package org.apache.activemq.tests.extras.byteman; import org.apache.activemq.api.core.SimpleString; @@ -132,7 +132,7 @@ public class OrphanedConsumerTest extends ServiceTestBase targetClass = "org.apache.activemq.core.server.impl.ServerConsumerImpl", targetMethod = "close", targetLocation = "AT EXIT", - condition = "org.apache.activemq.byteman.tests.OrphanedConsumerTest.isConditionActive()", + condition = "org.apache.activemq.tests.extras.byteman.OrphanedConsumerTest.isConditionActive()", action = "System.out.println(\"throwing stuff\");throw new InterruptedException()" ), @BMRule @@ -141,8 +141,8 @@ public class OrphanedConsumerTest extends ServiceTestBase targetClass = "org.apache.activemq.core.server.impl.ServerConsumerImpl", targetMethod = "close", targetLocation = "ENTRY", - condition = "org.apache.activemq.byteman.tests.OrphanedConsumerTest.isConditionActive()", - action = "org.apache.activemq.byteman.tests.OrphanedConsumerTest.leavingCloseOnTestCountersWhileClosing()" + condition = "org.apache.activemq.tests.extras.byteman.OrphanedConsumerTest.isConditionActive()", + action = "org.apache.activemq.tests.extras.byteman.OrphanedConsumerTest.leavingCloseOnTestCountersWhileClosing()" ) } @@ -171,7 +171,7 @@ public class OrphanedConsumerTest extends ServiceTestBase targetClass = "org.apache.activemq.core.server.impl.ServerConsumerImpl", targetMethod = "close", targetLocation = "AT EXIT", - condition = "org.apache.activemq.byteman.tests.OrphanedConsumerTest.isConditionActive()", + condition = "org.apache.activemq.tests.extras.byteman.OrphanedConsumerTest.isConditionActive()", action = "System.out.println(\"throwing stuff\");throw new InterruptedException()" ), @BMRule @@ -180,8 +180,8 @@ public class OrphanedConsumerTest extends ServiceTestBase targetClass = "org.apache.activemq.core.server.impl.ServerConsumerImpl", targetMethod = "close", targetLocation = "ENTRY", - condition = "org.apache.activemq.byteman.tests.OrphanedConsumerTest.isConditionActive()", - action = "org.apache.activemq.byteman.tests.OrphanedConsumerTest.leavingCloseOnTestCountersWhileClosing()" + condition = "org.apache.activemq.tests.extras.byteman.OrphanedConsumerTest.isConditionActive()", + action = "org.apache.activemq.tests.extras.byteman.OrphanedConsumerTest.leavingCloseOnTestCountersWhileClosing()" ) } diff --git a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/PagingLeakTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/PagingLeakTest.java similarity index 96% rename from tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/PagingLeakTest.java rename to tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/PagingLeakTest.java index 74c0ec93ac..2da8445a26 100644 --- a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/PagingLeakTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/PagingLeakTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.byteman.tests; +package org.apache.activemq.tests.extras.byteman; import java.util.ArrayList; import java.util.List; @@ -76,7 +76,7 @@ public class PagingLeakTest extends ServiceTestBase targetClass = "org.apache.activemq.core.paging.cursor.impl.PagePositionImpl", targetMethod = "()", targetLocation = "ENTRY", - action = "org.apache.activemq.byteman.tests.PagingLeakTest.newPosition()" + action = "org.apache.activemq.tests.extras.byteman.PagingLeakTest.newPosition()" ), @BMRule ( @@ -84,7 +84,7 @@ public class PagingLeakTest extends ServiceTestBase targetClass = "org.apache.activemq.core.paging.cursor.impl.PagePositionImpl", targetMethod = "finalize", targetLocation = "ENTRY", - action = "org.apache.activemq.byteman.tests.PagingLeakTest.deletePosition()" + action = "org.apache.activemq.tests.extras.byteman.PagingLeakTest.deletePosition()" ) } ) diff --git a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ReplicationBackupTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/ReplicationBackupTest.java similarity index 96% rename from tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ReplicationBackupTest.java rename to tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/ReplicationBackupTest.java index 2a153743a5..15c987c210 100644 --- a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ReplicationBackupTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/ReplicationBackupTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.byteman.tests; +package org.apache.activemq.tests.extras.byteman; import java.util.concurrent.CountDownLatch; @@ -53,7 +53,7 @@ public class ReplicationBackupTest extends ServiceTestBase targetClass = "org.apache.activemq.core.server.impl.SharedNothingLiveActivation", targetMethod = "run", targetLocation = "AT EXIT", - action = "org.apache.activemq.byteman.tests.ReplicationBackupTest.breakIt();" + action = "org.apache.activemq.tests.extras.byteman.ReplicationBackupTest.breakIt();" ) } ) diff --git a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ScaleDownFailoverTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/ScaleDownFailoverTest.java similarity index 98% rename from tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ScaleDownFailoverTest.java rename to tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/ScaleDownFailoverTest.java index 72fa0ad5b3..d06b093a01 100644 --- a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ScaleDownFailoverTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/ScaleDownFailoverTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.byteman.tests; +package org.apache.activemq.tests.extras.byteman; import org.apache.activemq.api.core.TransportConfiguration; import org.apache.activemq.api.core.client.ClientMessage; @@ -104,7 +104,7 @@ public class ScaleDownFailoverTest extends ClusterTestBase targetMethod = "createSessionFactory(org.apache.activemq.api.core.TransportConfiguration, int, boolean)", isInterface = true, targetLocation = "ENTRY", - action = "org.apache.activemq.byteman.tests.ScaleDownFailoverTest.fail($1);" + action = "org.apache.activemq.tests.extras.byteman.ScaleDownFailoverTest.fail($1);" ) public void testScaleDownWhenFirstServerFails() throws Exception { diff --git a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ScaleDownFailureTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/ScaleDownFailureTest.java similarity index 98% rename from tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ScaleDownFailureTest.java rename to tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/ScaleDownFailureTest.java index c5215b08a6..fbf46f16b2 100644 --- a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ScaleDownFailureTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/ScaleDownFailureTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.byteman.tests; +package org.apache.activemq.tests.extras.byteman; import org.apache.activemq.api.core.client.ClientMessage; import org.apache.activemq.core.config.ScaleDownConfiguration; diff --git a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ScaleDownGroupedFailoverTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/ScaleDownGroupedFailoverTest.java similarity index 94% rename from tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ScaleDownGroupedFailoverTest.java rename to tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/ScaleDownGroupedFailoverTest.java index 594dd32508..e86d4d69b5 100644 --- a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ScaleDownGroupedFailoverTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/ScaleDownGroupedFailoverTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.byteman.tests; +package org.apache.activemq.tests.extras.byteman; public class ScaleDownGroupedFailoverTest extends ScaleDownFailoverTest { diff --git a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ScaleDownGroupedFailureTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/ScaleDownGroupedFailureTest.java similarity index 94% rename from tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ScaleDownGroupedFailureTest.java rename to tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/ScaleDownGroupedFailureTest.java index eb0d9968b1..87dd577688 100644 --- a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/ScaleDownGroupedFailureTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/ScaleDownGroupedFailureTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.byteman.tests; +package org.apache.activemq.tests.extras.byteman; public class ScaleDownGroupedFailureTest extends ScaleDownFailureTest { diff --git a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/StartStopDeadlockTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/StartStopDeadlockTest.java similarity index 97% rename from tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/StartStopDeadlockTest.java rename to tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/StartStopDeadlockTest.java index 409c811079..fa8dfdc423 100644 --- a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/StartStopDeadlockTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/StartStopDeadlockTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.byteman.tests; +package org.apache.activemq.tests.extras.byteman; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicInteger; @@ -71,7 +71,7 @@ public class StartStopDeadlockTest extends ServiceTestBase ), @BMRule( name = "StartStopDeadlockTest tearDown", - targetClass = "org.apache.activemq.byteman.tests.StartStopDeadlockTest", + targetClass = "org.apache.activemq.tests.extras.byteman.StartStopDeadlockTest", targetMethod = "tearDown", targetLocation = "ENTRY", action = "deleteCounter(\"server-Init\")" diff --git a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/StompInternalStateTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/StompInternalStateTest.java similarity index 97% rename from tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/StompInternalStateTest.java rename to tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/StompInternalStateTest.java index 05d93d4b89..12037f4059 100644 --- a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/StompInternalStateTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/byteman/StompInternalStateTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.byteman.tests; +package org.apache.activemq.tests.extras.byteman; import java.util.HashMap; import java.util.Map; @@ -61,7 +61,7 @@ public class StompInternalStateTest extends ServiceTestBase targetClass = "org.apache.activemq.core.protocol.stomp.StompProtocolManager", targetMethod = "onNotification(org.apache.activemq.core.server.management.Notification)", targetLocation = "EXIT", - helper = "org.apache.activemq.byteman.tests.StompInternalStateTest", + helper = "org.apache.activemq.tests.extras.byteman.StompInternalStateTest", action = "verifyBindingAddRemove($1, $0.destinations)" ) } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/BridgeTestBase.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/bridge/BridgeTestBase.java similarity index 99% rename from tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/BridgeTestBase.java rename to tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/bridge/BridgeTestBase.java index d5dfa9c531..ee53af0d95 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/BridgeTestBase.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/bridge/BridgeTestBase.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.tests.integration.jms.bridge; +package org.apache.activemq.tests.extras.jms.bridge; import javax.jms.BytesMessage; import javax.jms.Connection; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/ClusteredBridgeTestBase.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/bridge/ClusteredBridgeTestBase.java similarity index 99% rename from tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/ClusteredBridgeTestBase.java rename to tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/bridge/ClusteredBridgeTestBase.java index 31a094a945..dffe6673ae 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/ClusteredBridgeTestBase.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/bridge/ClusteredBridgeTestBase.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.tests.integration.jms.bridge; +package org.apache.activemq.tests.extras.jms.bridge; import javax.jms.ConnectionFactory; import javax.jms.Destination; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/JMSBridgeClusteredTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/bridge/JMSBridgeClusteredTest.java similarity index 99% rename from tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/JMSBridgeClusteredTest.java rename to tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/bridge/JMSBridgeClusteredTest.java index d3baf43f60..f3565402b6 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/JMSBridgeClusteredTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/bridge/JMSBridgeClusteredTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.tests.integration.jms.bridge; +package org.apache.activemq.tests.extras.jms.bridge; import javax.transaction.TransactionManager; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/bridge/JMSBridgeReconnectionTest.java similarity index 99% rename from tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java rename to tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/bridge/JMSBridgeReconnectionTest.java index 752c8c50d4..972fe4ba59 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/bridge/JMSBridgeReconnectionTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.tests.integration.jms.bridge; +package org.apache.activemq.tests.extras.jms.bridge; import org.apache.activemq.api.core.TransportConfiguration; import org.apache.activemq.api.core.client.ClientSession; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/JMSBridgeTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/bridge/JMSBridgeTest.java similarity index 99% rename from tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/JMSBridgeTest.java rename to tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/bridge/JMSBridgeTest.java index 474c12698c..de916f3f49 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/JMSBridgeTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/bridge/JMSBridgeTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.tests.integration.jms.bridge; +package org.apache.activemq.tests.extras.jms.bridge; import javax.jms.Connection; import javax.jms.DeliveryMode; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/TransactionManagerLocatorImpl.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/bridge/TransactionManagerLocatorImpl.java similarity index 95% rename from tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/TransactionManagerLocatorImpl.java rename to tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/bridge/TransactionManagerLocatorImpl.java index f502d23c12..255741f29c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/TransactionManagerLocatorImpl.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/bridge/TransactionManagerLocatorImpl.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.activemq.tests.integration.jms.bridge; +package org.apache.activemq.tests.extras.jms.bridge; import javax.transaction.TransactionManager; diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/XATest.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/xa/XATest.java similarity index 66% rename from tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/XATest.java rename to tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/xa/XATest.java index 019b53466d..4847e348d6 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/XATest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/xa/XATest.java @@ -14,17 +14,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.jms.tests; -import java.util.ArrayList; -import java.util.List; +package org.apache.activemq.tests.extras.jms.xa; 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.jms.XAConnection; @@ -36,12 +33,17 @@ import javax.transaction.xa.XAException; import javax.transaction.xa.XAResource; import javax.transaction.xa.Xid; +import com.arjuna.ats.arjuna.coordinator.TransactionReaper; +import com.arjuna.ats.arjuna.coordinator.TxControl; import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple; +import org.apache.activemq.api.jms.ActiveMQJMSClient; import org.apache.activemq.core.client.impl.ClientSessionInternal; -import org.apache.activemq.jms.tests.util.ProxyAssertSupport; +import org.apache.activemq.tests.extras.ExtrasTestLogger; +import org.apache.activemq.tests.util.JMSTestBase; import org.jboss.tm.TxUtils; import org.junit.After; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -55,7 +57,7 @@ import org.junit.Test; * * */ -public class XATest extends ActiveMQServerTestCase +public class XATest extends JMSTestBase { // Constants ----------------------------------------------------- @@ -68,8 +70,8 @@ public class XATest extends ActiveMQServerTestCase protected Transaction suspendedTx; protected XAConnectionFactory xacf; - - protected ConnectionFactory cf; + + protected Queue queue1; // Constructors -------------------------------------------------- @@ -81,13 +83,14 @@ public class XATest extends ActiveMQServerTestCase { super.setUp(); - cf = getConnectionFactory(); + xacf = ActiveMQJMSClient.createConnectionFactory("tcp://localhost:61616", "test"); + + queue1 = createQueue("queue1"); + TxControl.enable(); - xacf = getXAConnectionFactory(); + tm = new TransactionManagerImple(); - tm = getTransactionManager(); - - ProxyAssertSupport.assertTrue(tm instanceof TransactionManagerImple); + Assert.assertTrue(tm instanceof TransactionManagerImple); suspendedTx = tm.suspend(); } @@ -113,9 +116,9 @@ public class XATest extends ActiveMQServerTestCase Transaction tx = tm.suspend(); if (tx != null) { - log.warn("Transaction still associated with thread " + tx + - " at status " + - TxUtils.getStatusAsString(tx.getStatus())); + ExtrasTestLogger.LOGGER.warn("Transaction still associated with thread " + tx + + " at status " + + TxUtils.getStatusAsString(tx.getStatus())); } } @@ -123,6 +126,13 @@ public class XATest extends ActiveMQServerTestCase { tm.resume(suspendedTx); } + + TxControl.disable(true); + + TransactionReaper.terminate(false); + + super.tearDown(); + } // Public -------------------------------------------------------- @@ -153,9 +163,9 @@ public class XATest extends ActiveMQServerTestCase MessageProducer prod = sess.createProducer(queue1); prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT); Message m = sess.createTextMessage("XATest1"); - prod.send(queue1, m); + prod.send(m); m = sess.createTextMessage("XATest2"); - prod.send(queue1, m); + prod.send(m); tx.delistResource(res, XAResource.TMSUCCESS); tx.delistResource(res2, XAResource.TMSUCCESS); @@ -167,11 +177,11 @@ public class XATest extends ActiveMQServerTestCase Session sessReceiver = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageConsumer cons = sessReceiver.createConsumer(queue1); TextMessage m2 = (TextMessage)cons.receive(1000); - ProxyAssertSupport.assertNotNull(m2); - ProxyAssertSupport.assertEquals("XATest1", m2.getText()); + Assert.assertNotNull(m2); + Assert.assertEquals("XATest1", m2.getText()); m2 = (TextMessage)cons.receive(1000); - ProxyAssertSupport.assertNotNull(m2); - ProxyAssertSupport.assertEquals("XATest2", m2.getText()); + Assert.assertNotNull(m2); + Assert.assertEquals("XATest2", m2.getText()); } finally { @@ -215,9 +225,9 @@ public class XATest extends ActiveMQServerTestCase MessageProducer prod = sess.createProducer(queue1); prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT); Message m = sess.createTextMessage("XATest1"); - prod.send(queue1, m); + prod.send(m); m = sess.createTextMessage("XATest2"); - prod.send(queue1, m); + prod.send(m); tx.delistResource(res, XAResource.TMSUCCESS); tx.delistResource(res2, XAResource.TMSUCCESS); @@ -228,67 +238,12 @@ public class XATest extends ActiveMQServerTestCase conn2.start(); Session sessReceiver = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageConsumer cons = sessReceiver.createConsumer(queue1); - TextMessage m2 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(m2); - ProxyAssertSupport.assertEquals("XATest1", m2.getText()); - m2 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(m2); - ProxyAssertSupport.assertEquals("XATest2", m2.getText()); - } - finally - { - if (conn != null) - { - conn.close(); - } - if (conn2 != null) - { - conn2.close(); - } - } - } - - @Test - public void test2PCSendRollback1PCOptimization() throws Exception - { - // Since both resources have some RM, TM will probably use 1PC optimization - - XAConnection conn = null; - Connection conn2 = null; - try - { - conn = xacf.createXAConnection(); - - tm.begin(); - - XASession sess = conn.createXASession(); - XAResource res = sess.getXAResource(); - - XAResource res2 = new DummyXAResource(); - - Transaction tx = tm.getTransaction(); - tx.enlistResource(res); - tx.enlistResource(res2); - - MessageProducer prod = sess.createProducer(queue1); - prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT); - Message m = sess.createTextMessage("XATest1"); - prod.send(queue1, m); - m = sess.createTextMessage("XATest2"); - prod.send(queue1, m); - - tx.delistResource(res, XAResource.TMSUCCESS); - tx.delistResource(res2, XAResource.TMSUCCESS); - - tm.rollback(); - - conn2 = cf.createConnection(); - conn2.start(); - Session sessReceiver = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE); - MessageConsumer cons = sessReceiver.createConsumer(queue1); - Message m2 = cons.receive(ActiveMQServerTestCase.MIN_TIMEOUT); - ProxyAssertSupport.assertNull(m2); - + TextMessage m2 = (TextMessage)cons.receive(5000); + Assert.assertNotNull(m2); + Assert.assertEquals("XATest1", m2.getText()); + m2 = (TextMessage)cons.receive(5000); + Assert.assertNotNull(m2); + Assert.assertEquals("XATest2", m2.getText()); } finally { @@ -330,7 +285,7 @@ public class XATest extends ActiveMQServerTestCase tx.enlistResource(res3); tx.enlistResource(res4); - MessageProducer prod = sess.createProducer(queue1); + MessageProducer prod = sess.createProducer(null); prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT); Message m = sess.createTextMessage("XATest1"); prod.send(queue1, m); @@ -346,7 +301,7 @@ public class XATest extends ActiveMQServerTestCase { tm.commit(); - ProxyAssertSupport.fail("should not get here"); + Assert.fail("should not get here"); } catch (Exception e) { @@ -357,8 +312,8 @@ public class XATest extends ActiveMQServerTestCase conn2.start(); Session sessReceiver = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageConsumer cons = sessReceiver.createConsumer(queue1); - Message m2 = cons.receive(ActiveMQServerTestCase.MIN_TIMEOUT); - ProxyAssertSupport.assertNull(m2); + Message m2 = cons.receive(100); + Assert.assertNull(m2); } finally { @@ -396,7 +351,7 @@ public class XATest extends ActiveMQServerTestCase tx.enlistResource(res); tx.enlistResource(res2); - MessageProducer prod = sess.createProducer(queue1); + MessageProducer prod = sess.createProducer(null); prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT); Message m = sess.createTextMessage("XATest1"); prod.send(queue1, m); @@ -412,8 +367,8 @@ public class XATest extends ActiveMQServerTestCase conn2.start(); Session sessReceiver = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageConsumer cons = sessReceiver.createConsumer(queue1); - Message m2 = cons.receive(ActiveMQServerTestCase.MIN_TIMEOUT); - ProxyAssertSupport.assertNull(m2); + Message m2 = cons.receive(100); + Assert.assertNull(m2); } finally @@ -464,15 +419,15 @@ public class XATest extends ActiveMQServerTestCase MessageConsumer cons = sess.createConsumer(queue1); - TextMessage m2 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + TextMessage m2 = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(m2); - ProxyAssertSupport.assertEquals("XATest1", m2.getText()); + Assert.assertNotNull(m2); + Assert.assertEquals("XATest1", m2.getText()); - m2 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + m2 = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(m2); - ProxyAssertSupport.assertEquals("XATest2", m2.getText()); + Assert.assertNotNull(m2); + Assert.assertEquals("XATest2", m2.getText()); tx.delistResource(res, XAResource.TMSUCCESS); tx.delistResource(res2, XAResource.TMSUCCESS); @@ -485,9 +440,9 @@ public class XATest extends ActiveMQServerTestCase tx.enlistResource(res); tx.enlistResource(res2); - Message m3 = cons.receive(ActiveMQServerTestCase.MIN_TIMEOUT); + Message m3 = cons.receive(100); - ProxyAssertSupport.assertNull(m3); + Assert.assertNull(m3); tx.delistResource(res, XAResource.TMSUCCESS); tx.delistResource(res2, XAResource.TMSUCCESS); @@ -542,15 +497,15 @@ public class XATest extends ActiveMQServerTestCase MessageConsumer cons = sess.createConsumer(queue1); - TextMessage m2 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + TextMessage m2 = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(m2); - ProxyAssertSupport.assertEquals("XATest1", m2.getText()); + Assert.assertNotNull(m2); + Assert.assertEquals("XATest1", m2.getText()); - m2 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + m2 = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(m2); - ProxyAssertSupport.assertEquals("XATest2", m2.getText()); + Assert.assertNotNull(m2); + Assert.assertEquals("XATest2", m2.getText()); tx.delistResource(res, XAResource.TMSUCCESS); tx.delistResource(res2, XAResource.TMSUCCESS); @@ -563,9 +518,9 @@ public class XATest extends ActiveMQServerTestCase tx.enlistResource(res); tx.enlistResource(res2); - Message m3 = cons.receive(ActiveMQServerTestCase.MIN_TIMEOUT); + Message m3 = cons.receive(100); - ProxyAssertSupport.assertNull(m3); + Assert.assertNull(m3); tx.delistResource(res, XAResource.TMSUCCESS); tx.delistResource(res2, XAResource.TMSUCCESS); @@ -621,12 +576,12 @@ public class XATest extends ActiveMQServerTestCase MessageConsumer cons = sess.createConsumer(queue1); - TextMessage m2 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(m2); - ProxyAssertSupport.assertEquals("XATest1", m2.getText()); - m2 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(m2); - ProxyAssertSupport.assertEquals("XATest2", m2.getText()); + TextMessage m2 = (TextMessage)cons.receive(5000); + Assert.assertNotNull(m2); + Assert.assertEquals("XATest1", m2.getText()); + m2 = (TextMessage)cons.receive(5000); + Assert.assertNotNull(m2); + Assert.assertEquals("XATest2", m2.getText()); tx.delistResource(res, XAResource.TMSUCCESS); tx.delistResource(res2, XAResource.TMSUCCESS); @@ -641,14 +596,14 @@ public class XATest extends ActiveMQServerTestCase tx.enlistResource(res); tx.enlistResource(res2); - TextMessage m3 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(m3); - ProxyAssertSupport.assertEquals("XATest1", m3.getText()); - m3 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(m3); - ProxyAssertSupport.assertEquals("XATest2", m3.getText()); + TextMessage m3 = (TextMessage)cons.receive(5000); + Assert.assertNotNull(m3); + Assert.assertEquals("XATest1", m3.getText()); + m3 = (TextMessage)cons.receive(5000); + Assert.assertNotNull(m3); + Assert.assertEquals("XATest2", m3.getText()); - ProxyAssertSupport.assertTrue(m3.getJMSRedelivered()); + Assert.assertTrue(m3.getJMSRedelivered()); tx.delistResource(res, XAResource.TMSUCCESS); tx.delistResource(res2, XAResource.TMSUCCESS); @@ -702,12 +657,12 @@ public class XATest extends ActiveMQServerTestCase MessageConsumer cons = sess.createConsumer(queue1); - TextMessage m2 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(m2); - ProxyAssertSupport.assertEquals("XATest1", m2.getText()); - m2 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(m2); - ProxyAssertSupport.assertEquals("XATest2", m2.getText()); + TextMessage m2 = (TextMessage)cons.receive(5000); + Assert.assertNotNull(m2); + Assert.assertEquals("XATest1", m2.getText()); + m2 = (TextMessage)cons.receive(5000); + Assert.assertNotNull(m2); + Assert.assertEquals("XATest2", m2.getText()); tx.delistResource(res, XAResource.TMSUCCESS); tx.delistResource(res2, XAResource.TMSUCCESS); @@ -722,14 +677,14 @@ public class XATest extends ActiveMQServerTestCase tx.enlistResource(res); tx.enlistResource(res2); - TextMessage m3 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(m3); - ProxyAssertSupport.assertEquals("XATest1", m3.getText()); - m3 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(m3); - ProxyAssertSupport.assertEquals("XATest2", m3.getText()); + TextMessage m3 = (TextMessage)cons.receive(5000); + Assert.assertNotNull(m3); + Assert.assertEquals("XATest1", m3.getText()); + m3 = (TextMessage)cons.receive(5000); + Assert.assertNotNull(m3); + Assert.assertEquals("XATest2", m3.getText()); - ProxyAssertSupport.assertTrue(m3.getJMSRedelivered()); + Assert.assertTrue(m3.getJMSRedelivered()); tx.delistResource(res, XAResource.TMSUCCESS); tx.delistResource(res2, XAResource.TMSUCCESS); @@ -769,7 +724,7 @@ public class XATest extends ActiveMQServerTestCase Transaction tx = tm.getTransaction(); tx.enlistResource(res); - MessageProducer prod = sess.createProducer(queue1); + MessageProducer prod = sess.createProducer(null); prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT); Message m = sess.createTextMessage("XATest1"); prod.send(queue1, m); @@ -784,12 +739,12 @@ public class XATest extends ActiveMQServerTestCase conn2.start(); Session sessReceiver = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageConsumer cons = sessReceiver.createConsumer(queue1); - TextMessage m2 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(m2); - ProxyAssertSupport.assertEquals("XATest1", m2.getText()); - m2 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(m2); - ProxyAssertSupport.assertEquals("XATest2", m2.getText()); + TextMessage m2 = (TextMessage)cons.receive(5000); + Assert.assertNotNull(m2); + Assert.assertEquals("XATest1", m2.getText()); + m2 = (TextMessage)cons.receive(5000); + Assert.assertNotNull(m2); + Assert.assertEquals("XATest2", m2.getText()); } finally { @@ -805,55 +760,6 @@ public class XATest extends ActiveMQServerTestCase } - @Test - public void test1PCSendRollback() throws Exception - { - XAConnection conn = null; - Connection conn2 = null; - try - { - conn = xacf.createXAConnection(); - - tm.begin(); - - XASession sess = conn.createXASession(); - XAResource res = sess.getXAResource(); - - Transaction tx = tm.getTransaction(); - tx.enlistResource(res); - - MessageProducer prod = sess.createProducer(queue1); - prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT); - Message m = sess.createTextMessage("XATest1"); - prod.send(queue1, m); - m = sess.createTextMessage("XATest2"); - prod.send(queue1, m); - - tx.delistResource(res, XAResource.TMSUCCESS); - - tm.rollback(); - - conn2 = cf.createConnection(); - conn2.start(); - Session sessReceiver = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE); - MessageConsumer cons = sessReceiver.createConsumer(queue1); - Message m2 = cons.receive(ActiveMQServerTestCase.MIN_TIMEOUT); - ProxyAssertSupport.assertNull(m2); - - } - finally - { - if (conn != null) - { - conn.close(); - } - if (conn2 != null) - { - conn2.close(); - } - } - } - @Test public void test1PCReceiveCommit() throws Exception { @@ -884,14 +790,14 @@ public class XATest extends ActiveMQServerTestCase MessageConsumer cons = sess.createConsumer(queue1); - TextMessage m2 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + TextMessage m2 = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(m2); - ProxyAssertSupport.assertEquals("XATest1", m2.getText()); - m2 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + Assert.assertNotNull(m2); + Assert.assertEquals("XATest1", m2.getText()); + m2 = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(m2); - ProxyAssertSupport.assertEquals("XATest2", m2.getText()); + Assert.assertNotNull(m2); + Assert.assertEquals("XATest2", m2.getText()); tx.delistResource(res, XAResource.TMSUCCESS); @@ -902,9 +808,9 @@ public class XATest extends ActiveMQServerTestCase tx = tm.getTransaction(); tx.enlistResource(res); - Message m3 = cons.receive(ActiveMQServerTestCase.MIN_TIMEOUT); + Message m3 = cons.receive(100); - ProxyAssertSupport.assertNull(m3); + Assert.assertNull(m3); tx.delistResource(res, XAResource.TMSUCCESS); @@ -953,15 +859,15 @@ public class XATest extends ActiveMQServerTestCase MessageConsumer cons = sess.createConsumer(queue1); - TextMessage m2 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + TextMessage m2 = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(m2); - ProxyAssertSupport.assertEquals("XATest1", m2.getText()); + Assert.assertNotNull(m2); + Assert.assertEquals("XATest1", m2.getText()); - m2 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + m2 = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(m2); - ProxyAssertSupport.assertEquals("XATest2", m2.getText()); + Assert.assertNotNull(m2); + Assert.assertEquals("XATest2", m2.getText()); tx.delistResource(res, XAResource.TMSUCCESS); @@ -974,17 +880,17 @@ public class XATest extends ActiveMQServerTestCase tx = tm.getTransaction(); tx.enlistResource(res); - TextMessage m3 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + TextMessage m3 = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(m3); - ProxyAssertSupport.assertEquals("XATest1", m3.getText()); + Assert.assertNotNull(m3); + Assert.assertEquals("XATest1", m3.getText()); - m3 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + m3 = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(m3); - ProxyAssertSupport.assertEquals("XATest2", m3.getText()); + Assert.assertNotNull(m3); + Assert.assertEquals("XATest2", m3.getText()); - ProxyAssertSupport.assertTrue(m3.getJMSRedelivered()); + Assert.assertTrue(m3.getJMSRedelivered()); tx.delistResource(res, XAResource.TMSUCCESS); @@ -1041,18 +947,18 @@ public class XATest extends ActiveMQServerTestCase // Receive the messages, one on each consumer MessageConsumer cons1 = sess1.createConsumer(queue1); - TextMessage r1 = (TextMessage)cons1.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + TextMessage r1 = (TextMessage)cons1.receive(5000); - ProxyAssertSupport.assertNotNull(r1); - ProxyAssertSupport.assertEquals("jellyfish1", r1.getText()); + Assert.assertNotNull(r1); + Assert.assertEquals("jellyfish1", r1.getText()); cons1.close(); MessageConsumer cons2 = sess2.createConsumer(queue1); - TextMessage r2 = (TextMessage)cons2.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + TextMessage r2 = (TextMessage)cons2.receive(5000); - ProxyAssertSupport.assertNotNull(r2); - ProxyAssertSupport.assertEquals("jellyfish2", r2.getText()); + Assert.assertNotNull(r2); + Assert.assertEquals("jellyfish2", r2.getText()); tx.delistResource(res1, XAResource.TMSUCCESS); tx.delistResource(res2, XAResource.TMSUCCESS); @@ -1064,8 +970,8 @@ public class XATest extends ActiveMQServerTestCase MessageConsumer cons = sess.createConsumer(queue1); conn2.start(); - TextMessage r3 = (TextMessage)cons.receive(ActiveMQServerTestCase.MIN_TIMEOUT); - ProxyAssertSupport.assertNull(r3); + TextMessage r3 = (TextMessage)cons.receive(100); + Assert.assertNull(r3); } finally @@ -1118,18 +1024,18 @@ public class XATest extends ActiveMQServerTestCase // Receive the messages, one on each consumer MessageConsumer cons1 = sess1.createConsumer(queue1); - TextMessage r1 = (TextMessage)cons1.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + TextMessage r1 = (TextMessage)cons1.receive(5000); - ProxyAssertSupport.assertNotNull(r1); - ProxyAssertSupport.assertEquals("jellyfish1", r1.getText()); + Assert.assertNotNull(r1); + Assert.assertEquals("jellyfish1", r1.getText()); cons1.close(); MessageConsumer cons2 = sess2.createConsumer(queue1); - TextMessage r2 = (TextMessage)cons2.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + TextMessage r2 = (TextMessage)cons2.receive(5000); - ProxyAssertSupport.assertNotNull(r2); - ProxyAssertSupport.assertEquals("jellyfish2", r2.getText()); + Assert.assertNotNull(r2); + Assert.assertEquals("jellyfish2", r2.getText()); tx.delistResource(res1, XAResource.TMSUCCESS); tx.delistResource(res2, XAResource.TMSUCCESS); @@ -1141,8 +1047,8 @@ public class XATest extends ActiveMQServerTestCase MessageConsumer cons = sess.createConsumer(queue1); conn2.start(); - TextMessage r3 = (TextMessage)cons.receive(ActiveMQServerTestCase.MIN_TIMEOUT); - ProxyAssertSupport.assertNull(r3); + TextMessage r3 = (TextMessage)cons.receive(100); + Assert.assertNull(r3); } finally @@ -1199,28 +1105,28 @@ public class XATest extends ActiveMQServerTestCase // Receive the messages, two on each consumer MessageConsumer cons1 = sess1.createConsumer(queue1); - TextMessage r1 = (TextMessage)cons1.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + TextMessage r1 = (TextMessage)cons1.receive(5000); - ProxyAssertSupport.assertNotNull(r1); - ProxyAssertSupport.assertEquals("jellyfish1", r1.getText()); + Assert.assertNotNull(r1); + Assert.assertEquals("jellyfish1", r1.getText()); - r1 = (TextMessage)cons1.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + r1 = (TextMessage)cons1.receive(5000); - ProxyAssertSupport.assertNotNull(r1); - ProxyAssertSupport.assertEquals("jellyfish2", r1.getText()); + Assert.assertNotNull(r1); + Assert.assertEquals("jellyfish2", r1.getText()); cons1.close(); MessageConsumer cons2 = sess2.createConsumer(queue1); - TextMessage r2 = (TextMessage)cons2.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + TextMessage r2 = (TextMessage)cons2.receive(5000); - ProxyAssertSupport.assertNotNull(r2); - ProxyAssertSupport.assertEquals("jellyfish3", r2.getText()); + Assert.assertNotNull(r2); + Assert.assertEquals("jellyfish3", r2.getText()); - r2 = (TextMessage)cons2.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + r2 = (TextMessage)cons2.receive(5000); - ProxyAssertSupport.assertNotNull(r2); - ProxyAssertSupport.assertEquals("jellyfish4", r2.getText()); + Assert.assertNotNull(r2); + Assert.assertEquals("jellyfish4", r2.getText()); cons2.close(); @@ -1241,8 +1147,8 @@ public class XATest extends ActiveMQServerTestCase MessageConsumer cons = sess.createConsumer(queue1); conn2.start(); - TextMessage r = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(r); + TextMessage r = (TextMessage)cons.receive(5000); + Assert.assertNotNull(r); boolean session1First = false; @@ -1256,54 +1162,54 @@ public class XATest extends ActiveMQServerTestCase } else { - ProxyAssertSupport.fail("Unexpected message"); + Assert.fail("Unexpected message"); } if (session1First) { - r = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + r = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(r); + Assert.assertNotNull(r); - ProxyAssertSupport.assertEquals("jellyfish2", r.getText()); + Assert.assertEquals("jellyfish2", r.getText()); - r = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + r = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(r); + Assert.assertNotNull(r); - ProxyAssertSupport.assertEquals("jellyfish3", r.getText()); + Assert.assertEquals("jellyfish3", r.getText()); - r = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + r = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(r); + Assert.assertNotNull(r); - ProxyAssertSupport.assertEquals("jellyfish4", r.getText()); + Assert.assertEquals("jellyfish4", r.getText()); } else { - r = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + r = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(r); + Assert.assertNotNull(r); - ProxyAssertSupport.assertEquals("jellyfish4", r.getText()); + Assert.assertEquals("jellyfish4", r.getText()); - r = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + r = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(r); + Assert.assertNotNull(r); - ProxyAssertSupport.assertEquals("jellyfish1", r.getText()); + Assert.assertEquals("jellyfish1", r.getText()); - r = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + r = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(r); + Assert.assertNotNull(r); - ProxyAssertSupport.assertEquals("jellyfish2", r.getText()); + Assert.assertEquals("jellyfish2", r.getText()); } - r = (TextMessage)cons.receive(ActiveMQServerTestCase.MIN_TIMEOUT); + r = (TextMessage)cons.receive(100); - ProxyAssertSupport.assertNull(r); + Assert.assertNull(r); } finally @@ -1360,15 +1266,15 @@ public class XATest extends ActiveMQServerTestCase // Receive the messages, two on each consumer MessageConsumer cons1 = sess1.createConsumer(queue1); - TextMessage r1 = (TextMessage)cons1.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + TextMessage r1 = (TextMessage)cons1.receive(5000); - ProxyAssertSupport.assertNotNull(r1); - ProxyAssertSupport.assertEquals("jellyfish1", r1.getText()); + Assert.assertNotNull(r1); + Assert.assertEquals("jellyfish1", r1.getText()); - r1 = (TextMessage)cons1.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + r1 = (TextMessage)cons1.receive(5000); - ProxyAssertSupport.assertNotNull(r1); - ProxyAssertSupport.assertEquals("jellyfish2", r1.getText()); + Assert.assertNotNull(r1); + Assert.assertEquals("jellyfish2", r1.getText()); cons1.close(); @@ -1376,15 +1282,15 @@ public class XATest extends ActiveMQServerTestCase Thread.sleep(500); MessageConsumer cons2 = sess2.createConsumer(queue1); - TextMessage r2 = (TextMessage)cons2.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + TextMessage r2 = (TextMessage)cons2.receive(5000); - ProxyAssertSupport.assertNotNull(r2); - ProxyAssertSupport.assertEquals("jellyfish3", r2.getText()); + Assert.assertNotNull(r2); + Assert.assertEquals("jellyfish3", r2.getText()); - r2 = (TextMessage)cons2.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + r2 = (TextMessage)cons2.receive(5000); - ProxyAssertSupport.assertNotNull(r2); - ProxyAssertSupport.assertEquals("jellyfish4", r2.getText()); + Assert.assertNotNull(r2); + Assert.assertEquals("jellyfish4", r2.getText()); // rollback @@ -1405,8 +1311,8 @@ public class XATest extends ActiveMQServerTestCase MessageConsumer cons = sess.createConsumer(queue1); conn2.start(); - TextMessage r = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(r); + TextMessage r = (TextMessage)cons.receive(5000); + Assert.assertNotNull(r); boolean session1First = false; @@ -1420,54 +1326,54 @@ public class XATest extends ActiveMQServerTestCase } else { - ProxyAssertSupport.fail("Unexpected message"); + Assert.fail("Unexpected message"); } if (session1First) { - r = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + r = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(r); + Assert.assertNotNull(r); - ProxyAssertSupport.assertEquals("jellyfish2", r.getText()); + Assert.assertEquals("jellyfish2", r.getText()); - r = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + r = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(r); + Assert.assertNotNull(r); - ProxyAssertSupport.assertEquals("jellyfish3", r.getText()); + Assert.assertEquals("jellyfish3", r.getText()); - r = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + r = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(r); + Assert.assertNotNull(r); - ProxyAssertSupport.assertEquals("jellyfish4", r.getText()); + Assert.assertEquals("jellyfish4", r.getText()); } else { - r = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + r = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(r); + Assert.assertNotNull(r); - ProxyAssertSupport.assertEquals("jellyfish4", r.getText()); + Assert.assertEquals("jellyfish4", r.getText()); - r = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + r = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(r); + Assert.assertNotNull(r); - ProxyAssertSupport.assertEquals("jellyfish1", r.getText()); + Assert.assertEquals("jellyfish1", r.getText()); - r = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + r = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(r); + Assert.assertNotNull(r); - ProxyAssertSupport.assertEquals("jellyfish2", r.getText()); + Assert.assertEquals("jellyfish2", r.getText()); } - r = (TextMessage)cons.receive(ActiveMQServerTestCase.MIN_TIMEOUT); + r = (TextMessage)cons.receive(100); - ProxyAssertSupport.assertNull(r); + Assert.assertNull(r); } finally { @@ -1518,29 +1424,29 @@ public class XATest extends ActiveMQServerTestCase tx.enlistResource(res2); MessageConsumer cons1 = sess1.createConsumer(queue1); - TextMessage r1 = (TextMessage)cons1.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + TextMessage r1 = (TextMessage)cons1.receive(5000); - ProxyAssertSupport.assertNotNull(r1); - ProxyAssertSupport.assertEquals("jellyfish1", r1.getText()); + Assert.assertNotNull(r1); + Assert.assertEquals("jellyfish1", r1.getText()); - r1 = (TextMessage)cons1.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + r1 = (TextMessage)cons1.receive(5000); - ProxyAssertSupport.assertNotNull(r1); - ProxyAssertSupport.assertEquals("jellyfish2", r1.getText()); + Assert.assertNotNull(r1); + Assert.assertEquals("jellyfish2", r1.getText()); - r1 = (TextMessage)cons1.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + r1 = (TextMessage)cons1.receive(5000); - ProxyAssertSupport.assertNotNull(r1); - ProxyAssertSupport.assertEquals("jellyfish3", r1.getText()); + Assert.assertNotNull(r1); + Assert.assertEquals("jellyfish3", r1.getText()); - r1 = (TextMessage)cons1.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + r1 = (TextMessage)cons1.receive(5000); - ProxyAssertSupport.assertNotNull(r1); - ProxyAssertSupport.assertEquals("jellyfish4", r1.getText()); + Assert.assertNotNull(r1); + Assert.assertEquals("jellyfish4", r1.getText()); - r1 = (TextMessage)cons1.receive(1000); + r1 = (TextMessage)cons1.receive(100); - ProxyAssertSupport.assertNull(r1); + Assert.assertNull(r1); cons1.close(); @@ -1553,11 +1459,11 @@ public class XATest extends ActiveMQServerTestCase // rollback will cause an attempt to deliver messages locally to the original consumers. // the original consumer has closed, so it will cancelled to the server // the server cancel is asynch, so we need to sleep for a bit to make sure it completes - log.trace("Forcing failure"); + ExtrasTestLogger.LOGGER.trace("Forcing failure"); try { tm.commit(); - ProxyAssertSupport.fail("should not get here"); + Assert.fail("should not get here"); } catch (Exception e) { @@ -1570,33 +1476,33 @@ public class XATest extends ActiveMQServerTestCase MessageConsumer cons = sess.createConsumer(queue1); conn2.start(); - TextMessage r = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + TextMessage r = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(r); + Assert.assertNotNull(r); - ProxyAssertSupport.assertEquals("jellyfish1", r.getText()); + Assert.assertEquals("jellyfish1", r.getText()); - r = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + r = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(r); + Assert.assertNotNull(r); - ProxyAssertSupport.assertEquals("jellyfish2", r.getText()); + Assert.assertEquals("jellyfish2", r.getText()); - r = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + r = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(r); + Assert.assertNotNull(r); - ProxyAssertSupport.assertEquals("jellyfish3", r.getText()); + Assert.assertEquals("jellyfish3", r.getText()); - r = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + r = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(r); + Assert.assertNotNull(r); - ProxyAssertSupport.assertEquals("jellyfish4", r.getText()); + Assert.assertEquals("jellyfish4", r.getText()); - r = (TextMessage)cons.receive(ActiveMQServerTestCase.MIN_TIMEOUT); + r = (TextMessage)cons.receive(100); - ProxyAssertSupport.assertNull(r); + Assert.assertNull(r); } finally { @@ -1659,13 +1565,13 @@ public class XATest extends ActiveMQServerTestCase MessageConsumer cons = sess.createConsumer(queue1); conn2.start(); - TextMessage r1 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(r1); - ProxyAssertSupport.assertEquals("echidna1", r1.getText()); + TextMessage r1 = (TextMessage)cons.receive(5000); + Assert.assertNotNull(r1); + Assert.assertEquals("echidna1", r1.getText()); - TextMessage r2 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(r2); - ProxyAssertSupport.assertEquals("echidna2", r2.getText()); + TextMessage r2 = (TextMessage)cons.receive(5000); + Assert.assertNotNull(r2); + Assert.assertEquals("echidna2", r2.getText()); } finally @@ -1731,13 +1637,13 @@ public class XATest extends ActiveMQServerTestCase MessageConsumer cons = sess.createConsumer(queue1); conn2.start(); - TextMessage r1 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(r1); - ProxyAssertSupport.assertEquals("echidna1", r1.getText()); + TextMessage r1 = (TextMessage)cons.receive(5000); + Assert.assertNotNull(r1); + Assert.assertEquals("echidna1", r1.getText()); - TextMessage r2 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(r2); - ProxyAssertSupport.assertEquals("echidna2", r2.getText()); + TextMessage r2 = (TextMessage)cons.receive(5000); + Assert.assertNotNull(r2); + Assert.assertEquals("echidna2", r2.getText()); } finally @@ -1802,8 +1708,8 @@ public class XATest extends ActiveMQServerTestCase MessageConsumer cons = sess.createConsumer(queue1); conn2.start(); - TextMessage r1 = (TextMessage)cons.receive(ActiveMQServerTestCase.MIN_TIMEOUT); - ProxyAssertSupport.assertNull(r1); + TextMessage r1 = (TextMessage)cons.receive(100); + Assert.assertNull(r1); } finally @@ -1867,8 +1773,8 @@ public class XATest extends ActiveMQServerTestCase MessageConsumer cons = sess.createConsumer(queue1); conn2.start(); - TextMessage r1 = (TextMessage)cons.receive(ActiveMQServerTestCase.MIN_TIMEOUT); - ProxyAssertSupport.assertNull(r1); + TextMessage r1 = (TextMessage)cons.receive(100); + Assert.assertNull(r1); } finally { @@ -1917,9 +1823,9 @@ public class XATest extends ActiveMQServerTestCase // Receive one message in one tx - TextMessage r1 = (TextMessage)cons1.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(r1); - ProxyAssertSupport.assertEquals("jellyfish1", r1.getText()); + TextMessage r1 = (TextMessage)cons1.receive(5000); + Assert.assertNotNull(r1); + Assert.assertEquals("jellyfish1", r1.getText()); tx1.delistResource(res1, XAResource.TMSUCCESS); @@ -1932,9 +1838,9 @@ public class XATest extends ActiveMQServerTestCase tx2.enlistResource(res1); // Receive 2nd message in a different tx - TextMessage r2 = (TextMessage)cons1.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(r2); - ProxyAssertSupport.assertEquals("jellyfish2", r2.getText()); + TextMessage r2 = (TextMessage)cons1.receive(5000); + Assert.assertNotNull(r2); + Assert.assertEquals("jellyfish2", r2.getText()); tx2.delistResource(res1, XAResource.TMSUCCESS); @@ -1947,8 +1853,8 @@ public class XATest extends ActiveMQServerTestCase Session sess = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE); conn2.start(); MessageConsumer cons = sess.createConsumer(queue1); - TextMessage r3 = (TextMessage)cons.receive(ActiveMQServerTestCase.MIN_TIMEOUT); - ProxyAssertSupport.assertNull(r3); + TextMessage r3 = (TextMessage)cons.receive(100); + Assert.assertNull(r3); // now resume the first tx and then commit it tm.resume(suspended); @@ -2002,9 +1908,9 @@ public class XATest extends ActiveMQServerTestCase // Receive one message in one tx - TextMessage r1 = (TextMessage)cons1.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(r1); - ProxyAssertSupport.assertEquals("jellyfish1", r1.getText()); + TextMessage r1 = (TextMessage)cons1.receive(5000); + Assert.assertNotNull(r1); + Assert.assertEquals("jellyfish1", r1.getText()); tx1.delistResource(res1, XAResource.TMSUCCESS); @@ -2017,9 +1923,9 @@ public class XATest extends ActiveMQServerTestCase tx2.enlistResource(res1); // Receive 2nd message in a different tx - TextMessage r2 = (TextMessage)cons1.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(r2); - ProxyAssertSupport.assertEquals("jellyfish2", r2.getText()); + TextMessage r2 = (TextMessage)cons1.receive(5000); + Assert.assertNotNull(r2); + Assert.assertEquals("jellyfish2", r2.getText()); cons1.close(); @@ -2035,23 +1941,23 @@ public class XATest extends ActiveMQServerTestCase conn2.start(); MessageConsumer cons = sess.createConsumer(queue1); - TextMessage r3 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); + TextMessage r3 = (TextMessage)cons.receive(5000); - ProxyAssertSupport.assertNotNull(r3); - ProxyAssertSupport.assertEquals("jellyfish2", r3.getText()); - r3 = (TextMessage)cons.receive(ActiveMQServerTestCase.MIN_TIMEOUT); - ProxyAssertSupport.assertNull(r3); + Assert.assertNotNull(r3); + Assert.assertEquals("jellyfish2", r3.getText()); + r3 = (TextMessage)cons.receive(100); + Assert.assertNull(r3); // rollback the other tx tm.resume(suspended); tm.rollback(); // Verify the first message is now available - r3 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(r3); - ProxyAssertSupport.assertEquals("jellyfish1", r3.getText()); - r3 = (TextMessage)cons.receive(ActiveMQServerTestCase.MIN_TIMEOUT); - ProxyAssertSupport.assertNull(r3); + r3 = (TextMessage)cons.receive(5000); + Assert.assertNotNull(r3); + Assert.assertEquals("jellyfish1", r3.getText()); + r3 = (TextMessage)cons.receive(100); + Assert.assertNull(r3); } finally @@ -2118,11 +2024,11 @@ public class XATest extends ActiveMQServerTestCase Session sess = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE); conn2.start(); MessageConsumer cons = sess.createConsumer(queue1); - TextMessage r1 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(r1); - ProxyAssertSupport.assertEquals("kangaroo2", r1.getText()); - TextMessage r2 = (TextMessage)cons.receive(ActiveMQServerTestCase.MIN_TIMEOUT); - ProxyAssertSupport.assertNull(r2); + TextMessage r1 = (TextMessage)cons.receive(5000); + Assert.assertNotNull(r1); + Assert.assertEquals("kangaroo2", r1.getText()); + TextMessage r2 = (TextMessage)cons.receive(100); + Assert.assertNull(r2); // now resume the first tx and then commit it tm.resume(suspended); @@ -2130,9 +2036,9 @@ public class XATest extends ActiveMQServerTestCase tm.commit(); // verify that the first text message is received - TextMessage r3 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(r3); - ProxyAssertSupport.assertEquals("kangaroo1", r3.getText()); + TextMessage r3 = (TextMessage)cons.receive(5000); + Assert.assertNotNull(r3); + Assert.assertEquals("kangaroo1", r3.getText()); } finally @@ -2165,107 +2071,7 @@ public class XATest extends ActiveMQServerTestCase XASession sess2 = conn.createXASession(); XAResource res2 = sess2.getXAResource(); - ProxyAssertSupport.assertTrue(res1.isSameRM(res2)); - } - - @Test - public void testOneSessionTwoTransactionsRollbackSend() throws Exception - { - XAConnection conn = null; - - Connection conn2 = null; - - try - { - - conn = xacf.createXAConnection(); - - // Create a session - XASession sess1 = conn.createXASession(); - XAResource res1 = sess1.getXAResource(); - - MessageProducer prod1 = sess1.createProducer(queue1); - - tm.begin(); - - Transaction tx1 = tm.getTransaction(); - tx1.enlistResource(res1); - - // Send a message - prod1.send(sess1.createTextMessage("kangaroo1")); - - // suspend the tx - Transaction suspended = tm.suspend(); - - tm.begin(); - - // Send another message in another tx using the same session - Transaction tx2 = tm.getTransaction(); - tx2.enlistResource(res1); - - // Send a message - prod1.send(sess1.createTextMessage("kangaroo2")); - - tx2.delistResource(res1, XAResource.TMSUCCESS); - - // rollback this transaction - tm.rollback(); - - // verify no messages are sent - conn2 = cf.createConnection(); - Session sess = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE); - conn2.start(); - MessageConsumer cons = sess.createConsumer(queue1); - TextMessage r1 = (TextMessage)cons.receive(ActiveMQServerTestCase.MIN_TIMEOUT); - - ProxyAssertSupport.assertNull(r1); - - // now resume the first tx and then commit it - tm.resume(suspended); - - tx1.delistResource(res1, XAResource.TMSUCCESS); - - tm.commit(); - - // verify that the first text message is received - TextMessage r3 = (TextMessage)cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(r3); - ProxyAssertSupport.assertEquals("kangaroo1", r3.getText()); - - } - finally - { - if (conn != null) - { - conn.close(); - } - if (conn2 != null) - { - conn2.close(); - } - - } - - } - - // Package protected --------------------------------------------- - - // Protected ----------------------------------------------------- - - // Private ------------------------------------------------------- - - // Inner classes ------------------------------------------------- - - static class DummyListener implements MessageListener - { - protected JmsTestLogger log = JmsTestLogger.LOGGER; - - public List messages = new ArrayList(); - - public void onMessage(final Message message) - { - messages.add(message); - } + Assert.assertTrue(res1.isSameRM(res2)); } static class DummyXAResource implements XAResource diff --git a/tests/integration-tests/pom.xml b/tests/integration-tests/pom.xml index 3b3017c866..3c32bfe978 100644 --- a/tests/integration-tests/pom.xml +++ b/tests/integration-tests/pom.xml @@ -20,7 +20,7 @@ org.apache.activemq.tests activemq-tests-pom - 6.0.0 + 6.0.1-SNAPSHOT integration-tests @@ -181,18 +181,6 @@ 5.0.0.GA - - - org.jboss.jbossts.jts - jbossjts-jacorb - 4.17.13.Final - - - org.jboss - jboss-transaction-spi - 7.1.0.Final - - io.vertx diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/JMSContextTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/JMSContextTest.java index e4ef1bd249..3210655627 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/JMSContextTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/JMSContextTest.java @@ -31,7 +31,6 @@ import org.apache.activemq.ra.ActiveMQRAManagedConnectionFactory; import org.apache.activemq.ra.ActiveMQResourceAdapter; import org.apache.activemq.spi.core.security.ActiveMQSecurityManagerImpl; import org.apache.activemq.service.extensions.ServiceUtils; -import org.apache.activemq.tests.integration.jms.bridge.TransactionManagerLocatorImpl; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -68,7 +67,6 @@ public class JMSContextTest extends ActiveMQRATestBase resourceAdapter.setConnectorClassName(InVMConnectorFactory.class.getName()); MyBootstrapContext ctx = new MyBootstrapContext(); - TransactionManagerLocatorImpl.tm = DummyTransactionManager.tm; resourceAdapter.start(ctx); ActiveMQRAManagedConnectionFactory mcf = new ActiveMQRAManagedConnectionFactory(); mcf.setResourceAdapter(resourceAdapter); diff --git a/tests/concurrent-tests/src/test/java/org/apache/activemq/tests/concurrent/stomp/ConcurrentStompTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/stomp/ConcurrentStompTest.java similarity index 97% rename from tests/concurrent-tests/src/test/java/org/apache/activemq/tests/concurrent/stomp/ConcurrentStompTest.java rename to tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/stomp/ConcurrentStompTest.java index c101c9cacd..eb1678ad49 100644 --- a/tests/concurrent-tests/src/test/java/org/apache/activemq/tests/concurrent/stomp/ConcurrentStompTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/stomp/ConcurrentStompTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.tests.concurrent.stomp; +package org.apache.activemq.tests.integration.stomp; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -26,7 +26,6 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import org.apache.activemq.core.protocol.stomp.Stomp; -import org.apache.activemq.tests.integration.stomp.StompTestBase; import org.junit.Assert; import org.junit.Test; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/util/JMSTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/util/JMSTestBase.java index ca9b00bf4b..2dae1e5a49 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/util/JMSTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/util/JMSTestBase.java @@ -34,7 +34,6 @@ import java.util.List; import java.util.Random; import java.util.Set; -import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple; import org.apache.activemq.api.core.TransportConfiguration; import org.apache.activemq.api.core.management.QueueControl; import org.apache.activemq.api.jms.management.JMSQueueControl; @@ -46,7 +45,6 @@ import org.apache.activemq.jms.server.config.ConnectionFactoryConfiguration; import org.apache.activemq.jms.server.config.impl.ConnectionFactoryConfigurationImpl; import org.apache.activemq.jms.server.impl.JMSServerManagerImpl; import org.apache.activemq.service.extensions.ServiceUtils; -import org.apache.activemq.tests.integration.jms.bridge.TransactionManagerLocatorImpl; import org.apache.activemq.tests.integration.ra.DummyTransactionManager; import org.apache.activemq.tests.unit.util.InVMNamingContext; import org.junit.After; @@ -234,7 +232,6 @@ public class JMSTestBase extends ServiceTestBase mbeanServer = null; - TransactionManagerLocatorImpl.tm = null; ServiceUtils.setTransactionManager(null); super.tearDown(); @@ -301,11 +298,6 @@ public class JMSTestBase extends ServiceTestBase } } - protected void useRealTransactionManager() - { - ServiceUtils.setTransactionManager((javax.transaction.TransactionManager) new TransactionManagerImple()); - } - protected void useDummyTransactionManager() { ServiceUtils.setTransactionManager(new DummyTransactionManager()); diff --git a/tests/integration-tests/src/test/resources/META-INF/services/org.apache.activemq.service.extensions.transactions.TransactionManagerLocator b/tests/integration-tests/src/test/resources/META-INF/services/org.apache.activemq.service.extensions.transactions.TransactionManagerLocator index fe2642378d..e9ef6bf146 100644 --- a/tests/integration-tests/src/test/resources/META-INF/services/org.apache.activemq.service.extensions.transactions.TransactionManagerLocator +++ b/tests/integration-tests/src/test/resources/META-INF/services/org.apache.activemq.service.extensions.transactions.TransactionManagerLocator @@ -1 +1 @@ -org.apache.activemq.tests.integration.jms.bridge.TransactionManagerLocatorImpl +org.apache.activemq.tests.extras.jms.bridge.TransactionManagerLocatorImpl diff --git a/tests/jms-tests/pom.xml b/tests/jms-tests/pom.xml index c2034fec11..8466285395 100644 --- a/tests/jms-tests/pom.xml +++ b/tests/jms-tests/pom.xml @@ -20,7 +20,7 @@ org.apache.activemq.tests activemq-tests-pom - 6.0.0 + 6.0.1-SNAPSHOT jms-tests @@ -95,19 +95,6 @@ geronimo-ejb_3.0_spec - - - org.jboss - jboss-transaction-spi - 7.0.0.Final - - - org.jboss.logging - jboss-logging-spi - - - - org.apache.geronimo.components geronimo-jaspi @@ -154,14 +141,6 @@ maven-surefire-plugin ${skipJmsTests} - - - org/apache/activemq/jms/tests/XARecoveryTest.java - org/apache/activemq/jms/tests/XAResourceRecoveryTest.java - org/apache/activemq/jms/tests/XATest.java - org/apache/activemq/jms/tests/stress/*.java - org/apache/activemq/jms/tests/manual/** - ${activemq-surefire-argline} diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/XARecoveryTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/XARecoveryTest.java deleted file mode 100644 index 749ab84523..0000000000 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/XARecoveryTest.java +++ /dev/null @@ -1,3052 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.jms.tests; - -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.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.apache.activemq.core.transaction.impl.XidImpl; -import org.apache.activemq.jms.tests.util.ProxyAssertSupport; -import org.junit.Ignore; -import org.junit.Test; - -/** - * A XARecoveryTest - * - * @author Tim Fox - * @author Juha Lindfors - */ -public class XARecoveryTest extends JMSTestCase -{ - /* - * In this test, we have two queues, each with four messages already in them. We send 4 more - * messages to each queue, and ack the original 4 in a tx Then recover it without restarting the - * server - */ - @Test - public void testComplexTransactionalRecoveryWithoutRestart() throws Exception - { - Connection conn1 = null; - - XAConnection conn2 = null; - - XAConnection conn3 = null; - - try - { - conn1 = createConnection(); - - Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - - MessageProducer prod1 = sess1.createProducer(queue2); - - MessageProducer prod2 = sess1.createProducer(queue3); - - TextMessage tm1 = sess1.createTextMessage("tm1"); - TextMessage tm2 = sess1.createTextMessage("tm2"); - TextMessage tm3 = sess1.createTextMessage("tm3"); - TextMessage tm4 = sess1.createTextMessage("tm4"); - TextMessage tm5 = sess1.createTextMessage("tm5"); - TextMessage tm6 = sess1.createTextMessage("tm6"); - TextMessage tm7 = sess1.createTextMessage("tm7"); - TextMessage tm8 = sess1.createTextMessage("tm8"); - - prod1.send(tm1); - prod1.send(tm2); - prod1.send(tm3); - prod1.send(tm4); - - prod2.send(tm5); - prod2.send(tm6); - prod2.send(tm7); - prod2.send(tm8); - - conn1.close(); - - conn2 = createXAConnection(); - - conn2.start(); - - XASession sess2 = conn2.createXASession(); - - XAResource res = sess2.getXAResource(); - - Xid xid1 = new XidImpl("bq1".getBytes(), 42, "eemeli".getBytes()); - - res.start(xid1, XAResource.TMNOFLAGS); - - MessageProducer prod3 = sess2.createProducer(queue2); - - TextMessage tm9 = sess2.createTextMessage("tm9"); - TextMessage tm10 = sess2.createTextMessage("tm10"); - TextMessage tm11 = sess2.createTextMessage("tm11"); - TextMessage tm12 = sess2.createTextMessage("tm12"); - - prod3.send(tm9); - prod3.send(tm10); - prod3.send(tm11); - prod3.send(tm12); - - MessageProducer prod4 = sess2.createProducer(queue3); - - TextMessage tm13 = sess2.createTextMessage("tm13"); - TextMessage tm14 = sess2.createTextMessage("tm14"); - TextMessage tm15 = sess2.createTextMessage("tm15"); - TextMessage tm16 = sess2.createTextMessage("tm16"); - - prod4.send(tm13); - prod4.send(tm14); - prod4.send(tm15); - prod4.send(tm16); - - MessageConsumer cons1 = sess2.createConsumer(queue2); - - TextMessage rm1 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm1); - ProxyAssertSupport.assertEquals(tm1.getText(), rm1.getText()); - - TextMessage rm2 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm2); - ProxyAssertSupport.assertEquals(tm2.getText(), rm2.getText()); - - TextMessage rm3 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm3); - ProxyAssertSupport.assertEquals(tm3.getText(), rm3.getText()); - - TextMessage rm4 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm4); - ProxyAssertSupport.assertEquals(tm4.getText(), rm4.getText()); - - Message m = cons1.receive(1000); - - ProxyAssertSupport.assertNull(m); - - MessageConsumer cons2 = sess2.createConsumer(queue3); - - TextMessage rm5 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm5); - ProxyAssertSupport.assertEquals(tm5.getText(), rm5.getText()); - - TextMessage rm6 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm6); - ProxyAssertSupport.assertEquals(tm6.getText(), rm6.getText()); - - TextMessage rm7 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm7); - ProxyAssertSupport.assertEquals(tm7.getText(), rm7.getText()); - - TextMessage rm8 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm8); - ProxyAssertSupport.assertEquals(tm8.getText(), rm8.getText()); - - m = cons2.receive(1000); - - ProxyAssertSupport.assertNull(m); - - res.end(xid1, XAResource.TMSUCCESS); - - // prepare it - - log.trace("Preparing xid " + xid1); - res.prepare(xid1); - log.trace("Prepared xid " + xid1); - - conn3 = createXAConnection(); - - XASession sess3 = conn3.createXASession(); - - XAResource res3 = sess3.getXAResource(); - - Xid[] xids = res3.recover(XAResource.TMSTARTRSCAN); - ProxyAssertSupport.assertEquals(1, xids.length); - - Xid[] xids2 = res3.recover(XAResource.TMENDRSCAN); - ProxyAssertSupport.assertEquals(0, xids2.length); - - ProxyAssertSupport.assertEquals(xid1, xids[0]); - - log.trace("Committing the tx"); - - // Commit - res3.commit(xids[0], false); - - log.trace("committed the tx"); - - conn1.close(); - - conn2.close(); - - conn1 = createConnection(); - - conn1.start(); - - sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - - log.trace("creating a consumer"); - - cons1 = sess1.createConsumer(queue2); - - log.trace("created a consumer"); - - TextMessage rm9 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm9); - ProxyAssertSupport.assertEquals(tm9.getText(), rm9.getText()); - - TextMessage rm10 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm10); - ProxyAssertSupport.assertEquals(tm10.getText(), rm10.getText()); - - TextMessage rm11 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm11); - ProxyAssertSupport.assertEquals(tm11.getText(), rm11.getText()); - - TextMessage rm12 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm12); - ProxyAssertSupport.assertEquals(tm12.getText(), rm12.getText()); - - m = cons1.receive(1000); - - ProxyAssertSupport.assertNull(m); - - cons2 = sess1.createConsumer(queue3); - - TextMessage rm13 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm13); - ProxyAssertSupport.assertEquals(tm13.getText(), rm13.getText()); - - TextMessage rm14 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm14); - ProxyAssertSupport.assertEquals(tm14.getText(), rm14.getText()); - - TextMessage rm15 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm15); - ProxyAssertSupport.assertEquals(tm15.getText(), rm15.getText()); - - TextMessage rm16 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm16); - ProxyAssertSupport.assertEquals(tm16.getText(), rm16.getText()); - - m = cons2.receive(1000); - - ProxyAssertSupport.assertNull(m); - - } - finally - { - if (conn1 != null) - { - conn1.close(); - } - - if (conn2 != null) - { - conn2.close(); - } - - if (conn3 != null) - { - conn3.close(); - } - } - } - - /* - * In this test, we have two queues, each with four messages already in them. - * - * We send 4 more messages to each queue, and ack the original 4 in a tx - * - * Then recover it without restarting the server, then rollback - * - */ - @Test - public void testComplexTransactionalRecoveryWithoutRestartRollback() throws Exception - { - Connection conn1 = null; - - XAConnection conn2 = null; - - XAConnection conn3 = null; - - try - { - conn1 = createConnection(); - - Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - - MessageProducer prod1 = sess1.createProducer(queue2); - - MessageProducer prod2 = sess1.createProducer(queue3); - - TextMessage tm1 = sess1.createTextMessage("tm1"); - TextMessage tm2 = sess1.createTextMessage("tm2"); - TextMessage tm3 = sess1.createTextMessage("tm3"); - TextMessage tm4 = sess1.createTextMessage("tm4"); - TextMessage tm5 = sess1.createTextMessage("tm5"); - TextMessage tm6 = sess1.createTextMessage("tm6"); - TextMessage tm7 = sess1.createTextMessage("tm7"); - TextMessage tm8 = sess1.createTextMessage("tm8"); - - prod1.send(tm1); - prod1.send(tm2); - prod1.send(tm3); - prod1.send(tm4); - - prod2.send(tm5); - prod2.send(tm6); - prod2.send(tm7); - prod2.send(tm8); - - conn2 = createXAConnection(); - - conn2.start(); - - XASession sess2 = conn2.createXASession(); - - XAResource res = sess2.getXAResource(); - - Xid xid1 = new XidImpl("bq1".getBytes(), 42, "eemeli".getBytes()); - - res.start(xid1, XAResource.TMNOFLAGS); - - MessageProducer prod3 = sess2.createProducer(queue2); - - TextMessage tm9 = sess2.createTextMessage("tm9"); - TextMessage tm10 = sess2.createTextMessage("tm10"); - TextMessage tm11 = sess2.createTextMessage("tm11"); - TextMessage tm12 = sess2.createTextMessage("tm12"); - - prod3.send(tm9); - prod3.send(tm10); - prod3.send(tm11); - prod3.send(tm12); - - MessageProducer prod4 = sess2.createProducer(queue3); - - TextMessage tm13 = sess2.createTextMessage("tm13"); - TextMessage tm14 = sess2.createTextMessage("tm14"); - TextMessage tm15 = sess2.createTextMessage("tm15"); - TextMessage tm16 = sess2.createTextMessage("tm16"); - - prod4.send(tm13); - prod4.send(tm14); - prod4.send(tm15); - prod4.send(tm16); - - MessageConsumer cons1 = sess2.createConsumer(queue2); - - TextMessage rm1 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm1); - ProxyAssertSupport.assertEquals(tm1.getText(), rm1.getText()); - - TextMessage rm2 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm2); - ProxyAssertSupport.assertEquals(tm2.getText(), rm2.getText()); - - TextMessage rm3 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm3); - ProxyAssertSupport.assertEquals(tm3.getText(), rm3.getText()); - - TextMessage rm4 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm4); - ProxyAssertSupport.assertEquals(tm4.getText(), rm4.getText()); - - Message m = cons1.receive(1000); - - ProxyAssertSupport.assertNull(m); - - MessageConsumer cons2 = sess2.createConsumer(queue3); - - TextMessage rm5 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm5); - ProxyAssertSupport.assertEquals(tm5.getText(), rm5.getText()); - - TextMessage rm6 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm6); - ProxyAssertSupport.assertEquals(tm6.getText(), rm6.getText()); - - TextMessage rm7 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm7); - ProxyAssertSupport.assertEquals(tm7.getText(), rm7.getText()); - - TextMessage rm8 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm8); - ProxyAssertSupport.assertEquals(tm8.getText(), rm8.getText()); - - m = cons2.receive(1000); - - ProxyAssertSupport.assertNull(m); - - res.end(xid1, XAResource.TMSUCCESS); - - // prepare it - - res.prepare(xid1); - - conn3 = createXAConnection(); - - XASession sess3 = conn3.createXASession(); - - XAResource res3 = sess3.getXAResource(); - - Xid[] xids = res3.recover(XAResource.TMSTARTRSCAN); - ProxyAssertSupport.assertEquals(1, xids.length); - - Xid[] xids2 = res3.recover(XAResource.TMENDRSCAN); - ProxyAssertSupport.assertEquals(0, xids2.length); - - ProxyAssertSupport.assertEquals(xid1, xids[0]); - - log.trace("rolling back the tx"); - - // rollback - res3.rollback(xids[0]); - - log.trace("rolledb back the tx"); - - conn1.close(); - - conn2.close(); - - conn1 = createConnection(); - - conn1.start(); - - sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - - log.trace("creating a consumer"); - - cons1 = sess1.createConsumer(queue2); - - log.trace("created a consumer"); - - TextMessage rm9 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm9); - ProxyAssertSupport.assertEquals(tm1.getText(), rm9.getText()); - - TextMessage rm10 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm10); - ProxyAssertSupport.assertEquals(tm2.getText(), rm10.getText()); - - TextMessage rm11 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm11); - ProxyAssertSupport.assertEquals(tm3.getText(), rm11.getText()); - - TextMessage rm12 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm12); - ProxyAssertSupport.assertEquals(tm4.getText(), rm12.getText()); - - m = cons1.receive(1000); - - ProxyAssertSupport.assertNull(m); - - cons2 = sess1.createConsumer(queue3); - - TextMessage rm13 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm13); - ProxyAssertSupport.assertEquals(tm5.getText(), rm13.getText()); - - TextMessage rm14 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm14); - ProxyAssertSupport.assertEquals(tm6.getText(), rm14.getText()); - - TextMessage rm15 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm15); - ProxyAssertSupport.assertEquals(tm7.getText(), rm15.getText()); - - TextMessage rm16 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm16); - ProxyAssertSupport.assertEquals(tm8.getText(), rm16.getText()); - - m = cons2.receive(1000); - - ProxyAssertSupport.assertNull(m); - } - finally - { - if (conn1 != null) - { - try - { - conn1.close(); - } - catch (Exception e) - { - // Ignore - } - } - - if (conn2 != null) - { - try - { - conn2.close(); - } - catch (Exception e) - { - // Ignore - } - } - - if (conn3 != null) - { - try - { - conn3.close(); - } - catch (Exception e) - { - // Ignore - } - } - } - } - - /* - * In this test, we have two queues, each with four messages already in them. - * - * We send 4 more messages to each queue, and ack the original 4 in a tx - * - * Then recover it after restarting the server - * - */ - @Test - public void testComplexTransactionalRecoveryWithRestart() throws Exception - { - Connection conn1 = null; - - XAConnection conn2 = null; - - XAConnection conn3 = null; - - try - { - conn1 = createConnection(); - - Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - - MessageProducer prod1 = sess1.createProducer(queue2); - - MessageProducer prod2 = sess1.createProducer(queue3); - - TextMessage tm1 = sess1.createTextMessage("tm1"); - TextMessage tm2 = sess1.createTextMessage("tm2"); - TextMessage tm3 = sess1.createTextMessage("tm3"); - TextMessage tm4 = sess1.createTextMessage("tm4"); - TextMessage tm5 = sess1.createTextMessage("tm5"); - TextMessage tm6 = sess1.createTextMessage("tm6"); - TextMessage tm7 = sess1.createTextMessage("tm7"); - TextMessage tm8 = sess1.createTextMessage("tm8"); - - prod1.send(tm1); - prod1.send(tm2); - prod1.send(tm3); - prod1.send(tm4); - - prod2.send(tm5); - prod2.send(tm6); - prod2.send(tm7); - prod2.send(tm8); - - conn2 = createXAConnection(); - - conn2.start(); - - XASession sess2 = conn2.createXASession(); - - XAResource res = sess2.getXAResource(); - - Xid xid1 = new XidImpl("bq1".getBytes(), 42, "eemeli".getBytes()); - - res.start(xid1, XAResource.TMNOFLAGS); - - MessageProducer prod3 = sess2.createProducer(queue2); - - TextMessage tm9 = sess2.createTextMessage("tm9"); - TextMessage tm10 = sess2.createTextMessage("tm10"); - TextMessage tm11 = sess2.createTextMessage("tm11"); - TextMessage tm12 = sess2.createTextMessage("tm12"); - - prod3.send(tm9); - prod3.send(tm10); - prod3.send(tm11); - prod3.send(tm12); - - MessageProducer prod4 = sess2.createProducer(queue3); - - TextMessage tm13 = sess2.createTextMessage("tm13"); - TextMessage tm14 = sess2.createTextMessage("tm14"); - TextMessage tm15 = sess2.createTextMessage("tm15"); - TextMessage tm16 = sess2.createTextMessage("tm16"); - - prod4.send(tm13); - prod4.send(tm14); - prod4.send(tm15); - prod4.send(tm16); - - MessageConsumer cons1 = sess2.createConsumer(queue2); - - TextMessage rm1 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm1); - ProxyAssertSupport.assertEquals(tm1.getText(), rm1.getText()); - - TextMessage rm2 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm2); - ProxyAssertSupport.assertEquals(tm2.getText(), rm2.getText()); - - TextMessage rm3 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm3); - ProxyAssertSupport.assertEquals(tm3.getText(), rm3.getText()); - - TextMessage rm4 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm4); - ProxyAssertSupport.assertEquals(tm4.getText(), rm4.getText()); - - Message m = cons1.receive(1000); - - ProxyAssertSupport.assertNull(m); - - MessageConsumer cons2 = sess2.createConsumer(queue3); - - TextMessage rm5 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm5); - ProxyAssertSupport.assertEquals(tm5.getText(), rm5.getText()); - - TextMessage rm6 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm6); - ProxyAssertSupport.assertEquals(tm6.getText(), rm6.getText()); - - TextMessage rm7 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm7); - ProxyAssertSupport.assertEquals(tm7.getText(), rm7.getText()); - - TextMessage rm8 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm8); - ProxyAssertSupport.assertEquals(tm8.getText(), rm8.getText()); - - m = cons2.receive(1000); - - ProxyAssertSupport.assertNull(m); - - res.end(xid1, XAResource.TMSUCCESS); - - // prepare it - - res.prepare(xid1); - - conn1.close(); - conn2.close(); - - conn1 = null; - - conn2 = null; - - // Now "crash" the server - - stopServerPeer(); - - startServerPeer(); - - deployAndLookupAdministeredObjects(); - - conn3 = createXAConnection(); - - XASession sess3 = conn3.createXASession(); - - XAResource res3 = sess3.getXAResource(); - - Xid[] xids = res3.recover(XAResource.TMSTARTRSCAN); - ProxyAssertSupport.assertEquals(1, xids.length); - - Xid[] xids2 = res3.recover(XAResource.TMENDRSCAN); - ProxyAssertSupport.assertEquals(0, xids2.length); - - ProxyAssertSupport.assertEquals(xid1, xids[0]); - - log.trace("Committing the tx"); - - // Commit - res3.commit(xids[0], false); - - log.trace("committed the tx"); - - conn1 = createConnection(); - - conn1.start(); - - sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - - log.trace("creating a consumer"); - - cons1 = sess1.createConsumer(queue2); - - log.trace("created a consumer"); - - TextMessage rm9 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm9); - ProxyAssertSupport.assertEquals(tm9.getText(), rm9.getText()); - - TextMessage rm10 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm10); - ProxyAssertSupport.assertEquals(tm10.getText(), rm10.getText()); - - TextMessage rm11 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm11); - ProxyAssertSupport.assertEquals(tm11.getText(), rm11.getText()); - - TextMessage rm12 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm12); - ProxyAssertSupport.assertEquals(tm12.getText(), rm12.getText()); - - m = cons1.receive(1000); - - ProxyAssertSupport.assertNull(m); - - cons2 = sess1.createConsumer(queue3); - - TextMessage rm13 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm13); - ProxyAssertSupport.assertEquals(tm13.getText(), rm13.getText()); - - TextMessage rm14 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm14); - ProxyAssertSupport.assertEquals(tm14.getText(), rm14.getText()); - - TextMessage rm15 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm15); - ProxyAssertSupport.assertEquals(tm15.getText(), rm15.getText()); - - TextMessage rm16 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm16); - ProxyAssertSupport.assertEquals(tm16.getText(), rm16.getText()); - - m = cons2.receive(1000); - - ProxyAssertSupport.assertNull(m); - } - finally - { - if (conn1 != null) - { - try - { - conn1.close(); - } - catch (Exception e) - { - // Ignore - } - } - - if (conn2 != null) - { - try - { - conn2.close(); - } - catch (Exception e) - { - // Ignore - } - } - - if (conn3 != null) - { - try - { - conn3.close(); - } - catch (Exception e) - { - // Ignore - } - } - Thread.sleep(1000); - removeAllMessages(queue2.getQueueName(), true); - removeAllMessages(queue3.getQueueName(), true); - } - } - - /* - * In this test, we have two queues, each with four messages already in them. - * - * We send 4 more messages to each queue, and ack the original 4 in a tx - * - * Then recover it after restarting the server, then rollback - * - */ - @Test - public void testComplexTransactionalRecoveryWithRestartRollback() throws Exception - { - Connection conn1 = null; - - XAConnection conn2 = null; - - XAConnection conn3 = null; - - try - { - conn1 = createConnection(); - - Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - - MessageProducer prod1 = sess1.createProducer(queue2); - - MessageProducer prod2 = sess1.createProducer(queue3); - - TextMessage tm1 = sess1.createTextMessage("tm1"); - TextMessage tm2 = sess1.createTextMessage("tm2"); - TextMessage tm3 = sess1.createTextMessage("tm3"); - TextMessage tm4 = sess1.createTextMessage("tm4"); - TextMessage tm5 = sess1.createTextMessage("tm5"); - TextMessage tm6 = sess1.createTextMessage("tm6"); - TextMessage tm7 = sess1.createTextMessage("tm7"); - TextMessage tm8 = sess1.createTextMessage("tm8"); - - prod1.send(tm1); - prod1.send(tm2); - prod1.send(tm3); - prod1.send(tm4); - - prod2.send(tm5); - prod2.send(tm6); - prod2.send(tm7); - prod2.send(tm8); - - conn2 = createXAConnection(); - - conn2.start(); - - XASession sess2 = conn2.createXASession(); - - XAResource res = sess2.getXAResource(); - - Xid xid1 = new XidImpl("bq1".getBytes(), 42, "eemeli".getBytes()); - - res.start(xid1, XAResource.TMNOFLAGS); - - MessageProducer prod3 = sess2.createProducer(queue2); - - TextMessage tm9 = sess2.createTextMessage("tm9"); - TextMessage tm10 = sess2.createTextMessage("tm10"); - TextMessage tm11 = sess2.createTextMessage("tm11"); - TextMessage tm12 = sess2.createTextMessage("tm12"); - - prod3.send(tm9); - prod3.send(tm10); - prod3.send(tm11); - prod3.send(tm12); - - MessageProducer prod4 = sess2.createProducer(queue3); - - TextMessage tm13 = sess2.createTextMessage("tm13"); - TextMessage tm14 = sess2.createTextMessage("tm14"); - TextMessage tm15 = sess2.createTextMessage("tm15"); - TextMessage tm16 = sess2.createTextMessage("tm16"); - - prod4.send(tm13); - prod4.send(tm14); - prod4.send(tm15); - prod4.send(tm16); - - MessageConsumer cons1 = sess2.createConsumer(queue2); - - TextMessage rm1 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm1); - ProxyAssertSupport.assertEquals(tm1.getText(), rm1.getText()); - - TextMessage rm2 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm2); - ProxyAssertSupport.assertEquals(tm2.getText(), rm2.getText()); - - TextMessage rm3 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm3); - ProxyAssertSupport.assertEquals(tm3.getText(), rm3.getText()); - - TextMessage rm4 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm4); - ProxyAssertSupport.assertEquals(tm4.getText(), rm4.getText()); - - Message m = cons1.receive(1000); - - ProxyAssertSupport.assertNull(m); - - MessageConsumer cons2 = sess2.createConsumer(queue3); - - TextMessage rm5 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm5); - ProxyAssertSupport.assertEquals(tm5.getText(), rm5.getText()); - - TextMessage rm6 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm6); - ProxyAssertSupport.assertEquals(tm6.getText(), rm6.getText()); - - TextMessage rm7 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm7); - ProxyAssertSupport.assertEquals(tm7.getText(), rm7.getText()); - - TextMessage rm8 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm8); - ProxyAssertSupport.assertEquals(tm8.getText(), rm8.getText()); - - m = cons2.receive(1000); - - ProxyAssertSupport.assertNull(m); - - res.end(xid1, XAResource.TMSUCCESS); - - // prepare it - - res.prepare(xid1); - - conn1.close(); - conn2.close(); - conn1 = null; - - conn2 = null; - - // Now "crash" the server - - stopServerPeer(); - - startServerPeer(); - - deployAndLookupAdministeredObjects(); - - conn3 = createXAConnection(); - - XASession sess3 = conn3.createXASession(); - - XAResource res3 = sess3.getXAResource(); - - Xid[] xids = res3.recover(XAResource.TMSTARTRSCAN); - ProxyAssertSupport.assertEquals(1, xids.length); - - Xid[] xids2 = res3.recover(XAResource.TMENDRSCAN); - ProxyAssertSupport.assertEquals(0, xids2.length); - - ProxyAssertSupport.assertEquals(xid1, xids[0]); - - log.trace("rolling back the tx"); - - // rollback - res3.rollback(xids[0]); - - log.trace("rolled back the tx"); - - Thread.sleep(1000); - - conn1 = createConnection(); - - conn1.start(); - - sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - - log.trace("creating a consumer"); - - cons1 = sess1.createConsumer(queue2); - - log.trace("created a consumer"); - - TextMessage rm9 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm9); - ProxyAssertSupport.assertEquals(tm1.getText(), rm9.getText()); - - TextMessage rm10 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm10); - ProxyAssertSupport.assertEquals(tm2.getText(), rm10.getText()); - - TextMessage rm11 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm11); - ProxyAssertSupport.assertEquals(tm3.getText(), rm11.getText()); - - TextMessage rm12 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm12); - ProxyAssertSupport.assertEquals(tm4.getText(), rm12.getText()); - - m = cons1.receive(1000); - - ProxyAssertSupport.assertNull(m); - - cons2 = sess1.createConsumer(queue3); - - TextMessage rm13 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm13); - ProxyAssertSupport.assertEquals(tm5.getText(), rm13.getText()); - - TextMessage rm14 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm14); - ProxyAssertSupport.assertEquals(tm6.getText(), rm14.getText()); - - TextMessage rm15 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm15); - ProxyAssertSupport.assertEquals(tm7.getText(), rm15.getText()); - - TextMessage rm16 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm16); - ProxyAssertSupport.assertEquals(tm8.getText(), rm16.getText()); - - m = cons2.receive(1000); - - ProxyAssertSupport.assertNull(m); - - cons1.close(); - } - finally - { - if (conn1 != null) - { - try - { - conn1.close(); - } - catch (Exception e) - { - // Ignore - } - } - - if (conn2 != null) - { - try - { - conn2.close(); - } - catch (Exception e) - { - // Ignore - } - } - - if (conn3 != null) - { - try - { - conn3.close(); - } - catch (Exception e) - { - // Ignore - } - } - } - } - - /* Not really necessary - but it does no harm */ - @Test - public void testComplexTransactional() throws Exception - { - Connection conn1 = null; - - XAConnection conn2 = null; - - XAConnection conn3 = null; - - try - { - conn1 = createConnection(); - - Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - - MessageProducer prod1 = sess1.createProducer(queue2); - - MessageProducer prod2 = sess1.createProducer(queue3); - - TextMessage tm1 = sess1.createTextMessage("tm1"); - TextMessage tm2 = sess1.createTextMessage("tm2"); - TextMessage tm3 = sess1.createTextMessage("tm3"); - TextMessage tm4 = sess1.createTextMessage("tm4"); - TextMessage tm5 = sess1.createTextMessage("tm5"); - TextMessage tm6 = sess1.createTextMessage("tm6"); - TextMessage tm7 = sess1.createTextMessage("tm7"); - TextMessage tm8 = sess1.createTextMessage("tm8"); - - prod1.send(tm1); - prod1.send(tm2); - prod1.send(tm3); - prod1.send(tm4); - - prod2.send(tm5); - prod2.send(tm6); - prod2.send(tm7); - prod2.send(tm8); - - conn2 = createXAConnection(); - - conn2.start(); - - XASession sess2 = conn2.createXASession(); - - XAResource res = sess2.getXAResource(); - - Xid xid1 = new XidImpl("bq1".getBytes(), 42, "eemeli".getBytes()); - - res.start(xid1, XAResource.TMNOFLAGS); - - MessageProducer prod3 = sess2.createProducer(queue2); - - TextMessage tm9 = sess2.createTextMessage("tm9"); - TextMessage tm10 = sess2.createTextMessage("tm10"); - TextMessage tm11 = sess2.createTextMessage("tm11"); - TextMessage tm12 = sess2.createTextMessage("tm12"); - - prod3.send(tm9); - prod3.send(tm10); - prod3.send(tm11); - prod3.send(tm12); - - MessageProducer prod4 = sess2.createProducer(queue3); - - TextMessage tm13 = sess2.createTextMessage("tm13"); - TextMessage tm14 = sess2.createTextMessage("tm14"); - TextMessage tm15 = sess2.createTextMessage("tm15"); - TextMessage tm16 = sess2.createTextMessage("tm16"); - - prod4.send(tm13); - prod4.send(tm14); - prod4.send(tm15); - prod4.send(tm16); - - MessageConsumer cons1 = sess2.createConsumer(queue2); - - TextMessage rm1 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm1); - ProxyAssertSupport.assertEquals(tm1.getText(), rm1.getText()); - - TextMessage rm2 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm2); - ProxyAssertSupport.assertEquals(tm2.getText(), rm2.getText()); - - TextMessage rm3 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm3); - ProxyAssertSupport.assertEquals(tm3.getText(), rm3.getText()); - - TextMessage rm4 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm4); - ProxyAssertSupport.assertEquals(tm4.getText(), rm4.getText()); - - Message m = cons1.receive(1000); - - ProxyAssertSupport.assertNull(m); - - MessageConsumer cons2 = sess2.createConsumer(queue3); - - TextMessage rm5 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm5); - ProxyAssertSupport.assertEquals(tm5.getText(), rm5.getText()); - - TextMessage rm6 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm6); - ProxyAssertSupport.assertEquals(tm6.getText(), rm6.getText()); - - TextMessage rm7 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm7); - ProxyAssertSupport.assertEquals(tm7.getText(), rm7.getText()); - - TextMessage rm8 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm8); - ProxyAssertSupport.assertEquals(tm8.getText(), rm8.getText()); - - m = cons2.receive(1000); - - ProxyAssertSupport.assertNull(m); - - res.end(xid1, XAResource.TMSUCCESS); - - // prepare it - - res.prepare(xid1); - - res.commit(xid1, false); - - conn1.close(); - - conn2.close(); - - conn1 = createConnection(); - - conn1.start(); - - sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - - cons1 = sess1.createConsumer(queue2); - - TextMessage rm9 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm9); - ProxyAssertSupport.assertEquals(tm9.getText(), rm9.getText()); - - TextMessage rm10 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm10); - ProxyAssertSupport.assertEquals(tm10.getText(), rm10.getText()); - - TextMessage rm11 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm11); - ProxyAssertSupport.assertEquals(tm11.getText(), rm11.getText()); - - TextMessage rm12 = (TextMessage) cons1.receive(1000); - ProxyAssertSupport.assertNotNull(rm12); - ProxyAssertSupport.assertEquals(tm12.getText(), rm12.getText()); - - m = cons1.receive(1000); - - ProxyAssertSupport.assertNull(m); - - cons2 = sess1.createConsumer(queue3); - - TextMessage rm13 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm13); - ProxyAssertSupport.assertEquals(tm13.getText(), rm13.getText()); - - TextMessage rm14 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm14); - ProxyAssertSupport.assertEquals(tm14.getText(), rm14.getText()); - - TextMessage rm15 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm15); - ProxyAssertSupport.assertEquals(tm15.getText(), rm15.getText()); - - TextMessage rm16 = (TextMessage) cons2.receive(1000); - ProxyAssertSupport.assertNotNull(rm16); - ProxyAssertSupport.assertEquals(tm16.getText(), rm16.getText()); - - m = cons2.receive(1000); - - ProxyAssertSupport.assertNull(m); - } - finally - { - if (conn1 != null) - { - try - { - conn1.close(); - } - catch (Exception e) - { - // Ignore - } - } - - if (conn2 != null) - { - try - { - conn2.close(); - } - catch (Exception e) - { - // Ignore - } - } - - if (conn3 != null) - { - try - { - conn3.close(); - } - catch (Exception e) - { - // Ignore - } - } - } - } - - /* A simple send in a transaction - recovered without restarting the server */ - @Test - public void testSimpleTransactionalSendRecoveryWithoutRestart() throws Exception - { - log.trace("starting testSimpleTransactionalDeliveryRecoveryWithoutRestart"); - - XAConnection conn1 = null; - - Connection conn2 = null; - - XAConnection conn3 = null; - - try - { - conn1 = createXAConnection(); - - XASession sess1 = conn1.createXASession(); - - XAResource res1 = sess1.getXAResource(); - - // Pretend to be a transaction manager by interacting through the XAResources - Xid xid1 = new XidImpl("bq1".getBytes(), 42, "eemeli".getBytes()); - - log.trace("Sending message"); - - // Send message in tx - - res1.start(xid1, XAResource.TMNOFLAGS); - - MessageProducer prod1 = sess1.createProducer(queue4); - - TextMessage tm1 = sess1.createTextMessage("tm1"); - - prod1.send(tm1); - - res1.end(xid1, XAResource.TMSUCCESS); - - log.trace("Sent message"); - - // prepare tx - - res1.prepare(xid1); - - log.trace("prepared tx"); - - conn2 = createConnection(); - - Session sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE); - - MessageConsumer cons2 = sess2.createConsumer(queue4); - - conn2.start(); - - // Verify message can't be received - - Message m = cons2.receive(1000); - - ProxyAssertSupport.assertNull(m); - - // Now recover - - conn3 = createXAConnection(); - - XASession sess3 = conn3.createXASession(); - - XAResource res3 = sess3.getXAResource(); - - Xid[] xids = res3.recover(XAResource.TMSTARTRSCAN); - ProxyAssertSupport.assertEquals(1, xids.length); - - Xid[] xids2 = res3.recover(XAResource.TMENDRSCAN); - ProxyAssertSupport.assertEquals(0, xids2.length); - - ProxyAssertSupport.assertEquals(xid1, xids[0]); - - // Verify message still can't be received - - m = cons2.receive(1000); - - ProxyAssertSupport.assertNull(m); - - // Commit the tx - - res1.commit(xids[0], false); - - // The message should now be available - - TextMessage rm1 = (TextMessage) cons2.receive(1000); - - ProxyAssertSupport.assertNotNull(rm1); - - ProxyAssertSupport.assertEquals(tm1.getText(), rm1.getText()); - - } - finally - { - if (conn1 != null) - { - try - { - conn1.close(); - } - catch (Exception e) - { - // Ignore - } - } - - if (conn2 != null) - { - try - { - conn2.close(); - } - catch (Exception e) - { - // Ignore - } - } - - if (conn3 != null) - { - try - { - conn3.close(); - } - catch (Exception e) - { - // Ignore - } - } - } - } - - /* A simple send in a transaction - recovered after restarting the server */ - @Test - public void testSimpleTransactionalSendRecoveryWithRestart() throws Exception - { - log.trace("starting testSimpleTransactionalDeliveryRecoveryWithRestart"); - - XAConnection conn1 = null; - - Connection conn2 = null; - - XAConnection conn3 = null; - - try - { - conn1 = createXAConnection(); - - XASession sess1 = conn1.createXASession(); - - XAResource res1 = sess1.getXAResource(); - - // Pretend to be a transaction manager by interacting through the XAResources - Xid xid1 = new XidImpl("bq1".getBytes(), 42, "eemeli".getBytes()); - - log.trace("Sending message"); - - // Send message in tx - - res1.start(xid1, XAResource.TMNOFLAGS); - - MessageProducer prod1 = sess1.createProducer(queue4); - - TextMessage tm1 = sess1.createTextMessage("tm1"); - - prod1.send(tm1); - - res1.end(xid1, XAResource.TMSUCCESS); - - log.trace("Sent message"); - - // prepare tx - - res1.prepare(xid1); - - log.trace("prepared tx"); - - conn2 = createConnection(); - - Session sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE); - - MessageConsumer cons2 = sess2.createConsumer(queue4); - - conn2.start(); - - // Verify message can't be received - - Message m = cons2.receive(1000); - - ProxyAssertSupport.assertNull(m); - - conn1.close(); - - conn2.close(); - - conn1 = null; - - conn2 = null; - - // Now "crash" the server - - stopServerPeer(); - - startServerPeer(); - - deployAndLookupAdministeredObjects(); - - conn3 = createXAConnection(); - - XASession sess3 = conn3.createXASession(); - - XAResource res3 = sess3.getXAResource(); - - log.trace("created connection"); - - Xid[] xids = res3.recover(XAResource.TMSTARTRSCAN); - ProxyAssertSupport.assertEquals(1, xids.length); - - Xid[] xids2 = res3.recover(XAResource.TMENDRSCAN); - ProxyAssertSupport.assertEquals(0, xids2.length); - - ProxyAssertSupport.assertEquals(xid1, xids[0]); - - log.trace("recovered"); - - conn2 = createConnection(); - - sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE); - - cons2 = sess2.createConsumer(queue4); - - conn2.start(); - - // Verify message still can't be received - - m = cons2.receive(1000); - - ProxyAssertSupport.assertNull(m); - - log.trace("still can't see message"); - - // Commit the tx - - res3.commit(xids[0], false); - - log.trace("committed"); - - // The message should now be available - - TextMessage rm1 = (TextMessage) cons2.receive(1000); - - ProxyAssertSupport.assertNotNull(rm1); - - ProxyAssertSupport.assertEquals(tm1.getText(), rm1.getText()); - - } - finally - { - if (conn1 != null) - { - try - { - conn1.close(); - } - catch (Exception e) - { - // Ignore - } - } - - if (conn2 != null) - { - try - { - conn2.close(); - } - catch (Exception e) - { - // Ignore - } - } - - if (conn3 != null) - { - try - { - conn3.close(); - } - catch (Exception e) - { - // Ignore - } - } - } - } - - /* A simple acknowledgement in a transaction, recovered without restart */ - @Test - public void testSimpleTransactionalAcknowledgementRecoveryWithoutRestart() throws Exception - { - log.trace("starting testSimpleTransactionalAcknowledgementRecovery"); - - Connection conn1 = null; - - XAConnection conn2 = null; - - XAConnection conn3 = null; - - try - { - // First send a message to the queue - conn1 = createConnection(); - - Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - - MessageProducer prod = sess1.createProducer(queue4); - - TextMessage tm1 = sess1.createTextMessage("tm1"); - - prod.send(tm1); - - conn2 = createXAConnection(); - - XASession sess2 = conn2.createXASession(); - - XAResource res1 = sess2.getXAResource(); - - // Pretend to be a transaction manager by interacting through the XAResources - Xid xid1 = new XidImpl("bq1".getBytes(), 42, "eemeli".getBytes()); - - res1.start(xid1, XAResource.TMNOFLAGS); - - MessageConsumer cons = sess2.createConsumer(queue4); - - conn2.start(); - - // Consume the message - - TextMessage rm1 = (TextMessage) cons.receive(1000); - - ProxyAssertSupport.assertNotNull(rm1); - - ProxyAssertSupport.assertEquals(tm1.getText(), rm1.getText()); - - res1.end(xid1, XAResource.TMSUCCESS); - - // prepare the tx - - res1.prepare(xid1); - - // Now recover - - conn3 = createXAConnection(); - - XASession sess3 = conn3.createXASession(); - - XAResource res3 = sess3.getXAResource(); - - Xid[] xids = res3.recover(XAResource.TMSTARTRSCAN); - ProxyAssertSupport.assertEquals(1, xids.length); - - Xid[] xids2 = res3.recover(XAResource.TMENDRSCAN); - ProxyAssertSupport.assertEquals(0, xids2.length); - - ProxyAssertSupport.assertEquals(xid1, xids[0]); - - // Commit the tx - - res1.commit(xids[0], false); - - // The message should be acknowldged - - conn1.close(); - - conn2.close(); - - conn3.close(); - - conn1 = createConnection(); - - sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - - MessageConsumer cons1 = sess1.createConsumer(queue4); - - conn1.start(); - - Message m = cons1.receive(1000); - - ProxyAssertSupport.assertNull(m); - - } - finally - { - if (conn1 != null) - { - try - { - conn1.close(); - } - catch (Exception e) - { - // Ignore - } - } - - if (conn2 != null) - { - try - { - conn2.close(); - } - catch (Exception e) - { - // Ignore - } - } - - if (conn3 != null) - { - try - { - conn3.close(); - } - catch (Exception e) - { - // Ignore - } - } - } - } - - /* A simple acknowledgement in a transaction, recovered with restart */ - @Test - public void testSimpleTransactionalAcknowledgementRecoveryWithRestart() throws Exception - { - log.trace("starting testSimpleTransactionalAcknowledgementRecoveryWithRestart"); - - Connection conn1 = null; - - XAConnection conn2 = null; - - XAConnection conn3 = null; - - try - { - // First send a message to the queue - conn1 = createConnection(); - - Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - - MessageProducer prod = sess1.createProducer(queue4); - - TextMessage tm1 = sess1.createTextMessage("tm1"); - - prod.send(tm1); - - conn2 = createXAConnection(); - - XASession sess2 = conn2.createXASession(); - - XAResource res1 = sess2.getXAResource(); - - // Pretend to be a transaction manager by interacting through the XAResources - Xid xid1 = new XidImpl("bq1".getBytes(), 42, "eemeli".getBytes()); - - res1.start(xid1, XAResource.TMNOFLAGS); - - MessageConsumer cons = sess2.createConsumer(queue4); - - conn2.start(); - - // Consume the message - - TextMessage rm1 = (TextMessage) cons.receive(1000); - - ProxyAssertSupport.assertNotNull(rm1); - - ProxyAssertSupport.assertEquals(tm1.getText(), rm1.getText()); - - res1.end(xid1, XAResource.TMSUCCESS); - - // prepare the tx - - res1.prepare(xid1); - - conn1.close(); - - conn2.close(); - - conn1 = null; - - conn2 = null; - - // Now "crash" the server - - stopServerPeer(); - - startServerPeer(); - - deployAndLookupAdministeredObjects(); - - // Now recover - - conn3 = createXAConnection(); - - XASession sess3 = conn3.createXASession(); - - XAResource res3 = sess3.getXAResource(); - - Xid[] xids = res3.recover(XAResource.TMSTARTRSCAN); - ProxyAssertSupport.assertEquals(1, xids.length); - - Xid[] xids2 = res3.recover(XAResource.TMENDRSCAN); - ProxyAssertSupport.assertEquals(0, xids2.length); - - ProxyAssertSupport.assertEquals(xid1, xids[0]); - - // Commit the tx - - res3.commit(xids[0], false); - - // The message should be acknowldged - - conn3.close(); - - conn1 = createConnection(); - - sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - - MessageConsumer cons1 = sess1.createConsumer(queue4); - - conn1.start(); - - Message m = cons1.receive(1000); - - ProxyAssertSupport.assertNull(m); - - } - finally - { - if (conn1 != null) - { - try - { - conn1.close(); - } - catch (Exception e) - { - // Ignore - } - } - - if (conn2 != null) - { - try - { - conn2.close(); - } - catch (Exception e) - { - // Ignore - } - } - - if (conn3 != null) - { - try - { - conn3.close(); - } - catch (Exception e) - { - // Ignore - } - } - } - } - - /* - * In this test, we have 4 messages in a 2 durable subs on the same topic. - * - * We ack them, then add four more messages - * - * This test tests for the recovery when the same message is in multiple channels - * - * We don't restart in this test - * - */ - @Test - public void testRecoveryWithTwoDurableSubsWithoutRestart() throws Exception - { - Connection conn1 = null; - - XAConnection conn2 = null; - - XAConnection conn3 = null; - - try - { - conn1 = createConnection(); - - conn1.setClientID("wib1"); - - Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - - MessageProducer prod1 = sess1.createProducer(ActiveMQServerTestCase.topic2); - - MessageConsumer sub1 = sess1.createDurableSubscriber(ActiveMQServerTestCase.topic2, "sub1"); - - MessageConsumer sub2 = sess1.createDurableSubscriber(ActiveMQServerTestCase.topic2, "sub2"); - - // send four messages - - TextMessage tm1 = sess1.createTextMessage("tm1"); - TextMessage tm2 = sess1.createTextMessage("tm2"); - TextMessage tm3 = sess1.createTextMessage("tm3"); - TextMessage tm4 = sess1.createTextMessage("tm4"); - - prod1.send(tm1); - prod1.send(tm2); - prod1.send(tm3); - prod1.send(tm4); - - conn1.close(); - - // The messages should now be in both durable subs - - conn2 = createXAConnection(); - - conn2.setClientID("wib1"); - - conn2.start(); - - XASession sess2 = conn2.createXASession(); - - XAResource res = sess2.getXAResource(); - - Xid xid1 = new XidImpl("bq1".getBytes(), 42, "eemeli".getBytes()); - - res.start(xid1, XAResource.TMNOFLAGS); - - // Now send four more messages in a global tx - - MessageProducer prod2 = sess2.createProducer(ActiveMQServerTestCase.topic2); - - TextMessage tm5 = sess2.createTextMessage("tm5"); - TextMessage tm6 = sess2.createTextMessage("tm6"); - TextMessage tm7 = sess2.createTextMessage("tm7"); - TextMessage tm8 = sess2.createTextMessage("tm8"); - - prod2.send(tm5); - prod2.send(tm6); - prod2.send(tm7); - prod2.send(tm8); - - // And consume the first four from each in the tx - - sub1 = sess2.createDurableSubscriber(ActiveMQServerTestCase.topic2, "sub1"); - - sub2 = sess2.createDurableSubscriber(ActiveMQServerTestCase.topic2, "sub2"); - - TextMessage rm1 = (TextMessage) sub1.receive(1000); - ProxyAssertSupport.assertNotNull(rm1); - ProxyAssertSupport.assertEquals(tm1.getText(), rm1.getText()); - - TextMessage rm2 = (TextMessage) sub1.receive(1000); - ProxyAssertSupport.assertNotNull(rm2); - ProxyAssertSupport.assertEquals(tm2.getText(), rm2.getText()); - - TextMessage rm3 = (TextMessage) sub1.receive(1000); - ProxyAssertSupport.assertNotNull(rm3); - ProxyAssertSupport.assertEquals(tm3.getText(), rm3.getText()); - - TextMessage rm4 = (TextMessage) sub1.receive(1000); - ProxyAssertSupport.assertNotNull(rm4); - ProxyAssertSupport.assertEquals(tm4.getText(), rm4.getText()); - - Message m = sub1.receive(1000); - - ProxyAssertSupport.assertNull(m); - - rm1 = (TextMessage) sub2.receive(1000); - ProxyAssertSupport.assertNotNull(rm1); - ProxyAssertSupport.assertEquals(tm1.getText(), rm1.getText()); - - rm2 = (TextMessage) sub2.receive(1000); - ProxyAssertSupport.assertNotNull(rm2); - ProxyAssertSupport.assertEquals(tm2.getText(), rm2.getText()); - - rm3 = (TextMessage) sub2.receive(1000); - ProxyAssertSupport.assertNotNull(rm3); - ProxyAssertSupport.assertEquals(tm3.getText(), rm3.getText()); - - rm4 = (TextMessage) sub2.receive(1000); - ProxyAssertSupport.assertNotNull(rm4); - ProxyAssertSupport.assertEquals(tm4.getText(), rm4.getText()); - - m = sub2.receive(1000); - - ProxyAssertSupport.assertNull(m); - - res.end(xid1, XAResource.TMSUCCESS); - - // prepare it - - res.prepare(xid1); - - conn3 = createXAConnection(); - - XASession sess3 = conn3.createXASession(); - - XAResource res3 = sess3.getXAResource(); - - // recover - - Xid[] xids = res3.recover(XAResource.TMSTARTRSCAN); - ProxyAssertSupport.assertEquals(1, xids.length); - - Xid[] xids2 = res3.recover(XAResource.TMENDRSCAN); - ProxyAssertSupport.assertEquals(0, xids2.length); - - ProxyAssertSupport.assertEquals(xid1, xids[0]); - - log.trace("Committing the tx"); - - // Commit - res3.commit(xids[0], false); - - log.trace("committed the tx"); - - conn2.close(); - - conn1 = createConnection(); - - conn1.setClientID("wib1"); - - conn1.start(); - - sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - - // Should now see the last 4 messages - - sub1 = sess1.createDurableSubscriber(ActiveMQServerTestCase.topic2, "sub1"); - - sub2 = sess1.createDurableSubscriber(ActiveMQServerTestCase.topic2, "sub2"); - - TextMessage rm5 = (TextMessage) sub1.receive(1000); - ProxyAssertSupport.assertNotNull(rm5); - ProxyAssertSupport.assertEquals(tm5.getText(), rm5.getText()); - - TextMessage rm6 = (TextMessage) sub1.receive(1000); - ProxyAssertSupport.assertNotNull(rm6); - ProxyAssertSupport.assertEquals(tm6.getText(), rm6.getText()); - - TextMessage rm7 = (TextMessage) sub1.receive(1000); - ProxyAssertSupport.assertNotNull(rm7); - ProxyAssertSupport.assertEquals(tm7.getText(), rm7.getText()); - - TextMessage rm8 = (TextMessage) sub1.receive(1000); - ProxyAssertSupport.assertNotNull(rm8); - ProxyAssertSupport.assertEquals(tm8.getText(), rm8.getText()); - - m = sub1.receive(1000); - - ProxyAssertSupport.assertNull(m); - - rm5 = (TextMessage) sub2.receive(1000); - ProxyAssertSupport.assertNotNull(rm5); - ProxyAssertSupport.assertEquals(tm5.getText(), rm5.getText()); - - rm6 = (TextMessage) sub2.receive(1000); - ProxyAssertSupport.assertNotNull(rm6); - ProxyAssertSupport.assertEquals(tm6.getText(), rm6.getText()); - - rm7 = (TextMessage) sub2.receive(1000); - ProxyAssertSupport.assertNotNull(rm7); - ProxyAssertSupport.assertEquals(tm7.getText(), rm7.getText()); - - rm8 = (TextMessage) sub2.receive(1000); - ProxyAssertSupport.assertNotNull(rm8); - ProxyAssertSupport.assertEquals(tm8.getText(), rm8.getText()); - - m = sub2.receive(1000); - - ProxyAssertSupport.assertNull(m); - - sub1.close(); - - sub2.close(); - - sess1.unsubscribe("sub1"); - - sess1.unsubscribe("sub2"); - - } - finally - { - if (conn1 != null) - { - try - { - conn1.close(); - } - catch (Exception e) - { - // Ignore - } - } - - if (conn2 != null) - { - try - { - conn2.close(); - } - catch (Exception e) - { - // Ignore - } - } - - if (conn3 != null) - { - try - { - conn3.close(); - } - catch (Exception e) - { - // Ignore - } - } - } - } - - /* - * In this test, we have 4 messages in a 2 durable subs on the same topic. - * - * We ack them, then add four more messages - * - * This test tests for the recovery when the same message is in multiple channels - * - * We do restart in this test - * - */ - @Test - public void testRecoveryWithTwoDurableSubsWithRestart() throws Exception - { - Connection conn1 = null; - - XAConnection conn2 = null; - - XAConnection conn3 = null; - - try - { - conn1 = createConnection(); - - conn1.setClientID("wib1"); - - Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - - MessageProducer prod1 = sess1.createProducer(ActiveMQServerTestCase.topic2); - - MessageConsumer sub1 = sess1.createDurableSubscriber(ActiveMQServerTestCase.topic2, "sub1"); - - MessageConsumer sub2 = sess1.createDurableSubscriber(ActiveMQServerTestCase.topic2, "sub2"); - - // send four messages - - TextMessage tm1 = sess1.createTextMessage("tm1"); - TextMessage tm2 = sess1.createTextMessage("tm2"); - TextMessage tm3 = sess1.createTextMessage("tm3"); - TextMessage tm4 = sess1.createTextMessage("tm4"); - - prod1.send(tm1); - prod1.send(tm2); - prod1.send(tm3); - prod1.send(tm4); - - conn1.close(); - - // The messages should now be in both durable subs - - conn2 = createXAConnection(); - - conn2.setClientID("wib1"); - - conn2.start(); - - XASession sess2 = conn2.createXASession(); - - XAResource res = sess2.getXAResource(); - - Xid xid1 = new XidImpl("bq1".getBytes(), 42, "eemeli".getBytes()); - - res.start(xid1, XAResource.TMNOFLAGS); - - // Now send four more messages in a global tx - - MessageProducer prod2 = sess2.createProducer(ActiveMQServerTestCase.topic2); - - TextMessage tm5 = sess2.createTextMessage("tm5"); - TextMessage tm6 = sess2.createTextMessage("tm6"); - TextMessage tm7 = sess2.createTextMessage("tm7"); - TextMessage tm8 = sess2.createTextMessage("tm8"); - - prod2.send(tm5); - prod2.send(tm6); - prod2.send(tm7); - prod2.send(tm8); - - // And consume the first four from each in the tx - - sub1 = sess2.createDurableSubscriber(ActiveMQServerTestCase.topic2, "sub1"); - - sub2 = sess2.createDurableSubscriber(ActiveMQServerTestCase.topic2, "sub2"); - - TextMessage rm1 = (TextMessage) sub1.receive(1000); - ProxyAssertSupport.assertNotNull(rm1); - ProxyAssertSupport.assertEquals(tm1.getText(), rm1.getText()); - - TextMessage rm2 = (TextMessage) sub1.receive(1000); - ProxyAssertSupport.assertNotNull(rm2); - ProxyAssertSupport.assertEquals(tm2.getText(), rm2.getText()); - - TextMessage rm3 = (TextMessage) sub1.receive(1000); - ProxyAssertSupport.assertNotNull(rm3); - ProxyAssertSupport.assertEquals(tm3.getText(), rm3.getText()); - - TextMessage rm4 = (TextMessage) sub1.receive(1000); - ProxyAssertSupport.assertNotNull(rm4); - ProxyAssertSupport.assertEquals(tm4.getText(), rm4.getText()); - - Message m = sub1.receive(1000); - - ProxyAssertSupport.assertNull(m); - - rm1 = (TextMessage) sub2.receive(1000); - ProxyAssertSupport.assertNotNull(rm1); - ProxyAssertSupport.assertEquals(tm1.getText(), rm1.getText()); - - rm2 = (TextMessage) sub2.receive(1000); - ProxyAssertSupport.assertNotNull(rm2); - ProxyAssertSupport.assertEquals(tm2.getText(), rm2.getText()); - - rm3 = (TextMessage) sub2.receive(1000); - ProxyAssertSupport.assertNotNull(rm3); - ProxyAssertSupport.assertEquals(tm3.getText(), rm3.getText()); - - rm4 = (TextMessage) sub2.receive(1000); - ProxyAssertSupport.assertNotNull(rm4); - ProxyAssertSupport.assertEquals(tm4.getText(), rm4.getText()); - - m = sub2.receive(1000); - - ProxyAssertSupport.assertNull(m); - - res.end(xid1, XAResource.TMSUCCESS); - - // prepare it - - res.prepare(xid1); - - conn1.close(); - conn2.close(); - conn1 = null; - - conn2 = null; - - // Now "crash" the server - - stopServerPeer(); - - startServerPeer(); - - deployAndLookupAdministeredObjects(); - - conn3 = createXAConnection(); - - XASession sess3 = conn3.createXASession(); - - XAResource res3 = sess3.getXAResource(); - - // recover - - Xid[] xids = res3.recover(XAResource.TMSTARTRSCAN); - ProxyAssertSupport.assertEquals(1, xids.length); - - Xid[] xids2 = res3.recover(XAResource.TMENDRSCAN); - ProxyAssertSupport.assertEquals(0, xids2.length); - - ProxyAssertSupport.assertEquals(xid1, xids[0]); - - log.trace("Committing the tx"); - - // Commit - res3.commit(xids[0], false); - - log.trace("committed the tx"); - - conn1 = createConnection(); - - conn1.setClientID("wib1"); - - conn1.start(); - - sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - - // Should now see the last 4 messages - - sub1 = sess1.createDurableSubscriber(ActiveMQServerTestCase.topic2, "sub1"); - - sub2 = sess1.createDurableSubscriber(ActiveMQServerTestCase.topic2, "sub2"); - - TextMessage rm5 = (TextMessage) sub1.receive(1000); - ProxyAssertSupport.assertNotNull(rm5); - ProxyAssertSupport.assertEquals(tm5.getText(), rm5.getText()); - - TextMessage rm6 = (TextMessage) sub1.receive(1000); - ProxyAssertSupport.assertNotNull(rm6); - ProxyAssertSupport.assertEquals(tm6.getText(), rm6.getText()); - - TextMessage rm7 = (TextMessage) sub1.receive(1000); - ProxyAssertSupport.assertNotNull(rm7); - ProxyAssertSupport.assertEquals(tm7.getText(), rm7.getText()); - - TextMessage rm8 = (TextMessage) sub1.receive(1000); - ProxyAssertSupport.assertNotNull(rm8); - ProxyAssertSupport.assertEquals(tm8.getText(), rm8.getText()); - - m = sub1.receive(1000); - - ProxyAssertSupport.assertNull(m); - - rm5 = (TextMessage) sub2.receive(1000); - ProxyAssertSupport.assertNotNull(rm5); - ProxyAssertSupport.assertEquals(tm5.getText(), rm5.getText()); - - rm6 = (TextMessage) sub2.receive(1000); - ProxyAssertSupport.assertNotNull(rm6); - ProxyAssertSupport.assertEquals(tm6.getText(), rm6.getText()); - - rm7 = (TextMessage) sub2.receive(1000); - ProxyAssertSupport.assertNotNull(rm7); - ProxyAssertSupport.assertEquals(tm7.getText(), rm7.getText()); - - rm8 = (TextMessage) sub2.receive(1000); - ProxyAssertSupport.assertNotNull(rm8); - ProxyAssertSupport.assertEquals(tm8.getText(), rm8.getText()); - - m = sub2.receive(1000); - - ProxyAssertSupport.assertNull(m); - - sub1.close(); - - sub2.close(); - - sess1.unsubscribe("sub1"); - - sess1.unsubscribe("sub2"); - - } - finally - { - if (conn1 != null) - { - try - { - conn1.close(); - } - catch (Exception e) - { - // Ignore - } - } - - if (conn2 != null) - { - try - { - conn2.close(); - } - catch (Exception e) - { - // Ignore - } - } - - if (conn3 != null) - { - try - { - conn3.close(); - } - catch (Exception e) - { - // Ignore - } - } - } - } - - /* - * Send two messages in two transactions. - * Prepare tx - * Crash the server - * Restart the server - * Make sure the messages can be received - * NOTE this test only tests transactional sends, not transactional acknowledgments - * - */ - @Test - public void testTransactionalDeliveryRecovery() throws Exception - { - log.trace("starting testTransactionalDeliveryRecovery"); - - XAConnection conn1 = null; - - XAConnection conn2 = null; - - Connection conn3 = null; - - try - { - conn1 = createXAConnection(); - - conn2 = createXAConnection(); - - XASession sess1 = conn1.createXASession(); - - XASession sess2 = conn2.createXASession(); - - XAResource res1 = sess1.getXAResource(); - - XAResource res2 = sess2.getXAResource(); - - // Pretend to be a transaction manager by interacting through the XAResources - Xid xid1 = new XidImpl("bq1".getBytes(), 42, "eemeli".getBytes()); - Xid xid2 = new XidImpl("bq2".getBytes(), 42, "frigtard".getBytes()); - - log.trace("Sending messages"); - - // Send two messages in transaction 1 - - res1.start(xid1, XAResource.TMNOFLAGS); - - MessageProducer prod1 = sess1.createProducer(queue4); - - TextMessage tm1 = sess1.createTextMessage("tm1"); - - prod1.send(tm1); - - TextMessage tm2 = sess1.createTextMessage("tm2"); - - prod1.send(tm2); - - res1.end(xid1, XAResource.TMSUCCESS); - - // Send two messages in transaction 2 - - res2.start(xid2, XAResource.TMNOFLAGS); - - MessageProducer prod2 = sess2.createProducer(queue4); - - TextMessage tm3 = sess2.createTextMessage("tm3"); - - prod2.send(tm3); - - TextMessage tm4 = sess2.createTextMessage("tm4"); - - prod2.send(tm4); - - res2.end(xid2, XAResource.TMSUCCESS); - - log.trace("Sent messages"); - - // prepare both txs - - res1.prepare(xid1); - res2.prepare(xid2); - - log.trace("prepared messages"); - - // Now "crash" the server - - conn1.close(); - - conn2.close(); - - conn1 = null; - - conn2 = null; - - stopServerPeer(); - - startServerPeer(); - - deployAndLookupAdministeredObjects(); - - conn1 = createXAConnection(); - - XAResource res = conn1.createXASession().getXAResource(); - - log.trace("Recovering"); - - Xid[] xids = res.recover(XAResource.TMSTARTRSCAN); - ProxyAssertSupport.assertEquals(2, xids.length); - - Xid[] xids2 = res.recover(XAResource.TMENDRSCAN); - ProxyAssertSupport.assertEquals(0, xids2.length); - - // They may be in a different order - ProxyAssertSupport.assertTrue(xids[0].equals(xid1) || xids[1].equals(xid1)); - ProxyAssertSupport.assertTrue(xids[0].equals(xid2) || xids[1].equals(xid2)); - - // Make sure can't receive the messages - - log.trace("Creating conn"); - - conn3 = createConnection(); - - Session sessRec = conn3.createSession(false, Session.AUTO_ACKNOWLEDGE); - MessageConsumer cons = sessRec.createConsumer(queue4); - conn3.start(); - - log.trace("Created conn3"); - - TextMessage m1 = (TextMessage) cons.receive(1000); - ProxyAssertSupport.assertNull(m1); - - log.trace("committing"); - - // Commit tx1 - - res.commit(xid1, false); - - log.trace("committed"); - - // Should now be able to receive tm1 and tm2 - - m1 = (TextMessage) cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(m1); - - ProxyAssertSupport.assertEquals(tm1.getText(), m1.getText()); - - TextMessage m2 = (TextMessage) cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(m2); - - ProxyAssertSupport.assertEquals(tm2.getText(), m2.getText()); - - TextMessage m3 = (TextMessage) cons.receive(1000); - ProxyAssertSupport.assertNull(m3); - - // Now commit tx2 - - res.commit(xid2, false); - - // Should now be able to receive tm3 and tm4 - - m3 = (TextMessage) cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(m3); - - ProxyAssertSupport.assertEquals(tm3.getText(), m3.getText()); - - TextMessage m4 = (TextMessage) cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(m4); - - ProxyAssertSupport.assertEquals(tm4.getText(), m4.getText()); - - TextMessage m5 = (TextMessage) cons.receive(1000); - ProxyAssertSupport.assertNull(m5); - } - finally - { - if (conn1 != null) - { - try - { - conn1.close(); - } - catch (Exception e) - { - // Ignore - } - } - - if (conn2 != null) - { - try - { - conn2.close(); - } - catch (Exception e) - { - // Ignore - } - } - - if (conn3 != null) - { - try - { - conn3.close(); - } - catch (Exception e) - { - // Ignore - } - } - } - } - - /* - * This test sends some messages in a couple of txs, crashes then recovers - * NOTE it does not test transactional acknowledgements - */ - @Test - public void testMockCoordinatorRecovery() throws Exception - { - XAConnection conn1 = null; - - XAConnection conn2 = null; - - Connection conn3 = null; - - try - { - - conn1 = createXAConnection(); - - conn2 = createXAConnection(); - - XASession sess1 = conn1.createXASession(); - - XASession sess2 = conn2.createXASession(); - - XAResource res1 = sess1.getXAResource(); - - XAResource res2 = sess2.getXAResource(); - - // Pretend to be a transaction manager by interacting through the XAResources - Xid xid1 = new XidImpl("bq1".getBytes(), 42, "aapeli".getBytes()); - Xid xid2 = new XidImpl("bq2".getBytes(), 42, "belsebub".getBytes()); - - // Send a message in each tx - - res1.start(xid1, XAResource.TMNOFLAGS); - - MessageProducer prod1 = sess1.createProducer(queue2); - - TextMessage tm1 = sess1.createTextMessage("alpha"); - - prod1.send(tm1); - - res1.end(xid1, XAResource.TMSUCCESS); - - res2.start(xid2, XAResource.TMNOFLAGS); - - MessageProducer prod2 = sess2.createProducer(queue2); - - TextMessage tm2 = sess2.createTextMessage("beta"); - - prod2.send(tm2); - - res2.end(xid2, XAResource.TMSUCCESS); - - // prepare both txs - - res1.prepare(xid1); - res2.prepare(xid2); - - // Now "crash" the server - - stopServerPeer(); - - startServerPeer(); - - deployAndLookupAdministeredObjects(); - - conn1.close(); - - conn2.close(); - - conn1 = createXAConnection(); - - XAResource res = conn1.createXASession().getXAResource(); - - Xid[] xids = res.recover(XAResource.TMSTARTRSCAN); - ProxyAssertSupport.assertEquals(2, xids.length); - - Xid[] xids2 = res.recover(XAResource.TMENDRSCAN); - ProxyAssertSupport.assertEquals(0, xids2.length); - - ProxyAssertSupport.assertTrue(xids[0].equals(xid1) || xids[1].equals(xid1)); - ProxyAssertSupport.assertTrue(xids[0].equals(xid2) || xids[1].equals(xid2)); - - res.commit(xid1, false); - - res.commit(xid2, false); - - conn3 = createConnection(); - - Session sessRec = conn3.createSession(false, Session.AUTO_ACKNOWLEDGE); - MessageConsumer cons = sessRec.createConsumer(queue2); - conn3.start(); - - Message msg = cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - - TextMessage m1 = (TextMessage) msg; - ProxyAssertSupport.assertNotNull(m1); - - ProxyAssertSupport.assertTrue("alpha".equals(m1.getText()) || "beta".equals(m1.getText())); - - TextMessage m2 = (TextMessage) cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(m2); - - ProxyAssertSupport.assertTrue("alpha".equals(m2.getText()) || "beta".equals(m2.getText())); - - ProxyAssertSupport.assertTrue(!tm1.getText().equals(tm2.getText())); - - Message nullMessage = cons.receive(ActiveMQServerTestCase.MIN_TIMEOUT); - ProxyAssertSupport.assertTrue(nullMessage == null); - - } - finally - { - if (conn1 != null) - { - try - { - conn1.close(); - } - catch (Exception e) - { - // Ignore - } - } - - if (conn2 != null) - { - try - { - conn2.close(); - } - catch (Exception e) - { - // Ignore - } - } - - if (conn3 != null) - { - try - { - conn3.close(); - } - catch (Exception e) - { - // Ignore - } - } - } - - } - - /* - * This test sends some messages in a couple of txs, crashes then recovers - * It uses the JBoss TS XId implementation - so we can show compatibility - * NOTE it does not test transactional acknowledgements - */ - @Test - public void testMockCoordinatorRecoveryWithJBossTSXids() throws Exception - { - XAConnection conn1 = null; - - XAConnection conn2 = null; - - Connection conn3 = null; - conn1 = createXAConnection(); - - conn2 = createXAConnection(); - - XASession sess1 = conn1.createXASession(); - - XASession sess2 = conn2.createXASession(); - - XAResource res1 = sess1.getXAResource(); - - XAResource res2 = sess2.getXAResource(); - - // Pretend to be a transaction manager by interacting through the XAResources - Xid xid1 = new XidImple(new Uid("cadaver"), true, 666); - Xid xid2 = new XidImple(new Uid("dalidom"), true, 661); // TODO - - // Send a message in each tx - - res1.start(xid1, XAResource.TMNOFLAGS); - - MessageProducer prod1 = sess1.createProducer(queue1); - - TextMessage tm1 = sess1.createTextMessage("testing1"); - - prod1.send(tm1); - - res1.end(xid1, XAResource.TMSUCCESS); - - res2.start(xid2, XAResource.TMNOFLAGS); - - MessageProducer prod2 = sess2.createProducer(queue1); - - TextMessage tm2 = sess2.createTextMessage("testing2"); - - prod2.send(tm2); - - res2.end(xid2, XAResource.TMSUCCESS); - - // prepare both txs - - res1.prepare(xid1); - res2.prepare(xid2); - - // Now "crash" the server - - stopServerPeer(); - - startServerPeer(); - - deployAndLookupAdministeredObjects(); - - conn1.close(); - - conn2.close(); - - conn1 = createXAConnection(); - - - XAResource res = conn1.createXASession().getXAResource(); - Xid[] xids = res.recover(XAResource.TMSTARTRSCAN); - ProxyAssertSupport.assertEquals(2, xids.length); - - Xid[] xids2 = res.recover(XAResource.TMENDRSCAN); - ProxyAssertSupport.assertEquals(0, xids2.length); - - ProxyAssertSupport.assertTrue(xids[0].equals(xid1) || xids[1].equals(xid1)); - ProxyAssertSupport.assertTrue(xids[0].equals(xid2) || xids[1].equals(xid2)); - - res.commit(xid1, false); - - res.commit(xid2, false); - - conn3 = createConnection(); - - Session sessRec = conn3.createSession(false, Session.AUTO_ACKNOWLEDGE); - MessageConsumer cons = sessRec.createConsumer(queue1); - conn3.start(); - - TextMessage m1 = (TextMessage) cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(m1); - ProxyAssertSupport.assertEquals("testing1", m1.getText()); - - TextMessage m2 = (TextMessage) cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(m2); - - ProxyAssertSupport.assertEquals("testing2", m2.getText()); - } - - @Test - @Ignore("Ignored because: (i) it was ignored by our pom.xml, (ii) currently it still fails") - public void testMockCoordinatorRecovery3() throws Exception - { - XAConnection conn1 = null; - - XAConnection conn2 = null; - - Connection conn3 = null; - conn1 = createXAConnection(); - - - conn2 = createXAConnection(); - XASession sess1 = conn1.createXASession(); - - XASession sess2 = conn2.createXASession(); - - XAResource res1 = sess1.getXAResource(); - - XAResource res2 = sess2.getXAResource(); - - // Pretend to be a transaction manager by interacting through the XAResources - Xid xid1 = new XidImpl("bq1".getBytes(), 123, "gbtxid1".getBytes()); - Xid xid2 = new XidImpl("bq2".getBytes(), 124, "gbtxid2".getBytes()); - - // Send a message in each tx - - res1.start(xid1, XAResource.TMNOFLAGS); - - MessageProducer prod1 = sess1.createProducer(queue1); - - TextMessage tm1 = sess1.createTextMessage("testing1"); - - prod1.send(tm1); - - res1.end(xid1, XAResource.TMSUCCESS); - - res2.start(xid2, XAResource.TMNOFLAGS); - - MessageProducer prod2 = sess2.createProducer(queue1); - - TextMessage tm2 = sess2.createTextMessage("testing2"); - - prod2.send(tm2); - - res2.end(xid2, XAResource.TMSUCCESS); - - // prepare both txs - - res1.prepare(xid1); - res2.prepare(xid2); - - // Now "crash" the server - - stopServerPeer(); - - startServerPeer(); - - deployAndLookupAdministeredObjects(); - - conn1.close(); - - conn2.close(); - - conn1 = createXAConnection(); - - - XAResource res = conn1.createXASession().getXAResource(); - - Xid[] xids = res.recover(XAResource.TMSTARTRSCAN); - ProxyAssertSupport.assertEquals(2, xids.length); - - Xid[] xids2 = res.recover(XAResource.TMENDRSCAN); - ProxyAssertSupport.assertEquals(0, xids2.length); - - ProxyAssertSupport.assertTrue(xids[0].equals(xid1) || xids[1].equals(xid1)); - ProxyAssertSupport.assertTrue(xids[0].equals(xid2) || xids[1].equals(xid2)); - - res.commit(xids[0], false); - - res.commit(xids[1], false); - - conn3 = createConnection(); - - Session sessRec = conn3.createSession(false, Session.AUTO_ACKNOWLEDGE); - MessageConsumer cons = sessRec.createConsumer(queue1); - conn3.start(); - - TextMessage m1 = (TextMessage) cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(m1); - ProxyAssertSupport.assertEquals("testing1", m1.getText()); - - TextMessage m2 = (TextMessage) cons.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(m2); - - ProxyAssertSupport.assertEquals("testing2", m2.getText()); - } - - @Test - public void testMultiChannelRecovery() throws Exception - { - - XAConnection conn1 = createXAConnection(); - - - XAConnection conn2 = createXAConnection(); - - - XASession sess1 = conn1.createXASession(); - - XASession sess2 = conn2.createXASession(); - - XAResource res1 = sess1.getXAResource(); - - XAResource res2 = sess2.getXAResource(); - - // Pretend to be a transaction manager by interacting through the XAResources - Xid xid1 = new XidImpl("bq1".getBytes(), 123, "gbtxid1".getBytes()); - Xid xid2 = new XidImpl("bq2".getBytes(), 124, "gbtxid2".getBytes()); - - // Send a message in each tx - - res1.start(xid1, XAResource.TMNOFLAGS); - - MessageProducer prod1 = sess1.createProducer(queue2); - MessageProducer prod2 = sess1.createProducer(queue3); - - TextMessage tm1 = sess1.createTextMessage("testing1"); - TextMessage tm2 = sess1.createTextMessage("testing2"); - - prod1.send(tm1); - prod2.send(tm2); - - res1.end(xid1, XAResource.TMSUCCESS); - - res2.start(xid2, XAResource.TMNOFLAGS); - - MessageProducer prod3 = sess2.createProducer(queue1); - - TextMessage tm3 = sess2.createTextMessage("testing3"); - - prod3.send(tm3); - - res2.end(xid2, XAResource.TMSUCCESS); - - // prepare both txs - - res1.prepare(xid1); - res2.prepare(xid2); - - // Now "crash" the server - - stopServerPeer(); - - startServerPeer(); - - deployAndLookupAdministeredObjects(); - - conn1.close(); - - conn2.close(); - - conn1 = createXAConnection(); - - - XAResource res = conn1.createXASession().getXAResource(); - - Xid[] xids = res.recover(XAResource.TMSTARTRSCAN); - ProxyAssertSupport.assertEquals(2, xids.length); - - Xid[] xids2 = res.recover(XAResource.TMENDRSCAN); - ProxyAssertSupport.assertEquals(0, xids2.length); - - ProxyAssertSupport.assertTrue(xids[0].equals(xid1) || xids[1].equals(xid1)); - ProxyAssertSupport.assertTrue(xids[0].equals(xid2) || xids[1].equals(xid2)); - - res.commit(xids[0], false); - - res.commit(xids[1], false); - - Connection conn3 = createConnection(); - - Session sessRec = conn3.createSession(false, Session.AUTO_ACKNOWLEDGE); - - MessageConsumer cons1 = sessRec.createConsumer(queue2); - MessageConsumer cons2 = sessRec.createConsumer(queue3); - MessageConsumer cons3 = sessRec.createConsumer(queue1); - - conn3.start(); - - TextMessage m1 = (TextMessage) cons1.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(m1); - ProxyAssertSupport.assertEquals("testing1", m1.getText()); - - TextMessage m2 = (TextMessage) cons2.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(m2); - ProxyAssertSupport.assertEquals("testing2", m2.getText()); - - TextMessage m3 = (TextMessage) cons3.receive(ActiveMQServerTestCase.MAX_TIMEOUT); - ProxyAssertSupport.assertNotNull(m3); - ProxyAssertSupport.assertEquals("testing3", m3.getText()); - - } -} diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/ConcurrentCloseStressTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/ConcurrentCloseStressTest.java deleted file mode 100644 index 30d001bc36..0000000000 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/ConcurrentCloseStressTest.java +++ /dev/null @@ -1,297 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.jms.tests.stress; -import java.util.ArrayList; -import java.util.List; - -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.naming.InitialContext; - -import org.apache.activemq.jms.tests.ActiveMQServerTestCase; -import org.apache.activemq.jms.tests.JmsTestLogger; -import org.apache.activemq.jms.tests.util.ProxyAssertSupport; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * This test was added to test regression on http://jira.jboss.com/jira/browse/JBMESSAGING-660 - * @author Clebert Suconic - */ -public class ConcurrentCloseStressTest extends ActiveMQServerTestCase -{ - @BeforeClass - public static void stressTestsEnabled() - { - org.junit.Assume.assumeTrue(JMSStressTestBase.STRESS_TESTS_ENABLED); - } - - InitialContext ic; - - ConnectionFactory cf; - - Queue queue; - - @Override - @Before - public void setUp() throws Exception - { - super.setUp(); - - // ServerManagement.start("all"); - - ic = getInitialContext(); - cf = (ConnectionFactory)ic.lookup("/ConnectionFactory"); - - destroyQueue("TestQueue"); - createQueue("TestQueue"); - - queue = (Queue)ic.lookup("queue/TestQueue"); - - log.debug("setup done"); - } - - @Override - @After - public void tearDown() throws Exception - { - destroyQueue("TestQueue"); - super.tearDown(); - } - - @Test - public void testProducersAndConsumers() throws Exception - { - Connection connectionProducer = cf.createConnection(); - Connection connectionReader = cf.createConnection(); - - connectionReader.start(); - connectionProducer.start(); // try with and without this... - - ProducerThread[] producerThread = new ProducerThread[20]; - ReaderThread[] readerThread = new ReaderThread[20]; - TestThread[] threads = new TestThread[40]; - - for (int i = 0; i < 20; i++) - { - producerThread[i] = new ProducerThread(i, connectionProducer, queue); - readerThread[i] = new ReaderThread(i, connectionReader, queue); - threads[i] = producerThread[i]; - threads[i + 20] = readerThread[i]; - } - - for (int i = 0; i < 40; i++) - { - threads[i].start(); - } - - for (int i = 0; i < 40; i++) - { - threads[i].join(); - } - - boolean hasFailure = false; - - for (int i = 0; i < 40; i++) - { - if (!threads[i].exceptions.isEmpty()) - { - hasFailure = true; - for (Exception element : threads[i].exceptions) - { - Exception ex = element; - log.error("Exception occurred in one of the threads - " + ex, ex); - } - } - } - - int messagesProduced = 0; - int messagesRead = 0; - for (ProducerThread element : producerThread) - { - messagesProduced += element.messagesProduced; - } - - for (int i = 0; i < producerThread.length; i++) - { - messagesRead += readerThread[i].messagesRead; - } - - if (hasFailure) - { - ProxyAssertSupport.fail("An exception has occurred in one of the threads"); - } - } - - static class TestThread extends Thread - { - List exceptions = new ArrayList(); - - protected int index; - - public int messageCount = 0; - } - - static class ReaderThread extends TestThread - { - private static final JmsTestLogger log = JmsTestLogger.LOGGER; - - Connection conn; - - Queue queue; - - int messagesRead = 0; - - public ReaderThread(final int index, final Connection conn, final Queue queue) throws Exception - { - this.index = index; - this.conn = conn; - this.queue = queue; - } - - @Override - public void run() - { - int commitCounter = 0; - try - { - Session session = conn.createSession(true, Session.SESSION_TRANSACTED); - MessageConsumer consumer = session.createConsumer(queue); - - int lastCount = messageCount; - while (true) - { - TextMessage message = (TextMessage)consumer.receive(5000); - if (message == null) - { - break; - } - ReaderThread.log.debug("read message " + message.getText()); - - // alternating commits and rollbacks - if (commitCounter++ % 2 == 0) - { - messagesRead += messageCount - lastCount; - lastCount = messageCount; - ReaderThread.log.debug("commit"); - session.commit(); - } - else - { - lastCount = messageCount; - ReaderThread.log.debug("rollback"); - session.rollback(); - } - - messageCount++; - - if (messageCount % 7 == 0) - { - session.close(); - - session = conn.createSession(true, Session.SESSION_TRANSACTED); - consumer = session.createConsumer(queue); - } - } - - messagesRead += messageCount - lastCount; - - session.commit(); - consumer.close(); - session.close(); - } - catch (Exception e) - { - e.printStackTrace(); - exceptions.add(e); - } - } - - } - - static class ProducerThread extends TestThread - { - private static final JmsTestLogger log = JmsTestLogger.LOGGER; - - Connection conn; - - Queue queue; - - int messagesProduced = 0; - - public ProducerThread(final int index, final Connection conn, final Queue queue) throws Exception - { - this.index = index; - this.conn = conn; - this.queue = queue; - } - - @Override - public void run() - { - for (int i = 0; i < 10; i++) - { - try - { - int lastMessage = messageCount; - Session sess = conn.createSession(true, Session.SESSION_TRANSACTED); - MessageProducer producer = sess.createProducer(queue); - - for (int j = 0; j < 20; j++) - { - producer.send(sess.createTextMessage("Message " + i + ", " + j)); - - if (j % 2 == 0) - { - ProducerThread.log.debug("commit"); - messagesProduced += messageCount - lastMessage; - lastMessage = messageCount; - - sess.commit(); - } - else - { - ProducerThread.log.debug("rollback"); - lastMessage = messageCount; - sess.rollback(); - } - messageCount++; - - } - - messagesProduced += messageCount - lastMessage; - sess.commit(); - sess.close(); - } - catch (Exception e) - { - e.printStackTrace(); - exceptions.add(e); - } - } - } - - } - -} diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/CorruptMessageStressTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/CorruptMessageStressTest.java deleted file mode 100644 index e5fde58ccf..0000000000 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/CorruptMessageStressTest.java +++ /dev/null @@ -1,164 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.jms.tests.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.apache.activemq.jms.tests.ActiveMQServerTestCase; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * A stress test written to investigate http://jira.jboss.org/jira/browse/JBMESSAGING-362 - * - * @author Ovidiu Feodorov - */ -public class CorruptMessageStressTest extends ActiveMQServerTestCase -{ - @BeforeClass - public static void stressTestsEnabled() - { - org.junit.Assume.assumeTrue(JMSStressTestBase.STRESS_TESTS_ENABLED); - } - - public static int PRODUCER_COUNT = 30; - - public static int MESSAGE_COUNT = 10000; - - // Static -------------------------------------------------------- - - // Attributes ---------------------------------------------------- - - private InitialContext ic; - - // Constructors -------------------------------------------------- - - // Public -------------------------------------------------------- - - @Test - public void testMultipleSenders() throws Exception - { - ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory"); - Queue queue = (Queue)ic.lookup("/queue/StressTestQueue"); - drainDestination(cf, queue); - - Connection conn = cf.createConnection(); - - Session[] sessions = new Session[CorruptMessageStressTest.PRODUCER_COUNT]; - MessageProducer[] producers = new MessageProducer[CorruptMessageStressTest.PRODUCER_COUNT]; - - for (int i = 0; i < CorruptMessageStressTest.PRODUCER_COUNT; i++) - { - sessions[i] = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); - producers[i] = sessions[i].createProducer(queue); - producers[i].setDeliveryMode(DeliveryMode.NON_PERSISTENT); - } - - Thread[] threads = new Thread[CorruptMessageStressTest.PRODUCER_COUNT]; - - for (int i = 0; i < CorruptMessageStressTest.PRODUCER_COUNT; i++) - { - threads[i] = new Thread(new Sender(sessions[i], producers[i]), "Sender Thread #" + i); - threads[i].start(); - } - - // wait for the threads to finish - - for (int i = 0; i < CorruptMessageStressTest.PRODUCER_COUNT; i++) - { - threads[i].join(); - } - - conn.close(); - } - - // Package protected --------------------------------------------- - - // Protected ----------------------------------------------------- - - @Override - @Before - public void setUp() throws Exception - { - super.setUp(); - - // ServerManagement.start("all"); - ic = getInitialContext(); - createQueue("StressTestQueue"); - } - - @Override - @After - public void tearDown() throws Exception - { - super.tearDown(); - destroyQueue("StressTestQueue"); - ic.close(); - } - - // Private ------------------------------------------------------- - - // Inner classes ------------------------------------------------- - - private class Sender implements Runnable - { - private final Session session; - - private final MessageProducer producer; - - private int count = 0; - - public Sender(final Session session, final MessageProducer producer) - { - this.session = session; - this.producer = producer; - } - - public void run() - { - while (true) - { - if (count == CorruptMessageStressTest.MESSAGE_COUNT) - { - break; - } - - try - { - Message m = session.createMessage(); - m.setStringProperty("XXX", "XXX-VALUE"); - m.setStringProperty("YYY", "YYY-VALUE"); - producer.send(m); - count++; - } - catch (Exception e) - { - log.error("Sender thread failed", e); - break; - } - } - } - } -} diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/JMSStressTestBase.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/JMSStressTestBase.java deleted file mode 100644 index 93b368c086..0000000000 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/JMSStressTestBase.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.jms.tests.stress; -import javax.jms.ConnectionFactory; -import javax.jms.Destination; -import javax.jms.Topic; -import javax.jms.XASession; - -import org.apache.activemq.jms.tests.ActiveMQServerTestCase; -import org.apache.activemq.jms.tests.util.ProxyAssertSupport; -import org.junit.After; -import org.junit.BeforeClass; - -/** - * - * Base class for stress tests - * - * @author Tim Fox - * -*/ -public abstract class JMSStressTestBase extends ActiveMQServerTestCase -{ - public static final boolean STRESS_TESTS_ENABLED = false; - - @BeforeClass - public static void stressTestsEnabled() - { - org.junit.Assume.assumeTrue(JMSStressTestBase.STRESS_TESTS_ENABLED); - } - - protected static final int NUM_PERSISTENT_MESSAGES = 4000; - - protected static final int NUM_NON_PERSISTENT_MESSAGES = 6000; - - protected static final int NUM_PERSISTENT_PRESEND = 5000; - - protected static final int NUM_NON_PERSISTENT_PRESEND = 3000; - - protected ConnectionFactory cf; - - protected Destination topic; - - protected Destination destinationQueue1; - protected Destination destinationQueue2; - protected Destination destinationQueue3; - protected Destination destinationQueue4; - - protected Topic topic1; - protected Topic topic2; - protected Topic topic3; - protected Topic topic4; - - @Override - @After - public void tearDown() throws Exception - { - super.tearDown(); - if (checkNoMessageData()) - { - ProxyAssertSupport.fail("Message data still exists"); - } - } - - protected void runRunners(final Runner[] runners) throws Exception - { - Thread[] threads = new Thread[runners.length]; - for (int i = 0; i < runners.length; i++) - { - threads[i] = new Thread(runners[i]); - threads[i].start(); - } - - for (int i = 0; i < runners.length; i++) - { - threads[i].join(); - } - - for (int i = 0; i < runners.length; i++) - { - if (runners[i].isFailed()) - { - ProxyAssertSupport.fail("Runner " + i + " failed"); - log.error("runner failed"); - } - } - } - - protected void tweakXASession(final XASession sess) - { - - } -} diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/ManyConnectionsStressTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/ManyConnectionsStressTest.java deleted file mode 100644 index a53f174eed..0000000000 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/ManyConnectionsStressTest.java +++ /dev/null @@ -1,218 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.jms.tests.stress; - -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 java.util.HashSet; -import java.util.Set; - -import org.apache.activemq.jms.tests.ActiveMQServerTestCase; -import org.apache.activemq.jms.tests.util.ProxyAssertSupport; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * Create 500 connections each with a consumer, consuming from a topic - * - * @author Tim Fox - */ -public class ManyConnectionsStressTest extends ActiveMQServerTestCase -{ - @BeforeClass - public static void stressTestsEnabled() - { - org.junit.Assume.assumeTrue(JMSStressTestBase.STRESS_TESTS_ENABLED); - } - - private static final int NUM_CONNECTIONS = 500; - - private static final int NUM_MESSAGES = 100; - - // Static -------------------------------------------------------- - - // Attributes ---------------------------------------------------- - - private InitialContext ic; - - private volatile boolean failed; - - private final Set listeners = new HashSet(); - - // Constructors -------------------------------------------------- - - // Public -------------------------------------------------------- - - @Override - @Before - public void setUp() throws Exception - { - super.setUp(); - - // ServerManagement.start("all"); - - ic = getInitialContext(); - - createTopic("StressTestTopic"); - } - - @Override - @After - public void tearDown() throws Exception - { - destroyTopic("StressTestTopic"); - ic.close(); - super.tearDown(); - } - - @Test - public void testManyConnections() throws Exception - { - ConnectionFactory cf = (ConnectionFactory) ic.lookup("/ConnectionFactory"); - - Topic topic = (Topic) ic.lookup("/topic/StressTestTopic"); - - Connection[] conns = new Connection[ManyConnectionsStressTest.NUM_CONNECTIONS]; - - for (int i = 0; i < ManyConnectionsStressTest.NUM_CONNECTIONS; i++) - { - conns[i] = addConnection(cf.createConnection()); - - Session sess = conns[i].createSession(false, Session.AUTO_ACKNOWLEDGE); - - MessageConsumer cons = sess.createConsumer(topic); - - MyListener listener = new MyListener(); - - synchronized (listeners) - { - listeners.add(listener); - } - - cons.setMessageListener(listener); - - conns[i].start(); - - log.info("Created " + i); - } - - // Thread.sleep(100 * 60 * 1000); - - Connection connSend = addConnection(cf.createConnection()); - - Session sessSend = connSend.createSession(false, Session.AUTO_ACKNOWLEDGE); - - MessageProducer prod = sessSend.createProducer(topic); - - for (int i = 0; i < ManyConnectionsStressTest.NUM_MESSAGES; i++) - { - TextMessage tm = sessSend.createTextMessage("message" + i); - - tm.setIntProperty("count", i); - - prod.send(tm); - } - - long wait = 30000; - - synchronized (listeners) - { - while (!listeners.isEmpty() && wait > 0) - { - long start = System.currentTimeMillis(); - try - { - listeners.wait(wait); - } - catch (InterruptedException e) - { - // Ignore - } - wait -= System.currentTimeMillis() - start; - } - } - - if (wait <= 0) - { - ProxyAssertSupport.fail("Timed out"); - } - - ProxyAssertSupport.assertFalse(failed); - } - - private void finished(final MyListener listener) - { - synchronized (listeners) - { - log.info("consumer " + listener + " has finished"); - - listeners.remove(listener); - - listeners.notify(); - } - } - - private void failed(final MyListener listener) - { - synchronized (listeners) - { - log.error("consumer " + listener + " has failed"); - - listeners.remove(listener); - - failed = true; - - listeners.notify(); - } - } - - private final class MyListener implements MessageListener - { - public void onMessage(final Message msg) - { - try - { - int count = msg.getIntProperty("count"); - - // log.info(this + " got message " + msg); - - if (count == ManyConnectionsStressTest.NUM_MESSAGES - 1) - { - finished(this); - } - } - catch (JMSException e) - { - log.error("Failed to get int property", e); - - failed(this); - } - } - - } -} diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/OpenCloseStressTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/OpenCloseStressTest.java deleted file mode 100644 index 29d5f8f885..0000000000 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/OpenCloseStressTest.java +++ /dev/null @@ -1,445 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.jms.tests.stress; -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -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.apache.activemq.jms.tests.ActiveMQServerTestCase; -import org.apache.activemq.jms.tests.util.ProxyAssertSupport; -import org.apache.activemq.utils.UUIDGenerator; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * A OpenCloseStressTest. - *

- * This stress test starts several publisher connections and several subscriber connections, then - * sends and consumes messages while concurrently closing the sessions. - *

- * This test will help catch race conditions that occurred with rapid open/closing of sessions when - * messages are being sent/received - *

- * E.g. http://jira.jboss.com/jira/browse/JBMESSAGING-982 - * @author Tim Fox - */ -public class OpenCloseStressTest extends ActiveMQServerTestCase -{ - @BeforeClass - public static void stressTestsEnabled() - { - org.junit.Assume.assumeTrue(JMSStressTestBase.STRESS_TESTS_ENABLED); - } - - InitialContext ic; - - ConnectionFactory cf; - - Topic topic; - - @Override - @Before - public void setUp() throws Exception - { - super.setUp(); - - // ServerManagement.start("all"); - - ic = getInitialContext(); - cf = (ConnectionFactory)ic.lookup("/ConnectionFactory"); - - destroyTopic("TestTopic"); - createTopic("TestTopic"); - - topic = (Topic)ic.lookup("topic/TestTopic"); - - log.debug("setup done"); - } - - @Override - @After - public void tearDown() throws Exception - { - destroyQueue("TestQueue"); - log.debug("tear down done"); - } - - @Test - public void testOpenClose() throws Exception - { - Connection conn1 = null; - Connection conn2 = null; - Connection conn3 = null; - - Connection conn4 = null; - Connection conn5 = null; - Connection conn6 = null; - Connection conn7 = null; - Connection conn8 = null; - - try - { - Publisher[] publishers = new Publisher[3]; - - final int MSGS_PER_PUBLISHER = 10000; - - conn1 = cf.createConnection(); - Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - MessageProducer prod1 = sess1.createProducer(topic); - prod1.setDeliveryMode(DeliveryMode.PERSISTENT); - publishers[0] = new Publisher(sess1, prod1, MSGS_PER_PUBLISHER, 2); - - conn2 = cf.createConnection(); - Session sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE); - MessageProducer prod2 = sess2.createProducer(topic); - prod2.setDeliveryMode(DeliveryMode.PERSISTENT); - publishers[1] = new Publisher(sess2, prod2, MSGS_PER_PUBLISHER, 5); - - conn3 = cf.createConnection(); - Session sess3 = conn3.createSession(false, Session.AUTO_ACKNOWLEDGE); - MessageProducer prod3 = sess3.createProducer(topic); - prod3.setDeliveryMode(DeliveryMode.PERSISTENT); - publishers[2] = new Publisher(sess3, prod3, MSGS_PER_PUBLISHER, 1); - - Subscriber[] subscribers = new Subscriber[5]; - - conn4 = cf.createConnection(); - subscribers[0] = new Subscriber(conn4, 3 * MSGS_PER_PUBLISHER, 500, 1000 * 60 * 15, topic, false); - - conn5 = cf.createConnection(); - subscribers[1] = new Subscriber(conn5, 3 * MSGS_PER_PUBLISHER, 2000, 1000 * 60 * 15, topic, false); - - conn6 = cf.createConnection(); - subscribers[2] = new Subscriber(conn6, 3 * MSGS_PER_PUBLISHER, 700, 1000 * 60 * 15, topic, false); - - conn7 = cf.createConnection(); - subscribers[3] = new Subscriber(conn7, 3 * MSGS_PER_PUBLISHER, 1500, 1000 * 60 * 15, topic, true); - - conn8 = cf.createConnection(); - subscribers[4] = new Subscriber(conn8, 3 * MSGS_PER_PUBLISHER, 1200, 1000 * 60 * 15, topic, true); - - Thread[] threads = new Thread[8]; - - // subscribers - threads[0] = new Thread(subscribers[0]); - - threads[1] = new Thread(subscribers[1]); - - threads[2] = new Thread(subscribers[2]); - - threads[3] = new Thread(subscribers[3]); - - threads[4] = new Thread(subscribers[4]); - - // publishers - - threads[5] = new Thread(publishers[0]); - - threads[6] = new Thread(publishers[1]); - - threads[7] = new Thread(publishers[2]); - - for (int i = 0; i < subscribers.length; i++) - { - threads[i].start(); - } - - // Pause before creating producers otherwise subscribers to make sure they're all created - - Thread.sleep(5000); - - for (int i = subscribers.length; i < threads.length; i++) - { - threads[i].start(); - } - - for (Thread thread : threads) - { - thread.join(); - } - - for (Subscriber subscriber : subscribers) - { - if (subscriber.isDurable()) - { - ProxyAssertSupport.assertEquals(3 * MSGS_PER_PUBLISHER, subscriber.getMessagesReceived()); - } - else - { - // Note that for a non durable subscriber the number of messages received in total - // will be somewhat less than the total number received since when recycling the session - // there is a period of time after closing the previous session and starting the next one - // when messages are being sent and won't be received (since there is no consumer) - } - - ProxyAssertSupport.assertFalse(subscriber.isFailed()); - } - - for (Publisher publisher : publishers) - { - ProxyAssertSupport.assertFalse(publisher.isFailed()); - } - } - finally - { - if (conn1 != null) - { - conn1.close(); - } - if (conn2 != null) - { - conn2.close(); - } - if (conn3 != null) - { - conn3.close(); - } - if (conn4 != null) - { - conn4.close(); - } - if (conn5 != null) - { - conn5.close(); - } - if (conn6 != null) - { - conn6.close(); - } - if (conn7 != null) - { - conn7.close(); - } - if (conn8 != null) - { - conn8.close(); - } - } - - } - - class Publisher implements Runnable - { - private final Session sess; - - private final int numMessages; - - private final int delay; - - private final MessageProducer prod; - - private boolean failed; - - boolean isFailed() - { - return failed; - } - - Publisher(final Session sess, final MessageProducer prod, final int numMessages, final int delay) - { - this.sess = sess; - - this.prod = prod; - - this.numMessages = numMessages; - - this.delay = delay; - } - - public void run() - { - try - { - for (int i = 0; i < numMessages; i++) - { - TextMessage tm = sess.createTextMessage("message" + i); - - prod.send(tm); - - try - { - Thread.sleep(delay); - } - catch (Exception ignore) - { - } - } - } - catch (JMSException e) - { - log.error("Failed to send message", e); - failed = true; - } - } - - } - - class Subscriber implements Runnable - { - private Session sess; - - private MessageConsumer cons; - - private int msgsReceived; - - private final int numMessages; - - private final int delay; - - private final Connection conn; - - private boolean failed; - - private final long timeout; - - private final Destination dest; - - private final boolean durable; - - private String subname; - - boolean isFailed() - { - return failed; - } - - boolean isDurable() - { - return durable; - } - - synchronized void msgReceived() - { - msgsReceived++; - } - - synchronized int getMessagesReceived() - { - return msgsReceived; - } - - class Listener implements MessageListener - { - - public void onMessage(final Message msg) - { - msgReceived(); - } - - } - - Subscriber(final Connection conn, - final int numMessages, - final int delay, - final long timeout, - final Destination dest, - final boolean durable) throws Exception - { - this.conn = conn; - - this.numMessages = numMessages; - - this.delay = delay; - - this.timeout = timeout; - - this.dest = dest; - - this.durable = durable; - - if (durable) - { - conn.setClientID(UUIDGenerator.getInstance().generateStringUUID()); - - subname = UUIDGenerator.getInstance().generateStringUUID(); - } - } - - public void run() - { - try - { - long start = System.currentTimeMillis(); - - while (System.currentTimeMillis() - start < timeout && msgsReceived < numMessages) - { - // recycle the session - - recycleSession(); - - Thread.sleep(delay); - } - - // Delete the durable sub - - if (durable) - { - recycleSession(); - - cons.close(); - - sess.unsubscribe(subname); - } - } - catch (Exception e) - { - log.error("Failed in subscriber", e); - failed = true; - } - - } - - void recycleSession() throws Exception - { - conn.stop(); - - if (sess != null) - { - sess.close(); - } - - sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); - - if (durable) - { - cons = sess.createDurableSubscriber((Topic)dest, subname); - } - else - { - cons = sess.createConsumer(dest); - } - - cons.setMessageListener(new Listener()); - - conn.start(); - } - - } - -} diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/QueueStressTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/QueueStressTest.java deleted file mode 100644 index 7878859818..0000000000 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/QueueStressTest.java +++ /dev/null @@ -1,271 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.jms.tests.stress; - -import javax.jms.Connection; -import javax.jms.DeliveryMode; -import javax.jms.MessageConsumer; -import javax.jms.MessageProducer; -import javax.jms.Session; -import javax.jms.XAConnection; -import javax.jms.XASession; - -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * A QueueStressTest. - * - * @author Tim Fox - * @version $Revision: 2349 $ - */ - -public class QueueStressTest extends JMSStressTestBase -{ - @BeforeClass - public static void stressTestsEnabled() - { - org.junit.Assume.assumeTrue(JMSStressTestBase.STRESS_TESTS_ENABLED); - } - - /* - * Stress a queue with transational, non transactional and 2pc senders sending both persistent - * and non persistent messages - * Transactional senders go through a cycle of sending and rolling back - * - */ - @Test - public void testQueueMultipleSenders() throws Exception - { - Connection conn1 = cf.createConnection(); - - Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - Session sess2 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - Session sess3 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - Session sess4 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - Session sess5 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - Session sess6 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - Session sess7 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - Session sess8 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - - Session sess9 = conn1.createSession(true, Session.SESSION_TRANSACTED); - Session sess10 = conn1.createSession(true, Session.SESSION_TRANSACTED); - Session sess11 = conn1.createSession(true, Session.SESSION_TRANSACTED); - Session sess12 = conn1.createSession(true, Session.SESSION_TRANSACTED); - Session sess13 = conn1.createSession(true, Session.SESSION_TRANSACTED); - Session sess14 = conn1.createSession(true, Session.SESSION_TRANSACTED); - Session sess15 = conn1.createSession(true, Session.SESSION_TRANSACTED); - Session sess16 = conn1.createSession(true, Session.SESSION_TRANSACTED); - - XASession xaSess1 = ((XAConnection) conn1).createXASession(); - tweakXASession(xaSess1); - XASession xaSess2 = ((XAConnection) conn1).createXASession(); - tweakXASession(xaSess2); - XASession xaSess3 = ((XAConnection) conn1).createXASession(); - tweakXASession(xaSess3); - XASession xaSess4 = ((XAConnection) conn1).createXASession(); - tweakXASession(xaSess4); - XASession xaSess5 = ((XAConnection) conn1).createXASession(); - tweakXASession(xaSess5); - XASession xaSess6 = ((XAConnection) conn1).createXASession(); - tweakXASession(xaSess6); - XASession xaSess7 = ((XAConnection) conn1).createXASession(); - tweakXASession(xaSess7); - XASession xaSess8 = ((XAConnection) conn1).createXASession(); - tweakXASession(xaSess8); - - Session sess17 = xaSess1.getSession(); - Session sess18 = xaSess2.getSession(); - Session sess19 = xaSess3.getSession(); - Session sess20 = xaSess4.getSession(); - Session sess21 = xaSess5.getSession(); - Session sess22 = xaSess6.getSession(); - Session sess23 = xaSess7.getSession(); - Session sess24 = xaSess8.getSession(); - - MessageProducer prod1 = sess1.createProducer(destinationQueue1); - prod1.setDeliveryMode(DeliveryMode.NON_PERSISTENT); - MessageProducer prod2 = sess2.createProducer(destinationQueue1); - prod2.setDeliveryMode(DeliveryMode.PERSISTENT); - MessageProducer prod3 = sess3.createProducer(destinationQueue1); - prod3.setDeliveryMode(DeliveryMode.NON_PERSISTENT); - MessageProducer prod4 = sess4.createProducer(destinationQueue1); - prod4.setDeliveryMode(DeliveryMode.PERSISTENT); - MessageProducer prod5 = sess5.createProducer(destinationQueue1); - prod5.setDeliveryMode(DeliveryMode.NON_PERSISTENT); - MessageProducer prod6 = sess6.createProducer(destinationQueue1); - prod6.setDeliveryMode(DeliveryMode.PERSISTENT); - MessageProducer prod7 = sess7.createProducer(destinationQueue1); - prod7.setDeliveryMode(DeliveryMode.NON_PERSISTENT); - MessageProducer prod8 = sess8.createProducer(destinationQueue1); - prod8.setDeliveryMode(DeliveryMode.PERSISTENT); - MessageProducer prod9 = sess9.createProducer(destinationQueue1); - prod9.setDeliveryMode(DeliveryMode.NON_PERSISTENT); - MessageProducer prod10 = sess10.createProducer(destinationQueue1); - prod10.setDeliveryMode(DeliveryMode.PERSISTENT); - MessageProducer prod11 = sess11.createProducer(destinationQueue1); - prod11.setDeliveryMode(DeliveryMode.NON_PERSISTENT); - MessageProducer prod12 = sess12.createProducer(destinationQueue1); - prod12.setDeliveryMode(DeliveryMode.PERSISTENT); - MessageProducer prod13 = sess13.createProducer(destinationQueue1); - prod13.setDeliveryMode(DeliveryMode.NON_PERSISTENT); - MessageProducer prod14 = sess14.createProducer(destinationQueue1); - prod14.setDeliveryMode(DeliveryMode.PERSISTENT); - MessageProducer prod15 = sess15.createProducer(destinationQueue1); - prod15.setDeliveryMode(DeliveryMode.NON_PERSISTENT); - MessageProducer prod16 = sess16.createProducer(destinationQueue1); - prod16.setDeliveryMode(DeliveryMode.PERSISTENT); - MessageProducer prod17 = sess17.createProducer(destinationQueue1); - prod17.setDeliveryMode(DeliveryMode.NON_PERSISTENT); - MessageProducer prod18 = sess18.createProducer(destinationQueue1); - prod18.setDeliveryMode(DeliveryMode.PERSISTENT); - MessageProducer prod19 = sess19.createProducer(destinationQueue1); - prod19.setDeliveryMode(DeliveryMode.NON_PERSISTENT); - MessageProducer prod20 = sess20.createProducer(destinationQueue1); - prod20.setDeliveryMode(DeliveryMode.PERSISTENT); - MessageProducer prod21 = sess21.createProducer(destinationQueue1); - prod21.setDeliveryMode(DeliveryMode.NON_PERSISTENT); - MessageProducer prod22 = sess22.createProducer(destinationQueue1); - prod22.setDeliveryMode(DeliveryMode.PERSISTENT); - MessageProducer prod23 = sess23.createProducer(destinationQueue1); - prod23.setDeliveryMode(DeliveryMode.NON_PERSISTENT); - MessageProducer prod24 = sess24.createProducer(destinationQueue1); - prod24.setDeliveryMode(DeliveryMode.PERSISTENT); - - Connection conn2 = cf.createConnection(); - conn2.start(); - Session sessReceive = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE); - MessageConsumer cons = sessReceive.createConsumer(destinationQueue1); - - Runner[] runners = new Runner[]{ - new Sender("prod1", sess1, prod1, JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES), - new Sender("prod2", sess2, prod2, JMSStressTestBase.NUM_PERSISTENT_MESSAGES), - new Sender("prod3", sess3, prod3, JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES), - new Sender("prod4", sess4, prod4, JMSStressTestBase.NUM_PERSISTENT_MESSAGES), - new Sender("prod5", sess5, prod5, JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES), - new Sender("prod6", sess6, prod6, JMSStressTestBase.NUM_PERSISTENT_MESSAGES), - new Sender("prod7", sess7, prod7, JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES), - new Sender("prod8", sess8, prod8, JMSStressTestBase.NUM_PERSISTENT_MESSAGES), - new TransactionalSender("prod9", - sess9, - prod9, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES, - 1, - 1), - new TransactionalSender("prod10", - sess10, - prod10, - JMSStressTestBase.NUM_PERSISTENT_MESSAGES, - 1, - 1), - new TransactionalSender("prod11", - sess11, - prod11, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES, - 10, - 7), - new TransactionalSender("prod12", - sess12, - prod12, - JMSStressTestBase.NUM_PERSISTENT_MESSAGES, - 10, - 7), - new TransactionalSender("prod13", - sess13, - prod13, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES, - 50, - 21), - new TransactionalSender("prod14", - sess14, - prod14, - JMSStressTestBase.NUM_PERSISTENT_MESSAGES, - 50, - 21), - new TransactionalSender("prod15", - sess15, - prod15, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES, - 100, - 67), - new TransactionalSender("prod16", - sess16, - prod16, - JMSStressTestBase.NUM_PERSISTENT_MESSAGES, - 100, - 67), - new Transactional2PCSender("prod17", - xaSess1, - prod17, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES, - 1, - 1), - new Transactional2PCSender("prod18", - xaSess2, - prod18, - JMSStressTestBase.NUM_PERSISTENT_MESSAGES, - 1, - 1), - new Transactional2PCSender("prod19", - xaSess3, - prod19, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES, - 10, - 7), - new Transactional2PCSender("prod20", - xaSess4, - prod20, - JMSStressTestBase.NUM_PERSISTENT_MESSAGES, - 10, - 7), - new Transactional2PCSender("prod21", - xaSess5, - prod21, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES, - 50, - 21), - new Transactional2PCSender("prod22", - xaSess6, - prod22, - JMSStressTestBase.NUM_PERSISTENT_MESSAGES, - 50, - 21), - new Transactional2PCSender("prod23", - xaSess7, - prod23, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES, - 100, - 67), - new Transactional2PCSender("prod24", - xaSess8, - prod24, - JMSStressTestBase.NUM_PERSISTENT_MESSAGES, - 100, - 67), - new Receiver(sessReceive, - cons, - 12 * JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES + 12 * JMSStressTestBase.NUM_PERSISTENT_MESSAGES, - false)}; - - runRunners(runners); - - conn1.close(); - - conn2.close(); - } - -} diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/Receiver.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/Receiver.java deleted file mode 100644 index 1a4c6b4760..0000000000 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/Receiver.java +++ /dev/null @@ -1,297 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.jms.tests.stress; - -import java.util.HashMap; -import java.util.Map; - -import javax.jms.Connection; -import javax.jms.ConnectionConsumer; -import javax.jms.Destination; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageConsumer; -import javax.jms.MessageListener; -import javax.jms.ServerSession; -import javax.jms.ServerSessionPool; -import javax.jms.Session; - -import org.apache.activemq.jms.tests.JmsTestLogger; - -/** - * Receives messages from a destination for stress testing - * @author Tim Fox - */ -public class Receiver extends Runner implements MessageListener -{ - private static final JmsTestLogger log = JmsTestLogger.LOGGER; - - private static final long RECEIVE_TIMEOUT = 120000; - - protected MessageConsumer cons; - - protected int count; - - protected boolean isListener; - - protected Map counts = new HashMap(); - - protected boolean isCC; - - protected Connection conn; - - protected ConnectionConsumer cc; - - private final Object lock1 = new Object(); - - private final Object lock2 = new Object(); - - private Message theMessage; - - private boolean finished; - - public Receiver(final Connection conn, final Session sess, final int numMessages, final Destination dest) throws Exception - { - super(sess, numMessages); - - isListener = true; - - isCC = true; - - sess.setMessageListener(this); - - cc = conn.createConnectionConsumer(dest, null, new MockServerSessionPool(sess), 10); - - } - - public Receiver(final Session sess, final MessageConsumer cons, final int numMessages, final boolean isListener) throws Exception - { - super(sess, numMessages); - this.cons = cons; - this.isListener = isListener; - if (this.isListener) - { - cons.setMessageListener(this); - } - } - - private boolean done; - - public void onMessage(final Message m) - { - try - { - synchronized (lock1) - { - theMessage = m; - - lock1.notify(); - } - - // Wait for message to be processed - synchronized (lock2) - { - while (!done && !finished) - { - lock2.wait(); - } - done = false; - } - - } - catch (Exception e) - { - Receiver.log.error("Failed to put in channel", e); - setFailed(true); - } - } - - protected void finished() - { - synchronized (lock2) - { - finished = true; - lock2.notify(); - } - } - - protected Message getMessage() throws Exception - { - Message m; - - if (isListener) - { - synchronized (lock1) - { - long start = System.currentTimeMillis(); - long waitTime = Receiver.RECEIVE_TIMEOUT; - while (theMessage == null && waitTime >= 0) - { - lock1.wait(waitTime); - - waitTime = Receiver.RECEIVE_TIMEOUT - (System.currentTimeMillis() - start); - } - m = theMessage; - theMessage = null; - } - } - else - { - m = cons.receive(Receiver.RECEIVE_TIMEOUT); - } - - return m; - } - - protected void processingDone() - { - if (isListener) - { - synchronized (lock2) - { - done = true; - lock2.notify(); - } - } - } - - @Override - public void run() - { - - // Small pause so as not to miss any messages in a topic - try - { - Thread.sleep(1000); - } - catch (InterruptedException e) - { - } - - try - { - String prodName = null; - Integer msgCount = null; - - while (count < numMessages) - { - Message m = getMessage(); - - if (m == null) - { - Receiver.log.error("Message is null"); - setFailed(true); - processingDone(); - return; - } - - prodName = m.getStringProperty("PROD_NAME"); - msgCount = new Integer(m.getIntProperty("MSG_NUMBER")); - - // log.info(this + " Got message " + prodName + ":" + msgCount + "M: " + m.getJMSMessageID()); - - Integer prevCount = (Integer)counts.get(prodName); - if (prevCount == null) - { - if (msgCount.intValue() != 0) - { - Receiver.log.error("First message received not zero"); - setFailed(true); - processingDone(); - return; - } - } - else - { - if (prevCount.intValue() != msgCount.intValue() - 1) - { - Receiver.log.error("Message out of sequence for " + prodName + - ", expected:" + - (prevCount.intValue() + 1) + - " got " + - msgCount); - setFailed(true); - processingDone(); - return; - } - } - counts.put(prodName, msgCount); - - count++; - - processingDone(); - } - - } - catch (Exception e) - { - Receiver.log.error("Failed to receive message", e); - setFailed(true); - } - finally - { - if (cc != null) - { - try - { - cc.close(); - } - catch (JMSException e) - { - Receiver.log.error("Failed to close connection consumer", e); - } - } - } - } - - static final class MockServerSessionPool implements ServerSessionPool - { - private final ServerSession serverSession; - - MockServerSessionPool(final Session sess) - { - serverSession = new MockServerSession(sess); - } - - public ServerSession getServerSession() throws JMSException - { - return serverSession; - } - } - - static final class MockServerSession implements ServerSession - { - Session session; - - MockServerSession(final Session sess) - { - session = sess; - } - - public Session getSession() throws JMSException - { - return session; - } - - public void start() throws JMSException - { - session.run(); - } - - } - -} diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/RecoveringReceiver.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/RecoveringReceiver.java deleted file mode 100644 index eb2e4ea050..0000000000 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/RecoveringReceiver.java +++ /dev/null @@ -1,195 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.jms.tests.stress; - -import org.apache.activemq.jms.tests.JmsTestLogger; - -import javax.jms.Message; -import javax.jms.MessageConsumer; -import javax.jms.Session; - -/** - * - * A RecoveringReceiver. - * - * A Receiver that receives messages from a destination and alternately - * acknowledges and recovers the session. - * Must be used with ack mode CLIENT_ACKNOWLEDGE - * - * - * @author Tim Fox - * - */ -public class RecoveringReceiver extends Receiver -{ - private static final JmsTestLogger log = JmsTestLogger.LOGGER; - - protected int ackSize; - - protected int recoverSize; - - class Count - { - int lastAcked; - - int lastReceived; - } - - public RecoveringReceiver(final Session sess, - final MessageConsumer cons, - final int numMessages, - final int ackSize, - final int recoverSize, - final boolean isListener) throws Exception - { - super(sess, cons, numMessages, isListener); - this.ackSize = ackSize; - this.recoverSize = recoverSize; - } - - @Override - public void run() - { - // Small pause so as not to miss any messages in a topic - try - { - Thread.sleep(1000); - } - catch (InterruptedException e) - { - } - - try - { - int iterations = numMessages / ackSize; - - for (int outerCount = 0; outerCount < iterations; outerCount++) - { - Message m = null; - for (int innerCount = 0; innerCount < ackSize; innerCount++) - { - m = getMessage(); - - if (m == null) - { - RecoveringReceiver.log.error("Message is null"); - setFailed(true); - return; - } - String prodName = m.getStringProperty("PROD_NAME"); - Integer msgCount = new Integer(m.getIntProperty("MSG_NUMBER")); - - Count count = (Count)counts.get(prodName); - if (count == null) - { - // First time - if (msgCount.intValue() != 0) - { - RecoveringReceiver.log.error("First message from " + prodName + " is not 0, it is " + msgCount); - setFailed(true); - return; - } - else - { - count = new Count(); - counts.put(prodName, count); - } - } - else - { - if (count.lastAcked != msgCount.intValue() - 1) - { - RecoveringReceiver.log.error("Message out of sequence for " + prodName + - ", expected " + - (count.lastAcked + 1)); - setFailed(true); - return; - } - } - count.lastAcked = msgCount.intValue(); - - count.lastReceived = msgCount.intValue(); - - if (innerCount == ackSize - 1) - { - m.acknowledge(); - } - processingDone(); - - } - - if (outerCount == iterations - 1) - { - break; - } - - for (int innerCount = 0; innerCount < recoverSize; innerCount++) - { - m = getMessage(); - - if (m == null) - { - RecoveringReceiver.log.error("Message is null"); - return; - } - String prodName = m.getStringProperty("PROD_NAME"); - Integer msgCount = new Integer(m.getIntProperty("MSG_NUMBER")); - - Count count = (Count)counts.get(prodName); - if (count == null) - { - // First time - if (msgCount.intValue() != 0) - { - RecoveringReceiver.log.error("First message from " + prodName + " is not 0, it is " + msgCount); - setFailed(true); - return; - } - else - { - count = new Count(); - count.lastAcked = -1; - counts.put(prodName, count); - } - } - else - { - if (count.lastReceived != msgCount.intValue() - 1) - { - RecoveringReceiver.log.error("Message out of sequence"); - setFailed(true); - return; - } - } - count.lastReceived = msgCount.intValue(); - - if (innerCount == recoverSize - 1) - { - sess.recover(); - } - processingDone(); - } - } - } - catch (Exception e) - { - RecoveringReceiver.log.error("Failed to receive message", e); - setFailed(true); - } - } - -} diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/RelayStressTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/RelayStressTest.java deleted file mode 100644 index 04cd83030c..0000000000 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/RelayStressTest.java +++ /dev/null @@ -1,256 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.jms.tests.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.apache.activemq.jms.tests.ActiveMQServerTestCase; -import org.apache.activemq.jms.tests.JmsTestLogger; -import org.apache.activemq.jms.tests.util.ProxyAssertSupport; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * 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. - * - * @author Tim Fox - * - * - */ -public class RelayStressTest extends ActiveMQServerTestCase -{ - @BeforeClass - public static void stressTestsEnabled() - { - org.junit.Assume.assumeTrue(JMSStressTestBase.STRESS_TESTS_ENABLED); - } - - // Constants ----------------------------------------------------- - - private static JmsTestLogger log = JmsTestLogger.LOGGER; - - // Static -------------------------------------------------------- - - // Attributes ---------------------------------------------------- - - private InitialContext ic; - - // Constructors -------------------------------------------------- - - // Public -------------------------------------------------------- - - @Override - @Before - public void setUp() throws Exception - { - super.setUp(); - - // ServerManagement.start("all"); - ic = getInitialContext(); - createTopic("StressTestTopic"); - - RelayStressTest.log.debug("setup done"); - } - - @Override - @After - public void tearDown() throws Exception - { - destroyTopic("StressTestTopic"); - ic.close(); - } - - @Test - public void testRelay() throws Exception - { - ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory"); - - Topic topic = (Topic)ic.lookup("/topic/StressTestTopic"); - - final int numMessages = 20000; - - final int numRelayers = 5; - - final int numConsumers = 20; - - Connection conn = cf.createConnection(); - - class Relayer implements MessageListener - { - boolean done; - - boolean failed; - - int count; - - MessageProducer prod; - - Relayer(final MessageProducer prod) - { - this.prod = prod; - } - - public void onMessage(final Message m) - { - try - { - m.clearProperties(); - m.setStringProperty("name", "Tim"); - - prod.send(m); - - count++; - - if (count == numMessages) - { - synchronized (this) - { - done = true; - notify(); - } - } - } - catch (JMSException e) - { - e.printStackTrace(); - synchronized (this) - { - done = true; - failed = true; - notify(); - } - } - } - } - - class Consumer implements MessageListener - { - boolean failed; - - boolean done; - - int count; - - public void onMessage(final Message m) - { - count++; - - if (count == numMessages * numRelayers) - { - synchronized (this) - { - done = true; - notify(); - } - } - } - } - - Relayer[] relayers = new Relayer[numRelayers]; - - Consumer[] consumers = new Consumer[numConsumers]; - - for (int i = 0; i < numRelayers; i++) - { - Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); - - MessageConsumer cons = sess.createConsumer(topic, "name = 'Watt'"); - // MessageConsumer cons = sess.createConsumer(topic); - - MessageProducer prod = sess.createProducer(topic); - - relayers[i] = new Relayer(prod); - - cons.setMessageListener(relayers[i]); - } - - for (int i = 0; i < numConsumers; i++) - { - Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); - - MessageConsumer cons = sess.createConsumer(topic, "name = 'Tim'"); - - consumers[i] = new Consumer(); - - cons.setMessageListener(consumers[i]); - } - - conn.start(); - - Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); - - MessageProducer prod = sess.createProducer(topic); - - prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT); - - for (int i = 0; i < numMessages; i++) - { - Message m = sess.createMessage(); - - m.setStringProperty("name", "Watt"); - - prod.send(m); - } - - for (int i = 0; i < numRelayers; i++) - { - synchronized (relayers[i]) - { - if (!relayers[i].done) - { - relayers[i].wait(); - } - } - } - - for (int i = 0; i < numConsumers; i++) - { - synchronized (consumers[i]) - { - if (!consumers[i].done) - { - consumers[i].wait(); - } - } - } - - conn.close(); - - for (int i = 0; i < numRelayers; i++) - { - ProxyAssertSupport.assertFalse(relayers[i].failed); - } - - for (int i = 0; i < numConsumers; i++) - { - ProxyAssertSupport.assertFalse(consumers[i].failed); - } - - } -} diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/Runner.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/Runner.java deleted file mode 100644 index d5aab5e900..0000000000 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/Runner.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.jms.tests.stress; - -import org.apache.activemq.jms.tests.JmsTestLogger; - -import javax.jms.Session; - -/** - * - * A Runner. - * - * Base class for running components of a stress test - * - * @author Tim Fox - * - */ -public abstract class Runner implements Runnable -{ - protected JmsTestLogger log = JmsTestLogger.LOGGER; - - protected Session sess; - - protected int numMessages; - - private boolean failed; - - public Runner(final Session sess, final int numMessages) - { - this.sess = sess; - this.numMessages = numMessages; - } - - public abstract void run(); - - public boolean isFailed() - { - return failed; - } - - public void setFailed(final boolean failed) - { - this.failed = failed; - if (failed) - { - log.info("Marking Runner " + this + " as failed", new Exception("trace")); - } - } - -} diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/Sender.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/Sender.java deleted file mode 100644 index f57a375ce0..0000000000 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/Sender.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.jms.tests.stress; - -import org.apache.activemq.jms.tests.JmsTestLogger; - -import javax.jms.Message; -import javax.jms.MessageProducer; -import javax.jms.Session; - -/** - * - * A Sender. - * - * Sends messages to a destination, used in stress testing - * - * @author Tim Fox - * - */ -public class Sender extends Runner -{ - private static final JmsTestLogger log = JmsTestLogger.LOGGER; - - protected MessageProducer prod; - - protected String prodName; - - protected int count; - - public Sender(final String prodName, final Session sess, final MessageProducer prod, final int numMessages) - { - super(sess, numMessages); - this.prod = prod; - this.prodName = prodName; - } - - @Override - public void run() - { - try - { - while (count < numMessages) - { - Message m = sess.createMessage(); - m.setStringProperty("PROD_NAME", prodName); - m.setIntProperty("MSG_NUMBER", count); - prod.send(m); - count++; - } - } - catch (Exception e) - { - Sender.log.error("Failed to send message", e); - setFailed(true); - } - } - -} diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/SeveralClientsStressTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/SeveralClientsStressTest.java deleted file mode 100644 index 72b33b3ddd..0000000000 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/SeveralClientsStressTest.java +++ /dev/null @@ -1,547 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.jms.tests.stress; -import java.util.HashSet; -import java.util.Random; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; - -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 org.apache.activemq.jms.tests.ActiveMQServerTestCase; -import org.apache.activemq.jms.tests.JmsTestLogger; -import org.apache.activemq.jms.tests.util.ProxyAssertSupport; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * 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 - * - * It's required to re-login after this change. - * - * For Windows you need also to increase this limit (max opened files) somehow. - * - * -Example of /etc/security/limits.confg: -# -clebert hard nofile 10240 - - - * @author Clebert Suconic - */ -public class SeveralClientsStressTest extends ActiveMQServerTestCase -{ - @BeforeClass - public static void stressTestsEnabled() - { - org.junit.Assume.assumeTrue(JMSStressTestBase.STRESS_TESTS_ENABLED); - } - - protected boolean info = false; - - protected boolean startServer = true; - - // Static --------------------------------------------------------------------------------------- - - protected static long PRODUCER_ALIVE_FOR = 60000; // one minute - - protected static long CONSUMER_ALIVE_FOR = 60000; // one minutes - - protected static long TEST_ALIVE_FOR = 5 * 60 * 1000; // 5 minutes - - protected static int NUMBER_OF_PRODUCERS = 100; // this should be set to 300 later - - protected static int NUMBER_OF_CONSUMERS = 100; // this should be set to 300 later - - // a producer should have a long wait between each message sent? - protected static boolean LONG_WAIT_ON_PRODUCERS = false; - - protected static AtomicInteger producedMessages = new AtomicInteger(0); - - protected static AtomicInteger readMessages = new AtomicInteger(0); - - protected Context createContext() throws Exception - { - return getInitialContext(); - } - - // Constructors --------------------------------------------------------------------------------- - - // Public --------------------------------------------------------------------------------------- - - @Test - public void testQueue() throws Exception - { - Context ctx = createContext(); - - HashSet threads = new HashSet(); - - // A chhanel of communication between workers and the test method - LinkedBlockingQueue testChannel = new LinkedBlockingQueue(); - - for (int i = 0; i < SeveralClientsStressTest.NUMBER_OF_PRODUCERS; i++) - { - threads.add(new SeveralClientsStressTest.Producer(i, testChannel)); - } - - for (int i = 0; i < SeveralClientsStressTest.NUMBER_OF_CONSUMERS; i++) - { - threads.add(new SeveralClientsStressTest.Consumer(i, testChannel)); - } - - for (Worker worker : threads) - { - worker.start(); - } - - long timeToFinish = System.currentTimeMillis() + SeveralClientsStressTest.TEST_ALIVE_FOR; - - int numberOfProducers = SeveralClientsStressTest.NUMBER_OF_PRODUCERS; - int numberOfConsumers = SeveralClientsStressTest.NUMBER_OF_CONSUMERS; - - while (threads.size() > 0) - { - SeveralClientsStressTest.InternalMessage msg = testChannel.poll(2000, - TimeUnit.MILLISECONDS); - - log.info("Produced:" + SeveralClientsStressTest.producedMessages.get() + - " and Consumed:" + - SeveralClientsStressTest.readMessages.get() + - " messages"); - - if (msg != null) - { - if (info) - { - log.info("Received message " + msg); - } - if (msg instanceof SeveralClientsStressTest.WorkerFailed) - { - ProxyAssertSupport.fail("Worker " + msg.getWorker() + " has failed"); - } - else if (msg instanceof SeveralClientsStressTest.WorkedFinishedMessages) - { - SeveralClientsStressTest.WorkedFinishedMessages finished = (SeveralClientsStressTest.WorkedFinishedMessages)msg; - if (threads.remove(finished.getWorker())) - { - if (System.currentTimeMillis() < timeToFinish) - { - if (finished.getWorker() instanceof SeveralClientsStressTest.Producer) - { - if (info) - { - log.info("Scheduling new Producer " + numberOfProducers); - } - SeveralClientsStressTest.Producer producer = new SeveralClientsStressTest.Producer(numberOfProducers++, - testChannel); - threads.add(producer); - producer.start(); - } - else if (finished.getWorker() instanceof SeveralClientsStressTest.Consumer) - { - if (info) - { - log.info("Scheduling new ClientConsumer " + numberOfConsumers); - } - SeveralClientsStressTest.Consumer consumer = new SeveralClientsStressTest.Consumer(numberOfConsumers++, - testChannel); - threads.add(consumer); - consumer.start(); - } - } - } - else - { - log.warn(finished.getWorker() + " was not available on threads HashSet"); - } - } - } - } - - log.info("Produced:" + SeveralClientsStressTest.producedMessages.get() + - " and Consumed:" + - SeveralClientsStressTest.readMessages.get() + - " messages"); - - clearMessages(); - - log.info("Produced:" + SeveralClientsStressTest.producedMessages.get() + - " and Consumed:" + - SeveralClientsStressTest.readMessages.get() + - " messages"); - - ProxyAssertSupport.assertEquals(SeveralClientsStressTest.producedMessages.get(), - SeveralClientsStressTest.readMessages.get()); - } - - // Package protected ---------------------------------------------------------------------------- - - // Protected ------------------------------------------------------------------------------------ - - protected void clearMessages() throws Exception - { - Context ctx = createContext(); - ConnectionFactory cf = (ConnectionFactory)ctx.lookup("/ClusteredConnectionFactory"); - Connection conn = cf.createConnection(); - Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); - Queue queue = (Queue)ctx.lookup("queue/testQueue"); - MessageConsumer consumer = sess.createConsumer(queue); - - conn.start(); - - while (consumer.receive(1000) != null) - { - SeveralClientsStressTest.readMessages.incrementAndGet(); - log.info("Received JMS message on clearMessages"); - } - - conn.close(); - } - - @Override - @Before - public void setUp() throws Exception - { - super.setUp(); - - if (startServer) - { - // ServerManagement.start("all", true); - createQueue("testQueue"); - } - - clearMessages(); - SeveralClientsStressTest.producedMessages = new AtomicInteger(0); - SeveralClientsStressTest.readMessages = new AtomicInteger(0); - } - - // Private -------------------------------------------------------------------------------------- - - // Inner classes -------------------------------------------------------------------------------- - - private class Worker extends Thread - { - - protected JmsTestLogger log = JmsTestLogger.LOGGER; - - private boolean failed = false; - - private final int workerId; - - private Exception ex; - - LinkedBlockingQueue messageQueue; - - public int getWorkerId() - { - return workerId; - } - - public Exception getException() - { - return ex; - } - - public boolean isFailed() - { - return failed; - } - - protected synchronized void setFailed(final boolean failed, final Exception ex) - { - this.failed = failed; - this.ex = ex; - - log.info("Sending Exception", ex); - - sendInternalMessage(new SeveralClientsStressTest.WorkerFailed(this)); - - } - - protected void sendInternalMessage(final SeveralClientsStressTest.InternalMessage msg) - { - if (info) - { - log.info("Sending message " + msg); - } - try - { - messageQueue.put(msg); - } - catch (Exception e) - { - log.error(e, e); - setFailed(true, e); - } - } - - public Worker(final String name, final int workerId, - final LinkedBlockingQueue messageQueue) - { - super(name); - this.workerId = workerId; - this.messageQueue = messageQueue; - setDaemon(true); - } - - @Override - public String toString() - { - return this.getClass().getName() + ":" + getWorkerId(); - } - } - - final class Producer extends SeveralClientsStressTest.Worker - { - public Producer(final int producerId, - final LinkedBlockingQueue messageQueue) - { - super("Producer:" + producerId, producerId, messageQueue); - } - - Random random = new Random(); - - @Override - public void run() - { - try - { - Context ctx = createContext(); - - ConnectionFactory cf = (ConnectionFactory)ctx.lookup("/ClusteredConnectionFactory"); - - Queue queue = (Queue)ctx.lookup("queue/testQueue"); - - if (info) - { - log.info("Creating connection and producer"); - } - Connection conn = cf.createConnection(); - Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); - MessageProducer prod = sess.createProducer(queue); - - if (getWorkerId() % 2 == 0) - { - if (info) - { - log.info("Non Persistent Producer was created"); - } - prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT); - } - else - { - if (info) - { - log.info("Persistent Producer was created"); - } - prod.setDeliveryMode(DeliveryMode.PERSISTENT); - } - - long timeToFinish = System.currentTimeMillis() + SeveralClientsStressTest.PRODUCER_ALIVE_FOR; - - try - { - int messageSent = 0; - while (System.currentTimeMillis() < timeToFinish) - { - prod.send(sess.createTextMessage("Message sent at " + System.currentTimeMillis())); - SeveralClientsStressTest.producedMessages.incrementAndGet(); - messageSent++; - if (messageSent % 50 == 0) - { - if (info) - { - log.info("Sent " + messageSent + " Messages"); - } - } - - if (SeveralClientsStressTest.LONG_WAIT_ON_PRODUCERS) - { - int waitTime = random.nextInt() % 2 + 1; - if (waitTime < 0) - { - waitTime *= -1; - } - Thread.sleep(waitTime * 1000); // wait 1 or 2 seconds - } - else - { - Thread.sleep(100); - } - } - sendInternalMessage(new SeveralClientsStressTest.WorkedFinishedMessages(this)); - } - finally - { - conn.close(); - } - - } - catch (Exception e) - { - log.error(e, e); - setFailed(true, e); - } - } - } - - final class Consumer extends SeveralClientsStressTest.Worker - { - public Consumer(final int consumerId, - final LinkedBlockingQueue messageQueue) - { - super("ClientConsumer:" + consumerId, consumerId, messageQueue); - } - - @Override - public void run() - { - try - { - Context ctx = createContext(); - - ConnectionFactory cf = (ConnectionFactory)ctx.lookup("/ClusteredConnectionFactory"); - - Queue queue = (Queue)ctx.lookup("queue/testQueue"); - - if (info) - { - log.info("Creating connection and consumer"); - } - Connection conn = cf.createConnection(); - Session sess = conn.createSession(true, Session.SESSION_TRANSACTED); - MessageConsumer consumer = sess.createConsumer(queue); - if (info) - { - log.info("ClientConsumer was created"); - } - - conn.start(); - - int msgs = 0; - - int transactions = 0; - - long timeToFinish = System.currentTimeMillis() + SeveralClientsStressTest.CONSUMER_ALIVE_FOR; - - try - { - while (System.currentTimeMillis() < timeToFinish) - { - Message msg = consumer.receive(1000); - if (msg != null) - { - msgs++; - if (msgs >= 50) - { - transactions++; - if (transactions % 2 == 0) - { - if (info) - { - log.info("Commit transaction"); - } - sess.commit(); - SeveralClientsStressTest.readMessages.addAndGet(msgs); - } - else - { - if (info) - { - log.info("Rollback transaction"); - } - sess.rollback(); - } - msgs = 0; - } - } - else - { - break; - } - } - - SeveralClientsStressTest.readMessages.addAndGet(msgs); - sess.commit(); - - sendInternalMessage(new SeveralClientsStressTest.WorkedFinishedMessages(this)); - } - finally - { - conn.close(); - } - - } - catch (Exception e) - { - log.error(e); - setFailed(true, e); - } - } - } - - // Objects used on the communication between Workers and the test - static class InternalMessage - { - SeveralClientsStressTest.Worker worker; - - public InternalMessage(final SeveralClientsStressTest.Worker worker) - { - this.worker = worker; - } - - public SeveralClientsStressTest.Worker getWorker() - { - return worker; - } - - @Override - public String toString() - { - return this.getClass().getName() + " worker-> " + worker.toString(); - } - } - - static class WorkedFinishedMessages extends SeveralClientsStressTest.InternalMessage - { - - public WorkedFinishedMessages(final SeveralClientsStressTest.Worker worker) - { - super(worker); - } - - } - - static class WorkerFailed extends SeveralClientsStressTest.InternalMessage - { - public WorkerFailed(final SeveralClientsStressTest.Worker worker) - { - super(worker); - } - } - -} diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/TopicStressTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/TopicStressTest.java deleted file mode 100644 index f81099e12f..0000000000 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/TopicStressTest.java +++ /dev/null @@ -1,297 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.jms.tests.stress; - -import javax.jms.Connection; -import javax.jms.DeliveryMode; -import javax.jms.MessageConsumer; -import javax.jms.MessageProducer; -import javax.jms.Session; -import javax.jms.XAConnection; -import javax.jms.XASession; - -import org.junit.Test; - -/** - * A TopicStressTest. - * - * @author Tim Fox - * @version $Revision: 2349 $ - */ -public class TopicStressTest extends JMSStressTestBase -{ - /* - * Stress a topic with with many non transactional, transactional and 2pc receivers. - * Non transactional receivers use ack modes of auto, dups and client ack. - * Client ack receivers go through a cycle of receiving a batch, acking and recovering - * Transactional receivers go through a cycle of receiving committing and rolling back. - * Half the consumers are durable and half non durable. - * - */ - @Test - public void testTopicMultipleReceivers() throws Exception - { - Connection conn1 = cf.createConnection(); - - Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - Session sess2 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); - - MessageProducer prod1 = sess1.createProducer(topic1); - prod1.setDeliveryMode(DeliveryMode.NON_PERSISTENT); - - MessageProducer prod2 = sess2.createProducer(topic1); - prod2.setDeliveryMode(DeliveryMode.PERSISTENT); - - Connection conn2 = cf.createConnection(); - conn2.setClientID("clientid1"); - conn2.start(); - - // 4 auto ack - Session rsess1 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE); - Session rsess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE); - Session rsess3 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE); - Session rsess4 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE); - - // 4 dups - Session rsess5 = conn2.createSession(false, Session.DUPS_OK_ACKNOWLEDGE); - Session rsess6 = conn2.createSession(false, Session.DUPS_OK_ACKNOWLEDGE); - Session rsess7 = conn2.createSession(false, Session.DUPS_OK_ACKNOWLEDGE); - Session rsess8 = conn2.createSession(false, Session.DUPS_OK_ACKNOWLEDGE); - - // 4 client - Session rsess9 = conn2.createSession(false, Session.CLIENT_ACKNOWLEDGE); - Session rsess10 = conn2.createSession(false, Session.CLIENT_ACKNOWLEDGE); - Session rsess11 = conn2.createSession(false, Session.CLIENT_ACKNOWLEDGE); - Session rsess12 = conn2.createSession(false, Session.CLIENT_ACKNOWLEDGE); - - // 4 transactional - Session rsess13 = conn2.createSession(true, Session.SESSION_TRANSACTED); - Session rsess14 = conn2.createSession(true, Session.SESSION_TRANSACTED); - Session rsess15 = conn2.createSession(true, Session.SESSION_TRANSACTED); - Session rsess16 = conn2.createSession(true, Session.SESSION_TRANSACTED); - - // 4 2pc transactional - XASession rxaSess1 = ((XAConnection) conn2).createXASession(); - tweakXASession(rxaSess1); - XASession rxaSess2 = ((XAConnection) conn2).createXASession(); - tweakXASession(rxaSess2); - XASession rxaSess3 = ((XAConnection) conn2).createXASession(); - tweakXASession(rxaSess3); - XASession rxaSess4 = ((XAConnection) conn2).createXASession(); - tweakXASession(rxaSess4); - - Session rsess17 = rxaSess1.getSession(); - Session rsess18 = rxaSess2.getSession(); - Session rsess19 = rxaSess3.getSession(); - Session rsess20 = rxaSess4.getSession(); - - MessageConsumer cons1 = rsess1.createConsumer(topic1); - MessageConsumer cons2 = rsess2.createDurableSubscriber(topic1, "sub1"); - MessageConsumer cons3 = rsess3.createConsumer(topic1); - MessageConsumer cons4 = rsess4.createDurableSubscriber(topic1, "sub2"); - MessageConsumer cons5 = rsess5.createConsumer(topic1); - MessageConsumer cons6 = rsess6.createDurableSubscriber(topic1, "sub3"); - MessageConsumer cons7 = rsess7.createConsumer(topic1); - MessageConsumer cons8 = rsess8.createDurableSubscriber(topic1, "sub4"); - MessageConsumer cons9 = rsess9.createConsumer(topic1); - MessageConsumer cons10 = rsess10.createDurableSubscriber(topic1, "sub5"); - MessageConsumer cons11 = rsess11.createConsumer(topic1); - MessageConsumer cons12 = rsess12.createDurableSubscriber(topic1, "sub6"); - MessageConsumer cons13 = rsess13.createConsumer(topic1); - MessageConsumer cons14 = rsess14.createDurableSubscriber(topic1, "sub7"); - MessageConsumer cons15 = rsess15.createConsumer(topic1); - MessageConsumer cons16 = rsess16.createDurableSubscriber(topic1, "sub8"); - MessageConsumer cons17 = rsess17.createConsumer(topic1); - MessageConsumer cons18 = rsess18.createDurableSubscriber(topic1, "sub9"); - MessageConsumer cons19 = rsess19.createConsumer(topic1); - MessageConsumer cons20 = rsess20.createDurableSubscriber(topic1, "sub10"); - - // To make sure paging occurs first send some messages before receiving - - Runner[] runners = new Runner[]{ - new Sender("prod1", sess1, prod1, JMSStressTestBase.NUM_NON_PERSISTENT_PRESEND), - new Sender("prod2", sess2, prod2, JMSStressTestBase.NUM_PERSISTENT_PRESEND)}; - - runRunners(runners); - - runners = new Runner[]{ - // 4 auto ack - new Receiver(rsess1, - cons1, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES + JMSStressTestBase.NUM_PERSISTENT_MESSAGES + - JMSStressTestBase.NUM_NON_PERSISTENT_PRESEND + - JMSStressTestBase.NUM_PERSISTENT_PRESEND, - false), - new Receiver(rsess2, - cons2, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES + JMSStressTestBase.NUM_PERSISTENT_MESSAGES + - JMSStressTestBase.NUM_NON_PERSISTENT_PRESEND + - JMSStressTestBase.NUM_PERSISTENT_PRESEND, - true), - new Receiver(rsess3, - cons3, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES + JMSStressTestBase.NUM_PERSISTENT_MESSAGES + - JMSStressTestBase.NUM_NON_PERSISTENT_PRESEND + - JMSStressTestBase.NUM_PERSISTENT_PRESEND, - false), - new Receiver(rsess4, - cons4, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES + JMSStressTestBase.NUM_PERSISTENT_MESSAGES + - JMSStressTestBase.NUM_NON_PERSISTENT_PRESEND + - JMSStressTestBase.NUM_PERSISTENT_PRESEND, - true), - - // 4 dups ok - new Receiver(rsess5, - cons5, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES + JMSStressTestBase.NUM_PERSISTENT_MESSAGES + - JMSStressTestBase.NUM_NON_PERSISTENT_PRESEND + - JMSStressTestBase.NUM_PERSISTENT_PRESEND, - false), - new Receiver(rsess6, - cons6, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES + JMSStressTestBase.NUM_PERSISTENT_MESSAGES + - JMSStressTestBase.NUM_NON_PERSISTENT_PRESEND + - JMSStressTestBase.NUM_PERSISTENT_PRESEND, - true), - new Receiver(rsess7, - cons7, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES + JMSStressTestBase.NUM_PERSISTENT_MESSAGES + - JMSStressTestBase.NUM_NON_PERSISTENT_PRESEND + - JMSStressTestBase.NUM_PERSISTENT_PRESEND, - false), - new Receiver(rsess8, - cons8, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES + JMSStressTestBase.NUM_PERSISTENT_MESSAGES + - JMSStressTestBase.NUM_NON_PERSISTENT_PRESEND + - JMSStressTestBase.NUM_PERSISTENT_PRESEND, - true), - - // 4 client ack - new RecoveringReceiver(rsess9, - cons9, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES + JMSStressTestBase.NUM_PERSISTENT_MESSAGES + - JMSStressTestBase.NUM_NON_PERSISTENT_PRESEND + - JMSStressTestBase.NUM_PERSISTENT_PRESEND, - 1, - 1, - false), - new RecoveringReceiver(rsess10, - cons10, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES + JMSStressTestBase.NUM_PERSISTENT_MESSAGES + - JMSStressTestBase.NUM_NON_PERSISTENT_PRESEND + - JMSStressTestBase.NUM_PERSISTENT_PRESEND, - 10, - 7, - true), - new RecoveringReceiver(rsess11, - cons11, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES + JMSStressTestBase.NUM_PERSISTENT_MESSAGES + - JMSStressTestBase.NUM_NON_PERSISTENT_PRESEND + - JMSStressTestBase.NUM_PERSISTENT_PRESEND, - 50, - 21, - false), - new RecoveringReceiver(rsess12, - cons12, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES + JMSStressTestBase.NUM_PERSISTENT_MESSAGES + - JMSStressTestBase.NUM_NON_PERSISTENT_PRESEND + - JMSStressTestBase.NUM_PERSISTENT_PRESEND, - 100, - 67, - true), - - // 4 transactional - - new TransactionalReceiver(rsess13, - cons13, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES + JMSStressTestBase.NUM_PERSISTENT_MESSAGES + - JMSStressTestBase.NUM_NON_PERSISTENT_PRESEND + - JMSStressTestBase.NUM_PERSISTENT_PRESEND, - 1, - 1, - false), - new TransactionalReceiver(rsess14, - cons14, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES + JMSStressTestBase.NUM_PERSISTENT_MESSAGES + - JMSStressTestBase.NUM_NON_PERSISTENT_PRESEND + - JMSStressTestBase.NUM_PERSISTENT_PRESEND, - 10, - 7, - true), - new TransactionalReceiver(rsess15, - cons15, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES + JMSStressTestBase.NUM_PERSISTENT_MESSAGES + - JMSStressTestBase.NUM_NON_PERSISTENT_PRESEND + - JMSStressTestBase.NUM_PERSISTENT_PRESEND, - 50, - 21, - false), - new TransactionalReceiver(rsess16, - cons16, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES + JMSStressTestBase.NUM_PERSISTENT_MESSAGES + - JMSStressTestBase.NUM_NON_PERSISTENT_PRESEND + - JMSStressTestBase.NUM_PERSISTENT_PRESEND, - 100, - 67, - true), - - // 4 2pc transactional - new Transactional2PCReceiver(rxaSess1, - cons17, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES + JMSStressTestBase.NUM_PERSISTENT_MESSAGES + - JMSStressTestBase.NUM_NON_PERSISTENT_PRESEND + - JMSStressTestBase.NUM_PERSISTENT_PRESEND, - 1, - 1, - false), - new Transactional2PCReceiver(rxaSess2, - cons18, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES + JMSStressTestBase.NUM_PERSISTENT_MESSAGES + - JMSStressTestBase.NUM_NON_PERSISTENT_PRESEND + - JMSStressTestBase.NUM_PERSISTENT_PRESEND, - 10, - 7, - true), - new Transactional2PCReceiver(rxaSess3, - cons19, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES + JMSStressTestBase.NUM_PERSISTENT_MESSAGES + - JMSStressTestBase.NUM_NON_PERSISTENT_PRESEND + - JMSStressTestBase.NUM_PERSISTENT_PRESEND, - 50, - 21, - false), - new Transactional2PCReceiver(rxaSess4, - cons20, - JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES + JMSStressTestBase.NUM_PERSISTENT_MESSAGES + - JMSStressTestBase.NUM_NON_PERSISTENT_PRESEND + - JMSStressTestBase.NUM_PERSISTENT_PRESEND, - 100, - 67, - true), - - new Sender("prod3", sess1, prod1, JMSStressTestBase.NUM_NON_PERSISTENT_MESSAGES), - new Sender("prod4", sess2, prod2, JMSStressTestBase.NUM_PERSISTENT_MESSAGES)}; - - runRunners(runners); - - conn1.close(); - - conn2.close(); - } - -} diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/Transactional2PCReceiver.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/Transactional2PCReceiver.java deleted file mode 100644 index 31e611cd50..0000000000 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/Transactional2PCReceiver.java +++ /dev/null @@ -1,231 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.jms.tests.stress; - -import javax.jms.Message; -import javax.jms.MessageConsumer; -import javax.jms.XASession; -import javax.transaction.xa.XAResource; - -import org.apache.activemq.core.transaction.impl.XidImpl; -import org.apache.activemq.jms.tests.JmsTestLogger; -import org.apache.activemq.utils.UUIDGenerator; - -/** - * - * A receiver that receives messages in a XA transaction - * - * Receives messages then prepares, commits, then - * Receives messages then prepares, rollsback until - * a total of messages have been received (committed) - * must be a multiple of - * - * @author Tim Fox - * - */ -public class Transactional2PCReceiver extends Receiver -{ - private static final JmsTestLogger log = JmsTestLogger.LOGGER; - - protected int commitSize; - - protected int rollbackSize; - - protected XAResource xaResource; - - class Count - { - int lastCommitted; - - int lastReceived; - } - - public Transactional2PCReceiver(final XASession sess, - final MessageConsumer cons, - final int numMessages, - final int commitSize, - final int rollbackSize, - final boolean isListener) throws Exception - { - super(sess, cons, numMessages, isListener); - this.commitSize = commitSize; - this.rollbackSize = rollbackSize; - xaResource = sess.getXAResource(); - } - - @Override - public void run() - { - // Small pause so as not to miss any messages in a topic - try - { - Thread.sleep(1000); - } - catch (InterruptedException e) - { - } - - try - { - int iterations = numMessages / commitSize; - - XidImpl xid = null; - - xid = new XidImpl("bq1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes()); - xaResource.start(xid, XAResource.TMNOFLAGS); - - for (int outerCount = 0; outerCount < iterations; outerCount++) - { - - for (int innerCount = 0; innerCount < commitSize; innerCount++) - { - Message m = getMessage(); - - if (m == null) - { - Transactional2PCReceiver.log.error("Message is null"); - setFailed(true); - return; - } - String prodName = m.getStringProperty("PROD_NAME"); - Integer msgCount = new Integer(m.getIntProperty("MSG_NUMBER")); - - Count count = (Count)counts.get(prodName); - if (count == null) - { - // First time - if (msgCount.intValue() != 0) - { - Transactional2PCReceiver.log.error("First message from " + prodName + - " is not 0, it is " + - msgCount); - setFailed(true); - return; - } - else - { - count = new Count(); - counts.put(prodName, count); - } - } - else - { - if (count.lastCommitted != msgCount.intValue() - 1) - { - Transactional2PCReceiver.log.error("Message out of sequence for " + prodName + - ", expected " + - (count.lastCommitted + 1) + - ", actual " + - msgCount); - setFailed(true); - return; - } - } - count.lastCommitted = msgCount.intValue(); - - count.lastReceived = msgCount.intValue(); - - if (innerCount == commitSize - 1) - { - xaResource.end(xid, XAResource.TMSUCCESS); - xaResource.prepare(xid); - xaResource.commit(xid, false); - - // Starting new tx - xid = new XidImpl("bq1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes()); - xaResource.start(xid, XAResource.TMNOFLAGS); - - } - - processingDone(); - } - - if (outerCount == iterations - 1) - { - break; - } - - for (int innerCount = 0; innerCount < rollbackSize; innerCount++) - { - Message m = getMessage(); - - if (m == null) - { - Transactional2PCReceiver.log.error("Message is null (rollback)"); - setFailed(true); - return; - } - String prodName = m.getStringProperty("PROD_NAME"); - Integer msgCount = new Integer(m.getIntProperty("MSG_NUMBER")); - - Count count = (Count)counts.get(prodName); - if (count == null) - { - // First time - if (msgCount.intValue() != 0) - { - Transactional2PCReceiver.log.error("First message from " + prodName + - " is not 0, it is " + - msgCount); - setFailed(true); - return; - } - else - { - count = new Count(); - count.lastCommitted = -1; - counts.put(prodName, count); - } - } - else - { - if (count.lastReceived != msgCount.intValue() - 1) - { - Transactional2PCReceiver.log.error("Message out of sequence"); - setFailed(true); - return; - } - } - count.lastReceived = msgCount.intValue(); - - if (innerCount == rollbackSize - 1) - { - xaResource.end(xid, XAResource.TMSUCCESS); - xaResource.prepare(xid); - xaResource.rollback(xid); - - xid = new XidImpl("bq1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes()); - xaResource.start(xid, XAResource.TMNOFLAGS); - } - processingDone(); - } - } - - xaResource.end(xid, XAResource.TMSUCCESS); - xaResource.prepare(xid); - xaResource.commit(xid, false); - - finished(); - - } - catch (Exception e) - { - Transactional2PCReceiver.log.error("Failed to receive message", e); - setFailed(true); - } - } -} diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/Transactional2PCSender.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/Transactional2PCSender.java deleted file mode 100644 index e1e1880c7b..0000000000 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/Transactional2PCSender.java +++ /dev/null @@ -1,120 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.jms.tests.stress; - -import javax.jms.Message; -import javax.jms.MessageProducer; -import javax.jms.XASession; -import javax.transaction.xa.XAResource; - -import org.apache.activemq.core.transaction.impl.XidImpl; -import org.apache.activemq.jms.tests.JmsTestLogger; -import org.apache.activemq.utils.UUIDGenerator; - -/** - * - * A Sender that sends messages to a destination in an XA transaction - * - * Sends messages to a destination in a jms transaction. - * Sends messages then prepares, commits, then - * sends messages then prepares, rollsback until - * a total of messages have been sent (commitSize) - * must be a multiple of - * - * @author Tim Fox - * - */ -public class Transactional2PCSender extends Sender -{ - private static final JmsTestLogger log = JmsTestLogger.LOGGER; - - protected int commitSize; - - protected int rollbackSize; - - protected XAResource xaResource; - - public Transactional2PCSender(final String prodName, - final XASession sess, - final MessageProducer prod, - final int numMessages, - final int commitSize, - final int rollbackSize) - { - super(prodName, sess, prod, numMessages); - - this.commitSize = commitSize; - this.rollbackSize = rollbackSize; - xaResource = sess.getXAResource(); - } - - @Override - public void run() - { - - int iterations = numMessages / commitSize; - - try - { - for (int outerCount = 0; outerCount < iterations; outerCount++) - { - XidImpl xid = null; - if (commitSize > 0) - { - xid = new XidImpl("bq1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes()); - xaResource.start(xid, XAResource.TMNOFLAGS); - } - for (int innerCount = 0; innerCount < commitSize; innerCount++) - { - Message m = sess.createMessage(); - m.setStringProperty("PROD_NAME", prodName); - m.setIntProperty("MSG_NUMBER", outerCount * commitSize + innerCount); - prod.send(m); - } - if (commitSize > 0) - { - xaResource.end(xid, XAResource.TMSUCCESS); - xaResource.prepare(xid); - xaResource.commit(xid, false); - } - if (rollbackSize > 0) - { - xid = new XidImpl("bq1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes()); - xaResource.start(xid, XAResource.TMNOFLAGS); - } - for (int innerCount = 0; innerCount < rollbackSize; innerCount++) - { - Message m = sess.createMessage(); - m.setStringProperty("PROD_NAME", prodName); - m.setIntProperty("MSG_NUMBER", (outerCount + 1) * commitSize + innerCount); - prod.send(m); - } - if (rollbackSize > 0) - { - xaResource.end(xid, XAResource.TMSUCCESS); - xaResource.prepare(xid); - xaResource.rollback(xid); - } - } - } - catch (Exception e) - { - Transactional2PCSender.log.error("Failed to send message", e); - setFailed(true); - } - } -} diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/TransactionalReceiver.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/TransactionalReceiver.java deleted file mode 100644 index 90617c5332..0000000000 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/TransactionalReceiver.java +++ /dev/null @@ -1,200 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.jms.tests.stress; - -import org.apache.activemq.jms.tests.JmsTestLogger; - -import javax.jms.Message; -import javax.jms.MessageConsumer; -import javax.jms.Session; - -/** - * - * A Receiver that receives messages from a destination in a JMS transaction - * - * Receives messages then commits, then - * Receives messages then rollsback until - * a total of messages have been received (committed) - * must be a multiple of - * - * @author Tim Fox - * - */ -public class TransactionalReceiver extends Receiver -{ - private static final JmsTestLogger log = JmsTestLogger.LOGGER; - - protected int commitSize; - - protected int rollbackSize; - - class Count - { - int lastCommitted; - - int lastReceived; - } - - public TransactionalReceiver(final Session sess, - final MessageConsumer cons, - final int numMessages, - final int commitSize, - final int rollbackSize, - final boolean isListener) throws Exception - { - super(sess, cons, numMessages, isListener); - this.commitSize = commitSize; - this.rollbackSize = rollbackSize; - } - - @Override - public void run() - { - // Small pause so as not to miss any messages in a topic - try - { - Thread.sleep(1000); - } - catch (InterruptedException e) - { - } - - try - { - int iterations = numMessages / commitSize; - - for (int outerCount = 0; outerCount < iterations; outerCount++) - { - for (int innerCount = 0; innerCount < commitSize; innerCount++) - { - Message m = getMessage(); - - if (m == null) - { - TransactionalReceiver.log.error("Message is null"); - setFailed(true); - return; - } - String prodName = m.getStringProperty("PROD_NAME"); - Integer msgCount = new Integer(m.getIntProperty("MSG_NUMBER")); - - Count count = (Count)counts.get(prodName); - if (count == null) - { - // First time - if (msgCount.intValue() != 0) - { - TransactionalReceiver.log.error("First message from " + prodName + " is not 0, it is " + msgCount); - setFailed(true); - return; - } - else - { - count = new Count(); - counts.put(prodName, count); - } - } - else - { - if (count.lastCommitted != msgCount.intValue() - 1) - { - TransactionalReceiver.log.error("Message out of sequence for " + m.getJMSMessageID() + - " " + - prodName + - ", expected " + - (count.lastCommitted + 1) + - ", actual " + - msgCount); - setFailed(true); - return; - } - } - count.lastCommitted = msgCount.intValue(); - - count.lastReceived = msgCount.intValue(); - - if (innerCount == commitSize - 1) - { - sess.commit(); - } - - processingDone(); - } - - if (outerCount == iterations - 1) - { - break; - } - - for (int innerCount = 0; innerCount < rollbackSize; innerCount++) - { - Message m = getMessage(); - - if (m == null) - { - TransactionalReceiver.log.error("Message is null"); - setFailed(true); - return; - } - String prodName = m.getStringProperty("PROD_NAME"); - Integer msgCount = new Integer(m.getIntProperty("MSG_NUMBER")); - - Count count = (Count)counts.get(prodName); - if (count == null) - { - // First time - if (msgCount.intValue() != 0) - { - TransactionalReceiver.log.error("First message from " + prodName + " is not 0, it is " + msgCount); - setFailed(true); - return; - } - else - { - count = new Count(); - count.lastCommitted = -1; - counts.put(prodName, count); - } - } - else - { - if (count.lastReceived != msgCount.intValue() - 1) - { - TransactionalReceiver.log.error("Message out of sequence"); - setFailed(true); - return; - } - } - count.lastReceived = msgCount.intValue(); - - if (innerCount == rollbackSize - 1 && outerCount != iterations - 1) - { - // Don't roll back on the very last one - sess.rollback(); - } - processingDone(); - } - } - finished(); - } - catch (Exception e) - { - TransactionalReceiver.log.error("Failed to receive message", e); - setFailed(true); - } - } -} diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/TransactionalSender.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/TransactionalSender.java deleted file mode 100644 index 4c19344d59..0000000000 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/stress/TransactionalSender.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.jms.tests.stress; - -import org.apache.activemq.jms.tests.JmsTestLogger; - -import javax.jms.Message; -import javax.jms.MessageProducer; -import javax.jms.Session; - -/** - * - * A Sender that sends messages to a destination in a JMS transaction. - * - * Sends messages to a destination in a jms transaction. - * Sends messages then commits, then - * sends messages then rollsback until - * a total of messages have been sent (commitSize) - * must be a multiple of - * - * @author Tim Fox - * - */ -public class TransactionalSender extends Sender -{ - private static final JmsTestLogger log = JmsTestLogger.LOGGER; - - protected int commitSize; - - protected int rollbackSize; - - public TransactionalSender(final String prodName, - final Session sess, - final MessageProducer prod, - final int numMessages, - final int commitSize, - final int rollbackSize) - { - super(prodName, sess, prod, numMessages); - - this.commitSize = commitSize; - this.rollbackSize = rollbackSize; - - } - - @Override - public void run() - { - int iterations = numMessages / commitSize; - - try - { - for (int outerCount = 0; outerCount < iterations; outerCount++) - { - for (int innerCount = 0; innerCount < commitSize; innerCount++) - { - Message m = sess.createMessage(); - m.setStringProperty("PROD_NAME", prodName); - m.setIntProperty("MSG_NUMBER", outerCount * commitSize + innerCount); - prod.send(m); - } - sess.commit(); - for (int innerCount = 0; innerCount < rollbackSize; innerCount++) - { - Message m = sess.createMessage(); - m.setStringProperty("PROD_NAME", prodName); - m.setIntProperty("MSG_NUMBER", (outerCount + 1) * commitSize + innerCount); - prod.send(m); - } - sess.rollback(); - } - } - catch (Exception e) - { - TransactionalSender.log.error("Failed to send message", e); - setFailed(true); - } - } -} diff --git a/tests/joram-tests/pom.xml b/tests/joram-tests/pom.xml index fac51b4448..81c0fd330a 100644 --- a/tests/joram-tests/pom.xml +++ b/tests/joram-tests/pom.xml @@ -21,7 +21,7 @@ org.apache.activemq.tests activemq-tests-pom - 6.0.0 + 6.0.1-SNAPSHOT joram-tests diff --git a/tests/performance-tests/pom.xml b/tests/performance-tests/pom.xml index 4457b83202..3e6dc27402 100644 --- a/tests/performance-tests/pom.xml +++ b/tests/performance-tests/pom.xml @@ -21,7 +21,7 @@ org.apache.activemq.tests activemq-tests-pom - 6.0.0 + 6.0.1-SNAPSHOT performance-tests diff --git a/tests/pom.xml b/tests/pom.xml index 65c02c27d7..f2db04d6c7 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -19,7 +19,7 @@ org.apache.activemq activemq-pom - 6.0.0 + 6.0.1-SNAPSHOT ActiveMQ6 Tests POM @@ -77,15 +77,9 @@ - banned-tests + extra-tests - jms-tests - integration-tests - byteman-tests - soak-tests - stress-tests - concurrent-tests - performance-tests + extra-tests @@ -94,5 +88,10 @@ unit-tests joram-tests timing-tests + jms-tests + integration-tests + soak-tests + stress-tests + performance-tests diff --git a/tests/soak-tests/pom.xml b/tests/soak-tests/pom.xml index a87cdf97a8..a789581203 100644 --- a/tests/soak-tests/pom.xml +++ b/tests/soak-tests/pom.xml @@ -21,7 +21,7 @@ org.apache.activemq.tests activemq-tests-pom - 6.0.0 + 6.0.1-SNAPSHOT soak-tests diff --git a/tests/stress-tests/pom.xml b/tests/stress-tests/pom.xml index 0cb9eedc2a..b51dbbf7fd 100644 --- a/tests/stress-tests/pom.xml +++ b/tests/stress-tests/pom.xml @@ -21,7 +21,7 @@ org.apache.activemq.tests activemq-tests-pom - 6.0.0 + 6.0.1-SNAPSHOT stress-tests diff --git a/tests/timing-tests/pom.xml b/tests/timing-tests/pom.xml index db859c378f..7a1def1729 100644 --- a/tests/timing-tests/pom.xml +++ b/tests/timing-tests/pom.xml @@ -21,7 +21,7 @@ org.apache.activemq.tests activemq-tests-pom - 6.0.0 + 6.0.1-SNAPSHOT timing-tests diff --git a/tests/concurrent-tests/src/test/java/org/apache/activemq/tests/concurrent/server/impl/QueueTest.java b/tests/timing-tests/src/test/java/org/apache/activemq/tests/timing/core/server/impl/QueueConcurrentTest.java similarity index 95% rename from tests/concurrent-tests/src/test/java/org/apache/activemq/tests/concurrent/server/impl/QueueTest.java rename to tests/timing-tests/src/test/java/org/apache/activemq/tests/timing/core/server/impl/QueueConcurrentTest.java index f0039ff0c8..740d9b8c2d 100644 --- a/tests/concurrent-tests/src/test/java/org/apache/activemq/tests/concurrent/server/impl/QueueTest.java +++ b/tests/timing-tests/src/test/java/org/apache/activemq/tests/timing/core/server/impl/QueueConcurrentTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.tests.concurrent.server.impl; +package org.apache.activemq.tests.timing.core.server.impl; import org.junit.Before; import org.junit.After; @@ -43,7 +43,7 @@ import org.apache.activemq.tests.util.UnitTestCase; * @author Tim Fox * */ -public class QueueTest extends UnitTestCase +public class QueueConcurrentTest extends UnitTestCase { private static final UnitTestLogger log = UnitTestLogger.LOGGER; @@ -114,9 +114,9 @@ public class QueueTest extends UnitTestCase assertRefListsIdenticalRefs(sender.getReferences(), consumer.getReferences()); - QueueTest.log.info("num refs: " + sender.getReferences().size()); + QueueConcurrentTest.log.info("num refs: " + sender.getReferences().size()); - QueueTest.log.info("num toggles: " + toggler.getNumToggles()); + QueueConcurrentTest.log.info("num toggles: " + toggler.getNumToggles()); } diff --git a/tests/unit-tests/pom.xml b/tests/unit-tests/pom.xml index 776929c2df..87a4fb2a09 100644 --- a/tests/unit-tests/pom.xml +++ b/tests/unit-tests/pom.xml @@ -20,7 +20,7 @@ org.apache.activemq.tests activemq-tests-pom - 6.0.0 + 6.0.1-SNAPSHOT unit-tests