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