9 |
|
import java.util.*; |
10 |
|
import java.util.concurrent.*; |
11 |
|
import java.io.*; |
12 |
< |
|
12 |
> |
import java.security.*; |
13 |
|
|
14 |
|
/** |
15 |
|
* Base class for JSR166 Junit TCK tests. Defines some constants, |
98 |
|
public static Test suite ( ) { |
99 |
|
TestSuite suite = new TestSuite("JSR166 Unit Tests"); |
100 |
|
|
101 |
+ |
suite.addTest(new TestSuite(AbstractExecutorServiceTest.class)); |
102 |
|
suite.addTest(new TestSuite(ArrayBlockingQueueTest.class)); |
103 |
|
suite.addTest(new TestSuite(AtomicBooleanTest.class)); |
104 |
|
suite.addTest(new TestSuite(AtomicIntegerArrayTest.class)); |
112 |
|
suite.addTest(new TestSuite(AtomicReferenceFieldUpdaterTest.class)); |
113 |
|
suite.addTest(new TestSuite(AtomicReferenceTest.class)); |
114 |
|
suite.addTest(new TestSuite(AtomicStampedReferenceTest.class)); |
114 |
– |
suite.addTest(new TestSuite(CancellableTaskTest.class)); |
115 |
|
suite.addTest(new TestSuite(ConcurrentHashMapTest.class)); |
116 |
|
suite.addTest(new TestSuite(ConcurrentLinkedQueueTest.class)); |
117 |
|
suite.addTest(new TestSuite(CopyOnWriteArrayListTest.class)); |
121 |
|
suite.addTest(new TestSuite(DelayQueueTest.class)); |
122 |
|
suite.addTest(new TestSuite(ExchangerTest.class)); |
123 |
|
suite.addTest(new TestSuite(ExecutorsTest.class)); |
124 |
– |
suite.addTest(new TestSuite(FairSemaphoreTest.class)); |
124 |
|
suite.addTest(new TestSuite(FutureTaskTest.class)); |
125 |
|
suite.addTest(new TestSuite(LinkedBlockingQueueTest.class)); |
126 |
|
suite.addTest(new TestSuite(LinkedListTest.class)); |
320 |
|
static final Integer m10 = new Integer(-10); |
321 |
|
|
322 |
|
|
323 |
+ |
/** |
324 |
+ |
* A security policy where new permissions can be dynamically added |
325 |
+ |
* or all cleared. |
326 |
+ |
*/ |
327 |
+ |
static class AdjustablePolicy extends java.security.Policy { |
328 |
+ |
Permissions perms = new Permissions(); |
329 |
+ |
AdjustablePolicy() { } |
330 |
+ |
void addPermission(Permission perm) { perms.add(perm); } |
331 |
+ |
void clearPermissions() { perms = new Permissions(); } |
332 |
+ |
public PermissionCollection getPermissions(CodeSource cs) { |
333 |
+ |
return perms; |
334 |
+ |
} |
335 |
+ |
public PermissionCollection getPermissions(ProtectionDomain pd) { |
336 |
+ |
return perms; |
337 |
+ |
} |
338 |
+ |
public boolean implies(ProtectionDomain pd, Permission p) { |
339 |
+ |
return perms.implies(p); |
340 |
+ |
} |
341 |
+ |
public void refresh() {} |
342 |
+ |
} |
343 |
+ |
|
344 |
+ |
|
345 |
|
// Some convenient Runnable classes |
346 |
|
|
347 |
|
static class NoOpRunnable implements Runnable { |
352 |
|
public Object call() { return Boolean.TRUE; } |
353 |
|
} |
354 |
|
|
355 |
+ |
static final String TEST_STRING = "a test string"; |
356 |
+ |
|
357 |
+ |
static class StringTask implements Callable<String> { |
358 |
+ |
public String call() { return TEST_STRING; } |
359 |
+ |
} |
360 |
+ |
|
361 |
+ |
static class NPETask implements Callable<String> { |
362 |
+ |
public String call() { throw new NullPointerException(); } |
363 |
+ |
} |
364 |
+ |
|
365 |
+ |
static class CallableOne implements Callable<Integer> { |
366 |
+ |
public Integer call() { return one; } |
367 |
+ |
} |
368 |
+ |
|
369 |
|
class ShortRunnable implements Runnable { |
370 |
|
public void run() { |
371 |
|
try { |