1 19 20 21 package org.openide.loaders; 22 23 import java.util.logging.Level ; 24 import junit.framework.*; 25 import java.beans.PropertyChangeListener ; 26 import java.beans.PropertyChangeSupport ; 27 import java.lang.ref.SoftReference ; 28 import java.lang.ref.WeakReference ; 29 import java.lang.ref.Reference ; 30 import java.io.IOException ; 31 import java.util.*; 32 import org.netbeans.junit.NbTestCase; 33 import org.openide.ErrorManager; 34 import org.openide.util.datatransfer.*; 35 import org.openide.filesystems.*; 36 import org.openide.util.*; 37 38 43 public class FolderListTest extends NbTestCase { 44 private FileObject folder; 45 private FolderList list; 46 47 48 public FolderListTest(String testName) { 49 super(testName); 50 } 51 52 protected Level logLevel() { 53 return Level.FINE; 54 } 55 56 protected void setUp() throws Exception { 57 clearWorkDir(); 58 59 LocalFileSystem lfs = new LocalFileSystem(); 60 lfs.setRootDirectory(getWorkDir()); 61 62 folder = FileUtil.createFolder(lfs.getRoot(), "folder"); 63 64 FileUtil.createData(folder, "A.txt"); 65 FileUtil.createData(folder, "B.txt"); 66 FileUtil.createData(folder, "C.txt"); 67 68 list = FolderList.find(folder, true); 69 } 70 71 protected void tearDown() throws Exception { 72 } 73 74 public void testComputeChildrenList() throws Exception { 75 class L implements FolderListListener { 76 private int cnt; 77 private boolean finished; 78 79 public void process(DataObject obj, List arr) { 80 cnt++; 81 } 82 83 public void finished(List arr) { 84 assertTrue(arr.isEmpty()); 85 finished = true; 86 } 87 } 88 89 L listener = new L(); 90 RequestProcessor.Task t = list.computeChildrenList(listener); 91 t.waitFinished(); 92 93 assertEquals("Three files", 3, listener.cnt); 94 assertTrue("finished", listener.finished); 95 } 96 97 } 98 | Popular Tags |