KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > transaction > log > HOWLLogTest


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 package org.apache.geronimo.transaction.log;
19
20 import java.io.File JavaDoc;
21
22 import junit.extensions.TestSetup;
23 import junit.framework.Test;
24 import junit.framework.TestSuite;
25 import org.apache.geronimo.transaction.manager.TransactionLog;
26 import org.apache.geronimo.transaction.manager.XidFactory;
27 import org.apache.geronimo.transaction.manager.XidFactoryImpl;
28
29 /**
30  *
31  *
32  * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
33  *
34  * */

35 public class HOWLLogTest extends AbstractLogTest {
36     private static final File JavaDoc basedir = new File JavaDoc(System.getProperty("basedir", System.getProperty("user.dir")));
37     private static final String JavaDoc LOG_FILE_NAME = "howl_test";
38
39
40     protected String JavaDoc getResultFileName() {
41         return "howllog";
42     }
43
44     protected void closeTransactionLog(TransactionLog transactionLog) throws Exception JavaDoc {
45         ((HOWLLog) transactionLog).doStop();
46     }
47
48
49     protected TransactionLog createTransactionLog() throws Exception JavaDoc {
50         XidFactory xidFactory = new XidFactoryImpl();
51         HOWLLog howlLog = new HOWLLog(
52                 "org.objectweb.howl.log.BlockLogBuffer", // "bufferClassName",
53
4, // "bufferSizeKBytes",
54
true, // "checksumEnabled",
55
true, // "adler32Checksum",
56
20, // "flushSleepTime",
57
"txlog", // "logFileDir",
58
"log", // "logFileExt",
59
LOG_FILE_NAME, // "logFileName",
60
200, // "maxBlocksPerFile",
61
10, // "maxBuffers",
62
2, // "maxLogFiles",
63
2, // "minBuffers",
64
10,// "threadsWaitingForceThreshold"});
65
xidFactory,
66                 new File JavaDoc(basedir, "target")
67         );
68         howlLog.doStart();
69         return howlLog;
70     }
71     public static Test suite() {
72         return new TestSetup(new TestSuite(HOWLLogTest.class)) {
73             protected void setUp() throws Exception JavaDoc {
74                 File JavaDoc logFile = new File JavaDoc(basedir, "target/" + LOG_FILE_NAME + "_1.log");
75                 if (logFile.exists()) {
76                     logFile.delete();
77                 }
78                 logFile = new File JavaDoc(basedir, "target/" + LOG_FILE_NAME + "_2.log");
79                 if (logFile.exists()) {
80                     logFile.delete();
81                 }
82             }
83         };
84     }
85
86 }
87
Popular Tags