1 37 package net.sourceforge.cruisecontrol; 38 39 import java.io.File ; 40 import java.io.IOException ; 41 42 import junit.extensions.TestSetup; 43 import junit.framework.Test; 44 45 53 public class LogFileSetupDecorator extends TestSetup { 54 public static final File LOG_DIR = new File ("tempLogDir"); 55 private File [] logFiles; 56 57 60 public LogFileSetupDecorator(Test decoratedTest) { 61 super(decoratedTest); 62 } 63 64 protected void setUp() throws IOException { 65 if (!LOG_DIR.exists()) { 66 assertTrue("Failed to create test result dir", LOG_DIR.mkdir()); 67 } 68 logFiles = new File [] { new File (LOG_DIR, "log20020222120000.xml"), 69 new File (LOG_DIR, "log20020223120000LBuild.1.xml"), 70 new File (LOG_DIR, "log20020224120000.xml"), 71 new File (LOG_DIR, "log20020225120000LBuild.2.xml"), 72 new File (LOG_DIR, "log20041018160000.xml.gz"), 73 new File (LOG_DIR, "log20041018170000LBuild.3.xml.gz")}; 74 for (int i = 0; i < logFiles.length; i++) { 75 File logFile = logFiles[i]; 76 logFile.createNewFile(); 77 } 78 } 79 80 protected void tearDown() throws Exception { 81 for (int i = 0; i < logFiles.length; i++) { 82 logFiles[i].delete(); 83 } 84 LOG_DIR.delete(); 85 } 86 } | Popular Tags |