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, |
128 |
|
suite.addTest(new TestSuite(LockSupportTest.class)); |
129 |
|
suite.addTest(new TestSuite(PriorityBlockingQueueTest.class)); |
130 |
|
suite.addTest(new TestSuite(PriorityQueueTest.class)); |
131 |
+ |
suite.addTest(new TestSuite(PrivilegedFutureTaskTest.class)); |
132 |
|
suite.addTest(new TestSuite(ReentrantLockTest.class)); |
133 |
|
suite.addTest(new TestSuite(ReentrantReadWriteLockTest.class)); |
134 |
|
suite.addTest(new TestSuite(ScheduledExecutorTest.class)); |
322 |
|
static final Integer m10 = new Integer(-10); |
323 |
|
|
324 |
|
|
325 |
+ |
/** |
326 |
+ |
* A security policy where new permissions can be dynamically added |
327 |
+ |
* or all cleared. |
328 |
+ |
*/ |
329 |
+ |
static class AdjustablePolicy extends java.security.Policy { |
330 |
+ |
Permissions perms = new Permissions(); |
331 |
+ |
AdjustablePolicy() { } |
332 |
+ |
void addPermission(Permission perm) { perms.add(perm); } |
333 |
+ |
void clearPermissions() { perms = new Permissions(); } |
334 |
+ |
public PermissionCollection getPermissions(CodeSource cs) { |
335 |
+ |
return perms; |
336 |
+ |
} |
337 |
+ |
public PermissionCollection getPermissions(ProtectionDomain pd) { |
338 |
+ |
return perms; |
339 |
+ |
} |
340 |
+ |
public boolean implies(ProtectionDomain pd, Permission p) { |
341 |
+ |
return perms.implies(p); |
342 |
+ |
} |
343 |
+ |
public void refresh() {} |
344 |
+ |
} |
345 |
+ |
|
346 |
+ |
|
347 |
|
// Some convenient Runnable classes |
348 |
|
|
349 |
|
static class NoOpRunnable implements Runnable { |