@@ -0,0 +1,2291 @@
+/*%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;%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 for hit_names that aren't formatted correctly.%0A */%0Apublic class HitNameFormat extends SingleDatabaseTestCase %7B%0A%0A%09/**%0A%09 * Creates a new instance.%0A%09 */%0A%09public HitNameFormat() %7B%0A%0A%09%09addToGroup(%22release%22);%0A%09%09addToGroup(%22post_genebuild%22);%0A%09%09setDescription(%22Check that there are no incorrectly formatted hit_names%22);%0A%09%09setPriority(Priority.AMBER);%0A%09%09setFix(%22Manually fix affected values.%22);%0A%09%09setTeamResponsible(%22genebuild%22);%0A%0A%09%7D%0A%0A%09/**%0A%09 * Run the test.%0A%09 * %0A%09 * @param dbre%0A%09 *          The database registry entry to be checked.%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%09String%5B%5D tables = %7B %22dna_align_feature%22, %22protein_align_feature%22, %22protein_feature%22 %7D;%0A%0A%09%09for (String table : tables) %7B%0A%0A%09%09%09// TODO check other formats?%0A%09%09%09int rows = getRowCount(con, %22SELECT COUNT(*) FROM %22 + table + %22 WHERE hit_name LIKE '%25%7C%25'%22);%0A%0A%09%09%09if (rows %3E 0) %7B%0A%09%09%09%09ReportManager.problem(this, con, rows + %22 %22 + table + %22s appear to have incorrectly formatted hit_names%22);%0A%09%09%09%09result = false;%0A%09%09%09%7D else %7B%0A%09%09%09%09ReportManager.correct(this, con, %22All %22 + table + %22s have correctly formatted hit_names%22);%0A%09%09%09%7D%0A%0A%09%09%7D%0A%0A%09%09return result;%0A%0A%09%7D%0A%0A%7D // HitNameFormat%0A%0A

Check for the presence of the | character in dna/protein (align) features