From 4fa14823a4110d82c26edcc1aaf0cd9d325a9dd4 Mon Sep 17 00:00:00 2001 From: Robert Greig Date: Wed, 2 May 2007 16:47:36 +0000 Subject: Removed accidentally included copyright and author tags. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@534539 13f79535-47bb-0310-9956-ffa450edef68 --- .../qpid/server/filter/ArithmeticExpression.java | 1 - .../qpid/server/filter/BinaryExpression.java | 1 - .../qpid/server/filter/BooleanExpression.java | 1 - .../qpid/server/filter/ComparisonExpression.java | 1 - .../org/apache/qpid/server/filter/Expression.java | 1 - .../apache/qpid/server/filter/LogicExpression.java | 1 - .../java/org/apache/qpid/sasl/CramMD5Client.java | 2 - .../java/org/apache/qpid/sasl/PlainClient.java | 4 +- .../org/apache/qpid/util/CommandLineParser.java | 4 - .../apache/qpid/util/CommandLineParserTest.java | 216 +++++++++++---------- .../interop/coordinator/CoordinatingTestCase.java | 5 +- .../qpid/interop/coordinator/Coordinator.java | 65 ++++--- .../interop/coordinator/InvitingTestDecorator.java | 32 +-- .../testcases/CoordinatingTestCase2BasicP2P.java | 48 +++++ .../org/apache/qpid/util/ConversationHelper.java | 27 ++- .../org/apache/qpid/ping/PingDurableClient.java | 3 - .../org/apache/qpid/ping/PingSendOnlyClient.java | 13 +- .../java/org/apache/qpid/ping/PingTestPerf.java | 2 - .../apache/qpid/requestreply/PingPongTestPerf.java | 2 - 19 files changed, 236 insertions(+), 193 deletions(-) create mode 100644 java/integrationtests/src/main/java/org/apache/qpid/interop/coordinator/testcases/CoordinatingTestCase2BasicP2P.java (limited to 'java') diff --git a/java/broker/src/main/java/org/apache/qpid/server/filter/ArithmeticExpression.java b/java/broker/src/main/java/org/apache/qpid/server/filter/ArithmeticExpression.java index 138d4155b1..fb5220f4da 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/filter/ArithmeticExpression.java +++ b/java/broker/src/main/java/org/apache/qpid/server/filter/ArithmeticExpression.java @@ -1,4 +1,3 @@ -/* Copyright Rupert Smith, 2005 to 2006, all rights reserved. */ /** * * Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/java/broker/src/main/java/org/apache/qpid/server/filter/BinaryExpression.java b/java/broker/src/main/java/org/apache/qpid/server/filter/BinaryExpression.java index 1a1024bd2b..024257bea9 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/filter/BinaryExpression.java +++ b/java/broker/src/main/java/org/apache/qpid/server/filter/BinaryExpression.java @@ -1,4 +1,3 @@ -/* Copyright Rupert Smith, 2005 to 2006, all rights reserved. */ /** * * Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/java/broker/src/main/java/org/apache/qpid/server/filter/BooleanExpression.java b/java/broker/src/main/java/org/apache/qpid/server/filter/BooleanExpression.java index 0d5c5009f7..e28ff79820 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/filter/BooleanExpression.java +++ b/java/broker/src/main/java/org/apache/qpid/server/filter/BooleanExpression.java @@ -1,4 +1,3 @@ -/* Copyright Rupert Smith, 2005 to 2006, all rights reserved. */ /** * * Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/java/broker/src/main/java/org/apache/qpid/server/filter/ComparisonExpression.java b/java/broker/src/main/java/org/apache/qpid/server/filter/ComparisonExpression.java index 606a59e0fa..72a9ef7969 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/filter/ComparisonExpression.java +++ b/java/broker/src/main/java/org/apache/qpid/server/filter/ComparisonExpression.java @@ -1,4 +1,3 @@ -/* Copyright Rupert Smith, 2005 to 2006, all rights reserved. */ /* * * Licensed to the Apache Software Foundation (ASF) under one diff --git a/java/broker/src/main/java/org/apache/qpid/server/filter/Expression.java b/java/broker/src/main/java/org/apache/qpid/server/filter/Expression.java index cb40a32290..5f646c15db 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/filter/Expression.java +++ b/java/broker/src/main/java/org/apache/qpid/server/filter/Expression.java @@ -1,4 +1,3 @@ -/* Copyright Rupert Smith, 2005 to 2006, all rights reserved. */ /** * * Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/java/broker/src/main/java/org/apache/qpid/server/filter/LogicExpression.java b/java/broker/src/main/java/org/apache/qpid/server/filter/LogicExpression.java index a90775a186..c8cbdb2125 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/filter/LogicExpression.java +++ b/java/broker/src/main/java/org/apache/qpid/server/filter/LogicExpression.java @@ -1,4 +1,3 @@ -/* Copyright Rupert Smith, 2005 to 2006, all rights reserved. */ /** * * Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/java/client-java14/src/main/java/org/apache/qpid/sasl/CramMD5Client.java b/java/client-java14/src/main/java/org/apache/qpid/sasl/CramMD5Client.java index c771df458e..7d15f03329 100644 --- a/java/client-java14/src/main/java/org/apache/qpid/sasl/CramMD5Client.java +++ b/java/client-java14/src/main/java/org/apache/qpid/sasl/CramMD5Client.java @@ -35,8 +35,6 @@ import javax.security.sasl.SaslException; * Concatenate the user id and password hashed by a challenge string as the challenge response. * Ensure password is wiped once a challenge has been processed. * - * - * @author Rupert Smith */ public class CramMD5Client implements SaslClient { diff --git a/java/client-java14/src/main/java/org/apache/qpid/sasl/PlainClient.java b/java/client-java14/src/main/java/org/apache/qpid/sasl/PlainClient.java index 67d00fd7d4..97e607c57e 100644 --- a/java/client-java14/src/main/java/org/apache/qpid/sasl/PlainClient.java +++ b/java/client-java14/src/main/java/org/apache/qpid/sasl/PlainClient.java @@ -32,8 +32,6 @@ import javax.security.sasl.SaslException; * Concatenate the user id and password in plain text as the challenge respose. * Ensure password is wiped once a challenge has been processed. * - * - * @author Rupert Smith */ public class PlainClient implements SaslClient { @@ -124,7 +122,7 @@ public class PlainClient implements SaslClient // Create an array big enough to hold the results. byte[] result = new byte[password.length + authenticationBytes.length + 2 - + ((authorizationBytes == null) ? 0 : authorizationBytes.length)]; + + ((authorizationBytes == null) ? 0 : authorizationBytes.length)]; // Copy the authorization id, authentication id and password into the results. int pos = 0; diff --git a/java/common/src/main/java/org/apache/qpid/util/CommandLineParser.java b/java/common/src/main/java/org/apache/qpid/util/CommandLineParser.java index 9051d6b470..165c912422 100644 --- a/java/common/src/main/java/org/apache/qpid/util/CommandLineParser.java +++ b/java/common/src/main/java/org/apache/qpid/util/CommandLineParser.java @@ -81,8 +81,6 @@ import java.util.regex.*; * Provide a formatted options in force string for a command line. * Allow errors on unknowns behaviour to be turned on or off. * - * - * @author Rupert Smith */ public class CommandLineParser { @@ -644,8 +642,6 @@ public class CommandLineParser * Responsibilities Collaborations * Hold details of a command line option. * - * - * @author Rupert Smith */ protected class CommandLineOption { diff --git a/java/common/src/test/java/org/apache/qpid/util/CommandLineParserTest.java b/java/common/src/test/java/org/apache/qpid/util/CommandLineParserTest.java index 085a724399..c480ce3944 100644 --- a/java/common/src/test/java/org/apache/qpid/util/CommandLineParserTest.java +++ b/java/common/src/test/java/org/apache/qpid/util/CommandLineParserTest.java @@ -1,4 +1,3 @@ -/* Copyright Rupert Smith, 2005 to 2006, all rights reserved. */ package org.apache.qpid.util; import java.util.Properties; @@ -35,8 +34,6 @@ import org.apache.log4j.*; * Check that get options in force returns an empty string before parsing. * Check that get options in force return a non-empty string after parsing. * - * - * @author Rupert Smith */ public class CommandLineParserTest extends TestCase { @@ -70,13 +67,15 @@ public class CommandLineParserTest extends TestCase public void testGetErrorsReturnsEmptyStringOnNoErrors() throws Exception { // Create a command line parser for some flags and options. - CommandLineParser parser = new CommandLineParser(new String[][] - { - { "t1", "Test Flag 1." }, - { "t2", "Test Option 2.", "test" }, - { "t3", "Test Option 3.", "test", "true" }, - { "t4", "Test Option 4.", "test", null, "^test$" } - }); + CommandLineParser parser = + new CommandLineParser( + new String[][] + { + { "t1", "Test Flag 1." }, + { "t2", "Test Option 2.", "test" }, + { "t3", "Test Option 3.", "test", "true" }, + { "t4", "Test Option 4.", "test", null, "^test$" } + }); // Do some legal parsing. parser.parseCommandLine(new String[] { "-t1", "-t2test", "-t3test", "-t4test" }); @@ -89,13 +88,15 @@ public class CommandLineParserTest extends TestCase public void testGetErrorsReturnsStringOnErrors() throws Exception { // Create a command line parser for some flags and options. - CommandLineParser parser = new CommandLineParser(new String[][] - { - { "t1", "Test Flag 1." }, - { "t2", "Test Option 2.", "test" }, - { "t3", "Test Option 3.", "test", "true" }, - { "t4", "Test Option 4.", "test", null, "^test$" } - }); + CommandLineParser parser = + new CommandLineParser( + new String[][] + { + { "t1", "Test Flag 1." }, + { "t2", "Test Option 2.", "test" }, + { "t3", "Test Option 3.", "test", "true" }, + { "t4", "Test Option 4.", "test", null, "^test$" } + }); try { @@ -107,7 +108,7 @@ public class CommandLineParserTest extends TestCase // Check that the get errors message returns a string. assertTrue("The errors method returned an empty string.", - !((parser.getErrors() == null) || "".equals(parser.getErrors()))); + !((parser.getErrors() == null) || "".equals(parser.getErrors()))); } @@ -115,13 +116,15 @@ public class CommandLineParserTest extends TestCase public void testGetOptionsInForceReturnsEmptyStringBeforeParsing() throws Exception { // Create a command line parser for some flags and options. - CommandLineParser parser = new CommandLineParser(new String[][] - { - { "t1", "Test Flag 1." }, - { "t2", "Test Option 2.", "test" }, - { "t3", "Test Option 3.", "test", "true" }, - { "t4", "Test Option 4.", "test", null, "^test$" } - }); + CommandLineParser parser = + new CommandLineParser( + new String[][] + { + { "t1", "Test Flag 1." }, + { "t2", "Test Option 2.", "test" }, + { "t3", "Test Option 3.", "test", "true" }, + { "t4", "Test Option 4.", "test", null, "^test$" } + }); // Check that the options in force method returns an empty string. assertTrue("The options in force method did not return an empty string.", "".equals(parser.getOptionsInForce())); @@ -131,49 +134,55 @@ public class CommandLineParserTest extends TestCase public void testGetOptionsInForceReturnsNonEmptyStringAfterParsing() throws Exception { // Create a command line parser for some flags and options. - CommandLineParser parser = new CommandLineParser(new String[][] - { - { "t1", "Test Flag 1." }, - { "t2", "Test Option 2.", "test" }, - { "t3", "Test Option 3.", "test", "true" }, - { "t4", "Test Option 4.", "test", null, "^test$" } - }); + CommandLineParser parser = + new CommandLineParser( + new String[][] + { + { "t1", "Test Flag 1." }, + { "t2", "Test Option 2.", "test" }, + { "t3", "Test Option 3.", "test", "true" }, + { "t4", "Test Option 4.", "test", null, "^test$" } + }); // Do some parsing. parser.parseCommandLine(new String[] { "-t1", "-t2test", "-t3test", "-t4test" }); // Check that the options in force method returns a string. assertTrue("The options in force method did not return a non empty string.", - !((parser.getOptionsInForce() == null) || "".equals(parser.getOptionsInForce()))); + !((parser.getOptionsInForce() == null) || "".equals(parser.getOptionsInForce()))); } /** Check that get usage returns a string. */ public void testGetUsageReturnsString() throws Exception { // Create a command line parser for some flags and options. - CommandLineParser parser = new CommandLineParser(new String[][] - { - { "t1", "Test Flag 1." }, - { "t2", "Test Option 2.", "test" }, - { "t3", "Test Option 3.", "test", "true" }, - { "t4", "Test Option 4.", "test", null, "^test$" } - }); + CommandLineParser parser = + new CommandLineParser( + new String[][] + { + { "t1", "Test Flag 1." }, + { "t2", "Test Option 2.", "test" }, + { "t3", "Test Option 3.", "test", "true" }, + { "t4", "Test Option 4.", "test", null, "^test$" } + }); // Check that the usage method returns a string. assertTrue("The usage method did not return a non empty string.", - !((parser.getUsage() == null) || "".equals(parser.getUsage()))); + !((parser.getUsage() == null) || "".equals(parser.getUsage()))); } /** Check that parsing multiple flags condensed together works ok. */ public void testParseCondensedFlagsOk() throws Exception { // Create a command line parser for multiple flags. - CommandLineParser parser = new CommandLineParser(new String[][] - { - { "t1", "Test Flag 1." }, - { "t2", "Test Flag 2." }, - { "t3", "Test Flag 3." } - }); + CommandLineParser parser = + new CommandLineParser( + new String[][] + { + { "t1", "Test Flag 1." }, + { "t2", "Test Flag 2." }, + { "t3", "Test Flag 3." } + }); // Parse a command line with the flags set and condensed together. Properties testProps = parser.parseCommandLine(new String[] { "-t1t2t3" }); @@ -188,11 +197,12 @@ public class CommandLineParserTest extends TestCase public void testParseFlagCondensedWithOptionFails() throws Exception { // Create a command line parser for a flag and an option. - CommandLineParser parser = new CommandLineParser(new String[][] - { - { "t1", "Test Flag 1." }, - { "t2", "Test Option 2.", "test" } - }); + CommandLineParser parser = + new CommandLineParser(new String[][] + { + { "t1", "Test Flag 1." }, + { "t2", "Test Option 2.", "test" } + }); // Check that the parser reports an error. boolean testPassed = false; @@ -214,10 +224,11 @@ public class CommandLineParserTest extends TestCase public void testParseFormattedFreeArgumentFailsBadArgument() throws Exception { // Create a command line parser for a formatted free argument. - CommandLineParser parser = new CommandLineParser(new String[][] - { - { "1", "Test Free Argument.", "test", null, "^test$" } - }); + CommandLineParser parser = + new CommandLineParser(new String[][] + { + { "1", "Test Free Argument.", "test", null, "^test$" } + }); // Check that the parser signals an error for a badly formatted argument. boolean testPassed = false; @@ -239,17 +250,18 @@ public class CommandLineParserTest extends TestCase public void testParseFormattedFreeArgumentOk() throws Exception { // Create a command line parser for a formatted free argument. - CommandLineParser parser = new CommandLineParser(new String[][] - { - { "1", "Test Free Argument.", "test", null, "^test$" } - }); + CommandLineParser parser = + new CommandLineParser(new String[][] + { + { "1", "Test Free Argument.", "test", null, "^test$" } + }); // Parse a command line with this argument set correctly. Properties testProps = parser.parseCommandLine(new String[] { "test" }); // Check that the resultant properties contains the correctly parsed option. assertTrue("The first free argument was not equal to \"test\" but was: " + testProps.get("1"), - "test".equals(testProps.get("1"))); + "test".equals(testProps.get("1"))); } /** Check that parsing an option with specific argument format fails on bad argument. */ @@ -257,9 +269,9 @@ public class CommandLineParserTest extends TestCase { // Create a command line parser for a formatted option. CommandLineParser parser = new CommandLineParser(new String[][] - { - { "t", "Test Option.", "test", null, "^test$" } - }); + { + { "t", "Test Option.", "test", null, "^test$" } + }); // Check that the parser signals an error for a badly formatted argument. boolean testPassed = false; @@ -282,15 +294,16 @@ public class CommandLineParserTest extends TestCase { // Create a command line parser for a formatted option. CommandLineParser parser = new CommandLineParser(new String[][] - { - { "t", "Test Option.", "test", null, "^test$" } - }); + { + { "t", "Test Option.", "test", null, "^test$" } + }); // Parse a command line with this option set correctly. Properties testProps = parser.parseCommandLine(new String[] { "-t", "test" }); // Check that the resultant properties contains the correctly parsed option. - assertTrue("The test option was not equal to \"test\" but was: " + testProps.get("t"), "test".equals(testProps.get("t"))); + assertTrue("The test option was not equal to \"test\" but was: " + testProps.get("t"), + "test".equals(testProps.get("t"))); } /** Check that parsing a free argument works ok. */ @@ -298,16 +311,16 @@ public class CommandLineParserTest extends TestCase { // Create a command line parser for a free argument. CommandLineParser parser = new CommandLineParser(new String[][] - { - { "1", "Test Free Argument.", "test" } - }); + { + { "1", "Test Free Argument.", "test" } + }); // Parse a command line with this argument set. Properties testProps = parser.parseCommandLine(new String[] { "test" }); // Check that the resultant properties contains the correctly parsed option. assertTrue("The first free argument was not equal to \"test\" but was: " + testProps.get("1"), - "test".equals(testProps.get("1"))); + "test".equals(testProps.get("1"))); } /** Check that parsing a mandatory option works ok. */ @@ -315,15 +328,16 @@ public class CommandLineParserTest extends TestCase { // Create a command line parser for a mandatory option. CommandLineParser parser = new CommandLineParser(new String[][] - { - { "t", "Test Option.", "test", "true" } - }); + { + { "t", "Test Option.", "test", "true" } + }); // Parse a command line with this option set correctly. Properties testProps = parser.parseCommandLine(new String[] { "-t", "test" }); // Check that the resultant properties contains the correctly parsed option. - assertTrue("The test option was not equal to \"test\" but was: " + testProps.get("t"), "test".equals(testProps.get("t"))); + assertTrue("The test option was not equal to \"test\" but was: " + testProps.get("t"), + "test".equals(testProps.get("t"))); } /** Check that parsing a mandatory free argument works ok. */ @@ -331,16 +345,16 @@ public class CommandLineParserTest extends TestCase { // Create a command line parser for a mandatory free argument. CommandLineParser parser = new CommandLineParser(new String[][] - { - { "1", "Test Option.", "test", "true" } - }); + { + { "1", "Test Option.", "test", "true" } + }); // Parse a command line with this argument set. Properties testProps = parser.parseCommandLine(new String[] { "test" }); // Check that the resultant properties contains the correctly parsed option. assertTrue("The first free argument was not equal to \"test\" but was: " + testProps.get("1"), - "test".equals(testProps.get("1"))); + "test".equals(testProps.get("1"))); } /** Check that parsing a mandatory free argument fails when no argument is specified. */ @@ -348,9 +362,9 @@ public class CommandLineParserTest extends TestCase { // Create a command line parser for a mandatory free argument. CommandLineParser parser = new CommandLineParser(new String[][] - { - { "1", "Test Option.", "test", "true" } - }); + { + { "1", "Test Option.", "test", "true" } + }); // Check that parsing fails when this mandatory free argument is missing. boolean testPassed = false; @@ -374,9 +388,9 @@ public class CommandLineParserTest extends TestCase { // Create a command line parser for a mandatory option. CommandLineParser parser = new CommandLineParser(new String[][] - { - { "t", "Test Option.", "test", "true" } - }); + { + { "t", "Test Option.", "test", "true" } + }); // Check that parsing fails when this mandatory option is missing. boolean testPassed = false; @@ -400,15 +414,16 @@ public class CommandLineParserTest extends TestCase { // Create a command line parser for an option. CommandLineParser parser = new CommandLineParser(new String[][] - { - { "t", "Test Option.", "test" } - }); + { + { "t", "Test Option.", "test" } + }); // Parse a command line with this option set with no space. Properties testProps = parser.parseCommandLine(new String[] { "-ttest" }); // Check that the resultant properties contains the correctly parsed option. - assertTrue("The test option was not equal to \"test\" but was: " + testProps.get("t"), "test".equals(testProps.get("t"))); + assertTrue("The test option was not equal to \"test\" but was: " + testProps.get("t"), + "test".equals(testProps.get("t"))); } /** Check that parsing an option with a space between it and its argument works ok. */ @@ -416,15 +431,16 @@ public class CommandLineParserTest extends TestCase { // Create a command line parser for an option. CommandLineParser parser = new CommandLineParser(new String[][] - { - { "t", "Test Option.", "test" } - }); + { + { "t", "Test Option.", "test" } + }); // Parse a command line with this option set with a space. Properties testProps = parser.parseCommandLine(new String[] { "-t", "test" }); // Check that the resultant properties contains the correctly parsed option. - assertTrue("The test option was not equal to \"test\" but was: " + testProps.get("t"), "test".equals(testProps.get("t"))); + assertTrue("The test option was not equal to \"test\" but was: " + testProps.get("t"), + "test".equals(testProps.get("t"))); } /** Check that parsing a single flag works ok. */ @@ -432,9 +448,9 @@ public class CommandLineParserTest extends TestCase { // Create a command line parser for a single flag. CommandLineParser parser = new CommandLineParser(new String[][] - { - { "t", "Test Flag." } - }); + { + { "t", "Test Flag." } + }); // Parse a command line with the single flag set. Properties testProps = parser.parseCommandLine(new String[] { "-t" }); @@ -490,7 +506,8 @@ public class CommandLineParserTest extends TestCase testPassed = true; } - assertTrue("IllegalArgumentException not thrown for an unknown flag when errors on unknowns mode is on.", testPassed); + assertTrue("IllegalArgumentException not thrown for an unknown flag when errors on unknowns mode is on.", + testPassed); } /** Check that parsing an unknown option fails when unknowns are to be reported as errors. */ @@ -514,7 +531,8 @@ public class CommandLineParserTest extends TestCase testPassed = true; } - assertTrue("IllegalArgumentException not thrown for an unknown option when errors on unknowns mode is on.", testPassed); + assertTrue("IllegalArgumentException not thrown for an unknown option when errors on unknowns mode is on.", + testPassed); } protected void tearDown() throws Exception diff --git a/java/integrationtests/src/main/java/org/apache/qpid/interop/coordinator/CoordinatingTestCase.java b/java/integrationtests/src/main/java/org/apache/qpid/interop/coordinator/CoordinatingTestCase.java index f2c0acbc16..36c270ef11 100644 --- a/java/integrationtests/src/main/java/org/apache/qpid/interop/coordinator/CoordinatingTestCase.java +++ b/java/integrationtests/src/main/java/org/apache/qpid/interop/coordinator/CoordinatingTestCase.java @@ -1,3 +1,4 @@ +/* Copyright Rupert Smith, 2005 to 2006, all rights reserved. */ /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -125,7 +126,7 @@ public abstract class CoordinatingTestCase extends TestCase /** * Holds a test coordinating conversation with the test clients. This is the basic implementation of the inner - * loop of Use Case 5. It consists of assign the test roles, begining the test and gathering the test reports + * loop of Use Case 5. It consists of assigning the test roles, begining the test and gathering the test reports * from the participants. * * @param testProperties The test case definition. @@ -134,7 +135,7 @@ public abstract class CoordinatingTestCase extends TestCase * * @throws JMSException All underlying JMSExceptions are allowed to fall through. */ - protected Object[] sequenceTest(Properties testProperties) throws JMSException + protected Message[] sequenceTest(Properties testProperties) throws JMSException { // Assign the sender role to the sending test client. Message assignSender = conversation.getSession().createMessage(); diff --git a/java/integrationtests/src/main/java/org/apache/qpid/interop/coordinator/Coordinator.java b/java/integrationtests/src/main/java/org/apache/qpid/interop/coordinator/Coordinator.java index 3f87becc3d..5e0f5b4941 100644 --- a/java/integrationtests/src/main/java/org/apache/qpid/interop/coordinator/Coordinator.java +++ b/java/integrationtests/src/main/java/org/apache/qpid/interop/coordinator/Coordinator.java @@ -31,8 +31,11 @@ import junit.framework.TestSuite; import org.apache.log4j.Logger; +import org.apache.qpid.interop.coordinator.testcases.CoordinatingTestCase2BasicP2P; import org.apache.qpid.interop.testclient.InteropClientTestCase; import org.apache.qpid.interop.testclient.TestClient; +import org.apache.qpid.interop.testclient.testcases.TestCase1DummyRun; +import org.apache.qpid.interop.testclient.testcases.TestCase2BasicP2P; import org.apache.qpid.util.ClasspathScanner; import org.apache.qpid.util.CommandLineParser; import org.apache.qpid.util.ConversationHelper; @@ -69,6 +72,10 @@ public class Coordinator extends TestRunnerImprovedErrorHandling /** Holds the list of all clients that enlisted, when the compulsory invite was issued. */ Set enlistedClients = new HashSet(); + /** Holds the conversation helper for the control conversation. */ + private ConversationHelper conversation; + private Connection connection; + /** * Creates an interop test coordinator on the specified broker and virtual host. * @@ -99,39 +106,34 @@ public class Coordinator extends TestRunnerImprovedErrorHandling { try { - // Use the command line parser to evaluate the command line. - CommandLineParser commandLine = - new CommandLineParser(new String[][] - { - { "b", "The broker URL.", "broker", "false" }, - { "h", "The virtual host to use.", "virtual host", "false" } - }); - - // Capture the command line arguments or display errors and correct usage and then exit. - Properties options = null; - - try - { - options = commandLine.parseCommandLine(args); - } - catch (IllegalArgumentException e) - { - System.out.println(commandLine.getErrors()); - System.out.println(commandLine.getUsage()); - System.exit(1); - } + // Use the command line parser to evaluate the command line with standard handling behaviour (print errors + // and usage then exist if there are errors). + Properties options = + CommandLineParser.processCommandLine(args, + new CommandLineParser( + new String[][] + { + { "b", "The broker URL.", "broker", "false" }, + { "h", "The virtual host to use.", "virtual host", "false" } + })); // Extract the command line options. String brokerUrl = options.getProperty("b"); String virtualHost = options.getProperty("h"); - // Add all the trailing command line options (name=value pairs) to system properties. Tests may pick up - // overridden values from there. - commandLine.addCommandLineToSysProperties(); - // Scan for available test cases using a classpath scanner. Collection> testCaseClasses = - ClasspathScanner.getMatches(CoordinatingTestCase.class, "^Test.*", true); + new ArrayList>(); + // ClasspathScanner.getMatches(CoordinatingTestCase.class, "^Test.*", true); + // Hard code the test classes till the classpath scanner is fixed. + Collections.addAll(testCaseClasses, new Class[] { CoordinatingTestCase2BasicP2P.class }); + + // Check that some test classes were actually found. + if ((testCaseClasses == null) || testCaseClasses.isEmpty()) + { + throw new RuntimeException( + "No test classes implementing CoordinatingTestCase were found on the class path."); + } int i = 0; String[] testClassNames = new String[testCaseClasses.size()]; @@ -174,17 +176,16 @@ public class Coordinator extends TestRunnerImprovedErrorHandling public TestResult start(String[] testClassNames) throws Exception { log.debug("public TestResult start(String[] testClassNames = " + PrettyPrintingUtils.printArray(testClassNames) - + "): called"); + + "): called"); // Connect to the broker. - Connection connection = TestClient.createConnection(DEFAULT_CONNECTION_PROPS_RESOURCE, brokerUrl, virtualHost); + connection = TestClient.createConnection(DEFAULT_CONNECTION_PROPS_RESOURCE, brokerUrl, virtualHost); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Destination controlTopic = session.createTopic("iop.control"); Destination responseQueue = session.createQueue("coordinator"); - ConversationHelper conversation = - new ConversationHelper(connection, controlTopic, responseQueue, LinkedBlockingQueue.class); + conversation = new ConversationHelper(connection, controlTopic, responseQueue, LinkedBlockingQueue.class); // Broadcast the compulsory invitation to find out what clients are available to test. Message invite = session.createMessage(); @@ -222,7 +223,7 @@ public class Coordinator extends TestRunnerImprovedErrorHandling public static Set extractEnlists(Collection enlists) throws JMSException { log.debug("public static Set extractEnlists(Collection enlists = " + enlists - + "): called"); + + "): called"); Set enlistedClients = new HashSet(); @@ -282,7 +283,7 @@ public class Coordinator extends TestRunnerImprovedErrorHandling } // Wrap the tests in an inviting test decorator, to perform the invite/test cycle. - targetTest = new InvitingTestDecorator(targetTest, enlistedClients); + targetTest = new InvitingTestDecorator(targetTest, enlistedClients, conversation); return super.doRun(targetTest, wait); } diff --git a/java/integrationtests/src/main/java/org/apache/qpid/interop/coordinator/InvitingTestDecorator.java b/java/integrationtests/src/main/java/org/apache/qpid/interop/coordinator/InvitingTestDecorator.java index 64770be654..2975082631 100644 --- a/java/integrationtests/src/main/java/org/apache/qpid/interop/coordinator/InvitingTestDecorator.java +++ b/java/integrationtests/src/main/java/org/apache/qpid/interop/coordinator/InvitingTestDecorator.java @@ -21,6 +21,7 @@ package org.apache.qpid.interop.coordinator; import java.util.*; +import java.util.concurrent.LinkedBlockingQueue; import javax.jms.JMSException; import javax.jms.Message; @@ -47,34 +48,33 @@ public class InvitingTestDecorator extends WrappedSuiteTestDecorator { private static final Logger log = Logger.getLogger(InvitingTestDecorator.class); + /** Holds the contact information for all test clients that are available and that may take part in the test. */ Set allClients; + + /** Holds the conversation helper for the control level conversation for coordinating the test through. */ ConversationHelper conversation; + /** Holds the underlying {@link CoordinatingTestCase}s that this decorator wraps. */ WrappedSuiteTestDecorator testSuite; - /** - * Creates a wrappred suite test decorator from a test suite. - * - * @param suite The test suite. - * @param allClients The list of all clients that responded to the compulsory invite. - */ - /*public InvitingTestDecorator(TestSuite suite, Collection allClients, ConversationHelper conversation) - { - super(suite); - }*/ - /** * Creates a wrapped suite test decorator from another one. * - * @param suite The test suite. - * @param allClients The list of all clients that responded to the compulsory invite. + * @param suite The test suite. + * @param availableClients The list of all clients that responded to the compulsory invite. + * @param controlConversation The conversation helper for the control level, test coordination conversation. */ - public InvitingTestDecorator(WrappedSuiteTestDecorator suite, Set allClients) + public InvitingTestDecorator(WrappedSuiteTestDecorator suite, Set availableClients, + ConversationHelper controlConversation) { super(suite); log.debug("public InvitingTestDecorator(WrappedSuiteTestDecorator suite, Set allClients = " - + allClients + "): called"); + + availableClients + ", ConversationHelper controlConversation = " + controlConversation + "): called"); + + testSuite = suite; + allClients = availableClients; + conversation = controlConversation; } /** @@ -127,7 +127,7 @@ public class InvitingTestDecorator extends WrappedSuiteTestDecorator for (List failPair : failPairs) { - CoordinatingTestCase failTest = new OptOutTestCase(""); + CoordinatingTestCase failTest = new OptOutTestCase("testOptOut"); failTest.setSender(failPair.get(0)); failTest.setReceiver(failPair.get(1)); diff --git a/java/integrationtests/src/main/java/org/apache/qpid/interop/coordinator/testcases/CoordinatingTestCase2BasicP2P.java b/java/integrationtests/src/main/java/org/apache/qpid/interop/coordinator/testcases/CoordinatingTestCase2BasicP2P.java new file mode 100644 index 0000000000..4fb9729c4a --- /dev/null +++ b/java/integrationtests/src/main/java/org/apache/qpid/interop/coordinator/testcases/CoordinatingTestCase2BasicP2P.java @@ -0,0 +1,48 @@ +package org.apache.qpid.interop.coordinator.testcases; + +import java.util.Properties; + +import javax.jms.Message; + +import junit.framework.Assert; + +import org.apache.qpid.interop.coordinator.CoordinatingTestCase; + +/** + *

+ *
CRC Card
Responsibilities Collaborations + *
Setup p2p test parameters and compare with test output. {@link CoordinatingTestCase} + *
+ */ +public class CoordinatingTestCase2BasicP2P extends CoordinatingTestCase +{ + /** + * Creates a new coordinating test case with the specified name. + * + * @param name The test case name. + */ + public CoordinatingTestCase2BasicP2P(String name) + { + super(name); + } + + /** + * Performs the basic P2P test case, "Test Case 2" in the specification. + */ + public void testBasicP2P() throws Exception + { + Properties testConfig = new Properties(); + testConfig.setProperty("TEST_CASE", "TC2_BasicP2P"); + testConfig.setProperty("P2P_QUEUE_AND_KEY_NAME", "tc2queue"); + testConfig.setProperty("P2P_NUM_MESSAGES", "50"); + + Message[] reports = sequenceTest(testConfig); + + // Compare sender and receiver reports. + int messagesSent = reports[0].getIntProperty("MESSAGE_COUNT"); + int messagesReceived = reports[1].getIntProperty("MESSAGE_COUNT"); + + Assert.assertEquals("The requested number of messages were not sent.", 50, messagesSent); + Assert.assertEquals("Sender and receiver messages sent did not match up.", messagesSent, messagesReceived); + } +} diff --git a/java/integrationtests/src/main/java/org/apache/qpid/util/ConversationHelper.java b/java/integrationtests/src/main/java/org/apache/qpid/util/ConversationHelper.java index 9b0bc07ba9..1fd1fee377 100644 --- a/java/integrationtests/src/main/java/org/apache/qpid/util/ConversationHelper.java +++ b/java/integrationtests/src/main/java/org/apache/qpid/util/ConversationHelper.java @@ -31,19 +31,16 @@ import javax.jms.*; * A conversation helper, uses a message correlation id pattern to match up sent and received messages as a conversation * over JMS messaging. Incoming message traffic is divided up by correlation id. Each id has a queue (behaviour dependant * on the queue implementation). Clients of this de-multiplexer can wait on messages, defined by message correlation ids. - * The correlating listener is a message listener, and can therefore be attached to a MessageConsumer which is consuming - * from a queue or topic. * - *

One use of the correlating listener is to act as a conversation synchronizer where multiple threads are carrying - * out conversations over a multiplexed messaging route. This can be usefull, as JMS sessions are not multi-threaded. - * Setting up the correlating listener with synchronous queues will allow these threads to be written in a synchronous - * style, but with their execution order governed by the asynchronous message flow. For example, something like the - * following code could run a multi-threaded conversation (the conversation methods can be called many times in - * parallel): + *

One use of this is as a conversation synchronizer where multiple threads are carrying out conversations over a + * multiplexed messaging route. This can be usefull, as JMS sessions are not multi-threaded. Setting up the conversation + * with synchronous queues will allow these threads to be written in a synchronous style, but with their execution order + * governed by the asynchronous message flow. For example, something like the following code could run a multi-threaded + * conversation (the conversation methods can be called many times in parallel): * *

- * MessageListener conversation = new ConversationHelper(java.util.concurrent.LinkedBlockingQueue.class),
- *                                                       sendDesitination, replyDestination);
+ * ConversationHelper conversation = new ConversationHelper(connection, sendDesitination, replyDestination,
+ *                                                          java.util.concurrent.LinkedBlockingQueue.class);
  *
  * initiateConversation()
  * {
@@ -79,9 +76,9 @@ import javax.jms.*;
  *
  * 

*
CRC Card
Responsibilities Collaborations - *
Associate messages to a conversation using correlation ids. + *
Associate messages to an ongoing conversation using correlation ids. *
Auto manage sessions for conversations. - *
Store messages not in conversation in dead letter box. + *
Store messages not in a conversation in dead letter box. *
* * @todo Non-transactional, can use shared session. Transactional, must have session per-thread. Session pool? In @@ -91,9 +88,9 @@ import javax.jms.*; * to restrict receives on that session to prevent it picking up messages bound for other conversations. Or use * a temporary response queue, with only that session listening to it. * - * @todo Want something convenient that hides many details. Write out some example use cases to get the best feel for + * @todo Want something convenient that hides details. Write out some example use cases to get the best feel for * it. Pass in connection, send destination, receive destination. Provide endConvo, send, receive - * methods. Bind corrId, session etc. on thread locals. Clean on endConvo. Provide deadLetter box, that + * methods. Bind corrId, session etc. on thread locals? Clean on endConvo. Provide deadLetter box, that * uncorrelated or late messages go in. Provide time-out on wait methods, and global time-out. * PingPongProducer provides a good use-case example (sends messages, waits for replies). * @@ -139,7 +136,7 @@ public class ConversationHelper * @throws JMSException All undelying JMSExceptions are allowed to fall through. */ public ConversationHelper(Connection connection, Destination sendDestination, Destination receiveDestination, - Class queueClass) throws JMSException + Class queueClass) throws JMSException { session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); producer = session.createProducer(sendDestination); diff --git a/java/perftests/src/main/java/org/apache/qpid/ping/PingDurableClient.java b/java/perftests/src/main/java/org/apache/qpid/ping/PingDurableClient.java index 0e832ef100..2765986868 100644 --- a/java/perftests/src/main/java/org/apache/qpid/ping/PingDurableClient.java +++ b/java/perftests/src/main/java/org/apache/qpid/ping/PingDurableClient.java @@ -1,4 +1,3 @@ -/* Copyright Rupert Smith, 2005 to 2006, all rights reserved. */ /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -304,8 +303,6 @@ public class PingDurableClient extends PingPongProducer implements ExceptionList System.out.println("Messages sent: " + messagesSent + ", Messages Committed = " + messagesCommitted + ", Messages not Committed = " + messagesNotCommitted); - - return messagesSent; } diff --git a/java/perftests/src/main/java/org/apache/qpid/ping/PingSendOnlyClient.java b/java/perftests/src/main/java/org/apache/qpid/ping/PingSendOnlyClient.java index 29757a20ba..ed0ac49ef9 100644 --- a/java/perftests/src/main/java/org/apache/qpid/ping/PingSendOnlyClient.java +++ b/java/perftests/src/main/java/org/apache/qpid/ping/PingSendOnlyClient.java @@ -1,17 +1,16 @@ -/* Copyright Rupert Smith, 2005 to 2006, all rights reserved. */ package org.apache.qpid.ping; import java.util.Properties; -import org.apache.log4j.Logger; - -import org.apache.qpid.util.CommandLineParser; -import org.apache.qpid.client.message.TestMessageFactory; - -import javax.jms.ObjectMessage; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.Message; +import javax.jms.ObjectMessage; + +import org.apache.log4j.Logger; + +import org.apache.qpid.client.message.TestMessageFactory; +import org.apache.qpid.util.CommandLineParser; /** *

diff --git a/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java b/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java index 6e8bf65198..248034af9b 100644 --- a/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java +++ b/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java @@ -55,8 +55,6 @@ import uk.co.thebadgerset.junit.extensions.util.TestContextProperties; *

CRC Card
*
CRC Card
Responsibilities Collaborations *
- * - * @author Rupert Smith */ public class PingTestPerf extends AsymptoticTestCase implements TestThreadAware { diff --git a/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java b/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java index 9a9f9ba6b5..f4a6dc6554 100644 --- a/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java +++ b/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java @@ -55,8 +55,6 @@ import uk.co.thebadgerset.junit.extensions.util.TestContextProperties; *

*
CRC Card
Responsibilities Collaborations *
- * - * @author Rupert Smith */ public class PingPongTestPerf extends AsymptoticTestCase { -- cgit v1.2.1