1 19 20 package org.netbeans.modules.apisupport.project; 21 22 import java.io.File ; 23 import java.util.Collections ; 24 25 30 public class ManifestManagerTest extends TestBase { 31 32 34 public ManifestManagerTest(String name) { 35 super(name); 36 } 37 38 private File suite1, suite2; 39 40 protected void setUp() throws Exception { 41 super.setUp(); 42 suite1 = resolveEEPFile("suite1"); 43 suite2 = resolveEEPFile("suite2"); 44 } 45 46 public void testDirectManifestFile() throws Exception { 47 File basedir = new File (suite2, "misc-project"); 48 ManifestManager mm = ManifestManager.getInstance(new File (basedir, "manifest.mf"), false); 49 assertEquals("right codeNameBase", "org.netbeans.examples.modules.misc", mm.getCodeNameBase()); 50 assertEquals("right release version", "1", mm.getReleaseVersion()); 51 assertEquals("right specification version", "1.0", mm.getSpecificationVersion()); 52 assertEquals("right localizing bundle", "org/netbeans/examples/modules/misc/Bundle.properties", 53 mm.getLocalizingBundle()); 54 55 basedir = new File (suite1, "action-project"); 56 mm = ManifestManager.getInstance(new File (basedir, "manifest.mf"), false); 57 assertEquals("right codeNameBase", "org.netbeans.examples.modules.action", mm.getCodeNameBase()); 58 assertNull("no release version", mm.getReleaseVersion()); 59 } 60 61 public void testFriends() throws Exception { 62 File manifest = new File (getWorkDir(), "testManifest.mf"); 63 String mfContent = "Manifest-Version: 1.0\n" + 64 "Ant-Version: Apache Ant 1.6.5\n" + 65 "Created-By: 1.4.2_10-b03 (Sun Microsystems Inc.)\n" + 66 "OpenIDE-Module-Public-Packages: org.netbeans.modules.editor.hints.spi.*\n" + 67 "OpenIDE-Module-Friends: org.netbeans.modules.java.hints, org.netbeans.\n" + 68 " modules.j2ee.ejbcore, org.netbeans.modules.kjava.editor\n" + 69 "OpenIDE-Module-Module-Dependencies: org.openide.filesystems > 6.2, org\n" + 70 " .openide.util > 6.2, org.openide.modules > 6.2, org.openide.nodes > 6\n" + 71 " .2, org.openide.awt > 6.2, org.openide.text > 6.2, org.openide.loader\n" + 72 " s, org.netbeans.modules.editor.lib/1, org.netbeans.modules.editor.mim\n" + 73 " elookup/1\n" + 74 "OpenIDE-Module-Build-Version: 060123\n" + 75 "OpenIDE-Module-Specification-Version: 1.10.0.1\n" + 76 "OpenIDE-Module: org.netbeans.modules.editor.hints/1\n" + 77 "OpenIDE-Module-Implementation-Version: 1\n" + 78 "OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/editor/hints/re\n" + 79 " sources/Bundle.properties\n" + 80 "OpenIDE-Module-Install: org/netbeans/modules/editor/hints/HintsModule.\n" + 81 " class\n" + 82 "OpenIDE-Module-Requires: org.openide.modules.ModuleFormat1\n"; 83 dump(manifest, mfContent); 84 ManifestManager mm = ManifestManager.getInstance(manifest, true); 85 assertEquals("one public package", 1, mm.getPublicPackages().length); 86 } 87 88 public void testJarWithNoManifest() throws Exception { 89 File jar = new File (getWorkDir(), "test.jar"); 91 TestBase.createJar(jar, Collections.singletonMap("foo", "bar"), null); 92 ManifestManager.getInstanceFromJAR(jar); 93 } 94 95 } 96 | Popular Tags |