qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rupertlssm...@apache.org
Subject svn commit: r561855 [3/3] - in /incubator/qpid/branches/M2/java: integrationtests/src/main/java/org/apache/qpid/interop/clienttestcases/ integrationtests/src/main/java/org/apache/qpid/interop/testcases/ integrationtests/src/main/java/org/apache/qpid/pe...
Date Wed, 01 Aug 2007 16:19:37 GMT
Modified: incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/FanOutTestDecorator.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/FanOutTestDecorator.java?view=diff&rev=561855&r1=561854&r2=561855
==============================================================================
--- incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/FanOutTestDecorator.java (original)
+++ incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/FanOutTestDecorator.java Wed Aug  1 09:19:31 2007
@@ -25,11 +25,12 @@
 
 import org.apache.log4j.Logger;
 
-import org.apache.qpid.test.framework.sequencers.DistributedTestSequencer;
-import org.apache.qpid.test.framework.sequencers.FanOutTestSequencer;
 import org.apache.qpid.test.framework.DropInTest;
-import org.apache.qpid.util.ConversationFactory;
+import org.apache.qpid.test.framework.FrameworkBaseCase;
 import org.apache.qpid.test.framework.TestClientDetails;
+import org.apache.qpid.test.framework.sequencers.CircuitFactory;
+import org.apache.qpid.test.framework.sequencers.FanOutCircuitFactory;
+import org.apache.qpid.util.ConversationFactory;
 
 import uk.co.thebadgerset.junit.extensions.WrappedSuiteTestDecorator;
 
@@ -50,7 +51,7 @@
  *
  * <p><table id="crc"><caption>CRC Card</caption>
  * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Execute coordinated test cases. <td> {@link DistributedTestCase}
+ * <tr><td> Execute coordinated test cases. <td> {@link FrameworkBaseCase}
  * <tr><td> Accept test clients joining a running test.
  * </table>
  */
@@ -60,7 +61,7 @@
     private static final Logger log = Logger.getLogger(FanOutTestDecorator.class);
 
     /** Holds the currently running test case. */
-    DistributedTestCase currentTest = null;
+    FrameworkBaseCase currentTest = null;
 
     /**
      * Creates a wrapped suite test decorator from another one.
@@ -112,9 +113,9 @@
         }
 
         // Run all of the test cases in the test suite.
-        for (Test test : tests)
+        for (Test test : getAllUnderlyingTests())
         {
-            DistributedTestCase coordTest = (DistributedTestCase) test;
+            FrameworkBaseCase coordTest = (FrameworkBaseCase) test;
 
             // Get all of the clients able to participate in the test.
             Set<TestClientDetails> enlists = signupClients(coordTest);
@@ -125,28 +126,28 @@
                 throw new RuntimeException("No clients to test with");
             }
 
-            // Create a distributed test sequencer for the test.
-            DistributedTestSequencer sequencer = getDistributedTestSequencer();
+            // Create a distributed test circuit factory for the test.
+            CircuitFactory circuitFactory = getTestSequencer();
 
             // Set up the first client in the sender role, and the remainder in the receivers role.
             Iterator<TestClientDetails> clients = enlists.iterator();
-            sequencer.setSender(clients.next());
+            circuitFactory.setSender(clients.next());
 
             while (clients.hasNext())
             {
                 // Set the sending and receiving client details on the test case.
-                sequencer.setReceiver(clients.next());
+                circuitFactory.setReceiver(clients.next());
             }
 
             // Pass down the connection to hold the coordinating conversation over.
-            sequencer.setConversationFactory(conversationFactory);
+            circuitFactory.setConversationFactory(conversationFactory);
 
             // If the current test case is a drop-in test, set it up as the currently running test for late joiners to
             // add in to. Otherwise the current test field is set to null, to indicate that late joiners are not allowed.
             currentTest = (coordTest instanceof DropInTest) ? coordTest : null;
 
             // Execute the test case.
-            coordTest.setTestSequencer(sequencer);
+            coordTest.setCircuitFactory(circuitFactory);
             coordTest.run(testResult);
 
             currentTest = null;
@@ -159,9 +160,9 @@
      *
      * @return A distributed test sequencer.
      */
-    public DistributedTestSequencer getDistributedTestSequencer()
+    public CircuitFactory getTestSequencer()
     {
-        return new FanOutTestSequencer();
+        return new FanOutCircuitFactory();
     }
 
     /**

Modified: incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/InteropTestDecorator.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/InteropTestDecorator.java?view=diff&rev=561855&r1=561854&r2=561855
==============================================================================
--- incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/InteropTestDecorator.java (original)
+++ incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/InteropTestDecorator.java Wed Aug  1 09:19:31 2007
@@ -25,9 +25,10 @@
 
 import org.apache.log4j.Logger;
 
-import org.apache.qpid.test.framework.sequencers.DistributedTestSequencer;
-import org.apache.qpid.test.framework.sequencers.InteropTestSequencer;
+import org.apache.qpid.test.framework.FrameworkBaseCase;
 import org.apache.qpid.test.framework.TestClientDetails;
+import org.apache.qpid.test.framework.sequencers.CircuitFactory;
+import org.apache.qpid.test.framework.sequencers.InteropCircuitFactory;
 import org.apache.qpid.util.ConversationFactory;
 
 import uk.co.thebadgerset.junit.extensions.WrappedSuiteTestDecorator;
@@ -48,7 +49,7 @@
  * <tr><th> Responsibilities <th> Collaborations
  * <tr><td> Broadcast test invitations and collect enlists. <td> {@link org.apache.qpid.util.ConversationFactory}.
  * <tr><td> Output test failures for clients unwilling to run the test case. <td> {@link Coordinator}
- * <tr><td> Execute distributed test cases. <td> {@link DistributedTestCase}
+ * <tr><td> Execute distributed test cases. <td> {@link FrameworkBaseCase}
  * <tr><td> Fail non participating pairings. <td> {@link OptOutTestCase}
  * </table>
  */
