Lines 2532-2537
Link Here
|
2532 |
TestFileUtils.writeFile(new File(data, "mod2/pkg/C3.java"), "package pkg; class C3 {}"); |
2532 |
TestFileUtils.writeFile(new File(data, "mod2/pkg/C3.java"), "package pkg; class C3 {}"); |
2533 |
File mod2JAR = createTestJAR(data, jars, "mod2", null); |
2533 |
File mod2JAR = createTestJAR(data, jars, "mod2", null); |
2534 |
ModuleManager mgr = new ModuleManager(new MockModuleInstaller(), new MockEvents()); |
2534 |
ModuleManager mgr = new ModuleManager(new MockModuleInstaller(), new MockEvents()); |
|
|
2535 |
ModuleInfo.OwnershipProvider ownership = mgr.getModuleLookup().lookup(ModuleInfo.OwnershipProvider.class); |
2536 |
assertNotNull(ownership); |
2535 |
mgr.mutexPrivileged().enterWriteAccess(); |
2537 |
mgr.mutexPrivileged().enterWriteAccess(); |
2536 |
try { |
2538 |
try { |
2537 |
Module mod1 = mgr.create(mod1JAR, null, false, false, false); |
2539 |
Module mod1 = mgr.create(mod1JAR, null, false, false, false); |
Lines 2547-2556
Link Here
|
2547 |
assertFalse(mod2.owns(c1)); |
2549 |
assertFalse(mod2.owns(c1)); |
2548 |
assertFalse(mod2.owns(c2)); |
2550 |
assertFalse(mod2.owns(c2)); |
2549 |
assertTrue(mod2.owns(c3)); |
2551 |
assertTrue(mod2.owns(c3)); |
|
|
2552 |
assertEquals(mod1, ownership.forClass(c1)); |
2553 |
assertEquals(mod1, ownership.forClass(c2)); |
2554 |
assertEquals(mod2, ownership.forClass(c3)); |
2555 |
assertNull(ownership.forClass(String.class)); |
2550 |
} finally { |
2556 |
} finally { |
2551 |
mgr.mutexPrivileged().exitWriteAccess(); |
2557 |
mgr.mutexPrivileged().exitWriteAccess(); |
2552 |
} |
2558 |
} |
2553 |
mgr = new ModuleManager(new MockModuleInstaller(), new MockEvents()); |
2559 |
mgr = new ModuleManager(new MockModuleInstaller(), new MockEvents()); |
|
|
2560 |
ownership = mgr.getModuleLookup().lookup(ModuleInfo.OwnershipProvider.class); |
2561 |
assertNotNull(ownership); |
2554 |
mgr.mutexPrivileged().enterWriteAccess(); |
2562 |
mgr.mutexPrivileged().enterWriteAccess(); |
2555 |
try { |
2563 |
try { |
2556 |
ClassLoader l = new URLClassLoader(new URL[] {mod1JAR.toURI().toURL(), mod2JAR.toURI().toURL()}); |
2564 |
ClassLoader l = new URLClassLoader(new URL[] {mod1JAR.toURI().toURL(), mod2JAR.toURI().toURL()}); |
Lines 2569-2574
Link Here
|
2569 |
assertFalse(mod2.owns(c1)); |
2577 |
assertFalse(mod2.owns(c1)); |
2570 |
assertFalse(mod2.owns(c2)); |
2578 |
assertFalse(mod2.owns(c2)); |
2571 |
assertTrue(mod2.owns(c3)); |
2579 |
assertTrue(mod2.owns(c3)); |
|
|
2580 |
assertEquals(mod1, ownership.forClass(c1)); |
2581 |
assertEquals(mod1, ownership.forClass(c2)); |
2582 |
assertEquals(mod2, ownership.forClass(c3)); |
2583 |
assertNull(ownership.forClass(String.class)); |
2572 |
} finally { |
2584 |
} finally { |
2573 |
mgr.mutexPrivileged().exitWriteAccess(); |
2585 |
mgr.mutexPrivileged().exitWriteAccess(); |
2574 |
} |
2586 |
} |