From 34521d12132b409638af8d867e4ecf943412b790 Mon Sep 17 00:00:00 2001 From: Aidan Skinner Date: Thu, 24 Apr 2008 01:59:13 +0000 Subject: QPID-832 nuke some obsolete stuff git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@651134 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/qpid/framing/MethodConverter_8_0.java | 125 --------- .../qpid/server/exchange/ImmediateMessageTest.java | 296 -------------------- .../qpid/server/exchange/MandatoryMessageTest.java | 308 --------------------- .../messageStore/TestableMemoryMessageStore.java | 41 --- 4 files changed, 770 deletions(-) delete mode 100644 qpid/java/common/src/main/java/org/apache/qpid/framing/MethodConverter_8_0.java delete mode 100644 qpid/java/systests/src/main/java/org/apache/qpid/server/exchange/ImmediateMessageTest.java delete mode 100644 qpid/java/systests/src/main/java/org/apache/qpid/server/exchange/MandatoryMessageTest.java delete mode 100644 qpid/java/systests/src/main/java/org/apache/qpid/server/messageStore/TestableMemoryMessageStore.java (limited to 'qpid/java') diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/MethodConverter_8_0.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/MethodConverter_8_0.java deleted file mode 100644 index 9a113f452b..0000000000 --- a/qpid/java/common/src/main/java/org/apache/qpid/framing/MethodConverter_8_0.java +++ /dev/null @@ -1,125 +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.qpid.framing; - -import org.apache.qpid.framing.abstraction.ProtocolVersionMethodConverter; -import org.apache.qpid.framing.abstraction.ContentChunk; -import org.apache.qpid.framing.abstraction.MessagePublishInfo; -import org.apache.qpid.framing.abstraction.AbstractMethodConverter; - -import org.apache.mina.common.ByteBuffer; - -public class MethodConverter_8_0 extends AbstractMethodConverter implements ProtocolVersionMethodConverter -{ - private int _basicPublishClassId; - private int _basicPublishMethodId; - - public MethodConverter_8_0() - { - super((byte)8,(byte)0); - - - } - - public AMQBody convertToBody(ContentChunk contentChunk) - { - return new ContentBody(contentChunk.getData()); - } - - public ContentChunk convertToContentChunk(AMQBody body) - { - final ContentBody contentBodyChunk = (ContentBody) body; - - return new ContentChunk() - { - - public int getSize() - { - return contentBodyChunk.getSize(); - } - - public ByteBuffer getData() - { - return contentBodyChunk.payload; - } - - public void reduceToFit() - { - contentBodyChunk.reduceBufferToFit(); - } - }; - - } - - public void configure() - { - - _basicPublishClassId = BasicPublishBody.getClazz(getProtocolMajorVersion(),getProtocolMinorVersion()); - _basicPublishMethodId = BasicPublishBody.getMethod(getProtocolMajorVersion(),getProtocolMinorVersion()); - - } - - public MessagePublishInfo convertToInfo(AMQMethodBody methodBody) - { - final BasicPublishBody body = (BasicPublishBody) methodBody; - - return new MessagePublishInfo() - { - - public AMQShortString getExchange() - { - return body.getExchange(); - } - - public boolean isImmediate() - { - return body.getImmediate(); - } - - public boolean isMandatory() - { - return body.getMandatory(); - } - - public AMQShortString getRoutingKey() - { - return body.getRoutingKey(); - } - }; - - } - - public AMQMethodBody convertToBody(MessagePublishInfo info) - { - - return new BasicPublishBody(getProtocolMajorVersion(), - getProtocolMinorVersion(), - _basicPublishClassId, - _basicPublishMethodId, - info.getExchange(), - info.isImmediate(), - info.isMandatory(), - info.getRoutingKey(), - 0) ; // ticket - - } -} diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/exchange/ImmediateMessageTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/exchange/ImmediateMessageTest.java deleted file mode 100644 index 9b5c9c3d00..0000000000 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/exchange/ImmediateMessageTest.java +++ /dev/null @@ -1,296 +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.qpid.server.exchange; - -import org.apache.qpid.test.framework.Circuit; -import org.apache.qpid.test.framework.FrameworkBaseCase; -import org.apache.qpid.test.framework.MessagingTestConfigProperties; -import static org.apache.qpid.test.framework.MessagingTestConfigProperties.*; -import org.apache.qpid.test.framework.sequencers.CircuitFactory; - -import uk.co.thebadgerset.junit.extensions.util.ParsedProperties; -import uk.co.thebadgerset.junit.extensions.util.TestContextProperties; - -/** - * ImmediateMessageTest tests for the desired behaviour of immediate messages. Immediate messages are a non-JMS - * feature. A message may be marked with an immediate delivery flag, which means that a consumer must be connected - * to receive the message, through a valid route, when it is sent, or when its transaction is committed in the case - * of transactional messaging. If this is not the case, the broker should return the message with a NO_CONSUMERS code. - * - *

- *
CRC Card
Responsibilities Collaborations - *
Check that an immediate message is sent succesfully not using transactions when a consumer is connected. - *
Check that an immediate message is committed succesfully in a transaction when a consumer is connected. - *
Check that an immediate message results in no consumers code, not using transactions, when a consumer is - * disconnected. - *
Check that an immediate message results in no consumers code, in a transaction, when a consumer is - * disconnected. - *
Check that an immediate message results in no route code, not using transactions, when no outgoing route is - * connected. - *
Check that an immediate message results in no route code, upon transaction commit, when no outgoing route is - * connected. - *
Check that an immediate message is sent succesfully not using transactions when a consumer is connected. - *
Check that an immediate message is committed succesfully in a transaction when a consumer is connected. - *
Check that an immediate message results in no consumers code, not using transactions, when a consumer is - * disconnected. - *
Check that an immediate message results in no consumers code, in a transaction, when a consumer is - * disconnected. - *
Check that an immediate message results in no route code, not using transactions, when no outgoing route is - * connected. - *
Check that an immediate message results in no route code, upon transaction commit, when no outgoing route is - * connected. - *
- * - * @todo All of these test cases will be generated by a test generator that thoroughly tests all combinations of test - * circuits. - */ -public class ImmediateMessageTest extends FrameworkBaseCase -{ - /** Used to read the tests configurable properties through. */ - ParsedProperties testProps; - - /** - * Creates a new test case with the specified name. - * - * @param name The test case name. - */ - public ImmediateMessageTest(String name) - { - super(name); - } - - /** Check that an immediate message is sent succesfully not using transactions when a consumer is connected. */ - public void test_QPID_517_ImmediateOkNoTxP2P() - { - // Ensure transactional sessions are off. - testProps.setProperty(TRANSACTED_PROPNAME, false); - testProps.setProperty(PUBSUB_PROPNAME, false); - - // Run the default test sequence over the test circuit checking for no errors. - CircuitFactory circuitFactory = getCircuitFactory(); - Circuit testCircuit = circuitFactory.createCircuit(testProps); - - assertNoFailures(testCircuit.test(1, assertionList(testCircuit.getPublisher().noExceptionsAssertion()))); - } - - /** Check that an immediate message is committed succesfully in a transaction when a consumer is connected. */ - public void test_QPID_517_ImmediateOkTxP2P() - { - // Ensure transactional sessions are off. - testProps.setProperty(TRANSACTED_PROPNAME, true); - testProps.setProperty(PUBSUB_PROPNAME, false); - - // Send one message with no errors. - CircuitFactory circuitFactory = getCircuitFactory(); - Circuit testCircuit = circuitFactory.createCircuit(testProps); - - assertNoFailures(testCircuit.test(1, assertionList(testCircuit.getPublisher().noExceptionsAssertion()))); - } - - /** Check that an immediate message results in no consumers code, not using transactions, when a consumer is disconnected. */ - public void test_QPID_517_ImmediateFailsConsumerDisconnectedNoTxP2P() - { - // Ensure transactional sessions are off. - testProps.setProperty(TRANSACTED_PROPNAME, false); - testProps.setProperty(PUBSUB_PROPNAME, false); - - // Disconnect the consumer. - testProps.setProperty(RECEIVER_CONSUMER_ACTIVE_PROPNAME, false); - - CircuitFactory circuitFactory = getCircuitFactory(); - Circuit testCircuit = circuitFactory.createCircuit(testProps); - - // Send one message and get a linked no consumers exception. - assertNoFailures(testCircuit.test(1, assertionList(testCircuit.getPublisher().noConsumersAssertion()))); - } - - /** Check that an immediate message results in no consumers code, in a transaction, when a consumer is disconnected. */ - public void test_QPID_517_ImmediateFailsConsumerDisconnectedTxP2P() - { - // Ensure transactional sessions are on. - testProps.setProperty(TRANSACTED_PROPNAME, true); - testProps.setProperty(PUBSUB_PROPNAME, false); - - // Disconnect the consumer. - testProps.setProperty(RECEIVER_CONSUMER_ACTIVE_PROPNAME, false); - - CircuitFactory circuitFactory = getCircuitFactory(); - Circuit testCircuit = circuitFactory.createCircuit(testProps); - - // Send one message and get a linked no consumers exception. - assertNoFailures(testCircuit.test(1, assertionList(testCircuit.getPublisher().noConsumersAssertion()))); - } - - /** Check that an immediate message results in no route code, not using transactions, when no outgoing route is connected. */ - public void test_QPID_517_ImmediateFailsNoRouteNoTxP2P() - { - // 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 receivers to - // collect its messages). - testProps.setProperty(RECEIVER_CONSUMER_BIND_PROPNAME, false); - - // Send one message and get a linked no route exception. - CircuitFactory circuitFactory = getCircuitFactory(); - Circuit testCircuit = circuitFactory.createCircuit(testProps); - - assertNoFailures(testCircuit.test(1, assertionList(testCircuit.getPublisher().noRouteAssertion()))); - } - - /** Check that an immediate message results in no route code, upon transaction commit, when no outgoing route is connected. */ - public void test_QPID_517_ImmediateFailsNoRouteTxP2P() - { - // 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 receivers to - // collect its messages). - testProps.setProperty(RECEIVER_CONSUMER_BIND_PROPNAME, false); - - // Send one message and get a linked no route exception. - CircuitFactory circuitFactory = getCircuitFactory(); - Circuit testCircuit = circuitFactory.createCircuit(testProps); - - assertNoFailures(testCircuit.test(1, assertionList(testCircuit.getPublisher().noRouteAssertion()))); - } - - /** Check that an immediate message is sent succesfully not using transactions when a consumer is connected. */ - public void test_QPID_517_ImmediateOkNoTxPubSub() - { - // Ensure transactional sessions are off. - testProps.setProperty(TRANSACTED_PROPNAME, false); - testProps.setProperty(PUBSUB_PROPNAME, true); - - // Send one message with no errors. - CircuitFactory circuitFactory = getCircuitFactory(); - Circuit testCircuit = circuitFactory.createCircuit(testProps); - - assertNoFailures(testCircuit.test(1, assertionList(testCircuit.getPublisher().noExceptionsAssertion()))); - } - - /** Check that an immediate message is committed succesfully in a transaction when a consumer is connected. */ - public void test_QPID_517_ImmediateOkTxPubSub() - { - // Ensure transactional sessions are off. - testProps.setProperty(TRANSACTED_PROPNAME, true); - testProps.setProperty(PUBSUB_PROPNAME, true); - - // Send one message with no errors. - CircuitFactory circuitFactory = getCircuitFactory(); - Circuit testCircuit = circuitFactory.createCircuit(testProps); - - assertNoFailures(testCircuit.test(1, assertionList(testCircuit.getPublisher().noExceptionsAssertion()))); - } - - /** Check that an immediate message results in no consumers code, not using transactions, when a consumer is disconnected. */ - public void test_QPID_517_ImmediateFailsConsumerDisconnectedNoTxPubSub() - { - // Ensure transactional sessions are off. - 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); - - // Disconnect the consumer. - testProps.setProperty(RECEIVER_CONSUMER_ACTIVE_PROPNAME, false); - - CircuitFactory circuitFactory = getCircuitFactory(); - Circuit testCircuit = circuitFactory.createCircuit(testProps); - - // Send one message and get a linked no consumers exception. - assertNoFailures(testCircuit.test(1, assertionList(testCircuit.getPublisher().noConsumersAssertion()))); - } - - /** Check that an immediate message results in no consumers code, in a transaction, when a consumer is disconnected. */ - public void test_QPID_517_ImmediateFailsConsumerDisconnectedTxPubSub() - { - // Ensure transactional sessions are on. - 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); - - // Disconnect the consumer. - testProps.setProperty(RECEIVER_CONSUMER_ACTIVE_PROPNAME, false); - - CircuitFactory circuitFactory = getCircuitFactory(); - Circuit testCircuit = circuitFactory.createCircuit(testProps); - - // Send one message and get a linked no consumers exception. - assertNoFailures(testCircuit.test(1, assertionList(testCircuit.getPublisher().noConsumersAssertion()))); - } - - /** Check that an immediate message results in no route code, not using transactions, when no outgoing route is connected. */ - public void test_QPID_517_ImmediateFailsNoRouteNoTxPubSub() - { - // 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 receivers to - // collect its messages). - testProps.setProperty(RECEIVER_CONSUMER_BIND_PROPNAME, false); - - // Send one message and get a linked no route exception. - CircuitFactory circuitFactory = getCircuitFactory(); - Circuit testCircuit = circuitFactory.createCircuit(testProps); - - assertNoFailures(testCircuit.test(1, assertionList(testCircuit.getPublisher().noRouteAssertion()))); - } - - /** Check that an immediate message results in no route code, upon transaction commit, when no outgoing route is connected. */ - public void test_QPID_517_ImmediateFailsNoRouteTxPubSub() - { - // 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 receivers to - // collect its messages). - testProps.setProperty(RECEIVER_CONSUMER_BIND_PROPNAME, false); - - // Send one message and get a linked no route exception. - CircuitFactory circuitFactory = getCircuitFactory(); - Circuit testCircuit = circuitFactory.createCircuit(testProps); - - assertNoFailures(testCircuit.test(1, assertionList(testCircuit.getPublisher().noRouteAssertion()))); - } - - protected void setUp() throws Exception - { - super.setUp(); - - testProps = TestContextProperties.getInstance(MessagingTestConfigProperties.defaults); - - /** All these tests should have the immediate flag on. */ - testProps.setProperty(IMMEDIATE_PROPNAME, true); - testProps.setProperty(MANDATORY_PROPNAME, false); - - /** Bind the receivers consumer by default. */ - testProps.setProperty(RECEIVER_CONSUMER_BIND_PROPNAME, true); - testProps.setProperty(RECEIVER_CONSUMER_ACTIVE_PROPNAME, true); - } -} diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/exchange/MandatoryMessageTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/exchange/MandatoryMessageTest.java deleted file mode 100644 index df99d044d2..0000000000 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/exchange/MandatoryMessageTest.java +++ /dev/null @@ -1,308 +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.qpid.server.exchange; - -import org.apache.qpid.test.framework.Circuit; -import org.apache.qpid.test.framework.FrameworkBaseCase; -import org.apache.qpid.test.framework.MessagingTestConfigProperties; -import static org.apache.qpid.test.framework.MessagingTestConfigProperties.*; -import org.apache.qpid.test.framework.sequencers.CircuitFactory; - -import uk.co.thebadgerset.junit.extensions.util.ParsedProperties; -import uk.co.thebadgerset.junit.extensions.util.TestContextProperties; - -/** - * MandatoryMessageTest tests for the desired behaviour of mandatory messages. Mandatory messages are a non-JMS - * feature. A message may be marked with a mandatory delivery flag, which means that a valid route for the message - * must exist, when it is sent, or when its transaction is committed in the case of transactional messaging. If this - * is not the case, the broker should return the message with a NO_CONSUMERS code. - * - *

- *
CRC Card
Responsibilities Collaborations - *
Check that an mandatory message is sent succesfully not using transactions when a consumer is connected. - *
Check that an mandatory message is committed succesfully in a transaction when a consumer is connected. - *
Check that a mandatory message is sent succesfully, not using transactions, when a consumer is disconnected - * but the route exists. - *
Check that a mandatory message is sent succesfully, in a transaction, when a consumer is disconnected but - * the route exists. - *
Check that an mandatory message results in no route code, not using transactions, when no consumer is - * connected. - *
Check that an mandatory message results in no route code, upon transaction commit, when a consumer is - * connected. - *
Check that an mandatory message is sent succesfully not using transactions when a consumer is connected. - *
Check that an mandatory message is committed succesfully in a transaction when a consumer is connected. - *
Check that a mandatory message is sent succesfully, not using transactions, when a consumer is disconnected - * but the route exists. - *
Check that a mandatory message is sent succesfully, in a transaction, when a consumer is disconnected but - * the route exists. - *
Check that an mandatory message results in no route code, not using transactions, when no consumer is - * connected. - *
Check that an mandatory message results in no route code, upon transaction commit, when a consumer is - * connected. - *
- * - * @todo All of these test cases will be generated by a test generator that thoroughly tests all combinations of test - * circuits. - */ -public class MandatoryMessageTest extends FrameworkBaseCase -{ - /** Used to read the tests configurable properties through. */ - ParsedProperties testProps; - - /** - * Creates a new test case with the specified name. - * - * @param name The test case name. - */ - public MandatoryMessageTest(String name) - { - super(name); - } - - /** Check that an mandatory message is sent succesfully not using transactions when a consumer is connected. */ - public void test_QPID_508_MandatoryOkNoTxP2P() - { - // Ensure transactional sessions are off. - testProps.setProperty(TRANSACTED_PROPNAME, false); - testProps.setProperty(PUBSUB_PROPNAME, false); - - // Run the default test sequence over the test circuit checking for no errors. - CircuitFactory circuitFactory = getCircuitFactory(); - Circuit testCircuit = circuitFactory.createCircuit(testProps); - - assertNoFailures(testCircuit.test(1, assertionList(testCircuit.getPublisher().noExceptionsAssertion()))); - } - - /** Check that an mandatory message is committed succesfully in a transaction when a consumer is connected. */ - public void test_QPID_508_MandatoryOkTxP2P() - { - // Ensure transactional sessions are off. - testProps.setProperty(TRANSACTED_PROPNAME, true); - testProps.setProperty(PUBSUB_PROPNAME, false); - - // Run the default test sequence over the test circuit checking for no errors. - CircuitFactory circuitFactory = getCircuitFactory(); - Circuit testCircuit = circuitFactory.createCircuit(testProps); - - assertNoFailures(testCircuit.test(1, assertionList(testCircuit.getPublisher().noExceptionsAssertion()))); - } - - /** - * Check that a mandatory message is sent succesfully, not using transactions, when a consumer is disconnected but - * the route exists. - */ - public void test_QPID_517_MandatoryOkConsumerDisconnectedNoTxP2P() - { - // Ensure transactional sessions are off. - testProps.setProperty(TRANSACTED_PROPNAME, false); - testProps.setProperty(PUBSUB_PROPNAME, false); - - // Disconnect the consumer. - testProps.setProperty(RECEIVER_CONSUMER_ACTIVE_PROPNAME, false); - - CircuitFactory circuitFactory = getCircuitFactory(); - Circuit testCircuit = circuitFactory.createCircuit(testProps); - - // Send one message with no errors. - assertNoFailures(testCircuit.test(1, assertionList(testCircuit.getPublisher().noExceptionsAssertion()))); - } - - /** - * Check that a mandatory message is sent succesfully, in a transaction, when a consumer is disconnected but - * the route exists. - */ - public void test_QPID_517_MandatoryOkConsumerDisconnectedTxP2P() - { - // Ensure transactional sessions are on. - testProps.setProperty(TRANSACTED_PROPNAME, true); - testProps.setProperty(PUBSUB_PROPNAME, false); - - // Disconnect the consumer. - testProps.setProperty(RECEIVER_CONSUMER_ACTIVE_PROPNAME, false); - - CircuitFactory circuitFactory = getCircuitFactory(); - Circuit testCircuit = circuitFactory.createCircuit(testProps); - - // Send one message with no errors. - assertNoFailures(testCircuit.test(1, assertionList(testCircuit.getPublisher().noExceptionsAssertion()))); - } - - /** Check that an mandatory message results in no route code, not using transactions, when no consumer is connected. */ - public void test_QPID_508_MandatoryFailsNoRouteNoTxP2P() - { - // 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 receivers to - // collect its messages). - testProps.setProperty(RECEIVER_CONSUMER_BIND_PROPNAME, false); - - // Send one message and get a linked no route exception. - CircuitFactory circuitFactory = getCircuitFactory(); - Circuit testCircuit = circuitFactory.createCircuit(testProps); - - assertNoFailures(testCircuit.test(1, assertionList(testCircuit.getPublisher().noRouteAssertion()))); - } - - /** Check that an mandatory message results in no route code, upon transaction commit, when a consumer is connected. */ - public void test_QPID_508_MandatoryFailsNoRouteTxP2P() - { - // 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 receivers to - // collect its messages). - testProps.setProperty(RECEIVER_CONSUMER_BIND_PROPNAME, false); - - // Send one message and get a linked no route exception. - CircuitFactory circuitFactory = getCircuitFactory(); - Circuit testCircuit = circuitFactory.createCircuit(testProps); - - assertNoFailures(testCircuit.test(1, assertionList(testCircuit.getPublisher().noRouteAssertion()))); - } - - /** Check that an mandatory message is sent succesfully not using transactions when a consumer is connected. */ - public void test_QPID_508_MandatoryOkNoTxPubSub() - { - // Ensure transactional sessions are off. - testProps.setProperty(TRANSACTED_PROPNAME, false); - testProps.setProperty(PUBSUB_PROPNAME, true); - - // Run the default test sequence over the test circuit checking for no errors. - CircuitFactory circuitFactory = getCircuitFactory(); - Circuit testCircuit = circuitFactory.createCircuit(testProps); - - assertNoFailures(testCircuit.test(1, assertionList(testCircuit.getPublisher().noExceptionsAssertion()))); - } - - /** Check that an mandatory message is committed succesfully in a transaction when a consumer is connected. */ - public void test_QPID_508_MandatoryOkTxPubSub() - { - // Ensure transactional sessions are on. - testProps.setProperty(TRANSACTED_PROPNAME, true); - testProps.setProperty(PUBSUB_PROPNAME, true); - - // Run the default test sequence over the test circuit checking for no errors. - CircuitFactory circuitFactory = getCircuitFactory(); - Circuit testCircuit = circuitFactory.createCircuit(testProps); - - assertNoFailures(testCircuit.test(1, assertionList(testCircuit.getPublisher().noExceptionsAssertion()))); - } - - /** - * Check that a mandatory message is sent succesfully, not using transactions, when a consumer is disconnected but - * the route exists. - */ - public void test_QPID_517_MandatoryOkConsumerDisconnectedNoTxPubSub() - { - // Ensure transactional sessions are off. - 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); - - // Disconnect the consumer. - testProps.setProperty(RECEIVER_CONSUMER_ACTIVE_PROPNAME, false); - - CircuitFactory circuitFactory = getCircuitFactory(); - Circuit testCircuit = circuitFactory.createCircuit(testProps); - - // Send one message with no errors. - assertNoFailures(testCircuit.test(1, assertionList(testCircuit.getPublisher().noExceptionsAssertion()))); - } - - /** - * Check that a mandatory message is sent succesfully, in a transaction, when a consumer is disconnected but - * the route exists. - */ - public void test_QPID_517_MandatoryOkConsumerDisconnectedTxPubSub() - { - // Ensure transactional sessions are on. - 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); - - // Disconnect the consumer. - testProps.setProperty(RECEIVER_CONSUMER_ACTIVE_PROPNAME, false); - - CircuitFactory circuitFactory = getCircuitFactory(); - Circuit testCircuit = circuitFactory.createCircuit(testProps); - - // Send one message with no errors. - assertNoFailures(testCircuit.test(1, assertionList(testCircuit.getPublisher().noExceptionsAssertion()))); - } - - /** Check that an mandatory message results in no route code, not using transactions, when no consumer is connected. */ - public void test_QPID_508_MandatoryFailsNoRouteNoTxPubSub() - { - // 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 receivers to - // collect its messages). - testProps.setProperty(RECEIVER_CONSUMER_BIND_PROPNAME, false); - - // Send one message and get a linked no route exception. - CircuitFactory circuitFactory = getCircuitFactory(); - Circuit testCircuit = circuitFactory.createCircuit(testProps); - - assertNoFailures(testCircuit.test(1, assertionList(testCircuit.getPublisher().noRouteAssertion()))); - } - - /** Check that an mandatory message results in no route code, upon transaction commit, when a consumer is connected. */ - public void test_QPID_508_MandatoryFailsNoRouteTxPubSub() - { - // 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 receivers to - // collect its messages). - testProps.setProperty(RECEIVER_CONSUMER_BIND_PROPNAME, false); - - // Send one message and get a linked no route exception. - CircuitFactory circuitFactory = getCircuitFactory(); - Circuit testCircuit = circuitFactory.createCircuit(testProps); - - assertNoFailures(testCircuit.test(1, assertionList(testCircuit.getPublisher().noRouteAssertion()))); - } - - protected void setUp() throws Exception - { - super.setUp(); - - testProps = TestContextProperties.getInstance(MessagingTestConfigProperties.defaults); - - /** All these tests should have the mandatory flag on. */ - testProps.setProperty(IMMEDIATE_PROPNAME, false); - testProps.setProperty(MANDATORY_PROPNAME, true); - - /** Bind the receivers consumer by default. */ - testProps.setProperty(RECEIVER_CONSUMER_BIND_PROPNAME, true); - testProps.setProperty(RECEIVER_CONSUMER_ACTIVE_PROPNAME, true); - } -} diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/messageStore/TestableMemoryMessageStore.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/messageStore/TestableMemoryMessageStore.java deleted file mode 100644 index af3b5b0baf..0000000000 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/messageStore/TestableMemoryMessageStore.java +++ /dev/null @@ -1,41 +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.qpid.server.messageStore; - -import java.util.List; - -/** - * Created by Arnaud Simon - * Date: 09-May-2007 - * Time: 11:45:18 - */ -public class TestableMemoryMessageStore extends MemoryMessageStore -{ - public int getNumberStoredMessages() - { - int res = 0; - if (_queueMap != null) - { - for (List l : _queueMap.values()) - { - res = res + l.size(); - } - } - return res; - } -} -- cgit v1.2.1