Author: clebert.suconic(a)jboss.com
Date: 2011-11-02 18:48:24 -0400 (Wed, 02 Nov 2011)
New Revision: 11645
Modified:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/JournalCrashTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/util/UnitTestCase.java
Log:
oops.. fixing tests after a dumb mistake of mine
Modified:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/JournalCrashTest.java
===================================================================
---
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/JournalCrashTest.java 2011-11-02
21:04:13 UTC (rev 11644)
+++
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/JournalCrashTest.java 2011-11-02
22:48:24 UTC (rev 11645)
@@ -127,20 +127,15 @@
{
try
{
- int start = 4;
- int end = 8;
+ int start = Integer.parseInt(arg[1]);
- if (arg.length > 0)
- {
- start = Integer.parseInt(arg[0]);
- }
+ int end = Integer.parseInt(arg[2]);
+
+ long timeStart = Long.parseLong(arg[0]);
- if (arg.length > 1)
- {
- end = Integer.parseInt(arg[1]);
- }
-
JournalCrashTest restart = new JournalCrashTest();
+
+ restart.setTimeStart(timeStart);
restart.startServer();
@@ -196,10 +191,10 @@
public void testRestartJournal() throws Throwable
{
- runExternalProcess(0, JournalCrashTest.FIRST_RUN);
- runExternalProcess(JournalCrashTest.FIRST_RUN, JournalCrashTest.SECOND_RUN);
- runExternalProcess(JournalCrashTest.SECOND_RUN, JournalCrashTest.THIRD_RUN);
- runExternalProcess(JournalCrashTest.THIRD_RUN, JournalCrashTest.FOURTH_RUN);
+ runExternalProcess(getTimeStart(), 0, JournalCrashTest.FIRST_RUN);
+ runExternalProcess(getTimeStart(), JournalCrashTest.FIRST_RUN,
JournalCrashTest.SECOND_RUN);
+ runExternalProcess(getTimeStart(), JournalCrashTest.SECOND_RUN,
JournalCrashTest.THIRD_RUN);
+ runExternalProcess(getTimeStart(), JournalCrashTest.THIRD_RUN,
JournalCrashTest.FOURTH_RUN);
printJournal();
@@ -241,7 +236,7 @@
* @throws Exception
* @throws InterruptedException
*/
- private void runExternalProcess(final int start, final int end) throws Exception,
InterruptedException
+ private void runExternalProcess(final long timeStart, final int start, final int end)
throws Exception, InterruptedException
{
System.err.println("running external process...");
Process process = SpawnedVMSupport.spawnVM(this.getClass().getCanonicalName(),
@@ -249,6 +244,7 @@
new String[] {},
true,
true,
+ Long.toString(timeStart),
Integer.toString(start),
Integer.toString(end));
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/util/UnitTestCase.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/util/UnitTestCase.java 2011-11-02
21:04:13 UTC (rev 11644)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/util/UnitTestCase.java 2011-11-02
22:48:24 UTC (rev 11645)
@@ -113,7 +113,20 @@
private final String baseDir = System.getProperty("java.io.tmpdir",
"/tmp") + File.separator + "hornetq-unit-test";
- private final String testDir = baseDir + File.separator + System.currentTimeMillis();
+ private long timeStart = System.currentTimeMillis();
+
+ public long getTimeStart()
+ {
+ return timeStart;
+ }
+
+ private String testDir = baseDir + File.separator + timeStart;
+
+ public void setTimeStart(long time)
+ {
+ timeStart = time;
+ testDir = baseDir + File.separator + timeStart;
+ }
// There is a verification about thread leakages. We only fail a single thread when
this happens
private static Set<Thread> alreadyFailedThread = new HashSet<Thread>();
@@ -899,7 +912,7 @@
OperationContextImpl.clearContext();
- deleteDirectory(new File(baseDir));
+ clearData(getTestDir());
InVMRegistry.instance.clear();