jtulach@108: package org.apidesign.deadlock.logs; jtulach@108: jtulach@108: import java.util.logging.Handler; jtulach@108: import java.util.logging.Level; jtulach@108: import java.util.logging.LogRecord; jtulach@108: import java.util.logging.Logger; jtulach@108: import org.junit.After; jtulach@108: import org.junit.AfterClass; jtulach@108: import org.junit.Before; jtulach@108: import org.junit.BeforeClass; jtulach@108: import org.junit.Test; jtulach@108: import org.netbeans.junit.NbTestCase; jtulach@108: import static org.junit.Assert.*; jtulach@108: jtulach@108: public class ParallelControlFlowTest extends NbTestCase { jtulach@108: public ParallelControlFlowTest(String testName) { jtulach@108: super(testName); jtulach@108: } jtulach@108: jtulach@108: @Override jtulach@108: protected Level logLevel() { jtulach@108: return Level.WARNING; jtulach@108: } jtulach@108: jtulach@108: // BEGIN: test.parallel.test.controlflow jtulach@108: public void testMain() throws Exception { jtulach@108: org.netbeans.junit.Log.controlFlow(Logger.global, null, jtulach@108: "THREAD: 1st MSG: cnt: 0" + jtulach@108: "THREAD: 2nd MSG: .*0" + jtulach@108: "THREAD: 1st MSG: ...: 1" + jtulach@108: "THREAD: 2nd MSG: cnt: 1" + jtulach@108: "THREAD: 1st MSG: cnt: 2" + jtulach@108: "THREAD: 2nd MSG: cnt: 2" + jtulach@108: "THREAD: 1st MSG: cnt: 3" + jtulach@108: "THREAD: 2nd MSG: cnt: 3" + jtulach@108: "THREAD: 1st MSG: cnt: 4" + jtulach@108: "THREAD: 2nd MSG: cnt: 4" + jtulach@108: "THREAD: 1st MSG: cnt: 5" + jtulach@108: "THREAD: 2nd MSG: cnt: 5" + jtulach@108: "THREAD: 1st MSG: cnt: 6" + jtulach@108: "THREAD: 2nd MSG: cnt: 6" + jtulach@108: "THREAD: 1st MSG: cnt: 7" + jtulach@108: "THREAD: 2nd MSG: cnt: 7" + jtulach@108: "THREAD: 1st MSG: cnt: 8" + jtulach@108: "THREAD: 2nd MSG: cnt: 8" + jtulach@108: "THREAD: 1st MSG: cnt: 9" + jtulach@108: "THREAD: 2nd MSG: cnt: 9", jtulach@108: 500 jtulach@108: ); jtulach@108: Parael.main(null); jtulach@108: fail("Ok, just print the logged output"); jtulach@108: } jtulach@108: // END: test.parallel.test.controlflow jtulach@108: jtulach@108: jtulach@108: // BEGIN: test.parallel.test.fivetwo jtulach@108: public void testFiveAndThenTwo() throws Exception { jtulach@108: org.netbeans.junit.Log.controlFlow(Logger.global, null, jtulach@108: "THREAD: 1st MSG: cnt: 5" + jtulach@108: "THREAD: 2nd MSG: cnt: 2" + jtulach@108: "THREAD: 1st MSG: cnt: 6", jtulach@108: 5000 jtulach@108: ); jtulach@108: Parael.main(null); jtulach@108: fail("Ok, just print the logged output"); jtulach@108: } jtulach@108: // END: test.parallel.test.fivetwo jtulach@108: jtulach@108: }