aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephane Gamard <stephane.gamard@searchbox.com>2014-07-03 17:46:33 +0200
committerStephane Gamard <stephane.gamard@searchbox.com>2014-07-04 09:33:08 +0200
commit45d9ba377c3c8c3841330954c2fcd7e2d2757731 (patch)
tree1df28dcf0b54da81cf388d6a06409252704c2241
parent18450f3ab2c8694e903fd3be20e7d02f0f662a63 (diff)
downloadsonarqube-45d9ba377c3c8c3841330954c2fcd7e2d2757731.tar.gz
sonarqube-45d9ba377c3c8c3841330954c2fcd7e2d2757731.zip
fix quality flaw (fixed Ignored test)
-rw-r--r--sonar-server/src/test/java/org/sonar/server/qualityprofile/ActiveRuleBackendMediumTest.java22
1 files changed, 16 insertions, 6 deletions
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 2c5ff0f035f..ce38f3781b4 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,7 +23,6 @@ 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;
@@ -36,6 +35,7 @@ import org.sonar.core.qualityprofile.db.QualityProfileDto;
import org.sonar.core.rule.RuleDto;
import org.sonar.core.rule.RuleParamDto;
import org.sonar.server.db.DbClient;
+import org.sonar.server.platform.Platform;
import org.sonar.server.qualityprofile.index.ActiveRuleIndex;
import org.sonar.server.qualityprofile.index.ActiveRuleNormalizer;
import org.sonar.server.rule.RuleTesting;
@@ -67,8 +67,10 @@ public class ActiveRuleBackendMediumTest {
}
@Test
- @Ignore("To be fixed with DB Time zone sprint -- SONAR-5183")
public void synchronize_index() throws Exception {
+
+ Date beginning = new Date();
+
QualityProfileDto profile1 = QProfileTesting.newXooP1();
db.qualityProfileDao().insert(dbSession, profile1);
@@ -79,15 +81,23 @@ public class ActiveRuleBackendMediumTest {
db.activeRuleDao().insert(dbSession, activeRule);
dbSession.commit();
+
+ // 1. Synchronize since 0
tester.clearIndexes();
+ assertThat(index.getByKey(activeRule.getKey())).isNull();
+ db.activeRuleDao().synchronizeAfter(dbSession, new Date(0L));
+ assertThat(index.getByKey(activeRule.getKey())).isNotNull();
- // 0. Assert that we have no rules in Is.
+ // 2. Synchronize since beginning
+ tester.clearIndexes();
assertThat(index.getByKey(activeRule.getKey())).isNull();
+ db.activeRuleDao().synchronizeAfter(dbSession, beginning);
+ assertThat(index.getByKey(activeRule.getKey())).isNotNull();
- // 1. Synchronize since 0
- db.activeRuleDao().synchronizeAfter(dbSession, new Date());
- // 2. Assert that we have the rule in Index
+ // 3. Assert startup picks it up
+ tester.clearIndexes();
+ tester.get(Platform.class).executeStartupTasks();
assertThat(index.getByKey(activeRule.getKey())).isNotNull();
}