summaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2014-06-12 18:20:59 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2014-06-12 18:21:09 +0200
commit980a535929f5d4a1944a14882d74fab4a0a54693 (patch)
tree52f5cbd16d832a9c18f9d284f0e22f860ce22414 /sonar-core
parent58e9546400d146a4fb64f5a7ef57d3804f50b318 (diff)
downloadsonarqube-980a535929f5d4a1944a14882d74fab4a0a54693.tar.gz
sonarqube-980a535929f5d4a1944a14882d74fab4a0a54693.zip
SONAR-5007 delete unused class RulesDao
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/java/org/sonar/jpa/dao/RulesDao.java47
-rw-r--r--sonar-core/src/test/java/org/sonar/jpa/dao/RulesDaoTest.java52
2 files changed, 0 insertions, 99 deletions
diff --git a/sonar-core/src/main/java/org/sonar/jpa/dao/RulesDao.java b/sonar-core/src/main/java/org/sonar/jpa/dao/RulesDao.java
deleted file mode 100644
index 1a47b332c01..00000000000
--- a/sonar-core/src/main/java/org/sonar/jpa/dao/RulesDao.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 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.jpa.dao;
-
-import org.sonar.api.database.DatabaseSession;
-import org.sonar.api.rules.Rule;
-import org.sonar.api.rules.RuleParam;
-
-public class RulesDao extends BaseDao {
-
- public RulesDao(DatabaseSession session) {
- super(session);
- }
-
- public Rule getRuleByKey(String repositoryKey, String ruleKey) {
- DatabaseSession session = getSession();
- return (Rule) session.getSingleResult(
- session.createQuery("FROM " + Rule.class.getSimpleName() + " r WHERE r.key=:key and r.pluginName=:pluginName and r.status<>:status")
- .setParameter("key", ruleKey)
- .setParameter("pluginName", repositoryKey)
- .setParameter("status", Rule.STATUS_REMOVED
- ),
- null);
- }
-
- public RuleParam getRuleParam(Rule rule, String paramKey) {
- return getSession().getSingleResult(RuleParam.class, "rule", rule, "key", paramKey);
- }
-
-}
diff --git a/sonar-core/src/test/java/org/sonar/jpa/dao/RulesDaoTest.java b/sonar-core/src/test/java/org/sonar/jpa/dao/RulesDaoTest.java
deleted file mode 100644
index e8256331e79..00000000000
--- a/sonar-core/src/test/java/org/sonar/jpa/dao/RulesDaoTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 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.jpa.dao;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.sonar.api.rules.Rule;
-import org.sonar.jpa.test.AbstractDbUnitTestCase;
-
-import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-public class RulesDaoTest extends AbstractDbUnitTestCase {
-
- private RulesDao rulesDao;
-
- @Before
- public void setup() {
- rulesDao = new RulesDao(getSession());
- }
-
- @Test
- public void shouldGetRuleWithRuleKeyAndPluginKey() {
- setupData("shouldGetRuleWithRuleKeyAndPluginKey");
-
- Rule rule = rulesDao.getRuleByKey("plugin", "checkstyle.rule1");
- assertThat(rule, notNullValue());
- assertThat(rule.getId(), notNullValue());
-
- Rule rule2 = rulesDao.getRuleByKey("plugin", "key not found");
- assertThat(rule2, nullValue());
- }
-
-}