01: /*
02:
03: Derby - Class org.apache.derbyTesting.functionTests.store.LogChecksumRecovery
04:
05: Licensed to the Apache Software Foundation (ASF) under one or more
06: contributor license agreements. See the NOTICE file distributed with
07: this work for additional information regarding copyright ownership.
08: The ASF licenses this file to You under the Apache License, Version 2.0
09: (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:
24: import java.sql.Connection;
25: import java.sql.SQLException;
26: import java.util.zip.CRC32;
27: import org.apache.derby.tools.ij;
28:
29: /*
30: * Purpose of this class is to test the database recovery of
31: * the inserts executed with simulated log corruption in LogChecksumSetup.java
32: * and perform some updates after a successfully boot.
33: * This test should be run after the store/LogChecksumSetup.java.
34: *
35: * @author <a href="mailto:suresh.thalamati@gmail.com">Suresh Thalamati</a>
36: * @version 1.0
37: * @see LogChecksumSetup
38: */
39:
40: public class LogChecksumRecovery extends LogChecksumSetup {
41:
42: LogChecksumRecovery() {
43: super ();
44: }
45:
46: private void runTest(Connection conn) throws SQLException {
47: logMessage("Begin LogCheckumRecovery Test");
48: verifyData(conn, 10);
49: updateAndCorrupt(conn, 10);
50: logMessage("End LogCheckumRecovery Test");
51: }
52:
53: public static void main(String[] argv) throws Throwable {
54:
55: LogChecksumRecovery lctest = new LogChecksumRecovery();
56: ij.getPropertyArg(argv);
57: Connection conn = ij.startJBMS();
58: conn.setAutoCommit(false);
59:
60: try {
61: lctest.runTest(conn);
62: } catch (SQLException sqle) {
63: org.apache.derby.tools.JDBCDisplayUtil.ShowSQLException(
64: System.out, sqle);
65: sqle.printStackTrace(System.out);
66: }
67: }
68: }
|