aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2016-03-31 16:27:21 +0200
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2016-03-31 16:55:01 +0200
commita81d697437999945c1acbd8117bf01b94906941b (patch)
tree889f02747ae111af7d01133a54343aadda422099
parent0dd3ac65fe67516316d153a4ce950a74fd1aa0e0 (diff)
downloadsonarqube-a81d697437999945c1acbd8117bf01b94906941b.tar.gz
sonarqube-a81d697437999945c1acbd8117bf01b94906941b.zip
SONAR-6717 Drop issue.Action API
-rw-r--r--server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java2
-rw-r--r--server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/issue/action/Action.java102
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/issue/action/Actions.java46
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/issue/action/Function.java46
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/issue/action/package-info.java23
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/issue/action/ActionTest.java93
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/issue/action/ActionsTest.java36
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/batch/mediumtest/tasks/TasksMediumTest.java22
10 files changed, 2 insertions, 372 deletions
diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java
index bd2d9e11eb0..cc98def1ecf 100644
--- a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java
+++ b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java
@@ -24,7 +24,6 @@ import java.util.List;
import javax.annotation.CheckForNull;
import org.sonar.api.config.EmailSettings;
import org.sonar.api.internal.SonarQubeVersionFactory;
-import org.sonar.api.issue.action.Actions;
import org.sonar.api.profiles.AnnotationProfileParser;
import org.sonar.api.profiles.XMLProfileParser;
import org.sonar.api.profiles.XMLProfileSerializer;
@@ -426,7 +425,6 @@ public class ComputeEngineContainerImpl implements ComputeEngineContainer {
// InternalRubyIssueService.class, indirectly used only in Web Services
// IssueChangelogService.class, indirectly used only in Web Services
// ActionService.class, indirectly used only in Web Services
- Actions.class,
// IssueBulkChangeService.class, indirectly used only in Web Services
// WsResponseCommonFormat.class, indirectly used only in Web Services
// IssueWsModule.class, no Web Service in CE
diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java
index 15abf853225..4345cd88fe4 100644
--- a/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java
+++ b/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java
@@ -79,7 +79,7 @@ public class ComputeEngineContainerImplTest {
assertThat(picoContainer.getComponentAdapters())
.hasSize(
CONTAINER_ITSELF
- + 76 // level 4
+ + 75 // level 4
+ 5 // content of CeModule
+ 7 // content of CeQueueModule
+ 4 // content of ReportProcessingModule
diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java
index 10913fa94ca..7d4549f10a8 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java
@@ -21,7 +21,6 @@ package org.sonar.server.platform.platformlevel;
import java.util.List;
import org.sonar.api.config.EmailSettings;
-import org.sonar.api.issue.action.Actions;
import org.sonar.api.profiles.AnnotationProfileParser;
import org.sonar.api.profiles.XMLProfileParser;
import org.sonar.api.profiles.XMLProfileSerializer;
@@ -556,7 +555,6 @@ public class PlatformLevel4 extends PlatformLevel {
InternalRubyIssueService.class,
IssueChangelogService.class,
ActionService.class,
- Actions.class,
IssueBulkChangeService.class,
WsResponseCommonFormat.class,
IssueWsModule.class,
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/action/Action.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/action/Action.java
deleted file mode 100644
index 9112f6cd637..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/action/Action.java
+++ /dev/null
@@ -1,102 +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.api.issue.action;
-
-import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
-import com.google.common.collect.ImmutableList;
-import java.util.List;
-import org.sonar.api.issue.Issue;
-import org.sonar.api.issue.condition.Condition;
-
-import static com.google.common.collect.Lists.newArrayList;
-
-/**
- * @since 3.6
- * @deprecated in 5.5. Webapp cannot be customized anymore to define actions on issues
- */
-@Deprecated
-public class Action {
-
- private final String key;
- private final List<Condition> conditions;
- private final List<Function> functions;
-
- Action(String key) {
- Preconditions.checkArgument(!Strings.isNullOrEmpty(key), "Action key must be set");
- this.key = key;
- this.conditions = newArrayList();
- this.functions = newArrayList();
- }
-
- public String key() {
- return key;
- }
-
- public Action setConditions(Condition... conditions) {
- this.conditions.addAll(ImmutableList.copyOf(conditions));
- return this;
- }
-
- public List<Condition> conditions() {
- return conditions;
- }
-
- public Action setFunctions(Function... functions) {
- this.functions.addAll(ImmutableList.copyOf(functions));
- return this;
- }
-
- public List<Function> functions() {
- return functions;
- }
-
- public boolean supports(Issue issue) {
- for (Condition condition : conditions) {
- if (!condition.matches(issue)) {
- return false;
- }
- }
- return true;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- Action that = (Action) o;
- return key.equals(that.key);
- }
-
- @Override
- public int hashCode() {
- return key.hashCode();
- }
-
- @Override
- public String toString() {
- return key;
- }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/action/Actions.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/action/Actions.java
deleted file mode 100644
index 29dd04cd835..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/action/Actions.java
+++ /dev/null
@@ -1,46 +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.api.issue.action;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.sonar.api.server.ServerSide;
-
-/**
- * @since 3.6
- * @deprecated in 5.5. Webapp cannot be customized anymore to define actions on issues
- */
-@Deprecated
-@ServerSide
-public class Actions {
-
- private final List<Action> list = new ArrayList<>();
-
- public Action add(String actionKey) {
- Action action = new Action(actionKey);
- this.list.add(action);
- return action;
- }
-
- public List<Action> list() {
- return list;
- }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/action/Function.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/action/Function.java
deleted file mode 100644
index d0e1a99ba7b..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/action/Function.java
+++ /dev/null
@@ -1,46 +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.api.issue.action;
-
-import com.google.common.annotations.Beta;
-import org.sonar.api.config.Settings;
-import org.sonar.api.issue.Issue;
-
-import javax.annotation.Nullable;
-
-/**
- * @since 3.6
- */
-@Beta
-public interface Function {
-
- void execute(Context context);
-
- interface Context {
- Issue issue();
-
- Settings projectSettings();
-
- Context setAttribute(String key, @Nullable String value);
-
- Context addComment(@Nullable String text);
- }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/action/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/action/package-info.java
deleted file mode 100644
index 700451e8741..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/action/package-info.java
+++ /dev/null
@@ -1,23 +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.
- */
-@ParametersAreNonnullByDefault
-package org.sonar.api.issue.action;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/issue/action/ActionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/issue/action/ActionTest.java
deleted file mode 100644
index e0ac8afbe11..00000000000
--- a/sonar-plugin-api/src/test/java/org/sonar/api/issue/action/ActionTest.java
+++ /dev/null
@@ -1,93 +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.api.issue.action;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.api.issue.Issue;
-import org.sonar.api.issue.condition.Condition;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class ActionTest {
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- Condition condition1 = mock(Condition.class);
- Condition condition2 = mock(Condition.class);
- Function function1 = mock(Function.class);
- Function function2 = mock(Function.class);
-
- @Test
- public void test_action() throws Exception {
- Action action = new Action("link-to-jira")
- .setConditions(condition1, condition2)
- .setFunctions(function1, function2);
-
- assertThat(action.key()).isEqualTo("link-to-jira");
- assertThat(action.conditions()).containsOnly(condition1, condition2);
- assertThat(action.functions()).containsOnly(function1, function2);
- }
-
- @Test
- public void key_should_be_set() {
- thrown.expectMessage("Action key must be set");
-
- new Action("");
- }
-
- @Test
- public void should_verify_conditions() {
- Issue issue = mock(Issue.class);
- Action action = new Action("link-to-jira")
- .setConditions(condition1, condition2);
-
- when(condition1.matches(issue)).thenReturn(true);
- when(condition2.matches(issue)).thenReturn(false);
- assertThat(action.supports(issue)).isFalse();
-
- when(condition1.matches(issue)).thenReturn(true);
- when(condition2.matches(issue)).thenReturn(true);
- assertThat(action.supports(issue)).isTrue();
- }
-
- @Test
- public void test_equals_and_hashCode() throws Exception {
- Action t1 = new Action("link-to-jira");
- Action t2 = new Action("link-to-jira");
- Action t3 = new Action("comment");
-
- assertThat(t1).isEqualTo(t1);
- assertThat(t1).isEqualTo(t2);
- assertThat(t1).isNotEqualTo(t3);
-
- assertThat(t1.hashCode()).isEqualTo(t1.hashCode());
- }
-
- @Test
- public void test_toString() throws Exception {
- Action t1 = new Action("link-to-jira");
- assertThat(t1.toString()).isEqualTo("link-to-jira");
- }
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/issue/action/ActionsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/issue/action/ActionsTest.java
deleted file mode 100644
index 522ebbac329..00000000000
--- a/sonar-plugin-api/src/test/java/org/sonar/api/issue/action/ActionsTest.java
+++ /dev/null
@@ -1,36 +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.api.issue.action;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class ActionsTest {
-
- @Test
- public void add_action() {
- Actions actions = new Actions();
- actions.add("assign");
-
- assertThat(actions.list()).hasSize(1);
- }
-
-}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/mediumtest/tasks/TasksMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/mediumtest/tasks/TasksMediumTest.java
index 766e9371898..0918a21db03 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/batch/mediumtest/tasks/TasksMediumTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/mediumtest/tasks/TasksMediumTest.java
@@ -28,7 +28,6 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.sonar.api.SonarPlugin;
-import org.sonar.api.issue.action.Actions;
import org.sonar.api.task.Task;
import org.sonar.api.task.TaskDefinition;
import org.sonar.api.utils.MessageException;
@@ -106,18 +105,6 @@ public class TasksMediumTest {
.start();
}
- private void startServer(Integer responseStatus, String responseData) throws Exception {
- server = new MockHttpServer();
- server.start();
-
- if (responseStatus != null) {
- server.setMockResponseStatus(responseStatus);
- }
- if (responseData != null) {
- server.setMockResponseData(responseData);
- }
- }
-
private static class FakeTaskPlugin extends SonarPlugin {
@Override
@@ -142,17 +129,10 @@ public class TasksMediumTest {
private static class BrokenTask implements Task {
public static final TaskDefinition DEF = TaskDefinition.builder().key("broken").description("Broken description").taskClass(BrokenTask.class).build();
- private final Actions serverSideComponent;
-
- public BrokenTask(Actions serverSideComponent) {
- this.serverSideComponent = serverSideComponent;
- }
@Override
public void execute() {
- System.out.println(serverSideComponent.list());
- ;
-
+ // do nothing
}
}