aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src/test/java/org/sonar/server/plugins
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2013-09-26 14:16:11 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2013-09-26 14:36:28 +0200
commit48f90cf6a79574c42c91594786d44fe2e887f9dd (patch)
tree1ab2157260fd7b5c26ef9a1808674ac86e73dda4 /sonar-server/src/test/java/org/sonar/server/plugins
parenta0c84b3c8e9a31d409a0803dc248a649e3ce13e9 (diff)
downloadsonarqube-48f90cf6a79574c42c91594786d44fe2e887f9dd.tar.gz
sonarqube-48f90cf6a79574c42c91594786d44fe2e887f9dd.zip
SONAR-4596 Don't install bundled plugins during upgrade
Diffstat (limited to 'sonar-server/src/test/java/org/sonar/server/plugins')
-rw-r--r--sonar-server/src/test/java/org/sonar/server/plugins/PluginDeployerTest.java30
1 files changed, 28 insertions, 2 deletions
diff --git a/sonar-server/src/test/java/org/sonar/server/plugins/PluginDeployerTest.java b/sonar-server/src/test/java/org/sonar/server/plugins/PluginDeployerTest.java
index 7d5ededcba4..9d6a23e7d96 100644
--- a/sonar-server/src/test/java/org/sonar/server/plugins/PluginDeployerTest.java
+++ b/sonar-server/src/test/java/org/sonar/server/plugins/PluginDeployerTest.java
@@ -26,6 +26,7 @@ import org.junit.rules.ExpectedException;
import org.junit.rules.TestName;
import org.sonar.api.platform.PluginMetadata;
import org.sonar.api.platform.Server;
+import org.sonar.api.platform.ServerUpgradeStatus;
import org.sonar.core.plugins.PluginInstaller;
import org.sonar.server.platform.DefaultServerFileSystem;
import org.sonar.test.TestUtils;
@@ -48,6 +49,7 @@ public class PluginDeployerTest {
private File deployDir;
private PluginDeployer deployer;
private Server server = mock(Server.class);
+ private ServerUpgradeStatus serverUpgradeStatus;
@Before
public void start() {
@@ -56,15 +58,18 @@ public class PluginDeployerTest {
deployDir = TestUtils.getTestTempDir(PluginDeployerTest.class, name.getMethodName() + "/deploy");
fileSystem = new DefaultServerFileSystem(null, homeDir, deployDir);
extractor = new PluginInstaller();
- deployer = new PluginDeployer(server, fileSystem, extractor);
+ serverUpgradeStatus = mock(ServerUpgradeStatus.class);
+ deployer = new PluginDeployer(server, serverUpgradeStatus, fileSystem, extractor);
}
@Test
public void deployPlugin() {
+ when(serverUpgradeStatus.isFreshInstall()).thenReturn(false);
+
deployer.start();
// check that the plugin is registered
- assertThat(deployer.getMetadata()).hasSize(1); // no more checkstyle
+ assertThat(deployer.getMetadata()).hasSize(1);
PluginMetadata plugin = deployer.getMetadata("foo");
assertThat(plugin.getName()).isEqualTo("Foo");
@@ -79,6 +84,27 @@ public class PluginDeployerTest {
}
@Test
+ public void deployBundledPluginsOnFreshInstall() {
+ when(serverUpgradeStatus.isFreshInstall()).thenReturn(true);
+
+ deployer.start();
+
+ // check that the plugin is registered
+ assertThat(deployer.getMetadata()).hasSize(2);
+
+ PluginMetadata plugin = deployer.getMetadata("bar");
+ assertThat(plugin.getName()).isEqualTo("Bar");
+ assertThat(plugin.getDeployedFiles()).hasSize(1);
+ assertThat(plugin.isCore()).isFalse();
+ assertThat(plugin.isUseChildFirstClassLoader()).isFalse();
+
+ // check that the file is deployed
+ File deployedJar = new File(deployDir, "plugins/bar/bar-plugin.jar");
+ assertThat(deployedJar).exists();
+ assertThat(deployedJar).isFile();
+ }
+
+ @Test
public void deployPluginExtensions() {
deployer.start();