diff options
Diffstat (limited to 'sonar-ws-client/src/test/resources')
17 files changed, 200 insertions, 0 deletions
diff --git a/sonar-ws-client/src/test/resources/dependencies/many.json b/sonar-ws-client/src/test/resources/dependencies/many.json new file mode 100644 index 00000000000..75e1d00e365 --- /dev/null +++ b/sonar-ws-client/src/test/resources/dependencies/many.json @@ -0,0 +1,137 @@ +[ + { + "id":"1649", + "fi": 33, + "ti": 45, + "fk":"org.apache.shiro:shiro-core:org.apache.shiro.authc.pam", + "tk":"org.apache.shiro:shiro-core:org.apache.shiro.realm", + "u":"USES", + "w":5 + }, + { + "id":"1686", + "fi": 333, + "ti": 453, + "fk":"org.apache.shiro:shiro-core:org.apache.shiro.realm", + "tk":"org.apache.shiro:shiro-core:org.apache.shiro.authz.permission", + "u":"USES", + "w":3 + }, + { + "id":"1690", + "fi": 334, + "ti": 454, + "fk":"org.apache.shiro:shiro-core:org.apache.shiro.realm", + "tk":"org.apache.shiro:shiro-core:org.apache.shiro.util", + "u":"USES", + "w":2 + }, + { + "id":"1693", + "fi": 335, + "ti": 455, + "fk":"org.apache.shiro:shiro-core:org.apache.shiro.realm", + "tk":"org.apache.shiro:shiro-core:org.apache.shiro.authc.credential", + "u":"USES", + "w":3 + }, + { + "id":"1697", + "fi": 336, + "ti": 456, + "fk":"org.apache.shiro:shiro-core:org.apache.shiro.realm", + "tk":"org.apache.shiro:shiro-core:org.apache.shiro.authc", + "u":"USES", + "w":16 + }, + { + "id":"1714", + "fi": 337, + "ti": 457, + "fk":"org.apache.shiro:shiro-core:org.apache.shiro.realm", + "tk":"org.apache.shiro:shiro-core:org.apache.shiro.cache", + "u":"USES", + "w":6 + }, + { + "id":"1721", + "fi": 3338, + "ti": 4258, + "fk":"org.apache.shiro:shiro-core:org.apache.shiro.realm", + "tk":"org.apache.shiro:shiro-core:org.apache.shiro.authz", + "u":"USES", + "w":9 + }, + { + "id":"1731", + "fi": 343, + "ti": 4445, + "fk":"org.apache.shiro:shiro-core:org.apache.shiro.realm", + "tk":"org.apache.shiro:shiro-core:org.apache.shiro.subject", + "u":"USES", + "w":3 + }, + { + "id":"1735", + "fi": 3443, + "ti": 455, + "fk":"org.apache.shiro:shiro-core:org.apache.shiro.realm.ldap", + "tk":"org.apache.shiro:shiro-core:org.apache.shiro.realm", + "u":"USES", + "w":1 + }, + { + "id":"1775", + "fi": 373, + "ti": 6645, + "fk":"org.apache.shiro:shiro-core:org.apache.shiro.mgt", + "tk":"org.apache.shiro:shiro-core:org.apache.shiro.realm", + "u":"USES", + "w":2 + }, + { + "id":"1886", + "fi": 339, + "ti": 495, + "fk":"org.apache.shiro:shiro-core:org.apache.shiro.realm.jdbc", + "tk":"org.apache.shiro:shiro-core:org.apache.shiro.realm", + "u":"USES", + "w":1 + }, + { + "id":"1962", + "fi": 373, + "ti": 485, + "fk":"org.apache.shiro:shiro-core:org.apache.shiro.config", + "tk":"org.apache.shiro:shiro-core:org.apache.shiro.realm", + "u":"USES", + "w":4 + }, + { + "id":"1995", + "fi": 363, + "ti": 445, + "fk":"org.apache.shiro:shiro-core:org.apache.shiro.realm.jndi", + "tk":"org.apache.shiro:shiro-core:org.apache.shiro.realm", + "u":"USES", + "w":2 + }, + { + "id":"2098", + "fi": 333, + "ti": 415, + "fk":"org.apache.shiro:shiro-core:org.apache.shiro.realm.text", + "tk":"org.apache.shiro:shiro-core:org.apache.shiro.realm", + "u":"USES", + "w":1 + }, + { + "id":"2119", + "fi": 332, + "ti": 451, + "fk":"org.apache.shiro:shiro-core:org.apache.shiro.authz", + "tk":"org.apache.shiro:shiro-core:org.apache.shiro.realm", + "u":"USES", + "w":1 + } +]
\ No newline at end of file diff --git a/sonar-ws-client/src/test/resources/dependencies/single.json b/sonar-ws-client/src/test/resources/dependencies/single.json new file mode 100644 index 00000000000..3afb73ceeab --- /dev/null +++ b/sonar-ws-client/src/test/resources/dependencies/single.json @@ -0,0 +1,15 @@ +[ + { + "id":"1649", + "fi": 33, + "ti": 45, + "fk":"org.apache.shiro:shiro-core:org.apache.shiro.authc.pam", + "tk":"org.apache.shiro:shiro-core:org.apache.shiro.realm", + "u":"USES", + "w":5, + "fn": "pam", + "fq": "PAC", + "tn": "realm", + "tq": "PAC" + } +]
\ No newline at end of file diff --git a/sonar-ws-client/src/test/resources/dependency_tree/many_depths.json b/sonar-ws-client/src/test/resources/dependency_tree/many_depths.json new file mode 100644 index 00000000000..9a9ccb6a2c4 --- /dev/null +++ b/sonar-ws-client/src/test/resources/dependency_tree/many_depths.json @@ -0,0 +1 @@ +[{"did":"12345","rid":"2000","n":"Logback","s":"LIB","q":"LIB","w":1,"u":"compile","v":"1.4","to":[{"did":"12346","rid":"2001","n":"SLF4J","s":"LIB","q":"LIB","w":1,"u":"compile","v":"0.9"},{"did":"12347","rid":"2002","n":"Commons Lang","s":"LIB","q":"LIB","w":1,"u":"compile","v":"1.4"}]}]
\ No newline at end of file diff --git a/sonar-ws-client/src/test/resources/dependency_tree/single_depth.json b/sonar-ws-client/src/test/resources/dependency_tree/single_depth.json new file mode 100644 index 00000000000..434a2da2cb2 --- /dev/null +++ b/sonar-ws-client/src/test/resources/dependency_tree/single_depth.json @@ -0,0 +1 @@ +[{"did":"12345","rid":"2000","n":"Commons Lang","s":"PRJ","q":"LIB","w":1,"u":"compile","v":"1.4"},{"did":"12346","rid":"2001","n":"Commons IO","s":"PRJ","q":"LIB","w":1,"u":"compile","v":"2.4"}]
\ No newline at end of file diff --git a/sonar-ws-client/src/test/resources/metrics/many_metrics.json b/sonar-ws-client/src/test/resources/metrics/many_metrics.json new file mode 100644 index 00000000000..e7104a6a43e --- /dev/null +++ b/sonar-ws-client/src/test/resources/metrics/many_metrics.json @@ -0,0 +1 @@ +[{"key":"packages","name":"Packages","description":"Packages","domain":"Size","qualitative":false,"user_managed":false,"direction":-1,"val_type":"INT"},{"key":"classes","name":"Classes","description":"Classes","domain":"Size","qualitative":false,"user_managed":false,"direction":-1,"val_type":"INT"},{"key":"ncloc","name":"Lines of code","description":"Non Commenting Lines of Code","domain":"Size","qualitative":false,"user_managed":false,"direction":-1,"val_type":"INT"},{"key":"functions","name":"Methods","description":"Methods","domain":"Size","qualitative":false,"user_managed":false,"direction":-1,"val_type":"INT"},{"key":"duplicated_lines","name":"Duplicated lines","description":"Duplicated lines","domain":"Duplication","qualitative":false,"user_managed":false,"direction":-1,"val_type":"INT"},{"key":"test_errors","name":"Unit test errors","description":"Number of unit test errors","domain":"Tests","qualitative":false,"user_managed":false,"direction":-1,"val_type":"INT"},{"key":"skipped_tests","name":"Skipped unit tests","description":"Number of skipped unit tests","domain":"Tests","qualitative":false,"user_managed":false,"direction":-1,"val_type":"INT"},{"key":"test_failures","name":"Unit test failures","description":"Number of unit test failures","domain":"Tests","qualitative":false,"user_managed":false,"direction":-1,"val_type":"INT"},{"key":"tests","name":"Unit tests","description":"Number of unit tests","domain":"Tests","qualitative":false,"user_managed":false,"direction":-1,"val_type":"INT"},{"key":"test_execution_time","name":"Unit tests duration","description":"Execution duration of unit tests ","domain":"Tests","qualitative":false,"user_managed":false,"direction":-1,"val_type":"MILLISEC"}]
\ No newline at end of file diff --git a/sonar-ws-client/src/test/resources/metrics/one_metric.json b/sonar-ws-client/src/test/resources/metrics/one_metric.json new file mode 100644 index 00000000000..17a163b5b82 --- /dev/null +++ b/sonar-ws-client/src/test/resources/metrics/one_metric.json @@ -0,0 +1 @@ +[{"key":"ncloc","name":"Lines of code","description":"Non Commenting Lines of Code","domain":"Size","qualitative":false,"user_managed":false,"direction":-1,"val_type":"INT","hidden":true}]
\ No newline at end of file diff --git a/sonar-ws-client/src/test/resources/properties/many.json b/sonar-ws-client/src/test/resources/properties/many.json new file mode 100644 index 00000000000..87d57bf7297 --- /dev/null +++ b/sonar-ws-client/src/test/resources/properties/many.json @@ -0,0 +1 @@ +[{"key":"myprop","value":"myvalue"},{"key":"myprop2","value":"myvalue2"},{"key":"myprop3","value":"myvalue3"}]
\ No newline at end of file diff --git a/sonar-ws-client/src/test/resources/properties/single.json b/sonar-ws-client/src/test/resources/properties/single.json new file mode 100644 index 00000000000..f1f0be4b0a5 --- /dev/null +++ b/sonar-ws-client/src/test/resources/properties/single.json @@ -0,0 +1 @@ +[{"key":"myprop","value":"myvalue"}]
\ No newline at end of file diff --git a/sonar-ws-client/src/test/resources/resources/many-resources-with-measures.json b/sonar-ws-client/src/test/resources/resources/many-resources-with-measures.json new file mode 100644 index 00000000000..b11780d979a --- /dev/null +++ b/sonar-ws-client/src/test/resources/resources/many-resources-with-measures.json @@ -0,0 +1 @@ +[{"id":38909,"key":"org.codehaus.sonar:sonar-plugin-api","name":"Sonar API","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:27:25+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality","msr":[{"key":"ncloc","val":9955.0,"frmt_val":"9,955"},{"key":"lines","val":19679.0,"frmt_val":"19,679"}]},{"id":94156,"key":"org.codehaus.sonar:sonar-squid","name":"Sonar Squid","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:29:42+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality","msr":[{"key":"ncloc","val":4757.0,"frmt_val":"4,757"},{"key":"lines","val":8279.0,"frmt_val":"8,279"}]},{"id":182945,"key":"org.codehaus.sonar:sonar-colorizer","name":"Sonar Code Colorizer","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:32:32+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality","msr":[{"key":"ncloc","val":829.0,"frmt_val":"829"},{"key":"lines","val":1566.0,"frmt_val":"1,566"}]},{"id":39023,"key":"org.codehaus.sonar:sonar-core","name":"Sonar core","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:32:57+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality","msr":[{"key":"ncloc","val":2471.0,"frmt_val":"2,471"},{"key":"lines","val":3830.0,"frmt_val":"3,830"}]},{"id":88480,"key":"org.codehaus.sonar.runtime:sonar-core-maven-plugin","name":"Sonar batch","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:33:57+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Sonar batch","msr":[{"key":"ncloc","val":1790.0,"frmt_val":"1,790"},{"key":"lines","val":2835.0,"frmt_val":"2,835"}]},{"id":39141,"key":"org.codehaus.sonar:sonar-web","name":"Sonar web","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:34:42+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality","msr":[{"key":"ncloc","val":1359.0,"frmt_val":"1,359"},{"key":"lines","val":1992.0,"frmt_val":"1,992"}]},{"id":39212,"key":"org.codehaus.sonar:sonar-application","name":"Sonar application","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:35:38+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Package the standalone distribution","msr":[{"key":"ncloc","val":163.0,"frmt_val":"163"},{"key":"lines","val":230.0,"frmt_val":"230"}]},{"id":48696,"key":"org.codehaus.sonar.plugins:sonar-plugin-core","name":"Sonar plugin core","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:35:53+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality","msr":[{"key":"ncloc","val":1913.0,"frmt_val":"1,913"},{"key":"lines","val":3318.0,"frmt_val":"3,318"}]},{"id":39200,"key":"org.codehaus.sonar.plugins:sonar-plugin-checkstyle","name":"Sonar Checkstyle plugin","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:39:05+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality","msr":[{"key":"ncloc","val":488.0,"frmt_val":"488"},{"key":"lines","val":770.0,"frmt_val":"770"}]},{"id":39218,"key":"org.codehaus.sonar.plugins:sonar-plugin-pmd","name":"Sonar PMD plugin","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:39:21+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality","msr":[{"key":"ncloc","val":478.0,"frmt_val":"478"},{"key":"lines","val":762.0,"frmt_val":"762"}]},{"id":48767,"key":"org.codehaus.sonar.plugins:sonar-plugin-cobertura","name":"Sonar Cobertura plugin","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:39:37+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality","msr":[{"key":"ncloc","val":286.0,"frmt_val":"286"},{"key":"lines","val":396.0,"frmt_val":"396"}]},{"id":48774,"key":"org.codehaus.sonar.plugins:sonar-plugin-clover","name":"Sonar Clover plugin","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:39:52+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality","msr":[{"key":"ncloc","val":471.0,"frmt_val":"471"},{"key":"lines","val":727.0,"frmt_val":"727"}]},{"id":48796,"key":"org.codehaus.sonar.plugins:sonar-plugin-surefire","name":"Sonar Surefire plugin","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:40:08+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality","msr":[{"key":"ncloc","val":393.0,"frmt_val":"393"},{"key":"lines","val":575.0,"frmt_val":"575"}]},{"id":48806,"key":"org.codehaus.sonar.plugins:sonar-plugin-googleanalytics","name":"Sonar Google analytics plugin","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:40:21+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality","msr":[{"key":"ncloc","val":65.0,"frmt_val":"65"},{"key":"lines","val":120.0,"frmt_val":"120"}]},{"id":48810,"key":"org.codehaus.sonar.plugins:sonar-plugin-findbugs","name":"Sonar Findbugs plugin","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:40:29+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality","msr":[{"key":"ncloc","val":862.0,"frmt_val":"862"},{"key":"lines","val":1447.0,"frmt_val":"1,447"}]},{"id":48790,"key":"org.codehaus.sonar.plugins:sonar-plugin-cpd","name":"Sonar CPD plugin","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:40:47+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality","msr":[{"key":"ncloc","val":347.0,"frmt_val":"347"},{"key":"lines","val":552.0,"frmt_val":"552"}]},{"id":94200,"key":"org.codehaus.sonar.plugins:sonar-plugin-squid","name":"Sonar Squid plugin","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:40:59+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality","msr":[{"key":"ncloc","val":439.0,"frmt_val":"439"},{"key":"lines","val":720.0,"frmt_val":"720"}]}]
\ No newline at end of file diff --git a/sonar-ws-client/src/test/resources/resources/many-resources.json b/sonar-ws-client/src/test/resources/resources/many-resources.json new file mode 100644 index 00000000000..30211af02e6 --- /dev/null +++ b/sonar-ws-client/src/test/resources/resources/many-resources.json @@ -0,0 +1 @@ +[{"id":38909,"key":"org.codehaus.sonar:sonar-plugin-api","name":"Sonar API","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:27:25+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality"},{"id":94156,"key":"org.codehaus.sonar:sonar-squid","name":"Sonar Squid","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:29:42+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality"},{"id":182945,"key":"org.codehaus.sonar:sonar-colorizer","name":"Sonar Code Colorizer","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:32:32+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality"},{"id":222615,"key":"org.codehaus.sonar:sonar-client","name":"Sonar Client","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:32:50+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality"},{"id":172279,"key":"org.codehaus.sonar.archetypes:sonar-archetypes","name":"Sonar archetypes","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:32:53+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality"},{"id":39023,"key":"org.codehaus.sonar:sonar-core","name":"Sonar core","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:32:57+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality"},{"id":88480,"key":"org.codehaus.sonar.runtime:sonar-core-maven-plugin","name":"Sonar batch","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:33:57+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Sonar batch"},{"id":39141,"key":"org.codehaus.sonar:sonar-web","name":"Sonar web","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:34:42+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality"},{"id":39212,"key":"org.codehaus.sonar:sonar-application","name":"Sonar application","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:35:38+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Package the standalone distribution"},{"id":48696,"key":"org.codehaus.sonar.plugins:sonar-plugin-core","name":"Sonar plugin core","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:35:53+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality"},{"id":39200,"key":"org.codehaus.sonar.plugins:sonar-plugin-checkstyle","name":"Sonar Checkstyle plugin","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:39:05+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality"},{"id":39218,"key":"org.codehaus.sonar.plugins:sonar-plugin-pmd","name":"Sonar PMD plugin","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:39:21+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality"},{"id":48767,"key":"org.codehaus.sonar.plugins:sonar-plugin-cobertura","name":"Sonar Cobertura plugin","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:39:37+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality"},{"id":48774,"key":"org.codehaus.sonar.plugins:sonar-plugin-clover","name":"Sonar Clover plugin","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:39:52+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality"},{"id":48796,"key":"org.codehaus.sonar.plugins:sonar-plugin-surefire","name":"Sonar Surefire plugin","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:40:08+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality"},{"id":48806,"key":"org.codehaus.sonar.plugins:sonar-plugin-googleanalytics","name":"Sonar Google analytics plugin","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:40:21+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality"},{"id":48810,"key":"org.codehaus.sonar.plugins:sonar-plugin-findbugs","name":"Sonar Findbugs plugin","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:40:29+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality"},{"id":48790,"key":"org.codehaus.sonar.plugins:sonar-plugin-cpd","name":"Sonar CPD plugin","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:40:47+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality"},{"id":94200,"key":"org.codehaus.sonar.plugins:sonar-plugin-squid","name":"Sonar Squid plugin","scope":"PRJ","qualifier":"BRC","date":"2010-01-01T22:40:59+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality"}]
\ No newline at end of file diff --git a/sonar-ws-client/src/test/resources/resources/single-resource-with-measures.json b/sonar-ws-client/src/test/resources/resources/single-resource-with-measures.json new file mode 100644 index 00000000000..5449b1a01ba --- /dev/null +++ b/sonar-ws-client/src/test/resources/resources/single-resource-with-measures.json @@ -0,0 +1 @@ +[{"id":48569,"key":"org.codehaus.sonar:sonar","name":"Sonar","scope":"PRJ","qualifier":"TRK","date":"2010-01-01T22:27:25+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality","msr":[{"key":"lines","val":47798.0,"frmt_val":"47,798"},{"key":"ncloc","val":27066.0,"frmt_val":"27,066"}]}]
\ No newline at end of file diff --git a/sonar-ws-client/src/test/resources/resources/single-resource-with-trends.json b/sonar-ws-client/src/test/resources/resources/single-resource-with-trends.json new file mode 100644 index 00000000000..b67714ed06b --- /dev/null +++ b/sonar-ws-client/src/test/resources/resources/single-resource-with-trends.json @@ -0,0 +1,29 @@ +[ + { + "id":48569, + "key":"org.codehaus.sonar:sonar", + "name":"Sonar", + "scope":"PRJ", + "qualifier":"TRK", + "date":"2010-01-01T22:27:25+00:00", + "lang":"java", + "version":"1.13-SNAPSHOT", + "description":"Embrace Quality", + "msr":[ + { + "key":"lines", + "val":47798.0, + "frmt_val":"47,798", + "trend":0, + "var":2 + }, + { + "key":"ncloc", + "val":27066.0, + "frmt_val":"27,066", + "trend":1, + "var":1 + } + ] + } +]
\ No newline at end of file diff --git a/sonar-ws-client/src/test/resources/resources/single-resource.json b/sonar-ws-client/src/test/resources/resources/single-resource.json new file mode 100644 index 00000000000..f8b52f1cd18 --- /dev/null +++ b/sonar-ws-client/src/test/resources/resources/single-resource.json @@ -0,0 +1 @@ +[{"id":48569,"key":"org.codehaus.sonar:sonar","name":"Sonar","scope":"PRJ","qualifier":"TRK","date":"2010-01-01T22:27:25+00:00","lang":"java","version":"1.13-SNAPSHOT","description":"Embrace Quality"}]
\ No newline at end of file diff --git a/sonar-ws-client/src/test/resources/sources/from_line_to_line.json b/sonar-ws-client/src/test/resources/sources/from_line_to_line.json new file mode 100644 index 00000000000..c4c7ed00509 --- /dev/null +++ b/sonar-ws-client/src/test/resources/sources/from_line_to_line.json @@ -0,0 +1 @@ +[{"3":" * Copyright (C) 2009 SonarSource SA","4":" * mailto:contact AT sonarsource DOT com","5":" *","6":" * Sonar is free software; you can redistribute it and\/or","7":" * modify it under the terms of the GNU Lesser General Public","8":" * License as published by the Free Software Foundation; either","9":" * version 3 of the License, or (at your option) any later version.","10":" *","11":" * Sonar is distributed in the hope that it will be useful,","12":" * but WITHOUT ANY WARRANTY; without even the implied warranty of","13":" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU","14":" * Lesser General Public License for more details.","15":" *","16":" * You should have received a copy of the GNU Lesser General Public","17":" * License along with Sonar; if not, write to the Free Software"}]
\ No newline at end of file diff --git a/sonar-ws-client/src/test/resources/sources/source.json b/sonar-ws-client/src/test/resources/sources/source.json new file mode 100644 index 00000000000..5042d43778e --- /dev/null +++ b/sonar-ws-client/src/test/resources/sources/source.json @@ -0,0 +1 @@ +[{"1":"\/*","2":" * Sonar, open source software quality management tool.","3":" * Copyright (C) 2009 SonarSource SA","4":" * mailto:contact AT sonarsource DOT com","5":" *","6":" * Sonar is free software; you can redistribute it and\/or","7":" * modify it under the terms of the GNU Lesser General Public","8":" * License as published by the Free Software Foundation; either","9":" * version 3 of the License, or (at your option) any later version.","10":" *","11":" * Sonar is distributed in the hope that it will be useful,","12":" * but WITHOUT ANY WARRANTY; without even the implied warranty of","13":" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU","14":" * Lesser General Public License for more details.","15":" *","16":" * You should have received a copy of the GNU Lesser General Public","17":" * License along with Sonar; if not, write to the Free Software","18":" * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02","19":" *\/","20":"package org.sonar.api.utils;","21":"","22":"import com.google.common.collect.Multiset;","23":"import org.apache.commons.collections.Bag;","24":"import org.apache.commons.lang.StringUtils;","25":"import org.apache.commons.lang.math.NumberUtils;","26":"import org.sonar.api.rules.RulePriority;","27":"import org.slf4j.LoggerFactory;","28":"","29":"import java.util.HashMap;","30":"import java.util.Map;","31":"","32":"\/**","33":" * Util class to format key\/value data. Output is a string representation ready to be","34":" * injected into the database","35":" *","36":" * @since 1.10","37":" *\/","38":"public final class KeyValueFormat {","39":"","40":" private KeyValueFormat() {","41":" }","42":"","43":" \/**","44":" * Transforms a string with the following format : "key1=value1;key2=value2..."","45":" * into a Map<KEY, VALUE>. Requires to implement the transform(key,value) method","46":" *","47":" * @param data the input string","48":" * @param transformer the interface to implement","49":" * @return a Map of <key, value>","50":" *\/","51":" public static <KEY, VALUE> Map<KEY, VALUE> parse(String data, Transformer<KEY, VALUE> transformer) {","52":" Map<String, String> rawData = parse(data);","53":" Map<KEY, VALUE> map = new HashMap<KEY, VALUE>();","54":" for (Map.Entry<String, String> entry : rawData.entrySet()) {","55":" KeyValue<KEY, VALUE> keyVal = transformer.transform(entry.getKey(), entry.getValue());","56":" if (keyVal != null) {","57":" map.put(keyVal.getKey(), keyVal.getValue());","58":" }","59":" }","60":" return map;","61":" }","62":"","63":" \/**","64":" * Transforms a string with the following format : "key1=value1;key2=value2..."","65":" * into a Map<String,String>","66":" *","67":" * @param data the string to parse","68":" * @return a map","69":" *\/","70":" public static Map<String, String> parse(String data) {","71":" Map<String, String> map = new HashMap<String, String>();","72":" String[] pairs = StringUtils.split(data, ";");","73":" for (String pair : pairs) {","74":" String[] keyValue = StringUtils.split(pair, "=");","75":" String key = keyValue[0];","76":" String value = (keyValue.length == 2 ? keyValue[1] : "");","77":" map.put(key, value);","78":" }","79":" return map;","80":" }","81":"","82":" \/**","83":" * Transforms a map<KEY,VALUE> into a string with the format : "key1=value1;key2=value2..."","84":" *","85":" * @param map the map to transform","86":" * @return the formatted string","87":" *\/","88":" public static <KEY, VALUE> String format(Map<KEY, VALUE> map) {","89":" StringBuilder sb = new StringBuilder();","90":" boolean first = true;","91":" for (Map.Entry<?, ?> entry : map.entrySet()) {","92":" if (!first) {","93":" sb.append(";");","94":" }","95":" sb.append(entry.getKey().toString());","96":" sb.append("=");","97":" if (entry.getValue() != null) {","98":" sb.append(entry.getValue());","99":" }","100":" first = false;","101":" }","102":"","103":" return sb.toString();","104":" }","105":"","106":" \/**","107":" * @since 1.11","108":" * @deprecated use Multiset from google collections instead of commons-collections bags","109":" *\/","110":" public static String format(Bag bag) {","111":" return format(bag, 0);","112":" }","113":"","114":" \/**","115":" * @since 1.11","116":" * @deprecated use Multiset from google collections instead of commons-collections bags","117":" *\/","118":" public static String format(Bag bag, int var) {","119":" StringBuilder sb = new StringBuilder();","120":" boolean first = true;","121":" for (Object obj : bag.uniqueSet()) {","122":" if (!first) {","123":" sb.append(";");","124":" }","125":" sb.append(obj.toString());","126":" sb.append("=");","127":" sb.append(bag.getCount(obj) + var);","128":" first = false;","129":" }","130":"","131":" return sb.toString();","132":" }","133":"","134":" \/**","135":" * Transforms a Multiset<?> into a string with the format : "key1=count1;key2=count2..."","136":" *","137":" * @param set the set to transform","138":" * @return the formatted string","139":" *\/","140":" public static String format(Multiset<?> set) {","141":" StringBuilder sb = new StringBuilder();","142":" boolean first = true;","143":" for (Multiset.Entry<?> entry : set.entrySet()) {","144":" if (!first) {","145":" sb.append(";");","146":" }","147":" sb.append(entry.getElement().toString());","148":" sb.append("=");","149":" sb.append(entry.getCount());","150":" first = false;","151":" }","152":" return sb.toString();","153":" }","154":"","155":" \/**","156":" * Transforms a Object... into a string with the format : "object1=object2;object3=object4..."","157":" *","158":" * @param objects the object list to transform","159":" * @return the formatted string","160":" *\/","161":" public static String format(Object... objects) {","162":" StringBuilder sb = new StringBuilder();","163":" boolean first = true;","164":" if (objects != null) {","165":" for (int i = 0; i < objects.length; i++) {","166":" if (!first) {","167":" sb.append(";");","168":" }","169":" sb.append(objects[i++].toString());","170":" sb.append("=");","171":" sb.append(objects[i]);","172":" first = false;","173":" }","174":" }","175":" return sb.toString();","176":" }","177":"","178":" public interface Transformer<KEY, VALUE> {","179":" KeyValue<KEY, VALUE> transform(String key, String value);","180":" }","181":"","182":" \/**","183":" * Implementation of Transformer<String, Double>","184":" *\/","185":" public static class StringNumberPairTransformer implements Transformer<String, Double> {","186":"","187":" public KeyValue<String, Double> transform(String key, String value) {","188":" return new KeyValue<String, Double>(key, toDouble(value));","189":" }","190":" }","191":"","192":" \/**","193":" * Implementation of Transformer<Double, Double>","194":" *\/","195":" public static class DoubleNumbersPairTransformer implements Transformer<Double, Double> {","196":"","197":" public KeyValue<Double, Double> transform(String key, String value) {","198":" return new KeyValue<Double, Double>(toDouble(key), toDouble(value));","199":" }","200":" }","201":"","202":" \/**","203":" * Implementation of Transformer<Integer, Integer>","204":" *\/","205":" public static class IntegerNumbersPairTransformer implements Transformer<Integer, Integer> {","206":"","207":" public KeyValue<Integer, Integer> transform(String key, String value) {","208":" return new KeyValue<Integer, Integer>(toInteger(key), toInteger(value));","209":" }","210":" }","211":"","212":" \/**","213":" * Implementation of Transformer<RulePriority, Integer>","214":" *\/","215":" public static class RulePriorityNumbersPairTransformer implements Transformer<RulePriority, Integer> {","216":"","217":" public KeyValue<RulePriority, Integer> transform(String key, String value) {","218":" try {","219":" if (StringUtils.isBlank(value)) { value = "0"; }","220":" return new KeyValue<RulePriority, Integer>(RulePriority.valueOf(key.toUpperCase()), Integer.parseInt(value));","221":" }","222":" catch (Exception e) {","223":" LoggerFactory.getLogger(RulePriorityNumbersPairTransformer.class).warn("Property " + key + " has invalid value: " + value, e);","224":" return null;","225":" }","226":" }","227":" }","228":"","229":" private static Double toDouble(String value) {","230":" return StringUtils.isBlank(value) ? null : NumberUtils.toDouble(value);","231":" }","232":"","233":" private static Integer toInteger(String value) {","234":" return StringUtils.isBlank(value) ? null : NumberUtils.toInt(value);","235":" }","236":"}"}]
\ No newline at end of file diff --git a/sonar-ws-client/src/test/resources/violations/violation-without-optional-fields.json b/sonar-ws-client/src/test/resources/violations/violation-without-optional-fields.json new file mode 100644 index 00000000000..acfffe3e152 --- /dev/null +++ b/sonar-ws-client/src/test/resources/violations/violation-without-optional-fields.json @@ -0,0 +1,3 @@ +[ + {"message":"throw java.lang.Exception","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 diff --git a/sonar-ws-client/src/test/resources/violations/violations.json b/sonar-ws-client/src/test/resources/violations/violations.json new file mode 100644 index 00000000000..ec9fb7b682a --- /dev/null +++ b/sonar-ws-client/src/test/resources/violations/violations.json @@ -0,0 +1,4 @@ +[ + {"message":"throw java.lang.Exception","line":97,"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":"The user-supplied array 'threads' is stored directly.","line":242,"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"}} +]
\ No newline at end of file |