1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 package org.objectledge.filesystem;
30
31 import java.io.IOException;
32
33 import junit.framework.TestCase;
34
35 /***
36 *
37 *
38 * @author <a href="Rafal.Krzewski">rafal@caltha.pl</a>
39 * @version $Id: ClasspathFileSystemProviderTest.java,v 1.3 2004/04/01 08:54:25 fil Exp $
40 */
41 public class ClasspathFileSystemProviderTest extends TestCase
42 {
43 protected ClasspathFileSystemProvider provider;
44
45 /***
46 * Constructor for LocalFileProviderTest.
47 * @param arg0
48 */
49 public ClasspathFileSystemProviderTest(String arg0)
50 {
51 super(arg0);
52 }
53
54
55
56
57 protected void setUp() throws Exception
58 {
59 super.setUp();
60 provider = new ClasspathFileSystemProvider("classpath",
61 ClasspathFileSystemProvider.class.getClassLoader());
62 }
63
64 public void testGetName()
65 {
66 assertEquals(provider.getName(), "classpath");
67 }
68
69 public void testIsReadOnly()
70 {
71 assertTrue("Provider is read only", provider.isReadOnly());
72 }
73
74 public void testExists()
75 {
76 assertTrue("File does not exist - check test resources!",
77 provider.exists("org/objectledge/filesystem/ClasspathFileSystemProvider.class"));
78 assertFalse("File exists - check test resources!", provider.exists("nofile"));
79 }
80
81 public void testIsFile()
82 {
83 assertTrue("The resource is not a file - check test resources!",
84 provider.isFile("org/objectledge/filesystem/ClasspathFileSystemProvider.class"));
85
86
87 }
88
89 public void testIsDirectory()
90 {
91
92
93 assertFalse("The resource is a directory - check test resources!",
94 provider.isDirectory("org/objectledge/filesystem/ClasspathFileSystemProvider.class"));
95 }
96
97 public void testCanRead()
98 {
99 assertTrue("The resource is not readable - check test resources!",
100 provider.canRead("org/objectledge/filesystem/ClasspathFileSystemProvider.class"));
101 assertFalse("The resource is readable - check test resources!",
102 provider.canRead("nofile"));
103 }
104
105 public void testCanWrite()
106 {
107 assertFalse("The resource is writable - check test resources!",
108 provider.canWrite("nofile"));
109 }
110
111 public void testList()
112 throws Exception
113 {
114
115
116 }
117
118 public void testCreateNewFile()
119 throws Exception
120 {
121 try
122 {
123 provider.createNewFile("foo");
124 fail("should throw the exception");
125 }
126 catch(IOException e)
127 {
128
129 }
130 }
131
132 public void testMkdirs()
133 throws IOException
134 {
135 try
136 {
137 provider.mkdirs("foo");
138 fail("should throw the exception");
139 }
140 catch(IOException e)
141 {
142
143 }
144 }
145
146 public void testDelete()
147 {
148 try
149 {
150 provider.delete("foo");
151 fail("should throw the exception");
152 }
153 catch(IOException e)
154 {
155
156 }
157 }
158
159 public void testRename()
160 {
161 try
162 {
163 provider.rename("foo","foo");
164 fail("should throw the exception");
165 }
166 catch(IOException e)
167 {
168
169 }
170 }
171
172 public void testGetInputStream()
173 {
174
175 }
176
177 public void testGetOutputStream()
178 {
179 assertNull(provider.getOutputStream("",true));
180 }
181
182 public void testGetRandomAccess()
183 {
184 assertNull(provider.getRandomAccess("",""));
185 }
186
187 public void testLastModified()
188 {
189 assertEquals(-1L, provider.lastModified(""));
190
191
192 }
193
194 public void testLength()
195 {
196 assertEquals(-1L, provider.length(""));
197
198
199 }
200 }