mirror of https://github.com/apache/activemq.git
updated timers to ensure that the test runs even on slow machines
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@385467 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
db9a7097a1
commit
c8b8fdde4f
|
@ -47,6 +47,10 @@ public final class LargeStreamletTest extends TestCase {
|
||||||
|
|
||||||
private AtomicBoolean stopThreads = new AtomicBoolean(false);
|
private AtomicBoolean stopThreads = new AtomicBoolean(false);
|
||||||
|
|
||||||
|
protected Exception writerException;
|
||||||
|
|
||||||
|
protected Exception readerException;
|
||||||
|
|
||||||
public void testStreamlets() throws Exception {
|
public void testStreamlets() throws Exception {
|
||||||
final ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(
|
final ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(
|
||||||
BROKER_URL);
|
BROKER_URL);
|
||||||
|
@ -77,6 +81,7 @@ public final class LargeStreamletTest extends TestCase {
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
readerException = e;
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
System.err
|
System.err
|
||||||
|
@ -105,6 +110,7 @@ public final class LargeStreamletTest extends TestCase {
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
writerException = e;
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
System.err.println(totalWritten
|
System.err.println(totalWritten
|
||||||
|
@ -116,11 +122,14 @@ public final class LargeStreamletTest extends TestCase {
|
||||||
readerThread.start();
|
readerThread.start();
|
||||||
writerThread.start();
|
writerThread.start();
|
||||||
|
|
||||||
readerThread.join(30*1000);
|
writerThread.join(60 * 1000);
|
||||||
writerThread.join(10);
|
readerThread.join(60 * 1000);
|
||||||
|
|
||||||
stopThreads.set(true);
|
stopThreads.set(true);
|
||||||
|
|
||||||
|
assertTrue("Should not have received a reader exception", readerException == null);
|
||||||
|
assertTrue("Should not have received a writer exception", writerException == null);
|
||||||
|
|
||||||
Assert.assertEquals("Not all messages accounted for",
|
Assert.assertEquals("Not all messages accounted for",
|
||||||
totalWritten, totalRead);
|
totalWritten, totalRead);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue