1   package org.apache.jcs.auxiliary.disk.jdbc.mysql;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with 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,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.jcs.auxiliary.disk.jdbc.TableState;
23  
24  import junit.framework.TestCase;
25  
26  /***
27   * Hand run tests for the MySQL table optimizer.
28   * <p>
29   * @author Aaron Smuts
30   */
31  public class MySQLTableOptimizerManualTester
32      extends TestCase
33  {
34  
35      /***
36       * Run the optimization against live a table.
37       */
38      public void testBasicOptimization()
39      {
40          MySQLDiskCacheAttributes attributes = new MySQLDiskCacheAttributes();
41          attributes.setUserName( "java" );
42          attributes.setPassword( "letmein" );
43          attributes.setUrl( "jdbc:mysql://10.19.98.43:3306/flight_option_cache" );
44          attributes.setDriverClassName( "org.gjt.mm.mysql.Driver" );
45          String tableName = "JCS_STORE_FLIGHT_OPTION_ITINERARY";
46          attributes.setTableName( tableName );
47          TableState tableState = new TableState( tableName);
48  
49          MySQLTableOptimizer optimizer = new MySQLTableOptimizer( attributes, tableState );
50  
51          optimizer.optimizeTable();
52      }
53  
54      /***
55       * Run the optimization against live a table.
56       */
57      public void testBasicOptimizationUnknownTable()
58      {
59          MySQLDiskCacheAttributes attributes = new MySQLDiskCacheAttributes();
60          attributes.setUserName( "java" );
61          attributes.setPassword( "letmein" );
62          attributes.setUrl( "jdbc:mysql://10.19.98.43:3306/flight_option_cache" );
63          attributes.setDriverClassName( "org.gjt.mm.mysql.Driver" );
64          String tableName = "DOESNTEXIST";
65          attributes.setTableName( tableName );
66          TableState tableState = new TableState( tableName);
67  
68          MySQLTableOptimizer optimizer = new MySQLTableOptimizer( attributes, tableState );
69  
70          optimizer.optimizeTable();
71      }
72  
73  }