1 19 20 package org.netbeans.nbbuild; 21 22 import java.io.File ; 23 import java.io.FileOutputStream ; 24 import java.io.IOException ; 25 import java.io.InputStream ; 26 import junit.framework.*; 27 import org.netbeans.junit.*; 28 29 33 public class TestDepsTest extends NbTestCase { 34 35 public TestDepsTest(java.lang.String testName) { 36 super(testName); 37 } 38 39 public static void main(java.lang.String [] args) { 40 junit.textui.TestRunner.run(suite()); 41 } 42 43 public static Test suite() { 44 TestSuite suite = new NbTestSuite(TestDepsTest.class); 45 return suite; 46 } 47 48 49 public void testDepsTest () throws Exception { 50 File projectxml = extractFile(TestDepsTest.class.getResourceAsStream("TestDepsProject.xml"),"project.xml"); 52 PublicPackagesInProjectizedXMLTest.execute ("TestDeps.xml", new String [] { "-verbose", "-Dproject.file=" + projectxml, "test-deps" }); 53 } 54 public void testDepsNoTestDeps() throws Exception { 55 File projectxml = extractFile(TestDepsTest.class.getResourceAsStream("TestDepsProjectNoTestDeps.xml"),"project.xml"); 56 PublicPackagesInProjectizedXMLTest.execute ("TestDeps.xml", new String [] { "-verbose", "-Dproject.file=" + projectxml, "test-deps-no-test-deps" }); 57 58 } 59 60 private File extractFile(InputStream is, String fileName) throws IOException { 61 File f = new File (getWorkDir(),fileName); 62 byte bytes[] = new byte[50000]; 63 FileOutputStream fos = new FileOutputStream (f); 64 int len = is.read(bytes); 65 fos.write(bytes,0,len); 66 fos.close(); 67 return f; 68 } 69 70 71 } 72 | Popular Tags |