]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9664 Apply feedback
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Mon, 28 Aug 2017 13:47:30 +0000 (15:47 +0200)
committerJulien HENRY <julien.henry@sonarsource.com>
Thu, 7 Sep 2017 06:33:31 +0000 (08:33 +0200)
25 files changed:
server/sonar-db-core/src/main/resources/org/sonar/db/version/schema-h2.ddl
server/sonar-db-dao/src/main/java/org/sonar/db/plugin/PluginDao.java
server/sonar-db-dao/src/main/java/org/sonar/db/plugin/PluginDto.java
server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleDefinitionDto.java
server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleDto.java
server/sonar-db-dao/src/main/resources/org/sonar/db/plugin/PluginMapper.xml
server/sonar-db-dao/src/test/java/org/sonar/db/plugin/PluginDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/plugin/PluginTesting.java
server/sonar-db-dao/src/test/resources/org/sonar/db/plugin/PluginDaoTest/shared.xml
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/CreateTablePlugins.java
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/CreateTablePluginsTest.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/issue/IssueCreationDateCalculator.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/issue/Rule.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/issue/RuleImpl.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/qualityprofile/ActiveRule.java
server/sonar-server/src/main/java/org/sonar/server/plugins/ws/InstalledAction.java
server/sonar-server/src/main/java/org/sonar/server/plugins/ws/PluginWSCommons.java
server/sonar-server/src/main/java/org/sonar/server/startup/GeneratePluginIndex.java
server/sonar-server/src/main/java/org/sonar/server/startup/RegisterPlugins.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/issue/IssueCreationDateCalculatorTest.java
server/sonar-server/src/test/java/org/sonar/server/plugins/ws/InstalledActionTest.java
server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginWSCommonsTest.java
server/sonar-server/src/test/resources/org/sonar/server/startup/RegisterPluginsTest/insert_new_plugins-result.xml
server/sonar-server/src/test/resources/org/sonar/server/startup/RegisterPluginsTest/update_only_changed_plugins-result.xml
server/sonar-server/src/test/resources/org/sonar/server/startup/RegisterPluginsTest/update_only_changed_plugins.xml

index 2b1dc43cb0a3ea5bcbd7f61dda9560a30a6aad62..55bc327fb2aa51a77ed52228bc6c6e5500ff4d89 100644 (file)
@@ -685,7 +685,7 @@ CREATE TABLE "PLUGINS" (
   "UUID" VARCHAR(40) NOT NULL PRIMARY KEY,
   "KEE" VARCHAR(200) NOT NULL,
   "BASE_PLUGIN_KEY" VARCHAR(200),
-  "HASH" VARCHAR(200) NOT NULL,
+  "FILE_HASH" VARCHAR(200) NOT NULL,
   "CREATED_AT" BIGINT NOT NULL,
   "UPDATED_AT" BIGINT NOT NULL
 );
index 68705f81a33bffebfde7d7fcd20f70555c3eabfd..d7196d7670dac2312e5f522963ed896886d24f01 100644 (file)
@@ -42,10 +42,6 @@ public class PluginDao implements Dao {
     mapper(dbSession).update(dto);
   }
 
-  public void delete(DbSession dbSession, PluginDto dto) {
-    mapper(dbSession).delete(dto.getUuid());
-  }
-
   private static PluginMapper mapper(DbSession dbSession) {
     return dbSession.getMapper(PluginMapper.class);
   }
