aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephane Gamard <stephane.gamard@sonarsource.com>2014-09-01 12:52:23 +0200
committerStephane Gamard <stephane.gamard@sonarsource.com>2014-09-01 12:52:23 +0200
commit8088bf304b258124bbb7378055702475b26850d8 (patch)
treed3610b12ad75bb68720d2c44b79026e5708f31ef
parentf0e2ba8e65ca5e227855fa1f8aab24d9915bcd38 (diff)
parent1cbddc7257f081c53619ad15d0d4f58f62d4b4ba (diff)
downloadsonarqube-8088bf304b258124bbb7378055702475b26850d8.tar.gz
sonarqube-8088bf304b258124bbb7378055702475b26850d8.zip
Merge branch 'master' into SONAR-5529
-rw-r--r--plugins/sonar-xoo-plugin/pom.xml5
-rw-r--r--plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/SymbolReferencesSensor.java4
-rw-r--r--plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/SymbolReferencesSensorTest.java93
-rw-r--r--plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/SyntaxHighlightingSensorTest.java86
-rw-r--r--server/process/sonar-process/src/main/java/org/sonar/process/package-info.java23
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/app/Connectors.java3
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/app/Logging.java3
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/app/Webapp.java3
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java1
-rw-r--r--server/sonar-web/Gruntfile.coffee4
-rw-r--r--server/sonar-web/src/main/js/navigator/filters/base-filters.js2
-rw-r--r--server/sonar-web/src/main/js/third-party/latinize.js (renamed from server/sonar-web/src/main/js/latinize.js)0
12 files changed, 221 insertions, 6 deletions
diff --git a/plugins/sonar-xoo-plugin/pom.xml b/plugins/sonar-xoo-plugin/pom.xml
index 15955bbd380..6c1a1182306 100644
--- a/plugins/sonar-xoo-plugin/pom.xml
+++ b/plugins/sonar-xoo-plugin/pom.xml
@@ -36,6 +36,11 @@
<artifactId>sonar-testing-harness</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/SymbolReferencesSensor.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/SymbolReferencesSensor.java
index c8cafc2d705..628ce6ece70 100644
--- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/SymbolReferencesSensor.java
+++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/SymbolReferencesSensor.java
@@ -44,7 +44,7 @@ public class SymbolReferencesSensor implements Sensor {
private static final String SYMBOL_EXTENSION = ".symbol";
- private void processFileHighlighting(InputFile inputFile, SensorContext context) {
+ private void processFileSymbol(InputFile inputFile, SensorContext context) {
File ioFile = inputFile.file();
File symbolFile = new File(ioFile.getParentFile(), ioFile.getName() + SYMBOL_EXTENSION);
if (symbolFile.exists()) {
@@ -92,7 +92,7 @@ public class SymbolReferencesSensor implements Sensor {
@Override
public void execute(SensorContext context) {
for (InputFile file : context.fileSystem().inputFiles(context.fileSystem().predicates().hasLanguages(Xoo.KEY))) {
- processFileHighlighting(file, context);
+ processFileSymbol(file, context);
}
}
}
diff --git a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/SymbolReferencesSensorTest.java b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/SymbolReferencesSensorTest.java
new file mode 100644
index 00000000000..68fd40d0f80
--- /dev/null
+++ b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/SymbolReferencesSensorTest.java
@@ -0,0 +1,93 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 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.xoo.lang;
+
+import org.apache.commons.io.FileUtils;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.sonar.api.batch.fs.internal.DefaultFileSystem;
+import org.sonar.api.batch.fs.internal.DefaultInputFile;
+import org.sonar.api.batch.sensor.SensorContext;
+import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor;
+import org.sonar.api.batch.sensor.symbol.Symbol;
+import org.sonar.api.batch.sensor.symbol.SymbolTableBuilder;
+
+import java.io.File;
+import java.io.IOException;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+public class SymbolReferencesSensorTest {
+
+ private SymbolReferencesSensor sensor;
+ private SensorContext context = mock(SensorContext.class);
+ private DefaultFileSystem fileSystem;
+
+ @Rule
+ public TemporaryFolder temp = new TemporaryFolder();
+ private File baseDir;
+
+ @Before
+ public void prepare() throws IOException {
+ baseDir = temp.newFolder();
+ sensor = new SymbolReferencesSensor();
+ fileSystem = new DefaultFileSystem();
+ when(context.fileSystem()).thenReturn(fileSystem);
+ }
+
+ @Test
+ public void testDescriptor() {
+ sensor.describe(new DefaultSensorDescriptor());
+ }
+
+ @Test
+ public void testNoExecutionIfNoSymbolFile() {
+ DefaultInputFile inputFile = new DefaultInputFile("src/foo.xoo").setAbsolutePath(new File(baseDir, "src/foo.xoo").getAbsolutePath()).setLanguage("xoo");
+ fileSystem.add(inputFile);
+ sensor.execute(context);
+ }
+
+ @Test
+ public void testExecution() throws IOException {
+ File symbol = new File(baseDir, "src/foo.xoo.symbol");
+ FileUtils.write(symbol, "1,4,7\n12,15,23\n\n#comment");
+ DefaultInputFile inputFile = new DefaultInputFile("src/foo.xoo").setAbsolutePath(new File(baseDir, "src/foo.xoo").getAbsolutePath()).setLanguage("xoo");
+ fileSystem.add(inputFile);
+ SymbolTableBuilder symbolTableBuilder = mock(SymbolTableBuilder.class);
+ when(context.symbolTableBuilder(inputFile)).thenReturn(symbolTableBuilder);
+
+ Symbol symbol1 = mock(Symbol.class);
+ when(symbolTableBuilder.newSymbol(1, 4)).thenReturn(symbol1);
+ Symbol symbol2 = mock(Symbol.class);
+ when(symbolTableBuilder.newSymbol(12, 15)).thenReturn(symbol2);
+
+ sensor.execute(context);
+
+ verify(symbolTableBuilder).newSymbol(1, 4);
+ verify(symbolTableBuilder).newReference(symbol1, 7);
+ verify(symbolTableBuilder).newSymbol(12, 15);
+ verify(symbolTableBuilder).newReference(symbol2, 23);
+ }
+
+}
diff --git a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/SyntaxHighlightingSensorTest.java b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/SyntaxHighlightingSensorTest.java
new file mode 100644
index 00000000000..9918a3625ef
--- /dev/null
+++ b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/SyntaxHighlightingSensorTest.java
@@ -0,0 +1,86 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 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.xoo.lang;
+
+import org.apache.commons.io.FileUtils;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.sonar.api.batch.fs.internal.DefaultFileSystem;
+import org.sonar.api.batch.fs.internal.DefaultInputFile;
+import org.sonar.api.batch.sensor.SensorContext;
+import org.sonar.api.batch.sensor.highlighting.HighlightingBuilder;
+import org.sonar.api.batch.sensor.highlighting.TypeOfText;
+import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor;
+
+import java.io.File;
+import java.io.IOException;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+public class SyntaxHighlightingSensorTest {
+
+ private SyntaxHighlightingSensor sensor;
+ private SensorContext context = mock(SensorContext.class);
+ private DefaultFileSystem fileSystem;
+
+ @Rule
+ public TemporaryFolder temp = new TemporaryFolder();
+ private File baseDir;
+
+ @Before
+ public void prepare() throws IOException {
+ baseDir = temp.newFolder();
+ sensor = new SyntaxHighlightingSensor();
+ fileSystem = new DefaultFileSystem();
+ when(context.fileSystem()).thenReturn(fileSystem);
+ }
+
+ @Test
+ public void testDescriptor() {
+ sensor.describe(new DefaultSensorDescriptor());
+ }
+
+ @Test
+ public void testNoExecutionIfNoSyntaxFile() {
+ DefaultInputFile inputFile = new DefaultInputFile("src/foo.xoo").setAbsolutePath(new File(baseDir, "src/foo.xoo").getAbsolutePath()).setLanguage("xoo");
+ fileSystem.add(inputFile);
+ sensor.execute(context);
+ }
+
+ @Test
+ public void testExecution() throws IOException {
+ File symbol = new File(baseDir, "src/foo.xoo.highlighting");
+ FileUtils.write(symbol, "1:4:k\n12:15:cppd\n\n#comment");
+ DefaultInputFile inputFile = new DefaultInputFile("src/foo.xoo").setAbsolutePath(new File(baseDir, "src/foo.xoo").getAbsolutePath()).setLanguage("xoo");
+ fileSystem.add(inputFile);
+ HighlightingBuilder builder = mock(HighlightingBuilder.class);
+ when(context.highlightingBuilder(inputFile)).thenReturn(builder);
+
+ sensor.execute(context);
+
+ verify(builder).highlight(1, 4, TypeOfText.KEYWORD);
+ verify(builder).highlight(12, 15, TypeOfText.CPP_DOC);
+ verify(builder).done();
+ }
+}
diff --git a/server/process/sonar-process/src/main/java/org/sonar/process/package-info.java b/server/process/sonar-process/src/main/java/org/sonar/process/package-info.java
new file mode 100644
index 00000000000..09da5ce266d
--- /dev/null
+++ b/server/process/sonar-process/src/main/java/org/sonar/process/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 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.
+ */
+@ParametersAreNonnullByDefault
+package org.sonar.process;
+
+import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/server/sonar-server/src/main/java/org/sonar/server/app/Connectors.java b/server/sonar-server/src/main/java/org/sonar/server/app/Connectors.java
index 340c3b3ccbf..6a743f88c92 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/app/Connectors.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/app/Connectors.java
@@ -39,6 +39,9 @@ class Connectors {
static final String HTTP_PROTOCOL = "HTTP/1.1";
static final String AJP_PROTOCOL = "AJP/1.3";
+ private Connectors() {
+ }
+
static void configure(Tomcat tomcat, Props props) {
List<Connector> connectors = new ArrayList<Connector>();
connectors.addAll(Arrays.asList(newHttpConnector(props), newAjpConnector(props), newHttpsConnector(props)));
diff --git a/server/sonar-server/src/main/java/org/sonar/server/app/Logging.java b/server/sonar-server/src/main/java/org/sonar/server/app/Logging.java
index 777a06883cb..fefc1444a3b 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/app/Logging.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/app/Logging.java
@@ -54,6 +54,9 @@ class Logging {
static final String ACCESS_RELATIVE_PATH = "WEB-INF/config/logback-access.xml";
static final String PROPERTY_ENABLE_ACCESS_LOGS = "sonar.web.accessLogs.enable";
+ private Logging() {
+ }
+
static void init(Props props) {
configureLogback(props);
diff --git a/server/sonar-server/src/main/java/org/sonar/server/app/Webapp.java b/server/sonar-server/src/main/java/org/sonar/server/app/Webapp.java
index 006bbafd237..f959faed106 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/app/Webapp.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/app/Webapp.java
@@ -35,6 +35,9 @@ class Webapp {
private static final String RAILS_ENV = "rails.env";
private static final String PROPERTY_CONTEXT = "sonar.web.context";
+ private Webapp() {
+ }
+
static StandardContext configure(Tomcat tomcat, Props props) {
try {
StandardContext context = (StandardContext) tomcat.addWebapp(getContextPath(props), webappPath(props));
diff --git a/server/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java b/server/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java
index 5e7613339d1..f77088beb21 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java
@@ -20,7 +20,6 @@
package org.sonar.server.ui;
import org.slf4j.LoggerFactory;
-import org.sonar.api.CoreProperties;
import org.sonar.api.config.License;
import org.sonar.api.config.PropertyDefinitions;
import org.sonar.api.config.Settings;
diff --git a/server/sonar-web/Gruntfile.coffee b/server/sonar-web/Gruntfile.coffee
index 88e35c0930a..5cef7cbd1dc 100644
--- a/server/sonar-web/Gruntfile.coffee
+++ b/server/sonar-web/Gruntfile.coffee
@@ -78,6 +78,7 @@ module.exports = (grunt) ->
'<%= pkg.assets %>js/third-party/jquery.js'
'<%= pkg.assets %>js/third-party/jquery-ui.js'
'<%= pkg.assets %>js/third-party/d3.js'
+ '<%= pkg.assets %>js/third-party/latinize.js'
'<%= pkg.assets %>js/third-party/underscore.js'
'<%= pkg.assets %>js/third-party/select2.js'
'<%= pkg.assets %>js/third-party/keymaster.js'
@@ -102,7 +103,6 @@ module.exports = (grunt) ->
'<%= pkg.assets %>js/resource.js'
'<%= pkg.assets %>js/issue.js'
'<%= pkg.assets %>js/recent-history.js'
- '<%= pkg.assets %>js/latinize.js'
]
build:
files:
@@ -111,6 +111,7 @@ module.exports = (grunt) ->
'<%= pkg.assets %>js/third-party/jquery.js'
'<%= pkg.assets %>js/third-party/jquery-ui.js'
'<%= pkg.assets %>js/third-party/d3.js'
+ '<%= pkg.assets %>js/third-party/latinize.js'
'<%= pkg.assets %>js/third-party/underscore.js'
'<%= pkg.assets %>js/third-party/select2.js'
'<%= pkg.assets %>js/third-party/keymaster.js'
@@ -135,7 +136,6 @@ module.exports = (grunt) ->
'<%= pkg.assets %>js/resource.js'
'<%= pkg.assets %>js/issue.js'
'<%= pkg.assets %>js/recent-history.js'
- '<%= pkg.assets %>js/latinize.js'
]
diff --git a/server/sonar-web/src/main/js/navigator/filters/base-filters.js b/server/sonar-web/src/main/js/navigator/filters/base-filters.js
index 88a69b7a50f..103f668d40c 100644
--- a/server/sonar-web/src/main/js/navigator/filters/base-filters.js
+++ b/server/sonar-web/src/main/js/navigator/filters/base-filters.js
@@ -33,7 +33,7 @@ define([
this.$el.on('click', function(e) {
e.stopPropagation();
});
- this.$el.attr('id', 'filter-' + this.model.get('property'))
+ this.$el.attr('id', 'filter-' + this.model.get('property'));
},
diff --git a/server/sonar-web/src/main/js/latinize.js b/server/sonar-web/src/main/js/third-party/latinize.js
index 6d302eec0a3..6d302eec0a3 100644
--- a/server/sonar-web/src/main/js/latinize.js
+++ b/server/sonar-web/src/main/js/third-party/latinize.js