From 4e75d5f0cb8454951d2c3d7a0fe30c00cb816415 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Thu, 12 May 2016 17:50:13 +0200 Subject: [PATCH] SONAR-7400 Do not return anymore active rule parent key in rules WS --- .../java/org/sonar/server/rule/ws/ActiveRuleCompleter.java | 4 ---- .../index/ActiveRuleResultSetIteratorTest.java | 6 ------ sonar-ws/src/main/protobuf/ws-rules.proto | 3 ++- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/ws/ActiveRuleCompleter.java b/server/sonar-server/src/main/java/org/sonar/server/rule/ws/ActiveRuleCompleter.java index aec0e902e4e..88608db09c8 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/rule/ws/ActiveRuleCompleter.java +++ b/server/sonar-server/src/main/java/org/sonar/server/rule/ws/ActiveRuleCompleter.java @@ -165,10 +165,6 @@ public class ActiveRuleCompleter { activeRuleResponse.setQProfile(activeRule.key().qProfile()); activeRuleResponse.setInherit(activeRule.inheritance().toString()); activeRuleResponse.setSeverity(activeRule.severity()); - ActiveRuleKey parentKey = activeRule.parentKey(); - if (parentKey != null) { - activeRuleResponse.setParent(parentKey.toString()); - } Rules.Active.Param.Builder paramBuilder = Rules.Active.Param.newBuilder(); for (ActiveRuleParamDto parameter : parameters) { activeRuleResponse.addParams(paramBuilder.clear() diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/index/ActiveRuleResultSetIteratorTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/index/ActiveRuleResultSetIteratorTest.java index 354db25ad5a..cdce8f33cce 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/index/ActiveRuleResultSetIteratorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/index/ActiveRuleResultSetIteratorTest.java @@ -63,7 +63,6 @@ public class ActiveRuleResultSetIteratorTest { assertThat(activeRule.key()).isEqualTo(key); assertThat(activeRule.severity()).isEqualTo(CRITICAL); assertThat(activeRule.inheritance()).isEqualTo(ActiveRule.Inheritance.NONE); - assertThat(activeRule.parentKey()).isNull(); assertThat(activeRule.createdAt()).isEqualTo(1500000000000L); assertThat(activeRule.updatedAt()).isEqualTo(1600000000000L); } @@ -82,7 +81,6 @@ public class ActiveRuleResultSetIteratorTest { assertThat(activeRule.key()).isEqualTo(key); assertThat(activeRule.severity()).isEqualTo(CRITICAL); assertThat(activeRule.inheritance()).isEqualTo(ActiveRule.Inheritance.NONE); - assertThat(activeRule.parentKey()).isNull(); assertThat(activeRule.createdAt()).isEqualTo(2000000000000L); assertThat(activeRule.updatedAt()).isEqualTo(2100000000000L); @@ -91,7 +89,6 @@ public class ActiveRuleResultSetIteratorTest { assertThat(activeRule.key()).isEqualTo(key); assertThat(activeRule.severity()).isEqualTo(INFO); assertThat(activeRule.inheritance()).isEqualTo(ActiveRule.Inheritance.NONE); - assertThat(activeRule.parentKey()).isNull(); assertThat(activeRule.createdAt()).isEqualTo(1700000000000L); assertThat(activeRule.updatedAt()).isEqualTo(1800000000000L); @@ -100,7 +97,6 @@ public class ActiveRuleResultSetIteratorTest { assertThat(activeRule.key()).isEqualTo(key); assertThat(activeRule.severity()).isEqualTo(BLOCKER); assertThat(activeRule.inheritance()).isEqualTo(INHERITED); - assertThat(activeRule.parentKey()).isEqualTo(ActiveRuleKey.of("parent", RuleKey.of("xoo", "S001"))); assertThat(activeRule.createdAt()).isEqualTo(1500000000000L); assertThat(activeRule.updatedAt()).isEqualTo(1600000000000L); } @@ -117,7 +113,6 @@ public class ActiveRuleResultSetIteratorTest { ActiveRuleKey key = ActiveRuleKey.of("child", RuleKey.of("xoo", "S001")); ActiveRuleDoc activeRule = activeRulesByKey.get(key); assertThat(activeRule.inheritance()).isEqualTo(INHERITED); - assertThat(activeRule.parentKey()).isEqualTo(ActiveRuleKey.of("parent", RuleKey.of("xoo", "S001"))); } @Test @@ -132,7 +127,6 @@ public class ActiveRuleResultSetIteratorTest { ActiveRuleKey key = ActiveRuleKey.of("child", RuleKey.of("xoo", "S001")); ActiveRuleDoc activeRule = activeRulesByKey.get(key); assertThat(activeRule.inheritance()).isEqualTo(ActiveRule.Inheritance.OVERRIDES); - assertThat(activeRule.parentKey()).isEqualTo(ActiveRuleKey.of("parent", RuleKey.of("xoo", "S001"))); } @Test diff --git a/sonar-ws/src/main/protobuf/ws-rules.proto b/sonar-ws/src/main/protobuf/ws-rules.proto index 08067de63ea..c08cad07af2 100644 --- a/sonar-ws/src/main/protobuf/ws-rules.proto +++ b/sonar-ws/src/main/protobuf/ws-rules.proto @@ -154,7 +154,8 @@ message Active { optional string qProfile = 1; optional string inherit = 2; optional string severity = 3; - optional string parent = 4; + // Unused since 5.6, it has been removed because it was never used and costly to compute + optional string unusedParent = 4; repeated Param params = 5; message Param { -- 2.39.5