aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorStephane Gamard <stephane.gamard@searchbox.com>2014-07-03 15:24:25 +0200
committerStephane Gamard <stephane.gamard@searchbox.com>2014-07-03 15:24:25 +0200
commit2f6dea76d6b86441612b036361a4ae354843805d (patch)
treeb6d8d62425ef46cfbf24bf20ac98876ee8837806 /sonar-server
parentbdc44605d38868e7d797c4e0218deef12fc1a949 (diff)
downloadsonarqube-2f6dea76d6b86441612b036361a4ae354843805d.tar.gz
sonarqube-2f6dea76d6b86441612b036361a4ae354843805d.zip
SONAR-5007 - Ignore test for SONAR-5183
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/java/org/sonar/server/rule/index/RuleNormalizer.java41
-rw-r--r--sonar-server/src/test/java/org/sonar/server/qualityprofile/ActiveRuleBackendMediumTest.java2
2 files changed, 27 insertions, 16 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/rule/index/RuleNormalizer.java b/sonar-server/src/main/java/org/sonar/server/rule/index/RuleNormalizer.java
index 8fff85e9166..1c2c91db539 100644
--- a/sonar-server/src/main/java/org/sonar/server/rule/index/RuleNormalizer.java
+++ b/sonar-server/src/main/java/org/sonar/server/rule/index/RuleNormalizer.java
@@ -26,6 +26,7 @@ import org.elasticsearch.action.WriteConsistencyLevel;
import org.elasticsearch.action.support.replication.ReplicationType;
import org.elasticsearch.action.update.UpdateRequest;
import org.sonar.api.rule.RuleKey;
+import org.sonar.api.rule.RuleStatus;
import org.sonar.api.server.debt.DebtCharacteristic;
import org.sonar.core.persistence.DbSession;
import org.sonar.core.rule.RuleDto;
@@ -39,7 +40,12 @@ import org.sonar.server.search.Indexable;
import org.sonar.server.search.es.ListUpdate;
import java.lang.reflect.Field;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
public class RuleNormalizer extends BaseNormalizer<RuleDto, RuleKey> {
@@ -179,7 +185,10 @@ public class RuleNormalizer extends BaseNormalizer<RuleDto, RuleKey> {
update.put(RuleField.HTML_DESCRIPTION.field(), rule.getDescription());
update.put(RuleField.FIX_DESCRIPTION.field(), rule.getEffortToFixDescription());
update.put(RuleField.SEVERITY.field(), rule.getSeverityString());
- update.put(RuleField.STATUS.field(), rule.getStatus().name());
+
+ RuleStatus status = rule.getStatus();
+ update.put(RuleField.STATUS.field(), status != null ? rule.getStatus().name() : null);
+
update.put(RuleField.LANGUAGE.field(), rule.getLanguage());
update.put(RuleField.INTERNAL_KEY.field(), rule.getConfigKey());
update.put(RuleField.IS_TEMPLATE.field(), rule.isTemplate());
@@ -316,24 +325,24 @@ public class RuleNormalizer extends BaseNormalizer<RuleDto, RuleKey> {
newParam.put(RuleParamField.DEFAULT_VALUE.field(), param.getDefaultValue());
return ImmutableList.of(new UpdateRequest()
- .id(key.toString())
- .script(ListUpdate.NAME)
- .addScriptParam(ListUpdate.FIELD, RuleField.PARAMS.field())
- .addScriptParam(ListUpdate.VALUE, newParam)
- .addScriptParam(ListUpdate.ID_FIELD, RuleParamField.NAME.field())
- .addScriptParam(ListUpdate.ID_VALUE, param.getName())
- );
+ .id(key.toString())
+ .script(ListUpdate.NAME)
+ .addScriptParam(ListUpdate.FIELD, RuleField.PARAMS.field())
+ .addScriptParam(ListUpdate.VALUE, newParam)
+ .addScriptParam(ListUpdate.ID_FIELD, RuleParamField.NAME.field())
+ .addScriptParam(ListUpdate.ID_VALUE, param.getName())
+ );
}
private List<UpdateRequest> nestedDelete(RuleParamDto param, RuleKey key) {
return ImmutableList.of(new UpdateRequest()
- .id(key.toString())
- .script(ListUpdate.NAME)
- .addScriptParam(ListUpdate.FIELD, RuleField.PARAMS.field())
- .addScriptParam(ListUpdate.VALUE, null)
- .addScriptParam(ListUpdate.ID_FIELD, RuleParamField.NAME.field())
- .addScriptParam(ListUpdate.ID_VALUE, param.getName())
- );
+ .id(key.toString())
+ .script(ListUpdate.NAME)
+ .addScriptParam(ListUpdate.FIELD, RuleField.PARAMS.field())
+ .addScriptParam(ListUpdate.VALUE, null)
+ .addScriptParam(ListUpdate.ID_FIELD, RuleParamField.NAME.field())
+ .addScriptParam(ListUpdate.ID_VALUE, param.getName())
+ );
}
}
diff --git a/sonar-server/src/test/java/org/sonar/server/qualityprofile/ActiveRuleBackendMediumTest.java b/sonar-server/src/test/java/org/sonar/server/qualityprofile/ActiveRuleBackendMediumTest.java
index 1882cf33f33..2c5ff0f035f 100644
--- a/sonar-server/src/test/java/org/sonar/server/qualityprofile/ActiveRuleBackendMediumTest.java
+++ b/sonar-server/src/test/java/org/sonar/server/qualityprofile/ActiveRuleBackendMediumTest.java
@@ -23,6 +23,7 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.Multimap;
import org.junit.Before;
import org.junit.ClassRule;
+import org.junit.Ignore;
import org.junit.Test;
import org.sonar.api.rule.RuleKey;
import org.sonar.api.rule.RuleStatus;
@@ -66,6 +67,7 @@ public class ActiveRuleBackendMediumTest {
}
@Test
+ @Ignore("To be fixed with DB Time zone sprint -- SONAR-5183")
public void synchronize_index() throws Exception {
QualityProfileDto profile1 = QProfileTesting.newXooP1();
db.qualityProfileDao().insert(dbSession, profile1);