diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-07-26 14:14:33 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-07-29 10:31:31 +0200 |
commit | 7ce0fb39f58c6fd4d01075944e1756909fd6abc3 (patch) | |
tree | 57f20c617ec40e7031a12abb17d08b87cc984c57 /server/sonar-ce/src | |
parent | 13c05cb112bb10b2706d97b432d8208cd503208f (diff) | |
download | sonarqube-7ce0fb39f58c6fd4d01075944e1756909fd6abc3.tar.gz sonarqube-7ce0fb39f58c6fd4d01075944e1756909fd6abc3.zip |
SONAR-7899 Refactor server file system
- new interface org.sonar.server.platform.ServerFileSystem
- deprecate org.sonar.api.platform.Server#getDeployDir()
Diffstat (limited to 'server/sonar-ce/src')
5 files changed, 47 insertions, 12 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 a9d64dd3c37..67587fbd760 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 @@ -21,7 +21,7 @@ package org.sonar.ce.container; import java.io.File; import org.apache.commons.io.FileUtils; -import org.sonar.api.platform.ServerFileSystem; +import org.sonar.server.platform.ServerFileSystem; import org.sonar.api.utils.ZipUtils; import org.sonar.core.platform.ExplodedPlugin; import org.sonar.core.platform.PluginInfo; 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 0f24f3d6b1d..540f93f2fe8 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 @@ -33,7 +33,7 @@ import org.sonar.api.utils.log.Loggers; import org.sonar.core.platform.PluginInfo; import org.sonar.core.platform.PluginLoader; import org.sonar.core.platform.PluginRepository; -import org.sonar.server.platform.DefaultServerFileSystem; +import org.sonar.server.platform.ServerFileSystem; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkState; @@ -48,7 +48,7 @@ public class CePluginRepository implements PluginRepository, Startable { private static final String[] JAR_FILE_EXTENSIONS = new String[] {"jar"}; private static final String NOT_STARTED_YET = "not started yet"; - private final DefaultServerFileSystem fs; + private final ServerFileSystem fs; private final PluginLoader loader; private final AtomicBoolean started = new AtomicBoolean(false); @@ -56,7 +56,7 @@ public class CePluginRepository implements PluginRepository, Startable { private final Map<String, PluginInfo> pluginInfosByKeys = new HashMap<>(); private final Map<String, Plugin> pluginInstancesByKeys = new HashMap<>(); - public CePluginRepository(DefaultServerFileSystem fs, PluginLoader loader) { + public CePluginRepository(ServerFileSystem fs, PluginLoader loader) { this.fs = fs; this.loader = loader; } diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java index b3d4233e5c9..bab0a7282d1 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java @@ -70,9 +70,9 @@ import org.sonar.server.component.ComponentCleanerService; import org.sonar.server.component.ComponentFinder; import org.sonar.server.component.ComponentService; import org.sonar.server.computation.CeModule; -import org.sonar.server.computation.task.projectanalysis.ProjectAnalysisTaskModule; import org.sonar.server.computation.CeQueueModule; import org.sonar.server.computation.queue.PurgeCeActivities; +import org.sonar.server.computation.task.projectanalysis.ProjectAnalysisTaskModule; import org.sonar.server.computation.taskprocessor.CeTaskProcessorModule; import org.sonar.server.debt.DebtModelPluginRepository; import org.sonar.server.debt.DebtRulesXMLImporter; @@ -99,9 +99,9 @@ import org.sonar.server.notification.NotificationService; import org.sonar.server.notification.email.AlertsEmailTemplate; import org.sonar.server.notification.email.EmailNotificationChannel; import org.sonar.server.platform.DatabaseServerCompatibility; -import org.sonar.server.platform.DefaultServerFileSystem; import org.sonar.server.platform.DefaultServerUpgradeStatus; import org.sonar.server.platform.PersistentSettings; +import org.sonar.server.platform.ServerFileSystemImpl; import org.sonar.server.platform.ServerImpl; import org.sonar.server.platform.ServerLifecycleNotifier; import org.sonar.server.platform.ServerLogging; @@ -216,7 +216,7 @@ public class ComputeEngineContainerImpl implements ComputeEngineContainer { DatabaseServerCompatibility.class, DatabaseVersion.class, PurgeProfiler.class, - DefaultServerFileSystem.class, + ServerFileSystemImpl.class, // no TempFolderCleaner.class, responsibility of Web Server new TempFolderProvider(), System2.INSTANCE, 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 4062a8747f3..59be2e53d21 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 @@ -24,7 +24,7 @@ import java.io.IOException; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.sonar.api.platform.ServerFileSystem; +import org.sonar.server.platform.ServerFileSystem; import org.sonar.core.platform.ExplodedPlugin; import org.sonar.core.platform.PluginInfo; @@ -98,6 +98,16 @@ public class CePluginJarExploderTest { } @Override + public File getDataDir() { + throw new UnsupportedOperationException(); + } + + @Override + public File getDeployDir() { + throw new UnsupportedOperationException(); + } + + @Override public File getHomeDir() { throw new UnsupportedOperationException(); } @@ -114,5 +124,30 @@ public class CePluginJarExploderTest { return tempDir; } + @Override + public File getDeployedPluginsDir() { + throw new UnsupportedOperationException(); + } + + @Override + public File getDownloadedPluginsDir() { + throw new UnsupportedOperationException(); + } + + @Override + public File getInstalledPluginsDir() { + throw new UnsupportedOperationException(); + } + + @Override + public File getBundledPluginsDir() { + throw new UnsupportedOperationException(); + } + + @Override + public File getPluginIndex() { + 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 a7ebbc8eff3..09c044809bf 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 @@ -32,7 +32,7 @@ import org.mockito.Mockito; import org.sonar.api.Plugin; import org.sonar.core.platform.PluginInfo; import org.sonar.core.platform.PluginLoader; -import org.sonar.server.platform.DefaultServerFileSystem; +import org.sonar.server.platform.ServerFileSystem; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; @@ -46,9 +46,9 @@ public class CePluginRepositoryTest { @Rule public ExpectedException expectedException = ExpectedException.none(); - DefaultServerFileSystem fs = mock(DefaultServerFileSystem.class, Mockito.RETURNS_DEEP_STUBS); - PluginLoader pluginLoader = new DumbPluginLoader(); - CePluginRepository underTest = new CePluginRepository(fs, pluginLoader); + private ServerFileSystem fs = mock(ServerFileSystem.class, Mockito.RETURNS_DEEP_STUBS); + private PluginLoader pluginLoader = new DumbPluginLoader(); + private CePluginRepository underTest = new CePluginRepository(fs, pluginLoader); @After public void tearDown() { |