]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5359 Rename template to is_template
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 3 Jun 2014 12:54:58 +0000 (14:54 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 3 Jun 2014 12:54:58 +0000 (14:54 +0200)
16 files changed:
sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivator.java
sonar-server/src/main/java/org/sonar/server/rule/Rule.java
sonar-server/src/main/java/org/sonar/server/rule/index/RuleDoc.java
sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java
sonar-server/src/main/java/org/sonar/server/rule/index/RuleNormalizer.java
sonar-server/src/main/java/org/sonar/server/rule/index/RuleQuery.java
sonar-server/src/main/java/org/sonar/server/rule/ws/RuleMapping.java
sonar-server/src/main/java/org/sonar/server/rule/ws/SearchAction.java
sonar-server/src/main/resources/org/sonar/server/rule/ws/example-search.json
sonar-server/src/test/java/org/sonar/server/rule/RuleBackendMediumTest.java
sonar-server/src/test/java/org/sonar/server/rule/index/RuleIndexMediumTest.java
sonar-server/src/test/java/org/sonar/server/rule/ws/RulesWebServiceTest.java
sonar-server/src/test/resources/org/sonar/server/rule/ws/RulesWebServiceTest/search_2_rules.json
sonar-server/src/test/resources/org/sonar/server/rule/ws/RulesWebServiceTest/search_template_rules.json
sonar-server/src/test/resources/org/sonar/server/rule/ws/RulesWebServiceTest/show_rule_active.json
sonar-server/src/test/resources/org/sonar/server/rule/ws/RulesWebServiceTest/show_rule_no_active.json

index cc2c7c324ca491dc231f1288223d2d01e2e12210..e8abe2e0f8168196af768d2eb9c7aa342c2125fa 100644 (file)
@@ -30,16 +30,13 @@ import org.sonar.api.server.rule.RuleParamType;
 import org.sonar.core.permission.GlobalPermissions;
 import org.sonar.core.persistence.DbSession;
 import org.sonar.core.preview.PreviewCache;
-import org.sonar.core.qualityprofile.db.ActiveRuleDto;
-import org.sonar.core.qualityprofile.db.ActiveRuleKey;
-import org.sonar.core.qualityprofile.db.ActiveRuleParamDto;
-import org.sonar.core.qualityprofile.db.QualityProfileDto;
-import org.sonar.core.qualityprofile.db.QualityProfileKey;
+import org.sonar.core.qualityprofile.db.*;
 import org.sonar.core.rule.RuleParamDto;
 import org.sonar.server.db.DbClient;
 import org.sonar.server.qualityprofile.db.ActiveRuleDao;
 import org.sonar.server.rule.Rule;
 import org.sonar.server.rule.index.RuleIndex;
+import org.sonar.server.rule.index.RuleNormalizer;
 import org.sonar.server.rule.index.RuleQuery;
 import org.sonar.server.rule.index.RuleResult;
 import org.sonar.server.search.IndexClient;
@@ -48,6 +45,7 @@ import org.sonar.server.user.UserSession;
 import org.sonar.server.util.TypeValidations;
 
 import javax.annotation.Nullable;
+
 import java.util.List;
 import java.util.Map;
 
@@ -295,11 +293,11 @@ public class RuleActivator implements ServerComponent {
       RuleResult result = ruleIndex.search(ruleQuery,
         QueryOptions.DEFAULT.setOffset(0)
           .setLimit(Integer.MAX_VALUE)
-          .setFieldsToReturn(ImmutableSet.of("template", "severity"))
+          .setFieldsToReturn(ImmutableSet.of(RuleNormalizer.RuleField.IS_TEMPLATE.field(), RuleNormalizer.RuleField.SEVERITY.field()))
       );
 
       for (Rule rule : result.getHits()) {
-        if (!rule.template()) {
+        if (!rule.isTemplate()) {
           ActiveRuleKey key = ActiveRuleKey.of(profile, rule.key());
           RuleActivation activation = new RuleActivation(key);
           activation.setSeverity(rule.severity());
@@ -328,7 +326,7 @@ public class RuleActivator implements ServerComponent {
         QueryOptions.DEFAULT.setOffset(0)
           // TODO pb because limited to QueryOptions.MAX_LIMIT
           .setLimit(Integer.MAX_VALUE)
-          .setFieldsToReturn(ImmutableSet.of("template", "severity"))
+          .setFieldsToReturn(ImmutableSet.of(RuleNormalizer.RuleField.IS_TEMPLATE.field(), RuleNormalizer.RuleField.SEVERITY.field()))
       );
 
       for (Rule rule : result.getHits()) {
index 5e1894a82a20422a8e91a021280cd9d7e548f9c0..cb3008783d3fe6277df4a562dad9ecbe147bfa04 100644 (file)
@@ -55,7 +55,7 @@ public interface Rule {
    */
   RuleStatus status();
 
-  boolean template();
+  boolean isTemplate();
 
   @CheckForNull
   RuleKey templateKey();
index 196eba033f7835e6fdd4b3c678a3de71f132938d..0fe251bf8d1ae6f0badb6497b02bec9d296927b1 100644 (file)
@@ -86,8 +86,8 @@ public class RuleDoc extends BaseDoc implements Rule {
   }
 
   @Override
-  public boolean template() {
-    return (Boolean) getField(RuleNormalizer.RuleField.TEMPLATE.field());
+  public boolean isTemplate() {
+    return (Boolean) getField(RuleNormalizer.RuleField.IS_TEMPLATE.field());
   }
 
   @Override
index 5987a94c6d1c74352844350608137c6761b278ba..9e1e2f21c093c5ecac38e2291269f863cf27c90d 100644 (file)
@@ -195,10 +195,10 @@ public class RuleIndex extends BaseIndex<Rule, RuleDto, RuleKey> {
 
     Boolean isTemplate = query.isTemplate();
     if (isTemplate != null) {
-      this.addTermFilter(fb, RuleNormalizer.RuleField.TEMPLATE.field(), Boolean.toString(isTemplate));
+      this.addTermFilter(fb, RuleNormalizer.RuleField.IS_TEMPLATE.field(), Boolean.toString(isTemplate));
     }
 
-    String template = query.template();
+    String template = query.templateKey();
     if (template != null) {
       this.addTermFilter(fb, RuleNormalizer.RuleField.TEMPLATE_KEY.field(), template);
     }
index aaf9e57db334da5aa80d92e80f8d66ab71c7298e..777deb5aa1302f084492ebd15a0bac29bd31dc37 100644 (file)
@@ -79,13 +79,13 @@ public class RuleNormalizer extends BaseNormalizer<RuleDto, RuleKey> {
     public static IndexField TAGS = add(IndexField.Type.STRING, "tags");
     public static IndexField SYSTEM_TAGS = add(IndexField.Type.STRING, "sysTags");
     public static IndexField INTERNAL_KEY = add(IndexField.Type.STRING, "internalKey");
-    public static IndexField TEMPLATE = add(IndexField.Type.BOOLEAN, "template");
+    public static IndexField IS_TEMPLATE = add(IndexField.Type.BOOLEAN, "isTemplate");
+    public static IndexField TEMPLATE_KEY = add(IndexField.Type.STRING, "templateKey");
     public static IndexField DEBT_FUNCTION_TYPE = add(IndexField.Type.STRING, "debtRemFnType");
     public static IndexField DEBT_FUNCTION_COEFFICIENT = add(IndexField.Type.STRING, "debtRemFnCoefficient");
     public static IndexField DEBT_FUNCTION_OFFSET = add(IndexField.Type.STRING, "debtRemFnOffset");
     public static IndexField SUB_CHARACTERISTIC = add(IndexField.Type.STRING, "debtSubChar");
     public static IndexField CHARACTERISTIC = add(IndexField.Type.STRING, "debtChar");
-    public static IndexField TEMPLATE_KEY = add(IndexField.Type.STRING, "templateKey");
     public static IndexField NOTE = add(IndexField.Type.TEXT, "markdownNote");
     public static IndexField NOTE_LOGIN = add(IndexField.Type.STRING, "noteLogin");
     public static IndexField NOTE_CREATED_AT = add(IndexField.Type.DATE, "noteCreatedAt");
@@ -159,7 +159,7 @@ public class RuleNormalizer extends BaseNormalizer<RuleDto, RuleKey> {
       update.put(RuleField.STATUS.field(), rule.getStatus().name());
       update.put(RuleField.LANGUAGE.field(), rule.getLanguage());
       update.put(RuleField.INTERNAL_KEY.field(), rule.getConfigKey());
-      update.put(RuleField.TEMPLATE.field(), rule.getCardinality() == Cardinality.MULTIPLE);
+      update.put(RuleField.IS_TEMPLATE.field(), rule.getCardinality() == Cardinality.MULTIPLE);
 
       update.put(RuleField.NOTE.field(), rule.getNoteData());
       update.put(RuleField.NOTE_LOGIN.field(), rule.getNoteUserLogin());
index a993a7ebf745373f579341215c6a71af1ad871cc..02481451c028deb828b76f9d0f4b2545727f9912 100644 (file)
@@ -45,7 +45,7 @@ public class RuleQuery {
   private Boolean activation;
   private String qProfileKey;
   private Collection<String> inheritance;
-  private String template;
+  private String templateKey;
   private Boolean isTemplate;
   private Date availableSince;
   private IndexField sortField;
@@ -209,12 +209,12 @@ public class RuleQuery {
   }
 
   @CheckForNull
-  public String template() {
-    return template;
+  public String templateKey() {
+    return templateKey;
   }
 
-  public RuleQuery setTemplate(@Nullable String template) {
-    this.template = template;
+  public RuleQuery setTemplateKey(@Nullable String templateKey) {
+    this.templateKey = templateKey;
     return this;
   }
 
index 8adcfb1b47c5ea66af0028bf1a5661d85357f4dc..172dca21ff40dddcc9df548e6707c81c2cf33ee6 100644 (file)
@@ -43,7 +43,7 @@ public class RuleMapping extends BaseMapping {
     addIndexStringField("severity", RuleNormalizer.RuleField.SEVERITY.field());
     addIndexStringField("status", RuleNormalizer.RuleField.STATUS.field());
     addIndexStringField("internalKey", RuleNormalizer.RuleField.INTERNAL_KEY.field());
-    addIndexBooleanField("template", RuleNormalizer.RuleField.TEMPLATE.field());
+    addIndexBooleanField("isTemplate", RuleNormalizer.RuleField.IS_TEMPLATE.field());
     addIndexStringField("templateKey", RuleNormalizer.RuleField.TEMPLATE_KEY.field());
     addIndexArrayField("tags", RuleNormalizer.RuleField.TAGS.field());
     addIndexArrayField("sysTags", RuleNormalizer.RuleField.SYSTEM_TAGS.field());
index fd5b6502555d44bbbd5f8c07ab42b661471acb24..f82ef87be85f0d931d590a5126229bc157b80fc5 100644 (file)
@@ -60,7 +60,7 @@ public class SearchAction implements RequestHandler {
   public static final String PARAM_ALL_OF_TAGS = "all_of_tags";
   public static final String PARAM_INHERITANCE = "inheritance";
   public static final String PARAM_IS_TEMPLATE = "is_template";
-  public static final String PARAM_TEMPLATE = "template";
+  public static final String PARAM_TEMPLATE_KEY = "template_key";
   public static final String PARAM_FACETS = "facets";
 
   public static final String SEARCH_ACTION = "search";
@@ -182,7 +182,7 @@ public class SearchAction implements RequestHandler {
       .setBooleanPossibleValues();
 
     action
-      .createParam(PARAM_TEMPLATE)
+      .createParam(PARAM_TEMPLATE_KEY)
       .setDescription("Key of template rule to filter on. Available since 4.4")
       .setExampleValue("java:S001");
 
@@ -240,7 +240,7 @@ public class SearchAction implements RequestHandler {
     query.setAllOfTags(request.paramAsStrings(PARAM_ALL_OF_TAGS));
     query.setInheritance(request.paramAsStrings(PARAM_INHERITANCE));
     query.setIsTemplate(request.paramAsBoolean(PARAM_IS_TEMPLATE));
-    query.setTemplate(request.param(PARAM_TEMPLATE));
+    query.setTemplateKey(request.param(PARAM_TEMPLATE_KEY));
     return query;
   }
 
index d0e7213252914236edc36a45a6f258252534cdb1..7b639d784195549207483af95c29041315348cdf 100644 (file)
@@ -11,7 +11,7 @@
       "severity": "MAJOR",
       "status": "READY",
       "internalKey": "S1067",
-      "template": false,
+      "isTemplate": false,
       "tags": [],
       "sysTags": ["brain-overload"],
       "lang": "java",
@@ -32,7 +32,7 @@
       "severity": "MAJOR",
       "status": "READY",
       "internalKey": "ClassCyclomaticComplexity",
-      "template": false,
+      "isTemplate": false,
       "tags": [],
       "sysTags": ["brain-overload"],
       "lang": "java",
@@ -53,7 +53,7 @@
       "severity": "MAJOR",
       "status": "READY",
       "internalKey": "MethodCyclomaticComplexity",
-      "template": false,
+      "isTemplate": false,
       "tags": [],
       "sysTags": ["brain-overload"],
       "lang": "java",
           "defaultValue": "10"
         }
       ]
+    },
+    {
+      "key": "squid:XPath",
+      "repo": "squid",
+      "name": "XPath rule",
+      "createdAt": "2013-03-27T08:52:40+0100",
+      "htmlDesc": "<p>\nThis rule allows to define some homemade Java rules with help of an XPath expression.\n</p>\n\n<p>\nIssues are created depending on the return value of the XPath expression. If the XPath expression returns:\n</p>\n<ul>\n <li>a single or list of AST nodes, then a line issue with the given message is created for each node</li>\n <li>a boolean, then a file issue with the given message is created only if the boolean is true</li>\n <li>anything else, no issue is created</li>\n</ul>\n\n<p>\nHere is an example of an XPath expression to log an issue on each if statement : //ifStatement\n</p>",
+      "severity": "MAJOR",
+      "status": "READY",
+      "internalKey": "XPath",
+      "isTemplate": true,
+      "tags": [ ],
+      "sysTags": [ ],
+      "mdNote": "<p>\nThe tree produced by the <code>firstOf()</code> matcher is hard to work with from checks when alternatives are not named.\n</p>\n\n<p>\nConsider the following rule:\n</p>\n\n<pre>\nb.rule(COMPILATION_UNIT).is(\n b.firstOf( /* Non-Compliant */\n \"FOO\",\n \"BAR\"));\n</pre>\n\n<p>\nIf, from a check, one wants to forbid the usage of the \"BAR\" alternative,\nthe easiest option will be to verify that the value of the first token is \"BAR\",\ni.e. <code>\"BAR\".equals(compilationUnitNode.getTokenValue())</code>.\n</p>\n\n<p>\nThis is not maintainable, for at least two reasons:\n</p>\n\n<ul>\n <li>The grammar might evolve to also accept \"bar\" in lowercase, which will break <code>\"BAR\".equals(...)</code></li>\n <li>The grammar might evolve to optionally accept \"hello\" before the <code>firstOf()</code>, which will break <code>compilationUnitNode.getTokenValue()</code></li>\n</ul>\n\n<p>\nInstead, it is much better to rewrite the grammar as:\n</p>\n\n<pre>\nb.rule(COMPILATION_UNIT).is(\n firstOf( /* Compliant */\n FOO,\n BAR));\nb.rule(FOO).is(\"FOO\");\nb.rule(BAR).is(\"BAR\");\n</pre>\n\n<p>\nThe same check which forbids \"BAR\" would be written as: <code>compilationUnitNode.hasDirectChildren(BAR)</code>.\nThis allows both of the previous grammar evolutions to be made without impacting the check at all.\n</p>",
+      "htmlNote": "&lt;p&gt;<br/>The tree produced by the &lt;code&gt;firstOf()&lt;/code&gt; matcher is hard to work with from checks when alternatives are not named.<br/>&lt;/p&gt;<br/><br/>&lt;p&gt;<br/>Consider the following rule:<br/>&lt;/p&gt;<br/><br/>&lt;pre&gt;<br/>b.rule(COMPILATION_UNIT).is(<br/> b.firstOf( /* Non-Compliant */<br/> &quot;FOO&quot;,<br/> &quot;BAR&quot;));<br/>&lt;/pre&gt;<br/><br/>&lt;p&gt;<br/>If, from a check, one wants to forbid the usage of the &quot;BAR&quot; alternative,<br/>the easiest option will be to verify that the value of the first token is &quot;BAR&quot;,<br/>i.e. &lt;code&gt;&quot;BAR&quot;.equals(compilationUnitNode.getTokenValue())&lt;/code&gt;.<br/>&lt;/p&gt;<br/><br/>&lt;p&gt;<br/>This is not maintainable, for at least two reasons:<br/>&lt;/p&gt;<br/><br/>&lt;ul&gt;<br/> &lt;li&gt;The grammar might evolve to also accept &quot;bar&quot; in lowercase, which will break &lt;code&gt;&quot;BAR&quot;.equals(...)&lt;/code&gt;&lt;/li&gt;<br/> &lt;li&gt;The grammar might evolve to optionally accept &quot;hello&quot; before the &lt;code&gt;firstOf()&lt;/code&gt;, which will break &lt;code&gt;compilationUnitNode.getTokenValue()&lt;/code&gt;&lt;/li&gt;<br/>&lt;/ul&gt;<br/><br/>&lt;p&gt;<br/>Instead, it is much better to rewrite the grammar as:<br/>&lt;/p&gt;<br/><br/>&lt;pre&gt;<br/>b.rule(COMPILATION_UNIT).is(<br/> firstOf( /* Compliant */<br/> FOO,<br/> BAR));<br/>b.rule(FOO).is(&quot;FOO&quot;);<br/>b.rule(BAR).is(&quot;BAR&quot;);<br/>&lt;/pre&gt;<br/><br/>&lt;p&gt;<br/>The same check which forbids &quot;BAR&quot; would be written as: &lt;code&gt;compilationUnitNode.hasDirectChildren(BAR)&lt;/code&gt;.<br/>This allows both of the previous grammar evolutions to be made without impacting the check at all.<br/>&lt;/p&gt;",
+      "noteLogin": "eric.hartmann",
+      "lang": "java",
+      "langName": "Java",
+      "params": [
+        {
+          "key": "xpathQuery",
+          "desc": "The XPath query",
+          "defaultValue": ""
+        },
+        {
+          "key": "message",
+          "desc": "The violation message",
+          "defaultValue": "The XPath expression matches this piece of code"
+        }
+      ]
+    },
+    {
+      "key": "squid:XPath_1369910135",
+      "repo": "squid",
+      "name": "firstOf() alternatives should be rules or token types",
+      "createdAt": "2013-05-30T10:35:35+0200",
+      "htmlDesc": "<p>\r\nThe tree produced by the <code>firstOf()</code> matcher is hard to work with from checks when alternatives are not named.\r\n</p>\r\n\r\n<p>\r\nConsider the following rule:\r\n</p>\r\n\r\n<pre>\r\nb.rule(COMPILATION_UNIT).is(\r\n b.firstOf( /* Non-Compliant */\r\n \"FOO\",\r\n \"BAR\"));\r\n</pre>\r\n\r\n<p>\r\nIf, from a check, one wants to forbid the usage of the \"BAR\" alternative,\r\nthe easiest option will be to verify that the value of the first token is \"BAR\",\r\ni.e. <code>\"BAR\".equals(compilationUnitNode.getTokenValue())</code>.\r\n</p>\r\n\r\n<p>\r\nThis is not maintainable, for at least two reasons:\r\n</p>\r\n\r\n<ul>\r\n <li>The grammar might evolve to also accept \"bar\" in lowercase, which will break <code>\"BAR\".equals(...)</code></li>\r\n <li>The grammar might evolve to optionally accept \"hello\" before the <code>firstOf()</code>, which will break <code>compilationUnitNode.getTokenValue()</code></li>\r\n</ul>\r\n\r\n<p>\r\nInstead, it is much better to rewrite the grammar as:\r\n</p>\r\n\r\n<pre>\r\nb.rule(COMPILATION_UNIT).is(\r\n firstOf( /* Compliant */\r\n FOO,\r\n BAR));\r\nb.rule(FOO).is(\"FOO\");\r\nb.rule(BAR).is(\"BAR\");\r\n</pre>\r\n\r\n<p>\r\nThe same check which forbids \"BAR\" would be written as: <code>compilationUnitNode.hasDirectChildren(BAR)</code>.\r\nThis allows both of the previous grammar evolutions to be made without impacting the check at all.\r\n</p>",
+      "severity": "MAJOR",
+      "status": "READY",
+      "internalKey": "XPath",
+      "isTemplate": false,
+      "templateKey": "squid:XPath",
+      "tags": [ ],
+      "sysTags": [ ],
+      "lang": "java",
+      "langName": "Java",
+      "params": [
+        {
+          "key": "xpathQuery",
+          "desc": "The XPath query",
+          "defaultValue": "//expression[primary/qualifiedIdentifier[count(IDENTIFIER) = 2]/IDENTIFIER[2]/@tokenValue = 'firstOf' and primary/identifierSuffix/arguments/expression[not(primary) or primary[not(qualifiedIdentifier) or identifierSuffix]]]"
+        },
+        {
+          "key": "message",
+          "desc": "The violation message",
+          "defaultValue": "Refactor this firstOf() to only use a rule or token type for each alternative."
+        }
+      ]
     }
   ],
   "actives": {
         {
           "val": "javadoc",
           "count": 13
-        }]
+        }
+      ]
     },
     {
       "name": "languages",
index f470e9e0eacf9f151122ff5f121916ef44068109..e146c532c958ee743976d39defa90258aff5ffcb 100644 (file)
@@ -102,7 +102,7 @@ public class RuleBackendMediumTest {
     assertThat(hit.updatedAt()).isNotNull();
     assertThat(hit.internalKey()).isEqualTo("InternalKeyS001");
     assertThat(hit.severity()).isEqualTo("INFO");
-    assertThat(hit.template()).isFalse();
+    assertThat(hit.isTemplate()).isFalse();
     assertThat(hit.tags()).containsOnly("tag1", "tag2");
     assertThat(hit.systemTags()).containsOnly("systag1", "systag2");
   }
index 05c6fa5985b2dbe8fb38a1fdd797d2d45e33cd04..3b182fb91477d890682738e5cbf353a1c79df888 100644 (file)
@@ -661,13 +661,13 @@ public class RuleIndexMediumTest {
     results = index.search(query, new QueryOptions());
     assertThat(results.getHits()).hasSize(1);
     assertThat(Iterables.getFirst(results.getHits(), null).key().rule()).isEqualTo("S002");
-    assertThat(Iterables.getFirst(results.getHits(), null).template()).isTrue();
+    assertThat(Iterables.getFirst(results.getHits(), null).isTemplate()).isTrue();
 
     // Only not template
     query = new RuleQuery().setIsTemplate(false);
     results = index.search(query, new QueryOptions());
     assertThat(results.getHits()).hasSize(1);
-    assertThat(Iterables.getFirst(results.getHits(), null).template()).isFalse();
+    assertThat(Iterables.getFirst(results.getHits(), null).isTemplate()).isFalse();
     assertThat(Iterables.getFirst(results.getHits(), null).key().rule()).isEqualTo("S001");
 
     // null => no filter
@@ -688,14 +688,14 @@ public class RuleIndexMediumTest {
     assertThat(results.getHits()).hasSize(2);
 
     // Only custom rule
-    query = new RuleQuery().setTemplate("java:S001");
+    query = new RuleQuery().setTemplateKey("java:S001");
     results = index.search(query, new QueryOptions());
     assertThat(results.getHits()).hasSize(1);
     assertThat(Iterables.getFirst(results.getHits(), null).key().rule()).isEqualTo("S001_MY_CUSTOM");
     assertThat(Iterables.getFirst(results.getHits(), null).templateKey()).isEqualTo(RuleKey.of("java", "S001"));
 
     // null => no filter
-    query = new RuleQuery().setTemplate(null);
+    query = new RuleQuery().setTemplateKey(null);
     assertThat(index.search(query, new QueryOptions()).getHits()).hasSize(2);
   }
 
index ccbdff36d1f38abe54668a5547824198a15d74df..cd7f36756d643ef604077bf5b37834232c8506f5 100644 (file)
@@ -175,7 +175,7 @@ public class RulesWebServiceTest {
 
     MockUserSession.set();
     WsTester.TestRequest request = tester.wsTester().newGetRequest(API_ENDPOINT, API_SEARCH_METHOD);
-    request.setParam(SearchOptions.PARAM_FIELDS, "template");
+    request.setParam(SearchOptions.PARAM_FIELDS, "isTemplate");
     request.setParam(SearchAction.PARAM_IS_TEMPLATE, "true");
     WsTester.Result result = request.execute();
     result.assertJson(this.getClass(), "search_template_rules.json");
@@ -191,7 +191,7 @@ public class RulesWebServiceTest {
     MockUserSession.set();
     WsTester.TestRequest request = tester.wsTester().newGetRequest(API_ENDPOINT, API_SEARCH_METHOD);
     request.setParam(SearchOptions.PARAM_FIELDS, "templateKey");
-    request.setParam(SearchAction.PARAM_TEMPLATE, "java:S001");
+    request.setParam(SearchAction.PARAM_TEMPLATE_KEY, "java:S001");
     WsTester.Result result = request.execute();
     result.assertJson(this.getClass(), "search_rules_from_template_key.json");
   }
index ea0909a52d96919012f713358a69b3733ee1acd2..6bf26137b79a8144f830466a21d5687f82ffff78 100644 (file)
@@ -7,7 +7,7 @@
     "htmlDesc": "Description S002",
     "status": "READY",
     "severity": "INFO",
-    "template": false,
+    "isTemplate": false,
     "internalKey": "InternalKeyS002",
     "tags": [],
     "sysTags": [],
@@ -24,7 +24,7 @@
     "htmlDesc": "Description S001",
     "status": "READY",
     "severity": "INFO",
-    "template": false,
+    "isTemplate": false,
     "internalKey": "InternalKeyS001",
     "tags": [],
     "sysTags": [],
index bb8f626b6c6a09f86d7e866b89769da6046899ce..e757679aa7de31d679afea0f73acae2a5ff4fd8d 100644 (file)
@@ -1,6 +1,6 @@
 {"total": 1, "p": 1, "ps": 10, "rules": [
   {
     "key": "java:S001",
-    "template": true
+    "isTemplate": true
   }
 ]}
index 97e4c23b920adcf1ea9e11e6b14e1ccae06c4de9..f10eaae76671470406fd9c6eb69398c10f99c94b 100644 (file)
@@ -22,6 +22,6 @@
     "status": "READY",
     "sysTags": [],
     "tags": [],
-    "template": false
+    "isTemplate": false
   }
 }
index c96026422a9dbb91254ba599f0444c5a941af20e..a0921b679732783b347c654909e03fa766f88591 100644 (file)
@@ -14,6 +14,6 @@
     "status": "READY",
     "sysTags": [],
     "tags": [],
-    "template": false
+    "isTemplate": false
   }
 }