Lines 44-51
Link Here
|
44 |
|
44 |
|
45 |
package org.openide.filesystems; |
45 |
package org.openide.filesystems; |
46 |
|
46 |
|
|
|
47 |
import java.io.File; |
47 |
import org.netbeans.junit.*; |
48 |
import org.netbeans.junit.*; |
48 |
import junit.textui.TestRunner; |
|
|
49 |
|
49 |
|
50 |
/** |
50 |
/** |
51 |
* Test that MultiFileSystem does not refresh more than it needs to |
51 |
* Test that MultiFileSystem does not refresh more than it needs to |
Lines 59-69
Link Here
|
59 |
super(name); |
59 |
super(name); |
60 |
} |
60 |
} |
61 |
|
61 |
|
62 |
public static void main(String[] args) { |
|
|
63 |
TestRunner.run(new NbTestSuite(MultiFileSystemRefreshTest.class)); |
64 |
} |
65 |
|
66 |
private FileSystem fs1, fs2; |
62 |
private FileSystem fs1, fs2; |
|
|
63 |
@Override |
67 |
protected void setUp() throws Exception { |
64 |
protected void setUp() throws Exception { |
68 |
super.setUp(); |
65 |
super.setUp(); |
69 |
fs1 = TestUtilHid.createLocalFileSystem("mfsrefresh1"+getName() + "1", new String[] { |
66 |
fs1 = TestUtilHid.createLocalFileSystem("mfsrefresh1"+getName() + "1", new String[] { |
Lines 75-80
Link Here
|
75 |
"e/g.txt", |
72 |
"e/g.txt", |
76 |
}); |
73 |
}); |
77 |
} |
74 |
} |
|
|
75 |
@Override |
78 |
protected void tearDown() throws Exception { |
76 |
protected void tearDown() throws Exception { |
79 |
TestUtilHid.destroyLocalFileSystem(getName() + "1"); |
77 |
TestUtilHid.destroyLocalFileSystem(getName() + "1"); |
80 |
TestUtilHid.destroyLocalFileSystem(getName() + "2"); |
78 |
TestUtilHid.destroyLocalFileSystem(getName() + "2"); |
Lines 117-122
Link Here
|
117 |
assertEquals(1, e.getChildren().length); |
115 |
assertEquals(1, e.getChildren().length); |
118 |
assertEquals(1, count); |
116 |
assertEquals(1, count); |
119 |
} |
117 |
} |
|
|
118 |
|
119 |
public void testRefreshMissingRoot() throws Exception { |
120 |
LocalFileSystem fs = new LocalFileSystem(); |
121 |
clearWorkDir(); |
122 |
fs.setRootDirectory(getWorkDir()); |
123 |
|
124 |
MultiFileSystem mfs = new MultiFileSystem(fs1, fs2, fs); |
125 |
FileObject b = mfs.findResource("a/b"); |
126 |
assertNotNull(b); |
127 |
assertEquals(2, b.getChildren().length); |
128 |
File x = new File(new File(new File(getWorkDir(), "a"), "b"), "x.txt"); |
129 |
x.getParentFile().mkdirs(); |
130 |
assertTrue("File created", x.createNewFile()); |
131 |
b.refresh(); |
132 |
// fixes the refresh: b.getFileSystem().refresh(true); |
133 |
assertEquals("Three now", 3, b.getChildren().length); |
134 |
} |
120 |
|
135 |
|
121 |
public void fileAttributeChanged(FileAttributeEvent fe) { |
136 |
public void fileAttributeChanged(FileAttributeEvent fe) { |
122 |
System.err.println("attr changed: " + fe); |
137 |
System.err.println("attr changed: " + fe); |