From 30e3216e8b60b0b3baa591a84351f95fdcdb5882 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Fri, 17 May 2013 17:31:56 +0200 Subject: [PATCH] SONAR-3755 do not filter non-READY rules in the WS /api/issues/search --- .../main/java/org/sonar/core/rule/DefaultRuleFinder.java | 6 ++---- .../java/org/sonar/core/rule/DefaultRuleFinderTest.java | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) 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 -- 2.39.5