KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2
3    Derby - Class org.apache.derbyTesting.functionTests.harness.procedure
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
24 import org.apache.derby.iapi.db.OnlineCompress;
25
26 import org.apache.derby.iapi.services.sanity.SanityManager;
27
28 import java.sql.CallableStatement JavaDoc;
29 import java.sql.Connection JavaDoc;
30 import java.sql.PreparedStatement JavaDoc;
31 import java.sql.ResultSet JavaDoc;
32 import java.sql.SQLException JavaDoc;
33 import java.sql.Statement JavaDoc;
34
35 import org.apache.derby.tools.ij;
36
37
38 public class oc_rec4 extends OnlineCompressTest
39 {
40
41     public oc_rec4()
42     {
43     }
44
45     /**
46      * setup for restart recovery test.
47      * <p>
48      * Do setup to test restart recovery of online compress. Real work
49      * is done in next test oc_rec4 which will run restart recovery on
50      * the work done in this test.
51      *
52      **/

53     private void test1(
54     Connection JavaDoc conn,
55     String JavaDoc test_name,
56     String JavaDoc table_name)
57         throws SQLException JavaDoc
58     {
59         beginTest(conn, test_name);
60
61         // oc_rec3 left the table with no rows, but compress command
62
// did not commit.
63
String JavaDoc table_name_2 = table_name + "_2";
64         if (!checkConsistency(conn, "APP", table_name_2))
65         {
66             logError("conistency check failed.");
67         }
68
69         // make sure we can add data to the existing table after redo
70
// recovery.
71
createAndLoadTable(conn, false, table_name_2, 6000, 0);
72         if (!checkConsistency(conn, "APP", table_name_2))
73         {
74             logError("conistency check failed.");
75         }
76         endTest(conn, test_name);
77     }
78
79     public void testList(Connection JavaDoc conn)
80         throws SQLException JavaDoc
81     {
82         test1(conn, "test1", "TEST1");
83     }
84
85     public static void main(String JavaDoc[] argv)
86         throws Throwable JavaDoc
87     {
88         oc_rec4 test = new oc_rec4();
89
90         ij.getPropertyArg(argv);
91         Connection JavaDoc conn = ij.startJBMS();
92         conn.setAutoCommit(false);
93
94         try
95         {
96             test.testList(conn);
97         }
98         catch (SQLException JavaDoc sqle)
99         {
100             org.apache.derby.tools.JDBCDisplayUtil.ShowSQLException(
101                 System.out, sqle);
102             sqle.printStackTrace(System.out);
103         }
104     }
105 }
106
Popular Tags