author | Jaroslav Tulach <jaroslav.tulach@apidesign.org> |
Thu, 30 Oct 2014 20:46:27 +0100 | |
changeset 408 | 9a439a79c6d0 |
parent 144 | cef9a41a770a |
permissions | -rw-r--r-- |
jtulach@144 | 1 |
package org.apidesign.samples; |
jtulach@144 | 2 |
|
jtulach@144 | 3 |
import java.io.File; |
jtulach@144 | 4 |
import java.io.IOException; |
jtulach@144 | 5 |
import junit.framework.Test; |
jtulach@144 | 6 |
import org.netbeans.junit.NbTestCase; |
jtulach@144 | 7 |
import org.netbeans.junit.NbTestSetup; |
jtulach@144 | 8 |
import org.netbeans.junit.NbTestSuite; |
jtulach@144 | 9 |
import org.openide.filesystems.FileSystem; |
jtulach@144 | 10 |
import org.openide.filesystems.JarFileSystem; |
jtulach@144 | 11 |
|
jtulach@144 | 12 |
public class FileSystemLikeTCK { |
jtulach@144 | 13 |
// BEGIN: tck.factory |
jtulach@144 | 14 |
public static abstract class FileSystemFactoryHid extends NbTestSetup { |
jtulach@144 | 15 |
public FileSystemFactoryHid(Test testToDecorate) { |
jtulach@144 | 16 |
super(testToDecorate); |
jtulach@144 | 17 |
} |
jtulach@144 | 18 |
|
jtulach@144 | 19 |
protected abstract FileSystem createFileSystem( |
jtulach@144 | 20 |
String testName, String[] resources |
jtulach@144 | 21 |
) throws Exception; |
jtulach@144 | 22 |
protected abstract void destroyFileSystem( |
jtulach@144 | 23 |
String testName |
jtulach@144 | 24 |
) throws IOException; |
jtulach@144 | 25 |
} |
jtulach@144 | 26 |
// END: tck.factory |
jtulach@144 | 27 |
|
jtulach@144 | 28 |
|
jtulach@144 | 29 |
// BEGIN: tck.setup |
jtulach@144 | 30 |
public static class JarFileSystemTest extends FileSystemFactoryHid { |
jtulach@144 | 31 |
public JarFileSystemTest(Test testToDecorate) { |
jtulach@144 | 32 |
super(testToDecorate); |
jtulach@144 | 33 |
} |
jtulach@144 | 34 |
|
jtulach@144 | 35 |
public static Test suite() { |
jtulach@144 | 36 |
NbTestSuite suite = new NbTestSuite(); |
jtulach@144 | 37 |
suite.addTestSuite(RepositoryTestHid.class); |
jtulach@144 | 38 |
suite.addTestSuite(FileSystemTestHid.class); |
jtulach@144 | 39 |
suite.addTestSuite(FileObjectTestHid.class); |
jtulach@144 | 40 |
return new JarFileSystemTest(suite); |
jtulach@144 | 41 |
} |
jtulach@144 | 42 |
|
jtulach@144 | 43 |
protected void destroyFileSystem(String testName) throws IOException { |
jtulach@144 | 44 |
} |
jtulach@144 | 45 |
|
jtulach@145 | 46 |
protected FileSystem createFileSystem( |
jtulach@145 | 47 |
String testName, String[] resources |
jtulach@145 | 48 |
) throws Exception { |
jtulach@144 | 49 |
JarFileSystem fs = new JarFileSystem(); |
jtulach@144 | 50 |
fs.setJarFile(createJarFile(testName, resources)); |
jtulach@144 | 51 |
return fs; |
jtulach@144 | 52 |
} |
jtulach@144 | 53 |
} |
jtulach@144 | 54 |
// END: tck.setup |
jtulach@144 | 55 |
|
jtulach@144 | 56 |
static File createJarFile(String name, String[] resources) { |
jtulach@144 | 57 |
return null; |
jtulach@144 | 58 |
} |
jtulach@144 | 59 |
|
jtulach@144 | 60 |
public static final class RepositoryTestHid extends NbTestCase { |
jtulach@144 | 61 |
public RepositoryTestHid(String name) { |
jtulach@144 | 62 |
super(name); |
jtulach@144 | 63 |
} |
jtulach@144 | 64 |
|
jtulach@144 | 65 |
} |
jtulach@144 | 66 |
public static final class FileSystemTestHid extends NbTestCase { |
jtulach@144 | 67 |
public FileSystemTestHid(String name) { |
jtulach@144 | 68 |
super(name); |
jtulach@144 | 69 |
} |
jtulach@144 | 70 |
|
jtulach@144 | 71 |
} |
jtulach@144 | 72 |
public static final class FileObjectTestHid extends NbTestCase { |
jtulach@144 | 73 |
public FileObjectTestHid(String name) { |
jtulach@144 | 74 |
super(name); |
jtulach@144 | 75 |
} |
jtulach@144 | 76 |
} |
jtulach@144 | 77 |
} |