index 13c512ff328fb1e79d85bdb84969c69021700bb7..baeba50bc6800ca344d41ee8e643ed0b04d006c6 100644 (file)
@@ -30,7 +30,7 @@ public class PluginDto {
   /** Base plugin key, can be null */
   private String basePluginKey;
   /** JAR file MD5 checksum, can't be null */
-  private String hash;
+  private String fileHash;
   /** Time plugin was first installed */
   private long createdAt;
   /** Time of last plugin update (=md5 change) */
@@ -64,12 +64,12 @@ public class PluginDto {
     return this;
   }
 
-  public String getHash() {
-    return hash;
+  public String getFileHash() {
+    return fileHash;
   }
 
-  public PluginDto setHash(String s) {
-    this.hash = s;
+  public PluginDto setFileHash(String s) {
+    this.fileHash = s;
     return this;
   }
 
@@ -97,7 +97,7 @@ public class PluginDto {
       .append("uuid", uuid)
       .append("key", kee)
       .append("basePluginKey", basePluginKey)
-      .append("jarMd5", hash)
+      .append("fileHash", fileHash)
       .append("createdAt", createdAt)
       .append("updatedAt", updatedAt)
       .toString();
index 13c687305c1b64d5d7672582f02aa7f5a4ef357a..47f2b72bb9f68ea315f4d815ad16ef72030a1906 100644 (file)
@@ -295,11 +295,12 @@ public class RuleDefinitionDto {
     return this;
   }
 
+  @CheckForNull
   public String getPluginKey() {
     return pluginKey;
   }
 
-  public RuleDefinitionDto setPluginKey(String pluginKey) {
+  public RuleDefinitionDto setPluginKey(@Nullable String pluginKey) {
     this.pluginKey = pluginKey;
     return this;
   }
index e5861debe31d6c20a45c5eec5e38889b5bab109f..c1c6a11cd99ab641cc3457eb3a356592e1650a72 100644 (file)
@@ -89,11 +89,12 @@ public class RuleDto {
     return this;
   }
 
+  @CheckForNull
   public String getPluginKey() {
     return definition.getPluginKey();
   }
 
-  public RuleDto setPluginKey(String s) {
+  public RuleDto setPluginKey(@Nullable String s) {
     definition.setPluginKey(s);
     return this;
   }
index a6fdb0c199a694306ec124b7a9e7f970640d944a..0ff5f6cf543a550e02bfe5bfb25de906e7284547 100644 (file)
@@ -8,7 +8,7 @@
     uuid,
     kee,
     base_plugin_key as basePluginKey,
-    hash,
+    file_hash as fileHash,
     created_at as createdAt,
     updated_at as updatedAt
   </sql>
     uuid,
     kee,
     base_plugin_key,
-    hash,
+    file_hash,
     created_at,
     updated_at
     ) values (
     #{uuid,jdbcType=VARCHAR},
     #{kee,jdbcType=VARCHAR},
     #{basePluginKey,jdbcType=VARCHAR},
-    #{hash,jdbcType=VARCHAR},
+    #{fileHash,jdbcType=VARCHAR},
     #{createdAt,jdbcType=TIMESTAMP},
     #{updatedAt,jdbcType=TIMESTAMP}
     )
   <update id="update" parameterType="org.sonar.db.plugin.PluginDto">
     update plugins set
       base_plugin_key=#{basePluginKey,jdbcType=VARCHAR},
-      hash=#{hash,jdbcType=VARCHAR},
+      file_hash=#{fileHash,jdbcType=VARCHAR},
       updated_at=#{updatedAt,jdbcType=BIGINT}
     where
       uuid=#{uuid,jdbcType=VARCHAR}
   </update>
 
-  <delete id="delete" parameterType="String">
-    delete from plugins
-    where
-    uuid = #{uuid,jdbcType=VARCHAR}
-  </delete>
 </mapper>
index fda7a9581d1710c0cc0e65a05580b2a79bf0aee2..bb646d180f4771486205708c5af60e6859cf0fd6 100644 (file)
@@ -48,7 +48,7 @@ public class PluginDaoTest {
     assertThat(plugin.get().getUuid()).isEqualTo("a");
     assertThat(plugin.get().getKee()).isEqualTo("java");
     assertThat(plugin.get().getBasePluginKey()).isNull();
-    assertThat(plugin.get().getHash()).isEqualTo("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+    assertThat(plugin.get().getFileHash()).isEqualTo("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
     assertThat(plugin.get().getCreatedAt()).isEqualTo(1500000000000L);
     assertThat(plugin.get().getUpdatedAt()).isEqualTo(1600000000000L);
   }
@@ -68,7 +68,7 @@ public class PluginDaoTest {
       .setUuid("c")
       .setKee("javascript")
       .setBasePluginKey("java")
-      .setHash("cccccccccccccccccccccccccccccccc")
+      .setFileHash("cccccccccccccccccccccccccccccccc")
       .setCreatedAt(1L)
       .setUpdatedAt(2L));
 
@@ -77,7 +77,7 @@ public class PluginDaoTest {
     assertThat(plugin.get().getUuid()).isEqualTo("c");
     assertThat(plugin.get().getKee()).isEqualTo("javascript");
     assertThat(plugin.get().getBasePluginKey()).isEqualTo("java");
-    assertThat(plugin.get().getHash()).isEqualTo("cccccccccccccccccccccccccccccccc");
+    assertThat(plugin.get().getFileHash()).isEqualTo("cccccccccccccccccccccccccccccccc");
     assertThat(plugin.get().getCreatedAt()).isEqualTo(1L);
     assertThat(plugin.get().getUpdatedAt()).isEqualTo(2L);
   }
@@ -89,7 +89,7 @@ public class PluginDaoTest {
     PluginDto plugin = underTest.selectByKey(db.getSession(), "java").get();
 
     plugin.setBasePluginKey("foo");
-    plugin.setHash("abc");
+    plugin.setFileHash("abc");
     plugin.setUpdatedAt(3L);
 
     underTest.update(db.getSession(), plugin);
@@ -98,19 +98,8 @@ public class PluginDaoTest {
     assertThat(plugin.getUuid()).isEqualTo("a");
     assertThat(plugin.getKee()).isEqualTo("java");
     assertThat(plugin.getBasePluginKey()).isEqualTo("foo");
-    assertThat(plugin.getHash()).isEqualTo("abc");
+    assertThat(plugin.getFileHash()).isEqualTo("abc");
     assertThat(plugin.getCreatedAt()).isEqualTo(1500000000000L);
     assertThat(plugin.getUpdatedAt()).isEqualTo(3L);
   }
-
-  @Test
-  public void delete() {
-    db.prepareDbUnit(getClass(), "shared.xml");
-
-    underTest.delete(db.getSession(), new PluginDto()
-      .setUuid("a"));
-
-    assertThat(underTest.selectAll(db.getSession())).hasSize(1);
-  }
-
 }
index a8be45222584f4294e0ae2c73eb698884f0416be..d75e017ed4bbfefc2b6e70c2757a410a4d8ebe6d 100644 (file)
@@ -38,7 +38,7 @@ public class PluginTesting {
     return new PluginDto()
       .setUuid(uuid)
       .setKee(uuid)
-      .setHash(randomAlphanumeric(32))
+      .setFileHash(randomAlphanumeric(32))
       .setCreatedAt(nextLong())
       .setUpdatedAt(nextLong());
   }
index 016bddf0d08c72796c32c4f2aeaffe93907eeb53..a667eb84ae48aa41340c31e4e098a5d033f339e3 100644 (file)
@@ -3,7 +3,7 @@
   <plugins uuid="a"
          kee="java"
          base_plugin_key="[null]"
-         hash="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+         file_hash="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
          created_at="1500000000000"
          updated_at="1600000000000"
   />
@@ -11,7 +11,7 @@
   <plugins uuid="b"
          kee="javacustom"
          base_plugin_key="java"
-         hash="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
+         file_hash="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
          created_at="1500000000000"
          updated_at="1600000000000"
   />
index 9b28fa45fd72dc2b752a73ae0632e7d331e56fc9..4c36d3ddf71874ef8212014a4f6edc618ccbc51a 100644 (file)
@@ -56,7 +56,7 @@ public class CreateTablePlugins extends DdlChange {
           .setIsNullable(true)
           .build())
         .addColumn(newVarcharColumnDefBuilder()
-          .setColumnName("hash")
+          .setColumnName("file_hash")
           .setLimit(200)
           .setIsNullable(false)
           .build())
index 91f3f4b92f60ab9a919902669170d5b0ddb69539..f4b14a5f944b819898f1c3f2a97810783bc2e33b 100644 (file)
@@ -49,7 +49,7 @@ public class CreateTablePluginsTest {
     db.assertPrimaryKey(TABLE, "pk_plugins", "uuid");
     db.assertColumnDefinition(TABLE, "kee", Types.VARCHAR, 200, false);
     db.assertColumnDefinition(TABLE, "base_plugin_key", Types.VARCHAR, 200, true);
-    db.assertColumnDefinition(TABLE, "hash", Types.VARCHAR, 200, false);
+    db.assertColumnDefinition(TABLE, "file_hash", Types.VARCHAR, 200, false);
     db.assertColumnDefinition(TABLE, "created_at", Types.BIGINT, null, false);
     db.assertColumnDefinition(TABLE, "updated_at", Types.BIGINT, null, false);
 
index 873cd23b3af329dcb47f812695650e46f405f924..1ed3b618c8a50f197d9f78408e5ea4d91ecef8e2 100644 (file)
@@ -91,6 +91,10 @@ public class IssueCreationDateCalculator extends IssueVisitor {
 
   private boolean ruleImplementationChanged(ActiveRule activeRule, long lastAnalysisDate) {
     String pluginKey = activeRule.getPluginKey();
+    if (pluginKey == null) {
+      return false;
+    }
+    
     ScannerPlugin scannerPlugin = Optional.ofNullable(analysisMetadataHolder.getScannerPluginsByKey().get(pluginKey))
       .orElseThrow(illegalStateException("The rule %s is declared to come from plugin %s, but this plugin was not used by scanner.", activeRule.getRuleKey(), pluginKey));
     return pluginIsNew(scannerPlugin, lastAnalysisDate)
index 3c6cb7b4207d74b63cdff7f54e7451ece9bea72b..e8f131848f20f0eb60d2b08d8a0c1720c8aea907 100644 (file)
@@ -46,5 +46,6 @@ public interface Rule {
   @CheckForNull
   DebtRemediationFunction getRemediationFunction();
 
+  @CheckForNull
   String getPluginKey();
 }
index 56aab9d104d472aa7922a8dd31d1e1f89418e517..3104138ba31fec363c874536995abe77912f2bb2 100644 (file)
@@ -91,6 +91,7 @@ public class RuleImpl implements Rule {
     return type;
   }
 
+  @CheckForNull
   @Override
   public String getPluginKey() {
     return pluginKey;
index 68465731a9c9f752876ce83038b85ba490851d5f..b04d54afdcb84174a789d9c2c3a6ccc990443ced 100644 (file)
@@ -21,6 +21,8 @@ package org.sonar.server.computation.task.projectanalysis.qualityprofile;
 
 import com.google.common.collect.ImmutableMap;
 import java.util.Map;
+import javax.annotation.CheckForNull;
+import javax.annotation.Nullable;
 import javax.annotation.concurrent.Immutable;
 import org.sonar.api.rule.RuleKey;
 
@@ -32,7 +34,7 @@ public class ActiveRule {
   private final long createdAt;
   private final String pluginKey;
 
-  public ActiveRule(RuleKey ruleKey, String severity, Map<String, String> params, long createdAt, String pluginKey) {
+  public ActiveRule(RuleKey ruleKey, String severity, Map<String, String> params, long createdAt, @Nullable String pluginKey) {
     this.ruleKey = ruleKey;
     this.severity = severity;
     this.pluginKey = pluginKey;
@@ -56,6 +58,7 @@ public class ActiveRule {
     return createdAt;
   }
 
+  @CheckForNull
   public String getPluginKey() {
     return pluginKey;
   }
index 0d5595ecd67db9a935cc0468407552c68a49c063..04050fd6534c589bd43edf4208206802ed671542 100644 (file)
@@ -72,7 +72,7 @@ public class InstalledAction implements PluginsWsAction {
       .setSince("5.2")
       .setChangelog(
         new Change("6.6", "The 'filename' field is added"),
-        new Change("6.6", "The 'hash' field is added"),
+        new Change("6.6", "The 'fileHash' field is added"),
         new Change("6.6", "The 'sonarLintSupported' field is added"),
         new Change("6.6", "The 'updatedAt' field is added"))
       .setHandler(this)
index 44716a3ab7dea30878c096121083d3e154d4647f..44c362d6c45736c37313f1fb8fdfd4bf2f055517 100644 (file)
@@ -95,7 +95,7 @@ public class PluginWSCommons {
     if (pluginDto != null) {
       json.prop(PROPERTY_FILENAME, pluginInfo.getNonNullJarFile().getName());
       json.prop(PROPERTY_SONARLINT_SUPPORTED, pluginInfo.isSonarLintSupported());
-      json.prop(PROPERTY_HASH, pluginDto.getHash());
+      json.prop(PROPERTY_HASH, pluginDto.getFileHash());
       json.prop(PROPERTY_UPDATED_AT, pluginDto.getUpdatedAt());
     }
     json.prop(PROPERTY_DESCRIPTION, pluginInfo.getDescription());
index 15527cc90c4b0c0274d067ca9e84afdb59633348..30eaad5065600c282028fc9ff53ea8541412c88a 100644 (file)
@@ -27,7 +27,7 @@ import java.io.Writer;
 import java.nio.charset.StandardCharsets;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.CharUtils;
-import org.picocontainer.Startable;
+import org.sonar.api.Startable;
 import org.sonar.api.server.ServerSide;
 import org.sonar.api.utils.log.Logger;
 import org.sonar.api.utils.log.Loggers;
index 58eb25bde364009b8ee073d72172257bb5994b96..248bf994af37f87ec4ddd99c0e9f1aec49451841 100644 (file)
@@ -22,7 +22,7 @@ package org.sonar.server.startup;
 import java.util.Collection;
 import java.util.Map;
 import java.util.stream.Collectors;
-import org.picocontainer.Startable;
+import org.sonar.api.Startable;
 import org.sonar.api.utils.System2;
 import org.sonar.api.utils.log.Logger;
 import org.sonar.api.utils.log.Loggers;
@@ -83,15 +83,15 @@ public class RegisterPlugins implements Startable {
             .setUuid(uuidFactory.create())
             .setKee(pluginInfo.getKey())
             .setBasePluginKey(pluginInfo.getBasePlugin())
-            .setHash(newJarMd5)
+            .setFileHash(newJarMd5)
             .setCreatedAt(now)
             .setUpdatedAt(now);
           dbClient.pluginDao().insert(dbSession, pluginDto);
-        } else if (!previousDto.getHash().equals(newJarMd5)) {
+        } else if (!previousDto.getFileHash().equals(newJarMd5)) {
           LOG.debug("Update plugin {}", pluginInfo.getKey());
           previousDto
             .setBasePluginKey(pluginInfo.getBasePlugin())
-            .setHash(newJarMd5)
+            .setFileHash(newJarMd5)
             .setUpdatedAt(now);
           dbClient.pluginDao().update(dbSession, previousDto);
         }
index f0e84c58a061b2fa803962324afc070877886195..8f3cf22439e82af33a12233010e468418c735402 100644 (file)
@@ -24,6 +24,7 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
 import org.sonar.api.rule.RuleKey;
 import org.sonar.core.issue.DefaultIssue;
@@ -33,7 +34,7 @@ import org.sonar.db.protobuf.DbIssues.Flow;
 import org.sonar.db.protobuf.DbIssues.Location;
 import org.sonar.db.protobuf.DbIssues.Locations.Builder;
 import org.sonar.server.computation.task.projectanalysis.analysis.Analysis;
-import org.sonar.server.computation.task.projectanalysis.analysis.AnalysisMetadataHolder;
+import org.sonar.server.computation.task.projectanalysis.analysis.AnalysisMetadataHolderRule;
 import org.sonar.server.computation.task.projectanalysis.analysis.ScannerPlugin;
 import org.sonar.server.computation.task.projectanalysis.component.Component;
 import org.sonar.server.computation.task.projectanalysis.qualityprofile.ActiveRule;
@@ -53,8 +54,9 @@ import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 public class IssueCreationDateCalculatorTest {
+  @Rule
+  public AnalysisMetadataHolderRule analysisMetadataHolder = new AnalysisMetadataHolderRule();
 
-  private AnalysisMetadataHolder analysisMetadataHolder;
   private ScmInfoRepository scmInfoRepository;
   private IssueFieldsSetter issueUpdater;
   private ActiveRulesHolder activeRulesHolder;
@@ -69,9 +71,9 @@ public class IssueCreationDateCalculatorTest {
 
   @Before
   public void before() {
-    analysisMetadataHolder = mock(AnalysisMetadataHolder.class);
     scannerPlugins = new HashMap<>();
-    when(analysisMetadataHolder.getScannerPluginsByKey()).thenReturn(scannerPlugins);
+    analysisMetadataHolder.setScannerPluginsByKey(scannerPlugins);
+    analysisMetadataHolder.setAnalysisDate(new Date());
     scmInfoRepository = mock(ScmInfoRepository.class);
     issueUpdater = mock(IssueFieldsSetter.class);
     activeRulesHolder = mock(ActiveRulesHolder.class);
@@ -181,6 +183,7 @@ public class IssueCreationDateCalculatorTest {
 
   @Test
   public void should_change_date_if_scm_is_available_and_first_analysis() {
+    analysisMetadataHolder.setBaseAnalysis(null);
     currentAnalysisIs(3000L);
 
     newIssue();
@@ -226,6 +229,7 @@ public class IssueCreationDateCalculatorTest {
 
   @Test
   public void should_use_primary_location_when_backdating() {
+    analysisMetadataHolder.setBaseAnalysis(null);
     currentAnalysisIs(3000L);
 
     newIssue();
@@ -240,6 +244,7 @@ public class IssueCreationDateCalculatorTest {
 
   @Test
   public void should_use_flows_location_when_backdating() {
+    analysisMetadataHolder.setBaseAnalysis(null);
     currentAnalysisIs(3000L);
 
     newIssue();
@@ -271,8 +276,7 @@ public class IssueCreationDateCalculatorTest {
   }
 
   private void previousAnalysisWas(long analysisDate) {
-    when(analysisMetadataHolder.getBaseAnalysis())
-      .thenReturn(baseAnalysis);
+    analysisMetadataHolder.setBaseAnalysis(baseAnalysis);
     when(baseAnalysis.getCreatedAt())
       .thenReturn(analysisDate);
   }
@@ -286,7 +290,7 @@ public class IssueCreationDateCalculatorTest {
   }
 
   private void currentAnalysisIs(long analysisDate) {
-    when(analysisMetadataHolder.getAnalysisDate()).thenReturn(analysisDate);
+    analysisMetadataHolder.setAnalysisDate(analysisDate);
   }
 
   private void newIssue() {
index f7e0f39296aaa59f833217f2186571da27f3816f..9e113765a43f747accba5b6f763089503b6dab02 100644 (file)
@@ -104,7 +104,7 @@ public class InstalledActionTest {
       of(new PluginInfo("").setName("").setJarFile(new File(""))));
     db.pluginDbTester().insertPlugin(
       p -> p.setKee(""),
-      p -> p.setHash("abcdA"),
+      p -> p.setFileHash("abcdA"),
       p -> p.setUpdatedAt(111111L));
 
     underTest.handle(request, response);
@@ -130,7 +130,7 @@ public class InstalledActionTest {
         .setJarFile(new File(getClass().getResource(jarFilename).toURI()))));
     db.pluginDbTester().insertPlugin(
       p -> p.setKee("plugKey"),
-      p -> p.setHash("abcdplugKey"),
+      p -> p.setFileHash("abcdplugKey"),
       p -> p.setUpdatedAt(111111L));
 
     underTest.handle(request, response);
@@ -184,7 +184,7 @@ public class InstalledActionTest {
 
     db.pluginDbTester().insertPlugin(
       p -> p.setKee("plugKey"),
-      p -> p.setHash("abcdplugKey"),
+      p -> p.setFileHash("abcdplugKey"),
       p -> p.setUpdatedAt(111111L));
 
     when(request.paramAsStrings(Param.FIELDS)).thenReturn(singletonList("category"));
@@ -223,19 +223,19 @@ public class InstalledActionTest {
 
     db.pluginDbTester().insertPlugin(
       p -> p.setKee("A"),
-      p -> p.setHash("abcdA"),
+      p -> p.setFileHash("abcdA"),
       p -> p.setUpdatedAt(111111L));
     db.pluginDbTester().insertPlugin(
       p -> p.setKee("B"),
-      p -> p.setHash("abcdB"),
+      p -> p.setFileHash("abcdB"),
       p -> p.setUpdatedAt(222222L));
     db.pluginDbTester().insertPlugin(
       p -> p.setKee("C"),
-      p -> p.setHash("abcdC"),
+      p -> p.setFileHash("abcdC"),
       p -> p.setUpdatedAt(333333L));
     db.pluginDbTester().insertPlugin(
       p -> p.setKee("D"),
-      p -> p.setHash("abcdD"),
+      p -> p.setFileHash("abcdD"),
       p -> p.setUpdatedAt(444444L));
 
     underTest.handle(request, response);
@@ -261,7 +261,7 @@ public class InstalledActionTest {
 
     db.pluginDbTester().insertPlugin(
       p -> p.setKee("A"),
-      p -> p.setHash("abcdA"),
+      p -> p.setFileHash("abcdA"),
       p -> p.setUpdatedAt(111111L));
 
     underTest.handle(request, response);
index e98d2b3f8d7177cb989892e471539ff46768d5a4..f3ddea9942b15854afd9678a01b3e747df3eda1e 100644 (file)
@@ -65,7 +65,7 @@ public class PluginWSCommonsTest {
 
   @Test
   public void verify_properties_written_by_writePluginMetadata_with_dto() {
-    underTest.writePluginInfo(jsonWriter, gitPluginInfo(), null, new PluginDto().setHash("abcdef123456").setUpdatedAt(123456L));
+    underTest.writePluginInfo(jsonWriter, gitPluginInfo(), null, new PluginDto().setFileHash("abcdef123456").setUpdatedAt(123456L));
 
     jsonWriter.close();
     assertJson(response.outputAsString()).withStrictArrayOrder().isSimilarTo("{" +
index 37b152ccac342a93335b78d20e83b41bd8ed54e5..61b7da84dd92e788be2d03eb4dd911361dcda1cf 100644 (file)
@@ -1,6 +1,6 @@
 <dataset>
 
-  <plugins uuid="a" kee="java" base_plugin_key="[null]" hash="bd451e47a1aa76e73da0359cef63dd63" created_at="12345" updated_at="12345"/>
-  <plugins uuid="b" kee="javacustom" base_plugin_key="java" hash="de9b2de3ddc0680904939686c0dba5be" created_at="12345" updated_at="12345"/>
+  <plugins uuid="a" kee="java" base_plugin_key="[null]" file_hash="bd451e47a1aa76e73da0359cef63dd63" created_at="12345" updated_at="12345"/>
+  <plugins uuid="b" kee="javacustom" base_plugin_key="java" file_hash="de9b2de3ddc0680904939686c0dba5be" created_at="12345" updated_at="12345"/>
 
 </dataset>
index 037fb9aec93ffb6e334fa84524e119c376b3a4f4..13e66930f3ea10be08821d9fff9a38b1dbabca26 100644 (file)
@@ -1,6 +1,6 @@
 <dataset>
 
-  <plugins uuid="a" kee="java" base_plugin_key="[null]" hash="bd451e47a1aa76e73da0359cef63dd63" created_at="1" updated_at="1"/>
-  <plugins uuid="b" kee="javacustom" base_plugin_key="java2" hash="d22091cff5155e892cfe2f9dab51f811" created_at="1" updated_at="12345"/>
+  <plugins uuid="a" kee="java" base_plugin_key="[null]" file_hash="bd451e47a1aa76e73da0359cef63dd63" created_at="1" updated_at="1"/>
+  <plugins uuid="b" kee="javacustom" base_plugin_key="java2" file_hash="d22091cff5155e892cfe2f9dab51f811" created_at="1" updated_at="12345"/>
 
 </dataset>
index b217fb7fa6d27a8528fc2f76facb2d2c3b60de81..09657bd51a09fe194ceabe97f146262a97097974 100644 (file)
@@ -1,6 +1,6 @@
 <dataset>
 
-  <plugins uuid="a" kee="java" base_plugin_key="[null]" hash="bd451e47a1aa76e73da0359cef63dd63" created_at="1" updated_at="1"/>
-  <plugins uuid="b" kee="javacustom" base_plugin_key="java" hash="de9b2de3ddc0680904939686c0dba5be" created_at="1" updated_at="1"/>
+  <plugins uuid="a" kee="java" base_plugin_key="[null]" file_hash="bd451e47a1aa76e73da0359cef63dd63" created_at="1" updated_at="1"/>
+  <plugins uuid="b" kee="javacustom" base_plugin_key="java" file_hash="de9b2de3ddc0680904939686c0dba5be" created_at="1" updated_at="1"/>
 
 </dataset>