Modified: incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/server/exchange/MandatoryMessageTest.java URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/server/exchange/MandatoryMessageTest.java?view=diff&rev=550849&r1=550848&r2=550849 ============================================================================== --- incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/server/exchange/MandatoryMessageTest.java (original) +++ incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/server/exchange/MandatoryMessageTest.java Tue Jun 26 09:43:58 2007 @@ -91,42 +91,6 @@ testClients.testNoExceptions(testProps); } - /** Check that an mandatory message results in no route code, not using transactions, when no consumer is connected. */ - public void test_QPID_508_MandatoryFailsNoRouteNoTxP2P() throws Exception - { - // Ensure transactional sessions are off. - testProps.setProperty(TRANSACTED_PROPNAME, false); - testProps.setProperty(PUBSUB_PROPNAME, false); - - // Set up the messaging topology so that only the publishers producer is bound (do not set up the receiver to - // collect its messages). - testProps.setProperty(RECEIVER_CONSUMER_BIND_PROPNAME, false); - - ImmediateMessageTest.PublisherReceiver testClients = - ImmediateMessageTest.PublisherReceiverImpl.connectClients(testProps); - - // Send one message and get a linked no consumers exception. - testClients.testWithAssertions(testProps, AMQNoRouteException.class); - } - - /** Check that an mandatory message results in no route code, upon transaction commit, when a consumer is connected. */ - public void test_QPID_508_MandatoryFailsNoRouteTxP2P() throws Exception - { - // Ensure transactional sessions are on. - testProps.setProperty(TRANSACTED_PROPNAME, true); - testProps.setProperty(PUBSUB_PROPNAME, false); - - // Set up the messaging topology so that only the publishers producer is bound (do not set up the receiver to - // collect its messages). - testProps.setProperty(RECEIVER_CONSUMER_BIND_PROPNAME, false); - - ImmediateMessageTest.PublisherReceiver testClients = - ImmediateMessageTest.PublisherReceiverImpl.connectClients(testProps); - - // Send one message and get a linked no consumers exception. - testClients.testWithAssertions(testProps, AMQNoRouteException.class); - } - /** * Check that a mandatory message is sent succesfully, not using transactions, when a consumer is disconnected but * the route exists. @@ -167,68 +131,68 @@ testClients.testNoExceptions(testProps); } - /** Check that an mandatory message is sent succesfully not using transactions when a consumer is connected. */ - public void test_QPID_508_MandatoryOkNoTxPubSub() throws Exception + /** Check that an mandatory message results in no route code, not using transactions, when no consumer is connected. */ + public void test_QPID_508_MandatoryFailsNoRouteNoTxP2P() throws Exception { // Ensure transactional sessions are off. testProps.setProperty(TRANSACTED_PROPNAME, false); - testProps.setProperty(PUBSUB_PROPNAME, true); + testProps.setProperty(PUBSUB_PROPNAME, false); + + // Set up the messaging topology so that only the publishers producer is bound (do not set up the receiver to + // collect its messages). + testProps.setProperty(RECEIVER_CONSUMER_BIND_PROPNAME, false); ImmediateMessageTest.PublisherReceiver testClients = ImmediateMessageTest.PublisherReceiverImpl.connectClients(testProps); - // Send one message with no errors. - testClients.testNoExceptions(testProps); + // Send one message and get a linked no consumers exception. + testClients.testWithAssertions(testProps, AMQNoRouteException.class); } - /** Check that an mandatory message is committed succesfully in a transaction when a consumer is connected. */ - public void test_QPID_508_MandatoryOkTxPubSub() throws Exception + /** Check that an mandatory message results in no route code, upon transaction commit, when a consumer is connected. */ + public void test_QPID_508_MandatoryFailsNoRouteTxP2P() throws Exception { - // Ensure transactional sessions are off. + // Ensure transactional sessions are on. testProps.setProperty(TRANSACTED_PROPNAME, true); - testProps.setProperty(PUBSUB_PROPNAME, true); + testProps.setProperty(PUBSUB_PROPNAME, false); + + // Set up the messaging topology so that only the publishers producer is bound (do not set up the receiver to + // collect its messages). + testProps.setProperty(RECEIVER_CONSUMER_BIND_PROPNAME, false); ImmediateMessageTest.PublisherReceiver testClients = ImmediateMessageTest.PublisherReceiverImpl.connectClients(testProps); - // Send one message with no errors. - testClients.testNoExceptions(testProps); + // Send one message and get a linked no consumers exception. + testClients.testWithAssertions(testProps, AMQNoRouteException.class); } - /** Check that an mandatory message results in no route code, not using transactions, when no consumer is connected. */ - public void test_QPID_508_MandatoryFailsNoRouteNoTxPubSub() throws Exception + /** Check that an mandatory message is sent succesfully not using transactions when a consumer is connected. */ + public void test_QPID_508_MandatoryOkNoTxPubSub() throws Exception { // Ensure transactional sessions are off. testProps.setProperty(TRANSACTED_PROPNAME, false); testProps.setProperty(PUBSUB_PROPNAME, true); - // Set up the messaging topology so that only the publishers producer is bound (do not set up the receiver to - // collect its messages). - testProps.setProperty(RECEIVER_CONSUMER_BIND_PROPNAME, false); - ImmediateMessageTest.PublisherReceiver testClients = ImmediateMessageTest.PublisherReceiverImpl.connectClients(testProps); - // Send one message and get a linked no consumers exception. - testClients.testWithAssertions(testProps, AMQNoRouteException.class); + // Send one message with no errors. + testClients.testNoExceptions(testProps); } - /** Check that an mandatory message results in no route code, upon transaction commit, when a consumer is connected. */ - public void test_QPID_508_MandatoryFailsNoRouteTxPubSub() throws Exception + /** Check that an mandatory message is committed succesfully in a transaction when a consumer is connected. */ + public void test_QPID_508_MandatoryOkTxPubSub() throws Exception { - // Ensure transactional sessions are on. + // Ensure transactional sessions are off. testProps.setProperty(TRANSACTED_PROPNAME, true); testProps.setProperty(PUBSUB_PROPNAME, true); - // Set up the messaging topology so that only the publishers producer is bound (do not set up the receiver to - // collect its messages). - testProps.setProperty(RECEIVER_CONSUMER_BIND_PROPNAME, false); - ImmediateMessageTest.PublisherReceiver testClients = ImmediateMessageTest.PublisherReceiverImpl.connectClients(testProps); - // Send one message and get a linked no consumers exception. - testClients.testWithAssertions(testProps, AMQNoRouteException.class); + // Send one message with no errors. + testClients.testNoExceptions(testProps); } /** @@ -241,6 +205,9 @@ testProps.setProperty(TRANSACTED_PROPNAME, false); testProps.setProperty(PUBSUB_PROPNAME, true); + // Use durable subscriptions, so that the route remains open with no subscribers. + testProps.setProperty(DURABLE_SUBSCRIPTION_PROPNAME, true); + ImmediateMessageTest.PublisherReceiver testClients = ImmediateMessageTest.PublisherReceiverImpl.connectClients(testProps); @@ -261,6 +228,9 @@ testProps.setProperty(TRANSACTED_PROPNAME, true); testProps.setProperty(PUBSUB_PROPNAME, true); + // Use durable subscriptions, so that the route remains open with no subscribers. + testProps.setProperty(DURABLE_SUBSCRIPTION_PROPNAME, true); + ImmediateMessageTest.PublisherReceiver testClients = ImmediateMessageTest.PublisherReceiverImpl.connectClients(testProps); @@ -269,6 +239,42 @@ // Send one message with no errors. testClients.testNoExceptions(testProps); + } + + /** Check that an mandatory message results in no route code, not using transactions, when no consumer is connected. */ + public void test_QPID_508_MandatoryFailsNoRouteNoTxPubSub() throws Exception + { + // Ensure transactional sessions are off. + testProps.setProperty(TRANSACTED_PROPNAME, false); + testProps.setProperty(PUBSUB_PROPNAME, true); + + // Set up the messaging topology so that only the publishers producer is bound (do not set up the receiver to + // collect its messages). + testProps.setProperty(RECEIVER_CONSUMER_BIND_PROPNAME, false); + + ImmediateMessageTest.PublisherReceiver testClients = + ImmediateMessageTest.PublisherReceiverImpl.connectClients(testProps); + + // Send one message and get a linked no consumers exception. + testClients.testWithAssertions(testProps, AMQNoRouteException.class); + } + + /** Check that an mandatory message results in no route code, upon transaction commit, when a consumer is connected. */ + public void test_QPID_508_MandatoryFailsNoRouteTxPubSub() throws Exception + { + // Ensure transactional sessions are on. + testProps.setProperty(TRANSACTED_PROPNAME, true); + testProps.setProperty(PUBSUB_PROPNAME, true); + + // Set up the messaging topology so that only the publishers producer is bound (do not set up the receiver to + // collect its messages). + testProps.setProperty(RECEIVER_CONSUMER_BIND_PROPNAME, false); + + ImmediateMessageTest.PublisherReceiver testClients = + ImmediateMessageTest.PublisherReceiverImpl.connectClients(testProps); + + // Send one message and get a linked no consumers exception. + testClients.testWithAssertions(testProps, AMQNoRouteException.class); } protected void setUp() throws Exception
Modified: incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/server/exchange/MessagingTestConfigProperties.java URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/server/exchange/MessagingTestConfigProperties.java?view=diff&rev=550849&r1=550848&r2=550849 ============================================================================== --- incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/server/exchange/MessagingTestConfigProperties.java (original) +++ incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/server/exchange/MessagingTestConfigProperties.java Tue Jun 26 09:43:58 2007 @@ -1,3 +1,23 @@ +/* + * + * 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.qpid.server.exchange; import org.apache.qpid.jms.Session; @@ -167,6 +187,12 @@ /** Defines the default message acknowledgement mode. */ public static final int ACK_MODE_DEFAULT = Session.AUTO_ACKNOWLEDGE; + /** Holds the name of the property to get the durable subscriptions flag from, when doing pub/sub messaging. */ + public static final String DURABLE_SUBSCRIPTION_PROPNAME = "durableSubscription"; + + /** Defines the default value of the durable subscriptions flag. */ + public static final boolean DURABLE_SUBSCRIPTION_DEFAULT = false; + // ====================== Qpid Options and Flags ================================ /** Holds the name of the property to set the exclusive flag from. */ @@ -272,6 +298,7 @@ defaults.setPropertyIfNull(TX_BATCH_SIZE_PROPNAME, TX_BATCH_SIZE_DEFAULT); defaults.setPropertyIfNull(DURABLE_DESTS_PROPNAME, DURABLE_DESTS_DEFAULT); defaults.setPropertyIfNull(ACK_MODE_PROPNAME, ACK_MODE_DEFAULT); + defaults.setPropertyIfNull(DURABLE_SUBSCRIPTION_PROPNAME, DURABLE_SUBSCRIPTION_DEFAULT); defaults.setPropertyIfNull(MAX_PENDING_PROPNAME, MAX_PENDING_DEFAULT); defaults.setPropertyIfNull(PREFECTH_PROPNAME, PREFETCH_DEFAULT); defaults.setPropertyIfNull(NO_LOCAL_PROPNAME, NO_LOCAL_DEFAULT);
