From: Simon Brandhof Date: Fri, 17 May 2013 15:31:56 +0000 (+0200) Subject: SONAR-3755 do not filter non-READY rules in the WS /api/issues/search X-Git-Tag: 3.6~338 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=30e3216e8b60b0b3baa591a84351f95fdcdb5882;p=sonarqube.git SONAR-3755 do not filter non-READY rules in the WS /api/issues/search --- diff --git a/sonar-core/src/main/java/org/sonar/core/rule/DefaultRuleFinder.java b/sonar-core/src/main/java/org/sonar/core/rule/DefaultRuleFinder.java index c7399c00b9c..ab82ec70fde 100644 --- a/sonar-core/src/main/java/org/sonar/core/rule/DefaultRuleFinder.java +++ b/sonar-core/src/main/java/org/sonar/core/rule/DefaultRuleFinder.java @@ -63,10 +63,8 @@ public class DefaultRuleFinder implements RuleFinder { return Collections.emptyList(); } DatabaseSession session = sessionFactory.getSession(); - StringBuilder hql = new StringBuilder().append("from ").append(Rule.class.getSimpleName()).append(" r where r.id in (:ids) and status<>:status "); - Query hqlQuery = session.createQuery(hql.toString()) - .setParameter("status", Rule.STATUS_REMOVED) - .setParameter("ids", ruleIds); + StringBuilder hql = new StringBuilder().append("from ").append(Rule.class.getSimpleName()).append(" r where r.id in (:ids)"); + Query hqlQuery = session.createQuery(hql.toString()).setParameter("ids", ruleIds); return hqlQuery.getResultList(); } diff --git a/sonar-core/src/test/java/org/sonar/core/rule/DefaultRuleFinderTest.java b/sonar-core/src/test/java/org/sonar/core/rule/DefaultRuleFinderTest.java index f2bdccae419..ab42781963a 100644 --- a/sonar-core/src/test/java/org/sonar/core/rule/DefaultRuleFinderTest.java +++ b/sonar-core/src/test/java/org/sonar/core/rule/DefaultRuleFinderTest.java @@ -50,8 +50,8 @@ public class DefaultRuleFinderTest extends AbstractDbUnitTestCase { public void should_find_by_ids() { setupData("shared"); DefaultRuleFinder finder = new DefaultRuleFinder(getSessionFactory()); - // 2 is disabled - assertThat(finder.findByIds(newArrayList(2, 3))).hasSize(1); + // 2 is returned even its status is REMOVED + assertThat(finder.findByIds(newArrayList(2, 3))).hasSize(2); } @Test