ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/ThreadPoolExecutor9Test.java
Revision: 1.5
Committed: Fri Sep 4 19:35:46 2015 UTC (8 years, 8 months ago) by jsr166
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +0 -0 lines
State: FILE REMOVED
Log Message:
move ThreadPoolExecutor9Test.java into ThreadPoolExecutorTest.java

File Contents

# User Rev Content
1 jsr166 1.1 /*
2     * Written by Martin Buchholz and Doug Lea with assistance from
3     * members of JCP JSR-166 Expert Group and released to the public
4     * domain, as explained at
5     * http://creativecommons.org/publicdomain/zero/1.0/
6     */
7    
8     import static java.util.concurrent.TimeUnit.MILLISECONDS;
9 jsr166 1.3
10     import java.util.concurrent.ArrayBlockingQueue;
11     import java.util.concurrent.ThreadPoolExecutor;
12    
13     import junit.framework.Test;
14     import junit.framework.TestSuite;
15 jsr166 1.1
16     public class ThreadPoolExecutor9Test extends JSR166TestCase {
17     public static void main(String[] args) {
18 jsr166 1.4 main(suite(), args);
19 jsr166 1.1 }
20     public static Test suite() {
21     return new TestSuite(ThreadPoolExecutor9Test.class);
22     }
23    
24     /**
25     * Configuration changes that allow core pool size greater than
26     * max pool size result in IllegalArgumentException.
27     */
28     public void testPoolSizeInvariants() {
29     ThreadPoolExecutor p =
30     new ThreadPoolExecutor(1, 1,
31     LONG_DELAY_MS, MILLISECONDS,
32     new ArrayBlockingQueue<Runnable>(10));
33     for (int s = 1; s < 5; s++) {
34     p.setMaximumPoolSize(s);
35     p.setCorePoolSize(s);
36     try {
37     p.setMaximumPoolSize(s - 1);
38     shouldThrow();
39     } catch (IllegalArgumentException success) {}
40     assertEquals(s, p.getCorePoolSize());
41     assertEquals(s, p.getMaximumPoolSize());
42     try {
43     p.setCorePoolSize(s + 1);
44     shouldThrow();
45     } catch (IllegalArgumentException success) {}
46     assertEquals(s, p.getCorePoolSize());
47     assertEquals(s, p.getMaximumPoolSize());
48     }
49     joinPool(p);
50     }
51    
52     }