diff options
| author | Robert Greig <rgreig@apache.org> | 2007-02-02 15:09:08 +0000 |
|---|---|---|
| committer | Robert Greig <rgreig@apache.org> | 2007-02-02 15:09:08 +0000 |
| commit | 3393bb42ebc8f802988f98848e64b1bec508c5bb (patch) | |
| tree | 853ed3f15e4c311a97d8ef3781211d0ca6f42440 /java/perftests/src/test | |
| parent | 6aef63d9078abd7f96b79e70ede242fa7056da37 (diff) | |
| download | qpid-python-3393bb42ebc8f802988f98848e64b1bec508c5bb.tar.gz | |
(Submitted by Rupert Smith)
Perftests improved with better timeout handling. Shared/unique destinations to ping now an option.
TestRunner now runs all per-thread setups, synchs all threads, then runs tests, synchas all threads, then runs tear downs.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@502620 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/perftests/src/test')
3 files changed, 55 insertions, 42 deletions
diff --git a/java/perftests/src/test/java/org/apache/qpid/ping/PingAsyncTestPerf.java b/java/perftests/src/test/java/org/apache/qpid/ping/PingAsyncTestPerf.java index 27de27faf3..f61516fc5a 100644 --- a/java/perftests/src/test/java/org/apache/qpid/ping/PingAsyncTestPerf.java +++ b/java/perftests/src/test/java/org/apache/qpid/ping/PingAsyncTestPerf.java @@ -250,14 +250,16 @@ public class PingAsyncTestPerf extends PingTestPerf implements TimingControllerA */ public void onMessage(Message message, int remainingCount) throws JMSException { - _logger.debug("public void onMessage(Message message, int remainingCount = " + remainingCount + "): called"); - // Check if a batch boundary has been crossed. if ((remainingCount % _batchSize) == 0) { // Extract the correlation id from the message. String correlationId = message.getJMSCorrelationID(); + _logger.debug("public void onMessage(Message message, int remainingCount = " + remainingCount + + "): called on batch boundary for message id: " + + correlationId + " with thread id: " + Thread.currentThread().getId()); + // Get the details for the correlation id and check that they are not null. They can become null // if a test times out. PerCorrelationId perCorrelationId = perCorrelationIds.get(correlationId); 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 c4e72f4bb6..0d0df0128e 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 @@ -72,41 +72,40 @@ public class PingTestPerf extends AsymptoticTestCase implements TestThreadAware super(name);
// Sets up the test parameters with defaults.
- ParsedProperties.setSysPropertyIfNull(PingPongProducer.COMMIT_BATCH_SIZE_PROPNAME,
- Integer.toString(PingPongProducer.DEFAULT_TX_BATCH_SIZE));
- ParsedProperties.setSysPropertyIfNull(PingPongProducer.MESSAGE_SIZE_PROPNAME,
- Integer.toString(PingPongProducer.DEFAULT_MESSAGE_SIZE));
- ParsedProperties.setSysPropertyIfNull(PingPongProducer.PING_QUEUE_NAME_PROPNAME,
- PingPongProducer.DEFAULT_PING_DESTINATION_NAME);
- ParsedProperties.setSysPropertyIfNull(PingPongProducer.PERSISTENT_MODE_PROPNAME,
- Boolean.toString(PingPongProducer.DEFAULT_PERSISTENT_MODE));
- ParsedProperties.setSysPropertyIfNull(PingPongProducer.TRANSACTED_PROPNAME,
- Boolean.toString(PingPongProducer.DEFAULT_TRANSACTED));
- ParsedProperties.setSysPropertyIfNull(PingPongProducer.BROKER_PROPNAME, PingPongProducer.DEFAULT_BROKER);
- ParsedProperties.setSysPropertyIfNull(PingPongProducer.USERNAME_PROPNAME, PingPongProducer.DEFAULT_USERNAME);
- ParsedProperties.setSysPropertyIfNull(PingPongProducer.PASSWORD_PROPNAME, PingPongProducer.DEFAULT_PASSWORD);
- ParsedProperties.setSysPropertyIfNull(PingPongProducer.VIRTUAL_PATH_PROPNAME, PingPongProducer.DEFAULT_VIRTUAL_PATH);
- ParsedProperties.setSysPropertyIfNull(PingPongProducer.VERBOSE_OUTPUT_PROPNAME,
- Boolean.toString(PingPongProducer.DEFAULT_VERBOSE));
- ParsedProperties.setSysPropertyIfNull(PingPongProducer.RATE_PROPNAME,
- Integer.toString(PingPongProducer.DEFAULT_RATE));
- ParsedProperties.setSysPropertyIfNull(PingPongProducer.IS_PUBSUB_PROPNAME,
- Boolean.toString(PingPongProducer.DEFAULT_PUBSUB));
- ParsedProperties.setSysPropertyIfNull(PingPongProducer.COMMIT_BATCH_SIZE_PROPNAME,
- Integer.toString(PingPongProducer.DEFAULT_TX_BATCH_SIZE));
- ParsedProperties.setSysPropertyIfNull(PingPongProducer.TIMEOUT_PROPNAME,
- Long.toString(PingPongProducer.DEFAULT_TIMEOUT));
- ParsedProperties.setSysPropertyIfNull(PingPongProducer.PING_DESTINATION_COUNT_PROPNAME,
- Integer.toString(PingPongProducer.DEFAULT_DESTINATION_COUNT));
- ParsedProperties.setSysPropertyIfNull(PingPongProducer.FAIL_AFTER_COMMIT_PROPNAME,
- PingPongProducer.DEFAULT_FAIL_AFTER_COMMIT);
- ParsedProperties.setSysPropertyIfNull(PingPongProducer.FAIL_BEFORE_COMMIT_PROPNAME,
- PingPongProducer.DEFAULT_FAIL_BEFORE_COMMIT);
- ParsedProperties.setSysPropertyIfNull(PingPongProducer.FAIL_AFTER_SEND_PROPNAME,
- PingPongProducer.DEFAULT_FAIL_AFTER_SEND);
- ParsedProperties.setSysPropertyIfNull(PingPongProducer.FAIL_BEFORE_SEND_PROPNAME,
- PingPongProducer.DEFAULT_FAIL_BEFORE_SEND);
- ParsedProperties.setSysPropertyIfNull(PingPongProducer.FAIL_ONCE_PROPNAME, PingPongProducer.DEFAULT_FAIL_ONCE);
+ testParameters.setPropertyIfNull(PingPongProducer.COMMIT_BATCH_SIZE_PROPNAME,
+ Integer.toString(PingPongProducer.DEFAULT_TX_BATCH_SIZE));
+ testParameters.setPropertyIfNull(PingPongProducer.MESSAGE_SIZE_PROPNAME,
+ Integer.toString(PingPongProducer.DEFAULT_MESSAGE_SIZE));
+ testParameters.setPropertyIfNull(PingPongProducer.PING_QUEUE_NAME_PROPNAME,
+ PingPongProducer.DEFAULT_PING_DESTINATION_NAME);
+ testParameters.setPropertyIfNull(PingPongProducer.PERSISTENT_MODE_PROPNAME,
+ Boolean.toString(PingPongProducer.DEFAULT_PERSISTENT_MODE));
+ testParameters.setPropertyIfNull(PingPongProducer.TRANSACTED_PROPNAME,
+ Boolean.toString(PingPongProducer.DEFAULT_TRANSACTED));
+ testParameters.setPropertyIfNull(PingPongProducer.BROKER_PROPNAME, PingPongProducer.DEFAULT_BROKER);
+ testParameters.setPropertyIfNull(PingPongProducer.USERNAME_PROPNAME, PingPongProducer.DEFAULT_USERNAME);
+ testParameters.setPropertyIfNull(PingPongProducer.PASSWORD_PROPNAME, PingPongProducer.DEFAULT_PASSWORD);
+ testParameters.setPropertyIfNull(PingPongProducer.VIRTUAL_PATH_PROPNAME, PingPongProducer.DEFAULT_VIRTUAL_PATH);
+ testParameters.setPropertyIfNull(PingPongProducer.VERBOSE_OUTPUT_PROPNAME,
+ Boolean.toString(PingPongProducer.DEFAULT_VERBOSE));
+ testParameters.setPropertyIfNull(PingPongProducer.RATE_PROPNAME, Integer.toString(PingPongProducer.DEFAULT_RATE));
+ testParameters.setPropertyIfNull(PingPongProducer.IS_PUBSUB_PROPNAME,
+ Boolean.toString(PingPongProducer.DEFAULT_PUBSUB));
+ testParameters.setPropertyIfNull(PingPongProducer.COMMIT_BATCH_SIZE_PROPNAME,
+ Integer.toString(PingPongProducer.DEFAULT_TX_BATCH_SIZE));
+ testParameters.setPropertyIfNull(PingPongProducer.TIMEOUT_PROPNAME, Long.toString(PingPongProducer.DEFAULT_TIMEOUT));
+ testParameters.setPropertyIfNull(PingPongProducer.PING_DESTINATION_COUNT_PROPNAME,
+ Integer.toString(PingPongProducer.DEFAULT_DESTINATION_COUNT));
+ testParameters.setPropertyIfNull(PingPongProducer.FAIL_AFTER_COMMIT_PROPNAME,
+ PingPongProducer.DEFAULT_FAIL_AFTER_COMMIT);
+ testParameters.setPropertyIfNull(PingPongProducer.FAIL_BEFORE_COMMIT_PROPNAME,
+ PingPongProducer.DEFAULT_FAIL_BEFORE_COMMIT);
+ testParameters.setPropertyIfNull(PingPongProducer.FAIL_AFTER_SEND_PROPNAME,
+ PingPongProducer.DEFAULT_FAIL_AFTER_SEND);
+ testParameters.setPropertyIfNull(PingPongProducer.FAIL_BEFORE_SEND_PROPNAME,
+ PingPongProducer.DEFAULT_FAIL_BEFORE_SEND);
+ testParameters.setPropertyIfNull(PingPongProducer.FAIL_ONCE_PROPNAME, PingPongProducer.DEFAULT_FAIL_ONCE);
+ testParameters.setPropertyIfNull(PingPongProducer.UNIQUE_PROPNAME, PingPongProducer.DEFAULT_UNIQUE);
}
/**
@@ -125,11 +124,17 @@ public class PingTestPerf extends AsymptoticTestCase implements TestThreadAware public void testPingOk(int numPings) throws Exception
{
+ if (numPings == 0)
+ {
+ Assert.fail("Number of pings requested was zero.");
+ }
+
// Get the per thread test setup to run the test through.
PerThreadSetup perThreadSetup = threadSetup.get();
- if (numPings == 0)
+
+ if (perThreadSetup == null)
{
- _logger.error("Number of pings requested was zero.");
+ Assert.fail("Could not get per thread test setup, it was null.");
}
// Generate a sample message. This message is already time stamped and has its reply-to destination set.
@@ -182,6 +187,7 @@ public class PingTestPerf extends AsymptoticTestCase implements TestThreadAware boolean failBeforeSend = testParameters.getPropertyAsBoolean(PingPongProducer.FAIL_BEFORE_SEND_PROPNAME);
int batchSize = testParameters.getPropertyAsInteger(PingPongProducer.COMMIT_BATCH_SIZE_PROPNAME);
Boolean failOnce = testParameters.getPropertyAsBoolean(PingPongProducer.FAIL_ONCE_PROPNAME);
+ boolean unique = testParameters.getPropertyAsBoolean(PingPongProducer.UNIQUE_PROPNAME);
// Extract the test set up paramaeters.
int destinationscount =
@@ -195,7 +201,7 @@ public class PingTestPerf extends AsymptoticTestCase implements TestThreadAware perThreadSetup._pingClient = new PingClient(brokerDetails, username, password, virtualPath, destinationName,
selector, transacted, persistent, messageSize, verbose,
failAfterCommit, failBeforeCommit, failAfterSend, failBeforeSend,
- failOnce, batchSize, destinationscount, rate, pubsub);
+ failOnce, batchSize, destinationscount, rate, pubsub, unique);
}
// Start the client connection
perThreadSetup._pingClient.getConnection().start();
@@ -224,7 +230,10 @@ public class PingTestPerf extends AsymptoticTestCase implements TestThreadAware // Close the pingers so that it cleans up its connection cleanly.
synchronized (this)
{
- perThreadSetup._pingClient.close();
+ if ((perThreadSetup != null) && (perThreadSetup._pingClient != null))
+ {
+ perThreadSetup._pingClient.close();
+ }
}
// Ensure the per thread fixture is reclaimed.
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 81967d332a..3a89b1044e 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 @@ -110,6 +110,7 @@ public class PingPongTestPerf extends AsymptoticTestCase ParsedProperties.setSysPropertyIfNull(PingPongProducer.FAIL_BEFORE_SEND_PROPNAME,
PingPongProducer.DEFAULT_FAIL_BEFORE_SEND);
ParsedProperties.setSysPropertyIfNull(PingPongProducer.FAIL_ONCE_PROPNAME, PingPongProducer.DEFAULT_FAIL_ONCE);
+ ParsedProperties.setSysPropertyIfNull(PingPongProducer.UNIQUE_PROPNAME, Boolean.toString(PingPongProducer.DEFAULT_UNIQUE));
}
/**
@@ -186,6 +187,7 @@ public class PingPongTestPerf extends AsymptoticTestCase boolean failBeforeSend = testParameters.getPropertyAsBoolean(PingPongProducer.FAIL_BEFORE_SEND_PROPNAME);
int batchSize = testParameters.getPropertyAsInteger(PingPongProducer.COMMIT_BATCH_SIZE_PROPNAME);
Boolean failOnce = testParameters.getPropertyAsBoolean(PingPongProducer.FAIL_ONCE_PROPNAME);
+ boolean unique = testParameters.getPropertyAsBoolean(PingPongProducer.UNIQUE_PROPNAME);
synchronized (this)
{
@@ -203,7 +205,7 @@ public class PingPongTestPerf extends AsymptoticTestCase destinationName, selector, transacted, persistent,
messageSize, verbose, failAfterCommit,
failBeforeCommit, failAfterSend, failBeforeSend,
- failOnce, batchSize, 0, rate, pubsub);
+ failOnce, batchSize, 0, rate, pubsub, unique);
perThreadSetup._testPingProducer.getConnection().start();
}
|
