diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2011-05-27 15:15:17 +0200 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2011-05-27 15:15:17 +0200 |
commit | 78f121539257fda264f929a4d596e3919eaafdcc (patch) | |
tree | 7434523cec2a7a9298e209d2e7284d13e871e4f1 /sonar-batch | |
parent | 5bfa0ea11539a3a175532a2eb97fea60c05d5dae (diff) | |
download | sonarqube-78f121539257fda264f929a4d596e3919eaafdcc.tar.gz sonarqube-78f121539257fda264f929a4d596e3919eaafdcc.zip |
Rename org.sonar.batch.ExtensionDownloader to ArtifactDownloader
Diffstat (limited to 'sonar-batch')
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/bootstrap/ArtifactDownloader.java (renamed from sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionDownloader.java) | 7 | ||||
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchPluginRepository.java | 4 | ||||
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/bootstrap/BootstrapClassLoader.java | 2 | ||||
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/bootstrap/BootstrapModule.java | 2 | ||||
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/bootstrap/Module.java | 1 | ||||
-rw-r--r-- | sonar-batch/src/test/java/org/sonar/batch/bootstrap/ArtifactDownloaderTest.java (renamed from sonar-batch/src/test/java/org/sonar/batch/bootstrap/ExtensionDownloaderTest.java) | 6 | ||||
-rw-r--r-- | sonar-batch/src/test/java/org/sonar/batch/bootstrap/BatchPluginRepositoryTest.java | 6 |
7 files changed, 12 insertions, 16 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionDownloader.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ArtifactDownloader.java index 397838986f7..6aa16b1c1e1 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionDownloader.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ArtifactDownloader.java @@ -29,16 +29,13 @@ import java.io.File; import java.net.URI; import java.net.URISyntaxException; -/** - * TODO this class should be renamed ArtifactDownloader, because it does not relate only to plugin extensions. - */ -public class ExtensionDownloader implements BatchComponent { +public class ArtifactDownloader implements BatchComponent { private HttpDownloader httpDownloader; private TempDirectories workingDirectories; private String baseUrl; - public ExtensionDownloader(HttpDownloader httpDownloader, TempDirectories workingDirectories, ServerMetadata server) { + public ArtifactDownloader(HttpDownloader httpDownloader, TempDirectories workingDirectories, ServerMetadata server) { this.httpDownloader = httpDownloader; this.workingDirectories = workingDirectories; this.baseUrl = server.getURL(); diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchPluginRepository.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchPluginRepository.java index b647df8bc7a..47270c198ab 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchPluginRepository.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchPluginRepository.java @@ -47,10 +47,10 @@ public class BatchPluginRepository implements PluginRepository { private static final Logger LOG = LoggerFactory.getLogger(BatchPluginRepository.class); private JpaPluginDao dao; - private ExtensionDownloader artifactDownloader; + private ArtifactDownloader artifactDownloader; private Map<String, Plugin> pluginsByKey; - public BatchPluginRepository(JpaPluginDao dao, ExtensionDownloader artifactDownloader) { + public BatchPluginRepository(JpaPluginDao dao, ArtifactDownloader artifactDownloader) { this.dao = dao; this.artifactDownloader = artifactDownloader; // TODO reactivate somewhere else: LOG.info("Execution environment: {} {}", environment.getKey(), environment.getVersion()); diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BootstrapClassLoader.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BootstrapClassLoader.java index e9ec1e8cf7c..ca00f9a0691 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BootstrapClassLoader.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BootstrapClassLoader.java @@ -33,7 +33,7 @@ public class BootstrapClassLoader { private URLClassLoader classLoader; - public BootstrapClassLoader(ExtensionDownloader extensionDownloader) { + public BootstrapClassLoader(ArtifactDownloader extensionDownloader) { this(extensionDownloader.downloadJdbcDriver()); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BootstrapModule.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BootstrapModule.java index 10546623f32..fda540156a8 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BootstrapModule.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BootstrapModule.java @@ -55,7 +55,7 @@ public class BootstrapModule extends Module { addComponent(ServerMetadata.class);// registered here because used by BootstrapClassLoader addComponent(TempDirectories.class);// registered here because used by BootstrapClassLoader addComponent(HttpDownloader.class);// registered here because used by BootstrapClassLoader - addComponent(ExtensionDownloader.class);// registered here because used by BootstrapClassLoader + addComponent(ArtifactDownloader.class);// registered here because used by BootstrapClassLoader addComponent(BootstrapClassLoader.class); URLClassLoader bootstrapClassLoader = getComponent(BootstrapClassLoader.class).getClassLoader(); diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/Module.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/Module.java index 2c0d289b548..0fab9682c7b 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/Module.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/Module.java @@ -30,7 +30,6 @@ import java.util.List; * Module describes group of components - {@link #configure()}. * Several modules can be grouped together - {@link #install(Module)}, {@link #installChild(Module)}. * <p/> - * TODO Move to org.sonar.batch.bootstrap ? */ public abstract class Module { diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ExtensionDownloaderTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ArtifactDownloaderTest.java index ab9a0aad137..e318ca69249 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ExtensionDownloaderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ArtifactDownloaderTest.java @@ -33,7 +33,7 @@ import java.net.URISyntaxException; import static org.junit.Assert.assertNotNull; import static org.mockito.Mockito.*; -public class ExtensionDownloaderTest { +public class ArtifactDownloaderTest { @Test public void shouldDownloadJdbcDriver() throws IOException, URISyntaxException { @@ -43,7 +43,7 @@ public class ExtensionDownloaderTest { HttpDownloader httpDownloader = mock(HttpDownloader.class); TempDirectories workingDirectories = new TempDirectories(); - ExtensionDownloader downloader = new ExtensionDownloader(httpDownloader, workingDirectories, server); + ArtifactDownloader downloader = new ArtifactDownloader(httpDownloader, workingDirectories, server); File jdbcDriver = downloader.downloadJdbcDriver(); assertNotNull(jdbcDriver); @@ -58,7 +58,7 @@ public class ExtensionDownloaderTest { HttpDownloader httpDownloader = mock(HttpDownloader.class); TempDirectories workingDirectories = new TempDirectories(); - ExtensionDownloader downloader = new ExtensionDownloader(httpDownloader, workingDirectories, server); + ArtifactDownloader downloader = new ArtifactDownloader(httpDownloader, workingDirectories, server); JpaPluginFile extension = new JpaPluginFile(new JpaPlugin("findbugs"), "bcel.jar"); File bcel = downloader.downloadExtension(extension); diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/BatchPluginRepositoryTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/BatchPluginRepositoryTest.java index 6e848f4278d..0c617bf4271 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/BatchPluginRepositoryTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/BatchPluginRepositoryTest.java @@ -43,7 +43,7 @@ public class BatchPluginRepositoryTest { @Test public void shouldLoadPlugin() { - ExtensionDownloader extensionDownloader = mock(ExtensionDownloader.class); + ArtifactDownloader extensionDownloader = mock(ArtifactDownloader.class); when(extensionDownloader.downloadExtension(any(JpaPluginFile.class))).thenReturn( FileUtils.toFile(getClass().getResource("/org/sonar/batch/bootstrap/BatchPluginRepositoryTest/sonar-artifact-size-plugin-0.2.jar"))); BatchPluginRepository repository = new BatchPluginRepository(null, extensionDownloader); @@ -64,7 +64,7 @@ public class BatchPluginRepositoryTest { */ @Test public void shouldPluginExtensionInTheSameClassloader() { - ExtensionDownloader extensionDownloader = mock(ExtensionDownloader.class); + ArtifactDownloader extensionDownloader = mock(ArtifactDownloader.class); prepareDownloader(extensionDownloader, "artifactsize", "/org/sonar/batch/bootstrap/BatchPluginRepositoryTest/sonar-artifact-size-plugin-0.2.jar"); prepareDownloader(extensionDownloader, "clirr", "/org/sonar/batch/bootstrap/BatchPluginRepositoryTest/sonar-clirr-plugin-1.1.jar"); BatchPluginRepository repository = new BatchPluginRepository(null, extensionDownloader); @@ -85,7 +85,7 @@ public class BatchPluginRepositoryTest { assertThat(entryPointBase.getClass().getClassLoader(), is(entryPointExtension.getClass().getClassLoader())); } - private void prepareDownloader(ExtensionDownloader extensionDownloader, final String pluginKey, final String filename) { + private void prepareDownloader(ArtifactDownloader extensionDownloader, final String pluginKey, final String filename) { when(extensionDownloader.downloadExtension(argThat(new BaseMatcher<JpaPluginFile>() { public boolean matches(Object o) { return o != null && ((JpaPluginFile) o).getPluginKey().equals(pluginKey); |