]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6818 Split batch/project WS in several simpler WS
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Wed, 30 Sep 2015 09:54:28 +0000 (11:54 +0200)
committerDuarte Meneses <duarte.meneses@sonarsource.com>
Wed, 30 Sep 2015 14:28:09 +0000 (16:28 +0200)
13 files changed:
sonar-batch/src/main/java/org/sonar/batch/rule/ActiveRulesLoader.java
sonar-batch/src/main/java/org/sonar/batch/rule/ActiveRulesProvider.java
sonar-batch/src/main/java/org/sonar/batch/rule/DefaultActiveRulesLoader.java
sonar-batch/src/main/java/org/sonar/batch/rule/LoadedActiveRule.java [new file with mode: 0644]
sonar-batch/src/test/java/org/sonar/batch/cache/NonAssociatedCacheSynchronizerTest.java
sonar-batch/src/test/java/org/sonar/batch/cache/ProjectCacheSynchronizerTest.java
sonar-batch/src/test/java/org/sonar/batch/mediumtest/BatchMediumTester.java
sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/ChecksMediumTest.java
sonar-batch/src/test/java/org/sonar/batch/rule/ActiveRulesProviderTest.java
sonar-batch/src/test/java/org/sonar/batch/rule/DefaultActiveRulesLoaderTest.java
sonar-batch/src/test/resources/org/sonar/batch/rule/DefaultActiveRulesLoaderTest/active_rule_search.protobuf [deleted file]
sonar-batch/src/test/resources/org/sonar/batch/rule/DefaultActiveRulesLoaderTest/active_rule_search1.protobuf [new file with mode: 0644]
sonar-batch/src/test/resources/org/sonar/batch/rule/DefaultActiveRulesLoaderTest/active_rule_search2.protobuf [new file with mode: 0644]

index 72f33bdb43c9f452c33473c1d2f9c19a3094ad5c..e66d8ef7403662070aeef5b5089624e4fce5e494 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonar.batch.rule;
 
-import org.sonarqube.ws.Rules.Rule;
 import org.apache.commons.lang.mutable.MutableBoolean;
 
 import javax.annotation.Nullable;
@@ -27,5 +26,5 @@ import javax.annotation.Nullable;
 import java.util.List;
 
 public interface ActiveRulesLoader {
-  List<Rule> load(String qualityProfileKey, @Nullable MutableBoolean fromCache);
+  List<LoadedActiveRule> load(String qualityProfileKey, @Nullable MutableBoolean fromCache);
 }
index 76fffd15264a70cc5b7492aa6c4396f10fb08e81..da9f5211994be5ae62077d97ebd44ac452763682 100644 (file)
@@ -23,8 +23,6 @@ import org.sonar.api.utils.log.Profiler;
 
 import org.sonar.api.utils.log.Logger;
 import org.sonar.api.utils.log.Loggers;
-import org.sonarqube.ws.Rules.Rule.Param;
-import org.sonarqube.ws.Rules.Rule;
 import org.picocontainer.injectors.ProviderAdapter;
 import org.sonar.api.batch.rule.ActiveRules;
 import org.sonar.api.batch.rule.internal.ActiveRulesBuilder;
