samples/deadlock/test/org/apidesign/deadlock/logs/ParallelControlFlowTest.java
changeset 108 a420a1124988
child 203 0e46110eebc1
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/samples/deadlock/test/org/apidesign/deadlock/logs/ParallelControlFlowTest.java	Sat Jun 14 09:54:32 2008 +0200
     1.3 @@ -0,0 +1,69 @@
     1.4 +package org.apidesign.deadlock.logs;
     1.5 +
     1.6 +import java.util.logging.Handler;
     1.7 +import java.util.logging.Level;
     1.8 +import java.util.logging.LogRecord;
     1.9 +import java.util.logging.Logger;
    1.10 +import org.junit.After;
    1.11 +import org.junit.AfterClass;
    1.12 +import org.junit.Before;
    1.13 +import org.junit.BeforeClass;
    1.14 +import org.junit.Test;
    1.15 +import org.netbeans.junit.NbTestCase;
    1.16 +import static org.junit.Assert.*;
    1.17 +
    1.18 +public class ParallelControlFlowTest extends NbTestCase {
    1.19 +    public ParallelControlFlowTest(String testName) {
    1.20 +        super(testName);
    1.21 +    }
    1.22 +
    1.23 +    @Override
    1.24 +    protected Level logLevel() {
    1.25 +        return Level.WARNING;
    1.26 +    }
    1.27 +
    1.28 +// BEGIN: test.parallel.test.controlflow
    1.29 +    public void testMain() throws Exception {
    1.30 +        org.netbeans.junit.Log.controlFlow(Logger.global, null,
    1.31 +            "THREAD: 1st MSG: cnt: 0" +
    1.32 +            "THREAD: 2nd MSG: .*0" +
    1.33 +            "THREAD: 1st MSG: ...: 1" +
    1.34 +            "THREAD: 2nd MSG: cnt: 1" +
    1.35 +            "THREAD: 1st MSG: cnt: 2" +
    1.36 +            "THREAD: 2nd MSG: cnt: 2" +
    1.37 +            "THREAD: 1st MSG: cnt: 3" +
    1.38 +            "THREAD: 2nd MSG: cnt: 3" +
    1.39 +            "THREAD: 1st MSG: cnt: 4" +
    1.40 +            "THREAD: 2nd MSG: cnt: 4" +
    1.41 +            "THREAD: 1st MSG: cnt: 5" +
    1.42 +            "THREAD: 2nd MSG: cnt: 5" +
    1.43 +            "THREAD: 1st MSG: cnt: 6" +
    1.44 +            "THREAD: 2nd MSG: cnt: 6" +
    1.45 +            "THREAD: 1st MSG: cnt: 7" +
    1.46 +            "THREAD: 2nd MSG: cnt: 7" +
    1.47 +            "THREAD: 1st MSG: cnt: 8" +
    1.48 +            "THREAD: 2nd MSG: cnt: 8" +
    1.49 +            "THREAD: 1st MSG: cnt: 9" +
    1.50 +            "THREAD: 2nd MSG: cnt: 9",
    1.51 +            500
    1.52 +        );
    1.53 +        Parael.main(null);
    1.54 +        fail("Ok, just print the logged output");
    1.55 +    }
    1.56 +// END: test.parallel.test.controlflow
    1.57 +    
    1.58 +    
    1.59 +    // BEGIN: test.parallel.test.fivetwo
    1.60 +    public void testFiveAndThenTwo() throws Exception {
    1.61 +        org.netbeans.junit.Log.controlFlow(Logger.global, null,
    1.62 +            "THREAD: 1st MSG: cnt: 5" +
    1.63 +            "THREAD: 2nd MSG: cnt: 2" +
    1.64 +            "THREAD: 1st MSG: cnt: 6",
    1.65 +            5000
    1.66 +        );
    1.67 +        Parael.main(null);
    1.68 +        fail("Ok, just print the logged output");
    1.69 +    }
    1.70 +    // END: test.parallel.test.fivetwo
    1.71 +    
    1.72 +}