1 19 24 25 package org.netbeans.jmi.javamodel.regenerator; 26 27 import java.beans.PropertyVetoException ; 28 import java.io.File ; 29 import java.io.IOException ; 30 import junit.textui.TestRunner; 31 import org.netbeans.jmi.javamodel.codegen.Utility; 32 import org.netbeans.jmi.javamodel.codegen.Utility; 33 import org.netbeans.junit.NbTestCase; 34 import org.netbeans.junit.NbTestSuite; 35 import org.openide.filesystems.FileSystem; 36 import org.openide.filesystems.LocalFileSystem; 37 38 42 public class Main extends NbTestCase { 43 44 45 public Main(String name) { 46 super(name); 47 48 } 49 50 53 public static void main(String [] args) { 54 TestRunner.run(suite()); 55 } 56 57 public static NbTestSuite suite() { 58 NbTestSuite suite = new NbTestSuite(); 59 suite.addTest(new Main("testRegenerateFileSystem")); 60 return suite; 61 } 62 63 80 public void testRegenerateFileSystem () { 81 String fsName = System.getProperty("org.netbeans.javacore.fsname"); 82 FileSystem fs = null; 83 if (fsName == null) { 84 fs = Utility.findFileSystem("sampledir"); 85 } else { 86 try { 87 fs = new LocalFileSystem(); 88 ((LocalFileSystem) fs).setRootDirectory(new File (fsName)); 89 } catch (PropertyVetoException e) { 90 fail(e.toString()); 91 } catch (IOException e) { 92 fail(e.toString()); 93 } 94 } 95 96 Regenerator regenerator = new Regenerator(); 97 regenerator.setSourceFileSystem(fs); 98 regenerator.setTargetFileSystem(Utility.findFileSystem("testsrc")); 99 regenerator.regenerateAll(); 100 } 101 } 102 | Popular Tags |