diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2017-01-25 10:50:24 +0100 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2017-01-26 17:52:52 +0100 |
commit | b035830c7b7d14a42e72dd8cd0249bbf26f2628f (patch) | |
tree | 8d07380199c790f2c49f59168006f6b1dda038b3 | |
parent | b48ef5e2fc174a391a050a00ed03298e5cc688da (diff) | |
download | sonarqube-b035830c7b7d14a42e72dd8cd0249bbf26f2628f.tar.gz sonarqube-b035830c7b7d14a42e72dd8cd0249bbf26f2628f.zip |
SONAR-8684 Cleanup code related to rails
Signed-off-by: Julien Lancelot <julien.lancelot@sonarsource.com>
28 files changed, 13 insertions, 522 deletions
diff --git a/it/it-tests/src/test/java/it/user/LocalAuthenticationTest.java b/it/it-tests/src/test/java/it/user/LocalAuthenticationTest.java index 1680459ab1b..5cf74a17343 100644 --- a/it/it-tests/src/test/java/it/user/LocalAuthenticationTest.java +++ b/it/it-tests/src/test/java/it/user/LocalAuthenticationTest.java @@ -159,9 +159,6 @@ public class LocalAuthenticationTest { // TODO selenium } - /** - * This is currently a limitation of Ruby on Rails stack. - */ @Test public void basic_authentication_does_not_support_utf8_passwords() { String login = LOGIN; 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 bc6e8f09234..5d607377b71 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 @@ -293,7 +293,7 @@ public class ComputeEngineContainerImpl implements ComputeEngineContainer { return new Object[] { ResourceTypes.class, DefaultResourceTypes.get(), - Periods.class, // used by JRuby and EvaluationResultTextConverterImpl + Periods.class, // quality profile ActiveRuleIndexer.class, diff --git a/server/sonar-process-monitor/src/test/resources/org/sonar/process/ProcessTest/sonar.properties b/server/sonar-process-monitor/src/test/resources/org/sonar/process/ProcessTest/sonar.properties deleted file mode 100644 index efd29888d3d..00000000000 --- a/server/sonar-process-monitor/src/test/resources/org/sonar/process/ProcessTest/sonar.properties +++ /dev/null @@ -1,147 +0,0 @@ -# This file must contain only ISO 8859-1 characters -# see http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Properties.html#load(java.io.InputStream) -# -# To use an environment variable, use the following syntax : ${env:NAME_OF_ENV_VARIABLE} -# For example: -# sonar.jdbc.url= ${env:SONAR_JDBC_URL} -# -# -# See also the file conf/wrapper.conf for JVM advanced settings - - - -#-------------------------------------------------------------------------------------------------- -# DATABASE -# -# IMPORTANT: the embedded H2 database is used by default. It is recommended for tests only. -# Please use a production-ready database. Supported databases are MySQL, Oracle, PostgreSQL -# and Microsoft SQLServer. - -# Permissions to create tables, indices and triggers must be granted to JDBC user. -# The schema must be created first. -sonar.jdbc.username=sonar -sonar.jdbc.password=sonar - -#----- Embedded database H2 -# Note: it does not accept connections from remote hosts, so the -# SonarQube server and the maven plugin must be executed on the same host. - -# Comment the following line to deactivate the default embedded database. -sonar.jdbc.url=jdbc:h2:tcp://localhost:9092/sonar - -# directory containing H2 database files. By default it's the /data directory in the SonarQube installation. -#sonar.embeddedDatabase.dataDir= -# H2 embedded database server listening port, defaults to 9092 -#sonar.embeddedDatabase.port=9092 - - -#----- MySQL 5.x -# Comment the embedded database and uncomment the following line to use MySQL -#sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true - - -#----- Oracle 10g/11g -# To connect to Oracle database: -# -# - It's recommended to use the latest version of the JDBC driver (ojdbc6.jar). -# Download it in http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html -# - Copy the driver to the directory extensions/jdbc-driver/oracle/ -# - If you need to set the schema, please refer to http://jira.sonarsource.com/browse/SONAR-5000 -# - Comment the embedded database and uncomment the following line: -#sonar.jdbc.url=jdbc:oracle:thin:@localhost/XE - - -#----- PostgreSQL 8.x/9.x -# Comment the embedded database and uncomment the following property to use PostgreSQL. -# If you don't use the schema named "public", please refer to http://jira.sonarsource.com/browse/SONAR-5000 -#sonar.jdbc.url=jdbc:postgresql://localhost/sonar - - -#----- Microsoft SQLServer -# The Jtds open source driver is available in extensions/jdbc-driver/mssql. More details on http://jtds.sourceforge.net -#sonar.jdbc.url=jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursor - - -#----- Connection pool settings -sonar.jdbc.maxActive=20 -sonar.jdbc.maxIdle=5 -sonar.jdbc.minIdle=2 -sonar.jdbc.maxWait=5000 -sonar.jdbc.minEvictableIdleTimeMillis=600000 -sonar.jdbc.timeBetweenEvictionRunsMillis=30000 - - - -#-------------------------------------------------------------------------------------------------- -# WEB SERVER - -# Binding IP address. For servers with more than one IP address, this property specifies which -# address will be used for listening on the specified ports. -# By default, ports will be used on all IP addresses associated with the server. -#sonar.web.host=0.0.0.0 - -# Web context. When set, it must start with forward slash (for example /sonarqube). -# The default value is root context (empty value). -#sonar.web.context= - -# TCP port for incoming HTTP connections. Disabled when value is -1. -#sonar.web.port=9000 - -# The maximum number of connections that the server will accept and process at any given time. -# When this number has been reached, the server will not accept any more connections until -# the number of connections falls below this value. The operating system may still accept connections -# based on the sonar.web.connections.acceptCount property. The default value is 50 for each -# enabled connector. -#sonar.web.http.maxThreads=50 - -# The minimum number of threads always kept running. The default value is 5 for each -# enabled connector. -#sonar.web.http.minThreads=5 - -# The maximum queue length for incoming connection requests when all possible request processing -# threads are in use. Any requests received when the queue is full will be refused. -# The default value is 25 for each enabled connector. -#sonar.web.http.acceptCount=25 - -# Access logs are generated in the file logs/access.log. This file is rolled over when it's 5Mb. -# An archive of 3 files is kept in the same directory. -# Access logs are enabled by default. -#sonar.web.accessLogs.enable=true - -#-------------------------------------------------------------------------------------------------- -# UPDATE CENTER - -# The Update Center requires an internet connection to request https://update.sonarsource.org -# It is enabled by default. -#sonar.updatecenter.activate=true - -# HTTP proxy (default none) -#http.proxyHost= -#http.proxyPort= - -# NT domain name if NTLM proxy is used -#http.auth.ntlm.domain= - -# SOCKS proxy (default none) -#socksProxyHost= -#socksProxyPort= - -# proxy authentication. The 2 following properties are used for HTTP and SOCKS proxies. -#http.proxyUser= -#http.proxyPassword= - - -#-------------------------------------------------------------------------------------------------- -# NOTIFICATIONS - -# Delay in seconds between processing of notification queue. Default is 60. -#sonar.notifications.delay=60 - - - -#-------------------------------------------------------------------------------------------------- -# DEVELOPMENT MODE -# Only for debugging - -# Set to true to apply Ruby on Rails code changes on the fly -#sonar.rails.dev=false diff --git a/server/sonar-process/src/main/java/org/sonar/process/ProcessProperties.java b/server/sonar-process/src/main/java/org/sonar/process/ProcessProperties.java index 197887d6eab..fb92d468256 100644 --- a/server/sonar-process/src/main/java/org/sonar/process/ProcessProperties.java +++ b/server/sonar-process/src/main/java/org/sonar/process/ProcessProperties.java @@ -67,9 +67,7 @@ public class ProcessProperties { */ public static final String ENABLE_STOP_COMMAND = "sonar.enableStopCommand"; - public static final String WEB_ENFORCED_JVM_ARGS = "-Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djruby.management.enabled=false " + - // jruby is slow with java 8: https://jira.sonarsource.com/browse/SONAR-6115 - "-Djruby.compile.invokedynamic=false"; + public static final String WEB_ENFORCED_JVM_ARGS = "-Djava.awt.headless=true -Dfile.encoding=UTF-8"; public static final String CE_ENFORCED_JVM_ARGS = "-Djava.awt.headless=true -Dfile.encoding=UTF-8"; diff --git a/server/sonar-process/src/test/resources/org/sonar/process/ProcessTest/sonar.properties b/server/sonar-process/src/test/resources/org/sonar/process/ProcessTest/sonar.properties deleted file mode 100644 index efd29888d3d..00000000000 --- a/server/sonar-process/src/test/resources/org/sonar/process/ProcessTest/sonar.properties +++ /dev/null @@ -1,147 +0,0 @@ -# This file must contain only ISO 8859-1 characters -# see http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Properties.html#load(java.io.InputStream) -# -# To use an environment variable, use the following syntax : ${env:NAME_OF_ENV_VARIABLE} -# For example: -# sonar.jdbc.url= ${env:SONAR_JDBC_URL} -# -# -# See also the file conf/wrapper.conf for JVM advanced settings - - - -#-------------------------------------------------------------------------------------------------- -# DATABASE -# -# IMPORTANT: the embedded H2 database is used by default. It is recommended for tests only. -# Please use a production-ready database. Supported databases are MySQL, Oracle, PostgreSQL -# and Microsoft SQLServer. - -# Permissions to create tables, indices and triggers must be granted to JDBC user. -# The schema must be created first. -sonar.jdbc.username=sonar -sonar.jdbc.password=sonar - -#----- Embedded database H2 -# Note: it does not accept connections from remote hosts, so the -# SonarQube server and the maven plugin must be executed on the same host. - -# Comment the following line to deactivate the default embedded database. -sonar.jdbc.url=jdbc:h2:tcp://localhost:9092/sonar - -# directory containing H2 database files. By default it's the /data directory in the SonarQube installation. -#sonar.embeddedDatabase.dataDir= -# H2 embedded database server listening port, defaults to 9092 -#sonar.embeddedDatabase.port=9092 - - -#----- MySQL 5.x -# Comment the embedded database and uncomment the following line to use MySQL -#sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true - - -#----- Oracle 10g/11g -# To connect to Oracle database: -# -# - It's recommended to use the latest version of the JDBC driver (ojdbc6.jar). -# Download it in http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html -# - Copy the driver to the directory extensions/jdbc-driver/oracle/ -# - If you need to set the schema, please refer to http://jira.sonarsource.com/browse/SONAR-5000 -# - Comment the embedded database and uncomment the following line: -#sonar.jdbc.url=jdbc:oracle:thin:@localhost/XE - - -#----- PostgreSQL 8.x/9.x -# Comment the embedded database and uncomment the following property to use PostgreSQL. -# If you don't use the schema named "public", please refer to http://jira.sonarsource.com/browse/SONAR-5000 -#sonar.jdbc.url=jdbc:postgresql://localhost/sonar - - -#----- Microsoft SQLServer -# The Jtds open source driver is available in extensions/jdbc-driver/mssql. More details on http://jtds.sourceforge.net -#sonar.jdbc.url=jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursor - - -#----- Connection pool settings -sonar.jdbc.maxActive=20 -sonar.jdbc.maxIdle=5 -sonar.jdbc.minIdle=2 -sonar.jdbc.maxWait=5000 -sonar.jdbc.minEvictableIdleTimeMillis=600000 -sonar.jdbc.timeBetweenEvictionRunsMillis=30000 - - - -#-------------------------------------------------------------------------------------------------- -# WEB SERVER - -# Binding IP address. For servers with more than one IP address, this property specifies which -# address will be used for listening on the specified ports. -# By default, ports will be used on all IP addresses associated with the server. -#sonar.web.host=0.0.0.0 - -# Web context. When set, it must start with forward slash (for example /sonarqube). -# The default value is root context (empty value). -#sonar.web.context= - -# TCP port for incoming HTTP connections. Disabled when value is -1. -#sonar.web.port=9000 - -# The maximum number of connections that the server will accept and process at any given time. -# When this number has been reached, the server will not accept any more connections until -# the number of connections falls below this value. The operating system may still accept connections -# based on the sonar.web.connections.acceptCount property. The default value is 50 for each -# enabled connector. -#sonar.web.http.maxThreads=50 - -# The minimum number of threads always kept running. The default value is 5 for each -# enabled connector. -#sonar.web.http.minThreads=5 - -# The maximum queue length for incoming connection requests when all possible request processing -# threads are in use. Any requests received when the queue is full will be refused. -# The default value is 25 for each enabled connector. -#sonar.web.http.acceptCount=25 - -# Access logs are generated in the file logs/access.log. This file is rolled over when it's 5Mb. -# An archive of 3 files is kept in the same directory. -# Access logs are enabled by default. -#sonar.web.accessLogs.enable=true - -#-------------------------------------------------------------------------------------------------- -# UPDATE CENTER - -# The Update Center requires an internet connection to request https://update.sonarsource.org -# It is enabled by default. -#sonar.updatecenter.activate=true - -# HTTP proxy (default none) -#http.proxyHost= -#http.proxyPort= - -# NT domain name if NTLM proxy is used -#http.auth.ntlm.domain= - -# SOCKS proxy (default none) -#socksProxyHost= -#socksProxyPort= - -# proxy authentication. The 2 following properties are used for HTTP and SOCKS proxies. -#http.proxyUser= -#http.proxyPassword= - - -#-------------------------------------------------------------------------------------------------- -# NOTIFICATIONS - -# Delay in seconds between processing of notification queue. Default is 60. -#sonar.notifications.delay=60 - - - -#-------------------------------------------------------------------------------------------------- -# DEVELOPMENT MODE -# Only for debugging - -# Set to true to apply Ruby on Rails code changes on the fly -#sonar.rails.dev=false diff --git a/server/sonar-server/src/main/java/org/sonar/server/app/EmbeddedTomcat.java b/server/sonar-server/src/main/java/org/sonar/server/app/EmbeddedTomcat.java index a3de4ace39a..ee3d4b81dd2 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/app/EmbeddedTomcat.java +++ b/server/sonar-server/src/main/java/org/sonar/server/app/EmbeddedTomcat.java @@ -42,7 +42,6 @@ class EmbeddedTomcat { void start() { // '%2F' (slash /) and '%5C' (backslash \) are permitted as path delimiters in URLs - // See Ruby on Rails url_for System.setProperty("org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH", "true"); System.setProperty("org.apache.catalina.startup.EXIT_ON_INIT_FAILURE", "true"); diff --git a/server/sonar-server/src/main/java/org/sonar/server/app/TomcatContexts.java b/server/sonar-server/src/main/java/org/sonar/server/app/TomcatContexts.java index a12cc406cf1..f514c28cc09 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/app/TomcatContexts.java +++ b/server/sonar-server/src/main/java/org/sonar/server/app/TomcatContexts.java @@ -24,7 +24,6 @@ import java.io.File; import java.io.IOException; import java.util.Map; import javax.servlet.ServletException; -import org.apache.catalina.Context; import org.apache.catalina.core.StandardContext; import org.apache.catalina.startup.Tomcat; import org.apache.commons.io.FileUtils; @@ -45,8 +44,6 @@ import static org.apache.commons.lang.StringUtils.isEmpty; */ public class TomcatContexts { - private static final String JRUBY_MAX_RUNTIMES = "jruby.max.runtimes"; - private static final String RAILS_ENV = "rails.env"; public static final String PROPERTY_CONTEXT = "sonar.web.context"; public static final String WEB_DEPLOY_PATH_RELATIVE_TO_DATA_DIR = "web/deploy"; @@ -65,7 +62,6 @@ public class TomcatContexts { addStaticDir(tomcat, getContextPath(props) + "/deploy", new File(props.nonNullValueAsFile(ProcessProperties.PATH_DATA), WEB_DEPLOY_PATH_RELATIVE_TO_DATA_DIR)); StandardContext webapp = addContext(tomcat, getContextPath(props), webappDir(props)); - configureRails(props, webapp); for (Map.Entry<Object, Object> entry : props.rawProperties().entrySet()) { String key = entry.getKey().toString(); webapp.addParameter(key, entry.getValue().toString()); @@ -118,21 +114,6 @@ public class TomcatContexts { } } - static void configureRails(Props props, Context context) { - // sonar.dev is kept for backward-compatibility - if (props.valueAsBoolean("sonar.dev", false)) { - props.set("sonar.web.dev", "true"); - } - if (props.valueAsBoolean("sonar.web.dev", false)) { - context.addParameter(RAILS_ENV, "development"); - context.addParameter(JRUBY_MAX_RUNTIMES, "3"); - Loggers.get(TomcatContexts.class).warn("WEB DEVELOPMENT MODE IS ENABLED - DO NOT USE FOR PRODUCTION USAGE"); - } else { - context.addParameter(RAILS_ENV, "production"); - context.addParameter(JRUBY_MAX_RUNTIMES, "1"); - } - } - static File webappDir(Props props) { String devDir = props.value("sonar.web.dev.sources"); File dir; diff --git a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelService.java b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelService.java index a4cf7b2b756..a201d822f25 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelService.java @@ -27,7 +27,6 @@ import org.sonar.api.server.debt.DebtModel; import org.sonar.api.utils.ValidationMessages; /** - * Used through ruby code <pre>Internal.debt</pre> * Also used by SQALE plugin. */ public class DebtModelService implements DebtModel { diff --git a/server/sonar-server/src/main/java/org/sonar/server/notification/email/EmailNotificationChannel.java b/server/sonar-server/src/main/java/org/sonar/server/notification/email/EmailNotificationChannel.java index 1a55f2ac133..1e05b5bc998 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/notification/email/EmailNotificationChannel.java +++ b/server/sonar-server/src/main/java/org/sonar/server/notification/email/EmailNotificationChannel.java @@ -205,7 +205,7 @@ public class EmailNotificationChannel extends NotificationChannel { } /** - * Send test email. This method called from Ruby. + * Send test email. * * @throws EmailException when unable to send */ diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/Platform.java b/server/sonar-server/src/main/java/org/sonar/server/platform/Platform.java index 1ca7998c81d..f726d460559 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/Platform.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/Platform.java @@ -23,7 +23,6 @@ import com.google.common.collect.Lists; import java.util.Collection; import java.util.List; import java.util.Properties; -import javax.annotation.CheckForNull; import javax.servlet.ServletContext; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; @@ -64,17 +63,6 @@ public class Platform { return INSTANCE; } - /** - * Used by ruby code - */ - @CheckForNull - public static <T> T component(Class<T> type) { - if (INSTANCE.started) { - return INSTANCE.getContainer().getComponentByType(type); - } - return null; - } - public void init(Properties properties, ServletContext servletContext) { this.properties = properties; this.servletContext = servletContext; diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/web/PlatformServletContextListener.java b/server/sonar-server/src/main/java/org/sonar/server/platform/web/PlatformServletContextListener.java index d83304190e7..cf7387db8e4 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/web/PlatformServletContextListener.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/web/PlatformServletContextListener.java @@ -46,10 +46,7 @@ public final class PlatformServletContextListener implements ServletContextListe event.getServletContext().setAttribute(STARTED_ATTRIBUTE, Boolean.TRUE); } catch (Throwable t) { - // Tomcat 7 "limitations": - // - server does not stop if webapp fails at startup - // - the second listener for jruby on rails is started even if this listener fails. It generates - // unexpected errors + // Tomcat 7 "limitations": server does not stop if webapp fails at startup stopQuietly(); throw Throwables.propagate(t); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileExporters.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileExporters.java index 983d30edfd3..acfe985363f 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileExporters.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileExporters.java @@ -25,7 +25,6 @@ import com.google.common.collect.Lists; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; -import java.io.StringWriter; import java.io.Writer; import java.nio.charset.StandardCharsets; import java.util.ArrayList; @@ -113,15 +112,6 @@ public class QProfileExporters { exporter.exportProfile(wrap(profile), writer); } - /** - * Only for ruby on rails - */ - public String export(String profileKey, String tool) { - StringWriter writer = new StringWriter(); - export(profileKey, tool, writer); - return writer.toString(); - } - private RulesProfile wrap(QualityProfileDto profile) { DbSession dbSession = dbClient.openSession(false); RulesProfile target = new RulesProfile(profile.getName(), profile.getLanguage()); diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileService.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileService.java index 991ae55a881..cdc2687809b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileService.java @@ -19,7 +19,6 @@ */ package org.sonar.server.qualityprofile; -import java.io.StringWriter; import java.io.Writer; import java.util.List; import javax.annotation.CheckForNull; @@ -96,16 +95,6 @@ public class QProfileService { } /** - * @deprecated used only by Ruby on Rails. Use {@link #backup(String, java.io.Writer)} - */ - @Deprecated - public String backup(String profileKey) { - StringWriter output = new StringWriter(); - backup(profileKey, output); - return output.toString(); - } - - /** * Used in /api/profiles and in /profiles/export */ @CheckForNull diff --git a/server/sonar-server/src/main/java/org/sonar/server/util/ClassLoaderUtils.java b/server/sonar-server/src/main/java/org/sonar/server/util/ClassLoaderUtils.java index a5df8a85bb8..b5b370d911c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/util/ClassLoaderUtils.java +++ b/server/sonar-server/src/main/java/org/sonar/server/util/ClassLoaderUtils.java @@ -21,18 +21,14 @@ package org.sonar.server.util; import com.google.common.base.Throwables; import com.google.common.collect.Lists; -import java.io.File; -import java.io.IOException; import java.net.URL; import java.net.URLDecoder; import java.util.Collection; import java.util.Enumeration; -import java.util.function.Function; import java.util.function.Predicate; import java.util.jar.JarEntry; import java.util.jar.JarFile; import javax.annotation.Nullable; -import org.apache.commons.io.FileUtils; import org.apache.commons.lang.CharEncoding; import org.apache.commons.lang.StringUtils; import org.sonar.api.utils.log.Loggers; @@ -43,22 +39,6 @@ public class ClassLoaderUtils { // only static methods } - public static File copyResources(ClassLoader classLoader, String rootPath, File toDir, Function<String, String> relocationFunction) { - Collection<String> relativePaths = listFiles(classLoader, rootPath); - for (String relativePath : relativePaths) { - URL resource = classLoader.getResource(relativePath); - String filename = relocationFunction.apply(relativePath); - File toFile = new File(toDir, filename); - try { - FileUtils.copyURLToFile(resource, toFile); - } catch (IOException e) { - throw new IllegalStateException("Fail to extract " + relativePath + " to " + toFile.getAbsolutePath(), e); - } - } - - return toDir; - } - /** * Finds files within a given directory and its subdirectories * @@ -89,14 +69,14 @@ public class ClassLoaderUtils { // Path of the root directory // Examples : - // org/sonar/sqale/index.txt -> rootDirectory is org/sonar/sqale - // org/sonar/sqale/ -> rootDirectory is org/sonar/sqale - // org/sonar/sqale -> rootDirectory is org/sonar/sqale + // org/sonar/sqale/index.txt -> rootDirectory is org/sonar/sqale + // org/sonar/sqale/ -> rootDirectory is org/sonar/sqale + // org/sonar/sqale -> rootDirectory is org/sonar/sqale String rootDirectory = rootPath; if (StringUtils.substringAfterLast(rootPath, "/").indexOf('.') >= 0) { rootDirectory = StringUtils.substringBeforeLast(rootPath, "/"); } - //strip out only the JAR file + // strip out only the JAR file jarPath = root.getPath().substring(5, root.getPath().indexOf('!')); jar = new JarFile(URLDecoder.decode(jarPath, CharEncoding.UTF_8)); Enumeration<JarEntry> entries = jar.entries(); diff --git a/server/sonar-server/src/main/resources/org/sonar/server/platform/ws/example-system-info.json b/server/sonar-server/src/main/resources/org/sonar/server/platform/ws/example-system-info.json index 891f2616978..a7f679e72e6 100644 --- a/server/sonar-server/src/main/resources/org/sonar/server/platform/ws/example-system-info.json +++ b/server/sonar-server/src/main/resources/org/sonar/server/platform/ws/example-system-info.json @@ -145,8 +145,6 @@ "java.vm.specification.version": "1.7", "java.vm.vendor": "Oracle Corporation", "java.vm.version": "24.71-b01", - "jruby.compile.invokedynamic": "false", - "jruby.management.enabled": "false", "line.separator": "\n", "org.apache.catalina.startup.EXIT_ON_INIT_FAILURE": "true", "org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH": "true", diff --git a/server/sonar-server/src/main/resources/org/sonar/server/platform/ws/logs-example.log b/server/sonar-server/src/main/resources/org/sonar/server/platform/ws/logs-example.log index 6a101b16082..c5cc421ffd5 100644 --- a/server/sonar-server/src/main/resources/org/sonar/server/platform/ws/logs-example.log +++ b/server/sonar-server/src/main/resources/org/sonar/server/platform/ws/logs-example.log @@ -6,7 +6,7 @@ Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org 2016.11.17 16:26:33 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /Users/me/sonarqube-6.2/temp 2016.11.17 16:26:33 INFO app[][o.s.p.m.JavaProcessLauncher] Launch process[es]: /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/bin/java -Djava.awt.headless=true -Xmx1G -Xms256m -Xss256k -Djna.nosys=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=/Users/me/sonarqube-6.2/temp -javaagent:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/management-agent.jar -cp ./lib/common/*:./lib/search/* org.sonar.search.SearchServer /Users/me/sonarqube-6.2/temp/sq-process607963922619414430properties 2016.11.17 16:26:39 INFO app[][o.s.p.m.Monitor] Process[es] is up -2016.11.17 16:26:39 INFO app[][o.s.p.m.JavaProcessLauncher] Launch process[web]: /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djruby.management.enabled=false -Djruby.compile.invokedynamic=false -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=/Users/me/sonarqube-6.2/temp -javaagent:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/management-agent.jar -cp ./lib/common/*:./lib/server/*:/Users/me/sonarqube-6.2/lib/jdbc/h2/h2-1.3.176.jar org.sonar.server.app.WebServer /Users/me/sonarqube-6.2/temp/sq-process8504251823484440932properties +2016.11.17 16:26:39 INFO app[][o.s.p.m.JavaProcessLauncher] Launch process[web]: /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=/Users/me/sonarqube-6.2/temp -javaagent:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/management-agent.jar -cp ./lib/common/*:./lib/server/*:/Users/me/sonarqube-6.2/lib/jdbc/h2/h2-1.3.176.jar org.sonar.server.app.WebServer /Users/me/sonarqube-6.2/temp/sq-process8504251823484440932properties 2016.11.17 16:26:59 INFO app[][o.s.p.m.Monitor] Process[web] is up 2016.11.17 16:26:59 INFO app[][o.s.p.m.JavaProcessLauncher] Launch process[ce]: /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=/Users/me/sonarqube-6.2/temp -javaagent:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/management-agent.jar -cp ./lib/common/*:./lib/server/*:./lib/ce/*:/Users/me/sonarqube-6.2/lib/jdbc/h2/h2-1.3.176.jar org.sonar.ce.app.CeServer /Users/me/sonarqube-6.2/temp/sq-process6754313832695376518properties 2016.11.17 16:27:04 INFO app[][o.s.p.m.Monitor] Process[ce] is up diff --git a/server/sonar-server/src/main/resources/org/sonar/server/ruby/call_invalidate_metric_cache.rb b/server/sonar-server/src/main/resources/org/sonar/server/ruby/call_invalidate_metric_cache.rb deleted file mode 100644 index 6ead450460b..00000000000 --- a/server/sonar-server/src/main/resources/org/sonar/server/ruby/call_invalidate_metric_cache.rb +++ /dev/null @@ -1,13 +0,0 @@ -# this script defines a method which calls the class method "clear_cache" of the Metric class defined -# in /server/sonar-web/src/main/webapp/WEB-INF/app/models/metric.rb - -# this essentially makes UT work, must be a file that actually exists in production -require 'database_version' - -class RbCallInvalidateMetricCache - include Java::org.sonar.server.ruby.CallInvalidateMetricCache - def call_invalidate - Metric.clear_cache - end -end -RbCallInvalidateMetricCache.new diff --git a/server/sonar-server/src/main/resources/org/sonar/server/ruby/call_load_java_web_services.rb b/server/sonar-server/src/main/resources/org/sonar/server/ruby/call_load_java_web_services.rb deleted file mode 100644 index ddd01c92495..00000000000 --- a/server/sonar-server/src/main/resources/org/sonar/server/ruby/call_load_java_web_services.rb +++ /dev/null @@ -1,13 +0,0 @@ -# this script defines a method which calls the class method "load_java_web_services" of the Bootstrap class -# definedin /server/sonar-web/src/main/webapp/WEB-INF/config/environment.rb - -# this essentially makes UT work, must be a file that actually exists in production -require 'database_version' - -class RbCallLoadJavaWebServices - include Java::org.sonar.server.ruby.CallLoadJavaWebServices - def call_load_java_web_services - Bootstrap.load_java_web_services - end -end -RbCallLoadJavaWebServices.new diff --git a/server/sonar-server/src/test/java/org/sonar/server/app/TomcatContextsTest.java b/server/sonar-server/src/test/java/org/sonar/server/app/TomcatContextsTest.java index 79f648f7608..fa07182b289 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/app/TomcatContextsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/app/TomcatContextsTest.java @@ -22,7 +22,6 @@ package org.sonar.server.app; import java.io.File; import java.io.IOException; import java.util.Properties; -import org.apache.catalina.Context; import org.apache.catalina.core.StandardContext; import org.apache.catalina.startup.Tomcat; import org.apache.commons.io.FileUtils; @@ -74,28 +73,6 @@ public class TomcatContextsTest { } @Test - public void configure_rails_dev_mode() { - props.setProperty("sonar.web.dev", "true"); - Context context = mock(Context.class); - - underTest.configureRails(new Props(props), context); - - verify(context).addParameter("jruby.max.runtimes", "3"); - verify(context).addParameter("rails.env", "development"); - } - - @Test - public void configure_rails_production_mode() { - props.setProperty("sonar.web.dev", "false"); - Context context = mock(Context.class); - - underTest.configureRails(new Props(props), context); - - verify(context).addParameter("jruby.max.runtimes", "1"); - verify(context).addParameter("rails.env", "production"); - } - - @Test public void create_dir_and_configure_static_directory() throws Exception { File dir = temp.newFolder(); dir.delete(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/ClassLoaderUtilsTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/ClassLoaderUtilsTest.java index 5eda287cefd..4b1e064ea82 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/platform/ClassLoaderUtilsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/platform/ClassLoaderUtilsTest.java @@ -19,18 +19,11 @@ */ package org.sonar.server.platform; -import java.io.File; -import java.io.IOException; import java.net.URL; import java.net.URLClassLoader; import java.util.Collection; -import java.util.function.Function; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.FilenameUtils; import org.junit.Before; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.TemporaryFolder; import org.sonar.server.util.ClassLoaderUtils; import static org.apache.commons.lang.StringUtils.endsWith; @@ -40,9 +33,6 @@ public class ClassLoaderUtilsTest { private ClassLoader classLoader; - @Rule - public TemporaryFolder temp = new TemporaryFolder(); - @Before public void prepareClassLoader() { // This JAR file has the three following files : @@ -83,23 +73,4 @@ public class ClassLoaderUtilsTest { "org/sonar/sqale/app/README.md"); } - @Test - public void copyRubyRailsApp() throws IOException { - File toDir = temp.newFolder("dest"); - ClassLoaderUtils.copyResources(classLoader, "org/sonar/sqale", toDir, Function.identity()); - - assertThat(FileUtils.listFiles(toDir, null, true)).hasSize(2); - assertThat(new File(toDir, "org/sonar/sqale/app/copyright.txt")).exists(); - assertThat(new File(toDir, "org/sonar/sqale/app/README.md")).exists(); - } - - @Test - public void copyRubyRailsApp_relocate_files() throws IOException { - File toDir = temp.newFolder("dest"); - ClassLoaderUtils.copyResources(classLoader, "org/sonar/sqale", toDir, path -> "foo/" + FilenameUtils.getName(path)); - - assertThat(FileUtils.listFiles(toDir, null, true)).hasSize(2); - assertThat(new File(toDir, "foo/copyright.txt")).exists(); - assertThat(new File(toDir, "foo/README.md")).exists(); - } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileExportersTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileExportersTest.java index d2d4e38821b..357673c6ac7 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileExportersTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileExportersTest.java @@ -43,7 +43,6 @@ import org.sonar.db.DbSession; import org.sonar.db.qualityprofile.ActiveRuleDto; import org.sonar.db.qualityprofile.QualityProfileDto; import org.sonar.server.exceptions.BadRequestException; -import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.qualityprofile.index.ActiveRuleIndexer; import org.sonar.server.rule.index.RuleIndex; import org.sonar.server.rule.index.RuleQuery; @@ -104,34 +103,6 @@ public class QProfileExportersTest { } @Test - public void export() { - QualityProfileDto profile = tester.get(QProfileLoader.class).getByLangAndName("xoo", "P1"); - assertThat(exporters.export(profile.getKey(), "xootool")).isEqualTo("xoo -> P1 -> 1"); - assertThat(exporters.export(profile.getKey(), "standard")).isEqualTo("standard -> P1 -> 1"); - } - - @Test - public void fail_if_missing_exporter() { - QualityProfileDto profile = tester.get(QProfileLoader.class).getByLangAndName("xoo", "P1"); - try { - exporters.export(profile.getKey(), "unknown"); - fail(); - } catch (NotFoundException e) { - assertThat(e).hasMessage("Unknown quality profile exporter: unknown"); - } - } - - @Test - public void fail_if_missing_profile() { - try { - exporters.export("unknown", "xootool"); - fail(); - } catch (NotFoundException e) { - assertThat(e).hasMessage("Unknown Quality profile: unknown"); - } - } - - @Test public void profile_importers_for_language() { assertThat(exporters.findProfileImportersForLanguage("xoo")).hasSize(3); } diff --git a/server/sonar-server/src/test/resources/org/sonar/server/ruby/database_version.rb b/server/sonar-server/src/test/resources/org/sonar/server/ruby/database_version.rb deleted file mode 100644 index fceb33a1d57..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/ruby/database_version.rb +++ /dev/null @@ -1,18 +0,0 @@ -# a dummy class Bootstrap that "mocks" the Bootstrap class of the platform by defining a class method called load_java_web_services -# unit test only makes sure the wrapping and method forwarding provided by JRuby works so providing an empty method is enough as -# it would otherwise raise an exception -class Bootstrap - - def self.load_java_web_services - - end - -end - -class Metric - - def self.clear_cache - - end - -end diff --git a/sonar-db/src/main/java/org/sonar/db/DefaultDatabase.java b/sonar-db/src/main/java/org/sonar/db/DefaultDatabase.java index 8520edd25a8..f3be7e3013f 100644 --- a/sonar-db/src/main/java/org/sonar/db/DefaultDatabase.java +++ b/sonar-db/src/main/java/org/sonar/db/DefaultDatabase.java @@ -169,10 +169,6 @@ public class DefaultDatabase implements Database { result.setProperty(StringUtils.removeStart(key, SONAR_JDBC), (String) entry.getValue()); } } - - // This property is required by the Ruby Oracle enhanced adapter. - // It directly uses the Connection implementation provided by the Oracle driver - result.setProperty("accessToUnderlyingConnectionAllowed", "true"); return result; } diff --git a/sonar-db/src/main/java/org/sonar/db/schemamigration/SchemaMigrationDto.java b/sonar-db/src/main/java/org/sonar/db/schemamigration/SchemaMigrationDto.java index 7f7911e4516..ec0bd7babb2 100644 --- a/sonar-db/src/main/java/org/sonar/db/schemamigration/SchemaMigrationDto.java +++ b/sonar-db/src/main/java/org/sonar/db/schemamigration/SchemaMigrationDto.java @@ -20,7 +20,7 @@ package org.sonar.db.schemamigration; /** - * Maps the table SCHEMA_MIGRATIONS that is fed by Ruby on Rails Migrations + * Maps the table SCHEMA_MIGRATIONS * @since 3.0 */ public class SchemaMigrationDto { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java index 453ed994b4e..e5f11c69fb6 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java @@ -50,8 +50,7 @@ import static java.lang.String.format; import static java.util.Arrays.asList; /** - * Defines a web service. Note that contrary to the deprecated {@link org.sonar.api.web.Webservice} - * the ws is fully implemented in Java and does not require any Ruby on Rails code. + * Defines a web service. * <br> * <br> * The classes implementing this extension point must be declared by {@link org.sonar.api.Plugin}. diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/Footer.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/Footer.java index 1dc71ec828a..c5144ece41a 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/web/Footer.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/web/Footer.java @@ -30,7 +30,7 @@ import org.sonar.api.server.ServerSide; public interface Footer { /** - * Static HTML (no Ruby on Rails) + * Static HTML */ String getHtml(); } diff --git a/tests/perf/src/test/java/org/sonarsource/sonarqube/perf/server/ServerTest.java b/tests/perf/src/test/java/org/sonarsource/sonarqube/perf/server/ServerTest.java index 17d3d6a3a58..3ce2ba566db 100644 --- a/tests/perf/src/test/java/org/sonarsource/sonarqube/perf/server/ServerTest.java +++ b/tests/perf/src/test/java/org/sonarsource/sonarqube/perf/server/ServerTest.java @@ -41,7 +41,7 @@ public class ServerTest extends PerfTestCase { // ES + TOMCAT @Test public void server_startup_and_shutdown() throws Exception { - String defaultWebJavaOptions = "-Xmx768m -XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djruby.management.enabled=false"; + String defaultWebJavaOptions = "-Xmx768m -XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless=true -Dfile.encoding=UTF-8"; Orchestrator orchestrator = Orchestrator.builderEnv() .setOrchestratorProperty("javaVersion", "LATEST_RELEASE") .addPlugin("java") diff --git a/tests/upgrade/src/test/java/org/sonarsource/sonarqube/upgrade/UpgradeTest.java b/tests/upgrade/src/test/java/org/sonarsource/sonarqube/upgrade/UpgradeTest.java index 480846415f3..f1f7027bd1a 100644 --- a/tests/upgrade/src/test/java/org/sonarsource/sonarqube/upgrade/UpgradeTest.java +++ b/tests/upgrade/src/test/java/org/sonarsource/sonarqube/upgrade/UpgradeTest.java @@ -232,7 +232,6 @@ public class UpgradeTest { connection.connect(); assertThat(connection.getResponseCode()).as("Fail to load " + path).isEqualTo(HttpURLConnection.HTTP_OK); - // Error HTML pages generated by Ruby on Rails String content = IOUtils.toString(connection.getInputStream()); assertThat(content).as("Fail to load " + path).doesNotContain("something went wrong"); assertThat(content).as("Fail to load " + path).doesNotContain("The page you were looking for doesn't exist"); |