diff -r 000000000000 -r a420a1124988 samples/deadlock/test/org/apidesign/deadlock/logs/ParallelControlFlowTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/deadlock/test/org/apidesign/deadlock/logs/ParallelControlFlowTest.java Sat Jun 14 09:54:32 2008 +0200 @@ -0,0 +1,69 @@ +package org.apidesign.deadlock.logs; + +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.LogRecord; +import java.util.logging.Logger; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.netbeans.junit.NbTestCase; +import static org.junit.Assert.*; + +public class ParallelControlFlowTest extends NbTestCase { + public ParallelControlFlowTest(String testName) { + super(testName); + } + + @Override + protected Level logLevel() { + return Level.WARNING; + } + +// BEGIN: test.parallel.test.controlflow + public void testMain() throws Exception { + org.netbeans.junit.Log.controlFlow(Logger.global, null, + "THREAD: 1st MSG: cnt: 0" + + "THREAD: 2nd MSG: .*0" + + "THREAD: 1st MSG: ...: 1" + + "THREAD: 2nd MSG: cnt: 1" + + "THREAD: 1st MSG: cnt: 2" + + "THREAD: 2nd MSG: cnt: 2" + + "THREAD: 1st MSG: cnt: 3" + + "THREAD: 2nd MSG: cnt: 3" + + "THREAD: 1st MSG: cnt: 4" + + "THREAD: 2nd MSG: cnt: 4" + + "THREAD: 1st MSG: cnt: 5" + + "THREAD: 2nd MSG: cnt: 5" + + "THREAD: 1st MSG: cnt: 6" + + "THREAD: 2nd MSG: cnt: 6" + + "THREAD: 1st MSG: cnt: 7" + + "THREAD: 2nd MSG: cnt: 7" + + "THREAD: 1st MSG: cnt: 8" + + "THREAD: 2nd MSG: cnt: 8" + + "THREAD: 1st MSG: cnt: 9" + + "THREAD: 2nd MSG: cnt: 9", + 500 + ); + Parael.main(null); + fail("Ok, just print the logged output"); + } +// END: test.parallel.test.controlflow + + + // BEGIN: test.parallel.test.fivetwo + public void testFiveAndThenTwo() throws Exception { + org.netbeans.junit.Log.controlFlow(Logger.global, null, + "THREAD: 1st MSG: cnt: 5" + + "THREAD: 2nd MSG: cnt: 2" + + "THREAD: 1st MSG: cnt: 6", + 5000 + ); + Parael.main(null); + fail("Ok, just print the logged output"); + } + // END: test.parallel.test.fivetwo + +}