1 17 18 package org.apache.geronimo.transaction.manager; 19 20 import java.io.File ; 21 22 import org.apache.geronimo.transaction.log.HOWLLog; 23 import junit.framework.Test; 24 import junit.framework.TestSuite; 25 import junit.extensions.TestSetup; 26 27 33 public class HOWLLogRecoveryTest extends AbstractRecoveryTest { 34 private static final File basedir = new File (System.getProperty("basedir", System.getProperty("user.dir"))); 35 private static final String LOG_FILE_NAME = "howl_test_"; 36 private static final String logFileDir = "txlog"; 37 private static final String targetDir = new File (basedir, "target").getAbsolutePath(); 38 private static final File txlogDir = new File (basedir, "target/" + logFileDir); 39 40 public void test2Again() throws Exception { 41 test2ResOnlineAfterRecoveryStart(); 42 } 43 44 public void test3Again() throws Exception { 45 test3ResOnlineAfterRecoveryStart(); 46 } 47 48 protected void setUp() throws Exception { 49 File [] files = txlogDir.listFiles(); 51 if ( null != files ) { 52 for (int i = 0; i < files.length; i++) { 53 files[i].delete(); 54 } 55 } 56 setUpHowlLog(); 57 } 58 59 private void setUpHowlLog() throws Exception { 60 HOWLLog howlLog = new HOWLLog( 61 "org.objectweb.howl.log.BlockLogBuffer", 4, true, true, 20, logFileDir, "log", LOG_FILE_NAME, 200, 10, 2, 2, 10, xidFactory, 75 new File (targetDir) 76 ); 77 howlLog.doStart(); 78 txLog = howlLog; 79 } 80 81 protected void tearDown() throws Exception { 82 ((HOWLLog)txLog).doStop(); 83 txLog = null; 84 } 85 86 protected void prepareForReplay() throws Exception { 87 tearDown(); 88 setUpHowlLog(); 89 } 90 91 public static Test suite() { 92 return new TestSetup(new TestSuite(HOWLLogRecoveryTest.class)) { 93 protected void setUp() throws Exception { 94 File logFile = new File (txlogDir, LOG_FILE_NAME + "_1.log"); 95 if (logFile.exists()) { 96 logFile.delete(); 97 } 98 logFile = new File (txlogDir, LOG_FILE_NAME + "_2.log"); 99 if (logFile.exists()) { 100 logFile.delete(); 101 } 102 } 103 }; 104 } 105 } 106 | Popular Tags |