001/*
002 * (C) Copyright 2014 Nuxeo SA (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl-2.1.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Antoine Taillefer <ataillefer@nuxeo.com>
016 */
017package org.nuxeo.ecm.core.storage.sql;
018
019import org.junit.internal.AssumptionViolatedException;
020import org.nuxeo.runtime.test.runner.FeaturesRunner;
021import org.nuxeo.runtime.test.runner.SimpleFeature;
022
023/**
024 * Allows to ignore all the tests from a class running this feature if the database configured for tests is not H2.
025 *
026 * @since 5.9.5
027 */
028public class H2OnlyFeature extends SimpleFeature {
029
030    @Override
031    public void start(FeaturesRunner runner) throws Exception {
032        if (DatabaseHelper.DATABASE instanceof DatabaseH2) {
033            return;
034        }
035        throw new AssumptionViolatedException("Database is not H2");
036    }
037
038}