From 98459327e1257c7d2b6e1a4abe531d9d2e45f853 Mon Sep 17 00:00:00 2001 From: Fabrice Bellingard Date: Thu, 31 Jan 2013 16:30:54 +0100 Subject: [PATCH] SONAR-3959 Refactor existing notification-related code --- .../org/sonar/plugins/core/CorePlugin.java | 555 +++++++++--------- .../alerts/AlertsOnMyFavouriteProject.java | 2 +- ...ngesInReviewAssignedToMeOrCreatedByMe.java | 2 +- .../NewViolationsOnMyFavouriteProject.java | 2 +- .../AlertsOnMyFavouriteProjectTest.java | 4 +- ...InReviewAssignedToMeOrCreatedByMeTest.java | 4 +- ...NewViolationsOnMyFavouriteProjectTest.java | 4 +- .../sonar-email-notifications-plugin/pom.xml | 5 - .../EmailNotificationsPlugin.java | 32 +- .../alerts/AlertsEmailTemplate.java | 2 +- .../reviews/ReviewEmailTemplate.java | 2 +- .../NewViolationsEmailTemplate.java | 2 +- .../EmailNotificationsPluginTest.java | 2 +- .../alerts/AlertsEmailTemplateTest.java | 4 +- .../reviews/ReviewEmailTemplateTest.java | 4 +- .../NewViolationsEmailTemplateTest.java | 4 +- 16 files changed, 320 insertions(+), 310 deletions(-) rename plugins/{sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications => sonar-core-plugin/src/main/java/org/sonar/plugins/core/notifications}/alerts/AlertsOnMyFavouriteProject.java (97%) rename plugins/{sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications => sonar-core-plugin/src/main/java/org/sonar/plugins/core/notifications}/reviews/ChangesInReviewAssignedToMeOrCreatedByMe.java (98%) rename plugins/{sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/newviolations => sonar-core-plugin/src/main/java/org/sonar/plugins/core/notifications/violations}/NewViolationsOnMyFavouriteProject.java (97%) rename plugins/{sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications => sonar-core-plugin/src/test/java/org/sonar/plugins/core/notifications}/alerts/AlertsOnMyFavouriteProjectTest.java (95%) rename plugins/{sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications => sonar-core-plugin/src/test/java/org/sonar/plugins/core/notifications}/reviews/ChangesInReviewAssignedToMeOrCreatedByMeTest.java (96%) rename plugins/{sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/newviolations => sonar-core-plugin/src/test/java/org/sonar/plugins/core/notifications/violations}/NewViolationsOnMyFavouriteProjectTest.java (95%) rename plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/{ => templates}/alerts/AlertsEmailTemplate.java (98%) rename plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/{ => templates}/reviews/ReviewEmailTemplate.java (98%) rename plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/{newviolations => templates/violations}/NewViolationsEmailTemplate.java (97%) rename plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/{ => templates}/alerts/AlertsEmailTemplateTest.java (97%) rename plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/{ => templates}/reviews/ReviewEmailTemplateTest.java (99%) rename plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/{newviolations => templates/violations}/NewViolationsEmailTemplateTest.java (94%) diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java index bd7015dfddf..62a8807c33b 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java @@ -26,6 +26,7 @@ import org.sonar.api.Property; import org.sonar.api.PropertyType; import org.sonar.api.SonarPlugin; import org.sonar.api.checks.NoSonarFilter; +import org.sonar.api.notifications.NotificationDispatcherMetadata; import org.sonar.api.resources.Java; import org.sonar.core.timemachine.Periods; import org.sonar.plugins.core.batch.ExcludedResourceFilter; @@ -43,6 +44,9 @@ import org.sonar.plugins.core.dashboards.ProjectReviewsDashboard; import org.sonar.plugins.core.dashboards.ProjectTimeMachineDashboard; import org.sonar.plugins.core.measurefilters.MyFavouritesFilter; import org.sonar.plugins.core.measurefilters.ProjectFilter; +import org.sonar.plugins.core.notifications.alerts.AlertsOnMyFavouriteProject; +import org.sonar.plugins.core.notifications.reviews.ChangesInReviewAssignedToMeOrCreatedByMe; +import org.sonar.plugins.core.notifications.violations.NewViolationsOnMyFavouriteProject; import org.sonar.plugins.core.security.ApplyProjectRolesDecorator; import org.sonar.plugins.core.sensors.BranchCoverageDecorator; import org.sonar.plugins.core.sensors.CheckAlertThresholds; @@ -116,275 +120,275 @@ import org.sonar.plugins.core.widgets.reviews.UnplannedReviewsWidget; import java.util.List; @Properties({ - @Property( - key = CoreProperties.SERVER_BASE_URL, - defaultValue = CoreProperties.SERVER_BASE_URL_DEFAULT_VALUE, - name = "Server base URL", - description = "HTTP URL of this Sonar server, such as http://yourhost.yourdomain/sonar. This value is used i.e. to create links in emails.", - project = false, - global = true, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.LINKS_HOME_PAGE, - defaultValue = "", - name = "Project Home Page", - description = "HTTP URL of the home page of the project.", - project = false, - global = false, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.LINKS_CI, - defaultValue = "", - name = "CI server", - description = "HTTP URL of the continuous integration server.", - project = false, - global = false, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.LINKS_ISSUE_TRACKER, - defaultValue = "", - name = "Issue Tracker", - description = "HTTP URL of the issue tracker.", - project = false, - global = false, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.LINKS_SOURCES, - defaultValue = "", - name = "SCM server", - description = "HTTP URL of the server which hosts the sources of the project.", - project = false, - global = false, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.LINKS_SOURCES_DEV, - defaultValue = "", - name = "SCM connection for developers", - description = "HTTP URL used by developers to connect to the SCM server for the project.", - project = false, - global = false, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.PROJECT_LANGUAGE_PROPERTY, - defaultValue = Java.KEY, - name = "Default language", - description = "Default language of the source code to analyse.", - project = false, - global = true, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.GLOBAL_EXCLUSIONS_PROPERTY, - name = "Global source exclusions", - description = "Exclude sources from code analysis. Applies to every project. Cannot be overriden. Changes will be applied during next code analysis.", - multiValues = true, - category = CoreProperties.CATEGORY_EXCLUSIONS), - @Property( - key = CoreProperties.GLOBAL_TEST_EXCLUSIONS_PROPERTY, - name = "Global test exclusions", - description = "Exclude tests from code analysis. Applies to every project. Cannot be overriden. Changes will be applied during next code analysis.", - multiValues = true, - category = CoreProperties.CATEGORY_EXCLUSIONS, - defaultValue = CoreProperties.GLOBAL_TEST_EXCLUSIONS_DEFAULT), - @Property( - key = CoreProperties.PROJECT_EXCLUSIONS_PROPERTY, - name = "Exclusions", - description = "Exclude sources from code analysis. Changes will be applied during next code analysis.", - project = true, - global = true, - multiValues = true, - category = CoreProperties.CATEGORY_EXCLUSIONS), - @Property( - key = CoreProperties.PROJECT_TEST_EXCLUSIONS_PROPERTY, - name = "Test Exclusions", - description = "Exclude tests from code analysis. Changes will be applied during next code analysis.", - project = true, - global = true, - multiValues = true, - category = CoreProperties.CATEGORY_EXCLUSIONS), - @Property( - key = CoreProperties.CORE_IMPORT_SOURCES_PROPERTY, - defaultValue = "" + CoreProperties.CORE_IMPORT_SOURCES_DEFAULT_VALUE, - name = "Import sources", - description = "Set to false if sources should not be displayed, e.g. for security reasons.", - project = true, - module = true, - global = true, - category = CoreProperties.CATEGORY_SECURITY, - type = PropertyType.BOOLEAN), - @Property( - key = CoreProperties.CORE_TENDENCY_DEPTH_PROPERTY, - defaultValue = "" + CoreProperties.CORE_TENDENCY_DEPTH_DEFAULT_VALUE, - name = "Tendency period", - description = TendencyDecorator.PROP_DAYS_DESCRIPTION, - project = false, - global = true, - category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS, - type = PropertyType.INTEGER), - @Property( - key = CoreProperties.SKIP_TENDENCIES_PROPERTY, - defaultValue = "" + CoreProperties.SKIP_TENDENCIES_DEFAULT_VALUE, - name = "Skip tendencies", - description = "Skip calculation of measure tendencies", - project = true, - module = false, - global = true, - category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS, - type = PropertyType.BOOLEAN), - @Property( - key = CoreProperties.CORE_SKIPPED_MODULES_PROPERTY, - name = "Exclude modules", - description = "Maven artifact ids of modules to exclude.", - project = true, - global = false, - multiValues = true, - category = CoreProperties.CATEGORY_EXCLUSIONS), - @Property( - key = CoreProperties.CORE_FORCE_AUTHENTICATION_PROPERTY, - defaultValue = "" + CoreProperties.CORE_FORCE_AUTHENTICATION_DEFAULT_VALUE, - name = "Force user authentication", - description = "Forcing user authentication stops un-logged users to access Sonar.", - project = false, - global = true, - category = CoreProperties.CATEGORY_SECURITY, - type = PropertyType.BOOLEAN), - @Property( - key = CoreProperties.CORE_ALLOW_USERS_TO_SIGNUP_PROPERTY, - defaultValue = "" + CoreProperties.CORE_ALLOW_USERS_TO_SIGNUP_DEAULT_VALUE, - name = "Allow users to sign up online", - description = "Users can sign up online.", - project = false, - global = true, - category = CoreProperties.CATEGORY_SECURITY, - type = PropertyType.BOOLEAN), - @Property( - key = CoreProperties.CORE_DEFAULT_GROUP, - defaultValue = CoreProperties.CORE_DEFAULT_GROUP_DEFAULT_VALUE, - name = "Default user group", - description = "Any new users will automatically join this group.", - project = false, - global = true, - category = CoreProperties.CATEGORY_SECURITY), - @Property( - key = CoreProperties.CORE_VIOLATION_LOCALE_PROPERTY, - defaultValue = "en", - name = "Locale used for violation messages", - description = "Locale to be used when generating violation messages. It's up to each rule engine to support this global internationalization property", - project = true, - global = true, - category = CoreProperties.CATEGORY_L10N), - @Property( - key = "sonar.timemachine.period1", - name = "Period 1", - description = "Period used to compare measures and track new violations. Values are : " + - "

When specifying a number of days or a date, the snapshot selected for comparison is " + - " the first one available inside the corresponding time range.

" + - "

Changing this property only takes effect after subsequent project inspections.

", - project = false, - global = true, - defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_1, - category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), - @Property( - key = "sonar.timemachine.period2", - name = "Period 2", - description = "See the property 'Period 1'", - project = false, - global = true, - defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_2, - category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), - @Property( - key = "sonar.timemachine.period3", - name = "Period 3", - description = "See the property 'Period 1'", - project = false, - global = true, - defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_3, - category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), - @Property( - key = "sonar.timemachine.period4", - name = "Period 4", - description = "Period used to compare measures and track new violations. This property is specific to the project. Values are : " + - "

" + - "

When specifying a number of days or a date, the snapshot selected for comparison is the first one available inside the corresponding time range.

" + - "

Changing this property only takes effect after subsequent project inspections.

", - project = true, - global = false, - defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_4, - category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), - @Property( - key = "sonar.timemachine.period5", - name = "Period 5", - description = "See the property 'Period 4'", - project = true, - global = false, - defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_5, - category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), - @Property( - key = CoreProperties.DRY_RUN, - defaultValue = "false", - name = "Dry Run", - type = PropertyType.BOOLEAN, - global = false, project = false, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.DRY_RUN_INCLUDE_PLUGINS, - name = "Plugins accepted for dry run", - defaultValue = CoreProperties.DRY_RUN_INCLUDE_PLUGINS_DEFAULT_VALUE, - global = true, project = false, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.DRY_RUN_EXCLUDE_PLUGINS, - name = "Plugins excluded for dry run", - global = true, project = false, - defaultValue = CoreProperties.DRY_RUN_EXCLUDE_PLUGINS_DEFAULT_VALUE, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = "sonar.dryRun.export.path", - defaultValue = "dryRun.json", - name = "Dry Run Results Export File", - type = PropertyType.STRING, - global = false, project = false), + @Property( + key = CoreProperties.SERVER_BASE_URL, + defaultValue = CoreProperties.SERVER_BASE_URL_DEFAULT_VALUE, + name = "Server base URL", + description = "HTTP URL of this Sonar server, such as http://yourhost.yourdomain/sonar. This value is used i.e. to create links in emails.", + project = false, + global = true, + category = CoreProperties.CATEGORY_GENERAL), + @Property( + key = CoreProperties.LINKS_HOME_PAGE, + defaultValue = "", + name = "Project Home Page", + description = "HTTP URL of the home page of the project.", + project = false, + global = false, + category = CoreProperties.CATEGORY_GENERAL), + @Property( + key = CoreProperties.LINKS_CI, + defaultValue = "", + name = "CI server", + description = "HTTP URL of the continuous integration server.", + project = false, + global = false, + category = CoreProperties.CATEGORY_GENERAL), + @Property( + key = CoreProperties.LINKS_ISSUE_TRACKER, + defaultValue = "", + name = "Issue Tracker", + description = "HTTP URL of the issue tracker.", + project = false, + global = false, + category = CoreProperties.CATEGORY_GENERAL), + @Property( + key = CoreProperties.LINKS_SOURCES, + defaultValue = "", + name = "SCM server", + description = "HTTP URL of the server which hosts the sources of the project.", + project = false, + global = false, + category = CoreProperties.CATEGORY_GENERAL), + @Property( + key = CoreProperties.LINKS_SOURCES_DEV, + defaultValue = "", + name = "SCM connection for developers", + description = "HTTP URL used by developers to connect to the SCM server for the project.", + project = false, + global = false, + category = CoreProperties.CATEGORY_GENERAL), + @Property( + key = CoreProperties.PROJECT_LANGUAGE_PROPERTY, + defaultValue = Java.KEY, + name = "Default language", + description = "Default language of the source code to analyse.", + project = false, + global = true, + category = CoreProperties.CATEGORY_GENERAL), + @Property( + key = CoreProperties.GLOBAL_EXCLUSIONS_PROPERTY, + name = "Global source exclusions", + description = "Exclude sources from code analysis. Applies to every project. Cannot be overriden. Changes will be applied during next code analysis.", + multiValues = true, + category = CoreProperties.CATEGORY_EXCLUSIONS), + @Property( + key = CoreProperties.GLOBAL_TEST_EXCLUSIONS_PROPERTY, + name = "Global test exclusions", + description = "Exclude tests from code analysis. Applies to every project. Cannot be overriden. Changes will be applied during next code analysis.", + multiValues = true, + category = CoreProperties.CATEGORY_EXCLUSIONS, + defaultValue = CoreProperties.GLOBAL_TEST_EXCLUSIONS_DEFAULT), + @Property( + key = CoreProperties.PROJECT_EXCLUSIONS_PROPERTY, + name = "Exclusions", + description = "Exclude sources from code analysis. Changes will be applied during next code analysis.", + project = true, + global = true, + multiValues = true, + category = CoreProperties.CATEGORY_EXCLUSIONS), + @Property( + key = CoreProperties.PROJECT_TEST_EXCLUSIONS_PROPERTY, + name = "Test Exclusions", + description = "Exclude tests from code analysis. Changes will be applied during next code analysis.", + project = true, + global = true, + multiValues = true, + category = CoreProperties.CATEGORY_EXCLUSIONS), + @Property( + key = CoreProperties.CORE_IMPORT_SOURCES_PROPERTY, + defaultValue = "" + CoreProperties.CORE_IMPORT_SOURCES_DEFAULT_VALUE, + name = "Import sources", + description = "Set to false if sources should not be displayed, e.g. for security reasons.", + project = true, + module = true, + global = true, + category = CoreProperties.CATEGORY_SECURITY, + type = PropertyType.BOOLEAN), + @Property( + key = CoreProperties.CORE_TENDENCY_DEPTH_PROPERTY, + defaultValue = "" + CoreProperties.CORE_TENDENCY_DEPTH_DEFAULT_VALUE, + name = "Tendency period", + description = TendencyDecorator.PROP_DAYS_DESCRIPTION, + project = false, + global = true, + category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS, + type = PropertyType.INTEGER), + @Property( + key = CoreProperties.SKIP_TENDENCIES_PROPERTY, + defaultValue = "" + CoreProperties.SKIP_TENDENCIES_DEFAULT_VALUE, + name = "Skip tendencies", + description = "Skip calculation of measure tendencies", + project = true, + module = false, + global = true, + category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS, + type = PropertyType.BOOLEAN), + @Property( + key = CoreProperties.CORE_SKIPPED_MODULES_PROPERTY, + name = "Exclude modules", + description = "Maven artifact ids of modules to exclude.", + project = true, + global = false, + multiValues = true, + category = CoreProperties.CATEGORY_EXCLUSIONS), + @Property( + key = CoreProperties.CORE_FORCE_AUTHENTICATION_PROPERTY, + defaultValue = "" + CoreProperties.CORE_FORCE_AUTHENTICATION_DEFAULT_VALUE, + name = "Force user authentication", + description = "Forcing user authentication stops un-logged users to access Sonar.", + project = false, + global = true, + category = CoreProperties.CATEGORY_SECURITY, + type = PropertyType.BOOLEAN), + @Property( + key = CoreProperties.CORE_ALLOW_USERS_TO_SIGNUP_PROPERTY, + defaultValue = "" + CoreProperties.CORE_ALLOW_USERS_TO_SIGNUP_DEAULT_VALUE, + name = "Allow users to sign up online", + description = "Users can sign up online.", + project = false, + global = true, + category = CoreProperties.CATEGORY_SECURITY, + type = PropertyType.BOOLEAN), + @Property( + key = CoreProperties.CORE_DEFAULT_GROUP, + defaultValue = CoreProperties.CORE_DEFAULT_GROUP_DEFAULT_VALUE, + name = "Default user group", + description = "Any new users will automatically join this group.", + project = false, + global = true, + category = CoreProperties.CATEGORY_SECURITY), + @Property( + key = CoreProperties.CORE_VIOLATION_LOCALE_PROPERTY, + defaultValue = "en", + name = "Locale used for violation messages", + description = "Locale to be used when generating violation messages. It's up to each rule engine to support this global internationalization property", + project = true, + global = true, + category = CoreProperties.CATEGORY_L10N), + @Property( + key = "sonar.timemachine.period1", + name = "Period 1", + description = "Period used to compare measures and track new violations. Values are :

" + + "

When specifying a number of days or a date, the snapshot selected for comparison is " + + " the first one available inside the corresponding time range.

" + + "

Changing this property only takes effect after subsequent project inspections.

", + project = false, + global = true, + defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_1, + category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), + @Property( + key = "sonar.timemachine.period2", + name = "Period 2", + description = "See the property 'Period 1'", + project = false, + global = true, + defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_2, + category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), + @Property( + key = "sonar.timemachine.period3", + name = "Period 3", + description = "See the property 'Period 1'", + project = false, + global = true, + defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_3, + category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), + @Property( + key = "sonar.timemachine.period4", + name = "Period 4", + description = "Period used to compare measures and track new violations. This property is specific to the project. Values are : " + + "

" + + "

When specifying a number of days or a date, the snapshot selected for comparison is the first one available inside the corresponding time range.

" + + "

Changing this property only takes effect after subsequent project inspections.

", + project = true, + global = false, + defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_4, + category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), + @Property( + key = "sonar.timemachine.period5", + name = "Period 5", + description = "See the property 'Period 4'", + project = true, + global = false, + defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_5, + category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), + @Property( + key = CoreProperties.DRY_RUN, + defaultValue = "false", + name = "Dry Run", + type = PropertyType.BOOLEAN, + global = false, project = false, + category = CoreProperties.CATEGORY_GENERAL), + @Property( + key = CoreProperties.DRY_RUN_INCLUDE_PLUGINS, + name = "Plugins accepted for dry run", + defaultValue = CoreProperties.DRY_RUN_INCLUDE_PLUGINS_DEFAULT_VALUE, + global = true, project = false, + category = CoreProperties.CATEGORY_GENERAL), + @Property( + key = CoreProperties.DRY_RUN_EXCLUDE_PLUGINS, + name = "Plugins excluded for dry run", + global = true, project = false, + defaultValue = CoreProperties.DRY_RUN_EXCLUDE_PLUGINS_DEFAULT_VALUE, + category = CoreProperties.CATEGORY_GENERAL), + @Property( + key = "sonar.dryRun.export.path", + defaultValue = "dryRun.json", + name = "Dry Run Results Export File", + type = PropertyType.STRING, + global = false, project = false), - // SERVER-SIDE TECHNICAL PROPERTIES + // SERVER-SIDE TECHNICAL PROPERTIES - @Property( - key = "sonar.security.realm", - name = "Security Realm", - project = false, - global = false - ), - @Property( - key = "sonar.security.savePassword", - name = "Save external password", - project = false, - global = false - ), - @Property( - key = "sonar.authenticator.downcase", - name = "Downcase login", - description = "Downcase login during user authentication, typically for Active Directory", - project = false, - global = false, - defaultValue = "false", - type = PropertyType.BOOLEAN), - @Property( - key = CoreProperties.CORE_AUTHENTICATOR_CREATE_USERS, - name = "Create user accounts", - description = "Create accounts when authenticating users via an external system", - project = false, - global = false, - defaultValue = "true", - type = PropertyType.BOOLEAN), - @Property( - key = CoreProperties.CORE_AUTHENTICATOR_IGNORE_STARTUP_FAILURE, - name = "Ignore failures during authenticator startup", - defaultValue = "false", - project = false, - global = false, - type = PropertyType.BOOLEAN) + @Property( + key = "sonar.security.realm", + name = "Security Realm", + project = false, + global = false + ), + @Property( + key = "sonar.security.savePassword", + name = "Save external password", + project = false, + global = false + ), + @Property( + key = "sonar.authenticator.downcase", + name = "Downcase login", + description = "Downcase login during user authentication, typically for Active Directory", + project = false, + global = false, + defaultValue = "false", + type = PropertyType.BOOLEAN), + @Property( + key = CoreProperties.CORE_AUTHENTICATOR_CREATE_USERS, + name = "Create user accounts", + description = "Create accounts when authenticating users via an external system", + project = false, + global = false, + defaultValue = "true", + type = PropertyType.BOOLEAN), + @Property( + key = CoreProperties.CORE_AUTHENTICATOR_IGNORE_STARTUP_FAILURE, + name = "Ignore failures during authenticator startup", + defaultValue = "false", + project = false, + global = false, + type = PropertyType.BOOLEAN) }) public final class CorePlugin extends SonarPlugin { @@ -499,6 +503,21 @@ public final class CorePlugin extends SonarPlugin { NewCoverageFileAnalyzer.class, NewItCoverageFileAnalyzer.class, NewOverallCoverageFileAnalyzer.class, - NewCoverageAggregator.class); + NewCoverageAggregator.class, + + // notifications + // Notify incoming violations on my favourite projects + NewViolationsOnMyFavouriteProject.class, + NotificationDispatcherMetadata.create("NewViolationsOnMyFavouriteProject") + .setProperty(NotificationDispatcherMetadata.GLOBAL_NOTIFICATION, "true"), + // Notify alerts on my favourite projects + AlertsOnMyFavouriteProject.class, + NotificationDispatcherMetadata.create("AlertsOnMyFavouriteProject") + .setProperty(NotificationDispatcherMetadata.GLOBAL_NOTIFICATION, "true"), + // Notify reviews changes + ChangesInReviewAssignedToMeOrCreatedByMe.class, + NotificationDispatcherMetadata.create("ChangesInReviewAssignedToMeOrCreatedByMe") + .setProperty(NotificationDispatcherMetadata.GLOBAL_NOTIFICATION, "true") + .setProperty(NotificationDispatcherMetadata.PER_PROJECT_NOTIFICATION, "true")); } } diff --git a/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/alerts/AlertsOnMyFavouriteProject.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/notifications/alerts/AlertsOnMyFavouriteProject.java similarity index 97% rename from plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/alerts/AlertsOnMyFavouriteProject.java rename to plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/notifications/alerts/AlertsOnMyFavouriteProject.java index 49c7da72e02..ebf874b358c 100644 --- a/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/alerts/AlertsOnMyFavouriteProject.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/notifications/alerts/AlertsOnMyFavouriteProject.java @@ -17,7 +17,7 @@ * License along with Sonar; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.emailnotifications.alerts; +package org.sonar.plugins.core.notifications.alerts; import com.google.common.collect.Multimap; import org.sonar.api.notifications.Notification; diff --git a/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/reviews/ChangesInReviewAssignedToMeOrCreatedByMe.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/notifications/reviews/ChangesInReviewAssignedToMeOrCreatedByMe.java similarity index 98% rename from plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/reviews/ChangesInReviewAssignedToMeOrCreatedByMe.java rename to plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/notifications/reviews/ChangesInReviewAssignedToMeOrCreatedByMe.java index 31b1952b1b3..c699a4fffa4 100644 --- a/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/reviews/ChangesInReviewAssignedToMeOrCreatedByMe.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/notifications/reviews/ChangesInReviewAssignedToMeOrCreatedByMe.java @@ -17,7 +17,7 @@ * License along with Sonar; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.emailnotifications.reviews; +package org.sonar.plugins.core.notifications.reviews; import com.google.common.collect.Multimap; import org.apache.commons.lang.StringUtils; diff --git a/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/newviolations/NewViolationsOnMyFavouriteProject.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/notifications/violations/NewViolationsOnMyFavouriteProject.java similarity index 97% rename from plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/newviolations/NewViolationsOnMyFavouriteProject.java rename to plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/notifications/violations/NewViolationsOnMyFavouriteProject.java index 1125bb02dee..4220db3716c 100644 --- a/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/newviolations/NewViolationsOnMyFavouriteProject.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/notifications/violations/NewViolationsOnMyFavouriteProject.java @@ -17,7 +17,7 @@ * License along with Sonar; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.emailnotifications.newviolations; +package org.sonar.plugins.core.notifications.violations; import com.google.common.collect.Multimap; import org.sonar.api.notifications.Notification; diff --git a/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/alerts/AlertsOnMyFavouriteProjectTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/notifications/alerts/AlertsOnMyFavouriteProjectTest.java similarity index 95% rename from plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/alerts/AlertsOnMyFavouriteProjectTest.java rename to plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/notifications/alerts/AlertsOnMyFavouriteProjectTest.java index 01887396b05..16e865dbf46 100644 --- a/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/alerts/AlertsOnMyFavouriteProjectTest.java +++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/notifications/alerts/AlertsOnMyFavouriteProjectTest.java @@ -17,7 +17,9 @@ * License along with Sonar; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.emailnotifications.alerts; +package org.sonar.plugins.core.notifications.alerts; + +import org.sonar.plugins.core.notifications.alerts.AlertsOnMyFavouriteProject; import com.google.common.collect.HashMultimap; import com.google.common.collect.Lists; diff --git a/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/reviews/ChangesInReviewAssignedToMeOrCreatedByMeTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/notifications/reviews/ChangesInReviewAssignedToMeOrCreatedByMeTest.java similarity index 96% rename from plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/reviews/ChangesInReviewAssignedToMeOrCreatedByMeTest.java rename to plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/notifications/reviews/ChangesInReviewAssignedToMeOrCreatedByMeTest.java index a5b68352aa2..4840c7e0fe0 100644 --- a/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/reviews/ChangesInReviewAssignedToMeOrCreatedByMeTest.java +++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/notifications/reviews/ChangesInReviewAssignedToMeOrCreatedByMeTest.java @@ -17,7 +17,9 @@ * License along with Sonar; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.emailnotifications.reviews; +package org.sonar.plugins.core.notifications.reviews; + +import org.sonar.plugins.core.notifications.reviews.ChangesInReviewAssignedToMeOrCreatedByMe; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; diff --git a/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/newviolations/NewViolationsOnMyFavouriteProjectTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/notifications/violations/NewViolationsOnMyFavouriteProjectTest.java similarity index 95% rename from plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/newviolations/NewViolationsOnMyFavouriteProjectTest.java rename to plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/notifications/violations/NewViolationsOnMyFavouriteProjectTest.java index 91de747a3e3..47130b2b977 100644 --- a/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/newviolations/NewViolationsOnMyFavouriteProjectTest.java +++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/notifications/violations/NewViolationsOnMyFavouriteProjectTest.java @@ -17,7 +17,9 @@ * License along with Sonar; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.emailnotifications.newviolations; +package org.sonar.plugins.core.notifications.violations; + +import org.sonar.plugins.core.notifications.violations.NewViolationsOnMyFavouriteProject; import com.google.common.collect.HashMultimap; import com.google.common.collect.Lists; diff --git a/plugins/sonar-email-notifications-plugin/pom.xml b/plugins/sonar-email-notifications-plugin/pom.xml index bf10af333c1..72d10f4b76c 100644 --- a/plugins/sonar-email-notifications-plugin/pom.xml +++ b/plugins/sonar-email-notifications-plugin/pom.xml @@ -22,11 +22,6 @@ sonar-plugin-api provided - - org.codehaus.sonar - sonar-core - provided - org.apache.commons commons-email diff --git a/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/EmailNotificationsPlugin.java b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/EmailNotificationsPlugin.java index d62857fbca8..e226088092e 100644 --- a/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/EmailNotificationsPlugin.java +++ b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/EmailNotificationsPlugin.java @@ -19,15 +19,14 @@ */ package org.sonar.plugins.emailnotifications; +import org.sonar.plugins.emailnotifications.templates.reviews.ReviewEmailTemplate; + +import org.sonar.plugins.emailnotifications.templates.violations.NewViolationsEmailTemplate; + +import org.sonar.plugins.emailnotifications.templates.alerts.AlertsEmailTemplate; + import com.google.common.collect.ImmutableList; import org.sonar.api.SonarPlugin; -import org.sonar.api.notifications.NotificationDispatcherMetadata; -import org.sonar.plugins.emailnotifications.alerts.AlertsEmailTemplate; -import org.sonar.plugins.emailnotifications.alerts.AlertsOnMyFavouriteProject; -import org.sonar.plugins.emailnotifications.newviolations.NewViolationsEmailTemplate; -import org.sonar.plugins.emailnotifications.newviolations.NewViolationsOnMyFavouriteProject; -import org.sonar.plugins.emailnotifications.reviews.ChangesInReviewAssignedToMeOrCreatedByMe; -import org.sonar.plugins.emailnotifications.reviews.ReviewEmailTemplate; import java.util.List; @@ -36,24 +35,9 @@ public class EmailNotificationsPlugin extends SonarPlugin { return ImmutableList.of( EmailNotificationChannel.class, - // Notify incoming violations on my favourite projects - NewViolationsOnMyFavouriteProject.class, - NotificationDispatcherMetadata.create("NewViolationsOnMyFavouriteProject") - .setProperty(NotificationDispatcherMetadata.GLOBAL_NOTIFICATION, "true"), + // Email templates NewViolationsEmailTemplate.class, - - // Notify reviews changes - ChangesInReviewAssignedToMeOrCreatedByMe.class, - NotificationDispatcherMetadata.create("ChangesInReviewAssignedToMeOrCreatedByMe") - .setProperty(NotificationDispatcherMetadata.GLOBAL_NOTIFICATION, "true"), ReviewEmailTemplate.class, - - // Notify alerts on my favourite projects - AlertsOnMyFavouriteProject.class, - NotificationDispatcherMetadata.create("AlertsOnMyFavouriteProject") - .setProperty(NotificationDispatcherMetadata.GLOBAL_NOTIFICATION, "true"), - AlertsEmailTemplate.class - - ); + AlertsEmailTemplate.class); } } diff --git a/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/alerts/AlertsEmailTemplate.java b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/templates/alerts/AlertsEmailTemplate.java similarity index 98% rename from plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/alerts/AlertsEmailTemplate.java rename to plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/templates/alerts/AlertsEmailTemplate.java index 96d96cb3ad7..0a015ae56d2 100644 --- a/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/alerts/AlertsEmailTemplate.java +++ b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/templates/alerts/AlertsEmailTemplate.java @@ -17,7 +17,7 @@ * License along with Sonar; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.emailnotifications.alerts; +package org.sonar.plugins.emailnotifications.templates.alerts; import org.apache.commons.lang.StringUtils; import org.sonar.api.config.EmailSettings; diff --git a/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/reviews/ReviewEmailTemplate.java b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/templates/reviews/ReviewEmailTemplate.java similarity index 98% rename from plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/reviews/ReviewEmailTemplate.java rename to plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/templates/reviews/ReviewEmailTemplate.java index 57da295f6eb..2a2e4df3bc1 100644 --- a/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/reviews/ReviewEmailTemplate.java +++ b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/templates/reviews/ReviewEmailTemplate.java @@ -17,7 +17,7 @@ * License along with Sonar; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.emailnotifications.reviews; +package org.sonar.plugins.emailnotifications.templates.reviews; import org.apache.commons.lang.StringUtils; import org.sonar.api.config.EmailSettings; diff --git a/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/newviolations/NewViolationsEmailTemplate.java b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/templates/violations/NewViolationsEmailTemplate.java similarity index 97% rename from plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/newviolations/NewViolationsEmailTemplate.java rename to plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/templates/violations/NewViolationsEmailTemplate.java index 2294b368e34..4e9552d9d5c 100644 --- a/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/newviolations/NewViolationsEmailTemplate.java +++ b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/templates/violations/NewViolationsEmailTemplate.java @@ -17,7 +17,7 @@ * License along with Sonar; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.emailnotifications.newviolations; +package org.sonar.plugins.emailnotifications.templates.violations; import org.sonar.api.notifications.Notification; import org.sonar.api.config.EmailSettings; diff --git a/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/EmailNotificationsPluginTest.java b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/EmailNotificationsPluginTest.java index 55096f5565b..b2763851df3 100644 --- a/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/EmailNotificationsPluginTest.java +++ b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/EmailNotificationsPluginTest.java @@ -26,6 +26,6 @@ import static org.fest.assertions.Assertions.assertThat; public class EmailNotificationsPluginTest { @Test public void should_get_extensions() { - assertThat(new EmailNotificationsPlugin().getExtensions()).hasSize(10); + assertThat(new EmailNotificationsPlugin().getExtensions()).hasSize(4); } } diff --git a/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/alerts/AlertsEmailTemplateTest.java b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/templates/alerts/AlertsEmailTemplateTest.java similarity index 97% rename from plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/alerts/AlertsEmailTemplateTest.java rename to plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/templates/alerts/AlertsEmailTemplateTest.java index 1a68497f1c9..5f7cc46d9ca 100644 --- a/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/alerts/AlertsEmailTemplateTest.java +++ b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/templates/alerts/AlertsEmailTemplateTest.java @@ -17,7 +17,9 @@ * License along with Sonar; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.emailnotifications.alerts; +package org.sonar.plugins.emailnotifications.templates.alerts; + +import org.sonar.plugins.emailnotifications.templates.alerts.AlertsEmailTemplate; import org.junit.Before; import org.junit.Test; diff --git a/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/reviews/ReviewEmailTemplateTest.java b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/templates/reviews/ReviewEmailTemplateTest.java similarity index 99% rename from plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/reviews/ReviewEmailTemplateTest.java rename to plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/templates/reviews/ReviewEmailTemplateTest.java index 3e52167e9d1..7ea299fded1 100644 --- a/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/reviews/ReviewEmailTemplateTest.java +++ b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/templates/reviews/ReviewEmailTemplateTest.java @@ -17,7 +17,9 @@ * License along with Sonar; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.emailnotifications.reviews; +package org.sonar.plugins.emailnotifications.templates.reviews; + +import org.sonar.plugins.emailnotifications.templates.reviews.ReviewEmailTemplate; import org.junit.Before; import org.junit.Test; diff --git a/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/newviolations/NewViolationsEmailTemplateTest.java b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/templates/violations/NewViolationsEmailTemplateTest.java similarity index 94% rename from plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/newviolations/NewViolationsEmailTemplateTest.java rename to plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/templates/violations/NewViolationsEmailTemplateTest.java index 3bd32290422..27dbe38667c 100644 --- a/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/newviolations/NewViolationsEmailTemplateTest.java +++ b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/templates/violations/NewViolationsEmailTemplateTest.java @@ -17,7 +17,9 @@ * License along with Sonar; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.emailnotifications.newviolations; +package org.sonar.plugins.emailnotifications.templates.violations; + +import org.sonar.plugins.emailnotifications.templates.violations.NewViolationsEmailTemplate; import org.junit.Before; import org.junit.Test; -- 2.39.5