From b83c444064ab861e095d0f19e35ba6897a4fe450 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Thu, 20 Feb 2014 23:02:17 +0100 Subject: [PATCH] Revert "RuleRepositoryTestHelper is back" This reverts commit 3f42ac85a4495333dbe76e1b1587ea05b7d900a4. --- sonar-deprecated/pom.xml | 5 +- sonar-testing-harness/pom.xml | 5 -- .../test/i18n/RuleRepositoryTestHelper.java | 67 ------------------- 3 files changed, 3 insertions(+), 74 deletions(-) delete mode 100644 sonar-testing-harness/src/main/java/org/sonar/test/i18n/RuleRepositoryTestHelper.java diff --git a/sonar-deprecated/pom.xml b/sonar-deprecated/pom.xml index 82394aebe91..1a21f72325e 100644 --- a/sonar-deprecated/pom.xml +++ b/sonar-deprecated/pom.xml @@ -39,8 +39,9 @@ - org.hamcrest - hamcrest-all + ${project.groupId} + sonar-testing-harness + ${project.version} test diff --git a/sonar-testing-harness/pom.xml b/sonar-testing-harness/pom.xml index 9e42d67fdb3..e32a3a72f43 100644 --- a/sonar-testing-harness/pom.xml +++ b/sonar-testing-harness/pom.xml @@ -44,11 +44,6 @@ sonar-plugin-api ${project.version} - - org.codehaus.sonar - sonar-deprecated - ${project.version} - org.codehaus.sonar sonar-plugin-api diff --git a/sonar-testing-harness/src/main/java/org/sonar/test/i18n/RuleRepositoryTestHelper.java b/sonar-testing-harness/src/main/java/org/sonar/test/i18n/RuleRepositoryTestHelper.java deleted file mode 100644 index 62c45d8f77b..00000000000 --- a/sonar-testing-harness/src/main/java/org/sonar/test/i18n/RuleRepositoryTestHelper.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2013 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.test.i18n; - -import com.google.common.io.Closeables; -import org.sonar.api.rules.Rule; -import org.sonar.api.rules.RuleRepository; -import org.sonar.api.utils.SonarException; -import org.sonar.test.TestUtils; - -import java.io.IOException; -import java.io.InputStream; -import java.util.List; -import java.util.Properties; - -public final class RuleRepositoryTestHelper { - private RuleRepositoryTestHelper() { - // Static utility class - } - - public static List createRulesWithNameAndDescription(String pluginKey, RuleRepository repository) { - Properties props = loadProperties(String.format("/org/sonar/l10n/%s.properties", pluginKey)); - - List rules = repository.createRules(); - for (Rule rule : rules) { - String name = props.getProperty(String.format("rule.%s.%s.name", repository.getKey(), rule.getKey())); - String description = TestUtils.getResourceContent(String.format("/org/sonar/l10n/%s/rules/%s/%s.html", pluginKey, repository.getKey(), rule.getKey())); - - rule.setName(name); - rule.setDescription(description); - } - - return rules; - } - - private static Properties loadProperties(String resourcePath) { - Properties properties = new Properties(); - - InputStream input = null; - try { - input = TestUtils.class.getResourceAsStream(resourcePath); - properties.load(input); - return properties; - } catch (IOException e) { - throw new SonarException("Unable to read properties " + resourcePath, e); - } finally { - Closeables.closeQuietly(input); - } - } -} -- 2.39.5