diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-02-04 22:40:54 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-02-05 14:24:25 +0100 |
commit | 8115b23fa61b022377a5fc150ac2b3ec2ca11d97 (patch) | |
tree | 1bd893e4a8bab47e1e0dc51e2882372aba803b82 | |
parent | 27858608f46ae9f1cd2c2269151e68f56f882417 (diff) | |
download | sonarqube-8115b23fa61b022377a5fc150ac2b3ec2ca11d97.tar.gz sonarqube-8115b23fa61b022377a5fc150ac2b3ec2ca11d97.zip |
SONAR-6740 add fake plugin to emulate server startup failure
-rw-r--r-- | it/it-plugins/server-plugin/src/main/java/ServerPlugin.java | 3 | ||||
-rw-r--r-- | it/it-plugins/server-plugin/src/main/java/StartupCrash.java | 43 |
2 files changed, 45 insertions, 1 deletions
diff --git a/it/it-plugins/server-plugin/src/main/java/ServerPlugin.java b/it/it-plugins/server-plugin/src/main/java/ServerPlugin.java index 7164283ce69..ce032d42c34 100644 --- a/it/it-plugins/server-plugin/src/main/java/ServerPlugin.java +++ b/it/it-plugins/server-plugin/src/main/java/ServerPlugin.java @@ -28,6 +28,7 @@ import org.sonar.api.SonarPlugin; }) public class ServerPlugin extends SonarPlugin { public List getExtensions() { - return Arrays.asList(WidgetDisplayingProperties.class, TempFolderExtension.class); + return Arrays.asList( + StartupCrash.class, WidgetDisplayingProperties.class, TempFolderExtension.class); } } diff --git a/it/it-plugins/server-plugin/src/main/java/StartupCrash.java b/it/it-plugins/server-plugin/src/main/java/StartupCrash.java new file mode 100644 index 00000000000..bda47b6c0b6 --- /dev/null +++ b/it/it-plugins/server-plugin/src/main/java/StartupCrash.java @@ -0,0 +1,43 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +import org.sonar.api.config.Settings; +import org.sonar.api.server.ServerSide; + + +@ServerSide +public class StartupCrash { + + private final Settings settings; + + public StartupCrash(Settings settings) { + this.settings = settings; + } + + public void start() { + if (settings.getBoolean("failAtStartup")) { + throw new IllegalStateException("Error in plugin [server]"); + } + } + + public void stop() { + + } +} |