diff options
author | Fabrice Bellingard <bellingard@gmail.com> | 2011-04-27 14:25:18 +0200 |
---|---|---|
committer | Fabrice Bellingard <bellingard@gmail.com> | 2011-04-28 15:15:49 +0200 |
commit | 50a43f7b9dab293b61fabe742252dca659f2e4ca (patch) | |
tree | 69fb495c2a8a73f8cda78d0549cce1a98f543e3e /sonar-ws-client | |
parent | c22c2f412714a7d9ff8edee8a07d5589fc250f3b (diff) | |
download | sonarqube-50a43f7b9dab293b61fabe742252dca659f2e4ca.tar.gz sonarqube-50a43f7b9dab293b61fabe742252dca659f2e4ca.zip |
SONAR-2381 Improve the violations WS decorated with reviews
Diffstat (limited to 'sonar-ws-client')
4 files changed, 10 insertions, 10 deletions
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 4e170124c6b..d077ac97495 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 @@ -33,7 +33,7 @@ public class Violation extends Model { private String resourceScope = null; private String resourceQualifier = null; private Date createdAt = null; - private boolean falsePositive; + private boolean switchedOff; private Long reviewId = null; public String getMessage() { @@ -180,16 +180,16 @@ public class Violation extends Model { /** * @since 2.8 */ - public Violation setFalsePositive(Boolean b) { - this.falsePositive = (b != null && b); + public Violation setSwitchedOff(Boolean b) { + this.switchedOff = (b != null && b); return this; } /** * @since 2.8 */ - public boolean isFalsePositive() { - return falsePositive; + public boolean isSwitchedOff() { + return switchedOff; } public Long getReviewId() { 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 45f692b582c..a73d4b3c4fa 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 @@ -33,7 +33,7 @@ public class ViolationUnmarshaller extends AbstractUnmarshaller<Violation> { violation.setLine(utils.getInteger(json, "line")); violation.setSeverity(utils.getString(json, "priority")); violation.setCreatedAt(utils.getDateTime(json, "createdAt")); - violation.setFalsePositive(utils.getBoolean(json, "falsePositive")); + violation.setSwitchedOff(utils.getBoolean(json, "switchedOff")); violation.setReviewId(utils.getLong(json, "review")); Object rule = utils.getField(json, "rule"); 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 4652c2cd9d9..16e07efff38 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 @@ -53,7 +53,7 @@ public class ViolationUnmarshallerTest extends UnmarshallerTestCase { assertThat(violation.getResourceName(), is("TraceableResourceLimitingPool")); assertThat(violation.getResourceQualifier(), is("CLA")); assertThat(violation.getResourceScope(), is("FIL")); - assertThat(violation.isFalsePositive(), is(false)); + assertThat(violation.isSwitchedOff(), is(false)); assertThat(violation.getReviewId(), nullValue()); } @@ -67,9 +67,9 @@ public class ViolationUnmarshallerTest extends UnmarshallerTestCase { } @Test - public void testFalsePositive() { + public void testSwitchedOff() { Violation violation = new ViolationUnmarshaller().toModel(loadFile("/violations/false-positive.json")); - assertThat(violation.isFalsePositive(), is(true)); + assertThat(violation.isSwitchedOff(), is(true)); assertThat(violation.getReviewId(), is(123L)); } diff --git a/sonar-ws-client/src/test/resources/violations/false-positive.json b/sonar-ws-client/src/test/resources/violations/false-positive.json index d84cb1528d5..2165e9455c1 100644 --- a/sonar-ws-client/src/test/resources/violations/false-positive.json +++ b/sonar-ws-client/src/test/resources/violations/false-positive.json @@ -1,3 +1,3 @@ [ - {"message":"throw java.lang.Exception","falsePositive": true, "review": 123, "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"}} + {"message":"throw java.lang.Exception","switchedOff": true, "review": 123, "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"}} ]
\ No newline at end of file |