12 |
|
|
13 |
|
public class ScheduledExecutorSubclassTest extends JSR166TestCase { |
14 |
|
public static void main(String[] args) { |
15 |
< |
junit.textui.TestRunner.run (suite()); |
15 |
> |
junit.textui.TestRunner.run(suite()); |
16 |
|
} |
17 |
|
public static Test suite() { |
18 |
|
return new TestSuite(ScheduledExecutorSubclassTest.class); |
78 |
|
* execute successfully executes a runnable |
79 |
|
*/ |
80 |
|
public void testExecute() throws InterruptedException { |
81 |
< |
TrackedShortRunnable runnable =new TrackedShortRunnable(); |
81 |
> |
TrackedShortRunnable runnable = new TrackedShortRunnable(); |
82 |
|
CustomExecutor p1 = new CustomExecutor(1); |
83 |
|
p1.execute(runnable); |
84 |
|
assertFalse(runnable.done); |
107 |
|
} |
108 |
|
|
109 |
|
/** |
110 |
< |
* delayed schedule of runnable successfully executes after delay |
110 |
> |
* delayed schedule of runnable successfully executes after delay |
111 |
|
*/ |
112 |
|
public void testSchedule3() throws InterruptedException { |
113 |
|
TrackedShortRunnable runnable = new TrackedShortRunnable(); |
190 |
|
|
191 |
|
|
192 |
|
/** |
193 |
< |
* execute (null) throws NPE |
193 |
> |
* execute(null) throws NPE |
194 |
|
*/ |
195 |
|
public void testExecuteNull() throws InterruptedException { |
196 |
|
CustomExecutor se = new CustomExecutor(1); |
202 |
|
} |
203 |
|
|
204 |
|
/** |
205 |
< |
* schedule (null) throws NPE |
205 |
> |
* schedule(null) throws NPE |
206 |
|
*/ |
207 |
|
public void testScheduleNull() throws InterruptedException { |
208 |
|
CustomExecutor se = new CustomExecutor(1); |
264 |
|
} |
265 |
|
|
266 |
|
/** |
267 |
< |
* scheduleAtFixedRate throws RejectedExecutionException if shutdown |
267 |
> |
* scheduleAtFixedRate throws RejectedExecutionException if shutdown |
268 |
|
*/ |
269 |
|
public void testScheduleAtFixedRate1_RejectedExecutionException() { |
270 |
|
CustomExecutor se = new CustomExecutor(1); |
296 |
|
} |
297 |
|
|
298 |
|
/** |
299 |
< |
* getActiveCount increases but doesn't overestimate, when a |
300 |
< |
* thread becomes active |
299 |
> |
* getActiveCount increases but doesn't overestimate, when a |
300 |
> |
* thread becomes active |
301 |
|
*/ |
302 |
|
public void testGetActiveCount() throws InterruptedException { |
303 |
|
CustomExecutor p2 = new CustomExecutor(2); |
309 |
|
} |
310 |
|
|
311 |
|
/** |
312 |
< |
* getCompletedTaskCount increases, but doesn't overestimate, |
313 |
< |
* when tasks complete |
312 |
> |
* getCompletedTaskCount increases, but doesn't overestimate, |
313 |
> |
* when tasks complete |
314 |
|
*/ |
315 |
|
public void testGetCompletedTaskCount() throws InterruptedException { |
316 |
|
CustomExecutor p2 = new CustomExecutor(2); |
322 |
|
} |
323 |
|
|
324 |
|
/** |
325 |
< |
* getCorePoolSize returns size given in constructor if not otherwise set |
325 |
> |
* getCorePoolSize returns size given in constructor if not otherwise set |
326 |
|
*/ |
327 |
|
public void testGetCorePoolSize() { |
328 |
|
CustomExecutor p1 = new CustomExecutor(1); |
331 |
|
} |
332 |
|
|
333 |
|
/** |
334 |
< |
* getLargestPoolSize increases, but doesn't overestimate, when |
335 |
< |
* multiple threads active |
334 |
> |
* getLargestPoolSize increases, but doesn't overestimate, when |
335 |
> |
* multiple threads active |
336 |
|
*/ |
337 |
|
public void testGetLargestPoolSize() throws InterruptedException { |
338 |
|
CustomExecutor p2 = new CustomExecutor(2); |
345 |
|
} |
346 |
|
|
347 |
|
/** |
348 |
< |
* getPoolSize increases, but doesn't overestimate, when threads |
349 |
< |
* become active |
348 |
> |
* getPoolSize increases, but doesn't overestimate, when threads |
349 |
> |
* become active |
350 |
|
*/ |
351 |
|
public void testGetPoolSize() { |
352 |
|
CustomExecutor p1 = new CustomExecutor(1); |
357 |
|
} |
358 |
|
|
359 |
|
/** |
360 |
< |
* getTaskCount increases, but doesn't overestimate, when tasks |
361 |
< |
* submitted |
360 |
> |
* getTaskCount increases, but doesn't overestimate, when tasks |
361 |
> |
* submitted |
362 |
|
*/ |
363 |
|
public void testGetTaskCount() throws InterruptedException { |
364 |
|
CustomExecutor p1 = new CustomExecutor(1); |
406 |
|
} |
407 |
|
|
408 |
|
/** |
409 |
< |
* is isShutDown is false before shutdown, true after |
409 |
> |
* isShutDown is false before shutdown, true after |
410 |
|
*/ |
411 |
|
public void testIsShutdown() { |
412 |
|
CustomExecutor p1 = new CustomExecutor(1); |
421 |
|
|
422 |
|
|
423 |
|
/** |
424 |
< |
* isTerminated is false before termination, true after |
424 |
> |
* isTerminated is false before termination, true after |
425 |
|
*/ |
426 |
|
public void testIsTerminated() throws InterruptedException { |
427 |
|
CustomExecutor p1 = new CustomExecutor(1); |
435 |
|
} |
436 |
|
|
437 |
|
/** |
438 |
< |
* isTerminating is not true when running or when terminated |
438 |
> |
* isTerminating is not true when running or when terminated |
439 |
|
*/ |
440 |
|
public void testIsTerminating() throws InterruptedException { |
441 |
|
CustomExecutor p1 = new CustomExecutor(1); |
497 |
|
} |
498 |
|
|
499 |
|
/** |
500 |
< |
* purge removes cancelled tasks from the queue |
500 |
> |
* purge removes cancelled tasks from the queue |
501 |
|
*/ |
502 |
|
public void testPurge() throws InterruptedException { |
503 |
|
CustomExecutor p1 = new CustomExecutor(1); |
526 |
|
} |
527 |
|
|
528 |
|
/** |
529 |
< |
* shutDownNow returns a list containing tasks that were not run |
529 |
> |
* shutDownNow returns a list containing tasks that were not run |
530 |
|
*/ |
531 |
|
public void testShutDownNow() { |
532 |
|
CustomExecutor p1 = new CustomExecutor(1); |