1 19 20 package org.netbeans.core.startup.layers; 21 22 import java.io.File ; 23 import java.io.IOException ; 24 import java.net.URL ; 25 import java.util.Arrays ; 26 import junit.framework.Test; 27 import org.netbeans.junit.NbTestSuite; 28 import org.openide.filesystems.AttributesTestHidden; 29 import org.openide.filesystems.FileObjectTestHid; 30 import org.openide.filesystems.FileSystem; 31 import org.openide.filesystems.FileSystemFactoryHid; 32 import org.openide.filesystems.FileSystemTestHid; 33 import org.openide.filesystems.TestUtilHid; 34 import org.openide.filesystems.XMLFileSystem; 35 36 40 public class BinaryFSTest extends FileSystemFactoryHid { 41 public BinaryFSTest(Test test) { 42 super(test); 43 } 44 45 public static Test suite() { 46 NbTestSuite suite = new NbTestSuite(); 47 suite.addTestSuite(FileSystemTestHid.class); 48 suite.addTestSuite(FileObjectTestHid.class); 49 suite.addTestSuite(AttributesTestHidden.class); 50 51 return new BinaryFSTest(suite); 52 } 53 54 protected FileSystem[] createFileSystem(String testName, String [] resources) throws IOException { 55 XMLFileSystem xfs = (XMLFileSystem)TestUtilHid.createXMLFileSystem(testName, resources); 56 BinaryCacheManager bm = new BinaryCacheManager(getWorkDir()); 57 FileSystem fs = bm.store(Arrays.asList(new URL [] {xfs.getXmlUrl()})); 58 return new FileSystem[] {fs}; 59 } 60 61 protected void destroyFileSystem(String testName) throws IOException { 62 } 63 64 private File getWorkDir() { 65 String workDirProperty = System.getProperty("workdir"); workDirProperty = (workDirProperty != null) ? workDirProperty : System.getProperty("java.io.tmpdir"); return new File (workDirProperty); 68 } 69 } 70 | Popular Tags |