KickJava   Java API By Example, From Geeks To Geeks.

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


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_rec1 extends OnlineCompressTest
39 {
40
41     public oc_rec1()
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_rec2 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         createAndLoadTable(conn, true, table_name, 5000, 0);
61         executeQuery(conn, "delete from " + table_name, true);
62         callCompress(conn, "APP", table_name, true, true, true, true);
63         endTest(conn, test_name);
64     }
65
66     public void testList(Connection JavaDoc conn)
67         throws SQLException JavaDoc
68     {
69         test1(conn, "test1", "TEST1");
70     }
71
72     public static void main(String JavaDoc[] argv)
73         throws Throwable JavaDoc
74     {
75         oc_rec1 test = new oc_rec1();
76
77         ij.getPropertyArg(argv);
78         Connection JavaDoc conn = ij.startJBMS();
79         conn.setAutoCommit(false);
80
81         try
82         {
83             test.testList(conn);
84         }
85         catch (SQLException JavaDoc sqle)
86         {
87             org.apache.derby.tools.JDBCDisplayUtil.ShowSQLException(
88                 System.out, sqle);
89             sqle.printStackTrace(System.out);
90         }
91     }
92 }
93
Popular Tags