Lines 77-82
Link Here
|
77 |
import org.netbeans.junit.RandomlyFails; |
77 |
import org.netbeans.junit.RandomlyFails; |
78 |
import org.openide.modules.Dependency; |
78 |
import org.openide.modules.Dependency; |
79 |
import org.openide.modules.ModuleInfo; |
79 |
import org.openide.modules.ModuleInfo; |
|
|
80 |
import org.openide.modules.Modules; |
80 |
import org.openide.util.Lookup; |
81 |
import org.openide.util.Lookup; |
81 |
import org.openide.util.LookupEvent; |
82 |
import org.openide.util.LookupEvent; |
82 |
import org.openide.util.LookupListener; |
83 |
import org.openide.util.LookupListener; |
Lines 2532-2537
Link Here
|
2532 |
TestFileUtils.writeFile(new File(data, "mod2/pkg/C3.java"), "package pkg; class C3 {}"); |
2533 |
TestFileUtils.writeFile(new File(data, "mod2/pkg/C3.java"), "package pkg; class C3 {}"); |
2533 |
File mod2JAR = createTestJAR(data, jars, "mod2", null); |
2534 |
File mod2JAR = createTestJAR(data, jars, "mod2", null); |
2534 |
ModuleManager mgr = new ModuleManager(new MockModuleInstaller(), new MockEvents()); |
2535 |
ModuleManager mgr = new ModuleManager(new MockModuleInstaller(), new MockEvents()); |
|
|
2536 |
Modules modules = mgr.getModuleLookup().lookup(Modules.class); |
2537 |
assertNotNull(modules); |
2535 |
mgr.mutexPrivileged().enterWriteAccess(); |
2538 |
mgr.mutexPrivileged().enterWriteAccess(); |
2536 |
try { |
2539 |
try { |
2537 |
Module mod1 = mgr.create(mod1JAR, null, false, false, false); |
2540 |
Module mod1 = mgr.create(mod1JAR, null, false, false, false); |
Lines 2547-2556
Link Here
|
2547 |
assertFalse(mod2.owns(c1)); |
2550 |
assertFalse(mod2.owns(c1)); |
2548 |
assertFalse(mod2.owns(c2)); |
2551 |
assertFalse(mod2.owns(c2)); |
2549 |
assertTrue(mod2.owns(c3)); |
2552 |
assertTrue(mod2.owns(c3)); |
|
|
2553 |
assertEquals(mod1, modules.ownerOf(c1)); |
2554 |
assertEquals(mod1, modules.ownerOf(c2)); |
2555 |
assertEquals(mod2, modules.ownerOf(c3)); |
2556 |
assertNull(modules.ownerOf(String.class)); |
2550 |
} finally { |
2557 |
} finally { |
2551 |
mgr.mutexPrivileged().exitWriteAccess(); |
2558 |
mgr.mutexPrivileged().exitWriteAccess(); |
2552 |
} |
2559 |
} |
2553 |
mgr = new ModuleManager(new MockModuleInstaller(), new MockEvents()); |
2560 |
mgr = new ModuleManager(new MockModuleInstaller(), new MockEvents()); |
|
|
2561 |
modules = mgr.getModuleLookup().lookup(Modules.class); |
2562 |
assertNotNull(modules); |
2554 |
mgr.mutexPrivileged().enterWriteAccess(); |
2563 |
mgr.mutexPrivileged().enterWriteAccess(); |
2555 |
try { |
2564 |
try { |
2556 |
ClassLoader l = new URLClassLoader(new URL[] {mod1JAR.toURI().toURL(), mod2JAR.toURI().toURL()}); |
2565 |
ClassLoader l = new URLClassLoader(new URL[] {mod1JAR.toURI().toURL(), mod2JAR.toURI().toURL()}); |
Lines 2569-2574
Link Here
|
2569 |
assertFalse(mod2.owns(c1)); |
2578 |
assertFalse(mod2.owns(c1)); |
2570 |
assertFalse(mod2.owns(c2)); |
2579 |
assertFalse(mod2.owns(c2)); |
2571 |
assertTrue(mod2.owns(c3)); |
2580 |
assertTrue(mod2.owns(c3)); |
|
|
2581 |
assertEquals(mod1, modules.ownerOf(c1)); |
2582 |
assertEquals(mod1, modules.ownerOf(c2)); |
2583 |
assertEquals(mod2, modules.ownerOf(c3)); |
2584 |
assertNull(modules.ownerOf(String.class)); |
2572 |
} finally { |
2585 |
} finally { |
2573 |
mgr.mutexPrivileged().exitWriteAccess(); |
2586 |
mgr.mutexPrivileged().exitWriteAccess(); |
2574 |
} |
2587 |
} |