1 19 20 package org.netbeans.core.startup; 21 22 import java.io.File ; 23 import java.util.Arrays ; 24 import java.util.Collections ; 25 import java.util.HashSet ; 26 import java.util.Set ; 27 import org.netbeans.Module; 28 import org.netbeans.ModuleManager; 29 import org.openide.filesystems.Repository; 30 31 35 public class NbInstallerTest4 extends SetupHid { 36 37 44 45 public NbInstallerTest4(String name) { 46 super(name); 47 } 48 49 52 public void testDependencyLayerOverrides1() throws Exception { 53 Main.getModuleSystem (); final FakeEvents ev = new FakeEvents(); 55 org.netbeans.core.startup.NbInstaller installer = new org.netbeans.core.startup.NbInstaller(ev); 56 ModuleManager mgr = new ModuleManager(installer, ev); 57 installer.registerManager(mgr); 58 mgr.mutexPrivileged().enterWriteAccess(); 59 try { 60 Module m1 = mgr.create(new File (jars, "base-layer-mod.jar"), null, false, false, false); 61 Module m2 = mgr.create(new File (jars, "override-layer-mod.jar"), null, false, false, false); 62 assertEquals(Collections.EMPTY_SET, m2.getProblems()); 63 assertEquals(null, slurp("foo/file1.txt")); 64 assertEquals(null, slurp("foo/file3.txt")); 65 assertEquals(null, slurp("foo/file4.txt")); 66 Set m1m2 = new HashSet (Arrays.asList(new Module[] {m1, m2})); 67 mgr.enable(m1m2); 68 assertEquals("base contents", slurp("foo/file1.txt")); 69 assertEquals("customized contents", slurp("foo/file3.txt")); 70 assertEquals(null, slurp("foo/file4.txt")); 71 assertEquals("someotherval", Repository.getDefault().getDefaultFileSystem().findResource("foo/file5.txt").getAttribute("myattr")); 72 mgr.disable(m1m2); 73 assertEquals(null, slurp("foo/file1.txt")); 74 mgr.delete(m2); 75 mgr.delete(m1); 76 } finally { 77 mgr.mutexPrivileged().exitWriteAccess(); 78 } 79 } 80 81 } 82 | Popular Tags |