@@ -74,7 +75,7 @@
     /**
      * Broadcasts a test invitation and accetps enlisting from participating clients. The wrapped test case is
      * then repeated for every combination of test clients (provided the wrapped test case extends
-     * {@link DistributedTestCase}.
+     * {@link FrameworkBaseCase}.
      *
      * <p/>Any JMSExceptions during the invite/enlist conversation will be allowed to fall through as runtime exceptions,
      * resulting in the non-completion of the test run.
@@ -89,9 +90,9 @@
 
         Collection<Test> tests = testSuite.getAllUnderlyingTests();
 
-        for (Test test : tests)
+        for (Test test : getAllUnderlyingTests())
         {
-            DistributedTestCase coordTest = (DistributedTestCase) test;
+            FrameworkBaseCase coordTest = (FrameworkBaseCase) test;
 
             // Broadcast the invitation to find out what clients are available to test.
             Set<TestClientDetails> enlists = signupClients(coordTest);
@@ -105,14 +106,14 @@
 
             for (List<TestClientDetails> failPair : failPairs)
             {
-                // Create a distributed test sequencer for the test.
-                DistributedTestSequencer sequencer = getDistributedTestSequencer();
+                // Create a distributed test circuit factory for the test.
+                CircuitFactory circuitFactory = getTestSequencer();
 
                 // Create an automatic failure test for the opted out test pair.
-                DistributedTestCase failTest = new OptOutTestCase("testOptOut");
-                sequencer.setSender(failPair.get(0));
-                sequencer.setReceiver(failPair.get(1));
-                failTest.setTestSequencer(sequencer);
+                FrameworkBaseCase failTest = new OptOutTestCase("testOptOut");
+                circuitFactory.setSender(failPair.get(0));
+                circuitFactory.setReceiver(failPair.get(1));
+                failTest.setCircuitFactory(circuitFactory);
 
                 failTest.run(testResult);
             }
@@ -122,18 +123,18 @@
 
             for (List<TestClientDetails> enlistedPair : enlistedPairs)
             {
-                // Create a distributed test sequencer for the test.
-                DistributedTestSequencer sequencer = getDistributedTestSequencer();
+                // Create a distributed test circuit factory for the test.
+                CircuitFactory circuitFactory = getTestSequencer();
 
-                // Set the sending and receiving client details on the test sequencer.
-                sequencer.setSender(enlistedPair.get(0));
-                sequencer.setReceiver(enlistedPair.get(1));
+                // Set the sending and receiving client details on the test circuitFactory.
+                circuitFactory.setSender(enlistedPair.get(0));
+                circuitFactory.setReceiver(enlistedPair.get(1));
 
                 // Pass down the connection to hold the coordination conversation over.
-                sequencer.setConversationFactory(conversationFactory);
+                circuitFactory.setConversationFactory(conversationFactory);
 
                 // Execute the test case.
-                coordTest.setTestSequencer(sequencer);
+                coordTest.setCircuitFactory(circuitFactory);
                 coordTest.run(testResult);
             }
         }
@@ -145,9 +146,9 @@
      *
      * @return A distributed test sequencer.
      */
-    public DistributedTestSequencer getDistributedTestSequencer()
+    public CircuitFactory getTestSequencer()
     {
-        return new InteropTestSequencer();
+        return new InteropCircuitFactory();
     }
 
     /**

Modified: incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/OptOutTestCase.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/OptOutTestCase.java?view=diff&rev=561855&r1=561854&r2=561855
==============================================================================
--- incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/OptOutTestCase.java (original)
+++ incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/OptOutTestCase.java Wed Aug  1 09:19:31 2007
@@ -20,7 +20,8 @@
  */
 package org.apache.qpid.test.framework.distributedtesting;
 
-import org.apache.qpid.test.framework.sequencers.DistributedTestSequencer;
+import org.apache.qpid.test.framework.sequencers.CircuitFactory;
+import org.apache.qpid.test.framework.FrameworkBaseCase;
 
 /**
  * An OptOutTestCase is a test case that automatically fails. It is used when a list of test clients has been generated
@@ -32,7 +33,7 @@
  * <tr><td> Fail the test with a suitable reason.
  * </table>
  */
