diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2015-07-27 12:25:42 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2015-07-27 13:48:01 +0200 |
commit | 60a09b339533429a7eebecc75c21f36a45ee06ee (patch) | |
tree | 32f32771858b51aea12c69f3d073d8aa1bb0b33a /it | |
parent | 5050ad482cc23da9593fabf5e57863665f39aabd (diff) | |
download | sonarqube-60a09b339533429a7eebecc75c21f36a45ee06ee.tar.gz sonarqube-60a09b339533429a7eebecc75c21f36a45ee06ee.zip |
Move server category test from it-sonar
Diffstat (limited to 'it')
81 files changed, 2130 insertions, 257 deletions
diff --git a/it/it-plugins/global-property-change-plugin/pom.xml b/it/it-plugins/global-property-change-plugin/pom.xml new file mode 100644 index 00000000000..dd98ded898c --- /dev/null +++ b/it/it-plugins/global-property-change-plugin/pom.xml @@ -0,0 +1,39 @@ +<?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>global-property-change-plugin</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>sonar-plugin</packaging> + <description>Plugins :: Global Property Change</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> + <pluginClass>GlobalPropertyChangePlugin</pluginClass> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/it/it-plugins/global-property-change-plugin/src/main/java/FakeGlobalPropertyChange.java b/it/it-plugins/global-property-change-plugin/src/main/java/FakeGlobalPropertyChange.java new file mode 100644 index 00000000000..ed0c697c5b7 --- /dev/null +++ b/it/it-plugins/global-property-change-plugin/src/main/java/FakeGlobalPropertyChange.java @@ -0,0 +1,12 @@ +import org.sonar.api.Properties; +import org.sonar.api.Property; +import org.sonar.api.config.GlobalPropertyChangeHandler; + +@Properties(@Property(key = "globalPropertyChange.received", name = "Check that extension has correctly been notified by global property change", category = "fake")) +public final class FakeGlobalPropertyChange extends GlobalPropertyChangeHandler { + + @Override + public void onChange(PropertyChange propertyChange) { + System.out.println("Received change: " + propertyChange); + } +} diff --git a/it/it-plugins/global-property-change-plugin/src/main/java/GlobalPropertyChangePlugin.java b/it/it-plugins/global-property-change-plugin/src/main/java/GlobalPropertyChangePlugin.java new file mode 100644 index 00000000000..3f27d04f9db --- /dev/null +++ b/it/it-plugins/global-property-change-plugin/src/main/java/GlobalPropertyChangePlugin.java @@ -0,0 +1,9 @@ +import java.util.Arrays; +import java.util.List; +import org.sonar.api.SonarPlugin; + +public class GlobalPropertyChangePlugin extends SonarPlugin { + public List getExtensions() { + return Arrays.asList(FakeGlobalPropertyChange.class); + } +} diff --git a/it/it-plugins/license-plugin/pom.xml b/it/it-plugins/license-plugin/pom.xml new file mode 100644 index 00000000000..e2480fb86b7 --- /dev/null +++ b/it/it-plugins/license-plugin/pom.xml @@ -0,0 +1,38 @@ +<?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>license-plugin</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>sonar-plugin</packaging> + <description>Plugins :: License</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> + <pluginClass>LicensePlugin</pluginClass> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/it/it-plugins/license-plugin/src/main/java/LicensePlugin.java b/it/it-plugins/license-plugin/src/main/java/LicensePlugin.java new file mode 100644 index 00000000000..b7d589dac1d --- /dev/null +++ b/it/it-plugins/license-plugin/src/main/java/LicensePlugin.java @@ -0,0 +1,24 @@ +import java.util.Collections; +import java.util.List; +import org.sonar.api.CoreProperties; +import org.sonar.api.Properties; +import org.sonar.api.Property; +import org.sonar.api.PropertyType; +import org.sonar.api.SonarPlugin; + +@Properties({ + @Property( + key = "untyped.license.secured", + name = "Property without license type", + category = CoreProperties.CATEGORY_GENERAL), + @Property( + key = "typed.license.secured", + name = "Typed property", + category = CoreProperties.CATEGORY_GENERAL, + type = PropertyType.LICENSE) +}) +public class LicensePlugin extends SonarPlugin { + public List getExtensions() { + return Collections.emptyList(); + } +} diff --git a/it/it-plugins/pom.xml b/it/it-plugins/pom.xml index ef5117becb0..d93f4a945e8 100644 --- a/it/it-plugins/pom.xml +++ b/it/it-plugins/pom.xml @@ -30,8 +30,13 @@ </properties> <modules> + <module>global-property-change-plugin</module> <module>l10n-fr-pack</module> + <module>license-plugin</module> + <module>property-relocation-plugin</module> <module>property-sets-plugin</module> + <module>server-plugin</module> + <module>settings-plugin</module> <module>sonar-fake-plugin</module> <module>sonar-subcategories-plugin</module> </modules> diff --git a/it/it-plugins/property-relocation-plugin/pom.xml b/it/it-plugins/property-relocation-plugin/pom.xml new file mode 100644 index 00000000000..1f3e0d353a6 --- /dev/null +++ b/it/it-plugins/property-relocation-plugin/pom.xml @@ -0,0 +1,39 @@ +<?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>property-relocation-plugin</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>sonar-plugin</packaging> + <description>Plugins :: Property Relocation</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> + <pluginClass>PropertyRelocationPlugin</pluginClass> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/it/it-plugins/property-relocation-plugin/src/main/java/CheckProperties.java b/it/it-plugins/property-relocation-plugin/src/main/java/CheckProperties.java new file mode 100644 index 00000000000..ef0a850440b --- /dev/null +++ b/it/it-plugins/property-relocation-plugin/src/main/java/CheckProperties.java @@ -0,0 +1,16 @@ +import org.sonar.api.BatchExtension; +import org.sonar.api.config.Settings; + +public class CheckProperties implements BatchExtension { + private Settings settings; + + public CheckProperties(Settings settings) { + this.settings = settings; + } + + public void start() { + if (settings.getBoolean("sonar.newKey") != true) { + throw new IllegalStateException("Property not found: sonar.newKey"); + } + } +} diff --git a/it/it-plugins/property-relocation-plugin/src/main/java/PropertyRelocationPlugin.java b/it/it-plugins/property-relocation-plugin/src/main/java/PropertyRelocationPlugin.java new file mode 100644 index 00000000000..f2e1e654215 --- /dev/null +++ b/it/it-plugins/property-relocation-plugin/src/main/java/PropertyRelocationPlugin.java @@ -0,0 +1,14 @@ +import java.util.Arrays; +import java.util.List; +import org.sonar.api.Properties; +import org.sonar.api.Property; +import org.sonar.api.SonarPlugin; + +@Properties({ + @Property(key = "sonar.newKey", deprecatedKey = "sonar.deprecatedKey", name = "New Key", category = "general") +}) +public class PropertyRelocationPlugin extends SonarPlugin { + public List getExtensions() { + return Arrays.asList(CheckProperties.class); + } +} diff --git a/it/it-plugins/server-plugin/pom.xml b/it/it-plugins/server-plugin/pom.xml new file mode 100644 index 00000000000..82c49fae573 --- /dev/null +++ b/it/it-plugins/server-plugin/pom.xml @@ -0,0 +1,39 @@ +<?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>server-plugin</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>sonar-plugin</packaging> + <name>SonarQube Integration Tests :: Plugins :: Server</name> + <description>Main plugin for Server tests</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> + <pluginClass>ServerPlugin</pluginClass> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/it/it-plugins/server-plugin/src/main/java/ServerPlugin.java b/it/it-plugins/server-plugin/src/main/java/ServerPlugin.java new file mode 100644 index 00000000000..41271c1b628 --- /dev/null +++ b/it/it-plugins/server-plugin/src/main/java/ServerPlugin.java @@ -0,0 +1,14 @@ +import java.util.Arrays; +import java.util.List; +import org.sonar.api.Properties; +import org.sonar.api.Property; +import org.sonar.api.SonarPlugin; + +@Properties({ + @Property(key = "some-property", name = "Some Property", defaultValue = "aDefaultValue", global = true, project = false) +}) +public class ServerPlugin extends SonarPlugin { + public List getExtensions() { + return Arrays.asList(WidgetDisplayingProperties.class, TempFolderExtension.class); + } +} diff --git a/it/it-plugins/server-plugin/src/main/java/TempFolderExtension.java b/it/it-plugins/server-plugin/src/main/java/TempFolderExtension.java new file mode 100644 index 00000000000..a8ac1c854e9 --- /dev/null +++ b/it/it-plugins/server-plugin/src/main/java/TempFolderExtension.java @@ -0,0 +1,40 @@ +import org.sonar.api.Properties; +import org.sonar.api.Property; +import org.sonar.api.PropertyType; +import org.sonar.api.ServerExtension; +import org.sonar.api.config.Settings; +import org.sonar.api.utils.TempFolder; +import org.sonar.api.utils.log.Logger; +import org.sonar.api.utils.log.Loggers; + +@Properties({ + @Property( + key = TempFolderExtension.CREATE_TEMP_FILES, + type = PropertyType.BOOLEAN, + name = "Property to decide if it should create temp files", + defaultValue = "false") +}) +public class TempFolderExtension implements ServerExtension { + + private static final Logger LOG = Loggers.get(TempFolderExtension.class); + + public static final String CREATE_TEMP_FILES = "sonar.createTempFiles"; + + private Settings settings; + + private TempFolder tempFolder; + + public TempFolderExtension(Settings settings, TempFolder tempFolder) { + this.settings = settings; + this.tempFolder = tempFolder; + start(); + } + + public void start() { + if (settings.getBoolean(CREATE_TEMP_FILES)) { + LOG.info("Creating temp directory: " + tempFolder.newDir("sonar-it").getAbsolutePath()); + LOG.info("Creating temp file: " + tempFolder.newFile("sonar-it", ".txt").getAbsolutePath()); + } + } + +} diff --git a/it/it-plugins/server-plugin/src/main/java/WidgetDisplayingProperties.java b/it/it-plugins/server-plugin/src/main/java/WidgetDisplayingProperties.java new file mode 100644 index 00000000000..94f92639720 --- /dev/null +++ b/it/it-plugins/server-plugin/src/main/java/WidgetDisplayingProperties.java @@ -0,0 +1,22 @@ +import org.sonar.api.web.AbstractRubyTemplate; +import org.sonar.api.web.RubyRailsWidget; +import org.sonar.api.web.WidgetScope; + +import static org.sonar.api.web.WidgetScope.GLOBAL; + +@WidgetScope(GLOBAL) +public class WidgetDisplayingProperties extends AbstractRubyTemplate implements RubyRailsWidget { + + public String getId() { + return "widget-displaying-properties"; + } + + public String getTitle() { + return "Widget Displaying Properties"; + } + + @Override + protected String getTemplatePath() { + return "/widgets/widget-displaying-properties.html.erb"; + } +} diff --git a/it/it-plugins/server-plugin/src/main/resources/widgets/widget-displaying-properties.html.erb b/it/it-plugins/server-plugin/src/main/resources/widgets/widget-displaying-properties.html.erb new file mode 100644 index 00000000000..b98754d9605 --- /dev/null +++ b/it/it-plugins/server-plugin/src/main/resources/widgets/widget-displaying-properties.html.erb @@ -0,0 +1,12 @@ +<table> + <thead> + <tr> + <th>Property</th> + <th>Value</th> + </tr> + </thead> + <tr> + <td>some-property</td> + <td id="some-property"><%= configuration('some-property') -%></td> + </tr> +</table> diff --git a/it/it-plugins/settings-plugin/pom.xml b/it/it-plugins/settings-plugin/pom.xml new file mode 100644 index 00000000000..9196eae40fc --- /dev/null +++ b/it/it-plugins/settings-plugin/pom.xml @@ -0,0 +1,40 @@ +<?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>settings-plugin</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>sonar-plugin</packaging> + <description>Plugins :: Settings</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> + <pluginClass>SettingsPlugin</pluginClass> + <pluginName>Settings</pluginName> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/it/it-plugins/settings-plugin/src/main/java/PropertyTypes.java b/it/it-plugins/settings-plugin/src/main/java/PropertyTypes.java new file mode 100644 index 00000000000..eb2738f07a9 --- /dev/null +++ b/it/it-plugins/settings-plugin/src/main/java/PropertyTypes.java @@ -0,0 +1,16 @@ +import org.sonar.api.Properties; +import org.sonar.api.Property; +import org.sonar.api.PropertyType; +import org.sonar.api.ServerExtension; + +@Properties({ + @Property(key = "boolean", name = "Boolean", type=PropertyType.BOOLEAN), + @Property(key = "integer", name = "Integer", type=PropertyType.INTEGER), + @Property(key = "float", name = "Float", type=PropertyType.FLOAT), + @Property(key = "password", name = "Password", type=PropertyType.PASSWORD, defaultValue = "sonar"), + @Property(key = "text", name = "Text", type=PropertyType.TEXT), + @Property(key = "metric", name = "Metric", type=PropertyType.METRIC), + @Property(key = "single_select_list", name = "Single Select List", type=PropertyType.SINGLE_SELECT_LIST, options = {"de", "en", "nl"}) +}) +public class PropertyTypes implements ServerExtension { +} diff --git a/it/it-plugins/settings-plugin/src/main/java/ServerExtensionWithProperties.java b/it/it-plugins/settings-plugin/src/main/java/ServerExtensionWithProperties.java new file mode 100644 index 00000000000..d4ecd07d124 --- /dev/null +++ b/it/it-plugins/settings-plugin/src/main/java/ServerExtensionWithProperties.java @@ -0,0 +1,24 @@ +import org.sonar.api.Properties; +import org.sonar.api.Property; +import org.sonar.api.ServerExtension; +import org.sonar.api.config.Settings; + +@Properties({ + @Property(key = "settings.extension.hidden", name = "Hidden Property", description = "Hidden Property defined on extension but not plugin", global = false, project = false, module = false, defaultValue = "teahupoo"), + @Property(key = "settings.extension.global", name = "Global Property", global = true, project = false, module = false) +}) +public final class ServerExtensionWithProperties implements ServerExtension { + + private Settings settings; + + public ServerExtensionWithProperties(Settings settings) { + this.settings = settings; + } + + public void start() { + System.out.println("Test that the default value of properties are automatically injected by the component Settings"); + if (!"teahupoo".equals(settings.getString("settings.extension.hidden"))) { + throw new IllegalStateException("The property settings.extension.hidden is not registered"); + } + } +} diff --git a/it/it-plugins/settings-plugin/src/main/java/SettingsPlugin.java b/it/it-plugins/settings-plugin/src/main/java/SettingsPlugin.java new file mode 100644 index 00000000000..e89b7bfb555 --- /dev/null +++ b/it/it-plugins/settings-plugin/src/main/java/SettingsPlugin.java @@ -0,0 +1,9 @@ +import java.util.Arrays; +import java.util.List; +import org.sonar.api.SonarPlugin; + +public class SettingsPlugin extends SonarPlugin { + public List getExtensions() { + return Arrays.asList(ServerExtensionWithProperties.class, PropertyTypes.class); + } +} diff --git a/it/it-tests/src/test/java/administation/HttpsTest.java b/it/it-tests/src/test/java/administation/HttpsTest.java new file mode 100644 index 00000000000..1f77039e869 --- /dev/null +++ b/it/it-tests/src/test/java/administation/HttpsTest.java @@ -0,0 +1,182 @@ +/* + * Copyright (C) 2009-2014 SonarSource SA + * All rights reserved + * mailto:contact AT sonarsource DOT com + */ +package administation; + +import com.sonar.orchestrator.Orchestrator; +import com.sonar.orchestrator.util.NetworkUtils; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.security.cert.X509Certificate; +import java.util.List; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLHandshakeException; +import javax.net.ssl.SSLSession; +import javax.net.ssl.SSLSocketFactory; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.StringUtils; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.fail; + +public class HttpsTest { + + public static final String HTTPS_PROTOCOLS = "https.protocols"; + + Orchestrator orchestrator; + + int httpsPort = NetworkUtils.getNextAvailablePort(); + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + String initialHttpsProtocols = null; + + @Before + public void setUp() throws Exception { + // SSLv3 is not supported since SQ 4.5.2. Only TLS v1, v1.1 and v1.2 are + // enabled by Tomcat. + // The problem is that java 1.6 supports only TLSv1 but not v1.1 nor 1.2, + // so version to be used must be explicitly set on JVM. + initialHttpsProtocols = StringUtils.defaultString(System.getProperty(HTTPS_PROTOCOLS), ""); + System.setProperty(HTTPS_PROTOCOLS, "TLSv1"); + } + + @After + public void tearDown() { + if (orchestrator != null) { + orchestrator.stop(); + } + System.setProperty(HTTPS_PROTOCOLS, initialHttpsProtocols); + } + + @Test + public void fail_to_start_if_bad_keystore_credentials() throws Exception { + try { + URL jksKeystore = getClass().getResource("/administration/HttpsTest/keystore.jks"); + orchestrator = Orchestrator.builderEnv() + .setServerProperty("sonar.web.https.port", String.valueOf(httpsPort)) + .setServerProperty("sonar.web.https.keyAlias", "tests") + .setServerProperty("sonar.web.https.keyPass", "__wrong__") + .setServerProperty("sonar.web.https.keystoreFile", new File(jksKeystore.toURI()).getAbsolutePath()) + .setServerProperty("sonar.web.https.keystorePass", "__wrong__") + .build(); + orchestrator.start(); + fail(); + } catch (Exception e) { + File logFile = orchestrator.getServer().getLogs(); + assertThat(FileUtils.readFileToString(logFile)).contains("Password verification failed"); + } + } + + @Test + public void enable_https_port() throws Exception { + // start server + URL jksKeystore = getClass().getResource("/administration/HttpsTest/keystore.jks"); + orchestrator = Orchestrator.builderEnv() + .setServerProperty("sonar.web.https.port", String.valueOf(httpsPort)) + .setServerProperty("sonar.web.https.keyAlias", "tests") + .setServerProperty("sonar.web.https.keyPass", "thetests") + .setServerProperty("sonar.web.https.keystoreFile", new File(jksKeystore.toURI()).getAbsolutePath()) + .setServerProperty("sonar.web.https.keystorePass", "thepassword") + .build(); + orchestrator.start(); + + // check logs + File logFile = orchestrator.getServer().getLogs(); + assertThat(FileUtils.readFileToString(logFile)).contains("HTTPS connector enabled on port " + httpsPort); + + // connect from clients + connectTrusted(); + connectUntrusted(); + } + + private void connectTrusted() throws IOException { + URL url = new URL("https://localhost:" + httpsPort + "/sonar"); + HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); + try { + connection.getInputStream(); + fail(); + } catch (SSLHandshakeException e) { + // ok, the certificate is not trusted + } + } + + private void connectUntrusted() throws Exception { + // Create a trust manager that does not validate certificate chains + TrustManager[] trustAllCerts = new TrustManager[] {new X509TrustManager() { + public X509Certificate[] getAcceptedIssuers() { + return null; + } + + public void checkClientTrusted(X509Certificate[] certs, String authType) { + } + + public void checkServerTrusted(X509Certificate[] certs, String authType) { + } + } + }; + + // Install the all-trusting trust manager + // SSLv3 is disabled since SQ 4.5.2 : https://jira.codehaus.org/browse/SONAR-5860 + SSLContext sc = SSLContext.getInstance("TLS"); + sc.init(null, trustAllCerts, new java.security.SecureRandom()); + + SSLSocketFactory untrustedSocketFactory = sc.getSocketFactory(); + + + // Create all-trusting host name verifier + HostnameVerifier allHostsValid = new HostnameVerifier() { + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + URL url = new URL("https://localhost:" + httpsPort + "/sonar/sessions/login"); + HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); + connection.setRequestMethod("POST"); + connection.setAllowUserInteraction(true); + connection.setSSLSocketFactory(untrustedSocketFactory); + connection.setHostnameVerifier(allHostsValid); + + InputStream input = connection.getInputStream(); + checkCookieFlags(connection); + try { + String html = IOUtils.toString(input); + assertThat(html).contains("<body"); + } finally { + IOUtils.closeQuietly(input); + } + } + + /** + * SSF-13 HttpOnly flag + * SSF-16 Secure flag + */ + private void checkCookieFlags(HttpsURLConnection connection) { + List<String> cookies = connection.getHeaderFields().get("Set-Cookie"); + boolean foundSessionCookie = false; + for (String cookie : cookies) { + if (StringUtils.containsIgnoreCase(cookie, "JSESSIONID")) { + foundSessionCookie = true; + assertThat(cookie).containsIgnoringCase("Secure").containsIgnoringCase("HttpOnly"); + } + } + if (!foundSessionCookie) { + fail("Session cookie not found"); + } + } +} diff --git a/it/it-tests/src/test/java/administation/ServerTest.java b/it/it-tests/src/test/java/administation/ServerTest.java new file mode 100644 index 00000000000..0598dccc0b1 --- /dev/null +++ b/it/it-tests/src/test/java/administation/ServerTest.java @@ -0,0 +1,313 @@ +/* + * Copyright (C) 2009-2014 SonarSource SA + * All rights reserved + * mailto:contact AT sonarsource DOT com + */ +package administation; + +import com.sonar.orchestrator.Orchestrator; +import com.sonar.orchestrator.OrchestratorBuilder; +import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.locator.FileLocation; +import com.sonar.orchestrator.selenium.Selenese; +import java.io.File; +import java.io.IOException; +import java.net.URL; +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang.SystemUtils; +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.util.EntityUtils; +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.sonar.wsclient.base.HttpException; +import org.sonar.wsclient.services.PropertyDeleteQuery; +import org.sonar.wsclient.services.PropertyUpdateQuery; +import org.sonar.wsclient.services.Server; +import org.sonar.wsclient.services.ServerQuery; +import util.ItUtils; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.fail; + +public class ServerTest { + + Orchestrator orchestrator; + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @After + public void stop() { + if (orchestrator != null) { + orchestrator.stop(); + } + } + + /** + * See http://jira.codehaus.org/browse/SONAR-2727 + */ + @Test + public void display_warnings_when_using_h2() { + OrchestratorBuilder builder = Orchestrator.builderEnv(); + if (builder.getOrchestratorConfiguration().getString("sonar.jdbc.dialect").equals("h2")) { + orchestrator = builder.build(); + orchestrator.start(); + + Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("derby-warnings", + "/administration/ServerTest/derby-warning.html").build(); + orchestrator.executeSelenese(selenese); + } + } + + /** + * See http://jira.codehaus.org/browse/SONAR-2840 + */ + @Test + public void hide_jdbc_settings_to_non_admin() { + orchestrator = Orchestrator.createEnv(); + orchestrator.start(); + + Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("jdbc-settings", + "/administration/ServerTest/hide-jdbc-settings.html").build(); + orchestrator.executeSelenese(selenese); + } + + @Test + public void test_settings() { + URL secretKeyUrl = getClass().getResource("/administration/ServerTest/sonar-secret.txt"); + orchestrator = Orchestrator.builderEnv() + .addPlugin(ItUtils.pluginArtifact("settings-plugin")) + .addPlugin(ItUtils.pluginArtifact("license-plugin")) + .setServerProperty("sonar.secretKeyPath", secretKeyUrl.getFile()) + .build(); + orchestrator.start(); + + Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("settings", + "/administration/ServerTest/settings/general-settings.html", + + // SONAR-2869 the annotation @Properties can be used on extensions and not only on plugin entry points + "/administration/ServerTest/settings/hidden-extension-property.html", + "/administration/ServerTest/settings/global-extension-property.html", + + // SONAR-3344 - licenses + "/administration/ServerTest/settings/ignore-corrupted-license.html", + "/administration/ServerTest/settings/display-license.html", + "/administration/ServerTest/settings/display-untyped-license.html", + + // SONAR-2084 - encryption + "/administration/ServerTest/settings/generate-secret-key.html", + "/administration/ServerTest/settings/encrypt-text.html", + + // SONAR-1378 - property types + "/administration/ServerTest/settings/validate-property-type.html", + + // SONAR-3127 - hide passwords + "/administration/ServerTest/settings/hide-passwords.html" + ).build(); + orchestrator.executeSelenese(selenese); + } + + @Test + public void property_relocation() { + orchestrator = Orchestrator.builderEnv() + .addPlugin(ItUtils.pluginArtifact("property-relocation-plugin")) + .addPlugin(ItUtils.xooPlugin()) + .setServerProperty("sonar.deprecatedKey", "true") + .build(); + orchestrator.start(); + + SonarRunner withDeprecatedKey = SonarRunner.create(ItUtils.projectDir("shared/xoo-sample")) + .setProperty("sonar.deprecatedKey", "true"); + SonarRunner withNewKey = SonarRunner.create(ItUtils.projectDir("shared/xoo-sample")) + .setProperty("sonar.newKey", "true"); + // should not fail + orchestrator.executeBuilds(withDeprecatedKey, withNewKey); + + Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("property_relocation", + "/administration/ServerTest/settings/property_relocation.html" + ).build(); + orchestrator.executeSelenese(selenese); + } + + /** + * SONAR-5542 + */ + @Test + public void force_authentication_should_be_used_on_java_web_services_but_not_on_batch_index_and_file() throws IOException { + orchestrator = Orchestrator.createEnv(); + orchestrator.start(); + + try { + orchestrator.getServer().getAdminWsClient().update(new PropertyUpdateQuery("sonar.forceAuthentication", "true")); + + // /batch/index should never need authentication + String batchIndex = orchestrator.getServer().wsClient().get("/batch/index"); + assertThat(batchIndex).isNotEmpty(); + + String jar = batchIndex.split("\\|")[0]; + + // /batch/file should never need authentication + HttpClient httpclient = new DefaultHttpClient(); + try { + HttpGet get = new HttpGet(orchestrator.getServer().getUrl() + "/batch/file?name=" + jar); + HttpResponse response = httpclient.execute(get); + assertThat(response.getStatusLine().getStatusCode()).isEqualTo(200); + EntityUtils.consume(response.getEntity()); + + // As Sonar runner is still using /batch/key, we have to also verify it + get = new HttpGet(orchestrator.getServer().getUrl() + "/batch/" + jar); + response = httpclient.execute(get); + assertThat(response.getStatusLine().getStatusCode()).isEqualTo(200); + EntityUtils.consume(response.getEntity()); + + } finally { + httpclient.getConnectionManager().shutdown(); + } + + // but other java web services should need authentication + try { + orchestrator.getServer().wsClient().get("/api"); + } catch (HttpException e) { + assertThat(e.getMessage()).contains("401"); + } + + } finally { + orchestrator.getServer().getAdminWsClient().delete(new PropertyDeleteQuery("sonar.forceAuthentication")); + } + } + + /** + * SONAR-3320 + */ + @Test + public void global_property_change_extension_point() throws IOException { + orchestrator = Orchestrator.builderEnv() + .addPlugin(ItUtils.pluginArtifact("global-property-change-plugin")) + .build(); + orchestrator.start(); + + orchestrator.getServer().adminWsClient().post("api/properties/create?id=globalPropertyChange.received&value=NEWVALUE"); + assertThat(FileUtils.readFileToString(orchestrator.getServer().getLogs()).contains("Received change: NEWVALUE")); + } + + /** + * SONAR-3516 + */ + @Test + public void check_minimal_sonar_version_at_startup() throws Exception { + try { + orchestrator = Orchestrator.builderEnv() + .addPlugin(FileLocation.of(new File(ServerTest.class.getResource("/administration/ServerTest/incompatible-plugin-1.0.jar").toURI()))) + .build(); + orchestrator.start(); + fail(); + } catch (Exception e) { + assertThat(FileUtils.readFileToString(orchestrator.getServer().getLogs())).contains( + "Plugin incompatible-plugin [incompatibleplugin] requires at least SonarQube 5.9"); + } + } + + /** + * SONAR-3962 + */ + @Test + public void not_fail_with_url_ending_by_jsp() { + orchestrator = Orchestrator.builderEnv().addPlugin(ItUtils.xooPlugin()).build(); + orchestrator.start(); + + orchestrator.executeBuild(SonarRunner.create(ItUtils.projectDir("shared/xoo-sample")) + .setProperty("sonar.projectKey", "myproject.jsp")); + // Access dashboard + Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("url_ending_by_jsp", + "/administration/ServerTest/url_ending_by_jsp.html").build(); + orchestrator.executeSelenese(selenese); + } + + @Test + public void support_install_dir_with_whitespaces() throws Exception { + String dirName = "target/has space"; + FileUtils.deleteDirectory(new File(dirName)); + orchestrator = Orchestrator.builderEnv().setOrchestratorProperty("orchestrator.workspaceDir", dirName).build(); + orchestrator.start(); + + Server.Status status = orchestrator.getServer().getAdminWsClient().find(new ServerQuery()).getStatus(); + assertThat(status).isEqualTo(Server.Status.UP); + } + + // SONAR-4404 + @Test + public void should_get_settings_default_value() { + orchestrator = Orchestrator.builderEnv() + .addPlugin(ItUtils.pluginArtifact("server-plugin")) + .build(); + orchestrator.start(); + + Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("settings-default-value", + "/administration/ServerTest/settings-default-value.html").build(); + orchestrator.executeSelenese(selenese); + } + + // SONAR-4748 + @Test + public void should_create_in_temp_folder() throws Exception { + orchestrator = Orchestrator.builderEnv() + .addPlugin(ItUtils.pluginArtifact("server-plugin")) + .setServerProperty("sonar.createTempFiles", "true") + .build(); + orchestrator.start(); + + File tempDir = new File(orchestrator.getServer().getHome(), "temp/tmp"); + + String logs = FileUtils.readFileToString(orchestrator.getServer().getLogs()); + assertThat(logs).contains("Creating temp directory: " + tempDir.getAbsolutePath() + File.separator + "sonar-it"); + assertThat(logs).contains("Creating temp file: " + tempDir.getAbsolutePath() + File.separator + "sonar-it"); + + // Verify temp folder is created + assertThat(new File(tempDir, "sonar-it")).isDirectory().exists(); + + orchestrator.stop(); + + // Verify temp folder is deleted after shutdown + assertThat(new File(tempDir, "sonar-it")).doesNotExist(); + } + + /** + * SONAR-4843 + */ + @Test + public void restart_forbidden_if_not_dev_mode() throws Exception { + // server classloader locks Jar files on Windows + if (!SystemUtils.IS_OS_WINDOWS) { + orchestrator = Orchestrator.builderEnv().build(); + orchestrator.start(); + try { + orchestrator.getServer().adminWsClient().systemClient().restart(); + fail(); + } catch (Exception e) { + assertThat(e.getMessage()).contains("403"); + } + } + } + + /** + * SONAR-4843 + */ + @Test + public void restart_on_dev_mode() throws Exception { + // server classloader locks Jar files on Windows + if (!SystemUtils.IS_OS_WINDOWS) { + orchestrator = Orchestrator.builderEnv().setServerProperty("sonar.web.dev", "true").build(); + orchestrator.start(); + + orchestrator.getServer().adminWsClient().systemClient().restart(); + assertThat(FileUtils.readFileToString(orchestrator.getServer().getLogs())) + .contains("Restart server") + .contains("Server restarted"); + } + } +} diff --git a/it/it-tests/src/test/java/administation/suite/AdministrationTestSuite.java b/it/it-tests/src/test/java/administation/suite/AdministrationTestSuite.java index 644da40579f..e91265dd063 100644 --- a/it/it-tests/src/test/java/administation/suite/AdministrationTestSuite.java +++ b/it/it-tests/src/test/java/administation/suite/AdministrationTestSuite.java @@ -30,14 +30,15 @@ import util.ItUtils; BulkDeletionTest.class, ProjectAdministrationTest.class, PropertySetsTest.class, - SubCategoriesTest.class + SubCategoriesTest.class, + WebServiceTest.class, + ServerAdministrationTest.class }) public class AdministrationTestSuite { @ClassRule public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv() .setServerProperty("sonar.notifications.delay", "1") -// .addPlugin(ItUtils.pluginArtifact("crash-plugin")) .addPlugin(ItUtils.pluginArtifact("property-sets-plugin")) .addPlugin(ItUtils.pluginArtifact("sonar-subcategories-plugin")) .addPlugin(ItUtils.xooPlugin()) diff --git a/it/it-tests/src/test/java/administation/suite/BulkDeletionTest.java b/it/it-tests/src/test/java/administation/suite/BulkDeletionTest.java index b54c1eee4d5..567b07da529 100644 --- a/it/it-tests/src/test/java/administation/suite/BulkDeletionTest.java +++ b/it/it-tests/src/test/java/administation/suite/BulkDeletionTest.java @@ -49,7 +49,7 @@ public class BulkDeletionTest { executeBuild("cameleon-3", "Bar-Sonar-Plugin"); Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("project-bulk-deletion-on-selected-project", - "/administration/project-bulk-deletion/bulk-delete-filter-projects.html" + "/administration/suite/BulkDeletionTest/project-bulk-deletion/bulk-delete-filter-projects.html" ).build(); orchestrator.executeSelenese(selenese); } @@ -63,8 +63,8 @@ public class BulkDeletionTest { Selenese selenese = Selenese.builder() .setHtmlTestsInClasspath("bulk-delete-projects-with-short-name", - "/administration/project-bulk-deletion/display-two-letters-long-project.html", - "/administration/project-bulk-deletion/filter-two-letters-long-project.html" + "/administration/suite/BulkDeletionTest/project-bulk-deletion/display-two-letters-long-project.html", + "/administration/suite/BulkDeletionTest/project-bulk-deletion/filter-two-letters-long-project.html" ).build(); orchestrator.executeSelenese(selenese); } diff --git a/it/it-tests/src/test/java/administation/suite/ProjectAdministrationTest.java b/it/it-tests/src/test/java/administation/suite/ProjectAdministrationTest.java index 97d9b7a6f8e..1370eae96d8 100644 --- a/it/it-tests/src/test/java/administation/suite/ProjectAdministrationTest.java +++ b/it/it-tests/src/test/java/administation/suite/ProjectAdministrationTest.java @@ -116,7 +116,7 @@ public class ProjectAdministrationTest { PermissionParameters.create().user(projectAdminUser).component("sample").permission("admin")); orchestrator.executeSelenese( - Selenese.builder().setHtmlTestsInClasspath("project-deletion", "/administration/project-deletion/project-deletion.html").build() + Selenese.builder().setHtmlTestsInClasspath("project-deletion", "/administration/suite/ProjectAdministrationTest/project-deletion/project-deletion.html").build() ); } finally { adminClient.userClient().deactivate(projectAdminUser); @@ -143,7 +143,7 @@ public class ProjectAdministrationTest { Selenese selenese = Selenese .builder() .setHtmlTestsInClasspath("delete_version_of_multimodule_project", - "/administration/project-administration/multimodule-project-modify-version.html" + "/administration/suite/ProjectAdministrationTest/project-administration/multimodule-project-modify-version.html" ).build(); orchestrator.executeSelenese(selenese); @@ -152,7 +152,7 @@ public class ProjectAdministrationTest { selenese = Selenese .builder() .setHtmlTestsInClasspath("delete_version_of_multimodule_project", - "/administration/project-administration/multimodule-project-delete-version.html" + "/administration/suite/ProjectAdministrationTest/project-administration/multimodule-project-delete-version.html" ).build(); orchestrator.executeSelenese(selenese); @@ -176,7 +176,7 @@ public class ProjectAdministrationTest { Selenese selenese = Selenese .builder() .setHtmlTestsInClasspath("display-alerts-history-page", - "/administration/display-alerts-history-page/should-display-alerts-correctly-history-page.html" + "/administration/suite/ProjectAdministrationTest/display-alerts-history-page/should-display-alerts-correctly-history-page.html" ).build(); orchestrator.executeSelenese(selenese); @@ -204,7 +204,7 @@ public class ProjectAdministrationTest { Selenese selenese = Selenese .builder() .setHtmlTestsInClasspath("display-period-alerts", - "/administration/display-alerts/should-display-period-alerts-correctly.html" + "/administration/suite/ProjectAdministrationTest/display-alerts/should-display-period-alerts-correctly.html" ).build(); orchestrator.executeSelenese(selenese); @@ -221,9 +221,9 @@ public class ProjectAdministrationTest { Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("project-settings", // SONAR-3425 - "/administration/project-settings/override-global-settings.html", + "/administration/suite/ProjectAdministrationTest/project-settings/override-global-settings.html", - "/administration/project-settings/only-on-project-settings.html" + "/administration/suite/ProjectAdministrationTest/project-settings/only-on-project-settings.html" ).build(); orchestrator.executeSelenese(selenese); @@ -242,10 +242,10 @@ public class ProjectAdministrationTest { Selenese selenese = Selenese .builder() .setHtmlTestsInClasspath("project-bulk-update-keys", - "/administration/project-update-keys/bulk-update-impossible-because-duplicate-keys.html", - "/administration/project-update-keys/bulk-update-impossible-because-no-input.html", - "/administration/project-update-keys/bulk-update-impossible-because-no-match.html", - "/administration/project-update-keys/bulk-update-success.html" + "/administration/suite/ProjectAdministrationTest/project-update-keys/bulk-update-impossible-because-duplicate-keys.html", + "/administration/suite/ProjectAdministrationTest/project-update-keys/bulk-update-impossible-because-no-input.html", + "/administration/suite/ProjectAdministrationTest/project-update-keys/bulk-update-impossible-because-no-match.html", + "/administration/suite/ProjectAdministrationTest/project-update-keys/bulk-update-success.html" ).build(); orchestrator.executeSelenese(selenese); } @@ -261,8 +261,8 @@ public class ProjectAdministrationTest { Selenese selenese = Selenese .builder() .setHtmlTestsInClasspath("project-fine-grained-update-keys", - "/administration/project-update-keys/fine-grained-update-impossible.html", - "/administration/project-update-keys/fine-grained-update-success.html" + "/administration/suite/ProjectAdministrationTest/project-update-keys/fine-grained-update-impossible.html", + "/administration/suite/ProjectAdministrationTest/project-update-keys/fine-grained-update-success.html" ).build(); orchestrator.executeSelenese(selenese); } @@ -273,7 +273,7 @@ public class ProjectAdministrationTest { Selenese selenese = Selenese.builder() .setHtmlTestsInClasspath("anonymous_should_have_user_role_to_access_project", - "/administration/anonymous_should_have_user_role_to_access_project/remove_user_role.html" + "/administration/suite/ProjectAdministrationTest/anonymous_should_have_user_role_to_access_project/remove_user_role.html" ).build(); orchestrator.executeSelenese(selenese); } @@ -287,7 +287,7 @@ public class ProjectAdministrationTest { Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("module-settings", // SONAR-3425 - "/administration/module-settings/display-module-settings.html" + "/administration/suite/ProjectAdministrationTest/module-settings/display-module-settings.html" ).build(); orchestrator.executeSelenese(selenese); } diff --git a/it/it-tests/src/test/java/administation/suite/PropertySetsTest.java b/it/it-tests/src/test/java/administation/suite/PropertySetsTest.java index 6b1b7f93830..3ef89bb98e2 100644 --- a/it/it-tests/src/test/java/administation/suite/PropertySetsTest.java +++ b/it/it-tests/src/test/java/administation/suite/PropertySetsTest.java @@ -36,10 +36,10 @@ public class PropertySetsTest { @Test public void should_support_property_sets() { Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("property-sets", - "/administration/property-sets/create.html", - "/administration/property-sets/delete.html", - "/administration/property-sets/reference.html", - "/administration/property-sets/all_types.html" + "/administration/suite/PropertySetsTest/property-sets/create.html", + "/administration/suite/PropertySetsTest/property-sets/delete.html", + "/administration/suite/PropertySetsTest/property-sets/reference.html", + "/administration/suite/PropertySetsTest/property-sets/all_types.html" ).build(); orchestrator.executeSelenese(selenese); @@ -66,7 +66,7 @@ public class PropertySetsTest { @Test public void should_support_property_sets_with_auto_generated_keys() { orchestrator.executeSelenese(Selenese.builder().setHtmlTestsInClasspath("create-auto-generated", - "/administration/auto-generated/create.html" + "/administration/suite/PropertySetsTest/auto-generated/create.html" ).build()); String[] keys = getProperty("sonar.autogenerated").split("[,]"); @@ -75,7 +75,7 @@ public class PropertySetsTest { assertThat(getProperty("sonar.autogenerated." + keys[2] + ".value")).isEqualTo("THIRD"); orchestrator.executeSelenese(Selenese.builder().setHtmlTestsInClasspath("update-auto-generated", - "/administration/auto-generated/update.html" + "/administration/suite/PropertySetsTest/auto-generated/update.html" ).build()); keys = getProperty("sonar.autogenerated").split("[,]"); diff --git a/it/it-tests/src/test/java/administation/suite/ServerAdministrationTest.java b/it/it-tests/src/test/java/administation/suite/ServerAdministrationTest.java new file mode 100644 index 00000000000..20e15bec86a --- /dev/null +++ b/it/it-tests/src/test/java/administation/suite/ServerAdministrationTest.java @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2009-2014 SonarSource SA + * All rights reserved + * mailto:contact AT sonarsource DOT com + */ +package administation.suite; + +import com.sonar.orchestrator.Orchestrator; +import com.sonar.orchestrator.selenium.Selenese; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.util.EntityUtils; +import org.json.simple.JSONValue; +import org.junit.ClassRule; +import org.junit.Test; +import org.sonar.wsclient.services.Server; +import org.sonar.wsclient.services.ServerQuery; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.fail; + +public class ServerAdministrationTest { + + @ClassRule + public static Orchestrator orchestrator = AdministrationTestSuite.ORCHESTRATOR; + + @Test + public void get_sonar_version() { + String version = orchestrator.getServer().getWsClient().find(new ServerQuery()).getVersion(); + if (!StringUtils.startsWithAny(version, new String[] {"5.", "6."})) { + fail("Bad version: " + version); + } + } + + @Test + public void get_server_status() { + assertThat(orchestrator.getServer().getWsClient().find(new ServerQuery()).getStatus()).isEqualTo(Server.Status.UP); + } + + @Test + public void generate_server_id() { + Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("server_id", + "/administration/suite/ServerAdministrationTest/server_id/missing_ip.html", + // SONAR-4102 + "/administration/suite/ServerAdministrationTest/organisation_must_not_accept_special_chars.html", + "/administration/suite/ServerAdministrationTest/valid_id.html").build(); + orchestrator.executeSelenese(selenese); + } + + @Test + public void display_system_info() { + Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("server-administration", + "/administration/suite/ServerAdministrationTest/server-administration/system_info.html" + ).build(); + orchestrator.executeSelenese(selenese); + } + + /** + * SONAR-3147 + */ + @Test + public void test_widgets_web_service() throws IOException { + HttpClient httpclient = new DefaultHttpClient(); + try { + HttpGet get = new HttpGet(orchestrator.getServer().getUrl() + "/api/widgets"); + HttpResponse response = httpclient.execute(get); + + assertThat(response.getStatusLine().getStatusCode()).isEqualTo(200); + String json = IOUtils.toString(response.getEntity().getContent()); + List widgets = (List) JSONValue.parse(json); + assertThat(widgets.size()).isGreaterThan(10); + + // quick test of the first widget + assertThat(((Map) widgets.get(0)).get("title")).isNotNull(); + + EntityUtils.consume(response.getEntity()); + + } finally { + httpclient.getConnectionManager().shutdown(); + } + } + + /** + * SONAR-5197 + */ + @Test + public void api_ws_shortcut() throws Exception { + HttpClient httpclient = new DefaultHttpClient(); + try { + HttpGet get = new HttpGet(orchestrator.getServer().getUrl() + "/api"); + HttpResponse response = httpclient.execute(get); + + assertThat(response.getStatusLine().getStatusCode()).isEqualTo(200); + String json = IOUtils.toString(response.getEntity().getContent()); + Map jsonAsMap = (Map) JSONValue.parse(json); + assertThat(jsonAsMap.get("webServices")).isNotNull(); + EntityUtils.consume(response.getEntity()); + + } finally { + httpclient.getConnectionManager().shutdown(); + } + } +} diff --git a/it/it-tests/src/test/java/administation/suite/SubCategoriesTest.java b/it/it-tests/src/test/java/administation/suite/SubCategoriesTest.java index d963cd7738b..95413851c43 100644 --- a/it/it-tests/src/test/java/administation/suite/SubCategoriesTest.java +++ b/it/it-tests/src/test/java/administation/suite/SubCategoriesTest.java @@ -40,9 +40,9 @@ public class SubCategoriesTest { @Test public void should_support_global_subcategories() { Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("subcategories", - "/administration/subcategories/global-subcategories.html", + "/administration/suite/SubCategoriesTest/subcategories/global-subcategories.html", // SONAR-4495 - "/administration/subcategories/global-subcategories-no-default.html" + "/administration/suite/SubCategoriesTest/subcategories/global-subcategories-no-default.html" ).build(); orchestrator.executeSelenese(selenese); assertThat(getProperty("prop3", null)).isEqualTo("myValue"); @@ -56,9 +56,9 @@ public class SubCategoriesTest { orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("subcategories", - "/administration/subcategories/project-subcategories.html", + "/administration/suite/SubCategoriesTest/subcategories/project-subcategories.html", // SONAR-4495 - "/administration/subcategories/project-subcategories-no-default.html" + "/administration/suite/SubCategoriesTest/subcategories/project-subcategories-no-default.html" ).build(); orchestrator.executeSelenese(selenese); assertThat(getProperty("prop3", "sample")).isEqualTo("myValue2"); diff --git a/it/it-tests/src/test/java/administation/suite/WebServiceTest.java b/it/it-tests/src/test/java/administation/suite/WebServiceTest.java new file mode 100644 index 00000000000..85c4394fb7e --- /dev/null +++ b/it/it-tests/src/test/java/administation/suite/WebServiceTest.java @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2009-2014 SonarSource SA + * All rights reserved + * mailto:contact AT sonarsource DOT com + */ +package administation.suite; + +import com.google.common.base.Function; +import com.google.common.collect.Iterables; +import com.sonar.orchestrator.Orchestrator; +import com.sonar.orchestrator.build.SonarRunner; +import java.io.IOException; +import java.util.List; +import org.apache.commons.io.IOUtils; +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.util.EntityUtils; +import org.junit.Before; +import org.junit.ClassRule; +import org.junit.Test; +import org.sonar.wsclient.Sonar; +import org.sonar.wsclient.services.Favourite; +import org.sonar.wsclient.services.FavouriteCreateQuery; +import org.sonar.wsclient.services.FavouriteDeleteQuery; +import org.sonar.wsclient.services.FavouriteQuery; + +import static com.google.common.collect.Lists.newArrayList; +import static org.assertj.core.api.Assertions.assertThat; +import static util.ItUtils.projectDir; + +public class WebServiceTest { + + @ClassRule + public static Orchestrator orchestrator = AdministrationTestSuite.ORCHESTRATOR; + + @Before + public void inspectProject() { + orchestrator.resetData(); + orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + } + + @Test + public void favourites_web_service() throws Exception { + Sonar adminWsClient = orchestrator.getServer().getAdminWsClient(); + + // GET (nothing) + List<Favourite> favourites = adminWsClient.findAll(new FavouriteQuery()); + assertThat(favourites).isEmpty(); + + // POST (create favourites) + Favourite favourite = adminWsClient.create(new FavouriteCreateQuery("sample")); + assertThat(favourite).isNotNull(); + assertThat(favourite.getKey()).isEqualTo("sample"); + adminWsClient.create(new FavouriteCreateQuery("sample:src/main/xoo/sample/Sample.xoo")); + + // GET (created favourites) + favourites = adminWsClient.findAll(new FavouriteQuery()); + assertThat(favourites).hasSize(2); + List<String> keys = newArrayList(Iterables.transform(favourites, new Function<Favourite, String>() { + @Override + public String apply(Favourite input) { + return input.getKey(); + } + })); + assertThat(keys).containsOnly("sample", "sample:src/main/xoo/sample/Sample.xoo"); + + // DELETE (a favourite) + adminWsClient.delete(new FavouriteDeleteQuery("sample")); + favourites = adminWsClient.findAll(new FavouriteQuery()); + assertThat(favourites).hasSize(1); + assertThat(favourites.get(0).getKey()).isEqualTo("sample:src/main/xoo/sample/Sample.xoo"); + } + + /** + * SONAR-3105 + */ + @Test + public void projects_web_service() throws IOException { + SonarRunner build = SonarRunner.create(projectDir("shared/xoo-sample")); + orchestrator.executeBuild(build); + + String url = orchestrator.getServer().getUrl() + "/api/projects?key=sample&versions=true"; + HttpClient httpclient = new DefaultHttpClient(); + try { + HttpGet get = new HttpGet(url); + HttpResponse response = httpclient.execute(get); + + assertThat(response.getStatusLine().getStatusCode()).isEqualTo(200); + String content = IOUtils.toString(response.getEntity().getContent()); + assertThat(content).doesNotContain("error"); + assertThat(content).contains("sample"); + EntityUtils.consume(response.getEntity()); + + } finally { + httpclient.getConnectionManager().shutdown(); + } + } + +} diff --git a/it/it-tests/src/test/resources/administration/HttpsTest/keystore.jks b/it/it-tests/src/test/resources/administration/HttpsTest/keystore.jks Binary files differnew file mode 100644 index 00000000000..13234b49dc2 --- /dev/null +++ b/it/it-tests/src/test/resources/administration/HttpsTest/keystore.jks diff --git a/it/it-tests/src/test/resources/administration/HttpsTest/keystore.jks.txt b/it/it-tests/src/test/resources/administration/HttpsTest/keystore.jks.txt new file mode 100644 index 00000000000..ce4a4adfc39 --- /dev/null +++ b/it/it-tests/src/test/resources/administration/HttpsTest/keystore.jks.txt @@ -0,0 +1,3 @@ +keytool -genkey -alias tests -keyalg RSA -keystore keystore.jks +keystore password: thepassword +key password for <tests>: thetests
\ No newline at end of file diff --git a/it/it-tests/src/test/resources/administration/ServerTest/derby-warning.html b/it/it-tests/src/test/resources/administration/ServerTest/derby-warning.html new file mode 100644 index 00000000000..2fac7ea6548 --- /dev/null +++ b/it/it-tests/src/test/resources/administration/ServerTest/derby-warning.html @@ -0,0 +1,35 @@ +<?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>derby-warning</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> + <thead> + <tr> + <td rowspan="1" colspan="3">derby-warning</td> + </tr> + </thead> + <tbody> + <tr> + <td>open</td> + <td>/sonar/</td> + <td></td> + </tr> + <tr> + <td>assertElementPresent</td> + <td>evaluation_warning</td> + <td></td> + </tr> + <tr> + <td>assertText</td> + <td>footer</td> + <td>glob:*evaluation*</td> + </tr> + + </tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/administration/ServerTest/hide-jdbc-settings.html b/it/it-tests/src/test/resources/administration/ServerTest/hide-jdbc-settings.html new file mode 100644 index 00000000000..e223287d9e4 --- /dev/null +++ b/it/it-tests/src/test/resources/administration/ServerTest/hide-jdbc-settings.html @@ -0,0 +1,30 @@ +<?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>hide-jdbc-settings</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> + <thead> + <tr> + <td rowspan="1" colspan="3">hide-jdbc-settings</td> + </tr> + </thead> + <tbody> + <tr> + <td>open</td> + <td>/sonar/setup/index</td> + <td></td> + </tr> + <tr> + <td>assertTextNotPresent</td> + <td>jdbc:</td> + <td></td> + </tr> + + </tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/administration/ServerTest/incompatible-plugin-1.0.jar b/it/it-tests/src/test/resources/administration/ServerTest/incompatible-plugin-1.0.jar Binary files differnew file mode 100644 index 00000000000..a998a46bb29 --- /dev/null +++ b/it/it-tests/src/test/resources/administration/ServerTest/incompatible-plugin-1.0.jar diff --git a/it/it-tests/src/test/resources/administration/ServerTest/settings-default-value.html b/it/it-tests/src/test/resources/administration/ServerTest/settings-default-value.html new file mode 100644 index 00000000000..70e59f6de88 --- /dev/null +++ b/it/it-tests/src/test/resources/administration/ServerTest/settings-default-value.html @@ -0,0 +1,29 @@ +<?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>settings-default-value</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> + <thead> + <tr> + <td rowspan="1" colspan="3">settings-default-value</td> + </tr> + </thead> + <tbody> + <tr> + <td>open</td> + <td>/sonar/widget?id=widget-displaying-properties</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>some-property</td> + <td>aDefaultValue</td> +</tr> +</tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/administration/ServerTest/settings/display-license.html b/it/it-tests/src/test/resources/administration/ServerTest/settings/display-license.html new file mode 100644 index 00000000000..ec3d5e86821 --- /dev/null +++ b/it/it-tests/src/test/resources/administration/ServerTest/settings/display-license.html @@ -0,0 +1,64 @@ +<?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>display-license</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> + <tbody> + <tr> + <td>open</td> + <td>/sonar/sessions/logout</td> + <td></td> + </tr> + <tr> + <td>open</td> + <td>/sonar/settings?category=general</td> + <td></td> + </tr> + <tr> + <td>type</td> + <td>id=login</td> + <td>admin</td> + </tr> + <tr> + <td>type</td> + <td>id=password</td> + <td>admin</td> + </tr> + <tr> + <td>clickAndWait</td> + <td>name=commit</td> + <td></td> + </tr> + <tr> + <td>type</td> + <td>id=input_typed.license.secured</td> + <td>TmFtZTogRGV2ZWxvcHBlcnMKUGx1Z2luOiBhdXRvY29udHJvbApFeHBpcmVzOiAyMDEyLTA0LTAxCktleTogNjI5N2MxMzEwYzg2NDZiZTE5MDU1MWE4ZmZmYzk1OTBmYzEyYTIyMgo=</td> + </tr> + <tr> + <td>click</td> + <td>id=submit_settings</td> + <td></td> + </tr> + <tr> + <td>waitForText</td> + <td>block_typed.license.secured</td> + <td>*autocontrol*</td> + </tr> + <tr> + <td>assertText</td> + <td>block_typed.license.secured</td> + <td>*Developpers*</td> + </tr> + <tr> + <td>assertText</td> + <td>block_typed.license.secured</td> + <td>*2012*</td> + </tr> + </tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/administration/ServerTest/settings/display-untyped-license.html b/it/it-tests/src/test/resources/administration/ServerTest/settings/display-untyped-license.html new file mode 100644 index 00000000000..b824efb36cd --- /dev/null +++ b/it/it-tests/src/test/resources/administration/ServerTest/settings/display-untyped-license.html @@ -0,0 +1,64 @@ +<?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>display-untyped-license</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> + <tbody> + <tr> + <td>open</td> + <td>/sonar/sessions/logout</td> + <td></td> + </tr> + <tr> + <td>open</td> + <td>/sonar/settings?category=general</td> + <td></td> + </tr> + <tr> + <td>type</td> + <td>id=login</td> + <td>admin</td> + </tr> + <tr> + <td>type</td> + <td>id=password</td> + <td>admin</td> + </tr> + <tr> + <td>clickAndWait</td> + <td>name=commit</td> + <td></td> + </tr> + <tr> + <td>type</td> + <td>id=input_untyped.license.secured</td> + <td>TmFtZTogRGV2ZWxvcHBlcnMKUGx1Z2luOiBhdXRvY29udHJvbApFeHBpcmVzOiAyMDEyLTA0LTAxCktleTogNjI5N2MxMzEwYzg2NDZiZTE5MDU1MWE4ZmZmYzk1OTBmYzEyYTIyMgo=</td> + </tr> + <tr> + <td>click</td> + <td>submit_settings</td> + <td></td> + </tr> + <tr> + <td>waitForText</td> + <td>block_untyped.license.secured</td> + <td>*autocontrol*</td> + </tr> + <tr> + <td>assertText</td> + <td>block_untyped.license.secured</td> + <td>*Developpers*</td> + </tr> + <tr> + <td>assertText</td> + <td>block_untyped.license.secured</td> + <td>*2012*</td> + </tr> + </tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/administration/ServerTest/settings/encrypt-text.html b/it/it-tests/src/test/resources/administration/ServerTest/settings/encrypt-text.html new file mode 100644 index 00000000000..521edc1e4de --- /dev/null +++ b/it/it-tests/src/test/resources/administration/ServerTest/settings/encrypt-text.html @@ -0,0 +1,65 @@ +<?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>encrypt-text</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> + <tbody> + <tr> + <td>open</td> + <td>/sonar/sessions/logout</td> + <td></td> + </tr> + <tr> + <td>open</td> + <td>/sonar/settings?category=security&subcategory=encryption</td> + <td></td> + </tr> + <tr> + <td>type</td> + <td>id=login</td> + <td>admin</td> + </tr> + <tr> + <td>type</td> + <td>id=password</td> + <td>admin</td> + </tr> + <tr> + <td>clickAndWait</td> + <td>name=commit</td> + <td></td> + </tr> + <tr> + <td>selectFrame</td> + <td>settings_iframe</td> + <td></td> + </tr> + <tr> + <td>type</td> + <td>id=clear_text</td> + <td>clear</td> + </tr> + <tr> + <td>click</td> + <td>id=submit_encrypt</td> + <td></td> + </tr> + <tr> + <td>waitForVisible</td> + <td>encrypted_text</td> + <td></td> + </tr> + <tr> + <td>assertValue</td> + <td>encrypted_text</td> + <td>{aes}4aQbfYe1lrEjiRzv/ETbyg==</td> + </tr> + + </tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/administration/ServerTest/settings/general-settings.html b/it/it-tests/src/test/resources/administration/ServerTest/settings/general-settings.html new file mode 100644 index 00000000000..e8b6a5554df --- /dev/null +++ b/it/it-tests/src/test/resources/administration/ServerTest/settings/general-settings.html @@ -0,0 +1,54 @@ +<?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>settings_on_core_plugins</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> + <thead> + <tr> + <td rowspan="1" colspan="3">settings_on_core_plugins</td> + </tr> + </thead> + <tbody> + <tr> + <td>open</td> + <td>/sonar/sessions/logout</td> + <td></td> +</tr> +<tr> + <td>open</td> + <td>/sonar/sessions/new</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>login</td> + <td>admin</td> +</tr> +<tr> + <td>type</td> + <td>password</td> + <td>admin</td> +</tr> +<tr> + <td>clickAndWait</td> + <td>commit</td> + <td></td> +</tr> +<tr> + <td>open</td> + <td>/sonar/settings/index</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>plugins</td> + <td>*General*</td> +</tr> +</tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/administration/ServerTest/settings/generate-secret-key.html b/it/it-tests/src/test/resources/administration/ServerTest/settings/generate-secret-key.html new file mode 100644 index 00000000000..61128b0ec5f --- /dev/null +++ b/it/it-tests/src/test/resources/administration/ServerTest/settings/generate-secret-key.html @@ -0,0 +1,59 @@ +<?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>generate-secret-key</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> + <tbody> + <tr> + <td>open</td> + <td>/sonar/sessions/logout</td> + <td></td> + </tr> + <tr> + <td>open</td> + <td>/sonar/settings?category=security&subcategory=encryption</td> + <td></td> + </tr> + <tr> + <td>type</td> + <td>id=login</td> + <td>admin</td> + </tr> + <tr> + <td>type</td> + <td>id=password</td> + <td>admin</td> + </tr> + <tr> + <td>clickAndWait</td> + <td>name=commit</td> + <td></td> + </tr> + <tr> + <td>selectFrame</td> + <td>settings_iframe</td> + <td></td> + </tr> + <tr> + <td>clickAndWait</td> + <td>link=secret key can be changed</td> + <td></td> + </tr> + <tr> + <td>click</td> + <td>submit_generate_secret</td> + <td></td> + </tr> + <tr> + <td>waitForVisible</td> + <td>secret</td> + <td></td> + </tr> + </tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/administration/user-notif-settings/register_to_new_violations_on_project.html b/it/it-tests/src/test/resources/administration/ServerTest/settings/global-extension-property.html index 207a3dcb619..a96d9ccdc13 100644 --- a/it/it-tests/src/test/resources/administration/user-notif-settings/register_to_new_violations_on_project.html +++ b/it/it-tests/src/test/resources/administration/ServerTest/settings/global-extension-property.html @@ -3,10 +3,15 @@ <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>register_to_new_violations_on_project</title> + <title>global-extension-property</title> </head> <body> <table cellpadding="1" cellspacing="1" border="1"> + <thead> + <tr> + <td rowspan="1" colspan="3">global-extension-property</td> + </tr> + </thead> <tbody> <tr> <td>open</td> @@ -16,43 +21,30 @@ <tr> <td>type</td> <td>login</td> - <td>tester</td> + <td>admin</td> </tr> <tr> <td>type</td> <td>password</td> - <td>tester</td> + <td>admin</td> </tr> <tr> <td>clickAndWait</td> <td>commit</td> <td></td> </tr> + <tr> <td>open</td> - <td>/sonar/account/index</td> - <td></td> - </tr> - <tr> - <td>waitForElementPresent</td> - <td>new_project</td> - <td></td> - </tr> - <tr> - <td>typeAndWait</td> - <td>new_project</td> - <td>com.sonarsource.it.projects.rule:notification-for-new-violations</td> - </tr> - <tr> - <td>clickAndWait</td> - <td>//input[@value='Save changes']</td> + <td>/sonar/settings?category=Settings</td> <td></td> </tr> <tr> - <td>assertText</td> - <td>notif_form</td> - <td>*New violations*notification-for-new-violations*Email*</td> + <td>assertNotText</td> + <td>plugins</td> + <td>glob:*Hidden*</td> </tr> + </tbody> </table> </body> diff --git a/it/it-tests/src/test/resources/administration/ServerTest/settings/hidden-extension-property.html b/it/it-tests/src/test/resources/administration/ServerTest/settings/hidden-extension-property.html new file mode 100644 index 00000000000..b1ccfb97130 --- /dev/null +++ b/it/it-tests/src/test/resources/administration/ServerTest/settings/hidden-extension-property.html @@ -0,0 +1,51 @@ +<?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>hidden-extension-property</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> + <thead> + <tr> + <td rowspan="1" colspan="3">hidden-extension-property</td> + </tr> + </thead> + <tbody> + <tr> + <td>open</td> + <td>/sonar/sessions/new</td> + <td></td> + </tr> + <tr> + <td>type</td> + <td>login</td> + <td>admin</td> + </tr> + <tr> + <td>type</td> + <td>password</td> + <td>admin</td> + </tr> + <tr> + <td>clickAndWait</td> + <td>commit</td> + <td></td> + </tr> + + <tr> + <td>open</td> + <td>/sonar/settings?category=Settings</td> + <td></td> + </tr> + <tr> + <td>assertNotText</td> + <td>plugins</td> + <td>glob:*Hidden*</td> + </tr> + + </tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/administration/ServerTest/settings/hide-passwords.html b/it/it-tests/src/test/resources/administration/ServerTest/settings/hide-passwords.html new file mode 100644 index 00000000000..68db3b6a6f7 --- /dev/null +++ b/it/it-tests/src/test/resources/administration/ServerTest/settings/hide-passwords.html @@ -0,0 +1,49 @@ +<?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>hide-passwords</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> + <tbody> + <tr> + <td>open</td> + <td>/sonar/sessions/logout</td> + <td></td> + </tr> + <tr> + <td>open</td> + <td>/sonar/settings?category=Settings</td> + <td></td> + </tr> + <tr> + <td>type</td> + <td>id=login</td> + <td>admin</td> + </tr> + <tr> + <td>type</td> + <td>id=password</td> + <td>admin</td> + </tr> + <tr> + <td>clickAndWait</td> + <td>name=commit</td> + <td></td> + </tr> + <tr> + <td>assertText</td> + <td>block_password</td> + <td>*Default*</td> + </tr> + <tr> + <td>assertNotText</td> + <td>block_password</td> + <td>*Default*sonar*</td> + </tr> + </tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/administration/ServerTest/settings/ignore-corrupted-license.html b/it/it-tests/src/test/resources/administration/ServerTest/settings/ignore-corrupted-license.html new file mode 100644 index 00000000000..54c71066f48 --- /dev/null +++ b/it/it-tests/src/test/resources/administration/ServerTest/settings/ignore-corrupted-license.html @@ -0,0 +1,54 @@ +<?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>ignore-corrupted-license</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> + <tbody> + <tr> + <td>open</td> + <td>/sonar/sessions/logout</td> + <td></td> + </tr> + <tr> + <td>open</td> + <td>/sonar/settings?category=general</td> + <td></td> + </tr> + <tr> + <td>type</td> + <td>id=login</td> + <td>admin</td> + </tr> + <tr> + <td>type</td> + <td>id=password</td> + <td>admin</td> + </tr> + <tr> + <td>clickAndWait</td> + <td>name=commit</td> + <td></td> + </tr> + <tr> + <td>type</td> + <td>id=input_typed.license.secured</td> + <td>ABCDE</td> + </tr> + <tr> + <td>click</td> + <td>id=submit_settings</td> + <td></td> + </tr> + <tr> + <td>waitForText</td> + <td>block_typed.license.secured</td> + <td>*Product*-*Organization*-*Expiration*-*</td> + </tr> + </tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/administration/profile-admin/create-user.html b/it/it-tests/src/test/resources/administration/ServerTest/settings/property_relocation.html index ee78c448d00..dd35bb04664 100644 --- a/it/it-tests/src/test/resources/administration/profile-admin/create-user.html +++ b/it/it-tests/src/test/resources/administration/ServerTest/settings/property_relocation.html @@ -3,7 +3,7 @@ <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>create-user</title> + <title>property-relocation</title> </head> <body> <table cellpadding="1" cellspacing="1" border="1"> @@ -15,7 +15,7 @@ </tr> <tr> <td>open</td> - <td>/sonar/users</td> + <td>/sonar/settings/index?category=general</td> <td></td> </tr> <tr> @@ -34,49 +34,14 @@ <td></td> </tr> <tr> - <td>click</td> - <td>id=create-link-user</td> - <td></td> -</tr> -<tr> - <td>waitForVisible</td> - <td>user_create_form</td> - <td></td> -</tr> -<tr> - <td>type</td> - <td>id=user_login</td> - <td>user</td> -</tr> -<tr> - <td>type</td> - <td>id=user_name</td> - <td>Simple User</td> -</tr> -<tr> - <td>type</td> - <td>id=user_password</td> - <td>userpwd</td> -</tr> -<tr> - <td>type</td> - <td>id=user_password_confirmation</td> - <td>userpwd</td> -</tr> -<tr> - <td>click</td> - <td>name=commit</td> - <td></td> -</tr> -<tr> - <td>waitForVisible</td> - <td>info</td> - <td></td> + <td>assertText</td> + <td>properties</td> + <td>*sonar.newKey*</td> </tr> <tr> - <td>assertText</td> - <td>info</td> - <td>*User is created*</td> + <td>assertNotText</td> + <td>properties</td> + <td>*sonar.deprecatedKey*</td> </tr> </tbody> </table> diff --git a/it/it-tests/src/test/resources/administration/ServerTest/settings/validate-property-type.html b/it/it-tests/src/test/resources/administration/ServerTest/settings/validate-property-type.html new file mode 100644 index 00000000000..6ed955d1ea6 --- /dev/null +++ b/it/it-tests/src/test/resources/administration/ServerTest/settings/validate-property-type.html @@ -0,0 +1,74 @@ +<?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>validate-property-type</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> + <tbody> + <tr> + <td>open</td> + <td>/sonar/sessions/logout</td> + <td></td> + </tr> + <tr> + <td>open</td> + <td>/sonar/settings?category=Settings</td> + <td></td> + </tr> + <tr> + <td>type</td> + <td>id=login</td> + <td>admin</td> + </tr> + <tr> + <td>type</td> + <td>id=password</td> + <td>admin</td> + </tr> + <tr> + <td>clickAndWait</td> + <td>name=commit</td> + <td></td> + </tr> + <tr> + <td>type</td> + <td>id=input_float</td> + <td>abc</td> + </tr> + <tr> + <td>type</td> + <td>id=input_integer</td> + <td>123</td> + </tr> + <tr> + <td>click</td> + <td>id=submit_settings</td> + <td></td> + </tr> + <tr> + <td>waitForText</td> + <td>properties</td> + <td>*Not a floating point number*</td> + </tr> + <tr> + <td>assertValue</td> + <td>input_integer</td> + <td>123</td> + </tr> + <tr> + <td>open</td> + <td>/sonar/settings?category=Settings</td> + <td></td> + </tr> + <tr> + <td>assertValue</td> + <td>input_float</td> + <td></td> + </tr> + </tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/administration/ServerTest/sonar-secret.txt b/it/it-tests/src/test/resources/administration/ServerTest/sonar-secret.txt new file mode 100644 index 00000000000..65b98c522da --- /dev/null +++ b/it/it-tests/src/test/resources/administration/ServerTest/sonar-secret.txt @@ -0,0 +1 @@ +0PZz+G+f8mjr3sPn4+AhHg==
\ No newline at end of file diff --git a/it/it-tests/src/test/resources/administration/ServerTest/url_ending_by_jsp.html b/it/it-tests/src/test/resources/administration/ServerTest/url_ending_by_jsp.html new file mode 100644 index 00000000000..194ed4bd07b --- /dev/null +++ b/it/it-tests/src/test/resources/administration/ServerTest/url_ending_by_jsp.html @@ -0,0 +1,22 @@ +<?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"/> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> + <tbody> + <tr> + <td>open</td> + <td>/sonar/dashboard/index/myproject.jsp</td> + <td></td> + </tr> + <tr> + <td>assertElementPresent</td> + <td>dashboard</td> + <td></td> + </tr> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/administration/profile-admin/create-profile-administrator.html b/it/it-tests/src/test/resources/administration/profile-admin/create-profile-administrator.html deleted file mode 100644 index 81317f9c20f..00000000000 --- a/it/it-tests/src/test/resources/administration/profile-admin/create-profile-administrator.html +++ /dev/null @@ -1,124 +0,0 @@ -<?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>create-user</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> - <tbody> - <tr> - <td>open</td> - <td>/sonar/sessions/logout</td> - <td></td> - </tr> - <tr> - <td>open</td> - <td>/sonar/users</td> - <td></td> - </tr> - <tr> - <td>type</td> - <td>id=login</td> - <td>admin</td> - </tr> - <tr> - <td>type</td> - <td>id=password</td> - <td>admin</td> - </tr> - <tr> - <td>clickAndWait</td> - <td>name=commit</td> - <td></td> - </tr> - <tr> - <td>type</td> - <td>id=user_login</td> - <td>profileadm</td> - </tr> - <tr> - <td>type</td> - <td>id=user_name</td> - <td>Profile Admin</td> - </tr> - <tr> - <td>type</td> - <td>id=user_password</td> - <td>papwd</td> - </tr> - <tr> - <td>type</td> - <td>id=user_password_confirmation</td> - <td>papwd</td> - </tr> - <tr> - <td>clickAndWait</td> - <td>name=commit</td> - <td></td> - </tr> - <tr> - <td>clickAndWait</td> - <td>link=Groups</td> - <td></td> - </tr> - <tr> - <td>type</td> - <td>id=group_name</td> - <td>profile-admins</td> - </tr> - <tr> - <td>clickAndWait</td> - <td>name=commit</td> - <td></td> - </tr> - <tr> - <td>clickAndWait</td> - <td>id=select-profile-admins</td> - <td></td> - </tr> - <tr> - <td>addSelection</td> - <td>id=from</td> - <td>label=Profile Admin</td> - </tr> - <tr> - <td>click</td> - <td>id=select_right</td> - <td></td> - </tr> - <tr> - <td>clickAndWait</td> - <td>id=save</td> - <td></td> - </tr> - <tr> - <td>clickAndWait</td> - <td>link=Administrators</td> - <td></td> - </tr> - <tr> - <td>clickAndWait</td> - <td>xpath=(//a[contains(text(),'select')])[4]</td> - <td></td> - </tr> - <tr> - <td>addSelection</td> - <td>id=from</td> - <td>label=profile-admins</td> - </tr> - <tr> - <td>click</td> - <td>id=select_right</td> - <td></td> - </tr> - <tr> - <td>clickAndWait</td> - <td>id=save</td> - <td></td> - </tr> - </tbody> -</table> -</body> -</html> diff --git a/it/it-tests/src/test/resources/administration/project-bulk-deletion/bulk-delete-filter-projects.html b/it/it-tests/src/test/resources/administration/suite/BulkDeletionTest/project-bulk-deletion/bulk-delete-filter-projects.html index 8ff4b7089c2..8ff4b7089c2 100644 --- a/it/it-tests/src/test/resources/administration/project-bulk-deletion/bulk-delete-filter-projects.html +++ b/it/it-tests/src/test/resources/administration/suite/BulkDeletionTest/project-bulk-deletion/bulk-delete-filter-projects.html diff --git a/it/it-tests/src/test/resources/administration/project-bulk-deletion/bulk-delete-selected-projects.html b/it/it-tests/src/test/resources/administration/suite/BulkDeletionTest/project-bulk-deletion/bulk-delete-selected-projects.html index 7662c60c5de..7662c60c5de 100644 --- a/it/it-tests/src/test/resources/administration/project-bulk-deletion/bulk-delete-selected-projects.html +++ b/it/it-tests/src/test/resources/administration/suite/BulkDeletionTest/project-bulk-deletion/bulk-delete-selected-projects.html diff --git a/it/it-tests/src/test/resources/administration/project-bulk-deletion/display-two-letters-long-project.html b/it/it-tests/src/test/resources/administration/suite/BulkDeletionTest/project-bulk-deletion/display-two-letters-long-project.html index 3f0095f07b9..3f0095f07b9 100644 --- a/it/it-tests/src/test/resources/administration/project-bulk-deletion/display-two-letters-long-project.html +++ b/it/it-tests/src/test/resources/administration/suite/BulkDeletionTest/project-bulk-deletion/display-two-letters-long-project.html diff --git a/it/it-tests/src/test/resources/administration/project-bulk-deletion/filter-two-letters-long-project.html b/it/it-tests/src/test/resources/administration/suite/BulkDeletionTest/project-bulk-deletion/filter-two-letters-long-project.html index 17e6732e271..17e6732e271 100644 --- a/it/it-tests/src/test/resources/administration/project-bulk-deletion/filter-two-letters-long-project.html +++ b/it/it-tests/src/test/resources/administration/suite/BulkDeletionTest/project-bulk-deletion/filter-two-letters-long-project.html diff --git a/it/it-tests/src/test/resources/administration/anonymous_should_have_user_role_to_access_project/remove_user_role.html b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/anonymous_should_have_user_role_to_access_project/remove_user_role.html index 4e45f9901d0..4e45f9901d0 100644 --- a/it/it-tests/src/test/resources/administration/anonymous_should_have_user_role_to_access_project/remove_user_role.html +++ b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/anonymous_should_have_user_role_to_access_project/remove_user_role.html diff --git a/it/it-tests/src/test/resources/administration/display-alerts-history-page/should-display-alerts-correctly-history-page.html b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/display-alerts-history-page/should-display-alerts-correctly-history-page.html index 1845a5a031d..1845a5a031d 100644 --- a/it/it-tests/src/test/resources/administration/display-alerts-history-page/should-display-alerts-correctly-history-page.html +++ b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/display-alerts-history-page/should-display-alerts-correctly-history-page.html diff --git a/it/it-tests/src/test/resources/administration/display-alerts/should-display-period-alerts-correctly.html b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/display-alerts/should-display-period-alerts-correctly.html index 9c4db5c8779..9c4db5c8779 100644 --- a/it/it-tests/src/test/resources/administration/display-alerts/should-display-period-alerts-correctly.html +++ b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/display-alerts/should-display-period-alerts-correctly.html diff --git a/it/it-tests/src/test/resources/administration/module-settings/display-module-settings.html b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/module-settings/display-module-settings.html index f9137271bca..f9137271bca 100644 --- a/it/it-tests/src/test/resources/administration/module-settings/display-module-settings.html +++ b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/module-settings/display-module-settings.html diff --git a/it/it-tests/src/test/resources/administration/project-administration/multimodule-project-delete-version.html b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/project-administration/multimodule-project-delete-version.html index 2c1a2f0ed60..2c1a2f0ed60 100644 --- a/it/it-tests/src/test/resources/administration/project-administration/multimodule-project-delete-version.html +++ b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/project-administration/multimodule-project-delete-version.html diff --git a/it/it-tests/src/test/resources/administration/project-administration/multimodule-project-modify-version.html b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/project-administration/multimodule-project-modify-version.html index aa3fb40c3c8..aa3fb40c3c8 100644 --- a/it/it-tests/src/test/resources/administration/project-administration/multimodule-project-modify-version.html +++ b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/project-administration/multimodule-project-modify-version.html diff --git a/it/it-tests/src/test/resources/administration/project-deletion/project-deletion.html b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/project-deletion/project-deletion.html index 9de248da681..9de248da681 100644 --- a/it/it-tests/src/test/resources/administration/project-deletion/project-deletion.html +++ b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/project-deletion/project-deletion.html diff --git a/it/it-tests/src/test/resources/administration/project-settings/only-on-project-settings.html b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/project-settings/only-on-project-settings.html index f90a77b2037..f90a77b2037 100644 --- a/it/it-tests/src/test/resources/administration/project-settings/only-on-project-settings.html +++ b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/project-settings/only-on-project-settings.html diff --git a/it/it-tests/src/test/resources/administration/project-settings/override-global-settings.html b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/project-settings/override-global-settings.html index db0eab19545..db0eab19545 100644 --- a/it/it-tests/src/test/resources/administration/project-settings/override-global-settings.html +++ b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/project-settings/override-global-settings.html diff --git a/it/it-tests/src/test/resources/administration/project-update-keys/bulk-update-impossible-because-duplicate-keys.html b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/project-update-keys/bulk-update-impossible-because-duplicate-keys.html index 7e3f7a63ec2..7e3f7a63ec2 100644 --- a/it/it-tests/src/test/resources/administration/project-update-keys/bulk-update-impossible-because-duplicate-keys.html +++ b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/project-update-keys/bulk-update-impossible-because-duplicate-keys.html diff --git a/it/it-tests/src/test/resources/administration/project-update-keys/bulk-update-impossible-because-no-input.html b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/project-update-keys/bulk-update-impossible-because-no-input.html index 3f925bc2226..3f925bc2226 100644 --- a/it/it-tests/src/test/resources/administration/project-update-keys/bulk-update-impossible-because-no-input.html +++ b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/project-update-keys/bulk-update-impossible-because-no-input.html diff --git a/it/it-tests/src/test/resources/administration/project-update-keys/bulk-update-impossible-because-no-match.html b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/project-update-keys/bulk-update-impossible-because-no-match.html index 7bd340476d7..7bd340476d7 100644 --- a/it/it-tests/src/test/resources/administration/project-update-keys/bulk-update-impossible-because-no-match.html +++ b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/project-update-keys/bulk-update-impossible-because-no-match.html diff --git a/it/it-tests/src/test/resources/administration/project-update-keys/bulk-update-success.html b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/project-update-keys/bulk-update-success.html index 1a778ecf599..1a778ecf599 100644 --- a/it/it-tests/src/test/resources/administration/project-update-keys/bulk-update-success.html +++ b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/project-update-keys/bulk-update-success.html diff --git a/it/it-tests/src/test/resources/administration/project-update-keys/fine-grained-update-impossible.html b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/project-update-keys/fine-grained-update-impossible.html index c4191f938b9..c4191f938b9 100644 --- a/it/it-tests/src/test/resources/administration/project-update-keys/fine-grained-update-impossible.html +++ b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/project-update-keys/fine-grained-update-impossible.html diff --git a/it/it-tests/src/test/resources/administration/project-update-keys/fine-grained-update-success.html b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/project-update-keys/fine-grained-update-success.html index aaa1d9929f3..aaa1d9929f3 100644 --- a/it/it-tests/src/test/resources/administration/project-update-keys/fine-grained-update-success.html +++ b/it/it-tests/src/test/resources/administration/suite/ProjectAdministrationTest/project-update-keys/fine-grained-update-success.html diff --git a/it/it-tests/src/test/resources/administration/auto-generated/create.html b/it/it-tests/src/test/resources/administration/suite/PropertySetsTest/auto-generated/create.html index e562216ca56..e562216ca56 100644 --- a/it/it-tests/src/test/resources/administration/auto-generated/create.html +++ b/it/it-tests/src/test/resources/administration/suite/PropertySetsTest/auto-generated/create.html diff --git a/it/it-tests/src/test/resources/administration/auto-generated/update.html b/it/it-tests/src/test/resources/administration/suite/PropertySetsTest/auto-generated/update.html index 0cc6d84f611..0cc6d84f611 100644 --- a/it/it-tests/src/test/resources/administration/auto-generated/update.html +++ b/it/it-tests/src/test/resources/administration/suite/PropertySetsTest/auto-generated/update.html diff --git a/it/it-tests/src/test/resources/administration/property-sets/all_types.html b/it/it-tests/src/test/resources/administration/suite/PropertySetsTest/property-sets/all_types.html index e12fac9d324..e12fac9d324 100644 --- a/it/it-tests/src/test/resources/administration/property-sets/all_types.html +++ b/it/it-tests/src/test/resources/administration/suite/PropertySetsTest/property-sets/all_types.html diff --git a/it/it-tests/src/test/resources/administration/property-sets/create.html b/it/it-tests/src/test/resources/administration/suite/PropertySetsTest/property-sets/create.html index 6722841897e..6722841897e 100644 --- a/it/it-tests/src/test/resources/administration/property-sets/create.html +++ b/it/it-tests/src/test/resources/administration/suite/PropertySetsTest/property-sets/create.html diff --git a/it/it-tests/src/test/resources/administration/property-sets/delete.html b/it/it-tests/src/test/resources/administration/suite/PropertySetsTest/property-sets/delete.html index 2e881114d98..2e881114d98 100644 --- a/it/it-tests/src/test/resources/administration/property-sets/delete.html +++ b/it/it-tests/src/test/resources/administration/suite/PropertySetsTest/property-sets/delete.html diff --git a/it/it-tests/src/test/resources/administration/property-sets/reference.html b/it/it-tests/src/test/resources/administration/suite/PropertySetsTest/property-sets/reference.html index 0792bc556f9..0792bc556f9 100644 --- a/it/it-tests/src/test/resources/administration/property-sets/reference.html +++ b/it/it-tests/src/test/resources/administration/suite/PropertySetsTest/property-sets/reference.html diff --git a/it/it-tests/src/test/resources/administration/user-notif-settings/create_user_with_email.html b/it/it-tests/src/test/resources/administration/suite/ServerAdministrationTest/server-administration/system_info.html index d969dbe9274..8239c6e124a 100644 --- a/it/it-tests/src/test/resources/administration/user-notif-settings/create_user_with_email.html +++ b/it/it-tests/src/test/resources/administration/suite/ServerAdministrationTest/server-administration/system_info.html @@ -3,18 +3,23 @@ <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>create_user_with_email</title> + <title>system_info</title> </head> <body> <table cellpadding="1" cellspacing="1" border="1"> <thead> <tr> - <td rowspan="1" colspan="3">create_user_with_email</td> + <td rowspan="1" colspan="3">system_info</td> </tr> </thead> <tbody> <tr> <td>open</td> + <td>/sonar/sessions/logout</td> + <td></td> +</tr> +<tr> + <td>open</td> <td>/sonar/sessions/new</td> <td></td> </tr> @@ -35,48 +40,28 @@ </tr> <tr> <td>open</td> - <td>/sonar/users</td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>id=create-link-user</td> + <td>/sonar/system/index</td> <td></td> </tr> <tr> - <td>waitForVisible</td> - <td>user_create_form</td> - <td></td> -</tr> -<tr> - <td>type</td> - <td>user_login</td> - <td>tester</td> -</tr> -<tr> - <td>type</td> - <td>user_name</td> - <td>Tester</td> + <td>assertText</td> + <td>sonarqube</td> + <td>*Version*.*-SNAPSHOT*</td> </tr> <tr> - <td>type</td> - <td>user_email</td> - <td>tester@example.org</td> -</tr> -<tr> - <td>type</td> - <td>user_password</td> - <td>tester</td> -</tr> -<tr> - <td>type</td> - <td>user_password_confirmation</td> - <td>tester</td> + <td>assertText</td> + <td>database</td> + <td>*Database Version*Pool Active Connections*</td> </tr> + <tr> + <td>assertText</td> + <td>system</td> + <td>*Start Time*Processors*</td> + </tr> <tr> - <td>clickAndWait</td> - <td>commit</td> - <td></td> + <td>assertText</td> + <td>jvmproperties</td> + <td>*java.class.path*java.specification.version*</td> </tr> </tbody> </table> diff --git a/it/it-tests/src/test/resources/administration/suite/ServerAdministrationTest/server_id/missing_ip.html b/it/it-tests/src/test/resources/administration/suite/ServerAdministrationTest/server_id/missing_ip.html new file mode 100644 index 00000000000..f946aaebbba --- /dev/null +++ b/it/it-tests/src/test/resources/administration/suite/ServerAdministrationTest/server_id/missing_ip.html @@ -0,0 +1,84 @@ +<?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>missing_ip</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> + <thead> + <tr> + <td rowspan="1" colspan="3">missing_ip</td> + </tr> + </thead> + <tbody> + <tr> + <td>open</td> + <td>/sonar/sessions/new</td> + <td></td> + </tr> + <tr> + <td>type</td> + <td>login</td> + <td>admin</td> + </tr> + <tr> + <td>type</td> + <td>password</td> + <td>admin</td> + </tr> + <tr> + <td>clickAndWait</td> + <td>commit</td> + <td></td> + </tr> + <tr> + <td>open</td> + <td>/sonar/settings/index</td> + <td></td> + </tr> + <tr> + <td>clickAndWait</td> + <td>link=Licenses</td> + <td></td> + </tr> + <tr> + <td>clickAndWait</td> + <td>link=Server ID</td> + <td></td> + </tr> + <tr> + <td>selectFrame</td> + <td>settings_iframe</td> + <td></td> + </tr> + <tr> + <td>type</td> + <td>name=organisation</td> + <td>DEMO</td> + </tr> + <tr> + <td>type</td> + <td>name=address</td> + <td></td> + </tr> + <tr> + <td>clickAndWait</td> + <td>generate-button</td> + <td></td> + </tr> + <tr> + <td>assertElementPresent</td> + <td>error</td> + <td></td> + </tr> + <tr> + <td>assertElementNotPresent</td> + <td>server_id</td> + <td></td> + </tr> + </tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/administration/suite/ServerAdministrationTest/server_id/organisation_must_not_accept_special_chars.html b/it/it-tests/src/test/resources/administration/suite/ServerAdministrationTest/server_id/organisation_must_not_accept_special_chars.html new file mode 100644 index 00000000000..7aaee957676 --- /dev/null +++ b/it/it-tests/src/test/resources/administration/suite/ServerAdministrationTest/server_id/organisation_must_not_accept_special_chars.html @@ -0,0 +1,89 @@ +<?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>organisation_must_not_accept_special_chars</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> + <tbody> + <tr> + <td>open</td> + <td>/sonar/sessions/new</td> + <td></td> + </tr> + <tr> + <td>type</td> + <td>login</td> + <td>admin</td> + </tr> + <tr> + <td>type</td> + <td>password</td> + <td>admin</td> + </tr> + <tr> + <td>clickAndWait</td> + <td>commit</td> + <td></td> + </tr> + <tr> + <td>open</td> + <td>/sonar/settings/index</td> + <td></td> + </tr> + <tr> + <td>clickAndWait</td> + <td>link=Licenses</td> + <td></td> + </tr> + <tr> + <td>clickAndWait</td> + <td>link=Server ID</td> + <td></td> + </tr> + <tr> + <td>selectFrame</td> + <td>settings_iframe</td> + <td></td> + </tr> + <tr> + <td>storeText</td> + <td>address_0</td> + <td>valid_ip</td> + </tr> + <tr> + <td>type</td> + <td>name=organisation</td> + <td>Name with invalid chars like $</td> + </tr> + <tr> + <td>type</td> + <td>name=address</td> + <td>${valid_ip}</td> + </tr> + <tr> + <td>clickAndWait</td> + <td>generate-button</td> + <td></td> + </tr> + <tr> + <td>assertElementPresent</td> + <td>error</td> + <td></td> + </tr> + <tr> + <td>assertText</td> + <td>error</td> + <td>*Organisation does not match the required pattern.*</td> + </tr> + <tr> + <td>assertElementNotPresent</td> + <td>server_id</td> + <td></td> + </tr> + </tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/administration/suite/ServerAdministrationTest/server_id/valid_id.html b/it/it-tests/src/test/resources/administration/suite/ServerAdministrationTest/server_id/valid_id.html new file mode 100644 index 00000000000..3c987a451de --- /dev/null +++ b/it/it-tests/src/test/resources/administration/suite/ServerAdministrationTest/server_id/valid_id.html @@ -0,0 +1,109 @@ +<?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>valid_id</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> + <thead> + <tr> + <td rowspan="1" colspan="3">valid_id</td> + </tr> + </thead> + <tbody> + <tr> + <td>open</td> + <td>/sonar/sessions/new</td> + <td></td> + </tr> + <tr> + <td>type</td> + <td>login</td> + <td>admin</td> + </tr> + <tr> + <td>type</td> + <td>password</td> + <td>admin</td> + </tr> + <tr> + <td>clickAndWait</td> + <td>commit</td> + <td></td> + </tr> + <tr> + <td>open</td> + <td>/sonar/settings/index</td> + <td></td> + </tr> + <tr> + <td>clickAndWait</td> + <td>link=Licenses</td> + <td></td> + </tr> + <tr> + <td>clickAndWait</td> + <td>link=Server ID</td> + <td></td> + </tr> + <tr> + <td>waitForElementPresent</td> + <td>settings_iframe</td> + <td></td> + </tr> + <tr> + <td>selectFrame</td> + <td>settings_iframe</td> + <td></td> + </tr> + <tr> + <td>storeText</td> + <td>address_0</td> + <td>valid_ip</td> + </tr> + <tr> + <td>type</td> + <td>name=organisation</td> + <td>DEMO</td> + </tr> + <tr> + <td>type</td> + <td>name=address</td> + <td>${valid_ip}</td> + </tr> + <tr> + <td>clickAndWait</td> + <td>generate-button</td> + <td></td> + </tr> + <tr> + <td>assertElementPresent</td> + <td>server_id</td> + <td></td> + </tr> + <tr> + <td>storeText</td> + <td>server_id</td> + <td>server_id</td> + </tr> + <tr> + <td>selectFrame</td> + <td>relative=parent</td> + <td></td> + </tr> + <tr> + <td>open</td> + <td>/sonar/system</td> + <td></td> + </tr> + <tr> + <td>assertText</td> + <td>sonarqube</td> + <td>glob:*Server ID*${server_id}*</td> + </tr> + </tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/administration/subcategories/global-subcategories-no-default.html b/it/it-tests/src/test/resources/administration/suite/SubCategoriesTest/subcategories/global-subcategories-no-default.html index f6b410b562c..f6b410b562c 100644 --- a/it/it-tests/src/test/resources/administration/subcategories/global-subcategories-no-default.html +++ b/it/it-tests/src/test/resources/administration/suite/SubCategoriesTest/subcategories/global-subcategories-no-default.html diff --git a/it/it-tests/src/test/resources/administration/subcategories/global-subcategories.html b/it/it-tests/src/test/resources/administration/suite/SubCategoriesTest/subcategories/global-subcategories.html index 6f9896fa32f..6f9896fa32f 100644 --- a/it/it-tests/src/test/resources/administration/subcategories/global-subcategories.html +++ b/it/it-tests/src/test/resources/administration/suite/SubCategoriesTest/subcategories/global-subcategories.html diff --git a/it/it-tests/src/test/resources/administration/subcategories/project-subcategories-no-default.html b/it/it-tests/src/test/resources/administration/suite/SubCategoriesTest/subcategories/project-subcategories-no-default.html index 875e7fc7657..875e7fc7657 100644 --- a/it/it-tests/src/test/resources/administration/subcategories/project-subcategories-no-default.html +++ b/it/it-tests/src/test/resources/administration/suite/SubCategoriesTest/subcategories/project-subcategories-no-default.html diff --git a/it/it-tests/src/test/resources/administration/subcategories/project-subcategories.html b/it/it-tests/src/test/resources/administration/suite/SubCategoriesTest/subcategories/project-subcategories.html index e3284d63f16..e3284d63f16 100644 --- a/it/it-tests/src/test/resources/administration/subcategories/project-subcategories.html +++ b/it/it-tests/src/test/resources/administration/suite/SubCategoriesTest/subcategories/project-subcategories.html diff --git a/it/it-tests/src/test/resources/qualitygate/notifications/activate_notification_channels.html b/it/it-tests/src/test/resources/qualitygate/notifications/activate_notification_channels.html index 8e0bce0bf8e..ce8cfc27691 100644 --- a/it/it-tests/src/test/resources/qualitygate/notifications/activate_notification_channels.html +++ b/it/it-tests/src/test/resources/qualitygate/notifications/activate_notification_channels.html @@ -3,7 +3,7 @@ <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>create_user_with_email</title> + <title>reate_user_with_email</title> </head> <body> <table cellpadding="1" cellspacing="1" border="1"> |