aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorDavid Gageot <david@gageot.net>2012-07-16 18:36:41 +0200
committerDavid Gageot <david@gageot.net>2012-07-16 18:36:41 +0200
commit0beb403f5df390aeb04291f30ae05388131235df (patch)
tree29890349ed460c729089f770578448859dd7bff0 /sonar-core
parent0b9545a8b74aca473cb776275be4dc93a327c363 (diff)
downloadsonarqube-0beb403f5df390aeb04291f30ae05388131235df.tar.gz
sonarqube-0beb403f5df390aeb04291f30ae05388131235df.zip
SONAR-3664 Log sonar/plugins versions and sha1 at startup
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/plugins/DefaultPluginMetadata.java10
-rw-r--r--sonar-core/src/main/java/org/sonar/core/plugins/PluginInstaller.java1
-rw-r--r--sonar-core/src/test/java/org/sonar/core/plugins/DefaultPluginMetadataTest.java4
-rw-r--r--sonar-core/src/test/java/org/sonar/core/plugins/PluginInstallerTest.java11
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/plugins/sonar-cobertura-plugin-3.1.1.jarbin0 -> 14560 bytes
5 files changed, 20 insertions, 6 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/plugins/DefaultPluginMetadata.java b/sonar-core/src/main/java/org/sonar/core/plugins/DefaultPluginMetadata.java
index fb9498bc0f8..6b96809a76b 100644
--- a/sonar-core/src/main/java/org/sonar/core/plugins/DefaultPluginMetadata.java
+++ b/sonar-core/src/main/java/org/sonar/core/plugins/DefaultPluginMetadata.java
@@ -47,6 +47,7 @@ public class DefaultPluginMetadata implements PluginMetadata, Comparable<PluginM
private boolean useChildFirstClassLoader;
private String basePlugin;
private boolean core;
+ private String implementationBuild;
private DefaultPluginMetadata() {
}
@@ -239,6 +240,15 @@ public class DefaultPluginMetadata implements PluginMetadata, Comparable<PluginM
return this;
}
+ public String getImplementationBuild() {
+ return implementationBuild;
+ }
+
+ public DefaultPluginMetadata setImplementationBuild(String implementationBuild) {
+ this.implementationBuild = implementationBuild;
+ return this;
+ }
+
public boolean isOldManifest() {
return !hasKey() && hasMainClass();
}
diff --git a/sonar-core/src/main/java/org/sonar/core/plugins/PluginInstaller.java b/sonar-core/src/main/java/org/sonar/core/plugins/PluginInstaller.java
index d0289f4a82f..085765a92d2 100644
--- a/sonar-core/src/main/java/org/sonar/core/plugins/PluginInstaller.java
+++ b/sonar-core/src/main/java/org/sonar/core/plugins/PluginInstaller.java
@@ -121,6 +121,7 @@ public class PluginInstaller {
metadata.setPathsToInternalDeps(manifest.getDependencies());
metadata.setUseChildFirstClassLoader(manifest.isUseChildFirstClassLoader());
metadata.setBasePlugin(manifest.getBasePlugin());
+ metadata.setImplementationBuild(manifest.getImplementationBuild());
metadata.setCore(isCore);
if (metadata.isOldManifest()) {
completeDeprecatedMetadata(metadata);
diff --git a/sonar-core/src/test/java/org/sonar/core/plugins/DefaultPluginMetadataTest.java b/sonar-core/src/test/java/org/sonar/core/plugins/DefaultPluginMetadataTest.java
index 5ac3f1dcc0a..7d8a770e85e 100644
--- a/sonar-core/src/test/java/org/sonar/core/plugins/DefaultPluginMetadataTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/plugins/DefaultPluginMetadataTest.java
@@ -44,7 +44,8 @@ public class DefaultPluginMetadataTest {
.setVersion("1.1")
.setSonarVersion("3.0")
.setUseChildFirstClassLoader(true)
- .setCore(false);
+ .setCore(false)
+ .setImplementationBuild("abcdef");
assertThat(metadata.getKey()).isEqualTo("checkstyle");
assertThat(metadata.getLicense()).isEqualTo("LGPL");
@@ -60,6 +61,7 @@ public class DefaultPluginMetadataTest {
assertThat(metadata.getBasePlugin()).isNull();
assertThat(metadata.getFile()).isNotNull();
assertThat(metadata.getDeployedFiles()).isEmpty();
+ assertThat(metadata.getImplementationBuild()).isEqualTo("abcdef");
}
@Test
diff --git a/sonar-core/src/test/java/org/sonar/core/plugins/PluginInstallerTest.java b/sonar-core/src/test/java/org/sonar/core/plugins/PluginInstallerTest.java
index e9a893c48be..36d32419e3e 100644
--- a/sonar-core/src/test/java/org/sonar/core/plugins/PluginInstallerTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/plugins/PluginInstallerTest.java
@@ -38,14 +38,15 @@ public class PluginInstallerTest {
@Test
public void shouldExtractMetadata() {
- DefaultPluginMetadata metadata = extractor.extractMetadata(getFile("sonar-checkstyle-plugin-2.8.jar"), true);
+ DefaultPluginMetadata metadata = extractor.extractMetadata(getFile("sonar-cobertura-plugin-3.1.1.jar"), true);
- assertThat(metadata.getKey()).isEqualTo("checkstyle");
+ assertThat(metadata.getKey()).isEqualTo("cobertura");
assertThat(metadata.getBasePlugin()).isNull();
- assertThat(metadata.getName()).isEqualTo("Checkstyle");
+ assertThat(metadata.getName()).isEqualTo("Cobertura");
assertThat(metadata.isCore()).isEqualTo(true);
- assertThat(metadata.getFile().getName()).isEqualTo("sonar-checkstyle-plugin-2.8.jar");
- assertThat(metadata.getVersion()).isEqualTo("2.8");
+ assertThat(metadata.getFile().getName()).isEqualTo("sonar-cobertura-plugin-3.1.1.jar");
+ assertThat(metadata.getVersion()).isEqualTo("3.1.1");
+ assertThat(metadata.getImplementationBuild()).isEqualTo("b9283404030db9ce1529b1fadfb98331686b116d");
}
@Test
diff --git a/sonar-core/src/test/resources/org/sonar/core/plugins/sonar-cobertura-plugin-3.1.1.jar b/sonar-core/src/test/resources/org/sonar/core/plugins/sonar-cobertura-plugin-3.1.1.jar
new file mode 100644
index 00000000000..6a74b55d02c
--- /dev/null
+++ b/sonar-core/src/test/resources/org/sonar/core/plugins/sonar-cobertura-plugin-3.1.1.jar
Binary files differ