diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2014-03-16 00:08:39 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2014-03-16 00:08:39 +0100 |
commit | f40d89dd7beef93e10fea0d9a8885a7ac78543bd (patch) | |
tree | 6d51966410f64a79f5c115fda4f0a1c85e057fec /sonar-server/src/test/java/org/sonar | |
parent | 0703df654d4166a553f9b5f6d392341a116e2e3f (diff) | |
download | sonarqube-f40d89dd7beef93e10fea0d9a8885a7ac78543bd.tar.gz sonarqube-f40d89dd7beef93e10fea0d9a8885a7ac78543bd.zip |
Refactor org.sonar.server.plugins.ApplicationDeployer
Diffstat (limited to 'sonar-server/src/test/java/org/sonar')
-rw-r--r-- | sonar-server/src/test/java/org/sonar/server/platform/ClassLoaderUtilsTest.java (renamed from sonar-server/src/test/java/org/sonar/server/plugins/ClassLoaderUtilsTest.java) | 5 | ||||
-rw-r--r-- | sonar-server/src/test/java/org/sonar/server/platform/RailsAppsDeployerTest.java (renamed from sonar-server/src/test/java/org/sonar/server/plugins/ApplicationDeployerTest.java) | 24 |
2 files changed, 16 insertions, 13 deletions
diff --git a/sonar-server/src/test/java/org/sonar/server/plugins/ClassLoaderUtilsTest.java b/sonar-server/src/test/java/org/sonar/server/platform/ClassLoaderUtilsTest.java index 21ef3d6c3f8..400da37c733 100644 --- a/sonar-server/src/test/java/org/sonar/server/plugins/ClassLoaderUtilsTest.java +++ b/sonar-server/src/test/java/org/sonar/server/platform/ClassLoaderUtilsTest.java @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.server.plugins; +package org.sonar.server.platform; import com.google.common.base.Function; import com.google.common.base.Predicate; @@ -29,6 +29,7 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; +import org.sonar.server.platform.ClassLoaderUtils; import javax.annotation.Nullable; import java.io.File; @@ -52,7 +53,7 @@ public class ClassLoaderUtilsTest { // org/sonar/sqale/app/copyright.txt // org/sonar/sqale/app/README.md // org/sonar/other/other.txt - URL jarUrl = getClass().getResource("/org/sonar/server/plugins/ClassLoaderUtilsTest/ClassLoaderUtilsTest.jar"); + URL jarUrl = getClass().getResource("/org/sonar/server/platform/ClassLoaderUtilsTest/ClassLoaderUtilsTest.jar"); classLoader = new URLClassLoader(new URL[]{jarUrl}, /* no parent classloader */null); } diff --git a/sonar-server/src/test/java/org/sonar/server/plugins/ApplicationDeployerTest.java b/sonar-server/src/test/java/org/sonar/server/platform/RailsAppsDeployerTest.java index 3c5728ef582..daec51fbd2f 100644 --- a/sonar-server/src/test/java/org/sonar/server/plugins/ApplicationDeployerTest.java +++ b/sonar-server/src/test/java/org/sonar/server/platform/RailsAppsDeployerTest.java @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.server.plugins; +package org.sonar.server.platform; import org.apache.commons.io.FileUtils; import org.junit.Rule; @@ -33,11 +33,13 @@ import java.net.URLClassLoader; import java.util.Collections; import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class ApplicationDeployerTest { +public class RailsAppsDeployerTest { @Rule public TemporaryFolder temp = new TemporaryFolder(); @@ -45,19 +47,19 @@ public class ApplicationDeployerTest { @Test public void hasRubyRailsApp() throws Exception { ClassLoader classLoader = new URLClassLoader(new URL[]{ - getClass().getResource("/org/sonar/server/plugins/ApplicationDeployerTest/FakeRubyRailsApp.jar").toURI().toURL()}, null); + getClass().getResource("/org/sonar/server/platform/RailsAppsDeployerTest/FakeRubyRailsApp.jar").toURI().toURL()}, null); - assertTrue(ApplicationDeployer.hasRubyRailsApp("fake", classLoader)); - assertFalse(ApplicationDeployer.hasRubyRailsApp("other", classLoader)); + assertTrue(RailsAppsDeployer.hasRailsApp("fake", classLoader)); + assertFalse(RailsAppsDeployer.hasRailsApp("other", classLoader)); } @Test public void deployRubyRailsApp() throws Exception { File tempDir = this.temp.getRoot(); ClassLoader classLoader = new URLClassLoader(new URL[]{ - getClass().getResource("/org/sonar/server/plugins/ApplicationDeployerTest/FakeRubyRailsApp.jar").toURI().toURL()}, null); + getClass().getResource("/org/sonar/server/platform/RailsAppsDeployerTest/FakeRubyRailsApp.jar").toURI().toURL()}, null); - ApplicationDeployer.deployRubyRailsApp(tempDir, "fake", classLoader); + RailsAppsDeployer.deployRailsApp(tempDir, "fake", classLoader); File appDir = new File(tempDir, "fake"); assertThat(appDir.isDirectory(), is(true)); @@ -76,7 +78,7 @@ public class ApplicationDeployerTest { PluginRepository pluginRepository = mock(PluginRepository.class); when(pluginRepository.getMetadata()).thenReturn(Collections.<PluginMetadata>emptyList()); - new ApplicationDeployer(fileSystem, pluginRepository).start(); + new RailsAppsDeployer(fileSystem, pluginRepository).start(); File appDir = new File(tempDir, "ror"); assertThat(appDir.isDirectory(), is(true)); @@ -90,7 +92,7 @@ public class ApplicationDeployerTest { File tempDir = this.temp.getRoot(); when(fileSystem.getTempDir()).thenReturn(tempDir); - File dir = new ApplicationDeployer(fileSystem, mock(PluginRepository.class)).prepareRubyRailsRootDirectory(); + File dir = new RailsAppsDeployer(fileSystem, mock(PluginRepository.class)).prepareRailsDirectory(); assertThat(dir.isDirectory(), is(true)); assertThat(dir.exists(), is(true)); @@ -106,7 +108,7 @@ public class ApplicationDeployerTest { File file = new File(tempDir, "ror/foo/bar.txt"); FileUtils.writeStringToFile(file, "foooo"); - File dir = new ApplicationDeployer(fileSystem, mock(PluginRepository.class)).prepareRubyRailsRootDirectory(); + File dir = new RailsAppsDeployer(fileSystem, mock(PluginRepository.class)).prepareRailsDirectory(); assertThat(dir.isDirectory(), is(true)); assertThat(dir.exists(), is(true)); |