From bbfbe368e249720fc4f7f1a507537339dd03e8d0 Mon Sep 17 00:00:00 2001 From: Stephane Gamard Date: Thu, 1 May 2014 15:20:52 +0200 Subject: SONAR-5237 - Passing Test for RuleStatus in RuleSearchMediumTest --- sonar-server/src/main/java/org/sonar/server/rule2/RuleIndex.java | 8 ++++++++ .../test/java/org/sonar/server/rule2/RuleSearchMediumTest.java | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'sonar-server') diff --git a/sonar-server/src/main/java/org/sonar/server/rule2/RuleIndex.java b/sonar-server/src/main/java/org/sonar/server/rule2/RuleIndex.java index f43505a867b..856391b4e5e 100644 --- a/sonar-server/src/main/java/org/sonar/server/rule2/RuleIndex.java +++ b/sonar-server/src/main/java/org/sonar/server/rule2/RuleIndex.java @@ -130,6 +130,13 @@ public class RuleIndex extends BaseIndex { .endObject(); } + private void addFindField(XContentBuilder mapping, String field, String type) throws IOException { + mapping.startObject(field) + .field("type", type) + .field("index", "analyzed") + .endObject(); + } + @Override protected XContentBuilder getMapping() throws IOException { XContentBuilder mapping = jsonBuilder().startObject() @@ -140,6 +147,7 @@ public class RuleIndex extends BaseIndex { addMatchField(mapping, RuleField.KEY.key(), "string"); addMatchField(mapping, RuleField.REPOSITORY.key(), "string"); addMatchField(mapping, RuleField.SEVERITY.key(), "string"); + addMatchField(mapping, RuleField.STATUS.key(), "string"); mapping.startObject(RuleField.NAME.key()) .field("type", "multi_field") diff --git a/sonar-server/src/test/java/org/sonar/server/rule2/RuleSearchMediumTest.java b/sonar-server/src/test/java/org/sonar/server/rule2/RuleSearchMediumTest.java index 0fa8bb86aca..4b06353cd2a 100644 --- a/sonar-server/src/test/java/org/sonar/server/rule2/RuleSearchMediumTest.java +++ b/sonar-server/src/test/java/org/sonar/server/rule2/RuleSearchMediumTest.java @@ -213,7 +213,6 @@ public class RuleSearchMediumTest { } @Test - @Ignore public void search_rules_by_any_of_statuses() throws InterruptedException { dao.insert(newRuleDto(RuleKey.of("java", "S001")).setStatus(RuleStatus.BETA.name())); dao.insert(newRuleDto(RuleKey.of("java", "S002")).setStatus(RuleStatus.READY.name())); -- cgit v1.2.3