KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > vfs > test > FileSystemManagerFactoryTestCase


1 /*
2  * Copyright 2002-2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.commons.vfs.test;
17
18 import org.apache.commons.AbstractVfsTestCase;
19 import org.apache.commons.vfs.FileObject;
20 import org.apache.commons.vfs.FileSystemManager;
21 import org.apache.commons.vfs.FileType;
22 import org.apache.commons.vfs.VFS;
23
24 import java.io.File JavaDoc;
25
26 /**
27  * Test cases for the VFS factory.
28  *
29  * @author <a HREF="mailto:adammurdoch@apache.org">Adam Murdoch</a>
30  */

31 public class FileSystemManagerFactoryTestCase
32     extends AbstractVfsTestCase
33 {
34     /**
35      * Sanity test.
36      */

37     public void testDefaultInstance() throws Exception JavaDoc
38     {
39         // Locate the default manager
40
final FileSystemManager manager = VFS.getManager();
41
42         // Lookup a test jar file
43
final File JavaDoc jarFile = getTestResource("test.jar");
44         FileObject file = manager.toFileObject(jarFile);
45         assertNotNull(file);
46         assertTrue(file.exists());
47         assertSame(FileType.FILE, file.getType());
48
49         // Expand it
50
file = manager.createFileSystem(file);
51         assertNotNull(file);
52         assertTrue(file.exists());
53         assertSame(FileType.FOLDER, file.getType());
54     }
55
56 }
57
Popular Tags