1 19 20 package org.netbeans.modules.j2ee.persistence.wizard.fromdb; 21 22 import java.lang.ref.Reference ; 23 import java.lang.ref.WeakReference ; 24 import org.netbeans.api.project.Project; 25 import org.netbeans.junit.NbTestCase; 26 import org.openide.filesystems.FileObject; 27 import org.openide.util.Lookup; 28 29 33 public class TableSourceTest extends NbTestCase { 34 35 public TableSourceTest(String testName) { 36 super(testName); 37 } 38 39 public void testNoLeak() { 40 Project project = new ProjectImpl(); 41 42 TableSource source = new TableSource("jndi/foo", TableSource.Type.DATA_SOURCE); 43 TableSource.put(project, source); 44 45 assertSame(source, TableSource.get(project)); 46 47 Reference <Project> projectRef = new WeakReference (project); 48 project = null; 49 assertGC("Should be possible to GC project", projectRef); 50 } 51 52 private static final class ProjectImpl implements Project { 53 54 public FileObject getProjectDirectory() { 55 return null; 56 } 57 58 public Lookup getLookup() { 59 return null; 60 } 61 } 62 } 63 | Popular Tags |