diff options
Diffstat (limited to 'sonar-application/src/test')
17 files changed, 577 insertions, 52 deletions
diff --git a/sonar-application/src/test/fake-app/conf/logback-access.xml b/sonar-application/src/test/fake-app/conf/logback-access.xml new file mode 100644 index 00000000000..77cfc885d09 --- /dev/null +++ b/sonar-application/src/test/fake-app/conf/logback-access.xml @@ -0,0 +1,17 @@ +<!-- + + See http://logback.qos.ch/access.html#configuration + +--> +<configuration debug="false"> + <contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator"/> + + <appender name="FILE" class="ch.qos.logback.core.FileAppender"> + <file>${SONAR_HOME}/logs/access.log</file> + <encoder> + <pattern>combined</pattern> + </encoder> + </appender> + + <appender-ref ref="FILE" /> +</configuration> diff --git a/sonar-application/src/test/fake-app/conf/sonar.properties b/sonar-application/src/test/fake-app/conf/sonar.properties new file mode 100644 index 00000000000..e8e111dcab8 --- /dev/null +++ b/sonar-application/src/test/fake-app/conf/sonar.properties @@ -0,0 +1,2 @@ +# random open port +sonar.web.port=0
\ No newline at end of file diff --git a/sonar-application/src/test/fake-app/web/META-INF/context.xml b/sonar-application/src/test/fake-app/web/META-INF/context.xml new file mode 100644 index 00000000000..5e31888a15e --- /dev/null +++ b/sonar-application/src/test/fake-app/web/META-INF/context.xml @@ -0,0 +1,2 @@ +<Context antiJARLocking="true" antiResourceLocking="true"> +</Context> diff --git a/sonar-application/src/test/fake-app/web/WEB-INF/web.xml b/sonar-application/src/test/fake-app/web/WEB-INF/web.xml new file mode 100644 index 00000000000..9f13dabf72f --- /dev/null +++ b/sonar-application/src/test/fake-app/web/WEB-INF/web.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://java.sun.com/xml/ns/javaee" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" + id="Fake" + version="3.0" + metadata-complete="true"> + + <display-name>Fake</display-name> + +</web-app> diff --git a/sonar-application/src/test/fake-app/web/index.html b/sonar-application/src/test/fake-app/web/index.html new file mode 100644 index 00000000000..5e1c309dae7 --- /dev/null +++ b/sonar-application/src/test/fake-app/web/index.html @@ -0,0 +1 @@ +Hello World
\ No newline at end of file diff --git a/sonar-application/src/test/java/org/sonar/application/ConnectorsTest.java b/sonar-application/src/test/java/org/sonar/application/ConnectorsTest.java new file mode 100644 index 00000000000..b437227211f --- /dev/null +++ b/sonar-application/src/test/java/org/sonar/application/ConnectorsTest.java @@ -0,0 +1,102 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2013 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * 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.application; + +import org.apache.catalina.connector.Connector; +import org.apache.catalina.startup.Tomcat; +import org.junit.Test; +import org.mockito.ArgumentMatcher; +import org.mockito.Mockito; + +import java.util.Properties; + +import static org.mockito.Matchers.anyInt; +import static org.mockito.Matchers.anyString; +import static org.mockito.Matchers.argThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; + +public class ConnectorsTest { + @Test + public void enable_shutdown_port() throws Exception { + Properties p = new Properties(); + p.setProperty(Connectors.PROPERTY_SHUTDOWN_PORT, "9010"); + p.setProperty(Connectors.PROPERTY_SHUTDOWN_TOKEN, "SHUTDOWN"); + Props props = new Props(p); + + Tomcat tomcat = mock(Tomcat.class, Mockito.RETURNS_DEEP_STUBS); + Connectors.configure(tomcat, props); + + verify(tomcat.getServer()).setPort(9010); + verify(tomcat.getServer()).setShutdown("SHUTDOWN"); + } + + @Test + public void disable_shutdown_port_by_default() throws Exception { + Props props = new Props(new Properties()); + + Tomcat tomcat = mock(Tomcat.class, Mockito.RETURNS_DEEP_STUBS); + Connectors.configure(tomcat, props); + + verify(tomcat.getServer(), never()).setPort(anyInt()); + verify(tomcat.getServer(), never()).setShutdown(anyString()); + } + + @Test + public void configure_thread_pool() throws Exception { + Properties p = new Properties(); + p.setProperty(Connectors.PROPERTY_MIN_THREADS, "2"); + p.setProperty(Connectors.PROPERTY_MAX_THREADS, "30"); + p.setProperty(Connectors.PROPERTY_ACCEPT_COUNT, "20"); + Props props = new Props(p); + + Tomcat tomcat = mock(Tomcat.class, Mockito.RETURNS_DEEP_STUBS); + Connectors.configure(tomcat, props); + + verify(tomcat).setConnector(argThat(new ArgumentMatcher<Connector>() { + @Override + public boolean matches(Object o) { + Connector c = (Connector)o; + return (Integer)c.getProperty("minSpareThreads") == 2 && + (Integer) c.getProperty("maxThreads") == 30 && + (Integer) c.getProperty("acceptCount") == 20; + } + })); + } + + @Test + public void configure_default_thread_pool() throws Exception { + Props props = new Props(new Properties()); + + Tomcat tomcat = mock(Tomcat.class, Mockito.RETURNS_DEEP_STUBS); + Connectors.configure(tomcat, props); + + verify(tomcat).setConnector(argThat(new ArgumentMatcher<Connector>() { + @Override + public boolean matches(Object o) { + Connector c = (Connector)o; + return (Integer)c.getProperty("minSpareThreads") == 5 && + (Integer) c.getProperty("maxThreads") == 50 && + (Integer) c.getProperty("acceptCount") == 25; + } + })); + } +} diff --git a/sonar-application/src/test/java/org/sonar/application/EnvTest.java b/sonar-application/src/test/java/org/sonar/application/EnvTest.java new file mode 100644 index 00000000000..0aab59fa26e --- /dev/null +++ b/sonar-application/src/test/java/org/sonar/application/EnvTest.java @@ -0,0 +1,80 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2013 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * 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.application; + +import org.apache.commons.io.FileUtils; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; + +import java.io.File; + +import static org.fest.assertions.Assertions.assertThat; + +public class EnvTest { + + @Rule + public TemporaryFolder temp = new TemporaryFolder(); + + @Test + public void files() throws Exception { + File home = temp.newFolder(); + File confFile = new File(home, "conf/sonar.properties"); + File logFile = new File(home, "logs/sonar.log"); + + FileUtils.touch(confFile); + FileUtils.touch(logFile); + + Env env = new Env(confFile); + + assertThat(env.rootDir()).isDirectory().exists().isEqualTo(home); + assertThat(env.file("conf/sonar.properties")).isFile().exists().isEqualTo(confFile); + assertThat(env.file("logs/sonar.log")).isFile().exists().isEqualTo(logFile); + assertThat(env.file("xxx/unknown.log")).doesNotExist(); + } + + @Test + public void fresh_dir() throws Exception { + File home = temp.newFolder(); + File confFile = new File(home, "conf/sonar.properties"); + File logFile = new File(home, "logs/sonar.log"); + + FileUtils.touch(confFile); + FileUtils.touch(logFile); + + Env env = new Env(confFile); + + File data = env.freshDir("data/h2"); + assertThat(data).isDirectory().exists(); + assertThat(data.getParentFile().getName()).isEqualTo("data"); + assertThat(data.getParentFile().getParentFile()).isEqualTo(home); + + // clean directory + File logs = env.freshDir("logs"); + assertThat(logs).isDirectory().exists(); + assertThat(logs.listFiles()).isEmpty(); + } + + @Test + public void temp_dir_should_be_writable() throws Exception { + new Env(temp.newFile()).verifyWritableTempDir(); + // do not fail + } +} diff --git a/sonar-application/src/test/java/org/sonar/application/JettyEmbedderTest.java b/sonar-application/src/test/java/org/sonar/application/JettyEmbedderTest.java deleted file mode 100644 index 5c7a35e163c..00000000000 --- a/sonar-application/src/test/java/org/sonar/application/JettyEmbedderTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2013 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * 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.application; - -import org.apache.commons.lang.StringUtils; -import org.junit.Test; - -import static org.fest.assertions.Assertions.assertThat; - -public class JettyEmbedderTest { - - @Test - public void shouldConfigureProgrammatically() throws Exception { - JettyEmbedder jetty = new JettyEmbedder("1.2.3.4", 9999); - - assertThat(jetty.getServer().getConnectors()).hasSize(1); - assertThat(jetty.getServer().getConnectors()[0].getPort()).isEqualTo(9999); - assertThat(jetty.getServer().getConnectors()[0].getHost()).isEqualTo("1.2.3.4"); - } - - @Test - public void shouldLoadPluginsClasspath() throws Exception { - JettyEmbedder jetty = new JettyEmbedder("127.0.0.1", 9999); - - String classpath = jetty.getPluginsClasspath("/org/sonar/application/JettyEmbedderTest/shouldLoadPluginsClasspath"); - classpath = StringUtils.replaceChars(classpath, "\\", "/"); - - assertThat(classpath).contains("org/sonar/application/JettyEmbedderTest/shouldLoadPluginsClasspath/plugin1.jar"); - assertThat(classpath).contains("org/sonar/application/JettyEmbedderTest/shouldLoadPluginsClasspath/plugin1.jar"); - assertThat(classpath).contains("org/sonar/application/JettyEmbedderTest/shouldLoadPluginsClasspath/plugin2.jar"); - - // important : directories end with / - assertThat(classpath).contains("org/sonar/application/JettyEmbedderTest/shouldLoadPluginsClasspath/,"); - } -} diff --git a/sonar-application/src/test/java/org/sonar/application/LoggingTest.java b/sonar-application/src/test/java/org/sonar/application/LoggingTest.java new file mode 100644 index 00000000000..ca5f6ef3c51 --- /dev/null +++ b/sonar-application/src/test/java/org/sonar/application/LoggingTest.java @@ -0,0 +1,68 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2013 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * 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.application; + +import ch.qos.logback.access.tomcat.LogbackValve; +import org.apache.catalina.Valve; +import org.apache.catalina.startup.Tomcat; +import org.junit.Test; +import org.mockito.ArgumentMatcher; +import org.mockito.Mockito; + +import java.io.File; + +import static org.fest.assertions.Assertions.assertThat; +import static org.fest.assertions.Fail.fail; +import static org.mockito.Matchers.argThat; +import static org.mockito.Mockito.*; + +public class LoggingTest { + @Test + public void configure_access_logs() throws Exception { + Tomcat tomcat = mock(Tomcat.class, Mockito.RETURNS_DEEP_STUBS); + Env env = mock(Env.class); + final File propsFile = new File(getClass().getResource("/org/sonar/application/LoggingTest/logback-access.xml").toURI()); + when(env.file(Logging.CONF_PATH)).thenReturn(propsFile); + Logging.configure(tomcat, env); + + verify(tomcat.getHost().getPipeline()).addValve(argThat(new ArgumentMatcher<Valve>() { + @Override + public boolean matches(Object o) { + LogbackValve v = (LogbackValve) o; + return v.getFilename().equals(propsFile.getAbsolutePath()); + } + })); + } + + @Test + public void fail_if_missing_conf_file() throws Exception { + Tomcat tomcat = mock(Tomcat.class, Mockito.RETURNS_DEEP_STUBS); + Env env = mock(Env.class); + final File confFile = new File("target/does_not_exist/logback-access.xml"); + when(env.file(Logging.CONF_PATH)).thenReturn(confFile); + + try { + Logging.configure(tomcat, env); + fail(); + } catch (IllegalStateException e) { + assertThat(e).hasMessage("File is missing: " + confFile.getAbsolutePath()); + } + } +} diff --git a/sonar-application/src/test/java/org/sonar/application/NullJarScannerTest.java b/sonar-application/src/test/java/org/sonar/application/NullJarScannerTest.java new file mode 100644 index 00000000000..50e3a9a60d0 --- /dev/null +++ b/sonar-application/src/test/java/org/sonar/application/NullJarScannerTest.java @@ -0,0 +1,43 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2013 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * 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.application; + +import org.apache.tomcat.JarScannerCallback; +import org.junit.Test; + +import javax.servlet.ServletContext; +import java.util.HashSet; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verifyZeroInteractions; + +public class NullJarScannerTest { + + @Test + public void does_nothing() { + ServletContext context = mock(ServletContext.class); + ClassLoader classloader = mock(ClassLoader.class); + JarScannerCallback callback = mock(JarScannerCallback.class); + + new NullJarScanner().scan(context, classloader, callback, new HashSet<String>()); + + verifyZeroInteractions(context, classloader, callback); + } +} diff --git a/sonar-application/src/test/java/org/sonar/application/PropsTest.java b/sonar-application/src/test/java/org/sonar/application/PropsTest.java new file mode 100644 index 00000000000..b2bd5d0fd69 --- /dev/null +++ b/sonar-application/src/test/java/org/sonar/application/PropsTest.java @@ -0,0 +1,98 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2013 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * 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.application; + +import org.junit.Test; + +import java.io.File; +import java.util.Properties; + +import static org.fest.assertions.Assertions.assertThat; +import static org.fest.assertions.Fail.fail; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +public class PropsTest { + @Test + public void of() throws Exception { + Properties p = new Properties(); + p.setProperty("foo", "bar"); + Props props = new Props(p); + + assertThat(props.of("foo")).isEqualTo("bar"); + assertThat(props.of("foo", "default value")).isEqualTo("bar"); + assertThat(props.of("unknown")).isNull(); + assertThat(props.of("unknown", "default value")).isEqualTo("default value"); + } + + @Test + public void intOf() throws Exception { + Properties p = new Properties(); + p.setProperty("foo", "33"); + Props props = new Props(p); + + assertThat(props.intOf("foo")).isEqualTo(33); + assertThat(props.intOf("foo", 44)).isEqualTo(33); + assertThat(props.intOf("unknown")).isNull(); + assertThat(props.intOf("unknown", 44)).isEqualTo(44); + } + + @Test + public void intOf_not_integer() throws Exception { + Properties p = new Properties(); + p.setProperty("foo", "bar"); + Props props = new Props(p); + + try { + props.intOf("foo"); + fail(); + } catch (IllegalStateException e) { + assertThat(e).hasMessage("Value of property foo is not an integer: bar"); + } + } + + @Test + public void load_file_and_system_properties() throws Exception { + Env env = mock(Env.class); + File propsFile = new File(getClass().getResource("/org/sonar/application/PropsTest/sonar.properties").toURI()); + when(env.file("conf/sonar.properties")).thenReturn(propsFile); + + Props props = Props.create(env); + + assertThat(props.of("foo")).isEqualTo("bar"); + assertThat(props.of("java.version")).isNotNull(); + + // system properties override file properties + assertThat(props.of("java.io.tmpdir")).isNotEmpty().isNotEqualTo("/should/be/overridden"); + } + + @Test + public void fail_if_file_does_not_exist() throws Exception { + Env env = mock(Env.class); + when(env.file("conf/sonar.properties")).thenReturn(new File("target/not_exist/sonar.properties")); + + try { + Props.create(env); + fail(); + } catch (IllegalStateException e) { + assertThat(e).hasMessage("File does not exist or can't be open: target/not_exist/sonar.properties"); + } + } +} diff --git a/sonar-application/src/test/java/org/sonar/application/StartServerTest.java b/sonar-application/src/test/java/org/sonar/application/StartServerTest.java new file mode 100644 index 00000000000..868a51288d2 --- /dev/null +++ b/sonar-application/src/test/java/org/sonar/application/StartServerTest.java @@ -0,0 +1,150 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2013 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * 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.application; + +import com.github.kevinsawicki.http.HttpRequest; +import org.apache.commons.io.FileUtils; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.io.File; +import java.io.IOException; + +import static org.fest.assertions.Assertions.assertThat; +import static org.fest.assertions.Fail.fail; + +public class StartServerTest { + + Env env = new Env(locateFakeConfFile()); + StartServer starter = new StartServer(env); + + @Before + @After + public void clean_generated_dirs() throws IOException { + FileUtils.deleteDirectory(env.file("temp")); + FileUtils.deleteDirectory(env.file("logs")); + } + + @Test + public void start_server() throws Exception { + BackgroundThread background = new BackgroundThread(starter); + int port = 0; + try { + background.start(); + boolean started = false; + for (int i = 0; i < 100; i++) { + // Waiting for server to be started. + // A random and open port is used (see conf/sonar.properties) + Thread.sleep(500L); + if (verifyUp() && verifyLogs()) { + port = starter.port(); + started = true; + break; + } + } + assertThat(started).isTrue(); + } finally { + starter.stop(); + } + + // Server is down + try { + assertThat(HttpRequest.get("http://localhost:" + port).ok()).isFalse(); + } catch (HttpRequest.HttpRequestException e) { + // ok + } + } + + private boolean verifyUp() { + if (starter.port() > 0) { + String url = "http://localhost:" + starter.port() + "/index.html"; + HttpRequest request = HttpRequest.get(url); + if (request.ok() && "Hello World".equals(request.body(HttpRequest.CHARSET_UTF8))) { + return true; + } + } + return false; + } + + private boolean verifyLogs() { + File logFile = env.file("logs/access.log"); + return logFile.isFile() && logFile.exists() && logFile.length()>0; + } + + @Test + public void fail_if_started_twice() throws Exception { + BackgroundThread background = new BackgroundThread(starter); + try { + background.start(); + boolean started = false; + for (int i = 0; i < 100; i++) { + // Waiting for server to be started. + // A random and open port is used (see conf/sonar.properties) + Thread.sleep(500L); + if (starter.port() > 0) { + try { + starter.start(); + fail(); + } catch (IllegalStateException e) { + assertThat(e.getMessage()).isEqualTo("Tomcat is already started"); + started = true; + break; + } + } + } + assertThat(started).isTrue(); + + } finally { + starter.stop(); + } + } + + @Test + public void ignore_stop_if_not_running() throws Exception { + starter.stop(); + starter.stop(); + } + + private File locateFakeConfFile() { + File confFile = new File("src/test/fake-app/conf/sonar.properties"); + if (!confFile.exists()) { + confFile = new File("sonar-application/src/test/fake-app/conf/sonar.properties"); + } + return confFile; + } + + static class BackgroundThread extends Thread { + private StartServer server; + + BackgroundThread(StartServer server) { + this.server = server; + } + + @Override + public void run() { + try { + server.start(); + } catch (Exception e) { + throw new IllegalStateException(e); + } + } + } +} diff --git a/sonar-application/src/test/resources/org/sonar/application/JettyEmbedderTest/shouldLoadPluginsClasspath/foo.xml b/sonar-application/src/test/resources/org/sonar/application/JettyEmbedderTest/shouldLoadPluginsClasspath/foo.xml deleted file mode 100644 index e69de29bb2d..00000000000 --- a/sonar-application/src/test/resources/org/sonar/application/JettyEmbedderTest/shouldLoadPluginsClasspath/foo.xml +++ /dev/null diff --git a/sonar-application/src/test/resources/org/sonar/application/JettyEmbedderTest/shouldLoadPluginsClasspath/plugin1.jar b/sonar-application/src/test/resources/org/sonar/application/JettyEmbedderTest/shouldLoadPluginsClasspath/plugin1.jar deleted file mode 100644 index e69de29bb2d..00000000000 --- a/sonar-application/src/test/resources/org/sonar/application/JettyEmbedderTest/shouldLoadPluginsClasspath/plugin1.jar +++ /dev/null diff --git a/sonar-application/src/test/resources/org/sonar/application/JettyEmbedderTest/shouldLoadPluginsClasspath/plugin2.jar b/sonar-application/src/test/resources/org/sonar/application/JettyEmbedderTest/shouldLoadPluginsClasspath/plugin2.jar deleted file mode 100644 index e69de29bb2d..00000000000 --- a/sonar-application/src/test/resources/org/sonar/application/JettyEmbedderTest/shouldLoadPluginsClasspath/plugin2.jar +++ /dev/null diff --git a/sonar-application/src/test/resources/org/sonar/application/LoggingTest/logback-access.xml b/sonar-application/src/test/resources/org/sonar/application/LoggingTest/logback-access.xml new file mode 100644 index 00000000000..298193e01fa --- /dev/null +++ b/sonar-application/src/test/resources/org/sonar/application/LoggingTest/logback-access.xml @@ -0,0 +1 @@ +<configuration/> diff --git a/sonar-application/src/test/resources/org/sonar/application/PropsTest/sonar.properties b/sonar-application/src/test/resources/org/sonar/application/PropsTest/sonar.properties new file mode 100644 index 00000000000..b73be15411b --- /dev/null +++ b/sonar-application/src/test/resources/org/sonar/application/PropsTest/sonar.properties @@ -0,0 +1,2 @@ +foo=bar +java.io.tmpdir=/should/be/overridden |