aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2013-06-03 15:42:55 +0200
committerJulien Lancelot <julien.lancelot@gmail.com>2013-06-03 15:42:55 +0200
commit96a2e77ad59364031ec7689b2c1f0ed036ec6ef7 (patch)
tree185d4be45ab531e05e63740c561cab94e94c9a94 /sonar-plugin-api/src
parent990b1e27db1745961a5595f911948e5f1d08fb77 (diff)
downloadsonarqube-96a2e77ad59364031ec7689b2c1f0ed036ec6ef7.tar.gz
sonarqube-96a2e77ad59364031ec7689b2c1f0ed036ec6ef7.zip
SONAR-3755 Manage errors from actions and transitions
Diffstat (limited to 'sonar-plugin-api/src')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/issue/condition/IsUnResolved.java (renamed from sonar-plugin-api/src/main/java/org/sonar/api/workflow/Comment.java)19
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/workflow/MutableReview.java45
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/workflow/Review.java83
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/workflow/WorkflowContext.java48
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/AdminRoleCondition.java44
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/Condition.java59
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/Conditions.java59
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/HasProjectPropertyCondition.java51
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/HasReviewPropertyCondition.java52
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/NotCondition.java51
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/ProjectPropertyCondition.java42
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/ResolutionCondition.java61
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/StatusCondition.java61
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/package-info.java23
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/workflow/internal/DefaultComment.java60
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/workflow/internal/DefaultReview.java215
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/workflow/internal/DefaultWorkflowContext.java109
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/workflow/internal/package-info.java31
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/workflow/package-info.java24
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/workflow/screen/CommentScreen.java38
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/workflow/screen/Screen.java54
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/workflow/screen/package-info.java23
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/issue/condition/HasResolutionTest.java5
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/issue/condition/IsUnResolvedTest.java (renamed from sonar-plugin-api/src/test/java/org/sonar/api/workflow/screen/CommentScreenTest.java)20
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/AdminRoleConditionTest.java44
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/ConditionTest.java51
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/ConditionsTest.java68
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/HasProjectPropertyConditionTest.java63
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/HasReviewPropertyConditionTest.java62
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/NotConditionTest.java53
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/ProjectPropertyConditionTest.java57
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/ResolutionConditionTest.java61
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/StatusConditionTest.java62
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/workflow/internal/DefaultReviewTest.java37
34 files changed, 21 insertions, 1814 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/Comment.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/condition/IsUnResolved.java
index c7d032b896f..ed181fb8290 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/Comment.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/condition/IsUnResolved.java
@@ -17,20 +17,17 @@
* 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.workflow;
+package org.sonar.api.issue.condition;
-import com.google.common.annotations.Beta;
+import org.sonar.api.issue.Issue;
/**
- * @since 3.1
+ * @since 3.6
*/
-@Beta
-public interface Comment {
- String getMarkdownText();
+public class IsUnResolved implements Condition {
- Long getUserId();
-
- Comment setMarkdownText(String s);
-
- Comment setUserId(Long l);
+ @Override
+ public boolean matches(Issue issue) {
+ return issue.resolution() == null;
+ }
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/MutableReview.java b/sonar-plugin-api/src/main/java/org/sonar/api/workflow/MutableReview.java
deleted file mode 100644
index 9a0f7e25fd5..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/MutableReview.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow;
-
-import com.google.common.annotations.Beta;
-
-import javax.annotation.Nullable;
-import java.util.List;
-
-/**
- * Review that can be changed by functions. It does not support (yet) changes
- * on creation date, author, severity, existing comments or switched-off attribute.
- *
- * @since 3.1
- */
-@Beta
-public interface MutableReview extends Review {
-
- MutableReview setStatus(String s);
-
- MutableReview setResolution(@Nullable String resolution);
-
- MutableReview setProperty(String key, @Nullable String value);
-
- Comment createComment();
-
- List<Comment> getNewComments();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/Review.java b/sonar-plugin-api/src/main/java/org/sonar/api/workflow/Review.java
deleted file mode 100644
index f9fa9046292..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/Review.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow;
-
-import com.google.common.annotations.Beta;
-
-import java.util.Map;
-
-/**
- * @since 3.1
- */
-@Beta
-public interface Review {
-
- /**
- * This method will probably be removed in order to decrease
- * coupling with database.
- *
- * @return not-null review id (primary key of the table REVIEWS).
- */
- Long getReviewId();
-
- /**
- * @return not-null rule repository, for example "checkstyle"
- */
- String getRuleRepositoryKey();
-
- /**
- * @return not-null rule key
- */
- String getRuleKey();
-
- /**
- * @return not-null rule name, in English.
- */
- String getRuleName();
-
- boolean isSwitchedOff();
-
- String getMessage();
-
- /**
- * @return not-null properties
- */
- Map<String, String> getProperties();
-
- String getStatus();
-
- String getResolution();
-
- /**
- * @return not-null severity, from INFO to BLOCKER
- */
- String getSeverity();
-
- /**
- * @return optional line, starting from 1
- */
- Long getLine();
-
- /**
- * @return true if the violation has been created by an automated rule engine,
- * false if created by an end-user.
- */
- boolean isManual();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/WorkflowContext.java b/sonar-plugin-api/src/main/java/org/sonar/api/workflow/WorkflowContext.java
deleted file mode 100644
index c643de96a01..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/WorkflowContext.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow;
-
-import com.google.common.annotations.Beta;
-import org.sonar.api.config.Settings;
-
-/**
- * @since 3.1
- */
-@Beta
-public interface WorkflowContext {
-
- /**
- * TODO : to be replaced by getProjectKey()
- */
- Long getProjectId();
-
- Long getUserId();
-
- String getUserLogin();
-
- String getUserName();
-
- String getUserEmail();
-
- boolean isAdmin();
-
- Settings getProjectSettings();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/AdminRoleCondition.java b/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/AdminRoleCondition.java
deleted file mode 100644
index 9b7fd482094..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/AdminRoleCondition.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow.condition;
-
-import com.google.common.annotations.Beta;
-import org.sonar.api.workflow.Review;
-import org.sonar.api.workflow.WorkflowContext;
-
-import javax.annotation.Nullable;
-
-/**
- * Checks that user has admin rights on project.
- *
- * @since 3.1
- */
-@Beta
-public final class AdminRoleCondition extends Condition {
-
- public AdminRoleCondition() {
- super(true);
- }
-
- @Override
- public boolean doVerify(@Nullable Review review, WorkflowContext context) {
- return context.isAdmin();
- }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/Condition.java b/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/Condition.java
deleted file mode 100644
index 0d72044a7c7..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/Condition.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow.condition;
-
-import com.google.common.annotations.Beta;
-import org.sonar.api.workflow.Review;
-import org.sonar.api.workflow.WorkflowContext;
-
-import javax.annotation.Nullable;
-
-/**
- * Conditions control who can perform a command (i.e. who can see the screen
- * associated to the command).
- *
- * @since 3.1
- */
-@Beta
-public abstract class Condition {
-
- private final boolean onContext;
-
- protected Condition(boolean onContext) {
- this.onContext = onContext;
- }
-
- /**
- * @return true if the condition relates to a review, false if it relates to the resource
- * context (selected file, end-user, ...)
- */
- public final boolean isOnContext() {
- return onContext;
- }
-
- /**
- * @param review the review on "review conditions" like StatusCondition, null on "context conditions"
- * like AdminRoleCondition or ProjectPropertyCondition
- * @param context
- * @return is the condition verified ?
- */
- public abstract boolean doVerify(@Nullable Review review, WorkflowContext context);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/Conditions.java b/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/Conditions.java
deleted file mode 100644
index 2edb0964952..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/Conditions.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow.condition;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Static utility methods pertaining to {@link Condition} instances.
- *
- * @since 3.1
- */
-@Beta
-public final class Conditions {
-
- private Conditions() {
- }
-
- public static Condition not(Condition c) {
- return new NotCondition(c);
- }
-
- public static Condition hasReviewProperty(String propertyKey) {
- return new HasReviewPropertyCondition(propertyKey);
- }
-
- public static Condition hasProjectProperty(String propertyKey) {
- return new HasProjectPropertyCondition(propertyKey);
- }
-
- public static Condition hasAdminRole() {
- return new AdminRoleCondition();
- }
-
- public static Condition statuses(String... statuses) {
- return new StatusCondition(statuses);
- }
-
- public static Condition resolutions(String... resolutions) {
- return new ResolutionCondition(resolutions);
- }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/HasProjectPropertyCondition.java b/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/HasProjectPropertyCondition.java
deleted file mode 100644
index b0275edef18..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/HasProjectPropertyCondition.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow.condition;
-
-import com.google.common.annotations.Beta;
-import org.sonar.api.config.Settings;
-import org.sonar.api.workflow.Review;
-import org.sonar.api.workflow.WorkflowContext;
-
-import javax.annotation.Nullable;
-
-/**
- * Checks that a project property is set, whatever its value.
- *
- * @since 3.1
- */
-@Beta
-public final class HasProjectPropertyCondition extends ProjectPropertyCondition {
-
- public HasProjectPropertyCondition(String propertyKey) {
- super(propertyKey);
- }
-
- @Override
- public boolean doVerify(@Nullable Review review, WorkflowContext context) {
- Settings settings = context.getProjectSettings();
- return settings.hasKey(getPropertyKey()) || settings.getDefaultValue(getPropertyKey()) != null;
- }
-
- @Override
- public String toString() {
- return "Property " + getPropertyKey() + " must be set";
- }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/HasReviewPropertyCondition.java b/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/HasReviewPropertyCondition.java
deleted file mode 100644
index f33202085b8..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/HasReviewPropertyCondition.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow.condition;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
-import org.sonar.api.workflow.Review;
-import org.sonar.api.workflow.WorkflowContext;
-
-import javax.annotation.Nullable;
-
-/**
- * @since 3.1
- */
-@Beta
-public final class HasReviewPropertyCondition extends Condition {
-
- private final String propertyKey;
-
- public HasReviewPropertyCondition(String propertyKey) {
- super(false);
- Preconditions.checkArgument(!Strings.isNullOrEmpty(propertyKey));
- this.propertyKey = propertyKey;
- }
-
- public String getPropertyKey() {
- return propertyKey;
- }
-
- @Override
- public boolean doVerify(@Nullable Review review, WorkflowContext context) {
- return review != null && !Strings.isNullOrEmpty(review.getProperties().get(propertyKey));
- }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/NotCondition.java b/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/NotCondition.java
deleted file mode 100644
index bb5525392c7..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/NotCondition.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow.condition;
-
-import com.google.common.annotations.Beta;
-import com.google.common.annotations.VisibleForTesting;
-import org.sonar.api.workflow.Review;
-import org.sonar.api.workflow.WorkflowContext;
-
-import javax.annotation.Nullable;
-
-/**
- * @since 3.1
- */
-@Beta
-public final class NotCondition extends Condition {
-
- private Condition condition;
-
- public NotCondition(Condition c) {
- super(c.isOnContext());
- this.condition = c;
- }
-
- @Override
- public boolean doVerify(@Nullable Review review, WorkflowContext context) {
- return !condition.doVerify(review, context);
- }
-
- @VisibleForTesting
- Condition getCondition() {
- return condition;
- }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/ProjectPropertyCondition.java b/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/ProjectPropertyCondition.java
deleted file mode 100644
index 8fc7f46e79a..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/ProjectPropertyCondition.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow.condition;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
-
-/**
- * @since 3.1
- */
-@Beta
-public abstract class ProjectPropertyCondition extends Condition {
- private final String propertyKey;
-
- protected ProjectPropertyCondition(String propertyKey) {
- super(true);
- Preconditions.checkArgument(!Strings.isNullOrEmpty(propertyKey));
- this.propertyKey = propertyKey;
- }
-
- public final String getPropertyKey() {
- return propertyKey;
- }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/ResolutionCondition.java b/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/ResolutionCondition.java
deleted file mode 100644
index 572aaa4b452..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/ResolutionCondition.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow.condition;
-
-import com.google.common.annotations.Beta;
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
-import org.sonar.api.workflow.Review;
-import org.sonar.api.workflow.WorkflowContext;
-
-import javax.annotation.Nullable;
-import java.util.Arrays;
-import java.util.Set;
-
-/**
- * @since 3.1
- */
-@Beta
-public final class ResolutionCondition extends Condition {
- private final Set<String> resolutions;
-
- public ResolutionCondition(Set<String> resolutions) {
- super(false);
- Preconditions.checkNotNull(resolutions);
- Preconditions.checkArgument(!resolutions.isEmpty(), "No resolutions defined");
- this.resolutions = resolutions;
- }
-
- public ResolutionCondition(String... resolutions) {
- this(Sets.newLinkedHashSet(Arrays.asList(resolutions)));
- }
-
- @Override
- public boolean doVerify(@Nullable Review review, WorkflowContext context) {
- return review != null && resolutions.contains(review.getResolution());
- }
-
- @VisibleForTesting
- Set<String> getResolutions() {
- return ImmutableSet.copyOf(resolutions);
- }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/StatusCondition.java b/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/StatusCondition.java
deleted file mode 100644
index c1f7e6632c2..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/StatusCondition.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow.condition;
-
-import com.google.common.annotations.Beta;
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
-import org.sonar.api.workflow.Review;
-import org.sonar.api.workflow.WorkflowContext;
-
-import javax.annotation.Nullable;
-import java.util.Arrays;
-import java.util.Set;
-
-/**
- * @since 3.1
- */
-@Beta
-public final class StatusCondition extends Condition {
- private final Set<String> statuses;
-
- public StatusCondition(Set<String> statuses) {
- super(false);
- Preconditions.checkNotNull(statuses);
- Preconditions.checkArgument(!statuses.isEmpty(), "No statuses defined");
- this.statuses = statuses;
- }
-
- public StatusCondition(String... statuses) {
- this(Sets.newLinkedHashSet(Arrays.asList(statuses)));
- }
-
- @Override
- public boolean doVerify(@Nullable Review review, WorkflowContext context) {
- return review != null && statuses.contains(review.getStatus());
- }
-
- @VisibleForTesting
- Set<String> getStatuses() {
- return ImmutableSet.copyOf(statuses);
- }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/package-info.java
deleted file mode 100644
index b9b583feb2c..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/condition/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.
- */
-@ParametersAreNonnullByDefault
-package org.sonar.api.workflow.condition;
-
-import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/internal/DefaultComment.java b/sonar-plugin-api/src/main/java/org/sonar/api/workflow/internal/DefaultComment.java
deleted file mode 100644
index 8e14abfeba4..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/internal/DefaultComment.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow.internal;
-
-import com.google.common.annotations.Beta;
-import org.apache.commons.lang.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
-import org.sonar.api.workflow.Comment;
-
-/**
- * @since 3.1
- */
-@Beta
-public final class DefaultComment implements Comment {
- private String markdownText;
- private Long userId;
-
- DefaultComment() {
- }
-
- public String getMarkdownText() {
- return markdownText;
- }
-
- public DefaultComment setMarkdownText(String s) {
- this.markdownText = s;
- return this;
- }
-
- public Long getUserId() {
- return userId;
- }
-
- public DefaultComment setUserId(Long l) {
- this.userId = l;
- return this;
- }
-
- @Override
- public String toString() {
- return new ReflectionToStringBuilder(this, ToStringStyle.SIMPLE_STYLE).toString();
- }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/internal/DefaultReview.java b/sonar-plugin-api/src/main/java/org/sonar/api/workflow/internal/DefaultReview.java
deleted file mode 100644
index 5d334877649..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/internal/DefaultReview.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow.internal;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import org.apache.commons.lang.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
-import org.sonar.api.workflow.Comment;
-import org.sonar.api.workflow.MutableReview;
-import org.sonar.api.utils.KeyValueFormat;
-
-import javax.annotation.Nullable;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @since 3.1
- */
-@Beta
-public final class DefaultReview implements MutableReview {
-
- private Long violationId;
- private Long reviewId;
- private String ruleRepositoryKey;
- private String ruleKey;
- private String ruleName;
- private Long line;
- private boolean switchedOff = false;
- private boolean manual = false;
- private String message;
- private String status;
- private String resolution;
- private String severity;
- private Map<String, String> properties;
- private List<Comment> newComments;
-
- public Long getViolationId() {
- return violationId;
- }
-
- public DefaultReview setViolationId(Long violationId) {
- this.violationId = violationId;
- return this;
- }
-
- public Long getReviewId() {
- return reviewId;
- }
-
- public DefaultReview setReviewId(Long reviewId) {
- this.reviewId = reviewId;
- return this;
- }
-
- public String getRuleRepositoryKey() {
- return ruleRepositoryKey;
- }
-
- public DefaultReview setRuleRepositoryKey(String s) {
- this.ruleRepositoryKey = s;
- return this;
- }
-
- public String getRuleKey() {
- return ruleKey;
- }
-
- public DefaultReview setRuleKey(String s) {
- this.ruleKey = s;
- return this;
- }
-
- public String getRuleName() {
- return ruleName;
- }
-
- public DefaultReview setRuleName(String s) {
- this.ruleName = s;
- return this;
- }
-
- public Long getLine() {
- return line;
- }
-
- public DefaultReview setLine(Long line) {
- this.line = line;
- return this;
- }
-
- public boolean isSwitchedOff() {
- return switchedOff;
- }
-
- public DefaultReview setSwitchedOff(boolean b) {
- this.switchedOff = b;
- return this;
- }
-
- public boolean isManual() {
- return manual;
- }
-
- public DefaultReview setManual(boolean manual) {
- this.manual = manual;
- return this;
- }
-
- public String getMessage() {
- return message;
- }
-
- public DefaultReview setMessage(String message) {
- this.message = message;
- return this;
- }
-
- public String getStatus() {
- return status;
- }
-
- public DefaultReview setStatus(String s) {
- Preconditions.checkArgument(!Strings.isNullOrEmpty(s));
- this.status = s;
- return this;
- }
-
- public String getResolution() {
- return resolution;
- }
-
- public DefaultReview setResolution(@Nullable String s) {
- this.resolution = s;
- return this;
- }
-
- public String getSeverity() {
- return severity;
- }
-
- public DefaultReview setSeverity(String s) {
- Preconditions.checkArgument(!Strings.isNullOrEmpty(s));
- this.severity = s;
- return this;
- }
-
- public Map<String, String> getProperties() {
- if (properties == null) {
- return Collections.emptyMap();
- }
- return properties;
- }
-
- public DefaultReview setProperties(Map<String, String> properties) {
- this.properties = properties;
- return this;
- }
-
- public DefaultReview setPropertiesAsString(@Nullable String s) {
- this.properties = (s == null ? null : KeyValueFormat.parse(s));
- return this;
- }
-
- public Comment createComment() {
- if (newComments == null) {
- newComments = Lists.newArrayList();
- }
- Comment comment = new DefaultComment();
- newComments.add(comment);
- return comment;
- }
-
- public List<Comment> getNewComments() {
- if (newComments == null) {
- return Collections.emptyList();
- }
- return newComments;
- }
-
- public DefaultReview setProperty(String key, @Nullable String value) {
- if (properties == null) {
- // keeping entries ordered by key allows to have consistent behavior in unit tests
- properties = Maps.newLinkedHashMap();
- }
- properties.put(key, value);
- return this;
- }
-
- @Override
- public String toString() {
- return new ReflectionToStringBuilder(this, ToStringStyle.SIMPLE_STYLE).toString();
- }
-} \ No newline at end of file
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/internal/DefaultWorkflowContext.java b/sonar-plugin-api/src/main/java/org/sonar/api/workflow/internal/DefaultWorkflowContext.java
deleted file mode 100644
index 4796d29cfce..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/internal/DefaultWorkflowContext.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow.internal;
-
-import com.google.common.annotations.Beta;
-import org.apache.commons.lang.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
-import org.sonar.api.config.Settings;
-import org.sonar.api.workflow.WorkflowContext;
-
-/**
- * @since 3.1
- */
-@Beta
-public final class DefaultWorkflowContext implements WorkflowContext {
-
- private Long userId;
- private String userLogin;
- private String userName;
- private String userEmail;
- private boolean isAdmin = false;
- private Long projectId;
- private Settings settings;
-
- public Long getUserId() {
- return userId;
- }
-
- public DefaultWorkflowContext setUserId(Long l) {
- this.userId = l;
- return this;
- }
-
- public String getUserLogin() {
- return userLogin;
- }
-
- public DefaultWorkflowContext setUserLogin(String s) {
- this.userLogin = s;
- return this;
- }
-
- public String getUserName() {
- return userName;
- }
-
- public DefaultWorkflowContext setUserName(String s) {
- this.userName = s;
- return this;
- }
-
- public String getUserEmail() {
- return userEmail;
- }
-
- public DefaultWorkflowContext setUserEmail(String userEmail) {
- this.userEmail = userEmail;
- return this;
- }
-
- public boolean isAdmin() {
- return isAdmin;
- }
-
- public DefaultWorkflowContext setIsAdmin(boolean b) {
- isAdmin = b;
- return this;
- }
-
- public Long getProjectId() {
- return projectId;
- }
-
- public DefaultWorkflowContext setProjectId(Long l) {
- this.projectId = l;
- return this;
- }
-
- public Settings getProjectSettings() {
- return settings;
- }
-
- public DefaultWorkflowContext setSettings(Settings s) {
- this.settings = s;
- return this;
- }
-
- @Override
- public String toString() {
- return new ReflectionToStringBuilder(this, ToStringStyle.SIMPLE_STYLE).toString();
- }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/internal/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/workflow/internal/package-info.java
deleted file mode 100644
index 52219cfbec1..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/internal/package-info.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.
- */
-
-/**
- This package is not considered as API and future versions can break backward-compatibility.
- <p>
- It provides some classes that can be helpful for unit tests but must
- <b>ABSOLUTELY NOT</b> be used by plugins production code.
- </p>
- */
-@ParametersAreNonnullByDefault
-package org.sonar.api.workflow.internal;
-
-import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/workflow/package-info.java
deleted file mode 100644
index 64b31cee194..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.
- */
-
-@ParametersAreNonnullByDefault
-package org.sonar.api.workflow;
-
-import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/screen/CommentScreen.java b/sonar-plugin-api/src/main/java/org/sonar/api/workflow/screen/CommentScreen.java
deleted file mode 100644
index 4498cb9188d..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/screen/CommentScreen.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow.screen;
-
-/**
- * Form with only a textarea field to type a comment.
- */
-
-import com.google.common.annotations.Beta;
-
-/**
- * @since 3.1
- */
-@Beta
-public final class CommentScreen extends Screen {
-
- public CommentScreen() {
- super("comment");
- }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/screen/Screen.java b/sonar-plugin-api/src/main/java/org/sonar/api/workflow/screen/Screen.java
deleted file mode 100644
index 696f0ab06a5..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/screen/Screen.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow.screen;
-
-import com.google.common.annotations.Beta;
-
-/**
- * <h2>Localization</h2>
- * <p>At least two buttons must have labels :</p>
- * <ul>
- * <li>the button in the violation toolbar that displays the form screen. Key is 'reviews.command.<command_key>.button'.</li>
- * <li>the button in the form screen that submits the command. Key is 'reviews.command.<command_key>.submit'.</li>
- * </ul>
- * @since 3.1
- */
-@Beta
-public abstract class Screen {
- private final String key;
- private String commandKey;
-
- protected Screen(String key) {
- this.key = key;
- }
-
- public final String getKey() {
- return key;
- }
-
- public final String getCommandKey() {
- return commandKey;
- }
-
- public final Screen setCommandKey(String commandKey) {
- this.commandKey = commandKey;
- return this;
- }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/screen/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/workflow/screen/package-info.java
deleted file mode 100644
index e83da0e9545..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/workflow/screen/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.
- */
-@ParametersAreNonnullByDefault
-package org.sonar.api.workflow.screen;
-
-import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/issue/condition/HasResolutionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/issue/condition/HasResolutionTest.java
index c183f49e1ae..527a8aba400 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/issue/condition/HasResolutionTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/issue/condition/HasResolutionTest.java
@@ -20,6 +20,7 @@
package org.sonar.api.issue.condition;
import org.junit.Test;
+import org.sonar.api.issue.Issue;
import org.sonar.api.issue.internal.DefaultIssue;
import static org.fest.assertions.Assertions.assertThat;
@@ -30,13 +31,11 @@ public class HasResolutionTest {
@Test
public void should_match() throws Exception {
- HasResolution condition = new HasResolution("OPEN", "FIXED", "FALSE-POSITIVE");
+ HasResolution condition = new HasResolution(Issue.RESOLUTION_FIXED, Issue.RESOLUTION_FALSE_POSITIVE);
- assertThat(condition.matches(issue.setResolution("OPEN"))).isTrue();
assertThat(condition.matches(issue.setResolution("FIXED"))).isTrue();
assertThat(condition.matches(issue.setResolution("FALSE-POSITIVE"))).isTrue();
- assertThat(condition.matches(issue.setResolution("open"))).isFalse();
assertThat(condition.matches(issue.setResolution("Fixed"))).isFalse();
}
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/workflow/screen/CommentScreenTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/issue/condition/IsUnResolvedTest.java
index 6731a501fec..338e8c59942 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/workflow/screen/CommentScreenTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/issue/condition/IsUnResolvedTest.java
@@ -17,21 +17,23 @@
* 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.workflow.screen;
+
+package org.sonar.api.issue.condition;
import org.junit.Test;
+import org.sonar.api.issue.internal.DefaultIssue;
import static org.fest.assertions.Assertions.assertThat;
-public class CommentScreenTest {
- @Test
- public void testCommentScreen() {
- CommentScreen screen = new CommentScreen();
+public class IsUnResolvedTest {
- assertThat(screen.getKey()).isEqualTo("comment");
+ DefaultIssue issue = new DefaultIssue();
+
+ @Test
+ public void should_match() throws Exception {
+ IsUnResolved condition = new IsUnResolved();
- assertThat(screen.getCommandKey()).isNull();
- assertThat(screen.setCommandKey("create-jira-issue"));
- assertThat(screen.getCommandKey()).isEqualTo("create-jira-issue");
+ assertThat(condition.matches(issue)).isTrue();
+ assertThat(condition.matches(issue.setResolution("FIXED"))).isFalse();
}
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/AdminRoleConditionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/AdminRoleConditionTest.java
deleted file mode 100644
index 68bd741e272..00000000000
--- a/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/AdminRoleConditionTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow.condition;
-
-import org.junit.Test;
-import org.sonar.api.workflow.internal.DefaultReview;
-import org.sonar.api.workflow.internal.DefaultWorkflowContext;
-
-import static org.fest.assertions.Assertions.assertThat;
-
-public class AdminRoleConditionTest {
- @Test
- public void verifiedIfAdminRole() {
- AdminRoleCondition condition = new AdminRoleCondition();
- DefaultWorkflowContext context = new DefaultWorkflowContext();
- context.setIsAdmin(true);
- assertThat(condition.doVerify(new DefaultReview(), context)).isTrue();
- }
-
- @Test
- public void failIfNotAdminRole() {
- AdminRoleCondition condition = new AdminRoleCondition();
- DefaultWorkflowContext context = new DefaultWorkflowContext();
- context.setIsAdmin(false);
- assertThat(condition.doVerify(new DefaultReview(), context)).isFalse();
- }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/ConditionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/ConditionTest.java
deleted file mode 100644
index 493757e91dd..00000000000
--- a/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/ConditionTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow.condition;
-
-import org.junit.Test;
-import org.sonar.api.workflow.Review;
-import org.sonar.api.workflow.WorkflowContext;
-
-import static org.fest.assertions.Assertions.assertThat;
-
-public class ConditionTest {
- @Test
- public void checkedOncePerGroupOfReviews() {
- Condition condition = new Condition(true) {
- @Override
- public boolean doVerify(Review review, WorkflowContext context) {
- return false;
- }
- };
- assertThat(condition.isOnContext()).isTrue();
- }
-
- @Test
- public void checkedForEveryReview() {
- Condition condition = new Condition(false) {
- @Override
- public boolean doVerify(Review review, WorkflowContext context) {
- return false;
- }
- };
- assertThat(condition.isOnContext()).isFalse();
- }
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/ConditionsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/ConditionsTest.java
deleted file mode 100644
index edf9c90a17a..00000000000
--- a/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/ConditionsTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow.condition;
-
-import org.junit.Test;
-
-import static org.fest.assertions.Assertions.assertThat;
-
-public class ConditionsTest {
- @Test
- public void not() {
- StatusCondition target = new StatusCondition("OPEN");
- Condition not = Conditions.not(target);
- assertThat(not).isInstanceOf(NotCondition.class);
- assertThat(((NotCondition) not).getCondition()).isSameAs(target);
- }
-
- @Test
- public void hasReviewProperty() {
- Condition condition = Conditions.hasReviewProperty("foo");
- assertThat(condition).isInstanceOf(HasReviewPropertyCondition.class);
- assertThat(((HasReviewPropertyCondition) condition).getPropertyKey()).isEqualTo("foo");
- }
-
- @Test
- public void hasProjectProperty() {
- Condition condition = Conditions.hasProjectProperty("foo");
- assertThat(condition).isInstanceOf(HasProjectPropertyCondition.class);
- assertThat(((HasProjectPropertyCondition) condition).getPropertyKey()).isEqualTo("foo");
- }
-
- @Test
- public void hasAdminRole() {
- Condition condition = Conditions.hasAdminRole();
- assertThat(condition).isInstanceOf(AdminRoleCondition.class);
- }
-
- @Test
- public void statuses() {
- Condition condition = Conditions.statuses("OPEN", "CLOSED");
- assertThat(condition).isInstanceOf(StatusCondition.class);
- assertThat(((StatusCondition) condition).getStatuses()).containsOnly("OPEN", "CLOSED");
- }
-
- @Test
- public void resolutions() {
- Condition condition = Conditions.resolutions("", "RESOLVED");
- assertThat(condition).isInstanceOf(ResolutionCondition.class);
- assertThat(((ResolutionCondition) condition).getResolutions()).containsOnly("", "RESOLVED");
- }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/HasProjectPropertyConditionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/HasProjectPropertyConditionTest.java
deleted file mode 100644
index 37f9d9940c8..00000000000
--- a/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/HasProjectPropertyConditionTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow.condition;
-
-import org.junit.Test;
-import org.sonar.api.Properties;
-import org.sonar.api.Property;
-import org.sonar.api.config.PropertyDefinitions;
-import org.sonar.api.config.Settings;
-import org.sonar.api.workflow.internal.DefaultReview;
-import org.sonar.api.workflow.internal.DefaultWorkflowContext;
-
-import static org.fest.assertions.Assertions.assertThat;
-
-public class HasProjectPropertyConditionTest {
- @Test
- public void doVerify() {
- HasProjectPropertyCondition condition = new HasProjectPropertyCondition("jira.url");
- DefaultWorkflowContext context = new DefaultWorkflowContext();
- context.setSettings(new Settings().setProperty("jira.url", "http://jira"));
- assertThat(condition.doVerify(new DefaultReview(), context)).isTrue();
- }
-
- @Test
- public void missingProperty() {
- HasProjectPropertyCondition condition = new HasProjectPropertyCondition("jira.url");
- DefaultWorkflowContext context = new DefaultWorkflowContext();
- context.setSettings(new Settings());
- assertThat(condition.doVerify(new DefaultReview(), context)).isFalse();
- }
-
- @Test
- public void returnTrueIfDefaultValue() {
- HasProjectPropertyCondition condition = new HasProjectPropertyCondition("jira.url");
- DefaultWorkflowContext context = new DefaultWorkflowContext();
- context.setSettings(new Settings(new PropertyDefinitions().addComponent(WithDefaultValue.class)));
- assertThat(condition.doVerify(new DefaultReview(), context)).isTrue();
- }
-
- @Properties({
- @Property(key = "jira.url", name = "JIRA URL", defaultValue = "http://jira.com")
- })
- private static class WithDefaultValue {
-
- }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/HasReviewPropertyConditionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/HasReviewPropertyConditionTest.java
deleted file mode 100644
index 1263b6d3cbb..00000000000
--- a/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/HasReviewPropertyConditionTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow.condition;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.api.workflow.internal.DefaultReview;
-import org.sonar.api.workflow.internal.DefaultWorkflowContext;
-
-import static org.fest.assertions.Assertions.assertThat;
-
-public class HasReviewPropertyConditionTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Test
- public void doVerify() {
- HasReviewPropertyCondition condition = new HasReviewPropertyCondition("foo");
-
- DefaultWorkflowContext context = new DefaultWorkflowContext();
- assertThat(condition.doVerify(new DefaultReview(), context)).isFalse();
- assertThat(condition.doVerify(new DefaultReview().setProperty("foo", ""), context)).isFalse();
- assertThat(condition.doVerify(new DefaultReview().setProperty("foo", "bar"), context)).isTrue();
- }
-
- @Test
- public void getPropertyKey() {
- HasReviewPropertyCondition condition = new HasReviewPropertyCondition("foo");
- assertThat(condition.getPropertyKey()).isEqualTo("foo");
- }
-
- @Test
- public void failIfNullProperty() {
- thrown.expect(IllegalArgumentException.class);
- new HasReviewPropertyCondition(null);
- }
-
- @Test
- public void failIfEmptyProperty() {
- thrown.expect(IllegalArgumentException.class);
- new HasReviewPropertyCondition("");
- }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/NotConditionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/NotConditionTest.java
deleted file mode 100644
index 83f4eb7853c..00000000000
--- a/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/NotConditionTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow.condition;
-
-import org.junit.Test;
-import org.sonar.api.workflow.internal.DefaultReview;
-import org.sonar.api.workflow.internal.DefaultWorkflowContext;
-import org.sonar.api.workflow.Review;
-import org.sonar.api.workflow.WorkflowContext;
-
-import static org.fest.assertions.Assertions.assertThat;
-
-public class NotConditionTest {
- @Test
- public void doVerifyInverse() {
- Condition target = new TargetCondition(true);
- assertThat(new NotCondition(target).doVerify(new DefaultReview(), new DefaultWorkflowContext())).isFalse();
-
- target = new TargetCondition(false);
- assertThat(new NotCondition(target).doVerify(new DefaultReview(), new DefaultWorkflowContext())).isTrue();
- }
-
- private static class TargetCondition extends Condition {
- private boolean returns;
-
- private TargetCondition(boolean returns) {
- super(false);
- this.returns = returns;
- }
-
- @Override
- public boolean doVerify(Review review, WorkflowContext context) {
- return returns;
- }
- }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/ProjectPropertyConditionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/ProjectPropertyConditionTest.java
deleted file mode 100644
index 1b3ce5a58dd..00000000000
--- a/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/ProjectPropertyConditionTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow.condition;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.api.workflow.Review;
-import org.sonar.api.workflow.WorkflowContext;
-
-import javax.annotation.Nullable;
-
-import static org.fest.assertions.Assertions.assertThat;
-
-public class ProjectPropertyConditionTest {
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Test
- public void getPropertyKey() {
- ProjectPropertyCondition condition = new ProjectPropertyCondition("foo") {
- @Override
- public boolean doVerify(Review review, WorkflowContext context) {
- return false;
- }
- };
- assertThat(condition.getPropertyKey()).isEqualTo("foo");
- }
-
- @Test
- public void keyIsMandatory() {
- thrown.expect(IllegalArgumentException.class);
- new ProjectPropertyCondition(""){
- @Override
- public boolean doVerify(@Nullable Review review, WorkflowContext context) {
- return false;
- }
- };
- }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/ResolutionConditionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/ResolutionConditionTest.java
deleted file mode 100644
index caedc231ee1..00000000000
--- a/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/ResolutionConditionTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow.condition;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.api.workflow.Review;
-import org.sonar.api.workflow.internal.DefaultReview;
-import org.sonar.api.workflow.internal.DefaultWorkflowContext;
-
-import static org.fest.assertions.Assertions.assertThat;
-
-public class ResolutionConditionTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Test
- public void failIfNoResolution() {
- thrown.expect(IllegalArgumentException.class);
- new ResolutionCondition();
- }
-
- @Test
- public void getResolutions() {
- ResolutionCondition condition = new ResolutionCondition("", "RESOLVED");
- assertThat(condition.getResolutions()).containsOnly("", "RESOLVED");
- }
-
- @Test
- public void doVerify_review_has_resolution() {
- Condition condition = new ResolutionCondition("", "RESOLVED");
- Review review = new DefaultReview().setResolution("");
- assertThat(condition.doVerify(review, new DefaultWorkflowContext())).isTrue();
- }
-
- @Test
- public void doVerify_review_does_not_have_resolution() {
- Condition condition = new ResolutionCondition("", "RESOLVED");
- Review review = new DefaultReview().setResolution("OTHER");
- assertThat(condition.doVerify(review, new DefaultWorkflowContext())).isFalse();
- }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/StatusConditionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/StatusConditionTest.java
deleted file mode 100644
index 50bf96ba39e..00000000000
--- a/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/StatusConditionTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow.condition;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.api.workflow.Review;
-import org.sonar.api.workflow.internal.DefaultReview;
-import org.sonar.api.workflow.internal.DefaultWorkflowContext;
-
-import static org.fest.assertions.Assertions.assertThat;
-
-public class StatusConditionTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Test
- public void failIfNoStatus() {
- thrown.expect(IllegalArgumentException.class);
- new StatusCondition();
- }
-
-
- @Test
- public void getStatuses() {
- StatusCondition condition = new StatusCondition("OPEN", "CLOSED");
- assertThat(condition.getStatuses()).containsOnly("OPEN", "CLOSED");
- }
-
- @Test
- public void doVerify_review_has_status() {
- Condition condition = new StatusCondition("OPEN", "CLOSED");
- Review review = new DefaultReview().setStatus("CLOSED");
- assertThat(condition.doVerify(review, new DefaultWorkflowContext())).isTrue();
- }
-
- @Test
- public void doVerify_review_does_not_have_status() {
- Condition condition = new StatusCondition("OPEN", "CLOSED");
- Review review = new DefaultReview().setStatus("OTHER");
- assertThat(condition.doVerify(review, new DefaultWorkflowContext())).isFalse();
- }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/workflow/internal/DefaultReviewTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/workflow/internal/DefaultReviewTest.java
deleted file mode 100644
index 556e7efe36f..00000000000
--- a/sonar-plugin-api/src/test/java/org/sonar/api/workflow/internal/DefaultReviewTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.api.workflow.internal;
-
-import org.junit.Test;
-import org.sonar.api.workflow.MutableReview;
-
-import static org.fest.assertions.Assertions.assertThat;
-
-public class DefaultReviewTest {
- @Test
- public void createComment_keep_order() {
- MutableReview review = new DefaultReview();
- review.createComment().setMarkdownText("first");
- review.createComment().setMarkdownText("second");
- assertThat(review.getNewComments()).hasSize(2);
- assertThat(review.getNewComments().get(0).getMarkdownText()).isEqualTo("first");
- assertThat(review.getNewComments().get(1).getMarkdownText()).isEqualTo("second");
- }
-}