001package fr.ifremer.adagio.core.test;
002
003/*
004 * #%L
005 * SIH-Adagio Core for Allegro
006 * $Id: TestUtil.java 607 2013-04-21 12:34:44Z tc1fbb1 $
007 * $HeadURL: https://forge.ifremer.fr/svn/sih-adagio/trunk/adagio/core-allegro/src/test/java/fr/ifremer/adagio/core/TestUtil.java $
008 * %%
009 * Copyright (C) 2012 - 2013 Ifremer
010 * %%
011 * This program is free software: you can redistribute it and/or modify
012 * it under the terms of the GNU Affero General Public License as published by
013 * the Free Software Foundation, either version 3 of the License, or
014 * (at your option) any later version.
015 * 
016 * This program is distributed in the hope that it will be useful,
017 * but WITHOUT ANY WARRANTY; without even the implied warranty of
018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
019 * GNU General Public License for more details.
020 * 
021 * You should have received a copy of the GNU Affero General Public License
022 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
023 * #L%
024 */
025
026import org.apache.commons.logging.Log;
027import org.apache.commons.logging.LogFactory;
028import org.junit.Assume;
029import org.junit.Ignore;
030
031import fr.ifremer.adagio.core.service.ServiceLocator;
032
033import java.io.File;
034
035/**
036 * Useful method around tests.
037 *
038 *
039 * @author tchemit <chemit@codelutin.com>
040 * @since 3.3.1
041 */
042@Ignore
043public final class TestUtil {
044
045    protected TestUtil() {
046    }
047
048    /** Logger. */
049    private static final Log log = LogFactory.getLog(TestUtil.class);
050
051    public static void checkDbExists(Class<?> testClass, String dbDirectory) {
052        File db = new File(dbDirectory);
053        if (!db.exists()) {
054
055            if (log.isWarnEnabled()) {
056                log.warn("Could not find db at " + db + ", test [" +
057                            testClass + "] is skipped.");
058            }
059            Assume.assumeTrue(false);
060        }
061    }
062    
063}