Lines 63-68
Link Here
|
63 |
import org.openide.filesystems.FileRenameEvent; |
63 |
import org.openide.filesystems.FileRenameEvent; |
64 |
import org.openide.filesystems.FileSystem; |
64 |
import org.openide.filesystems.FileSystem; |
65 |
import org.openide.filesystems.FileUtil; |
65 |
import org.openide.filesystems.FileUtil; |
|
|
66 |
import org.openide.filesystems.LocalFileSystem; |
66 |
import org.openide.modules.ModuleInfo; |
67 |
import org.openide.modules.ModuleInfo; |
67 |
import org.openide.util.Lookup; |
68 |
import org.openide.util.Lookup; |
68 |
import org.openide.util.lookup.InstanceContent; |
69 |
import org.openide.util.lookup.InstanceContent; |
Lines 230-235
Link Here
|
230 |
assertTrue("Still valid", global.isValid()); |
231 |
assertTrue("Still valid", global.isValid()); |
231 |
assertEquals("fileone", read(global)); |
232 |
assertEquals("fileone", read(global)); |
232 |
} |
233 |
} |
|
|
234 |
|
235 |
public void testDynamicSystemsCanAlsoBeBehindLayers() throws Exception { |
236 |
ModuleManager mgr = Main.getModuleSystem ().getManager(); |
237 |
mgr.mutexPrivileged().enterWriteAccess(); |
238 |
Module m1 = mgr.create(new File(jars, "base-layer-mod.jar"), null, false, false, false); |
239 |
FileObject global; |
240 |
try { |
241 |
assertEquals(Collections.EMPTY_SET, m1.getProblems()); |
242 |
mgr.enable(m1); |
243 |
global = FileUtil.getConfigFile("foo/file2.txt"); |
244 |
assertNotNull("File Object installed: " + global, global); |
245 |
assertEquals("base contents", read(global)); |
246 |
|
247 |
final LocalFileSystem lfs1 = new LocalFileSystem(); |
248 |
File dir1 = new File(getWorkDir(), "dir1"); |
249 |
dir1.mkdirs(); |
250 |
lfs1.setRootDirectory(dir1); |
251 |
lfs1.getRoot().setAttribute("fallback", Boolean.TRUE); |
252 |
assertEquals("Position attribute is there", -1, lfs1.getRoot().getAttribute("fallback")); |
253 |
fs1 = lfs1; |
254 |
|
255 |
FileObject fo1 = FileUtil.createData(fs1.getRoot(), global.getPath()); |
256 |
fo1.setAttribute("one", 1); |
257 |
write(fo1, "fileone"); |
258 |
|
259 |
FileObject fo11 = FileUtil.createData(fs1.getRoot(), "test-fs-is-there.txt"); |
260 |
write(fo11, "hereIam"); |
261 |
|
262 |
FileObject fo2 = FileUtil.createData(fs2.getRoot(), global.getPath()); |
263 |
fo2.setAttribute("two", 2); |
264 |
write(fo2, "two"); |
265 |
|
266 |
events.clear(); |
267 |
|
268 |
|
269 |
MainLookup.register(fs1, this); |
270 |
MainLookup.register(fs2, this); |
271 |
|
272 |
Iterator<? extends FileSystem> it = Lookup.getDefault().lookupAll(FileSystem.class).iterator(); |
273 |
assertTrue("At least One", it.hasNext()); |
274 |
assertEquals("first is fs1", fs1, it.next()); |
275 |
assertTrue("At least two ", it.hasNext()); |
276 |
assertEquals("first is fs2", fs2, it.next()); |
277 |
|
278 |
assertEquals("two", read(global)); |
279 |
} finally { |
280 |
mgr.disable(m1); |
281 |
mgr.delete(m1); |
282 |
mgr.mutexPrivileged().exitWriteAccess(); |
283 |
} |
284 |
assertTrue("Still valid", global.isValid()); |
285 |
assertEquals("two", read(global)); |
286 |
|
287 |
FileObject fo = FileUtil.getConfigFile("test-fs-is-there.txt"); |
288 |
assertNotNull("File found", fo); |
289 |
assertEquals("Text is correct", "hereIam", read(fo)); |
290 |
} |
233 |
|
291 |
|
234 |
public void testCanHideFilesFromModules() throws Exception { |
292 |
public void testCanHideFilesFromModules() throws Exception { |
235 |
ModuleManager mgr = Main.getModuleSystem ().getManager(); |
293 |
ModuleManager mgr = Main.getModuleSystem ().getManager(); |