|
29 | 29 | import java.net.URLClassLoader; |
30 | 30 | import java.nio.file.Path; |
31 | 31 | import java.util.Arrays; |
| 32 | +import java.util.LinkedHashMap; |
32 | 33 | import java.util.List; |
33 | 34 | import java.util.Map; |
34 | 35 | import java.util.Set; |
@@ -448,41 +449,42 @@ public void testFilesEntitlementsWithExclusive() { |
448 | 449 | var baseTestPath = Path.of("/base").toAbsolutePath(); |
449 | 450 | var testPath1 = Path.of("/base/test").toAbsolutePath(); |
450 | 451 | var testPath2 = Path.of("/base/test/foo").toAbsolutePath(); |
451 | | - var iae = expectThrows( |
452 | | - IllegalArgumentException.class, |
453 | | - () -> new PolicyManager( |
454 | | - createEmptyTestServerPolicy(), |
455 | | - List.of(), |
456 | | - Map.of( |
457 | | - "plugin1", |
458 | | - new Policy( |
459 | | - "test", |
| 452 | + var plugins = new LinkedHashMap<String, Policy>(); |
| 453 | + plugins.put("plugin1", |
| 454 | + new Policy( |
| 455 | + "test", |
| 456 | + List.of( |
| 457 | + new Scope( |
| 458 | + "test.module1", |
460 | 459 | List.of( |
461 | | - new Scope( |
462 | | - "test.module1", |
463 | | - List.of( |
464 | | - new FilesEntitlement( |
465 | | - List.of(FilesEntitlement.FileData.ofPath(testPath1, FilesEntitlement.Mode.READ).withExclusive(true)) |
466 | | - ) |
467 | | - ) |
| 460 | + new FilesEntitlement( |
| 461 | + List.of(FilesEntitlement.FileData.ofPath(testPath1, FilesEntitlement.Mode.READ).withExclusive(true)) |
468 | 462 | ) |
469 | 463 | ) |
470 | | - ), |
471 | | - "plugin2", |
472 | | - new Policy( |
473 | | - "test", |
| 464 | + ) |
| 465 | + ) |
| 466 | + )); |
| 467 | + plugins.put( |
| 468 | + "plugin2", |
| 469 | + new Policy( |
| 470 | + "test", |
| 471 | + List.of( |
| 472 | + new Scope( |
| 473 | + "test.module2", |
474 | 474 | List.of( |
475 | | - new Scope( |
476 | | - "test.module2", |
477 | | - List.of( |
478 | | - new FilesEntitlement( |
479 | | - List.of(FilesEntitlement.FileData.ofPath(testPath1, FilesEntitlement.Mode.READ).withExclusive(true)) |
480 | | - ) |
481 | | - ) |
| 475 | + new FilesEntitlement( |
| 476 | + List.of(FilesEntitlement.FileData.ofPath(testPath1, FilesEntitlement.Mode.READ).withExclusive(true)) |
482 | 477 | ) |
483 | 478 | ) |
484 | 479 | ) |
485 | | - ), |
| 480 | + ) |
| 481 | + )); |
| 482 | + var iae = expectThrows( |
| 483 | + IllegalArgumentException.class, |
| 484 | + () -> new PolicyManager( |
| 485 | + createEmptyTestServerPolicy(), |
| 486 | + List.of(), |
| 487 | + plugins, |
486 | 488 | c -> "", |
487 | 489 | Map.of("plugin1", Path.of("modules", "plugin1"), "plugin2", Path.of("modules", "plugin2")), |
488 | 490 | TEST_AGENTS_PACKAGE_NAME, |
|
0 commit comments