From 5c0a0e3e24c69951d225a25f63aab10e268ee7e1 Mon Sep 17 00:00:00 2001 From: Duarte Meneses Date: Fri, 9 Oct 2015 09:15:50 +0200 Subject: [PATCH] Remove unused json objects --- .../batch/protocol/input/ActiveRule.java | 100 ------------------ .../sonar/batch/protocol/input/QProfile.java | 71 ------------- .../batch/protocol/input/QProfileTest.java | 42 -------- 3 files changed, 213 deletions(-) delete mode 100644 sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/ActiveRule.java delete mode 100644 sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/QProfile.java delete mode 100644 sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/QProfileTest.java diff --git a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/ActiveRule.java b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/ActiveRule.java deleted file mode 100644 index 167f7aabd87..00000000000 --- a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/ActiveRule.java +++ /dev/null @@ -1,100 +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 javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import java.util.HashMap; -import java.util.Map; - -public class ActiveRule { - private final String repositoryKey; - private final String ruleKey; - private final String templateRuleKey; - private final String name; - private final String severity; - private final String internalKey; - private final String language; - private final Map params = new HashMap<>(); - - public ActiveRule(String repositoryKey, String ruleKey, @Nullable String templateRuleKey, String name, @Nullable String severity, - @Nullable String internalKey, @Nullable String language) { - this.repositoryKey = repositoryKey; - this.ruleKey = ruleKey; - this.templateRuleKey = templateRuleKey; - this.name = name; - this.severity = severity; - this.internalKey = internalKey; - this.language = language; - } - - public String repositoryKey() { - return repositoryKey; - } - - public String ruleKey() { - return ruleKey; - } - - @CheckForNull - public String templateRuleKey() { - return templateRuleKey; - } - - public String name() { - return name; - } - - /** - * Is null on manual rules - */ - @CheckForNull - public String severity() { - return severity; - } - - /** - * Is null on manual rules - */ - @CheckForNull - public String language() { - return language; - } - - @CheckForNull - public String param(String key) { - return params.get(key); - } - - public ActiveRule addParam(String key, String value) { - params.put(key, value); - return this; - } - - public Map params() { - return params; - } - - @CheckForNull - public String internalKey() { - return internalKey; - } -} diff --git a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/QProfile.java b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/QProfile.java deleted file mode 100644 index 3e98e0ffb5a..00000000000 --- a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/QProfile.java +++ /dev/null @@ -1,71 +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.Date; - -public class QProfile { - - private final String key; - private final String name; - private final String language; - private final Date rulesUpdatedAt; - - public QProfile(String key, String name, String language, Date rulesUpdatedAt) { - this.key = key; - this.name = name; - this.language = language; - this.rulesUpdatedAt = rulesUpdatedAt; - } - - public String key() { - return key; - } - - public String name() { - return name; - } - - public String language() { - return language; - } - - public Date rulesUpdatedAt() { - return rulesUpdatedAt; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - QProfile qProfile = (QProfile) o; - return key.equals(qProfile.key); - } - - @Override - public int hashCode() { - return key.hashCode(); - } -} diff --git a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/QProfileTest.java b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/QProfileTest.java deleted file mode 100644 index d28bdbbe489..00000000000 --- a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/QProfileTest.java +++ /dev/null @@ -1,42 +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.junit.Test; - -import java.text.ParseException; -import java.text.SimpleDateFormat; - -import static org.assertj.core.api.Assertions.assertThat; - -public class QProfileTest { - - @Test - public void testEqualsAndHashCode() throws ParseException { - QProfile qProfile1 = new QProfile("squid-java", "Java", "java", new SimpleDateFormat("dd/MM/yyyy").parse("14/03/1984")); - QProfile qProfile2 = new QProfile("squid-java", "Java 2", "java", new SimpleDateFormat("dd/MM/yyyy").parse("14/03/1985")); - - assertThat(qProfile1.equals(qProfile1)).isTrue(); - assertThat(qProfile1.equals("foo")).isFalse(); - assertThat(qProfile1.equals(qProfile2)).isTrue(); - - assertThat(qProfile1.hashCode()).isEqualTo(148572637); - } -} -- 2.39.5