Line data Source code
1 : // Copyright (C) 2013 The Android Open Source Project 2 : // 3 : // Licensed under the Apache License, Version 2.0 (the "License"); 4 : // you may not use this file except in compliance with the License. 5 : // You may obtain a copy of the License at 6 : // 7 : // http://www.apache.org/licenses/LICENSE-2.0 8 : // 9 : // Unless required by applicable law or agreed to in writing, software 10 : // distributed under the License is distributed on an "AS IS" BASIS, 11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : // See the License for the specific language governing permissions and 13 : // limitations under the License. 14 : 15 : package com.google.gerrit.testing; 16 : 17 : import com.google.gerrit.acceptance.config.ConfigAnnotationParser; 18 : import com.google.gerrit.acceptance.config.GerritConfig; 19 : import com.google.gerrit.acceptance.config.GerritConfigs; 20 : import org.eclipse.jgit.lib.Config; 21 : import org.junit.Rule; 22 : import org.junit.rules.TestRule; 23 : import org.junit.runner.RunWith; 24 : import org.junit.runners.model.Statement; 25 : 26 : @RunWith(ConfigSuite.class) 27 10 : public class GerritServerTests { 28 : @ConfigSuite.Parameter public Config config; 29 : 30 10 : @Rule 31 : public TestRule testRunner = 32 : (base, description) -> { 33 10 : GerritConfig gerritConfig = description.getAnnotation(GerritConfig.class); 34 10 : if (gerritConfig != null) { 35 4 : config = ConfigAnnotationParser.parse(config, gerritConfig); 36 : } 37 10 : GerritConfigs gerritConfigs = description.getAnnotation(GerritConfigs.class); 38 10 : if (gerritConfigs != null) { 39 0 : config = ConfigAnnotationParser.parse(config, gerritConfigs); 40 : } 41 10 : return new Statement() { 42 : @Override 43 : public void evaluate() throws Throwable { 44 10 : base.evaluate(); 45 10 : } 46 : }; 47 : }; 48 : }