From: Stephane Gamard Date: Thu, 3 Jul 2014 15:46:33 +0000 (+0200) Subject: fix quality flaw (fixed Ignored test) X-Git-Tag: 4.4-RC2~24 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=45d9ba377c3c8c3841330954c2fcd7e2d2757731;p=sonarqube.git fix quality flaw (fixed Ignored test) --- 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(); }