diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2015-07-30 17:14:05 +0200 |
---|---|---|
committer | Duarte Meneses <duarte.meneses@sonarsource.com> | 2015-07-31 12:04:26 +0200 |
commit | 6cd87655c83490cc9f80f10c71a12a09e05378f2 (patch) | |
tree | ff726994d55fc667d8f2f19833f8a28667b44e75 /sonar-batch-protocol/src | |
parent | 46774df18dad3bb7deeb0e9964233d8617ce9490 (diff) | |
download | sonarqube-6cd87655c83490cc9f80f10c71a12a09e05378f2.tar.gz sonarqube-6cd87655c83490cc9f80f10c71a12a09e05378f2.zip |
use new rule WS
Diffstat (limited to 'sonar-batch-protocol/src')
3 files changed, 0 insertions, 152 deletions
diff --git a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/Rule.java b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/Rule.java deleted file mode 100644 index 8f71f3ff00a..00000000000 --- a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/Rule.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube 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. - * - * SonarQube 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.batch.protocol.input; - -public class Rule { - private final String key; - private final String repo; - private final String internalKey; - private final String name; - - public Rule(String ruleKey, String repositoryKey, String internalKey, String name) { - this.key = ruleKey; - this.repo = repositoryKey; - this.internalKey = internalKey; - this.name = name; - } - - public String ruleKey() { - return key; - } - - public String repositoryKey() { - return repo; - } - - public String internalKey() { - return internalKey; - } - - public String name() { - return name; - } - -} diff --git a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/RulesSearchResult.java b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/RulesSearchResult.java deleted file mode 100644 index 91dccb179f7..00000000000 --- a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/RulesSearchResult.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube 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. - * - * SonarQube 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.batch.protocol.input; - -import java.util.List; - -import org.sonar.batch.protocol.GsonHelper; - -public class RulesSearchResult { - List<Rule> rules; - - public List<Rule> getRules() { - return rules; - } - - public void setRules(List<Rule> rules) { - this.rules = rules; - } - - public String toJson() { - return GsonHelper.create().toJson(this); - } - - public static RulesSearchResult fromJson(String json) { - return GsonHelper.create().fromJson(json, RulesSearchResult.class); - } - -} diff --git a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/RulesSearchResultTest.java b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/RulesSearchResultTest.java deleted file mode 100644 index 0781a69b78f..00000000000 --- a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/RulesSearchResultTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube 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. - * - * SonarQube 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.batch.protocol.input; - -import org.apache.commons.io.IOUtils; - -import java.io.IOException; -import java.net.URL; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.sonar.test.JsonAssert; -import org.assertj.core.util.Lists; -import org.junit.Test; - -public class RulesSearchResultTest { - @Test - public void testJsonParsing() { - Rule rule1 = new Rule("squid:S1194", "squid", "S1194", "\"java.lang.Error\" should not be extended"); - Rule rule2 = new Rule("squid:ObjectFinalizeOverridenCallsSuperFinalizeCheck", "squid", "ObjectFinalizeOverridenCallsSuperFinalizeCheck", - "super.finalize() should be called at the end of Object.finalize() implementations"); - - RulesSearchResult rules = new RulesSearchResult(); - rules.setRules(Lists.newArrayList(rule1, rule2)); - - JsonAssert - .assertJson(getClass().getResource("RulesSearchTest/expected.json")) - .isSimilarTo(rules.toJson()); - } - - @Test - public void testJsonParsingEmpty() throws IOException { - URL resource = getClass().getResource("RulesSearchTest/empty.json"); - String json = IOUtils.toString(resource); - RulesSearchResult result = RulesSearchResult.fromJson(json); - - assertThat(result.getRules()).isEmpty(); - } -} |