aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-ce
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-ce')
-rw-r--r--server/sonar-ce/src/main/java/org/sonar/ce/container/CePluginJarExploder.java2
-rw-r--r--server/sonar-ce/src/main/java/org/sonar/ce/container/CePluginRepository.java11
-rw-r--r--server/sonar-ce/src/test/java/org/sonar/ce/container/CePluginJarExploderTest.java7
-rw-r--r--server/sonar-ce/src/test/java/org/sonar/ce/container/CePluginRepositoryTest.java8
4 files changed, 19 insertions, 9 deletions
diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/container/CePluginJarExploder.java b/server/sonar-ce/src/main/java/org/sonar/ce/container/CePluginJarExploder.java
index 1560d042832..18959e76b31 100644
--- a/server/sonar-ce/src/main/java/org/sonar/ce/container/CePluginJarExploder.java
+++ b/server/sonar-ce/src/main/java/org/sonar/ce/container/CePluginJarExploder.java
@@ -28,7 +28,7 @@ import org.sonar.core.platform.PluginInfo;
import org.sonar.core.platform.PluginJarExploder;
/**
- * Explodes the plugin JARs of extensions/plugins/ into a temporary directory
+ * Explodes the plugin JARs of extensions/plugins or lib/extensions into a temporary directory
* dedicated to compute engine.
*/
public class CePluginJarExploder extends PluginJarExploder {
diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/container/CePluginRepository.java b/server/sonar-ce/src/main/java/org/sonar/ce/container/CePluginRepository.java
index 14b11ada9ca..4c9476647ce 100644
--- a/server/sonar-ce/src/main/java/org/sonar/ce/container/CePluginRepository.java
+++ b/server/sonar-ce/src/main/java/org/sonar/ce/container/CePluginRepository.java
@@ -64,12 +64,17 @@ public class CePluginRepository implements PluginRepository, Startable {
@Override
public void start() {
Loggers.get(getClass()).info("Load plugins");
- for (File file : listJarFiles(fs.getInstalledPluginsDir())) {
+ registerPluginsFromDir(fs.getInstalledBundledPluginsDir());
+ registerPluginsFromDir(fs.getInstalledExternalPluginsDir());
+ pluginInstancesByKeys.putAll(loader.load(pluginInfosByKeys));
+ started.set(true);
+ }
+
+ private void registerPluginsFromDir(File pluginsDir) {
+ for (File file : listJarFiles(pluginsDir)) {
PluginInfo info = PluginInfo.create(file);
pluginInfosByKeys.put(info.getKey(), info);
}
- pluginInstancesByKeys.putAll(loader.load(pluginInfosByKeys));
- started.set(true);
}
@Override
diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/container/CePluginJarExploderTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/container/CePluginJarExploderTest.java
index 94de2f97a88..e7136f2c67f 100644
--- a/server/sonar-ce/src/test/java/org/sonar/ce/container/CePluginJarExploderTest.java
+++ b/server/sonar-ce/src/test/java/org/sonar/ce/container/CePluginJarExploderTest.java
@@ -125,7 +125,12 @@ public class CePluginJarExploderTest {
}
@Override
- public File getInstalledPluginsDir() {
+ public File getInstalledExternalPluginsDir() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public File getInstalledBundledPluginsDir() {
throw new UnsupportedOperationException();
}
diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/container/CePluginRepositoryTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/container/CePluginRepositoryTest.java
index ef691a2150f..047eebf6ead 100644
--- a/server/sonar-ce/src/test/java/org/sonar/ce/container/CePluginRepositoryTest.java
+++ b/server/sonar-ce/src/test/java/org/sonar/ce/container/CePluginRepositoryTest.java
@@ -58,7 +58,7 @@ public class CePluginRepositoryTest {
@Test
public void empty_plugins() throws Exception {
// empty folder
- when(fs.getInstalledPluginsDir()).thenReturn(temp.newFolder());
+ when(fs.getInstalledExternalPluginsDir()).thenReturn(temp.newFolder());
underTest.start();
@@ -69,7 +69,7 @@ public class CePluginRepositoryTest {
@Test
public void load_plugins() {
String pluginKey = "test";
- when(fs.getInstalledPluginsDir()).thenReturn(new File("src/test/plugins/sonar-test-plugin/target"));
+ when(fs.getInstalledExternalPluginsDir()).thenReturn(new File("src/test/plugins/sonar-test-plugin/target"));
underTest.start();
@@ -85,7 +85,7 @@ public class CePluginRepositoryTest {
expectedException.expectMessage("Plugin [foo] does not exist");
// empty folder
- when(fs.getInstalledPluginsDir()).thenReturn(temp.newFolder());
+ when(fs.getInstalledExternalPluginsDir()).thenReturn(temp.newFolder());
underTest.start();
underTest.getPluginInfo("foo");
}
@@ -96,7 +96,7 @@ public class CePluginRepositoryTest {
expectedException.expectMessage("Plugin [foo] does not exist");
// empty folder
- when(fs.getInstalledPluginsDir()).thenReturn(temp.newFolder());
+ when(fs.getInstalledExternalPluginsDir()).thenReturn(temp.newFolder());
underTest.start();
underTest.getPluginInstance("foo");
}