Line 0
Link Here
|
|
|
1 |
/* |
2 |
* The contents of this file are subject to the terms of the Common Development |
3 |
* and Distribution License (the License). You may not use this file except in |
4 |
* compliance with the License. |
5 |
* |
6 |
* You can obtain a copy of the License at http://www.netbeans.org/cddl.html |
7 |
* or http://www.netbeans.org/cddl.txt. |
8 |
* |
9 |
* When distributing Covered Code, include this CDDL Header Notice in each file |
10 |
* and include the License file at http://www.netbeans.org/cddl.txt. |
11 |
* If applicable, add the following below the CDDL Header, with the fields |
12 |
* enclosed by brackets [] replaced by your own identifying information: |
13 |
* "Portions Copyrighted [year] [name of copyright owner]" |
14 |
* |
15 |
* Portions Copyrighted 2007 Nokia Siemens Networks Oy |
16 |
*/ |
17 |
package org.netbeans.core.startup.layers; |
18 |
|
19 |
import org.netbeans.junit.NbTestCase; |
20 |
import org.openide.filesystems.FileObject; |
21 |
import org.openide.filesystems.FileSystem; |
22 |
import org.openide.filesystems.Repository; |
23 |
import org.openide.util.actions.SystemAction; |
24 |
|
25 |
/** |
26 |
* Tests whether the system property |
27 |
* <code>org.netbeans.core.systemfilesystem.custom</code> correctly |
28 |
* installs a custom filesystem. |
29 |
* |
30 |
* @author David Strupl |
31 |
*/ |
32 |
public class CustomWritableSystemFileSystemTest extends NbTestCase { |
33 |
|
34 |
private SystemFileSystem sfs; |
35 |
|
36 |
public CustomWritableSystemFileSystemTest(String testName) { |
37 |
super(testName); |
38 |
} |
39 |
|
40 |
protected void setUp() throws Exception { |
41 |
System.setProperty("netbeans.user", "memory"); |
42 |
System.setProperty("org.netbeans.core.systemfilesystem.custom", PoohFileSystem.class.getName()); |
43 |
sfs = (SystemFileSystem) Repository.getDefault().getDefaultFileSystem(); |
44 |
} |
45 |
|
46 |
public void testCustomSFSWritableLayerPresent() throws Exception { |
47 |
FileSystem writable = sfs.createWritableOn(null); |
48 |
assertTrue(writable instanceof ModuleLayeredFileSystem); |
49 |
ModuleLayeredFileSystem mlf = (ModuleLayeredFileSystem) writable; |
50 |
assertTrue(mlf.getWritableLayer() instanceof PoohFileSystem); |
51 |
} |
52 |
|
53 |
public static class PoohFileSystem extends FileSystem { |
54 |
|
55 |
public String getDisplayName() { |
56 |
return "Pooh"; |
57 |
} |
58 |
|
59 |
public boolean isReadOnly() { |
60 |
return false; |
61 |
} |
62 |
|
63 |
public FileObject getRoot() { |
64 |
throw new UnsupportedOperationException("Not supported yet."); |
65 |
} |
66 |
|
67 |
public FileObject findResource(String name) { |
68 |
throw new UnsupportedOperationException("Not supported yet."); |
69 |
} |
70 |
|
71 |
public SystemAction[] getActions() { |
72 |
throw new UnsupportedOperationException("Not supported yet."); |
73 |
} |
74 |
} |
75 |
} |