KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derbyTesting > functionTests > tests > store > LogChecksumRecovery


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

21
22 package org.apache.derbyTesting.functionTests.tests.store;
23 import java.sql.Connection JavaDoc;
24 import java.sql.SQLException JavaDoc;
25 import java.util.zip.CRC32 JavaDoc;
26 import org.apache.derby.tools.ij;
27
28 /*
29  * Purpose of this class is to test the database recovery of
30  * the inserts executed with simulated log corruption in LogChecksumSetup.java
31  * and perform some updates after a successfully boot.
32  * This test should be run after the store/LogChecksumSetup.java.
33  *
34  * @author <a HREF="mailto:suresh.thalamati@gmail.com">Suresh Thalamati</a>
35  * @version 1.0
36  * @see LogChecksumSetup
37  */

38
39 public class LogChecksumRecovery extends LogChecksumSetup {
40
41     LogChecksumRecovery()
42     {
43         super();
44     }
45     
46     private void runTest(Connection JavaDoc conn) throws SQLException JavaDoc
47     {
48         logMessage("Begin LogCheckumRecovery Test");
49         verifyData(conn, 10);
50         updateAndCorrupt(conn, 10);
51         logMessage("End LogCheckumRecovery Test");
52     }
53     
54     public static void main(String JavaDoc[] argv)
55         throws Throwable JavaDoc
56     {
57         
58         LogChecksumRecovery lctest = new LogChecksumRecovery();
59         ij.getPropertyArg(argv);
60         Connection JavaDoc conn = ij.startJBMS();
61         conn.setAutoCommit(false);
62
63         try {
64             lctest.runTest(conn);
65         }
66         catch (SQLException JavaDoc sqle) {
67             org.apache.derby.tools.JDBCDisplayUtil.ShowSQLException(
68                 System.out, sqle);
69             sqle.printStackTrace(System.out);
70         }
71     }
72 }
73
74
75
76
77
78
79
80
81
82
Popular Tags