1 19 20 package org.netbeans.core.startup; 21 22 import java.io.File ; 23 import java.io.IOException ; 24 import java.io.OutputStream ; 25 import org.netbeans.junit.NbTestCase; 26 import org.openide.filesystems.*; 27 28 32 public class NbRepositoryTest extends NbTestCase { 33 34 public NbRepositoryTest(String testName) { 35 super(testName); 36 } 37 38 protected void setUp() throws Exception { 39 } 40 41 protected void tearDown() throws Exception { 42 } 43 44 public void testUserDirIsWriteableEvenInstallDirDoesNotExists() throws IOException { 45 System.getProperties().remove("netbeans.home"); 46 System.setProperty("netbeans.user", getWorkDirPath()); 47 48 FileObject fo = Repository.getDefault().getDefaultFileSystem().getRoot(); 49 50 FileObject ahoj = FileUtil.createData(fo, "ahoj.jardo"); 51 52 OutputStream os = ahoj.getOutputStream(); 53 os.write("Ahoj".getBytes()); 54 os.close(); 55 56 File af = new File (new File (getWorkDir(), "config"), "ahoj.jardo"); 57 assertTrue("File created", af.exists()); 58 assertEquals("4 bytes", 4, af.length()); 59 } 60 } 61 | Popular Tags |