-public class OptOutTestCase extends DistributedTestCase
+public class OptOutTestCase extends FrameworkBaseCase
 {
     /**
      * Creates a new coordinating test case with the specified name.
@@ -47,9 +48,9 @@
     /** Generates an appropriate test failure assertion. */
     public void testOptOut()
     {
-        DistributedTestSequencer sequencer = getDistributedTestSequencer();
+        CircuitFactory circuitFactory = getCircuitFactory();
 
-        fail("One of " + sequencer.getSender() + " and " + getDistributedTestSequencer().getReceivers()
+        fail("One of " + circuitFactory.getSender() + " and " + getCircuitFactory().getReceivers()
             + " opted out of the test.");
     }
 

Added: incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/TestClientControlledTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/TestClientControlledTest.java?view=auto&rev=561855
==============================================================================
--- incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/TestClientControlledTest.java (added)
+++ incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/TestClientControlledTest.java Wed Aug  1 09:19:31 2007
@@ -0,0 +1,108 @@
+/*
+ *
+ * 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.test.framework.distributedtesting;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.Session;
+
+/**
+ * TestClientControlledTest provides an interface that classes implementing test cases to run on a {@link TestClient}
+ * node can use. Implementations must be Java beans, that is, to provide a default constructor and to implement the
+ * {@link #getName} method.
+ *
+ * <p/>The methods specified in this interface are called when the {@link TestClient} receives control instructions to
+ * apply to the test. There are control instructions to present the test case with the test invite, so that it may
+ * choose whether or not to participate in the test, assign the test to play the sender or receiver role, start the
+ * test and obtain the test status report.
+ *
+ * <p><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities
+ * <tr><td> Supply the name of the test case that this implements.
+ * <tr><td> Accept/Reject invites based on test parameters.
+ * <tr><td> Adapt to assigned roles.
+ * <tr><td> Perform test case actions.
+ * <tr><td> Generate test reports.
+ * </table>
+ */
+public interface TestClientControlledTest
+{
+    /** Defines the possible test case roles that an interop test case can take on. */
+    public enum Roles
+    {
+        /** Specifies the sender role. */
+        SENDER,
+
+        /** Specifies the receivers role. */
+        RECEIVER
+    }
+
+    /**
+     * Should provide the name of the test case that this class implements. The exact names are defined in the
+     * interop testing spec.
+     *
+     * @return The name of the test case that this implements.
+     */
+    public String getName();
+
+    /**
+     * Determines whether the test invite that matched this test case is acceptable.
+     *
+     * @param inviteMessage The invitation to accept or reject.
+     *
+     * @return <tt>true</tt> to accept the invitation, <tt>false</tt> to reject it.
+     *
+     * @throws JMSException Any JMSException resulting from reading the message are allowed to fall through.
+     */
+    public boolean acceptInvite(Message inviteMessage) throws JMSException;
+
+    /**
+     * Assigns the role to be played by this test case. The test parameters are fully specified in the
+     * assignment message. When this method return the test case will be ready to execute.
+     *
+     * @param role              The role to be played; sender or receivers.
+     * @param assignRoleMessage The role assingment message, contains the full test parameters.
+     *
+     * @throws JMSException Any JMSException resulting from reading the message are allowed to fall through.
+     */
+    public void assignRole(Roles role, Message assignRoleMessage) throws JMSException;
+
+    /**
+     * Performs the test case actions. Returning from here, indicates that the sending role has completed its test.
+     *
+     * @param numMessages The number of test messages to send.
+     *
+     * @throws JMSException Any JMSException resulting from reading the message are allowed to fall through.
+     */
+    public void start(int numMessages) throws JMSException;
+
+    /**
+     * Gets a report on the actions performed by the test case in its assigned role.
+     *
+     * @param session The controlSession to create the report message in.
+     *
+     * @return The report message.
+     *
+     * @throws JMSException Any JMSExceptions resulting from creating the report are allowed to fall through.
+     */
+    public Message getReport(Session session) throws JMSException;
+}

Modified: incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/listeners/XMLTestListener.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/listeners/XMLTestListener.java?view=diff&rev=561855&r1=561854&r2=561855
==============================================================================
--- incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/listeners/XMLTestListener.java (original)
+++ incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/listeners/XMLTestListener.java Wed Aug  1 09:19:31 2007
@@ -26,6 +26,7 @@
 
 import org.apache.log4j.Logger;
 
+import uk.co.thebadgerset.junit.extensions.ShutdownHookable;
 import uk.co.thebadgerset.junit.extensions.listeners.TKTestListener;
 
 import java.io.IOException;
@@ -62,7 +63,7 @@
  *       the ant XML formatter, and a more structured one for outputing results with timings and summaries from
  *       performance tests.
  */
-public class XMLTestListener implements TKTestListener
+public class XMLTestListener implements TKTestListener, ShutdownHookable
 {
     /** Used for debugging. */
     private static final Logger log = Logger.getLogger(XMLTestListener.class);
@@ -348,6 +349,22 @@
         {
             throw new RuntimeException("Unable to write the test results.", e);
         }
+    }
+
+    /**
+     * Supplies the shutdown hook.
+     *
+     * @return The shut down hook.
+     */
+    public Thread getShutdownHook()
+    {
+        return new Thread(new Runnable()
+                {
+                    public void run()
+                    {
+                        log.debug("XMLTestListener::ShutdownHook: called");
+                    }
+                });
     }
 
     /**

Copied: incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalCircuitImpl.java (from r559458, incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/CircuitImpl.java)
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalCircuitImpl.java?view=diff&rev=561855&p1=incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/CircuitImpl.java&r1=559458&p2=incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalCircuitImpl.java&r2=561855
==============================================================================
--- incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/CircuitImpl.java (original)
+++ incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalCircuitImpl.java Wed Aug  1 09:19:31 2007
@@ -20,6 +20,8 @@
  */
 package org.apache.qpid.test.framework.localcircuit;
 
+import org.apache.log4j.Logger;
+
 import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.test.framework.*;
 
@@ -32,27 +34,27 @@
 import java.util.concurrent.atomic.AtomicLong;
 
 /**
- * CircuitImpl provides an implementation of the test circuit. This is a first prototype implementation and only supports
- * a single producer/consumer on each end of the circuit, with both ends of the circuit on the same JVM.
+ * LocalCircuitImpl provides an implementation of the test circuit. This is a local only circuit implementation that
+ * supports a single producer/consumer on each end of the circuit, with both ends of the circuit on the same JVM.
  *
  * <p/><table id="crc"><caption>CRC Card</caption>
  * <tr><th> Responsibilities <th> Collaborations
  * <tr><td> Supply the publishing and receiving ends of a test messaging circuit.
- *     <td> {@link PublisherImpl}, {@link ReceiverImpl}
+ *     <td> {@link LocalPublisherImpl}, {@link LocalReceiverImpl}
  * <tr><td> Start the circuit running.
  * <tr><td> Close the circuit down.
  * <tr><td> Take a reading of the circuits state.
- * <tr><td> Apply assertions against the circuits state. <td> {@link org.apache.qpid.test.framework.Assertion}
+ * <tr><td> Apply assertions against the circuits state. <td> {@link Assertion}
  * <tr><td> Send test messages over the circuit.
  * <tr><td> Perform the default test procedure on the circuit.
- * <tr><td> Provide access to connection and session exception monitors <td> {@link org.apache.qpid.test.framework.ExceptionMonitor}
+ * <tr><td> Provide access to connection and controlSession exception monitors <td> {@link ExceptionMonitor}
  * </table>
- *
- * @todo Add ability to create routes with no consumers active on them. Immediate/Mandatory tests are closing consumers
- *       themsleves to create this scenario. Should make it part of the test configuration.
  */
-public class CircuitImpl implements Circuit
+public class LocalCircuitImpl implements Circuit
 {
+    /** Used for debugging. */
+    private static final Logger log = Logger.getLogger(LocalCircuitImpl.class);
+
     /** Used to create unique destination names for each test. */
     private static AtomicLong uniqueDestsId = new AtomicLong();
 
@@ -60,10 +62,10 @@
     private ParsedProperties testProps;
 
     /** Holds the publishing end of the circuit. */
-    private PublisherImpl publisher;
+    private LocalPublisherImpl publisher;
 
     /** Holds the receiving end of the circuit. */
-    private ReceiverImpl receiver;
+    private LocalReceiverImpl receiver;
 
     /** Holds the connection for the publishing end of the circuit. */
     private Connection connection;
@@ -71,7 +73,7 @@
     /** Holds the exception listener for the connection on the publishing end of the circuit. */
     private ExceptionMonitor connectionExceptionMonitor;
 
-    /** Holds the exception listener for the session on the publishing end of the circuit. */
+    /** Holds the exception listener for the controlSession on the publishing end of the circuit. */
     private ExceptionMonitor exceptionMonitor;
 
     /**
@@ -84,8 +86,8 @@
      * @param connection                 The connection.
      * @param connectionExceptionMonitor The connection exception monitor.
      */
-    protected CircuitImpl(ParsedProperties testProps, PublisherImpl publisher, ReceiverImpl receiver, Connection connection,
-        ExceptionMonitor connectionExceptionMonitor)
+    protected LocalCircuitImpl(ParsedProperties testProps, LocalPublisherImpl publisher, LocalReceiverImpl receiver,
+        Connection connection, ExceptionMonitor connectionExceptionMonitor)
     {
         this.testProps = testProps;
         this.publisher = publisher;
@@ -100,7 +102,7 @@
     }
 
     /**
-     * Creates a test circuit from the specified test parameters.
+     * Creates a local test circuit from the specified test parameters.
      *
      * @param testProps The test parameters.
      *
@@ -111,106 +113,33 @@
         // Create a standard publisher/receivers test client pair on a shared connection, individual sessions.
         try
         {
-            // ParsedProperties testProps = new ParsedProperties(testProps);
+            // Cast the test properties into a typed interface for convenience.
+            MessagingTestConfigProperties props = new MessagingTestConfigProperties(testProps);
 
             // Get a unique offset to append to destination names to make them unique to the connection.
             long uniqueId = uniqueDestsId.incrementAndGet();
 
-            // Extract the standard test configuration parameters relevant to the connection.
-            String destinationSendRoot =
-                testProps.getProperty(MessagingTestConfigProperties.SEND_DESTINATION_NAME_ROOT_PROPNAME) + "_" + uniqueId;
-            String destinationReceiveRoot =
-                testProps.getProperty(MessagingTestConfigProperties.RECEIVE_DESTINATION_NAME_ROOT_PROPNAME) + "_" + uniqueId;
-            boolean createPublisherProducer =
-                testProps.getPropertyAsBoolean(MessagingTestConfigProperties.PUBLISHER_PRODUCER_BIND_PROPNAME);
-            boolean createPublisherConsumer =
-                testProps.getPropertyAsBoolean(MessagingTestConfigProperties.PUBLISHER_CONSUMER_BIND_PROPNAME);
-            boolean createReceiverProducer =
-                testProps.getPropertyAsBoolean(MessagingTestConfigProperties.RECEIVER_PRODUCER_BIND_PROPNAME);
-            boolean createReceiverConsumer =
-                testProps.getPropertyAsBoolean(MessagingTestConfigProperties.RECEIVER_CONSUMER_BIND_PROPNAME);
-
-            // Check which JMS flags and options are to be set.
-            int ackMode = testProps.getPropertyAsInteger(MessagingTestConfigProperties.ACK_MODE_PROPNAME);
-            boolean useTopics = testProps.getPropertyAsBoolean(MessagingTestConfigProperties.PUBSUB_PROPNAME);
-            boolean transactional = testProps.getPropertyAsBoolean(MessagingTestConfigProperties.TRANSACTED_PROPNAME);
-            boolean durableSubscription =
-                testProps.getPropertyAsBoolean(MessagingTestConfigProperties.DURABLE_SUBSCRIPTION_PROPNAME);
-
-            // Check if any Qpid/AMQP specific flags or options need to be set.
-            boolean immediate = testProps.getPropertyAsBoolean(MessagingTestConfigProperties.IMMEDIATE_PROPNAME);
-            boolean mandatory = testProps.getPropertyAsBoolean(MessagingTestConfigProperties.MANDATORY_PROPNAME);
-            boolean needsQpidOptions = immediate | mandatory;
-
-            /*log.debug("ackMode = " + ackMode);
-            log.debug("useTopics = " + useTopics);
-            log.debug("destinationSendRoot = " + destinationSendRoot);
-            log.debug("destinationReceiveRoot = " + destinationReceiveRoot);
-            log.debug("createPublisherProducer = " + createPublisherProducer);
-            log.debug("createPublisherConsumer = " + createPublisherConsumer);
-            log.debug("createReceiverProducer = " + createReceiverProducer);
-            log.debug("createReceiverConsumer = " + createReceiverConsumer);
-            log.debug("transactional = " + transactional);
-            log.debug("immediate = " + immediate);
-            log.debug("mandatory = " + mandatory);
-            log.debug("needsQpidOptions = " + needsQpidOptions);*/
-
-            // Create connection, sessions and producer/consumer pairs on each session.
+            // Set up the connection.
             Connection connection = TestUtils.createConnection(testProps);
 
             // Add the connection exception listener to assert on exception conditions with.
-            ExceptionMonitor exceptionMonitor = new ExceptionMonitor();
-            connection.setExceptionListener(exceptionMonitor);
-
-            Session publisherSession = connection.createSession(transactional, ackMode);
-            Session receiverSession = connection.createSession(transactional, ackMode);
-
-            Destination publisherProducerDestination =
-                useTopics ? publisherSession.createTopic(destinationSendRoot)
-                          : publisherSession.createQueue(destinationSendRoot);
-
-            MessageProducer publisherProducer =
-                createPublisherProducer
-                ? (needsQpidOptions
-                    ? ((AMQSession) publisherSession).createProducer(publisherProducerDestination, mandatory, immediate)
-                    : publisherSession.createProducer(publisherProducerDestination)) : null;
-
-            MessageConsumer publisherConsumer =
-                createPublisherConsumer
-                ? publisherSession.createConsumer(publisherSession.createQueue(destinationReceiveRoot)) : null;
-
-            if (publisherConsumer != null)
-            {
-                publisherConsumer.setMessageListener(new MessageMonitor());
-            }
+            // ExceptionMonitor exceptionMonitor = new ExceptionMonitor();
+            // connection.setExceptionListener(exceptionMonitor);
 
-            MessageProducer receiverProducer =
-                createReceiverProducer ? receiverSession.createProducer(receiverSession.createQueue(destinationReceiveRoot))
-                                       : null;
-
-            Destination receiverConsumerDestination =
-                useTopics ? receiverSession.createTopic(destinationSendRoot)
-                          : receiverSession.createQueue(destinationSendRoot);
-
-            MessageConsumer receiverConsumer =
-                createReceiverConsumer
-                ? ((durableSubscription && useTopics)
-                    ? receiverSession.createDurableSubscriber((Topic) receiverConsumerDestination, "testsub")
-                    : receiverSession.createConsumer(receiverConsumerDestination)) : null;
+            // Set up the publisher.
+            CircuitEndBase publisherEnd = createPublisherCircuitEnd(connection, props, uniqueId);
 
-            if (receiverConsumer != null)
-            {
-                receiverConsumer.setMessageListener(new MessageMonitor());
-            }
+            // Set up the receiver.
+            CircuitEndBase receiverEnd = createReceiverCircuitEnd(connection, props, uniqueId);
 
             // Start listening for incoming messages.
             connection.start();
 
             // Package everything up.
-            PublisherImpl publisher = new PublisherImpl(publisherProducer, publisherConsumer, publisherSession);
-            ReceiverImpl receiver = new ReceiverImpl(receiverProducer, receiverConsumer, receiverSession);
+            LocalPublisherImpl publisher = new LocalPublisherImpl(publisherEnd);
+            LocalReceiverImpl receiver = new LocalReceiverImpl(receiverEnd);
 
-            return new CircuitImpl(testProps, publisher, receiver, connection, exceptionMonitor);
+            return new LocalCircuitImpl(testProps, publisher, receiver, connection, publisher.getExceptionMonitor());
         }
         catch (JMSException e)
         {
@@ -219,6 +148,113 @@
     }
 
     /**
+     * Builds a circuit end suitable for the publishing side of a test circuit, from standard test parameters.
+     *
+     * @param connection The connection to build the circuit end on.
+     * @param testProps  The test parameters to configure the circuit end construction.
+     * @param uniqueId   A unique number to being numbering destinations from, to make this circuit unique.
+     *
+     * @return A circuit end suitable for the publishing side of a test circuit.
+     *
+     * @throws JMSException Any underlying JMSExceptions are allowed to fall through and fail the creation.
+     */
+    public static CircuitEndBase createPublisherCircuitEnd(Connection connection, ParsedProperties testProps, long uniqueId)
+        throws JMSException
+    {
+        log.debug(
+            "public static CircuitEndBase createPublisherCircuitEnd(Connection connection, ParsedProperties testProps, long uniqueId = "
+            + uniqueId + "): called");
+
+        // Cast the test properties into a typed interface for convenience.
+        MessagingTestConfigProperties props = new MessagingTestConfigProperties(testProps);
+
+        Session session = connection.createSession(props.getTransacted(), props.getAckMode());
+
+        Destination destination =
+            props.getPubsub() ? session.createTopic(props.getSendDestinationNameRoot() + "_" + uniqueId)
+                              : session.createQueue(props.getSendDestinationNameRoot() + "_" + uniqueId);
+
+        MessageProducer producer =
+            props.getPublisherProducerBind()
+            ? ((props.getImmediate() | props.getMandatory())
+                ? ((AMQSession) session).createProducer(destination, props.getMandatory(), props.getImmediate())
+                : session.createProducer(destination)) : null;
+
+        MessageConsumer consumer =
+            props.getPublisherConsumerBind()
+            ? session.createConsumer(session.createQueue(props.getReceiveDestinationNameRoot() + "_" + uniqueId)) : null;
+
+        MessageMonitor messageMonitor = new MessageMonitor();
+
+        if (consumer != null)
+        {
+            consumer.setMessageListener(messageMonitor);
+        }
+
+        ExceptionMonitor exceptionMonitor = new ExceptionMonitor();
+        connection.setExceptionListener(exceptionMonitor);
+
+        if (!props.getPublisherConsumerActive() && (consumer != null))
+        {
+            consumer.close();
+        }
+
+        return new CircuitEndBase(producer, consumer, session, messageMonitor, exceptionMonitor);
+    }
+
+    /**
+     * Builds a circuit end suitable for the receiving side of a test circuit, from standard test parameters.
+     *
+     * @param connection The connection to build the circuit end on.
+     * @param testProps  The test parameters to configure the circuit end construction.
+     * @param uniqueId   A unique number to being numbering destinations from, to make this circuit unique.
+     *
+     * @return A circuit end suitable for the receiving side of a test circuit.
+     *
+     * @throws JMSException Any underlying JMSExceptions are allowed to fall through and fail the creation.
+     */
+    public static CircuitEndBase createReceiverCircuitEnd(Connection connection, ParsedProperties testProps, long uniqueId)
+        throws JMSException
+    {
+        log.debug(
+            "public static CircuitEndBase createReceiverCircuitEnd(Connection connection, ParsedProperties testProps, long uniqueId = "
+            + uniqueId + "): called");
+
+        // Cast the test properties into a typed interface for convenience.
+        MessagingTestConfigProperties props = new MessagingTestConfigProperties(testProps);
+
+        Session session = connection.createSession(props.getTransacted(), props.getAckMode());
+
+        MessageProducer producer =
+            props.getReceiverProducerBind()
+            ? session.createProducer(session.createQueue(props.getReceiveDestinationNameRoot() + "_" + uniqueId)) : null;
+
+        Destination destination =
+            props.getPubsub() ? session.createTopic(props.getSendDestinationNameRoot() + "_" + uniqueId)
+                              : session.createQueue(props.getSendDestinationNameRoot() + "_" + uniqueId);
+
+        MessageConsumer consumer =
+            props.getReceiverConsumerBind()
+            ? ((props.getDurableSubscription() && props.getPubsub())
+                ? session.createDurableSubscriber((Topic) destination, "testsub") : session.createConsumer(destination))
+            : null;
+
+        MessageMonitor messageMonitor = new MessageMonitor();
+
+        if (consumer != null)
+        {
+            consumer.setMessageListener(messageMonitor);
+        }
+
+        if (!props.getReceiverConsumerActive() && (consumer != null))
+        {
+            consumer.close();
+        }
+
+        return new CircuitEndBase(producer, consumer, session, messageMonitor, null);
+    }
+
+    /**
      * Gets the interface on the publishing end of the circuit.
      *
      * @return The publishing end of the circuit.
@@ -229,6 +265,16 @@
     }
 
     /**
+     * Gets the local publishing circuit end, for direct manipulation.
+     *
+     * @return The local publishing circuit end.
+     */
+    public CircuitEnd getLocalPublisherCircuitEnd()
+    {
+        return publisher;
+    }
+
+    /**
      * Gets the interface on the receiving end of the circuit.
      *
      * @return The receiving end of the circuit.
@@ -239,6 +285,16 @@
     }
 
     /**
+     * Gets the local receiving circuit end, for direct manipulation.
+     *
+     * @return The local receiving circuit end.
+     */
+    public CircuitEnd getLocalReceiverCircuitEnd()
+    {
+        return receiver;
+    }
+
+    /**
      * Checks the test circuit. The effect of this is to gather the circuits state, for both ends of the circuit,
      * into a report, against which assertions may be checked.
      */
@@ -293,18 +349,20 @@
     /**
      * Sends a message on the test circuit. The exact nature of the message sent is controlled by the test parameters.
      */
-    public void send()
+    protected void send()
     {
         boolean transactional = testProps.getPropertyAsBoolean(MessagingTestConfigProperties.TRANSACTED_PROPNAME);
 
         // Send an immediate message through the publisher and ensure that it results in a JMSException.
         try
         {
-            getPublisher().send(createTestMessage(getPublisher()));
+            CircuitEnd end = getLocalPublisherCircuitEnd();
+
+            end.send(createTestMessage(end));
 
             if (transactional)
             {
-                getPublisher().getSession().commit();
+                end.getSession().commit();
             }
         }
         catch (JMSException e)
@@ -351,7 +409,7 @@
         // Apply all of the requested assertions, keeping record of any that fail.
         List<Assertion> failures = applyAssertions(assertions);
 
-        // Clean up the publisher/receivers/session/connections.
+        // Clean up the publisher/receivers/controlSession/connections.
         close();
 
         // Return any failed assertions to the caller.
@@ -383,9 +441,9 @@
     }
 
     /**
-     * Gets the exception monitor for the publishing ends session.
+     * Gets the exception monitor for the publishing ends controlSession.
      *
-     * @return The exception monitor for the publishing ends session.
+     * @return The exception monitor for the publishing ends controlSession.
      */
     public ExceptionMonitor getExceptionMonitor()
     {

Copied: incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalPublisherImpl.java (from r559458, incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/PublisherImpl.java)
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalPublisherImpl.java?view=diff&rev=561855&p1=incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/PublisherImpl.java&r1=559458&p2=incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalPublisherImpl.java&r2=561855
==============================================================================
--- incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/PublisherImpl.java (original)
+++ incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalPublisherImpl.java Wed Aug  1 09:19:31 2007
@@ -22,7 +22,6 @@
 
 import org.apache.qpid.client.AMQNoConsumersException;
 import org.apache.qpid.client.AMQNoRouteException;
-import org.apache.qpid.test.framework.localcircuit.CircuitImpl;
 import org.apache.qpid.test.framework.*;
 
 import javax.jms.MessageConsumer;
@@ -30,8 +29,10 @@
 import javax.jms.Session;
 
 /**
- * Provides an implementation of the {@link org.apache.qpid.test.framework.Publisher} interface that wraps a single message producer and consumer on
- * a single session.
+ * Provides an implementation of the {@link Publisher} interface and wraps a single message producer and consumer on
+ * a single controlSession, as a {@link CircuitEnd}. A local publisher also acts as a circuit end, because for a locally
+ * located circuit the assertions may be applied directly, there does not need to be any inter process messaging
+ * between the publisher and its single circuit end, in order to ascertain its status.
  *
  * <p/><table id="crc"><caption>CRC Card</caption>
  * <tr><th> Responsibilities <th> Collaborations
@@ -42,21 +43,32 @@
  * <tr><td> Provide assertion that the publisher received a no route error code.
  * </table>
  */
-public class PublisherImpl extends CircuitEndBase implements Publisher
+public class LocalPublisherImpl extends CircuitEndBase implements Publisher
 {
     /** Holds a reference to the containing circuit. */
-    private CircuitImpl circuit;
+    private LocalCircuitImpl circuit;
 
     /**
-     * Creates a circuit end point on the specified producer, consumer and session.
+     * Creates a circuit end point on the specified producer, consumer and controlSession.
      *
      * @param producer The message producer for the circuit end point.
      * @param consumer The message consumer for the circuit end point.
-     * @param session  The session for the circuit end point.
+     * @param session  The controlSession for the circuit end point.
      */
-    public PublisherImpl(MessageProducer producer, MessageConsumer consumer, Session session)
+    public LocalPublisherImpl(MessageProducer producer, MessageConsumer consumer, Session session,
+        MessageMonitor messageMonitor, ExceptionMonitor exceptionMonitor)
     {
-        super(producer, consumer, session);
+        super(producer, consumer, session, messageMonitor, exceptionMonitor);
+    }
+
+    /**
+     * Creates a circuit end point from the producer, consumer and controlSession in a circuit end base implementation.
+     *
+     * @param end The circuit end base implementation to take producers and consumers from.
+     */
+    public LocalPublisherImpl(CircuitEndBase end)
+    {
+        super(end.getProducer(), end.getConsumer(), end.getSession(), end.getMessageMonitor(), end.getExceptionMonitor());
     }
 
     /**
@@ -77,6 +89,7 @@
                     if (!connectionExceptionMonitor.assertNoExceptions())
                     {
                         passed = false;
+
                         addError("Was expecting no exceptions.\n");
                         addError("Got the following exceptions on the connection, "
                             + circuit.getConnectionExceptionMonitor());
@@ -85,6 +98,7 @@
                     if (!sessionExceptionMonitor.assertNoExceptions())
                     {
                         passed = false;
+
                         addError("Was expecting no exceptions.\n");
                         addError("Got the following exceptions on the producer, " + circuit.getExceptionMonitor());
                     }
@@ -110,6 +124,8 @@
 
                     if (!connectionExceptionMonitor.assertOneJMSExceptionWithLinkedCause(AMQNoConsumersException.class))
                     {
+                        passed = false;
+
                         addError("Was expecting linked exception type " + AMQNoConsumersException.class.getName()
                             + " on the connection.\n");
                         addError((connectionExceptionMonitor.size() > 0)
@@ -138,6 +154,8 @@
 
                     if (!connectionExceptionMonitor.assertOneJMSExceptionWithLinkedCause(AMQNoRouteException.class))
                     {
+                        passed = false;
+
                         addError("Was expecting linked exception type " + AMQNoRouteException.class.getName()
                             + " on the connection.\n");
                         addError((connectionExceptionMonitor.size() > 0)
@@ -155,7 +173,7 @@
      *
      * @param circuit The containing circuit.
      */
-    public void setCircuit(CircuitImpl circuit)
+    public void setCircuit(LocalCircuitImpl circuit)
     {
         this.circuit = circuit;
     }

Copied: incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalReceiverImpl.java (from r559458, incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/ReceiverImpl.java)
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalReceiverImpl.java?view=diff&rev=561855&p1=incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/ReceiverImpl.java&r1=559458&p2=incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalReceiverImpl.java&r2=561855
==============================================================================
--- incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/ReceiverImpl.java (original)
+++ incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalReceiverImpl.java Wed Aug  1 09:19:31 2007
@@ -20,18 +20,17 @@
  */
 package org.apache.qpid.test.framework.localcircuit;
 
-import org.apache.qpid.test.framework.localcircuit.CircuitImpl;
-import org.apache.qpid.test.framework.CircuitEndBase;
-import org.apache.qpid.test.framework.Receiver;
-import org.apache.qpid.test.framework.Assertion;
+import org.apache.qpid.test.framework.*;
 
 import javax.jms.MessageConsumer;
 import javax.jms.MessageProducer;
 import javax.jms.Session;
 
 /**
- * Provides an implementation of the {@link org.apache.qpid.test.framework.Receiver} interface that wraps a single message producer and consumer on
- * a single session.
+ * Provides an implementation of the {@link Receiver} interface that wraps a single message producer and consumer on
+ * a single controlSession, as a {@link CircuitEnd}. A local receiver also acts as a circuit end, because for a locally
+ * located circuit the assertions may be applied directly, there does not need to be any inter process messaging
+ * between the publisher and its single circuit end, in order to ascertain its status.
  *
  * <p/><table id="crc"><caption>CRC Card</caption>
  * <tr><th> Responsibilities <th> Collaborations
@@ -41,21 +40,32 @@
  * <tr><td> Provide assertion that the receivers received all test messages sent to it.
  * </table>
  */
-public class ReceiverImpl extends CircuitEndBase implements Receiver
+public class LocalReceiverImpl extends CircuitEndBase implements Receiver
 {
     /** Holds a reference to the containing circuit. */
-    private CircuitImpl circuit;
+    private LocalCircuitImpl circuit;
 
     /**
-     * Creates a circuit end point on the specified producer, consumer and session.
+     * Creates a circuit end point on the specified producer, consumer and controlSession.
      *
      * @param producer The message producer for the circuit end point.
      * @param consumer The message consumer for the circuit end point.
-     * @param session  The session for the circuit end point.
+     * @param session  The controlSession for the circuit end point.
      */
-    public ReceiverImpl(MessageProducer producer, MessageConsumer consumer, Session session)
+    public LocalReceiverImpl(MessageProducer producer, MessageConsumer consumer, Session session,
+        MessageMonitor messageMonitor, ExceptionMonitor exceptionMonitor)
     {
-        super(producer, consumer, session);
+        super(producer, consumer, session, messageMonitor, exceptionMonitor);
+    }
+
+    /**
+     * Creates a circuit end point from the producer, consumer and controlSession in a circuit end base implementation.
+     *
+     * @param end The circuit end base implementation to take producers and consumers from.
+     */
+    public LocalReceiverImpl(CircuitEndBase end)
+    {
+        super(end.getProducer(), end.getConsumer(), end.getSession(), end.getMessageMonitor(), end.getExceptionMonitor());
     }
 
     /**
@@ -83,7 +93,7 @@
      *
      * @param circuit The containing circuit.
      */
-    public void setCircuit(CircuitImpl circuit)
+    public void setCircuit(LocalCircuitImpl circuit)
     {
         this.circuit = circuit;
     }

Copied: incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/BaseCircuitFactory.java (from r559458, incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/BaseDistributedTestSequencer.java)
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/BaseCircuitFactory.java?view=diff&rev=561855&p1=incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/BaseDistributedTestSequencer.java&r1=559458&p2=incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/BaseCircuitFactory.java&r2=561855
==============================================================================
--- incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/BaseDistributedTestSequencer.java (original)
+++ incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/BaseCircuitFactory.java Wed Aug  1 09:19:31 2007
@@ -22,9 +22,8 @@
 
 import org.apache.log4j.Logger;
 
-import org.apache.qpid.test.framework.distributedtesting.DistributedTestCase;
-import org.apache.qpid.test.framework.TestClientDetails;
 import org.apache.qpid.test.framework.Circuit;
+import org.apache.qpid.test.framework.TestClientDetails;
 import org.apache.qpid.util.ConversationFactory;
 
 import java.util.LinkedList;
@@ -37,10 +36,10 @@
  * <tr><td>
  * </table>
  */
-public abstract class BaseDistributedTestSequencer implements DistributedTestSequencer
+public abstract class BaseCircuitFactory implements CircuitFactory
 {
     /** Used for debugging. */
-    private final Logger log = Logger.getLogger(DistributedTestCase.class);
+    private final Logger log = Logger.getLogger(BaseCircuitFactory.class);
 
     /** Holds the contact details for the sending test client. */
     protected TestClientDetails sender;

Copied: incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/CircuitFactory.java (from r559458, incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/TestCaseSequencer.java)
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/CircuitFactory.java?view=diff&rev=561855&p1=incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/TestCaseSequencer.java&r1=559458&p2=incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/CircuitFactory.java&r2=561855
==============================================================================
--- incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/TestCaseSequencer.java (original)
+++ incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/CircuitFactory.java Wed Aug  1 09:19:31 2007
@@ -22,6 +22,8 @@
 
 import org.apache.qpid.test.framework.Assertion;
 import org.apache.qpid.test.framework.Circuit;
+import org.apache.qpid.test.framework.TestClientDetails;
+import org.apache.qpid.util.ConversationFactory;
 
 import uk.co.thebadgerset.junit.extensions.util.ParsedProperties;
 
@@ -41,8 +43,14 @@
  * <tr><td> Provide a standard test procedure over a test circuit.
  * <tr><td> Construct test circuits appropriate to a tests context.
  * </table>
+ *
+ * @todo The sequence test method is deprecated, in favour of using test circuits instead. This interface might be
+ *       better renamed to somethign like CircuitFactory, also the split between this interface and
+ *       DistributedTestSequencer could be removed and DistributedTestCase functionality merged into FrameworkBaseCase.
+ *       This is so that any test case written on top of the framework base case can be distributed, without having
+ *       to extend a different base test class.
  */
-public interface TestCaseSequencer
+public interface CircuitFactory
 {
     /**
      * Holds a test coordinating conversation with the test clients. This should consist of assigning the test roles,
@@ -52,6 +60,8 @@
      * @param testCircuit    The test circuit.
      * @param assertions     The list of assertions to apply to the test circuit.
      * @param testProperties The test case definition.
+     *
+     * @deprecated Use test circuits and Circuit.test instead.
      */
     public void sequenceTest(Circuit testCircuit, List<Assertion> assertions, Properties testProperties);
 
@@ -63,4 +73,39 @@
      * @return A test circuit.
      */
     public Circuit createCircuit(ParsedProperties testProperties);
+
+    /**
+     * Sets the sender test client to coordinate the test with.
+     *
+     * @param sender The contact details of the sending client in the test.
+     */
+    public void setSender(TestClientDetails sender);
+
+    /**
+     * Sets the receiving test client to coordinate the test with.
+     *
+     * @param receiver The contact details of the sending client in the test.
+     */
+    public void setReceiver(TestClientDetails receiver);
+
+    /**
+     * Supplies the sending test client.
+     *
+     * @return The sending test client.
+     */
+    public TestClientDetails getSender();
+
+    /**
+     * Supplies the receiving test client.
+     *
+     * @return The receiving test client.
+     */
+    public List<TestClientDetails> getReceivers();
+
+    /**
+     * Accepts the conversation factory over which to hold the test coordinating conversation.
+     *
+     * @param conversationFactory The conversation factory to coordinate the test over.
+     */
+    public void setConversationFactory(ConversationFactory conversationFactory);
 }

Copied: incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/FanOutCircuitFactory.java (from r559458, incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/FanOutTestSequencer.java)
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/FanOutCircuitFactory.java?view=diff&rev=561855&p1=incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/FanOutTestSequencer.java&r1=559458&p2=incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/FanOutCircuitFactory.java&r2=561855
==============================================================================
--- incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/FanOutTestSequencer.java (original)
+++ incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/FanOutCircuitFactory.java Wed Aug  1 09:19:31 2007
@@ -22,10 +22,11 @@
 
 import org.apache.log4j.Logger;
 
-import org.apache.qpid.test.framework.TestClientDetails;
 import org.apache.qpid.test.framework.Assertion;
 import org.apache.qpid.test.framework.Circuit;
+import org.apache.qpid.test.framework.TestClientDetails;
 import org.apache.qpid.test.framework.TestUtils;
+import org.apache.qpid.test.framework.distributedcircuit.DistributedCircuitImpl;
 import org.apache.qpid.util.ConversationFactory;
 
 import uk.co.thebadgerset.junit.extensions.util.ParsedProperties;
@@ -35,19 +36,55 @@
 import javax.jms.Message;
 import javax.jms.Session;
 
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Properties;
 
 /**
+ * FanOutCircuitFactory is a circuit factory that creates distributed test circuits. Given a set of participating
+ * test client nodes, it assigns one node to the SENDER role and the remainder to the RECEIVER role.
+ *
  * <p/><table id="crc"><caption>CRC Card</caption>
  * <tr><th> Responsibilities <th> Collaborations
  * <tr><td>
  * </table>
+ *
+ * @todo Adapt this to be an n*m topology circuit factory. Need to add circuit topology definitions to the test
+ *       parameters. Place n senders onto the available test clients, and m receivers. Where n or m is larger than
+ *       the available nodes, start stacking multiple test clients on each node. There will also be an option that
+ *       indicates whether nodes can play both roles, and how many nodes out of all available may be assigned to
+ *       each role.
+ *
+ * @todo The createCircuit methods on this and InteropCircuitFactory are going to be identical. This is because the
+ *       partitioning into senders and receivers is already done by the test decorators. Either eliminate these factories
+ *       as unnesesary, or move the partitioning functionaility into the factories, in which case the test decorators
+ *       can probably be merged or eliminated. There is confusion over the placement of responsibilities between the
+ *       factories and the test decorators... although the test decorators may well do more than just circuit creation
+ *       in the future. For example, there may have to be a special decorator for test repetition that does one circuit
+ *       creation, but the runs many tests over it, in which case the handling of responsibilities becomes clearer.
  */
-public class FanOutTestSequencer extends BaseDistributedTestSequencer
+public class FanOutCircuitFactory extends BaseCircuitFactory
 {
     /** Used for debugging. */
-    Logger log = Logger.getLogger(FanOutTestSequencer.class);
+    Logger log = Logger.getLogger(FanOutCircuitFactory.class);
+
+    /**
+     * Creates a test circuit for the test, configered by the test parameters specified.
+     *
+     * @param testProperties The test parameters.
+     * @return A test circuit.
+     */
+    public Circuit createCircuit(ParsedProperties testProperties)
+    {
+        log.debug("public Circuit createCircuit(ParsedProperties testProperties): called");
+
+        List<TestClientDetails> senders = new LinkedList<TestClientDetails>();
+        senders.add(getSender());
+        List<TestClientDetails> receivers = getReceivers();
+        ConversationFactory conversationFactory = getConversationFactory();
+
+        return DistributedCircuitImpl.createCircuit(testProperties, senders, receivers, conversationFactory);
+    }
 
     /**
      * Holds a test coordinating conversation with the test clients. This should consist of assigning the test roles,
@@ -57,6 +94,8 @@
      * @param testCircuit    The test circuit.
      * @param assertions     The list of assertions to apply to the test circuit.
      * @param testProperties The test case definition.
+     *
+     * @deprecated Scheduled for removal once existing tests converted over to use test circuits.
      */
     public void sequenceTest(Circuit testCircuit, List<Assertion> assertions, Properties testProperties)
     {
@@ -68,7 +107,7 @@
 
         try
         {
-            // Create a conversation on the sender clients private control rouete.
+            // Create a conversation on the sender clients private control route.
             Session session = conversationFactory.getSession();
             Destination senderControlTopic = session.createTopic(sender.privateControlKey);
             ConversationFactory.Conversation senderConversation = conversationFactory.startConversation();
@@ -117,17 +156,6 @@
     }
 
     /**
-     * Creates a test circuit for the test, configered by the test parameters specified.
-     *
-     * @param testProperties The test parameters.
-     * @return A test circuit.
-     */
-    public Circuit createCircuit(ParsedProperties testProperties)
-    {
-        throw new RuntimeException("Not implemented.");
-    }
-
-    /**
      * Assigns the receivers role to the specified test client that is to act as a receivers during the test. This method
      * does not always wait for the receiving clients to confirm their role assignments. This is because this method
      * may be called from an 'onMessage' method, when a client is joining the test at a later point in time, and it
@@ -139,6 +167,8 @@
      * @param confirm        Indicates whether role confirmation should be waited for.
      *
      * @throws JMSException Any JMSExceptions occurring during the conversation are allowed to fall through.
+     *
+     * @deprecated Scheduled for removal once existing tests converted over to use test circuits.
      */
     protected void assignReceiverRole(TestClientDetails receiver, Properties testProperties, boolean confirm)
         throws JMSException

Copied: incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/InteropCircuitFactory.java (from r559458, incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/InteropTestSequencer.java)
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/InteropCircuitFactory.java?view=diff&rev=561855&p1=incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/InteropTestSequencer.java&r1=559458&p2=incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/InteropCircuitFactory.java&r2=561855
==============================================================================
--- incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/InteropTestSequencer.java (original)
+++ incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/InteropCircuitFactory.java Wed Aug  1 09:19:31 2007
@@ -22,10 +22,11 @@
 
 import org.apache.log4j.Logger;
 
-import org.apache.qpid.test.framework.TestClientDetails;
 import org.apache.qpid.test.framework.Assertion;
 import org.apache.qpid.test.framework.Circuit;
+import org.apache.qpid.test.framework.TestClientDetails;
 import org.apache.qpid.test.framework.TestUtils;
+import org.apache.qpid.test.framework.distributedcircuit.DistributedCircuitImpl;
 import org.apache.qpid.util.ConversationFactory;
 
 import uk.co.thebadgerset.junit.extensions.util.ParsedProperties;
@@ -35,6 +36,7 @@
 import javax.jms.Message;
 import javax.jms.Session;
 
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Properties;
 
@@ -44,10 +46,28 @@
  * <tr><td>
  * </table>
  */
-public class InteropTestSequencer extends BaseDistributedTestSequencer
+public class InteropCircuitFactory extends BaseCircuitFactory
 {
     /** Used for debugging. */
-    Logger log = Logger.getLogger(InteropTestSequencer.class);
+    Logger log = Logger.getLogger(InteropCircuitFactory.class);
+
+    /**
+     * Creates a test circuit for the test, configered by the test parameters specified.
+     *
+     * @param testProperties The test parameters.
+     * @return A test circuit.
+     */
+    public Circuit createCircuit(ParsedProperties testProperties)
+    {
+        log.debug("public Circuit createCircuit(ParsedProperties testProperties): called");
+
+        List<TestClientDetails> senders = new LinkedList<TestClientDetails>();
+        senders.add(getSender());
+        List<TestClientDetails> receivers = getReceivers();
+        ConversationFactory conversationFactory = getConversationFactory();
+
+        return DistributedCircuitImpl.createCircuit(testProperties, senders, receivers, conversationFactory);
+    }
 
     /**
      * Holds a test coordinating conversation with the test clients. This should consist of assigning the test roles,
@@ -122,16 +142,5 @@
         {
             throw new RuntimeException("JMSException not handled.");
         }
-    }
-
-    /**
-     * Creates a test circuit for the test, configered by the test parameters specified.
-     *
-     * @param testProperties The test parameters.
-     * @return A test circuit.
-     */
-    public Circuit createCircuit(ParsedProperties testProperties)
-    {
-        throw new RuntimeException("Not implemented.");
     }
 }

Modified: incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/util/ConversationFactory.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/util/ConversationFactory.java?view=diff&rev=561855&r1=561854&r2=561855
==============================================================================
--- incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/util/ConversationFactory.java (original)
+++ incubator/qpid/branches/M2/java/systests/src/main/java/org/apache/qpid/util/ConversationFactory.java Wed Aug  1 09:19:31 2007
@@ -87,7 +87,7 @@
  *
  * <p/>Conversation correlation id's are generated on a per thread basis.
  *
- * <p/>The same session is shared amongst all conversations. Calls to send are therefore synchronized because JMS
+ * <p/>The same controlSession is shared amongst all conversations. Calls to send are therefore synchronized because JMS
  * sessions are not multi-threaded.
  *
  * <p/><table id="crc"><caption>CRC Card</caption>
@@ -108,7 +108,7 @@
     /** Holds the connection over which the conversation is conducted. */
     private Connection connection;
 
-    /** Holds the session over which the conversation is conduxted. */
+    /** Holds the controlSession over which the conversation is conduxted. */
     private Session session;
 
     /** The message consumer for incoming messages. */
@@ -219,9 +219,9 @@
     }
 
     /**
-     * Gets the session over which the conversation is conducted.
+     * Gets the controlSession over which the conversation is conducted.
      *
-     * @return The session over which the conversation is conducted.
+     * @return The controlSession over which the conversation is conducted.
      */
     public Session getSession()
     {



Mime
View raw message