1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/samples/individualsamples/test/org/apidesign/samples/FileSystemLikeTCK.java Sat Jun 14 09:57:15 2008 +0200
1.3 @@ -0,0 +1,75 @@
1.4 +package org.apidesign.samples;
1.5 +
1.6 +import java.io.File;
1.7 +import java.io.IOException;
1.8 +import junit.framework.Test;
1.9 +import org.netbeans.junit.NbTestCase;
1.10 +import org.netbeans.junit.NbTestSetup;
1.11 +import org.netbeans.junit.NbTestSuite;
1.12 +import org.openide.filesystems.FileSystem;
1.13 +import org.openide.filesystems.JarFileSystem;
1.14 +
1.15 +public class FileSystemLikeTCK {
1.16 + // BEGIN: tck.factory
1.17 + public static abstract class FileSystemFactoryHid extends NbTestSetup {
1.18 + public FileSystemFactoryHid(Test testToDecorate) {
1.19 + super(testToDecorate);
1.20 + }
1.21 +
1.22 + protected abstract FileSystem createFileSystem(
1.23 + String testName, String[] resources
1.24 + ) throws Exception;
1.25 + protected abstract void destroyFileSystem(
1.26 + String testName
1.27 + ) throws IOException;
1.28 + }
1.29 + // END: tck.factory
1.30 +
1.31 +
1.32 + // BEGIN: tck.setup
1.33 + public static class JarFileSystemTest extends FileSystemFactoryHid {
1.34 + public JarFileSystemTest(Test testToDecorate) {
1.35 + super(testToDecorate);
1.36 + }
1.37 +
1.38 + public static Test suite() {
1.39 + NbTestSuite suite = new NbTestSuite();
1.40 + suite.addTestSuite(RepositoryTestHid.class);
1.41 + suite.addTestSuite(FileSystemTestHid.class);
1.42 + suite.addTestSuite(FileObjectTestHid.class);
1.43 + return new JarFileSystemTest(suite);
1.44 + }
1.45 +
1.46 + protected void destroyFileSystem(String testName) throws IOException {
1.47 + }
1.48 +
1.49 + protected FileSystem createFileSystem(String testName, String[] resources) throws Exception {
1.50 + JarFileSystem fs = new JarFileSystem();
1.51 + fs.setJarFile(createJarFile(testName, resources));
1.52 + return fs;
1.53 + }
1.54 + }
1.55 + // END: tck.setup
1.56 +
1.57 + static File createJarFile(String name, String[] resources) {
1.58 + return null;
1.59 + }
1.60 +
1.61 + public static final class RepositoryTestHid extends NbTestCase {
1.62 + public RepositoryTestHid(String name) {
1.63 + super(name);
1.64 + }
1.65 +
1.66 + }
1.67 + public static final class FileSystemTestHid extends NbTestCase {
1.68 + public FileSystemTestHid(String name) {
1.69 + super(name);
1.70 + }
1.71 +
1.72 + }
1.73 + public static final class FileObjectTestHid extends NbTestCase {
1.74 + public FileObjectTestHid(String name) {
1.75 + super(name);
1.76 + }
1.77 + }
1.78 +}