@@ -0,0 +1,2270 @@
+/*%0A * Copyright %5B1999-2015%5D Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute%0A * Copyright %5B2016-2017%5D EMBL-European Bioinformatics Institute%0A * %0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A * %0A *      http://www.apache.org/licenses/LICENSE-2.0%0A * %0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage org.ensembl.healthcheck.testcase.variation;%0A%0Aimport java.sql.Connection;%0A%0Aimport org.ensembl.healthcheck.DatabaseRegistryEntry;%0Aimport org.ensembl.healthcheck.DatabaseType;%0Aimport org.ensembl.healthcheck.ReportManager;%0Aimport org.ensembl.healthcheck.Team;%0Aimport org.ensembl.healthcheck.testcase.SingleDatabaseTestCase;%0Aimport org.ensembl.healthcheck.util.DBUtils;%0A%0A/**%0A * Check that the source table is consistent%0A */%0Apublic class Source extends SingleDatabaseTestCase %7B%0A%0A%09public Source() %7B%0A%0A%09%09addToGroup(%22variation-release%22);%0A%09%09%0A%09%09setDescription(%22Checks that the soucre table is consistent%22);%0A%09%09setTeamResponsible(Team.VARIATION);%0A%0A%09%7D%0A%0A%09/*%0A%09 * @param dbre%0A%09 *          The database to check.%0A%09 * @return true if the test passed.%0A%09 *%0A%09 */%0A%09public boolean run(DatabaseRegistryEntry dbre) %7B%0A%0A%09%09Connection con = dbre.getConnection();%0A%09%09boolean result = true;%0A%09%09%0A%09%09try %7B%09%09%09%09%0A%0A                   String versions_stmt = %22select count(distinct version) from source where name like '%25dbSNP%25' %22;%0A                   int versions = DBUtils.getRowCount(con,versions_stmt);%0A                   if (versions != 1) %7B%0A                       result = false;%0A                       ReportManager.problem(this, con,  versions + %22 different versions set for dbSNP sources %22);%0A                   %7D%0A                %7D%0A                catch (Exception e) %7B%0A                       ReportManager.problem(this, con, %22HealthCheck caused an exception: %22 + e.getMessage());%0A                       result = false;%0A                %7D%0A%0A%09%09return result;%0A%09%7D%0A%7D%0A

check sources have same versions