]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8079 drop methods suffixed with "kee" in RuleRepositoryDto
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 14 Sep 2016 15:19:46 +0000 (17:19 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 14 Sep 2016 15:19:46 +0000 (17:19 +0200)
server/sonar-server/src/main/java/org/sonar/server/rule/ws/AppAction.java
server/sonar-server/src/main/java/org/sonar/server/rule/ws/RepositoriesAction.java
sonar-db/src/main/java/org/sonar/db/rule/RuleRepositoryDto.java
sonar-db/src/test/java/org/sonar/db/rule/RuleRepositoryDaoTest.java

index 41f4f6e5fc3d3a3e6de1b90f3092500abcaedfe9..015fe37f35d5b91c3f2ebb746e6e143a0832cd16 100644 (file)
@@ -115,7 +115,7 @@ public class AppAction implements RulesWsAction {
       dbClient.ruleRepositoryDao()
         .selectAll(dbSession)
         .forEach(r -> json.beginObject()
-          .prop("key", r.getKee())
+          .prop("key", r.getKey())
           .prop("name", r.getName())
           .prop("language", r.getLanguage())
           .endObject());
index f1c8462d08193906e817e8eba1b058ad801c3675..e21a44b874a14bd774a31e6cccade967dfee2945 100644 (file)
@@ -75,7 +75,7 @@ public class RepositoriesAction implements RulesWsAction {
     for (RuleRepositoryDto repo : listMatchingRepositories(query, languageKey)) {
       json
         .beginObject()
-        .prop("key", repo.getKee())
+        .prop("key", repo.getKey())
         .prop("name", repo.getName())
         .prop(LANGUAGE, repo.getLanguage())
         .endObject();
@@ -87,7 +87,7 @@ public class RepositoriesAction implements RulesWsAction {
     Pattern pattern = Pattern.compile(query == null ? MATCH_ALL : MATCH_ALL + query + MATCH_ALL, Pattern.CASE_INSENSITIVE);
 
     return selectFromDb(languageKey).stream()
-      .filter(r -> pattern.matcher(r.getKee()).matches() || pattern.matcher(r.getName()).matches())
+      .filter(r -> pattern.matcher(r.getKey()).matches() || pattern.matcher(r.getName()).matches())
       .collect(Collectors.toList());
   }
 
index 150c1d3924b199e4f973525f9dac3421d9ce5d4e..772395b4f88bdc53e215fd52b1a9a265ebb46d05 100644 (file)
@@ -21,12 +21,13 @@ package org.sonar.db.rule;
 
 public class RuleRepositoryDto {
 
+  // do not rename "key" as MyBatis maps it with the db column "kee"
   private String kee;
   private String language;
   private String name;
 
   public RuleRepositoryDto() {
-
+    // used by MyBatis
   }
 
   public RuleRepositoryDto(String kee, String language, String name) {
@@ -35,13 +36,6 @@ public class RuleRepositoryDto {
     this.name = name;
   }
 
-  public String getKee() {
-    return kee;
-  }
-
-  /**
-   * Kept for compatibility with ruby code
-   */
   public String getKey() {
     return kee;
   }
@@ -54,7 +48,7 @@ public class RuleRepositoryDto {
     return name;
   }
 
-  public RuleRepositoryDto setKee(String s) {
+  public RuleRepositoryDto setKey(String s) {
     this.kee = s;
     return this;
   }
index 32989ef4807a5adf9837597a06b42b3970cf748c..d50b4497e393c03488209b41e5b17614345cdb4a 100644 (file)
@@ -48,7 +48,7 @@ public class RuleRepositoryDaoTest {
     List<RuleRepositoryDto> rows = underTest.selectAll(dbSession);
     assertThat(rows).hasSize(1);
     RuleRepositoryDto row = rows.get(0);
-    assertThat(row.getKee()).isEqualTo("findbugs");
+    assertThat(row.getKey()).isEqualTo("findbugs");
     assertThat(row.getName()).isEqualTo("Findbugs");
     assertThat(row.getLanguage()).isEqualTo("java");
   }
@@ -61,7 +61,7 @@ public class RuleRepositoryDaoTest {
     RuleRepositoryDto dto3 = new RuleRepositoryDto("cobol-lint", "cobol", "Cobol Lint");
     underTest.insert(dbSession, asList(dto1, dto2, dto3));
 
-    assertThat(underTest.selectAll(dbSession)).extracting(RuleRepositoryDto::getKee)
+    assertThat(underTest.selectAll(dbSession)).extracting(RuleRepositoryDto::getKey)
       // ordered by key
       .containsExactly("cobol-lint", "findbugs", "squid");
   }
@@ -74,7 +74,7 @@ public class RuleRepositoryDaoTest {
     RuleRepositoryDto dto3 = new RuleRepositoryDto("cobol-lint", "cobol", "Cobol Lint");
     underTest.insert(dbSession, asList(dto1, dto2, dto3));
 
-    assertThat(underTest.selectByLanguage(dbSession, "java")).extracting(RuleRepositoryDto::getKee)
+    assertThat(underTest.selectByLanguage(dbSession, "java")).extracting(RuleRepositoryDto::getKey)
       // ordered by key
       .containsExactly("findbugs", "squid");
   }
@@ -94,7 +94,7 @@ public class RuleRepositoryDaoTest {
     RuleRepositoryDto dto1 = new RuleRepositoryDto("findbugs", "java", "Findbugs");
     underTest.insert(dbSession, asList(dto1));
 
-    assertThat(underTest.selectByKey(dbSession, "findbugs").get().getKee()).isEqualTo("findbugs");
+    assertThat(underTest.selectByKey(dbSession, "findbugs").get().getKey()).isEqualTo("findbugs");
     assertThat(underTest.selectByKey(dbSession, "missing")).isNotPresent();
   }