From a4c82a13a22292a0e96286937f31bd2866ed9e57 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Sat, 25 May 2013 15:02:18 +0200 Subject: [PATCH] SONAR-4353 drop the node 'id' from result --- .../WEB-INF/app/controllers/api/violations_controller.rb | 2 +- .../main/java/org/sonar/wsclient/services/Violation.java | 9 --------- .../wsclient/unmarshallers/ViolationUnmarshaller.java | 1 - .../unmarshallers/ViolationUnmarshallerTest.java | 1 - .../src/test/resources/violations/violations.json | 4 ++-- 5 files changed, 3 insertions(+), 14 deletions(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/violations_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/violations_controller.rb index aeadcfd963e..a0e35c8fe9c 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/violations_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/violations_controller.rb @@ -62,7 +62,7 @@ class Api::ViolationsController < Api::ApiController results = Api.issues.find(conditions) array = results.issues.map do |issue| - hash={:id => issue.key} + hash={} hash[:message] = issue.message if issue.message hash[:line] = issue.line.to_i if issue.line hash[:priority] = issue.severity if issue.severity diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Violation.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Violation.java index 485db0910a1..fbd41ac18b7 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Violation.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Violation.java @@ -27,7 +27,6 @@ import java.util.Date; @Deprecated public class Violation extends Model { - private String id = null; private String message = null; private String severity = null; private Integer line = null; @@ -186,12 +185,4 @@ public class Violation extends Model { return switchedOff; } - public String getKey() { - return id; - } - - public Violation setKey(String id) { - this.id = id; - return this; - } } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ViolationUnmarshaller.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ViolationUnmarshaller.java index 25e5b5b585c..ea25de8c3d1 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ViolationUnmarshaller.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ViolationUnmarshaller.java @@ -29,7 +29,6 @@ public class ViolationUnmarshaller extends AbstractUnmarshaller { WSUtils utils = WSUtils.getINSTANCE(); Violation violation = new Violation(); - violation.setKey(utils.getString(json, "id")); violation.setMessage(utils.getString(json, "message")); violation.setLine(utils.getInteger(json, "line")); violation.setSeverity(utils.getString(json, "priority")); diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ViolationUnmarshallerTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ViolationUnmarshallerTest.java index 1eccd7e3158..75485ae5444 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ViolationUnmarshallerTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ViolationUnmarshallerTest.java @@ -47,7 +47,6 @@ public class ViolationUnmarshallerTest extends UnmarshallerTestCase { assertThat(violations.size(), is(2)); violation = violations.get(0); - assertThat(violation.getKey(), is("1")); assertThat(violation.getMessage(), is("throw java.lang.Exception")); assertThat(violation.hasLine(), is(true)); assertThat(violation.getLine(), is(97)); diff --git a/sonar-ws-client/src/test/resources/violations/violations.json b/sonar-ws-client/src/test/resources/violations/violations.json index 66353635fab..06c97eef38c 100644 --- a/sonar-ws-client/src/test/resources/violations/violations.json +++ b/sonar-ws-client/src/test/resources/violations/violations.json @@ -1,4 +1,4 @@ [ - {"id":1,"message":"throw java.lang.Exception","line":97,"createdAt":"2010-12-01T13:55:22+0300","priority":"MAJOR","rule":{"key":"pmd:SignatureDeclareThrowsException","name":"Signature Declare Throws Exception","category":"Maintainability"},"resource":{"key":"org.apache.excalibur.components:excalibur-pool-instrumented:org.apache.avalon.excalibur.pool.TraceableResourceLimitingPool","name":"TraceableResourceLimitingPool","scope":"FIL","qualifier":"CLA","language":"java"}}, - {"id":2,"message":"The user-supplied array 'threads' is stored directly.","line":242,"createdAt":"2010-12-01T13:55:22+0300","priority":"MAJOR","rule":{"key":"pmd:ArrayIsStoredDirectly","name":"Security - Array is stored directly","category":"Reliability"},"resource":{"key":"org.apache.excalibur.components:excalibur-pool-instrumented:org.apache.avalon.excalibur.pool.TraceableResourceLimitingPool","name":"TraceableResourceLimitingPool","scope":"FIL","qualifier":"CLA","language":"java"}} + {"message":"throw java.lang.Exception","line":97,"createdAt":"2010-12-01T13:55:22+0300","priority":"MAJOR","rule":{"key":"pmd:SignatureDeclareThrowsException","name":"Signature Declare Throws Exception","category":"Maintainability"},"resource":{"key":"org.apache.excalibur.components:excalibur-pool-instrumented:org.apache.avalon.excalibur.pool.TraceableResourceLimitingPool","name":"TraceableResourceLimitingPool","qualifier":"CLA"}}, + {"message":"The user-supplied array 'threads' is stored directly.","line":242,"createdAt":"2010-12-01T13:55:22+0300","priority":"MAJOR","rule":{"key":"pmd:ArrayIsStoredDirectly","name":"Security - Array is stored directly","category":"Reliability"},"resource":{"key":"org.apache.excalibur.components:excalibur-pool-instrumented:org.apache.avalon.excalibur.pool.TraceableResourceLimitingPool","name":"TraceableResourceLimitingPool","qualifier":"CLA"}} ] \ No newline at end of file -- 2.39.5