@@ -0,0 +1,2476 @@
+/*%0A * Copyright (C) 2004 EBI, GRL%0A * %0A * This library is free software; you can redistribute it and/or modify it under the terms of the%0A * GNU Lesser General Public License as published by the Free Software Foundation; either version%0A * 2.1 of the License, or (at your option) any later version.%0A * %0A * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without%0A * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU%0A * Lesser General Public License for more details.%0A * %0A * You should have received a copy of the GNU Lesser General Public License along with this library;%0A * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA%0A * 02111-1307 USA%0A */%0A%0Apackage org.ensembl.healthcheck.testcase.generic;%0A%0Aimport java.sql.Connection;%0Aimport java.sql.ResultSet;%0Aimport java.sql.Statement;%0A%0Aimport org.ensembl.healthcheck.DatabaseRegistryEntry;%0Aimport org.ensembl.healthcheck.ReportManager;%0Aimport org.ensembl.healthcheck.testcase.Priority;%0Aimport org.ensembl.healthcheck.testcase.SingleDatabaseTestCase;%0A%0A/**%0A * Check if any tables are partitioned. None should be yet, until their definitions are updated in table.sql.%0A */%0Apublic class PartitionedTables extends SingleDatabaseTestCase %7B%0A%0A%09/**%0A%09 * Creates a new instance of PartitionedTables%0A%09 */%0A%09public PartitionedTables() %7B%0A%0A%09%09addToGroup(%22release%22);%0A%09%09setDescription(%22Check whether tables have been partitioned.%22);%0A%09%09setPriority(Priority.AMBER);%0A%09%09setEffect(%22Tables should only be partitioned if the partitions are defined in table.sql.%22);%0A%09%09setTeamResponsible(%22ReleaseCoordinator%22);%0A%0A%09%7D%0A%0A%09/**%0A%09 * Run the test.%0A%09 * %0A%09 */%0A%09public boolean run(DatabaseRegistryEntry dbre) %7B%0A%0A%09%09boolean result = true;%0A%0A%09%09Connection con = dbre.getConnection();%0A%0A%09%09try %7B%0A%0A%09%09%09Statement stmt = con.createStatement();%0A%09%09%09ResultSet rs = stmt.executeQuery(%22SHOW TABLE STATUS WHERE create_options LIKE '%25partitioned%25'%22);%0A%0A%09%09%09while (rs.next()) %7B%0A%09%09%09%09%0A%09%09%09%09String table = rs.getString(1);%0A%09%09%09%09ReportManager.problem(this, con, table + %22 is partitioned but shouldn't be.%22);%0A%09%09%09%09result = false;%0A%09%09%09%09%0A%09%09%09%7D%0A%0A%09%09%09rs.close();%0A%0A%09%09%09stmt.close();%0A%0A%09%09%7D catch (Exception e) %7B%0A%0A%09%09%09e.printStackTrace();%0A%09%09%09System.exit(1);%0A%0A%09%09%7D%0A%0A%09%09if (result == true) %7B%0A%09%09%0A%09%09%09ReportManager.correct(this, con, %22No tables are partitioned%22);%0A%09%09%7D%0A%09%09%0A%09%09return result;%0A%0A%09%7D // run%0A%0A%09// -----------------------------------------------------------------------%0A%0A%7D // AnalyseTables%0A%0A

Check if any tables are partitioned. None should be yet, until their definitions are updated in table.sql.