This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 197308
Collapse All | Expand All

(-)a/openide.filesystems/test/unit/src/org/openide/filesystems/MultiFileObjectTestHid.java (+40 lines)
Lines 44-49 Link Here
44
44
45
package org.openide.filesystems;
45
package org.openide.filesystems;
46
46
47
import java.io.File;
47
import java.io.IOException;
48
import java.io.IOException;
48
import java.util.ArrayList;
49
import java.util.ArrayList;
49
import java.util.Arrays;
50
import java.util.Arrays;
Lines 61-66 Link Here
61
    }
62
    }
62
63
63
64
65
    @Override
64
    protected String[] getResources (String testName) {
66
    protected String[] getResources (String testName) {
65
        return resources;
67
        return resources;
66
    }
68
    }
Lines 219-222 Link Here
219
        assertEquals("1st test", "mal", t.getAttribute("x"));
221
        assertEquals("1st test", "mal", t.getAttribute("x"));
220
        assertEquals("2nd test", "mal", t.getAttribute("x"));
222
        assertEquals("2nd test", "mal", t.getAttribute("x"));
221
    }
223
    }
224
    
225
    public void testMultiFileSystemWithOverridenAttributes() throws Exception {
226
        MultiFileSystem mfs = (MultiFileSystem)this.testedFS;
227
        List<FileSystem> all = new ArrayList<FileSystem>(Arrays.asList(mfs.getDelegates()));
228
        File f = writeFile("layer.xml",
229
                "<filesystem>\n"
230
                + "    <folder name =\"org-sepix\">\n"
231
                + "       <folder name =\"Panes\">\n"
232
                + "            <file name=\"Demo.txt\">\n"
233
                + "                <attr name=\"position\" intvalue=\"100\"/>\n"
234
                + "            </file>\n"
235
                + "      </folder>\n"
236
                + "    </folder>\n"
237
                + "</filesystem>");
238
        XMLFileSystem xml = new XMLFileSystem(f.toURI().toURL());
239
        all.add(xml);
240
        mfs.setDelegates(all.toArray(new FileSystem[0]));
241
242
243
        FileObject folder = mfs.findResource("org-sepix/Panes/");
244
245
        for (FileObject fileObject : folder.getChildren()) {
246
            assertEquals("should be 100", 100, fileObject.getAttribute("position"));
247
248
            fileObject.setAttribute("position", 200);
249
            assertEquals("should be 200", 200, fileObject.getAttribute("position"));
250
            assertEquals("should be 200 still", 200, fileObject.getAttribute("position"));
251
        }
252
    }
253
254
    private File writeFile(String name, String content) throws IOException {
255
        File f = new File(getWorkDir(), name);
256
        java.io.FileWriter w = new java.io.FileWriter(f);
257
        w.write(content);
258
        w.close();
259
        return f;
260
    }
261
    
222
}
262
}
(-)a/openide.filesystems/test/unit/src/org/openide/filesystems/XMLFileSystemTestHid.java (+26 lines)
Lines 333-338 Link Here
333
        assertNotNull("Returned", instance);
333
        assertNotNull("Returned", instance);
334
        assertEquals("Right class", Count.class, instance.getClass());
334
        assertEquals("Right class", Count.class, instance.getClass());
335
    }
335
    }
336
    public void testMultiFileSystemWithOverridenAttributes() throws Exception {
337
        File f = writeFile("layer.xml",
338
                "<filesystem>\n"
339
                + "    <folder name =\"org-sepix\">\n"
340
                + "       <folder name =\"Panes\">\n"
341
                + "            <file name=\"Demo.txt\">\n"
342
                + "                <attr name=\"position\" intvalue=\"100\"/>\n"
343
                + "            </file>\n"
344
                + "      </folder>\n"
345
                + "    </folder>\n"
346
                + "</filesystem>");
347
348
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, f.toURI().toURL());
349
        final LocalFileSystem lfs = new LocalFileSystem();
350
        lfs.setRootDirectory(getWorkDir());
351
        MultiFileSystem mfs = new MultiFileSystem(new FileSystem[] { lfs, xfs });
352
        FileObject folder = mfs.findResource("org-sepix/Panes/");
353
354
        for (FileObject fileObject : folder.getChildren()) {
355
            assertEquals("should be 100", 100, fileObject.getAttribute("position"));
356
357
            fileObject.setAttribute("position", 200);
358
            assertEquals("should be 200", 200, fileObject.getAttribute("position"));
359
            assertEquals("should be 200 still", 200, fileObject.getAttribute("position"));
360
        }
361
    }
336
362
337
    public void testGetAttributeDoesNotAccessAllAttributes() throws Exception {
363
    public void testGetAttributeDoesNotAccessAllAttributes() throws Exception {
338
        File f = writeFile("layer.xml",
364
        File f = writeFile("layer.xml",

Return to bug 197308