@@ -59,16 +57,16 @@ public class ActiveRulesProvider extends ProviderAdapter {
   private static ActiveRules load(ActiveRulesLoader loader, ModuleQProfiles qProfiles) {
 
     Collection<String> qProfileKeys = getKeys(qProfiles);
-    Map<String, Rule> loadedRulesByKey = new HashMap<>();
+    Map<RuleKey, LoadedActiveRule> loadedRulesByKey = new HashMap<>();
 
     try {
       for (String qProfileKey : qProfileKeys) {
-        Collection<Rule> qProfileRules;
+        Collection<LoadedActiveRule> qProfileRules;
         qProfileRules = load(loader, qProfileKey);
 
-        for (Rule r : qProfileRules) {
-          if (!loadedRulesByKey.containsKey(r.getKey())) {
-            loadedRulesByKey.put(r.getKey(), r);
+        for (LoadedActiveRule r : qProfileRules) {
+          if (!loadedRulesByKey.containsKey(r.getRuleKey())) {
+            loadedRulesByKey.put(r.getRuleKey(), r);
           }
         }
       }
@@ -79,20 +77,22 @@ public class ActiveRulesProvider extends ProviderAdapter {
     return transform(loadedRulesByKey.values());
   }
 
-  private static ActiveRules transform(Collection<Rule> loadedRules) {
+  private static ActiveRules transform(Collection<LoadedActiveRule> loadedRules) {
     ActiveRulesBuilder builder = new ActiveRulesBuilder();
 
-    for (Rule activeRule : loadedRules) {
-      NewActiveRule newActiveRule = builder.create(RuleKey.parse(activeRule.getKey()));
+    for (LoadedActiveRule activeRule : loadedRules) {
+      NewActiveRule newActiveRule = builder.create(activeRule.getRuleKey());
       newActiveRule.setName(activeRule.getName());
       newActiveRule.setSeverity(activeRule.getSeverity());
-      newActiveRule.setLanguage(activeRule.getLang());
+      newActiveRule.setLanguage(activeRule.getLanguage());
       newActiveRule.setInternalKey(activeRule.getInternalKey());
-      newActiveRule.setTemplateRuleKey(activeRule.getTemplateKey());
+      newActiveRule.setTemplateRuleKey(activeRule.getTemplateRuleKey());
 
       // load parameters
-      for (Param param : activeRule.getParams().getParamsList()) {
-        newActiveRule.setParam(param.getKey(), param.getDefaultValue());
+      if (activeRule.getParams() != null) {
+        for (Map.Entry<String, String> params : activeRule.getParams().entrySet()) {
+          newActiveRule.setParam(params.getKey(), params.getValue());
+        }
       }
 
       newActiveRule.activate();
@@ -100,7 +100,7 @@ public class ActiveRulesProvider extends ProviderAdapter {
     return builder.build();
   }
 
-  private static List<Rule> load(ActiveRulesLoader loader, String qProfileKey) throws IOException {
+  private static List<LoadedActiveRule> load(ActiveRulesLoader loader, String qProfileKey) throws IOException {
     return loader.load(qProfileKey, null);
   }
 
index c752b2f387101f559c65210ef673fcf975e98775..14c37bf1745eae38bdcf934da2ea50b0e8f957d4 100644 (file)
  */
 package org.sonar.batch.rule;
 
+import org.sonarqube.ws.Rules.Active.Param;
+import org.sonarqube.ws.Rules.Active;
+import org.sonar.api.rule.RuleKey;
+import org.sonarqube.ws.Rules.ActiveList;
 import org.sonarqube.ws.Rules.SearchResponse;
-
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.mutable.MutableBoolean;
 import org.sonar.batch.cache.WSLoader;
@@ -32,10 +35,13 @@ import org.sonarqube.ws.Rules.Rule;
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.HashMap;
+import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 
 public class DefaultActiveRulesLoader implements ActiveRulesLoader {
-  private static final String RULES_SEARCH_URL = "/api/rules/search.protobuf?ps=500&f=repo,name,severity,lang,internalKey,templateKey,params&activation=true";
+  private static final String RULES_SEARCH_URL = "/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true";
 
   private final WSLoader wsLoader;
 
@@ -44,23 +50,40 @@ public class DefaultActiveRulesLoader implements ActiveRulesLoader {
   }
 
   @Override
-  public List<Rule> load(String qualityProfileKey, @Nullable MutableBoolean fromCache) {
-    WSLoaderResult<InputStream> result = wsLoader.loadStream(getUrl(qualityProfileKey));
-    List<Rule> ruleList = loadFromStream(result.get());
-    if (fromCache != null) {
-      fromCache.setValue(result.isFromCache());
+  public List<LoadedActiveRule> load(String qualityProfileKey, @Nullable MutableBoolean fromCache) {
+    List<LoadedActiveRule> ruleList = new LinkedList<>();
+    int page = 1;
+    int pageSize = 500;
+    int loaded = 0;
+
+    while (true) {
+      WSLoaderResult<InputStream> result = wsLoader.loadStream(getUrl(qualityProfileKey, page, pageSize));
+      SearchResponse response = loadFromStream(result.get());
+      List<LoadedActiveRule> pageRules = readPage(response);
+      ruleList.addAll(pageRules);
+      loaded += response.getPs();
+
+      if (response.getTotal() <= loaded) {
+        break;
+      }
+      page++;
     }
+
     return ruleList;
   }
 
-  private static String getUrl(String qualityProfileKey) {
-    return RULES_SEARCH_URL + "&qprofile=" + qualityProfileKey;
+  private static String getUrl(String qualityProfileKey, int page, int pageSize) {
+    StringBuilder builder = new StringBuilder(1024);
+    builder.append(RULES_SEARCH_URL);
+    builder.append("&qprofile=").append(qualityProfileKey);
+    builder.append("&p=").append(page);
+    builder.append("&ps=").append(pageSize);
+    return builder.toString();
   }
 
-  private static List<Rule> loadFromStream(InputStream is) {
+  private static SearchResponse loadFromStream(InputStream is) {
     try {
-      SearchResponse response = SearchResponse.parseFrom(is);
-      return response.getRulesList();
+      return SearchResponse.parseFrom(is);
     } catch (IOException e) {
       throw new IllegalStateException("Failed to load quality profiles", e);
     } finally {
@@ -68,4 +91,33 @@ public class DefaultActiveRulesLoader implements ActiveRulesLoader {
     }
   }
 
+  private static List<LoadedActiveRule> readPage(SearchResponse response) {
+    List<LoadedActiveRule> loadedRules = new LinkedList<>();
+
+    List<Rule> rulesList = response.getRulesList();
+    Map<String, ActiveList> actives = response.getActives().getActives();
+
+    for (Rule r : rulesList) {
+      ActiveList activeList = actives.get(r.getKey());
+      Active active = activeList.getActiveList(0);
+
+      LoadedActiveRule loadedRule = new LoadedActiveRule();
+      Map<String, String> params = new HashMap<>();
+
+      loadedRule.setRuleKey(RuleKey.parse(r.getKey()));
+      loadedRule.setName(r.getName());
+      loadedRule.setSeverity(active.getSeverity());
+      loadedRule.setLanguage(r.getLang());
+      loadedRule.setInternalKey(r.getInternalKey());
+      loadedRule.setTemplateRuleKey(r.getTemplateKey());
+
+      for (Param param : active.getParamsList()) {
+        params.put(param.getKey(), param.getValue());
+      }
+      loadedRule.setParams(params);
+      loadedRules.add(loadedRule);
+    }
+
+    return loadedRules;
+  }
 }
diff --git a/sonar-batch/src/main/java/org/sonar/batch/rule/LoadedActiveRule.java b/sonar-batch/src/main/java/org/sonar/batch/rule/LoadedActiveRule.java
new file mode 100644 (file)
index 0000000..edd5b2c
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+package org.sonar.batch.rule;
+
+import java.util.Map;
+
+import org.sonar.api.rule.RuleKey;
+
+public class LoadedActiveRule {
+  private RuleKey ruleKey;
+  private String severity;
+  private String name;
+  private String language;
+  private Map<String, String> params;
+  private String templateRuleKey;
+  private String internalKey;
+
+  public RuleKey getRuleKey() {
+    return ruleKey;
+  }
+
+  public void setRuleKey(RuleKey ruleKey) {
+    this.ruleKey = ruleKey;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public String getSeverity() {
+    return severity;
+  }
+
+  public void setSeverity(String severity) {
+    this.severity = severity;
+  }
+
+  public String getLanguage() {
+    return language;
+  }
+
+  public void setLanguage(String language) {
+    this.language = language;
+  }
+
+  public Map<String, String> getParams() {
+    return params;
+  }
+
+  public void setParams(Map<String, String> params) {
+    this.params = params;
+  }
+
+  public String getTemplateRuleKey() {
+    return templateRuleKey;
+  }
+
+  public void setTemplateRuleKey(String templateRuleKey) {
+    this.templateRuleKey = templateRuleKey;
+  }
+
+  public String getInternalKey() {
+    return internalKey;
+  }
+
+  public void setInternalKey(String internalKey) {
+    this.internalKey = internalKey;
+  }
+
+}
index 4181b2f16b2008e9caea342c4eed9d7fac652975..7934c0fed45e85323431c1bf0b774666620e0c3c 100644 (file)
  */
 package org.sonar.batch.cache;
 
-import static org.mockito.Mockito.when;
-
-import org.sonarqube.ws.Rules.Rule;
-
-import org.sonarqube.ws.QualityProfiles.WsSearchResponse.QualityProfile;
 import com.google.common.collect.ImmutableList;
+import org.junit.Before;
 import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.sonar.batch.repository.QualityProfileLoader;
+import org.sonar.batch.rule.ActiveRulesLoader;
+import org.sonar.batch.rule.LoadedActiveRule;
+import org.sonarqube.ws.QualityProfiles.WsSearchResponse.QualityProfile;
 
 import java.util.Date;
 
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyNoMoreInteractions;
-import org.mockito.MockitoAnnotations;
-import org.junit.Before;
-import org.mockito.Mock;
-import org.sonar.batch.rule.ActiveRulesLoader;
-import org.sonar.batch.repository.QualityProfileLoader;
+import static org.mockito.Mockito.when;
 
 public class NonAssociatedCacheSynchronizerTest {
   private NonAssociatedCacheSynchronizer synchronizer;
@@ -52,7 +50,7 @@ public class NonAssociatedCacheSynchronizerTest {
     MockitoAnnotations.initMocks(this);
 
     QualityProfile pf = QualityProfile.newBuilder().setKey("profile").setName("profile").setLanguage("lang").build();
-    Rule ar = Rule.newBuilder().build();
+    LoadedActiveRule ar = new LoadedActiveRule();
 
     when(qualityProfileLoader.loadDefault(null)).thenReturn(ImmutableList.of(pf));
     when(activeRulesLoader.load("profile", null)).thenReturn(ImmutableList.of(ar));
index 0d46388d01c33ba20b441823d7652b9e957d7833..548e6124313ba56d66da16af1abe25c36043e10f 100644 (file)
@@ -19,6 +19,8 @@
  */
 package org.sonar.batch.cache;
 
+import org.sonar.batch.rule.LoadedActiveRule;
+
 import com.google.common.base.Function;
 import com.google.common.collect.ImmutableList;
 import org.apache.commons.lang.mutable.MutableBoolean;
@@ -49,7 +51,6 @@ import java.util.Date;
 import java.util.HashMap;
 
 import static org.mockito.Matchers.anyBoolean;
-
 import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.anyString;
 import static org.mockito.Matchers.eq;
@@ -97,7 +98,7 @@ public class ProjectCacheSynchronizerTest {
     projectRepositoriesLoader = mock(DefaultProjectRepositoriesLoader.class);
 
     QualityProfile pf = QualityProfile.newBuilder().setKey("profile").setName("profile").setLanguage("lang").build();
-    org.sonarqube.ws.Rules.Rule ar = org.sonarqube.ws.Rules.Rule.newBuilder().build();
+    LoadedActiveRule ar = new LoadedActiveRule();
     ProjectRepositories repo = mock(ProjectRepositories.class);
 
     when(qualityProfileLoader.load(PROJECT_KEY, null, null)).thenReturn(ImmutableList.of(pf));
index f488d8bfe6541e15d1e9702d93a6810e142c2f9a..ab8ee270983fbe1e8a97b618a8d0093cf2fd11f0 100644 (file)
  */
 package org.sonar.batch.mediumtest;
 
-import org.sonar.batch.repository.FileData;
+import org.sonar.api.rule.RuleKey;
 
+import org.sonar.batch.rule.LoadedActiveRule;
+import org.sonar.batch.repository.FileData;
 import org.sonar.api.utils.DateUtils;
 import com.google.common.collect.Table;
 import com.google.common.collect.HashBasedTable;
@@ -217,33 +219,23 @@ public class BatchMediumTester {
       return this;
     }
 
-    public BatchMediumTesterBuilder activateRule(org.sonarqube.ws.Rules.Rule activeRule) {
+    public BatchMediumTesterBuilder activateRule(LoadedActiveRule activeRule) {
       activeRules.addActiveRule(activeRule);
       return this;
     }
 
     public BatchMediumTesterBuilder addActiveRule(String repositoryKey, String ruleKey, @Nullable String templateRuleKey, String name, @Nullable String severity,
       @Nullable String internalKey, @Nullable String languag) {
-
-      org.sonarqube.ws.Rules.Rule.Builder builder = org.sonarqube.ws.Rules.Rule.newBuilder();
-      builder.setRepo(repositoryKey);
-      if (internalKey != null) {
-        builder.setInternalKey(internalKey);
-      }
-      builder.setKey(repositoryKey + ":" + ruleKey);
-      builder.setName(name);
-
-      if (templateRuleKey != null) {
-        builder.setTemplateKey(templateRuleKey);
-      }
-      if (languag != null) {
-        builder.setLang(languag);
-      }
-      if (severity != null) {
-        builder.setSeverity(severity);
-      }
-
-      activeRules.addActiveRule(builder.build());
+      LoadedActiveRule r = new LoadedActiveRule();
+
+      r.setInternalKey(internalKey);
+      r.setRuleKey(RuleKey.of(repositoryKey, ruleKey));
+      r.setName(name);
+      r.setTemplateRuleKey(templateRuleKey);
+      r.setLanguage(languag);
+      r.setSeverity(severity);
+      
+      activeRules.addActiveRule(r);
       return this;
     }
 
@@ -379,14 +371,14 @@ public class BatchMediumTester {
   }
 
   private static class FakeActiveRulesLoader implements ActiveRulesLoader {
-    private List<org.sonarqube.ws.Rules.Rule> activeRules = new LinkedList<>();
+    private List<LoadedActiveRule> activeRules = new LinkedList<>();
 
-    public void addActiveRule(org.sonarqube.ws.Rules.Rule activeRule) {
+    public void addActiveRule(LoadedActiveRule activeRule) {
       this.activeRules.add(activeRule);
     }
 
     @Override
-    public List<org.sonarqube.ws.Rules.Rule> load(String qualityProfileKey, MutableBoolean fromCache) {
+    public List<LoadedActiveRule> load(String qualityProfileKey, MutableBoolean fromCache) {
       return activeRules;
     }
   }
index 29531f3e537df0c4eccc5edf0319f784ce28bb1b..4c58eb3eb6837df980062d07b696494edc833858 100644 (file)
  */
 package org.sonar.batch.mediumtest.issues;
 
-import org.sonarqube.ws.Rules.Rule.Param;
-
-import org.sonarqube.ws.Rules.Rule.Params;
-
-import javax.annotation.Nullable;
-
 import com.google.common.collect.ImmutableMap;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-
 import org.apache.commons.io.FileUtils;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
+import org.sonar.api.rule.RuleKey;
 import org.sonar.batch.mediumtest.BatchMediumTester;
 import org.sonar.batch.mediumtest.TaskResult;
 import org.sonar.batch.protocol.output.BatchReport.Issue;
+import org.sonar.batch.rule.LoadedActiveRule;
 import org.sonar.xoo.XooPlugin;
 import org.sonar.xoo.rule.XooRulesDefinition;
+
+import javax.annotation.Nullable;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 import static org.assertj.core.api.Assertions.assertThat;
 
 public class ChecksMediumTest {
@@ -109,29 +109,21 @@ public class ChecksMediumTest {
     assertThat(foundIssueAtLine2).isTrue();
   }
 
-  private org.sonarqube.ws.Rules.Rule createActiveRuleWithParam(String repositoryKey, String ruleKey, @Nullable String templateRuleKey, String name, @Nullable String severity,
+  private LoadedActiveRule createActiveRuleWithParam(String repositoryKey, String ruleKey, @Nullable String templateRuleKey, String name, @Nullable String severity,
     @Nullable String internalKey, @Nullable String languag, String paramKey, String paramValue) {
-    org.sonarqube.ws.Rules.Rule.Builder builder = org.sonarqube.ws.Rules.Rule.newBuilder();
-    builder.setRepo(repositoryKey);
-    builder.setKey(repositoryKey + ":" + ruleKey);
-    if (templateRuleKey != null) {
-      builder.setTemplateKey(templateRuleKey);
-    }
-    if (languag != null) {
-      builder.setLang(languag);
-    }
-    if (internalKey != null) {
-      builder.setInternalKey(internalKey);
-    }
-    if (severity != null) {
-      builder.setSeverity(severity);
-    }
-    builder.setName(name);
-
-    Param param = Param.newBuilder().setKey(paramKey).setDefaultValue(paramValue).build();
-    Params params = Params.newBuilder().addParams(param).build();
-    builder.setParams(params);
-    return builder.build();
+    LoadedActiveRule r = new LoadedActiveRule();
+
+    r.setInternalKey(internalKey);
+    r.setRuleKey(RuleKey.of(repositoryKey, ruleKey));
+    r.setName(name);
+    r.setTemplateRuleKey(templateRuleKey);
+    r.setLanguage(languag);
+    r.setSeverity(severity);
+
+    Map<String, String> params = new HashMap<>();
+    params.put(paramKey, paramValue);
+    r.setParams(params);
+    return r;
   }
 
 }
index 76a5cf1b07d19054e5c775a40b48feb4632f79c9..f459a3413417741182885f5ad8236f7a99d09a86 100644 (file)
@@ -28,7 +28,6 @@ import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 import org.sonar.api.batch.rule.ActiveRules;
 import org.sonar.api.rule.RuleKey;
-import org.sonarqube.ws.Rules.Rule;
 
 import java.util.LinkedList;
 import java.util.List;
@@ -52,13 +51,13 @@ public class ActiveRulesProviderTest {
 
   @Test
   public void testCombinationOfRules() {
-    Rule r1 = mockRule("rule1");
-    Rule r2 = mockRule("rule2");
-    Rule r3 = mockRule("rule3");
+    LoadedActiveRule r1 = mockRule("rule1");
+    LoadedActiveRule r2 = mockRule("rule2");
+    LoadedActiveRule r3 = mockRule("rule3");
 
-    List<Rule> qp1Rules = ImmutableList.of(r1, r2);
-    List<Rule> qp2Rules = ImmutableList.of(r2, r3);
-    List<Rule> qp3Rules = ImmutableList.of(r1, r3);
+    List<LoadedActiveRule> qp1Rules = ImmutableList.of(r1, r2);
+    List<LoadedActiveRule> qp2Rules = ImmutableList.of(r2, r3);
+    List<LoadedActiveRule> qp3Rules = ImmutableList.of(r1, r3);
 
     when(loader.load("qp1", null)).thenReturn(qp1Rules);
     when(loader.load("qp2", null)).thenReturn(qp2Rules);
@@ -88,7 +87,10 @@ public class ActiveRulesProviderTest {
     return new ModuleQProfiles(profiles);
   }
 
-  private static Rule mockRule(String name) {
-    return Rule.newBuilder().setName(name).setRepo(name).setKey(name + ":" + name).build();
+  private static LoadedActiveRule mockRule(String name) {
+    LoadedActiveRule r = new LoadedActiveRule();
+    r.setName(name);
+    r.setRuleKey(RuleKey.of(name, name));
+    return r;
   }
 }
index 9e96042319f1ff443b7dbc29333b4d1ad63f62fc..6c63d0545dc4c8ab816cddb2e207c71f4b97141d 100644 (file)
@@ -19,7 +19,8 @@
  */
 package org.sonar.batch.rule;
 
-import org.sonarqube.ws.Rules.Rule;
+import org.sonar.api.rule.RuleKey;
+
 import org.sonar.batch.cache.WSLoaderResult;
 import org.sonar.batch.cache.WSLoader;
 import com.google.common.io.Resources;
@@ -30,8 +31,6 @@ import java.io.InputStream;
 import java.util.Collection;
 
 import static org.mockito.Mockito.verify;
-
-import static org.mockito.Matchers.anyString;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verifyNoMoreInteractions;
@@ -50,14 +49,33 @@ public class DefaultActiveRulesLoaderTest {
 
   @Test
   public void feed_real_response() throws IOException {
-    InputStream response = loadResource("active_rule_search.protobuf");
-    when(ws.loadStream(anyString())).thenReturn(new WSLoaderResult<InputStream>(response, false));
-    Collection<Rule> activeRules = loader.load("java-sonar-way-26368", null);
-    assertThat(activeRules).hasSize(100);
+    InputStream response1 = loadResource("active_rule_search1.protobuf");
+    InputStream response2 = loadResource("active_rule_search2.protobuf");
+
+    String req1 = "/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=java-sonar-way-26368&p=1&ps=500";
+    String req2 = "/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=java-sonar-way-26368&p=2&ps=500";
+    when(ws.loadStream(req1)).thenReturn(new WSLoaderResult<InputStream>(response1, false));
+    when(ws.loadStream(req2)).thenReturn(new WSLoaderResult<InputStream>(response2, false));
 
-    verify(ws).loadStream("/api/rules/search.protobuf?ps=500&f=repo,name,severity,lang,internalKey,templateKey,params&activation=true&qprofile=java-sonar-way-26368");
+    Collection<LoadedActiveRule> activeRules = loader.load("java-sonar-way-26368", null);
+    assertThat(activeRules).hasSize(226);
+    assertActiveRule(activeRules);
+    
+    verify(ws).loadStream(req1);
+    verify(ws).loadStream(req2);
     verifyNoMoreInteractions(ws);
+  }
+
+  private static void assertActiveRule(Collection<LoadedActiveRule> activeRules) {
+    RuleKey key = RuleKey.of("squid", "S3008");
+    for (LoadedActiveRule r : activeRules) {
+      if (!r.getRuleKey().equals(key)) {
+        continue;
+      }
 
+      assertThat(r.getParams().get("format")).isEqualTo("^[a-z][a-zA-Z0-9]*$");
+      assertThat(r.getSeverity()).isEqualTo("MINOR");
+    }
   }
 
   private InputStream loadResource(String name) throws IOException {
diff --git a/sonar-batch/src/test/resources/org/sonar/batch/rule/DefaultActiveRulesLoaderTest/active_rule_search.protobuf b/sonar-batch/src/test/resources/org/sonar/batch/rule/DefaultActiveRulesLoaderTest/active_rule_search.protobuf
deleted file mode 100644 (file)
index 18d0a12..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-\b¾\ 2\10\ 1\18d"Z
-\vsquid:S1194\12\ 5squid\1a("java.lang.Error" should not be extendedR\ 5MAJORb\ 5S1194\9a\ 1\ 4java¢\ 1\ 4Java"×\ 1
-4squid:ObjectFinalizeOverridenCallsSuperFinalizeCheck\12\ 5squid\1aQsuper.finalize() should be called at the end of Object.finalize() implementationsR\aBLOCKERb.ObjectFinalizeOverridenCallsSuperFinalizeCheck\9a\ 1\ 4java¢\ 1\ 4Java"f
-\vsquid:S2078\12\ 5squid\1a1Values passed to LDAP queries should be sanitizedR\bCRITICALb\ 5S2078\9a\ 1\ 4java¢\ 1\ 4Java"~
-\vsquid:S1195\12\ 5squid\1aLArray designators "[]" should be located after the type in method signaturesR\ 5MINORb\ 5S1195\9a\ 1\ 4java¢\ 1\ 4Java"k
-
-squid:S106\12\ 5squid\1a;Standard ouputs should not be used directly to log anythingR\ 5MAJORb\ 4S106\9a\ 1\ 4java¢\ 1\ 4Java"Z
-\vsquid:S1192\12\ 5squid\1a(String literals should not be duplicatedR\ 5MINORb\ 5S1192\9a\ 1\ 4java¢\ 1\ 4Java"P
-
-squid:S109\12\ 5squid\1a Magic numbers should not be usedR\ 5MINORb\ 4S109\9a\ 1\ 4java¢\ 1\ 4Java"f
-\vsquid:S2077\12\ 5squid\1a1Values passed to SQL commands should be sanitizedR\bCRITICALb\ 5S2077\9a\ 1\ 4java¢\ 1\ 4Java"e
-\vsquid:S2076\12\ 5squid\1a0Values passed to OS commands should be sanitizedR\bCRITICALb\ 5S2076\9a\ 1\ 4java¢\ 1\ 4Java"y
-\vsquid:S1193\12\ 5squid\1aGException types should not be tested using "instanceof" in catch blocksR\ 5MAJORb\ 5S1193\9a\ 1\ 4java¢\ 1\ 4Java"]
-\vsquid:S1190\12\ 5squid\1a+Future keywords should not be used as namesR\ 5MAJORb\ 5S1190\9a\ 1\ 4java¢\ 1\ 4Java"b
-\vsquid:S1191\12\ 5squid\1a0Classes from "sun.*" packages should not be usedR\ 5MAJORb\ 5S1191\9a\ 1\ 4java¢\ 1\ 4Java"6
-\vsquid:S1444\12\ 5squid\1a\ 1:R\bCRITICALb\ 5S1444\9a\ 1\ 4java¢\ 1\ 4Java"x
-\vsquid:S2864\12\ 5squid\1aF"entrySet()" should be iterated when both the key and value are neededR\ 5MAJORb\ 5S2864\9a\ 1\ 4java¢\ 1\ 4Java"¢\ 1
-#squid:RightCurlyBraceStartLineCheck\12\ 5squid\1a@A close curly brace should be located at the beginning of a lineR\ 5MINORb\1dRightCurlyBraceStartLineCheck\9a\ 1\ 4java¢\ 1\ 4Java"p
-\vsquid:S2070\12\ 5squid\1a;SHA-1 and Message-Digest hash algorithms should not be usedR\bCRITICALb\ 5S2070\9a\ 1\ 4java¢\ 1\ 4Java"j
-\vsquid:S1849\12\ 5squid\1a6"Iterator.hasNext()" should not call "Iterator.next()"R\aBLOCKERb\ 5S1849\9a\ 1\ 4java¢\ 1\ 4Java"f
-\vsquid:S2301\12\ 5squid\1a4Public methods should not contain selector argumentsR\ 5MAJORb\ 5S2301\9a\ 1\ 4java¢\ 1\ 4Java"\7f
-\vsquid:S1848\12\ 5squid\1aJObjects should not be created to be dropped immediately without being usedR\bCRITICALb\ 5S1848\9a\ 1\ 4java¢\ 1\ 4Java"W
-\vsquid:S1199\12\ 5squid\1a%Nested code blocks should not be usedR\ 5MAJORb\ 5S1199\9a\ 1\ 4java¢\ 1\ 4Java"\9e\ 1
-\vsquid:S1844\12\ 5squid\1aj"Object.wait(...)" should never be called on objects that implement "java.util.concurrent.locks.Condition"R\aBLOCKERb\ 5S1844\9a\ 1\ 4java¢\ 1\ 4Java"p
-\vsquid:S1197\12\ 5squid\1a>Array designators "[]" should be on the type, not the variableR\ 5MINORb\ 5S1197\9a\ 1\ 4java¢\ 1\ 4Java"\80\ 1
-\vsquid:S2066\12\ 5squid\1aK"Serializable" inner classes of non-serializable classes should be "static"R\bCRITICALb\ 5S2066\9a\ 1\ 4java¢\ 1\ 4Java"n
-\vsquid:S2065\12\ 5squid\1a<Fields in non-serializable classes should not be "transient"R\ 5MINORb\ 5S2065\9a\ 1\ 4java¢\ 1\ 4Java"R
-\vsquid:S2970\12\ 5squid\1a\1dAssertions should be completeR\bCRITICALb\ 5S2970\9a\ 1\ 4java¢\ 1\ 4Java"Y
-\vsquid:S2068\12\ 5squid\1a$Credentials should not be hard-codedR\bCRITICALb\ 5S2068\9a\ 1\ 4java¢\ 1\ 4Java"i
-\vsquid:S2974\12\ 5squid\1a7Classes without "public" constructors should be "final"R\ 5MAJORb\ 5S2974\9a\ 1\ 4java¢\ 1\ 4Java"s
-\vsquid:S2976\12\ 5squid\1a>"File.createTempFile" should not be used to create a directoryR\bCRITICALb\ 5S2976\9a\ 1\ 4java¢\ 1\ 4Java"Y
-\vsquid:S1068\12\ 5squid\1a'Unused private fields should be removedR\ 5MAJORb\ 5S1068\9a\ 1\ 4java¢\ 1\ 4Java"Q
-\vsquid:S1065\12\ 5squid\1a\1fUnused labels should be removedR\ 5MAJORb\ 5S1065\9a\ 1\ 4java¢\ 1\ 4Java"}
- squid:MethodCyclomaticComplexity\12\ 5squid\1a!Methods should not be too complexR\ 5MAJORb\1aMethodCyclomaticComplexity\9a\ 1\ 4java¢\ 1\ 4Java"z
-\1esquid:EmptyStatementUsageCheck\12\ 5squid\1a"Empty statements should be removedR\ 5MINORb\18EmptyStatementUsageCheck\9a\ 1\ 4java¢\ 1\ 4Java"W
-\vsquid:S1067\12\ 5squid\1a%Expressions should not be too complexR\ 5MAJORb\ 5S1067\9a\ 1\ 4java¢\ 1\ 4Java"^
-\vsquid:S1066\12\ 5squid\1a,Collapsible "if" statements should be mergedR\ 5MAJORb\ 5S1066\9a\ 1\ 4java¢\ 1\ 4Java"t
-\vsquid:S2061\12\ 5squid\1a?Custom serialization method signatures should meet requirementsR\bCRITICALb\ 5S2061\9a\ 1\ 4java¢\ 1\ 4Java"Þ\ 1
--squid:RightCurlyBraceSameLineAsNextBlockCheck\12\ 5squid\1ahClose curly brace and the next "else", "catch" and "finally" keywords should be located on the same lineR\ 5MINORb'RightCurlyBraceSameLineAsNextBlockCheck\9a\ 1\ 4java¢\ 1\ 4Java"V
-\vsquid:S2063\12\ 5squid\1a$Comparators should be "Serializable"R\ 5MAJORb\ 5S2063\9a\ 1\ 4java¢\ 1\ 4Java"i
-\vsquid:S2701\12\ 5squid\1a7Literal boolean values should not be used in assertionsR\ 5MAJORb\ 5S2701\9a\ 1\ 4java¢\ 1\ 4Java"y
-\vsquid:S2059\12\ 5squid\1aG"Serializable" inner classes of "Serializable" classes should be staticR\ 5MAJORb\ 5S2059\9a\ 1\ 4java¢\ 1\ 4Java"a
-\vsquid:S2057\12\ 5squid\1a/"Serializable" classes should have a version idR\ 5MAJORb\ 5S2057\9a\ 1\ 4java¢\ 1\ 4Java"®\ 1
-\vsquid:S1596\12\ 5squid\1a|Collections.emptyList(), emptyMap() and emptySet() should be used instead of Collections.EMPTY_LIST, EMPTY_MAP and EMPTY_SETR\ 5MAJORb\ 5S1596\9a\ 1\ 4java¢\ 1\ 4Java"\93\ 1
-\vsquid:S2055\12\ 5squid\1a^The non-serializable super class of a "Serializable" class must have a no-argument constructorR\bCRITICALb\ 5S2055\9a\ 1\ 4java¢\ 1\ 4Java"h
-\vsquid:S1598\12\ 5squid\1a6Package declaration should match source file directoryR\ 5MAJORb\ 5S1598\9a\ 1\ 4java¢\ 1\ 4Java"S
-\12squid:ParsingError\12\ 5squid\1a\13Java parser failureR\ 5MAJORb\fParsingError\9a\ 1\ 4java¢\ 1\ 4Java"\95\ 1
-
-squid:S881\12\ 5squid\1aeIncrement (++) and decrement (--) operators should not be mixed with other operators in an expressionR\ 5MAJORb\ 4S881\9a\ 1\ 4java¢\ 1\ 4Java"v
-\vsquid:S1724\12\ 5squid\1aDDeprecated classes and interfaces should not be extended/implementedR\ 5MAJORb\ 5S1724\9a\ 1\ 4java¢\ 1\ 4Java"w
-\vsquid:S1862\12\ 5squid\1aBRelated "if/else if" statements should not have the same conditionR\bCRITICALb\ 5S1862\9a\ 1\ 4java¢\ 1\ 4Java"v
-\vsquid:S1860\12\ 5squid\1aBSynchronization should not be based on Strings or boxed primitivesR\aBLOCKERb\ 5S1860\9a\ 1\ 4java¢\ 1\ 4Java"\80\ 1
-\vsquid:S1317\12\ 5squid\1aN"StringBuilder" and "StringBuffer" should not be instantiated with a characterR\ 5MAJORb\ 5S1317\9a\ 1\ 4java¢\ 1\ 4Java"Q
-\vsquid:S1314\12\ 5squid\1a\1fOctal values should not be usedR\ 5MAJORb\ 5S1314\9a\ 1\ 4java¢\ 1\ 4Java"j
-\vsquid:S1315\12\ 5squid\1a8"CHECKSTYLE:OFF" suppression comments should not be usedR\ 5MINORb\ 5S1315\9a\ 1\ 4java¢\ 1\ 4Java"}
-\vsquid:S2718\12\ 5squid\1aH"DateUtils.truncate" from Apache Commons Lang library should not be usedR\bCRITICALb\ 5S2718\9a\ 1\ 4java¢\ 1\ 4Java"s
-\16squid:IndentationCheck\12\ 5squid\1a+Source code should be indented consistentlyR\ 5MINORb\10IndentationCheck\9a\ 1\ 4java¢\ 1\ 4Java"c
-\vsquid:S1451\12\ 5squid\1a/Copyright and license headers should be definedR\aBLOCKERb\ 5S1451\9a\ 1\ 4java¢\ 1\ 4Java"p
-\vsquid:S1452\12\ 5squid\1a>Generic wildcard types should not be used in return parametersR\ 5MAJORb\ 5S1452\9a\ 1\ 4java¢\ 1\ 4Java"u
-\vsquid:S1318\12\ 5squid\1a@"object == null" should be used instead of "object.equals(null)"R\bCRITICALb\ 5S1318\9a\ 1\ 4java¢\ 1\ 4Java"µ\ 1
-\vsquid:S1319\12\ 5squid\1a\82\ 1Declarations should use Java collection interfaces such as "List" rather than specific implementation classes such as "LinkedList"R\ 5MAJORb\ 5S1319\9a\ 1\ 4java¢\ 1\ 4Java"\7f
-\vsquid:S1312\12\ 5squid\1aMLoggers should be "private static final" and should share a naming conventionR\ 5MINORb\ 5S1312\9a\ 1\ 4java¢\ 1\ 4Java"V
-\vsquid:S1313\12\ 5squid\1a$IP addresses should not be hardcodedR\ 5MAJORb\ 5S1313\9a\ 1\ 4java¢\ 1\ 4Java"\7f
-
-squid:S864\12\ 5squid\1aOLimited dependence should be placed on operator precedence rules in expressionsR\ 5MAJORb\ 4S864\9a\ 1\ 4java¢\ 1\ 4Java"a
-\vsquid:S1310\12\ 5squid\1a/"NOPMD" suppression comments should not be usedR\ 5MINORb\ 5S1310\9a\ 1\ 4java¢\ 1\ 4Java"h
-\vsquid:S2447\12\ 5squid\1a3Null should not be returned from a "Boolean" methodR\bCRITICALb\ 5S2447\9a\ 1\ 4java¢\ 1\ 4Java"\7f
-\vsquid:S1850\12\ 5squid\1aM"instanceof" operators that always return "true" or "false" should be removedR\ 5MAJORb\ 5S1850\9a\ 1\ 4java¢\ 1\ 4Java"z
-\vsquid:S2583\12\ 5squid\1aFConditions should not unconditionally evaluate to "TRUE" or to "FALSE"R\aBLOCKERb\ 5S2583\9a\ 1\ 4java¢\ 1\ 4Java"^
-\vsquid:S1710\12\ 5squid\1a,Annotation repetitions should not be wrappedR\ 5MAJORb\ 5S1710\9a\ 1\ 4java¢\ 1\ 4Java"o
-\vsquid:S2440\12\ 5squid\1a=Classes with only "static" methods should not be instantiatedR\ 5MAJORb\ 5S2440\9a\ 1\ 4java¢\ 1\ 4Java"t
-\vsquid:S2441\12\ 5squid\1a?Non-serializable objects should not be stored in "HttpSessions"R\bCRITICALb\ 5S2441\9a\ 1\ 4java¢\ 1\ 4Java"_
-\vsquid:S2442\12\ 5squid\1a+"Lock" objects should not be "synchronized"R\aBLOCKERb\ 5S2442\9a\ 1\ 4java¢\ 1\ 4Java"\97\ 1
-"squid:ObjectFinalizeOverridenCheck\12\ 5squid\1a4The Object.finalize() method should not be overridenR\bCRITICALb\1cObjectFinalizeOverridenCheck\9a\ 1\ 4java¢\ 1\ 4Java"h
-\vsquid:S1858\12\ 5squid\1a6"toString()" should never be called on a String objectR\ 5MAJORb\ 5S1858\9a\ 1\ 4java¢\ 1\ 4Java"t
-\vsquid:S2444\12\ 5squid\1a?Lazy initialization of "static" fields should be "synchronized"R\bCRITICALb\ 5S2444\9a\ 1\ 4java¢\ 1\ 4Java"\8f\ 1
-\vsquid:S2445\12\ 5squid\1a[Blocks synchronized on fields should not contain assignments of new objects to those fieldsR\aBLOCKERb\ 5S2445\9a\ 1\ 4java¢\ 1\ 4Java"O
-\vsquid:S2446\12\ 5squid\1a\1a"notifyAll" should be usedR\bCRITICALb\ 5S2446\9a\ 1\ 4java¢\ 1\ 4Java"k
-\vsquid:S1301\12\ 5squid\1a9"switch" statements should have at least 3 "case" clausesR\ 5MINORb\ 5S1301\9a\ 1\ 4java¢\ 1\ 4Java"f
-\vsquid:S1607\12\ 5squid\1a4Skipped unit tests should be either removed or fixedR\ 5MAJORb\ 5S1607\9a\ 1\ 4java¢\ 1\ 4Java"d
-\vsquid:S1309\12\ 5squid\1a3The @SuppressWarnings annotation should not be usedR\ 4INFOb\ 5S1309\9a\ 1\ 4java¢\ 1\ 4Java"z
-\vsquid:S1604\12\ 5squid\1aHAnonymous inner classes containing only one method should become lambdasR\ 5MAJORb\ 5S1604\9a\ 1\ 4java¢\ 1\ 4Java"\81\ 1
-\vsquid:S1602\12\ 5squid\1aOLamdbas containing only one statement should not nest this statement in a blockR\ 5MAJORb\ 5S1602\9a\ 1\ 4java¢\ 1\ 4Java"{
-\1fsquid:ClassCyclomaticComplexity\12\ 5squid\1a!Classes should not be too complexR\ 5MAJORb\19ClassCyclomaticComplexity\9a\ 1\ 4java¢\ 1\ 4Java"\8b\ 1
-\vsquid:S1200\12\ 5squid\1aYClasses should not be coupled to too many other classes (Single Responsibility Principle)R\ 5MAJORb\ 5S1200\9a\ 1\ 4java¢\ 1\ 4Java"q
-\vsquid:S1201\12\ 5squid\1a<Methods named "equals" should override Object.equals(Object)R\bCRITICALb\ 5S1201\9a\ 1\ 4java¢\ 1\ 4Java"f
-\vsquid:S1701\12\ 5squid\1a4Fields and methods should not have conflicting namesR\ 5MAJORb\ 5S1701\9a\ 1\ 4java¢\ 1\ 4Java"w
-\vsquid:S1206\12\ 5squid\1aC"equals(Object obj)" and "hashCode()" should be overridden in pairsR\aBLOCKERb\ 5S1206\9a\ 1\ 4java¢\ 1\ 4Java"o
-\vsquid:S1700\12\ 5squid\1a=A field should not duplicate the name of its containing classR\ 5MAJORb\ 5S1700\9a\ 1\ 4java¢\ 1\ 4Java"k
-\vsquid:S2178\12\ 5squid\1a6Short-circuit logic should be used in boolean contextsR\bCRITICALb\ 5S2178\9a\ 1\ 4java¢\ 1\ 4Java"j
-\vsquid:S2176\12\ 5squid\1a8Class names should not shadow interfaces or superclassesR\ 5MAJORb\ 5S2176\9a\ 1\ 4java¢\ 1\ 4Java"\8a\ 1
- squid:ForLoopCounterChangedCheck\12\ 5squid\1a."for" loop stop conditions should be invariantR\ 5MAJORb\1aForLoopCounterChangedCheck\9a\ 1\ 4java¢\ 1\ 4Java"h
-\vsquid:S2175\12\ 5squid\1a3Inappropriate "Collection" calls should not be madeR\bCRITICALb\ 5S2175\9a\ 1\ 4java¢\ 1\ 4Java"e
-\vsquid:S2160\12\ 5squid\1a3Subclasses that add fields should override "equals"R\ 5MAJORb\ 5S2160\9a\ 1\ 4java¢\ 1\ 4Java"q
-\vsquid:S2162\12\ 5squid\1a<"equals" methods should be symmetric and work for subclassesR\bCRITICALb\ 5S2162\9a\ 1\ 4java¢\ 1\ 4Java"\93\ 1
-%squid:RedundantThrowsDeclarationCheck\12\ 5squid\1a-Throws declarations should not be superfluousR\ 5MINORb\1fRedundantThrowsDeclarationCheck\9a\ 1\ 4java¢\ 1\ 4Java"\91\ 1
-\vsquid:S1994\12\ 5squid\1a\"for" loop incrementers should modify the variable being tested in the loop's stop conditionR\bCRITICALb\ 5S1994\9a\ 1\ 4java¢\ 1\ 4Java"\
-\vsquid:S2165\12\ 5squid\1a*"finalize" should not set fields to "null"R\ 5MAJORb\ 5S2165\9a\ 1\ 4java¢\ 1\ 4Java"[
-\vsquid:S2164\12\ 5squid\1a&Math should not be performed on floatsR\bCRITICALb\ 5S2164\9a\ 1\ 4java¢\ 1\ 4Java"f
-\vsquid:S2167\12\ 5squid\1a1"compareTo" should not return "Integer.MIN_VALUE"R\bCRITICALb\ 5S2167\9a\ 1\ 4java¢\ 1\ 4Java"x
-\vsquid:S2166\12\ 5squid\1aFClasses named like "Exception" should extend "Exception" or a subclassR\ 5MAJORb\ 5S2166\9a\ 1\ 4java¢\ 1\ 4Java"g
-\vsquid:S2885\12\ 5squid\1a2"Calendars" and "DateFormats" should not be staticR\bCRITICALb\ 5S2885\9a\ 1\ 4java¢\ 1\ 4Java"~
-\vsquid:S2694\12\ 5squid\1aLInner classes which do not reference their owning classes should be "static"R\ 5MAJORb\ 5S2694\9a\ 1\ 4java¢\ 1\ 4Java"\83\ 1
-\vsquid:S2695\12\ 5squid\1aO"PreparedStatement" and "ResultSet" methods should be called with valid indicesR\aBLOCKERb\ 5S2695\9a\ 1\ 4java¢\ 1\ 4Java"h
-\vsquid:S2692\12\ 5squid\1a3"indexOf" checks should not be for positive numbersR\bCRITICALb\ 5S2692\9a\ 1\ 4java¢\ 1\ 4Java
\ No newline at end of file
diff --git a/sonar-batch/src/test/resources/org/sonar/batch/rule/DefaultActiveRulesLoaderTest/active_rule_search1.protobuf b/sonar-batch/src/test/resources/org/sonar/batch/rule/DefaultActiveRulesLoaderTest/active_rule_search1.protobuf
new file mode 100644 (file)
index 0000000..5544968
Binary files /dev/null and b/sonar-batch/src/test/resources/org/sonar/batch/rule/DefaultActiveRulesLoaderTest/active_rule_search1.protobuf differ
diff --git a/sonar-batch/src/test/resources/org/sonar/batch/rule/DefaultActiveRulesLoaderTest/active_rule_search2.protobuf b/sonar-batch/src/test/resources/org/sonar/batch/rule/DefaultActiveRulesLoaderTest/active_rule_search2.protobuf
new file mode 100644 (file)
index 0000000..a23bd1d
Binary files /dev/null and b/sonar-batch/src/test/resources/org/sonar/batch/rule/DefaultActiveRulesLoaderTest/active_rule_search2.protobuf differ