public void testDependOnAutoload() throws Exception { ModuleManager mgr = Main.getModuleSystem().getManager(); mgr.mutexPrivileged().enterWriteAccess(); try { Module m1; String mf = "Bundle-SymbolicName: org.require.autoload\n" + "Bundle-Version: 33.0.3\n" + "Bundle-ManifestVersion: 2\n" + "Require-Bundle: org.openide.compat\n\n"; /* mf = "OpenIDE-Module: org.require.autoload\n" + "OpenIDE-Module-Module-Dependencies: org.openide.compat\n\n"; /**/ File jj1 = NetigsoHid.changeManifest(getWorkDir(), j1, mf); m1 = mgr.create(jj1, null, false, false, false); CharSequence log = Log.enable("org.netbeans.core.modules", Level.WARNING); mgr.enable(m1); assertTrue("OSGi module is now enabled", m1.isEnabled()); Class<?> wl = m1.getClassLoader().loadClass("org.openide.util.WeakListener"); assertNotNull("Weak listener found", wl); Module compat = mgr.get("org.openide.compat"); assertTrue("Compat module is turned on too", compat.isEnabled()); } finally { mgr.mutexPrivileged().exitWriteAccess(); } }
public void testRenderInvalidDataObject() throws IOException { JList list = new JList(); Object wr = new WeakReference<Object>(obj); int index = 0; boolean isSelected = false; boolean cellHasFocus = false; obj.delete(); CharSequence log = Log.enable("", Level.WARNING); ObjectListRenderer instance = new ObjectListRenderer(); Component result = instance.getListCellRendererComponent(list, wr, index, isSelected, cellHasFocus); if (!(result instanceof JLabel)) { fail("Not JLabel: " + result); } JLabel l = (JLabel) result; assertEquals("Name", obj.getName(), l.getText()); if (log.length() > 0) { fail("There should be no warnings!\n" + log); } }