summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorRupert Smith <rupertlssmith@apache.org>2007-10-02 10:00:35 +0000
committerRupert Smith <rupertlssmith@apache.org>2007-10-02 10:00:35 +0000
commit61ec67bde802657ef173482e4409685bcc61a3f9 (patch)
tree0ca631ae4ac3962951fc2b3d8b304f448163b3bb /java
parent2ed6c3f489f3bf740d1641400037b644c132b75a (diff)
downloadqpid-python-61ec67bde802657ef173482e4409685bcc61a3f9.tar.gz
Fixed broken build by updating junit-toolkit references.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@581176 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r--java/perftests/distribution/pom.xml4
-rw-r--r--java/pom.xml2
-rw-r--r--java/systests/src/main/java/org/apache/qpid/test/framework/TestUtils.java47
-rw-r--r--java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/Coordinator.java101
-rw-r--r--java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalCircuitImpl.java2
5 files changed, 44 insertions, 112 deletions
diff --git a/java/perftests/distribution/pom.xml b/java/perftests/distribution/pom.xml
index de6497b5b8..c0e81ce3f5 100644
--- a/java/perftests/distribution/pom.xml
+++ b/java/perftests/distribution/pom.xml
@@ -56,13 +56,13 @@
<dependency>
<groupId>uk.co.thebadgerset</groupId>
<artifactId>junit-toolkit</artifactId>
- <version>0.5</version>
+ <version>0.6-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>uk.co.thebadgerset</groupId>
<artifactId>junit-toolkit-maven-plugin</artifactId>
- <version>0.5</version>
+ <version>0.6-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
</dependencies>
diff --git a/java/pom.xml b/java/pom.xml
index 4bfb23dad6..6702a21623 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -399,7 +399,7 @@ under the License.
<plugin>
<groupId>uk.co.thebadgerset</groupId>
<artifactId>junit-toolkit-maven-plugin</artifactId>
- <version>0.5</version>
+ <version>0.6-SNAPSHOT</version>
</plugin>
<!-- Disabled as plugin crashes on the systest module.
diff --git a/java/systests/src/main/java/org/apache/qpid/test/framework/TestUtils.java b/java/systests/src/main/java/org/apache/qpid/test/framework/TestUtils.java
index 7219d0c2da..c855ee21fa 100644
--- a/java/systests/src/main/java/org/apache/qpid/test/framework/TestUtils.java
+++ b/java/systests/src/main/java/org/apache/qpid/test/framework/TestUtils.java
@@ -26,16 +26,13 @@ import static org.apache.qpid.test.framework.MessagingTestConfigProperties.*;
import uk.co.thebadgerset.junit.extensions.util.ParsedProperties;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.Message;
+import javax.jms.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
-import java.util.Properties;
import java.util.Map;
+import java.util.Properties;
/**
* TestUtils provides static helper methods that are usefull for writing tests against QPid.
@@ -51,6 +48,10 @@ public class TestUtils
/** Used for debugging. */
private static Logger log = Logger.getLogger(TestUtils.class);
+ private static byte[] MESSAGE_DATA_BYTES =
+ "Test Message -- Test Message -- Test Message -- Test Message -- Test Message -- Test Message -- Test Message -- "
+ .getBytes();
+
/**
* Establishes a JMS connection using a set of properties and qpids built in JNDI implementation. This is a simple
* convenience method for code that does not anticipate handling connection failures. All exceptions that indicate
@@ -96,9 +97,8 @@ public class TestUtils
Context ctx = new InitialContext(messagingProps);
ConnectionFactory cf = (ConnectionFactory) ctx.lookup(CONNECTION_NAME);
- Connection connection = cf.createConnection();
- return connection;
+ return cf.createConnection();
}
catch (NamingException e)
{
@@ -111,6 +111,39 @@ public class TestUtils
}
/**
+ * Creates a test message of the specified size, on the given JMS session.
+ *
+ * @param session The JMS session.
+ * @param size The size of the message in bytes.
+ *
+ * @return A bytes message, of the specified size, filled with dummy data.
+ *
+ *
+ */
+ public static Message createTestMessageOfSize(Session session, int size) throws JMSException
+ {
+ BytesMessage message = session.createBytesMessage();
+
+ if (size > 0)
+ {
+ int div = MESSAGE_DATA_BYTES.length / size;
+ int mod = MESSAGE_DATA_BYTES.length % size;
+
+ for (int i = 0; i < div; i++)
+ {
+ message.writeBytes(MESSAGE_DATA_BYTES);
+ }
+
+ if (mod != 0)
+ {
+ message.writeBytes(MESSAGE_DATA_BYTES, 0, mod);
+ }
+ }
+
+ return message;
+ }
+
+ /**
* Pauses for the specified length of time. In the event of failing to pause for at least that length of time
* due to interuption of the thread, a RutimeException is raised to indicate the failure. The interupted status
* of the thread is restores in that case. This method should only be used when it is expected that the pause
diff --git a/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/Coordinator.java b/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/Coordinator.java
index 15c22fa323..f79cde9dcc 100644
--- a/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/Coordinator.java
+++ b/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/Coordinator.java
@@ -32,14 +32,11 @@ import org.apache.qpid.test.framework.MessagingTestConfigProperties;
import org.apache.qpid.test.framework.TestClientDetails;
import org.apache.qpid.test.framework.TestUtils;
import org.apache.qpid.test.framework.clocksynch.UDPClockReference;
-import org.apache.qpid.test.framework.listeners.XMLTestListener;
import org.apache.qpid.util.ConversationFactory;
import org.apache.qpid.util.PrettyPrintingUtils;
-import uk.co.thebadgerset.junit.extensions.TKTestResult;
import uk.co.thebadgerset.junit.extensions.TKTestRunner;
import uk.co.thebadgerset.junit.extensions.WrappedSuiteTestDecorator;
-import uk.co.thebadgerset.junit.extensions.listeners.CSVTestListener;
import uk.co.thebadgerset.junit.extensions.util.CommandLineParser;
import uk.co.thebadgerset.junit.extensions.util.MathUtils;
import uk.co.thebadgerset.junit.extensions.util.ParsedProperties;
@@ -47,7 +44,6 @@ import uk.co.thebadgerset.junit.extensions.util.TestContextProperties;
import javax.jms.*;
-import java.io.*;
import java.net.InetAddress;
import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
@@ -111,12 +107,6 @@ public class Coordinator extends TKTestRunner
/** Holds the connection that the coordinating messages are sent over. */
protected Connection connection;
- /**
- * Holds the name of the class of the test currently being run. Ideally passed into the {@link #createTestResult}
- * method, but as the signature is already fixed for this, the current value gets pushed here as a member variable.
- */
- protected String currentTestClassName;
-
/** Holds the path of the directory to output test results too, if one is defined. */
protected String reportDir;
@@ -126,12 +116,6 @@ public class Coordinator extends TKTestRunner
/** Flag that indicates that all test clients should be terminated upon completion of the test cases. */
protected boolean terminate;
- /** Flag that indicates the CSV results listener should be used to output results. */
- protected boolean csvResults;
-
- /** Flag that indiciates the XML results listener should be used to output results. */
- protected boolean xmlResults;
-
/**
* Creates an interop test coordinator on the specified broker and virtual host.
*
@@ -170,8 +154,6 @@ public class Coordinator extends TKTestRunner
this.reportDir = reportDir;
this.engine = engine;
this.terminate = terminate;
- this.csvResults = csv;
- this.xmlResults = xml;
}
/**
@@ -547,87 +529,4 @@ public class Coordinator extends TKTestRunner
return new InteropTestDecorator(targetTest, enlistedClients, conversationFactory, connection);
}
}
-
- /**
- * Creates the TestResult object to be used for test runs.
- *
- * @return An instance of the test result object.
- */
- protected TestResult createTestResult()
- {
- log.debug("protected TestResult createTestResult(): called");
-
- TKTestResult result = new TKTestResult(fPrinter.getWriter(), delay, verbose, testCaseName);
-
- // Check if a directory to output reports to has been specified and attach test listeners if so.
- if (reportDir != null)
- {
- // Create the report directory if it does not already exist.
- File reportDirFile = new File(reportDir);
-
- if (!reportDirFile.exists())
- {
- reportDirFile.mkdir();
- }
-
- // Create the results file (make the name of this configurable as a command line parameter).
- Writer timingsWriter;
-
- // Set up an XML results listener to output the timings to the results file, if requested on the command line.
- if (xmlResults)
- {
- try
- {
- File timingsFile = new File(reportDirFile, "TEST." + currentTestClassName + ".xml");
- timingsWriter = new BufferedWriter(new FileWriter(timingsFile), 20000);
- }
- catch (IOException e)
- {
- throw new RuntimeException("Unable to create the log file to write test results to: " + e, e);
- }
-
- XMLTestListener listener = new XMLTestListener(timingsWriter, currentTestClassName);
- result.addListener(listener);
- result.addTKTestListener(listener);
-
- registerShutdownHook(listener);
- }
-
- // Set up an CSV results listener to output the timings to the results file, if requested on the command line.
- if (csvResults)
- {
- try
- {
- File timingsFile =
- new File(reportDirFile, testRunName + "-" + TIME_STAMP_FORMAT.format(new Date()) + "-timings.csv");
- timingsWriter = new BufferedWriter(new FileWriter(timingsFile), 20000);
- }
- catch (IOException e)
- {
- throw new RuntimeException("Unable to create the log file to write test results to: " + e, e);
- }
-
- CSVTestListener listener = new CSVTestListener(timingsWriter);
- result.addListener(listener);
- result.addTKTestListener(listener);
-
- // Register the results listeners shutdown hook to flush its data if the test framework is shutdown
- // prematurely.
- registerShutdownHook(listener);
- }
-
- // Register the results listeners shutdown hook to flush its data if the test framework is shutdown
- // prematurely.
- // registerShutdownHook(listener);
-
- // Record the start time of the batch.
- // result.notifyStartBatch();
-
- // At this point in time the test class has been instantiated, giving it an opportunity to read its parameters.
- // Inform any test listers of the test properties.
- result.notifyTestProperties(TestContextProperties.getAccessedProps());
- }
-
- return result;
- }
}
diff --git a/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalCircuitImpl.java b/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalCircuitImpl.java
index 2900b7b02d..3a5ff49fd1 100644
--- a/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalCircuitImpl.java
+++ b/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalCircuitImpl.java
@@ -401,7 +401,7 @@ public class LocalCircuitImpl implements Circuit
}
// Inject a short pause to allow time for exceptions to come back asynchronously.
- TestUtils.pause(100L);
+ TestUtils.pause(500L);
// Request a status report.
check();