From d8a31bd9402b1063f77cb723f494ee330299a961 Mon Sep 17 00:00:00 2001 From: Tomas Bjerre Date: Fri, 31 Aug 2018 08:50:09 +0200 Subject: [PATCH] Updating fmt-plugin --- .travis.yml | 8 ++-- pom.xml | 4 +- .../se/bjurr/prnfb/http/ClientKeyStore.java | 4 +- .../java/se/bjurr/prnfb/http/UrlInvoker.java | 8 +--- .../listener/PrnfbPullRequestAction.java | 3 +- .../PrnfbPullRequestEventListener.java | 37 +++++++++---------- .../prnfb/presentation/ButtonServlet.java | 13 +++---- .../presentation/GlobalAdminServlet.java | 13 +++---- .../presentation/NotificationServlet.java | 9 ++--- .../presentation/SettingsDataServlet.java | 8 ++-- .../prnfb/presentation/dto/ButtonDTO.java | 7 +--- .../dto/ButtonFormElementDTO.java | 1 - .../presentation/dto/ButtonPressDTO.java | 1 - .../presentation/dto/NotificationDTO.java | 5 +-- .../dto/NotificationResponseDTO.java | 1 - .../presentation/dto/SettingsDataDTO.java | 1 - .../bjurr/prnfb/service/ButtonsService.java | 6 +-- .../se/bjurr/prnfb/service/PrnfbRenderer.java | 17 ++++----- .../prnfb/service/PrnfbRendererFactory.java | 1 - .../se/bjurr/prnfb/service/PrnfbVariable.java | 20 +++++----- .../prnfb/service/PrnfbVariableResolver.java | 10 ++--- .../bjurr/prnfb/service/SettingsService.java | 23 +++++------- .../bjurr/prnfb/service/UserCheckService.java | 14 +++---- .../bjurr/prnfb/service/VariablesContext.java | 10 ++--- .../se/bjurr/prnfb/settings/PrnfbButton.java | 4 +- .../settings/PrnfbButtonFormElement.java | 1 - .../prnfb/settings/PrnfbNotification.java | 8 ++-- .../settings/PrnfbNotificationBuilder.java | 4 +- .../prnfb/transformer/ButtonTransformer.java | 8 ++-- .../transformer/NotificationTransformer.java | 4 +- .../transformer/SettingsTransformer.java | 1 + .../bjurr/prnfb/http/ClientKeyStoreTest.java | 1 - .../se/bjurr/prnfb/http/UrlInvokerTest.java | 5 +-- .../PrnfbPullRequestEventListenerTest.java | 31 +++++++--------- .../prnfb/presentation/ButtonServletTest.java | 3 -- .../presentation/GlobalAdminServletTest.java | 8 ++-- .../presentation/NotificationServletTest.java | 6 +-- .../presentation/SettingsDataServletTest.java | 1 - .../prnfb/service/ButtonsServiceTest.java | 13 +++---- .../MockedEscalatedSecurityContext.java | 3 +- .../prnfb/service/PluginSettingsMap.java | 3 +- .../prnfb/service/PrnfbRendererTest.java | 21 +++++------ .../prnfb/service/PrnfbVariableTest.java | 19 ++++------ .../prnfb/service/SettingsServiceTest.java | 17 ++++----- .../prnfb/service/UserCheckServiceTest.java | 15 +++----- .../prnfb/service/VariablesContextTest.java | 17 ++++----- .../integration/PrnfbTestIntegration.java | 10 ++--- .../transformer/ButtonTransformerTest.java | 2 - .../NotificationTransformerTest.java | 4 +- .../SettingsDataTransformerTest.java | 1 - 50 files changed, 165 insertions(+), 269 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2844b5b5..3b89ff1e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,10 +7,10 @@ before_install: - ./setup-atlassian-sdk.sh `pwd` - export PATH=opt/atlassian-plugin-sdk/bin:opt/atlassian-plugin-sdk/apache-maven-*/bin:$PATH install: - - atlas-mvn -q install -Dbitbucket.version=5.1.0 - - atlas-mvn -q install + - atlas-mvn install -Dbitbucket.version=5.1.0 + - atlas-mvn install script: - - atlas-package -q -Dbitbucket.version=5.1.0 - - atlas-package -q + - atlas-package -Dbitbucket.version=5.1.0 + - atlas-package notifications: email: false diff --git a/pom.xml b/pom.xml index f770847a..dfa575bf 100644 --- a/pom.xml +++ b/pom.xml @@ -243,7 +243,7 @@ Changelog of Pull Request Notifier for Bitbucket. com.coveo fmt-maven-plugin - 1.3.0 + 2.5.1 @@ -327,7 +327,7 @@ Changelog of Pull Request Notifier for Bitbucket. - 5.7.0 + 5.13.1 ${bitbucket.version} 2.0.0 6.3.6 diff --git a/src/main/java/se/bjurr/prnfb/http/ClientKeyStore.java b/src/main/java/se/bjurr/prnfb/http/ClientKeyStore.java index 0cbe95fb..7c7f10c7 100644 --- a/src/main/java/se/bjurr/prnfb/http/ClientKeyStore.java +++ b/src/main/java/se/bjurr/prnfb/http/ClientKeyStore.java @@ -2,15 +2,13 @@ import static com.google.common.base.Optional.fromNullable; +import com.google.common.base.Optional; import java.io.File; import java.io.FileInputStream; import java.security.KeyStore; import java.security.KeyStoreException; - import se.bjurr.prnfb.settings.PrnfbSettingsData; -import com.google.common.base.Optional; - /** * A keystore based on the definition from the application properties.
*
diff --git a/src/main/java/se/bjurr/prnfb/http/UrlInvoker.java b/src/main/java/se/bjurr/prnfb/http/UrlInvoker.java index 13d71de4..13f55480 100644 --- a/src/main/java/se/bjurr/prnfb/http/UrlInvoker.java +++ b/src/main/java/se/bjurr/prnfb/http/UrlInvoker.java @@ -14,6 +14,8 @@ import static se.bjurr.prnfb.http.UrlInvoker.HTTP_METHOD.POST; import static se.bjurr.prnfb.http.UrlInvoker.HTTP_METHOD.PUT; +import com.google.common.annotations.VisibleForTesting; +import com.google.common.base.Optional; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; @@ -21,9 +23,7 @@ import java.net.URISyntaxException; import java.security.cert.X509Certificate; import java.util.List; - import javax.net.ssl.SSLContext; - import org.apache.http.HttpEntity; import org.apache.http.HttpHost; import org.apache.http.HttpVersion; @@ -49,10 +49,6 @@ import org.apache.http.ssl.TrustStrategy; import org.apache.http.util.EntityUtils; import org.slf4j.Logger; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Optional; - import se.bjurr.prnfb.settings.PrnfbHeader; import se.bjurr.prnfb.settings.PrnfbNotification; diff --git a/src/main/java/se/bjurr/prnfb/listener/PrnfbPullRequestAction.java b/src/main/java/se/bjurr/prnfb/listener/PrnfbPullRequestAction.java index f3fc1e62..2aef0883 100644 --- a/src/main/java/se/bjurr/prnfb/listener/PrnfbPullRequestAction.java +++ b/src/main/java/se/bjurr/prnfb/listener/PrnfbPullRequestAction.java @@ -1,9 +1,8 @@ package se.bjurr.prnfb.listener; -import se.bjurr.prnfb.settings.PrnfbNotification; - import com.atlassian.bitbucket.event.pull.PullRequestEvent; import com.atlassian.bitbucket.event.pull.PullRequestRescopedEvent; +import se.bjurr.prnfb.settings.PrnfbNotification; public enum PrnfbPullRequestAction { APPROVED, // diff --git a/src/main/java/se/bjurr/prnfb/listener/PrnfbPullRequestEventListener.java b/src/main/java/se/bjurr/prnfb/listener/PrnfbPullRequestEventListener.java index 43402db8..a404cb7f 100644 --- a/src/main/java/se/bjurr/prnfb/listener/PrnfbPullRequestEventListener.java +++ b/src/main/java/se/bjurr/prnfb/listener/PrnfbPullRequestEventListener.java @@ -13,26 +13,6 @@ import static se.bjurr.prnfb.settings.TRIGGER_IF_MERGE.CONFLICTING; import static se.bjurr.prnfb.settings.TRIGGER_IF_MERGE.NOT_CONFLICTING; -import java.util.concurrent.ExecutorService; - -import org.slf4j.Logger; - -import se.bjurr.prnfb.http.ClientKeyStore; -import se.bjurr.prnfb.http.HttpResponse; -import se.bjurr.prnfb.http.Invoker; -import se.bjurr.prnfb.http.NotificationResponse; -import se.bjurr.prnfb.http.UrlInvoker; -import se.bjurr.prnfb.service.PrnfbRenderer; -import se.bjurr.prnfb.service.PrnfbRenderer.ENCODE_FOR; -import se.bjurr.prnfb.service.PrnfbRendererFactory; -import se.bjurr.prnfb.service.SettingsService; -import se.bjurr.prnfb.service.VariablesContext; -import se.bjurr.prnfb.service.VariablesContext.VariablesContextBuilder; -import se.bjurr.prnfb.settings.PrnfbHeader; -import se.bjurr.prnfb.settings.PrnfbNotification; -import se.bjurr.prnfb.settings.PrnfbSettingsData; -import se.bjurr.prnfb.settings.TRIGGER_IF_MERGE; - import com.atlassian.bitbucket.ServiceException; import com.atlassian.bitbucket.event.pull.PullRequestCommentAddedEvent; import com.atlassian.bitbucket.event.pull.PullRequestCommentDeletedEvent; @@ -59,6 +39,23 @@ import com.atlassian.event.api.EventListener; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Optional; +import java.util.concurrent.ExecutorService; +import org.slf4j.Logger; +import se.bjurr.prnfb.http.ClientKeyStore; +import se.bjurr.prnfb.http.HttpResponse; +import se.bjurr.prnfb.http.Invoker; +import se.bjurr.prnfb.http.NotificationResponse; +import se.bjurr.prnfb.http.UrlInvoker; +import se.bjurr.prnfb.service.PrnfbRenderer; +import se.bjurr.prnfb.service.PrnfbRenderer.ENCODE_FOR; +import se.bjurr.prnfb.service.PrnfbRendererFactory; +import se.bjurr.prnfb.service.SettingsService; +import se.bjurr.prnfb.service.VariablesContext; +import se.bjurr.prnfb.service.VariablesContext.VariablesContextBuilder; +import se.bjurr.prnfb.settings.PrnfbHeader; +import se.bjurr.prnfb.settings.PrnfbNotification; +import se.bjurr.prnfb.settings.PrnfbSettingsData; +import se.bjurr.prnfb.settings.TRIGGER_IF_MERGE; public class PrnfbPullRequestEventListener { diff --git a/src/main/java/se/bjurr/prnfb/presentation/ButtonServlet.java b/src/main/java/se/bjurr/prnfb/presentation/ButtonServlet.java index e7120684..19457d84 100644 --- a/src/main/java/se/bjurr/prnfb/presentation/ButtonServlet.java +++ b/src/main/java/se/bjurr/prnfb/presentation/ButtonServlet.java @@ -2,20 +2,22 @@ import static com.google.common.base.Strings.isNullOrEmpty; import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.ok; -import static javax.ws.rs.core.Response.status; import static javax.ws.rs.core.Response.Status.NOT_FOUND; import static javax.ws.rs.core.Response.Status.OK; import static javax.ws.rs.core.Response.Status.UNAUTHORIZED; +import static javax.ws.rs.core.Response.ok; +import static javax.ws.rs.core.Response.status; import static se.bjurr.prnfb.transformer.ButtonTransformer.toButtonDto; import static se.bjurr.prnfb.transformer.ButtonTransformer.toButtonDtoList; import static se.bjurr.prnfb.transformer.ButtonTransformer.toPrnfbButton; import static se.bjurr.prnfb.transformer.ButtonTransformer.toTriggerResultDto; +import com.atlassian.annotations.security.XsrfProtectionExcluded; +import com.google.common.base.Optional; +import com.google.common.collect.Iterables; import java.util.Collections; import java.util.List; import java.util.UUID; - import javax.servlet.http.HttpServletRequest; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -26,7 +28,6 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; - import se.bjurr.prnfb.http.NotificationResponse; import se.bjurr.prnfb.presentation.dto.ButtonDTO; import se.bjurr.prnfb.presentation.dto.ButtonFormElementDTO; @@ -39,10 +40,6 @@ import se.bjurr.prnfb.settings.PrnfbButton; import se.bjurr.prnfb.settings.USER_LEVEL; -import com.atlassian.annotations.security.XsrfProtectionExcluded; -import com.google.common.base.Optional; -import com.google.common.collect.Iterables; - @Path("/settings/buttons") public class ButtonServlet { diff --git a/src/main/java/se/bjurr/prnfb/presentation/GlobalAdminServlet.java b/src/main/java/se/bjurr/prnfb/presentation/GlobalAdminServlet.java index 6fb96b8f..a1bb34c4 100644 --- a/src/main/java/se/bjurr/prnfb/presentation/GlobalAdminServlet.java +++ b/src/main/java/se/bjurr/prnfb/presentation/GlobalAdminServlet.java @@ -6,13 +6,6 @@ import static com.google.common.collect.ImmutableMap.of; import static com.google.common.collect.Maps.newHashMap; -import java.net.URI; -import java.util.Map; - -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import com.atlassian.bitbucket.project.Project; import com.atlassian.bitbucket.project.ProjectService; import com.atlassian.bitbucket.repository.Repository; @@ -23,7 +16,11 @@ import com.atlassian.templaterenderer.TemplateRenderer; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Optional; - +import java.net.URI; +import java.util.Map; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import se.bjurr.prnfb.service.UserCheckService; public class GlobalAdminServlet extends HttpServlet { diff --git a/src/main/java/se/bjurr/prnfb/presentation/NotificationServlet.java b/src/main/java/se/bjurr/prnfb/presentation/NotificationServlet.java index 9c8684f0..d966570f 100644 --- a/src/main/java/se/bjurr/prnfb/presentation/NotificationServlet.java +++ b/src/main/java/se/bjurr/prnfb/presentation/NotificationServlet.java @@ -2,18 +2,18 @@ import static com.google.common.base.Throwables.propagate; import static javax.ws.rs.core.MediaType.APPLICATION_JSON; -import static javax.ws.rs.core.Response.ok; -import static javax.ws.rs.core.Response.status; import static javax.ws.rs.core.Response.Status.OK; import static javax.ws.rs.core.Response.Status.UNAUTHORIZED; +import static javax.ws.rs.core.Response.ok; +import static javax.ws.rs.core.Response.status; import static se.bjurr.prnfb.transformer.NotificationTransformer.toNotificationDto; import static se.bjurr.prnfb.transformer.NotificationTransformer.toNotificationDtoList; import static se.bjurr.prnfb.transformer.NotificationTransformer.toPrnfbNotification; +import com.atlassian.annotations.security.XsrfProtectionExcluded; import java.util.Collections; import java.util.List; import java.util.UUID; - import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; @@ -22,15 +22,12 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.Response; - import se.bjurr.prnfb.presentation.dto.NotificationDTO; import se.bjurr.prnfb.service.SettingsService; import se.bjurr.prnfb.service.UserCheckService; import se.bjurr.prnfb.settings.PrnfbNotification; import se.bjurr.prnfb.settings.USER_LEVEL; -import com.atlassian.annotations.security.XsrfProtectionExcluded; - @Path("/settings/notifications") public class NotificationServlet { private final SettingsService settingsService; diff --git a/src/main/java/se/bjurr/prnfb/presentation/SettingsDataServlet.java b/src/main/java/se/bjurr/prnfb/presentation/SettingsDataServlet.java index b2b07d63..b30a7906 100644 --- a/src/main/java/se/bjurr/prnfb/presentation/SettingsDataServlet.java +++ b/src/main/java/se/bjurr/prnfb/presentation/SettingsDataServlet.java @@ -1,20 +1,21 @@ package se.bjurr.prnfb.presentation; import static javax.ws.rs.core.MediaType.APPLICATION_JSON; +import static javax.ws.rs.core.Response.Status.UNAUTHORIZED; import static javax.ws.rs.core.Response.noContent; import static javax.ws.rs.core.Response.ok; import static javax.ws.rs.core.Response.status; -import static javax.ws.rs.core.Response.Status.UNAUTHORIZED; import static se.bjurr.prnfb.transformer.SettingsTransformer.toDto; import static se.bjurr.prnfb.transformer.SettingsTransformer.toPrnfbSettingsData; +import com.atlassian.annotations.security.XsrfProtectionExcluded; +import com.google.common.base.Optional; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Response; - import se.bjurr.prnfb.presentation.dto.SettingsDataDTO; import se.bjurr.prnfb.service.SettingsService; import se.bjurr.prnfb.service.UserCheckService; @@ -22,9 +23,6 @@ import se.bjurr.prnfb.settings.Restricted; import se.bjurr.prnfb.settings.USER_LEVEL; -import com.atlassian.annotations.security.XsrfProtectionExcluded; -import com.google.common.base.Optional; - @Path("/settings") public class SettingsDataServlet { private final SettingsService settingsService; diff --git a/src/main/java/se/bjurr/prnfb/presentation/dto/ButtonDTO.java b/src/main/java/se/bjurr/prnfb/presentation/dto/ButtonDTO.java index 886254bd..40810e8d 100644 --- a/src/main/java/se/bjurr/prnfb/presentation/dto/ButtonDTO.java +++ b/src/main/java/se/bjurr/prnfb/presentation/dto/ButtonDTO.java @@ -2,17 +2,14 @@ import static javax.xml.bind.annotation.XmlAccessType.FIELD; +import com.google.common.base.Optional; +import com.google.gson.reflect.TypeToken; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.List; import java.util.UUID; - import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; - -import com.google.common.base.Optional; -import com.google.gson.reflect.TypeToken; - import se.bjurr.prnfb.settings.Restricted; import se.bjurr.prnfb.settings.USER_LEVEL; diff --git a/src/main/java/se/bjurr/prnfb/presentation/dto/ButtonFormElementDTO.java b/src/main/java/se/bjurr/prnfb/presentation/dto/ButtonFormElementDTO.java index accc8ccc..325a126f 100644 --- a/src/main/java/se/bjurr/prnfb/presentation/dto/ButtonFormElementDTO.java +++ b/src/main/java/se/bjurr/prnfb/presentation/dto/ButtonFormElementDTO.java @@ -3,7 +3,6 @@ import static javax.xml.bind.annotation.XmlAccessType.FIELD; import java.util.List; - import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; diff --git a/src/main/java/se/bjurr/prnfb/presentation/dto/ButtonPressDTO.java b/src/main/java/se/bjurr/prnfb/presentation/dto/ButtonPressDTO.java index 613bc6a7..a7a1a340 100644 --- a/src/main/java/se/bjurr/prnfb/presentation/dto/ButtonPressDTO.java +++ b/src/main/java/se/bjurr/prnfb/presentation/dto/ButtonPressDTO.java @@ -3,7 +3,6 @@ import static javax.xml.bind.annotation.XmlAccessType.FIELD; import java.util.List; - import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; diff --git a/src/main/java/se/bjurr/prnfb/presentation/dto/NotificationDTO.java b/src/main/java/se/bjurr/prnfb/presentation/dto/NotificationDTO.java index e54a5974..6e558827 100644 --- a/src/main/java/se/bjurr/prnfb/presentation/dto/NotificationDTO.java +++ b/src/main/java/se/bjurr/prnfb/presentation/dto/NotificationDTO.java @@ -2,14 +2,11 @@ import static javax.xml.bind.annotation.XmlAccessType.FIELD; +import com.google.common.base.Optional; import java.util.List; import java.util.UUID; - import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; - -import com.google.common.base.Optional; - import se.bjurr.prnfb.http.UrlInvoker.HTTP_METHOD; import se.bjurr.prnfb.service.PrnfbRenderer.ENCODE_FOR; import se.bjurr.prnfb.settings.Restricted; diff --git a/src/main/java/se/bjurr/prnfb/presentation/dto/NotificationResponseDTO.java b/src/main/java/se/bjurr/prnfb/presentation/dto/NotificationResponseDTO.java index 767fda44..81524d23 100644 --- a/src/main/java/se/bjurr/prnfb/presentation/dto/NotificationResponseDTO.java +++ b/src/main/java/se/bjurr/prnfb/presentation/dto/NotificationResponseDTO.java @@ -4,7 +4,6 @@ import java.net.URI; import java.util.UUID; - import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; diff --git a/src/main/java/se/bjurr/prnfb/presentation/dto/SettingsDataDTO.java b/src/main/java/se/bjurr/prnfb/presentation/dto/SettingsDataDTO.java index 244e3f16..6f03176d 100644 --- a/src/main/java/se/bjurr/prnfb/presentation/dto/SettingsDataDTO.java +++ b/src/main/java/se/bjurr/prnfb/presentation/dto/SettingsDataDTO.java @@ -4,7 +4,6 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; - import se.bjurr.prnfb.settings.USER_LEVEL; @XmlRootElement diff --git a/src/main/java/se/bjurr/prnfb/service/ButtonsService.java b/src/main/java/se/bjurr/prnfb/service/ButtonsService.java index e7ca30c3..6727af0d 100644 --- a/src/main/java/se/bjurr/prnfb/service/ButtonsService.java +++ b/src/main/java/se/bjurr/prnfb/service/ButtonsService.java @@ -6,14 +6,12 @@ import static java.lang.Boolean.TRUE; import static se.bjurr.prnfb.listener.PrnfbPullRequestAction.BUTTON_TRIGGER; -import java.util.List; -import java.util.UUID; - import com.atlassian.bitbucket.pull.PullRequest; import com.atlassian.bitbucket.pull.PullRequestService; import com.atlassian.bitbucket.repository.Repository; import com.google.common.annotations.VisibleForTesting; - +import java.util.List; +import java.util.UUID; import se.bjurr.prnfb.http.ClientKeyStore; import se.bjurr.prnfb.http.NotificationResponse; import se.bjurr.prnfb.listener.PrnfbPullRequestAction; diff --git a/src/main/java/se/bjurr/prnfb/service/PrnfbRenderer.java b/src/main/java/se/bjurr/prnfb/service/PrnfbRenderer.java index 60f328a9..578fca5f 100644 --- a/src/main/java/se/bjurr/prnfb/service/PrnfbRenderer.java +++ b/src/main/java/se/bjurr/prnfb/service/PrnfbRenderer.java @@ -9,25 +9,22 @@ import static se.bjurr.prnfb.service.PrnfbRenderer.ENCODE_FOR.URL; import static se.bjurr.prnfb.service.PrnfbVariable.EVERYTHING_URL; +import com.atlassian.bitbucket.pull.PullRequest; +import com.atlassian.bitbucket.repository.RepositoryService; +import com.atlassian.bitbucket.server.ApplicationPropertiesService; +import com.atlassian.bitbucket.user.ApplicationUser; +import com.atlassian.bitbucket.user.SecurityService; +import com.google.common.annotations.VisibleForTesting; +import com.google.common.base.Supplier; import java.io.UnsupportedEncodingException; import java.util.Map; import java.util.regex.Matcher; - import org.apache.commons.lang3.StringEscapeUtils; import org.slf4j.Logger; - import se.bjurr.prnfb.http.ClientKeyStore; import se.bjurr.prnfb.listener.PrnfbPullRequestAction; import se.bjurr.prnfb.settings.PrnfbNotification; -import com.atlassian.bitbucket.pull.PullRequest; -import com.atlassian.bitbucket.repository.RepositoryService; -import com.atlassian.bitbucket.server.ApplicationPropertiesService; -import com.atlassian.bitbucket.user.ApplicationUser; -import com.atlassian.bitbucket.user.SecurityService; -import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Supplier; - public class PrnfbRenderer { public enum ENCODE_FOR { NONE, diff --git a/src/main/java/se/bjurr/prnfb/service/PrnfbRendererFactory.java b/src/main/java/se/bjurr/prnfb/service/PrnfbRendererFactory.java index 85dc14c6..04c287a0 100644 --- a/src/main/java/se/bjurr/prnfb/service/PrnfbRendererFactory.java +++ b/src/main/java/se/bjurr/prnfb/service/PrnfbRendererFactory.java @@ -6,7 +6,6 @@ import com.atlassian.bitbucket.server.ApplicationPropertiesService; import com.atlassian.bitbucket.user.ApplicationUser; import com.atlassian.bitbucket.user.SecurityService; - import se.bjurr.prnfb.http.ClientKeyStore; import se.bjurr.prnfb.listener.PrnfbPullRequestAction; import se.bjurr.prnfb.settings.PrnfbNotification; diff --git a/src/main/java/se/bjurr/prnfb/service/PrnfbVariable.java b/src/main/java/se/bjurr/prnfb/service/PrnfbVariable.java index 0360cd88..8eeb4f8d 100644 --- a/src/main/java/se/bjurr/prnfb/service/PrnfbVariable.java +++ b/src/main/java/se/bjurr/prnfb/service/PrnfbVariable.java @@ -10,20 +10,11 @@ import static com.google.common.collect.Ordering.usingToString; import static com.google.common.collect.Sets.newTreeSet; import static java.util.regex.Pattern.compile; -import static se.bjurr.prnfb.http.UrlInvoker.urlInvoker; import static se.bjurr.prnfb.http.UrlInvoker.HTTP_METHOD.GET; +import static se.bjurr.prnfb.http.UrlInvoker.urlInvoker; import static se.bjurr.prnfb.service.RepoProtocol.http; import static se.bjurr.prnfb.service.RepoProtocol.ssh; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.regex.Matcher; - import com.atlassian.bitbucket.permission.Permission; import com.atlassian.bitbucket.pull.PullRequest; import com.atlassian.bitbucket.pull.PullRequestParticipant; @@ -39,7 +30,14 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Predicate; import com.google.common.base.Supplier; - +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.regex.Matcher; import se.bjurr.prnfb.http.ClientKeyStore; import se.bjurr.prnfb.http.HttpResponse; import se.bjurr.prnfb.http.Invoker; diff --git a/src/main/java/se/bjurr/prnfb/service/PrnfbVariableResolver.java b/src/main/java/se/bjurr/prnfb/service/PrnfbVariableResolver.java index f1aed034..6107538c 100644 --- a/src/main/java/se/bjurr/prnfb/service/PrnfbVariableResolver.java +++ b/src/main/java/se/bjurr/prnfb/service/PrnfbVariableResolver.java @@ -1,17 +1,15 @@ package se.bjurr.prnfb.service; -import java.util.Map; - -import se.bjurr.prnfb.http.ClientKeyStore; -import se.bjurr.prnfb.listener.PrnfbPullRequestAction; -import se.bjurr.prnfb.settings.PrnfbNotification; - import com.atlassian.bitbucket.pull.PullRequest; import com.atlassian.bitbucket.repository.RepositoryService; import com.atlassian.bitbucket.server.ApplicationPropertiesService; import com.atlassian.bitbucket.user.ApplicationUser; import com.atlassian.bitbucket.user.SecurityService; import com.google.common.base.Supplier; +import java.util.Map; +import se.bjurr.prnfb.http.ClientKeyStore; +import se.bjurr.prnfb.listener.PrnfbPullRequestAction; +import se.bjurr.prnfb.settings.PrnfbNotification; public interface PrnfbVariableResolver { diff --git a/src/main/java/se/bjurr/prnfb/service/SettingsService.java b/src/main/java/se/bjurr/prnfb/service/SettingsService.java index da12c42d..512f5017 100644 --- a/src/main/java/se/bjurr/prnfb/service/SettingsService.java +++ b/src/main/java/se/bjurr/prnfb/service/SettingsService.java @@ -13,12 +13,20 @@ import static se.bjurr.prnfb.settings.PrnfbSettingsBuilder.prnfbSettingsBuilder; import static se.bjurr.prnfb.settings.PrnfbSettingsDataBuilder.prnfbSettingsDataBuilder; +import com.atlassian.bitbucket.user.SecurityService; +import com.atlassian.bitbucket.util.Operation; +import com.atlassian.sal.api.pluginsettings.PluginSettings; +import com.atlassian.sal.api.pluginsettings.PluginSettingsFactory; +import com.atlassian.sal.api.transaction.TransactionCallback; +import com.atlassian.sal.api.transaction.TransactionTemplate; +import com.google.common.annotations.VisibleForTesting; +import com.google.common.base.Optional; +import com.google.common.base.Predicate; +import com.google.gson.Gson; import java.util.List; import java.util.UUID; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import se.bjurr.prnfb.settings.HasUuid; import se.bjurr.prnfb.settings.PrnfbButton; import se.bjurr.prnfb.settings.PrnfbNotification; @@ -27,17 +35,6 @@ import se.bjurr.prnfb.settings.USER_LEVEL; import se.bjurr.prnfb.settings.ValidationException; -import com.atlassian.bitbucket.user.SecurityService; -import com.atlassian.bitbucket.util.Operation; -import com.atlassian.sal.api.pluginsettings.PluginSettings; -import com.atlassian.sal.api.pluginsettings.PluginSettingsFactory; -import com.atlassian.sal.api.transaction.TransactionCallback; -import com.atlassian.sal.api.transaction.TransactionTemplate; -import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Optional; -import com.google.common.base.Predicate; -import com.google.gson.Gson; - public class SettingsService { public static final String STORAGE_KEY = "se.bjurr.prnfb.pull-request-notifier-for-bitbucket-3"; diff --git a/src/main/java/se/bjurr/prnfb/service/UserCheckService.java b/src/main/java/se/bjurr/prnfb/service/UserCheckService.java index de5bf954..799af15b 100644 --- a/src/main/java/se/bjurr/prnfb/service/UserCheckService.java +++ b/src/main/java/se/bjurr/prnfb/service/UserCheckService.java @@ -9,15 +9,6 @@ import static se.bjurr.prnfb.settings.USER_LEVEL.ADMIN; import static se.bjurr.prnfb.settings.USER_LEVEL.EVERYONE; -import java.util.List; - -import javax.annotation.Nullable; - -import org.slf4j.Logger; - -import se.bjurr.prnfb.settings.Restricted; -import se.bjurr.prnfb.settings.USER_LEVEL; - import com.atlassian.bitbucket.permission.PermissionService; import com.atlassian.bitbucket.project.Project; import com.atlassian.bitbucket.project.ProjectService; @@ -29,6 +20,11 @@ import com.atlassian.sal.api.user.UserManager; import com.atlassian.sal.api.user.UserProfile; import com.google.common.annotations.VisibleForTesting; +import java.util.List; +import javax.annotation.Nullable; +import org.slf4j.Logger; +import se.bjurr.prnfb.settings.Restricted; +import se.bjurr.prnfb.settings.USER_LEVEL; public class UserCheckService { private static final Logger LOG = getLogger(UserCheckService.class); diff --git a/src/main/java/se/bjurr/prnfb/service/VariablesContext.java b/src/main/java/se/bjurr/prnfb/service/VariablesContext.java index 76944e52..935010f8 100644 --- a/src/main/java/se/bjurr/prnfb/service/VariablesContext.java +++ b/src/main/java/se/bjurr/prnfb/service/VariablesContext.java @@ -11,12 +11,6 @@ import static se.bjurr.prnfb.service.PrnfbVariable.PULL_REQUEST_PREVIOUS_TO_HASH; import static se.bjurr.prnfb.service.PrnfbVariable.PULL_REQUEST_USER_GROUPS; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import se.bjurr.prnfb.settings.PrnfbButton; - import com.atlassian.bitbucket.event.pull.PullRequestCommentEvent; import com.atlassian.bitbucket.event.pull.PullRequestEvent; import com.atlassian.bitbucket.event.pull.PullRequestMergedEvent; @@ -24,6 +18,10 @@ import com.google.common.base.Joiner; import com.google.common.base.Supplier; import com.google.common.base.Suppliers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import se.bjurr.prnfb.settings.PrnfbButton; /** * {@link PrnfbVariable} is becoming a bit messy with a lot of parameters to resolve different diff --git a/src/main/java/se/bjurr/prnfb/settings/PrnfbButton.java b/src/main/java/se/bjurr/prnfb/settings/PrnfbButton.java index 3296f7c7..dfb1f6f2 100644 --- a/src/main/java/se/bjurr/prnfb/settings/PrnfbButton.java +++ b/src/main/java/se/bjurr/prnfb/settings/PrnfbButton.java @@ -5,12 +5,10 @@ import static com.google.common.base.Strings.emptyToNull; import static java.util.UUID.randomUUID; +import com.google.common.base.Optional; import java.util.ArrayList; import java.util.List; import java.util.UUID; - -import com.google.common.base.Optional; - import se.bjurr.prnfb.presentation.dto.ON_OR_OFF; public class PrnfbButton implements HasUuid, Restricted { diff --git a/src/main/java/se/bjurr/prnfb/settings/PrnfbButtonFormElement.java b/src/main/java/se/bjurr/prnfb/settings/PrnfbButtonFormElement.java index 75cea2d7..c8c9d696 100644 --- a/src/main/java/se/bjurr/prnfb/settings/PrnfbButtonFormElement.java +++ b/src/main/java/se/bjurr/prnfb/settings/PrnfbButtonFormElement.java @@ -6,7 +6,6 @@ import java.util.ArrayList; import java.util.List; - import se.bjurr.prnfb.presentation.dto.ButtonFormType; public class PrnfbButtonFormElement { diff --git a/src/main/java/se/bjurr/prnfb/settings/PrnfbNotification.java b/src/main/java/se/bjurr/prnfb/settings/PrnfbNotification.java index 658c8eba..8af3ea16 100644 --- a/src/main/java/se/bjurr/prnfb/settings/PrnfbNotification.java +++ b/src/main/java/se/bjurr/prnfb/settings/PrnfbNotification.java @@ -11,14 +11,12 @@ import static se.bjurr.prnfb.service.PrnfbRenderer.ENCODE_FOR.NONE; import static se.bjurr.prnfb.settings.TRIGGER_IF_MERGE.ALWAYS; -import java.net.URL; -import java.util.List; -import java.util.UUID; - import com.atlassian.bitbucket.pull.PullRequestState; import com.google.common.base.MoreObjects; import com.google.common.base.Optional; - +import java.net.URL; +import java.util.List; +import java.util.UUID; import se.bjurr.prnfb.http.UrlInvoker.HTTP_METHOD; import se.bjurr.prnfb.listener.PrnfbPullRequestAction; import se.bjurr.prnfb.service.PrnfbRenderer.ENCODE_FOR; diff --git a/src/main/java/se/bjurr/prnfb/settings/PrnfbNotificationBuilder.java b/src/main/java/se/bjurr/prnfb/settings/PrnfbNotificationBuilder.java index c88465e1..3b9bf154 100644 --- a/src/main/java/se/bjurr/prnfb/settings/PrnfbNotificationBuilder.java +++ b/src/main/java/se/bjurr/prnfb/settings/PrnfbNotificationBuilder.java @@ -6,11 +6,9 @@ import static java.util.UUID.randomUUID; import static se.bjurr.prnfb.http.UrlInvoker.HTTP_METHOD.GET; +import com.atlassian.bitbucket.pull.PullRequestState; import java.util.List; import java.util.UUID; - -import com.atlassian.bitbucket.pull.PullRequestState; - import se.bjurr.prnfb.http.UrlInvoker.HTTP_METHOD; import se.bjurr.prnfb.listener.PrnfbPullRequestAction; import se.bjurr.prnfb.service.PrnfbRenderer.ENCODE_FOR; diff --git a/src/main/java/se/bjurr/prnfb/transformer/ButtonTransformer.java b/src/main/java/se/bjurr/prnfb/transformer/ButtonTransformer.java index 2e08680f..22dbeb3e 100644 --- a/src/main/java/se/bjurr/prnfb/transformer/ButtonTransformer.java +++ b/src/main/java/se/bjurr/prnfb/transformer/ButtonTransformer.java @@ -6,15 +6,13 @@ import static se.bjurr.prnfb.presentation.dto.ButtonFormType.checkbox; import static se.bjurr.prnfb.presentation.dto.ButtonFormType.radio; +import com.google.common.annotations.VisibleForTesting; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import java.net.URI; import java.util.ArrayList; import java.util.List; import java.util.UUID; - -import com.google.common.annotations.VisibleForTesting; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - import se.bjurr.prnfb.http.NotificationResponse; import se.bjurr.prnfb.presentation.dto.ButtonDTO; import se.bjurr.prnfb.presentation.dto.ButtonFormElementDTO; diff --git a/src/main/java/se/bjurr/prnfb/transformer/NotificationTransformer.java b/src/main/java/se/bjurr/prnfb/transformer/NotificationTransformer.java index 30d80492..907067db 100644 --- a/src/main/java/se/bjurr/prnfb/transformer/NotificationTransformer.java +++ b/src/main/java/se/bjurr/prnfb/transformer/NotificationTransformer.java @@ -5,10 +5,8 @@ import static se.bjurr.prnfb.settings.PrnfbNotificationBuilder.prnfbNotificationBuilder; import static se.bjurr.prnfb.settings.PrnfbSettings.UNCHANGED; -import java.util.List; - import com.atlassian.bitbucket.pull.PullRequestState; - +import java.util.List; import se.bjurr.prnfb.listener.PrnfbPullRequestAction; import se.bjurr.prnfb.presentation.dto.HeaderDTO; import se.bjurr.prnfb.presentation.dto.NotificationDTO; diff --git a/src/main/java/se/bjurr/prnfb/transformer/SettingsTransformer.java b/src/main/java/se/bjurr/prnfb/transformer/SettingsTransformer.java index 244372c2..930ce6cf 100644 --- a/src/main/java/se/bjurr/prnfb/transformer/SettingsTransformer.java +++ b/src/main/java/se/bjurr/prnfb/transformer/SettingsTransformer.java @@ -2,6 +2,7 @@ import static se.bjurr.prnfb.settings.PrnfbSettings.UNCHANGED; import static se.bjurr.prnfb.settings.PrnfbSettingsDataBuilder.prnfbSettingsDataBuilder; + import se.bjurr.prnfb.presentation.dto.SettingsDataDTO; import se.bjurr.prnfb.settings.PrnfbSettingsData; diff --git a/src/test/java/se/bjurr/prnfb/http/ClientKeyStoreTest.java b/src/test/java/se/bjurr/prnfb/http/ClientKeyStoreTest.java index 7158d8b5..5320d4ca 100644 --- a/src/test/java/se/bjurr/prnfb/http/ClientKeyStoreTest.java +++ b/src/test/java/se/bjurr/prnfb/http/ClientKeyStoreTest.java @@ -5,7 +5,6 @@ import static se.bjurr.prnfb.settings.PrnfbSettingsDataBuilder.prnfbSettingsDataBuilder; import org.junit.Test; - import se.bjurr.prnfb.settings.PrnfbSettings; public class ClientKeyStoreTest { diff --git a/src/test/java/se/bjurr/prnfb/http/UrlInvokerTest.java b/src/test/java/se/bjurr/prnfb/http/UrlInvokerTest.java index 3483bce7..88a7211c 100644 --- a/src/test/java/se/bjurr/prnfb/http/UrlInvokerTest.java +++ b/src/test/java/se/bjurr/prnfb/http/UrlInvokerTest.java @@ -10,20 +10,17 @@ import static se.bjurr.prnfb.listener.PrnfbPullRequestAction.APPROVED; import static se.bjurr.prnfb.settings.PrnfbNotificationBuilder.prnfbNotificationBuilder; +import com.google.common.base.Optional; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; - import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; import org.apache.http.client.methods.HttpRequestBase; import org.apache.http.impl.client.HttpClientBuilder; import org.junit.Before; import org.junit.Test; - import se.bjurr.prnfb.settings.PrnfbNotification; -import com.google.common.base.Optional; - public class UrlInvokerTest { private HttpRequestBase httpRequestBase; diff --git a/src/test/java/se/bjurr/prnfb/listener/PrnfbPullRequestEventListenerTest.java b/src/test/java/se/bjurr/prnfb/listener/PrnfbPullRequestEventListenerTest.java index 199c5fa2..7b004adf 100644 --- a/src/test/java/se/bjurr/prnfb/listener/PrnfbPullRequestEventListenerTest.java +++ b/src/test/java/se/bjurr/prnfb/listener/PrnfbPullRequestEventListenerTest.java @@ -18,21 +18,30 @@ import static se.bjurr.prnfb.settings.TRIGGER_IF_MERGE.CONFLICTING; import static se.bjurr.prnfb.settings.TRIGGER_IF_MERGE.NOT_CONFLICTING; +import com.atlassian.bitbucket.event.pull.PullRequestCommentAddedEvent; +import com.atlassian.bitbucket.event.pull.PullRequestEvent; +import com.atlassian.bitbucket.project.Project; +import com.atlassian.bitbucket.pull.PullRequest; +import com.atlassian.bitbucket.pull.PullRequestRef; +import com.atlassian.bitbucket.pull.PullRequestService; +import com.atlassian.bitbucket.repository.Repository; +import com.atlassian.bitbucket.scm.Command; +import com.atlassian.bitbucket.scm.ScmService; +import com.atlassian.bitbucket.scm.pull.ScmPullRequestCommandFactory; +import com.atlassian.bitbucket.user.ApplicationUser; +import com.atlassian.bitbucket.user.EscalatedSecurityContext; +import com.atlassian.bitbucket.user.SecurityService; +import com.google.common.base.Function; import java.net.URI; import java.net.URISyntaxException; import java.util.List; import java.util.concurrent.ExecutorService; - -import com.atlassian.bitbucket.scm.Command; -import com.atlassian.bitbucket.scm.ScmService; -import com.atlassian.bitbucket.scm.pull.ScmPullRequestCommandFactory; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; - import se.bjurr.prnfb.http.ClientKeyStore; import se.bjurr.prnfb.http.HttpResponse; import se.bjurr.prnfb.http.Invoker; @@ -46,18 +55,6 @@ import se.bjurr.prnfb.settings.PrnfbSettingsData; import se.bjurr.prnfb.settings.ValidationException; -import com.atlassian.bitbucket.event.pull.PullRequestCommentAddedEvent; -import com.atlassian.bitbucket.event.pull.PullRequestEvent; -import com.atlassian.bitbucket.project.Project; -import com.atlassian.bitbucket.pull.PullRequest; -import com.atlassian.bitbucket.pull.PullRequestRef; -import com.atlassian.bitbucket.pull.PullRequestService; -import com.atlassian.bitbucket.repository.Repository; -import com.atlassian.bitbucket.user.ApplicationUser; -import com.atlassian.bitbucket.user.EscalatedSecurityContext; -import com.atlassian.bitbucket.user.SecurityService; -import com.google.common.base.Function; - public class PrnfbPullRequestEventListenerTest { private final ClientKeyStore clientKeyStore = null; diff --git a/src/test/java/se/bjurr/prnfb/presentation/ButtonServletTest.java b/src/test/java/se/bjurr/prnfb/presentation/ButtonServletTest.java index 6f68e6d5..db0293ad 100644 --- a/src/test/java/se/bjurr/prnfb/presentation/ButtonServletTest.java +++ b/src/test/java/se/bjurr/prnfb/presentation/ButtonServletTest.java @@ -17,17 +17,14 @@ import java.util.Iterator; import java.util.List; import java.util.UUID; - import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Response; - import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; - import se.bjurr.prnfb.presentation.dto.ButtonDTO; import se.bjurr.prnfb.presentation.dto.ON_OR_OFF; import se.bjurr.prnfb.service.ButtonsService; diff --git a/src/test/java/se/bjurr/prnfb/presentation/GlobalAdminServletTest.java b/src/test/java/se/bjurr/prnfb/presentation/GlobalAdminServletTest.java index d68807a3..846eef27 100644 --- a/src/test/java/se/bjurr/prnfb/presentation/GlobalAdminServletTest.java +++ b/src/test/java/se/bjurr/prnfb/presentation/GlobalAdminServletTest.java @@ -5,10 +5,6 @@ import static org.mockito.Mockito.when; import static org.mockito.MockitoAnnotations.initMocks; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; - import com.atlassian.bitbucket.project.Project; import com.atlassian.bitbucket.project.ProjectService; import com.atlassian.bitbucket.repository.Repository; @@ -16,7 +12,9 @@ import com.atlassian.sal.api.auth.LoginUriProvider; import com.atlassian.sal.api.user.UserManager; import com.atlassian.templaterenderer.TemplateRenderer; - +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; import se.bjurr.prnfb.service.UserCheckService; public class GlobalAdminServletTest { diff --git a/src/test/java/se/bjurr/prnfb/presentation/NotificationServletTest.java b/src/test/java/se/bjurr/prnfb/presentation/NotificationServletTest.java index 6d7d3fed..cac96374 100644 --- a/src/test/java/se/bjurr/prnfb/presentation/NotificationServletTest.java +++ b/src/test/java/se/bjurr/prnfb/presentation/NotificationServletTest.java @@ -14,23 +14,19 @@ import static se.bjurr.prnfb.test.Podam.populatedInstanceOf; import static se.bjurr.prnfb.transformer.NotificationTransformer.toPrnfbNotification; +import com.google.common.collect.Lists; import java.util.List; - import javax.ws.rs.core.Response; - import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.Mockito; - import se.bjurr.prnfb.presentation.dto.NotificationDTO; import se.bjurr.prnfb.service.SettingsService; import se.bjurr.prnfb.service.UserCheckService; import se.bjurr.prnfb.settings.PrnfbNotification; import se.bjurr.prnfb.settings.PrnfbSettingsData; -import com.google.common.collect.Lists; - public class NotificationServletTest { private PrnfbNotification notification1; private PrnfbNotification notification2; diff --git a/src/test/java/se/bjurr/prnfb/presentation/SettingsDataServletTest.java b/src/test/java/se/bjurr/prnfb/presentation/SettingsDataServletTest.java index 2c5263da..2f6ff15f 100644 --- a/src/test/java/se/bjurr/prnfb/presentation/SettingsDataServletTest.java +++ b/src/test/java/se/bjurr/prnfb/presentation/SettingsDataServletTest.java @@ -14,7 +14,6 @@ import org.junit.Test; import org.mockito.Mock; import org.mockito.Mockito; - import se.bjurr.prnfb.presentation.dto.SettingsDataDTO; import se.bjurr.prnfb.service.SettingsService; import se.bjurr.prnfb.service.UserCheckService; diff --git a/src/test/java/se/bjurr/prnfb/service/ButtonsServiceTest.java b/src/test/java/se/bjurr/prnfb/service/ButtonsServiceTest.java index 12ef90a8..c007984d 100644 --- a/src/test/java/se/bjurr/prnfb/service/ButtonsServiceTest.java +++ b/src/test/java/se/bjurr/prnfb/service/ButtonsServiceTest.java @@ -14,13 +14,6 @@ import static se.bjurr.prnfb.transformer.ButtonTransformer.toPrnfbButton; import static se.bjurr.prnfb.transformer.NotificationTransformer.toPrnfbNotification; -import java.util.List; -import java.util.UUID; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; - import com.atlassian.bitbucket.auth.AuthenticationContext; import com.atlassian.bitbucket.project.Project; import com.atlassian.bitbucket.pull.PullRequest; @@ -30,7 +23,11 @@ import com.atlassian.bitbucket.repository.RepositoryService; import com.atlassian.bitbucket.server.ApplicationPropertiesService; import com.google.common.collect.Lists; - +import java.util.List; +import java.util.UUID; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; import se.bjurr.prnfb.http.ClientKeyStore; import se.bjurr.prnfb.listener.PrnfbPullRequestAction; import se.bjurr.prnfb.listener.PrnfbPullRequestEventListener; diff --git a/src/test/java/se/bjurr/prnfb/service/MockedEscalatedSecurityContext.java b/src/test/java/se/bjurr/prnfb/service/MockedEscalatedSecurityContext.java index 511fcd63..5fbc215f 100644 --- a/src/test/java/se/bjurr/prnfb/service/MockedEscalatedSecurityContext.java +++ b/src/test/java/se/bjurr/prnfb/service/MockedEscalatedSecurityContext.java @@ -1,10 +1,9 @@ package se.bjurr.prnfb.service; -import java.util.Set; - import com.atlassian.bitbucket.permission.Permission; import com.atlassian.bitbucket.user.EscalatedSecurityContext; import com.atlassian.bitbucket.util.Operation; +import java.util.Set; public class MockedEscalatedSecurityContext implements EscalatedSecurityContext { diff --git a/src/test/java/se/bjurr/prnfb/service/PluginSettingsMap.java b/src/test/java/se/bjurr/prnfb/service/PluginSettingsMap.java index 858843d1..29fa6e72 100644 --- a/src/test/java/se/bjurr/prnfb/service/PluginSettingsMap.java +++ b/src/test/java/se/bjurr/prnfb/service/PluginSettingsMap.java @@ -2,9 +2,8 @@ import static com.google.common.collect.Maps.newHashMap; -import java.util.Map; - import com.atlassian.sal.api.pluginsettings.PluginSettings; +import java.util.Map; public class PluginSettingsMap implements PluginSettings { diff --git a/src/test/java/se/bjurr/prnfb/service/PrnfbRendererTest.java b/src/test/java/se/bjurr/prnfb/service/PrnfbRendererTest.java index 010a4fcc..930e6d8d 100644 --- a/src/test/java/se/bjurr/prnfb/service/PrnfbRendererTest.java +++ b/src/test/java/se/bjurr/prnfb/service/PrnfbRendererTest.java @@ -16,15 +16,22 @@ import static se.bjurr.prnfb.service.PrnfbVariable.PULL_REQUEST_TITLE; import static se.bjurr.prnfb.settings.PrnfbNotificationBuilder.prnfbNotificationBuilder; +import com.atlassian.bitbucket.pull.PullRequest; +import com.atlassian.bitbucket.pull.PullRequestParticipant; +import com.atlassian.bitbucket.pull.PullRequestRef; +import com.atlassian.bitbucket.repository.RepositoryService; +import com.atlassian.bitbucket.server.ApplicationPropertiesService; +import com.atlassian.bitbucket.user.ApplicationUser; +import com.atlassian.bitbucket.user.SecurityService; +import com.google.common.base.Supplier; +import com.google.common.base.Suppliers; import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URISyntaxException; import java.util.Map; - import org.junit.Before; import org.junit.Test; import org.mockito.Mock; - import se.bjurr.prnfb.http.ClientKeyStore; import se.bjurr.prnfb.http.HttpResponse; import se.bjurr.prnfb.http.Invoker; @@ -34,16 +41,6 @@ import se.bjurr.prnfb.settings.PrnfbNotification; import se.bjurr.prnfb.settings.ValidationException; -import com.atlassian.bitbucket.pull.PullRequest; -import com.atlassian.bitbucket.pull.PullRequestParticipant; -import com.atlassian.bitbucket.pull.PullRequestRef; -import com.atlassian.bitbucket.repository.RepositoryService; -import com.atlassian.bitbucket.server.ApplicationPropertiesService; -import com.atlassian.bitbucket.user.ApplicationUser; -import com.atlassian.bitbucket.user.SecurityService; -import com.google.common.base.Supplier; -import com.google.common.base.Suppliers; - public class PrnfbRendererTest { @Mock private ApplicationUser applicationUser; diff --git a/src/test/java/se/bjurr/prnfb/service/PrnfbVariableTest.java b/src/test/java/se/bjurr/prnfb/service/PrnfbVariableTest.java index 0e00d121..c04f63c9 100644 --- a/src/test/java/se/bjurr/prnfb/service/PrnfbVariableTest.java +++ b/src/test/java/se/bjurr/prnfb/service/PrnfbVariableTest.java @@ -5,27 +5,24 @@ import static se.bjurr.prnfb.service.PrnfbVariable.EVERYTHING_URL; import static se.bjurr.prnfb.service.PrnfbVariable.PULL_REQUEST_DESCRIPTION; +import com.atlassian.bitbucket.pull.PullRequest; +import com.atlassian.bitbucket.repository.RepositoryService; +import com.atlassian.bitbucket.server.ApplicationPropertiesService; +import com.atlassian.bitbucket.user.ApplicationUser; +import com.atlassian.bitbucket.user.SecurityService; +import com.google.common.base.Supplier; +import com.google.common.io.Files; +import com.google.common.io.Resources; import java.io.File; import java.io.IOException; import java.net.URISyntaxException; import java.net.URL; import java.util.Map; - import org.junit.Test; - import se.bjurr.prnfb.http.ClientKeyStore; import se.bjurr.prnfb.listener.PrnfbPullRequestAction; import se.bjurr.prnfb.settings.PrnfbNotification; -import com.atlassian.bitbucket.pull.PullRequest; -import com.atlassian.bitbucket.repository.RepositoryService; -import com.atlassian.bitbucket.server.ApplicationPropertiesService; -import com.atlassian.bitbucket.user.ApplicationUser; -import com.atlassian.bitbucket.user.SecurityService; -import com.google.common.base.Supplier; -import com.google.common.io.Files; -import com.google.common.io.Resources; - public class PrnfbVariableTest { private ApplicationUser applicationUser; diff --git a/src/test/java/se/bjurr/prnfb/service/SettingsServiceTest.java b/src/test/java/se/bjurr/prnfb/service/SettingsServiceTest.java index bab111fe..1895d987 100644 --- a/src/test/java/se/bjurr/prnfb/service/SettingsServiceTest.java +++ b/src/test/java/se/bjurr/prnfb/service/SettingsServiceTest.java @@ -13,26 +13,23 @@ import static se.bjurr.prnfb.settings.USER_LEVEL.EVERYONE; import static se.bjurr.prnfb.test.Podam.populatedInstanceOf; +import com.atlassian.bitbucket.permission.Permission; +import com.atlassian.bitbucket.user.EscalatedSecurityContext; +import com.atlassian.bitbucket.user.SecurityService; +import com.atlassian.sal.api.pluginsettings.PluginSettingsFactory; +import com.atlassian.sal.api.transaction.TransactionCallback; +import com.atlassian.sal.api.transaction.TransactionTemplate; +import com.google.gson.Gson; import java.util.List; - import org.junit.Before; import org.junit.Test; import org.mockito.Mock; - import se.bjurr.prnfb.presentation.dto.ON_OR_OFF; import se.bjurr.prnfb.settings.PrnfbButton; import se.bjurr.prnfb.settings.PrnfbNotification; import se.bjurr.prnfb.settings.PrnfbSettings; import se.bjurr.prnfb.settings.ValidationException; -import com.atlassian.bitbucket.permission.Permission; -import com.atlassian.bitbucket.user.EscalatedSecurityContext; -import com.atlassian.bitbucket.user.SecurityService; -import com.atlassian.sal.api.pluginsettings.PluginSettingsFactory; -import com.atlassian.sal.api.transaction.TransactionCallback; -import com.atlassian.sal.api.transaction.TransactionTemplate; -import com.google.gson.Gson; - public class SettingsServiceTest { private EscalatedSecurityContext escalatedSecurityContext; private PrnfbNotification notification1; diff --git a/src/test/java/se/bjurr/prnfb/service/UserCheckServiceTest.java b/src/test/java/se/bjurr/prnfb/service/UserCheckServiceTest.java index a8d7585d..62bf48d0 100644 --- a/src/test/java/se/bjurr/prnfb/service/UserCheckServiceTest.java +++ b/src/test/java/se/bjurr/prnfb/service/UserCheckServiceTest.java @@ -8,15 +8,6 @@ import static se.bjurr.prnfb.settings.USER_LEVEL.EVERYONE; import static se.bjurr.prnfb.settings.USER_LEVEL.SYSTEM_ADMIN; -import java.util.Set; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.Matchers; -import org.mockito.Mock; - -import se.bjurr.prnfb.settings.Restricted; - import com.atlassian.bitbucket.permission.Permission; import com.atlassian.bitbucket.permission.PermissionService; import com.atlassian.bitbucket.project.ProjectService; @@ -28,6 +19,12 @@ import com.atlassian.sal.api.user.UserManager; import com.atlassian.sal.api.user.UserProfile; import com.google.common.base.Optional; +import java.util.Set; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Matchers; +import org.mockito.Mock; +import se.bjurr.prnfb.settings.Restricted; public class UserCheckServiceTest { private final EscalatedSecurityContext escalatedSecurityContext = diff --git a/src/test/java/se/bjurr/prnfb/service/VariablesContextTest.java b/src/test/java/se/bjurr/prnfb/service/VariablesContextTest.java index 823816a0..c49603a7 100644 --- a/src/test/java/se/bjurr/prnfb/service/VariablesContextTest.java +++ b/src/test/java/se/bjurr/prnfb/service/VariablesContextTest.java @@ -10,16 +10,6 @@ import static se.bjurr.prnfb.service.PrnfbVariable.PULL_REQUEST_COMMENT_TEXT; import static se.bjurr.prnfb.service.PrnfbVariable.PULL_REQUEST_MERGE_COMMIT; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; - -import se.bjurr.prnfb.service.VariablesContext.VariablesContextBuilder; -import se.bjurr.prnfb.settings.PrnfbButton; -import se.bjurr.prnfb.settings.ValidationException; - import com.atlassian.bitbucket.comment.Comment; import com.atlassian.bitbucket.commit.MinimalCommit; import com.atlassian.bitbucket.event.pull.PullRequestCommentAddedEvent; @@ -27,6 +17,13 @@ import com.atlassian.bitbucket.event.pull.PullRequestEvent; import com.atlassian.bitbucket.event.pull.PullRequestMergedEvent; import com.google.common.base.Supplier; +import java.util.Map; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import se.bjurr.prnfb.service.VariablesContext.VariablesContextBuilder; +import se.bjurr.prnfb.settings.PrnfbButton; +import se.bjurr.prnfb.settings.ValidationException; public class VariablesContextTest { diff --git a/src/test/java/se/bjurr/prnfb/test/integration/PrnfbTestIntegration.java b/src/test/java/se/bjurr/prnfb/test/integration/PrnfbTestIntegration.java index 6e0a58c0..e3466200 100644 --- a/src/test/java/se/bjurr/prnfb/test/integration/PrnfbTestIntegration.java +++ b/src/test/java/se/bjurr/prnfb/test/integration/PrnfbTestIntegration.java @@ -13,17 +13,15 @@ import static se.bjurr.prnfb.settings.USER_LEVEL.ADMIN; import static se.bjurr.prnfb.settings.USER_LEVEL.EVERYONE; -import org.junit.Before; - -import se.bjurr.prnfb.presentation.dto.ButtonDTO; -import se.bjurr.prnfb.presentation.dto.NotificationDTO; -import se.bjurr.prnfb.presentation.dto.SettingsDataDTO; - import com.jayway.restassured.RestAssured; import com.jayway.restassured.builder.RequestSpecBuilder; import com.jayway.restassured.builder.ResponseSpecBuilder; import com.jayway.restassured.filter.log.LogDetail; import com.jayway.restassured.response.Response; +import org.junit.Before; +import se.bjurr.prnfb.presentation.dto.ButtonDTO; +import se.bjurr.prnfb.presentation.dto.NotificationDTO; +import se.bjurr.prnfb.presentation.dto.SettingsDataDTO; public class PrnfbTestIntegration { @Before diff --git a/src/test/java/se/bjurr/prnfb/transformer/ButtonTransformerTest.java b/src/test/java/se/bjurr/prnfb/transformer/ButtonTransformerTest.java index 9f0e01ca..9e942e90 100644 --- a/src/test/java/se/bjurr/prnfb/transformer/ButtonTransformerTest.java +++ b/src/test/java/se/bjurr/prnfb/transformer/ButtonTransformerTest.java @@ -12,9 +12,7 @@ import java.util.ArrayList; import java.util.List; - import org.junit.Test; - import se.bjurr.prnfb.presentation.dto.ButtonFormElementDTO; import se.bjurr.prnfb.presentation.dto.SettingsDataDTO; import se.bjurr.prnfb.settings.ValidationException; diff --git a/src/test/java/se/bjurr/prnfb/transformer/NotificationTransformerTest.java b/src/test/java/se/bjurr/prnfb/transformer/NotificationTransformerTest.java index b413a74d..7e552826 100644 --- a/src/test/java/se/bjurr/prnfb/transformer/NotificationTransformerTest.java +++ b/src/test/java/se/bjurr/prnfb/transformer/NotificationTransformerTest.java @@ -9,13 +9,11 @@ import static se.bjurr.prnfb.transformer.NotificationTransformer.toNotificationDto; import static se.bjurr.prnfb.transformer.NotificationTransformer.toPrnfbNotification; +import com.google.common.collect.Lists; import org.junit.Test; - import se.bjurr.prnfb.presentation.dto.NotificationDTO; import se.bjurr.prnfb.settings.ValidationException; -import com.google.common.collect.Lists; - public class NotificationTransformerTest { @Test public void testTransformation() throws ValidationException { diff --git a/src/test/java/se/bjurr/prnfb/transformer/SettingsDataTransformerTest.java b/src/test/java/se/bjurr/prnfb/transformer/SettingsDataTransformerTest.java index 54d2f4df..ace7b2f9 100644 --- a/src/test/java/se/bjurr/prnfb/transformer/SettingsDataTransformerTest.java +++ b/src/test/java/se/bjurr/prnfb/transformer/SettingsDataTransformerTest.java @@ -6,7 +6,6 @@ import static se.bjurr.prnfb.transformer.ButtonTransformer.toPrnfbButton; import org.junit.Test; - import se.bjurr.prnfb.presentation.dto.ButtonDTO; import se.bjurr.prnfb.settings.ValidationException;