]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5329 Add Medium Test to search profile by keys having dashes
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Fri, 20 Jun 2014 14:25:43 +0000 (16:25 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Fri, 20 Jun 2014 14:25:51 +0000 (16:25 +0200)
sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileServiceMediumTest.java

index 183e3072a0029fd9efd2144e1407e35d4b5da507..565e6c43d43fc6332b1f923229f192add99bd59a 100644 (file)
@@ -21,10 +21,7 @@ package org.sonar.server.qualityprofile;
 
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Multimap;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
+import org.junit.*;
 import org.sonar.api.rule.RuleKey;
 import org.sonar.api.rule.RuleStatus;
 import org.sonar.api.rule.Severity;
@@ -256,4 +253,29 @@ public class QProfileServiceMediumTest {
       , new QueryOptions())).hasSize(2);
   }
 
+  @Test
+  @Ignore
+  public void search_activity_by_qprofile_having_dashes_in_keys() throws InterruptedException {
+
+    tester.get(ActivityService.class).write(dbSession, Activity.Type.QPROFILE,
+      ActiveRuleChange.createFor(ActiveRuleChange.Type.ACTIVATED, ActiveRuleKey.of("java-default", RuleTesting.XOO_X1)));
+    tester.get(ActivityService.class).write(dbSession, Activity.Type.QPROFILE,
+      ActiveRuleChange.createFor(ActiveRuleChange.Type.ACTIVATED, ActiveRuleKey.of("java-toto", RuleTesting.XOO_X1)));
+    dbSession.commit();
+
+    // 0. Base case verify 2 activities in index
+    assertThat(service.findActivities(new QProfileActivityQuery(), new QueryOptions()))
+      .hasSize(2);
+
+    // 1. filter by QProfile
+    List<QProfileActivity> result = service.findActivities(new QProfileActivityQuery()
+      .setQprofileKeys(ImmutableSet.of("java-default")), new QueryOptions());
+    assertThat(result).hasSize(1);
+
+    // 1. filter by QProfiles
+    assertThat(service.findActivities(new QProfileActivityQuery()
+      .setQprofileKeys(ImmutableSet.of("java-default", "java-toto"))
+      , new QueryOptions())).hasSize(2);
+  }
+
 }