1 19 20 package org.netbeans.api.db.explorer; 21 22 import java.net.URL ; 23 import org.netbeans.modules.db.test.TestBase; 24 import org.netbeans.modules.db.test.Util; 25 import org.openide.cookies.OpenCookie; 26 import org.openide.filesystems.FileObject; 27 import org.openide.filesystems.Repository; 28 import org.openide.loaders.DataObject; 29 30 34 public class JDBCDriverManagerTest extends TestBase { 35 36 public JDBCDriverManagerTest(String testName) { 37 super(testName); 38 } 39 40 44 public void testSameInstanceAfterAdd() throws Exception { 45 Util.deleteDriverFiles(); 46 47 JDBCDriver driver1 = JDBCDriver.create("bar_driver", "Bar Driver", "org.bar.BarDriver", new URL [0]); 48 JDBCDriverManager.getDefault().addDriver(driver1); 49 50 DataObject dobj = DataObject.find(Repository.getDefault().getDefaultFileSystem().getRoot().createData("foo.xml")); 53 dobj.getCookie(OpenCookie.class); 54 55 60 System.gc(); 61 62 assertEquals(1, JDBCDriverManager.getDefault().getDrivers().length); 64 assertSame(driver1, JDBCDriverManager.getDefault().getDrivers("org.bar.BarDriver")[0]); 65 } 66 } 67 | Popular Tags |