aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-protocol/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-scanner-protocol/src/test')
-rw-r--r--sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/input/GlobalRepositoriesTest.java67
-rw-r--r--sonar-scanner-protocol/src/test/resources/org/sonar/scanner/protocol/input/GlobalRepositoriesTest/expected.json21
-rw-r--r--sonar-scanner-protocol/src/test/resources/org/sonar/scanner/protocol/input/ProjectRepositoriesTest/testToJson.json23
-rw-r--r--sonar-scanner-protocol/src/test/resources/org/sonar/scanner/protocol/input/RulesSearchTest/empty.json1
-rw-r--r--sonar-scanner-protocol/src/test/resources/org/sonar/scanner/protocol/input/RulesSearchTest/expected.json1
5 files changed, 0 insertions, 113 deletions
diff --git a/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/input/GlobalRepositoriesTest.java b/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/input/GlobalRepositoriesTest.java
deleted file mode 100644
index 703e182ea8d..00000000000
--- a/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/input/GlobalRepositoriesTest.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.scanner.protocol.input;
-
-import org.apache.commons.io.IOUtils;
-import org.junit.Test;
-import org.sonar.scanner.protocol.input.GlobalRepositories;
-import org.sonar.scanner.protocol.input.Metric;
-
-import static net.javacrumbs.jsonunit.assertj.JsonAssert.assertThatJson;
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class GlobalRepositoriesTest {
-
- @Test
- public void to_json() throws Exception {
- GlobalRepositories ref = new GlobalRepositories();
- ref.addMetric(new Metric(1, "ncloc", "INT", "Description", -1, "NCLOC", true, false, 2.0, 1.0, true));
- ref.addGlobalSetting("prop", "value");
- ref.setTimestamp(10);
-
- assertThatJson(ref.toJson())
- .isEqualTo(IOUtils.toString(getClass().getResource("GlobalRepositoriesTest/expected.json")));
- }
-
- @Test
- public void from_json() {
- GlobalRepositories ref = GlobalRepositories
- .fromJson(
- "{timestamp:1,"
- + "metrics:[{id:1,key:ncloc,valueType:DATA,description:Description,direction:-1,name:NCLOC,qualitative:true,userManaged:false,worstValue:2.0,bestValue:1.0,optimizedBestValue:true}],"
- + "globalSettings:{prop:value}}");
-
- assertThat(ref.timestamp()).isEqualTo(1);
- Metric metric = ref.metrics().iterator().next();
- assertThat(metric.id()).isEqualTo(1);
- assertThat(metric.key()).isEqualTo("ncloc");
- assertThat(metric.valueType()).isEqualTo("DATA");
- assertThat(metric.description()).isEqualTo("Description");
- assertThat(metric.direction()).isEqualTo(-1);
- assertThat(metric.name()).isEqualTo("NCLOC");
- assertThat(metric.isQualitative()).isTrue();
- assertThat(metric.isUserManaged()).isFalse();
- assertThat(metric.worstValue()).isEqualTo(2.0);
- assertThat(metric.bestValue()).isEqualTo(1.0);
- assertThat(metric.isOptimizedBestValue()).isTrue();
-
- assertThat(ref.globalSettings()).containsEntry("prop", "value");
- }
-}
diff --git a/sonar-scanner-protocol/src/test/resources/org/sonar/scanner/protocol/input/GlobalRepositoriesTest/expected.json b/sonar-scanner-protocol/src/test/resources/org/sonar/scanner/protocol/input/GlobalRepositoriesTest/expected.json
deleted file mode 100644
index de38ae0cb18..00000000000
--- a/sonar-scanner-protocol/src/test/resources/org/sonar/scanner/protocol/input/GlobalRepositoriesTest/expected.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "timestamp": 10,
- "metrics": [
- {
- "id": 1,
- "key": "ncloc",
- "valueType": "INT",
- "description": "Description",
- "direction": -1,
- "name": "NCLOC",
- "qualitative": true,
- "userManaged": false,
- "worstValue": 2.0,
- "bestValue": 1.0,
- "optimizedBestValue": true
- }
- ],
- "globalSettings": {
- "prop": "value"
- }
-}
diff --git a/sonar-scanner-protocol/src/test/resources/org/sonar/scanner/protocol/input/ProjectRepositoriesTest/testToJson.json b/sonar-scanner-protocol/src/test/resources/org/sonar/scanner/protocol/input/ProjectRepositoriesTest/testToJson.json
deleted file mode 100644
index ba7489143a6..00000000000
--- a/sonar-scanner-protocol/src/test/resources/org/sonar/scanner/protocol/input/ProjectRepositoriesTest/testToJson.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "timestamp": 10,
- "settingsByModule": {
- "foo": {
- "prop1": "value1",
- "prop2": "value2",
- "prop": "value"
- }
- },
- "fileDataByModuleAndPath": {
- "foo": {
- "src/main/java/Foo.java": {
- "hash": "xyz",
- "needBlame": true
- },
- "src/main/java/Foo2.java": {
- "hash": "xyz",
- "needBlame": false
- }
- }
- },
- "lastAnalysisDate": "2014-05-18T15:50:45+0100"
-}
diff --git a/sonar-scanner-protocol/src/test/resources/org/sonar/scanner/protocol/input/RulesSearchTest/empty.json b/sonar-scanner-protocol/src/test/resources/org/sonar/scanner/protocol/input/RulesSearchTest/empty.json
deleted file mode 100644
index 055fe8b8d63..00000000000
--- a/sonar-scanner-protocol/src/test/resources/org/sonar/scanner/protocol/input/RulesSearchTest/empty.json
+++ /dev/null
@@ -1 +0,0 @@
-{"total":3225,"p":30,"ps":500,"rules":[]} \ No newline at end of file
diff --git a/sonar-scanner-protocol/src/test/resources/org/sonar/scanner/protocol/input/RulesSearchTest/expected.json b/sonar-scanner-protocol/src/test/resources/org/sonar/scanner/protocol/input/RulesSearchTest/expected.json
deleted file mode 100644
index 89350a7e331..00000000000
--- a/sonar-scanner-protocol/src/test/resources/org/sonar/scanner/protocol/input/RulesSearchTest/expected.json
+++ /dev/null
@@ -1 +0,0 @@
-{"total":290,"p":1,"ps":2,"rules":[{"key":"squid:S1194","internalKey":"S1194","repo":"squid","name":"\"java.lang.Error\" should not be extended","severity":"MAJOR","lang":"java"},{"key":"squid:ObjectFinalizeOverridenCallsSuperFinalizeCheck","internalKey":"ObjectFinalizeOverridenCallsSuperFinalizeCheck","repo":"squid","name":"super.finalize() should be called at the end of Object.finalize() implementations","severity":"BLOCKER","lang":"java"}]} \ No newline at end of file