aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2015-08-28 11:04:46 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2015-08-31 09:52:02 +0200
commit824a30f8c36e35b3b9ca396619e3204f7568115b (patch)
treea3cb6573193333329498463ab74ebfb8878f8e90 /server
parent48835a873353be8fdd48ca57313f6a74ddaf15f7 (diff)
downloadsonarqube-824a30f8c36e35b3b9ca396619e3204f7568115b.tar.gz
sonarqube-824a30f8c36e35b3b9ca396619e3204f7568115b.zip
SONAR-6730 Add component key in the API
It will allow to have more information in error generated by plugin or in debug logs.
Diffstat (limited to 'server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/measure/api/ComponentImpl.java5
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/measure/api/ComponentImplTest.java1
2 files changed, 6 insertions, 0 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/measure/api/ComponentImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/measure/api/ComponentImpl.java
index 5578afdbcee..d5c9f582b02 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/measure/api/ComponentImpl.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/measure/api/ComponentImpl.java
@@ -60,6 +60,11 @@ public class ComponentImpl implements Component {
}
@Override
+ public String getKey() {
+ return key;
+ }
+
+ @Override
public FileAttributes getFileAttributes() {
checkState(this.type == Component.Type.FILE, "Only component of type FILE have a FileAttributes object");
return fileAttributes;
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/measure/api/ComponentImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/measure/api/ComponentImplTest.java
index 6c133a2b1f6..d9b383f5f7a 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/measure/api/ComponentImplTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/measure/api/ComponentImplTest.java
@@ -36,6 +36,7 @@ public class ComponentImplTest {
public void create_project() throws Exception {
ComponentImpl component = new ComponentImpl("Project", Component.Type.PROJECT, null);
+ assertThat(component.getKey()).isEqualTo("Project");
assertThat(component.getType()).isEqualTo(Component.Type.PROJECT);
}