public void testDeleteAbstractSwapFile() throws IOException { SwapFile sf = SwapFile.get(new File(DIR_NAME), FILE_NAME); sf.spoolDone(); // File on disk does not exist. It will not be removed from disk space. assertTrue("File should be deleted.", sf.delete()); }
public void testGetSwapFile() throws IOException { // Get swap file is possible only in this way. SwapFile sf = SwapFile.get(new File(DIR_NAME), FILE_NAME); assertNotNull("File should be created.", sf); sf.spoolDone(); sf.delete(); }
public void testDeleteExistingSwapFile() throws IOException { SwapFile sf = SwapFile.get(new File(DIR_NAME), FILE_NAME); // write to file OutputStream out = new FileOutputStream(sf); byte[] outWrite = new byte[] {1, 2, 3}; out.write(outWrite); out.close(); sf.spoolDone(); // File is present on the disk. It will be removed from disk space. assertTrue("File should be deleted.", sf.delete()); }
public void testCreateTempFile() { // Not applicable creation. try { SwapFile.createTempFile("prefix", "suffix", new File(DIR_NAME)); fail("IOException should have been thrown."); } catch (IOException e) { // Ok. } }
public void testIsSpooled() throws IOException { SwapFile sf = SwapFile.get(new File(DIR_NAME), FILE_NAME); assertFalse("Spool is not over.", sf.isSpooled()); sf.spoolDone(); assertTrue("Spool is over.", sf.isSpooled()); sf.delete(); }
public void testSpoolDone() throws IOException { SwapFile sf = SwapFile.get(new File(DIR_NAME), FILE_NAME); sf.spoolDone(); assertTrue("Spool should be done.", sf.isSpooled()); sf.delete(); }