mirror of
https://github.com/SonarSource/sonarqube.git
synced 2024-08-07 15:05:55 +02:00
Add I18nTest test
This commit is contained in:
parent
05e45302f2
commit
78afe1925d
52
it/it-plugins/l10n-fr-pack/pom.xml
Normal file
52
it/it-plugins/l10n-fr-pack/pom.xml
Normal file
@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.sonarsource.it</groupId>
|
||||
<artifactId>it-plugins</artifactId>
|
||||
<version>5.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>l10n-fr-pack</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>sonar-plugin</packaging>
|
||||
<description>IT :: Simple French Language Pack</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.sonar</groupId>
|
||||
<artifactId>sonar-plugin-api</artifactId>
|
||||
<version>${apiVersion}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.sonar</groupId>
|
||||
<artifactId>sonar-packaging-maven-plugin</artifactId>
|
||||
<version>1.12.1</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<basePlugin>l10nen</basePlugin>
|
||||
<pluginClass>SimpleFrenchPackPlugin</pluginClass>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>native2ascii-maven-plugin</artifactId>
|
||||
<version>1.0-beta-1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>native2ascii</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.sonar.api.SonarPlugin;
|
||||
|
||||
public final class SimpleFrenchPackPlugin extends SonarPlugin {
|
||||
public List getExtensions() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
metric.ncloc.name=Lignes de code
|
||||
metric.ncloc.description=Lignes de code (non commentaire)
|
||||
widget.size.lines_of_code=Lignes de code
|
||||
|
||||
layout.login=Se connecter
|
||||
layout.powered_by=Propulsé par
|
@ -30,6 +30,7 @@
|
||||
</properties>
|
||||
|
||||
<modules>
|
||||
<module>l10n-fr-pack</module>
|
||||
<module>sonar-fake-plugin</module>
|
||||
</modules>
|
||||
</project>
|
||||
|
5
it/it-projects/ui/xoo-sample/sonar-project.properties
Normal file
5
it/it-projects/ui/xoo-sample/sonar-project.properties
Normal file
@ -0,0 +1,5 @@
|
||||
sonar.projectKey=sample
|
||||
sonar.projectName=Sample
|
||||
sonar.projectVersion=1.0-SNAPSHOT
|
||||
sonar.sources=src/main/xoo
|
||||
sonar.language=xoo
|
16
it/it-projects/ui/xoo-sample/src/main/xoo/sample/Sample.xoo
Normal file
16
it/it-projects/ui/xoo-sample/src/main/xoo/sample/Sample.xoo
Normal file
@ -0,0 +1,16 @@
|
||||
package sample;
|
||||
|
||||
public class Sample {
|
||||
|
||||
public Sample(int i) {
|
||||
int j = i++;
|
||||
}
|
||||
|
||||
private String myMethod() {
|
||||
if (foo == bar) {
|
||||
return "hello";
|
||||
} else {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
ncloc:13
|
||||
#Used by dashboard/widgets tests
|
||||
complexity:3
|
||||
complexity_in_classes:3
|
||||
classes:1
|
||||
comment_lines:3
|
||||
public_api:5
|
||||
public_undocumented_api:2
|
||||
duplicated_files:1
|
||||
duplicated_blocks:2
|
||||
duplicated_lines:3
|
63
it/it-tests/src/test/java/ui/I18nTest.java
Normal file
63
it/it-tests/src/test/java/ui/I18nTest.java
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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 ui;
|
||||
|
||||
import com.sonar.orchestrator.Orchestrator;
|
||||
import com.sonar.orchestrator.build.SonarRunner;
|
||||
import com.sonar.orchestrator.selenium.Selenese;
|
||||
import org.junit.After;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Test;
|
||||
|
||||
import static util.ItUtils.pluginArtifact;
|
||||
import static util.ItUtils.projectDir;
|
||||
import static util.ItUtils.xooPlugin;
|
||||
|
||||
public class I18nTest {
|
||||
|
||||
@ClassRule
|
||||
public static Orchestrator orchestrator = Orchestrator.builderEnv()
|
||||
.addPlugin(pluginArtifact("l10n-fr-pack"))
|
||||
.addPlugin(xooPlugin())
|
||||
.build();
|
||||
|
||||
@After
|
||||
public void cleanDatabase() {
|
||||
orchestrator.resetData();
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO This test should use a fake widget that display a fake metric with decimals instead of using provided metric
|
||||
*/
|
||||
@Test
|
||||
public void test_localization() {
|
||||
orchestrator.executeBuild(SonarRunner.create(projectDir("ui/xoo-sample")));
|
||||
|
||||
Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("ui-i18n",
|
||||
"/ui/i18n/default-locale-is-english.html",
|
||||
"/ui/i18n/french-locale.html",
|
||||
"/ui/i18n/french-pack.html",
|
||||
"/ui/i18n/locale-with-france-country.html",
|
||||
"/ui/i18n/locale-with-swiss-country.html").build();
|
||||
orchestrator.executeSelenese(selenese);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<title>default_locale_is_english</title>
|
||||
</head>
|
||||
<body>
|
||||
<table cellpadding="1" cellspacing="1" border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<td rowspan="1" colspan="3">default_locale_is_english</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>open</td>
|
||||
<td>/sonar/dashboard/index/sample?locale=foo</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>waitForText</td>
|
||||
<td>css=.navbar-context</td>
|
||||
<td>regexp:.*Jan.*|.*Feb.*|.*Mar.*|.*Apr.*|.*May.*|.*Jun.*|.*Jul.*|.*Aug.*|.*Sep.*|.*Oct.*|.*Nov.*|.*Dec.*</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>assertText</td>
|
||||
<td>m_duplicated_lines_density</td>
|
||||
<td>0.0%</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
34
it/it-tests/src/test/resources/ui/i18n/french-locale.html
Normal file
34
it/it-tests/src/test/resources/ui/i18n/french-locale.html
Normal file
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<title>french</title>
|
||||
</head>
|
||||
<body>
|
||||
<table cellpadding="1" cellspacing="1" border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<td rowspan="1" colspan="3">french</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>open</td>
|
||||
<td>/sonar/dashboard/index/sample?locale=fr</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>waitForText</td>
|
||||
<td>css=.navbar-context</td>
|
||||
<td>regexp:.*jan.*|.*fév.*|.*mar.*|.*avr.*|.*mai.*|.*juin.*|.*juil.*|.*août.*|.*sept.*|.*oct.*|.*nov.*|.*déc.*</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>assertText</td>
|
||||
<td>m_duplicated_lines_density</td>
|
||||
<td>0,0%</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
39
it/it-tests/src/test/resources/ui/i18n/french-pack.html
Normal file
39
it/it-tests/src/test/resources/ui/i18n/french-pack.html
Normal file
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<title>french-pack</title>
|
||||
</head>
|
||||
<body>
|
||||
<table cellpadding="1" cellspacing="1" border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<td rowspan="1" colspan="3">french-pack</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>open</td>
|
||||
<td>/sonar/?locale=fr</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>waitForText</td>
|
||||
<td>css=.navbar</td>
|
||||
<td>glob:*Se connecter*</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>open</td>
|
||||
<td>/sonar/dashboard/index/sample?locale=fr</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>assertText</td>
|
||||
<td>css=.size</td>
|
||||
<td>glob:*Lignes de code*</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<title>french-france</title>
|
||||
</head>
|
||||
<body>
|
||||
<table cellpadding="1" cellspacing="1" border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<td rowspan="1" colspan="3">french-france</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>open</td>
|
||||
<td>/sonar/dashboard/index/sample?locale=fr-FR</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>waitForText</td>
|
||||
<td>css=.navbar-context</td>
|
||||
<td>regexp:.*jan.*|.*fév.*|.*mar.*|.*avr.*|.*mai.*|.*juin.*|.*juil.*|.*août.*|.*sept.*|.*oct.*|.*nov.*|.*déc.*</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>assertText</td>
|
||||
<td>m_duplicated_lines_density</td>
|
||||
<td>0,0%</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<title>french-switzerland</title>
|
||||
</head>
|
||||
<body>
|
||||
<table cellpadding="1" cellspacing="1" border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<td rowspan="1" colspan="3">french-switzerland</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>open</td>
|
||||
<td>/sonar/dashboard/index/sample?locale=fr-CH</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>waitForText</td>
|
||||
<td>css=.navbar-context</td>
|
||||
<td>regexp:.*jan.*|.*fév.*|.*mar.*|.*avr.*|.*mai.*|.*juin.*|.*juil.*|.*août.*|.*sept.*|.*oct.*|.*nov.*|.*déc.*</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>assertText</td>
|
||||
<td>m_duplicated_lines_density</td>
|
||||
<td>0.0%</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user