@@ -0,0 +1,2589 @@
+/*%0A Copyright (C) 2003 EBI, GRL%0A %0A This library is free software; you can redistribute it and/or%0A modify it under the terms of the GNU Lesser General Public%0A License as published by the Free Software Foundation; either%0A version 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,%0A but WITHOUT ANY WARRANTY; without even the implied warranty of%0A 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%0A License along with this library; if not, write to the Free Software%0A Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA%0A */%0Apackage org.ensembl.healthcheck.testcase.mart;%0A%0Aimport java.sql.Connection;%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0Aimport org.ensembl.healthcheck.DatabaseRegistryEntry;%0Aimport org.ensembl.healthcheck.ReportManager;%0Aimport org.ensembl.healthcheck.testcase.SingleDatabaseTestCase;%0A%0A/**%0A * Check the padding in the stable_id_1051 column in certain species.%0A */%0A%0Apublic class StableIDPadding extends SingleDatabaseTestCase %7B%0A%09%0A%09String column = %22stable_id_1051%22;%0A%09Map%3CString,Integer%3E tablePaddingLength;%0A%0A%09/**%0A%09 * Constructor.%0A%09 */%0A%09public StableIDPadding() %7B%0A%0A%09%09setTeamResponsible(%22biomart%22);%0A%09%09addToGroup(%22post_martbuild%22);%0A%09%09setDescription(%22Check the padding in the stable_id_1051 column in certain species.%22);%0A%0A%09%09tablePaddingLength = new HashMap%3CString,Integer%3E();%0A%09%09tablePaddingLength.put(%22hsapiens_functional_genomics__regulatory_feature__dm%22,  15);%0A%09%09tablePaddingLength.put(%22mmusculus_functional_genomics__regulatory_feature__dm%22, 18);%0A%0A%09%7D%0A%0A%09/**%0A%09 * Run the test.%0A%09 * %0A%09 * @param dbre%0A%09 *          The database to use.%0A%09 * @return true if the test passed.%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%09%09%0A%09%09for (String table : tablePaddingLength.keySet()) %7B%0A%09%09%0A%09%09%09int paddingLength = tablePaddingLength.get(table);%0A%09%09%09%0A%09%09%09int rows = getRowCount(con, %22SELECT COUNT(*) FROM %22 + table + %22 WHERE LENGTH(%22 + column + %22) != %22 + paddingLength);%0A%09%09%09%0A%09%09%09if (rows %3E 0) %7B%0A%09%0A%09%09%09%09ReportManager.problem(this, con, rows + %22 rows in %22 + table + %22 do not have padded stable IDs of required length (%22 + paddingLength + %22)%22);%0A%09%09%09%09result = false;%0A%09%09%09%09%0A%09%09%09%7D else %7B%0A%09%09%09%09%0A%09%09%09%09ReportManager.correct(this, con, %22All rows in %22 + table + %22 have padded stable IDs of required length (%22 + paddingLength + %22)%22);%0A%0A%09%09%09%7D%0A%09%09%7D%0A%09%09%0A%09%09return result;%0A%0A%09%7D // run%0A%0A%7D // StableIDPadding%0A

Check the padding in the stable_id_1051 column in certain species.