From db99b08a49bd52065ac07401460bbf9323debf05 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Mon, 15 Feb 2016 09:12:05 +0100 Subject: [PATCH] Migrate EncodingTest IT --- .../japanese-charset/sonar-project.properties | 6 ++ .../src/main/xoo/com/test/App.xoo | 75 +++++++++++++++++++ .../src/main/xoo/com/test/App.xoo.measures | 1 + .../src/main/xoo/com/test/AppCpdBug.xoo | 43 +++++++++++ .../main/xoo/com/test/AppCpdBug.xoo.measures | 1 + .../src/main/xoo/com/test/AppDuplication.xoo | 65 ++++++++++++++++ .../xoo/com/test/AppDuplication.xoo.measures | 1 + .../src/test/java/it/Category1Suite.java | 2 + .../test/java/it/sourceCode/EncodingTest.java | 49 ++++++++++++ .../EncodingTest/japanese_sources.html | 39 ++++++++++ 10 files changed, 282 insertions(+) create mode 100644 it/it-projects/sourceCode/japanese-charset/sonar-project.properties create mode 100644 it/it-projects/sourceCode/japanese-charset/src/main/xoo/com/test/App.xoo create mode 100644 it/it-projects/sourceCode/japanese-charset/src/main/xoo/com/test/App.xoo.measures create mode 100644 it/it-projects/sourceCode/japanese-charset/src/main/xoo/com/test/AppCpdBug.xoo create mode 100644 it/it-projects/sourceCode/japanese-charset/src/main/xoo/com/test/AppCpdBug.xoo.measures create mode 100644 it/it-projects/sourceCode/japanese-charset/src/main/xoo/com/test/AppDuplication.xoo create mode 100644 it/it-projects/sourceCode/japanese-charset/src/main/xoo/com/test/AppDuplication.xoo.measures create mode 100644 it/it-tests/src/test/java/it/sourceCode/EncodingTest.java create mode 100644 it/it-tests/src/test/resources/sourceCode/EncodingTest/japanese_sources.html diff --git a/it/it-projects/sourceCode/japanese-charset/sonar-project.properties b/it/it-projects/sourceCode/japanese-charset/sonar-project.properties new file mode 100644 index 00000000000..3c21994665d --- /dev/null +++ b/it/it-projects/sourceCode/japanese-charset/sonar-project.properties @@ -0,0 +1,6 @@ +sonar.projectKey=japanese-charset +sonar.projectName=Japanese charset +sonar.projectVersion=1.0-SNAPSHOT +sonar.sources=src/main/xoo +sonar.language=xoo +sonar.sourceEncoding=Shift_JIS diff --git a/it/it-projects/sourceCode/japanese-charset/src/main/xoo/com/test/App.xoo b/it/it-projects/sourceCode/japanese-charset/src/main/xoo/com/test/App.xoo new file mode 100644 index 00000000000..5496feccf6a --- /dev/null +++ b/it/it-projects/sourceCode/japanese-charset/src/main/xoo/com/test/App.xoo @@ -0,0 +1,75 @@ +package com.test; + +import java.io.PrintWriter; + +/** + * Hello world! + * + */ +public class App +{ + /** + * ’ŠÛƒNƒ‰ƒX‚𓱓ü + * + * + * + */ + public static void main( String[] args ) + { + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + int d1; + int d2; + int d3; + int d4; + int d5; + int d6; + int d7; + int d8; + int d9; + int d10; + } + + public void test(PrintWriter pw) { + pw.print( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + } + + public void ƒnƒ[ƒ[ƒ‹ƒh() { + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + } +} diff --git a/it/it-projects/sourceCode/japanese-charset/src/main/xoo/com/test/App.xoo.measures b/it/it-projects/sourceCode/japanese-charset/src/main/xoo/com/test/App.xoo.measures new file mode 100644 index 00000000000..0478fb1e30a --- /dev/null +++ b/it/it-projects/sourceCode/japanese-charset/src/main/xoo/com/test/App.xoo.measures @@ -0,0 +1 @@ +ncloc:76 diff --git a/it/it-projects/sourceCode/japanese-charset/src/main/xoo/com/test/AppCpdBug.xoo b/it/it-projects/sourceCode/japanese-charset/src/main/xoo/com/test/AppCpdBug.xoo new file mode 100644 index 00000000000..61a27c9aa45 --- /dev/null +++ b/it/it-projects/sourceCode/japanese-charset/src/main/xoo/com/test/AppCpdBug.xoo @@ -0,0 +1,43 @@ +package com.test; + +/** + * Hello world! + * + */ +public class AppCpdBug +{ + /** + * ’ŠÛƒNƒ‰ƒX‚𓱓ü + * + * + * + */ + public static void main( String[] args ) + { + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + int d1; + int d2; + int d3; + int d4; + int d5; + int d6; + int d7; + int d8; + int d9; + int d10; + } +} diff --git a/it/it-projects/sourceCode/japanese-charset/src/main/xoo/com/test/AppCpdBug.xoo.measures b/it/it-projects/sourceCode/japanese-charset/src/main/xoo/com/test/AppCpdBug.xoo.measures new file mode 100644 index 00000000000..9fd62445ebd --- /dev/null +++ b/it/it-projects/sourceCode/japanese-charset/src/main/xoo/com/test/AppCpdBug.xoo.measures @@ -0,0 +1 @@ +ncloc:44 diff --git a/it/it-projects/sourceCode/japanese-charset/src/main/xoo/com/test/AppDuplication.xoo b/it/it-projects/sourceCode/japanese-charset/src/main/xoo/com/test/AppDuplication.xoo new file mode 100644 index 00000000000..f69e98cd252 --- /dev/null +++ b/it/it-projects/sourceCode/japanese-charset/src/main/xoo/com/test/AppDuplication.xoo @@ -0,0 +1,65 @@ +package com.test; + +/** + * Hello world! + * + */ +public class AppDuplication +{ + /** + * ’ŠÛƒNƒ‰ƒX‚𓱓ü + * + * + * + */ + public static void main( String[] args ) + { + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println( "ƒnƒ[ƒ[ƒ‹ƒh!" ); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + System.out.println("Ø–¾‘ƒpƒX\’z‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"); + int d1; + int d2; + int d3; + int d4; + int d5; + int d6; + int d7; + int d8; + int d9; + int d10; + } +} diff --git a/it/it-projects/sourceCode/japanese-charset/src/main/xoo/com/test/AppDuplication.xoo.measures b/it/it-projects/sourceCode/japanese-charset/src/main/xoo/com/test/AppDuplication.xoo.measures new file mode 100644 index 00000000000..aad53b8fe28 --- /dev/null +++ b/it/it-projects/sourceCode/japanese-charset/src/main/xoo/com/test/AppDuplication.xoo.measures @@ -0,0 +1 @@ +ncloc:66 diff --git a/it/it-tests/src/test/java/it/Category1Suite.java b/it/it-tests/src/test/java/it/Category1Suite.java index a81080064be..06bd1bb8598 100644 --- a/it/it-tests/src/test/java/it/Category1Suite.java +++ b/it/it-tests/src/test/java/it/Category1Suite.java @@ -69,6 +69,7 @@ import it.qualityGate.QualityGateUiTest; import it.settings.PropertySetsTest; import it.settings.SettingsTest; import it.settings.SubCategoriesTest; +import it.sourceCode.EncodingTest; import org.junit.ClassRule; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -91,6 +92,7 @@ import static util.ItUtils.xooPlugin; ProjectComparisonTest.class, AllProjectsTest.class, ProjectWidgetsTest.class, + EncodingTest.class, // settings PropertySetsTest.class, SubCategoriesTest.class, diff --git a/it/it-tests/src/test/java/it/sourceCode/EncodingTest.java b/it/it-tests/src/test/java/it/sourceCode/EncodingTest.java new file mode 100644 index 00000000000..acee93cb531 --- /dev/null +++ b/it/it-tests/src/test/java/it/sourceCode/EncodingTest.java @@ -0,0 +1,49 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program 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. + * + * This program 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 it.sourceCode; + +import com.sonar.orchestrator.Orchestrator; +import com.sonar.orchestrator.selenium.Selenese; +import it.Category1Suite; +import org.junit.Before; +import org.junit.ClassRule; +import org.junit.Test; + +import static util.ItUtils.runProjectAnalysis; + +public class EncodingTest { + + @ClassRule + public static Orchestrator orchestrator = Category1Suite.ORCHESTRATOR; + + @Before + public void deleteData() { + orchestrator.resetData(); + } + + @Test + public void support_japanese_charset() { + runProjectAnalysis(orchestrator, "sourceCode/japanese-charset", "sonar.sourceEncoding", "Shift_JIS"); + + Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("java-japanese-charset", + "/sourceCode/EncodingTest/japanese_sources.html").build(); + orchestrator.executeSelenese(selenese); + } +} diff --git a/it/it-tests/src/test/resources/sourceCode/EncodingTest/japanese_sources.html b/it/it-tests/src/test/resources/sourceCode/EncodingTest/japanese_sources.html new file mode 100644 index 00000000000..830afd8fc0c --- /dev/null +++ b/it/it-tests/src/test/resources/sourceCode/EncodingTest/japanese_sources.html @@ -0,0 +1,39 @@ + + + + + + japanese_sources + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
japanese_sources
open/component/index?id=japanese-charset%3Asrc%2Fmain%2Fxoo%2Fcom%2Ftest%2FAppDuplication.xoo
waitForElementPresentcss=.source-viewer
waitForTextcss=.source-tableglob:*public class AppDuplication*
assertTextcss=.source-tableglob:*証明書パス構築に失敗しました。*
+ + -- 2.39.5