01: /*
02:
03: Derby - Class org.apache.derbyTesting.functionTests.harness.procedure
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 org.apache.derby.iapi.db.OnlineCompress;
25:
26: import org.apache.derby.iapi.services.sanity.SanityManager;
27:
28: import java.sql.CallableStatement;
29: import java.sql.Connection;
30: import java.sql.PreparedStatement;
31: import java.sql.ResultSet;
32: import java.sql.SQLException;
33: import java.sql.Statement;
34:
35: import org.apache.derby.tools.ij;
36:
37: public class oc_rec4 extends OnlineCompressTest {
38:
39: public oc_rec4() {
40: }
41:
42: /**
43: * setup for restart recovery test.
44: * <p>
45: * Do setup to test restart recovery of online compress. Real work
46: * is done in next test oc_rec4 which will run restart recovery on
47: * the work done in this test.
48: *
49: **/
50: private void test1(Connection conn, String test_name,
51: String table_name) throws SQLException {
52: beginTest(conn, test_name);
53:
54: // oc_rec3 left the table with no rows, but compress command
55: // did not commit.
56: String table_name_2 = table_name + "_2";
57: if (!checkConsistency(conn, "APP", table_name_2)) {
58: logError("conistency check failed.");
59: }
60:
61: // make sure we can add data to the existing table after redo
62: // recovery.
63: createAndLoadTable(conn, false, table_name_2, 6000, 0);
64: if (!checkConsistency(conn, "APP", table_name_2)) {
65: logError("conistency check failed.");
66: }
67: endTest(conn, test_name);
68: }
69:
70: public void testList(Connection conn) throws SQLException {
71: test1(conn, "test1", "TEST1");
72: }
73:
74: public static void main(String[] argv) throws Throwable {
75: oc_rec4 test = new oc_rec4();
76:
77: ij.getPropertyArg(argv);
78: Connection conn = ij.startJBMS();
79: conn.setAutoCommit(false);
80:
81: try {
82: test.testList(conn);
83: } catch (SQLException sqle) {
84: org.apache.derby.tools.JDBCDisplayUtil.ShowSQLException(
85: System.out, sqle);
86: sqle.printStackTrace(System.out);
87: }
88: }
89: }
|