- JOB=POSTGRES
- JOB=MYSQL
- JOB=WEB
- - JOB=ITS IT_CATEGORY=batch
- - JOB=ITS IT_CATEGORY=plugins
- - JOB=ITS IT_CATEGORY=issue_analysis
- - JOB=ITS IT_CATEGORY=administration_qualitygate
- - JOB=ITS IT_CATEGORY=server_updatecenter
+ - JOB=ITS IT_CATEGORY=Category1
+ - JOB=ITS IT_CATEGORY=Category2
+ - JOB=ITS IT_CATEGORY=Category3
+ - JOB=ITS IT_CATEGORY=Category4
+ - JOB=ITS IT_CATEGORY=Plugins
- JOB=PRANALYSIS
matrix:
--- /dev/null
+sonar.projectKey=case-sensitive-file-extensions
+sonar.projectName=Case Sensitive
+sonar.projectVersion=1.0-SNAPSHOT
+sonar.sources=src
+sonar.language=xoo
--- /dev/null
+File extension is upper case.
+It should not be ignored since SQ 4.0.
--- /dev/null
+public class Sample {
+
+ public Sample(int i) {
+ int j = i++;
+ }
+
+ private String myMethod() {
+ return "hello";
+ }
+}
--- /dev/null
+sonar.projectName=Module A
+sonar.moduleKey=com.sonarsource.it.samples:moduleA
--- /dev/null
+package com.sonar.it.samples.modules.a1;
+
+public class HelloA1 {
+ private int i;
+ private HelloA1() {
+
+ }
+
+ public void hello() {
+ System.out.println("hello" + " xoo");
+ }
+
+ protected String getHello() {
+ return "hello";
+ }
+}
\ No newline at end of file
--- /dev/null
+ncloc:12
+classes:1
--- /dev/null
+sonar.projectName=Module B
+sonar.moduleKey=com.sonarsource.it.samples:moduleB
--- /dev/null
+package com.sonar.it.samples.modules.a2;
+
+public class HelloA2 {
+ private int i;
+ private HelloA2() {
+
+ }
+
+ public void hello() {
+ System.out.println("hello" + " xoo");
+ }
+}
\ No newline at end of file
--- /dev/null
+ncloc:12
+classes:1
\ No newline at end of file
--- /dev/null
+# Root project information
+sonar.projectKey=com.sonarsource.it.samples:multi-modules-sample
+sonar.projectName=Sonar :: Integration Tests :: Multi-modules Sample
+sonar.projectVersion=1.0-SNAPSHOT
+
+sonar.language=xoo
+
+# Some properties that will be inherited by the modules
+sonar.sources=src/main/xoo
+
+# List of the module identifiers
+sonar.modules=module_a,module_b
--- /dev/null
+sonar.projectKey=com.sonarsource.it.projects.batch:duplicate-source
+sonar.projectName=exclusions
+sonar.projectVersion=1.0-SNAPSHOT
+sonar.sources=src/main/xoo,src/main/xoo2
+sonar.tests=src/test/xoo
+sonar.language=xoo
--- /dev/null
+package org.sonar.tests;
+
+public class ClassOne {
+
+}
--- /dev/null
+package org.sonar.tests;
+
+public class ClassOne {
+
+}
--- /dev/null
+package org.sonar.tests;
+
+public class ClassOne {
+
+}
--- /dev/null
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>module_a</artifactId>
+ <packaging>jar</packaging>
+ <name>Module A</name>
+
+ <parent>
+ <groupId>com.sonarsource.it.projects.batch</groupId>
+ <artifactId>extension-lifecycle</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+</project>
\ No newline at end of file
--- /dev/null
+public class HelloA {
+ private int i;
+ private HelloA() {
+
+ }
+
+ public void hello() {
+ System.out.println("hello" + " world");
+ }
+}
\ No newline at end of file
--- /dev/null
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>module_b</artifactId>
+ <packaging>jar</packaging>
+ <name>Module B</name>
+
+ <parent>
+ <groupId>com.sonarsource.it.projects.batch</groupId>
+ <artifactId>extension-lifecycle</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+</project>
\ No newline at end of file
--- /dev/null
+public class HelloB {
+ private int i;
+ private HelloB() {
+
+ }
+
+ public void hello() {
+ System.out.println("hello" + " world");
+ }
+}
\ No newline at end of file
--- /dev/null
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.sonarsource.it.projects.batch</groupId>
+ <artifactId>extension-lifecycle</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Sonar :: Integration Tests :: Extension Lifecycle Sample</name>
+ <modules>
+ <module>module_a</module>
+ <module>module_b</module>
+ </modules>
+</project>
\ No newline at end of file
--- /dev/null
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.sonarsource.it.samples</groupId>
+ <artifactId>simple-sample</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>Sonar :: Integration Tests :: Simple Sample</name>
+
+ <url>http://www.simplesample.org</url>
+
+ <issueManagement>
+ <system>jira</system>
+ <url>http://jira.codehaus.org/browse/SIMPLESAMPLE</url>
+ </issueManagement>
+
+ <scm>
+ <connection>scm:git:git@github.com:SonarSource/simplesample.git</connection>
+ <developerConnection>scm:git:git@github.com:SonarSource/simplesample.git</developerConnection>
+ <url>https://github.com/SonarSource/simplesample</url>
+ </scm>
+
+ <ciManagement>
+ <system>bamboo</system>
+ <url>http://bamboo.ci.codehaus.org/browse/SIMPLESAMPLE</url>
+ </ciManagement>
+
+ <properties>
+ <!-- The following property MUST override the <url> definition of the POM -->
+ <sonar.links.homepage>http://www.simplesample.org_OVERRIDDEN</sonar.links.homepage>
+ </properties>
+
+</project>
\ No newline at end of file
--- /dev/null
+sonar.projectKey=com.sonarsource.it.samples:simple-sample
+sonar.projectVersion=1.0-SNAPSHOT
+sonar.projectName=Sonar :: Integration Tests :: Simple Sample
+
+sonar.sources=src/main/java
+
+sonar.links.homepage=http://www.simplesample.org_OVERRIDDEN
+sonar.links.ci=http://bamboo.ci.codehaus.org/browse/SIMPLESAMPLE
+sonar.links.issue=http://jira.codehaus.org/browse/SIMPLESAMPLE
+sonar.links.scm=https://github.com/SonarSource/simplesample
+sonar.links.scm_dev=scm:git:git@github.com:SonarSource/simplesample.git
--- /dev/null
+package sample;
+
+public class Sample {
+
+ public Sample(int i) {
+ int j = i++;
+ }
+
+ private String myMethod() {
+ return "hello";
+ }
+}
--- /dev/null
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>com.sonarsource.it.projects.batch.multi-languages</groupId>
+ <artifactId>multi-languages</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>java-module</artifactId>
+ <name>Java Module</name>
+
+ <properties>
+ <sonar.language>java</sonar.language>
+ </properties>
+</project>
--- /dev/null
+public class HelloJava {
+ private int i;
+ private HelloJava() {
+
+ }
+
+ public void hello() {
+ System.out.println("hello" + " java");
+ }
+}
\ No newline at end of file
--- /dev/null
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>com.sonarsource.it.projects.batch.multi-languages</groupId>
+ <artifactId>multi-languages</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>javascript-module</artifactId>
+ <name>Javascript Module</name>
+
+ <properties>
+ <sonar.language>js</sonar.language>
+ </properties>
+
+ <build>
+ <sourceDirectory>src</sourceDirectory>
+ </build>
+
+</project>
\ No newline at end of file
--- /dev/null
+
+var Person = function(first, last, middle) {
+ this.first = first;
+ this.middle = middle;
+ this.last = last;
+};
+
+Person.prototype = {
+
+ whoAreYou : function() {
+ return this.first + (this.middle ? ' ' + this.middle: '') + ' ' + this.last;
+ }
+
+};
--- /dev/null
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.sonarsource.it.projects.batch.multi-languages</groupId>
+ <artifactId>multi-languages</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Multi Languages</name>
+ <description>One language per module</description>
+
+ <modules>
+ <module>java-module</module>
+ <module>javascript-module</module>
+ <module>python-module</module>
+ </modules>
+</project>
\ No newline at end of file
--- /dev/null
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>com.sonarsource.it.projects.batch.multi-languages</groupId>
+ <artifactId>multi-languages</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>python-module</artifactId>
+ <name>Python Module</name>
+
+ <properties>
+ <sonar.language>py</sonar.language>
+ </properties>
+
+ <build>
+ <sourceDirectory>src</sourceDirectory>
+ </build>
+</project>
\ No newline at end of file
--- /dev/null
+
+# fortune.py -- chooses a random fortune, as the fortune(8) program in
+# the BSD-games package does
+#
+# Copyright (c) 2010, Andrew M. Kuchling
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+import struct, random, string
+
+# C long variables are different sizes on 32-bit and 64-bit machines,
+# so we have to measure how big they are on the machine where this is running.
+LONG_SIZE = struct.calcsize('L')
+is_64_bit = (LONG_SIZE == 8)
+
+def get(filename):
+ "Select a random quotation, using a pregenerated .dat file"
+
+ # First, we open the .dat file, and read the header information.
+ # The C structure containing this info looks like:
+ ## typedef struct { /* information table */
+ ## #define VERSION 1
+ ## unsigned long str_version; /* version number */
+ ## unsigned long str_numstr; /* # of strings in the file */
+ ## unsigned long str_longlen; /* length of longest string */
+ ## unsigned long str_shortlen; /* length of shortest string */
+ ## #define STR_RANDOM 0x1 /* randomized pointers */
+ ## #define STR_ORDERED 0x2 /* ordered pointers */
+ ## #define STR_ROTATED 0x4 /* rot-13'd text */
+ ## unsigned long str_flags; /* bit field for flags */
+ ## unsigned char stuff[4]; /* long aligned space */
+ ## #define str_delim stuff[0] /* delimiting character */
+ ## } STRFILE;
+
+ datfile = open(filename+'.dat', 'r')
+ data = datfile.read(5 * LONG_SIZE)
+ if is_64_bit:
+ v1, v2, n1, n2, l1, l2, s1, s2, f1, f2 = struct.unpack('!10L', data)
+ version = v1 + (v2 << 32)
+ numstr = n1 + (n2 << 32)
+ longlen = l1 + (l2 << 32)
+ shortlen = s1 + (s2 << 32)
+ flags = f1 + (f2 << 32)
+ else:
+ version, numstr, longlen, shortlen, flags = struct.unpack('5l', data)
+
+ delimiter = datfile.read(1)
+ datfile.read(3) # Throw away padding bytes
+ if is_64_bit: datfile.read(4) # 64-bit machines align to 8 bytes
+
+ # Pick a random number
+ r = random.randint(0, numstr)
+ datfile.seek(LONG_SIZE * r, 1) # Seek to the chosen pointer
+ data = datfile.read(LONG_SIZE * 2)
+
+ if is_64_bit:
+ s1, s2, e1, e2 = struct.unpack('!4L', data)
+ start, end = s1 + (s2 << 32), e1 + (e2 << 32)
+ else:
+ start, end = struct.unpack('!ll', data)
+ datfile.close()
+
+ file = open(filename, 'r')
+ file.seek(start)
+ quotation = file.read(end-start)
+ L=string.split(quotation, '\n')
+ while string.strip(L[-1]) == delimiter or string.strip(L[-1]) == "":
+ L=L[:-1]
+ return string.join(L, '\n')
+
+if __name__ == '__main__':
+ import sys
+ if len(sys.argv) == 1:
+ print 'Usage: fortune.py <filename>'
+ sys.exit()
+ print get(sys.argv[1])
--- /dev/null
+sonar.projectKey=multi-languages
+sonar.projectName=Multi Languages
+sonar.projectVersion=1.0-SNAPSHOT
+sonar.modules=java-module,javascript-module,python-module
+
+# not used but mandatory parameter because of https://jira.codehaus.org/browse/SONARPLUGINS-2297
+sonar.sources=src
+
+java-module.sonar.projectName=Java Module
+java-module.sonar.sources=src/main/java
+java-module.sonar.language=java
+
+javascript-module.sonar.projectName=Javascript Module
+javascript-module.sonar.sources=src
+javascript-module.sonar.language=js
+
+python-module.sonar.projectName=Python Module
+python-module.sonar.sources=src
+python-module.sonar.language=py
\ No newline at end of file
--- /dev/null
+sonar.projectName=Module A
+sonar.moduleKey=com.sonarsource.it.samples:moduleA
--- /dev/null
+package com.sonar.it.samples.modules.a1;
+
+public class HelloA1 {
+ private int i;
+ private HelloA1() {
+
+ }
+
+ public void hello() {
+ System.out.println("hello" + " xoo");
+ }
+
+ protected String getHello() {
+ return "hello";
+ }
+}
\ No newline at end of file
--- /dev/null
+ncloc:12
+classes:1
--- /dev/null
+sonar.projectName=Module B
+sonar.moduleKey=com.sonarsource.it.samples:moduleB
--- /dev/null
+package com.sonar.it.samples.modules.a2;
+
+public class HelloA2 {
+ private int i;
+ private HelloA2() {
+
+ }
+
+ public void hello() {
+ System.out.println("hello" + " xoo");
+ }
+}
\ No newline at end of file
--- /dev/null
+ncloc:12
+classes:1
\ No newline at end of file
--- /dev/null
+# Root project information
+sonar.projectKey=projectAB
+sonar.projectName=Project AB
+sonar.projectVersion=1.0-SNAPSHOT
+
+sonar.language=xoo
+
+# Some properties that will be inherited by the modules
+sonar.sources=src/main/xoo
+
+# List of the module identifiers
+sonar.modules=module_a,module_b
--- /dev/null
+sonar.projectName=Module A
+sonar.moduleKey=com.sonarsource.it.samples:moduleA
--- /dev/null
+package com.sonar.it.samples.modules.a1;
+
+public class HelloA1 {
+ private int i;
+ private HelloA1() {
+
+ }
+
+ public void hello() {
+ System.out.println("hello" + " xoo");
+ }
+
+ protected String getHello() {
+ return "hello";
+ }
+}
\ No newline at end of file
--- /dev/null
+ncloc:12
+classes:1
--- /dev/null
+sonar.projectName=Module C
+sonar.moduleKey=com.sonarsource.it.samples:moduleC
--- /dev/null
+package com.sonar.it.samples.modules.a2;
+
+public class HelloA2 {
+ private int i;
+ private HelloA2() {
+
+ }
+
+ public void hello() {
+ System.out.println("hello" + " xoo");
+ }
+}
\ No newline at end of file
--- /dev/null
+ncloc:12
+classes:1
\ No newline at end of file
--- /dev/null
+# Root project information
+sonar.projectKey=projectAC
+sonar.projectName=Project AC
+sonar.projectVersion=1.0-SNAPSHOT
+
+sonar.language=xoo
+
+# Some properties that will be inherited by the modules
+sonar.sources=src/main/xoo
+
+# List of the module identifiers
+sonar.modules=module_a,module_c
--- /dev/null
+public class HelloA {
+ private int i;
+ private HelloA() {
+
+ }
+
+ public void hello() {
+ System.out.println("hello" + " world");
+ }
+}
\ No newline at end of file
--- /dev/null
+public class HelloB {
+ private int i;
+ private HelloB() {
+
+ }
+
+ public void hello() {
+ System.out.println("hello" + " world");
+ }
+}
\ No newline at end of file
--- /dev/null
+this file has been selected by the extension CreateSubProjects.
\ No newline at end of file
--- /dev/null
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.sonarsource.it.projects.batch</groupId>
+ <artifactId>project-builder</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Sonar :: Integration Tests :: Project Builder Sample</name>
+
+ <!-- modules are not defined in pom but in sonar plugin -->
+ <!-- <modules>
+ <module>module_a</module>
+ <module>module_b</module>
+ </modules>-->
+</project>
\ No newline at end of file
--- /dev/null
+sonar.projectKey=sample
+sonar.projectName=Sample
+sonar.projectVersion=1.0-SNAPSHOT
+sonar.sources=src/main/xoo
+sonar.language=xoo
\ No newline at end of file
--- /dev/null
+package sample;
+
+public class Sample {
+
+ public Sample(int i) {
+ int j = i++;
+ }
+
+ private String myMethod() {
+ return "hello";
+ }
+}
--- /dev/null
+sonar.projectKey=sample
+sonar.projectName=Sample
+sonar.projectVersion=1.0-SNAPSHOT
+sonar.sources=src/main/xoo
+sonar.language=xoo
\ No newline at end of file
--- /dev/null
+package sample;
+
+public class Sample {
+
+ public Sample(int i) {
+ int j = i++;
+ System.out.println("foo");
+ }
+
+ private String myMethod() {
+ System.out.println("foo");
+ return "hello";
+ }
+}
--- /dev/null
+sonar.projectKey=sample
+sonar.projectName=Sample
+sonar.projectVersion=1.0-SNAPSHOT
+sonar.sources=src/main/xoo
+sonar.language=xoo
\ No newline at end of file
--- /dev/null
+package sample;
+
+public class ClassAdded {
+
+ public ClassAdded(int i) {
+ int j = i++;
+ }
+
+ private String myMethod() {
+ return "hello";
+ }
+}
--- /dev/null
+ncloc:12
+classes:1
+
--- /dev/null
+package sample;
+
+public class ClassToModify {
+
+ public ClassToModify(int i) {
+ int j = i++;
+ }
+
+ public String addedMethod() {
+ return "This method was added in v2";
+ }
+
+ private String myMethod() {
+ return "hello";
+ }
+}
--- /dev/null
+ncloc:16
+classes:1
+
--- /dev/null
+package sample;
+
+public class ClassToModify {
+
+ public ClassToModify(int i) {
+ int j = i++;
+ }
+
+ private String myMethod() {
+ return "hello";
+ }
+}
--- /dev/null
+ncloc:12
+classes:1
--- /dev/null
+sonar.projectKey=multi-language-sample
+sonar.projectName=Multi-Language Sample
+sonar.projectVersion=1.0-SNAPSHOT
+sonar.sources=src
--- /dev/null
+package sample;
+
+public class Sample {
+
+ public Sample(int i) {
+ int j = i++;
+ }
+
+ private String myMethod() {
+ return "hello";
+ }
+}
--- /dev/null
+ncloc:13
+#Used by dashboard/widgets tests
+complexity_in_classes:3
+classes:1
+comment_lines:3
+public_api:5
+public_undocumented_api:2
+duplicated_files:1
+duplicated_blocks:2
+duplicated_lines:3
--- /dev/null
+package sample;
+
+public class Sample {
+
+ public Sample(int i) {
+ int j = i++;
+ }
+
+ private String myMethod() {
+ return "hello";
+ }
+}
--- /dev/null
+ncloc:13
+#Used by dashboard/widgets tests
+complexity_in_classes:3
+classes:1
+comment_lines:3
+public_api:5
+public_undocumented_api:2
+duplicated_files:1
+duplicated_blocks:2
+duplicated_lines:3
--- /dev/null
+package sample;
+
+public class Sample {
+
+ public Sample(int i) {
+ int j = i++;
+ }
+
+ private String myMethod() {
+ return "hello";
+ }
+}
--- /dev/null
+ncloc:13
+#Used by dashboard/widgets tests
+complexity:3
+complexity_in_classes:3
+classes:1
+comment_lines:3
+public_api:5
+public_undocumented_api:2
+duplicated_files:1
+duplicated_blocks:2
+duplicated_lines:3
--- /dev/null
+sonar.projectKey=sample
+sonar.projectName=Sample
+sonar.projectVersion=1.0-SNAPSHOT
+sonar.sources=my sources/main/xoo
+sonar.language=xoo
\ No newline at end of file
--- /dev/null
+package sample;
+
+public class Sample {
+
+ public Sample(int i) {
+ int j = i++;
+ }
+
+ private String myMethod_modified() {
+ return "hello";
+ }
+}
--- /dev/null
+ncloc:13
+#Used by dashboard/widgets tests
+complexity:3
+complexity_in_classes:3
+classes:1
+comment_lines:3
+public_api:5
+public_undocumented_api:2
+duplicated_files:1
+duplicated_blocks:2
+duplicated_lines:3
--- /dev/null
+sonar.projectKey=sample
+sonar.projectName=Sample
+sonar.projectVersion=1.0-SNAPSHOT
+sonar.sources=my sources/main/xoo
+sonar.language=xoo
\ No newline at end of file
+++ /dev/null
-sonar.projectKey=case-sensitive-file-extensions
-sonar.projectName=Case Sensitive
-sonar.projectVersion=1.0-SNAPSHOT
-sonar.sources=src
-sonar.language=xoo
+++ /dev/null
-File extension is upper case.
-It should not be ignored since SQ 4.0.
+++ /dev/null
-public class Sample {
-
- public Sample(int i) {
- int j = i++;
- }
-
- private String myMethod() {
- return "hello";
- }
-}
+++ /dev/null
-sonar.projectName=Module A
-sonar.moduleKey=com.sonarsource.it.samples:moduleA
+++ /dev/null
-package com.sonar.it.samples.modules.a1;
-
-public class HelloA1 {
- private int i;
- private HelloA1() {
-
- }
-
- public void hello() {
- System.out.println("hello" + " xoo");
- }
-
- protected String getHello() {
- return "hello";
- }
-}
\ No newline at end of file
+++ /dev/null
-ncloc:12
-classes:1
+++ /dev/null
-sonar.projectName=Module B
-sonar.moduleKey=com.sonarsource.it.samples:moduleB
+++ /dev/null
-package com.sonar.it.samples.modules.a2;
-
-public class HelloA2 {
- private int i;
- private HelloA2() {
-
- }
-
- public void hello() {
- System.out.println("hello" + " xoo");
- }
-}
\ No newline at end of file
+++ /dev/null
-ncloc:12
-classes:1
\ No newline at end of file
+++ /dev/null
-# Root project information
-sonar.projectKey=com.sonarsource.it.samples:multi-modules-sample
-sonar.projectName=Sonar :: Integration Tests :: Multi-modules Sample
-sonar.projectVersion=1.0-SNAPSHOT
-
-sonar.language=xoo
-
-# Some properties that will be inherited by the modules
-sonar.sources=src/main/xoo
-
-# List of the module identifiers
-sonar.modules=module_a,module_b
+++ /dev/null
-sonar.projectKey=com.sonarsource.it.projects.batch:duplicate-source
-sonar.projectName=exclusions
-sonar.projectVersion=1.0-SNAPSHOT
-sonar.sources=src/main/xoo,src/main/xoo2
-sonar.tests=src/test/xoo
-sonar.language=xoo
+++ /dev/null
-package org.sonar.tests;
-
-public class ClassOne {
-
-}
+++ /dev/null
-package org.sonar.tests;
-
-public class ClassOne {
-
-}
+++ /dev/null
-package org.sonar.tests;
-
-public class ClassOne {
-
-}
+++ /dev/null
-<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <artifactId>module_a</artifactId>
- <packaging>jar</packaging>
- <name>Module A</name>
-
- <parent>
- <groupId>com.sonarsource.it.projects.batch</groupId>
- <artifactId>extension-lifecycle</artifactId>
- <version>1.0-SNAPSHOT</version>
- </parent>
-
-</project>
\ No newline at end of file
+++ /dev/null
-public class HelloA {
- private int i;
- private HelloA() {
-
- }
-
- public void hello() {
- System.out.println("hello" + " world");
- }
-}
\ No newline at end of file
+++ /dev/null
-<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <artifactId>module_b</artifactId>
- <packaging>jar</packaging>
- <name>Module B</name>
-
- <parent>
- <groupId>com.sonarsource.it.projects.batch</groupId>
- <artifactId>extension-lifecycle</artifactId>
- <version>1.0-SNAPSHOT</version>
- </parent>
-</project>
\ No newline at end of file
+++ /dev/null
-public class HelloB {
- private int i;
- private HelloB() {
-
- }
-
- public void hello() {
- System.out.println("hello" + " world");
- }
-}
\ No newline at end of file
+++ /dev/null
-<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>com.sonarsource.it.projects.batch</groupId>
- <artifactId>extension-lifecycle</artifactId>
- <version>1.0-SNAPSHOT</version>
- <packaging>pom</packaging>
- <name>Sonar :: Integration Tests :: Extension Lifecycle Sample</name>
- <modules>
- <module>module_a</module>
- <module>module_b</module>
- </modules>
-</project>
\ No newline at end of file
+++ /dev/null
-<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>com.sonarsource.it.samples</groupId>
- <artifactId>simple-sample</artifactId>
- <version>1.0-SNAPSHOT</version>
- <name>Sonar :: Integration Tests :: Simple Sample</name>
-
- <url>http://www.simplesample.org</url>
-
- <issueManagement>
- <system>jira</system>
- <url>http://jira.codehaus.org/browse/SIMPLESAMPLE</url>
- </issueManagement>
-
- <scm>
- <connection>scm:git:git@github.com:SonarSource/simplesample.git</connection>
- <developerConnection>scm:git:git@github.com:SonarSource/simplesample.git</developerConnection>
- <url>https://github.com/SonarSource/simplesample</url>
- </scm>
-
- <ciManagement>
- <system>bamboo</system>
- <url>http://bamboo.ci.codehaus.org/browse/SIMPLESAMPLE</url>
- </ciManagement>
-
- <properties>
- <!-- The following property MUST override the <url> definition of the POM -->
- <sonar.links.homepage>http://www.simplesample.org_OVERRIDDEN</sonar.links.homepage>
- </properties>
-
-</project>
\ No newline at end of file
+++ /dev/null
-sonar.projectKey=com.sonarsource.it.samples:simple-sample
-sonar.projectVersion=1.0-SNAPSHOT
-sonar.projectName=Sonar :: Integration Tests :: Simple Sample
-
-sonar.sources=src/main/java
-
-sonar.links.homepage=http://www.simplesample.org_OVERRIDDEN
-sonar.links.ci=http://bamboo.ci.codehaus.org/browse/SIMPLESAMPLE
-sonar.links.issue=http://jira.codehaus.org/browse/SIMPLESAMPLE
-sonar.links.scm=https://github.com/SonarSource/simplesample
-sonar.links.scm_dev=scm:git:git@github.com:SonarSource/simplesample.git
+++ /dev/null
-package sample;
-
-public class Sample {
-
- public Sample(int i) {
- int j = i++;
- }
-
- private String myMethod() {
- return "hello";
- }
-}
+++ /dev/null
-<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>com.sonarsource.it.projects.batch.multi-languages</groupId>
- <artifactId>multi-languages</artifactId>
- <version>1.0-SNAPSHOT</version>
- </parent>
- <artifactId>java-module</artifactId>
- <name>Java Module</name>
-
- <properties>
- <sonar.language>java</sonar.language>
- </properties>
-</project>
+++ /dev/null
-public class HelloJava {
- private int i;
- private HelloJava() {
-
- }
-
- public void hello() {
- System.out.println("hello" + " java");
- }
-}
\ No newline at end of file
+++ /dev/null
-<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>com.sonarsource.it.projects.batch.multi-languages</groupId>
- <artifactId>multi-languages</artifactId>
- <version>1.0-SNAPSHOT</version>
- </parent>
- <artifactId>javascript-module</artifactId>
- <name>Javascript Module</name>
-
- <properties>
- <sonar.language>js</sonar.language>
- </properties>
-
- <build>
- <sourceDirectory>src</sourceDirectory>
- </build>
-
-</project>
\ No newline at end of file
+++ /dev/null
-
-var Person = function(first, last, middle) {
- this.first = first;
- this.middle = middle;
- this.last = last;
-};
-
-Person.prototype = {
-
- whoAreYou : function() {
- return this.first + (this.middle ? ' ' + this.middle: '') + ' ' + this.last;
- }
-
-};
+++ /dev/null
-<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>com.sonarsource.it.projects.batch.multi-languages</groupId>
- <artifactId>multi-languages</artifactId>
- <version>1.0-SNAPSHOT</version>
- <packaging>pom</packaging>
- <name>Multi Languages</name>
- <description>One language per module</description>
-
- <modules>
- <module>java-module</module>
- <module>javascript-module</module>
- <module>python-module</module>
- </modules>
-</project>
\ No newline at end of file
+++ /dev/null
-<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>com.sonarsource.it.projects.batch.multi-languages</groupId>
- <artifactId>multi-languages</artifactId>
- <version>1.0-SNAPSHOT</version>
- </parent>
- <artifactId>python-module</artifactId>
- <name>Python Module</name>
-
- <properties>
- <sonar.language>py</sonar.language>
- </properties>
-
- <build>
- <sourceDirectory>src</sourceDirectory>
- </build>
-</project>
\ No newline at end of file
+++ /dev/null
-
-# fortune.py -- chooses a random fortune, as the fortune(8) program in
-# the BSD-games package does
-#
-# Copyright (c) 2010, Andrew M. Kuchling
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-import struct, random, string
-
-# C long variables are different sizes on 32-bit and 64-bit machines,
-# so we have to measure how big they are on the machine where this is running.
-LONG_SIZE = struct.calcsize('L')
-is_64_bit = (LONG_SIZE == 8)
-
-def get(filename):
- "Select a random quotation, using a pregenerated .dat file"
-
- # First, we open the .dat file, and read the header information.
- # The C structure containing this info looks like:
- ## typedef struct { /* information table */
- ## #define VERSION 1
- ## unsigned long str_version; /* version number */
- ## unsigned long str_numstr; /* # of strings in the file */
- ## unsigned long str_longlen; /* length of longest string */
- ## unsigned long str_shortlen; /* length of shortest string */
- ## #define STR_RANDOM 0x1 /* randomized pointers */
- ## #define STR_ORDERED 0x2 /* ordered pointers */
- ## #define STR_ROTATED 0x4 /* rot-13'd text */
- ## unsigned long str_flags; /* bit field for flags */
- ## unsigned char stuff[4]; /* long aligned space */
- ## #define str_delim stuff[0] /* delimiting character */
- ## } STRFILE;
-
- datfile = open(filename+'.dat', 'r')
- data = datfile.read(5 * LONG_SIZE)
- if is_64_bit:
- v1, v2, n1, n2, l1, l2, s1, s2, f1, f2 = struct.unpack('!10L', data)
- version = v1 + (v2 << 32)
- numstr = n1 + (n2 << 32)
- longlen = l1 + (l2 << 32)
- shortlen = s1 + (s2 << 32)
- flags = f1 + (f2 << 32)
- else:
- version, numstr, longlen, shortlen, flags = struct.unpack('5l', data)
-
- delimiter = datfile.read(1)
- datfile.read(3) # Throw away padding bytes
- if is_64_bit: datfile.read(4) # 64-bit machines align to 8 bytes
-
- # Pick a random number
- r = random.randint(0, numstr)
- datfile.seek(LONG_SIZE * r, 1) # Seek to the chosen pointer
- data = datfile.read(LONG_SIZE * 2)
-
- if is_64_bit:
- s1, s2, e1, e2 = struct.unpack('!4L', data)
- start, end = s1 + (s2 << 32), e1 + (e2 << 32)
- else:
- start, end = struct.unpack('!ll', data)
- datfile.close()
-
- file = open(filename, 'r')
- file.seek(start)
- quotation = file.read(end-start)
- L=string.split(quotation, '\n')
- while string.strip(L[-1]) == delimiter or string.strip(L[-1]) == "":
- L=L[:-1]
- return string.join(L, '\n')
-
-if __name__ == '__main__':
- import sys
- if len(sys.argv) == 1:
- print 'Usage: fortune.py <filename>'
- sys.exit()
- print get(sys.argv[1])
+++ /dev/null
-sonar.projectKey=multi-languages
-sonar.projectName=Multi Languages
-sonar.projectVersion=1.0-SNAPSHOT
-sonar.modules=java-module,javascript-module,python-module
-
-# not used but mandatory parameter because of https://jira.codehaus.org/browse/SONARPLUGINS-2297
-sonar.sources=src
-
-java-module.sonar.projectName=Java Module
-java-module.sonar.sources=src/main/java
-java-module.sonar.language=java
-
-javascript-module.sonar.projectName=Javascript Module
-javascript-module.sonar.sources=src
-javascript-module.sonar.language=js
-
-python-module.sonar.projectName=Python Module
-python-module.sonar.sources=src
-python-module.sonar.language=py
\ No newline at end of file
+++ /dev/null
-sonar.projectName=Module A
-sonar.moduleKey=com.sonarsource.it.samples:moduleA
+++ /dev/null
-package com.sonar.it.samples.modules.a1;
-
-public class HelloA1 {
- private int i;
- private HelloA1() {
-
- }
-
- public void hello() {
- System.out.println("hello" + " xoo");
- }
-
- protected String getHello() {
- return "hello";
- }
-}
\ No newline at end of file
+++ /dev/null
-ncloc:12
-classes:1
+++ /dev/null
-sonar.projectName=Module B
-sonar.moduleKey=com.sonarsource.it.samples:moduleB
+++ /dev/null
-package com.sonar.it.samples.modules.a2;
-
-public class HelloA2 {
- private int i;
- private HelloA2() {
-
- }
-
- public void hello() {
- System.out.println("hello" + " xoo");
- }
-}
\ No newline at end of file
+++ /dev/null
-ncloc:12
-classes:1
\ No newline at end of file
+++ /dev/null
-# Root project information
-sonar.projectKey=projectAB
-sonar.projectName=Project AB
-sonar.projectVersion=1.0-SNAPSHOT
-
-sonar.language=xoo
-
-# Some properties that will be inherited by the modules
-sonar.sources=src/main/xoo
-
-# List of the module identifiers
-sonar.modules=module_a,module_b
+++ /dev/null
-sonar.projectName=Module A
-sonar.moduleKey=com.sonarsource.it.samples:moduleA
+++ /dev/null
-package com.sonar.it.samples.modules.a1;
-
-public class HelloA1 {
- private int i;
- private HelloA1() {
-
- }
-
- public void hello() {
- System.out.println("hello" + " xoo");
- }
-
- protected String getHello() {
- return "hello";
- }
-}
\ No newline at end of file
+++ /dev/null
-ncloc:12
-classes:1
+++ /dev/null
-sonar.projectName=Module C
-sonar.moduleKey=com.sonarsource.it.samples:moduleC
+++ /dev/null
-package com.sonar.it.samples.modules.a2;
-
-public class HelloA2 {
- private int i;
- private HelloA2() {
-
- }
-
- public void hello() {
- System.out.println("hello" + " xoo");
- }
-}
\ No newline at end of file
+++ /dev/null
-ncloc:12
-classes:1
\ No newline at end of file
+++ /dev/null
-# Root project information
-sonar.projectKey=projectAC
-sonar.projectName=Project AC
-sonar.projectVersion=1.0-SNAPSHOT
-
-sonar.language=xoo
-
-# Some properties that will be inherited by the modules
-sonar.sources=src/main/xoo
-
-# List of the module identifiers
-sonar.modules=module_a,module_c
+++ /dev/null
-public class HelloA {
- private int i;
- private HelloA() {
-
- }
-
- public void hello() {
- System.out.println("hello" + " world");
- }
-}
\ No newline at end of file
+++ /dev/null
-public class HelloB {
- private int i;
- private HelloB() {
-
- }
-
- public void hello() {
- System.out.println("hello" + " world");
- }
-}
\ No newline at end of file
+++ /dev/null
-this file has been selected by the extension CreateSubProjects.
\ No newline at end of file
+++ /dev/null
-<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>com.sonarsource.it.projects.batch</groupId>
- <artifactId>project-builder</artifactId>
- <version>1.0-SNAPSHOT</version>
- <packaging>pom</packaging>
- <name>Sonar :: Integration Tests :: Project Builder Sample</name>
-
- <!-- modules are not defined in pom but in sonar plugin -->
- <!-- <modules>
- <module>module_a</module>
- <module>module_b</module>
- </modules>-->
-</project>
\ No newline at end of file
+++ /dev/null
-sonar.projectKey=sample
-sonar.projectName=Sample
-sonar.projectVersion=1.0-SNAPSHOT
-sonar.sources=src/main/xoo
-sonar.language=xoo
\ No newline at end of file
+++ /dev/null
-package sample;
-
-public class Sample {
-
- public Sample(int i) {
- int j = i++;
- }
-
- private String myMethod() {
- return "hello";
- }
-}
+++ /dev/null
-sonar.projectKey=sample
-sonar.projectName=Sample
-sonar.projectVersion=1.0-SNAPSHOT
-sonar.sources=src/main/xoo
-sonar.language=xoo
\ No newline at end of file
+++ /dev/null
-package sample;
-
-public class Sample {
-
- public Sample(int i) {
- int j = i++;
- System.out.println("foo");
- }
-
- private String myMethod() {
- System.out.println("foo");
- return "hello";
- }
-}
+++ /dev/null
-sonar.projectKey=sample
-sonar.projectName=Sample
-sonar.projectVersion=1.0-SNAPSHOT
-sonar.sources=src/main/xoo
-sonar.language=xoo
\ No newline at end of file
+++ /dev/null
-package sample;
-
-public class ClassAdded {
-
- public ClassAdded(int i) {
- int j = i++;
- }
-
- private String myMethod() {
- return "hello";
- }
-}
+++ /dev/null
-ncloc:12
-classes:1
-
+++ /dev/null
-package sample;
-
-public class ClassToModify {
-
- public ClassToModify(int i) {
- int j = i++;
- }
-
- public String addedMethod() {
- return "This method was added in v2";
- }
-
- private String myMethod() {
- return "hello";
- }
-}
+++ /dev/null
-ncloc:16
-classes:1
-
+++ /dev/null
-package sample;
-
-public class ClassToModify {
-
- public ClassToModify(int i) {
- int j = i++;
- }
-
- private String myMethod() {
- return "hello";
- }
-}
+++ /dev/null
-ncloc:12
-classes:1
+++ /dev/null
-sonar.projectKey=multi-language-sample
-sonar.projectName=Multi-Language Sample
-sonar.projectVersion=1.0-SNAPSHOT
-sonar.sources=src
+++ /dev/null
-package sample;
-
-public class Sample {
-
- public Sample(int i) {
- int j = i++;
- }
-
- private String myMethod() {
- return "hello";
- }
-}
+++ /dev/null
-ncloc:13
-#Used by dashboard/widgets tests
-complexity_in_classes:3
-classes:1
-comment_lines:3
-public_api:5
-public_undocumented_api:2
-duplicated_files:1
-duplicated_blocks:2
-duplicated_lines:3
+++ /dev/null
-package sample;
-
-public class Sample {
-
- public Sample(int i) {
- int j = i++;
- }
-
- private String myMethod() {
- return "hello";
- }
-}
+++ /dev/null
-ncloc:13
-#Used by dashboard/widgets tests
-complexity_in_classes:3
-classes:1
-comment_lines:3
-public_api:5
-public_undocumented_api:2
-duplicated_files:1
-duplicated_blocks:2
-duplicated_lines:3
+++ /dev/null
-package sample;
-
-public class Sample {
-
- public Sample(int i) {
- int j = i++;
- }
-
- private String myMethod() {
- return "hello";
- }
-}
+++ /dev/null
-ncloc:13
-#Used by dashboard/widgets tests
-complexity:3
-complexity_in_classes:3
-classes:1
-comment_lines:3
-public_api:5
-public_undocumented_api:2
-duplicated_files:1
-duplicated_blocks:2
-duplicated_lines:3
+++ /dev/null
-sonar.projectKey=sample
-sonar.projectName=Sample
-sonar.projectVersion=1.0-SNAPSHOT
-sonar.sources=my sources/main/xoo
-sonar.language=xoo
\ No newline at end of file
+++ /dev/null
-package sample;
-
-public class Sample {
-
- public Sample(int i) {
- int j = i++;
- }
-
- private String myMethod_modified() {
- return "hello";
- }
-}
+++ /dev/null
-ncloc:13
-#Used by dashboard/widgets tests
-complexity:3
-complexity_in_classes:3
-classes:1
-comment_lines:3
-public_api:5
-public_undocumented_api:2
-duplicated_files:1
-duplicated_blocks:2
-duplicated_lines:3
+++ /dev/null
-sonar.projectKey=sample
-sonar.projectName=Sample
-sonar.projectVersion=1.0-SNAPSHOT
-sonar.sources=my sources/main/xoo
-sonar.language=xoo
\ No newline at end of file
<name>SonarQube Integration Tests :: Tests</name>
<properties>
- <category1>*</category1>
- <category2>NONE</category2>
+ <category>*</category>
<skipIts>false</skipIts>
</properties>
<dependency>
<groupId>org.sonarsource.orchestrator</groupId>
<artifactId>sonar-orchestrator</artifactId>
- <version>3.5</version>
+ <version>3.6</version>
<scope>test</scope>
</dependency>
<dependency>
<argLine>-Xmx128m -Dsonar.runtimeVersion=${project.version}</argLine>
<skipTests>${skipIts}</skipTests>
<includes>
- <include>${category1}/suite/*TestSuite.java</include>
- <include>${category2}/suite/*TestSuite.java</include>
- <!-- not included in suites -->
- <include>${category1}/*Test.java</include>
- <include>${category2}/*Test.java</include>
+ <include>*/${category}Suite.java</include>
</includes>
- <excludes>
- <!-- included into suites -->
- <exclude>*/suite/*Test.java</exclude>
- </excludes>
</configuration>
</plugin>
</plugins>
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package administration.suite;
-
-import administration.suite.administration.BulkDeletionTest;
-import administration.suite.administration.ProjectAdministrationTest;
-import administration.suite.administration.PropertySetsTest;
-import administration.suite.administration.SubCategoriesTest;
-import administration.suite.ui.I18nTest;
-import com.sonar.orchestrator.Orchestrator;
-import org.junit.ClassRule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import util.ItUtils;
-
-import static util.ItUtils.pluginArtifact;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- BulkDeletionTest.class,
- ProjectAdministrationTest.class,
- PropertySetsTest.class,
- SubCategoriesTest.class,
- I18nTest.class
-})
-public class AdministrationTestSuite {
-
- @ClassRule
- public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv()
- .setServerProperty("sonar.notifications.delay", "1")
- .addPlugin(ItUtils.pluginArtifact("property-sets-plugin"))
- .addPlugin(ItUtils.pluginArtifact("sonar-subcategories-plugin"))
-
- // Used in I18nTest
- .addPlugin(pluginArtifact("l10n-fr-pack"))
-
- .addPlugin(ItUtils.xooPlugin())
- .build();
-}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package administration.suite.administration;
-
-import administration.suite.AdministrationTestSuite;
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.SonarRunner;
-import com.sonar.orchestrator.selenium.Selenese;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import util.selenium.SeleneseTest;
-
-import static util.ItUtils.projectDir;
-
-public class BulkDeletionTest {
-
- @ClassRule
- public static Orchestrator orchestrator = AdministrationTestSuite.ORCHESTRATOR;
-
- @Before
- public void deleteData() {
- orchestrator.resetData();
- }
-
- /**
- * SONAR-2614, SONAR-3805
- */
- @Test
- public void test_bulk_deletion_on_selected_projects() throws Exception {
- // we must have several projects to test the bulk deletion
- executeBuild("cameleon-1", "Sample-Project");
- executeBuild("cameleon-2", "Foo-Application");
- executeBuild("cameleon-3", "Bar-Sonar-Plugin");
-
- Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("project-bulk-deletion-on-selected-project",
- "/administration/suite/BulkDeletionTest/project-bulk-deletion/bulk-delete-filter-projects.html"
- ).build();
- new SeleneseTest(selenese).runOn(orchestrator);
- }
-
- private void executeBuild(String projectKey, String projectName) {
- orchestrator.executeBuild(
- SonarRunner.create(projectDir("shared/xoo-sample"))
- .setProjectKey(projectKey)
- .setProjectName(projectName)
- );
- }
-
-}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package administration.suite.administration;
-
-import administration.suite.AdministrationTestSuite;
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.SonarRunner;
-import com.sonar.orchestrator.selenium.Selenese;
-import java.sql.SQLException;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import javax.annotation.Nullable;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.wsclient.SonarClient;
-import org.sonar.wsclient.base.HttpException;
-import org.sonar.wsclient.qualitygate.NewCondition;
-import org.sonar.wsclient.qualitygate.QualityGate;
-import org.sonar.wsclient.qualitygate.QualityGateClient;
-import org.sonar.wsclient.qualitygate.QualityGateCondition;
-import org.sonar.wsclient.qualitygate.UpdateCondition;
-import org.sonar.wsclient.services.PropertyQuery;
-import org.sonar.wsclient.services.ResourceQuery;
-import org.sonar.wsclient.user.UserParameters;
-import util.selenium.SeleneseTest;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static util.ItUtils.projectDir;
-
-public class ProjectAdministrationTest {
-
- private static final String DELETE_WS_ENDPOINT = "api/projects/bulk_delete";
- @ClassRule
- public static Orchestrator orchestrator = AdministrationTestSuite.ORCHESTRATOR;
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- private static final String PROJECT_KEY = "sample";
- private static final String FILE_KEY = "sample:src/main/xoo/sample/Sample.xoo";
-
- @Before
- public void deleteAnalysisData() throws SQLException {
- orchestrator.resetData();
- }
-
- @Test
- public void delete_project_by_web_service() {
- scanSampleWithDate("2012-01-01");
-
- assertThat(orchestrator.getServer().getWsClient().find(ResourceQuery.create(PROJECT_KEY))).isNotNull();
- assertThat(orchestrator.getServer().getWsClient().find(ResourceQuery.create(FILE_KEY))).isNotNull();
-
- orchestrator.getServer().adminWsClient().post(DELETE_WS_ENDPOINT, "keys", PROJECT_KEY);
-
- assertThat(orchestrator.getServer().getWsClient().find(ResourceQuery.create(PROJECT_KEY))).isNull();
- assertThat(orchestrator.getServer().getWsClient().find(ResourceQuery.create(FILE_KEY))).isNull();
- }
-
- @Test
- public void fail_when_trying_to_delete_a_file() {
- expectedException.expect(HttpException.class);
- scanSampleWithDate("2012-01-01");
-
- assertThat(orchestrator.getServer().getWsClient().find(ResourceQuery.create(PROJECT_KEY))).isNotNull();
- assertThat(orchestrator.getServer().getWsClient().find(ResourceQuery.create(FILE_KEY))).isNotNull();
-
- // it's forbidden to delete only some files
- orchestrator.getServer().adminWsClient().post(DELETE_WS_ENDPOINT, "keys", FILE_KEY);
- }
-
- @Test
- public void fail_when_insufficient_privilege() {
- expectedException.expect(HttpException.class);
- scanSampleWithDate("2012-01-01");
-
- assertThat(orchestrator.getServer().getWsClient().find(ResourceQuery.create(PROJECT_KEY))).isNotNull();
-
- // use wsClient() instead of adminWsClient()
- orchestrator.getServer().wsClient().post(DELETE_WS_ENDPOINT, "keys", PROJECT_KEY);
- }
-
- /**
- * Test updated for SONAR-3570 and SONAR-5923
- */
- @Test
- public void project_deletion() {
- String projectAdminUser = "project-deletion-with-admin-permission-on-project";
- SonarClient wsClient = orchestrator.getServer().adminWsClient();
- try {
- SonarRunner scan = SonarRunner.create(projectDir("shared/xoo-sample"));
- orchestrator.executeBuild(scan);
-
- // Create user having admin permission on previously analysed project
- wsClient.userClient().create(
- UserParameters.create().login(projectAdminUser).name(projectAdminUser).password("password").passwordConfirmation("password"));
-
- wsClient.post("api/permissions/add_user",
- "login", projectAdminUser,
- "projectKey", "sample",
- "permission", "admin");
-
- new SeleneseTest(
- Selenese.builder().setHtmlTestsInClasspath("project-deletion", "/administration/suite/ProjectAdministrationTest/project-deletion/project-deletion.html").build())
- .runOn(orchestrator);
- } finally {
- wsClient.userClient().deactivate(projectAdminUser);
- }
- }
-
- // SONAR-4203
- @Test
- public void delete_version_of_multimodule_project() {
- GregorianCalendar today = new GregorianCalendar();
- SonarRunner build = SonarRunner.create(projectDir("shared/xoo-multi-modules-sample"))
- .setProperty("sonar.dynamicAnalysis", "false")
- .setProperty("sonar.projectDate", (today.get(Calendar.YEAR) - 1) + "-01-01");
- orchestrator.executeBuild(build);
-
- // The analysis must be run once again to have an history so that it is possible
- // to set/delete version on old snapshot
- build.setProperty("sonar.projectDate", today.get(Calendar.YEAR) + "-01-01");
- orchestrator.executeBuild(build);
-
- // There are 7 modules
- assertThat(count("events where category='Version'")).as("Different number of events").isEqualTo(7);
-
- Selenese selenese = Selenese.builder()
- .setHtmlTestsInClasspath("modify_version_of_multimodule_project",
- "/administration/suite/ProjectAdministrationTest/project-administration/multimodule-project-modify-version.html"
- ).build();
- new SeleneseTest(selenese).runOn(orchestrator);
-
- assertThat(count("events where category='Version'")).as("Different number of events").isEqualTo(14);
-
- selenese = Selenese.builder()
- .setHtmlTestsInClasspath("delete_version_of_multimodule_project",
- "/administration/suite/ProjectAdministrationTest/project-administration/multimodule-project-delete-version.html"
- ).build();
- new SeleneseTest(selenese).runOn(orchestrator);
-
- assertThat(count("events where category='Version'")).as("Different number of events").isEqualTo(7);
- }
-
- // SONAR-3326
- @Test
- public void display_alerts_correctly_in_history_page() {
- QualityGateClient qgClient = orchestrator.getServer().adminWsClient().qualityGateClient();
- QualityGate qGate = qgClient.create("AlertsForHistory");
- qgClient.setDefault(qGate.id());
-
- // with this configuration, project should have an Orange alert
- QualityGateCondition lowThresholds = qgClient.createCondition(NewCondition.create(qGate.id()).metricKey("lines").operator("GT").warningThreshold("5").errorThreshold("50"));
- scanSampleWithDate("2012-01-01");
- // with this configuration, project should have a Green alert
- qgClient.updateCondition(UpdateCondition.create(lowThresholds.id()).metricKey("lines").operator("GT").warningThreshold("5000").errorThreshold("5000"));
- scanSampleWithDate("2012-01-02");
-
- Selenese selenese = Selenese.builder()
- .setHtmlTestsInClasspath("display-alerts-history-page",
- "/administration/suite/ProjectAdministrationTest/display-alerts-history-page/should-display-alerts-correctly-history-page.html"
- ).build();
- new SeleneseTest(selenese).runOn(orchestrator);
-
- qgClient.unsetDefault();
- qgClient.destroy(qGate.id());
- }
-
- /**
- * SONAR-1352
- */
- @Test
- public void display_period_alert_on_project_dashboard() {
- QualityGateClient qgClient = orchestrator.getServer().adminWsClient().qualityGateClient();
- QualityGate qGate = qgClient.create("AlertsForDashboard");
- qgClient.createCondition(NewCondition.create(qGate.id()).metricKey("lines").operator("LT").warningThreshold("0").errorThreshold("10")
- .period(1));
- qgClient.setDefault(qGate.id());
-
- // No alert
- scanSampleWithDate("2012-01-01");
-
- // Red alert because lines number has not changed since previous analysis
- scanSample();
-
- Selenese selenese = Selenese.builder()
- .setHtmlTestsInClasspath("display-period-alerts",
- "/administration/suite/ProjectAdministrationTest/display-alerts/should-display-period-alerts-correctly.html"
- ).build();
- new SeleneseTest(selenese).runOn(orchestrator);
-
- qgClient.unsetDefault();
- qgClient.destroy(qGate.id());
- }
-
- /**
- * SONAR-3425
- */
- @Test
- public void project_settings() {
- scanSampleWithDate("2012-01-01");
-
- Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("project-settings",
- // SONAR-3425
- "/administration/suite/ProjectAdministrationTest/project-settings/override-global-settings.html",
-
- "/administration/suite/ProjectAdministrationTest/project-settings/only-on-project-settings.html"
- ).build();
- new SeleneseTest(selenese).runOn(orchestrator);
-
- assertThat(orchestrator.getServer().getAdminWsClient().find(PropertyQuery.createForResource("sonar.skippedModules", "sample")).getValue())
- .isEqualTo("my-excluded-module");
- }
-
- /**
- * SONAR-1608
- */
- @Test
- public void bulk_update_project_keys() {
- SonarRunner build = SonarRunner.create(projectDir("shared/xoo-multi-modules-sample"));
- orchestrator.executeBuild(build);
-
- Selenese selenese = Selenese.builder()
- .setHtmlTestsInClasspath("project-bulk-update-keys",
- "/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();
- new SeleneseTest(selenese).runOn(orchestrator);
- }
-
- /**
- * SONAR-1608
- */
- @Test
- public void fine_grain_update_project_keys() {
- SonarRunner build = SonarRunner.create(projectDir("shared/xoo-multi-modules-sample"));
- orchestrator.executeBuild(build);
-
- Selenese selenese = Selenese.builder()
- .setHtmlTestsInClasspath("project-fine-grained-update-keys",
- "/administration/suite/ProjectAdministrationTest/project-update-keys/fine-grained-update-impossible.html",
- "/administration/suite/ProjectAdministrationTest/project-update-keys/fine-grained-update-success.html"
- ).build();
- new SeleneseTest(selenese).runOn(orchestrator);
- }
-
- /**
- * SONAR-4060
- */
- @Test
- public void display_module_settings() {
- orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-multi-modules-sample")));
-
- Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("module-settings",
- // SONAR-3425
- "/administration/suite/ProjectAdministrationTest/module-settings/display-module-settings.html"
- ).build();
- new SeleneseTest(selenese).runOn(orchestrator);
- }
-
- private void scanSample() {
- scanSample(null, null);
- }
-
- private void scanSampleWithDate(String date) {
- scanSample(date, null);
- }
-
- private void scanSample(@Nullable String date, @Nullable String profile) {
- SonarRunner scan = SonarRunner.create(projectDir("shared/xoo-sample"))
- .setProperties("sonar.cpd.skip", "true");
- if (date != null) {
- scan.setProperty("sonar.projectDate", date);
- }
- if (profile != null) {
- scan.setProfile(profile);
- }
- orchestrator.executeBuild(scan);
- }
-
- private int count(String condition) {
- return orchestrator.getDatabase().countSql("select count(*) from " + condition);
- }
-
-}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package administration.suite.administration;
-
-import administration.suite.AdministrationTestSuite;
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.selenium.Selenese;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.wsclient.services.PropertyQuery;
-import org.sonar.wsclient.services.PropertyUpdateQuery;
-import util.selenium.SeleneseTest;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class PropertySetsTest {
-
- @ClassRule
- public static Orchestrator orchestrator = AdministrationTestSuite.ORCHESTRATOR;
-
- @Test
- public void should_support_property_sets() {
- Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("property-sets",
- "/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();
- // Use the old runner because it fails with the new Selenium runner
- orchestrator.executeSelenese(selenese);
-
- // SSF-25 Check that the password has well be setted as now it does not appears in the html source code
- String sonarDemoValue = getProperty("sonar.demo");
- assertThat(getProperty("sonar.demo." + sonarDemoValue + ".password")).isEqualTo("abcde");
- }
-
- @Test
- public void should_edit_properties() {
- setProperty("sonar.test.jira.servers", "jira1,jira2");
- setProperty("sonar.test.jira.servers.jira1.url", "http://jira1");
- setProperty("sonar.test.jira.servers.jira2.url", "http://jira2");
- setProperty("sonar.test.jira.servers.jira1.port", "12345");
- setProperty("sonar.test.jira.servers.jira2.port", "66666");
-
- assertThat(getProperty("sonar.test.jira.servers")).isEqualTo("jira1,jira2");
- assertThat(getProperty("sonar.test.jira.servers.jira1.url")).isEqualTo("http://jira1");
- assertThat(getProperty("sonar.test.jira.servers.jira2.url")).isEqualTo("http://jira2");
- assertThat(getProperty("sonar.test.jira.servers.jira1.port")).isEqualTo("12345");
- assertThat(getProperty("sonar.test.jira.servers.jira2.port")).isEqualTo("66666");
- }
-
- @Test
- public void should_support_property_sets_with_auto_generated_keys() {
- new SeleneseTest(
- Selenese.builder().setHtmlTestsInClasspath("create-auto-generated",
- "/administration/suite/PropertySetsTest/auto-generated/create.html"
- ).build()).runOn(orchestrator);
-
- String[] keys = getProperty("sonar.autogenerated").split("[,]");
- assertThat(getProperty("sonar.autogenerated." + keys[0] + ".value")).isEqualTo("FIRST");
- assertThat(getProperty("sonar.autogenerated." + keys[1] + ".value")).isEqualTo("SECOND");
- assertThat(getProperty("sonar.autogenerated." + keys[2] + ".value")).isEqualTo("THIRD");
-
- new SeleneseTest(Selenese.builder().setHtmlTestsInClasspath("update-auto-generated",
- "/administration/suite/PropertySetsTest/auto-generated/update.html"
- ).build()).runOn(orchestrator);
-
- keys = getProperty("sonar.autogenerated").split("[,]");
- assertThat(getProperty("sonar.autogenerated." + keys[0] + ".value")).isEqualTo("FIRST");
- assertThat(getProperty("sonar.autogenerated." + keys[1] + ".value")).isEqualTo("THIRD");
- }
-
- static void setProperty(String key, String value) {
- orchestrator.getServer().getAdminWsClient().update(new PropertyUpdateQuery(key, value));
- }
-
- static String getProperty(String key) {
- return orchestrator.getServer().getAdminWsClient().find(new PropertyQuery().setKey(key)).getValue();
- }
-}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package administration.suite.administration;
-
-import administration.suite.AdministrationTestSuite;
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.SonarRunner;
-import com.sonar.orchestrator.selenium.Selenese;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.wsclient.services.PropertyQuery;
-import util.selenium.SeleneseTest;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static util.ItUtils.projectDir;
-
-public class SubCategoriesTest {
-
- @ClassRule
- public static Orchestrator orchestrator = AdministrationTestSuite.ORCHESTRATOR;
-
- /**
- * SONAR-3159
- */
- @Test
- public void should_support_global_subcategories() {
- Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("subcategories",
- "/administration/suite/SubCategoriesTest/subcategories/global-subcategories.html",
- // SONAR-4495
- "/administration/suite/SubCategoriesTest/subcategories/global-subcategories-no-default.html"
- ).build();
- new SeleneseTest(selenese).runOn(orchestrator);
- assertThat(getProperty("prop3", null)).isEqualTo("myValue");
- }
-
- /**
- * SONAR-3159
- */
- @Test
- public void should_support_project_subcategories() {
- orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample")));
-
- Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("subcategories",
- "/administration/suite/SubCategoriesTest/subcategories/project-subcategories.html",
- // SONAR-4495
- "/administration/suite/SubCategoriesTest/subcategories/project-subcategories-no-default.html"
- ).build();
- new SeleneseTest(selenese).runOn(orchestrator);
- assertThat(getProperty("prop3", "sample")).isEqualTo("myValue2");
- }
-
- static String getProperty(String key, String resourceKeyOrId) {
- return orchestrator.getServer().getAdminWsClient().find(new PropertyQuery().setKey(key).setResourceKeyOrId(resourceKeyOrId)).getValue();
- }
-}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-package administration.suite.ui;
-
-import administration.suite.AdministrationTestSuite;
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.SonarRunner;
-import com.sonar.orchestrator.selenium.Selenese;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import util.selenium.SeleneseTest;
-
-import static util.ItUtils.projectDir;
-
-public class I18nTest {
-
- @ClassRule
- public static Orchestrator orchestrator = AdministrationTestSuite.ORCHESTRATOR;
-
- @Before
- public void cleanDatabase() {
- orchestrator.resetData();
- }
-
- /**
- * TODO This test should use a fake widget that display a fake metric with decimals instead of using provided metric
- */
- @Test
- public void test_localization() {
- orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample")));
-
- Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("ui-i18n",
- "/ui/i18n/default-locale-is-english.html",
- "/ui/i18n/french-locale.html",
- "/ui/i18n/french-pack.html",
- "/ui/i18n/locale-with-france-country.html",
- "/ui/i18n/locale-with-swiss-country.html").build();
- new SeleneseTest(selenese).runOn(orchestrator);
- }
-
-}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package analysis.suite;
-
-import analysis.suite.measure.CustomMeasuresTest;
-import analysis.suite.measure.DifferentialPeriodsTest;
-import analysis.suite.measure.MeasureFiltersTest;
-import analysis.suite.measure.NewDebtRatioMeasureTest;
-import analysis.suite.measure.TechnicalDebtMeasureVariationTest;
-import analysis.suite.measure.TimeMachineTest;
-import analysis.suite.testing.CoverageTest;
-import analysis.suite.testing.CoverageTrackingTest;
-import analysis.suite.testing.NewCoverageTest;
-import analysis.suite.testing.TestExecutionTest;
-import com.sonar.orchestrator.Orchestrator;
-import org.junit.ClassRule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import util.ItUtils;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- CustomMeasuresTest.class,
- DifferentialPeriodsTest.class,
- MeasureFiltersTest.class,
- TimeMachineTest.class,
- CoverageTrackingTest.class,
- CoverageTest.class,
- NewCoverageTest.class,
- TestExecutionTest.class,
- TechnicalDebtMeasureVariationTest.class,
- NewDebtRatioMeasureTest.class
-})
-public class AnalysisTestSuite {
-
- @ClassRule
- public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv()
- .addPlugin(ItUtils.xooPlugin())
- .build();
-}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package analysis.suite.measure;
-
-import analysis.suite.AnalysisTestSuite;
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.SonarRunner;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.wsclient.services.Measure;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static util.ItUtils.projectDir;
-
-public class CustomMeasuresTest {
-
- public static final String PROJECT_KEY = "sample";
- @ClassRule
- public static Orchestrator orchestrator = AnalysisTestSuite.ORCHESTRATOR;
-
- @Before
- public void deleteProjects() {
- orchestrator.resetData();
- }
-
- @Test
- public void custom_measures_should_be_integrated_during_project_analysis() {
- analyzeProject();
- setBurnedBudget(1200.3);
- setTeamSize(4);
-
- assertThat(getMeasure("team_size")).isNull();
- assertThat(getMeasure("burned_budget")).isNull();
-
- analyzeProject();
-
- assertThat(getMeasure("burned_budget").getValue()).isEqualTo(1200.3);
- assertThat(getMeasure("team_size").getIntValue()).isEqualTo(4);
- }
-
- @Test
- public void should_update_value() {
- analyzeProject();
- setTeamSize(4);
- analyzeProject();
- updateTeamSize(15);
- assertThat(getMeasure("team_size").getIntValue()).isEqualTo(4);
- analyzeProject();// the value is available when the project is analyzed again
- assertThat(getMeasure("team_size").getIntValue()).isEqualTo(15);
- }
-
- @Test
- public void should_delete_custom_measure() {
- analyzeProject();
- setTeamSize(4);
- analyzeProject();
- deleteCustomMeasure("team_size");
- assertThat(getMeasure("team_size").getIntValue()).isEqualTo(4);// the value is still available. It will be removed during next analyzed
-
- analyzeProject();
- assertThat(getMeasure("team_size")).isNull();
- }
-
- private void analyzeProject() {
- orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample")));
- }
-
- private void setTeamSize(int i) {
- orchestrator.getServer().adminWsClient().post("api/custom_measures/create", "projectKey", PROJECT_KEY, "metricKey", "team_size", "value", String.valueOf(i));
- }
-
- private void updateTeamSize(int i) {
- String response = orchestrator.getServer().adminWsClient().get("api/custom_measures/search", "projectKey", PROJECT_KEY, "metricKey", "team_size");
- Matcher jsonObjectMatcher = Pattern.compile(".*?\"id\"\\s*:\\s*\"(.*?)\".*", Pattern.MULTILINE).matcher(response);
- jsonObjectMatcher.find();
- String customMeasureId = jsonObjectMatcher.group(1);
- orchestrator.getServer().adminWsClient().post("api/custom_measures/update", "id", customMeasureId, "value", String.valueOf(i));
- }
-
- private void setBurnedBudget(double d) {
- orchestrator.getServer().adminWsClient().post("api/custom_measures/create", "projectKey", PROJECT_KEY, "metricKey", "burned_budget", "value", String.valueOf(d));
- }
-
- private void deleteCustomMeasure(String metricKey) {
- String response = orchestrator.getServer().adminWsClient().get("api/custom_measures/search", "projectKey", PROJECT_KEY, "metricKey", metricKey);
- Matcher jsonObjectMatcher = Pattern.compile(".*?\"id\"\\s*:\\s*\"(.*?)\".*", Pattern.MULTILINE).matcher(response);
- jsonObjectMatcher.find();
- String customMeasureId = jsonObjectMatcher.group(1);
- orchestrator.getServer().adminWsClient().post("api/custom_measures/delete", "id", customMeasureId);
- }
-
- private Measure getMeasure(String metricKey) {
- Resource resource = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT_KEY, metricKey));
- return resource != null ? resource.getMeasure(metricKey) : null;
- }
-}
+++ /dev/null
-package analysis.suite.measure;
-
-import analysis.suite.AnalysisTestSuite;
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.SonarRunner;
-import com.sonar.orchestrator.locator.FileLocation;
-import java.util.List;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.wsclient.services.Measure;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-import util.ItUtils;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-
-public class DifferentialPeriodsTest {
-
- @ClassRule
- public static final Orchestrator orchestrator = AnalysisTestSuite.ORCHESTRATOR;
-
- @Before
- public void cleanUpAnalysisData() {
- orchestrator.resetData();
- }
-
- @After
- public void tearDown() throws Exception {
- String propertyKey = "sonar.timemachine.period4";
- unsetProperty(propertyKey);
- unsetProperty("sonar.timemachine.period5");
- }
-
- /**
- * SONAR-6787
- */
- @Test
- public void ensure_differential_period_4_and_5_defined_at_project_level_is_taken_into_account() throws Exception {
- setProperty("sonar.timemachine.period4", "30");
- setProperty("sonar.timemachine.period5", "previous_analysis");
-
- // Execute an analysis in the past to have a past snapshot without any issues
- orchestrator.getServer().provisionProject("sample", "sample");
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "empty");
- orchestrator.executeBuild(SonarRunner.create(ItUtils.projectDir("shared/xoo-sample"))
- .setProperty("sonar.projectDate", "2013-01-01"));
-
- // Second analysis -> issues will be created
- orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/measure/suite/one-issue-per-line.xml"));
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
- orchestrator.executeBuild(SonarRunner.create(ItUtils.projectDir("shared/xoo-sample")));
-
- // New technical debt only comes from new issues
- Resource newTechnicalDebt = orchestrator.getServer().getWsClient()
- .find(ResourceQuery.createForMetrics("sample:src/main/xoo/sample/Sample.xoo", "new_technical_debt").setIncludeTrends(true));
- List<Measure> measures = newTechnicalDebt.getMeasures();
- assertThat(measures.get(0).getVariation4()).isEqualTo(17);
- assertThat(measures.get(0).getVariation5()).isEqualTo(17);
-
- // Third analysis, with exactly the same profile -> no new issues so no new technical debt
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
- orchestrator.executeBuild(SonarRunner.create(ItUtils.projectDir("shared/xoo-sample")));
-
- newTechnicalDebt = orchestrator.getServer().getWsClient().find(
- ResourceQuery.createForMetrics("sample:src/main/xoo/sample/Sample.xoo", "new_technical_debt").setIncludeTrends(true)
- );
-
- // No variation => measure is purged
- assertThat(newTechnicalDebt).isNull();
- }
-
- private static void unsetProperty(String propertyKey) {
- setProperty(propertyKey, "");
- }
-
- private static void setProperty(String propertyKey, String propertyValue) {
- orchestrator.getServer().adminWsClient().post(
- "/api/properties?",
- "id", propertyKey,
- "value", propertyValue
- );
- }
-
-}
-
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package analysis.suite.measure;
-
-import analysis.suite.AnalysisTestSuite;
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.SonarRunner;
-import com.sonar.orchestrator.selenium.Selenese;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.wsclient.SonarClient;
-import org.sonar.wsclient.user.UserParameters;
-import util.selenium.SeleneseTest;
-
-import static util.ItUtils.projectDir;
-
-public class MeasureFiltersTest {
-
- @ClassRule
- public static Orchestrator orchestrator = AnalysisTestSuite.ORCHESTRATOR;
-
- @BeforeClass
- public static void scanStruts() {
- orchestrator.resetData();
- orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-multi-modules-sample")));
-
- createUser("user-measure-filters", "User Measure Filters");
- }
-
- @AfterClass
- public static void deleteTestUser() {
- deactivateUser("user-measure-filters");
- }
-
- @Test
- public void execute_measure_filters() {
- Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("execution_of_measure_filters",
- "/measure/suite/measure_filters/link_from_main_header.html",
- "/measure/suite/measure_filters/initial_search_form.html",
- "/measure/suite/measure_filters/search_for_projects.html",
- "/measure/suite/measure_filters/search_for_files.html",
- // SONAR-4195
- "/measure/suite/measure_filters/search-by-key.html",
- "/measure/suite/measure_filters/search-by-name.html",
- "/measure/suite/measure_filters/empty_filter.html"
- ).build();
- new SeleneseTest(selenese).runOn(orchestrator);
- }
-
- @Test
- public void display_measure_filter_as_list() {
- Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("display_measure_filter_as_list",
- "/measure/suite/measure_filters/list_change_columns.html",
- "/measure/suite/measure_filters/list_delete_column.html",
- "/measure/suite/measure_filters/list_move_columns.html",
- "/measure/suite/measure_filters/list_sort_by_descending_name.html",
- "/measure/suite/measure_filters/list_sort_by_ncloc.html"
- ).build();
- new SeleneseTest(selenese).runOn(orchestrator);
- }
-
- @Test
- public void share_measure_filters() {
- // SONAR-4099
- String user = "user-measures-filter-with-sharing-perm";
- createUser(user, "User Measure Filters with sharing permission", "shareDashboard");
-
- try {
- Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("share_measure_filters",
- // SONAR-4469
- "/measure/suite/measure_filters/should-unshare-filter-remove-other-filters-favourite.html"
- ).build();
- new SeleneseTest(selenese).runOn(orchestrator);
- } finally {
- deactivateUser(user);
- }
- }
-
- /**
- * SONAR-4099
- */
- @Test
- public void should_not_share_filter_when_user_have_no_sharing_permissions() {
- String user = "user-measures-filter-with-no-share-perm";
- createUser(user, "User Measure Filters without sharing permission");
-
- try {
- new SeleneseTest(Selenese.builder().setHtmlTestsInClasspath("should_not_share_filter_when_user_have_no_sharing_permissions",
- "/measure/suite/measure_filters/should-not-share-filter-when-user-have-no-sharing-permissions.html"
- ).build()).runOn(orchestrator);
- } finally {
- deactivateUser(user);
- }
- }
-
- @Test
- public void copy_measure_filters() {
- Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("copy_measure_filters",
- "/measure/suite/measure_filters/copy_measure_filter.html",
- "/measure/suite/measure_filters/copy_uniqueness_of_name.html"
- ).build();
- new SeleneseTest(selenese).runOn(orchestrator);
- }
-
- @Test
- public void manage_measure_filters() {
- Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("manage_measure_filters",
- "/measure/suite/measure_filters/save_with_special_characters.html"
- ).build();
- new SeleneseTest(selenese).runOn(orchestrator);
- }
-
- @Test
- public void measure_filter_list_widget() {
- Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("measure_filter_list_widget",
- "/measure/suite/measure_filters/list_widget.html",
- "/measure/suite/measure_filters/list_widget_sort.html",
- "/measure/suite/measure_filters/list_widget_warning_if_missing_filter.html"
- ).build();
- new SeleneseTest(selenese).runOn(orchestrator);
- }
-
- private static void createUser(String login, String name) {
- createUser(login, name, null);
- }
-
- private static void createUser(String login, String name, String permission) {
- SonarClient client = orchestrator.getServer().adminWsClient();
- UserParameters userCreationParameters = UserParameters.create().login(login).name(name).password("password").passwordConfirmation("password");
- client.userClient().create(userCreationParameters);
-
- if (permission != null) {
- client.post("api/permissions/add_user",
- "login", login,
- "permission", permission);
- }
- }
-
- private static void deactivateUser(String user) {
- orchestrator.getServer().adminWsClient().userClient().deactivate(user);
- }
-}
+++ /dev/null
-package analysis.suite.measure;
-
-import analysis.suite.AnalysisTestSuite;
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.locator.FileLocation;
-import java.util.List;
-import javax.annotation.Nullable;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.wsclient.services.Measure;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-import util.ItUtils;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.within;
-
-/**
- * SONAR-5876
- */
-public class NewDebtRatioMeasureTest {
-
- private static final String NEW_DEBT_RATIO_METRIC_KEY = "new_sqale_debt_ratio";
-
- @ClassRule
- public static Orchestrator orchestrator = AnalysisTestSuite.ORCHESTRATOR;
-
- @Before
- public void cleanUpAnalysisData() {
- orchestrator.resetData();
- }
-
- @Test
- public void new_debt_ratio_is_computed_from_nes_debt_and_new_ncloc_count_per_file() throws Exception {
- // This test assumes that period 1 is "since previous analysis" and 2 is "over 30 days"
-
- // run analysis on the day of after the first commit (2015-09-01), with 'one-issue-per-line' profile
- // => some issues at date 2015-09-02
- defineQualityProfile("one-issue-per-line");
- provisionSampleProject();
- setSampleProjectQualityProfile("one-issue-per-line");
- runSampleProjectAnalysis("v1", "sonar.projectDate", "2015-09-02");
-
- // first analysis, no previous snapshot => periods not resolved => no value
- assertNoNewDebtRatio();
-
- // run analysis on the day after of second commit (2015-09-17) 'one-issue-per-line' profile*
- // => 3 new issues will be created at date 2015-09-18
- runSampleProjectAnalysis("v2", "sonar.projectDate", "2015-09-18");
- assertNewDebtRatio(4.44, 4.44);
-
- // run analysis on the day after of third commit (2015-09-20) 'one-issue-per-line' profile*
- // => 4 new issues will be created at date 2015-09-21
- runSampleProjectAnalysis("v3", "sonar.projectDate", "2015-09-21");
- assertNewDebtRatio(4.17, 4.28);
- }
-
- private void assertNoNewDebtRatio() {
- assertThat(getFileResourceWithVariations(NEW_DEBT_RATIO_METRIC_KEY)).isNull();
- }
-
- private void assertNewDebtRatio(@Nullable Double valuePeriod1, @Nullable Double valuePeriod2) {
- Resource newTechnicalDebt = getFileResourceWithVariations(NEW_DEBT_RATIO_METRIC_KEY);
- List<Measure> measures = newTechnicalDebt.getMeasures();
- assertThat(measures.get(0).getVariation1()).isEqualTo(valuePeriod1, within(0.01));
- assertThat(measures.get(0).getVariation2()).isEqualTo(valuePeriod2, within(0.01));
- }
-
- private void setSampleProjectQualityProfile(String qualityProfileKey) {
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", qualityProfileKey);
- }
-
- private void provisionSampleProject() {
- orchestrator.getServer().provisionProject("sample", "sample");
- }
-
- private void defineQualityProfile(String qualityProfileKey) {
- orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/measure/suite/" + qualityProfileKey + ".xml"));
- }
-
- private void runSampleProjectAnalysis(String projectVersion, String... properties) {
- ItUtils.runVerboseProjectAnalysis(
- NewDebtRatioMeasureTest.orchestrator,
- "measure/xoo-new-debt-ratio-" + projectVersion,
- ItUtils.concat(properties,
- // disable standard scm support so that it does not interfere with Xoo Scm sensor
- "sonar.scm.disabled", "false")
- );
- }
-
- private Resource getFileResourceWithVariations(String metricKey) {
- return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample:src/main/xoo/sample/Sample.xoo", metricKey).setIncludeTrends(true));
- }
-
-}
+++ /dev/null
-package analysis.suite.measure;
-
-import analysis.suite.AnalysisTestSuite;
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.locator.FileLocation;
-import java.util.List;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.wsclient.services.Measure;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-import util.ItUtils;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-
-/**
- * SONAR-4776
- */
-public class TechnicalDebtMeasureVariationTest {
-
- @ClassRule
- public static Orchestrator orchestrator = AnalysisTestSuite.ORCHESTRATOR;
-
- @Before
- public void cleanUpAnalysisData() {
- orchestrator.resetData();
- }
-
- @Test
- public void new_technical_debt_measures_from_new_issues() throws Exception {
- // This test assumes that period 1 is "since previous analysis" and 2 is "over x days"
-
- // Execute an analysis in the past to have a past snapshot without any issues
- provisionSampleProject();
- setSampleProjectQualityProfile("empty");
- runSampleProjectAnalysis("sonar.projectDate", "2013-01-01");
-
- // Second analysis -> issues will be created
- defineQualityProfile("one-issue-per-line");
- setSampleProjectQualityProfile("one-issue-per-line");
- runSampleProjectAnalysis();
-
- // New technical debt only comes from new issues
- Resource newTechnicalDebt = getSampleProjectResourceWithVariations("new_technical_debt");
- List<Measure> measures = newTechnicalDebt.getMeasures();
- assertThat(measures.get(0).getVariation1()).isEqualTo(17);
- assertThat(measures.get(0).getVariation2()).isEqualTo(17);
-
- // Third analysis, with exactly the same profile -> no new issues so no new technical debt
- runSampleProjectAnalysis();
-
- newTechnicalDebt = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample:src/main/xoo/sample/Sample.xoo", "new_technical_debt").setIncludeTrends(true));
-
- // No variation => measure is purged
- assertThat(newTechnicalDebt).isNull();
- }
-
- @Test
- public void new_technical_debt_measures_from_technical_debt_update_since_previous_analysis() throws Exception {
- // This test assumes that period 1 is "since previous analysis"
-
- // Execute twice analysis
- defineQualityProfile("one-issue-per-file");
- provisionSampleProject();
- setSampleProjectQualityProfile("one-issue-per-file");
- runSampleProjectAnalysis();
- runSampleProjectAnalysis();
-
- // Third analysis, existing issues on OneIssuePerFile will have their technical debt updated with the effort to fix
- runSampleProjectAnalysis("sonar.oneIssuePerFile.effortToFix", "10");
-
- Resource newTechnicalDebt = getSampleProjectResourceWithVariations("new_technical_debt");
- List<Measure> measures = newTechnicalDebt.getMeasures();
- assertThat(measures.get(0).getVariation1()).isEqualTo(90);
-
- // Fourth analysis, with exactly the same profile -> no new issues so no new technical debt since previous analysis
- runSampleProjectAnalysis("sonar.oneIssuePerFile.effortToFix", "10");
-
- newTechnicalDebt = getSampleProjectResourceWithVariations("new_technical_debt");
- measures = newTechnicalDebt.getMeasures();
- assertThat(measures.get(0).getVariation1()).isEqualTo(0);
- }
-
- @Test
- public void new_technical_debt_measures_from_technical_debt_update_since_30_days() throws Exception {
- // This test assumes that period 2 is "over x days"
-
- // Execute an analysis in the past to have a past snapshot without any issues
- provisionSampleProject();
- setSampleProjectQualityProfile("empty");
- runSampleProjectAnalysis("sonar.projectDate", "2013-01-01");
-
- // Second analysis -> issues will be created
- String profileXmlFile = "one-issue-per-file";
- defineQualityProfile(profileXmlFile);
- setSampleProjectQualityProfile("one-issue-per-file");
- runSampleProjectAnalysis();
-
- // Third analysis, existing issues on OneIssuePerFile will have their technical debt updated with the effort to fix
- runSampleProjectAnalysis("sonar.oneIssuePerFile.effortToFix", "10");
-
- Resource newTechnicalDebt = getSampleProjectResourceWithVariations("new_technical_debt");
- List<Measure> measures = newTechnicalDebt.getMeasures();
- assertThat(measures.get(0).getVariation2()).isEqualTo(90);
-
- // Fourth analysis, with exactly the same profile -> no new issues so no new technical debt since previous analysis but still since 30 days
- runSampleProjectAnalysis("sonar.oneIssuePerFile.effortToFix", "10");
-
- newTechnicalDebt = getSampleProjectResourceWithVariations("new_technical_debt");
- measures = newTechnicalDebt.getMeasures();
- assertThat(measures.get(0).getVariation2()).isEqualTo(90);
- }
-
- /**
- * SONAR-5059
- */
- @Test
- public void new_technical_debt_measures_should_never_be_negative() throws Exception {
- // This test assumes that period 1 is "since previous analysis" and 2 is "over x days"
-
- // Execute an analysis with a big effort to fix
- defineQualityProfile("one-issue-per-file");
- provisionSampleProject();
- setSampleProjectQualityProfile("one-issue-per-file");
- runSampleProjectAnalysis("sonar.oneIssuePerFile.effortToFix", "100");
-
- // Execute a second analysis with a smaller effort to fix -> Added technical debt should be 0, not negative
- runSampleProjectAnalysis("sonar.oneIssuePerFile.effortToFix", "10");
-
- Resource newTechnicalDebt = getSampleProjectResourceWithVariations("new_technical_debt");
- assertThat(newTechnicalDebt).isNull();
- }
-
- private void setSampleProjectQualityProfile(String qualityProfileKey) {
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", qualityProfileKey);
- }
-
- private void provisionSampleProject() {
- orchestrator.getServer().provisionProject("sample", "sample");
- }
-
- private void defineQualityProfile(String qualityProfileKey) {
- orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/measure/suite/" + qualityProfileKey + ".xml"));
- }
-
- private void runSampleProjectAnalysis(String... properties) {
- ItUtils.runVerboseProjectAnalysis(TechnicalDebtMeasureVariationTest.orchestrator, "shared/xoo-sample", properties);
- }
-
- private Resource getSampleProjectResourceWithVariations(String metricKey) {
- return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample:src/main/xoo/sample/Sample.xoo", metricKey).setIncludeTrends(true));
- }
-
-}
-
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package analysis.suite.measure;
-
-import analysis.suite.AnalysisTestSuite;
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.BuildResult;
-import com.sonar.orchestrator.build.SonarRunner;
-import com.sonar.orchestrator.locator.FileLocation;
-import java.util.Date;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-import org.sonar.wsclient.services.TimeMachine;
-import org.sonar.wsclient.services.TimeMachineCell;
-import org.sonar.wsclient.services.TimeMachineQuery;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static util.ItUtils.projectDir;
-
-public class TimeMachineTest {
-
- private static final String PROJECT = "sample";
-
- @ClassRule
- public static Orchestrator orchestrator = AnalysisTestSuite.ORCHESTRATOR;
-
- @BeforeClass
- public static void initialize() {
- orchestrator.resetData();
- orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/measure/suite/TimeMachineTest/one-issue-per-line-profile.xml"));
- orchestrator.getServer().provisionProject("sample", "Sample");
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
- analyzeProject("measure/xoo-history-v1", "2014-10-19");
- analyzeProject("measure/xoo-history-v2", "2014-11-13");
- }
-
- private static BuildResult analyzeProject(String path, String date) {
- return orchestrator.executeBuild(SonarRunner.create(projectDir(path), "sonar.projectDate", date));
- }
-
- @Test
- public void projectIsAnalyzed() {
- assertThat(orchestrator.getServer().getWsClient().find(new ResourceQuery(PROJECT)).getVersion()).isEqualTo("1.0-SNAPSHOT");
- assertThat(orchestrator.getServer().getWsClient().find(new ResourceQuery(PROJECT)).getDate().getMonth()).isEqualTo(10); // November
- }
-
- @Test
- public void testHistoryOfIssues() {
- TimeMachineQuery query = TimeMachineQuery.createForMetrics(PROJECT, "blocker_violations", "critical_violations", "major_violations",
- "minor_violations", "info_violations");
- TimeMachine timemachine = orchestrator.getServer().getWsClient().find(query);
- assertThat(timemachine.getCells().length).isEqualTo(2);
-
- TimeMachineCell cell1 = timemachine.getCells()[0];
- TimeMachineCell cell2 = timemachine.getCells()[1];
-
- assertThat(cell1.getDate().getMonth()).isEqualTo(9);
- assertThat(cell1.getValues()).isEqualTo(new Object[] {0L, 0L, 0L, 26L, 0L});
-
- assertThat(cell2.getDate().getMonth()).isEqualTo(10);
- assertThat(cell2.getValues()).isEqualTo(new Object[] {0L, 0L, 0L, 43L, 0L});
- }
-
- @Test
- public void testHistoryOfMeasures() {
- TimeMachineQuery query = TimeMachineQuery.createForMetrics(PROJECT, "lines", "ncloc");
- TimeMachine timemachine = orchestrator.getServer().getWsClient().find(query);
- assertThat(timemachine.getCells().length).isEqualTo(2);
-
- TimeMachineCell cell1 = timemachine.getCells()[0];
- TimeMachineCell cell2 = timemachine.getCells()[1];
-
- assertThat(cell1.getDate().getMonth()).isEqualTo(9);
- assertThat(cell1.getValues()).isEqualTo(new Object[] {26L, 24L});
-
- assertThat(cell2.getDate().getMonth()).isEqualTo(10);
- assertThat(cell2.getValues()).isEqualTo(new Object[] {43L, 40L});
- }
-
- @Test
- public void unknownMetrics() {
- TimeMachine timemachine = orchestrator.getServer().getWsClient().find(TimeMachineQuery.createForMetrics(PROJECT, "notfound"));
- assertThat(timemachine.getCells().length).isEqualTo(0);
-
- timemachine = orchestrator.getServer().getWsClient().find(TimeMachineQuery.createForMetrics(PROJECT, "lines", "notfound"));
- assertThat(timemachine.getCells().length).isEqualTo(2);
- for (TimeMachineCell cell : timemachine.getCells()) {
- assertThat(cell.getValues().length).isEqualTo(1);
- assertThat(cell.getValues()[0]).isInstanceOf(Long.class);
- }
-
- timemachine = orchestrator.getServer().getWsClient().find(TimeMachineQuery.createForMetrics(PROJECT));
- assertThat(timemachine.getCells().length).isEqualTo(0);
- }
-
- @Test
- public void noDataForInterval() {
- Date now = new Date();
- TimeMachine timemachine = orchestrator.getServer().getWsClient().find(TimeMachineQuery.createForMetrics(PROJECT, "lines").setFrom(now).setTo(now));
- assertThat(timemachine.getCells().length).isEqualTo(0);
- }
-
- @Test
- public void unknownResource() {
- TimeMachine timemachine = orchestrator.getServer().getWsClient().find(TimeMachineQuery.createForMetrics("notfound:notfound", "lines"));
- assertThat(timemachine).isNull();
- }
-
- @Test
- public void test_measure_variations() {
- Resource project = getProject("files", "ncloc", "violations");
-
- // period 1 : previous analysis
- assertThat(project.getPeriod1Mode()).isEqualTo("previous_analysis");
- assertThat(project.getPeriod1Date()).isNotNull();
-
- // variations from previous analysis
- assertThat(project.getMeasure("files").getVariation1()).isEqualTo(1.0);
- assertThat(project.getMeasure("ncloc").getVariation1()).isEqualTo(16.0);
- assertThat(project.getMeasure("violations").getVariation1()).isGreaterThan(0.0);
- }
-
- /**
- * SONAR-4962
- */
- @Test
- public void measure_variations_are_only_meaningful_when_includetrends() {
- String[] metricKeys = {"violations", "new_violations"};
-
- Resource projectWithTrends = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT, metricKeys).setIncludeTrends(true));
- assertThat(projectWithTrends.getMeasure("violations")).isNotNull();
- assertThat(projectWithTrends.getMeasure("new_violations")).isNotNull();
-
- Resource projectWithoutTrends = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT, metricKeys).setIncludeTrends(false));
- assertThat(projectWithoutTrends.getMeasure("violations")).isNotNull();
- assertThat(projectWithoutTrends.getMeasure("new_violations")).isNull();
- }
-
- private Resource getProject(String... metricKeys) {
- return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT, metricKeys).setIncludeTrends(true));
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package analysis.suite.testing;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.SonarRunner;
-import java.io.File;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.io.filefilter.TrueFileFilter;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.skyscreamer.jsonassert.JSONAssert;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-
-import static analysis.suite.AnalysisTestSuite.ORCHESTRATOR;
-import static org.assertj.core.api.Assertions.assertThat;
-import static util.ItUtils.projectDir;
-
-public class CoverageTest {
-
- @ClassRule
- public static Orchestrator orchestrator = ORCHESTRATOR;
-
- private static final String[] ALL_COVERAGE_METRICS = new String[] {
- "line_coverage", "lines_to_cover", "uncovered_lines", "branch_coverage", "conditions_to_cover", "uncovered_conditions", "coverage",
- "it_line_coverage", "it_lines_to_cover", "it_uncovered_lines", "it_branch_coverage", "it_conditions_to_cover", "it_uncovered_conditions", "it_coverage",
- "overall_line_coverage", "overall_lines_to_cover", "overall_uncovered_lines", "overall_branch_coverage", "overall_conditions_to_cover", "overall_uncovered_conditions",
- "overall_coverage"
- };
-
- @Before
- public void delete_data() {
- orchestrator.resetData();
- }
-
- @Test
- public void unit_test_coverage() throws Exception {
- orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-ut-coverage")));
-
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample-ut-coverage", ALL_COVERAGE_METRICS));
- assertThat(project.getMeasureValue("line_coverage")).isEqualTo(50.0);
- assertThat(project.getMeasureValue("lines_to_cover")).isEqualTo(4);
- assertThat(project.getMeasureValue("uncovered_lines")).isEqualTo(2);
- assertThat(project.getMeasureValue("branch_coverage")).isEqualTo(50.0);
- assertThat(project.getMeasureValue("conditions_to_cover")).isEqualTo(2);
- assertThat(project.getMeasureValue("uncovered_conditions")).isEqualTo(1);
- assertThat(project.getMeasureValue("coverage")).isEqualTo(50.0);
-
- assertThat(project.getMeasureValue("it_coverage")).isNull();
-
- assertThat(project.getMeasureValue("overall_coverage")).isNull();
-
- String coverage = orchestrator.getServer().adminWsClient().get("api/sources/lines", "key", "sample-ut-coverage:src/main/xoo/sample/Sample.xoo");
- JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("/testing/suite/CoverageTest/unit_test_coverage-expected.json"), "UTF-8"), coverage, false);
-
- verifyComputeEngineTempDirIsEmpty();
- }
-
- @Test
- public void unit_test_coverage_no_condition() throws Exception {
- orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-ut-coverage-no-condition")));
-
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample-ut-coverage", ALL_COVERAGE_METRICS));
- assertThat(project.getMeasureValue("line_coverage")).isEqualTo(50.0);
- assertThat(project.getMeasureValue("lines_to_cover")).isEqualTo(4);
- assertThat(project.getMeasureValue("uncovered_lines")).isEqualTo(2);
- assertThat(project.getMeasureValue("branch_coverage")).isNull();
- assertThat(project.getMeasureValue("conditions_to_cover")).isNull();
- assertThat(project.getMeasureValue("uncovered_conditions")).isNull();
- assertThat(project.getMeasureValue("coverage")).isEqualTo(50.0);
-
- assertThat(project.getMeasureValue("it_coverage")).isNull();
-
- assertThat(project.getMeasureValue("overall_coverage")).isNull();
-
- String coverage = orchestrator.getServer().adminWsClient().get("api/sources/lines", "key", "sample-ut-coverage:src/main/xoo/sample/Sample.xoo");
- JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("/testing/suite/CoverageTest/unit_test_coverage_no_condition-expected.json"), "UTF-8"), coverage, false);
-
- verifyComputeEngineTempDirIsEmpty();
- }
-
- @Test
- public void it_coverage() throws Exception {
- orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-it-coverage")));
-
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample-it-coverage", ALL_COVERAGE_METRICS));
- assertThat(project.getMeasureValue("coverage")).isNull();
-
- assertThat(project.getMeasureValue("it_line_coverage")).isEqualTo(50.0);
- assertThat(project.getMeasureValue("it_lines_to_cover")).isEqualTo(4);
- assertThat(project.getMeasureValue("it_uncovered_lines")).isEqualTo(2);
- assertThat(project.getMeasureValue("it_branch_coverage")).isEqualTo(50.0);
- assertThat(project.getMeasureValue("it_conditions_to_cover")).isEqualTo(2);
- assertThat(project.getMeasureValue("it_uncovered_conditions")).isEqualTo(1);
- assertThat(project.getMeasureValue("it_coverage")).isEqualTo(50.0);
-
- assertThat(project.getMeasureValue("overall_coverage")).isNull();
-
- String coverage = orchestrator.getServer().adminWsClient().get("api/sources/lines", "key", "sample-it-coverage:src/main/xoo/sample/Sample.xoo");
- JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("/testing/suite/CoverageTest/it_coverage-expected.json"), "UTF-8"), coverage, false);
-
- verifyComputeEngineTempDirIsEmpty();
- }
-
- @Test
- public void ut_and_it_coverage() throws Exception {
- orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-overall-coverage")));
-
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample-overall-coverage", ALL_COVERAGE_METRICS));
- assertThat(project.getMeasureValue("line_coverage")).isEqualTo(50.0);
- assertThat(project.getMeasureValue("lines_to_cover")).isEqualTo(4);
- assertThat(project.getMeasureValue("uncovered_lines")).isEqualTo(2);
- assertThat(project.getMeasureValue("branch_coverage")).isEqualTo(25.0);
- assertThat(project.getMeasureValue("conditions_to_cover")).isEqualTo(4);
- assertThat(project.getMeasureValue("uncovered_conditions")).isEqualTo(3);
- assertThat(project.getMeasureValue("coverage")).isEqualTo(37.5);
-
- assertThat(project.getMeasureValue("it_line_coverage")).isEqualTo(50.0);
- assertThat(project.getMeasureValue("it_lines_to_cover")).isEqualTo(4);
- assertThat(project.getMeasureValue("it_uncovered_lines")).isEqualTo(2);
- assertThat(project.getMeasureValue("it_branch_coverage")).isEqualTo(25.0);
- assertThat(project.getMeasureValue("it_conditions_to_cover")).isEqualTo(4);
- assertThat(project.getMeasureValue("it_uncovered_conditions")).isEqualTo(3);
- assertThat(project.getMeasureValue("it_coverage")).isEqualTo(37.5);
-
- assertThat(project.getMeasureValue("overall_line_coverage")).isEqualTo(75.0);
- assertThat(project.getMeasureValue("overall_lines_to_cover")).isEqualTo(4);
- assertThat(project.getMeasureValue("overall_uncovered_lines")).isEqualTo(1);
- assertThat(project.getMeasureValue("overall_branch_coverage")).isEqualTo(50.0);
- assertThat(project.getMeasureValue("overall_conditions_to_cover")).isEqualTo(4);
- assertThat(project.getMeasureValue("overall_uncovered_conditions")).isEqualTo(2);
- assertThat(project.getMeasureValue("overall_coverage")).isEqualTo(62.5);
-
- String coverage = orchestrator.getServer().adminWsClient().get("api/sources/lines", "key", "sample-overall-coverage:src/main/xoo/sample/Sample.xoo");
- JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("/testing/suite/CoverageTest/ut_and_it_coverage-expected.json"), "UTF-8"), coverage, false);
-
- verifyComputeEngineTempDirIsEmpty();
- }
-
- /**
- * SONAR-766
- */
- @Test
- public void should_compute_coverage_on_project() {
- orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-half-covered")));
-
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("xoo-half-covered", ALL_COVERAGE_METRICS));
- assertThat(project.getMeasureValue("coverage")).isEqualTo(50.0);
-
- verifyComputeEngineTempDirIsEmpty();
- }
-
- /**
- * SONAR-766
- */
- @Test
- public void should_ignore_coverage_on_full_path() {
- orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-half-covered"))
- .setProperty("sonar.coverage.exclusions", "src/main/xoo/org/sonar/tests/halfcovered/UnCovered.xoo"));
-
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("xoo-half-covered", ALL_COVERAGE_METRICS));
- assertThat(project.getMeasureValue("coverage")).isEqualTo(100.0);
-
- verifyComputeEngineTempDirIsEmpty();
- }
-
- /**
- * SONAR-766
- */
- @Test
- public void should_ignore_coverage_on_pattern() {
- orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-half-covered"))
- .setProperty("sonar.coverage.exclusions", "**/UnCovered*"));
-
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("xoo-half-covered", ALL_COVERAGE_METRICS));
- assertThat(project.getMeasureValue("coverage")).isEqualTo(100.0);
-
- verifyComputeEngineTempDirIsEmpty();
- }
-
- /**
- * SONAR-766
- */
- @Test
- public void should_not_have_coverage_at_all() {
- orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-half-covered"))
- .setProperty("sonar.coverage.exclusions", "**/*"));
-
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("xoo-half-covered", ALL_COVERAGE_METRICS));
- assertThat(project.getMeasureValue("coverage")).isNull();
-
- verifyComputeEngineTempDirIsEmpty();
- }
-
- private void verifyComputeEngineTempDirIsEmpty() {
- File ceTempDirectory = new File(new File(orchestrator.getServer().getHome(), "temp"), "ce");
- assertThat(FileUtils.listFiles(ceTempDirectory, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE)).isEmpty();
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package analysis.suite.testing;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.SonarRunner;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.apache.commons.io.IOUtils;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.skyscreamer.jsonassert.JSONAssert;
-
-import static analysis.suite.AnalysisTestSuite.ORCHESTRATOR;
-import static util.ItUtils.projectDir;
-
-public class CoverageTrackingTest {
-
- @ClassRule
- public static Orchestrator orchestrator = ORCHESTRATOR;
-
- @Before
- public void delete_data() {
- orchestrator.resetData();
- }
-
- @Test
- public void test_coverage_per_test() throws Exception {
- orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-with-coverage-per-test")));
-
- String tests = orchestrator.getServer().adminWsClient().get("api/tests/list", "testFileKey", "sample-with-tests:src/test/xoo/sample/SampleTest.xoo");
- JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("/testing/suite/CoverageTrackingTest/tests-expected.json"), "UTF-8"), tests, false);
-
- String covered_files = orchestrator.getServer().adminWsClient()
- .get("api/tests/covered_files", "testId", extractSuccessfulTestId(tests));
- JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("/testing/suite/CoverageTrackingTest/covered_files-expected.json"), "UTF-8"), covered_files, false);
- }
-
- private String extractSuccessfulTestId(String json) {
- Matcher jsonObjectMatcher = Pattern.compile(".*\\{((.*?)success(.*?))\\}.*", Pattern.MULTILINE).matcher(json);
- jsonObjectMatcher.find();
-
- Matcher idMatcher = Pattern.compile(".*\"id\"\\s*?:\\s*?\"(\\S*?)\".*", Pattern.MULTILINE).matcher(jsonObjectMatcher.group(1));
- return idMatcher.find() ? idMatcher.group(1) : "";
- }
-}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package analysis.suite.testing;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.SonarRunner;
-import org.assertj.core.data.Offset;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-
-import static analysis.suite.AnalysisTestSuite.ORCHESTRATOR;
-import static org.assertj.core.api.Assertions.assertThat;
-import static util.ItUtils.projectDir;
-
-public class NewCoverageTest {
-
- @ClassRule
- public static Orchestrator orchestrator = ORCHESTRATOR;
-
- private static final String PROJECT_KEY = "sample-new-coverage";
-
- private static final Offset<Double> DEFAULT_OFFSET = Offset.offset(0.1d);
-
- private static final String[] ALL_NEW_COVERAGE_METRICS = new String[] {
- "new_coverage", "new_line_coverage", "new_branch_coverage",
- "new_it_coverage", "new_it_line_coverage", "new_it_branch_coverage",
- "new_overall_coverage", "new_overall_line_coverage", "new_overall_branch_coverage"
- };
-
- @BeforeClass
- public static void analyze_project() {
- orchestrator.resetData();
-
- orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-new-coverage-v1"))
- .setProperty("sonar.projectDate", "2015-02-01")
- .setProperty("sonar.scm.disabled", "false")
- );
- orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-new-coverage-v2"))
- .setProperty("sonar.scm.disabled", "false"));
- }
-
- @Test
- public void new_unit_test_coverage() throws Exception {
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT_KEY, ALL_NEW_COVERAGE_METRICS).setIncludeTrends(true));
- assertThat(project.getMeasure("new_coverage").getVariation1()).isEqualTo(62.5d, DEFAULT_OFFSET);
- assertThat(project.getMeasure("new_line_coverage").getVariation1()).isEqualTo(80d, DEFAULT_OFFSET);
- assertThat(project.getMeasure("new_branch_coverage").getVariation1()).isEqualTo(33.3, DEFAULT_OFFSET);
- }
-
- @Test
- public void new_integration_test_coverage() throws Exception {
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT_KEY, ALL_NEW_COVERAGE_METRICS).setIncludeTrends(true));
- assertThat(project.getMeasure("new_it_coverage").getVariation1()).isEqualTo(85.7, DEFAULT_OFFSET);
- assertThat(project.getMeasure("new_it_line_coverage").getVariation1()).isEqualTo(100d, DEFAULT_OFFSET);
- assertThat(project.getMeasure("new_it_branch_coverage").getVariation1()).isEqualTo(66.7, DEFAULT_OFFSET);
- }
-
- @Test
- public void new_overall_coverage() throws Exception {
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT_KEY, ALL_NEW_COVERAGE_METRICS).setIncludeTrends(true));
- assertThat(project.getMeasure("new_overall_coverage").getVariation1()).isEqualTo(44.4d, DEFAULT_OFFSET);
- assertThat(project.getMeasure("new_overall_line_coverage").getVariation1()).isEqualTo(50d, DEFAULT_OFFSET);
- assertThat(project.getMeasure("new_overall_branch_coverage").getVariation1()).isEqualTo(42.85, DEFAULT_OFFSET);
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package analysis.suite.testing;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.SonarRunner;
-import org.apache.commons.io.IOUtils;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.skyscreamer.jsonassert.JSONAssert;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-
-import static analysis.suite.AnalysisTestSuite.ORCHESTRATOR;
-import static org.assertj.core.api.Assertions.assertThat;
-import static util.ItUtils.projectDir;
-
-public class TestExecutionTest {
-
- @ClassRule
- public static Orchestrator orchestrator = ORCHESTRATOR;
-
- @Before
- public void delete_data() {
- orchestrator.resetData();
- }
-
- @Test
- public void test_execution() throws Exception {
- orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-with-tests-execution")));
-
- Resource project = orchestrator.getServer().getWsClient()
- .find(ResourceQuery.createForMetrics("sample-with-tests", "test_success_density", "test_failures", "test_errors", "tests", "skipped_tests", "test_execution_time"));
- assertThat(project.getMeasureValue("test_success_density")).isEqualTo(50.0);
- assertThat(project.getMeasureIntValue("test_failures")).isEqualTo(1);
- assertThat(project.getMeasureIntValue("test_errors")).isEqualTo(1);
- assertThat(project.getMeasureIntValue("tests")).isEqualTo(4);
- assertThat(project.getMeasureIntValue("skipped_tests")).isEqualTo(1);
- assertThat(project.getMeasureIntValue("test_execution_time")).isEqualTo(8);
-
- String json = orchestrator.getServer().adminWsClient().get("api/tests/list", "testFileKey", "sample-with-tests:src/test/xoo/sample/SampleTest.xoo");
- JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("/testing/suite/TestExecutionTest/expected.json"), "UTF-8"), json, false);
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package batch.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.BuildFailureException;
-import com.sonar.orchestrator.build.BuildResult;
-import com.sonar.orchestrator.build.SonarRunner;
-import com.sonar.orchestrator.locator.FileLocation;
-import java.io.File;
-import java.io.IOException;
-import java.util.Date;
-import org.apache.commons.io.FileUtils;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.rules.TemporaryFolder;
-import org.sonar.wsclient.Sonar;
-import org.sonar.wsclient.services.PropertyDeleteQuery;
-import org.sonar.wsclient.services.PropertyUpdateQuery;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-import util.ItUtils;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class BatchTest {
-
- @ClassRule
- public static Orchestrator orchestrator = BatchTestSuite.ORCHESTRATOR;
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Rule
- public TemporaryFolder temp = new TemporaryFolder();
-
- @Before
- public void deleteData() {
- orchestrator.resetData();
- orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/batch/BatchTest/one-issue-per-line.xml"));
- }
-
- /**
- * SONAR-3718
- */
- @Test
- public void should_scan_branch_with_forward_slash() {
- scan("shared/xoo-multi-modules-sample");
- scan("shared/xoo-multi-modules-sample", "sonar.branch", "branch/0.x");
-
- Sonar sonar = orchestrator.getServer().getWsClient();
- assertThat(sonar.findAll(new ResourceQuery().setQualifiers("TRK"))).hasSize(2);
-
- Resource master = sonar.find(new ResourceQuery("com.sonarsource.it.samples:multi-modules-sample"));
- assertThat(master.getName()).isEqualTo("Sonar :: Integration Tests :: Multi-modules Sample");
-
- Resource branch = sonar.find(new ResourceQuery("com.sonarsource.it.samples:multi-modules-sample:branch/0.x"));
- assertThat(branch.getName()).isEqualTo("Sonar :: Integration Tests :: Multi-modules Sample branch/0.x");
- }
-
- @Test
- public void use_sonar_profile_without_provisioning_project() {
- scan("shared/xoo-multi-modules-sample",
- "sonar.profile", "one-issue-per-line",
- "sonar.verbose", "true");
- Resource r = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("com.sonarsource.it.samples:multi-modules-sample", "violations"));
- assertThat(r.getMeasureIntValue("violations")).isEqualTo(61);
- }
-
- /**
- * SONAR-2907
- */
- @Test
- public void branch_should_load_own_settings_from_database() {
- orchestrator.getServer().provisionProject("com.sonarsource.it.samples:multi-modules-sample", "Sonar :: Integration Tests :: Multi-modules Sample");
- orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-sample", "xoo", "one-issue-per-line");
- scan("shared/xoo-multi-modules-sample");
- assertThat(getResource("com.sonarsource.it.samples:multi-modules-sample:module_b")).isNotNull();
-
- Sonar sonar = orchestrator.getServer().getAdminWsClient();
- // The parameter skippedModule considers key after first colon
- sonar.update(new PropertyUpdateQuery("sonar.skippedModules", "multi-modules-sample:module_b",
- "com.sonarsource.it.samples:multi-modules-sample"));
-
- try {
- scan("shared/xoo-multi-modules-sample");
- assertThat(getResource("com.sonarsource.it.samples:multi-modules-sample:module_b")).isNull();
-
- scan("shared/xoo-multi-modules-sample",
- "sonar.branch", "mybranch");
-
- assertThat(getResource("com.sonarsource.it.samples:multi-modules-sample:module_b:mybranch")).isNotNull();
- } finally {
- sonar.delete(new PropertyDeleteQuery("sonar.skippedModules", "com.sonarsource.it.samples:multi-modules-sample"));
- }
- }
-
- // SONAR-4680
- @Test
- public void module_should_load_own_settings_from_database() {
- orchestrator.getServer().provisionProject("com.sonarsource.it.samples:multi-modules-sample", "Sonar :: Integration Tests :: Multi-modules Sample");
-
- Sonar sonar = orchestrator.getServer().getAdminWsClient();
- String propKey = "myFakeProperty";
- String rootModuleKey = "com.sonarsource.it.samples:multi-modules-sample";
- String moduleBKey = rootModuleKey + ":module_b";
- sonar.delete(new PropertyDeleteQuery(propKey, rootModuleKey));
- sonar.delete(new PropertyDeleteQuery(propKey, moduleBKey));
-
- BuildResult result = scan("shared/xoo-multi-modules-sample", "sonar.showSettings", propKey);
-
- assertThat(result.getLogs()).doesNotContain(rootModuleKey + ":" + propKey);
- assertThat(result.getLogs()).doesNotContain(moduleBKey + ":" + propKey);
-
- // Set property only on root project
- sonar.update(new PropertyUpdateQuery(propKey, "project", rootModuleKey));
-
- result = scan("shared/xoo-multi-modules-sample", "sonar.showSettings", propKey);
-
- assertThat(result.getLogs()).contains(rootModuleKey + ":" + propKey + " = project");
- assertThat(result.getLogs()).contains(moduleBKey + ":" + propKey + " = project");
-
- // Override property on moduleB
- sonar.update(new PropertyUpdateQuery(propKey, "moduleB", moduleBKey));
-
- result = scan("shared/xoo-multi-modules-sample", "sonar.showSettings", propKey);
-
- assertThat(result.getLogs()).contains(rootModuleKey + ":" + propKey + " = project");
- assertThat(result.getLogs()).contains(moduleBKey + ":" + propKey + " = moduleB");
- }
-
- // SONAR-4680
- @Test
- public void module_should_load_settings_from_parent() {
- orchestrator.getServer().provisionProject("com.sonarsource.it.samples:multi-modules-sample", "Sonar :: Integration Tests :: Multi-modules Sample");
-
- Sonar sonar = orchestrator.getServer().getAdminWsClient();
- String propKey = "myFakeProperty";
- String rootModuleKey = "com.sonarsource.it.samples:multi-modules-sample";
- String moduleBKey = rootModuleKey + ":module_b";
-
- // Set property on provisionned project
- sonar.update(new PropertyUpdateQuery(propKey, "project", rootModuleKey));
- sonar.delete(new PropertyDeleteQuery(propKey, moduleBKey));
-
- BuildResult result = scan("shared/xoo-multi-modules-sample", "sonar.showSettings", propKey);
-
- assertThat(result.getLogs()).contains(rootModuleKey + ":" + propKey + " = project");
- // Module should inherit from parent
- assertThat(result.getLogs()).contains(moduleBKey + ":" + propKey + " = project");
- }
-
- /**
- * SONAR-3116
- */
- @Test
- public void should_not_exclude_root_module() {
- orchestrator.getServer().provisionProject("com.sonarsource.it.samples:multi-modules-sample", "Sonar :: Integration Tests :: Multi-modules Sample");
- orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-sample", "xoo", "one-issue-per-line");
-
- thrown.expect(BuildFailureException.class);
- scan("shared/xoo-multi-modules-sample",
- "sonar.skippedModules", "multi-modules-sample");
- }
-
- /**
- * SONAR-3024
- */
- @Test
- public void should_support_source_files_with_same_deprecated_key() {
- orchestrator.getServer().provisionProject("com.sonarsource.it.projects.batch:duplicate-source", "exclusions");
- orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.projects.batch:duplicate-source", "xoo", "one-issue-per-line");
- scan("batch/duplicate-source");
-
- Sonar sonar = orchestrator.getServer().getAdminWsClient();
- Resource project = sonar.find(new ResourceQuery("com.sonarsource.it.projects.batch:duplicate-source").setMetrics("files", "directories"));
- // 2 main files and 1 test file all with same deprecated key
- assertThat(project.getMeasureIntValue("files")).isEqualTo(2);
- assertThat(project.getMeasureIntValue("directories")).isEqualTo(3);
- }
-
- /**
- * SONAR-3125
- */
- @Test
- public void should_display_explicit_message_when_no_plugin_language_available() {
- orchestrator.getServer().provisionProject("sample", "xoo-sample");
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
-
- BuildResult buildResult = scanQuietly("shared/xoo-sample",
- "sonar.language", "foo",
- "sonar.profile", "");
- assertThat(buildResult.getStatus()).isEqualTo(1);
- assertThat(buildResult.getLogs()).contains(
- "You must install a plugin that supports the language 'foo'");
- }
-
- @Test
- public void should_display_explicit_message_when_wrong_profile() {
- orchestrator.getServer().provisionProject("sample", "xoo-sample");
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
-
- BuildResult buildResult = scanQuietly("shared/xoo-sample",
- "sonar.profile", "unknow");
- assertThat(buildResult.getStatus()).isEqualTo(1);
- assertThat(buildResult.getLogs()).contains(
- "sonar.profile was set to 'unknow' but didn't match any profile for any language. Please check your configuration.");
- }
-
- @Test
- public void should_honor_sonarUserHome() {
- File userHome = temp.getRoot();
-
- orchestrator.getServer().provisionProject("sample", "xoo-sample");
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
-
- SonarRunner runner = configureRunner("shared/xoo-sample",
- "sonar.verbose", "true");
- runner.setEnvironmentVariable("SONAR_USER_HOME", "/dev/null");
- BuildResult buildResult = orchestrator.executeBuildQuietly(runner);
- assertThat(buildResult.getStatus()).isEqualTo(1);
-
- buildResult = scan("shared/xoo-sample",
- "sonar.verbose", "true",
- "sonar.userHome", userHome.getAbsolutePath());
- assertThat(buildResult.isSuccess()).isTrue();
- }
-
- @Test
- public void should_authenticate_when_needed() {
- try {
- orchestrator.getServer().provisionProject("sample", "xoo-sample");
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
-
- orchestrator.getServer().getAdminWsClient().update(new PropertyUpdateQuery("sonar.forceAuthentication", "true"));
-
- BuildResult buildResult = scanQuietly("shared/xoo-sample",
- "sonar.login", "",
- "sonar.password", "");
- assertThat(buildResult.getStatus()).isEqualTo(1);
- assertThat(buildResult.getLogs()).contains(
- "Not authorized. Analyzing this project requires to be authenticated. Please provide the values of the properties sonar.login and sonar.password.");
-
- // SONAR-4048
- buildResult = scanQuietly("shared/xoo-sample",
- "sonar.login", "wrong_login",
- "sonar.password", "wrong_password");
- assertThat(buildResult.getStatus()).isEqualTo(1);
- assertThat(buildResult.getLogs()).contains(
- "Not authorized. Please check the properties sonar.login and sonar.password.");
-
- buildResult = scan("shared/xoo-sample",
- "sonar.login", "admin",
- "sonar.password", "admin");
- assertThat(buildResult.getStatus()).isEqualTo(0);
-
- } finally {
- orchestrator.getServer().getAdminWsClient().update(new PropertyUpdateQuery("sonar.forceAuthentication", "false"));
- }
- }
-
- /**
- * SONAR-4211 Test Sonar Runner when server requires authentication
- */
- @Test
- public void sonar_runner_with_secured_server() {
- try {
- orchestrator.getServer().provisionProject("sample", "xoo-sample");
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
-
- orchestrator.getServer().getAdminWsClient().update(new PropertyUpdateQuery("sonar.forceAuthentication", "true"));
-
- BuildResult buildResult = scanQuietly("shared/xoo-sample");
- assertThat(buildResult.getStatus()).isEqualTo(1);
- assertThat(buildResult.getLogs()).contains(
- "Not authorized. Analyzing this project requires to be authenticated. Please provide the values of the properties sonar.login and sonar.password.");
-
- buildResult = scanQuietly("shared/xoo-sample",
- "sonar.login", "wrong_login",
- "sonar.password", "wrong_password");
- assertThat(buildResult.getStatus()).isEqualTo(1);
- assertThat(buildResult.getLogs()).contains(
- "Not authorized. Please check the properties sonar.login and sonar.password.");
-
- buildResult = scan("shared/xoo-sample",
- "sonar.login", "admin",
- "sonar.password", "admin");
- assertThat(buildResult.getStatus()).isEqualTo(0);
-
- } finally {
- orchestrator.getServer().getAdminWsClient().update(new PropertyUpdateQuery("sonar.forceAuthentication", "false"));
- }
- }
-
- /**
- * SONAR-2291
- */
- @Test
- public void batch_should_cache_plugin_jars() throws IOException {
- File userHome = temp.newFolder();
-
- BuildResult result = scan("shared/xoo-sample",
- "sonar.userHome", userHome.getAbsolutePath());
-
- File cache = new File(userHome, "cache");
- assertThat(cache).exists().isDirectory();
- int cachedFiles = FileUtils.listFiles(cache, new String[] {"jar"}, true).size();
- assertThat(cachedFiles).isGreaterThan(5);
- assertThat(result.getLogs()).contains("User cache: " + cache.getAbsolutePath());
- assertThat(result.getLogs()).contains("Download sonar-xoo-plugin-");
-
- result = scan("shared/xoo-sample",
- "sonar.userHome", userHome.getAbsolutePath());
- assertThat(cachedFiles).isEqualTo(cachedFiles);
- assertThat(result.getLogs()).contains("User cache: " + cache.getAbsolutePath());
- assertThat(result.getLogs()).doesNotContain("Download sonar-xoo-plugin-");
- }
-
- /**
- * SONAR-4239
- */
- @Test
- public void should_display_project_url_after_analysis() throws IOException {
- orchestrator.getServer().provisionProject("com.sonarsource.it.samples:multi-modules-sample", "Sonar :: Integration Tests :: Multi-modules Sample");
- orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-sample", "xoo", "one-issue-per-line");
- Assume.assumeTrue(orchestrator.getServer().version().isGreaterThanOrEquals("3.6"));
-
- BuildResult result = scan("shared/xoo-multi-modules-sample");
-
- assertThat(result.getLogs()).contains("/dashboard/index/com.sonarsource.it.samples:multi-modules-sample");
-
- result = scan("shared/xoo-multi-modules-sample",
- "sonar.branch", "mybranch");
-
- assertThat(result.getLogs()).contains("/dashboard/index/com.sonarsource.it.samples:multi-modules-sample:mybranch");
-
- orchestrator.getServer().getAdminWsClient().update(new PropertyUpdateQuery("sonar.core.serverBaseURL", "http://foo:123/sonar"));
-
- result = scan("shared/xoo-multi-modules-sample");
-
- assertThat(result.getLogs()).contains("http://foo:123/sonar/dashboard/index/com.sonarsource.it.samples:multi-modules-sample");
- }
-
- /**
- * SONAR-4188, SONAR-5178, SONAR-5915
- */
- @Test
- public void should_display_explicit_message_when_invalid_project_key_or_branch() {
- orchestrator.getServer().provisionProject("sample", "xoo-sample");
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
-
- BuildResult buildResult = scanQuietly("shared/xoo-sample",
- "sonar.projectKey", "ar g$l:");
- assertThat(buildResult.getStatus()).isEqualTo(1);
- assertThat(buildResult.getLogs()).contains("\"ar g$l:\" is not a valid project or module key")
- .contains("Allowed characters");
-
- // SONAR-4629
- buildResult = scanQuietly("shared/xoo-sample",
- "sonar.projectKey", "12345");
- assertThat(buildResult.getStatus()).isEqualTo(1);
- assertThat(buildResult.getLogs()).contains("\"12345\" is not a valid project or module key")
- .contains("Allowed characters");
-
- buildResult = scanQuietly("shared/xoo-sample",
- "sonar.branch", "ar g$l:");
- assertThat(buildResult.getStatus()).isEqualTo(1);
- assertThat(buildResult.getLogs()).contains("\"ar g$l:\" is not a valid branch")
- .contains("Allowed characters");
- }
-
- /**
- * SONAR-4547
- */
- @Test
- public void display_MessageException_without_stacktrace() throws Exception {
- orchestrator.getServer().provisionProject("sample", "xoo-sample");
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
- BuildResult result = scanQuietly("shared/xoo-sample", "raiseMessageException", "true");
- assertThat(result.getStatus()).isNotEqualTo(0);
- assertThat(result.getLogs())
- // message
- .contains("Error message from plugin")
-
- // but not stacktrace
- .doesNotContain("at com.sonarsource.RaiseMessageException");
- }
-
- /**
- * SONAR-4751
- */
- @Test
- public void file_extensions_are_case_insensitive() throws Exception {
- orchestrator.getServer().provisionProject("case-sensitive-file-extensions", "Case Sensitive");
- orchestrator.getServer().associateProjectToQualityProfile("case-sensitive-file-extensions", "xoo", "one-issue-per-line");
- scan("batch/case-sensitive-file-extensions");
-
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("case-sensitive-file-extensions", "files", "ncloc"));
- assertThat(project.getMeasureIntValue("files")).isEqualTo(2);
- assertThat(project.getMeasureIntValue("ncloc")).isEqualTo(5 + 2);
- }
-
- /**
- * SONAR-4876
- */
- @Test
- public void custom_module_key() {
- orchestrator.getServer().provisionProject("com.sonarsource.it.samples:multi-modules-sample", "Sonar :: Integration Tests :: Multi-modules Sample");
- orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-sample", "xoo", "one-issue-per-line");
- scan("batch/custom-module-key");
- assertThat(getResource("com.sonarsource.it.samples:moduleA")).isNotNull();
- assertThat(getResource("com.sonarsource.it.samples:moduleB")).isNotNull();
- }
-
- /**
- * SONAR-4692
- */
- @Test
- @Ignore("This test should be moved to a Medium test of the Compute Engine")
- public void prevent_same_module_key_in_two_projects() {
- orchestrator.getServer().provisionProject("projectAB", "project AB");
- orchestrator.getServer().associateProjectToQualityProfile("projectAB", "xoo", "one-issue-per-line");
- scan("batch/prevent-common-module/projectAB");
- assertThat(getResource("com.sonarsource.it.samples:moduleA")).isNotNull();
- assertThat(getResource("com.sonarsource.it.samples:moduleB")).isNotNull();
-
- orchestrator.getServer().provisionProject("projectAC", "project AC");
- orchestrator.getServer().associateProjectToQualityProfile("projectAC", "xoo", "one-issue-per-line");
-
- BuildResult result = scanQuietly("batch/prevent-common-module/projectAC");
- assertThat(result.getStatus()).isNotEqualTo(0);
- assertThat(result.getLogs()).contains("Module \"com.sonarsource.it.samples:moduleA\" is already part of project \"projectAB\"");
- }
-
- /**
- * SONAR-4235
- */
- @Test
- public void test_project_creation_date() {
- long before = new Date().getTime() - 2000l;
- orchestrator.getServer().provisionProject("sample", "xoo-sample");
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
- orchestrator.executeBuild(SonarRunner.create(ItUtils.projectDir("shared/xoo-sample")));
- long after = new Date().getTime() + 2000l;
- Resource xooSample = orchestrator.getServer().getWsClient().find(new ResourceQuery().setResourceKeyOrId("sample"));
- assertThat(xooSample.getCreationDate().getTime()).isGreaterThan(before).isLessThan(after);
- }
-
- /**
- * SONAR-4334
- */
- @Test
- @Ignore("Should be move to CE IT/MT")
- public void fail_if_project_date_is_older_than_latest_snapshot() {
- orchestrator.getServer().provisionProject("sample", "xoo-sample");
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
- SonarRunner analysis = SonarRunner.create(ItUtils.projectDir("shared/xoo-sample"));
- analysis.setProperty("sonar.projectDate", "2014-01-01");
- orchestrator.executeBuild(analysis);
-
- analysis.setProperty("sonar.projectDate", "2000-10-19");
- BuildResult result = orchestrator.executeBuildQuietly(analysis);
-
- assertThat(result.getStatus()).isNotEqualTo(0);
- assertThat(result.getLogs()).contains("'sonar.projectDate' property cannot be older than the date of the last known quality snapshot on this project. Value: '2000-10-19'. " +
- "Latest quality snapshot: ");
- assertThat(result.getLogs()).contains("This property may only be used to rebuild the past in a chronological order.");
- }
-
- private Resource getResource(String key) {
- return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(key, "lines"));
- }
-
- private BuildResult scan(String projectPath, String... props) {
- SonarRunner runner = configureRunner(projectPath, props);
- return orchestrator.executeBuild(runner);
- }
-
- private BuildResult scanQuietly(String projectPath, String... props) {
- SonarRunner runner = configureRunner(projectPath, props);
- return orchestrator.executeBuildQuietly(runner);
- }
-
- private SonarRunner configureRunner(String projectPath, String... props) {
- SonarRunner runner = SonarRunner.create(ItUtils.projectDir(projectPath))
- .setProperties(props);
- return runner;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package batch.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import org.junit.ClassRule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import util.ItUtils;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- ExtensionLifecycleTest.class, LinksTest.class, MavenTest.class, ProjectBuilderTest.class, ProjectExclusionsTest.class,
- TempFolderTest.class, MultiLanguageTest.class, IssueJsonReportTest.class, ProjectProvisioningTest.class, BatchTest.class,
- IssuesModeTest.class, SettingsEncryptionTest.class
-})
-public class BatchTestSuite {
-
- @ClassRule
- public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv()
- .addPlugin(ItUtils.xooPlugin())
- .setOrchestratorProperty("javaVersion", "LATEST_RELEASE").addPlugin("java")
- .setContext("/")
-
- // Used by SettingsEncryptionTest
- .addPlugin(ItUtils.pluginArtifact("settings-encryption-plugin"))
-
- // Used by IssuesModeTest
- .addPlugin(ItUtils.pluginArtifact("access-secured-props-plugin"))
-
- // used by TempFolderTest
- .addPlugin(ItUtils.pluginArtifact("batch-plugin"))
-
- // used by ExtensionLifecycleTest
- .addPlugin(ItUtils.pluginArtifact("extension-lifecycle-plugin"))
-
- // used by ProjectBuilderTest
- .addPlugin(ItUtils.pluginArtifact("project-builder-plugin"))
-
- .build();
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package batch.suite;
-
-import util.ItUtils;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.MavenBuild;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-
-public class ExtensionLifecycleTest {
-
- @ClassRule
- public static Orchestrator orchestrator = BatchTestSuite.ORCHESTRATOR;
-
- @Before
- public void cleanup() {
- orchestrator.resetData();
- }
-
- @Test
- public void testInstantiationStrategyAndLifecycleOfBatchExtensions() {
- MavenBuild build = MavenBuild.create(ItUtils.projectPom("batch/extension-lifecycle"))
- .setCleanSonarGoals()
- .setProperty("extension.lifecycle", "true")
- .setProperty("sonar.dynamicAnalysis", "false");
-
- // Build fails if the extensions provided in the extension-lifecycle-plugin are not correctly
- // managed.
- orchestrator.executeBuild(build);
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package batch.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.SonarRunner;
-import com.sonar.orchestrator.locator.FileLocation;
-import com.sonar.orchestrator.locator.ResourceLocation;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.skyscreamer.jsonassert.JSONAssert;
-import util.ItUtils;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class IssueJsonReportTest {
-
- @ClassRule
- public static Orchestrator orchestrator = BatchTestSuite.ORCHESTRATOR;
-
- @Rule
- public TemporaryFolder temp = new TemporaryFolder();
-
- @Before
- public void resetData() {
- orchestrator.resetData();
- }
-
- @Test
- public void test_json_report_no_server_analysis() throws Exception {
- orchestrator.getServer().restoreProfile(getResource("one-issue-per-line.xml"));
- orchestrator.getServer().provisionProject("sample", "tracking");
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
-
- File projectDir = ItUtils.projectDir("batch/tracking/v1");
- SonarRunner issuesModeScan = SonarRunner.create(projectDir)
- .setProperty("sonar.analysis.mode", "issues")
- .setProperty("sonar.userHome", temp.newFolder().getAbsolutePath())
- .setProperty("sonar.report.export.path", "sonar-report.json")
- .setProperty("sonar.projectDate", "2013-05-02");
- orchestrator.executeBuild(issuesModeScan);
-
- File report = new File(projectDir, ".sonar/sonar-report.json");
- assertThat(report).isFile().exists();
-
- String json = sanitize(FileUtils.readFileToString(report));
- String expectedJson = sanitize(IOUtils.toString(getResourceInputStream("no-server-analysis.json")));
- JSONAssert.assertEquals(expectedJson, json, false);
- }
-
- @Test
- public void test_json_report() throws Exception {
- orchestrator.getServer().restoreProfile(getResource("one-issue-per-line.xml"));
- orchestrator.getServer().provisionProject("sample", "tracking");
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
-
- SonarRunner scan = SonarRunner.create(ItUtils.projectDir("batch/tracking/v1"))
- .setProperty("sonar.projectDate", "2013-05-01");
- orchestrator.executeBuild(scan);
-
- // Issues mode scan -> 2 new issues and 13 existing issues
- File projectDir = ItUtils.projectDir("batch/tracking/v2");
- SonarRunner issuesModeScan = SonarRunner.create(projectDir)
- .setProperty("sonar.analysis.mode", "issues")
- .setProperty("sonar.userHome", temp.newFolder().getAbsolutePath())
- .setProperty("sonar.report.export.path", "sonar-report.json")
- .setProperty("sonar.projectDate", "2013-05-02");
- orchestrator.executeBuild(issuesModeScan);
-
- File report = new File(projectDir, ".sonar/sonar-report.json");
- assertThat(report).isFile().exists();
-
- String json = sanitize(FileUtils.readFileToString(report));
- String expectedJson = sanitize(IOUtils.toString(getResourceInputStream("report-on-single-module.json")));
- JSONAssert.assertEquals(expectedJson, json, false);
- }
-
- @Test
- public void test_json_report_on_branch() throws Exception {
- orchestrator.getServer().restoreProfile(getResource("one-issue-per-line.xml"));
- orchestrator.getServer().provisionProject("sample:mybranch", "Sample");
- orchestrator.getServer().associateProjectToQualityProfile("sample:mybranch", "xoo", "one-issue-per-line");
-
- SonarRunner scan = SonarRunner.create(ItUtils.projectDir("batch/tracking/v1"))
- .setProperty("sonar.projectDate", "2013-05-01")
- .setProperty("sonar.branch", "mybranch");
- orchestrator.executeBuild(scan);
-
- // issues mode scan -> 2 new issues and 13 existing issues
- File projectDir = ItUtils.projectDir("batch/tracking/v2");
- SonarRunner issuesModeScan = SonarRunner.create(projectDir)
- .setProperty("sonar.analysis.mode", "issues")
- .setProperty("sonar.userHome", temp.newFolder().getAbsolutePath())
- .setProperty("sonar.report.export.path", "sonar-report.json")
- .setProperty("sonar.issuesReport.console.enable", "true")
- .setProperty("sonar.projectDate", "2013-05-02")
- .setProperty("sonar.verbose", "true")
- .setProperty("sonar.branch", "mybranch");
- orchestrator.executeBuild(issuesModeScan);
-
- File report = new File(projectDir, ".sonar/sonar-report.json");
- assertThat(report).isFile().exists();
-
- String json = sanitize(FileUtils.readFileToString(report));
- String expectedJson = sanitize(IOUtils.toString(getResourceInputStream("report-on-single-module-branch.json")));
- JSONAssert.assertEquals(expectedJson, json, false);
- }
-
- /**
- * Multi-modules project but Eclipse scans only a single module
- */
- @Test
- public void test_json_report_on_sub_module() throws Exception {
- orchestrator.getServer().restoreProfile(getResource("one-issue-per-line.xml"));
- orchestrator.getServer().provisionProject("com.sonarsource.it.samples:multi-modules-sample", "Multi-module sample");
- orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-sample", "xoo", "one-issue-per-line");
-
- File rootDir = ItUtils.projectDir("shared/xoo-multi-modules-sample");
- SonarRunner scan = SonarRunner.create(rootDir)
- .setProperty("sonar.projectDate", "2013-05-01");
- orchestrator.executeBuild(scan);
-
- // Issues mode scan on a module -> no new issues
- File moduleDir = ItUtils.projectDir("shared/xoo-multi-modules-sample/module_a/module_a1");
- SonarRunner issuesModeScan = SonarRunner.create(moduleDir)
- .setProperty("sonar.projectKey", "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1")
- .setProperty("sonar.projectVersion", "1.0-SNAPSHOT")
- .setProperty("sonar.projectName", "ModuleA1")
- .setProperty("sonar.sources", "src/main/xoo")
- .setProperty("sonar.language", "xoo")
- .setProperty("sonar.analysis.mode", "issues")
- .setProperty("sonar.userHome", temp.newFolder().getAbsolutePath())
- .setProperty("sonar.report.export.path", "sonar-report.json")
- .setProperty("sonar.projectDate", "2013-05-02");
- orchestrator.executeBuild(issuesModeScan);
-
- File report = new File(moduleDir, ".sonar/sonar-report.json");
- assertThat(report).isFile().exists();
-
- String json = sanitize(FileUtils.readFileToString(report));
- // SONAR-5218 All issues are updated as their root project id has changed (it's now the sub module)
- String expectedJson = sanitize(IOUtils.toString(getResourceInputStream("report-on-sub-module.json")));
- JSONAssert.assertEquals(expectedJson, json, false);
- }
-
- /**
- * Multi-modules project
- */
- @Test
- public void test_json_report_on_root_module() throws Exception {
- orchestrator.getServer().restoreProfile(getResource("/one-issue-per-line.xml"));
- orchestrator.getServer().provisionProject("com.sonarsource.it.samples:multi-modules-sample", "Sonar :: Integration Tests :: Multi-modules Sample");
- orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-sample", "xoo", "one-issue-per-line");
-
- File rootDir = ItUtils.projectDir("shared/xoo-multi-modules-sample");
- SonarRunner scan = SonarRunner.create(rootDir)
- .setProperty("sonar.projectDate", "2013-05-01");
- orchestrator.executeBuild(scan);
-
- // issues mode scan -> no new issues
- SonarRunner issuesModeScan = SonarRunner.create(rootDir)
- .setProperty("sonar.analysis.mode", "issues")
- .setProperty("sonar.userHome", temp.newFolder().getAbsolutePath())
- .setProperty("sonar.report.export.path", "sonar-report.json")
- .setProperty("sonar.projectDate", "2013-05-02");
- orchestrator.executeBuild(issuesModeScan);
-
- File report = new File(rootDir, ".sonar/sonar-report.json");
- assertThat(report).isFile().exists();
-
- String json = sanitize(FileUtils.readFileToString(report));
- String expectedJson = sanitize(IOUtils.toString(getResourceInputStream("report-on-root-module.json")));
- JSONAssert.assertEquals(expectedJson, json, false);
- }
-
- @Test
- public void sanityCheck() {
- assertThat(sanitize("5.0.0-5868-SILVER-SNAPSHOT")).isEqualTo("<SONAR_VERSION>");
- }
-
- private static String sanitize(String s) {
- // sanitize issue uuid keys
- s = s.replaceAll("\"[a-zA-Z_0-9\\-]{20}\"", "<ISSUE_KEY>");
-
- // sanitize sonar version. Note that "-SILVER-SNAPSHOT" is used by Goldeneye jobs
- s = s.replaceAll("\\d\\.\\d(.\\d)?(\\-.*)?\\-SNAPSHOT", "<SONAR_VERSION>");
-
- return ItUtils.sanitizeTimezones(s);
- }
-
- private InputStream getResourceInputStream(String resource) throws FileNotFoundException {
- ResourceLocation res = getResource(resource);
- return getClass().getResourceAsStream(res.getPath());
- }
-
- private ResourceLocation getResource(String resource) {
- return FileLocation.ofClasspath("/batch/IssueJsonReportTest/" + resource);
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package batch.suite;
-
-import com.google.common.collect.Maps;
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.BuildFailureException;
-import com.sonar.orchestrator.build.BuildResult;
-import com.sonar.orchestrator.build.SonarRunner;
-import com.sonar.orchestrator.build.SonarRunnerInstaller;
-import com.sonar.orchestrator.config.FileSystem;
-import com.sonar.orchestrator.locator.FileLocation;
-import com.sonar.orchestrator.version.Version;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import org.apache.commons.lang.ObjectUtils;
-import org.json.simple.JSONArray;
-import org.json.simple.JSONObject;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.rules.TemporaryFolder;
-import org.sonar.wsclient.SonarClient;
-import org.sonar.wsclient.issue.Issue;
-import org.sonar.wsclient.issue.IssueQuery;
-import org.sonar.wsclient.issue.Issues;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-import org.sonar.wsclient.user.UserParameters;
-import util.ItUtils;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.fail;
-
-public class IssuesModeTest {
-
- @ClassRule
- public static Orchestrator orchestrator = BatchTestSuite.ORCHESTRATOR;
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Rule
- public TemporaryFolder temp = new TemporaryFolder();
-
- @Before
- public void deleteData() throws IOException {
- orchestrator.resetData();
- }
-
- @Test
- public void issues_analysis_on_new_project() throws IOException {
- restoreProfile("one-issue-per-line.xml");
- orchestrator.getServer().provisionProject("sample", "xoo-sample");
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
- SonarRunner runner = configureRunnerIssues("shared/xoo-sample", "sonar.verbose", "true");
- BuildResult result = orchestrator.executeBuild(runner);
- assertThat(ItUtils.countIssuesInJsonReport(result, true)).isEqualTo(17);
- }
-
- @Test
- public void invalid_incremental_mode() throws IOException {
- restoreProfile("one-issue-per-line.xml");
- orchestrator.getServer().provisionProject("sample", "xoo-sample");
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
- SonarRunner runner = configureRunner("shared/xoo-sample");
- runner.setProperty("sonar.analysis.mode", "incremental");
-
- thrown.expect(BuildFailureException.class);
- BuildResult res = orchestrator.executeBuild(runner);
-
- assertThat(res.getLogs()).contains("Invalid analysis mode: incremental. This mode was removed in SonarQube 5.2");
- }
-
- @Test
- public void non_associated_mode() throws IOException {
- restoreProfile("one-issue-per-line.xml");
- setDefaultQualityProfile("xoo", "one-issue-per-line");
- SonarRunner runner = configureRunnerIssues("shared/xoo-sample-non-associated");
- BuildResult result = orchestrator.executeBuild(runner);
-
- assertThat(result.getLogs()).contains("Local analysis");
- assertThat(result.getLogs()).contains("Cache not found, synchronizing data");
- assertThat(ItUtils.countIssuesInJsonReport(result, true)).isEqualTo(17);
-
- result = orchestrator.executeBuild(runner);
- assertThat(ItUtils.countIssuesInJsonReport(result, true)).isEqualTo(17);
- assertThat(result.getLogs()).contains("Found cache");
- }
-
- // SONAR-5715
- @Test
- public void test_issues_mode_on_project_with_space_in_filename() throws IOException {
- restoreProfile("with-many-rules.xml");
- orchestrator.getServer().provisionProject("sample", "xoo-sample-with-spaces");
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "with-many-rules");
-
- SonarRunner runner = configureRunner("batch/xoo-sample-with-spaces/v2");
- BuildResult result = orchestrator.executeBuild(runner);
- assertThat(getResource("sample:my sources/main/xoo/sample/My Sample.xoo")).isNotNull();
-
- runner = configureRunnerIssues("batch/xoo-sample-with-spaces/v2");
- result = orchestrator.executeBuild(runner);
- // Analysis is not persisted in database
- Resource project = getResource("com.sonarsource.it.samples:simple-sample");
- assertThat(project).isNull();
- assertThat(result.getLogs()).contains("Issues");
- assertThat(result.getLogs()).contains("ANALYSIS SUCCESSFUL");
- }
-
- @Test
- public void should_not_fail_on_resources_that_have_existed_before() throws IOException {
- restoreProfile("with-many-rules.xml");
- orchestrator.getServer().provisionProject("sample", "xoo-history");
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "with-many-rules");
-
- // First real scan with source
- SonarRunner runner = configureRunner("shared/xoo-history-v2");
- BuildResult result = orchestrator.executeBuild(runner);
- assertThat(getResource("sample:src/main/xoo/sample/ClassAdded.xoo")).isNotNull();
-
- // Second scan should remove ClassAdded.xoo
- runner = configureRunner("shared/xoo-history-v1");
- result = orchestrator.executeBuild(runner);
- assertThat(getResource("sample:src/main/xoo/sample/ClassAdded.xoo")).isNull();
-
- // Re-add ClassAdded.xoo in local workspace
- runner = configureRunnerIssues("shared/xoo-history-v2");
- result = orchestrator.executeBuild(runner);
-
- assertThat(getResource("sample:src/main/xoo/sample/ClassAdded.xoo")).isNull();
- assertThat(result.getLogs()).contains("Issues");
- assertThat(result.getLogs()).contains("ANALYSIS SUCCESSFUL");
- }
-
- @Test
- public void should_fail_if_plugin_access_secured_properties() throws IOException {
- // Test access from task (ie BatchSettings)
- SonarRunner runner = configureRunnerIssues("shared/xoo-sample",
- "accessSecuredFromTask", "true");
- BuildResult result = orchestrator.executeBuildQuietly(runner);
-
- assertThat(result.getLogs()).contains("Access to the secured property 'foo.bar.secured' is not possible in issues mode. "
- + "The SonarQube plugin which requires this property must be deactivated in issues mode.");
-
- // Test access from sensor (ie ModuleSettings)
- runner = configureRunnerIssues("shared/xoo-sample",
- "accessSecuredFromSensor", "true");
- result = orchestrator.executeBuildQuietly(runner);
-
- assertThat(result.getLogs()).contains("Access to the secured property 'foo.bar.secured' is not possible in issues mode. "
- + "The SonarQube plugin which requires this property must be deactivated in issues mode.");
- }
-
- // SONAR-4602
- @Test
- public void no_issues_mode_cache_after_new_analysis() throws Exception {
- restoreProfile("one-issue-per-line.xml");
- restoreProfile("empty.xml");
- orchestrator.getServer().provisionProject("sample", "xoo-sample");
-
- // First run (publish mode)
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "empty");
- SonarRunner runner = configureRunner("shared/xoo-sample");
- orchestrator.executeBuild(runner);
-
- // First run issues mode
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
- runner = configureRunnerIssues("shared/xoo-sample");
- BuildResult result = orchestrator.executeBuild(runner);
-
- // As many new issue as lines
- assertThat(ItUtils.countIssuesInJsonReport(result, true)).isEqualTo(17);
-
- // Second run (publish mode) should invalidate cache
- runner = configureRunner("shared/xoo-sample");
- orchestrator.executeBuild(runner);
-
- // Second run issues mode
- runner = configureRunnerIssues("shared/xoo-sample", "sonar.report.export.path", "sonar-report.json");
- result = orchestrator.executeBuild(runner);
-
- // No new issue this time
- assertThat(ItUtils.countIssuesInJsonReport(result, true)).isEqualTo(0);
- }
-
- // SONAR-4602
- @Test
- public void no_issues_mode_cache_after_profile_change() throws Exception {
- restoreProfile("one-issue-per-line-empty.xml");
- orchestrator.getServer().provisionProject("sample", "xoo-sample");
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
-
- // First run (publish mode)
- SonarRunner runner = configureRunner("shared/xoo-sample");
- orchestrator.executeBuild(runner);
-
- // First issues mode
- runner = configureRunnerIssues("shared/xoo-sample");
- BuildResult result = orchestrator.executeBuild(runner);
-
- // No new issues
- assertThat(ItUtils.countIssuesInJsonReport(result, true)).isEqualTo(0);
-
- // Modification of QP should invalidate cache
- restoreProfile("/one-issue-per-line.xml");
-
- // Second issues mode
- runner = configureRunnerIssues("shared/xoo-sample", "sonar.report.export.path", "sonar-report.json");
- result = orchestrator.executeBuild(runner);
-
- // As many new issue as lines
- assertThat(ItUtils.countIssuesInJsonReport(result, true)).isEqualTo(17);
- }
-
- // SONAR-4602
- @Test
- public void no_issues_mode_cache_after_issue_change() throws Exception {
- restoreProfile("one-issue-per-line.xml");
- orchestrator.getServer().provisionProject("sample", "xoo-sample");
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
-
- // First run (publish mode)
- SonarRunner runner = configureRunner("shared/xoo-sample");
- orchestrator.executeBuild(runner);
-
- // First issues mode
- runner = configureRunnerIssues("shared/xoo-sample");
- BuildResult result = orchestrator.executeBuild(runner);
-
- // 17 issues
- assertThat(ItUtils.countIssuesInJsonReport(result, false)).isEqualTo(17);
-
- // Flag one issue as false positive
- JSONObject obj = ItUtils.getJSONReport(result);
- String key = ((JSONObject) ((JSONArray) obj.get("issues")).get(0)).get("key").toString();
- orchestrator.getServer().adminWsClient().issueClient().doTransition(key, "falsepositive");
-
- // Second issues mode
- runner = configureRunnerIssues("shared/xoo-sample");
- result = orchestrator.executeBuild(runner);
-
- // False positive is not returned
- assertThat(ItUtils.countIssuesInJsonReport(result, false)).isEqualTo(16);
- }
-
- // SONAR-6522
- @Test
- public void load_user_name_in_json_report() throws Exception {
- restoreProfile("one-issue-per-line.xml");
- orchestrator.getServer().provisionProject("sample", "xoo-sample");
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
-
- // First run (publish mode)
- SonarRunner runner = configureRunner("shared/xoo-sample");
- orchestrator.executeBuild(runner);
-
- SonarClient client = orchestrator.getServer().adminWsClient();
-
- Issues issues = client.issueClient().find(IssueQuery.create());
- Issue issue = issues.list().get(0);
-
- UserParameters creationParameters = UserParameters.create().login("julien").name("Julien H")
- .password("password").passwordConfirmation("password");
- client.userClient().create(creationParameters);
-
- // Assign issue
- client.issueClient().assign(issue.key(), "julien");
-
- // Issues
- runner = configureRunnerIssues("shared/xoo-sample");
- BuildResult result = orchestrator.executeBuild(runner);
-
- JSONObject obj = ItUtils.getJSONReport(result);
-
- Map<String, String> userNameByLogin = Maps.newHashMap();
- final JSONArray users = (JSONArray) obj.get("users");
- if (users != null) {
- for (Object user : users) {
- String login = ObjectUtils.toString(((JSONObject) user).get("login"));
- String name = ObjectUtils.toString(((JSONObject) user).get("name"));
- userNameByLogin.put(login, name);
- }
- }
- assertThat(userNameByLogin.get("julien")).isEqualTo("Julien H");
-
- for (Object issueJson : (JSONArray) obj.get("issues")) {
- JSONObject jsonObject = (JSONObject) issueJson;
- if (issue.key().equals(jsonObject.get("key"))) {
- assertThat(jsonObject.get("assignee")).isEqualTo("julien");
- return;
- }
- }
- fail("Issue not found");
- }
-
- @Test
- public void concurrent_issue_mode_on_existing_project() throws Exception {
- restoreProfile("one-issue-per-line.xml");
- orchestrator.getServer().provisionProject("sample", "xoo-sample");
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
-
- SonarRunner runner = configureRunner("shared/xoo-sample");
- orchestrator.executeBuild(runner);
-
- runConcurrentIssues();
- }
-
- private void runConcurrentIssues() throws InterruptedException, ExecutionException {
- // Install sonar-runner in advance to avoid concurrent unzip issues
- FileSystem fileSystem = orchestrator.getConfiguration().fileSystem();
- new SonarRunnerInstaller(fileSystem).install(Version.create(SonarRunner.DEFAULT_RUNNER_VERSION), fileSystem.workspace());
- final int nThreads = 3;
- ExecutorService executorService = Executors.newFixedThreadPool(nThreads);
- List<Callable<BuildResult>> tasks = new ArrayList<>();
- for (int i = 0; i < nThreads; i++) {
- tasks.add(new Callable<BuildResult>() {
-
- public BuildResult call() throws Exception {
- SonarRunner runner = configureRunnerIssues("shared/xoo-sample");
- return orchestrator.executeBuild(runner);
- }
- });
- }
-
- boolean expectedError = false;
- for (Future<BuildResult> result : executorService.invokeAll(tasks)) {
- try {
- result.get();
- } catch (ExecutionException e) {
- if (e.getCause() instanceof BuildFailureException) {
- BuildFailureException bfe = (BuildFailureException) e.getCause();
- assertThat(bfe.getResult().getLogs()).contains("Another SonarQube analysis is already in progress for this project");
- expectedError = true;
- }
- }
- }
- if (!expectedError) {
- fail("At least one of the threads should have failed");
- }
- }
-
- private void restoreProfile(String fileName) {
- orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/batch/IssuesModeTest/" + fileName));
- }
-
- private Resource getResource(String key) {
- return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(key, "lines"));
- }
-
- private SonarRunner configureRunnerIssues(String projectDir, String... props) throws IOException {
- SonarRunner runner = SonarRunner.create(ItUtils.projectDir(projectDir),
- "sonar.working.directory", temp.newFolder().getAbsolutePath(),
- "sonar.analysis.mode", "issues",
- "sonar.report.export.path", "sonar-report.json",
- "sonar.userHome", temp.newFolder().getAbsolutePath());
- runner.setProperties(props);
- return runner;
- }
-
- private SonarRunner configureRunner(String projectDir, String... props) throws IOException {
- SonarRunner runner = SonarRunner.create(ItUtils.projectDir(projectDir),
- "sonar.working.directory", temp.newFolder().getAbsolutePath(),
- "sonar.report.export.path", "sonar-report.json",
- "sonar.userHome", temp.newFolder().getAbsolutePath());
- runner.setProperties(props);
- return runner;
- }
-
- private void setDefaultQualityProfile(String languageKey, String profileName) {
- orchestrator.getServer().adminWsClient().post("api/qualityprofiles/set_default",
- "language", languageKey,
- "profileName", profileName);
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package batch.suite;
-
-import util.ItUtils;
-import com.google.common.collect.Lists;
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.MavenBuild;
-import com.sonar.orchestrator.build.SonarRunner;
-import com.sonar.orchestrator.db.Database;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class LinksTest {
-
- @ClassRule
- public static Orchestrator orchestrator = BatchTestSuite.ORCHESTRATOR;
-
- private static String[] expectedLinks = new String[] {
- "homepage=http://www.simplesample.org_OVERRIDDEN",
- "ci=http://bamboo.ci.codehaus.org/browse/SIMPLESAMPLE",
- "issue=http://jira.codehaus.org/browse/SIMPLESAMPLE",
- "scm=https://github.com/SonarSource/simplesample",
- "scm_dev=scm:git:git@github.com:SonarSource/simplesample.git"
- };
-
- @Before
- @After
- public void cleanProjectLinksTable() {
- // TODO should not do this and find another way without using direct db connection
- orchestrator.getDatabase().truncate("project_links");
- }
-
- /**
- * SONAR-3676
- */
- @Test
- public void shouldUseLinkProperties() {
- SonarRunner runner = SonarRunner.create(ItUtils.projectDir("batch/links-project"))
- .setProperty("sonar.scm.disabled", "true");
- orchestrator.executeBuild(runner);
-
- checkLinks();
- }
-
- /**
- * SONAR-3676
- */
- @Test
- public void shouldUseLinkPropertiesOverPomLinksInMaven() {
- MavenBuild build = MavenBuild.create(ItUtils.projectPom("batch/links-project"))
- .setCleanPackageSonarGoals()
- .setProperty("sonar.scm.disabled", "true");
- orchestrator.executeBuild(build);
-
- checkLinks();
- }
-
- private void checkLinks() {
- Database db = orchestrator.getDatabase();
- List<Map<String, String>> links = db.executeSql("select * from project_links");
-
- assertThat(links.size()).isEqualTo(5);
- Collection<String> linksToCheck = Lists.newArrayList();
- for (Map<String, String> linkRow : links) {
- linksToCheck.add(linkRow.get("LINK_TYPE") + "=" + linkRow.get("HREF"));
- }
- assertThat(linksToCheck).contains(expectedLinks);
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package batch.suite;
-
-import util.ItUtils;
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.BuildResult;
-import com.sonar.orchestrator.build.MavenBuild;
-
-import java.util.List;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.sonar.wsclient.Sonar;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-
-public class MavenTest {
-
- @ClassRule
- public static Orchestrator orchestrator = BatchTestSuite.ORCHESTRATOR;
-
- @Before
- public void deleteData() {
- orchestrator.resetData();
- }
-
- @Test
- public void shouldSupportJarWithoutSources() {
- MavenBuild build = MavenBuild.create(ItUtils.projectPom("maven/project-with-module-without-sources"))
- .setCleanSonarGoals();
- orchestrator.executeBuild(build);
-
- Resource project = orchestrator.getServer().getWsClient()
- .find(ResourceQuery.createForMetrics("com.sonarsource.it.samples.project-with-module-without-sources:parent", "files"));
- assertThat(project.getMeasureIntValue("files")).isEqualTo(1);
-
- Resource subProject = orchestrator.getServer().getWsClient().find(ResourceQuery.create("com.sonarsource.it.samples.project-with-module-without-sources:without-sources"));
- assertThat(subProject).isNotNull();
- }
-
- /**
- * See SONAR-594
- */
- @Test
- public void shouldSupportJeeProjects() {
- MavenBuild build = MavenBuild.create(ItUtils.projectPom("maven/jee"))
- .setGoals("clean install", "sonar:sonar");
- orchestrator.executeBuild(build);
-
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("com.sonarsource.it.samples.jee:parent", "files"));
- assertThat(project.getMeasureIntValue("files")).isEqualTo(2);
-
- List<Resource> modules = orchestrator.getServer().getWsClient().findAll(ResourceQuery.create("com.sonarsource.it.samples.jee:parent").setDepth(-1).setQualifiers("BRC"));
- assertThat(modules).hasSize(4);
- }
-
- /**
- * See SONAR-222
- */
- @Test
- public void shouldSupportMavenExtensions() {
- MavenBuild build = MavenBuild.create(ItUtils.projectPom("maven/maven-extensions"))
- .setCleanSonarGoals();
- orchestrator.executeBuild(build);
-
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("com.sonarsource.it.samples:maven-extensions", "files"));
- assertThat(project.getMeasureIntValue("files")).isEqualTo(1);
- }
-
- /**
- * This test should be splitted. It checks multiple use-cases at the same time : SONAR-518, SONAR-519 and SONAR-593
- */
- @Test
- public void testBadMavenParameters() {
- // should not fail
- MavenBuild build = MavenBuild.create(ItUtils.projectPom("maven/maven-bad-parameters"))
- .setCleanSonarGoals();
- orchestrator.executeBuild(build);
-
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("com.sonarsource.it.samples.maven-bad-parameters:parent", "files"));
- assertThat(project.getMeasureIntValue("files")).isGreaterThan(0);
- }
-
- @Test
- public void shouldAnalyzeMultiModules() {
- MavenBuild build = MavenBuild.create(ItUtils.projectPom("maven/modules-order"))
- .setCleanSonarGoals()
- .setProperty("sonar.dynamicAnalysis", "false");
- orchestrator.executeBuild(build);
-
- Sonar sonar = orchestrator.getServer().getWsClient();
- assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-order:root")).getName()).isEqualTo("Sonar tests - modules order");
-
- assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-order:parent")).getName()).isEqualTo("Parent");
-
- assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-order:module_a")).getName()).isEqualTo("Module A");
- assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-order:module_a:src/main/java/HelloA.java")).getName()).isEqualTo("HelloA.java");
-
- assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-order:module_b")).getName()).isEqualTo("Module B");
- assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-order:module_b:src/main/java/HelloB.java")).getName()).isEqualTo("HelloB.java");
- }
-
- /**
- * See SONAR-2735
- */
- @Test
- public void shouldSupportDifferentDeclarationsForModules() {
- MavenBuild build = MavenBuild.create(ItUtils.projectPom("maven/modules-declaration"))
- .setCleanSonarGoals()
- .setProperty("sonar.dynamicAnalysis", "false");
- orchestrator.executeBuild(build);
- Sonar sonar = orchestrator.getServer().getWsClient();
-
- assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-declaration:root")).getName()).isEqualTo("Root");
-
- assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-declaration:module_a")).getName()).isEqualTo("Module A");
- assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-declaration:module_a:src/main/java/HelloA.java")).getName()).isEqualTo("HelloA.java");
-
- assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-declaration:module_b")).getName()).isEqualTo("Module B");
- assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-declaration:module_b:src/main/java/HelloB.java")).getName()).isEqualTo("HelloB.java");
-
- assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-declaration:module_c")).getName()).isEqualTo("Module C");
- assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-declaration:module_c:src/main/java/HelloC.java")).getName()).isEqualTo("HelloC.java");
-
- assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-declaration:module_d")).getName()).isEqualTo("Module D");
- assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-declaration:module_d:src/main/java/HelloD.java")).getName()).isEqualTo("HelloD.java");
-
- assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-declaration:module_e")).getName()).isEqualTo("Module E");
- assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-declaration:module_e:src/main/java/HelloE.java")).getName()).isEqualTo("HelloE.java");
- }
-
- /**
- * See SONAR-3843
- */
- @Test
- public void should_support_shade_with_dependency_reduced_pom_with_clean_install_sonar_goals() {
- MavenBuild build = MavenBuild.create(ItUtils.projectPom("maven/shade-with-dependency-reduced-pom"))
- .setProperty("sonar.dynamicAnalysis", "false")
- .setGoals("clean", "install", "sonar:sonar");
-
- orchestrator.executeBuild(build);
- }
-
- /**
- * SONAR-4245
- */
- @Test
- @Ignore("This test should be moved to a Medium test of the Compute Engine")
- public void should_prevent_analysis_of_module_then_project() {
- MavenBuild scan = MavenBuild.create(ItUtils.projectPom("shared/multi-modules-sample/module_a"))
- .setProperty("sonar.dynamicAnalysis", "false")
- .setCleanSonarGoals();
- orchestrator.executeBuild(scan);
-
- scan = MavenBuild.create(ItUtils.projectPom("shared/multi-modules-sample"))
- .setProperty("sonar.dynamicAnalysis", "false")
- .setCleanSonarGoals();
- BuildResult result = orchestrator.executeBuildQuietly(scan);
- assertThat(result.getStatus()).isNotEqualTo(0);
- assertThat(result.getLogs()).contains("The project 'com.sonarsource.it.samples:module_a' is already defined in SonarQube "
- + "but not as a module of project 'com.sonarsource.it.samples:multi-modules-sample'. "
- + "If you really want to stop directly analysing project 'com.sonarsource.it.samples:module_a', "
- + "please first delete it from SonarQube and then relaunch the analysis of project 'com.sonarsource.it.samples:multi-modules-sample'.");
- }
-
- /**
- * src/main/java is missing
- */
- @Test
- public void maven_project_with_only_test_dir() {
- MavenBuild build = MavenBuild.create(ItUtils.projectPom("maven/maven-only-test-dir")).setCleanPackageSonarGoals();
- orchestrator.executeBuild(build);
-
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("com.sonarsource.it.samples:maven-only-test-dir", "tests", "files"));
- assertThat(project.getMeasureIntValue("tests")).isEqualTo(1);
- assertThat(project.getMeasure("files")).isNull();
- }
-
- /**
- * The property sonar.sources overrides the source dirs as declared in Maven
- */
- @Test
- public void override_sources() {
- MavenBuild build = MavenBuild.create(ItUtils.projectPom("maven/maven-override-sources")).setGoals("sonar:sonar");
- orchestrator.executeBuild(build);
-
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("com.sonarsource.it.samples:maven-override-sources", "files"));
- assertThat(project.getMeasureIntValue("files")).isEqualTo(1);
-
- Resource file = orchestrator.getServer().getWsClient().find(ResourceQuery.create("com.sonarsource.it.samples:maven-override-sources:src/main/java2/Hello2.java"));
- assertThat(file).isNotNull();
- }
-
- /**
- * The property sonar.inclusions overrides the property sonar.sources
- */
- @Test
- public void inclusions_apply_to_source_dirs() {
- MavenBuild build = MavenBuild.create(ItUtils.projectPom("maven/inclusions_apply_to_source_dirs")).setGoals("sonar:sonar");
- orchestrator.executeBuild(build);
-
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("com.sonarsource.it.samples:inclusions_apply_to_source_dirs", "files"));
- assertThat(project.getMeasureIntValue("files")).isEqualTo(1);
-
- Resource file = orchestrator.getServer().getWsClient().find(ResourceQuery.create("com.sonarsource.it.samples:inclusions_apply_to_source_dirs:src/main/java/Hello2.java"));
- assertThat(file).isNotNull();
- }
-
- /**
- * The property sonar.sources has a typo -> fail, like in sonar-runner
- */
- @Test
- public void fail_if_bad_value_of_sonar_sources_property() {
- MavenBuild build = MavenBuild.create(ItUtils.projectPom("maven/maven-bad-sources-property")).setGoals("sonar:sonar");
- BuildResult result = orchestrator.executeBuildQuietly(build);
- assertThat(result.getStatus()).isNotEqualTo(0);
- assertThat(result.getLogs()).contains(
- "java2' does not exist for Maven module com.sonarsource.it.samples:maven-bad-sources-property:jar:1.0-SNAPSHOT. Please check the property sonar.sources");
- }
-
- /**
- * The property sonar.sources has a typo -> fail, like in sonar-runner
- */
- @Test
- public void fail_if_bad_value_of_sonar_tests_property() {
- MavenBuild build = MavenBuild.create(ItUtils.projectPom("maven/maven-bad-tests-property")).setGoals("sonar:sonar");
- BuildResult result = orchestrator.executeBuildQuietly(build);
- assertThat(result.getStatus()).isNotEqualTo(0);
- assertThat(result.getLogs()).contains(
- "java2' does not exist for Maven module com.sonarsource.it.samples:maven-bad-tests-property:jar:1.0-SNAPSHOT. Please check the property sonar.tests");
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package batch.suite;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import util.ItUtils;
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.BuildResult;
-import com.sonar.orchestrator.build.SonarRunner;
-import com.sonar.orchestrator.locator.FileLocation;
-import org.junit.After;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-
-public class MultiLanguageTest {
-
- @ClassRule
- public static Orchestrator orchestrator = BatchTestSuite.ORCHESTRATOR;
-
- @After
- public void cleanDatabase() {
- orchestrator.resetData();
- }
-
- /**
- * SONAR-926
- * SONAR-5069
- */
- @Test
- public void test_sonar_runner_inspection() {
- orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/batch/MultiLanguageTest/one-issue-per-line.xml"));
- orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/batch/MultiLanguageTest/one-issue-per-line-xoo2.xml"));
-
- orchestrator.getServer().provisionProject("multi-language-sample", "multi-language-sample");
-
- orchestrator.getServer().associateProjectToQualityProfile("multi-language-sample", "xoo", "one-issue-per-line");
- orchestrator.getServer().associateProjectToQualityProfile("multi-language-sample","xoo2", "one-issue-per-line-xoo2");
-
- SonarRunner build = SonarRunner.create().setProjectDir(ItUtils.projectDir("batch/xoo-multi-languages"));
- BuildResult result = orchestrator.executeBuild(build);
-
- assertThat(result.getLogs()).contains("2 files indexed");
- assertThat(result.getLogs()).contains("Quality profile for xoo: one-issue-per-line");
- assertThat(result.getLogs()).contains("Quality profile for xoo2: one-issue-per-line-xoo2");
-
- // modules
- Resource project = getResource("multi-language-sample", "files", "violations");
- assertThat(project.getMeasureIntValue("files")).isEqualTo(2);
- assertThat(project.getMeasureIntValue("violations")).isEqualTo(26);
-
- Resource xooFile = getResource("multi-language-sample:src/sample/Sample.xoo", "violations");
- assertThat(xooFile.getMeasureIntValue("violations")).isEqualTo(13);
-
- Resource xoo2File = getResource("multi-language-sample:src/sample/Sample.xoo2", "violations");
- assertThat(xoo2File.getMeasureIntValue("violations")).isEqualTo(13);
- }
-
- private Resource getResource(String resourceKey, String... metricKeys) {
- return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(resourceKey, metricKeys));
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package batch.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.MavenBuild;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-import util.ItUtils;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * Test the extension point org.sonar.api.batch.bootstrap.ProjectBuilder
- * <p/>
- * A Sonar plugin can override the project definition injected by build-tool.
- * Example: C# plugin loads project structure and modules from Visual Studio metadata file.
- *
- * @since 2.9
- */
-public class ProjectBuilderTest {
-
- @ClassRule
- public static Orchestrator orchestrator = BatchTestSuite.ORCHESTRATOR;
-
- @Test
- public void shouldDefineProjectFromPlugin() {
- MavenBuild build = MavenBuild.create(ItUtils.projectPom("batch/project-builder"))
- .setCleanSonarGoals()
- .setProperty("sonar.enableProjectBuilder", "true")
- .setProperty("sonar.dynamicAnalysis", "false");
- orchestrator.executeBuild(build);
-
- checkProject();
- checkSubProject("project-builder-module-a");
- checkSubProject("project-builder-module-b");
- checkFile("project-builder-module-a", "src/HelloA.java");
- checkFile("project-builder-module-b", "src/HelloB.java");
- assertThat(getResource("com.sonarsource.it.projects.batch:project-builder-module-b:src/IgnoredFile.java")).isNull();
- }
-
- private void checkProject() {
- Resource project = getResource("com.sonarsource.it.projects.batch:project-builder");
-
- // name has been changed by plugin
- assertThat(project.getName()).isEqualTo("Name changed by plugin");
-
- assertThat(project).isNotNull();
- assertThat(project.getMeasureIntValue("files")).isEqualTo(2);
- assertThat(project.getMeasureIntValue("lines")).isGreaterThan(10);
- }
-
- private void checkSubProject(String subProjectKey) {
- Resource subProject = getResource("com.sonarsource.it.projects.batch:" + subProjectKey);
- assertThat(subProject).isNotNull();
- assertThat(subProject.getMeasureIntValue("files")).isEqualTo(1);
- assertThat(subProject.getMeasureIntValue("lines")).isGreaterThan(5);
- }
-
- private void checkFile(String subProjectKey, String fileKey) {
- Resource file = getResource("com.sonarsource.it.projects.batch:" + subProjectKey + ":" + fileKey);
- assertThat(file).isNotNull();
- assertThat(file.getMeasureIntValue("lines")).isGreaterThan(5);
- }
-
- private Resource getResource(String key) {
- return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(key, "lines", "files"));
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package batch.suite;
-
-import util.ItUtils;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.MavenBuild;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-public class ProjectExclusionsTest {
- @ClassRule
- public static Orchestrator orchestrator = BatchTestSuite.ORCHESTRATOR;
-
- @Before
- public void deleteProjectData() {
- orchestrator.resetData();
- }
-
- /**
- * This use-case was a bug in 2.8-RC2. It failed when both the properties sonar.branch and sonar.skippedModules
- * were set on the same multi-modules project.
- */
- @Test
- public void shouldSupportMixOfBranchAndSkippedModules() {
- MavenBuild build = MavenBuild.create(ItUtils.projectPom("shared/multi-modules-sample"))
- .setGoals("clean verify", "sonar:sonar")
- .setProperty("sonar.dynamicAnalysis", "false")
- .setProperty("sonar.branch", "mybranch")
- .setProperty("sonar.skippedModules", "module_b");
-
- orchestrator.executeBuild(build);
-
- assertNotNull(getResource("com.sonarsource.it.samples:multi-modules-sample:mybranch"));
- assertNotNull(getResource("com.sonarsource.it.samples:module_a:mybranch").getId());
- assertNotNull(getResource("com.sonarsource.it.samples:module_a1:mybranch").getId());
- assertNotNull(getResource("com.sonarsource.it.samples:module_a2:mybranch").getId());
-
- assertNull(getResource("com.sonarsource.it.samples:module_b:mybranch"));
- assertNull(getResource("com.sonarsource.it.samples:module_b1:mybranch"));
- assertNull(getResource("com.sonarsource.it.samples:module_b2:mybranch"));
- }
-
- /**
- * Black list
- */
- @Test
- public void shouldExcludeModuleAndItsChildren() {
- MavenBuild build = MavenBuild.create(ItUtils.projectPom("shared/multi-modules-sample"))
- .setGoals("clean verify", "sonar:sonar")
- .setProperty("sonar.dynamicAnalysis", "false")
- .setProperty("sonar.skippedModules", "module_b");
-
- orchestrator.executeBuild(build);
-
- assertNotNull(getResource("com.sonarsource.it.samples:multi-modules-sample"));
- assertNotNull(getResource("com.sonarsource.it.samples:module_a"));
- assertNotNull(getResource("com.sonarsource.it.samples:module_a1"));
- assertNotNull(getResource("com.sonarsource.it.samples:module_a2"));
-
- // excluded project and its children
- assertNull(getResource("com.sonarsource.it.samples:module_b"));
- assertNull(getResource("com.sonarsource.it.samples:module_b1"));
- assertNull(getResource("com.sonarsource.it.samples:module_b2"));
- }
-
- /**
- * Exhaustive white list
- */
- @Test
- public void shouldIncludeModules() {
- MavenBuild build = MavenBuild.create(ItUtils.projectPom("shared/multi-modules-sample"))
- .setGoals("clean verify", "sonar:sonar")
- .setProperty("sonar.dynamicAnalysis", "false")
- .setProperty("sonar.includedModules", "multi-modules-sample,module_a,module_a1");
-
- orchestrator.executeBuild(build);
-
- assertNotNull(getResource("com.sonarsource.it.samples:multi-modules-sample"));
- assertNotNull(getResource("com.sonarsource.it.samples:module_a"));
- assertNotNull(getResource("com.sonarsource.it.samples:module_a1"));
-
- assertNull(getResource("com.sonarsource.it.samples:module_a2"));
- assertNull(getResource("com.sonarsource.it.samples:module_b"));
- assertNull(getResource("com.sonarsource.it.samples:module_b1"));
- assertNull(getResource("com.sonarsource.it.samples:module_b2"));
- }
-
- @Test
- public void rootModuleShouldBeOptionalInListOfIncludedModules() {
- MavenBuild build = MavenBuild.create(ItUtils.projectPom("shared/multi-modules-sample"))
- .setCleanSonarGoals()
- .setProperty("sonar.dynamicAnalysis", "false")
- // the root module 'multi-modules-sample' is not declared
- .setProperty("sonar.includedModules", "module_a,module_a1");
-
- orchestrator.executeBuild(build);
-
- assertNotNull(getResource("com.sonarsource.it.samples:multi-modules-sample"));
- assertNotNull(getResource("com.sonarsource.it.samples:module_a"));
- assertNotNull(getResource("com.sonarsource.it.samples:module_a1"));
-
- assertNull(getResource("com.sonarsource.it.samples:module_a2"));
- assertNull(getResource("com.sonarsource.it.samples:module_b"));
- assertNull(getResource("com.sonarsource.it.samples:module_b1"));
- assertNull(getResource("com.sonarsource.it.samples:module_b2"));
- }
-
- private Resource getResource(String key) {
- return orchestrator.getServer().getWsClient().find(ResourceQuery.create(key));
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package batch.suite;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import util.ItUtils;
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.BuildResult;
-import com.sonar.orchestrator.build.SonarRunner;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.sonar.wsclient.SonarClient;
-import org.sonar.wsclient.project.NewProject;
-import org.sonar.wsclient.services.PropertyUpdateQuery;
-
-@Ignore
-public class ProjectProvisioningTest {
-
- @ClassRule
- public static Orchestrator orchestrator = BatchTestSuite.ORCHESTRATOR;
-
- @BeforeClass
- public static void init() {
- orchestrator.resetData();
- orchestrator.executeBuild(
- SonarRunner.create(ItUtils.projectDir("shared/xoo-sample"))
- );
- }
-
- @AfterClass
- public static void resetAutoProjectCreation() {
- setProperty("sonar.preventAutoProjectCreation", "false");
- }
-
- private SonarClient client;
-
- @Before
- public void initClient() {
- client = orchestrator.getServer().adminWsClient();
- }
-
- /**
- * SONAR-3871
- * SONAR-4713
- */
- @Test
- public void should_allow_existing_project_scan() {
- setProperty("sonar.preventAutoProjectCreation", "true");
-
- // xoo-sample already exists => pass
- checkBuildSuccess("shared/xoo-sample");
- }
-
- /**
- * SONAR-3871
- * SONAR-4713
- */
- @Test
- @Ignore("This test should be moved to a Medium test of the Compute Engine")
- public void should_prevent_project_creation() {
- setProperty("sonar.preventAutoProjectCreation", "true");
-
- // xoo-sample-with-tests does not exist => fail
- checkBuildFailed("shared/xoo-sample-with-tests");
-
- // provision xoo-sample-with-tests and retry
- client.projectClient().create(
- NewProject.create()
- .key("sample-with-tests")
- .name("Sample With Tests"));
- checkBuildSuccess("shared/xoo-sample-with-tests");
- }
-
- /**
- * SONAR-3871
- * SONAR-4713
- */
- @Test
- public void should_allow_provisioned_project() {
- setProperty("sonar.preventAutoProjectCreation", "true");
-
- // provision xoo-multi-modules-sample before 1st scan and check build OK
- client.projectClient().create(
- NewProject.create()
- .key("com.sonarsource.it.samples:multi-modules-sample")
- .name("Xoo Multi Modules Sample"));
- checkBuildSuccess("shared/xoo-multi-modules-sample");
- }
-
- /**
- * SONAR-5547
- */
- @Test
- public void should_allow_provisioned_project_with_branch() {
- setProperty("sonar.preventAutoProjectCreation", "true");
-
- // provision xoo-multi-modules-sample before 1st scan and check build OK
- client.projectClient().create(
- NewProject.create()
- .key("com.sonarsource.it.samples:multi-modules-sample:branch")
- .name("Xoo Multi Modules Sample - Branch"));
- checkBuildSuccess("shared/xoo-multi-modules-sample", "sonar.branch", "branch");
- }
-
- /**
- * SONAR-3871
- * SONAR-4713
- */
- @Test
- public void should_allow_provisioned_project_even_when_provisioning_not_enforced() {
- setProperty("sonar.preventAutoProjectCreation", "false");
-
- client.projectClient().create(
- NewProject.create()
- .key("xo")
- .name("xo"));
- checkBuildSuccess("shared/xoo-two-letters-named");
- }
-
- private static BuildResult checkBuildSuccess(String projectPath, String... propertiesKeyValues) {
- BuildResult result = scan(projectPath, propertiesKeyValues);
- assertThat(result.getStatus()).isZero();
- return result;
- }
-
- private static BuildResult checkBuildFailed(String projectPath) {
- BuildResult result = scan(projectPath);
- assertThat(result.getStatus()).isNotEqualTo(0);
- return result;
- }
-
- private static BuildResult scan(String projectPath, String... propertiesKeyValues) {
- return orchestrator.executeBuildQuietly(
- SonarRunner.create(ItUtils.projectDir(projectPath)).setProperties(propertiesKeyValues));
- }
-
- private static void setProperty(String key, String value) {
- orchestrator.getServer().getAdminWsClient().update(new PropertyUpdateQuery(key, value));
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package batch.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.BuildFailureException;
-import com.sonar.orchestrator.build.BuildResult;
-import com.sonar.orchestrator.build.SonarRunner;
-import java.io.File;
-import java.net.URL;
-import org.junit.ClassRule;
-import org.junit.Test;
-import util.ItUtils;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class SettingsEncryptionTest {
- @ClassRule
- public static Orchestrator orchestrator = BatchTestSuite.ORCHESTRATOR;
-
- /**
- * SONAR-2084
- * SONAR-4061
- */
- @Test
- public void testEncryptedProperty() throws Exception {
- SonarRunner build = SonarRunner.create(ItUtils.projectDir("shared/xoo-sample"))
- .setProperty("sonar.secretKeyPath", pathToValidSecretKey())
- .setProperty("sonar.login", "admin")
- // wrong password
- .setProperty("sonar.password", "{aes}wrongencryption==")// wrong password
- // "this is a secret" encrypted with the above secret key
- .setProperty("encryptedProperty", "{aes}9mx5Zq4JVyjeChTcVjEide4kWCwusFl7P2dSVXtg9IY=");
- BuildResult result = orchestrator.executeBuildQuietly(build);
- assertThat(result.getStatus()).isNotEqualTo(0);
- assertThat(result.getLogs()).contains("Fail to decrypt the property sonar.password. Please check your secret key");
-
- build = SonarRunner.create(ItUtils.projectDir("shared/xoo-sample"))
- .setProperty("sonar.secretKeyPath", pathToValidSecretKey())
- // "admin" encrypted with the above secret key
- .setProperty("sonar.login", "{aes}evRHXHsEyPr5RjEuxUJcHA==")
- .setProperty("sonar.password", "{aes}evRHXHsEyPr5RjEuxUJcHA==")
- // "this is a secret" encrypted with the above secret key
- .setProperty("encryptedProperty", "{aes}9mx5Zq4JVyjeChTcVjEide4kWCwusFl7P2dSVXtg9IY=");
- // no error
- orchestrator.executeBuild(build);
- }
-
- /**
- * SONAR-2084
- */
- @Test(expected = BuildFailureException.class)
- public void failIfEncryptedPropertyButNoSecretKey() throws Exception {
- // path to secret key is missing
- SonarRunner build = SonarRunner.create(ItUtils.projectDir("shared/xoo-sample"))
- .setProperty("encryptedProperty", "{aes}9mx5Zq4JVyjeChTcVjEide4kWCwusFl7P2dSVXtg9IY=");
- orchestrator.executeBuild(build);
- }
-
- private String pathToValidSecretKey() throws Exception {
- URL resource = getClass().getResource("/batch/SettingsEncryptionTest/sonar-secret.txt");
- return new File(resource.toURI()).getCanonicalPath();
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package batch.suite;
-
-import util.ItUtils;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.BuildResult;
-import com.sonar.orchestrator.build.SonarRunner;
-import com.sonar.orchestrator.locator.FileLocation;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.rules.TemporaryFolder;
-
-import java.io.File;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class TempFolderTest {
-
- @ClassRule
- public static Orchestrator orchestrator = BatchTestSuite.ORCHESTRATOR;
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Rule
- public TemporaryFolder temp = new TemporaryFolder();
-
- @Before
- public void deleteData() {
- orchestrator.resetData();
- orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/batch/TempFolderTest/one-issue-per-line.xml"));
- orchestrator.getServer().provisionProject("sample", "Sample");
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
- }
-
- // SONAR-4748
- @Test
- public void should_create_in_temp_folder() {
- File projectDir = ItUtils.projectDir("shared/xoo-sample");
- BuildResult result = scan();
-
- assertThat(result.getLogs()).doesNotContain("Creating temp directory:");
- assertThat(result.getLogs()).doesNotContain("Creating temp file:");
-
- result = scan("sonar.createTempFiles", "true");
- assertThat(result.getLogs()).contains(
- "Creating temp directory: " + projectDir.getAbsolutePath() + File.separator + ".sonar" + File.separator + ".sonartmp" + File.separator + "sonar-it");
- assertThat(result.getLogs()).contains(
- "Creating temp file: " + projectDir.getAbsolutePath() + File.separator + ".sonar" + File.separator + ".sonartmp" + File.separator + "sonar-it");
-
- // Verify temp folder is deleted after analysis
- assertThat(new File(projectDir, ".sonar/.sonartmp/sonar-it")).doesNotExist();
- }
-
- // SONAR-4748
- @Test
- public void should_not_use_system_tmp_dir() throws Exception {
- String oldTmp = System.getProperty("java.io.tmpdir");
- try {
- File tmp = temp.newFolder();
- assertThat(tmp.list()).isEmpty();
-
- SonarRunner runner = configureRunner()
- .setEnvironmentVariable("SONAR_RUNNER_OPTS", "-Djava.io.tmpdir=" + tmp.getAbsolutePath());
- orchestrator.executeBuild(runner);
-
- // TODO There is one remaining file waiting for SONARPLUGINS-3185
- assertThat(tmp.list()).hasSize(1);
- assertThat(tmp.list()[0]).matches("sonar-runner-batch(.*).jar");
- } finally {
- System.setProperty("java.io.tmpdir", oldTmp);
- }
- }
-
- private BuildResult scan(String... props) {
- SonarRunner runner = configureRunner(props);
- return orchestrator.executeBuild(runner);
- }
-
- private SonarRunner configureRunner(String... props) {
- return SonarRunner.create(ItUtils.projectDir("shared/xoo-sample"))
- .setProperties(props);
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package duplications.suite;
-
-import util.ItUtils;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.MavenBuild;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-import static org.hamcrest.Matchers.notNullValue;
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-@Ignore("Cross project duplications are temporary disabled, waiting to be reimplemented in CE or correctly implemented in the batch")
-public class CrossProjectDuplicationsTest {
-
- @ClassRule
- public static Orchestrator orchestrator = DuplicationsTestSuite.ORCHESTRATOR;
-
- @Before
- public void analyzeProjects() {
- orchestrator.resetData();
-
- MavenBuild build = MavenBuild.create(ItUtils.projectPom("duplications/cross-project/a"))
- .setCleanSonarGoals()
- .setProperty("sonar.cpd.cross_project", "true")
- .setProperty("sonar.dynamicAnalysis", "false");
- orchestrator.executeBuild(build);
-
- build = MavenBuild.create(ItUtils.projectPom("duplications/cross-project/b"))
- .setCleanSonarGoals()
- .setProperty("sonar.cpd.cross_project", "true")
- .setProperty("sonar.dynamicAnalysis", "false");
- orchestrator.executeBuild(build);
-
- build = MavenBuild.create(ItUtils.projectPom("duplications/cross-project/b"))
- .setCleanSonarGoals()
- .setProperty("sonar.cpd.cross_project", "true")
- .setProperty("sonar.branch", "branch")
- .setProperty("sonar.dynamicAnalysis", "false");
- orchestrator.executeBuild(build);
- }
-
- @Test
- public void testMeasures() throws Exception {
-
- Resource project = getResource("com.sonarsource.it.samples.duplications:a");
- assertThat(project, notNullValue());
- assertThat(project.getMeasureIntValue("duplicated_lines"), is(0));
-
- project = getResource("com.sonarsource.it.samples.duplications:b");
- assertThat(project, notNullValue());
- assertThat(project.getMeasureIntValue("duplicated_lines"), is(10));
-
- project = getResource("com.sonarsource.it.samples.duplications:b:branch");
- assertThat(project, notNullValue());
- assertThat(project.getMeasureIntValue("duplicated_lines"), is(0));
- }
-
- private Resource getResource(String key) {
- return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(key, "duplicated_lines"));
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package duplications.suite;
-
-import util.ItUtils;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.MavenBuild;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.core.IsNot.not;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.junit.Assert.assertThat;
-
-public class DuplicationsTest {
-
- private static final String DUPLICATIONS = "com.sonarsource.it.samples:duplications";
- private static final String DUPLICATIONS_WITH_EXCLUSIONS = "com.sonarsource.it.samples:duplications-with-exclusions";
- @ClassRule
- public static Orchestrator orchestrator = DuplicationsTestSuite.ORCHESTRATOR;
-
- @BeforeClass
- public static void init() {
- orchestrator.resetData();
-
- MavenBuild build = MavenBuild.create(ItUtils.projectPom("duplications/file-duplications"))
- .setCleanPackageSonarGoals();
- orchestrator.executeBuild(build);
-
- // Use a new project key to avoid conflict with other tests
- String projectKey = DUPLICATIONS_WITH_EXCLUSIONS;
- build = MavenBuild.create(ItUtils.projectPom("duplications/file-duplications"))
- .setCleanPackageSonarGoals()
- .setProperties("sonar.projectKey", projectKey,
- "sonar.cpd.exclusions", "**/Class*");
- orchestrator.executeBuild(build);
-
- }
-
- @Test
- public void duplicated_lines_within_same_class() {
- Resource file = getResource(DUPLICATIONS + ":src/main/java/duplicated_lines_within_same_class/DuplicatedLinesInSameClass.java");
- assertThat(file, not(nullValue()));
- assertThat(file.getMeasureValue("duplicated_blocks"), is(2.0));
- assertThat(file.getMeasureValue("duplicated_lines"), is(27.0 * 2)); // 2 blocks with 27 lines
- assertThat(file.getMeasureValue("duplicated_files"), is(1.0));
- assertThat(file.getMeasureValue("duplicated_lines_density"), is(60.0));
- }
-
- @Test
- public void duplicated_same_lines_within_3_classes() {
- Resource file1 = getResource(DUPLICATIONS + ":src/main/java/duplicated_same_lines_within_3_classes/Class1.java");
- assertThat(file1, not(nullValue()));
- assertThat(file1.getMeasureValue("duplicated_blocks"), is(1.0));
- assertThat(file1.getMeasureValue("duplicated_lines"), is(29.0));
- assertThat(file1.getMeasureValue("duplicated_files"), is(1.0));
- assertThat(file1.getMeasureValue("duplicated_lines_density"), is(47.5));
-
- Resource file2 = getResource(DUPLICATIONS + ":src/main/java/duplicated_same_lines_within_3_classes/Class2.java");
- assertThat(file2, not(nullValue()));
- assertThat(file2.getMeasureValue("duplicated_blocks"), is(1.0));
- assertThat(file2.getMeasureValue("duplicated_lines"), is(29.0));
- assertThat(file2.getMeasureValue("duplicated_files"), is(1.0));
- assertThat(file2.getMeasureValue("duplicated_lines_density"), is(48.3));
-
- Resource file3 = getResource(DUPLICATIONS + ":src/main/java/duplicated_same_lines_within_3_classes/Class3.java");
- assertThat(file3, not(nullValue()));
- assertThat(file3.getMeasureValue("duplicated_blocks"), is(1.0));
- assertThat(file3.getMeasureValue("duplicated_lines"), is(29.0));
- assertThat(file3.getMeasureValue("duplicated_files"), is(1.0));
- assertThat(file3.getMeasureValue("duplicated_lines_density"), is(46.0));
-
- Resource pkg = getResource(DUPLICATIONS + ":src/main/java/duplicated_same_lines_within_3_classes");
- assertThat(pkg, not(nullValue()));
- assertThat(pkg.getMeasureValue("duplicated_blocks"), is(3.0));
- assertThat(pkg.getMeasureValue("duplicated_lines"), is(29.0 * 3)); // 3 blocks with 29 lines
- assertThat(pkg.getMeasureValue("duplicated_files"), is(3.0));
- assertThat(pkg.getMeasureValue("duplicated_lines_density"), is(47.3));
- }
-
- @Test
- public void duplicated_lines_within_package() {
- Resource file1 = getResource(DUPLICATIONS + ":src/main/java/duplicated_lines_within_package/DuplicatedLinesInSamePackage1.java");
- assertThat(file1, not(nullValue()));
- assertThat(file1.getMeasureValue("duplicated_blocks"), is(4.0));
- assertThat(file1.getMeasureValue("duplicated_lines"), is(72.0));
- assertThat(file1.getMeasureValue("duplicated_files"), is(1.0));
- assertThat(file1.getMeasureValue("duplicated_lines_density"), is(58.1));
-
- Resource file2 = getResource(DUPLICATIONS + ":src/main/java/duplicated_lines_within_package/DuplicatedLinesInSamePackage2.java");
- assertThat(file2, not(nullValue()));
- assertThat(file2.getMeasureValue("duplicated_blocks"), is(3.0));
- assertThat(file2.getMeasureValue("duplicated_lines"), is(58.0));
- assertThat(file2.getMeasureValue("duplicated_files"), is(1.0));
- assertThat(file2.getMeasureValue("duplicated_lines_density"), is(64.4));
-
- Resource pkg = getResource(DUPLICATIONS + ":src/main/java/duplicated_lines_within_package");
- assertThat(pkg, not(nullValue()));
- assertThat(pkg.getMeasureValue("duplicated_blocks"), is(4.0 + 3.0));
- assertThat(pkg.getMeasureValue("duplicated_lines"), is(72.0 + 58.0));
- assertThat(pkg.getMeasureValue("duplicated_files"), is(2.0));
- assertThat(pkg.getMeasureValue("duplicated_lines_density"), is(60.7));
- }
-
- @Test
- public void duplicated_lines_with_other_package() {
- Resource file1 = getResource(DUPLICATIONS + ":src/main/java/duplicated_lines_with_other_package1/DuplicatedLinesWithOtherPackage.java");
- assertThat(file1, not(nullValue()));
- assertThat(file1.getMeasureValue("duplicated_blocks"), is(1.0));
- assertThat(file1.getMeasureValue("duplicated_lines"), is(36.0));
- assertThat(file1.getMeasureValue("duplicated_files"), is(1.0));
- assertThat(file1.getMeasureValue("duplicated_lines_density"), is(60.0));
-
- Resource pkg1 = getResource(DUPLICATIONS + ":src/main/java/duplicated_lines_with_other_package1");
- assertThat(pkg1, not(nullValue()));
- assertThat(pkg1.getMeasureValue("duplicated_blocks"), is(1.0));
- assertThat(pkg1.getMeasureValue("duplicated_lines"), is(36.0));
- assertThat(pkg1.getMeasureValue("duplicated_files"), is(1.0));
- assertThat(pkg1.getMeasureValue("duplicated_lines_density"), is(60.0));
-
- Resource file2 = getResource(DUPLICATIONS + ":src/main/java/duplicated_lines_with_other_package2/DuplicatedLinesWithOtherPackage.java");
- assertThat(file2, not(nullValue()));
- assertThat(file2.getMeasureValue("duplicated_blocks"), is(1.0));
- assertThat(file2.getMeasureValue("duplicated_lines"), is(36.0));
- assertThat(file2.getMeasureValue("duplicated_files"), is(1.0));
- assertThat(file2.getMeasureValue("duplicated_lines_density"), is(60.0));
-
- Resource pkg2 = getResource(DUPLICATIONS + ":src/main/java/duplicated_lines_with_other_package2");
- assertThat(pkg2, not(nullValue()));
- assertThat(pkg2.getMeasureValue("duplicated_blocks"), is(1.0));
- assertThat(pkg2.getMeasureValue("duplicated_lines"), is(36.0));
- assertThat(pkg2.getMeasureValue("duplicated_files"), is(1.0));
- assertThat(pkg2.getMeasureValue("duplicated_lines_density"), is(60.0));
- }
-
- @Test
- public void consolidation() {
- Resource project = getResource(DUPLICATIONS);
- assertThat(project, not(nullValue()));
- assertThat(project.getMeasureValue("duplicated_blocks"), is(14.0));
- assertThat(project.getMeasureValue("duplicated_lines"), is(343.0));
- assertThat(project.getMeasureValue("duplicated_files"), is(8.0));
- assertThat(project.getMeasureValue("duplicated_lines_density"), is(56.4));
- }
-
- /**
- * SONAR-3108
- */
- @Test
- public void use_duplication_exclusions() {
- Resource project = getResource(DUPLICATIONS_WITH_EXCLUSIONS);
- assertThat(project, not(nullValue()));
- assertThat(project.getMeasureValue("duplicated_blocks"), is(11.0));
- assertThat(project.getMeasureValue("duplicated_lines"), is(256.0));
- assertThat(project.getMeasureValue("duplicated_files"), is(5.0));
- assertThat(project.getMeasureValue("duplicated_lines_density"), is(42.1));
- }
-
- private Resource getResource(String key) {
- return orchestrator.getServer().getWsClient()
- .find(ResourceQuery.createForMetrics(key, "duplicated_lines", "duplicated_blocks", "duplicated_files", "duplicated_lines_density"));
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package duplications.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import org.junit.ClassRule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- CrossProjectDuplicationsTest.class, DuplicationsTest.class
-})
-public class DuplicationsTestSuite {
-
- @ClassRule
- public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv()
- .setOrchestratorProperty("javaVersion", "LATEST_RELEASE").addPlugin("java")
- .build();
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package exclusions.suite;
-
-import util.ItUtils;
-
-import com.sonar.orchestrator.Orchestrator;
-import org.junit.ClassRule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- FileExclusionsTest.class, IssueExclusionsTest.class
-})
-public class ExclusionsTestSuite {
-
- @ClassRule
- public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv()
- .addPlugin(ItUtils.xooPlugin())
- .build();
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package exclusions.suite;
-
-import util.ItUtils;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.SonarRunner;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-
-import java.util.List;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class FileExclusionsTest {
- static final String PROJECT = "exclusions";
-
- @ClassRule
- public static Orchestrator orchestrator = ExclusionsTestSuite.ORCHESTRATOR;
-
- @Before
- public void resetData() {
- orchestrator.resetData();
- }
-
- @Test
- public void exclude_source_files() {
- scan(
- "sonar.global.exclusions", "**/*Ignore*.xoo",
- "sonar.exclusions", "**/*Exclude*.xoo,src/main/xoo/org/sonar/tests/packageToExclude/**",
- "sonar.test.exclusions", "**/ClassTwoTest.xoo");
-
- Resource project = projectWithMetrics("ncloc", "files", "directories");
-
- assertThat(project.getMeasureIntValue("files")).isEqualTo(4);
- assertThat(project.getMeasureIntValue("ncloc")).isEqualTo(60);
- assertThat(project.getMeasureIntValue("directories")).isEqualTo(3);
- }
-
- /**
- * SONAR-2444 / SONAR-3758
- */
- @Test
- public void exclude_test_files() {
- scan(
- "sonar.global.exclusions", "**/*Ignore*.xoo",
- "sonar.exclusions", "**/*Exclude*.xoo,org/sonar/tests/packageToExclude/**",
- "sonar.test.exclusions", "**/ClassTwoTest.xoo");
-
- List<Resource> testFiles = orchestrator.getServer().getWsClient()
- .findAll(new ResourceQuery(PROJECT).setQualifiers("UTS").setDepth(-1));
-
- assertThat(testFiles).hasSize(2);
- assertThat(testFiles).extracting("name").doesNotContain("ClassTwoTest.xoo");
- }
-
- /**
- * SONAR-1896
- */
- @Test
- public void include_source_files() {
- scan(
- "sonar.dynamicAnalysis", "false",
- "sonar.inclusions", "**/*One.xoo,**/*Two.xoo");
-
- Resource project = projectWithMetrics("files");
- assertThat(project.getMeasureIntValue("files")).isEqualTo(2);
-
- List<Resource> sourceFiles = orchestrator.getServer().getWsClient()
- .findAll(new ResourceQuery(PROJECT).setQualifiers("FIL").setDepth(-1));
-
- assertThat(sourceFiles).hasSize(2);
- assertThat(sourceFiles).extracting("name").containsOnly("ClassOne.xoo", "ClassTwo.xoo");
- }
-
- /**
- * SONAR-1896
- */
- @Test
- public void include_test_files() {
- scan("sonar.test.inclusions", "src/test/xoo/**/*One*.xoo,src/test/xoo/**/*Two*.xoo");
-
- Resource project = projectWithMetrics("tests");
- assertThat(project.getMeasureIntValue("tests")).isEqualTo(2);
-
- List<Resource> testFiles = orchestrator.getServer().getWsClient()
- .findAll(new ResourceQuery(PROJECT).setQualifiers("UTS").setDepth(-1));
-
- assertThat(testFiles).hasSize(2);
- assertThat(testFiles).extracting("name").containsOnly("ClassOneTest.xoo", "ClassTwoTest.xoo");
- }
-
- /**
- * SONAR-2760
- */
- @Test
- public void include_and_exclude_files_by_absolute_path() {
- scan(
- // includes everything except ClassOnDefaultPackage
- "sonar.inclusions", "file:**/src/main/xoo/org/**/*.xoo",
-
- // exclude ClassThree and ClassToExclude
- "sonar.exclusions", "file:**/src/main/xoo/org/**/packageToExclude/*.xoo,file:**/src/main/xoo/org/**/*Exclude.xoo");
-
- List<Resource> sourceFiles = orchestrator.getServer().getWsClient()
- .findAll(new ResourceQuery(PROJECT).setQualifiers("FIL").setDepth(-1));
-
- assertThat(sourceFiles).hasSize(4);
- assertThat(sourceFiles).extracting("name").containsOnly("ClassOne.xoo", "ClassToIgnoreGlobally.xoo", "ClassTwo.xoo", "NoSonarComment.xoo");
- }
-
- static Resource projectWithMetrics(String... metricKeys) {
- return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT, metricKeys));
- }
-
- private void scan(String... properties) {
- SonarRunner build = SonarRunner
- .create(ItUtils.projectDir("exclusions/exclusions"))
- .setProperties(properties);
- orchestrator.executeBuild(build);
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package exclusions.suite;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import util.ItUtils;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.BuildResult;
-import com.sonar.orchestrator.build.SonarRunner;
-import com.sonar.orchestrator.locator.FileLocation;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-
-public class IssueExclusionsTest {
-
- private static final String PROJECT_KEY = "com.sonarsource.it.samples:multi-modules-exclusions";
- private static final String PROJECT_DIR = "exclusions/xoo-multi-modules";
-
- @ClassRule
- public static Orchestrator orchestrator = ExclusionsTestSuite.ORCHESTRATOR;
-
- @Before
- public void resetData() {
- orchestrator.resetData();
- }
-
- @Test
- public void should_not_exclude_anything() {
- scan();
-
- checkIssueCountBySeverity(67, 2, 57, 4, 0, 4);
- }
-
- @Test
- public void should_ignore_all_files() {
- scan(
- "sonar.issue.ignore.multicriteria", "1",
- "sonar.issue.ignore.multicriteria.1.resourceKey", "**/*.xoo",
- "sonar.issue.ignore.multicriteria.1.ruleKey", "*");
-
- checkIssueCountBySeverity(4, 0, 0, 0, 0, 4);
- }
-
- @Test
- public void should_enforce_only_on_one_file() {
- scan(
- "sonar.issue.enforce.multicriteria", "1",
- "sonar.issue.enforce.multicriteria.1.resourceKey", "**/HelloA1.xoo",
- "sonar.issue.enforce.multicriteria.1.ruleKey", "*");
-
- checkIssueCountBySeverity(
- 1 /* tag */+ 18 /* lines in HelloA1.xoo */+ 1 /* file */,
- 0 + 1,
- 0 + 18,
- 0 + 1,
- 0,
- 0);
- }
-
- @Test
- public void should_enforce_on_two_files_with_same_rule() {
- scan(
- "sonar.issue.enforce.multicriteria", "1,2",
- "sonar.issue.enforce.multicriteria.1.resourceKey", "**/HelloA1.xoo",
- "sonar.issue.enforce.multicriteria.1.ruleKey", "*",
- "sonar.issue.enforce.multicriteria.2.resourceKey", "**/HelloA2.xoo",
- "sonar.issue.enforce.multicriteria.2.ruleKey", "*");
-
- checkIssueCountBySeverity(
- 2 /* tags */+ 18 /* lines in HelloA1.xoo */+ 15 /* lines in HelloA2.xoo */+ 2 /* files */,
- 0 + 2,
- 0 + 18 + 15,
- 0 + 2,
- 0,
- 0);
- }
-
- @Test
- public void should_enforce_on_two_files_with_different_rule() {
- scan(
- "sonar.issue.enforce.multicriteria", "1,2",
- "sonar.issue.enforce.multicriteria.1.resourceKey", "**/HelloA1.xoo",
- "sonar.issue.enforce.multicriteria.1.ruleKey", "xoo:OneIssuePerLine",
- "sonar.issue.enforce.multicriteria.2.resourceKey", "**/HelloA2.xoo",
- "sonar.issue.enforce.multicriteria.2.ruleKey", "xoo:HasTag");
-
- checkIssueCountBySeverity(
- 1 /* tag in HelloA2 */+ 18 /* lines in HelloA1.xoo */+ 4 /* files */+ 4 /* modules */,
- 0 + 1,
- 0 + 18,
- 4,
- 0,
- 4);
- }
-
- @Test
- public void should_ignore_files_with_regexp() {
- scan(
- "sonar.issue.ignore.allfile", "1",
- "sonar.issue.ignore.allfile.1.fileRegexp", "EXTERMINATE-ALL-ISSUES");
-
- checkIssueCountBySeverity(
- 67 - 1 /* tag */- 18 /* lines in HelloA1.xoo */- 1 /* file */,
- 2 - 1,
- 57 - 18,
- 4 - 1,
- 0,
- 4);
- }
-
- @Test
- public void should_ignore_block_with_regexp() {
- scan(
- "sonar.issue.ignore.block", "1",
- "sonar.issue.ignore.block.1.beginBlockRegexp", "MUTE-SONAR",
- "sonar.issue.ignore.block.1.endBlockRegexp", "UNMUTE-SONAR");
-
- checkIssueCountBySeverity(
- 67 - 1 /* tag */- 5 /* lines in HelloA2.xoo */,
- 2 - 1,
- 57 - 5,
- 4,
- 0,
- 4);
- }
-
- @Test
- public void should_ignore_to_end_of_file() {
- scan(
- "sonar.issue.ignore.block", "1",
- "sonar.issue.ignore.block.1.beginBlockRegexp", "MUTE-SONAR",
- "sonar.issue.ignore.block.1.endBlockRegexp", "");
-
- checkIssueCountBySeverity(
- 67 - 1 /* tag */- 7 /* remaining lines in HelloA2.xoo */,
- 2 - 1,
- 57 - 7,
- 4,
- 0,
- 4);
- }
-
- @Test
- public void should_ignore_one_per_line_on_single_package() {
- scan(
- "sonar.issue.ignore.multicriteria", "1",
- "sonar.issue.ignore.multicriteria.1.resourceKey", "**/com/sonar/it/samples/modules/a1/*",
- "sonar.issue.ignore.multicriteria.1.ruleKey", "xoo:OneIssuePerLine");
-
- checkIssueCountBySeverity(
- 67 - 18 /* lines in HelloA1.xoo */,
- 2,
- 57 - 18,
- 4,
- 0,
- 4);
- }
-
- @Test
- public void should_apply_exclusions_from_multiple_sources() {
- scan(
- "sonar.issue.ignore.allfile", "1",
- "sonar.issue.ignore.allfile.1.fileRegexp", "EXTERMINATE-ALL-ISSUES",
- "sonar.issue.ignore.block", "1",
- "sonar.issue.ignore.block.1.beginBlockRegexp", "MUTE-SONAR",
- "sonar.issue.ignore.block.1.endBlockRegexp", "UNMUTE-SONAR",
- "sonar.issue.ignore.multicriteria", "1",
- "sonar.issue.ignore.multicriteria.1.resourceKey", "**/com/sonar/it/samples/modules/b1/*",
- "sonar.issue.ignore.multicriteria.1.ruleKey", "xoo:OneIssuePerLine");
-
- checkIssueCountBySeverity(
- 67 - 1 /* tag in HelloA1.xoo */- 1 /* tag in HelloA2.xoo */
- - 18 /* lines in HelloA1.xoo */- 5 /* lines in HelloA2.xoo */- 12 /* lines in HelloB1.xoo */
- - 1 /* HelloA1.xoo file */,
- 0,
- 57 - 18 - 5 - 12,
- 4 - 1,
- 0,
- 4);
- }
-
- @Test
- public void should_log_missing_resource_key() {
- checkAnalysisFails(
- "sonar.issue.ignore.multicriteria", "1",
- "sonar.issue.ignore.multicriteria.1.resourceKey", "",
- "sonar.issue.ignore.multicriteria.1.ruleKey", "*");
- }
-
- @Test
- public void should_log_missing_rule_key() {
- checkAnalysisFails(
- "sonar.issue.ignore.multicriteria", "1",
- "sonar.issue.ignore.multicriteria.1.resourceKey", "*",
- "sonar.issue.ignore.multicriteria.1.ruleKey", "");
- }
-
- @Test
- public void should_log_missing_block_start() {
- checkAnalysisFails(
- "sonar.issue.ignore.block", "1",
- "sonar.issue.ignore.block.1.beginBlockRegexp", "",
- "sonar.issue.ignore.block.1.endBlockRegexp", "UNMUTE-SONAR");
- }
-
- @Test
- public void should_log_missing_whole_file_regexp() {
- checkAnalysisFails(
- "sonar.issue.ignore.allfile", "1",
- "sonar.issue.ignore.allfile.1.fileRegexp", "");
- }
-
- protected BuildResult scan(String... properties) {
- orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/exclusions/IssueExclusionsTest/with-many-rules.xml"));
- orchestrator.getServer().provisionProject("com.sonarsource.it.samples:multi-modules-exclusions",
- "Sonar :: Integration Tests :: Multi-modules With Exclusions");
- orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-exclusions", "xoo", "with-many-rules");
-
- SonarRunner scan = SonarRunner.create(ItUtils.projectDir(PROJECT_DIR))
- .setProperties("sonar.cpd.skip", "true")
- .setProperties(properties)
- .setProperties("sonar.verbose", "true");
- return orchestrator.executeBuildQuietly(scan);
- }
-
- private void checkIssueCountBySeverity(int total, int taggedXoo, int perLine, int perFile, int blocker, int perModule) {
- Resource project = orchestrator.getServer().getWsClient()
- .find(ResourceQuery.createForMetrics(PROJECT_KEY, "violations", "info_violations", "minor_violations", "major_violations",
- "blocker_violations", "critical_violations"));
- assertThat(project.getMeasureIntValue("violations")).isEqualTo(total);
- assertThat(project.getMeasureIntValue("info_violations")).isEqualTo(taggedXoo); // Has tag 'xoo'
- assertThat(project.getMeasureIntValue("minor_violations")).isEqualTo(perLine); // One per line
- assertThat(project.getMeasureIntValue("major_violations")).isEqualTo(perFile); // One per file
- assertThat(project.getMeasureIntValue("blocker_violations")).isEqualTo(blocker);
- assertThat(project.getMeasureIntValue("critical_violations")).isEqualTo(perModule); // One per module
- }
-
- private void checkAnalysisFails(String... properties) {
- BuildResult buildResult = scan(properties);
- assertThat(buildResult.getStatus()).isNotEqualTo(0);
- assertThat(buildResult.getLogs().indexOf("SonarException")).isGreaterThan(0);
- }
-}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package issue.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.locator.FileLocation;
-import java.util.List;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.wsclient.issue.Issue;
-import org.sonar.wsclient.issue.IssueQuery;
-
-import static issue.suite.IssueTestSuite.searchIssues;
-import static org.assertj.core.api.Assertions.assertThat;
-import static util.ItUtils.runProjectAnalysis;
-
-public class CommonRulesTest {
-
- public static final String FILE_KEY = "common-rules-project:src/Sample.xoo";
- public static final String TEST_FILE_KEY = "common-rules-project:test/SampleTest.xoo";
-
- @ClassRule
- public static Orchestrator orchestrator = IssueTestSuite.ORCHESTRATOR;
-
- @BeforeClass
- public static void setUp() {
- orchestrator.resetData();
- orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/issue/suite/CommonRulesTest/xoo-common-rules-profile.xml"));
- orchestrator.getServer().provisionProject("common-rules-project", "Sample");
- orchestrator.getServer().associateProjectToQualityProfile("common-rules-project", "xoo", "xoo-common-rules");
- runProjectAnalysis(orchestrator, "issue/common-rules",
- "sonar.cpd.xoo.minimumTokens", "2",
- "sonar.cpd.xoo.minimumLines", "2");
- }
-
- @Test
- public void test_rule_on_duplicated_blocks() {
- List<Issue> issues = findIssues(FILE_KEY, "common-xoo:DuplicatedBlocks");
- assertThat(issues).hasSize(1);
- }
-
- @Test
- public void test_rule_on_comments() {
- List<Issue> issues = findIssues(FILE_KEY, "common-xoo:InsufficientCommentDensity");
- assertThat(issues.size()).isEqualTo(1);
- }
-
- @Test
- public void test_rule_on_coverage() {
- List<Issue> issues = findIssues(FILE_KEY, "common-xoo:InsufficientBranchCoverage");
- assertThat(issues.size()).isEqualTo(1);
-
- issues = findIssues(FILE_KEY, "common-xoo:InsufficientLineCoverage");
- assertThat(issues.size()).isEqualTo(1);
- }
-
- @Test
- public void test_rule_on_skipped_tests() {
- List<Issue> issues = findIssues(TEST_FILE_KEY, "common-xoo:SkippedUnitTests");
- assertThat(issues.size()).isEqualTo(1);
- }
-
- @Test
- public void test_rule_on_test_errors() {
- List<Issue> issues = findIssues(TEST_FILE_KEY, "common-xoo:FailedUnitTests");
- assertThat(issues.size()).isEqualTo(1);
- }
-
- private List<Issue> findIssues(String componentKey, String ruleKey) {
- return searchIssues(IssueQuery.create().components(componentKey).rules(ruleKey));
- }
-}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package issue.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import java.util.List;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.wsclient.issue.Issue;
-import util.ProjectAnalysis;
-import util.ProjectAnalysisRule;
-
-import static issue.suite.IssueTestSuite.searchIssues;
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class CustomRulesTest {
-
- @ClassRule
- public static Orchestrator orchestrator = IssueTestSuite.ORCHESTRATOR;
- @Rule
- public final ProjectAnalysisRule projectAnalysisRule = ProjectAnalysisRule.from(orchestrator);
-
- private ProjectAnalysis xooSampleAnalysis;
-
- @Before
- public void setup() {
- String profileKey = projectAnalysisRule.registerProfile("/issue/suite/CustomRulesTest/custom.xml");
- String projectKey = projectAnalysisRule.registerProject("shared/xoo-sample");
- this.xooSampleAnalysis = projectAnalysisRule.newProjectAnalysis(projectKey)
- .withQualityProfile(profileKey);
- }
-
- @Test
- public void analyzeProjectWithCustomRules() throws Exception {
- orchestrator.getServer().adminWsClient().post("api/rules/create",
- "template_key", "xoo:TemplateRule",
- "custom_key", "MyCustomRule",
- "markdown_description", "My description",
- "name", "My custom rule",
- "severity", "BLOCKER",
- "params", "line=2");
-
- xooSampleAnalysis.run();
-
- List<Issue> issues = searchIssues();
- assertThat(issues).hasSize(1);
-
- Issue issue = issues.get(0);
- assertThat(issue.ruleKey()).isEqualTo("xoo:MyCustomRule");
- assertThat(issue.line()).isEqualTo(2);
- // Overriden in quality profile
- assertThat(issue.severity()).isEqualTo("CRITICAL");
- }
-}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package issue.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import java.util.List;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.wsclient.base.HttpException;
-import org.sonar.wsclient.issue.ActionPlan;
-import org.sonar.wsclient.issue.ActionPlanClient;
-import org.sonar.wsclient.issue.Issue;
-import org.sonar.wsclient.issue.IssueComment;
-import org.sonar.wsclient.issue.IssueQuery;
-import org.sonar.wsclient.issue.Issues;
-import org.sonar.wsclient.issue.NewActionPlan;
-import util.ProjectAnalysis;
-import util.ProjectAnalysisRule;
-
-import static issue.suite.IssueTestSuite.ORCHESTRATOR;
-import static issue.suite.IssueTestSuite.adminIssueClient;
-import static issue.suite.IssueTestSuite.search;
-import static issue.suite.IssueTestSuite.searchIssueByKey;
-import static issue.suite.IssueTestSuite.searchIssues;
-import static issue.suite.IssueTestSuite.searchRandomIssue;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.fail;
-import static util.ItUtils.toDate;
-import static util.ItUtils.verifyHttpException;
-
-public class IssueActionTest {
-
- @ClassRule
- public static Orchestrator orchestrator = ORCHESTRATOR;
- @Rule
- public final ProjectAnalysisRule projectAnalysisRule = ProjectAnalysisRule.from(orchestrator);
-
- Issue issue;
- ProjectAnalysis projectAnalysis;
-
- @Before
- public void setup() {
- String qualityProfileKey = projectAnalysisRule.registerProfile("/issue/suite/IssueActionTest/xoo-one-issue-per-line-profile.xml");
- String projectKey = projectAnalysisRule.registerProject("shared/xoo-sample");
-
- this.projectAnalysis = projectAnalysisRule.newProjectAnalysis(projectKey).withQualityProfile(qualityProfileKey);
- this.projectAnalysis.run();
- this.issue = searchRandomIssue();
- }
-
- @Test
- public void no_comments_by_default() throws Exception {
- assertThat(issue.comments()).isEmpty();
- }
-
- @Test
- public void add_comment() throws Exception {
- IssueComment comment = adminIssueClient().addComment(issue.key(), "this is my *comment*");
- assertThat(comment.key()).isNotNull();
- assertThat(comment.htmlText()).isEqualTo("this is my <em>comment</em>");
- assertThat(comment.login()).isEqualTo("admin");
- assertThat(comment.createdAt()).isNotNull();
-
- // reload issue
- Issue reloaded = searchIssues(issue.key(), true).iterator().next();
-
- assertThat(reloaded.comments()).hasSize(1);
- assertThat(reloaded.comments().get(0).key()).isEqualTo(comment.key());
- assertThat(reloaded.comments().get(0).htmlText()).isEqualTo("this is my <em>comment</em>");
- assertThat(reloaded.updateDate().before(issue.creationDate())).isFalse();
- }
-
- /**
- * SONAR-4450
- */
- @Test
- public void should_reject_blank_comment() throws Exception {
- try {
- adminIssueClient().addComment(issue.key(), " ");
- fail();
- } catch (HttpException ex) {
- assertThat(ex.status()).isEqualTo(400);
- }
-
- Issue reloaded = searchIssueByKey(issue.key());
- assertThat(reloaded.comments()).hasSize(0);
- }
-
- /**
- * SONAR-4352
- */
- @Test
- public void change_severity() {
- String componentKey = "sample";
-
- // there are no blocker issues
- assertThat(searchIssuesBySeverities(componentKey, "BLOCKER")).isEmpty();
-
- // increase the severity of an issue
- adminIssueClient().setSeverity(issue.key(), "BLOCKER");
-
- assertThat(searchIssuesBySeverities(componentKey, "BLOCKER")).hasSize(1);
-
- projectAnalysis.run();
- Issue reloaded = searchIssueByKey(issue.key());
- assertThat(reloaded.severity()).isEqualTo("BLOCKER");
- assertThat(reloaded.status()).isEqualTo("OPEN");
- assertThat(reloaded.resolution()).isNull();
- assertThat(reloaded.creationDate()).isEqualTo(issue.creationDate());
- assertThat(reloaded.creationDate().before(reloaded.updateDate())).isTrue();
- }
-
- /**
- * SONAR-4287
- */
- @Test
- public void assign() {
- assertThat(issue.assignee()).isNull();
- Issues issues = search(IssueQuery.create().issues(issue.key()));
- assertThat(issues.users()).isEmpty();
-
- adminIssueClient().assign(issue.key(), "admin");
- assertThat(searchIssues(IssueQuery.create().assignees("admin"))).hasSize(1);
-
- projectAnalysis.run();
- Issue reloaded = searchIssueByKey(issue.key());
- assertThat(reloaded.assignee()).isEqualTo("admin");
- assertThat(reloaded.creationDate()).isEqualTo(issue.creationDate());
-
- issues = search(IssueQuery.create().issues(issue.key()));
- assertThat(issues.user("admin")).isNotNull();
- assertThat(issues.user("admin").name()).isEqualTo("Administrator");
-
- // unassign
- adminIssueClient().assign(issue.key(), null);
- reloaded = searchIssueByKey(issue.key());
- assertThat(reloaded.assignee()).isNull();
- assertThat(searchIssues(IssueQuery.create().assignees("admin"))).isEmpty();
- }
-
- /**
- * SONAR-4287
- */
- @Test
- public void fail_assign_if_assignee_does_not_exist() {
- assertThat(issue.assignee()).isNull();
- try {
- adminIssueClient().assign(issue.key(), "unknown");
- fail();
- } catch (Exception e) {
- verifyHttpException(e, 400);
- }
- }
-
- /**
- * SONAR-4290
- */
- @Test
- public void plan() {
- assertThat(issue.actionPlan()).isNull();
-
- // Set action plan to issue
- ActionPlan newActionPlan = adminActionPlanClient().create(NewActionPlan.create().name("Short term").project("sample")
- .description("Short term issues").deadLine(toDate("2113-01-31")));
- assertThat(newActionPlan.key()).isNotNull();
- adminIssueClient().plan(issue.key(), newActionPlan.key());
- assertThat(search(IssueQuery.create().actionPlans(newActionPlan.key())).list()).hasSize(1);
-
- projectAnalysis.run();
- Issue reloaded = searchIssueByKey(issue.key());
- assertThat(reloaded.actionPlan()).isEqualTo(newActionPlan.key());
- assertThat(reloaded.creationDate()).isEqualTo(issue.creationDate());
- ActionPlan actionPlan = search(IssueQuery.create().actionPlans(newActionPlan.key())).actionPlans(reloaded);
- assertThat(actionPlan.name()).isEqualTo(newActionPlan.name());
- assertThat(actionPlan.deadLine()).isEqualTo(newActionPlan.deadLine());
- }
-
- @Test
- public void fail_plan_if_action_plan_does_not_exist() {
- assertThat(issue.actionPlan()).isNull();
- try {
- adminIssueClient().plan(issue.key(), "unknown");
- fail();
- } catch (Exception e) {
- verifyHttpException(e, 400);
- }
- }
-
- @Test
- public void unplan() {
- assertThat(issue.actionPlan()).isNull();
-
- // Set action plan to issue
- ActionPlan newActionPlan = adminActionPlanClient().create(NewActionPlan.create().name("Short term").project("sample")
- .description("Short term issues").deadLine(toDate("2113-01-31")));
- assertThat(newActionPlan.key()).isNotNull();
- adminIssueClient().plan(issue.key(), newActionPlan.key());
- assertThat(search(IssueQuery.create().actionPlans(newActionPlan.key())).list()).hasSize(1);
-
- // Unplan
- adminIssueClient().plan(issue.key(), null);
- assertThat(search(IssueQuery.create().actionPlans(newActionPlan.key())).list()).hasSize(0);
-
- projectAnalysis.run();
- Issue reloaded = searchIssueByKey(issue.key());
- assertThat(reloaded.actionPlan()).isNull();
- assertThat(reloaded.creationDate()).isEqualTo(issue.creationDate());
- }
-
- /**
- * SONAR-4315
- */
- @Test
- public void apply_action_from_plugin() {
- // The condition on the action defined by the plugin is that the status must be resolved
- adminIssueClient().doTransition(issue.key(), "resolve");
- assertThat(adminIssueClient().actions(issue.key())).contains("fake");
-
- adminIssueClient().doAction(issue.key(), "fake");
-
- // reload issue
- Issue reloaded = searchIssues(issue.key(), true).iterator().next();
-
- assertThat(reloaded.comments()).hasSize(1);
- assertThat(reloaded.comments().get(0).htmlText()).isEqualTo("New Comment from fake action");
-
- // The action is no more available when already executed (because an issue attribute is used to check if the action is available or not)
- assertThat(adminIssueClient().actions(issue.key())).doesNotContain("fake");
- }
-
- /**
- * SONAR-4315
- */
- @Test
- public void issue_attribute_are_kept_on_new_analysis() {
- // The condition on the action defined by the plugin is that the status must be resolved
- adminIssueClient().doTransition(issue.key(), "resolve");
- adminIssueClient().doAction(issue.key(), "fake");
- assertThat(adminIssueClient().actions(issue.key())).doesNotContain("fake");
-
- projectAnalysis.run();
-
- // Fake action is no more available if the issue attribute is still there
- assertThat(adminIssueClient().actions(issue.key())).doesNotContain("fake");
- }
-
- private static List<Issue> searchIssuesBySeverities(String componentKey, String... severities) {
- return searchIssues(IssueQuery.create().componentRoots(componentKey).severities(severities));
- }
-
- private static ActionPlanClient adminActionPlanClient() {
- return orchestrator.getServer().adminWsClient().actionPlanClient();
- }
-
-}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package issue.suite;
-
-import com.google.common.base.Function;
-import com.google.common.collect.FluentIterable;
-import com.sonar.orchestrator.Orchestrator;
-import java.util.List;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.wsclient.base.HttpException;
-import org.sonar.wsclient.issue.ActionPlan;
-import org.sonar.wsclient.issue.ActionPlanClient;
-import org.sonar.wsclient.issue.BulkChange;
-import org.sonar.wsclient.issue.BulkChangeQuery;
-import org.sonar.wsclient.issue.Issue;
-import org.sonar.wsclient.issue.NewActionPlan;
-import util.ItUtils;
-import util.ProjectAnalysis;
-import util.ProjectAnalysisRule;
-
-import static issue.suite.IssueTestSuite.ORCHESTRATOR;
-import static issue.suite.IssueTestSuite.adminIssueClient;
-import static issue.suite.IssueTestSuite.issueClient;
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * SONAR-4421
- */
-public class IssueBulkChangeTest {
-
- private static final int BULK_EDITED_ISSUE_COUNT = 3;
- private static final String COMMENT_AS_MARKDOWN = "this is my *comment*";
- private static final String COMMENT_AS_HTML = "this is my <em>comment</em>";
-
- @ClassRule
- public static Orchestrator orchestrator = ORCHESTRATOR;
- @Rule
- public final ProjectAnalysisRule projectAnalysisRule = ProjectAnalysisRule.from(orchestrator);
-
- private ProjectAnalysis xooSampleLittleIssuesAnalysis;
-
- @Before
- public void setUp() throws Exception {
- String qualityProfileKey = projectAnalysisRule.registerProfile("/issue/suite/IssueBulkChangeTest/one-issue-per-line-profile.xml");
- String projectKey = projectAnalysisRule.registerProject("shared/xoo-sample");
- this.xooSampleLittleIssuesAnalysis = projectAnalysisRule.newProjectAnalysis(projectKey)
- .withQualityProfile(qualityProfileKey);
- }
-
- @Test
- public void should_change_severity() {
- xooSampleLittleIssuesAnalysis.run();
-
- String newSeverity = "BLOCKER";
- String[] issueKeys = searchIssueKeys(BULK_EDITED_ISSUE_COUNT);
- BulkChange bulkChange = bulkChangeSeverityOfIssues(issueKeys, newSeverity);
-
- assertThat(bulkChange.totalIssuesChanged()).isEqualTo(BULK_EDITED_ISSUE_COUNT);
- assertIssueSeverity(issueKeys, newSeverity);
- }
-
- @Test
- public void should_do_transition() {
- xooSampleLittleIssuesAnalysis.run();
- String[] issueKeys = searchIssueKeys(BULK_EDITED_ISSUE_COUNT);
- BulkChange bulkChange = bulkTransitionStatusOfIssues(issueKeys, "confirm");
-
- assertThat(bulkChange.totalIssuesChanged()).isEqualTo(BULK_EDITED_ISSUE_COUNT);
- assertIssueStatus(issueKeys, "CONFIRMED");
- }
-
- @Test
- public void should_assign() {
- xooSampleLittleIssuesAnalysis.run();
-
- String[] issueKeys = searchIssueKeys(BULK_EDITED_ISSUE_COUNT);
- BulkChange bulkChange = buldChangeAssigneeOfIssues(issueKeys, "admin");
-
- assertThat(bulkChange.totalIssuesChanged()).isEqualTo(BULK_EDITED_ISSUE_COUNT);
- for (Issue issue : IssueTestSuite.searchIssues(issueKeys)) {
- assertThat(issue.assignee()).isEqualTo("admin");
- }
- }
-
- @Test
- public void should_plan() {
- xooSampleLittleIssuesAnalysis.run();
-
- // Create action plan
- ActionPlan newActionPlan = adminActionPlanClient().create(
- NewActionPlan.create().name("Short term").project("sample").description("Short term issues").deadLine(ItUtils.toDate("2113-01-31")));
-
- String[] issueKeys = searchIssueKeys(BULK_EDITED_ISSUE_COUNT);
- BulkChange bulkChange = adminIssueClient().bulkChange(
- BulkChangeQuery.create()
- .issues(issueKeys)
- .actions("plan")
- .actionParameter("plan", "plan", newActionPlan.key())
- );
-
- assertThat(bulkChange.totalIssuesChanged()).isEqualTo(BULK_EDITED_ISSUE_COUNT);
- for (Issue issue : IssueTestSuite.searchIssues(issueKeys)) {
- assertThat(issue.actionPlan()).isEqualTo(newActionPlan.key());
- }
- }
-
- @Test
- public void should_setSeverity_add_comment_in_single_WS_call() {
- xooSampleLittleIssuesAnalysis.run();
-
- String newSeverity = "BLOCKER";
- String[] issueKeys = searchIssueKeys(BULK_EDITED_ISSUE_COUNT);
-
- BulkChange bulkChange = adminIssueClient().bulkChange(
- BulkChangeQuery.create()
- .issues(issueKeys)
- .actions("set_severity", "comment")
- .actionParameter("set_severity", "severity", newSeverity)
- .actionParameter("comment", "comment", COMMENT_AS_MARKDOWN)
- );
-
- assertThat(bulkChange.totalIssuesChanged()).isEqualTo(BULK_EDITED_ISSUE_COUNT);
- for (Issue issue : IssueTestSuite.searchIssues(issueKeys, true)) {
- assertThat(issue.comments()).hasSize(1);
- assertThat(issue.comments().get(0).htmlText()).isEqualTo(COMMENT_AS_HTML);
- }
- }
-
- @Test
- public void should_apply_bulk_change_on_many_actions() {
- xooSampleLittleIssuesAnalysis.run();
-
- String newSeverity = "BLOCKER";
- String[] issueKeys = searchIssueKeys(BULK_EDITED_ISSUE_COUNT);
-
- BulkChange bulkChange = adminIssueClient().bulkChange(
- BulkChangeQuery.create()
- .issues(issueKeys)
- .actions("do_transition", "assign", "set_severity")
- .actionParameter("do_transition", "transition", "confirm")
- .actionParameter("assign", "assignee", "admin")
- .actionParameter("set_severity", "severity", newSeverity)
- .comment(COMMENT_AS_MARKDOWN)
- );
-
- assertThat(bulkChange.totalIssuesChanged()).isEqualTo(BULK_EDITED_ISSUE_COUNT);
- for (Issue issue : IssueTestSuite.searchIssues(issueKeys, true)) {
- assertThat(issue.status()).isEqualTo("CONFIRMED");
- assertThat(issue.assignee()).isEqualTo("admin");
- assertThat(issue.severity()).isEqualTo(newSeverity);
- assertThat(issue.comments()).hasSize(1);
- assertThat(issue.comments().get(0).htmlText()).isEqualTo(COMMENT_AS_HTML);
- }
- }
-
- @Test
- public void should_not_apply_bulk_change_if_not_logged() {
- xooSampleLittleIssuesAnalysis.run();
-
- String newSeverity = "BLOCKER";
- String[] issueKeys = searchIssueKeys(BULK_EDITED_ISSUE_COUNT);
-
- try {
- issueClient().bulkChange(createBulkChangeSeverityOfIssuesQuery(issueKeys, newSeverity));
- } catch (Exception e) {
- assertHttpException(e, 401);
- }
- }
-
- @Test
- public void should_not_apply_bulk_change_if_no_change_to_do() {
- xooSampleLittleIssuesAnalysis.run();
-
- String newSeverity = "BLOCKER";
- String[] issueKeys = searchIssueKeys(BULK_EDITED_ISSUE_COUNT);
-
- // Apply the bulk change a first time
- BulkChange bulkChange = bulkChangeSeverityOfIssues(issueKeys, newSeverity);
- assertThat(bulkChange.totalIssuesChanged()).isEqualTo(BULK_EDITED_ISSUE_COUNT);
-
- // Re apply the same bulk change -> no issue should be changed
- bulkChange = bulkChangeSeverityOfIssues(issueKeys, newSeverity);
- assertThat(bulkChange.totalIssuesChanged()).isEqualTo(0);
- assertThat(bulkChange.totalIssuesNotChanged()).isEqualTo(BULK_EDITED_ISSUE_COUNT);
- }
-
- @Test
- public void should_not_apply_bulk_change_if_no_issue_selected() {
- try {
- bulkChangeSeverityOfIssues(new String[] {}, "BLOCKER");
- } catch (Exception e) {
- assertHttpException(e, 400);
- }
- }
-
- @Test
- public void should_not_apply_bulk_change_if_action_is_invalid() {
- xooSampleLittleIssuesAnalysis.run();
-
- int limit = BULK_EDITED_ISSUE_COUNT;
- String[] issueKeys = searchIssueKeys(limit);
-
- BulkChangeQuery query = (BulkChangeQuery.create().issues(issueKeys).actions("invalid"));
- try {
- adminIssueClient().bulkChange(query);
- } catch (Exception e) {
- assertHttpException(e, 400);
- }
- }
-
- @Test
- public void should_add_comment_only_on_issues_that_will_be_changed() {
- xooSampleLittleIssuesAnalysis.run();
- int nbIssues = BULK_EDITED_ISSUE_COUNT;
- String[] issueKeys = searchIssueKeys(nbIssues);
-
- // Confirm an issue
- adminIssueClient().doTransition(IssueTestSuite.searchIssues().iterator().next().key(), "confirm");
-
- // Apply a bulk change on unconfirm transition
- BulkChangeQuery query = (BulkChangeQuery.create()
- .issues(issueKeys)
- .actions("do_transition")
- .actionParameter("do_transition", "transition", "unconfirm")
- .comment("this is my comment")
- );
- BulkChange bulkChange = adminIssueClient().bulkChange(query);
- assertThat(bulkChange.totalIssuesChanged()).isEqualTo(1);
-
- int nbIssuesWithComment = 0;
- for (Issue issue : IssueTestSuite.searchIssues(issueKeys, true)) {
- if (!issue.comments().isEmpty()) {
- nbIssuesWithComment++;
- }
- }
- // Only one issue should have the comment
- assertThat(nbIssuesWithComment).isEqualTo(1);
- }
-
- private static void assertIssueSeverity(String[] issueKeys, String expectedSeverity) {
- for (Issue issue : IssueTestSuite.searchIssues(issueKeys)) {
- assertThat(issue.severity()).isEqualTo(expectedSeverity);
- }
- }
-
- private static void assertIssueStatus(String[] issueKeys, String expectedStatus) {
- for (Issue issue : IssueTestSuite.searchIssues(issueKeys)) {
- assertThat(issue.status()).isEqualTo(expectedStatus);
- }
- }
-
- private static void assertHttpException(Exception e, int expectedCode) {
- assertThat(e).isInstanceOf(HttpException.class);
- assertThat(((HttpException) e).status()).isEqualTo(expectedCode);
- }
-
- private static BulkChange bulkChangeSeverityOfIssues(String[] issueKeys, String newSeverity) {
- BulkChangeQuery bulkChangeQuery = createBulkChangeSeverityOfIssuesQuery(issueKeys, newSeverity);
-
- return adminIssueClient().bulkChange(bulkChangeQuery);
- }
-
- private static BulkChangeQuery createBulkChangeSeverityOfIssuesQuery(String[] issueKeys, String newSeverity) {
- BulkChangeQuery bulkChangeQuery = BulkChangeQuery.create()
- .actions("set_severity")
- .actionParameter("set_severity", "severity", newSeverity);
- if (issueKeys != null && issueKeys.length > 0) {
- bulkChangeQuery.issues(issueKeys);
- }
- return bulkChangeQuery;
- }
-
- private static BulkChange bulkTransitionStatusOfIssues(String[] issueKeys, String newSeverity) {
- return adminIssueClient().bulkChange(
- BulkChangeQuery.create()
- .issues(issueKeys)
- .actions("do_transition")
- .actionParameter("do_transition", "transition", newSeverity)
- );
- }
-
- private static BulkChange buldChangeAssigneeOfIssues(String[] issueKeys, String newAssignee) {
- return adminIssueClient().bulkChange(
- BulkChangeQuery.create()
- .issues(issueKeys)
- .actions("assign")
- .actionParameter("assign", "assignee", newAssignee)
- );
- }
-
- private static String[] getIssueKeys(List<Issue> issues, int nbIssues) {
- return FluentIterable.from(issues)
- .limit(nbIssues)
- .transform(IssueToKey.INSTANCE)
- .toArray(String.class);
- }
-
- private static String[] searchIssueKeys(int limit) {
- return getIssueKeys(IssueTestSuite.searchIssues(), limit);
- }
-
- private static ActionPlanClient adminActionPlanClient() {
- return orchestrator.getServer().adminWsClient().actionPlanClient();
- }
-
- private enum IssueToKey implements Function<Issue, String> {
- INSTANCE;
-
- public String apply(Issue issue) {
- return issue.key();
- }
- }
-}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package issue.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import java.util.List;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.wsclient.issue.Issue;
-import org.sonar.wsclient.issue.IssueChange;
-import org.sonar.wsclient.issue.IssueChangeDiff;
-import org.sonar.wsclient.issue.IssueQuery;
-import util.ProjectAnalysis;
-import util.ProjectAnalysisRule;
-
-import static issue.suite.IssueTestSuite.ORCHESTRATOR;
-import static issue.suite.IssueTestSuite.adminIssueClient;
-import static issue.suite.IssueTestSuite.issueClient;
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class IssueChangelogTest {
-
- @ClassRule
- public static Orchestrator orchestrator = ORCHESTRATOR;
- @Rule
- public final ProjectAnalysisRule projectAnalysisRule = ProjectAnalysisRule.from(orchestrator);
-
- Issue issue;
- ProjectAnalysis xooSampleAnalysis;
-
- @Before
- public void resetData() {
- xooSampleAnalysis = projectAnalysisRule
- .newProjectAnalysis(projectAnalysisRule.registerProject("shared/xoo-sample"))
- .withQualityProfile(projectAnalysisRule.registerProfile("/issue/suite/IssueChangelogTest/one-issue-per-line-profile.xml"));
- xooSampleAnalysis.run();
- issue = searchRandomIssue();
- }
-
- @Test
- public void update_changelog_when_assigning_issue_by_user() throws Exception {
- assertIssueHasNoChange(issue.key());
-
- adminIssueClient().assign(issue.key(), "admin");
-
- List<IssueChange> changes = retrieveChangeForIssue(issue.key());
- assertThat(changes).hasSize(1);
- IssueChange change = changes.get(0);
- assertThat(change.user()).isEqualTo("admin");
- assertThat(change.creationDate()).isNotNull();
- assertThat(change.diffs()).hasSize(1);
- IssueChangeDiff changeDiff = change.diffs().get(0);
- assertThat(changeDiff.key()).isEqualTo("assignee");
- assertThat(changeDiff.oldValue()).isNull();
- assertThat(changeDiff.newValue()).isEqualTo("Administrator");
- }
-
- @Test
- public void update_changelog_when_reopening_unresolved_issue_by_scan() throws Exception {
- assertIssueHasNoChange(issue.key());
-
- // re analyse the project after resolving an issue in order to reopen it
- adminIssueClient().doTransition(issue.key(), "resolve");
- xooSampleAnalysis.run();
-
- List<IssueChange> changes = retrieveChangeForIssue(issue.key());
- assertThat(changes).hasSize(2);
-
- // Change done by the user (first change is be the oldest one)
- IssueChange change1 = changes.get(0);
- assertThat(change1.user()).isEqualTo("admin");
- assertThat(change1.creationDate()).isNotNull();
- assertThat(change1.diffs()).hasSize(2);
-
- IssueChangeDiff change1Diff1 = change1.diffs().get(0);
- assertThat(change1Diff1.key()).isEqualTo("resolution");
- assertThat(change1Diff1.oldValue()).isNull();
- assertThat(change1Diff1.newValue()).isEqualTo("FIXED");
-
- IssueChangeDiff change1Diff2 = change1.diffs().get(1);
- assertThat(change1Diff2.key()).isEqualTo("status");
- assertThat(change1Diff2.oldValue()).isEqualTo("OPEN");
- assertThat(change1Diff2.newValue()).isEqualTo("RESOLVED");
-
- // Change done by scan
- IssueChange change2 = changes.get(1);
- assertThat(change2.user()).isNull();
- assertThat(change2.creationDate()).isNotNull();
- assertThat(change2.diffs()).hasSize(2);
-
- IssueChangeDiff changeDiff1 = change2.diffs().get(0);
- assertThat(changeDiff1.key()).isEqualTo("resolution");
- assertThat(changeDiff1.oldValue()).isNull();
- assertThat(changeDiff1.newValue()).isNull();
-
- IssueChangeDiff changeDiff2 = change2.diffs().get(1);
- assertThat(changeDiff2.key()).isEqualTo("status");
- assertThat(changeDiff2.oldValue()).isEqualTo("RESOLVED");
- assertThat(changeDiff2.newValue()).isEqualTo("REOPENED");
- }
-
- private static Issue searchRandomIssue() {
- List<Issue> issues = issueClient().find(IssueQuery.create()).list();
- assertThat(issues).isNotEmpty();
- return issues.get(0);
- }
-
- private void assertIssueHasNoChange(String issueKey) {
- assertThat(retrieveChangeForIssue(issueKey)).isEmpty();
- }
-
- private List<IssueChange> retrieveChangeForIssue(String issueKey) {
- return issueClient().changes(issueKey);
- }
-
-}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package issue.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import java.util.List;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.wsclient.issue.Issue;
-import org.sonar.wsclient.issue.IssueQuery;
-import org.sonar.wsclient.services.Measure;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-import util.ProjectAnalysis;
-import util.ProjectAnalysisRule;
-
-import static issue.suite.IssueTestSuite.ORCHESTRATOR;
-import static issue.suite.IssueTestSuite.searchIssues;
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * Tests the extension point IssueFilter
- */
-public class IssueFilterExtensionTest {
-
- @ClassRule
- public static Orchestrator orchestrator = ORCHESTRATOR;
- @Rule
- public final ProjectAnalysisRule projectAnalysisRule = ProjectAnalysisRule.from(orchestrator);
-
- private final String manyRuleProfileKey = projectAnalysisRule.registerProfile("/issue/suite/IssueFilterExtensionTest/xoo-with-many-rules.xml");
- private final String xooMultiModuleProjectKey = projectAnalysisRule.registerProject("shared/xoo-multi-modules-sample");
- private final ProjectAnalysis analysis = projectAnalysisRule.newProjectAnalysis(xooMultiModuleProjectKey)
- .withQualityProfile(manyRuleProfileKey);
-
- @Test
- public void should_filter_files() throws Exception {
- analysis.withProperties("sonar.exclusions", "**/HelloA1.xoo").run();
-
- List<Issue> issues = searchIssues();
- assertThat(issues).isNotEmpty();
- for (Issue issue : issues) {
- // verify exclusion to avoid false positive
- assertThat(issue.componentKey()).doesNotContain("HelloA1");
- }
-
- assertThat(getMeasure(xooMultiModuleProjectKey, "violations").getIntValue()).isEqualTo(issues.size());
- }
-
- @Test
- public void should_filter_issues() {
- // first analysis without issue-filter
- analysis.run();
-
- // Issue filter removes issues on lines < 5
- // Deprecated violation filter removes issues detected by PMD
- List<Issue> unresolvedIssues = searchResolvedIssues(xooMultiModuleProjectKey);
- int issuesBeforeLine5 = countIssuesBeforeLine5(unresolvedIssues);
- int pmdIssues = countModuleIssues(unresolvedIssues);
- assertThat(issuesBeforeLine5).isGreaterThan(0);
- assertThat(pmdIssues).isGreaterThan(0);
-
- // Enable issue filters
- analysis.withProperties("enableIssueFilters", "true").run();
-
- unresolvedIssues = searchResolvedIssues(xooMultiModuleProjectKey);
- List<Issue> resolvedIssues = searchUnresolvedIssues(xooMultiModuleProjectKey);
- assertThat(countIssuesBeforeLine5(unresolvedIssues)).isZero();
- assertThat(countModuleIssues(unresolvedIssues)).isZero();
- assertThat(countModuleIssues(resolvedIssues)).isGreaterThan(0);
- for (Issue issue : resolvedIssues) {
- // SONAR-6364 no line number on closed issues
- assertThat(issue.line()).isNull();
- }
- }
-
- private static List<Issue> searchUnresolvedIssues(String projectName) {
- return searchIssues(IssueQuery.create().componentRoots(projectName).resolved(true));
- }
-
- private static List<Issue> searchResolvedIssues(String projectName) {
- return searchIssues(IssueQuery.create().componentRoots(projectName).resolved(false));
- }
-
- private static Measure getMeasure(String projectKey, String metricKey) {
- Resource resource = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(projectKey, metricKey));
- return resource == null ? null : resource.getMeasure(metricKey);
- }
-
- private static int countModuleIssues(List<Issue> issues) {
- int count = 0;
- for (Issue issue : issues) {
- if (issue.ruleKey().equals("xoo:OneIssuePerModule")) {
- count++;
- }
- }
- return count;
- }
-
- private static int countIssuesBeforeLine5(List<Issue> issues) {
- int count = 0;
- for (Issue issue : issues) {
- if (issue.line() != null && issue.line() < 5) {
- count++;
- }
- }
- return count;
- }
-}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package issue.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import java.util.List;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.wsclient.issue.Issue;
-import org.sonar.wsclient.issue.IssueQuery;
-import util.ProjectAnalysis;
-import util.ProjectAnalysisRule;
-
-import static issue.suite.IssueTestSuite.ORCHESTRATOR;
-import static issue.suite.IssueTestSuite.searchIssues;
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class IssuePurgeTest {
-
- @ClassRule
- public static Orchestrator orchestrator = ORCHESTRATOR;
- @Rule
- public final ProjectAnalysisRule projectAnalysisRule = ProjectAnalysisRule.from(orchestrator);
-
- private ProjectAnalysis xooSampleAnalysis;
- private ProjectAnalysis xooMultiModuleAnalysis;
-
- @Before
- public void setUp() throws Exception {
- String manyRulesProfile = projectAnalysisRule.registerProfile("/issue/suite/IssuePurgeTest/with-many-rules.xml");
- String xooSampleProjectKey = projectAnalysisRule.registerProject("shared/xoo-sample");
- this.xooSampleAnalysis = projectAnalysisRule.newProjectAnalysis(xooSampleProjectKey)
- .withQualityProfile(manyRulesProfile);
- String xooMultiModuleProjectKey = projectAnalysisRule.registerProject("shared/xoo-multi-modules-sample");
- this.xooMultiModuleAnalysis = projectAnalysisRule.newProjectAnalysis(xooMultiModuleProjectKey)
- .withQualityProfile(manyRulesProfile);
- }
-
- /**
- * SONAR-4308
- */
- @Test
- public void purge_old_closed_issues() throws Exception {
- projectAnalysisRule.setServerProperty("sonar.dbcleaner.daysBeforeDeletingClosedIssues", "5000");
-
- // Generate some issues
- xooSampleAnalysis.withProperties(
- "sonar.dynamicAnalysis", "false",
- "sonar.projectDate", "2014-10-01")
- .run();
-
- // All the issues are open
- List<Issue> issues = searchIssues();
- for (Issue issue : issues) {
- assertThat(issue.resolution()).isNull();
- }
-
- // Second scan with empty profile -> all issues are resolved and closed
- // -> Not deleted because less than 5000 days long
- xooSampleAnalysis
- .withXooEmptyProfile()
- .withProperties(
- "sonar.dynamicAnalysis", "false",
- "sonar.projectDate", "2014-10-15")
- .run();
- issues = searchIssues();
- assertThat(issues).isNotEmpty();
- for (Issue issue : issues) {
- assertThat(issue.resolution()).isNotNull();
- assertThat(issue.status()).isEqualTo("CLOSED");
- }
-
- // Third scan -> closed issues are deleted
- projectAnalysisRule.setServerProperty("sonar.dbcleaner.daysBeforeDeletingClosedIssues", "1");
-
- xooSampleAnalysis.withXooEmptyProfile()
- .withProperties(
- "sonar.dynamicAnalysis", "false",
- "sonar.projectDate", "2014-10-20")
- .run();
- assertThat(searchIssues(IssueQuery.create())).isEmpty();
- }
-
- /**
- * SONAR-5200
- */
- @Test
- public void resolve_issues_when_removing_module() throws Exception {
- // Generate some issues
- xooMultiModuleAnalysis
- .withProperties("sonar.dynamicAnalysis", "false")
- .run();
-
- // All the issues are open
- List<Issue> issues = searchIssues();
- for (Issue issue : issues) {
- assertThat(issue.resolution()).isNull();
- }
- Issue issue = issues.get(0);
-
- int issuesOnModuleB = searchIssues(IssueQuery.create().componentRoots("com.sonarsource.it.samples:multi-modules-sample:module_b")).size();
- assertThat(issuesOnModuleB).isEqualTo(28);
-
- // Second scan without module B -> issues on module B are resolved as removed and closed
- xooMultiModuleAnalysis
- .withProperties(
- "sonar.dynamicAnalysis", "false",
- "sonar.modules", "module_a")
- .run();
-
- // Resolved should should all be mark as REMOVED and affect to module b
- List<Issue> reloadedIssues = searchIssues(IssueQuery.create().resolved(true));
- assertThat(reloadedIssues).hasSize(issuesOnModuleB);
- for (Issue reloadedIssue : reloadedIssues) {
- assertThat(reloadedIssue.resolution()).isEqualTo("FIXED");
- assertThat(reloadedIssue.status()).isEqualTo("CLOSED");
- assertThat(reloadedIssue.componentKey()).contains("com.sonarsource.it.samples:multi-modules-sample:module_b");
- assertThat(reloadedIssue.updateDate().before(issue.updateDate())).isFalse();
- assertThat(reloadedIssue.closeDate()).isNotNull();
- assertThat(reloadedIssue.closeDate().before(reloadedIssue.creationDate())).isFalse();
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package issue.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import java.util.List;
-import org.junit.ClassRule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.sonar.wsclient.issue.Issue;
-import org.sonar.wsclient.issue.IssueClient;
-import org.sonar.wsclient.issue.IssueQuery;
-import org.sonar.wsclient.issue.Issues;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static util.ItUtils.pluginArtifact;
-import static util.ItUtils.xooPlugin;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- CommonRulesTest.class,
- IssueWorkflowTest.class,
- ManualRulesTest.class,
- CustomRulesTest.class,
- IssueActionTest.class,
- IssueChangelogTest.class,
- IssueBulkChangeTest.class,
- IssuePurgeTest.class,
- IssueFilterExtensionTest.class
-})
-public class IssueTestSuite {
-
- @ClassRule
- public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv()
- .addPlugin(xooPlugin())
- .addPlugin(pluginArtifact("issue-action-plugin"))
- .addPlugin(pluginArtifact("issue-filter-plugin"))
- .build();
-
- static IssueClient adminIssueClient() {
- return ORCHESTRATOR.getServer().adminWsClient().issueClient();
- }
-
- static IssueClient issueClient() {
- return ORCHESTRATOR.getServer().wsClient().issueClient();
- }
-
- static Issue searchRandomIssue() {
- List<Issue> issues = searchIssues(IssueQuery.create());
- assertThat(issues).isNotEmpty();
- return issues.get(0);
- }
-
- static Issues search(IssueQuery issueQuery) {
- issueQuery.urlParams().put("additionalFields", "_all");
- return issueClient().find(issueQuery);
- }
-
- static Issue searchIssueByKey(String issueKey) {
- List<Issue> issues = searchIssues(IssueQuery.create().issues(issueKey));
- assertThat(issues).hasSize(1);
- return issues.get(0);
- }
-
- static List<Issue> searchIssues(String... issueKeys) {
- return searchIssues(issueKeys, false);
- }
-
- static List<Issue> searchIssues(String issueKey, boolean withComments) {
- return searchIssues(new String[] {issueKey}, withComments);
- }
-
- static List<Issue> searchIssues(String[] issueKeys, boolean withComments) {
- IssueQuery query = IssueQuery.create().issues(issueKeys);
- if (withComments) {
- query.urlParams().put("additionalFields", "comments");
- }
- return searchIssues(query);
- }
-
- static List<Issue> searchIssues() {
- return searchIssues(IssueQuery.create());
- }
-
- static List<Issue> searchIssues(IssueQuery issueQuery) {
- return issueClient().find(issueQuery).list();
- }
-}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package issue.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import java.util.List;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.wsclient.issue.Issue;
-import org.sonar.wsclient.issue.IssueQuery;
-import util.ProjectAnalysis;
-import util.ProjectAnalysisRule;
-
-import static issue.suite.IssueTestSuite.adminIssueClient;
-import static issue.suite.IssueTestSuite.searchIssueByKey;
-import static issue.suite.IssueTestSuite.searchIssues;
-import static issue.suite.IssueTestSuite.searchRandomIssue;
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class IssueWorkflowTest {
-
- @ClassRule
- public static Orchestrator orchestrator = IssueTestSuite.ORCHESTRATOR;
-
- @Rule
- public final ProjectAnalysisRule projectAnalysisRule = ProjectAnalysisRule.from(orchestrator);
-
- private ProjectAnalysis analysisWithIssues;
- private ProjectAnalysis analysisWithoutIssues;
- private Issue issue;
-
- @Before
- public void before() {
- String oneIssuePerFileProfileKey = projectAnalysisRule.registerProfile("/issue/suite/IssueWorkflowTest/xoo-one-issue-per-line-profile.xml");
- String analyzedProjectKey = projectAnalysisRule.registerProject("issue/workflow");
- analysisWithIssues = projectAnalysisRule.newProjectAnalysis(analyzedProjectKey).withQualityProfile(oneIssuePerFileProfileKey);
- analysisWithoutIssues = analysisWithIssues.withXooEmptyProfile();
- analysisWithIssues.run();
-
- issue = searchRandomIssue();
- }
-
- /**
- * Issue on a disabled rule (uninstalled plugin or rule deactivated from quality profile) must
- * be CLOSED with resolution REMOVED
- */
- @Test
- public void issue_is_closed_as_removed_when_rule_is_disabled() throws Exception {
- List<Issue> issues = searchIssues(IssueQuery.create().rules("xoo:OneIssuePerLine"));
- assertThat(issues).isNotEmpty();
-
- // re-analyze with profile "empty". The rule is disabled so the issues must be closed
- analysisWithoutIssues.run();
- issues = searchIssues(IssueQuery.create().rules("xoo:OneIssuePerLine"));
- assertThat(issues).isNotEmpty();
- for (Issue issue : issues) {
- assertThat(issue.status()).isEqualTo("CLOSED");
- assertThat(issue.resolution()).isEqualTo("REMOVED");
- }
- }
-
- /**
- * SONAR-4329
- */
- @Test
- public void user_should_confirm_issue() {
- // mark as confirmed
- adminIssueClient().doTransition(issue.key(), "confirm");
-
- Issue confirmed = searchIssueByKey(issue.key());
- assertThat(confirmed.status()).isEqualTo("CONFIRMED");
- assertThat(confirmed.resolution()).isNull();
- assertThat(confirmed.creationDate()).isEqualTo(issue.creationDate());
-
- // user unconfirm the issue
- assertThat(adminIssueClient().transitions(confirmed.key())).contains("unconfirm");
- adminIssueClient().doTransition(confirmed.key(), "unconfirm");
-
- Issue unconfirmed = searchIssueByKey(issue.key());
- assertThat(unconfirmed.status()).isEqualTo("REOPENED");
- assertThat(unconfirmed.resolution()).isNull();
- assertThat(unconfirmed.creationDate()).isEqualTo(confirmed.creationDate());
- }
-
- /**
- * SONAR-4329
- */
- @Test
- public void user_should_mark_as_false_positive_confirmed_issue() {
- // mark as confirmed
- adminIssueClient().doTransition(issue.key(), "confirm");
-
- Issue confirmed = searchIssueByKey(issue.key());
- assertThat(confirmed.status()).isEqualTo("CONFIRMED");
- assertThat(confirmed.resolution()).isNull();
- assertThat(confirmed.creationDate()).isEqualTo(issue.creationDate());
-
- // user mark the issue as false-positive
- assertThat(adminIssueClient().transitions(confirmed.key())).contains("falsepositive");
- adminIssueClient().doTransition(confirmed.key(), "falsepositive");
-
- Issue falsePositive = searchIssueByKey(issue.key());
- assertThat(falsePositive.status()).isEqualTo("RESOLVED");
- assertThat(falsePositive.resolution()).isEqualTo("FALSE-POSITIVE");
- assertThat(falsePositive.creationDate()).isEqualTo(confirmed.creationDate());
- }
-
- /**
- * SONAR-4329
- */
- @Test
- public void scan_should_close_no_more_existing_confirmed() {
- // mark as confirmed
- adminIssueClient().doTransition(issue.key(), "confirm");
- Issue falsePositive = searchIssueByKey(issue.key());
- assertThat(falsePositive.status()).isEqualTo("CONFIRMED");
- assertThat(falsePositive.resolution()).isNull();
- assertThat(falsePositive.creationDate()).isEqualTo(issue.creationDate());
-
- // scan without any rules -> confirmed is closed
- analysisWithoutIssues.run();
- Issue closed = searchIssueByKey(issue.key());
- assertThat(closed.status()).isEqualTo("CLOSED");
- assertThat(closed.resolution()).isEqualTo("REMOVED");
- assertThat(closed.creationDate()).isEqualTo(issue.creationDate());
- }
-
- /**
- * SONAR-4288
- */
- @Test
- public void scan_should_reopen_unresolved_issue_but_marked_as_resolved() {
- // mark as resolved
- adminIssueClient().doTransition(issue.key(), "resolve");
- Issue resolvedIssue = searchIssueByKey(issue.key());
- assertThat(resolvedIssue.status()).isEqualTo("RESOLVED");
- assertThat(resolvedIssue.resolution()).isEqualTo("FIXED");
- assertThat(resolvedIssue.creationDate()).isEqualTo(issue.creationDate());
- assertThat(resolvedIssue.updateDate().before(resolvedIssue.creationDate())).isFalse();
- assertThat(resolvedIssue.updateDate().before(issue.updateDate())).isFalse();
-
- // re-execute scan, with the same Q profile -> the issue has not been fixed
- analysisWithIssues.run();
-
- // reload issue
- Issue reopenedIssue = searchIssueByKey(issue.key());
-
- // the issue has been reopened
- assertThat(reopenedIssue.status()).isEqualTo("REOPENED");
- assertThat(reopenedIssue.resolution()).isNull();
- assertThat(reopenedIssue.creationDate()).isEqualTo(issue.creationDate());
- assertThat(reopenedIssue.updateDate().before(issue.updateDate())).isFalse();
- }
-
- /**
- * SONAR-4288
- */
- @Test
- public void scan_should_close_resolved_issue() {
- // mark as resolved
- adminIssueClient().doTransition(issue.key(), "resolve");
- Issue resolvedIssue = searchIssueByKey(issue.key());
- assertThat(resolvedIssue.status()).isEqualTo("RESOLVED");
- assertThat(resolvedIssue.resolution()).isEqualTo("FIXED");
- assertThat(resolvedIssue.creationDate()).isEqualTo(issue.creationDate());
- assertThat(resolvedIssue.closeDate()).isNull();
-
- // re-execute scan without rules -> the issue is removed with resolution "REMOVED"
- analysisWithoutIssues.run();
-
- // reload issue
- Issue closedIssue = searchIssueByKey(issue.key());
- assertThat(closedIssue.status()).isEqualTo("CLOSED");
- assertThat(closedIssue.resolution()).isEqualTo("REMOVED");
- assertThat(closedIssue.creationDate()).isEqualTo(issue.creationDate());
- assertThat(closedIssue.updateDate().before(resolvedIssue.updateDate())).isFalse();
- assertThat(closedIssue.closeDate()).isNotNull();
- assertThat(closedIssue.closeDate().before(closedIssue.creationDate())).isFalse();
- }
-
- /**
- * SONAR-4288
- */
- @Test
- public void user_should_reopen_issue_marked_as_resolved() {
- // user marks issue as resolved
- adminIssueClient().doTransition(issue.key(), "resolve");
- Issue resolved = searchIssueByKey(issue.key());
- assertThat(resolved.status()).isEqualTo("RESOLVED");
- assertThat(resolved.resolution()).isEqualTo("FIXED");
- assertThat(resolved.creationDate()).isEqualTo(issue.creationDate());
-
- // user reopens the issue
- assertThat(adminIssueClient().transitions(resolved.key())).contains("reopen");
- adminIssueClient().doTransition(resolved.key(), "reopen");
-
- Issue reopened = searchIssueByKey(resolved.key());
- assertThat(reopened.status()).isEqualTo("REOPENED");
- assertThat(reopened.resolution()).isNull();
- assertThat(reopened.creationDate()).isEqualTo(resolved.creationDate());
- assertThat(reopened.updateDate().before(resolved.updateDate())).isFalse();
- }
-
- /**
- * SONAR-4286
- */
- @Test
- public void scan_should_not_reopen_or_close_false_positives() {
- // user marks issue as false-positive
- adminIssueClient().doTransition(issue.key(), "falsepositive");
-
- Issue falsePositive = searchIssueByKey(issue.key());
- assertThat(falsePositive.status()).isEqualTo("RESOLVED");
- assertThat(falsePositive.resolution()).isEqualTo("FALSE-POSITIVE");
- assertThat(falsePositive.creationDate()).isEqualTo(issue.creationDate());
-
- // re-execute the same scan
- analysisWithIssues.run();
-
- // refresh
- Issue reloaded = searchIssueByKey(falsePositive.key());
- assertThat(reloaded.status()).isEqualTo("RESOLVED");
- assertThat(reloaded.resolution()).isEqualTo("FALSE-POSITIVE");
- assertThat(reloaded.creationDate()).isEqualTo(issue.creationDate());
- // TODO check that update date has not been changed
- }
-
- /**
- * SONAR-4286
- */
- @Test
- public void scan_should_close_no_more_existing_false_positive() {
- // user marks as false-positive
- adminIssueClient().doTransition(issue.key(), "falsepositive");
- Issue falsePositive = searchIssueByKey(issue.key());
- assertThat(falsePositive.status()).isEqualTo("RESOLVED");
- assertThat(falsePositive.resolution()).isEqualTo("FALSE-POSITIVE");
- assertThat(falsePositive.creationDate()).isEqualTo(issue.creationDate());
-
- // scan without any rules -> false-positive is closed
- analysisWithoutIssues.run();
- Issue closed = searchIssueByKey(issue.key());
- assertThat(closed.status()).isEqualTo("CLOSED");
- assertThat(closed.resolution()).isEqualTo("REMOVED");
- assertThat(closed.creationDate()).isEqualTo(issue.creationDate());
- }
-
- /**
- * SONAR-4286
- */
- @Test
- public void user_should_reopen_false_positive() {
- // user marks as false-positive
- adminIssueClient().doTransition(issue.key(), "falsepositive");
-
- Issue falsePositive = searchIssueByKey(issue.key());
- assertThat(falsePositive.status()).isEqualTo("RESOLVED");
- assertThat(falsePositive.resolution()).isEqualTo("FALSE-POSITIVE");
- assertThat(falsePositive.creationDate()).isEqualTo(issue.creationDate());
-
- // user reopens the issue
- assertThat(adminIssueClient().transitions(falsePositive.key())).contains("reopen");
- adminIssueClient().doTransition(falsePositive.key(), "reopen");
-
- Issue reopened = searchIssueByKey(issue.key());
- assertThat(reopened.status()).isEqualTo("REOPENED");
- assertThat(reopened.resolution()).isNull();
- assertThat(reopened.creationDate()).isEqualTo(falsePositive.creationDate());
- }
-
- @Test
- public void user_should_not_reopen_closed_issue() {
- adminIssueClient().doTransition(issue.key(), "resolve");
-
- // re-execute scan without rules -> the issue is closed
- analysisWithoutIssues.run();
-
- // user try to reopen the issue
- assertThat(adminIssueClient().transitions(issue.key())).isEmpty();
- }
-
-}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package issue.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.selenium.Selenese;
-import java.sql.Connection;
-import java.sql.SQLException;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import util.selenium.SeleneseTest;
-
-public class ManualRulesTest {
-
- @ClassRule
- public static Orchestrator orchestrator = IssueTestSuite.ORCHESTRATOR;
-
- @BeforeClass
- public static void setup() throws Exception {
- orchestrator.resetData();
- deleteManualRules();
- }
-
- @AfterClass
- public static void purgeManualRules() {
- deleteManualRules();
- }
-
- @Test
- public void testManualRules() {
- Selenese selenese = Selenese
- .builder()
- .setHtmlTestsInClasspath("manual-rules",
- "/issue/suite/ManualRulesTest/create_edit_delete_manual_rule.html"
- ).build();
- new SeleneseTest(selenese).runOn(orchestrator);
- }
-
- protected static void deleteManualRules(){
- try {
- Connection connection = orchestrator.getDatabase().openConnection();
- connection.prepareStatement("DELETE FROM rules WHERE rules.plugin_name='manual'").execute();
- } catch (SQLException e) {
- throw new IllegalStateException("Fail to remove manual rules", e);
- }
- }
-
-}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package it;/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+import com.sonar.orchestrator.Orchestrator;
+import it.i18n.I18nTest;
+import it.permission.IssuePermissionTest;
+import it.projectAdministration.BulkDeletionTest;
+import it.projectAdministration.ProjectAdministrationTest;
+import it.qualityGate.QualityGateNotificationTest;
+import it.qualityGate.QualityGateTest;
+import it.settings.PropertySetsTest;
+import it.settings.SettingsTest;
+import it.settings.SettingsTestRestartingOrchestrator;
+import it.settings.SubCategoriesTest;
+import org.junit.ClassRule;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+import static util.ItUtils.pluginArtifact;
+import static util.ItUtils.xooPlugin;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ // project administration
+ BulkDeletionTest.class,
+ ProjectAdministrationTest.class,
+ // settings
+ PropertySetsTest.class,
+ SubCategoriesTest.class,
+ SettingsTest.class,
+ SettingsTestRestartingOrchestrator.class,
+ // i18n
+ I18nTest.class,
+ // quality gate
+ QualityGateTest.class,
+ QualityGateNotificationTest.class,
+ // permission
+ IssuePermissionTest.class
+})
+public class Category1Suite {
+
+ @ClassRule
+ public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv()
+ .setServerProperty("sonar.notifications.delay", "1")
+ .addPlugin(pluginArtifact("property-sets-plugin"))
+ .addPlugin(pluginArtifact("sonar-subcategories-plugin"))
+
+ // Used in I18nTest
+ .addPlugin(pluginArtifact("l10n-fr-pack"))
+
+ // 1 second. Required for notification test.
+ .setServerProperty("sonar.notifications.delay", "1")
+
+ // Used in SettingsTest.global_property_change_extension_point
+ .addPlugin(pluginArtifact("global-property-change-plugin"))
+
+ // Used in SettingsTest.should_get_settings_default_value
+ .addPlugin(pluginArtifact("server-plugin"))
+
+ .addPlugin(xooPlugin())
+ .build();
+
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package it;/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+import com.sonar.orchestrator.Orchestrator;
+import it.customMeasure.CustomMeasuresTest;
+import it.issue.CommonRulesTest;
+import it.issue.CustomRulesTest;
+import it.issue.IssueActionTest;
+import it.issue.IssueBulkChangeTest;
+import it.issue.IssueChangelogTest;
+import it.issue.IssueFilterExtensionTest;
+import it.issue.IssuePurgeTest;
+import it.issue.IssueWorkflowTest;
+import it.issue.ManualRulesTest;
+import it.measureFilter.MeasureFiltersTest;
+import it.measure.NewDebtRatioMeasureTest;
+import it.measure.TechnicalDebtMeasureVariationTest;
+import it.measureHistory.DifferentialPeriodsTest;
+import it.measureHistory.TimeMachineTest;
+import it.test.CoverageTest;
+import it.test.CoverageTrackingTest;
+import it.test.NewCoverageTest;
+import it.test.TestExecutionTest;
+import org.junit.ClassRule;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+import static util.ItUtils.pluginArtifact;
+import static util.ItUtils.xooPlugin;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ // custom measure
+ CustomMeasuresTest.class,
+ // measure history
+ DifferentialPeriodsTest.class,
+ TimeMachineTest.class,
+ // measure
+ TechnicalDebtMeasureVariationTest.class,
+ NewDebtRatioMeasureTest.class,
+ MeasureFiltersTest.class,
+ // test
+ CoverageTrackingTest.class,
+ CoverageTest.class,
+ NewCoverageTest.class,
+ TestExecutionTest.class,
+ // issue
+ CommonRulesTest.class,
+ IssueWorkflowTest.class,
+ ManualRulesTest.class,
+ CustomRulesTest.class,
+ IssueActionTest.class,
+ IssueChangelogTest.class,
+ IssueBulkChangeTest.class,
+ IssuePurgeTest.class,
+ IssueFilterExtensionTest.class
+})
+public class Category2Suite {
+
+ @ClassRule
+ public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv()
+ .addPlugin(xooPlugin())
+
+ // issue
+ .addPlugin(pluginArtifact("issue-action-plugin"))
+ .addPlugin(pluginArtifact("issue-filter-plugin"))
+
+ .build();
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package it;
+
+import com.sonar.orchestrator.Orchestrator;
+import it.analysis.BatchTest;
+import it.analysis.ExtensionLifecycleTest;
+import it.analysis.IssueJsonReportTest;
+import it.analysis.IssuesModeTest;
+import it.analysis.LinksTest;
+import it.analysis.MavenTest;
+import it.analysis.MultiLanguageTest;
+import it.analysis.ProjectBuilderTest;
+import it.analysis.ProjectExclusionsTest;
+import it.analysis.ProjectProvisioningTest;
+import it.analysis.SettingsEncryptionTest;
+import it.analysis.TempFolderTest;
+import it.analysisExclusion.FileExclusionsTest;
+import it.analysisExclusion.IssueExclusionsTest;
+import it.duplication.CrossProjectDuplicationsTest;
+import it.duplication.DuplicationsTest;
+import org.junit.ClassRule;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+import static util.ItUtils.pluginArtifact;
+import static util.ItUtils.xooPlugin;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ // analysis
+ ExtensionLifecycleTest.class,
+ LinksTest.class,
+ MavenTest.class,
+ ProjectBuilderTest.class,
+ ProjectExclusionsTest.class,
+ TempFolderTest.class,
+ MultiLanguageTest.class,
+ IssueJsonReportTest.class,
+ ProjectProvisioningTest.class,
+ BatchTest.class,
+ IssuesModeTest.class,
+ SettingsEncryptionTest.class
+})
+public class Category3Suite {
+
+ @ClassRule
+ public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv()
+ .addPlugin(xooPlugin())
+ .setOrchestratorProperty("javaVersion", "LATEST_RELEASE").addPlugin("java")
+ .setContext("/")
+
+ // Used by SettingsEncryptionTest
+ .addPlugin(pluginArtifact("settings-encryption-plugin"))
+
+ // Used by IssuesModeTest
+ .addPlugin(pluginArtifact("access-secured-props-plugin"))
+
+ // used by TempFolderTest
+ .addPlugin(pluginArtifact("batch-plugin"))
+
+ // used by ExtensionLifecycleTest
+ .addPlugin(pluginArtifact("extension-lifecycle-plugin"))
+
+ // used by ProjectBuilderTest
+ .addPlugin(pluginArtifact("project-builder-plugin"))
+
+ .build();
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it;
+
+import com.sonar.orchestrator.Orchestrator;
+import it.analysisExclusion.FileExclusionsTest;
+import it.analysisExclusion.IssueExclusionsTest;
+import it.componentSearch.ProjectSearchTest;
+import it.duplication.CrossProjectDuplicationsTest;
+import it.duplication.DuplicationsTest;
+import it.serverSystem.DevModeTest;
+import it.serverSystem.HttpsTest;
+import it.serverSystem.ServerSystemRestartingOrchestrator;
+import it.serverSystem.ServerSystemTest;
+import it.updateCenter.UpdateCenterTest;
+import it.user.FavouriteTest;
+import it.user.ForceAuthenticationTest;
+import org.junit.ClassRule;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+import static util.ItUtils.xooPlugin;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ // server system
+ DevModeTest.class,
+ HttpsTest.class,
+ ServerSystemTest.class,
+ ServerSystemRestartingOrchestrator.class,
+ // user
+ ForceAuthenticationTest.class,
+ FavouriteTest.class,
+ // project search
+ ProjectSearchTest.class,
+ // update center
+ UpdateCenterTest.class,
+ // analysis exclusion
+ FileExclusionsTest.class,
+ IssueExclusionsTest.class,
+ // duplication
+ CrossProjectDuplicationsTest.class,
+ DuplicationsTest.class
+})
+public class Category4Suite {
+
+ @ClassRule
+ public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv()
+ .addPlugin(xooPlugin())
+ .setOrchestratorProperty("javaVersion", "LATEST_RELEASE").addPlugin("java")
+ .build();
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package it;
+
+import it.plugins.PluginsTest;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ PluginsTest.class,
+})
+public class PluginsSuite {
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package it.analysis;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.BuildFailureException;
+import com.sonar.orchestrator.build.BuildResult;
+import com.sonar.orchestrator.build.SonarRunner;
+import com.sonar.orchestrator.locator.FileLocation;
+import it.Category3Suite;
+import java.io.File;
+import java.io.IOException;
+import java.util.Date;
+import org.apache.commons.io.FileUtils;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.rules.TemporaryFolder;
+import org.sonar.wsclient.Sonar;
+import org.sonar.wsclient.services.PropertyDeleteQuery;
+import org.sonar.wsclient.services.PropertyUpdateQuery;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+import util.ItUtils;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class BatchTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category3Suite.ORCHESTRATOR;
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Rule
+ public TemporaryFolder temp = new TemporaryFolder();
+
+ @Before
+ public void deleteData() {
+ orchestrator.resetData();
+ orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/analysis/BatchTest/one-issue-per-line.xml"));
+ }
+
+ /**
+ * SONAR-3718
+ */
+ @Test
+ public void should_scan_branch_with_forward_slash() {
+ scan("shared/xoo-multi-modules-sample");
+ scan("shared/xoo-multi-modules-sample", "sonar.branch", "branch/0.x");
+
+ Sonar sonar = orchestrator.getServer().getWsClient();
+ assertThat(sonar.findAll(new ResourceQuery().setQualifiers("TRK"))).hasSize(2);
+
+ Resource master = sonar.find(new ResourceQuery("com.sonarsource.it.samples:multi-modules-sample"));
+ assertThat(master.getName()).isEqualTo("Sonar :: Integration Tests :: Multi-modules Sample");
+
+ Resource branch = sonar.find(new ResourceQuery("com.sonarsource.it.samples:multi-modules-sample:branch/0.x"));
+ assertThat(branch.getName()).isEqualTo("Sonar :: Integration Tests :: Multi-modules Sample branch/0.x");
+ }
+
+ @Test
+ public void use_sonar_profile_without_provisioning_project() {
+ scan("shared/xoo-multi-modules-sample",
+ "sonar.profile", "one-issue-per-line",
+ "sonar.verbose", "true");
+ Resource r = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("com.sonarsource.it.samples:multi-modules-sample", "violations"));
+ assertThat(r.getMeasureIntValue("violations")).isEqualTo(61);
+ }
+
+ /**
+ * SONAR-2907
+ */
+ @Test
+ public void branch_should_load_own_settings_from_database() {
+ orchestrator.getServer().provisionProject("com.sonarsource.it.samples:multi-modules-sample", "Sonar :: Integration Tests :: Multi-modules Sample");
+ orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-sample", "xoo", "one-issue-per-line");
+ scan("shared/xoo-multi-modules-sample");
+ assertThat(getResource("com.sonarsource.it.samples:multi-modules-sample:module_b")).isNotNull();
+
+ Sonar sonar = orchestrator.getServer().getAdminWsClient();
+ // The parameter skippedModule considers key after first colon
+ sonar.update(new PropertyUpdateQuery("sonar.skippedModules", "multi-modules-sample:module_b",
+ "com.sonarsource.it.samples:multi-modules-sample"));
+
+ try {
+ scan("shared/xoo-multi-modules-sample");
+ assertThat(getResource("com.sonarsource.it.samples:multi-modules-sample:module_b")).isNull();
+
+ scan("shared/xoo-multi-modules-sample",
+ "sonar.branch", "mybranch");
+
+ assertThat(getResource("com.sonarsource.it.samples:multi-modules-sample:module_b:mybranch")).isNotNull();
+ } finally {
+ sonar.delete(new PropertyDeleteQuery("sonar.skippedModules", "com.sonarsource.it.samples:multi-modules-sample"));
+ }
+ }
+
+ // SONAR-4680
+ @Test
+ public void module_should_load_own_settings_from_database() {
+ orchestrator.getServer().provisionProject("com.sonarsource.it.samples:multi-modules-sample", "Sonar :: Integration Tests :: Multi-modules Sample");
+
+ Sonar sonar = orchestrator.getServer().getAdminWsClient();
+ String propKey = "myFakeProperty";
+ String rootModuleKey = "com.sonarsource.it.samples:multi-modules-sample";
+ String moduleBKey = rootModuleKey + ":module_b";
+ sonar.delete(new PropertyDeleteQuery(propKey, rootModuleKey));
+ sonar.delete(new PropertyDeleteQuery(propKey, moduleBKey));
+
+ BuildResult result = scan("shared/xoo-multi-modules-sample", "sonar.showSettings", propKey);
+
+ assertThat(result.getLogs()).doesNotContain(rootModuleKey + ":" + propKey);
+ assertThat(result.getLogs()).doesNotContain(moduleBKey + ":" + propKey);
+
+ // Set property only on root project
+ sonar.update(new PropertyUpdateQuery(propKey, "project", rootModuleKey));
+
+ result = scan("shared/xoo-multi-modules-sample", "sonar.showSettings", propKey);
+
+ assertThat(result.getLogs()).contains(rootModuleKey + ":" + propKey + " = project");
+ assertThat(result.getLogs()).contains(moduleBKey + ":" + propKey + " = project");
+
+ // Override property on moduleB
+ sonar.update(new PropertyUpdateQuery(propKey, "moduleB", moduleBKey));
+
+ result = scan("shared/xoo-multi-modules-sample", "sonar.showSettings", propKey);
+
+ assertThat(result.getLogs()).contains(rootModuleKey + ":" + propKey + " = project");
+ assertThat(result.getLogs()).contains(moduleBKey + ":" + propKey + " = moduleB");
+ }
+
+ // SONAR-4680
+ @Test
+ public void module_should_load_settings_from_parent() {
+ orchestrator.getServer().provisionProject("com.sonarsource.it.samples:multi-modules-sample", "Sonar :: Integration Tests :: Multi-modules Sample");
+
+ Sonar sonar = orchestrator.getServer().getAdminWsClient();
+ String propKey = "myFakeProperty";
+ String rootModuleKey = "com.sonarsource.it.samples:multi-modules-sample";
+ String moduleBKey = rootModuleKey + ":module_b";
+
+ // Set property on provisionned project
+ sonar.update(new PropertyUpdateQuery(propKey, "project", rootModuleKey));
+ sonar.delete(new PropertyDeleteQuery(propKey, moduleBKey));
+
+ BuildResult result = scan("shared/xoo-multi-modules-sample", "sonar.showSettings", propKey);
+
+ assertThat(result.getLogs()).contains(rootModuleKey + ":" + propKey + " = project");
+ // Module should inherit from parent
+ assertThat(result.getLogs()).contains(moduleBKey + ":" + propKey + " = project");
+ }
+
+ /**
+ * SONAR-3116
+ */
+ @Test
+ public void should_not_exclude_root_module() {
+ orchestrator.getServer().provisionProject("com.sonarsource.it.samples:multi-modules-sample", "Sonar :: Integration Tests :: Multi-modules Sample");
+ orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-sample", "xoo", "one-issue-per-line");
+
+ thrown.expect(BuildFailureException.class);
+ scan("shared/xoo-multi-modules-sample",
+ "sonar.skippedModules", "multi-modules-sample");
+ }
+
+ /**
+ * SONAR-3024
+ */
+ @Test
+ public void should_support_source_files_with_same_deprecated_key() {
+ orchestrator.getServer().provisionProject("com.sonarsource.it.projects.batch:duplicate-source", "exclusions");
+ orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.projects.batch:duplicate-source", "xoo", "one-issue-per-line");
+ scan("analysis/duplicate-source");
+
+ Sonar sonar = orchestrator.getServer().getAdminWsClient();
+ Resource project = sonar.find(new ResourceQuery("com.sonarsource.it.projects.batch:duplicate-source").setMetrics("files", "directories"));
+ // 2 main files and 1 test file all with same deprecated key
+ assertThat(project.getMeasureIntValue("files")).isEqualTo(2);
+ assertThat(project.getMeasureIntValue("directories")).isEqualTo(3);
+ }
+
+ /**
+ * SONAR-3125
+ */
+ @Test
+ public void should_display_explicit_message_when_no_plugin_language_available() {
+ orchestrator.getServer().provisionProject("sample", "xoo-sample");
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
+
+ BuildResult buildResult = scanQuietly("shared/xoo-sample",
+ "sonar.language", "foo",
+ "sonar.profile", "");
+ assertThat(buildResult.getStatus()).isEqualTo(1);
+ assertThat(buildResult.getLogs()).contains(
+ "You must install a plugin that supports the language 'foo'");
+ }
+
+ @Test
+ public void should_display_explicit_message_when_wrong_profile() {
+ orchestrator.getServer().provisionProject("sample", "xoo-sample");
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
+
+ BuildResult buildResult = scanQuietly("shared/xoo-sample",
+ "sonar.profile", "unknow");
+ assertThat(buildResult.getStatus()).isEqualTo(1);
+ assertThat(buildResult.getLogs()).contains(
+ "sonar.profile was set to 'unknow' but didn't match any profile for any language. Please check your configuration.");
+ }
+
+ @Test
+ public void should_honor_sonarUserHome() {
+ File userHome = temp.getRoot();
+
+ orchestrator.getServer().provisionProject("sample", "xoo-sample");
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
+
+ SonarRunner runner = configureRunner("shared/xoo-sample",
+ "sonar.verbose", "true");
+ runner.setEnvironmentVariable("SONAR_USER_HOME", "/dev/null");
+ BuildResult buildResult = orchestrator.executeBuildQuietly(runner);
+ assertThat(buildResult.getStatus()).isEqualTo(1);
+
+ buildResult = scan("shared/xoo-sample",
+ "sonar.verbose", "true",
+ "sonar.userHome", userHome.getAbsolutePath());
+ assertThat(buildResult.isSuccess()).isTrue();
+ }
+
+ @Test
+ public void should_authenticate_when_needed() {
+ try {
+ orchestrator.getServer().provisionProject("sample", "xoo-sample");
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
+
+ orchestrator.getServer().getAdminWsClient().update(new PropertyUpdateQuery("sonar.forceAuthentication", "true"));
+
+ BuildResult buildResult = scanQuietly("shared/xoo-sample",
+ "sonar.login", "",
+ "sonar.password", "");
+ assertThat(buildResult.getStatus()).isEqualTo(1);
+ assertThat(buildResult.getLogs()).contains(
+ "Not authorized. Analyzing this project requires to be authenticated. Please provide the values of the properties sonar.login and sonar.password.");
+
+ // SONAR-4048
+ buildResult = scanQuietly("shared/xoo-sample",
+ "sonar.login", "wrong_login",
+ "sonar.password", "wrong_password");
+ assertThat(buildResult.getStatus()).isEqualTo(1);
+ assertThat(buildResult.getLogs()).contains(
+ "Not authorized. Please check the properties sonar.login and sonar.password.");
+
+ buildResult = scan("shared/xoo-sample",
+ "sonar.login", "admin",
+ "sonar.password", "admin");
+ assertThat(buildResult.getStatus()).isEqualTo(0);
+
+ } finally {
+ orchestrator.getServer().getAdminWsClient().update(new PropertyUpdateQuery("sonar.forceAuthentication", "false"));
+ }
+ }
+
+ /**
+ * SONAR-4211 Test Sonar Runner when server requires authentication
+ */
+ @Test
+ public void sonar_runner_with_secured_server() {
+ try {
+ orchestrator.getServer().provisionProject("sample", "xoo-sample");
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
+
+ orchestrator.getServer().getAdminWsClient().update(new PropertyUpdateQuery("sonar.forceAuthentication", "true"));
+
+ BuildResult buildResult = scanQuietly("shared/xoo-sample");
+ assertThat(buildResult.getStatus()).isEqualTo(1);
+ assertThat(buildResult.getLogs()).contains(
+ "Not authorized. Analyzing this project requires to be authenticated. Please provide the values of the properties sonar.login and sonar.password.");
+
+ buildResult = scanQuietly("shared/xoo-sample",
+ "sonar.login", "wrong_login",
+ "sonar.password", "wrong_password");
+ assertThat(buildResult.getStatus()).isEqualTo(1);
+ assertThat(buildResult.getLogs()).contains(
+ "Not authorized. Please check the properties sonar.login and sonar.password.");
+
+ buildResult = scan("shared/xoo-sample",
+ "sonar.login", "admin",
+ "sonar.password", "admin");
+ assertThat(buildResult.getStatus()).isEqualTo(0);
+
+ } finally {
+ orchestrator.getServer().getAdminWsClient().update(new PropertyUpdateQuery("sonar.forceAuthentication", "false"));
+ }
+ }
+
+ /**
+ * SONAR-2291
+ */
+ @Test
+ public void batch_should_cache_plugin_jars() throws IOException {
+ File userHome = temp.newFolder();
+
+ BuildResult result = scan("shared/xoo-sample",
+ "sonar.userHome", userHome.getAbsolutePath());
+
+ File cache = new File(userHome, "cache");
+ assertThat(cache).exists().isDirectory();
+ int cachedFiles = FileUtils.listFiles(cache, new String[] {"jar"}, true).size();
+ assertThat(cachedFiles).isGreaterThan(5);
+ assertThat(result.getLogs()).contains("User cache: " + cache.getAbsolutePath());
+ assertThat(result.getLogs()).contains("Download sonar-xoo-plugin-");
+
+ result = scan("shared/xoo-sample",
+ "sonar.userHome", userHome.getAbsolutePath());
+ assertThat(cachedFiles).isEqualTo(cachedFiles);
+ assertThat(result.getLogs()).contains("User cache: " + cache.getAbsolutePath());
+ assertThat(result.getLogs()).doesNotContain("Download sonar-xoo-plugin-");
+ }
+
+ /**
+ * SONAR-4239
+ */
+ @Test
+ public void should_display_project_url_after_analysis() throws IOException {
+ orchestrator.getServer().provisionProject("com.sonarsource.it.samples:multi-modules-sample", "Sonar :: Integration Tests :: Multi-modules Sample");
+ orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-sample", "xoo", "one-issue-per-line");
+ Assume.assumeTrue(orchestrator.getServer().version().isGreaterThanOrEquals("3.6"));
+
+ BuildResult result = scan("shared/xoo-multi-modules-sample");
+
+ assertThat(result.getLogs()).contains("/dashboard/index/com.sonarsource.it.samples:multi-modules-sample");
+
+ result = scan("shared/xoo-multi-modules-sample",
+ "sonar.branch", "mybranch");
+
+ assertThat(result.getLogs()).contains("/dashboard/index/com.sonarsource.it.samples:multi-modules-sample:mybranch");
+
+ orchestrator.getServer().getAdminWsClient().update(new PropertyUpdateQuery("sonar.core.serverBaseURL", "http://foo:123/sonar"));
+
+ result = scan("shared/xoo-multi-modules-sample");
+
+ assertThat(result.getLogs()).contains("http://foo:123/sonar/dashboard/index/com.sonarsource.it.samples:multi-modules-sample");
+ }
+
+ /**
+ * SONAR-4188, SONAR-5178, SONAR-5915
+ */
+ @Test
+ public void should_display_explicit_message_when_invalid_project_key_or_branch() {
+ orchestrator.getServer().provisionProject("sample", "xoo-sample");
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
+
+ BuildResult buildResult = scanQuietly("shared/xoo-sample",
+ "sonar.projectKey", "ar g$l:");
+ assertThat(buildResult.getStatus()).isEqualTo(1);
+ assertThat(buildResult.getLogs()).contains("\"ar g$l:\" is not a valid project or module key")
+ .contains("Allowed characters");
+
+ // SONAR-4629
+ buildResult = scanQuietly("shared/xoo-sample",
+ "sonar.projectKey", "12345");
+ assertThat(buildResult.getStatus()).isEqualTo(1);
+ assertThat(buildResult.getLogs()).contains("\"12345\" is not a valid project or module key")
+ .contains("Allowed characters");
+
+ buildResult = scanQuietly("shared/xoo-sample",
+ "sonar.branch", "ar g$l:");
+ assertThat(buildResult.getStatus()).isEqualTo(1);
+ assertThat(buildResult.getLogs()).contains("\"ar g$l:\" is not a valid branch")
+ .contains("Allowed characters");
+ }
+
+ /**
+ * SONAR-4547
+ */
+ @Test
+ public void display_MessageException_without_stacktrace() throws Exception {
+ orchestrator.getServer().provisionProject("sample", "xoo-sample");
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
+ BuildResult result = scanQuietly("shared/xoo-sample", "raiseMessageException", "true");
+ assertThat(result.getStatus()).isNotEqualTo(0);
+ assertThat(result.getLogs())
+ // message
+ .contains("Error message from plugin")
+
+ // but not stacktrace
+ .doesNotContain("at com.sonarsource.RaiseMessageException");
+ }
+
+ /**
+ * SONAR-4751
+ */
+ @Test
+ public void file_extensions_are_case_insensitive() throws Exception {
+ orchestrator.getServer().provisionProject("case-sensitive-file-extensions", "Case Sensitive");
+ orchestrator.getServer().associateProjectToQualityProfile("case-sensitive-file-extensions", "xoo", "one-issue-per-line");
+ scan("analysis/case-sensitive-file-extensions");
+
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("case-sensitive-file-extensions", "files", "ncloc"));
+ assertThat(project.getMeasureIntValue("files")).isEqualTo(2);
+ assertThat(project.getMeasureIntValue("ncloc")).isEqualTo(5 + 2);
+ }
+
+ /**
+ * SONAR-4876
+ */
+ @Test
+ public void custom_module_key() {
+ orchestrator.getServer().provisionProject("com.sonarsource.it.samples:multi-modules-sample", "Sonar :: Integration Tests :: Multi-modules Sample");
+ orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-sample", "xoo", "one-issue-per-line");
+ scan("analysis/custom-module-key");
+ assertThat(getResource("com.sonarsource.it.samples:moduleA")).isNotNull();
+ assertThat(getResource("com.sonarsource.it.samples:moduleB")).isNotNull();
+ }
+
+ /**
+ * SONAR-4692
+ */
+ @Test
+ @Ignore("This test should be moved to a Medium test of the Compute Engine")
+ public void prevent_same_module_key_in_two_projects() {
+ orchestrator.getServer().provisionProject("projectAB", "project AB");
+ orchestrator.getServer().associateProjectToQualityProfile("projectAB", "xoo", "one-issue-per-line");
+ scan("analysis/prevent-common-module/projectAB");
+ assertThat(getResource("com.sonarsource.it.samples:moduleA")).isNotNull();
+ assertThat(getResource("com.sonarsource.it.samples:moduleB")).isNotNull();
+
+ orchestrator.getServer().provisionProject("projectAC", "project AC");
+ orchestrator.getServer().associateProjectToQualityProfile("projectAC", "xoo", "one-issue-per-line");
+
+ BuildResult result = scanQuietly("analysis/prevent-common-module/projectAC");
+ assertThat(result.getStatus()).isNotEqualTo(0);
+ assertThat(result.getLogs()).contains("Module \"com.sonarsource.it.samples:moduleA\" is already part of project \"projectAB\"");
+ }
+
+ /**
+ * SONAR-4235
+ */
+ @Test
+ public void test_project_creation_date() {
+ long before = new Date().getTime() - 2000l;
+ orchestrator.getServer().provisionProject("sample", "xoo-sample");
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
+ orchestrator.executeBuild(SonarRunner.create(ItUtils.projectDir("shared/xoo-sample")));
+ long after = new Date().getTime() + 2000l;
+ Resource xooSample = orchestrator.getServer().getWsClient().find(new ResourceQuery().setResourceKeyOrId("sample"));
+ assertThat(xooSample.getCreationDate().getTime()).isGreaterThan(before).isLessThan(after);
+ }
+
+ /**
+ * SONAR-4334
+ */
+ @Test
+ @Ignore("Should be move to CE IT/MT")
+ public void fail_if_project_date_is_older_than_latest_snapshot() {
+ orchestrator.getServer().provisionProject("sample", "xoo-sample");
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
+ SonarRunner analysis = SonarRunner.create(ItUtils.projectDir("shared/xoo-sample"));
+ analysis.setProperty("sonar.projectDate", "2014-01-01");
+ orchestrator.executeBuild(analysis);
+
+ analysis.setProperty("sonar.projectDate", "2000-10-19");
+ BuildResult result = orchestrator.executeBuildQuietly(analysis);
+
+ assertThat(result.getStatus()).isNotEqualTo(0);
+ assertThat(result.getLogs()).contains("'sonar.projectDate' property cannot be older than the date of the last known quality snapshot on this project. Value: '2000-10-19'. " +
+ "Latest quality snapshot: ");
+ assertThat(result.getLogs()).contains("This property may only be used to rebuild the past in a chronological order.");
+ }
+
+ private Resource getResource(String key) {
+ return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(key, "lines"));
+ }
+
+ private BuildResult scan(String projectPath, String... props) {
+ SonarRunner runner = configureRunner(projectPath, props);
+ return orchestrator.executeBuild(runner);
+ }
+
+ private BuildResult scanQuietly(String projectPath, String... props) {
+ SonarRunner runner = configureRunner(projectPath, props);
+ return orchestrator.executeBuildQuietly(runner);
+ }
+
+ private SonarRunner configureRunner(String projectPath, String... props) {
+ SonarRunner runner = SonarRunner.create(ItUtils.projectDir(projectPath))
+ .setProperties(props);
+ return runner;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package it.analysis;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.MavenBuild;
+import it.Category3Suite;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import util.ItUtils;
+
+public class ExtensionLifecycleTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category3Suite.ORCHESTRATOR;
+
+ @Before
+ public void cleanup() {
+ orchestrator.resetData();
+ }
+
+ @Test
+ public void testInstantiationStrategyAndLifecycleOfBatchExtensions() {
+ MavenBuild build = MavenBuild.create(ItUtils.projectPom("analysis/extension-lifecycle"))
+ .setCleanSonarGoals()
+ .setProperty("extension.lifecycle", "true")
+ .setProperty("sonar.dynamicAnalysis", "false");
+
+ // Build fails if the extensions provided in the extension-lifecycle-plugin are not correctly
+ // managed.
+ orchestrator.executeBuild(build);
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package it.analysis;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import com.sonar.orchestrator.locator.FileLocation;
+import com.sonar.orchestrator.locator.ResourceLocation;
+import it.Category3Suite;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.skyscreamer.jsonassert.JSONAssert;
+import util.ItUtils;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class IssueJsonReportTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category3Suite.ORCHESTRATOR;
+
+ @Rule
+ public TemporaryFolder temp = new TemporaryFolder();
+
+ @Before
+ public void resetData() {
+ orchestrator.resetData();
+ }
+
+ @Test
+ public void test_json_report_no_server_analysis() throws Exception {
+ orchestrator.getServer().restoreProfile(getResource("one-issue-per-line.xml"));
+ orchestrator.getServer().provisionProject("sample", "tracking");
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
+
+ File projectDir = ItUtils.projectDir("analysis/tracking/v1");
+ SonarRunner issuesModeScan = SonarRunner.create(projectDir)
+ .setProperty("sonar.analysis.mode", "issues")
+ .setProperty("sonar.userHome", temp.newFolder().getAbsolutePath())
+ .setProperty("sonar.report.export.path", "sonar-report.json")
+ .setProperty("sonar.projectDate", "2013-05-02");
+ orchestrator.executeBuild(issuesModeScan);
+
+ File report = new File(projectDir, ".sonar/sonar-report.json");
+ assertThat(report).isFile().exists();
+
+ String json = sanitize(FileUtils.readFileToString(report));
+ String expectedJson = sanitize(IOUtils.toString(getResourceInputStream("no-server-analysis.json")));
+ JSONAssert.assertEquals(expectedJson, json, false);
+ }
+
+ @Test
+ public void test_json_report() throws Exception {
+ orchestrator.getServer().restoreProfile(getResource("one-issue-per-line.xml"));
+ orchestrator.getServer().provisionProject("sample", "tracking");
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
+
+ SonarRunner scan = SonarRunner.create(ItUtils.projectDir("analysis/tracking/v1"))
+ .setProperty("sonar.projectDate", "2013-05-01");
+ orchestrator.executeBuild(scan);
+
+ // Issues mode scan -> 2 new issues and 13 existing issues
+ File projectDir = ItUtils.projectDir("analysis/tracking/v2");
+ SonarRunner issuesModeScan = SonarRunner.create(projectDir)
+ .setProperty("sonar.analysis.mode", "issues")
+ .setProperty("sonar.userHome", temp.newFolder().getAbsolutePath())
+ .setProperty("sonar.report.export.path", "sonar-report.json")
+ .setProperty("sonar.projectDate", "2013-05-02");
+ orchestrator.executeBuild(issuesModeScan);
+
+ File report = new File(projectDir, ".sonar/sonar-report.json");
+ assertThat(report).isFile().exists();
+
+ String json = sanitize(FileUtils.readFileToString(report));
+ String expectedJson = sanitize(IOUtils.toString(getResourceInputStream("report-on-single-module.json")));
+ JSONAssert.assertEquals(expectedJson, json, false);
+ }
+
+ @Test
+ public void test_json_report_on_branch() throws Exception {
+ orchestrator.getServer().restoreProfile(getResource("one-issue-per-line.xml"));
+ orchestrator.getServer().provisionProject("sample:mybranch", "Sample");
+ orchestrator.getServer().associateProjectToQualityProfile("sample:mybranch", "xoo", "one-issue-per-line");
+
+ SonarRunner scan = SonarRunner.create(ItUtils.projectDir("analysis/tracking/v1"))
+ .setProperty("sonar.projectDate", "2013-05-01")
+ .setProperty("sonar.branch", "mybranch");
+ orchestrator.executeBuild(scan);
+
+ // issues mode scan -> 2 new issues and 13 existing issues
+ File projectDir = ItUtils.projectDir("analysis/tracking/v2");
+ SonarRunner issuesModeScan = SonarRunner.create(projectDir)
+ .setProperty("sonar.analysis.mode", "issues")
+ .setProperty("sonar.userHome", temp.newFolder().getAbsolutePath())
+ .setProperty("sonar.report.export.path", "sonar-report.json")
+ .setProperty("sonar.issuesReport.console.enable", "true")
+ .setProperty("sonar.projectDate", "2013-05-02")
+ .setProperty("sonar.verbose", "true")
+ .setProperty("sonar.branch", "mybranch");
+ orchestrator.executeBuild(issuesModeScan);
+
+ File report = new File(projectDir, ".sonar/sonar-report.json");
+ assertThat(report).isFile().exists();
+
+ String json = sanitize(FileUtils.readFileToString(report));
+ String expectedJson = sanitize(IOUtils.toString(getResourceInputStream("report-on-single-module-branch.json")));
+ JSONAssert.assertEquals(expectedJson, json, false);
+ }
+
+ /**
+ * Multi-modules project but Eclipse scans only a single module
+ */
+ @Test
+ public void test_json_report_on_sub_module() throws Exception {
+ orchestrator.getServer().restoreProfile(getResource("one-issue-per-line.xml"));
+ orchestrator.getServer().provisionProject("com.sonarsource.it.samples:multi-modules-sample", "Multi-module sample");
+ orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-sample", "xoo", "one-issue-per-line");
+
+ File rootDir = ItUtils.projectDir("shared/xoo-multi-modules-sample");
+ SonarRunner scan = SonarRunner.create(rootDir)
+ .setProperty("sonar.projectDate", "2013-05-01");
+ orchestrator.executeBuild(scan);
+
+ // Issues mode scan on a module -> no new issues
+ File moduleDir = ItUtils.projectDir("shared/xoo-multi-modules-sample/module_a/module_a1");
+ SonarRunner issuesModeScan = SonarRunner.create(moduleDir)
+ .setProperty("sonar.projectKey", "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1")
+ .setProperty("sonar.projectVersion", "1.0-SNAPSHOT")
+ .setProperty("sonar.projectName", "ModuleA1")
+ .setProperty("sonar.sources", "src/main/xoo")
+ .setProperty("sonar.language", "xoo")
+ .setProperty("sonar.analysis.mode", "issues")
+ .setProperty("sonar.userHome", temp.newFolder().getAbsolutePath())
+ .setProperty("sonar.report.export.path", "sonar-report.json")
+ .setProperty("sonar.projectDate", "2013-05-02");
+ orchestrator.executeBuild(issuesModeScan);
+
+ File report = new File(moduleDir, ".sonar/sonar-report.json");
+ assertThat(report).isFile().exists();
+
+ String json = sanitize(FileUtils.readFileToString(report));
+ // SONAR-5218 All issues are updated as their root project id has changed (it's now the sub module)
+ String expectedJson = sanitize(IOUtils.toString(getResourceInputStream("report-on-sub-module.json")));
+ JSONAssert.assertEquals(expectedJson, json, false);
+ }
+
+ /**
+ * Multi-modules project
+ */
+ @Test
+ public void test_json_report_on_root_module() throws Exception {
+ orchestrator.getServer().restoreProfile(getResource("/one-issue-per-line.xml"));
+ orchestrator.getServer().provisionProject("com.sonarsource.it.samples:multi-modules-sample", "Sonar :: Integration Tests :: Multi-modules Sample");
+ orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-sample", "xoo", "one-issue-per-line");
+
+ File rootDir = ItUtils.projectDir("shared/xoo-multi-modules-sample");
+ SonarRunner scan = SonarRunner.create(rootDir)
+ .setProperty("sonar.projectDate", "2013-05-01");
+ orchestrator.executeBuild(scan);
+
+ // issues mode scan -> no new issues
+ SonarRunner issuesModeScan = SonarRunner.create(rootDir)
+ .setProperty("sonar.analysis.mode", "issues")
+ .setProperty("sonar.userHome", temp.newFolder().getAbsolutePath())
+ .setProperty("sonar.report.export.path", "sonar-report.json")
+ .setProperty("sonar.projectDate", "2013-05-02");
+ orchestrator.executeBuild(issuesModeScan);
+
+ File report = new File(rootDir, ".sonar/sonar-report.json");
+ assertThat(report).isFile().exists();
+
+ String json = sanitize(FileUtils.readFileToString(report));
+ String expectedJson = sanitize(IOUtils.toString(getResourceInputStream("report-on-root-module.json")));
+ JSONAssert.assertEquals(expectedJson, json, false);
+ }
+
+ @Test
+ public void sanityCheck() {
+ assertThat(sanitize("5.0.0-5868-SILVER-SNAPSHOT")).isEqualTo("<SONAR_VERSION>");
+ }
+
+ private static String sanitize(String s) {
+ // sanitize issue uuid keys
+ s = s.replaceAll("\"[a-zA-Z_0-9\\-]{20}\"", "<ISSUE_KEY>");
+
+ // sanitize sonar version. Note that "-SILVER-SNAPSHOT" is used by Goldeneye jobs
+ s = s.replaceAll("\\d\\.\\d(.\\d)?(\\-.*)?\\-SNAPSHOT", "<SONAR_VERSION>");
+
+ return ItUtils.sanitizeTimezones(s);
+ }
+
+ private InputStream getResourceInputStream(String resource) throws FileNotFoundException {
+ ResourceLocation res = getResource(resource);
+ return getClass().getResourceAsStream(res.getPath());
+ }
+
+ private ResourceLocation getResource(String resource) {
+ return FileLocation.ofClasspath("/analysis/IssueJsonReportTest/" + resource);
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package it.analysis;
+
+import com.google.common.collect.Maps;
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.BuildFailureException;
+import com.sonar.orchestrator.build.BuildResult;
+import com.sonar.orchestrator.build.SonarRunner;
+import com.sonar.orchestrator.build.SonarRunnerInstaller;
+import com.sonar.orchestrator.config.FileSystem;
+import com.sonar.orchestrator.locator.FileLocation;
+import com.sonar.orchestrator.version.Version;
+import it.Category3Suite;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import org.apache.commons.lang.ObjectUtils;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.rules.TemporaryFolder;
+import org.sonar.wsclient.SonarClient;
+import org.sonar.wsclient.issue.Issue;
+import org.sonar.wsclient.issue.IssueQuery;
+import org.sonar.wsclient.issue.Issues;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+import org.sonar.wsclient.user.UserParameters;
+import util.ItUtils;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.fail;
+
+public class IssuesModeTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category3Suite.ORCHESTRATOR;
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Rule
+ public TemporaryFolder temp = new TemporaryFolder();
+
+ @Before
+ public void deleteData() throws IOException {
+ orchestrator.resetData();
+ }
+
+ @Test
+ public void issues_analysis_on_new_project() throws IOException {
+ restoreProfile("one-issue-per-line.xml");
+ orchestrator.getServer().provisionProject("sample", "xoo-sample");
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
+ SonarRunner runner = configureRunnerIssues("shared/xoo-sample", "sonar.verbose", "true");
+ BuildResult result = orchestrator.executeBuild(runner);
+ assertThat(ItUtils.countIssuesInJsonReport(result, true)).isEqualTo(17);
+ }
+
+ @Test
+ public void invalid_incremental_mode() throws IOException {
+ restoreProfile("one-issue-per-line.xml");
+ orchestrator.getServer().provisionProject("sample", "xoo-sample");
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
+ SonarRunner runner = configureRunner("shared/xoo-sample");
+ runner.setProperty("sonar.analysis.mode", "incremental");
+
+ thrown.expect(BuildFailureException.class);
+ BuildResult res = orchestrator.executeBuild(runner);
+
+ assertThat(res.getLogs()).contains("Invalid analysis mode: incremental. This mode was removed in SonarQube 5.2");
+ }
+
+ @Test
+ public void non_associated_mode() throws IOException {
+ restoreProfile("one-issue-per-line.xml");
+ setDefaultQualityProfile("xoo", "one-issue-per-line");
+ SonarRunner runner = configureRunnerIssues("shared/xoo-sample-non-associated");
+ BuildResult result = orchestrator.executeBuild(runner);
+
+ assertThat(result.getLogs()).contains("Local analysis");
+ assertThat(result.getLogs()).contains("Cache not found, synchronizing data");
+ assertThat(ItUtils.countIssuesInJsonReport(result, true)).isEqualTo(17);
+
+ result = orchestrator.executeBuild(runner);
+ assertThat(ItUtils.countIssuesInJsonReport(result, true)).isEqualTo(17);
+ assertThat(result.getLogs()).contains("Found cache");
+ }
+
+ // SONAR-5715
+ @Test
+ public void test_issues_mode_on_project_with_space_in_filename() throws IOException {
+ restoreProfile("with-many-rules.xml");
+ orchestrator.getServer().provisionProject("sample", "xoo-sample-with-spaces");
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "with-many-rules");
+
+ SonarRunner runner = configureRunner("analysis/xoo-sample-with-spaces/v2");
+ BuildResult result = orchestrator.executeBuild(runner);
+ assertThat(getResource("sample:my sources/main/xoo/sample/My Sample.xoo")).isNotNull();
+
+ runner = configureRunnerIssues("analysis/xoo-sample-with-spaces/v2");
+ result = orchestrator.executeBuild(runner);
+ // Analysis is not persisted in database
+ Resource project = getResource("com.sonarsource.it.samples:simple-sample");
+ assertThat(project).isNull();
+ assertThat(result.getLogs()).contains("Issues");
+ assertThat(result.getLogs()).contains("ANALYSIS SUCCESSFUL");
+ }
+
+ @Test
+ public void should_not_fail_on_resources_that_have_existed_before() throws IOException {
+ restoreProfile("with-many-rules.xml");
+ orchestrator.getServer().provisionProject("sample", "xoo-history");
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "with-many-rules");
+
+ // First real scan with source
+ SonarRunner runner = configureRunner("shared/xoo-history-v2");
+ BuildResult result = orchestrator.executeBuild(runner);
+ assertThat(getResource("sample:src/main/xoo/sample/ClassAdded.xoo")).isNotNull();
+
+ // Second scan should remove ClassAdded.xoo
+ runner = configureRunner("shared/xoo-history-v1");
+ result = orchestrator.executeBuild(runner);
+ assertThat(getResource("sample:src/main/xoo/sample/ClassAdded.xoo")).isNull();
+
+ // Re-add ClassAdded.xoo in local workspace
+ runner = configureRunnerIssues("shared/xoo-history-v2");
+ result = orchestrator.executeBuild(runner);
+
+ assertThat(getResource("sample:src/main/xoo/sample/ClassAdded.xoo")).isNull();
+ assertThat(result.getLogs()).contains("Issues");
+ assertThat(result.getLogs()).contains("ANALYSIS SUCCESSFUL");
+ }
+
+ @Test
+ public void should_fail_if_plugin_access_secured_properties() throws IOException {
+ // Test access from task (ie BatchSettings)
+ SonarRunner runner = configureRunnerIssues("shared/xoo-sample",
+ "accessSecuredFromTask", "true");
+ BuildResult result = orchestrator.executeBuildQuietly(runner);
+
+ assertThat(result.getLogs()).contains("Access to the secured property 'foo.bar.secured' is not possible in issues mode. "
+ + "The SonarQube plugin which requires this property must be deactivated in issues mode.");
+
+ // Test access from sensor (ie ModuleSettings)
+ runner = configureRunnerIssues("shared/xoo-sample",
+ "accessSecuredFromSensor", "true");
+ result = orchestrator.executeBuildQuietly(runner);
+
+ assertThat(result.getLogs()).contains("Access to the secured property 'foo.bar.secured' is not possible in issues mode. "
+ + "The SonarQube plugin which requires this property must be deactivated in issues mode.");
+ }
+
+ // SONAR-4602
+ @Test
+ public void no_issues_mode_cache_after_new_analysis() throws Exception {
+ restoreProfile("one-issue-per-line.xml");
+ restoreProfile("empty.xml");
+ orchestrator.getServer().provisionProject("sample", "xoo-sample");
+
+ // First run (publish mode)
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "empty");
+ SonarRunner runner = configureRunner("shared/xoo-sample");
+ orchestrator.executeBuild(runner);
+
+ // First run issues mode
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
+ runner = configureRunnerIssues("shared/xoo-sample");
+ BuildResult result = orchestrator.executeBuild(runner);
+
+ // As many new issue as lines
+ assertThat(ItUtils.countIssuesInJsonReport(result, true)).isEqualTo(17);
+
+ // Second run (publish mode) should invalidate cache
+ runner = configureRunner("shared/xoo-sample");
+ orchestrator.executeBuild(runner);
+
+ // Second run issues mode
+ runner = configureRunnerIssues("shared/xoo-sample", "sonar.report.export.path", "sonar-report.json");
+ result = orchestrator.executeBuild(runner);
+
+ // No new issue this time
+ assertThat(ItUtils.countIssuesInJsonReport(result, true)).isEqualTo(0);
+ }
+
+ // SONAR-4602
+ @Test
+ public void no_issues_mode_cache_after_profile_change() throws Exception {
+ restoreProfile("one-issue-per-line-empty.xml");
+ orchestrator.getServer().provisionProject("sample", "xoo-sample");
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
+
+ // First run (publish mode)
+ SonarRunner runner = configureRunner("shared/xoo-sample");
+ orchestrator.executeBuild(runner);
+
+ // First issues mode
+ runner = configureRunnerIssues("shared/xoo-sample");
+ BuildResult result = orchestrator.executeBuild(runner);
+
+ // No new issues
+ assertThat(ItUtils.countIssuesInJsonReport(result, true)).isEqualTo(0);
+
+ // Modification of QP should invalidate cache
+ restoreProfile("/one-issue-per-line.xml");
+
+ // Second issues mode
+ runner = configureRunnerIssues("shared/xoo-sample", "sonar.report.export.path", "sonar-report.json");
+ result = orchestrator.executeBuild(runner);
+
+ // As many new issue as lines
+ assertThat(ItUtils.countIssuesInJsonReport(result, true)).isEqualTo(17);
+ }
+
+ // SONAR-4602
+ @Test
+ public void no_issues_mode_cache_after_issue_change() throws Exception {
+ restoreProfile("one-issue-per-line.xml");
+ orchestrator.getServer().provisionProject("sample", "xoo-sample");
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
+
+ // First run (publish mode)
+ SonarRunner runner = configureRunner("shared/xoo-sample");
+ orchestrator.executeBuild(runner);
+
+ // First issues mode
+ runner = configureRunnerIssues("shared/xoo-sample");
+ BuildResult result = orchestrator.executeBuild(runner);
+
+ // 17 issues
+ assertThat(ItUtils.countIssuesInJsonReport(result, false)).isEqualTo(17);
+
+ // Flag one issue as false positive
+ JSONObject obj = ItUtils.getJSONReport(result);
+ String key = ((JSONObject) ((JSONArray) obj.get("issues")).get(0)).get("key").toString();
+ orchestrator.getServer().adminWsClient().issueClient().doTransition(key, "falsepositive");
+
+ // Second issues mode
+ runner = configureRunnerIssues("shared/xoo-sample");
+ result = orchestrator.executeBuild(runner);
+
+ // False positive is not returned
+ assertThat(ItUtils.countIssuesInJsonReport(result, false)).isEqualTo(16);
+ }
+
+ // SONAR-6522
+ @Test
+ public void load_user_name_in_json_report() throws Exception {
+ restoreProfile("one-issue-per-line.xml");
+ orchestrator.getServer().provisionProject("sample", "xoo-sample");
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
+
+ // First run (publish mode)
+ SonarRunner runner = configureRunner("shared/xoo-sample");
+ orchestrator.executeBuild(runner);
+
+ SonarClient client = orchestrator.getServer().adminWsClient();
+
+ Issues issues = client.issueClient().find(IssueQuery.create());
+ Issue issue = issues.list().get(0);
+
+ UserParameters creationParameters = UserParameters.create().login("julien").name("Julien H")
+ .password("password").passwordConfirmation("password");
+ client.userClient().create(creationParameters);
+
+ // Assign issue
+ client.issueClient().assign(issue.key(), "julien");
+
+ // Issues
+ runner = configureRunnerIssues("shared/xoo-sample");
+ BuildResult result = orchestrator.executeBuild(runner);
+
+ JSONObject obj = ItUtils.getJSONReport(result);
+
+ Map<String, String> userNameByLogin = Maps.newHashMap();
+ final JSONArray users = (JSONArray) obj.get("users");
+ if (users != null) {
+ for (Object user : users) {
+ String login = ObjectUtils.toString(((JSONObject) user).get("login"));
+ String name = ObjectUtils.toString(((JSONObject) user).get("name"));
+ userNameByLogin.put(login, name);
+ }
+ }
+ assertThat(userNameByLogin.get("julien")).isEqualTo("Julien H");
+
+ for (Object issueJson : (JSONArray) obj.get("issues")) {
+ JSONObject jsonObject = (JSONObject) issueJson;
+ if (issue.key().equals(jsonObject.get("key"))) {
+ assertThat(jsonObject.get("assignee")).isEqualTo("julien");
+ return;
+ }
+ }
+ fail("Issue not found");
+ }
+
+ @Test
+ public void concurrent_issue_mode_on_existing_project() throws Exception {
+ restoreProfile("one-issue-per-line.xml");
+ orchestrator.getServer().provisionProject("sample", "xoo-sample");
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
+
+ SonarRunner runner = configureRunner("shared/xoo-sample");
+ orchestrator.executeBuild(runner);
+
+ runConcurrentIssues();
+ }
+
+ private void runConcurrentIssues() throws InterruptedException, ExecutionException {
+ // Install sonar-runner in advance to avoid concurrent unzip issues
+ FileSystem fileSystem = orchestrator.getConfiguration().fileSystem();
+ new SonarRunnerInstaller(fileSystem).install(Version.create(SonarRunner.DEFAULT_RUNNER_VERSION), fileSystem.workspace());
+ final int nThreads = 3;
+ ExecutorService executorService = Executors.newFixedThreadPool(nThreads);
+ List<Callable<BuildResult>> tasks = new ArrayList<>();
+ for (int i = 0; i < nThreads; i++) {
+ tasks.add(new Callable<BuildResult>() {
+
+ public BuildResult call() throws Exception {
+ SonarRunner runner = configureRunnerIssues("shared/xoo-sample");
+ return orchestrator.executeBuild(runner);
+ }
+ });
+ }
+
+ boolean expectedError = false;
+ for (Future<BuildResult> result : executorService.invokeAll(tasks)) {
+ try {
+ result.get();
+ } catch (ExecutionException e) {
+ if (e.getCause() instanceof BuildFailureException) {
+ BuildFailureException bfe = (BuildFailureException) e.getCause();
+ assertThat(bfe.getResult().getLogs()).contains("Another SonarQube analysis is already in progress for this project");
+ expectedError = true;
+ }
+ }
+ }
+ if (!expectedError) {
+ fail("At least one of the threads should have failed");
+ }
+ }
+
+ private void restoreProfile(String fileName) {
+ orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/analysis/IssuesModeTest/" + fileName));
+ }
+
+ private Resource getResource(String key) {
+ return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(key, "lines"));
+ }
+
+ private SonarRunner configureRunnerIssues(String projectDir, String... props) throws IOException {
+ SonarRunner runner = SonarRunner.create(ItUtils.projectDir(projectDir),
+ "sonar.working.directory", temp.newFolder().getAbsolutePath(),
+ "sonar.analysis.mode", "issues",
+ "sonar.report.export.path", "sonar-report.json",
+ "sonar.userHome", temp.newFolder().getAbsolutePath());
+ runner.setProperties(props);
+ return runner;
+ }
+
+ private SonarRunner configureRunner(String projectDir, String... props) throws IOException {
+ SonarRunner runner = SonarRunner.create(ItUtils.projectDir(projectDir),
+ "sonar.working.directory", temp.newFolder().getAbsolutePath(),
+ "sonar.report.export.path", "sonar-report.json",
+ "sonar.userHome", temp.newFolder().getAbsolutePath());
+ runner.setProperties(props);
+ return runner;
+ }
+
+ private void setDefaultQualityProfile(String languageKey, String profileName) {
+ orchestrator.getServer().adminWsClient().post("api/qualityprofiles/set_default",
+ "language", languageKey,
+ "profileName", profileName);
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package it.analysis;
+
+import com.google.common.collect.Lists;
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.MavenBuild;
+import com.sonar.orchestrator.build.SonarRunner;
+import com.sonar.orchestrator.db.Database;
+import it.Category3Suite;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import util.ItUtils;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class LinksTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category3Suite.ORCHESTRATOR;
+
+ private static String[] expectedLinks = new String[] {
+ "homepage=http://www.simplesample.org_OVERRIDDEN",
+ "ci=http://bamboo.ci.codehaus.org/browse/SIMPLESAMPLE",
+ "issue=http://jira.codehaus.org/browse/SIMPLESAMPLE",
+ "scm=https://github.com/SonarSource/simplesample",
+ "scm_dev=scm:git:git@github.com:SonarSource/simplesample.git"
+ };
+
+ @Before
+ @After
+ public void cleanProjectLinksTable() {
+ // TODO should not do this and find another way without using direct db connection
+ orchestrator.getDatabase().truncate("project_links");
+ }
+
+ /**
+ * SONAR-3676
+ */
+ @Test
+ public void shouldUseLinkProperties() {
+ SonarRunner runner = SonarRunner.create(ItUtils.projectDir("analysis/links-project"))
+ .setProperty("sonar.scm.disabled", "true");
+ orchestrator.executeBuild(runner);
+
+ checkLinks();
+ }
+
+ /**
+ * SONAR-3676
+ */
+ @Test
+ public void shouldUseLinkPropertiesOverPomLinksInMaven() {
+ MavenBuild build = MavenBuild.create(ItUtils.projectPom("analysis/links-project"))
+ .setCleanPackageSonarGoals()
+ .setProperty("sonar.scm.disabled", "true");
+ orchestrator.executeBuild(build);
+
+ checkLinks();
+ }
+
+ private void checkLinks() {
+ Database db = orchestrator.getDatabase();
+ List<Map<String, String>> links = db.executeSql("select * from project_links");
+
+ assertThat(links.size()).isEqualTo(5);
+ Collection<String> linksToCheck = Lists.newArrayList();
+ for (Map<String, String> linkRow : links) {
+ linksToCheck.add(linkRow.get("LINK_TYPE") + "=" + linkRow.get("HREF"));
+ }
+ assertThat(linksToCheck).contains(expectedLinks);
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package it.analysis;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.BuildResult;
+import com.sonar.orchestrator.build.MavenBuild;
+import it.Category3Suite;
+import java.util.List;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.sonar.wsclient.Sonar;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+import util.ItUtils;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class MavenTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category3Suite.ORCHESTRATOR;
+
+ @Before
+ public void deleteData() {
+ orchestrator.resetData();
+ }
+
+ @Test
+ public void shouldSupportJarWithoutSources() {
+ MavenBuild build = MavenBuild.create(ItUtils.projectPom("maven/project-with-module-without-sources"))
+ .setCleanSonarGoals();
+ orchestrator.executeBuild(build);
+
+ Resource project = orchestrator.getServer().getWsClient()
+ .find(ResourceQuery.createForMetrics("com.sonarsource.it.samples.project-with-module-without-sources:parent", "files"));
+ assertThat(project.getMeasureIntValue("files")).isEqualTo(1);
+
+ Resource subProject = orchestrator.getServer().getWsClient().find(ResourceQuery.create("com.sonarsource.it.samples.project-with-module-without-sources:without-sources"));
+ assertThat(subProject).isNotNull();
+ }
+
+ /**
+ * See SONAR-594
+ */
+ @Test
+ public void shouldSupportJeeProjects() {
+ MavenBuild build = MavenBuild.create(ItUtils.projectPom("maven/jee"))
+ .setGoals("clean install", "sonar:sonar");
+ orchestrator.executeBuild(build);
+
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("com.sonarsource.it.samples.jee:parent", "files"));
+ assertThat(project.getMeasureIntValue("files")).isEqualTo(2);
+
+ List<Resource> modules = orchestrator.getServer().getWsClient().findAll(ResourceQuery.create("com.sonarsource.it.samples.jee:parent").setDepth(-1).setQualifiers("BRC"));
+ assertThat(modules).hasSize(4);
+ }
+
+ /**
+ * See SONAR-222
+ */
+ @Test
+ public void shouldSupportMavenExtensions() {
+ MavenBuild build = MavenBuild.create(ItUtils.projectPom("maven/maven-extensions"))
+ .setCleanSonarGoals();
+ orchestrator.executeBuild(build);
+
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("com.sonarsource.it.samples:maven-extensions", "files"));
+ assertThat(project.getMeasureIntValue("files")).isEqualTo(1);
+ }
+
+ /**
+ * This test should be splitted. It checks multiple use-cases at the same time : SONAR-518, SONAR-519 and SONAR-593
+ */
+ @Test
+ public void testBadMavenParameters() {
+ // should not fail
+ MavenBuild build = MavenBuild.create(ItUtils.projectPom("maven/maven-bad-parameters"))
+ .setCleanSonarGoals();
+ orchestrator.executeBuild(build);
+
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("com.sonarsource.it.samples.maven-bad-parameters:parent", "files"));
+ assertThat(project.getMeasureIntValue("files")).isGreaterThan(0);
+ }
+
+ @Test
+ public void shouldAnalyzeMultiModules() {
+ MavenBuild build = MavenBuild.create(ItUtils.projectPom("maven/modules-order"))
+ .setCleanSonarGoals()
+ .setProperty("sonar.dynamicAnalysis", "false");
+ orchestrator.executeBuild(build);
+
+ Sonar sonar = orchestrator.getServer().getWsClient();
+ assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-order:root")).getName()).isEqualTo("Sonar tests - modules order");
+
+ assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-order:parent")).getName()).isEqualTo("Parent");
+
+ assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-order:module_a")).getName()).isEqualTo("Module A");
+ assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-order:module_a:src/main/java/HelloA.java")).getName()).isEqualTo("HelloA.java");
+
+ assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-order:module_b")).getName()).isEqualTo("Module B");
+ assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-order:module_b:src/main/java/HelloB.java")).getName()).isEqualTo("HelloB.java");
+ }
+
+ /**
+ * See SONAR-2735
+ */
+ @Test
+ public void shouldSupportDifferentDeclarationsForModules() {
+ MavenBuild build = MavenBuild.create(ItUtils.projectPom("maven/modules-declaration"))
+ .setCleanSonarGoals()
+ .setProperty("sonar.dynamicAnalysis", "false");
+ orchestrator.executeBuild(build);
+ Sonar sonar = orchestrator.getServer().getWsClient();
+
+ assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-declaration:root")).getName()).isEqualTo("Root");
+
+ assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-declaration:module_a")).getName()).isEqualTo("Module A");
+ assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-declaration:module_a:src/main/java/HelloA.java")).getName()).isEqualTo("HelloA.java");
+
+ assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-declaration:module_b")).getName()).isEqualTo("Module B");
+ assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-declaration:module_b:src/main/java/HelloB.java")).getName()).isEqualTo("HelloB.java");
+
+ assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-declaration:module_c")).getName()).isEqualTo("Module C");
+ assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-declaration:module_c:src/main/java/HelloC.java")).getName()).isEqualTo("HelloC.java");
+
+ assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-declaration:module_d")).getName()).isEqualTo("Module D");
+ assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-declaration:module_d:src/main/java/HelloD.java")).getName()).isEqualTo("HelloD.java");
+
+ assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-declaration:module_e")).getName()).isEqualTo("Module E");
+ assertThat(sonar.find(new ResourceQuery("org.sonar.tests.modules-declaration:module_e:src/main/java/HelloE.java")).getName()).isEqualTo("HelloE.java");
+ }
+
+ /**
+ * See SONAR-3843
+ */
+ @Test
+ public void should_support_shade_with_dependency_reduced_pom_with_clean_install_sonar_goals() {
+ MavenBuild build = MavenBuild.create(ItUtils.projectPom("maven/shade-with-dependency-reduced-pom"))
+ .setProperty("sonar.dynamicAnalysis", "false")
+ .setGoals("clean", "install", "sonar:sonar");
+
+ orchestrator.executeBuild(build);
+ }
+
+ /**
+ * SONAR-4245
+ */
+ @Test
+ @Ignore("This test should be moved to a Medium test of the Compute Engine")
+ public void should_prevent_analysis_of_module_then_project() {
+ MavenBuild scan = MavenBuild.create(ItUtils.projectPom("shared/multi-modules-sample/module_a"))
+ .setProperty("sonar.dynamicAnalysis", "false")
+ .setCleanSonarGoals();
+ orchestrator.executeBuild(scan);
+
+ scan = MavenBuild.create(ItUtils.projectPom("shared/multi-modules-sample"))
+ .setProperty("sonar.dynamicAnalysis", "false")
+ .setCleanSonarGoals();
+ BuildResult result = orchestrator.executeBuildQuietly(scan);
+ assertThat(result.getStatus()).isNotEqualTo(0);
+ assertThat(result.getLogs()).contains("The project 'com.sonarsource.it.samples:module_a' is already defined in SonarQube "
+ + "but not as a module of project 'com.sonarsource.it.samples:multi-modules-sample'. "
+ + "If you really want to stop directly analysing project 'com.sonarsource.it.samples:module_a', "
+ + "please first delete it from SonarQube and then relaunch the analysis of project 'com.sonarsource.it.samples:multi-modules-sample'.");
+ }
+
+ /**
+ * src/main/java is missing
+ */
+ @Test
+ public void maven_project_with_only_test_dir() {
+ MavenBuild build = MavenBuild.create(ItUtils.projectPom("maven/maven-only-test-dir")).setCleanPackageSonarGoals();
+ orchestrator.executeBuild(build);
+
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("com.sonarsource.it.samples:maven-only-test-dir", "tests", "files"));
+ assertThat(project.getMeasureIntValue("tests")).isEqualTo(1);
+ assertThat(project.getMeasure("files")).isNull();
+ }
+
+ /**
+ * The property sonar.sources overrides the source dirs as declared in Maven
+ */
+ @Test
+ public void override_sources() {
+ MavenBuild build = MavenBuild.create(ItUtils.projectPom("maven/maven-override-sources")).setGoals("sonar:sonar");
+ orchestrator.executeBuild(build);
+
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("com.sonarsource.it.samples:maven-override-sources", "files"));
+ assertThat(project.getMeasureIntValue("files")).isEqualTo(1);
+
+ Resource file = orchestrator.getServer().getWsClient().find(ResourceQuery.create("com.sonarsource.it.samples:maven-override-sources:src/main/java2/Hello2.java"));
+ assertThat(file).isNotNull();
+ }
+
+ /**
+ * The property sonar.inclusions overrides the property sonar.sources
+ */
+ @Test
+ public void inclusions_apply_to_source_dirs() {
+ MavenBuild build = MavenBuild.create(ItUtils.projectPom("maven/inclusions_apply_to_source_dirs")).setGoals("sonar:sonar");
+ orchestrator.executeBuild(build);
+
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("com.sonarsource.it.samples:inclusions_apply_to_source_dirs", "files"));
+ assertThat(project.getMeasureIntValue("files")).isEqualTo(1);
+
+ Resource file = orchestrator.getServer().getWsClient().find(ResourceQuery.create("com.sonarsource.it.samples:inclusions_apply_to_source_dirs:src/main/java/Hello2.java"));
+ assertThat(file).isNotNull();
+ }
+
+ /**
+ * The property sonar.sources has a typo -> fail, like in sonar-runner
+ */
+ @Test
+ public void fail_if_bad_value_of_sonar_sources_property() {
+ MavenBuild build = MavenBuild.create(ItUtils.projectPom("maven/maven-bad-sources-property")).setGoals("sonar:sonar");
+ BuildResult result = orchestrator.executeBuildQuietly(build);
+ assertThat(result.getStatus()).isNotEqualTo(0);
+ assertThat(result.getLogs()).contains(
+ "java2' does not exist for Maven module com.sonarsource.it.samples:maven-bad-sources-property:jar:1.0-SNAPSHOT. Please check the property sonar.sources");
+ }
+
+ /**
+ * The property sonar.sources has a typo -> fail, like in sonar-runner
+ */
+ @Test
+ public void fail_if_bad_value_of_sonar_tests_property() {
+ MavenBuild build = MavenBuild.create(ItUtils.projectPom("maven/maven-bad-tests-property")).setGoals("sonar:sonar");
+ BuildResult result = orchestrator.executeBuildQuietly(build);
+ assertThat(result.getStatus()).isNotEqualTo(0);
+ assertThat(result.getLogs()).contains(
+ "java2' does not exist for Maven module com.sonarsource.it.samples:maven-bad-tests-property:jar:1.0-SNAPSHOT. Please check the property sonar.tests");
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package it.analysis;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.BuildResult;
+import com.sonar.orchestrator.build.SonarRunner;
+import com.sonar.orchestrator.locator.FileLocation;
+import it.Category3Suite;
+import org.junit.After;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+import util.ItUtils;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class MultiLanguageTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category3Suite.ORCHESTRATOR;
+
+ @After
+ public void cleanDatabase() {
+ orchestrator.resetData();
+ }
+
+ /**
+ * SONAR-926
+ * SONAR-5069
+ */
+ @Test
+ public void test_sonar_runner_inspection() {
+ orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/analysis/MultiLanguageTest/one-issue-per-line.xml"));
+ orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/analysis/MultiLanguageTest/one-issue-per-line-xoo2.xml"));
+
+ orchestrator.getServer().provisionProject("multi-language-sample", "multi-language-sample");
+
+ orchestrator.getServer().associateProjectToQualityProfile("multi-language-sample", "xoo", "one-issue-per-line");
+ orchestrator.getServer().associateProjectToQualityProfile("multi-language-sample","xoo2", "one-issue-per-line-xoo2");
+
+ SonarRunner build = SonarRunner.create().setProjectDir(ItUtils.projectDir("analysis/xoo-multi-languages"));
+ BuildResult result = orchestrator.executeBuild(build);
+
+ assertThat(result.getLogs()).contains("2 files indexed");
+ assertThat(result.getLogs()).contains("Quality profile for xoo: one-issue-per-line");
+ assertThat(result.getLogs()).contains("Quality profile for xoo2: one-issue-per-line-xoo2");
+
+ // modules
+ Resource project = getResource("multi-language-sample", "files", "violations");
+ assertThat(project.getMeasureIntValue("files")).isEqualTo(2);
+ assertThat(project.getMeasureIntValue("violations")).isEqualTo(26);
+
+ Resource xooFile = getResource("multi-language-sample:src/sample/Sample.xoo", "violations");
+ assertThat(xooFile.getMeasureIntValue("violations")).isEqualTo(13);
+
+ Resource xoo2File = getResource("multi-language-sample:src/sample/Sample.xoo2", "violations");
+ assertThat(xoo2File.getMeasureIntValue("violations")).isEqualTo(13);
+ }
+
+ private Resource getResource(String resourceKey, String... metricKeys) {
+ return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(resourceKey, metricKeys));
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package it.analysis;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.MavenBuild;
+import it.Category3Suite;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+import util.ItUtils;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Test the extension point org.sonar.api.batch.bootstrap.ProjectBuilder
+ * <p/>
+ * A Sonar plugin can override the project definition injected by build-tool.
+ * Example: C# plugin loads project structure and modules from Visual Studio metadata file.
+ *
+ * @since 2.9
+ */
+public class ProjectBuilderTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category3Suite.ORCHESTRATOR;
+
+ @Test
+ public void shouldDefineProjectFromPlugin() {
+ MavenBuild build = MavenBuild.create(ItUtils.projectPom("analysis/project-builder"))
+ .setCleanSonarGoals()
+ .setProperty("sonar.enableProjectBuilder", "true")
+ .setProperty("sonar.dynamicAnalysis", "false");
+ orchestrator.executeBuild(build);
+
+ checkProject();
+ checkSubProject("project-builder-module-a");
+ checkSubProject("project-builder-module-b");
+ checkFile("project-builder-module-a", "src/HelloA.java");
+ checkFile("project-builder-module-b", "src/HelloB.java");
+ assertThat(getResource("com.sonarsource.it.projects.batch:project-builder-module-b:src/IgnoredFile.java")).isNull();
+ }
+
+ private void checkProject() {
+ Resource project = getResource("com.sonarsource.it.projects.batch:project-builder");
+
+ // name has been changed by plugin
+ assertThat(project.getName()).isEqualTo("Name changed by plugin");
+
+ assertThat(project).isNotNull();
+ assertThat(project.getMeasureIntValue("files")).isEqualTo(2);
+ assertThat(project.getMeasureIntValue("lines")).isGreaterThan(10);
+ }
+
+ private void checkSubProject(String subProjectKey) {
+ Resource subProject = getResource("com.sonarsource.it.projects.batch:" + subProjectKey);
+ assertThat(subProject).isNotNull();
+ assertThat(subProject.getMeasureIntValue("files")).isEqualTo(1);
+ assertThat(subProject.getMeasureIntValue("lines")).isGreaterThan(5);
+ }
+
+ private void checkFile(String subProjectKey, String fileKey) {
+ Resource file = getResource("com.sonarsource.it.projects.batch:" + subProjectKey + ":" + fileKey);
+ assertThat(file).isNotNull();
+ assertThat(file.getMeasureIntValue("lines")).isGreaterThan(5);
+ }
+
+ private Resource getResource(String key) {
+ return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(key, "lines", "files"));
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package it.analysis;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.MavenBuild;
+import it.Category3Suite;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+import util.ItUtils;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+public class ProjectExclusionsTest {
+ @ClassRule
+ public static Orchestrator orchestrator = Category3Suite.ORCHESTRATOR;
+
+ @Before
+ public void deleteProjectData() {
+ orchestrator.resetData();
+ }
+
+ /**
+ * This use-case was a bug in 2.8-RC2. It failed when both the properties sonar.branch and sonar.skippedModules
+ * were set on the same multi-modules project.
+ */
+ @Test
+ public void shouldSupportMixOfBranchAndSkippedModules() {
+ MavenBuild build = MavenBuild.create(ItUtils.projectPom("shared/multi-modules-sample"))
+ .setGoals("clean verify", "sonar:sonar")
+ .setProperty("sonar.dynamicAnalysis", "false")
+ .setProperty("sonar.branch", "mybranch")
+ .setProperty("sonar.skippedModules", "module_b");
+
+ orchestrator.executeBuild(build);
+
+ assertNotNull(getResource("com.sonarsource.it.samples:multi-modules-sample:mybranch"));
+ assertNotNull(getResource("com.sonarsource.it.samples:module_a:mybranch").getId());
+ assertNotNull(getResource("com.sonarsource.it.samples:module_a1:mybranch").getId());
+ assertNotNull(getResource("com.sonarsource.it.samples:module_a2:mybranch").getId());
+
+ assertNull(getResource("com.sonarsource.it.samples:module_b:mybranch"));
+ assertNull(getResource("com.sonarsource.it.samples:module_b1:mybranch"));
+ assertNull(getResource("com.sonarsource.it.samples:module_b2:mybranch"));
+ }
+
+ /**
+ * Black list
+ */
+ @Test
+ public void shouldExcludeModuleAndItsChildren() {
+ MavenBuild build = MavenBuild.create(ItUtils.projectPom("shared/multi-modules-sample"))
+ .setGoals("clean verify", "sonar:sonar")
+ .setProperty("sonar.dynamicAnalysis", "false")
+ .setProperty("sonar.skippedModules", "module_b");
+
+ orchestrator.executeBuild(build);
+
+ assertNotNull(getResource("com.sonarsource.it.samples:multi-modules-sample"));
+ assertNotNull(getResource("com.sonarsource.it.samples:module_a"));
+ assertNotNull(getResource("com.sonarsource.it.samples:module_a1"));
+ assertNotNull(getResource("com.sonarsource.it.samples:module_a2"));
+
+ // excluded project and its children
+ assertNull(getResource("com.sonarsource.it.samples:module_b"));
+ assertNull(getResource("com.sonarsource.it.samples:module_b1"));
+ assertNull(getResource("com.sonarsource.it.samples:module_b2"));
+ }
+
+ /**
+ * Exhaustive white list
+ */
+ @Test
+ public void shouldIncludeModules() {
+ MavenBuild build = MavenBuild.create(ItUtils.projectPom("shared/multi-modules-sample"))
+ .setGoals("clean verify", "sonar:sonar")
+ .setProperty("sonar.dynamicAnalysis", "false")
+ .setProperty("sonar.includedModules", "multi-modules-sample,module_a,module_a1");
+
+ orchestrator.executeBuild(build);
+
+ assertNotNull(getResource("com.sonarsource.it.samples:multi-modules-sample"));
+ assertNotNull(getResource("com.sonarsource.it.samples:module_a"));
+ assertNotNull(getResource("com.sonarsource.it.samples:module_a1"));
+
+ assertNull(getResource("com.sonarsource.it.samples:module_a2"));
+ assertNull(getResource("com.sonarsource.it.samples:module_b"));
+ assertNull(getResource("com.sonarsource.it.samples:module_b1"));
+ assertNull(getResource("com.sonarsource.it.samples:module_b2"));
+ }
+
+ @Test
+ public void rootModuleShouldBeOptionalInListOfIncludedModules() {
+ MavenBuild build = MavenBuild.create(ItUtils.projectPom("shared/multi-modules-sample"))
+ .setCleanSonarGoals()
+ .setProperty("sonar.dynamicAnalysis", "false")
+ // the root module 'multi-modules-sample' is not declared
+ .setProperty("sonar.includedModules", "module_a,module_a1");
+
+ orchestrator.executeBuild(build);
+
+ assertNotNull(getResource("com.sonarsource.it.samples:multi-modules-sample"));
+ assertNotNull(getResource("com.sonarsource.it.samples:module_a"));
+ assertNotNull(getResource("com.sonarsource.it.samples:module_a1"));
+
+ assertNull(getResource("com.sonarsource.it.samples:module_a2"));
+ assertNull(getResource("com.sonarsource.it.samples:module_b"));
+ assertNull(getResource("com.sonarsource.it.samples:module_b1"));
+ assertNull(getResource("com.sonarsource.it.samples:module_b2"));
+ }
+
+ private Resource getResource(String key) {
+ return orchestrator.getServer().getWsClient().find(ResourceQuery.create(key));
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package it.analysis;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.BuildResult;
+import com.sonar.orchestrator.build.SonarRunner;
+import it.Category3Suite;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.sonar.wsclient.SonarClient;
+import org.sonar.wsclient.project.NewProject;
+import org.sonar.wsclient.services.PropertyUpdateQuery;
+import util.ItUtils;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+@Ignore
+public class ProjectProvisioningTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category3Suite.ORCHESTRATOR;
+
+ @BeforeClass
+ public static void init() {
+ orchestrator.resetData();
+ orchestrator.executeBuild(
+ SonarRunner.create(ItUtils.projectDir("shared/xoo-sample"))
+ );
+ }
+
+ @AfterClass
+ public static void resetAutoProjectCreation() {
+ setProperty("sonar.preventAutoProjectCreation", "false");
+ }
+
+ private SonarClient client;
+
+ @Before
+ public void initClient() {
+ client = orchestrator.getServer().adminWsClient();
+ }
+
+ /**
+ * SONAR-3871
+ * SONAR-4713
+ */
+ @Test
+ public void should_allow_existing_project_scan() {
+ setProperty("sonar.preventAutoProjectCreation", "true");
+
+ // xoo-sample already exists => pass
+ checkBuildSuccess("shared/xoo-sample");
+ }
+
+ /**
+ * SONAR-3871
+ * SONAR-4713
+ */
+ @Test
+ @Ignore("This test should be moved to a Medium test of the Compute Engine")
+ public void should_prevent_project_creation() {
+ setProperty("sonar.preventAutoProjectCreation", "true");
+
+ // xoo-sample-with-tests does not exist => fail
+ checkBuildFailed("shared/xoo-sample-with-tests");
+
+ // provision xoo-sample-with-tests and retry
+ client.projectClient().create(
+ NewProject.create()
+ .key("sample-with-tests")
+ .name("Sample With Tests"));
+ checkBuildSuccess("shared/xoo-sample-with-tests");
+ }
+
+ /**
+ * SONAR-3871
+ * SONAR-4713
+ */
+ @Test
+ public void should_allow_provisioned_project() {
+ setProperty("sonar.preventAutoProjectCreation", "true");
+
+ // provision xoo-multi-modules-sample before 1st scan and check build OK
+ client.projectClient().create(
+ NewProject.create()
+ .key("com.sonarsource.it.samples:multi-modules-sample")
+ .name("Xoo Multi Modules Sample"));
+ checkBuildSuccess("shared/xoo-multi-modules-sample");
+ }
+
+ /**
+ * SONAR-5547
+ */
+ @Test
+ public void should_allow_provisioned_project_with_branch() {
+ setProperty("sonar.preventAutoProjectCreation", "true");
+
+ // provision xoo-multi-modules-sample before 1st scan and check build OK
+ client.projectClient().create(
+ NewProject.create()
+ .key("com.sonarsource.it.samples:multi-modules-sample:branch")
+ .name("Xoo Multi Modules Sample - Branch"));
+ checkBuildSuccess("shared/xoo-multi-modules-sample", "sonar.branch", "branch");
+ }
+
+ /**
+ * SONAR-3871
+ * SONAR-4713
+ */
+ @Test
+ public void should_allow_provisioned_project_even_when_provisioning_not_enforced() {
+ setProperty("sonar.preventAutoProjectCreation", "false");
+
+ client.projectClient().create(
+ NewProject.create()
+ .key("xo")
+ .name("xo"));
+ checkBuildSuccess("shared/xoo-two-letters-named");
+ }
+
+ private static BuildResult checkBuildSuccess(String projectPath, String... propertiesKeyValues) {
+ BuildResult result = scan(projectPath, propertiesKeyValues);
+ assertThat(result.getStatus()).isZero();
+ return result;
+ }
+
+ private static BuildResult checkBuildFailed(String projectPath) {
+ BuildResult result = scan(projectPath);
+ assertThat(result.getStatus()).isNotEqualTo(0);
+ return result;
+ }
+
+ private static BuildResult scan(String projectPath, String... propertiesKeyValues) {
+ return orchestrator.executeBuildQuietly(
+ SonarRunner.create(ItUtils.projectDir(projectPath)).setProperties(propertiesKeyValues));
+ }
+
+ private static void setProperty(String key, String value) {
+ orchestrator.getServer().getAdminWsClient().update(new PropertyUpdateQuery(key, value));
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package it.analysis;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.BuildFailureException;
+import com.sonar.orchestrator.build.BuildResult;
+import com.sonar.orchestrator.build.SonarRunner;
+import it.Category3Suite;
+import java.io.File;
+import java.net.URL;
+import org.junit.ClassRule;
+import org.junit.Test;
+import util.ItUtils;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class SettingsEncryptionTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category3Suite.ORCHESTRATOR;
+
+ /**
+ * SONAR-2084
+ * SONAR-4061
+ */
+ @Test
+ public void testEncryptedProperty() throws Exception {
+ SonarRunner build = SonarRunner.create(ItUtils.projectDir("shared/xoo-sample"))
+ .setProperty("sonar.secretKeyPath", pathToValidSecretKey())
+ .setProperty("sonar.login", "admin")
+ // wrong password
+ .setProperty("sonar.password", "{aes}wrongencryption==")// wrong password
+ // "this is a secret" encrypted with the above secret key
+ .setProperty("encryptedProperty", "{aes}9mx5Zq4JVyjeChTcVjEide4kWCwusFl7P2dSVXtg9IY=");
+ BuildResult result = orchestrator.executeBuildQuietly(build);
+ assertThat(result.getStatus()).isNotEqualTo(0);
+ assertThat(result.getLogs()).contains("Fail to decrypt the property sonar.password. Please check your secret key");
+
+ build = SonarRunner.create(ItUtils.projectDir("shared/xoo-sample"))
+ .setProperty("sonar.secretKeyPath", pathToValidSecretKey())
+ // "admin" encrypted with the above secret key
+ .setProperty("sonar.login", "{aes}evRHXHsEyPr5RjEuxUJcHA==")
+ .setProperty("sonar.password", "{aes}evRHXHsEyPr5RjEuxUJcHA==")
+ // "this is a secret" encrypted with the above secret key
+ .setProperty("encryptedProperty", "{aes}9mx5Zq4JVyjeChTcVjEide4kWCwusFl7P2dSVXtg9IY=");
+ // no error
+ orchestrator.executeBuild(build);
+ }
+
+ /**
+ * SONAR-2084
+ */
+ @Test(expected = BuildFailureException.class)
+ public void failIfEncryptedPropertyButNoSecretKey() throws Exception {
+ // path to secret key is missing
+ SonarRunner build = SonarRunner.create(ItUtils.projectDir("shared/xoo-sample"))
+ .setProperty("encryptedProperty", "{aes}9mx5Zq4JVyjeChTcVjEide4kWCwusFl7P2dSVXtg9IY=");
+ orchestrator.executeBuild(build);
+ }
+
+ private String pathToValidSecretKey() throws Exception {
+ URL resource = getClass().getResource("/analysis/SettingsEncryptionTest/sonar-secret.txt");
+ return new File(resource.toURI()).getCanonicalPath();
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package it.analysis;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.BuildResult;
+import com.sonar.orchestrator.build.SonarRunner;
+import com.sonar.orchestrator.locator.FileLocation;
+import it.Category3Suite;
+import java.io.File;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.rules.TemporaryFolder;
+import util.ItUtils;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class TempFolderTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category3Suite.ORCHESTRATOR;
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Rule
+ public TemporaryFolder temp = new TemporaryFolder();
+
+ @Before
+ public void deleteData() {
+ orchestrator.resetData();
+ orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/analysis/TempFolderTest/one-issue-per-line.xml"));
+ orchestrator.getServer().provisionProject("sample", "Sample");
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
+ }
+
+ // SONAR-4748
+ @Test
+ public void should_create_in_temp_folder() {
+ File projectDir = ItUtils.projectDir("shared/xoo-sample");
+ BuildResult result = scan();
+
+ assertThat(result.getLogs()).doesNotContain("Creating temp directory:");
+ assertThat(result.getLogs()).doesNotContain("Creating temp file:");
+
+ result = scan("sonar.createTempFiles", "true");
+ assertThat(result.getLogs()).contains(
+ "Creating temp directory: " + projectDir.getAbsolutePath() + File.separator + ".sonar" + File.separator + ".sonartmp" + File.separator + "sonar-it");
+ assertThat(result.getLogs()).contains(
+ "Creating temp file: " + projectDir.getAbsolutePath() + File.separator + ".sonar" + File.separator + ".sonartmp" + File.separator + "sonar-it");
+
+ // Verify temp folder is deleted after analysis
+ assertThat(new File(projectDir, ".sonar/.sonartmp/sonar-it")).doesNotExist();
+ }
+
+ // SONAR-4748
+ @Test
+ public void should_not_use_system_tmp_dir() throws Exception {
+ String oldTmp = System.getProperty("java.io.tmpdir");
+ try {
+ File tmp = temp.newFolder();
+ assertThat(tmp.list()).isEmpty();
+
+ SonarRunner runner = configureRunner()
+ .setEnvironmentVariable("SONAR_RUNNER_OPTS", "-Djava.io.tmpdir=" + tmp.getAbsolutePath());
+ orchestrator.executeBuild(runner);
+
+ // TODO There is one remaining file waiting for SONARPLUGINS-3185
+ assertThat(tmp.list()).hasSize(1);
+ assertThat(tmp.list()[0]).matches("sonar-runner-batch(.*).jar");
+ } finally {
+ System.setProperty("java.io.tmpdir", oldTmp);
+ }
+ }
+
+ private BuildResult scan(String... props) {
+ SonarRunner runner = configureRunner(props);
+ return orchestrator.executeBuild(runner);
+ }
+
+ private SonarRunner configureRunner(String... props) {
+ return SonarRunner.create(ItUtils.projectDir("shared/xoo-sample"))
+ .setProperties(props);
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package it.analysisExclusion;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import it.Category4Suite;
+import java.util.List;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+import util.ItUtils;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class FileExclusionsTest {
+ static final String PROJECT = "exclusions";
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category4Suite.ORCHESTRATOR;
+
+ @Before
+ public void resetData() {
+ orchestrator.resetData();
+ }
+
+ @Test
+ public void exclude_source_files() {
+ scan(
+ "sonar.global.exclusions", "**/*Ignore*.xoo",
+ "sonar.exclusions", "**/*Exclude*.xoo,src/main/xoo/org/sonar/tests/packageToExclude/**",
+ "sonar.test.exclusions", "**/ClassTwoTest.xoo");
+
+ Resource project = projectWithMetrics("ncloc", "files", "directories");
+
+ assertThat(project.getMeasureIntValue("files")).isEqualTo(4);
+ assertThat(project.getMeasureIntValue("ncloc")).isEqualTo(60);
+ assertThat(project.getMeasureIntValue("directories")).isEqualTo(3);
+ }
+
+ /**
+ * SONAR-2444 / SONAR-3758
+ */
+ @Test
+ public void exclude_test_files() {
+ scan(
+ "sonar.global.exclusions", "**/*Ignore*.xoo",
+ "sonar.exclusions", "**/*Exclude*.xoo,org/sonar/tests/packageToExclude/**",
+ "sonar.test.exclusions", "**/ClassTwoTest.xoo");
+
+ List<Resource> testFiles = orchestrator.getServer().getWsClient()
+ .findAll(new ResourceQuery(PROJECT).setQualifiers("UTS").setDepth(-1));
+
+ assertThat(testFiles).hasSize(2);
+ assertThat(testFiles).extracting("name").doesNotContain("ClassTwoTest.xoo");
+ }
+
+ /**
+ * SONAR-1896
+ */
+ @Test
+ public void include_source_files() {
+ scan(
+ "sonar.dynamicAnalysis", "false",
+ "sonar.inclusions", "**/*One.xoo,**/*Two.xoo");
+
+ Resource project = projectWithMetrics("files");
+ assertThat(project.getMeasureIntValue("files")).isEqualTo(2);
+
+ List<Resource> sourceFiles = orchestrator.getServer().getWsClient()
+ .findAll(new ResourceQuery(PROJECT).setQualifiers("FIL").setDepth(-1));
+
+ assertThat(sourceFiles).hasSize(2);
+ assertThat(sourceFiles).extracting("name").containsOnly("ClassOne.xoo", "ClassTwo.xoo");
+ }
+
+ /**
+ * SONAR-1896
+ */
+ @Test
+ public void include_test_files() {
+ scan("sonar.test.inclusions", "src/test/xoo/**/*One*.xoo,src/test/xoo/**/*Two*.xoo");
+
+ Resource project = projectWithMetrics("tests");
+ assertThat(project.getMeasureIntValue("tests")).isEqualTo(2);
+
+ List<Resource> testFiles = orchestrator.getServer().getWsClient()
+ .findAll(new ResourceQuery(PROJECT).setQualifiers("UTS").setDepth(-1));
+
+ assertThat(testFiles).hasSize(2);
+ assertThat(testFiles).extracting("name").containsOnly("ClassOneTest.xoo", "ClassTwoTest.xoo");
+ }
+
+ /**
+ * SONAR-2760
+ */
+ @Test
+ public void include_and_exclude_files_by_absolute_path() {
+ scan(
+ // includes everything except ClassOnDefaultPackage
+ "sonar.inclusions", "file:**/src/main/xoo/org/**/*.xoo",
+
+ // exclude ClassThree and ClassToExclude
+ "sonar.exclusions", "file:**/src/main/xoo/org/**/packageToExclude/*.xoo,file:**/src/main/xoo/org/**/*Exclude.xoo");
+
+ List<Resource> sourceFiles = orchestrator.getServer().getWsClient()
+ .findAll(new ResourceQuery(PROJECT).setQualifiers("FIL").setDepth(-1));
+
+ assertThat(sourceFiles).hasSize(4);
+ assertThat(sourceFiles).extracting("name").containsOnly("ClassOne.xoo", "ClassToIgnoreGlobally.xoo", "ClassTwo.xoo", "NoSonarComment.xoo");
+ }
+
+ static Resource projectWithMetrics(String... metricKeys) {
+ return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT, metricKeys));
+ }
+
+ private void scan(String... properties) {
+ SonarRunner build = SonarRunner
+ .create(ItUtils.projectDir("exclusions/exclusions"))
+ .setProperties(properties);
+ orchestrator.executeBuild(build);
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package it.analysisExclusion;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.BuildResult;
+import com.sonar.orchestrator.build.SonarRunner;
+import com.sonar.orchestrator.locator.FileLocation;
+import it.Category3Suite;
+import it.Category4Suite;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+import util.ItUtils;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class IssueExclusionsTest {
+
+ private static final String PROJECT_KEY = "com.sonarsource.it.samples:multi-modules-exclusions";
+ private static final String PROJECT_DIR = "exclusions/xoo-multi-modules";
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category4Suite.ORCHESTRATOR;
+
+ @Before
+ public void resetData() {
+ orchestrator.resetData();
+ }
+
+ @Test
+ public void should_not_exclude_anything() {
+ scan();
+
+ checkIssueCountBySeverity(67, 2, 57, 4, 0, 4);
+ }
+
+ @Test
+ public void should_ignore_all_files() {
+ scan(
+ "sonar.issue.ignore.multicriteria", "1",
+ "sonar.issue.ignore.multicriteria.1.resourceKey", "**/*.xoo",
+ "sonar.issue.ignore.multicriteria.1.ruleKey", "*");
+
+ checkIssueCountBySeverity(4, 0, 0, 0, 0, 4);
+ }
+
+ @Test
+ public void should_enforce_only_on_one_file() {
+ scan(
+ "sonar.issue.enforce.multicriteria", "1",
+ "sonar.issue.enforce.multicriteria.1.resourceKey", "**/HelloA1.xoo",
+ "sonar.issue.enforce.multicriteria.1.ruleKey", "*");
+
+ checkIssueCountBySeverity(
+ 1 /* tag */+ 18 /* lines in HelloA1.xoo */+ 1 /* file */,
+ 0 + 1,
+ 0 + 18,
+ 0 + 1,
+ 0,
+ 0);
+ }
+
+ @Test
+ public void should_enforce_on_two_files_with_same_rule() {
+ scan(
+ "sonar.issue.enforce.multicriteria", "1,2",
+ "sonar.issue.enforce.multicriteria.1.resourceKey", "**/HelloA1.xoo",
+ "sonar.issue.enforce.multicriteria.1.ruleKey", "*",
+ "sonar.issue.enforce.multicriteria.2.resourceKey", "**/HelloA2.xoo",
+ "sonar.issue.enforce.multicriteria.2.ruleKey", "*");
+
+ checkIssueCountBySeverity(
+ 2 /* tags */+ 18 /* lines in HelloA1.xoo */+ 15 /* lines in HelloA2.xoo */+ 2 /* files */,
+ 0 + 2,
+ 0 + 18 + 15,
+ 0 + 2,
+ 0,
+ 0);
+ }
+
+ @Test
+ public void should_enforce_on_two_files_with_different_rule() {
+ scan(
+ "sonar.issue.enforce.multicriteria", "1,2",
+ "sonar.issue.enforce.multicriteria.1.resourceKey", "**/HelloA1.xoo",
+ "sonar.issue.enforce.multicriteria.1.ruleKey", "xoo:OneIssuePerLine",
+ "sonar.issue.enforce.multicriteria.2.resourceKey", "**/HelloA2.xoo",
+ "sonar.issue.enforce.multicriteria.2.ruleKey", "xoo:HasTag");
+
+ checkIssueCountBySeverity(
+ 1 /* tag in HelloA2 */+ 18 /* lines in HelloA1.xoo */+ 4 /* files */+ 4 /* modules */,
+ 0 + 1,
+ 0 + 18,
+ 4,
+ 0,
+ 4);
+ }
+
+ @Test
+ public void should_ignore_files_with_regexp() {
+ scan(
+ "sonar.issue.ignore.allfile", "1",
+ "sonar.issue.ignore.allfile.1.fileRegexp", "EXTERMINATE-ALL-ISSUES");
+
+ checkIssueCountBySeverity(
+ 67 - 1 /* tag */- 18 /* lines in HelloA1.xoo */- 1 /* file */,
+ 2 - 1,
+ 57 - 18,
+ 4 - 1,
+ 0,
+ 4);
+ }
+
+ @Test
+ public void should_ignore_block_with_regexp() {
+ scan(
+ "sonar.issue.ignore.block", "1",
+ "sonar.issue.ignore.block.1.beginBlockRegexp", "MUTE-SONAR",
+ "sonar.issue.ignore.block.1.endBlockRegexp", "UNMUTE-SONAR");
+
+ checkIssueCountBySeverity(
+ 67 - 1 /* tag */- 5 /* lines in HelloA2.xoo */,
+ 2 - 1,
+ 57 - 5,
+ 4,
+ 0,
+ 4);
+ }
+
+ @Test
+ public void should_ignore_to_end_of_file() {
+ scan(
+ "sonar.issue.ignore.block", "1",
+ "sonar.issue.ignore.block.1.beginBlockRegexp", "MUTE-SONAR",
+ "sonar.issue.ignore.block.1.endBlockRegexp", "");
+
+ checkIssueCountBySeverity(
+ 67 - 1 /* tag */- 7 /* remaining lines in HelloA2.xoo */,
+ 2 - 1,
+ 57 - 7,
+ 4,
+ 0,
+ 4);
+ }
+
+ @Test
+ public void should_ignore_one_per_line_on_single_package() {
+ scan(
+ "sonar.issue.ignore.multicriteria", "1",
+ "sonar.issue.ignore.multicriteria.1.resourceKey", "**/com/sonar/it/samples/modules/a1/*",
+ "sonar.issue.ignore.multicriteria.1.ruleKey", "xoo:OneIssuePerLine");
+
+ checkIssueCountBySeverity(
+ 67 - 18 /* lines in HelloA1.xoo */,
+ 2,
+ 57 - 18,
+ 4,
+ 0,
+ 4);
+ }
+
+ @Test
+ public void should_apply_exclusions_from_multiple_sources() {
+ scan(
+ "sonar.issue.ignore.allfile", "1",
+ "sonar.issue.ignore.allfile.1.fileRegexp", "EXTERMINATE-ALL-ISSUES",
+ "sonar.issue.ignore.block", "1",
+ "sonar.issue.ignore.block.1.beginBlockRegexp", "MUTE-SONAR",
+ "sonar.issue.ignore.block.1.endBlockRegexp", "UNMUTE-SONAR",
+ "sonar.issue.ignore.multicriteria", "1",
+ "sonar.issue.ignore.multicriteria.1.resourceKey", "**/com/sonar/it/samples/modules/b1/*",
+ "sonar.issue.ignore.multicriteria.1.ruleKey", "xoo:OneIssuePerLine");
+
+ checkIssueCountBySeverity(
+ 67 - 1 /* tag in HelloA1.xoo */- 1 /* tag in HelloA2.xoo */
+ - 18 /* lines in HelloA1.xoo */- 5 /* lines in HelloA2.xoo */- 12 /* lines in HelloB1.xoo */
+ - 1 /* HelloA1.xoo file */,
+ 0,
+ 57 - 18 - 5 - 12,
+ 4 - 1,
+ 0,
+ 4);
+ }
+
+ @Test
+ public void should_log_missing_resource_key() {
+ checkAnalysisFails(
+ "sonar.issue.ignore.multicriteria", "1",
+ "sonar.issue.ignore.multicriteria.1.resourceKey", "",
+ "sonar.issue.ignore.multicriteria.1.ruleKey", "*");
+ }
+
+ @Test
+ public void should_log_missing_rule_key() {
+ checkAnalysisFails(
+ "sonar.issue.ignore.multicriteria", "1",
+ "sonar.issue.ignore.multicriteria.1.resourceKey", "*",
+ "sonar.issue.ignore.multicriteria.1.ruleKey", "");
+ }
+
+ @Test
+ public void should_log_missing_block_start() {
+ checkAnalysisFails(
+ "sonar.issue.ignore.block", "1",
+ "sonar.issue.ignore.block.1.beginBlockRegexp", "",
+ "sonar.issue.ignore.block.1.endBlockRegexp", "UNMUTE-SONAR");
+ }
+
+ @Test
+ public void should_log_missing_whole_file_regexp() {
+ checkAnalysisFails(
+ "sonar.issue.ignore.allfile", "1",
+ "sonar.issue.ignore.allfile.1.fileRegexp", "");
+ }
+
+ protected BuildResult scan(String... properties) {
+ orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/exclusions/IssueExclusionsTest/with-many-rules.xml"));
+ orchestrator.getServer().provisionProject("com.sonarsource.it.samples:multi-modules-exclusions",
+ "Sonar :: Integration Tests :: Multi-modules With Exclusions");
+ orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-exclusions", "xoo", "with-many-rules");
+
+ SonarRunner scan = SonarRunner.create(ItUtils.projectDir(PROJECT_DIR))
+ .setProperties("sonar.cpd.skip", "true")
+ .setProperties(properties)
+ .setProperties("sonar.verbose", "true");
+ return orchestrator.executeBuildQuietly(scan);
+ }
+
+ private void checkIssueCountBySeverity(int total, int taggedXoo, int perLine, int perFile, int blocker, int perModule) {
+ Resource project = orchestrator.getServer().getWsClient()
+ .find(ResourceQuery.createForMetrics(PROJECT_KEY, "violations", "info_violations", "minor_violations", "major_violations",
+ "blocker_violations", "critical_violations"));
+ assertThat(project.getMeasureIntValue("violations")).isEqualTo(total);
+ assertThat(project.getMeasureIntValue("info_violations")).isEqualTo(taggedXoo); // Has tag 'xoo'
+ assertThat(project.getMeasureIntValue("minor_violations")).isEqualTo(perLine); // One per line
+ assertThat(project.getMeasureIntValue("major_violations")).isEqualTo(perFile); // One per file
+ assertThat(project.getMeasureIntValue("blocker_violations")).isEqualTo(blocker);
+ assertThat(project.getMeasureIntValue("critical_violations")).isEqualTo(perModule); // One per module
+ }
+
+ private void checkAnalysisFails(String... properties) {
+ BuildResult buildResult = scan(properties);
+ assertThat(buildResult.getStatus()).isNotEqualTo(0);
+ assertThat(buildResult.getLogs().indexOf("SonarException")).isGreaterThan(0);
+ }
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package it.componentSearch;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import it.Category4Suite;
+import java.io.IOException;
+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 static org.assertj.core.api.Assertions.assertThat;
+import static util.ItUtils.projectDir;
+
+public class ProjectSearchTest {
+
+ @ClassRule
+ public static final Orchestrator orchestrator = Category4Suite.ORCHESTRATOR;
+
+ @Before
+ public void inspectProject() {
+ orchestrator.resetData();
+ orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample")));
+ }
+
+ /**
+ * 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();
+ }
+ }
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it.customMeasure;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import it.Category2Suite;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.wsclient.services.Measure;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static util.ItUtils.projectDir;
+
+public class CustomMeasuresTest {
+
+ public static final String PROJECT_KEY = "sample";
+ @ClassRule
+ public static Orchestrator orchestrator = Category2Suite.ORCHESTRATOR;
+
+ @Before
+ public void deleteProjects() {
+ orchestrator.resetData();
+ }
+
+ @Test
+ public void custom_measures_should_be_integrated_during_project_analysis() {
+ analyzeProject();
+ setBurnedBudget(1200.3);
+ setTeamSize(4);
+
+ assertThat(getMeasure("team_size")).isNull();
+ assertThat(getMeasure("burned_budget")).isNull();
+
+ analyzeProject();
+
+ assertThat(getMeasure("burned_budget").getValue()).isEqualTo(1200.3);
+ assertThat(getMeasure("team_size").getIntValue()).isEqualTo(4);
+ }
+
+ @Test
+ public void should_update_value() {
+ analyzeProject();
+ setTeamSize(4);
+ analyzeProject();
+ updateTeamSize(15);
+ assertThat(getMeasure("team_size").getIntValue()).isEqualTo(4);
+ analyzeProject();// the value is available when the project is analyzed again
+ assertThat(getMeasure("team_size").getIntValue()).isEqualTo(15);
+ }
+
+ @Test
+ public void should_delete_custom_measure() {
+ analyzeProject();
+ setTeamSize(4);
+ analyzeProject();
+ deleteCustomMeasure("team_size");
+ assertThat(getMeasure("team_size").getIntValue()).isEqualTo(4);// the value is still available. It will be removed during next analyzed
+
+ analyzeProject();
+ assertThat(getMeasure("team_size")).isNull();
+ }
+
+ private void analyzeProject() {
+ orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample")));
+ }
+
+ private void setTeamSize(int i) {
+ orchestrator.getServer().adminWsClient().post("api/custom_measures/create", "projectKey", PROJECT_KEY, "metricKey", "team_size", "value", String.valueOf(i));
+ }
+
+ private void updateTeamSize(int i) {
+ String response = orchestrator.getServer().adminWsClient().get("api/custom_measures/search", "projectKey", PROJECT_KEY, "metricKey", "team_size");
+ Matcher jsonObjectMatcher = Pattern.compile(".*?\"id\"\\s*:\\s*\"(.*?)\".*", Pattern.MULTILINE).matcher(response);
+ jsonObjectMatcher.find();
+ String customMeasureId = jsonObjectMatcher.group(1);
+ orchestrator.getServer().adminWsClient().post("api/custom_measures/update", "id", customMeasureId, "value", String.valueOf(i));
+ }
+
+ private void setBurnedBudget(double d) {
+ orchestrator.getServer().adminWsClient().post("api/custom_measures/create", "projectKey", PROJECT_KEY, "metricKey", "burned_budget", "value", String.valueOf(d));
+ }
+
+ private void deleteCustomMeasure(String metricKey) {
+ String response = orchestrator.getServer().adminWsClient().get("api/custom_measures/search", "projectKey", PROJECT_KEY, "metricKey", metricKey);
+ Matcher jsonObjectMatcher = Pattern.compile(".*?\"id\"\\s*:\\s*\"(.*?)\".*", Pattern.MULTILINE).matcher(response);
+ jsonObjectMatcher.find();
+ String customMeasureId = jsonObjectMatcher.group(1);
+ orchestrator.getServer().adminWsClient().post("api/custom_measures/delete", "id", customMeasureId);
+ }
+
+ private Measure getMeasure(String metricKey) {
+ Resource resource = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT_KEY, metricKey));
+ return resource != null ? resource.getMeasure(metricKey) : null;
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package it.duplication;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.MavenBuild;
+import it.Category3Suite;
+import it.Category4Suite;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+import util.ItUtils;
+
+import static org.hamcrest.Matchers.notNullValue;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+@Ignore("Cross project duplications are temporary disabled, waiting to be reimplemented in CE or correctly implemented in the batch")
+public class CrossProjectDuplicationsTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category4Suite.ORCHESTRATOR;
+
+ @Before
+ public void analyzeProjects() {
+ orchestrator.resetData();
+
+ MavenBuild build = MavenBuild.create(ItUtils.projectPom("duplications/cross-project/a"))
+ .setCleanSonarGoals()
+ .setProperty("sonar.cpd.cross_project", "true")
+ .setProperty("sonar.dynamicAnalysis", "false");
+ orchestrator.executeBuild(build);
+
+ build = MavenBuild.create(ItUtils.projectPom("duplications/cross-project/b"))
+ .setCleanSonarGoals()
+ .setProperty("sonar.cpd.cross_project", "true")
+ .setProperty("sonar.dynamicAnalysis", "false");
+ orchestrator.executeBuild(build);
+
+ build = MavenBuild.create(ItUtils.projectPom("duplications/cross-project/b"))
+ .setCleanSonarGoals()
+ .setProperty("sonar.cpd.cross_project", "true")
+ .setProperty("sonar.branch", "branch")
+ .setProperty("sonar.dynamicAnalysis", "false");
+ orchestrator.executeBuild(build);
+ }
+
+ @Test
+ public void testMeasures() throws Exception {
+
+ Resource project = getResource("com.sonarsource.it.samples.duplications:a");
+ assertThat(project, notNullValue());
+ assertThat(project.getMeasureIntValue("duplicated_lines"), is(0));
+
+ project = getResource("com.sonarsource.it.samples.duplications:b");
+ assertThat(project, notNullValue());
+ assertThat(project.getMeasureIntValue("duplicated_lines"), is(10));
+
+ project = getResource("com.sonarsource.it.samples.duplications:b:branch");
+ assertThat(project, notNullValue());
+ assertThat(project.getMeasureIntValue("duplicated_lines"), is(0));
+ }
+
+ private Resource getResource(String key) {
+ return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(key, "duplicated_lines"));
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package it.duplication;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.MavenBuild;
+import it.Category3Suite;
+import it.Category4Suite;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+import util.ItUtils;
+
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.core.IsNot.not;
+import static org.hamcrest.core.IsNull.nullValue;
+import static org.junit.Assert.assertThat;
+
+public class DuplicationsTest {
+
+ private static final String DUPLICATIONS = "com.sonarsource.it.samples:duplications";
+ private static final String DUPLICATIONS_WITH_EXCLUSIONS = "com.sonarsource.it.samples:duplications-with-exclusions";
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category4Suite.ORCHESTRATOR;
+
+ @BeforeClass
+ public static void init() {
+ orchestrator.resetData();
+
+ MavenBuild build = MavenBuild.create(ItUtils.projectPom("duplications/file-duplications"))
+ .setCleanPackageSonarGoals();
+ orchestrator.executeBuild(build);
+
+ // Use a new project key to avoid conflict with other tests
+ String projectKey = DUPLICATIONS_WITH_EXCLUSIONS;
+ build = MavenBuild.create(ItUtils.projectPom("duplications/file-duplications"))
+ .setCleanPackageSonarGoals()
+ .setProperties("sonar.projectKey", projectKey,
+ "sonar.cpd.exclusions", "**/Class*");
+ orchestrator.executeBuild(build);
+
+ }
+
+ @Test
+ public void duplicated_lines_within_same_class() {
+ Resource file = getResource(DUPLICATIONS + ":src/main/java/duplicated_lines_within_same_class/DuplicatedLinesInSameClass.java");
+ assertThat(file, not(nullValue()));
+ assertThat(file.getMeasureValue("duplicated_blocks"), is(2.0));
+ assertThat(file.getMeasureValue("duplicated_lines"), is(27.0 * 2)); // 2 blocks with 27 lines
+ assertThat(file.getMeasureValue("duplicated_files"), is(1.0));
+ assertThat(file.getMeasureValue("duplicated_lines_density"), is(60.0));
+ }
+
+ @Test
+ public void duplicated_same_lines_within_3_classes() {
+ Resource file1 = getResource(DUPLICATIONS + ":src/main/java/duplicated_same_lines_within_3_classes/Class1.java");
+ assertThat(file1, not(nullValue()));
+ assertThat(file1.getMeasureValue("duplicated_blocks"), is(1.0));
+ assertThat(file1.getMeasureValue("duplicated_lines"), is(29.0));
+ assertThat(file1.getMeasureValue("duplicated_files"), is(1.0));
+ assertThat(file1.getMeasureValue("duplicated_lines_density"), is(47.5));
+
+ Resource file2 = getResource(DUPLICATIONS + ":src/main/java/duplicated_same_lines_within_3_classes/Class2.java");
+ assertThat(file2, not(nullValue()));
+ assertThat(file2.getMeasureValue("duplicated_blocks"), is(1.0));
+ assertThat(file2.getMeasureValue("duplicated_lines"), is(29.0));
+ assertThat(file2.getMeasureValue("duplicated_files"), is(1.0));
+ assertThat(file2.getMeasureValue("duplicated_lines_density"), is(48.3));
+
+ Resource file3 = getResource(DUPLICATIONS + ":src/main/java/duplicated_same_lines_within_3_classes/Class3.java");
+ assertThat(file3, not(nullValue()));
+ assertThat(file3.getMeasureValue("duplicated_blocks"), is(1.0));
+ assertThat(file3.getMeasureValue("duplicated_lines"), is(29.0));
+ assertThat(file3.getMeasureValue("duplicated_files"), is(1.0));
+ assertThat(file3.getMeasureValue("duplicated_lines_density"), is(46.0));
+
+ Resource pkg = getResource(DUPLICATIONS + ":src/main/java/duplicated_same_lines_within_3_classes");
+ assertThat(pkg, not(nullValue()));
+ assertThat(pkg.getMeasureValue("duplicated_blocks"), is(3.0));
+ assertThat(pkg.getMeasureValue("duplicated_lines"), is(29.0 * 3)); // 3 blocks with 29 lines
+ assertThat(pkg.getMeasureValue("duplicated_files"), is(3.0));
+ assertThat(pkg.getMeasureValue("duplicated_lines_density"), is(47.3));
+ }
+
+ @Test
+ public void duplicated_lines_within_package() {
+ Resource file1 = getResource(DUPLICATIONS + ":src/main/java/duplicated_lines_within_package/DuplicatedLinesInSamePackage1.java");
+ assertThat(file1, not(nullValue()));
+ assertThat(file1.getMeasureValue("duplicated_blocks"), is(4.0));
+ assertThat(file1.getMeasureValue("duplicated_lines"), is(72.0));
+ assertThat(file1.getMeasureValue("duplicated_files"), is(1.0));
+ assertThat(file1.getMeasureValue("duplicated_lines_density"), is(58.1));
+
+ Resource file2 = getResource(DUPLICATIONS + ":src/main/java/duplicated_lines_within_package/DuplicatedLinesInSamePackage2.java");
+ assertThat(file2, not(nullValue()));
+ assertThat(file2.getMeasureValue("duplicated_blocks"), is(3.0));
+ assertThat(file2.getMeasureValue("duplicated_lines"), is(58.0));
+ assertThat(file2.getMeasureValue("duplicated_files"), is(1.0));
+ assertThat(file2.getMeasureValue("duplicated_lines_density"), is(64.4));
+
+ Resource pkg = getResource(DUPLICATIONS + ":src/main/java/duplicated_lines_within_package");
+ assertThat(pkg, not(nullValue()));
+ assertThat(pkg.getMeasureValue("duplicated_blocks"), is(4.0 + 3.0));
+ assertThat(pkg.getMeasureValue("duplicated_lines"), is(72.0 + 58.0));
+ assertThat(pkg.getMeasureValue("duplicated_files"), is(2.0));
+ assertThat(pkg.getMeasureValue("duplicated_lines_density"), is(60.7));
+ }
+
+ @Test
+ public void duplicated_lines_with_other_package() {
+ Resource file1 = getResource(DUPLICATIONS + ":src/main/java/duplicated_lines_with_other_package1/DuplicatedLinesWithOtherPackage.java");
+ assertThat(file1, not(nullValue()));
+ assertThat(file1.getMeasureValue("duplicated_blocks"), is(1.0));
+ assertThat(file1.getMeasureValue("duplicated_lines"), is(36.0));
+ assertThat(file1.getMeasureValue("duplicated_files"), is(1.0));
+ assertThat(file1.getMeasureValue("duplicated_lines_density"), is(60.0));
+
+ Resource pkg1 = getResource(DUPLICATIONS + ":src/main/java/duplicated_lines_with_other_package1");
+ assertThat(pkg1, not(nullValue()));
+ assertThat(pkg1.getMeasureValue("duplicated_blocks"), is(1.0));
+ assertThat(pkg1.getMeasureValue("duplicated_lines"), is(36.0));
+ assertThat(pkg1.getMeasureValue("duplicated_files"), is(1.0));
+ assertThat(pkg1.getMeasureValue("duplicated_lines_density"), is(60.0));
+
+ Resource file2 = getResource(DUPLICATIONS + ":src/main/java/duplicated_lines_with_other_package2/DuplicatedLinesWithOtherPackage.java");
+ assertThat(file2, not(nullValue()));
+ assertThat(file2.getMeasureValue("duplicated_blocks"), is(1.0));
+ assertThat(file2.getMeasureValue("duplicated_lines"), is(36.0));
+ assertThat(file2.getMeasureValue("duplicated_files"), is(1.0));
+ assertThat(file2.getMeasureValue("duplicated_lines_density"), is(60.0));
+
+ Resource pkg2 = getResource(DUPLICATIONS + ":src/main/java/duplicated_lines_with_other_package2");
+ assertThat(pkg2, not(nullValue()));
+ assertThat(pkg2.getMeasureValue("duplicated_blocks"), is(1.0));
+ assertThat(pkg2.getMeasureValue("duplicated_lines"), is(36.0));
+ assertThat(pkg2.getMeasureValue("duplicated_files"), is(1.0));
+ assertThat(pkg2.getMeasureValue("duplicated_lines_density"), is(60.0));
+ }
+
+ @Test
+ public void consolidation() {
+ Resource project = getResource(DUPLICATIONS);
+ assertThat(project, not(nullValue()));
+ assertThat(project.getMeasureValue("duplicated_blocks"), is(14.0));
+ assertThat(project.getMeasureValue("duplicated_lines"), is(343.0));
+ assertThat(project.getMeasureValue("duplicated_files"), is(8.0));
+ assertThat(project.getMeasureValue("duplicated_lines_density"), is(56.4));
+ }
+
+ /**
+ * SONAR-3108
+ */
+ @Test
+ public void use_duplication_exclusions() {
+ Resource project = getResource(DUPLICATIONS_WITH_EXCLUSIONS);
+ assertThat(project, not(nullValue()));
+ assertThat(project.getMeasureValue("duplicated_blocks"), is(11.0));
+ assertThat(project.getMeasureValue("duplicated_lines"), is(256.0));
+ assertThat(project.getMeasureValue("duplicated_files"), is(5.0));
+ assertThat(project.getMeasureValue("duplicated_lines_density"), is(42.1));
+ }
+
+ private Resource getResource(String key) {
+ return orchestrator.getServer().getWsClient()
+ .find(ResourceQuery.createForMetrics(key, "duplicated_lines", "duplicated_blocks", "duplicated_files", "duplicated_lines_density"));
+ }
+
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package it.i18n;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import com.sonar.orchestrator.selenium.Selenese;
+import it.Category1Suite;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import util.selenium.SeleneseTest;
+
+import static util.ItUtils.projectDir;
+
+public class I18nTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category1Suite.ORCHESTRATOR;
+
+ @Before
+ public void cleanDatabase() {
+ orchestrator.resetData();
+ }
+
+ /**
+ * TODO This test should use a fake widget that display a fake metric with decimals instead of using provided metric
+ */
+ @Test
+ public void test_localization() {
+ orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample")));
+
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("ui-i18n",
+ "/i18n/default-locale-is-english.html",
+ "/i18n/french-locale.html",
+ "/i18n/french-pack.html",
+ "/i18n/locale-with-france-country.html",
+ "/i18n/locale-with-swiss-country.html").build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+ }
+
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package it.issue;
+
+import com.sonar.orchestrator.Orchestrator;
+import it.Category2Suite;
+import java.util.List;
+import org.junit.ClassRule;
+import org.sonar.wsclient.issue.Issue;
+import org.sonar.wsclient.issue.IssueClient;
+import org.sonar.wsclient.issue.IssueQuery;
+import org.sonar.wsclient.issue.Issues;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public abstract class AbstractIssueTest {
+
+ @ClassRule
+ public static final Orchestrator ORCHESTRATOR = Category2Suite.ORCHESTRATOR;
+
+ static IssueClient adminIssueClient() {
+ return ORCHESTRATOR.getServer().adminWsClient().issueClient();
+ }
+
+ static IssueClient issueClient() {
+ return ORCHESTRATOR.getServer().wsClient().issueClient();
+ }
+
+ static Issue searchRandomIssue() {
+ List<Issue> issues = searchIssues(IssueQuery.create());
+ assertThat(issues).isNotEmpty();
+ return issues.get(0);
+ }
+
+ static Issues search(IssueQuery issueQuery) {
+ issueQuery.urlParams().put("additionalFields", "_all");
+ return issueClient().find(issueQuery);
+ }
+
+ static Issue searchIssueByKey(String issueKey) {
+ List<Issue> issues = searchIssues(IssueQuery.create().issues(issueKey));
+ assertThat(issues).hasSize(1);
+ return issues.get(0);
+ }
+
+ static List<Issue> searchIssues(String... issueKeys) {
+ return searchIssues(issueKeys, false);
+ }
+
+ static List<Issue> searchIssues(String issueKey, boolean withComments) {
+ return searchIssues(new String[] {issueKey}, withComments);
+ }
+
+ static List<Issue> searchIssues(String[] issueKeys, boolean withComments) {
+ IssueQuery query = IssueQuery.create().issues(issueKeys);
+ if (withComments) {
+ query.urlParams().put("additionalFields", "comments");
+ }
+ return searchIssues(query);
+ }
+
+ static List<Issue> searchIssues() {
+ return searchIssues(IssueQuery.create());
+ }
+
+ static List<Issue> searchIssues(IssueQuery issueQuery) {
+ return issueClient().find(issueQuery).list();
+ }
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it.issue;
+
+import com.sonar.orchestrator.locator.FileLocation;
+import java.util.List;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.sonar.wsclient.issue.Issue;
+import org.sonar.wsclient.issue.IssueQuery;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static util.ItUtils.runProjectAnalysis;
+
+public class CommonRulesTest extends AbstractIssueTest {
+
+ public static final String FILE_KEY = "common-rules-project:src/Sample.xoo";
+ public static final String TEST_FILE_KEY = "common-rules-project:test/SampleTest.xoo";
+
+ @BeforeClass
+ public static void setUp() {
+ ORCHESTRATOR.resetData();
+ ORCHESTRATOR.getServer().restoreProfile(FileLocation.ofClasspath("/issue/CommonRulesTest/xoo-common-rules-profile.xml"));
+ ORCHESTRATOR.getServer().provisionProject("common-rules-project", "Sample");
+ ORCHESTRATOR.getServer().associateProjectToQualityProfile("common-rules-project", "xoo", "xoo-common-rules");
+ runProjectAnalysis(ORCHESTRATOR, "issue/common-rules",
+ "sonar.cpd.xoo.minimumTokens", "2",
+ "sonar.cpd.xoo.minimumLines", "2");
+ }
+
+ @Test
+ public void test_rule_on_duplicated_blocks() {
+ List<Issue> issues = findIssues(FILE_KEY, "common-xoo:DuplicatedBlocks");
+ assertThat(issues).hasSize(1);
+ }
+
+ @Test
+ public void test_rule_on_comments() {
+ List<Issue> issues = findIssues(FILE_KEY, "common-xoo:InsufficientCommentDensity");
+ assertThat(issues.size()).isEqualTo(1);
+ }
+
+ @Test
+ public void test_rule_on_coverage() {
+ List<Issue> issues = findIssues(FILE_KEY, "common-xoo:InsufficientBranchCoverage");
+ assertThat(issues.size()).isEqualTo(1);
+
+ issues = findIssues(FILE_KEY, "common-xoo:InsufficientLineCoverage");
+ assertThat(issues.size()).isEqualTo(1);
+ }
+
+ @Test
+ public void test_rule_on_skipped_tests() {
+ List<Issue> issues = findIssues(TEST_FILE_KEY, "common-xoo:SkippedUnitTests");
+ assertThat(issues.size()).isEqualTo(1);
+ }
+
+ @Test
+ public void test_rule_on_test_errors() {
+ List<Issue> issues = findIssues(TEST_FILE_KEY, "common-xoo:FailedUnitTests");
+ assertThat(issues.size()).isEqualTo(1);
+ }
+
+ private List<Issue> findIssues(String componentKey, String ruleKey) {
+ return searchIssues(IssueQuery.create().components(componentKey).rules(ruleKey));
+ }
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it.issue;
+
+import java.util.List;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.sonar.wsclient.issue.Issue;
+import util.ProjectAnalysis;
+import util.ProjectAnalysisRule;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class CustomRulesTest extends AbstractIssueTest {
+
+ @Rule
+ public final ProjectAnalysisRule projectAnalysisRule = ProjectAnalysisRule.from(ORCHESTRATOR);
+
+ private ProjectAnalysis xooSampleAnalysis;
+
+ @Before
+ public void setup() {
+ String profileKey = projectAnalysisRule.registerProfile("/issue/CustomRulesTest/custom.xml");
+ String projectKey = projectAnalysisRule.registerProject("shared/xoo-sample");
+ this.xooSampleAnalysis = projectAnalysisRule.newProjectAnalysis(projectKey)
+ .withQualityProfile(profileKey);
+ }
+
+ @Test
+ public void analyzeProjectWithCustomRules() throws Exception {
+ ORCHESTRATOR.getServer().adminWsClient().post("api/rules/create",
+ "template_key", "xoo:TemplateRule",
+ "custom_key", "MyCustomRule",
+ "markdown_description", "My description",
+ "name", "My custom rule",
+ "severity", "BLOCKER",
+ "params", "line=2");
+
+ xooSampleAnalysis.run();
+
+ List<Issue> issues = searchIssues();
+ assertThat(issues).hasSize(1);
+
+ Issue issue = issues.get(0);
+ assertThat(issue.ruleKey()).isEqualTo("xoo:MyCustomRule");
+ assertThat(issue.line()).isEqualTo(2);
+ // Overriden in quality profile
+ assertThat(issue.severity()).isEqualTo("CRITICAL");
+ }
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it.issue;
+
+import java.util.List;
+import org.assertj.core.api.Assertions;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.sonar.wsclient.base.HttpException;
+import org.sonar.wsclient.issue.ActionPlan;
+import org.sonar.wsclient.issue.ActionPlanClient;
+import org.sonar.wsclient.issue.Issue;
+import org.sonar.wsclient.issue.IssueComment;
+import org.sonar.wsclient.issue.IssueQuery;
+import org.sonar.wsclient.issue.Issues;
+import org.sonar.wsclient.issue.NewActionPlan;
+import util.ProjectAnalysis;
+import util.ProjectAnalysisRule;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.fail;
+import static util.ItUtils.toDate;
+import static util.ItUtils.verifyHttpException;
+
+public class IssueActionTest extends AbstractIssueTest {
+
+ @Rule
+ public final ProjectAnalysisRule projectAnalysisRule = ProjectAnalysisRule.from(ORCHESTRATOR);
+
+ Issue issue;
+ ProjectAnalysis projectAnalysis;
+
+ @Before
+ public void setup() {
+ String qualityProfileKey = projectAnalysisRule.registerProfile("/issue/IssueActionTest/xoo-one-issue-per-line-profile.xml");
+ String projectKey = projectAnalysisRule.registerProject("shared/xoo-sample");
+
+ this.projectAnalysis = projectAnalysisRule.newProjectAnalysis(projectKey).withQualityProfile(qualityProfileKey);
+ this.projectAnalysis.run();
+ this.issue = searchRandomIssue();
+ }
+
+ @Test
+ public void no_comments_by_default() throws Exception {
+ assertThat(issue.comments()).isEmpty();
+ }
+
+ @Test
+ public void add_comment() throws Exception {
+ IssueComment comment = adminIssueClient().addComment(issue.key(), "this is my *comment*");
+ assertThat(comment.key()).isNotNull();
+ assertThat(comment.htmlText()).isEqualTo("this is my <em>comment</em>");
+ assertThat(comment.login()).isEqualTo("admin");
+ assertThat(comment.createdAt()).isNotNull();
+
+ // reload issue
+ Issue reloaded = searchIssues(issue.key(), true).iterator().next();
+
+ assertThat(reloaded.comments()).hasSize(1);
+ assertThat(reloaded.comments().get(0).key()).isEqualTo(comment.key());
+ assertThat(reloaded.comments().get(0).htmlText()).isEqualTo("this is my <em>comment</em>");
+ assertThat(reloaded.updateDate().before(issue.creationDate())).isFalse();
+ }
+
+ /**
+ * SONAR-4450
+ */
+ @Test
+ public void should_reject_blank_comment() throws Exception {
+ try {
+ adminIssueClient().addComment(issue.key(), " ");
+ fail();
+ } catch (HttpException ex) {
+ assertThat(ex.status()).isEqualTo(400);
+ }
+
+ Issue reloaded = searchIssueByKey(issue.key());
+ assertThat(reloaded.comments()).hasSize(0);
+ }
+
+ /**
+ * SONAR-4352
+ */
+ @Test
+ public void change_severity() {
+ String componentKey = "sample";
+
+ // there are no blocker issues
+ assertThat(searchIssuesBySeverities(componentKey, "BLOCKER")).isEmpty();
+
+ // increase the severity of an issue
+ adminIssueClient().setSeverity(issue.key(), "BLOCKER");
+
+ assertThat(searchIssuesBySeverities(componentKey, "BLOCKER")).hasSize(1);
+
+ projectAnalysis.run();
+ Issue reloaded = searchIssueByKey(issue.key());
+ assertThat(reloaded.severity()).isEqualTo("BLOCKER");
+ assertThat(reloaded.status()).isEqualTo("OPEN");
+ assertThat(reloaded.resolution()).isNull();
+ assertThat(reloaded.creationDate()).isEqualTo(issue.creationDate());
+ assertThat(reloaded.creationDate().before(reloaded.updateDate())).isTrue();
+ }
+
+ /**
+ * SONAR-4287
+ */
+ @Test
+ public void assign() {
+ assertThat(issue.assignee()).isNull();
+ Issues issues = search(IssueQuery.create().issues(issue.key()));
+ assertThat(issues.users()).isEmpty();
+
+ adminIssueClient().assign(issue.key(), "admin");
+ Assertions.assertThat(searchIssues(IssueQuery.create().assignees("admin"))).hasSize(1);
+
+ projectAnalysis.run();
+ Issue reloaded = searchIssueByKey(issue.key());
+ assertThat(reloaded.assignee()).isEqualTo("admin");
+ assertThat(reloaded.creationDate()).isEqualTo(issue.creationDate());
+
+ issues = search(IssueQuery.create().issues(issue.key()));
+ assertThat(issues.user("admin")).isNotNull();
+ assertThat(issues.user("admin").name()).isEqualTo("Administrator");
+
+ // unassign
+ adminIssueClient().assign(issue.key(), null);
+ reloaded = searchIssueByKey(issue.key());
+ assertThat(reloaded.assignee()).isNull();
+ Assertions.assertThat(searchIssues(IssueQuery.create().assignees("admin"))).isEmpty();
+ }
+
+ /**
+ * SONAR-4287
+ */
+ @Test
+ public void fail_assign_if_assignee_does_not_exist() {
+ assertThat(issue.assignee()).isNull();
+ try {
+ adminIssueClient().assign(issue.key(), "unknown");
+ fail();
+ } catch (Exception e) {
+ verifyHttpException(e, 400);
+ }
+ }
+
+ /**
+ * SONAR-4290
+ */
+ @Test
+ public void plan() {
+ assertThat(issue.actionPlan()).isNull();
+
+ // Set action plan to issue
+ ActionPlan newActionPlan = adminActionPlanClient().create(NewActionPlan.create().name("Short term").project("sample")
+ .description("Short term issues").deadLine(toDate("2113-01-31")));
+ assertThat(newActionPlan.key()).isNotNull();
+ adminIssueClient().plan(issue.key(), newActionPlan.key());
+ Assertions.assertThat(search(IssueQuery.create().actionPlans(newActionPlan.key())).list()).hasSize(1);
+
+ projectAnalysis.run();
+ Issue reloaded = searchIssueByKey(issue.key());
+ assertThat(reloaded.actionPlan()).isEqualTo(newActionPlan.key());
+ assertThat(reloaded.creationDate()).isEqualTo(issue.creationDate());
+ ActionPlan actionPlan = search(IssueQuery.create().actionPlans(newActionPlan.key())).actionPlans(reloaded);
+ assertThat(actionPlan.name()).isEqualTo(newActionPlan.name());
+ assertThat(actionPlan.deadLine()).isEqualTo(newActionPlan.deadLine());
+ }
+
+ @Test
+ public void fail_plan_if_action_plan_does_not_exist() {
+ assertThat(issue.actionPlan()).isNull();
+ try {
+ adminIssueClient().plan(issue.key(), "unknown");
+ fail();
+ } catch (Exception e) {
+ verifyHttpException(e, 400);
+ }
+ }
+
+ @Test
+ public void unplan() {
+ assertThat(issue.actionPlan()).isNull();
+
+ // Set action plan to issue
+ ActionPlan newActionPlan = adminActionPlanClient().create(NewActionPlan.create().name("Short term").project("sample")
+ .description("Short term issues").deadLine(toDate("2113-01-31")));
+ assertThat(newActionPlan.key()).isNotNull();
+ adminIssueClient().plan(issue.key(), newActionPlan.key());
+ Assertions.assertThat(search(IssueQuery.create().actionPlans(newActionPlan.key())).list()).hasSize(1);
+
+ // Unplan
+ adminIssueClient().plan(issue.key(), null);
+ Assertions.assertThat(search(IssueQuery.create().actionPlans(newActionPlan.key())).list()).hasSize(0);
+
+ projectAnalysis.run();
+ Issue reloaded = searchIssueByKey(issue.key());
+ assertThat(reloaded.actionPlan()).isNull();
+ assertThat(reloaded.creationDate()).isEqualTo(issue.creationDate());
+ }
+
+ /**
+ * SONAR-4315
+ */
+ @Test
+ public void apply_action_from_plugin() {
+ // The condition on the action defined by the plugin is that the status must be resolved
+ adminIssueClient().doTransition(issue.key(), "resolve");
+ Assertions.assertThat(adminIssueClient().actions(issue.key())).contains("fake");
+
+ adminIssueClient().doAction(issue.key(), "fake");
+
+ // reload issue
+ Issue reloaded = searchIssues(issue.key(), true).iterator().next();
+
+ assertThat(reloaded.comments()).hasSize(1);
+ assertThat(reloaded.comments().get(0).htmlText()).isEqualTo("New Comment from fake action");
+
+ // The action is no more available when already executed (because an issue attribute is used to check if the action is available or not)
+ Assertions.assertThat(adminIssueClient().actions(issue.key())).doesNotContain("fake");
+ }
+
+ /**
+ * SONAR-4315
+ */
+ @Test
+ public void issue_attribute_are_kept_on_new_analysis() {
+ // The condition on the action defined by the plugin is that the status must be resolved
+ adminIssueClient().doTransition(issue.key(), "resolve");
+ adminIssueClient().doAction(issue.key(), "fake");
+ Assertions.assertThat(adminIssueClient().actions(issue.key())).doesNotContain("fake");
+
+ projectAnalysis.run();
+
+ // Fake action is no more available if the issue attribute is still there
+ Assertions.assertThat(adminIssueClient().actions(issue.key())).doesNotContain("fake");
+ }
+
+ private static List<Issue> searchIssuesBySeverities(String componentKey, String... severities) {
+ return searchIssues(IssueQuery.create().componentRoots(componentKey).severities(severities));
+ }
+
+ private static ActionPlanClient adminActionPlanClient() {
+ return ORCHESTRATOR.getServer().adminWsClient().actionPlanClient();
+ }
+
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it.issue;
+
+import com.google.common.base.Function;
+import com.google.common.collect.FluentIterable;
+import java.util.List;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.sonar.wsclient.base.HttpException;
+import org.sonar.wsclient.issue.ActionPlan;
+import org.sonar.wsclient.issue.ActionPlanClient;
+import org.sonar.wsclient.issue.BulkChange;
+import org.sonar.wsclient.issue.BulkChangeQuery;
+import org.sonar.wsclient.issue.Issue;
+import org.sonar.wsclient.issue.NewActionPlan;
+import util.ItUtils;
+import util.ProjectAnalysis;
+import util.ProjectAnalysisRule;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * SONAR-4421
+ */
+public class IssueBulkChangeTest extends AbstractIssueTest {
+
+ private static final int BULK_EDITED_ISSUE_COUNT = 3;
+ private static final String COMMENT_AS_MARKDOWN = "this is my *comment*";
+ private static final String COMMENT_AS_HTML = "this is my <em>comment</em>";
+
+ @Rule
+ public final ProjectAnalysisRule projectAnalysisRule = ProjectAnalysisRule.from(ORCHESTRATOR);
+
+ private ProjectAnalysis xooSampleLittleIssuesAnalysis;
+
+ @Before
+ public void setUp() throws Exception {
+ String qualityProfileKey = projectAnalysisRule.registerProfile("/issue/IssueBulkChangeTest/one-issue-per-line-profile.xml");
+ String projectKey = projectAnalysisRule.registerProject("shared/xoo-sample");
+ this.xooSampleLittleIssuesAnalysis = projectAnalysisRule.newProjectAnalysis(projectKey)
+ .withQualityProfile(qualityProfileKey);
+ }
+
+ @Test
+ public void should_change_severity() {
+ xooSampleLittleIssuesAnalysis.run();
+
+ String newSeverity = "BLOCKER";
+ String[] issueKeys = searchIssueKeys(BULK_EDITED_ISSUE_COUNT);
+ BulkChange bulkChange = bulkChangeSeverityOfIssues(issueKeys, newSeverity);
+
+ assertThat(bulkChange.totalIssuesChanged()).isEqualTo(BULK_EDITED_ISSUE_COUNT);
+ assertIssueSeverity(issueKeys, newSeverity);
+ }
+
+ @Test
+ public void should_do_transition() {
+ xooSampleLittleIssuesAnalysis.run();
+ String[] issueKeys = searchIssueKeys(BULK_EDITED_ISSUE_COUNT);
+ BulkChange bulkChange = bulkTransitionStatusOfIssues(issueKeys, "confirm");
+
+ assertThat(bulkChange.totalIssuesChanged()).isEqualTo(BULK_EDITED_ISSUE_COUNT);
+ assertIssueStatus(issueKeys, "CONFIRMED");
+ }
+
+ @Test
+ public void should_assign() {
+ xooSampleLittleIssuesAnalysis.run();
+
+ String[] issueKeys = searchIssueKeys(BULK_EDITED_ISSUE_COUNT);
+ BulkChange bulkChange = buldChangeAssigneeOfIssues(issueKeys, "admin");
+
+ assertThat(bulkChange.totalIssuesChanged()).isEqualTo(BULK_EDITED_ISSUE_COUNT);
+ for (Issue issue : searchIssues(issueKeys)) {
+ assertThat(issue.assignee()).isEqualTo("admin");
+ }
+ }
+
+ @Test
+ public void should_plan() {
+ xooSampleLittleIssuesAnalysis.run();
+
+ // Create action plan
+ ActionPlan newActionPlan = adminActionPlanClient().create(
+ NewActionPlan.create().name("Short term").project("sample").description("Short term issues").deadLine(ItUtils.toDate("2113-01-31")));
+
+ String[] issueKeys = searchIssueKeys(BULK_EDITED_ISSUE_COUNT);
+ BulkChange bulkChange = adminIssueClient().bulkChange(
+ BulkChangeQuery.create()
+ .issues(issueKeys)
+ .actions("plan")
+ .actionParameter("plan", "plan", newActionPlan.key())
+ );
+
+ assertThat(bulkChange.totalIssuesChanged()).isEqualTo(BULK_EDITED_ISSUE_COUNT);
+ for (Issue issue : searchIssues(issueKeys)) {
+ assertThat(issue.actionPlan()).isEqualTo(newActionPlan.key());
+ }
+ }
+
+ @Test
+ public void should_setSeverity_add_comment_in_single_WS_call() {
+ xooSampleLittleIssuesAnalysis.run();
+
+ String newSeverity = "BLOCKER";
+ String[] issueKeys = searchIssueKeys(BULK_EDITED_ISSUE_COUNT);
+
+ BulkChange bulkChange = adminIssueClient().bulkChange(
+ BulkChangeQuery.create()
+ .issues(issueKeys)
+ .actions("set_severity", "comment")
+ .actionParameter("set_severity", "severity", newSeverity)
+ .actionParameter("comment", "comment", COMMENT_AS_MARKDOWN)
+ );
+
+ assertThat(bulkChange.totalIssuesChanged()).isEqualTo(BULK_EDITED_ISSUE_COUNT);
+ for (Issue issue : searchIssues(issueKeys, true)) {
+ assertThat(issue.comments()).hasSize(1);
+ assertThat(issue.comments().get(0).htmlText()).isEqualTo(COMMENT_AS_HTML);
+ }
+ }
+
+ @Test
+ public void should_apply_bulk_change_on_many_actions() {
+ xooSampleLittleIssuesAnalysis.run();
+
+ String newSeverity = "BLOCKER";
+ String[] issueKeys = searchIssueKeys(BULK_EDITED_ISSUE_COUNT);
+
+ BulkChange bulkChange = adminIssueClient().bulkChange(
+ BulkChangeQuery.create()
+ .issues(issueKeys)
+ .actions("do_transition", "assign", "set_severity")
+ .actionParameter("do_transition", "transition", "confirm")
+ .actionParameter("assign", "assignee", "admin")
+ .actionParameter("set_severity", "severity", newSeverity)
+ .comment(COMMENT_AS_MARKDOWN)
+ );
+
+ assertThat(bulkChange.totalIssuesChanged()).isEqualTo(BULK_EDITED_ISSUE_COUNT);
+ for (Issue issue : searchIssues(issueKeys, true)) {
+ assertThat(issue.status()).isEqualTo("CONFIRMED");
+ assertThat(issue.assignee()).isEqualTo("admin");
+ assertThat(issue.severity()).isEqualTo(newSeverity);
+ assertThat(issue.comments()).hasSize(1);
+ assertThat(issue.comments().get(0).htmlText()).isEqualTo(COMMENT_AS_HTML);
+ }
+ }
+
+ @Test
+ public void should_not_apply_bulk_change_if_not_logged() {
+ xooSampleLittleIssuesAnalysis.run();
+
+ String newSeverity = "BLOCKER";
+ String[] issueKeys = searchIssueKeys(BULK_EDITED_ISSUE_COUNT);
+
+ try {
+ issueClient().bulkChange(createBulkChangeSeverityOfIssuesQuery(issueKeys, newSeverity));
+ } catch (Exception e) {
+ assertHttpException(e, 401);
+ }
+ }
+
+ @Test
+ public void should_not_apply_bulk_change_if_no_change_to_do() {
+ xooSampleLittleIssuesAnalysis.run();
+
+ String newSeverity = "BLOCKER";
+ String[] issueKeys = searchIssueKeys(BULK_EDITED_ISSUE_COUNT);
+
+ // Apply the bulk change a first time
+ BulkChange bulkChange = bulkChangeSeverityOfIssues(issueKeys, newSeverity);
+ assertThat(bulkChange.totalIssuesChanged()).isEqualTo(BULK_EDITED_ISSUE_COUNT);
+
+ // Re apply the same bulk change -> no issue should be changed
+ bulkChange = bulkChangeSeverityOfIssues(issueKeys, newSeverity);
+ assertThat(bulkChange.totalIssuesChanged()).isEqualTo(0);
+ assertThat(bulkChange.totalIssuesNotChanged()).isEqualTo(BULK_EDITED_ISSUE_COUNT);
+ }
+
+ @Test
+ public void should_not_apply_bulk_change_if_no_issue_selected() {
+ try {
+ bulkChangeSeverityOfIssues(new String[] {}, "BLOCKER");
+ } catch (Exception e) {
+ assertHttpException(e, 400);
+ }
+ }
+
+ @Test
+ public void should_not_apply_bulk_change_if_action_is_invalid() {
+ xooSampleLittleIssuesAnalysis.run();
+
+ int limit = BULK_EDITED_ISSUE_COUNT;
+ String[] issueKeys = searchIssueKeys(limit);
+
+ BulkChangeQuery query = (BulkChangeQuery.create().issues(issueKeys).actions("invalid"));
+ try {
+ adminIssueClient().bulkChange(query);
+ } catch (Exception e) {
+ assertHttpException(e, 400);
+ }
+ }
+
+ @Test
+ public void should_add_comment_only_on_issues_that_will_be_changed() {
+ xooSampleLittleIssuesAnalysis.run();
+ int nbIssues = BULK_EDITED_ISSUE_COUNT;
+ String[] issueKeys = searchIssueKeys(nbIssues);
+
+ // Confirm an issue
+ adminIssueClient().doTransition(searchIssues().iterator().next().key(), "confirm");
+
+ // Apply a bulk change on unconfirm transition
+ BulkChangeQuery query = (BulkChangeQuery.create()
+ .issues(issueKeys)
+ .actions("do_transition")
+ .actionParameter("do_transition", "transition", "unconfirm")
+ .comment("this is my comment")
+ );
+ BulkChange bulkChange = adminIssueClient().bulkChange(query);
+ assertThat(bulkChange.totalIssuesChanged()).isEqualTo(1);
+
+ int nbIssuesWithComment = 0;
+ for (Issue issue : searchIssues(issueKeys, true)) {
+ if (!issue.comments().isEmpty()) {
+ nbIssuesWithComment++;
+ }
+ }
+ // Only one issue should have the comment
+ assertThat(nbIssuesWithComment).isEqualTo(1);
+ }
+
+ private static void assertIssueSeverity(String[] issueKeys, String expectedSeverity) {
+ for (Issue issue : searchIssues(issueKeys)) {
+ assertThat(issue.severity()).isEqualTo(expectedSeverity);
+ }
+ }
+
+ private static void assertIssueStatus(String[] issueKeys, String expectedStatus) {
+ for (Issue issue : searchIssues(issueKeys)) {
+ assertThat(issue.status()).isEqualTo(expectedStatus);
+ }
+ }
+
+ private static void assertHttpException(Exception e, int expectedCode) {
+ assertThat(e).isInstanceOf(HttpException.class);
+ assertThat(((HttpException) e).status()).isEqualTo(expectedCode);
+ }
+
+ private static BulkChange bulkChangeSeverityOfIssues(String[] issueKeys, String newSeverity) {
+ BulkChangeQuery bulkChangeQuery = createBulkChangeSeverityOfIssuesQuery(issueKeys, newSeverity);
+
+ return adminIssueClient().bulkChange(bulkChangeQuery);
+ }
+
+ private static BulkChangeQuery createBulkChangeSeverityOfIssuesQuery(String[] issueKeys, String newSeverity) {
+ BulkChangeQuery bulkChangeQuery = BulkChangeQuery.create()
+ .actions("set_severity")
+ .actionParameter("set_severity", "severity", newSeverity);
+ if (issueKeys != null && issueKeys.length > 0) {
+ bulkChangeQuery.issues(issueKeys);
+ }
+ return bulkChangeQuery;
+ }
+
+ private static BulkChange bulkTransitionStatusOfIssues(String[] issueKeys, String newSeverity) {
+ return adminIssueClient().bulkChange(
+ BulkChangeQuery.create()
+ .issues(issueKeys)
+ .actions("do_transition")
+ .actionParameter("do_transition", "transition", newSeverity)
+ );
+ }
+
+ private static BulkChange buldChangeAssigneeOfIssues(String[] issueKeys, String newAssignee) {
+ return adminIssueClient().bulkChange(
+ BulkChangeQuery.create()
+ .issues(issueKeys)
+ .actions("assign")
+ .actionParameter("assign", "assignee", newAssignee)
+ );
+ }
+
+ private static String[] getIssueKeys(List<Issue> issues, int nbIssues) {
+ return FluentIterable.from(issues)
+ .limit(nbIssues)
+ .transform(IssueToKey.INSTANCE)
+ .toArray(String.class);
+ }
+
+ private static String[] searchIssueKeys(int limit) {
+ return getIssueKeys(searchIssues(), limit);
+ }
+
+ private static ActionPlanClient adminActionPlanClient() {
+ return ORCHESTRATOR.getServer().adminWsClient().actionPlanClient();
+ }
+
+ private enum IssueToKey implements Function<Issue, String> {
+ INSTANCE;
+
+ public String apply(Issue issue) {
+ return issue.key();
+ }
+ }
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it.issue;
+
+import java.util.List;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.sonar.wsclient.issue.Issue;
+import org.sonar.wsclient.issue.IssueChange;
+import org.sonar.wsclient.issue.IssueChangeDiff;
+import util.ProjectAnalysis;
+import util.ProjectAnalysisRule;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class IssueChangelogTest extends AbstractIssueTest {
+
+ @Rule
+ public final ProjectAnalysisRule projectAnalysisRule = ProjectAnalysisRule.from(ORCHESTRATOR);
+
+ Issue issue;
+ ProjectAnalysis xooSampleAnalysis;
+
+ @Before
+ public void resetData() {
+ xooSampleAnalysis = projectAnalysisRule
+ .newProjectAnalysis(projectAnalysisRule.registerProject("shared/xoo-sample"))
+ .withQualityProfile(projectAnalysisRule.registerProfile("/issue/IssueChangelogTest/one-issue-per-line-profile.xml"));
+ xooSampleAnalysis.run();
+ issue = searchRandomIssue();
+ }
+
+ @Test
+ public void update_changelog_when_assigning_issue_by_user() throws Exception {
+ assertIssueHasNoChange(issue.key());
+
+ adminIssueClient().assign(issue.key(), "admin");
+
+ List<IssueChange> changes = retrieveChangeForIssue(issue.key());
+ assertThat(changes).hasSize(1);
+ IssueChange change = changes.get(0);
+ assertThat(change.user()).isEqualTo("admin");
+ assertThat(change.creationDate()).isNotNull();
+ assertThat(change.diffs()).hasSize(1);
+ IssueChangeDiff changeDiff = change.diffs().get(0);
+ assertThat(changeDiff.key()).isEqualTo("assignee");
+ assertThat(changeDiff.oldValue()).isNull();
+ assertThat(changeDiff.newValue()).isEqualTo("Administrator");
+ }
+
+ @Test
+ public void update_changelog_when_reopening_unresolved_issue_by_scan() throws Exception {
+ assertIssueHasNoChange(issue.key());
+
+ // re analyse the project after resolving an issue in order to reopen it
+ adminIssueClient().doTransition(issue.key(), "resolve");
+ xooSampleAnalysis.run();
+
+ List<IssueChange> changes = retrieveChangeForIssue(issue.key());
+ assertThat(changes).hasSize(2);
+
+ // Change done by the user (first change is be the oldest one)
+ IssueChange change1 = changes.get(0);
+ assertThat(change1.user()).isEqualTo("admin");
+ assertThat(change1.creationDate()).isNotNull();
+ assertThat(change1.diffs()).hasSize(2);
+
+ IssueChangeDiff change1Diff1 = change1.diffs().get(0);
+ assertThat(change1Diff1.key()).isEqualTo("resolution");
+ assertThat(change1Diff1.oldValue()).isNull();
+ assertThat(change1Diff1.newValue()).isEqualTo("FIXED");
+
+ IssueChangeDiff change1Diff2 = change1.diffs().get(1);
+ assertThat(change1Diff2.key()).isEqualTo("status");
+ assertThat(change1Diff2.oldValue()).isEqualTo("OPEN");
+ assertThat(change1Diff2.newValue()).isEqualTo("RESOLVED");
+
+ // Change done by scan
+ IssueChange change2 = changes.get(1);
+ assertThat(change2.user()).isNull();
+ assertThat(change2.creationDate()).isNotNull();
+ assertThat(change2.diffs()).hasSize(2);
+
+ IssueChangeDiff changeDiff1 = change2.diffs().get(0);
+ assertThat(changeDiff1.key()).isEqualTo("resolution");
+ assertThat(changeDiff1.oldValue()).isNull();
+ assertThat(changeDiff1.newValue()).isNull();
+
+ IssueChangeDiff changeDiff2 = change2.diffs().get(1);
+ assertThat(changeDiff2.key()).isEqualTo("status");
+ assertThat(changeDiff2.oldValue()).isEqualTo("RESOLVED");
+ assertThat(changeDiff2.newValue()).isEqualTo("REOPENED");
+ }
+
+ private void assertIssueHasNoChange(String issueKey) {
+ assertThat(retrieveChangeForIssue(issueKey)).isEmpty();
+ }
+
+ private List<IssueChange> retrieveChangeForIssue(String issueKey) {
+ return issueClient().changes(issueKey);
+ }
+
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it.issue;
+
+import java.util.List;
+import org.junit.Rule;
+import org.junit.Test;
+import org.sonar.wsclient.issue.Issue;
+import org.sonar.wsclient.issue.IssueQuery;
+import org.sonar.wsclient.services.Measure;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+import util.ProjectAnalysis;
+import util.ProjectAnalysisRule;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Tests the extension point IssueFilter
+ */
+public class IssueFilterExtensionTest extends AbstractIssueTest {
+
+ @Rule
+ public final ProjectAnalysisRule projectAnalysisRule = ProjectAnalysisRule.from(ORCHESTRATOR);
+
+ private final String manyRuleProfileKey = projectAnalysisRule.registerProfile("/issue/IssueFilterExtensionTest/xoo-with-many-rules.xml");
+ private final String xooMultiModuleProjectKey = projectAnalysisRule.registerProject("shared/xoo-multi-modules-sample");
+ private final ProjectAnalysis analysis = projectAnalysisRule.newProjectAnalysis(xooMultiModuleProjectKey)
+ .withQualityProfile(manyRuleProfileKey);
+
+ @Test
+ public void should_filter_files() throws Exception {
+ analysis.withProperties("sonar.exclusions", "**/HelloA1.xoo").run();
+
+ List<Issue> issues = searchIssues();
+ assertThat(issues).isNotEmpty();
+ for (Issue issue : issues) {
+ // verify exclusion to avoid false positive
+ assertThat(issue.componentKey()).doesNotContain("HelloA1");
+ }
+
+ assertThat(getMeasure(xooMultiModuleProjectKey, "violations").getIntValue()).isEqualTo(issues.size());
+ }
+
+ @Test
+ public void should_filter_issues() {
+ // first analysis without issue-filter
+ analysis.run();
+
+ // Issue filter removes issues on lines < 5
+ // Deprecated violation filter removes issues detected by PMD
+ List<Issue> unresolvedIssues = searchResolvedIssues(xooMultiModuleProjectKey);
+ int issuesBeforeLine5 = countIssuesBeforeLine5(unresolvedIssues);
+ int pmdIssues = countModuleIssues(unresolvedIssues);
+ assertThat(issuesBeforeLine5).isGreaterThan(0);
+ assertThat(pmdIssues).isGreaterThan(0);
+
+ // Enable issue filters
+ analysis.withProperties("enableIssueFilters", "true").run();
+
+ unresolvedIssues = searchResolvedIssues(xooMultiModuleProjectKey);
+ List<Issue> resolvedIssues = searchUnresolvedIssues(xooMultiModuleProjectKey);
+ assertThat(countIssuesBeforeLine5(unresolvedIssues)).isZero();
+ assertThat(countModuleIssues(unresolvedIssues)).isZero();
+ assertThat(countModuleIssues(resolvedIssues)).isGreaterThan(0);
+ for (Issue issue : resolvedIssues) {
+ // SONAR-6364 no line number on closed issues
+ assertThat(issue.line()).isNull();
+ }
+ }
+
+ private static List<Issue> searchUnresolvedIssues(String projectName) {
+ return searchIssues(IssueQuery.create().componentRoots(projectName).resolved(true));
+ }
+
+ private static List<Issue> searchResolvedIssues(String projectName) {
+ return searchIssues(IssueQuery.create().componentRoots(projectName).resolved(false));
+ }
+
+ private static Measure getMeasure(String projectKey, String metricKey) {
+ Resource resource = ORCHESTRATOR.getServer().getWsClient().find(ResourceQuery.createForMetrics(projectKey, metricKey));
+ return resource == null ? null : resource.getMeasure(metricKey);
+ }
+
+ private static int countModuleIssues(List<Issue> issues) {
+ int count = 0;
+ for (Issue issue : issues) {
+ if (issue.ruleKey().equals("xoo:OneIssuePerModule")) {
+ count++;
+ }
+ }
+ return count;
+ }
+
+ private static int countIssuesBeforeLine5(List<Issue> issues) {
+ int count = 0;
+ for (Issue issue : issues) {
+ if (issue.line() != null && issue.line() < 5) {
+ count++;
+ }
+ }
+ return count;
+ }
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it.issue;
+
+import java.util.List;
+import org.assertj.core.api.Assertions;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.sonar.wsclient.issue.Issue;
+import org.sonar.wsclient.issue.IssueQuery;
+import util.ProjectAnalysis;
+import util.ProjectAnalysisRule;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class IssuePurgeTest extends AbstractIssueTest {
+
+ @Rule
+ public final ProjectAnalysisRule projectAnalysisRule = ProjectAnalysisRule.from(ORCHESTRATOR);
+
+ private ProjectAnalysis xooSampleAnalysis;
+ private ProjectAnalysis xooMultiModuleAnalysis;
+
+ @Before
+ public void setUp() throws Exception {
+ String manyRulesProfile = projectAnalysisRule.registerProfile("/issue/IssuePurgeTest/with-many-rules.xml");
+ String xooSampleProjectKey = projectAnalysisRule.registerProject("shared/xoo-sample");
+ this.xooSampleAnalysis = projectAnalysisRule.newProjectAnalysis(xooSampleProjectKey)
+ .withQualityProfile(manyRulesProfile);
+ String xooMultiModuleProjectKey = projectAnalysisRule.registerProject("shared/xoo-multi-modules-sample");
+ this.xooMultiModuleAnalysis = projectAnalysisRule.newProjectAnalysis(xooMultiModuleProjectKey)
+ .withQualityProfile(manyRulesProfile);
+ }
+
+ /**
+ * SONAR-4308
+ */
+ @Test
+ public void purge_old_closed_issues() throws Exception {
+ projectAnalysisRule.setServerProperty("sonar.dbcleaner.daysBeforeDeletingClosedIssues", "5000");
+
+ // Generate some issues
+ xooSampleAnalysis.withProperties(
+ "sonar.dynamicAnalysis", "false",
+ "sonar.projectDate", "2014-10-01")
+ .run();
+
+ // All the issues are open
+ List<Issue> issues = searchIssues();
+ for (Issue issue : issues) {
+ assertThat(issue.resolution()).isNull();
+ }
+
+ // Second scan with empty profile -> all issues are resolved and closed
+ // -> Not deleted because less than 5000 days long
+ xooSampleAnalysis
+ .withXooEmptyProfile()
+ .withProperties(
+ "sonar.dynamicAnalysis", "false",
+ "sonar.projectDate", "2014-10-15")
+ .run();
+ issues = searchIssues();
+ assertThat(issues).isNotEmpty();
+ for (Issue issue : issues) {
+ assertThat(issue.resolution()).isNotNull();
+ assertThat(issue.status()).isEqualTo("CLOSED");
+ }
+
+ // Third scan -> closed issues are deleted
+ projectAnalysisRule.setServerProperty("sonar.dbcleaner.daysBeforeDeletingClosedIssues", "1");
+
+ xooSampleAnalysis.withXooEmptyProfile()
+ .withProperties(
+ "sonar.dynamicAnalysis", "false",
+ "sonar.projectDate", "2014-10-20")
+ .run();
+ Assertions.assertThat(searchIssues(IssueQuery.create())).isEmpty();
+ }
+
+ /**
+ * SONAR-5200
+ */
+ @Test
+ public void resolve_issues_when_removing_module() throws Exception {
+ // Generate some issues
+ xooMultiModuleAnalysis
+ .withProperties("sonar.dynamicAnalysis", "false")
+ .run();
+
+ // All the issues are open
+ List<Issue> issues = searchIssues();
+ for (Issue issue : issues) {
+ assertThat(issue.resolution()).isNull();
+ }
+ Issue issue = issues.get(0);
+
+ int issuesOnModuleB = searchIssues(IssueQuery.create().componentRoots("com.sonarsource.it.samples:multi-modules-sample:module_b")).size();
+ assertThat(issuesOnModuleB).isEqualTo(28);
+
+ // Second scan without module B -> issues on module B are resolved as removed and closed
+ xooMultiModuleAnalysis
+ .withProperties(
+ "sonar.dynamicAnalysis", "false",
+ "sonar.modules", "module_a")
+ .run();
+
+ // Resolved should should all be mark as REMOVED and affect to module b
+ List<Issue> reloadedIssues = searchIssues(IssueQuery.create().resolved(true));
+ assertThat(reloadedIssues).hasSize(issuesOnModuleB);
+ for (Issue reloadedIssue : reloadedIssues) {
+ assertThat(reloadedIssue.resolution()).isEqualTo("FIXED");
+ assertThat(reloadedIssue.status()).isEqualTo("CLOSED");
+ assertThat(reloadedIssue.componentKey()).contains("com.sonarsource.it.samples:multi-modules-sample:module_b");
+ assertThat(reloadedIssue.updateDate().before(issue.updateDate())).isFalse();
+ assertThat(reloadedIssue.closeDate()).isNotNull();
+ assertThat(reloadedIssue.closeDate().before(reloadedIssue.creationDate())).isFalse();
+ }
+ }
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it.issue;
+
+import java.util.List;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.sonar.wsclient.issue.Issue;
+import org.sonar.wsclient.issue.IssueQuery;
+import util.ProjectAnalysis;
+import util.ProjectAnalysisRule;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class IssueWorkflowTest extends AbstractIssueTest {
+
+ @Rule
+ public final ProjectAnalysisRule projectAnalysisRule = ProjectAnalysisRule.from(ORCHESTRATOR);
+
+ private ProjectAnalysis analysisWithIssues;
+ private ProjectAnalysis analysisWithoutIssues;
+ private Issue issue;
+
+ @Before
+ public void before() {
+ String oneIssuePerFileProfileKey = projectAnalysisRule.registerProfile("/issue/IssueWorkflowTest/xoo-one-issue-per-line-profile.xml");
+ String analyzedProjectKey = projectAnalysisRule.registerProject("issue/workflow");
+ analysisWithIssues = projectAnalysisRule.newProjectAnalysis(analyzedProjectKey).withQualityProfile(oneIssuePerFileProfileKey);
+ analysisWithoutIssues = analysisWithIssues.withXooEmptyProfile();
+ analysisWithIssues.run();
+
+ issue = searchRandomIssue();
+ }
+
+ /**
+ * Issue on a disabled rule (uninstalled plugin or rule deactivated from quality profile) must
+ * be CLOSED with resolution REMOVED
+ */
+ @Test
+ public void issue_is_closed_as_removed_when_rule_is_disabled() throws Exception {
+ List<Issue> issues = searchIssues(IssueQuery.create().rules("xoo:OneIssuePerLine"));
+ assertThat(issues).isNotEmpty();
+
+ // re-analyze with profile "empty". The rule is disabled so the issues must be closed
+ analysisWithoutIssues.run();
+ issues = searchIssues(IssueQuery.create().rules("xoo:OneIssuePerLine"));
+ assertThat(issues).isNotEmpty();
+ for (Issue issue : issues) {
+ assertThat(issue.status()).isEqualTo("CLOSED");
+ assertThat(issue.resolution()).isEqualTo("REMOVED");
+ }
+ }
+
+ /**
+ * SONAR-4329
+ */
+ @Test
+ public void user_should_confirm_issue() {
+ // mark as confirmed
+ adminIssueClient().doTransition(issue.key(), "confirm");
+
+ Issue confirmed = searchIssueByKey(issue.key());
+ assertThat(confirmed.status()).isEqualTo("CONFIRMED");
+ assertThat(confirmed.resolution()).isNull();
+ assertThat(confirmed.creationDate()).isEqualTo(issue.creationDate());
+
+ // user unconfirm the issue
+ assertThat(adminIssueClient().transitions(confirmed.key())).contains("unconfirm");
+ adminIssueClient().doTransition(confirmed.key(), "unconfirm");
+
+ Issue unconfirmed = searchIssueByKey(issue.key());
+ assertThat(unconfirmed.status()).isEqualTo("REOPENED");
+ assertThat(unconfirmed.resolution()).isNull();
+ assertThat(unconfirmed.creationDate()).isEqualTo(confirmed.creationDate());
+ }
+
+ /**
+ * SONAR-4329
+ */
+ @Test
+ public void user_should_mark_as_false_positive_confirmed_issue() {
+ // mark as confirmed
+ adminIssueClient().doTransition(issue.key(), "confirm");
+
+ Issue confirmed = searchIssueByKey(issue.key());
+ assertThat(confirmed.status()).isEqualTo("CONFIRMED");
+ assertThat(confirmed.resolution()).isNull();
+ assertThat(confirmed.creationDate()).isEqualTo(issue.creationDate());
+
+ // user mark the issue as false-positive
+ assertThat(adminIssueClient().transitions(confirmed.key())).contains("falsepositive");
+ adminIssueClient().doTransition(confirmed.key(), "falsepositive");
+
+ Issue falsePositive = searchIssueByKey(issue.key());
+ assertThat(falsePositive.status()).isEqualTo("RESOLVED");
+ assertThat(falsePositive.resolution()).isEqualTo("FALSE-POSITIVE");
+ assertThat(falsePositive.creationDate()).isEqualTo(confirmed.creationDate());
+ }
+
+ /**
+ * SONAR-4329
+ */
+ @Test
+ public void scan_should_close_no_more_existing_confirmed() {
+ // mark as confirmed
+ adminIssueClient().doTransition(issue.key(), "confirm");
+ Issue falsePositive = searchIssueByKey(issue.key());
+ assertThat(falsePositive.status()).isEqualTo("CONFIRMED");
+ assertThat(falsePositive.resolution()).isNull();
+ assertThat(falsePositive.creationDate()).isEqualTo(issue.creationDate());
+
+ // scan without any rules -> confirmed is closed
+ analysisWithoutIssues.run();
+ Issue closed = searchIssueByKey(issue.key());
+ assertThat(closed.status()).isEqualTo("CLOSED");
+ assertThat(closed.resolution()).isEqualTo("REMOVED");
+ assertThat(closed.creationDate()).isEqualTo(issue.creationDate());
+ }
+
+ /**
+ * SONAR-4288
+ */
+ @Test
+ public void scan_should_reopen_unresolved_issue_but_marked_as_resolved() {
+ // mark as resolved
+ adminIssueClient().doTransition(issue.key(), "resolve");
+ Issue resolvedIssue = searchIssueByKey(issue.key());
+ assertThat(resolvedIssue.status()).isEqualTo("RESOLVED");
+ assertThat(resolvedIssue.resolution()).isEqualTo("FIXED");
+ assertThat(resolvedIssue.creationDate()).isEqualTo(issue.creationDate());
+ assertThat(resolvedIssue.updateDate().before(resolvedIssue.creationDate())).isFalse();
+ assertThat(resolvedIssue.updateDate().before(issue.updateDate())).isFalse();
+
+ // re-execute scan, with the same Q profile -> the issue has not been fixed
+ analysisWithIssues.run();
+
+ // reload issue
+ Issue reopenedIssue = searchIssueByKey(issue.key());
+
+ // the issue has been reopened
+ assertThat(reopenedIssue.status()).isEqualTo("REOPENED");
+ assertThat(reopenedIssue.resolution()).isNull();
+ assertThat(reopenedIssue.creationDate()).isEqualTo(issue.creationDate());
+ assertThat(reopenedIssue.updateDate().before(issue.updateDate())).isFalse();
+ }
+
+ /**
+ * SONAR-4288
+ */
+ @Test
+ public void scan_should_close_resolved_issue() {
+ // mark as resolved
+ adminIssueClient().doTransition(issue.key(), "resolve");
+ Issue resolvedIssue = searchIssueByKey(issue.key());
+ assertThat(resolvedIssue.status()).isEqualTo("RESOLVED");
+ assertThat(resolvedIssue.resolution()).isEqualTo("FIXED");
+ assertThat(resolvedIssue.creationDate()).isEqualTo(issue.creationDate());
+ assertThat(resolvedIssue.closeDate()).isNull();
+
+ // re-execute scan without rules -> the issue is removed with resolution "REMOVED"
+ analysisWithoutIssues.run();
+
+ // reload issue
+ Issue closedIssue = searchIssueByKey(issue.key());
+ assertThat(closedIssue.status()).isEqualTo("CLOSED");
+ assertThat(closedIssue.resolution()).isEqualTo("REMOVED");
+ assertThat(closedIssue.creationDate()).isEqualTo(issue.creationDate());
+ assertThat(closedIssue.updateDate().before(resolvedIssue.updateDate())).isFalse();
+ assertThat(closedIssue.closeDate()).isNotNull();
+ assertThat(closedIssue.closeDate().before(closedIssue.creationDate())).isFalse();
+ }
+
+ /**
+ * SONAR-4288
+ */
+ @Test
+ public void user_should_reopen_issue_marked_as_resolved() {
+ // user marks issue as resolved
+ adminIssueClient().doTransition(issue.key(), "resolve");
+ Issue resolved = searchIssueByKey(issue.key());
+ assertThat(resolved.status()).isEqualTo("RESOLVED");
+ assertThat(resolved.resolution()).isEqualTo("FIXED");
+ assertThat(resolved.creationDate()).isEqualTo(issue.creationDate());
+
+ // user reopens the issue
+ assertThat(adminIssueClient().transitions(resolved.key())).contains("reopen");
+ adminIssueClient().doTransition(resolved.key(), "reopen");
+
+ Issue reopened = searchIssueByKey(resolved.key());
+ assertThat(reopened.status()).isEqualTo("REOPENED");
+ assertThat(reopened.resolution()).isNull();
+ assertThat(reopened.creationDate()).isEqualTo(resolved.creationDate());
+ assertThat(reopened.updateDate().before(resolved.updateDate())).isFalse();
+ }
+
+ /**
+ * SONAR-4286
+ */
+ @Test
+ public void scan_should_not_reopen_or_close_false_positives() {
+ // user marks issue as false-positive
+ adminIssueClient().doTransition(issue.key(), "falsepositive");
+
+ Issue falsePositive = searchIssueByKey(issue.key());
+ assertThat(falsePositive.status()).isEqualTo("RESOLVED");
+ assertThat(falsePositive.resolution()).isEqualTo("FALSE-POSITIVE");
+ assertThat(falsePositive.creationDate()).isEqualTo(issue.creationDate());
+
+ // re-execute the same scan
+ analysisWithIssues.run();
+
+ // refresh
+ Issue reloaded = searchIssueByKey(falsePositive.key());
+ assertThat(reloaded.status()).isEqualTo("RESOLVED");
+ assertThat(reloaded.resolution()).isEqualTo("FALSE-POSITIVE");
+ assertThat(reloaded.creationDate()).isEqualTo(issue.creationDate());
+ // TODO check that update date has not been changed
+ }
+
+ /**
+ * SONAR-4286
+ */
+ @Test
+ public void scan_should_close_no_more_existing_false_positive() {
+ // user marks as false-positive
+ adminIssueClient().doTransition(issue.key(), "falsepositive");
+ Issue falsePositive = searchIssueByKey(issue.key());
+ assertThat(falsePositive.status()).isEqualTo("RESOLVED");
+ assertThat(falsePositive.resolution()).isEqualTo("FALSE-POSITIVE");
+ assertThat(falsePositive.creationDate()).isEqualTo(issue.creationDate());
+
+ // scan without any rules -> false-positive is closed
+ analysisWithoutIssues.run();
+ Issue closed = searchIssueByKey(issue.key());
+ assertThat(closed.status()).isEqualTo("CLOSED");
+ assertThat(closed.resolution()).isEqualTo("REMOVED");
+ assertThat(closed.creationDate()).isEqualTo(issue.creationDate());
+ }
+
+ /**
+ * SONAR-4286
+ */
+ @Test
+ public void user_should_reopen_false_positive() {
+ // user marks as false-positive
+ adminIssueClient().doTransition(issue.key(), "falsepositive");
+
+ Issue falsePositive = searchIssueByKey(issue.key());
+ assertThat(falsePositive.status()).isEqualTo("RESOLVED");
+ assertThat(falsePositive.resolution()).isEqualTo("FALSE-POSITIVE");
+ assertThat(falsePositive.creationDate()).isEqualTo(issue.creationDate());
+
+ // user reopens the issue
+ assertThat(adminIssueClient().transitions(falsePositive.key())).contains("reopen");
+ adminIssueClient().doTransition(falsePositive.key(), "reopen");
+
+ Issue reopened = searchIssueByKey(issue.key());
+ assertThat(reopened.status()).isEqualTo("REOPENED");
+ assertThat(reopened.resolution()).isNull();
+ assertThat(reopened.creationDate()).isEqualTo(falsePositive.creationDate());
+ }
+
+ @Test
+ public void user_should_not_reopen_closed_issue() {
+ adminIssueClient().doTransition(issue.key(), "resolve");
+
+ // re-execute scan without rules -> the issue is closed
+ analysisWithoutIssues.run();
+
+ // user try to reopen the issue
+ assertThat(adminIssueClient().transitions(issue.key())).isEmpty();
+ }
+
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it.issue;
+
+import com.sonar.orchestrator.selenium.Selenese;
+import java.sql.Connection;
+import java.sql.SQLException;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import util.selenium.SeleneseTest;
+
+public class ManualRulesTest extends AbstractIssueTest {
+
+ @BeforeClass
+ public static void setup() throws Exception {
+ ORCHESTRATOR.resetData();
+ deleteManualRules();
+ }
+
+ @AfterClass
+ public static void purgeManualRules() {
+ deleteManualRules();
+ }
+
+ @Test
+ public void testManualRules() {
+ Selenese selenese = Selenese
+ .builder()
+ .setHtmlTestsInClasspath("manual-rules",
+ "/issue/ManualRulesTest/create_edit_delete_manual_rule.html"
+ ).build();
+ new SeleneseTest(selenese).runOn(ORCHESTRATOR);
+ }
+
+ protected static void deleteManualRules() {
+ try {
+ Connection connection = ORCHESTRATOR.getDatabase().openConnection();
+ connection.prepareStatement("DELETE FROM rules WHERE rules.plugin_name='manual'").execute();
+ } catch (SQLException e) {
+ throw new IllegalStateException("Fail to remove manual rules", e);
+ }
+ }
+
+}
--- /dev/null
+package it.measure;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.locator.FileLocation;
+import it.Category2Suite;
+import java.util.List;
+import javax.annotation.Nullable;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.wsclient.services.Measure;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+import util.ItUtils;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.within;
+
+/**
+ * SONAR-5876
+ */
+public class NewDebtRatioMeasureTest {
+
+ private static final String NEW_DEBT_RATIO_METRIC_KEY = "new_sqale_debt_ratio";
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category2Suite.ORCHESTRATOR;
+
+ @Before
+ public void cleanUpAnalysisData() {
+ orchestrator.resetData();
+ }
+
+ @Test
+ public void new_debt_ratio_is_computed_from_nes_debt_and_new_ncloc_count_per_file() throws Exception {
+ // This test assumes that period 1 is "since previous analysis" and 2 is "over 30 days"
+
+ // run analysis on the day of after the first commit (2015-09-01), with 'one-issue-per-line' profile
+ // => some issues at date 2015-09-02
+ defineQualityProfile("one-issue-per-line");
+ provisionSampleProject();
+ setSampleProjectQualityProfile("one-issue-per-line");
+ runSampleProjectAnalysis("v1", "sonar.projectDate", "2015-09-02");
+
+ // first analysis, no previous snapshot => periods not resolved => no value
+ assertNoNewDebtRatio();
+
+ // run analysis on the day after of second commit (2015-09-17) 'one-issue-per-line' profile*
+ // => 3 new issues will be created at date 2015-09-18
+ runSampleProjectAnalysis("v2", "sonar.projectDate", "2015-09-18");
+ assertNewDebtRatio(4.44, 4.44);
+
+ // run analysis on the day after of third commit (2015-09-20) 'one-issue-per-line' profile*
+ // => 4 new issues will be created at date 2015-09-21
+ runSampleProjectAnalysis("v3", "sonar.projectDate", "2015-09-21");
+ assertNewDebtRatio(4.17, 4.28);
+ }
+
+ private void assertNoNewDebtRatio() {
+ assertThat(getFileResourceWithVariations(NEW_DEBT_RATIO_METRIC_KEY)).isNull();
+ }
+
+ private void assertNewDebtRatio(@Nullable Double valuePeriod1, @Nullable Double valuePeriod2) {
+ Resource newTechnicalDebt = getFileResourceWithVariations(NEW_DEBT_RATIO_METRIC_KEY);
+ List<Measure> measures = newTechnicalDebt.getMeasures();
+ assertThat(measures.get(0).getVariation1()).isEqualTo(valuePeriod1, within(0.01));
+ assertThat(measures.get(0).getVariation2()).isEqualTo(valuePeriod2, within(0.01));
+ }
+
+ private void setSampleProjectQualityProfile(String qualityProfileKey) {
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", qualityProfileKey);
+ }
+
+ private void provisionSampleProject() {
+ orchestrator.getServer().provisionProject("sample", "sample");
+ }
+
+ private void defineQualityProfile(String qualityProfileKey) {
+ orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/measure/" + qualityProfileKey + ".xml"));
+ }
+
+ private void runSampleProjectAnalysis(String projectVersion, String... properties) {
+ ItUtils.runVerboseProjectAnalysis(
+ NewDebtRatioMeasureTest.orchestrator,
+ "measure/xoo-new-debt-ratio-" + projectVersion,
+ ItUtils.concat(properties,
+ // disable standard scm support so that it does not interfere with Xoo Scm sensor
+ "sonar.scm.disabled", "false")
+ );
+ }
+
+ private Resource getFileResourceWithVariations(String metricKey) {
+ return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample:src/main/xoo/sample/Sample.xoo", metricKey).setIncludeTrends(true));
+ }
+
+}
--- /dev/null
+package it.measure;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.locator.FileLocation;
+import it.Category2Suite;
+import java.util.List;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.wsclient.services.Measure;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+import util.ItUtils;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * SONAR-4776
+ */
+public class TechnicalDebtMeasureVariationTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category2Suite.ORCHESTRATOR;
+
+ @Before
+ public void cleanUpAnalysisData() {
+ orchestrator.resetData();
+ }
+
+ @Test
+ public void new_technical_debt_measures_from_new_issues() throws Exception {
+ // This test assumes that period 1 is "since previous analysis" and 2 is "over x days"
+
+ // Execute an analysis in the past to have a past snapshot without any issues
+ provisionSampleProject();
+ setSampleProjectQualityProfile("empty");
+ runSampleProjectAnalysis("sonar.projectDate", "2013-01-01");
+
+ // Second analysis -> issues will be created
+ defineQualityProfile("one-issue-per-line");
+ setSampleProjectQualityProfile("one-issue-per-line");
+ runSampleProjectAnalysis();
+
+ // New technical debt only comes from new issues
+ Resource newTechnicalDebt = getSampleProjectResourceWithVariations("new_technical_debt");
+ List<Measure> measures = newTechnicalDebt.getMeasures();
+ assertThat(measures.get(0).getVariation1()).isEqualTo(17);
+ assertThat(measures.get(0).getVariation2()).isEqualTo(17);
+
+ // Third analysis, with exactly the same profile -> no new issues so no new technical debt
+ runSampleProjectAnalysis();
+
+ newTechnicalDebt = orchestrator.getServer().getWsClient()
+ .find(ResourceQuery.createForMetrics("sample:src/main/xoo/sample/Sample.xoo", "new_technical_debt").setIncludeTrends(true));
+
+ // No variation => measure is purged
+ assertThat(newTechnicalDebt).isNull();
+ }
+
+ @Test
+ public void new_technical_debt_measures_from_technical_debt_update_since_previous_analysis() throws Exception {
+ // This test assumes that period 1 is "since previous analysis"
+
+ // Execute twice analysis
+ defineQualityProfile("one-issue-per-file");
+ provisionSampleProject();
+ setSampleProjectQualityProfile("one-issue-per-file");
+ runSampleProjectAnalysis();
+ runSampleProjectAnalysis();
+
+ // Third analysis, existing issues on OneIssuePerFile will have their technical debt updated with the effort to fix
+ runSampleProjectAnalysis("sonar.oneIssuePerFile.effortToFix", "10");
+
+ Resource newTechnicalDebt = getSampleProjectResourceWithVariations("new_technical_debt");
+ List<Measure> measures = newTechnicalDebt.getMeasures();
+ assertThat(measures.get(0).getVariation1()).isEqualTo(90);
+
+ // Fourth analysis, with exactly the same profile -> no new issues so no new technical debt since previous analysis
+ runSampleProjectAnalysis("sonar.oneIssuePerFile.effortToFix", "10");
+
+ newTechnicalDebt = getSampleProjectResourceWithVariations("new_technical_debt");
+ measures = newTechnicalDebt.getMeasures();
+ assertThat(measures.get(0).getVariation1()).isEqualTo(0);
+ }
+
+ @Test
+ public void new_technical_debt_measures_from_technical_debt_update_since_30_days() throws Exception {
+ // This test assumes that period 2 is "over x days"
+
+ // Execute an analysis in the past to have a past snapshot without any issues
+ provisionSampleProject();
+ setSampleProjectQualityProfile("empty");
+ runSampleProjectAnalysis("sonar.projectDate", "2013-01-01");
+
+ // Second analysis -> issues will be created
+ String profileXmlFile = "one-issue-per-file";
+ defineQualityProfile(profileXmlFile);
+ setSampleProjectQualityProfile("one-issue-per-file");
+ runSampleProjectAnalysis();
+
+ // Third analysis, existing issues on OneIssuePerFile will have their technical debt updated with the effort to fix
+ runSampleProjectAnalysis("sonar.oneIssuePerFile.effortToFix", "10");
+
+ Resource newTechnicalDebt = getSampleProjectResourceWithVariations("new_technical_debt");
+ List<Measure> measures = newTechnicalDebt.getMeasures();
+ assertThat(measures.get(0).getVariation2()).isEqualTo(90);
+
+ // Fourth analysis, with exactly the same profile -> no new issues so no new technical debt since previous analysis but still since 30
+ // days
+ runSampleProjectAnalysis("sonar.oneIssuePerFile.effortToFix", "10");
+
+ newTechnicalDebt = getSampleProjectResourceWithVariations("new_technical_debt");
+ measures = newTechnicalDebt.getMeasures();
+ assertThat(measures.get(0).getVariation2()).isEqualTo(90);
+ }
+
+ /**
+ * SONAR-5059
+ */
+ @Test
+ public void new_technical_debt_measures_should_never_be_negative() throws Exception {
+ // This test assumes that period 1 is "since previous analysis" and 2 is "over x days"
+
+ // Execute an analysis with a big effort to fix
+ defineQualityProfile("one-issue-per-file");
+ provisionSampleProject();
+ setSampleProjectQualityProfile("one-issue-per-file");
+ runSampleProjectAnalysis("sonar.oneIssuePerFile.effortToFix", "100");
+
+ // Execute a second analysis with a smaller effort to fix -> Added technical debt should be 0, not negative
+ runSampleProjectAnalysis("sonar.oneIssuePerFile.effortToFix", "10");
+
+ Resource newTechnicalDebt = getSampleProjectResourceWithVariations("new_technical_debt");
+ assertThat(newTechnicalDebt).isNull();
+ }
+
+ private void setSampleProjectQualityProfile(String qualityProfileKey) {
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", qualityProfileKey);
+ }
+
+ private void provisionSampleProject() {
+ orchestrator.getServer().provisionProject("sample", "sample");
+ }
+
+ private void defineQualityProfile(String qualityProfileKey) {
+ orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/measure/" + qualityProfileKey + ".xml"));
+ }
+
+ private void runSampleProjectAnalysis(String... properties) {
+ ItUtils.runVerboseProjectAnalysis(TechnicalDebtMeasureVariationTest.orchestrator, "shared/xoo-sample", properties);
+ }
+
+ private Resource getSampleProjectResourceWithVariations(String metricKey) {
+ return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample:src/main/xoo/sample/Sample.xoo", metricKey).setIncludeTrends(true));
+ }
+
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it.measureFilter;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import com.sonar.orchestrator.selenium.Selenese;
+import it.Category2Suite;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.wsclient.SonarClient;
+import org.sonar.wsclient.user.UserParameters;
+import util.selenium.SeleneseTest;
+
+import static util.ItUtils.projectDir;
+
+public class MeasureFiltersTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category2Suite.ORCHESTRATOR;
+
+ @BeforeClass
+ public static void scanStruts() {
+ orchestrator.resetData();
+ orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-multi-modules-sample")));
+
+ createUser("user-measure-filters", "User Measure Filters");
+ }
+
+ @AfterClass
+ public static void deleteTestUser() {
+ deactivateUser("user-measure-filters");
+ }
+
+ @Test
+ public void execute_measure_filters() {
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("execution_of_measure_filters",
+ "/measureFilter/MeasureFiltersTest/link_from_main_header.html",
+ "/measureFilter/MeasureFiltersTest/initial_search_form.html",
+ "/measureFilter/MeasureFiltersTest/search_for_projects.html",
+ "/measureFilter/MeasureFiltersTest/search_for_files.html",
+ // SONAR-4195
+ "/measureFilter/MeasureFiltersTest/search-by-key.html",
+ "/measureFilter/MeasureFiltersTest/search-by-name.html",
+ "/measureFilter/MeasureFiltersTest/empty_filter.html"
+ ).build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+ }
+
+ @Test
+ public void display_measure_filter_as_list() {
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("display_measure_filter_as_list",
+ "/measureFilter/MeasureFiltersTest/list_change_columns.html",
+ "/measureFilter/MeasureFiltersTest/list_delete_column.html",
+ "/measureFilter/MeasureFiltersTest/list_move_columns.html",
+ "/measureFilter/MeasureFiltersTest/list_sort_by_descending_name.html",
+ "/measureFilter/MeasureFiltersTest/list_sort_by_ncloc.html"
+ ).build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+ }
+
+ @Test
+ public void share_measure_filters() {
+ // SONAR-4099
+ String user = "user-measures-filter-with-sharing-perm";
+ createUser(user, "User Measure Filters with sharing permission", "shareDashboard");
+
+ try {
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("share_measure_filters",
+ // SONAR-4469
+ "/measureFilter/MeasureFiltersTest/should-unshare-filter-remove-other-filters-favourite.html"
+ ).build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+ } finally {
+ deactivateUser(user);
+ }
+ }
+
+ /**
+ * SONAR-4099
+ */
+ @Test
+ public void should_not_share_filter_when_user_have_no_sharing_permissions() {
+ String user = "user-measures-filter-with-no-share-perm";
+ createUser(user, "User Measure Filters without sharing permission");
+
+ try {
+ new SeleneseTest(Selenese.builder().setHtmlTestsInClasspath("should_not_share_filter_when_user_have_no_sharing_permissions",
+ "/measureFilter/MeasureFiltersTest/should-not-share-filter-when-user-have-no-sharing-permissions.html"
+ ).build()).runOn(orchestrator);
+ } finally {
+ deactivateUser(user);
+ }
+ }
+
+ @Test
+ public void copy_measure_filters() {
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("copy_measure_filters",
+ "/measureFilter/MeasureFiltersTest/copy_measure_filter.html",
+ "/measureFilter/MeasureFiltersTest/copy_uniqueness_of_name.html"
+ ).build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+ }
+
+ @Test
+ public void manage_measure_filters() {
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("manage_measure_filters",
+ "/measureFilter/MeasureFiltersTest/save_with_special_characters.html"
+ ).build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+ }
+
+ @Test
+ public void measure_filter_list_widget() {
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("measure_filter_list_widget",
+ "/measureFilter/MeasureFiltersTest/list_widget.html",
+ "/measureFilter/MeasureFiltersTest/list_widget_sort.html",
+ "/measureFilter/MeasureFiltersTest/list_widget_warning_if_missing_filter.html"
+ ).build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+ }
+
+ private static void createUser(String login, String name) {
+ createUser(login, name, null);
+ }
+
+ private static void createUser(String login, String name, String permission) {
+ SonarClient client = orchestrator.getServer().adminWsClient();
+ UserParameters userCreationParameters = UserParameters.create().login(login).name(name).password("password").passwordConfirmation("password");
+ client.userClient().create(userCreationParameters);
+
+ if (permission != null) {
+ client.post("api/permissions/add_user",
+ "login", login,
+ "permission", permission);
+ }
+ }
+
+ private static void deactivateUser(String user) {
+ orchestrator.getServer().adminWsClient().userClient().deactivate(user);
+ }
+}
--- /dev/null
+package it.measureHistory;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import com.sonar.orchestrator.locator.FileLocation;
+import it.Category2Suite;
+import java.util.List;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.wsclient.services.Measure;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+import util.ItUtils;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class DifferentialPeriodsTest {
+
+ @ClassRule
+ public static final Orchestrator orchestrator = Category2Suite.ORCHESTRATOR;
+
+ @Before
+ public void cleanUpAnalysisData() {
+ orchestrator.resetData();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ String propertyKey = "sonar.timemachine.period4";
+ unsetProperty(propertyKey);
+ unsetProperty("sonar.timemachine.period5");
+ }
+
+ /**
+ * SONAR-6787
+ */
+ @Test
+ public void ensure_differential_period_4_and_5_defined_at_project_level_is_taken_into_account() throws Exception {
+ setProperty("sonar.timemachine.period4", "30");
+ setProperty("sonar.timemachine.period5", "previous_analysis");
+
+ // Execute an analysis in the past to have a past snapshot without any issues
+ orchestrator.getServer().provisionProject("sample", "sample");
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "empty");
+ orchestrator.executeBuild(SonarRunner.create(ItUtils.projectDir("shared/xoo-sample"))
+ .setProperty("sonar.projectDate", "2013-01-01"));
+
+ // Second analysis -> issues will be created
+ orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/measureHistory/one-issue-per-line-profile.xml"));
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
+ orchestrator.executeBuild(SonarRunner.create(ItUtils.projectDir("shared/xoo-sample")));
+
+ // New technical debt only comes from new issues
+ Resource newTechnicalDebt = orchestrator.getServer().getWsClient()
+ .find(ResourceQuery.createForMetrics("sample:src/main/xoo/sample/Sample.xoo", "new_technical_debt").setIncludeTrends(true));
+ List<Measure> measures = newTechnicalDebt.getMeasures();
+ assertThat(measures.get(0).getVariation4()).isEqualTo(17);
+ assertThat(measures.get(0).getVariation5()).isEqualTo(17);
+
+ // Third analysis, with exactly the same profile -> no new issues so no new technical debt
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
+ orchestrator.executeBuild(SonarRunner.create(ItUtils.projectDir("shared/xoo-sample")));
+
+ newTechnicalDebt = orchestrator.getServer().getWsClient().find(
+ ResourceQuery.createForMetrics("sample:src/main/xoo/sample/Sample.xoo", "new_technical_debt").setIncludeTrends(true)
+ );
+
+ // No variation => measure is purged
+ assertThat(newTechnicalDebt).isNull();
+ }
+
+ private static void unsetProperty(String propertyKey) {
+ setProperty(propertyKey, "");
+ }
+
+ private static void setProperty(String propertyKey, String propertyValue) {
+ orchestrator.getServer().adminWsClient().post(
+ "/api/properties?",
+ "id", propertyKey,
+ "value", propertyValue
+ );
+ }
+
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it.measureHistory;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.BuildResult;
+import com.sonar.orchestrator.build.SonarRunner;
+import com.sonar.orchestrator.locator.FileLocation;
+import it.Category2Suite;
+import java.util.Date;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+import org.sonar.wsclient.services.TimeMachine;
+import org.sonar.wsclient.services.TimeMachineCell;
+import org.sonar.wsclient.services.TimeMachineQuery;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static util.ItUtils.projectDir;
+
+public class TimeMachineTest {
+
+ private static final String PROJECT = "sample";
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category2Suite.ORCHESTRATOR;
+
+ @BeforeClass
+ public static void initialize() {
+ orchestrator.resetData();
+ orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/measureHistory/one-issue-per-line-profile.xml"));
+ orchestrator.getServer().provisionProject("sample", "Sample");
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
+ analyzeProject("measure/xoo-history-v1", "2014-10-19");
+ analyzeProject("measure/xoo-history-v2", "2014-11-13");
+ }
+
+ private static BuildResult analyzeProject(String path, String date) {
+ return orchestrator.executeBuild(SonarRunner.create(projectDir(path), "sonar.projectDate", date));
+ }
+
+ @Test
+ public void projectIsAnalyzed() {
+ assertThat(orchestrator.getServer().getWsClient().find(new ResourceQuery(PROJECT)).getVersion()).isEqualTo("1.0-SNAPSHOT");
+ assertThat(orchestrator.getServer().getWsClient().find(new ResourceQuery(PROJECT)).getDate().getMonth()).isEqualTo(10); // November
+ }
+
+ @Test
+ public void testHistoryOfIssues() {
+ TimeMachineQuery query = TimeMachineQuery.createForMetrics(PROJECT, "blocker_violations", "critical_violations", "major_violations",
+ "minor_violations", "info_violations");
+ TimeMachine timemachine = orchestrator.getServer().getWsClient().find(query);
+ assertThat(timemachine.getCells().length).isEqualTo(2);
+
+ TimeMachineCell cell1 = timemachine.getCells()[0];
+ TimeMachineCell cell2 = timemachine.getCells()[1];
+
+ assertThat(cell1.getDate().getMonth()).isEqualTo(9);
+ assertThat(cell1.getValues()).isEqualTo(new Object[] {0L, 0L, 0L, 26L, 0L});
+
+ assertThat(cell2.getDate().getMonth()).isEqualTo(10);
+ assertThat(cell2.getValues()).isEqualTo(new Object[] {0L, 0L, 0L, 43L, 0L});
+ }
+
+ @Test
+ public void testHistoryOfMeasures() {
+ TimeMachineQuery query = TimeMachineQuery.createForMetrics(PROJECT, "lines", "ncloc");
+ TimeMachine timemachine = orchestrator.getServer().getWsClient().find(query);
+ assertThat(timemachine.getCells().length).isEqualTo(2);
+
+ TimeMachineCell cell1 = timemachine.getCells()[0];
+ TimeMachineCell cell2 = timemachine.getCells()[1];
+
+ assertThat(cell1.getDate().getMonth()).isEqualTo(9);
+ assertThat(cell1.getValues()).isEqualTo(new Object[] {26L, 24L});
+
+ assertThat(cell2.getDate().getMonth()).isEqualTo(10);
+ assertThat(cell2.getValues()).isEqualTo(new Object[] {43L, 40L});
+ }
+
+ @Test
+ public void unknownMetrics() {
+ TimeMachine timemachine = orchestrator.getServer().getWsClient().find(TimeMachineQuery.createForMetrics(PROJECT, "notfound"));
+ assertThat(timemachine.getCells().length).isEqualTo(0);
+
+ timemachine = orchestrator.getServer().getWsClient().find(TimeMachineQuery.createForMetrics(PROJECT, "lines", "notfound"));
+ assertThat(timemachine.getCells().length).isEqualTo(2);
+ for (TimeMachineCell cell : timemachine.getCells()) {
+ assertThat(cell.getValues().length).isEqualTo(1);
+ assertThat(cell.getValues()[0]).isInstanceOf(Long.class);
+ }
+
+ timemachine = orchestrator.getServer().getWsClient().find(TimeMachineQuery.createForMetrics(PROJECT));
+ assertThat(timemachine.getCells().length).isEqualTo(0);
+ }
+
+ @Test
+ public void noDataForInterval() {
+ Date now = new Date();
+ TimeMachine timemachine = orchestrator.getServer().getWsClient().find(TimeMachineQuery.createForMetrics(PROJECT, "lines").setFrom(now).setTo(now));
+ assertThat(timemachine.getCells().length).isEqualTo(0);
+ }
+
+ @Test
+ public void unknownResource() {
+ TimeMachine timemachine = orchestrator.getServer().getWsClient().find(TimeMachineQuery.createForMetrics("notfound:notfound", "lines"));
+ assertThat(timemachine).isNull();
+ }
+
+ @Test
+ public void test_measure_variations() {
+ Resource project = getProject("files", "ncloc", "violations");
+
+ // period 1 : previous analysis
+ assertThat(project.getPeriod1Mode()).isEqualTo("previous_analysis");
+ assertThat(project.getPeriod1Date()).isNotNull();
+
+ // variations from previous analysis
+ assertThat(project.getMeasure("files").getVariation1()).isEqualTo(1.0);
+ assertThat(project.getMeasure("ncloc").getVariation1()).isEqualTo(16.0);
+ assertThat(project.getMeasure("violations").getVariation1()).isGreaterThan(0.0);
+ }
+
+ /**
+ * SONAR-4962
+ */
+ @Test
+ public void measure_variations_are_only_meaningful_when_includetrends() {
+ String[] metricKeys = {"violations", "new_violations"};
+
+ Resource projectWithTrends = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT, metricKeys).setIncludeTrends(true));
+ assertThat(projectWithTrends.getMeasure("violations")).isNotNull();
+ assertThat(projectWithTrends.getMeasure("new_violations")).isNotNull();
+
+ Resource projectWithoutTrends = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT, metricKeys).setIncludeTrends(false));
+ assertThat(projectWithoutTrends.getMeasure("violations")).isNotNull();
+ assertThat(projectWithoutTrends.getMeasure("new_violations")).isNull();
+ }
+
+ private Resource getProject(String... metricKeys) {
+ return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT, metricKeys).setIncludeTrends(true));
+ }
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it.permission;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import com.sonar.orchestrator.locator.FileLocation;
+import it.Category1Suite;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.wsclient.SonarClient;
+import org.sonar.wsclient.base.HttpException;
+import org.sonar.wsclient.issue.BulkChange;
+import org.sonar.wsclient.issue.BulkChangeQuery;
+import org.sonar.wsclient.issue.Issue;
+import org.sonar.wsclient.issue.IssueQuery;
+import org.sonar.wsclient.user.UserParameters;
+
+import static junit.framework.TestCase.fail;
+import static org.assertj.core.api.Assertions.assertThat;
+import static util.ItUtils.projectDir;
+
+public class IssuePermissionTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category1Suite.ORCHESTRATOR;
+
+ @Before
+ public void init() {
+ orchestrator.resetData();
+
+ orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/permission/one-issue-per-line-profile.xml"));
+
+ orchestrator.getServer().provisionProject("sample", "Sample");
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
+ SonarRunner sampleProject = SonarRunner.create(projectDir("shared/xoo-sample"));
+ orchestrator.executeBuild(sampleProject);
+
+ orchestrator.getServer().provisionProject("sample2", "Sample2");
+ orchestrator.getServer().associateProjectToQualityProfile("sample2", "xoo", "one-issue-per-line");
+ SonarRunner sampleProject2 = SonarRunner.create(projectDir("shared/xoo-sample"))
+ .setProperty("sonar.projectKey", "sample2")
+ .setProperty("sonar.projectName", "Sample2");
+ orchestrator.executeBuild(sampleProject2);
+ }
+
+ @Test
+ public void need_user_permission_on_project_to_see_issue() {
+ SonarClient client = orchestrator.getServer().adminWsClient();
+
+ String withBrowsePermission = "with-browse-permission";
+ String withoutBrowsePermission = "without-browse-permission";
+
+ try {
+ client.userClient().create(UserParameters.create().login(withBrowsePermission).name(withBrowsePermission)
+ .password("password").passwordConfirmation("password"));
+ addUserPermission(withBrowsePermission, "sample", "user");
+
+ client.userClient().create(UserParameters.create().login(withoutBrowsePermission).name(withoutBrowsePermission)
+ .password("password").passwordConfirmation("password"));
+ // By default, it's the group anyone that have the permission user, it would be better to remove all groups on this permission
+ removeGroupPermission("anyone", "sample", "user");
+
+ // Without user permission, a user cannot see issues on the project
+ assertThat(orchestrator.getServer().wsClient(withoutBrowsePermission, "password").issueClient().find(
+ IssueQuery.create().componentRoots("sample")).list()).isEmpty();
+
+ // With user permission, a user can see issues on the project
+ assertThat(orchestrator.getServer().wsClient(withBrowsePermission, "password").issueClient().find(
+ IssueQuery.create().componentRoots("sample")).list()).isNotEmpty();
+
+ } finally {
+ client.userClient().deactivate(withBrowsePermission);
+ client.userClient().deactivate(withoutBrowsePermission);
+ }
+ }
+
+ /**
+ * SONAR-4839
+ */
+ @Test
+ public void need_user_permission_on_project_to_see_issue_changelog() {
+ SonarClient client = orchestrator.getServer().adminWsClient();
+ Issue issue = client.issueClient().find(IssueQuery.create().componentRoots("sample")).list().get(0);
+ client.issueClient().assign(issue.key(), "admin");
+
+ String withBrowsePermission = "with-browse-permission";
+ String withoutBrowsePermission = "without-browse-permission";
+
+ try {
+ client.userClient().create(UserParameters.create().login(withBrowsePermission).name(withBrowsePermission)
+ .password("password").passwordConfirmation("password"));
+ addUserPermission(withBrowsePermission, "sample", "user");
+
+ client.userClient().create(UserParameters.create().login(withoutBrowsePermission).name(withoutBrowsePermission)
+ .password("password").passwordConfirmation("password"));
+ // By default, it's the group anyone that have the permission user, it would be better to remove all groups on this permission
+ removeGroupPermission("anyone", "sample", "user");
+
+ // Without user permission, a user cannot see issue changelog on the project
+ try {
+ orchestrator.getServer().wsClient(withoutBrowsePermission, "password").issueClient().changes(issue.key());
+ fail();
+ } catch (Exception e) {
+ assertThat(e).isInstanceOf(HttpException.class).describedAs("404");
+ }
+
+ // Without user permission, a user cannot see issues on the project
+ assertThat(orchestrator.getServer().wsClient(withBrowsePermission, "password").issueClient().changes(issue.key())).isNotEmpty();
+
+ } finally {
+ client.userClient().deactivate(withBrowsePermission);
+ client.userClient().deactivate(withoutBrowsePermission);
+ }
+ }
+
+ /**
+ * SONAR-2447
+ */
+ @Test
+ public void need_administer_issue_permission_on_project_to_set_severity() {
+ SonarClient client = orchestrator.getServer().adminWsClient();
+ Issue issueOnSample = client.issueClient().find(IssueQuery.create().componentRoots("sample")).list().get(0);
+ Issue issueOnSample2 = client.issueClient().find(IssueQuery.create().componentRoots("sample2")).list().get(0);
+
+ String user = "user";
+
+ try {
+ client.userClient().create(UserParameters.create().login(user).name(user).password("password").passwordConfirmation("password"));
+ addUserPermission(user, "sample", "issueadmin");
+
+ // Without issue admin permission, a user cannot set severity on the issue
+ try {
+ orchestrator.getServer().wsClient(user, "password").issueClient().setSeverity(issueOnSample2.key(), "BLOCKER");
+ fail();
+ } catch (Exception e) {
+ assertThat(e).isInstanceOf(HttpException.class).describedAs("404");
+ }
+
+ // With issue admin permission, a user can set severity on the issue
+ assertThat(orchestrator.getServer().wsClient(user, "password").issueClient().setSeverity(issueOnSample.key(), "BLOCKER").severity()).isEqualTo("BLOCKER");
+
+ } finally {
+ client.userClient().deactivate(user);
+ }
+ }
+
+ /**
+ * SONAR-2447
+ */
+ @Test
+ public void need_administer_issue_permission_on_project_to_flag_as_false_positive() {
+ SonarClient client = orchestrator.getServer().adminWsClient();
+ Issue issueOnSample = client.issueClient().find(IssueQuery.create().componentRoots("sample")).list().get(0);
+ Issue issueOnSample2 = client.issueClient().find(IssueQuery.create().componentRoots("sample2")).list().get(0);
+
+ String user = "user";
+
+ try {
+ client.userClient().create(UserParameters.create().login(user).name(user).password("password").passwordConfirmation("password"));
+ addUserPermission(user, "sample", "issueadmin");
+
+ // Without issue admin permission, a user cannot flag an issue as false positive
+ try {
+ orchestrator.getServer().wsClient(user, "password").issueClient().doTransition(issueOnSample2.key(), "falsepositive");
+ fail();
+ } catch (Exception e) {
+ assertThat(e).isInstanceOf(HttpException.class).describedAs("404");
+ }
+
+ // With issue admin permission, a user can flag an issue as false positive
+ assertThat(orchestrator.getServer().wsClient(user, "password").issueClient().doTransition(issueOnSample.key(), "falsepositive").status()).isEqualTo("RESOLVED");
+
+ } finally {
+ client.userClient().deactivate(user);
+ }
+ }
+
+ /**
+ * SONAR-2447
+ */
+ @Test
+ public void need_administer_issue_permission_on_project_to_bulk_change_severity_and_false_positive() {
+ SonarClient client = orchestrator.getServer().adminWsClient();
+ Issue issueOnSample = client.issueClient().find(IssueQuery.create().componentRoots("sample")).list().get(0);
+ Issue issueOnSample2 = client.issueClient().find(IssueQuery.create().componentRoots("sample2")).list().get(0);
+
+ String user = "user";
+
+ try {
+ client.userClient().create(UserParameters.create().login(user).name(user).password("password").passwordConfirmation("password"));
+ addUserPermission(user, "sample", "issueadmin");
+
+ BulkChange bulkChange = orchestrator.getServer().wsClient(user, "password").issueClient().bulkChange(
+ BulkChangeQuery.create().issues(issueOnSample.key(), issueOnSample2.key())
+ .actions("set_severity", "do_transition")
+ .actionParameter("do_transition", "transition", "falsepositive")
+ .actionParameter("set_severity", "severity", "BLOCKER"));
+
+ assertThat(bulkChange.totalIssuesChanged()).isEqualTo(1);
+ assertThat(bulkChange.totalIssuesNotChanged()).isEqualTo(1);
+
+ } finally {
+ client.userClient().deactivate(user);
+ }
+ }
+
+ private static void addUserPermission(String login, String projectKey, String permission) {
+ orchestrator.getServer().adminWsClient().post("api/permissions/add_user",
+ "login", login,
+ "projectKey", projectKey,
+ "permission", permission);
+ }
+
+ private static void removeGroupPermission(String groupName, String projectKey, String permission) {
+ orchestrator.getServer().adminWsClient().post("api/permissions/remove_group",
+ "groupName", groupName,
+ "projectKey", projectKey,
+ "permission", permission);
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package it.plugins;
+
+import com.google.common.base.Joiner;
+import com.google.common.collect.Sets;
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.OrchestratorBuilder;
+import com.sonar.orchestrator.build.BuildResult;
+import com.sonar.orchestrator.build.SonarRunner;
+import it.plugins.checks.AbapCheck;
+import it.plugins.checks.Check;
+import it.plugins.checks.CobolCheck;
+import it.plugins.checks.CssCheck;
+import it.plugins.checks.FlexCheck;
+import it.plugins.checks.GroovyCheck;
+import it.plugins.checks.JavaCheck;
+import it.plugins.checks.JavascriptCheck;
+import it.plugins.checks.PhpCheck;
+import it.plugins.checks.PythonCheck;
+import it.plugins.checks.RpgCheck;
+import it.plugins.checks.SwiftCheck;
+import it.plugins.checks.Validation;
+import it.plugins.checks.WebCheck;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ErrorCollector;
+import org.sonar.updatecenter.common.Plugin;
+import org.sonar.updatecenter.common.Release;
+
+import static org.assertj.core.api.Assertions.fail;
+
+/**
+ * Verify that the plugins available in update center
+ * are correctly supported.
+ */
+public class PluginsTest {
+
+ /**
+ * Temporarily disabled plugins. To be re-enabled.
+ */
+ static final Set<String> DISABLED_PLUGINS = Sets.newHashSet("devcockpit", "views",
+ // internal plugin used for integration tests of language plugins
+ "lits");
+
+ static final Set<String> LICENSED_PLUGINS = Sets.newHashSet(
+ "abap", "cobol", "cpp", "devcockpit", "objc", "pli", "plsql", "report", "rpg",
+ "sqale", "swift", "vb", "vbnet", "views");
+
+ static final Set<String> DISABLED_PLUGINS_FOR_PREVIEW_MODE = Sets.newHashSet("mantis",
+
+ // Caused by: Access to the secured property 'sonar.scm.user.secured' is not possible in preview mode. The SonarQube plugin which requires
+ // this property must be deactivated in preview mode.
+ "scmstats");
+
+ // TODO new PliCheck() is temporarily disabled as PLI plugin does not support multi-language feature. See sonar-project.properties
+ // TODO new CCheck(), CppCheck() and VbCheck() are temporarily disabled as there is no version compatible with SQ 5.2 (they are using
+ // Violation API).
+ static final List<Check> CHECKS = Arrays.asList((Check) new AbapCheck(), new CobolCheck(), new CssCheck(),
+ new FlexCheck(), new GroovyCheck(), new JavaCheck(), new JavascriptCheck(), new PhpCheck(), new RpgCheck(),
+ new PythonCheck(), new SwiftCheck(), new WebCheck());
+
+ static Orchestrator orchestrator;
+
+ @BeforeClass
+ public static void startServer() {
+ OrchestratorBuilder builder = Orchestrator.builderEnv();
+
+ // install latest compatible releases of plugins
+ org.sonar.updatecenter.common.Version sonarVersion = org.sonar.updatecenter.common.Version.create(builder.getSonarVersion());
+ builder.getUpdateCenter().setInstalledSonarVersion(sonarVersion);
+ for (Plugin plugin : builder.getUpdateCenter().findAllCompatiblePlugins()) {
+ if (!DISABLED_PLUGINS.contains(plugin.getKey())) {
+ Release release = plugin.getLastCompatibleRelease(sonarVersion);
+ if (release != null) {
+ builder.setOrchestratorProperty(plugin.getKey() + "Version", release.getVersion().toString());
+ builder.addPlugin(plugin.getKey());
+ }
+ }
+ }
+ activateLicenses(builder);
+ orchestrator = builder.build();
+ orchestrator.start();
+ }
+
+ @Rule
+ public ErrorCollector errorCollector = new ErrorCollector();
+
+ @Test
+ public void analysis_of_project_with_all_supported_languages() {
+ SonarRunner analysis = newAnalysis();
+ BuildResult result = orchestrator.executeBuildQuietly(analysis);
+ if (result.getStatus() != 0) {
+ fail(result.getLogs());
+ }
+ for (Check check : CHECKS) {
+ System.out.println(check.getClass().getSimpleName() + "...");
+ check.validate(new Validation(orchestrator, errorCollector));
+ }
+ }
+
+ @Test
+ public void preview_analysis_of_project_with_all_supported_languages() {
+ SonarRunner analysis = newAnalysis();
+ analysis.setProperty("sonar.analysis.mode", "issues");
+ analysis.setProperty("sonar.preview.excludePlugins", Joiner.on(",").join(DISABLED_PLUGINS_FOR_PREVIEW_MODE));
+ BuildResult result = orchestrator.executeBuildQuietly(analysis);
+ if (result.getStatus() != 0) {
+ fail(result.getLogs());
+ }
+ }
+
+ private static SonarRunner newAnalysis() {
+ SonarRunner analysis = SonarRunner.create(Project.basedir());
+ analysis.setEnvironmentVariable("SONAR_RUNNER_OPTS", "-XX:MaxPermSize=128m");
+ return analysis;
+ }
+
+ private static void activateLicenses(OrchestratorBuilder builder) {
+ for (String licensedPlugin : LICENSED_PLUGINS) {
+ if (!DISABLED_PLUGINS.contains(licensedPlugin)) {
+ builder.activateLicense(licensedPlugin);
+ }
+ }
+ }
+
+}
--- /dev/null
+package it.plugins;
+
+import com.google.common.base.Function;
+import java.io.File;
+import java.util.Collection;
+import javax.annotation.Nullable;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.lang.StringUtils;
+import util.ItUtils;
+
+import static com.google.common.collect.FluentIterable.from;
+
+public class Project {
+
+ public static File basedir() {
+ return ItUtils.projectDir("plugins/project");
+ }
+
+ public static Iterable<String> allFilesInDir(final String dirPath) {
+ Collection<File> files = FileUtils.listFiles(new File(basedir(), dirPath), null, true);
+ return from(files).transform(new Function<File, String>() {
+ @Nullable
+ public String apply(File file) {
+ // transforms /absolute/path/to/src/java/Foo.java to src/java/Foo.java
+ String filePath = FilenameUtils.separatorsToUnix(file.getPath());
+ return dirPath + StringUtils.substringAfterLast(filePath, dirPath);
+ }
+ });
+ }
+}
--- /dev/null
+package it.plugins.checks;
+
+public class AbapCheck implements Check {
+
+ public static final String DIR = "src/abap";
+
+ @Override
+ public void validate(Validation validation) {
+ validation.mustHaveNonEmptySource(DIR);
+ validation.mustHaveIssues(DIR);
+ validation.mustHaveSize(DIR);
+ validation.mustHaveComments(DIR);
+ validation.mustHaveComplexity(DIR);
+ }
+}
--- /dev/null
+package it.plugins.checks;
+
+public class CCheck implements Check {
+
+ public static final String DIR = "src/c";
+
+ @Override
+ public void validate(Validation validation) {
+ validation.mustHaveNonEmptySource(DIR);
+ validation.mustHaveIssues(DIR);
+ validation.mustHaveSize(DIR);
+ validation.mustHaveComments(DIR);
+ validation.mustHaveComplexity(DIR);
+ }
+}
--- /dev/null
+package it.plugins.checks;
+
+public interface Check {
+ void validate(Validation validation);
+}
--- /dev/null
+package it.plugins.checks;
+
+public class CobolCheck implements Check {
+
+ public static final String DIR = "src/cobol";
+
+ @Override
+ public void validate(Validation validation) {
+ validation.mustHaveNonEmptySource(DIR);
+ validation.mustHaveIssues(DIR);
+ validation.mustHaveSize(DIR);
+ validation.mustHaveComments(DIR);
+ validation.mustHaveComplexity(DIR);
+ }
+}
--- /dev/null
+package it.plugins.checks;
+
+public class CppCheck implements Check {
+
+ public static final String DIR = "src/cpp";
+
+ @Override
+ public void validate(Validation validation) {
+ validation.mustHaveNonEmptySource(DIR);
+ validation.mustHaveIssues(DIR);
+ validation.mustHaveSize(DIR);
+ validation.mustHaveComments(DIR);
+ validation.mustHaveComplexity(DIR);
+ }
+}
--- /dev/null
+package it.plugins.checks;
+
+public class CssCheck implements Check {
+
+ public static final String DIR = "src/css";
+
+ @Override
+ public void validate(Validation validation) {
+ validation.mustHaveNonEmptySource(DIR);
+ validation.mustHaveIssues(DIR);
+ validation.mustHaveSize(DIR);
+ validation.mustHaveComments(DIR);
+ }
+}
--- /dev/null
+package it.plugins.checks;
+
+public class FlexCheck implements Check {
+
+ public static final String DIR = "src/flex";
+
+ @Override
+ public void validate(Validation validation) {
+ validation.mustHaveNonEmptySource(DIR);
+ validation.mustHaveSize(DIR);
+ validation.mustHaveComments(DIR);
+ validation.mustHaveComplexity(DIR);
+ validation.mustHaveIssues(DIR + "/HasIssues.as");
+ }
+}
--- /dev/null
+package it.plugins.checks;
+
+public class GroovyCheck implements Check {
+
+ public static final String DIR = "src/groovy";
+
+ @Override
+ public void validate(Validation validation) {
+ validation.mustHaveNonEmptySource(DIR);
+ validation.mustHaveIssues(DIR);
+ validation.mustHaveSize(DIR);
+ validation.mustHaveComments(DIR);
+ validation.mustHaveComplexity(DIR);
+ }
+}
--- /dev/null
+package it.plugins.checks;
+
+public class JavaCheck implements Check {
+
+ public static final String DIR = "src/java";
+
+ @Override
+ public void validate(Validation validation) {
+ validation.mustHaveNonEmptySource(DIR);
+ validation.mustHaveIssues(DIR);
+ validation.mustHaveSize(DIR);
+ validation.mustHaveComments(DIR);
+ validation.mustHaveComplexity(DIR);
+ }
+}
--- /dev/null
+package it.plugins.checks;
+
+public class JavascriptCheck implements Check {
+
+ public static final String SRC_DIR = "src/js";
+
+ @Override
+ public void validate(Validation validation) {
+ validation.mustHaveNonEmptySource(SRC_DIR);
+ validation.mustHaveSize(SRC_DIR);
+ validation.mustHaveComments(SRC_DIR);
+ validation.mustHaveComplexity(SRC_DIR);
+ validation.mustHaveIssues(SRC_DIR + "/HasIssues.js");
+ validation.mustHaveMeasuresGreaterThan(SRC_DIR + "/Person.js", 0, "coverage");
+ }
+}
--- /dev/null
+package it.plugins.checks;
+
+public class PhpCheck implements Check {
+
+ public static final String DIR = "src/php";
+
+ @Override
+ public void validate(Validation validation) {
+ validation.mustHaveNonEmptySource(DIR);
+ validation.mustHaveIssues(DIR);
+ validation.mustHaveSize(DIR);
+ validation.mustHaveComments(DIR);
+ validation.mustHaveComplexity(DIR);
+ }
+}
--- /dev/null
+package it.plugins.checks;
+
+public class PliCheck implements Check {
+
+ public static final String DIR = "src/pli";
+
+ @Override
+ public void validate(Validation validation) {
+ validation.mustHaveNonEmptySource(DIR);
+ validation.mustHaveSize(DIR);
+ validation.mustHaveComments(DIR);
+ validation.mustHaveComplexity(DIR);
+ validation.mustHaveIssues(DIR + "/hasissues.pli");
+ }
+}
--- /dev/null
+package it.plugins.checks;
+
+import it.plugins.Project;
+
+public class PythonCheck implements Check {
+
+ public static final String DIR = "src/python";
+
+ @Override
+ public void validate(Validation validation) {
+ // all files have size measures, even empty __init__.py
+ validation.mustHaveSize(DIR);
+
+ for (String filePath : Project.allFilesInDir(DIR)) {
+ if (filePath.endsWith("__init__.py")) {
+ validation.mustHaveSource(filePath);
+ } else {
+ validation.mustHaveNonEmptySource(filePath);
+ validation.mustHaveComments(filePath);
+ validation.mustHaveComplexity(filePath);
+ }
+ }
+
+ validation.mustHaveIssues(DIR + "/hasissues.py");
+ }
+
+}
--- /dev/null
+package it.plugins.checks;
+
+public class RpgCheck implements Check {
+
+ public static final String DIR = "src/rpg";
+
+ @Override
+ public void validate(Validation validation) {
+ validation.mustHaveNonEmptySource(DIR);
+ validation.mustHaveIssues(DIR);
+ validation.mustHaveSize(DIR);
+ validation.mustHaveComments(DIR);
+ validation.mustHaveComplexity(DIR);
+ }
+}
--- /dev/null
+package it.plugins.checks;
+
+public class SwiftCheck implements Check {
+
+ public static final String DIR = "src/swift";
+
+ @Override
+ public void validate(Validation validation) {
+ validation.mustHaveNonEmptySource(DIR);
+ validation.mustHaveIssues(DIR);
+ validation.mustHaveSize(DIR);
+ validation.mustHaveComplexity(DIR);
+ }
+}
--- /dev/null
+package it.plugins.checks;
+
+import com.google.common.base.Joiner;
+import com.sonar.orchestrator.Orchestrator;
+import it.plugins.Project;
+import java.io.File;
+import org.hamcrest.Matchers;
+import org.junit.rules.ErrorCollector;
+import org.sonar.wsclient.services.Measure;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+import org.sonar.wsclient.services.Source;
+import org.sonar.wsclient.services.SourceQuery;
+
+import static java.util.Arrays.asList;
+import static org.hamcrest.CoreMatchers.notNullValue;
+
+/**
+ *
+ * TODO must have syntax highlighting
+ * TODO must have duplications
+ * TODO must have issues with SQALE characteristic and debt
+ * TODO must have rules with characteristic
+ * TODO must have tests
+ * TODO must have coverage
+ */
+public class Validation {
+
+ private final Orchestrator orchestrator;
+ private final ErrorCollector errorCollector;
+
+ public Validation(Orchestrator orchestrator, ErrorCollector errorCollector) {
+ this.orchestrator = orchestrator;
+ this.errorCollector = errorCollector;
+ }
+
+ public void mustHaveIssues(String path) {
+ // TODO use the WS api/issues
+ mustHaveMeasuresGreaterThan(path, 1, "violations");
+ }
+
+ public void mustHaveComments(String path) {
+ mustHaveMeasuresGreaterThan(path, 0, "comment_lines", "comment_lines_density");
+ }
+
+ public void mustHaveComplexity(String path) {
+ mustHaveMeasuresGreaterThan(path, 0, "complexity");
+ }
+
+ public void mustHaveSize(String path) {
+ mustHaveMeasuresGreaterThan(path, 0, "ncloc", "lines");
+ }
+
+ public void mustHaveMeasuresGreaterThan(String path, int min, String... metricKeys) {
+ for (String filePath : toFiles(path)) {
+ fileMustHaveMeasures(filePath, metricKeys, min);
+ }
+ }
+
+ private void fileMustHaveMeasures(String filePath, String[] metricKeys, int min) {
+ Resource resource = getMeasureForComponentKey(filePathToKey(filePath), metricKeys);
+ errorCollector.checkThat("Measures " + Joiner.on(",").join(metricKeys) + " are set on file " + filePath, resource, notNullValue());
+ if (resource != null) {
+ for (String metricKey : metricKeys) {
+ Measure measure = resource.getMeasure(metricKey);
+ errorCollector.checkThat("Measure " + metricKey + " is set on file " + filePath, measure, notNullValue());
+ if (measure != null && measure.getIntValue() != null) {
+ errorCollector.checkThat("Measure " + metricKey + " is positive on file " + filePath, measure.getIntValue(), Matchers.greaterThanOrEqualTo(min));
+ }
+ }
+ }
+ }
+
+ /**
+ * Checks that each source file of the given directory is uploaded to server.
+ * @param path relative path to source directory or source file
+ */
+ public void mustHaveNonEmptySource(String path) {
+ mustHaveSourceWithAtLeast(path, 1);
+ }
+
+ public void mustHaveSource(String path) {
+ mustHaveSourceWithAtLeast(path, 0);
+ }
+
+ private void mustHaveSourceWithAtLeast(String path, int minLines) {
+ for (String filePath : toFiles(path)) {
+ Source source = orchestrator.getServer().getWsClient().find(SourceQuery.create(filePathToKey(filePath)));
+ errorCollector.checkThat("Source is set on file " + filePath, source, notNullValue());
+ if (source != null) {
+ errorCollector.checkThat("Source is not empty on file " + filePath, source.getLines().size(), Matchers.greaterThanOrEqualTo(minLines));
+ }
+ }
+ }
+
+ private Iterable<String> toFiles(String path) {
+ File fileOrDir = new File(Project.basedir(), path);
+ if (!fileOrDir.exists()) {
+ throw new IllegalArgumentException("Path does not exist: " + fileOrDir);
+ }
+ if (fileOrDir.isDirectory()) {
+ return Project.allFilesInDir(path);
+ }
+ return asList(path);
+ }
+
+ public Resource getMeasureForComponentKey(String resourceKey, String... metricKeys) {
+ return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(resourceKey, metricKeys));
+ }
+
+ private String filePathToKey(String filePath) {
+ return "all-langs:" + filePath;
+ }
+}
--- /dev/null
+package it.plugins.checks;
+
+public class VbCheck implements Check {
+
+ public static final String DIR = "src/vb";
+
+ @Override
+ public void validate(Validation validation) {
+ validation.mustHaveNonEmptySource(DIR);
+ validation.mustHaveIssues(DIR);
+ validation.mustHaveSize(DIR);
+ validation.mustHaveComments(DIR);
+ validation.mustHaveComplexity(DIR);
+ }
+}
--- /dev/null
+package it.plugins.checks;
+
+public class WebCheck implements Check {
+
+ public static final String DIR = "src/web";
+
+ @Override
+ public void validate(Validation validation) {
+ validation.mustHaveNonEmptySource(DIR);
+ validation.mustHaveIssues(DIR);
+ validation.mustHaveSize(DIR);
+ validation.mustHaveComments(DIR);
+ }
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it.projectAdministration;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import com.sonar.orchestrator.selenium.Selenese;
+import it.Category1Suite;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import util.selenium.SeleneseTest;
+
+import static util.ItUtils.projectDir;
+
+public class BulkDeletionTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category1Suite.ORCHESTRATOR;
+
+ @Before
+ public void deleteData() {
+ orchestrator.resetData();
+ }
+
+ /**
+ * SONAR-2614, SONAR-3805
+ */
+ @Test
+ public void test_bulk_deletion_on_selected_projects() throws Exception {
+ // we must have several projects to test the bulk deletion
+ executeBuild("cameleon-1", "Sample-Project");
+ executeBuild("cameleon-2", "Foo-Application");
+ executeBuild("cameleon-3", "Bar-Sonar-Plugin");
+
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("project-bulk-deletion-on-selected-project",
+ "/projectAdministration/BulkDeletionTest/bulk-delete-filter-projects.html"
+ ).build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+ }
+
+ private void executeBuild(String projectKey, String projectName) {
+ orchestrator.executeBuild(
+ SonarRunner.create(projectDir("shared/xoo-sample"))
+ .setProjectKey(projectKey)
+ .setProjectName(projectName)
+ );
+ }
+
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package it.projectAdministration;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import com.sonar.orchestrator.selenium.Selenese;
+import it.Category1Suite;
+import java.sql.SQLException;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import javax.annotation.Nullable;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.sonar.wsclient.SonarClient;
+import org.sonar.wsclient.base.HttpException;
+import org.sonar.wsclient.qualitygate.NewCondition;
+import org.sonar.wsclient.qualitygate.QualityGate;
+import org.sonar.wsclient.qualitygate.QualityGateClient;
+import org.sonar.wsclient.qualitygate.QualityGateCondition;
+import org.sonar.wsclient.qualitygate.UpdateCondition;
+import org.sonar.wsclient.services.PropertyQuery;
+import org.sonar.wsclient.services.ResourceQuery;
+import org.sonar.wsclient.user.UserParameters;
+import util.selenium.SeleneseTest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static util.ItUtils.projectDir;
+
+public class ProjectAdministrationTest {
+
+ private static final String DELETE_WS_ENDPOINT = "api/projects/bulk_delete";
+ @ClassRule
+ public static Orchestrator orchestrator = Category1Suite.ORCHESTRATOR;
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ private static final String PROJECT_KEY = "sample";
+ private static final String FILE_KEY = "sample:src/main/xoo/sample/Sample.xoo";
+
+ @Before
+ public void deleteAnalysisData() throws SQLException {
+ orchestrator.resetData();
+ }
+
+ @Test
+ public void delete_project_by_web_service() {
+ scanSampleWithDate("2012-01-01");
+
+ assertThat(orchestrator.getServer().getWsClient().find(ResourceQuery.create(PROJECT_KEY))).isNotNull();
+ assertThat(orchestrator.getServer().getWsClient().find(ResourceQuery.create(FILE_KEY))).isNotNull();
+
+ orchestrator.getServer().adminWsClient().post(DELETE_WS_ENDPOINT, "keys", PROJECT_KEY);
+
+ assertThat(orchestrator.getServer().getWsClient().find(ResourceQuery.create(PROJECT_KEY))).isNull();
+ assertThat(orchestrator.getServer().getWsClient().find(ResourceQuery.create(FILE_KEY))).isNull();
+ }
+
+ @Test
+ public void fail_when_trying_to_delete_a_file() {
+ expectedException.expect(HttpException.class);
+ scanSampleWithDate("2012-01-01");
+
+ assertThat(orchestrator.getServer().getWsClient().find(ResourceQuery.create(PROJECT_KEY))).isNotNull();
+ assertThat(orchestrator.getServer().getWsClient().find(ResourceQuery.create(FILE_KEY))).isNotNull();
+
+ // it's forbidden to delete only some files
+ orchestrator.getServer().adminWsClient().post(DELETE_WS_ENDPOINT, "keys", FILE_KEY);
+ }
+
+ @Test
+ public void fail_when_insufficient_privilege() {
+ expectedException.expect(HttpException.class);
+ scanSampleWithDate("2012-01-01");
+
+ assertThat(orchestrator.getServer().getWsClient().find(ResourceQuery.create(PROJECT_KEY))).isNotNull();
+
+ // use wsClient() instead of adminWsClient()
+ orchestrator.getServer().wsClient().post(DELETE_WS_ENDPOINT, "keys", PROJECT_KEY);
+ }
+
+ /**
+ * Test updated for SONAR-3570 and SONAR-5923
+ */
+ @Test
+ public void project_deletion() {
+ String projectAdminUser = "project-deletion-with-admin-permission-on-project";
+ SonarClient wsClient = orchestrator.getServer().adminWsClient();
+ try {
+ SonarRunner scan = SonarRunner.create(projectDir("shared/xoo-sample"));
+ orchestrator.executeBuild(scan);
+
+ // Create user having admin permission on previously analysed project
+ wsClient.userClient().create(
+ UserParameters.create().login(projectAdminUser).name(projectAdminUser).password("password").passwordConfirmation("password"));
+
+ wsClient.post("api/permissions/add_user",
+ "login", projectAdminUser,
+ "projectKey", "sample",
+ "permission", "admin");
+
+ new SeleneseTest(
+ Selenese.builder().setHtmlTestsInClasspath("project-deletion", "/projectAdministration/ProjectAdministrationTest/project-deletion/project-deletion.html").build())
+ .runOn(orchestrator);
+ } finally {
+ wsClient.userClient().deactivate(projectAdminUser);
+ }
+ }
+
+ // SONAR-4203
+ @Test
+ public void delete_version_of_multimodule_project() {
+ GregorianCalendar today = new GregorianCalendar();
+ SonarRunner build = SonarRunner.create(projectDir("shared/xoo-multi-modules-sample"))
+ .setProperty("sonar.dynamicAnalysis", "false")
+ .setProperty("sonar.projectDate", (today.get(Calendar.YEAR) - 1) + "-01-01");
+ orchestrator.executeBuild(build);
+
+ // The analysis must be run once again to have an history so that it is possible
+ // to set/delete version on old snapshot
+ build.setProperty("sonar.projectDate", today.get(Calendar.YEAR) + "-01-01");
+ orchestrator.executeBuild(build);
+
+ // There are 7 modules
+ assertThat(count("events where category='Version'")).as("Different number of events").isEqualTo(7);
+
+ Selenese selenese = Selenese.builder()
+ .setHtmlTestsInClasspath("modify_version_of_multimodule_project",
+ "/projectAdministration/ProjectAdministrationTest/project-administration/multimodule-project-modify-version.html"
+ ).build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+
+ assertThat(count("events where category='Version'")).as("Different number of events").isEqualTo(14);
+
+ selenese = Selenese.builder()
+ .setHtmlTestsInClasspath("delete_version_of_multimodule_project",
+ "/projectAdministration/ProjectAdministrationTest/project-administration/multimodule-project-delete-version.html"
+ ).build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+
+ assertThat(count("events where category='Version'")).as("Different number of events").isEqualTo(7);
+ }
+
+ // SONAR-3326
+ // TODO should be moved to qualityGate
+ @Test
+ public void display_alerts_correctly_in_history_page() {
+ QualityGateClient qgClient = orchestrator.getServer().adminWsClient().qualityGateClient();
+ QualityGate qGate = qgClient.create("AlertsForHistory");
+ qgClient.setDefault(qGate.id());
+
+ // with this configuration, project should have an Orange alert
+ QualityGateCondition lowThresholds = qgClient.createCondition(NewCondition.create(qGate.id()).metricKey("lines").operator("GT").warningThreshold("5").errorThreshold("50"));
+ scanSampleWithDate("2012-01-01");
+ // with this configuration, project should have a Green alert
+ qgClient.updateCondition(UpdateCondition.create(lowThresholds.id()).metricKey("lines").operator("GT").warningThreshold("5000").errorThreshold("5000"));
+ scanSampleWithDate("2012-01-02");
+
+ Selenese selenese = Selenese.builder()
+ .setHtmlTestsInClasspath("display-alerts-history-page",
+ "/projectAdministration/ProjectAdministrationTest/display-alerts-history-page/should-display-alerts-correctly-history-page.html"
+ ).build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+
+ qgClient.unsetDefault();
+ qgClient.destroy(qGate.id());
+ }
+
+ /**
+ * SONAR-1352
+ */
+ // TODO should be moved to qualityGate
+ @Test
+ public void display_period_alert_on_project_dashboard() {
+ QualityGateClient qgClient = orchestrator.getServer().adminWsClient().qualityGateClient();
+ QualityGate qGate = qgClient.create("AlertsForDashboard");
+ qgClient.createCondition(NewCondition.create(qGate.id()).metricKey("lines").operator("LT").warningThreshold("0").errorThreshold("10")
+ .period(1));
+ qgClient.setDefault(qGate.id());
+
+ // No alert
+ scanSampleWithDate("2012-01-01");
+
+ // Red alert because lines number has not changed since previous analysis
+ scanSample();
+
+ Selenese selenese = Selenese.builder()
+ .setHtmlTestsInClasspath("display-period-alerts",
+ "/projectAdministration/ProjectAdministrationTest/display-alerts/should-display-period-alerts-correctly.html"
+ ).build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+
+ qgClient.unsetDefault();
+ qgClient.destroy(qGate.id());
+ }
+
+ /**
+ * SONAR-3425
+ */
+ @Test
+ public void project_settings() {
+ scanSampleWithDate("2012-01-01");
+
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("project-settings",
+ // SONAR-3425
+ "/projectAdministration/ProjectAdministrationTest/project-settings/override-global-settings.html",
+
+ "/projectAdministration/ProjectAdministrationTest/project-settings/only-on-project-settings.html"
+ ).build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+
+ assertThat(orchestrator.getServer().getAdminWsClient().find(PropertyQuery.createForResource("sonar.skippedModules", "sample")).getValue())
+ .isEqualTo("my-excluded-module");
+ }
+
+ /**
+ * SONAR-1608
+ */
+ @Test
+ public void bulk_update_project_keys() {
+ SonarRunner build = SonarRunner.create(projectDir("shared/xoo-multi-modules-sample"));
+ orchestrator.executeBuild(build);
+
+ Selenese selenese = Selenese.builder()
+ .setHtmlTestsInClasspath("project-bulk-update-keys",
+ "/projectAdministration/ProjectAdministrationTest/project-update-keys/bulk-update-impossible-because-duplicate-keys.html",
+ "/projectAdministration/ProjectAdministrationTest/project-update-keys/bulk-update-impossible-because-no-input.html",
+ "/projectAdministration/ProjectAdministrationTest/project-update-keys/bulk-update-impossible-because-no-match.html",
+ "/projectAdministration/ProjectAdministrationTest/project-update-keys/bulk-update-success.html"
+ ).build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+ }
+
+ /**
+ * SONAR-1608
+ */
+ @Test
+ public void fine_grain_update_project_keys() {
+ SonarRunner build = SonarRunner.create(projectDir("shared/xoo-multi-modules-sample"));
+ orchestrator.executeBuild(build);
+
+ Selenese selenese = Selenese.builder()
+ .setHtmlTestsInClasspath("project-fine-grained-update-keys",
+ "/projectAdministration/ProjectAdministrationTest/project-update-keys/fine-grained-update-impossible.html",
+ "/projectAdministration/ProjectAdministrationTest/project-update-keys/fine-grained-update-success.html"
+ ).build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+ }
+
+ /**
+ * SONAR-4060
+ */
+ @Test
+ public void display_module_settings() {
+ orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-multi-modules-sample")));
+
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("module-settings",
+ // SONAR-3425
+ "/projectAdministration/ProjectAdministrationTest/module-settings/display-module-settings.html"
+ ).build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+ }
+
+ private void scanSample() {
+ scanSample(null, null);
+ }
+
+ private void scanSampleWithDate(String date) {
+ scanSample(date, null);
+ }
+
+ private void scanSample(@Nullable String date, @Nullable String profile) {
+ SonarRunner scan = SonarRunner.create(projectDir("shared/xoo-sample"))
+ .setProperties("sonar.cpd.skip", "true");
+ if (date != null) {
+ scan.setProperty("sonar.projectDate", date);
+ }
+ if (profile != null) {
+ scan.setProfile(profile);
+ }
+ orchestrator.executeBuild(scan);
+ }
+
+ private int count(String condition) {
+ return orchestrator.getDatabase().countSql("select count(*) from " + condition);
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package it.qualityGate;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import com.sonar.orchestrator.selenium.Selenese;
+import it.Category1Suite;
+import java.util.Iterator;
+import javax.mail.internet.MimeMessage;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.wsclient.Sonar;
+import org.sonar.wsclient.qualitygate.NewCondition;
+import org.sonar.wsclient.qualitygate.QualityGate;
+import org.sonar.wsclient.qualitygate.QualityGateClient;
+import org.sonar.wsclient.services.Measure;
+import org.sonar.wsclient.services.PropertyUpdateQuery;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+import org.subethamail.wiser.Wiser;
+import org.subethamail.wiser.WiserMessage;
+import util.NetworkUtils;
+import util.selenium.SeleneseTest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static util.ItUtils.projectDir;
+
+public class QualityGateNotificationTest {
+
+ private static final String PROJECT_KEY = "sample";
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category1Suite.ORCHESTRATOR;
+
+ @Before
+ public void cleanUp() {
+ orchestrator.resetData();
+ }
+
+ @Test
+ public void status_on_metric_variation_and_send_notifications() throws Exception {
+ Wiser smtpServer = new Wiser(NetworkUtils.getNextAvailablePort());
+ try {
+ // Configure SMTP
+ smtpServer.start();
+ Sonar wsClient = orchestrator.getServer().getAdminWsClient();
+ wsClient.update(new PropertyUpdateQuery("email.smtp_host.secured", "localhost"));
+ wsClient.update(new PropertyUpdateQuery("email.smtp_port.secured", Integer.toString(smtpServer.getServer().getPort())));
+
+ // Create user, who will receive notifications for new violations
+ orchestrator.getServer().adminWsClient().post("api/users/create", "login", "tester", "name", "Tester", "email", "tester@example.org", "password", "tester");
+ Selenese selenese = Selenese
+ .builder()
+ .setHtmlTestsInClasspath("notifications",
+ "/qualitygate/notifications/email_configuration.html",
+ "/qualitygate/notifications/activate_notification_channels.html").build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+
+ // Create quality gate with conditions on variations
+ QualityGate simple = qgClient().create("SimpleWithDifferential");
+ qgClient().setDefault(simple.id());
+ qgClient().createCondition(NewCondition.create(simple.id()).metricKey("ncloc").period(1).operator("EQ").warningThreshold("0"));
+
+ SonarRunner analysis = SonarRunner.create(projectDir("qualitygate/xoo-sample"));
+ orchestrator.executeBuild(analysis);
+ assertThat(fetchGateStatus().getData()).isEqualTo("OK");
+
+ orchestrator.executeBuild(analysis);
+ assertThat(fetchGateStatus().getData()).isEqualTo("WARN");
+
+ qgClient().unsetDefault();
+ qgClient().destroy(simple.id());
+
+ // Wait until all notifications are delivered
+ Thread.sleep(10000);
+
+ Iterator<WiserMessage> emails = smtpServer.getMessages().iterator();
+
+ MimeMessage message = emails.next().getMimeMessage();
+ assertThat(message.getHeader("To", null)).isEqualTo("<test@example.org>");
+ assertThat((String) message.getContent()).contains("This is a test message from Sonar");
+
+ assertThat(emails.hasNext()).isTrue();
+ message = emails.next().getMimeMessage();
+ assertThat(message.getHeader("To", null)).isEqualTo("<tester@example.org>");
+ assertThat((String) message.getContent()).contains("Quality gate status: Orange (was Green)");
+ assertThat((String) message.getContent()).contains("Quality gate threshold: Lines of code variation = 0 since previous analysis");
+ assertThat((String) message.getContent()).contains("/dashboard/index/sample");
+ assertThat(emails.hasNext()).isFalse();
+
+ } finally {
+ smtpServer.stop();
+ }
+ }
+
+ private Measure fetchGateStatus() {
+ return fetchResourceWithGateStatus().getMeasure("alert_status");
+ }
+
+ private Resource fetchResourceWithGateStatus() {
+ return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT_KEY, "alert_status").setIncludeAlerts(true));
+ }
+
+ private static QualityGateClient qgClient() {
+ return orchestrator.getServer().adminWsClient().qualityGateClient();
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package it.qualityGate;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import it.Category1Suite;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.wsclient.project.NewProject;
+import org.sonar.wsclient.qualitygate.NewCondition;
+import org.sonar.wsclient.qualitygate.QualityGate;
+import org.sonar.wsclient.qualitygate.QualityGateClient;
+import org.sonar.wsclient.services.Measure;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static util.ItUtils.projectDir;
+
+public class QualityGateTest {
+
+ private static final String PROJECT_KEY = "sample";
+
+ private long provisionnedProjectId = -1L;
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category1Suite.ORCHESTRATOR;
+
+ @Before
+ public void cleanUp() {
+ orchestrator.resetData();
+ provisionnedProjectId = Long.parseLong(orchestrator.getServer().adminWsClient().projectClient().create(NewProject.create().key(PROJECT_KEY).name("Sample")).id());
+ }
+
+ @Test
+ public void do_not_compute_status_if_no_gate() {
+ SonarRunner build = SonarRunner.create(projectDir("qualitygate/xoo-sample"));
+ orchestrator.executeBuild(build);
+
+ assertThat(fetchResourceWithGateStatus()).isNull();
+ }
+
+ @Test
+ public void status_ok_if_empty_gate() {
+ QualityGate empty = qgClient().create("Empty");
+ qgClient().setDefault(empty.id());
+
+ try {
+ SonarRunner build = SonarRunner.create(projectDir("qualitygate/xoo-sample"));
+ orchestrator.executeBuild(build);
+
+ assertThat(fetchGateStatus().getData()).isEqualTo("OK");
+ } finally {
+ qgClient().unsetDefault();
+ qgClient().destroy(empty.id());
+ }
+ }
+
+ @Test
+ public void test_status_ok() {
+ QualityGate simple = qgClient().create("SimpleWithHighThreshold");
+ qgClient().setDefault(simple.id());
+ qgClient().createCondition(NewCondition.create(simple.id()).metricKey("ncloc").operator("GT").warningThreshold("40"));
+
+ try {
+ SonarRunner build = SonarRunner.create(projectDir("qualitygate/xoo-sample"));
+ orchestrator.executeBuild(build);
+
+ assertThat(fetchGateStatus().getData()).isEqualTo("OK");
+ } finally {
+ qgClient().unsetDefault();
+ qgClient().destroy(simple.id());
+ }
+ }
+
+ @Test
+ public void test_status_warning() {
+ QualityGate simple = qgClient().create("SimpleWithLowThreshold");
+ qgClient().setDefault(simple.id());
+ qgClient().createCondition(NewCondition.create(simple.id()).metricKey("ncloc").operator("GT").warningThreshold("10"));
+
+ try {
+ SonarRunner build = SonarRunner.create(projectDir("qualitygate/xoo-sample"));
+ orchestrator.executeBuild(build);
+
+ assertThat(fetchGateStatus().getData()).isEqualTo("WARN");
+ } finally {
+ qgClient().unsetDefault();
+ qgClient().destroy(simple.id());
+ }
+
+ }
+
+ @Test
+ public void test_status_error() {
+ QualityGate simple = qgClient().create("SimpleWithLowThreshold");
+ qgClient().setDefault(simple.id());
+ qgClient().createCondition(NewCondition.create(simple.id()).metricKey("ncloc").operator("GT").errorThreshold("10"));
+
+ try {
+ SonarRunner build = SonarRunner.create(projectDir("qualitygate/xoo-sample"));
+ orchestrator.executeBuild(build);
+
+ assertThat(fetchGateStatus().getData()).isEqualTo("ERROR");
+ } finally {
+ qgClient().unsetDefault();
+ qgClient().destroy(simple.id());
+ }
+ }
+
+ @Test
+ public void use_server_settings_instead_of_default_gate() {
+ QualityGate alert = qgClient().create("AlertWithLowThreshold");
+ qgClient().createCondition(NewCondition.create(alert.id()).metricKey("ncloc").operator("GT").warningThreshold("10"));
+ QualityGate error = qgClient().create("ErrorWithLowThreshold");
+ qgClient().createCondition(NewCondition.create(error.id()).metricKey("ncloc").operator("GT").errorThreshold("10"));
+
+ qgClient().setDefault(alert.id());
+ qgClient().selectProject(error.id(), provisionnedProjectId);
+
+ try {
+ SonarRunner build = SonarRunner.create(projectDir("qualitygate/xoo-sample"));
+ orchestrator.executeBuild(build);
+
+ assertThat(fetchGateStatus().getData()).isEqualTo("ERROR");
+ } finally {
+ qgClient().unsetDefault();
+ qgClient().destroy(alert.id());
+ qgClient().destroy(error.id());
+ }
+ }
+
+ @Test
+ public void conditions_on_multiple_metric_types() {
+ QualityGate allTypes = qgClient().create("AllMetricTypes");
+ qgClient().createCondition(NewCondition.create(allTypes.id()).metricKey("ncloc").operator("GT").warningThreshold("10"));
+ qgClient().createCondition(NewCondition.create(allTypes.id()).metricKey("duplicated_lines_density").operator("GT").warningThreshold("20"));
+ qgClient().setDefault(allTypes.id());
+
+ try {
+ SonarRunner build = SonarRunner.create(projectDir("qualitygate/xoo-sample"))
+ .setProperty("sonar.cpd.xoo.minimumLines", "2")
+ .setProperty("sonar.cpd.xoo.minimumTokens", "5");
+ orchestrator.executeBuild(build);
+
+ Measure alertStatus = fetchGateStatus();
+ assertThat(alertStatus.getData()).isEqualTo("WARN");
+ assertThat(alertStatus.getAlertText())
+ .contains("Lines of code > 10")
+ .contains("Duplicated lines (%) > 20");
+ } finally {
+ qgClient().unsetDefault();
+ qgClient().destroy(allTypes.id());
+ }
+ }
+
+ private Measure fetchGateStatus() {
+ return fetchResourceWithGateStatus().getMeasure("alert_status");
+ }
+
+ private Resource fetchResourceWithGateStatus() {
+ return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT_KEY, "alert_status").setIncludeAlerts(true));
+ }
+
+ private static QualityGateClient qgClient() {
+ return orchestrator.getServer().adminWsClient().qualityGateClient();
+ }
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it.serverSystem;
+
+import com.sonar.orchestrator.Orchestrator;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.SystemUtils;
+import org.junit.After;
+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;
+
+/**
+ * This class start a new orchestrator on each test case
+ */
+public class DevModeTest {
+
+ Orchestrator orchestrator;
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @After
+ public void stop() {
+ if (orchestrator != null) {
+ orchestrator.stop();
+ }
+ }
+
+ /**
+ * 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");
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package it.serverSystem;
+
+import com.sonar.orchestrator.Orchestrator;
+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 util.NetworkUtils;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.fail;
+
+/**
+ * This class start a new orchestrator on each test case
+ */
+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("/serverSystem/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("/serverSystem/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");
+ }
+ }
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it.serverSystem;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.locator.FileLocation;
+import java.io.File;
+import org.apache.commons.io.FileUtils;
+import org.junit.After;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+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;
+
+/**
+ * This class start a new orchestrator on each test case
+ */
+public class ServerSystemRestartingOrchestrator {
+
+ Orchestrator orchestrator;
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @After
+ public void stop() {
+ if (orchestrator != null) {
+ orchestrator.stop();
+ }
+ }
+
+ /**
+ * SONAR-3516
+ */
+ @Test
+ public void check_minimal_sonar_version_at_startup() throws Exception {
+ try {
+ orchestrator = Orchestrator.builderEnv()
+ .addPlugin(FileLocation.of(new File(ServerSystemRestartingOrchestrator.class.getResource("/serverSystem/ServerSystemTest/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");
+ }
+ }
+
+ @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-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();
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package it.serverSystem;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import com.sonar.orchestrator.selenium.Selenese;
+import it.Category4Suite;
+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.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.wsclient.services.Server;
+import org.sonar.wsclient.services.ServerQuery;
+import util.ItUtils;
+import util.selenium.SeleneseTest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.fail;
+
+public class ServerSystemTest {
+
+ @ClassRule
+ public static final Orchestrator orchestrator = Category4Suite.ORCHESTRATOR;
+
+ @Before
+ public void cleanDatabase() {
+ orchestrator.resetData();
+ }
+
+ @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",
+ "/serverSystem/ServerSystemTest/missing_ip.html",
+ // SONAR-4102
+ "/serverSystem/ServerSystemTest/organisation_must_not_accept_special_chars.html",
+ "/serverSystem/ServerSystemTest/valid_id.html").build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+ }
+
+ @Test
+ public void display_system_info() {
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("server-administration",
+ "/serverSystem/ServerSystemTest/system_info.html"
+ ).build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+ }
+
+ /**
+ * See http://jira.codehaus.org/browse/SONAR-2727
+ */
+ @Test
+ public void display_warnings_when_using_h2() {
+ if (orchestrator.getConfiguration().getString("sonar.jdbc.dialect").equals("h2")) {
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("derby-warnings",
+ "/serverSystem/ServerSystemTest/derby-warning.html").build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+ }
+ }
+
+ /**
+ * See http://jira.codehaus.org/browse/SONAR-2840
+ */
+ @Test
+ public void hide_jdbc_settings_to_non_admin() {
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("jdbc-settings",
+ "/serverSystem/ServerSystemTest/hide-jdbc-settings.html").build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+ }
+
+ /**
+ * SONAR-3962
+ */
+ // TODO should be moved elsewhere
+ @Test
+ public void not_fail_with_url_ending_by_jsp() {
+ 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",
+ "/serverSystem/ServerSystemTest/url_ending_by_jsp.html").build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+ }
+
+ /**
+ * SONAR-3147
+ */
+ // TODO should be moved elsewhere
+ @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
+ */
+ // TODO should be moved elsewhere
+ @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();
+ }
+ }
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package it.settings;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.selenium.Selenese;
+import it.Category1Suite;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.wsclient.services.PropertyQuery;
+import org.sonar.wsclient.services.PropertyUpdateQuery;
+import util.selenium.SeleneseTest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class PropertySetsTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category1Suite.ORCHESTRATOR;
+
+ @Test
+ public void should_support_property_sets() {
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("property-sets",
+ "/settings/PropertySetsTest/property-sets/create.html",
+ "/settings/PropertySetsTest/property-sets/delete.html",
+ "/settings/PropertySetsTest/property-sets/reference.html",
+ "/settings/PropertySetsTest/property-sets/all_types.html"
+ ).build();
+ // Use the old runner because it fails with the new Selenium runner
+ orchestrator.executeSelenese(selenese);
+
+ // SSF-25 Check that the password has well be setted as now it does not appears in the html source code
+ String sonarDemoValue = getProperty("sonar.demo");
+ assertThat(getProperty("sonar.demo." + sonarDemoValue + ".password")).isEqualTo("abcde");
+ }
+
+ @Test
+ public void should_edit_properties() {
+ setProperty("sonar.test.jira.servers", "jira1,jira2");
+ setProperty("sonar.test.jira.servers.jira1.url", "http://jira1");
+ setProperty("sonar.test.jira.servers.jira2.url", "http://jira2");
+ setProperty("sonar.test.jira.servers.jira1.port", "12345");
+ setProperty("sonar.test.jira.servers.jira2.port", "66666");
+
+ assertThat(getProperty("sonar.test.jira.servers")).isEqualTo("jira1,jira2");
+ assertThat(getProperty("sonar.test.jira.servers.jira1.url")).isEqualTo("http://jira1");
+ assertThat(getProperty("sonar.test.jira.servers.jira2.url")).isEqualTo("http://jira2");
+ assertThat(getProperty("sonar.test.jira.servers.jira1.port")).isEqualTo("12345");
+ assertThat(getProperty("sonar.test.jira.servers.jira2.port")).isEqualTo("66666");
+ }
+
+ @Test
+ public void should_support_property_sets_with_auto_generated_keys() {
+ new SeleneseTest(
+ Selenese.builder().setHtmlTestsInClasspath("create-auto-generated",
+ "/settings/PropertySetsTest/auto-generated/create.html"
+ ).build()).runOn(orchestrator);
+
+ String[] keys = getProperty("sonar.autogenerated").split("[,]");
+ assertThat(getProperty("sonar.autogenerated." + keys[0] + ".value")).isEqualTo("FIRST");
+ assertThat(getProperty("sonar.autogenerated." + keys[1] + ".value")).isEqualTo("SECOND");
+ assertThat(getProperty("sonar.autogenerated." + keys[2] + ".value")).isEqualTo("THIRD");
+
+ new SeleneseTest(Selenese.builder().setHtmlTestsInClasspath("update-auto-generated",
+ "/settings/PropertySetsTest/auto-generated/update.html"
+ ).build()).runOn(orchestrator);
+
+ keys = getProperty("sonar.autogenerated").split("[,]");
+ assertThat(getProperty("sonar.autogenerated." + keys[0] + ".value")).isEqualTo("FIRST");
+ assertThat(getProperty("sonar.autogenerated." + keys[1] + ".value")).isEqualTo("THIRD");
+ }
+
+ static void setProperty(String key, String value) {
+ orchestrator.getServer().getAdminWsClient().update(new PropertyUpdateQuery(key, value));
+ }
+
+ static String getProperty(String key) {
+ return orchestrator.getServer().getAdminWsClient().find(new PropertyQuery().setKey(key)).getValue();
+ }
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package it.settings;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.selenium.Selenese;
+import it.Category1Suite;
+import java.io.IOException;
+import org.apache.commons.io.FileUtils;
+import org.junit.ClassRule;
+import org.junit.Test;
+import util.selenium.SeleneseTest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class SettingsTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category1Suite.ORCHESTRATOR;
+
+ // SONAR-4404
+ @Test
+ public void should_get_settings_default_value() {
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("settings-default-value",
+ "/settings/SettingsTest/settings-default-value.html").build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+ }
+
+ /**
+ * SONAR-3320
+ */
+ @Test
+ public void global_property_change_extension_point() throws IOException {
+ orchestrator.getServer().adminWsClient().post("api/properties/create?id=globalPropertyChange.received&value=NEWVALUE");
+ assertThat(FileUtils.readFileToString(orchestrator.getServer().getLogs()).contains("Received change: NEWVALUE"));
+ }
+
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it.settings;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import com.sonar.orchestrator.selenium.Selenese;
+import java.net.URL;
+import org.junit.After;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import util.ItUtils;
+import util.selenium.SeleneseTest;
+
+import static util.ItUtils.*;
+
+/**
+ * This class start a new orchestrator on each test case
+ */
+public class SettingsTestRestartingOrchestrator {
+
+ Orchestrator orchestrator;
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @After
+ public void stop() {
+ if (orchestrator != null) {
+ orchestrator.stop();
+ }
+ }
+
+ @Test
+ public void test_settings() {
+ URL secretKeyUrl = getClass().getResource("/settings/SettingsTest/sonar-secret.txt");
+ orchestrator = Orchestrator.builderEnv()
+ .addPlugin(pluginArtifact("settings-plugin"))
+ .addPlugin(pluginArtifact("license-plugin"))
+ .setServerProperty("sonar.secretKeyPath", secretKeyUrl.getFile())
+ .build();
+ orchestrator.start();
+
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("test_settings",
+ "/settings/SettingsTest/general-settings.html",
+
+ // SONAR-2869 the annotation @Properties can be used on extensions and not only on plugin entry points
+ "/settings/SettingsTest/hidden-extension-property.html",
+ "/settings/SettingsTest/global-extension-property.html",
+
+ // SONAR-3344 - licenses
+ "/settings/SettingsTest/ignore-corrupted-license.html",
+ "/settings/SettingsTest/display-license.html",
+ "/settings/SettingsTest/display-untyped-license.html",
+
+ // SONAR-2084 - encryption
+ "/settings/SettingsTest/generate-secret-key.html",
+ "/settings/SettingsTest/encrypt-text.html",
+
+ // SONAR-1378 - property types
+ "/settings/SettingsTest/validate-property-type.html",
+
+ // SONAR-3127 - hide passwords
+ "/settings/SettingsTest/hide-passwords.html"
+ ).build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+ }
+
+ @Test
+ public void property_relocation() {
+ orchestrator = Orchestrator.builderEnv()
+ .addPlugin(pluginArtifact("property-relocation-plugin"))
+ .addPlugin(xooPlugin())
+ .setServerProperty("sonar.deprecatedKey", "true")
+ .build();
+ orchestrator.start();
+
+ SonarRunner withDeprecatedKey = SonarRunner.create(projectDir("shared/xoo-sample"))
+ .setProperty("sonar.deprecatedKey", "true");
+ SonarRunner withNewKey = SonarRunner.create(projectDir("shared/xoo-sample"))
+ .setProperty("sonar.newKey", "true");
+ // should not fail
+ orchestrator.executeBuilds(withDeprecatedKey, withNewKey);
+
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("property_relocation",
+ "/settings/SettingsTest/property_relocation.html"
+ ).build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+ }
+
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package it.settings;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import com.sonar.orchestrator.selenium.Selenese;
+import it.Category1Suite;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.wsclient.services.PropertyQuery;
+import util.selenium.SeleneseTest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static util.ItUtils.projectDir;
+
+public class SubCategoriesTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category1Suite.ORCHESTRATOR;
+
+ /**
+ * SONAR-3159
+ */
+ @Test
+ public void should_support_global_subcategories() {
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("subcategories",
+ "/settings/subcategories/global-subcategories.html",
+ // SONAR-4495
+ "/settings/subcategories/global-subcategories-no-default.html"
+ ).build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+ assertThat(getProperty("prop3", null)).isEqualTo("myValue");
+ }
+
+ /**
+ * SONAR-3159
+ */
+ @Test
+ public void should_support_project_subcategories() {
+ orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample")));
+
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("subcategories",
+ "/settings/subcategories/project-subcategories.html",
+ // SONAR-4495
+ "/settings/subcategories/project-subcategories-no-default.html"
+ ).build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+ assertThat(getProperty("prop3", "sample")).isEqualTo("myValue2");
+ }
+
+ static String getProperty(String key, String resourceKeyOrId) {
+ return orchestrator.getServer().getAdminWsClient().find(new PropertyQuery().setKey(key).setResourceKeyOrId(resourceKeyOrId)).getValue();
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package it.test;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import it.Category2Suite;
+import java.io.File;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.io.filefilter.TrueFileFilter;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.skyscreamer.jsonassert.JSONAssert;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static util.ItUtils.projectDir;
+
+public class CoverageTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category2Suite.ORCHESTRATOR;
+
+ private static final String[] ALL_COVERAGE_METRICS = new String[] {
+ "line_coverage", "lines_to_cover", "uncovered_lines", "branch_coverage", "conditions_to_cover", "uncovered_conditions", "coverage",
+ "it_line_coverage", "it_lines_to_cover", "it_uncovered_lines", "it_branch_coverage", "it_conditions_to_cover", "it_uncovered_conditions", "it_coverage",
+ "overall_line_coverage", "overall_lines_to_cover", "overall_uncovered_lines", "overall_branch_coverage", "overall_conditions_to_cover", "overall_uncovered_conditions",
+ "overall_coverage"
+ };
+
+ @Before
+ public void delete_data() {
+ orchestrator.resetData();
+ }
+
+ @Test
+ public void unit_test_coverage() throws Exception {
+ orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-ut-coverage")));
+
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample-ut-coverage", ALL_COVERAGE_METRICS));
+ assertThat(project.getMeasureValue("line_coverage")).isEqualTo(50.0);
+ assertThat(project.getMeasureValue("lines_to_cover")).isEqualTo(4);
+ assertThat(project.getMeasureValue("uncovered_lines")).isEqualTo(2);
+ assertThat(project.getMeasureValue("branch_coverage")).isEqualTo(50.0);
+ assertThat(project.getMeasureValue("conditions_to_cover")).isEqualTo(2);
+ assertThat(project.getMeasureValue("uncovered_conditions")).isEqualTo(1);
+ assertThat(project.getMeasureValue("coverage")).isEqualTo(50.0);
+
+ assertThat(project.getMeasureValue("it_coverage")).isNull();
+
+ assertThat(project.getMeasureValue("overall_coverage")).isNull();
+
+ String coverage = orchestrator.getServer().adminWsClient().get("api/sources/lines", "key", "sample-ut-coverage:src/main/xoo/sample/Sample.xoo");
+ JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("/test/CoverageTest/unit_test_coverage-expected.json"), "UTF-8"), coverage, false);
+
+ verifyComputeEngineTempDirIsEmpty();
+ }
+
+ @Test
+ public void unit_test_coverage_no_condition() throws Exception {
+ orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-ut-coverage-no-condition")));
+
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample-ut-coverage", ALL_COVERAGE_METRICS));
+ assertThat(project.getMeasureValue("line_coverage")).isEqualTo(50.0);
+ assertThat(project.getMeasureValue("lines_to_cover")).isEqualTo(4);
+ assertThat(project.getMeasureValue("uncovered_lines")).isEqualTo(2);
+ assertThat(project.getMeasureValue("branch_coverage")).isNull();
+ assertThat(project.getMeasureValue("conditions_to_cover")).isNull();
+ assertThat(project.getMeasureValue("uncovered_conditions")).isNull();
+ assertThat(project.getMeasureValue("coverage")).isEqualTo(50.0);
+
+ assertThat(project.getMeasureValue("it_coverage")).isNull();
+
+ assertThat(project.getMeasureValue("overall_coverage")).isNull();
+
+ String coverage = orchestrator.getServer().adminWsClient().get("api/sources/lines", "key", "sample-ut-coverage:src/main/xoo/sample/Sample.xoo");
+ JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("/test/CoverageTest/unit_test_coverage_no_condition-expected.json"), "UTF-8"), coverage,
+ false);
+
+ verifyComputeEngineTempDirIsEmpty();
+ }
+
+ @Test
+ public void it_coverage() throws Exception {
+ orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-it-coverage")));
+
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample-it-coverage", ALL_COVERAGE_METRICS));
+ assertThat(project.getMeasureValue("coverage")).isNull();
+
+ assertThat(project.getMeasureValue("it_line_coverage")).isEqualTo(50.0);
+ assertThat(project.getMeasureValue("it_lines_to_cover")).isEqualTo(4);
+ assertThat(project.getMeasureValue("it_uncovered_lines")).isEqualTo(2);
+ assertThat(project.getMeasureValue("it_branch_coverage")).isEqualTo(50.0);
+ assertThat(project.getMeasureValue("it_conditions_to_cover")).isEqualTo(2);
+ assertThat(project.getMeasureValue("it_uncovered_conditions")).isEqualTo(1);
+ assertThat(project.getMeasureValue("it_coverage")).isEqualTo(50.0);
+
+ assertThat(project.getMeasureValue("overall_coverage")).isNull();
+
+ String coverage = orchestrator.getServer().adminWsClient().get("api/sources/lines", "key", "sample-it-coverage:src/main/xoo/sample/Sample.xoo");
+ JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("/test/CoverageTest/it_coverage-expected.json"), "UTF-8"), coverage, false);
+
+ verifyComputeEngineTempDirIsEmpty();
+ }
+
+ @Test
+ public void ut_and_it_coverage() throws Exception {
+ orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-overall-coverage")));
+
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample-overall-coverage", ALL_COVERAGE_METRICS));
+ assertThat(project.getMeasureValue("line_coverage")).isEqualTo(50.0);
+ assertThat(project.getMeasureValue("lines_to_cover")).isEqualTo(4);
+ assertThat(project.getMeasureValue("uncovered_lines")).isEqualTo(2);
+ assertThat(project.getMeasureValue("branch_coverage")).isEqualTo(25.0);
+ assertThat(project.getMeasureValue("conditions_to_cover")).isEqualTo(4);
+ assertThat(project.getMeasureValue("uncovered_conditions")).isEqualTo(3);
+ assertThat(project.getMeasureValue("coverage")).isEqualTo(37.5);
+
+ assertThat(project.getMeasureValue("it_line_coverage")).isEqualTo(50.0);
+ assertThat(project.getMeasureValue("it_lines_to_cover")).isEqualTo(4);
+ assertThat(project.getMeasureValue("it_uncovered_lines")).isEqualTo(2);
+ assertThat(project.getMeasureValue("it_branch_coverage")).isEqualTo(25.0);
+ assertThat(project.getMeasureValue("it_conditions_to_cover")).isEqualTo(4);
+ assertThat(project.getMeasureValue("it_uncovered_conditions")).isEqualTo(3);
+ assertThat(project.getMeasureValue("it_coverage")).isEqualTo(37.5);
+
+ assertThat(project.getMeasureValue("overall_line_coverage")).isEqualTo(75.0);
+ assertThat(project.getMeasureValue("overall_lines_to_cover")).isEqualTo(4);
+ assertThat(project.getMeasureValue("overall_uncovered_lines")).isEqualTo(1);
+ assertThat(project.getMeasureValue("overall_branch_coverage")).isEqualTo(50.0);
+ assertThat(project.getMeasureValue("overall_conditions_to_cover")).isEqualTo(4);
+ assertThat(project.getMeasureValue("overall_uncovered_conditions")).isEqualTo(2);
+ assertThat(project.getMeasureValue("overall_coverage")).isEqualTo(62.5);
+
+ String coverage = orchestrator.getServer().adminWsClient().get("api/sources/lines", "key", "sample-overall-coverage:src/main/xoo/sample/Sample.xoo");
+ JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("/test/CoverageTest/ut_and_it_coverage-expected.json"), "UTF-8"), coverage, false);
+
+ verifyComputeEngineTempDirIsEmpty();
+ }
+
+ /**
+ * SONAR-766
+ */
+ @Test
+ public void should_compute_coverage_on_project() {
+ orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-half-covered")));
+
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("xoo-half-covered", ALL_COVERAGE_METRICS));
+ assertThat(project.getMeasureValue("coverage")).isEqualTo(50.0);
+
+ verifyComputeEngineTempDirIsEmpty();
+ }
+
+ /**
+ * SONAR-766
+ */
+ @Test
+ public void should_ignore_coverage_on_full_path() {
+ orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-half-covered"))
+ .setProperty("sonar.coverage.exclusions", "src/main/xoo/org/sonar/tests/halfcovered/UnCovered.xoo"));
+
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("xoo-half-covered", ALL_COVERAGE_METRICS));
+ assertThat(project.getMeasureValue("coverage")).isEqualTo(100.0);
+
+ verifyComputeEngineTempDirIsEmpty();
+ }
+
+ /**
+ * SONAR-766
+ */
+ @Test
+ public void should_ignore_coverage_on_pattern() {
+ orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-half-covered"))
+ .setProperty("sonar.coverage.exclusions", "**/UnCovered*"));
+
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("xoo-half-covered", ALL_COVERAGE_METRICS));
+ assertThat(project.getMeasureValue("coverage")).isEqualTo(100.0);
+
+ verifyComputeEngineTempDirIsEmpty();
+ }
+
+ /**
+ * SONAR-766
+ */
+ @Test
+ public void should_not_have_coverage_at_all() {
+ orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-half-covered"))
+ .setProperty("sonar.coverage.exclusions", "**/*"));
+
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("xoo-half-covered", ALL_COVERAGE_METRICS));
+ assertThat(project.getMeasureValue("coverage")).isNull();
+
+ verifyComputeEngineTempDirIsEmpty();
+ }
+
+ private void verifyComputeEngineTempDirIsEmpty() {
+ File ceTempDirectory = new File(new File(orchestrator.getServer().getHome(), "temp"), "ce");
+ assertThat(FileUtils.listFiles(ceTempDirectory, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE)).isEmpty();
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package it.test;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import it.Category2Suite;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.commons.io.IOUtils;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.skyscreamer.jsonassert.JSONAssert;
+
+import static util.ItUtils.projectDir;
+
+public class CoverageTrackingTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category2Suite.ORCHESTRATOR;
+
+ @Before
+ public void delete_data() {
+ orchestrator.resetData();
+ }
+
+ @Test
+ public void test_coverage_per_test() throws Exception {
+ orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-with-coverage-per-test")));
+
+ String tests = orchestrator.getServer().adminWsClient().get("api/tests/list", "testFileKey", "sample-with-tests:src/test/xoo/sample/SampleTest.xoo");
+ JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("/test/CoverageTrackingTest/tests-expected.json"), "UTF-8"), tests, false);
+
+ String covered_files = orchestrator.getServer().adminWsClient()
+ .get("api/tests/covered_files", "testId", extractSuccessfulTestId(tests));
+ JSONAssert
+ .assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("/test/CoverageTrackingTest/covered_files-expected.json"), "UTF-8"), covered_files, false);
+ }
+
+ private String extractSuccessfulTestId(String json) {
+ Matcher jsonObjectMatcher = Pattern.compile(".*\\{((.*?)success(.*?))\\}.*", Pattern.MULTILINE).matcher(json);
+ jsonObjectMatcher.find();
+
+ Matcher idMatcher = Pattern.compile(".*\"id\"\\s*?:\\s*?\"(\\S*?)\".*", Pattern.MULTILINE).matcher(jsonObjectMatcher.group(1));
+ return idMatcher.find() ? idMatcher.group(1) : "";
+ }
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it.test;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import it.Category2Suite;
+import org.assertj.core.data.Offset;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static util.ItUtils.projectDir;
+
+public class NewCoverageTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category2Suite.ORCHESTRATOR;
+
+ private static final String PROJECT_KEY = "sample-new-coverage";
+
+ private static final Offset<Double> DEFAULT_OFFSET = Offset.offset(0.1d);
+
+ private static final String[] ALL_NEW_COVERAGE_METRICS = new String[] {
+ "new_coverage", "new_line_coverage", "new_branch_coverage",
+ "new_it_coverage", "new_it_line_coverage", "new_it_branch_coverage",
+ "new_overall_coverage", "new_overall_line_coverage", "new_overall_branch_coverage"
+ };
+
+ @BeforeClass
+ public static void analyze_project() {
+ orchestrator.resetData();
+
+ orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-new-coverage-v1"))
+ .setProperty("sonar.projectDate", "2015-02-01")
+ .setProperty("sonar.scm.disabled", "false")
+ );
+ orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-new-coverage-v2"))
+ .setProperty("sonar.scm.disabled", "false"));
+ }
+
+ @Test
+ public void new_unit_test_coverage() throws Exception {
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT_KEY, ALL_NEW_COVERAGE_METRICS).setIncludeTrends(true));
+ assertThat(project.getMeasure("new_coverage").getVariation1()).isEqualTo(62.5d, DEFAULT_OFFSET);
+ assertThat(project.getMeasure("new_line_coverage").getVariation1()).isEqualTo(80d, DEFAULT_OFFSET);
+ assertThat(project.getMeasure("new_branch_coverage").getVariation1()).isEqualTo(33.3, DEFAULT_OFFSET);
+ }
+
+ @Test
+ public void new_integration_test_coverage() throws Exception {
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT_KEY, ALL_NEW_COVERAGE_METRICS).setIncludeTrends(true));
+ assertThat(project.getMeasure("new_it_coverage").getVariation1()).isEqualTo(85.7, DEFAULT_OFFSET);
+ assertThat(project.getMeasure("new_it_line_coverage").getVariation1()).isEqualTo(100d, DEFAULT_OFFSET);
+ assertThat(project.getMeasure("new_it_branch_coverage").getVariation1()).isEqualTo(66.7, DEFAULT_OFFSET);
+ }
+
+ @Test
+ public void new_overall_coverage() throws Exception {
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT_KEY, ALL_NEW_COVERAGE_METRICS).setIncludeTrends(true));
+ assertThat(project.getMeasure("new_overall_coverage").getVariation1()).isEqualTo(44.4d, DEFAULT_OFFSET);
+ assertThat(project.getMeasure("new_overall_line_coverage").getVariation1()).isEqualTo(50d, DEFAULT_OFFSET);
+ assertThat(project.getMeasure("new_overall_branch_coverage").getVariation1()).isEqualTo(42.85, DEFAULT_OFFSET);
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package it.test;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import it.Category2Suite;
+import org.apache.commons.io.IOUtils;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.skyscreamer.jsonassert.JSONAssert;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static util.ItUtils.projectDir;
+
+public class TestExecutionTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category2Suite.ORCHESTRATOR;
+
+ @Before
+ public void delete_data() {
+ orchestrator.resetData();
+ }
+
+ @Test
+ public void test_execution() throws Exception {
+ orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-with-tests-execution")));
+
+ Resource project = orchestrator.getServer().getWsClient()
+ .find(ResourceQuery.createForMetrics("sample-with-tests", "test_success_density", "test_failures", "test_errors", "tests", "skipped_tests", "test_execution_time"));
+ assertThat(project.getMeasureValue("test_success_density")).isEqualTo(50.0);
+ assertThat(project.getMeasureIntValue("test_failures")).isEqualTo(1);
+ assertThat(project.getMeasureIntValue("test_errors")).isEqualTo(1);
+ assertThat(project.getMeasureIntValue("tests")).isEqualTo(4);
+ assertThat(project.getMeasureIntValue("skipped_tests")).isEqualTo(1);
+ assertThat(project.getMeasureIntValue("test_execution_time")).isEqualTo(8);
+
+ String json = orchestrator.getServer().adminWsClient().get("api/tests/list", "testFileKey", "sample-with-tests:src/test/xoo/sample/SampleTest.xoo");
+ JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("/test/TestExecutionTest/expected.json"), "UTF-8"), json, false);
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package it.updateCenter;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.selenium.Selenese;
+import java.util.List;
+import org.apache.commons.lang.StringUtils;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.wsclient.services.Plugin;
+import org.sonar.wsclient.services.UpdateCenterQuery;
+import util.selenium.SeleneseTest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static util.ItUtils.pluginArtifact;
+import static util.ItUtils.xooPlugin;
+
+/**
+ * This class start its own orchestrator
+ */
+public class UpdateCenterTest {
+
+ @ClassRule
+ public static final Orchestrator orchestrator = Orchestrator.builderEnv()
+ .setServerProperty("sonar.updatecenter.url", UpdateCenterTest.class.getResource("/updateCenter/UpdateCenterTest/update-center.properties").toString())
+ .addPlugin(pluginArtifact("sonar-fake-plugin"))
+ .build();
+
+ @Test
+ public void web_service_should_return_installed_plugins() {
+ List<Plugin> plugins = orchestrator.getServer().getAdminWsClient().findAll(UpdateCenterQuery.createForInstalledPlugins());
+ assertThat(plugins.size()).isGreaterThan(0);
+
+ Plugin installedPlugin = findPlugin(plugins, "fake");
+
+ assertThat(installedPlugin).isNotNull();
+ assertThat(installedPlugin.getName()).isEqualTo("Plugins :: Fake");
+ assertThat(installedPlugin.getVersion()).isEqualTo("1.0-SNAPSHOT");
+ }
+
+ @Test
+ public void test_console() {
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("server-update-center",
+ "/updateCenter/installed-plugins.html")
+ .build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+ }
+
+ private Plugin findPlugin(List<Plugin> plugins, String pluginKey) {
+ for (Plugin plugin : plugins) {
+ if (StringUtils.equals(pluginKey, plugin.getKey())) {
+ return plugin;
+ }
+ }
+ return null;
+ }
+
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package it.user;
+
+import com.google.common.base.Function;
+import com.google.common.collect.Iterables;
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import com.sonar.orchestrator.locator.FileLocation;
+import it.Category4Suite;
+import java.util.List;
+import org.junit.Before;
+import org.junit.BeforeClass;
+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;
+import static util.ItUtils.runProjectAnalysis;
+
+/**
+ * TODO This test should not require an analysis, only provionning the project should be enough
+ */
+public class FavouriteTest {
+
+ @ClassRule
+ public static final Orchestrator orchestrator = Category4Suite.ORCHESTRATOR;
+
+ @Before
+ public void inspectProject() {
+ orchestrator.resetData();
+ orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample")));
+ }
+
+ @Test
+ public void favourites_web_service() {
+ 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");
+ }
+
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package it.user;
+
+import com.sonar.orchestrator.Orchestrator;
+import it.Category4Suite;
+import java.io.IOException;
+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.ClassRule;
+import org.junit.Test;
+import org.sonar.wsclient.base.HttpException;
+import org.sonar.wsclient.services.PropertyDeleteQuery;
+import org.sonar.wsclient.services.PropertyUpdateQuery;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class ForceAuthenticationTest {
+
+ @ClassRule
+ public static final Orchestrator orchestrator = Category4Suite.ORCHESTRATOR;
+
+ /**
+ * SONAR-5542
+ */
+ @Test
+ public void force_authentication_should_be_used_on_java_web_services_but_not_on_batch_index_and_file() throws IOException {
+ 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"));
+ }
+ }
+
+}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package permission.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.SonarRunner;
-import com.sonar.orchestrator.locator.FileLocation;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.wsclient.SonarClient;
-import org.sonar.wsclient.base.HttpException;
-import org.sonar.wsclient.issue.BulkChange;
-import org.sonar.wsclient.issue.BulkChangeQuery;
-import org.sonar.wsclient.issue.Issue;
-import org.sonar.wsclient.issue.IssueQuery;
-import org.sonar.wsclient.user.UserParameters;
-
-import static junit.framework.TestCase.fail;
-import static org.assertj.core.api.Assertions.assertThat;
-import static util.ItUtils.projectDir;
-
-public class IssuePermissionTest {
-
- @ClassRule
- public static Orchestrator orchestrator = PermissionTestSuite.ORCHESTRATOR;
-
- @Before
- public void init() {
- orchestrator.resetData();
-
- orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/permission/suite/one-issue-per-line-profile.xml"));
-
- orchestrator.getServer().provisionProject("sample", "Sample");
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
- SonarRunner sampleProject = SonarRunner.create(projectDir("shared/xoo-sample"));
- orchestrator.executeBuild(sampleProject);
-
- orchestrator.getServer().provisionProject("sample2", "Sample2");
- orchestrator.getServer().associateProjectToQualityProfile("sample2", "xoo", "one-issue-per-line");
- SonarRunner sampleProject2 = SonarRunner.create(projectDir("shared/xoo-sample"))
- .setProperty("sonar.projectKey", "sample2")
- .setProperty("sonar.projectName", "Sample2");
- orchestrator.executeBuild(sampleProject2);
- }
-
- @Test
- public void need_user_permission_on_project_to_see_issue() {
- SonarClient client = orchestrator.getServer().adminWsClient();
-
- String withBrowsePermission = "with-browse-permission";
- String withoutBrowsePermission = "without-browse-permission";
-
- try {
- client.userClient().create(UserParameters.create().login(withBrowsePermission).name(withBrowsePermission)
- .password("password").passwordConfirmation("password"));
- addUserPermission(withBrowsePermission, "sample", "user");
-
- client.userClient().create(UserParameters.create().login(withoutBrowsePermission).name(withoutBrowsePermission)
- .password("password").passwordConfirmation("password"));
- // By default, it's the group anyone that have the permission user, it would be better to remove all groups on this permission
- removeGroupPermission("anyone", "sample", "user");
-
- // Without user permission, a user cannot see issues on the project
- assertThat(orchestrator.getServer().wsClient(withoutBrowsePermission, "password").issueClient().find(
- IssueQuery.create().componentRoots("sample")).list()).isEmpty();
-
- // With user permission, a user can see issues on the project
- assertThat(orchestrator.getServer().wsClient(withBrowsePermission, "password").issueClient().find(
- IssueQuery.create().componentRoots("sample")).list()).isNotEmpty();
-
- } finally {
- client.userClient().deactivate(withBrowsePermission);
- client.userClient().deactivate(withoutBrowsePermission);
- }
- }
-
- /**
- * SONAR-4839
- */
- @Test
- public void need_user_permission_on_project_to_see_issue_changelog() {
- SonarClient client = orchestrator.getServer().adminWsClient();
- Issue issue = client.issueClient().find(IssueQuery.create().componentRoots("sample")).list().get(0);
- client.issueClient().assign(issue.key(), "admin");
-
- String withBrowsePermission = "with-browse-permission";
- String withoutBrowsePermission = "without-browse-permission";
-
- try {
- client.userClient().create(UserParameters.create().login(withBrowsePermission).name(withBrowsePermission)
- .password("password").passwordConfirmation("password"));
- addUserPermission(withBrowsePermission, "sample", "user");
-
- client.userClient().create(UserParameters.create().login(withoutBrowsePermission).name(withoutBrowsePermission)
- .password("password").passwordConfirmation("password"));
- // By default, it's the group anyone that have the permission user, it would be better to remove all groups on this permission
- removeGroupPermission("anyone", "sample", "user");
-
- // Without user permission, a user cannot see issue changelog on the project
- try {
- orchestrator.getServer().wsClient(withoutBrowsePermission, "password").issueClient().changes(issue.key());
- fail();
- } catch (Exception e) {
- assertThat(e).isInstanceOf(HttpException.class).describedAs("404");
- }
-
- // Without user permission, a user cannot see issues on the project
- assertThat(orchestrator.getServer().wsClient(withBrowsePermission, "password").issueClient().changes(issue.key())).isNotEmpty();
-
- } finally {
- client.userClient().deactivate(withBrowsePermission);
- client.userClient().deactivate(withoutBrowsePermission);
- }
- }
-
- /**
- * SONAR-2447
- */
- @Test
- public void need_administer_issue_permission_on_project_to_set_severity() {
- SonarClient client = orchestrator.getServer().adminWsClient();
- Issue issueOnSample = client.issueClient().find(IssueQuery.create().componentRoots("sample")).list().get(0);
- Issue issueOnSample2 = client.issueClient().find(IssueQuery.create().componentRoots("sample2")).list().get(0);
-
- String user = "user";
-
- try {
- client.userClient().create(UserParameters.create().login(user).name(user).password("password").passwordConfirmation("password"));
- addUserPermission(user, "sample", "issueadmin");
-
- // Without issue admin permission, a user cannot set severity on the issue
- try {
- orchestrator.getServer().wsClient(user, "password").issueClient().setSeverity(issueOnSample2.key(), "BLOCKER");
- fail();
- } catch (Exception e) {
- assertThat(e).isInstanceOf(HttpException.class).describedAs("404");
- }
-
- // With issue admin permission, a user can set severity on the issue
- assertThat(orchestrator.getServer().wsClient(user, "password").issueClient().setSeverity(issueOnSample.key(), "BLOCKER").severity()).isEqualTo("BLOCKER");
-
- } finally {
- client.userClient().deactivate(user);
- }
- }
-
- /**
- * SONAR-2447
- */
- @Test
- public void need_administer_issue_permission_on_project_to_flag_as_false_positive() {
- SonarClient client = orchestrator.getServer().adminWsClient();
- Issue issueOnSample = client.issueClient().find(IssueQuery.create().componentRoots("sample")).list().get(0);
- Issue issueOnSample2 = client.issueClient().find(IssueQuery.create().componentRoots("sample2")).list().get(0);
-
- String user = "user";
-
- try {
- client.userClient().create(UserParameters.create().login(user).name(user).password("password").passwordConfirmation("password"));
- addUserPermission(user, "sample", "issueadmin");
-
- // Without issue admin permission, a user cannot flag an issue as false positive
- try {
- orchestrator.getServer().wsClient(user, "password").issueClient().doTransition(issueOnSample2.key(), "falsepositive");
- fail();
- } catch (Exception e) {
- assertThat(e).isInstanceOf(HttpException.class).describedAs("404");
- }
-
- // With issue admin permission, a user can flag an issue as false positive
- assertThat(orchestrator.getServer().wsClient(user, "password").issueClient().doTransition(issueOnSample.key(), "falsepositive").status()).isEqualTo("RESOLVED");
-
- } finally {
- client.userClient().deactivate(user);
- }
- }
-
- /**
- * SONAR-2447
- */
- @Test
- public void need_administer_issue_permission_on_project_to_bulk_change_severity_and_false_positive() {
- SonarClient client = orchestrator.getServer().adminWsClient();
- Issue issueOnSample = client.issueClient().find(IssueQuery.create().componentRoots("sample")).list().get(0);
- Issue issueOnSample2 = client.issueClient().find(IssueQuery.create().componentRoots("sample2")).list().get(0);
-
- String user = "user";
-
- try {
- client.userClient().create(UserParameters.create().login(user).name(user).password("password").passwordConfirmation("password"));
- addUserPermission(user, "sample", "issueadmin");
-
- BulkChange bulkChange = orchestrator.getServer().wsClient(user, "password").issueClient().bulkChange(
- BulkChangeQuery.create().issues(issueOnSample.key(), issueOnSample2.key())
- .actions("set_severity", "do_transition")
- .actionParameter("do_transition", "transition", "falsepositive")
- .actionParameter("set_severity", "severity", "BLOCKER"));
-
- assertThat(bulkChange.totalIssuesChanged()).isEqualTo(1);
- assertThat(bulkChange.totalIssuesNotChanged()).isEqualTo(1);
-
- } finally {
- client.userClient().deactivate(user);
- }
- }
-
- private static void addUserPermission(String login, String projectKey, String permission) {
- orchestrator.getServer().adminWsClient().post("api/permissions/add_user",
- "login", login,
- "projectKey", projectKey,
- "permission", permission);
- }
-
- private static void removeGroupPermission(String groupName, String projectKey, String permission) {
- orchestrator.getServer().adminWsClient().post("api/permissions/remove_group",
- "groupName", groupName,
- "projectKey", projectKey,
- "permission", permission);
- }
-}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package permission.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import org.junit.ClassRule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-import static util.ItUtils.xooPlugin;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- IssuePermissionTest.class
-})
-public class PermissionTestSuite {
-
- @ClassRule
- public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv()
- .addPlugin(xooPlugin())
- .build();
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package plugins;
-
-import com.google.common.base.Joiner;
-import com.google.common.collect.Sets;
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.OrchestratorBuilder;
-import com.sonar.orchestrator.build.BuildResult;
-import com.sonar.orchestrator.build.SonarRunner;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ErrorCollector;
-import org.sonar.updatecenter.common.Plugin;
-import org.sonar.updatecenter.common.Release;
-import plugins.checks.AbapCheck;
-import plugins.checks.Check;
-import plugins.checks.CobolCheck;
-import plugins.checks.CssCheck;
-import plugins.checks.FlexCheck;
-import plugins.checks.GroovyCheck;
-import plugins.checks.JavaCheck;
-import plugins.checks.JavascriptCheck;
-import plugins.checks.PhpCheck;
-import plugins.checks.PythonCheck;
-import plugins.checks.RpgCheck;
-import plugins.checks.SwiftCheck;
-import plugins.checks.Validation;
-import plugins.checks.WebCheck;
-
-import static org.assertj.core.api.Assertions.fail;
-
-/**
- * Verify that the plugins available in update center
- * are correctly supported.
- */
-public class PluginsTest {
-
- /**
- * Temporarily disabled plugins. To be re-enabled.
- */
- static final Set<String> DISABLED_PLUGINS = Sets.newHashSet("devcockpit", "views",
- // internal plugin used for integration tests of language plugins
- "lits");
-
- static final Set<String> LICENSED_PLUGINS = Sets.newHashSet(
- "abap", "cobol", "cpp", "devcockpit", "objc", "pli", "plsql", "report", "rpg",
- "sqale", "swift", "vb", "vbnet", "views");
-
- static final Set<String> DISABLED_PLUGINS_FOR_PREVIEW_MODE = Sets.newHashSet("mantis",
-
- // Caused by: Access to the secured property 'sonar.scm.user.secured' is not possible in preview mode. The SonarQube plugin which requires
- // this property must be deactivated in preview mode.
- "scmstats");
-
- // TODO new PliCheck() is temporarily disabled as PLI plugin does not support multi-language feature. See sonar-project.properties
- // TODO new CCheck(), CppCheck() and VbCheck() are temporarily disabled as there is no version compatible with SQ 5.2 (they are using
- // Violation API).
- static final List<Check> CHECKS = Arrays.asList((Check) new AbapCheck(), new CobolCheck(), new CssCheck(),
- new FlexCheck(), new GroovyCheck(), new JavaCheck(), new JavascriptCheck(), new PhpCheck(), new RpgCheck(),
- new PythonCheck(), new SwiftCheck(), new WebCheck());
-
- static Orchestrator orchestrator;
-
- @BeforeClass
- public static void startServer() {
- OrchestratorBuilder builder = Orchestrator.builderEnv();
-
- // install latest compatible releases of plugins
- org.sonar.updatecenter.common.Version sonarVersion = org.sonar.updatecenter.common.Version.create(builder.getSonarVersion());
- builder.getUpdateCenter().setInstalledSonarVersion(sonarVersion);
- for (Plugin plugin : builder.getUpdateCenter().findAllCompatiblePlugins()) {
- if (!DISABLED_PLUGINS.contains(plugin.getKey())) {
- Release release = plugin.getLastCompatibleRelease(sonarVersion);
- if (release != null) {
- builder.setOrchestratorProperty(plugin.getKey() + "Version", release.getVersion().toString());
- builder.addPlugin(plugin.getKey());
- }
- }
- }
- activateLicenses(builder);
- orchestrator = builder.build();
- orchestrator.start();
- }
-
- @Rule
- public ErrorCollector errorCollector = new ErrorCollector();
-
- @Test
- public void analysis_of_project_with_all_supported_languages() {
- SonarRunner analysis = newAnalysis();
- BuildResult result = orchestrator.executeBuildQuietly(analysis);
- if (result.getStatus() != 0) {
- fail(result.getLogs());
- }
- for (Check check : CHECKS) {
- System.out.println(check.getClass().getSimpleName() + "...");
- check.validate(new Validation(orchestrator, errorCollector));
- }
- }
-
- @Test
- public void preview_analysis_of_project_with_all_supported_languages() {
- SonarRunner analysis = newAnalysis();
- analysis.setProperty("sonar.analysis.mode", "issues");
- analysis.setProperty("sonar.preview.excludePlugins", Joiner.on(",").join(DISABLED_PLUGINS_FOR_PREVIEW_MODE));
- BuildResult result = orchestrator.executeBuildQuietly(analysis);
- if (result.getStatus() != 0) {
- fail(result.getLogs());
- }
- }
-
- private static SonarRunner newAnalysis() {
- SonarRunner analysis = SonarRunner.create(Project.basedir());
- analysis.setEnvironmentVariable("SONAR_RUNNER_OPTS", "-XX:MaxPermSize=128m");
- return analysis;
- }
-
- private static void activateLicenses(OrchestratorBuilder builder) {
- for (String licensedPlugin : LICENSED_PLUGINS) {
- if (!DISABLED_PLUGINS.contains(licensedPlugin)) {
- builder.activateLicense(licensedPlugin);
- }
- }
- }
-
-}
+++ /dev/null
-package plugins;
-
-import com.google.common.base.Function;
-import java.io.File;
-import java.util.Collection;
-import javax.annotation.Nullable;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.FilenameUtils;
-import org.apache.commons.lang.StringUtils;
-import util.ItUtils;
-
-import static com.google.common.collect.FluentIterable.from;
-
-public class Project {
-
- public static File basedir() {
- return ItUtils.projectDir("plugins/project");
- }
-
- public static Iterable<String> allFilesInDir(final String dirPath) {
- Collection<File> files = FileUtils.listFiles(new File(basedir(), dirPath), null, true);
- return from(files).transform(new Function<File, String>() {
- @Nullable
- public String apply(File file) {
- // transforms /absolute/path/to/src/java/Foo.java to src/java/Foo.java
- String filePath = FilenameUtils.separatorsToUnix(file.getPath());
- return dirPath + StringUtils.substringAfterLast(filePath, dirPath);
- }
- });
- }
-}
+++ /dev/null
-package plugins.checks;
-
-public class AbapCheck implements Check {
-
- public static final String DIR = "src/abap";
-
- @Override
- public void validate(Validation validation) {
- validation.mustHaveNonEmptySource(DIR);
- validation.mustHaveIssues(DIR);
- validation.mustHaveSize(DIR);
- validation.mustHaveComments(DIR);
- validation.mustHaveComplexity(DIR);
- }
-}
+++ /dev/null
-package plugins.checks;
-
-public class CCheck implements Check {
-
- public static final String DIR = "src/c";
-
- @Override
- public void validate(Validation validation) {
- validation.mustHaveNonEmptySource(DIR);
- validation.mustHaveIssues(DIR);
- validation.mustHaveSize(DIR);
- validation.mustHaveComments(DIR);
- validation.mustHaveComplexity(DIR);
- }
-}
+++ /dev/null
-package plugins.checks;
-
-public interface Check {
- void validate(Validation validation);
-}
+++ /dev/null
-package plugins.checks;
-
-public class CobolCheck implements Check {
-
- public static final String DIR = "src/cobol";
-
- @Override
- public void validate(Validation validation) {
- validation.mustHaveNonEmptySource(DIR);
- validation.mustHaveIssues(DIR);
- validation.mustHaveSize(DIR);
- validation.mustHaveComments(DIR);
- validation.mustHaveComplexity(DIR);
- }
-}
+++ /dev/null
-package plugins.checks;
-
-public class CppCheck implements Check {
-
- public static final String DIR = "src/cpp";
-
- @Override
- public void validate(Validation validation) {
- validation.mustHaveNonEmptySource(DIR);
- validation.mustHaveIssues(DIR);
- validation.mustHaveSize(DIR);
- validation.mustHaveComments(DIR);
- validation.mustHaveComplexity(DIR);
- }
-}
+++ /dev/null
-package plugins.checks;
-
-public class CssCheck implements Check {
-
- public static final String DIR = "src/css";
-
- @Override
- public void validate(Validation validation) {
- validation.mustHaveNonEmptySource(DIR);
- validation.mustHaveIssues(DIR);
- validation.mustHaveSize(DIR);
- validation.mustHaveComments(DIR);
- }
-}
+++ /dev/null
-package plugins.checks;
-
-public class FlexCheck implements Check {
-
- public static final String DIR = "src/flex";
-
- @Override
- public void validate(Validation validation) {
- validation.mustHaveNonEmptySource(DIR);
- validation.mustHaveSize(DIR);
- validation.mustHaveComments(DIR);
- validation.mustHaveComplexity(DIR);
- validation.mustHaveIssues(DIR + "/HasIssues.as");
- }
-}
+++ /dev/null
-package plugins.checks;
-
-public class GroovyCheck implements Check {
-
- public static final String DIR = "src/groovy";
-
- @Override
- public void validate(Validation validation) {
- validation.mustHaveNonEmptySource(DIR);
- validation.mustHaveIssues(DIR);
- validation.mustHaveSize(DIR);
- validation.mustHaveComments(DIR);
- validation.mustHaveComplexity(DIR);
- }
-}
+++ /dev/null
-package plugins.checks;
-
-public class JavaCheck implements Check {
-
- public static final String DIR = "src/java";
-
- @Override
- public void validate(Validation validation) {
- validation.mustHaveNonEmptySource(DIR);
- validation.mustHaveIssues(DIR);
- validation.mustHaveSize(DIR);
- validation.mustHaveComments(DIR);
- validation.mustHaveComplexity(DIR);
- }
-}
+++ /dev/null
-package plugins.checks;
-
-public class JavascriptCheck implements Check {
-
- public static final String SRC_DIR = "src/js";
-
- @Override
- public void validate(Validation validation) {
- validation.mustHaveNonEmptySource(SRC_DIR);
- validation.mustHaveSize(SRC_DIR);
- validation.mustHaveComments(SRC_DIR);
- validation.mustHaveComplexity(SRC_DIR);
- validation.mustHaveIssues(SRC_DIR + "/HasIssues.js");
- validation.mustHaveMeasuresGreaterThan(SRC_DIR + "/Person.js", 0, "coverage");
- }
-}
+++ /dev/null
-package plugins.checks;
-
-public class PhpCheck implements Check {
-
- public static final String DIR = "src/php";
-
- @Override
- public void validate(Validation validation) {
- validation.mustHaveNonEmptySource(DIR);
- validation.mustHaveIssues(DIR);
- validation.mustHaveSize(DIR);
- validation.mustHaveComments(DIR);
- validation.mustHaveComplexity(DIR);
- }
-}
+++ /dev/null
-package plugins.checks;
-
-public class PliCheck implements Check {
-
- public static final String DIR = "src/pli";
-
- @Override
- public void validate(Validation validation) {
- validation.mustHaveNonEmptySource(DIR);
- validation.mustHaveSize(DIR);
- validation.mustHaveComments(DIR);
- validation.mustHaveComplexity(DIR);
- validation.mustHaveIssues(DIR + "/hasissues.pli");
- }
-}
+++ /dev/null
-package plugins.checks;
-
-import plugins.Project;
-
-public class PythonCheck implements Check {
-
- public static final String DIR = "src/python";
-
- @Override
- public void validate(Validation validation) {
- // all files have size measures, even empty __init__.py
- validation.mustHaveSize(DIR);
-
- for (String filePath : Project.allFilesInDir(DIR)) {
- if (filePath.endsWith("__init__.py")) {
- validation.mustHaveSource(filePath);
- } else {
- validation.mustHaveNonEmptySource(filePath);
- validation.mustHaveComments(filePath);
- validation.mustHaveComplexity(filePath);
- }
- }
-
- validation.mustHaveIssues(DIR + "/hasissues.py");
- }
-
-}
+++ /dev/null
-package plugins.checks;
-
-public class RpgCheck implements Check {
-
- public static final String DIR = "src/rpg";
-
- @Override
- public void validate(Validation validation) {
- validation.mustHaveNonEmptySource(DIR);
- validation.mustHaveIssues(DIR);
- validation.mustHaveSize(DIR);
- validation.mustHaveComments(DIR);
- validation.mustHaveComplexity(DIR);
- }
-}
+++ /dev/null
-package plugins.checks;
-
-public class SwiftCheck implements Check {
-
- public static final String DIR = "src/swift";
-
- @Override
- public void validate(Validation validation) {
- validation.mustHaveNonEmptySource(DIR);
- validation.mustHaveIssues(DIR);
- validation.mustHaveSize(DIR);
- validation.mustHaveComplexity(DIR);
- }
-}
+++ /dev/null
-package plugins.checks;
-
-import com.google.common.base.Joiner;
-import com.sonar.orchestrator.Orchestrator;
-import plugins.Project;
-import java.io.File;
-import org.hamcrest.Matchers;
-import org.junit.rules.ErrorCollector;
-import org.sonar.wsclient.services.Measure;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-import org.sonar.wsclient.services.Source;
-import org.sonar.wsclient.services.SourceQuery;
-
-import static java.util.Arrays.asList;
-import static org.hamcrest.CoreMatchers.notNullValue;
-
-/**
- *
- * TODO must have syntax highlighting
- * TODO must have duplications
- * TODO must have issues with SQALE characteristic and debt
- * TODO must have rules with characteristic
- * TODO must have tests
- * TODO must have coverage
- */
-public class Validation {
-
- private final Orchestrator orchestrator;
- private final ErrorCollector errorCollector;
-
- public Validation(Orchestrator orchestrator, ErrorCollector errorCollector) {
- this.orchestrator = orchestrator;
- this.errorCollector = errorCollector;
- }
-
- public void mustHaveIssues(String path) {
- // TODO use the WS api/issues
- mustHaveMeasuresGreaterThan(path, 1, "violations");
- }
-
- public void mustHaveComments(String path) {
- mustHaveMeasuresGreaterThan(path, 0, "comment_lines", "comment_lines_density");
- }
-
- public void mustHaveComplexity(String path) {
- mustHaveMeasuresGreaterThan(path, 0, "complexity");
- }
-
- public void mustHaveSize(String path) {
- mustHaveMeasuresGreaterThan(path, 0, "ncloc", "lines");
- }
-
- public void mustHaveMeasuresGreaterThan(String path, int min, String... metricKeys) {
- for (String filePath : toFiles(path)) {
- fileMustHaveMeasures(filePath, metricKeys, min);
- }
- }
-
- private void fileMustHaveMeasures(String filePath, String[] metricKeys, int min) {
- Resource resource = getMeasureForComponentKey(filePathToKey(filePath), metricKeys);
- errorCollector.checkThat("Measures " + Joiner.on(",").join(metricKeys) + " are set on file " + filePath, resource, notNullValue());
- if (resource != null) {
- for (String metricKey : metricKeys) {
- Measure measure = resource.getMeasure(metricKey);
- errorCollector.checkThat("Measure " + metricKey + " is set on file " + filePath, measure, notNullValue());
- if (measure != null && measure.getIntValue() != null) {
- errorCollector.checkThat("Measure " + metricKey + " is positive on file " + filePath, measure.getIntValue(), Matchers.greaterThanOrEqualTo(min));
- }
- }
- }
- }
-
- /**
- * Checks that each source file of the given directory is uploaded to server.
- * @param path relative path to source directory or source file
- */
- public void mustHaveNonEmptySource(String path) {
- mustHaveSourceWithAtLeast(path, 1);
- }
-
- public void mustHaveSource(String path) {
- mustHaveSourceWithAtLeast(path, 0);
- }
-
- private void mustHaveSourceWithAtLeast(String path, int minLines) {
- for (String filePath : toFiles(path)) {
- Source source = orchestrator.getServer().getWsClient().find(SourceQuery.create(filePathToKey(filePath)));
- errorCollector.checkThat("Source is set on file " + filePath, source, notNullValue());
- if (source != null) {
- errorCollector.checkThat("Source is not empty on file " + filePath, source.getLines().size(), Matchers.greaterThanOrEqualTo(minLines));
- }
- }
- }
-
- private Iterable<String> toFiles(String path) {
- File fileOrDir = new File(Project.basedir(), path);
- if (!fileOrDir.exists()) {
- throw new IllegalArgumentException("Path does not exist: " + fileOrDir);
- }
- if (fileOrDir.isDirectory()) {
- return Project.allFilesInDir(path);
- }
- return asList(path);
- }
-
- public Resource getMeasureForComponentKey(String resourceKey, String... metricKeys) {
- return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(resourceKey, metricKeys));
- }
-
- private String filePathToKey(String filePath) {
- return "all-langs:" + filePath;
- }
-}
+++ /dev/null
-package plugins.checks;
-
-public class VbCheck implements Check {
-
- public static final String DIR = "src/vb";
-
- @Override
- public void validate(Validation validation) {
- validation.mustHaveNonEmptySource(DIR);
- validation.mustHaveIssues(DIR);
- validation.mustHaveSize(DIR);
- validation.mustHaveComments(DIR);
- validation.mustHaveComplexity(DIR);
- }
-}
+++ /dev/null
-package plugins.checks;
-
-public class WebCheck implements Check {
-
- public static final String DIR = "src/web";
-
- @Override
- public void validate(Validation validation) {
- validation.mustHaveNonEmptySource(DIR);
- validation.mustHaveIssues(DIR);
- validation.mustHaveSize(DIR);
- validation.mustHaveComments(DIR);
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package qualitygate;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.SonarRunner;
-import com.sonar.orchestrator.selenium.Selenese;
-import java.util.Iterator;
-import javax.mail.internet.MimeMessage;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.wsclient.Sonar;
-import org.sonar.wsclient.qualitygate.NewCondition;
-import org.sonar.wsclient.qualitygate.QualityGate;
-import org.sonar.wsclient.qualitygate.QualityGateClient;
-import org.sonar.wsclient.services.Measure;
-import org.sonar.wsclient.services.PropertyUpdateQuery;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-import org.subethamail.wiser.Wiser;
-import org.subethamail.wiser.WiserMessage;
-import util.ItUtils;
-import util.NetworkUtils;
-import util.selenium.SeleneseTest;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static util.ItUtils.projectDir;
-
-public class QualityGateNotificationTest {
-
- private static final String PROJECT_KEY = "sample";
-
- @ClassRule
- public static Orchestrator orchestrator = Orchestrator.builderEnv()
- .addPlugin(ItUtils.xooPlugin())
-
- // 1 second. Required for notification test.
- .setServerProperty("sonar.notifications.delay", "1")
-
- .build();
-
- @Before
- public void cleanUp() {
- orchestrator.resetData();
- }
-
- @Test
- public void status_on_metric_variation_and_send_notifications() throws Exception {
- Wiser smtpServer = new Wiser(NetworkUtils.getNextAvailablePort());
- try {
- // Configure SMTP
- smtpServer.start();
- Sonar wsClient = orchestrator.getServer().getAdminWsClient();
- wsClient.update(new PropertyUpdateQuery("email.smtp_host.secured", "localhost"));
- wsClient.update(new PropertyUpdateQuery("email.smtp_port.secured", Integer.toString(smtpServer.getServer().getPort())));
-
- // Create user, who will receive notifications for new violations
- orchestrator.getServer().adminWsClient().post("api/users/create", "login", "tester", "name", "Tester", "email", "tester@example.org", "password", "tester");
- Selenese selenese = Selenese
- .builder()
- .setHtmlTestsInClasspath("notifications",
- "/qualitygate/notifications/email_configuration.html",
- "/qualitygate/notifications/activate_notification_channels.html").build();
- new SeleneseTest(selenese).runOn(orchestrator);
-
- // Create quality gate with conditions on variations
- QualityGate simple = qgClient().create("SimpleWithDifferential");
- qgClient().setDefault(simple.id());
- qgClient().createCondition(NewCondition.create(simple.id()).metricKey("ncloc").period(1).operator("EQ").warningThreshold("0"));
-
- SonarRunner analysis = SonarRunner.create(projectDir("qualitygate/xoo-sample"));
- orchestrator.executeBuild(analysis);
- assertThat(fetchGateStatus().getData()).isEqualTo("OK");
-
- orchestrator.executeBuild(analysis);
- assertThat(fetchGateStatus().getData()).isEqualTo("WARN");
-
- qgClient().unsetDefault();
- qgClient().destroy(simple.id());
-
- // Wait until all notifications are delivered
- Thread.sleep(10000);
-
- Iterator<WiserMessage> emails = smtpServer.getMessages().iterator();
-
- MimeMessage message = emails.next().getMimeMessage();
- assertThat(message.getHeader("To", null)).isEqualTo("<test@example.org>");
- assertThat((String) message.getContent()).contains("This is a test message from Sonar");
-
- assertThat(emails.hasNext()).isTrue();
- message = emails.next().getMimeMessage();
- assertThat(message.getHeader("To", null)).isEqualTo("<tester@example.org>");
- assertThat((String) message.getContent()).contains("Quality gate status: Orange (was Green)");
- assertThat((String) message.getContent()).contains("Quality gate threshold: Lines of code variation = 0 since previous analysis");
- assertThat((String) message.getContent()).contains("/dashboard/index/sample");
- assertThat(emails.hasNext()).isFalse();
-
- } finally {
- smtpServer.stop();
- }
- }
-
- private Measure fetchGateStatus() {
- return fetchResourceWithGateStatus().getMeasure("alert_status");
- }
-
- private Resource fetchResourceWithGateStatus() {
- return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT_KEY, "alert_status").setIncludeAlerts(true));
- }
-
- private static QualityGateClient qgClient() {
- return orchestrator.getServer().adminWsClient().qualityGateClient();
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package qualitygate;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.SonarRunner;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.wsclient.project.NewProject;
-import org.sonar.wsclient.qualitygate.NewCondition;
-import org.sonar.wsclient.qualitygate.QualityGate;
-import org.sonar.wsclient.qualitygate.QualityGateClient;
-import org.sonar.wsclient.services.Measure;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-import util.ItUtils;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static util.ItUtils.projectDir;
-
-public class QualityGateTest {
-
- private static final String PROJECT_KEY = "sample";
-
- private long provisionnedProjectId = -1L;
-
- @ClassRule
- public static Orchestrator orchestrator = Orchestrator.builderEnv()
- .addPlugin(ItUtils.xooPlugin())
-
- // 1 second. Required for notification test.
- .setServerProperty("sonar.notifications.delay", "1")
-
- .build();
-
- @Before
- public void cleanUp() {
- orchestrator.resetData();
- provisionnedProjectId = Long.parseLong(orchestrator.getServer().adminWsClient().projectClient().create(NewProject.create().key(PROJECT_KEY).name("Sample")).id());
- }
-
- @Test
- public void do_not_compute_status_if_no_gate() {
- SonarRunner build = SonarRunner.create(projectDir("qualitygate/xoo-sample"));
- orchestrator.executeBuild(build);
-
- assertThat(fetchResourceWithGateStatus()).isNull();
- }
-
- @Test
- public void status_ok_if_empty_gate() {
- QualityGate empty = qgClient().create("Empty");
- qgClient().setDefault(empty.id());
-
- try {
- SonarRunner build = SonarRunner.create(projectDir("qualitygate/xoo-sample"));
- orchestrator.executeBuild(build);
-
- assertThat(fetchGateStatus().getData()).isEqualTo("OK");
- } finally {
- qgClient().unsetDefault();
- qgClient().destroy(empty.id());
- }
- }
-
- @Test
- public void test_status_ok() {
- QualityGate simple = qgClient().create("SimpleWithHighThreshold");
- qgClient().setDefault(simple.id());
- qgClient().createCondition(NewCondition.create(simple.id()).metricKey("ncloc").operator("GT").warningThreshold("40"));
-
- try {
- SonarRunner build = SonarRunner.create(projectDir("qualitygate/xoo-sample"));
- orchestrator.executeBuild(build);
-
- assertThat(fetchGateStatus().getData()).isEqualTo("OK");
- } finally {
- qgClient().unsetDefault();
- qgClient().destroy(simple.id());
- }
- }
-
- @Test
- public void test_status_warning() {
- QualityGate simple = qgClient().create("SimpleWithLowThreshold");
- qgClient().setDefault(simple.id());
- qgClient().createCondition(NewCondition.create(simple.id()).metricKey("ncloc").operator("GT").warningThreshold("10"));
-
- try {
- SonarRunner build = SonarRunner.create(projectDir("qualitygate/xoo-sample"));
- orchestrator.executeBuild(build);
-
- assertThat(fetchGateStatus().getData()).isEqualTo("WARN");
- } finally {
- qgClient().unsetDefault();
- qgClient().destroy(simple.id());
- }
-
- }
-
- @Test
- public void test_status_error() {
- QualityGate simple = qgClient().create("SimpleWithLowThreshold");
- qgClient().setDefault(simple.id());
- qgClient().createCondition(NewCondition.create(simple.id()).metricKey("ncloc").operator("GT").errorThreshold("10"));
-
- try {
- SonarRunner build = SonarRunner.create(projectDir("qualitygate/xoo-sample"));
- orchestrator.executeBuild(build);
-
- assertThat(fetchGateStatus().getData()).isEqualTo("ERROR");
- } finally {
- qgClient().unsetDefault();
- qgClient().destroy(simple.id());
- }
- }
-
- @Test
- public void use_server_settings_instead_of_default_gate() {
- QualityGate alert = qgClient().create("AlertWithLowThreshold");
- qgClient().createCondition(NewCondition.create(alert.id()).metricKey("ncloc").operator("GT").warningThreshold("10"));
- QualityGate error = qgClient().create("ErrorWithLowThreshold");
- qgClient().createCondition(NewCondition.create(error.id()).metricKey("ncloc").operator("GT").errorThreshold("10"));
-
- qgClient().setDefault(alert.id());
- qgClient().selectProject(error.id(), provisionnedProjectId);
-
- try {
- SonarRunner build = SonarRunner.create(projectDir("qualitygate/xoo-sample"));
- orchestrator.executeBuild(build);
-
- assertThat(fetchGateStatus().getData()).isEqualTo("ERROR");
- } finally {
- qgClient().unsetDefault();
- qgClient().destroy(alert.id());
- qgClient().destroy(error.id());
- }
- }
-
- @Test
- public void conditions_on_multiple_metric_types() {
- QualityGate allTypes = qgClient().create("AllMetricTypes");
- qgClient().createCondition(NewCondition.create(allTypes.id()).metricKey("ncloc").operator("GT").warningThreshold("10"));
- qgClient().createCondition(NewCondition.create(allTypes.id()).metricKey("duplicated_lines_density").operator("GT").warningThreshold("20"));
- qgClient().setDefault(allTypes.id());
-
- try {
- SonarRunner build = SonarRunner.create(projectDir("qualitygate/xoo-sample"))
- .setProperty("sonar.cpd.xoo.minimumLines", "2")
- .setProperty("sonar.cpd.xoo.minimumTokens", "5");
- orchestrator.executeBuild(build);
-
- Measure alertStatus = fetchGateStatus();
- assertThat(alertStatus.getData()).isEqualTo("WARN");
- assertThat(alertStatus.getAlertText())
- .contains("Lines of code > 10")
- .contains("Duplicated lines (%) > 20");
- } finally {
- qgClient().unsetDefault();
- qgClient().destroy(allTypes.id());
- }
- }
-
- private Measure fetchGateStatus() {
- return fetchResourceWithGateStatus().getMeasure("alert_status");
- }
-
- private Resource fetchResourceWithGateStatus() {
- return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT_KEY, "alert_status").setIncludeAlerts(true));
- }
-
- private static QualityGateClient qgClient() {
- return orchestrator.getServer().adminWsClient().qualityGateClient();
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package server;
-
-import com.sonar.orchestrator.Orchestrator;
-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 util.NetworkUtils;
-
-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("/server/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("/server/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");
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package server;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.SonarRunner;
-import com.sonar.orchestrator.locator.FileLocation;
-import com.sonar.orchestrator.selenium.Selenese;
-import java.io.File;
-import java.net.URL;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.SystemUtils;
-import org.junit.After;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.wsclient.services.Server;
-import org.sonar.wsclient.services.ServerQuery;
-import util.ItUtils;
-import util.selenium.SeleneseTest;
-
-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();
- }
- }
-
- @Test
- public void test_settings() {
- URL secretKeyUrl = getClass().getResource("/server/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",
- "/server/ServerTest/settings/general-settings.html",
-
- // SONAR-2869 the annotation @Properties can be used on extensions and not only on plugin entry points
- "/server/ServerTest/settings/hidden-extension-property.html",
- "/server/ServerTest/settings/global-extension-property.html",
-
- // SONAR-3344 - licenses
- "/server/ServerTest/settings/ignore-corrupted-license.html",
- "/server/ServerTest/settings/display-license.html",
- "/server/ServerTest/settings/display-untyped-license.html",
-
- // SONAR-2084 - encryption
- "/server/ServerTest/settings/generate-secret-key.html",
- "/server/ServerTest/settings/encrypt-text.html",
-
- // SONAR-1378 - property types
- "/server/ServerTest/settings/validate-property-type.html",
-
- // SONAR-3127 - hide passwords
- "/server/ServerTest/settings/hide-passwords.html"
- ).build();
- new SeleneseTest(selenese).runOn(orchestrator);
- }
-
- @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",
- "/server/ServerTest/settings/property_relocation.html"
- ).build();
- new SeleneseTest(selenese).runOn(orchestrator);
- }
-
- /**
- * 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("/server/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");
- }
- }
-
- @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-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");
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package server.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 util.selenium.SeleneseTest;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.fail;
-
-public class ServerAdministrationTest {
-
- @ClassRule
- public static final Orchestrator orchestrator = ServerTestSuite.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",
- "/server/ServerAdministrationTest/server_id/missing_ip.html",
- // SONAR-4102
- "/server/ServerAdministrationTest/server_id/organisation_must_not_accept_special_chars.html",
- "/server/ServerAdministrationTest/server_id/valid_id.html").build();
- new SeleneseTest(selenese).runOn(orchestrator);
- }
-
- @Test
- public void display_system_info() {
- Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("server-administration",
- "/server/ServerAdministrationTest/server-administration/system_info.html"
- ).build();
- new SeleneseTest(selenese).runOn(orchestrator);
- }
-
- /**
- * 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();
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package server.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.SonarRunner;
-import com.sonar.orchestrator.selenium.Selenese;
-import java.io.IOException;
-import org.apache.commons.io.FileUtils;
-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.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 util.ItUtils;
-import util.selenium.SeleneseTest;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class ServerTest {
-
- @ClassRule
- public static final Orchestrator orchestrator = ServerTestSuite.ORCHESTRATOR;
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Before
- public void cleanDatabase() {
- orchestrator.resetData();
- }
-
- /**
- * See http://jira.codehaus.org/browse/SONAR-2727
- */
- @Test
- public void display_warnings_when_using_h2() {
- if (orchestrator.getConfiguration().getString("sonar.jdbc.dialect").equals("h2")) {
- Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("derby-warnings",
- "/server/ServerTest/derby-warning.html").build();
- new SeleneseTest(selenese).runOn(orchestrator);
- }
- }
-
- /**
- * See http://jira.codehaus.org/browse/SONAR-2840
- */
- @Test
- public void hide_jdbc_settings_to_non_admin() {
- Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("jdbc-settings",
- "/server/ServerTest/hide-jdbc-settings.html").build();
- new SeleneseTest(selenese).runOn(orchestrator);
- }
-
- /**
- * SONAR-5542
- */
- @Test
- public void force_authentication_should_be_used_on_java_web_services_but_not_on_batch_index_and_file() throws IOException {
- 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.getServer().adminWsClient().post("api/properties/create?id=globalPropertyChange.received&value=NEWVALUE");
- assertThat(FileUtils.readFileToString(orchestrator.getServer().getLogs()).contains("Received change: NEWVALUE"));
- }
-
- /**
- * SONAR-3962
- */
- @Test
- public void not_fail_with_url_ending_by_jsp() {
- 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",
- "/server/ServerTest/url_ending_by_jsp.html").build();
- new SeleneseTest(selenese).runOn(orchestrator);
- }
-
- // SONAR-4404
- @Test
- public void should_get_settings_default_value() {
- Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("settings-default-value",
- "/server/ServerTest/settings-default-value.html").build();
- new SeleneseTest(selenese).runOn(orchestrator);
- }
-
-}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-package server.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import org.junit.ClassRule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import util.ItUtils;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- ServerAdministrationTest.class,
- WebServiceTest.class,
- ServerTest.class
-})
-public class ServerTestSuite {
-
- @ClassRule
- public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv()
- .addPlugin(ItUtils.xooPlugin())
-
- // Used in global_property_change_extension_point
- .addPlugin(ItUtils.pluginArtifact("global-property-change-plugin"))
-
- // Used in should_get_settings_default_value
- .addPlugin(ItUtils.pluginArtifact("server-plugin"))
-
- .build();
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package server.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 final Orchestrator orchestrator = ServerTestSuite.ORCHESTRATOR;
-
- @Before
- public void inspectProject() {
- orchestrator.resetData();
- orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample")));
- }
-
- @Test
- public void favourites_web_service() {
- 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();
- }
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package updatecenter;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.selenium.Selenese;
-import java.util.List;
-import org.apache.commons.lang.StringUtils;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.wsclient.services.Plugin;
-import org.sonar.wsclient.services.UpdateCenterQuery;
-import util.selenium.SeleneseTest;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static util.ItUtils.pluginArtifact;
-
-public class UpdateCenterTest {
-
- @ClassRule
- public static Orchestrator orchestrator = Orchestrator.builderEnv()
- .setServerProperty("sonar.updatecenter.url", UpdateCenterTest.class.getResource("UpdateCenterTest/update-center.properties").toString())
- .addPlugin(pluginArtifact("sonar-fake-plugin"))
- .build();
-
- @Test
- public void web_service_should_return_installed_plugins() {
- List<Plugin> plugins = orchestrator.getServer().getAdminWsClient().findAll(UpdateCenterQuery.createForInstalledPlugins());
- assertThat(plugins.size()).isGreaterThan(0);
-
- Plugin installedPlugin = findPlugin(plugins, "fake");
-
- assertThat(installedPlugin).isNotNull();
- assertThat(installedPlugin.getName()).isEqualTo("Plugins :: Fake");
- assertThat(installedPlugin.getVersion()).isEqualTo("1.0-SNAPSHOT");
- }
-
- @Test
- public void test_console() {
- Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("server-update-center",
- "/updatecenter/installed-plugins.html")
- .build();
- new SeleneseTest(selenese).runOn(orchestrator);
- }
-
- private Plugin findPlugin(List<Plugin> plugins, String pluginKey) {
- for (Plugin plugin : plugins) {
- if (StringUtils.equals(pluginKey, plugin.getKey())) {
- return plugin;
- }
- }
- return null;
- }
-
-}
+++ /dev/null
-<?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>bulk-delete-filter-projects</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/sessions/login</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/projects</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>content</td>
- <td>*Bar-Sonar-Plugin*Foo-Application*Sample-Project*</td>
-</tr>
-<tr>
- <td>type</td>
- <td>css=.search-box-input</td>
- <td>s</td>
-</tr>
-<tr>
- <td>click</td>
- <td>css=.search-box-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>content</td>
- <td>*Bar-Sonar-Plugin*Sample-Project*</td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>content</td>
- <td>*cameleon-3*cameleon-1*</td>
-</tr>
-<tr>
- <td>assertTextNotPresent</td>
- <td>content</td>
- <td>*Foo-Application*</td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>bulk-delete-selected-projects</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/sessions/login</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/bulk_deletion</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>content</td>
- <td>*Bar-Sonar-Plugin*Foo-Application*Sample-Project*</td>
- </tr>
- <tr>
- <td>click</td>
- <td>id=r-0</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>id=r-2</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>id=delete_resources</td>
- <td></td>
- </tr>
- <tr>
- <td>assertConfirmation</td>
- <td>Are you sure you want to delete the selected resources?</td>
- <td></td>
- </tr>
- <tr>
- <td>pause</td>
- <td>12000</td>
- <td>NOTE: necessary as the deletion is asynchronous</td>
- </tr>
- <tr>
- <td>assertElementNotPresent</td>
- <td>id=r-1</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>content</td>
- <td>*Foo-Application*</td>
- </tr>
- <tr>
- <td>assertTextNotPresent</td>
- <td>content</td>
- <td>*Bar-Sonar-Plugin*Sample-Project*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>should-display-alerts-correctly-history-page</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <thead>
- <tr>
- <td rowspan="1" colspan="3">should-display-alerts-correctly-history-page</td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/sessions/login</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/dashboard/index/sample</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=#context-navigation .navbar-admin-link</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForElementPresent</td>
- <td>link=History</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>link=History</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementPresent</td>
- <td>//img[@title='Quality Gate Status: Green (was Orange). ']</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementPresent</td>
- <td>//img[@title='Quality Gate Status: Orange. Lines > 5']</td>
- <td></td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>should-display-alerts-correctly-history-page</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <thead>
- <tr>
- <td rowspan="1" colspan="3">should-display-alerts-correctly-history-page</td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/sessions/login</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/widget?id=alerts&resource=sample</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>class=alerts</td>
- <td>glob:*Lines*0 < 10*since previous analysis*</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>class=alert_ERROR</td>
- <td>0</td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>override-global-settings</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <thead>
- <tr>
- <td rowspan="1" colspan="3">override-global-settings</td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/sessions/logout</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/project/settings/com.sonarsource.it.samples%3Amulti-modules-sample%3Amodule_a</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>plugins</td>
- <td>*Settings*</td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ SonarQube, open source software quality management tool.
- ~ Copyright (C) 2008-2014 SonarSource
- ~ mailto:contact AT sonarsource DOT com
- ~
- ~ SonarQube is free software; you can redistribute it and/or
- ~ modify it under the terms of the GNU Lesser General Public
- ~ License as published by the Free Software Foundation; either
- ~ version 3 of the License, or (at your option) any later version.
- ~
- ~ SonarQube is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public License
- ~ along with this program; if not, write to the Free Software Foundation,
- ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- -->
-
-<!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>multimodule-project-delete-version</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <thead>
- <tr>
- <td rowspan="1" colspan="3">project-modify-versions</td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/sessions/logout</td>
- <td></td>
- </tr>
- <tr>
- <td>open</td>
- <td>/sonar/sessions/login</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/project/history/com.sonarsource.it.samples:multi-modules-sample</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>link=Remove</td>
- <td></td>
- </tr>
- <tr>
- <td>assertConfirmation</td>
- <td>Are you sure you want to remove "RELEASE" from this snapshot?</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>infomsg</td>
- <td>glob:*Version "RELEASE" was removed from current project and all its sub-projects*</td>
- </tr>
- <tr>
- <td>assertNotText</td>
- <td>version_1</td>
- <td>glob:*RELEASE*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ SonarQube, open source software quality management tool.
- ~ Copyright (C) 2008-2014 SonarSource
- ~ mailto:contact AT sonarsource DOT com
- ~
- ~ SonarQube is free software; you can redistribute it and/or
- ~ modify it under the terms of the GNU Lesser General Public
- ~ License as published by the Free Software Foundation; either
- ~ version 3 of the License, or (at your option) any later version.
- ~
- ~ SonarQube is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public License
- ~ along with this program; if not, write to the Free Software Foundation,
- ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- -->
-
-<!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>multimodule-project-modify-version</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <thead>
- <tr>
- <td rowspan="1" colspan="3">project-modify-versions</td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/sessions/logout</td>
- <td></td>
- </tr>
- <tr>
- <td>open</td>
- <td>/sonar/sessions/login</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/project/history/com.sonarsource.it.samples:multi-modules-sample</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementNotPresent</td>
- <td>link=Remove</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>version_1_change</td>
- <td></td>
- </tr>
- <tr>
- <td>type</td>
- <td>version_name_1</td>
- <td>RELEASE</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>save_version_1</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForElementPresent</td>
- <td>infomsg</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>infomsg</td>
- <td>Version "RELEASE" was created for current project and all its sub-projects.</td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>version_1</td>
- <td>glob:*RELEASE*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>project-deletion</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <thead>
- <tr>
- <td rowspan="1" colspan="3">project-deletion</td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/sessions/logout</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/sessions/login</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>login</td>
- <td>project-deletion-with-admin-permission-on-project</td>
-</tr>
-<tr>
- <td>type</td>
- <td>password</td>
- <td>password</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>commit</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/</td>
- <td></td>
-</tr>
-<tr>
- <td>assertTextPresent</td>
- <td>Sample</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/dashboard/index/sample</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>css=#context-navigation .navbar-admin-link</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>link=Deletion</td>
- <td></td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>link=Deletion</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>delete_resource</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>delete-project-form</td>
- <td>*Delete Project*</td>
-</tr>
-<tr>
- <td>click</td>
- <td>delete-project-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>pause</td>
- <td>3000</td>
- <td>NOTE: necessary as the deletion is asynchronous</td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/</td>
- <td></td>
-</tr>
-<tr>
- <td>assertTextNotPresent</td>
- <td>content</td>
- <td>*Sample*</td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>override-global-settings</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <thead>
- <tr>
- <td rowspan="1" colspan="3">override-global-settings</td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/sessions/logout</td>
- <td></td>
- </tr>
- <tr>
- <td>open</td>
- <td>/sonar/project/settings/sample?category=project-only</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_prop_only_on_project</td>
- <td>foo</td>
- </tr>
- <tr>
- <td>click</td>
- <td>id=submit_settings</td>
- <td></td>
- </tr>
- <tr>
- <td>assertValue</td>
- <td>id=input_prop_only_on_project</td>
- <td>foo</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>override-global-settings</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <thead>
- <tr>
- <td rowspan="1" colspan="3">override-global-settings</td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/sessions/logout</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/project/settings/sample?category=exclusions&subcategory=files</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_sonar.skippedModules</td>
- <td>my-excluded-module</td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=submit_settings</td>
- <td></td>
-</tr>
-<tr>
- <td>assertValue</td>
- <td>id=input_sonar.skippedModules</td>
- <td>my-excluded-module</td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>bulk-update-impossible-because-duplicate-keys</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/sessions/login</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/dashboard/index/com.sonarsource.it.samples:multi-modules-sample</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>css=#context-navigation .navbar-admin-link</td>
- <td></td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>link=Update Key</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=string_to_replace</td>
- <td>com.sonarsource.it.samples:multi-modules-sample:module_a </td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=replacement_string</td>
- <td>com.sonarsource.it.samples:multi-modules-sample:module_b </td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>id=bulk_update_button</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>content</td>
- <td>*Bulk update can not be performed*The replacement of "com.sonarsource.it.samples:multi-modules-sample:module_a" by "com.sonarsource.it.samples:multi-modules-sample:module_b" is impossible as it would result in duplicate keys (in red below):*</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>content</td>
- <td>*Duplicate key*</td>
-</tr>
-<tr>
- <td>assertElementNotPresent</td>
- <td>id=bulk_update_button</td>
- <td></td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>Link=Back</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>content</td>
- <td>*Update Key*com.sonarsource.it.samples:multi-modules-sample*</td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>bulk-update-impossible-because-no-input</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/sessions/login</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/dashboard/index/com.sonarsource.it.samples:multi-modules-sample</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=#context-navigation .navbar-admin-link</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForElementPresent</td>
- <td>link=Update Key</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>link=Update Key</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>id=bulk_update_button</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>content</td>
- <td>*The two fields can not be blank for the bulk update.*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>bulk-update-impossible-because-no-match</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/sessions/login</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/dashboard/index/com.sonarsource.it.samples:multi-modules-sample</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=#context-navigation .navbar-admin-link</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForElementPresent</td>
- <td>link=Update Key</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>link=Update Key</td>
- <td></td>
- </tr>
- <tr>
- <td>type</td>
- <td>id=string_to_replace</td>
- <td>foo</td>
- </tr>
- <tr>
- <td>type</td>
- <td>id=replacement_string</td>
- <td>org.sonar</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>id=bulk_update_button</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>content</td>
- <td>*Bulk update can not be performed*No key contains the string to replace ("foo").*</td>
- </tr>
- <tr>
- <td>assertElementNotPresent</td>
- <td>id=bulk_update_button</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>Link=Back</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>content</td>
- <td>*Update Key*com.sonarsource.it.samples:multi-modules-sample*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>bulk-update-success</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/sessions/login</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/dashboard/index/com.sonarsource.it.samples:multi-modules-sample</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>css=#context-navigation .navbar-admin-link</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>link=Update Key</td>
- <td></td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>link=Update Key</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=string_to_replace</td>
- <td>com.sonarsource</td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=replacement_string</td>
- <td>org.sonar</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>id=bulk_update_button</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>content</td>
- <td>*Do you really want to perform the bulk update on project keys?*</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>content</td>
- <td>*com.sonarsource.it.samples:multi-modules-sample*org.sonar.it.samples:multi-modules-sample*</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>content</td>
- <td>*com.sonarsource.it.samples:multi-modules-sample:module_a*org.sonar.it.samples:multi-modules-sample:module_a*</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>id=bulk_update_button</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>content</td>
- <td>*The key has successfully been updated for all required resources.*</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>content</td>
- <td>*org.sonar.it.samples:multi-modules-sample*</td>
-</tr>
-<tr>
- <td>assertTextNotPresent</td>
- <td>content</td>
- <td>*com.sonarsource.it.samples:multi-modules-sample*</td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>fine-grained-update-impossible</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/sessions/login</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/dashboard/index/com.sonarsource.it.samples:multi-modules-sample</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=#context-navigation .navbar-admin-link</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForElementPresent</td>
- <td>link=Update Key</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>link=Update Key</td>
- <td></td>
- </tr>
- <tr>
- <td>type</td>
- <td>id=key_05</td>
- <td>com.sonarsource.it.samples:multi-modules-sample:module_b</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>id=update_key_05</td>
- <td></td>
- </tr>
- <tr>
- <td>assertConfirmation</td>
- <td>*Are you sure you want to rename "com.sonarsource.it.samples:multi-modules-sample:module_*", as well as all its modules and resources?*</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>id=error</td>
- <td>*"com.sonarsource.it.samples:multi-modules-sample:module_*" can not be renamed because "com.sonarsource.it.samples:multi-modules-sample:module_b" is the key of an existing resource. The update has been canceled.*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>fine-grained-update-success</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/sessions/login</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/dashboard/index/com.sonarsource.it.samples:multi-modules-sample</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=#context-navigation .navbar-admin-link</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForElementPresent</td>
- <td>link=Update Key</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>link=Update Key</td>
- <td></td>
- </tr>
- <tr>
- <td>type</td>
- <td>id=key_02</td>
- <td>com.sonarsource.it.samples:module_c1</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>id=update_key_02</td>
- <td></td>
- </tr>
- <tr>
- <td>assertConfirmation</td>
- <td>*Are you sure you want to rename "com.sonarsource.it.samples:multi-modules-sample:module_*", as well as all its modules and resources?*</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>content</td>
- <td>*The key has successfully been updated for all required resources.*</td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>content</td>
- <td>*com.sonarsource.it.samples:module_c1*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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</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?category=DEV</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForValue</td>
- <td>name=page_version</td>
- <td>1</td>
- </tr>
- <tr>
- <td>type</td>
- <td>id=input_value</td>
- <td>FIRST</td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=button.add_value</td>
- <td></td>
- </tr>
- <tr>
- <td>type</td>
- <td>xpath=(//input[@id='input_value'])[2]</td>
- <td>SECOND</td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=button.add_value</td>
- <td></td>
- </tr>
- <tr>
- <td>type</td>
- <td>xpath=(//input[@id='input_value'])[3]</td>
- <td>THIRD</td>
- </tr>
- <tr>
- <td>click</td>
- <td>id=submit_settings</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForValue</td>
- <td>name=page_version</td>
- <td>2</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>update</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?category=DEV</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForValue</td>
- <td>name=page_version</td>
- <td>1</td>
- </tr>
- <tr>
- <td>click</td>
- <td>link=Delete</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>id=submit_settings</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForValue</td>
- <td>name=page_version</td>
- <td>2</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>all_types</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?category=DEV</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForValue</td>
- <td>name=page_version</td>
- <td>1</td>
- </tr>
- <tr>
- <td>type</td>
- <td>id=input_text</td>
- <td>text</td>
- </tr>
- <tr>
- <td>select</td>
- <td>id=input_boolean</td>
- <td>label=True</td>
- </tr>
- <tr>
- <td>type</td>
- <td>id=input_float</td>
- <td>42.0</td>
- </tr>
- <tr>
- <td>type</td>
- <td>id=input_license</td>
- <td>abc</td>
- </tr>
- <tr>
- <td>select</td>
- <td>id=input_metric</td>
- <td>label=Overall condition coverage</td>
- </tr>
- <tr>
- <td>type</td>
- <td>id=input_password</td>
- <td>abcde</td>
- </tr>
- <tr>
- <td>type</td>
- <td>id=input_regexp</td>
- <td>.*</td>
- </tr>
- <tr>
- <td>select</td>
- <td>id=input_list</td>
- <td>label=AAA</td>
- </tr>
- <tr>
- <td>click</td>
- <td>id=submit_settings</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForValue</td>
- <td>name=page_version</td>
- <td>2</td>
- </tr>
- <tr>
- <td>assertValue</td>
- <td>id=input_text</td>
- <td>text</td>
- </tr>
- <tr>
- <td>assertValue</td>
- <td>id=input_boolean</td>
- <td>true</td>
- </tr>
- <tr>
- <td>assertValue</td>
- <td>id=input_float</td>
- <td>42.0</td>
- </tr>
- <tr>
- <td>assertValue</td>
- <td>id=input_license</td>
- <td>abc</td>
- </tr>
- <tr>
- <td>assertValue</td>
- <td>id=input_metric</td>
- <td>overall_branch_coverage</td>
- </tr>
- <tr>
- <td>assertValue</td>
- <td>id=input_password</td>
- <td>{{*******************}}</td>
- </tr>
- <tr>
- <td>assertValue</td>
- <td>id=input_regexp</td>
- <td>exact:.*</td>
- </tr>
- <tr>
- <td>assertValue</td>
- <td>id=input_list</td>
- <td>AAA</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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</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?category=DEV</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForValue</td>
- <td>name=page_version</td>
- <td>1</td>
- </tr>
- <tr>
- <td>type</td>
- <td>id=input_key</td>
- <td>jira1</td>
- </tr>
- <tr>
- <td>type</td>
- <td>id=input_url</td>
- <td>http://jira</td>
- </tr>
- <tr>
- <td>type</td>
- <td>id=input_port</td>
- <td>12345</td>
- </tr>
- <tr>
- <td>click</td>
- <td>id=submit_settings</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForValue</td>
- <td>name=page_version</td>
- <td>2</td>
- </tr>
- <tr>
- <td>assertValue</td>
- <td>id=input_key</td>
- <td>jira1</td>
- </tr>
- <tr>
- <td>assertValue</td>
- <td>id=input_url</td>
- <td>exact:http://jira</td>
- </tr>
- <tr>
- <td>assertValue</td>
- <td>id=input_port</td>
- <td>12345</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>delete</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?category=DEV</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForValue</td>
- <td>name=page_version</td>
- <td>1</td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=input_key</td>
- <td>jira1</td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=input_url</td>
- <td>http://jira1</td>
-</tr>
-<tr>
- <td>click</td>
- <td>css=#block_sonar\.test\.jira\.servers .add_value</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>xpath=(//input[@id='input_key'])[2]</td>
- <td>jira2</td>
-</tr>
-<tr>
- <td>type</td>
- <td>xpath=(//input[@id='input_url'])[2]</td>
- <td>http://jira2</td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=submit_settings</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForValue</td>
- <td>name=page_version</td>
- <td>2</td>
-</tr>
-<tr>
- <td>assertValue</td>
- <td>xpath=(//input[@id='input_key'])[1]</td>
- <td>jira1</td>
-</tr>
-<tr>
- <td>assertValue</td>
- <td>xpath=(//input[@id='input_key'])[2]</td>
- <td>jira2</td>
-</tr>
-<tr>
- <td>click</td>
- <td>xpath=(//a[contains(text(),'Delete')])[3]</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=submit_settings</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForValue</td>
- <td>name=page_version</td>
- <td>3</td>
-</tr>
-<tr>
- <td>assertValue</td>
- <td>xpath=(//input[@id='input_key'])[1]</td>
- <td>jira1</td>
-</tr>
-<tr>
- <td>waitForNotText</td>
- <td>xpath=(//input[@id='input_key'])</td>
- <td>*jira2*</td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>reference</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?category=DEV</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForValue</td>
- <td>name=page_version</td>
- <td>1</td>
- </tr>
- <tr>
- <td>type</td>
- <td>xpath=(//input[@id='input_key'])[1]</td>
- <td>jira1</td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=#block_sonar\.test\.jira\.servers .add_value</td>
- <td></td>
- </tr>
- <tr>
- <td>type</td>
- <td>xpath=(//input[@id='input_key'])[2]</td>
- <td>jira2</td>
- </tr>
- <tr>
- <td>click</td>
- <td>id=submit_settings</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForValue</td>
- <td>name=page_version</td>
- <td>2</td>
- </tr>
- <tr>
- <td>assertSelectOptions</td>
- <td>id=input_sonar.test.jira</td>
- <td>Default,jira1,jira2</td>
- </tr>
- <tr>
- <td>click</td>
- <td>xpath=(//a[contains(text(),'Delete')])[2]</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>id=submit_settings</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForValue</td>
- <td>name=page_version</td>
- <td>3</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>global-subcategories</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?category=Category 2</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForValue</td>
- <td>name=page_version</td>
- <td>1</td>
- </tr>
- <!-- First subcategory should be selected by default -->
- <tr>
- <td>assertElementPresent</td>
- <td>id=input_prop2_1</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementNotPresent</td>
- <td>id=input_prop2_2</td>
- <td></td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>global-subcategories</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?category=Category 1</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForValue</td>
- <td>name=page_version</td>
- <td>1</td>
- </tr>
- <tr>
- <td>assertElementNotPresent</td>
- <td>id=input_prop1</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementNotPresent</td>
- <td>id=input_prop2</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementNotPresent</td>
- <td>id=input_prop3</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementPresent</td>
- <td>id=input_prop4</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>link=Sub category 1</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementPresent</td>
- <td>id=input_prop1</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementPresent</td>
- <td>id=input_prop2</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementNotPresent</td>
- <td>id=input_prop3</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementNotPresent</td>
- <td>id=input_prop4</td>
- <td></td>
- </tr>
- <!-- Verify index attribute is taken into account -->
- <tr>
- <td>assertElementPresent</td>
- <td>xpath=//.[@id='input_prop2']/following::input[@id='input_prop1']</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>link=Sub category 2</td>
- <td></td>
- </tr>
- <tr>
- <td>type</td>
- <td>id=input_prop3</td>
- <td>myValue</td>
- </tr>
- <tr>
- <td>click</td>
- <td>id=submit_settings</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForValue</td>
- <td>name=page_version</td>
- <td>2</td>
- </tr>
- <tr>
- <td>assertElementNotPresent</td>
- <td>id=input_prop1</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementNotPresent</td>
- <td>id=input_prop2</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementPresent</td>
- <td>id=input_prop3</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementNotPresent</td>
- <td>id=input_prop4</td>
- <td></td>
- </tr>
- <tr>
- <td>assertValue</td>
- <td>id=input_prop3</td>
- <td>myValue</td>
- </tr>
- <!-- SONAR-4473 -->
- <tr>
- <td>clickAndWait</td>
- <td>link=Sub category 1</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementPresent</td>
- <td>id=input_prop1</td>
- <td></td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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</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/project/settings/sample?category=Category 2</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForValue</td>
- <td>name=page_version</td>
- <td>1</td>
- </tr>
- <!-- First subcategory should be selected by default -->
- <tr>
- <td>assertElementPresent</td>
- <td>id=input_prop2_1</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementNotPresent</td>
- <td>id=input_prop2_2</td>
- <td></td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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</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/project/settings/sample?category=Category 1</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForValue</td>
- <td>name=page_version</td>
- <td>1</td>
- </tr>
- <tr>
- <td>assertElementNotPresent</td>
- <td>id=input_prop1</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementNotPresent</td>
- <td>id=input_prop2</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementNotPresent</td>
- <td>id=input_prop3</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementPresent</td>
- <td>id=input_prop4</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>link=Sub category 1</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementPresent</td>
- <td>id=input_prop1</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementPresent</td>
- <td>id=input_prop2</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementNotPresent</td>
- <td>id=input_prop3</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementNotPresent</td>
- <td>id=input_prop4</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>link=Sub category 2</td>
- <td></td>
- </tr>
- <tr>
- <td>type</td>
- <td>id=input_prop3</td>
- <td>myValue2</td>
- </tr>
- <tr>
- <td>click</td>
- <td>id=submit_settings</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForValue</td>
- <td>name=page_version</td>
- <td>2</td>
- </tr>
- <tr>
- <td>assertElementNotPresent</td>
- <td>id=input_prop1</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementNotPresent</td>
- <td>id=input_prop2</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementPresent</td>
- <td>id=input_prop3</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementNotPresent</td>
- <td>id=input_prop4</td>
- <td></td>
- </tr>
- <tr>
- <td>assertValue</td>
- <td>id=input_prop3</td>
- <td>myValue2</td>
- </tr>
- <!-- SONAR-4473 -->
- <tr>
- <td>clickAndWait</td>
- <td>link=Sub category 1</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementPresent</td>
- <td>id=input_prop1</td>
- <td></td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?><!-- Generated by Sonar -->
+<profile>
+ <name>one-issue-per-line</name>
+ <language>xoo</language>
+ <rules>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>OneIssuePerLine</key>
+ <priority>MAJOR</priority>
+ </rule>
+ </rules>
+</profile>
\ No newline at end of file
--- /dev/null
+{
+ "version": "<SONAR_VERSION>",
+ "issues": [
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 6,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": true,
+ "creationDate": "2013-05-02T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 5,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": true,
+ "creationDate": "2013-05-02T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 13,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": true,
+ "creationDate": "2013-05-02T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 1,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": true,
+ "creationDate": "2013-05-02T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 3,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": true,
+ "creationDate": "2013-05-02T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 4,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": true,
+ "creationDate": "2013-05-02T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 12,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": true,
+ "creationDate": "2013-05-02T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 10,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": true,
+ "creationDate": "2013-05-02T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 2,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": true,
+ "creationDate": "2013-05-02T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 9,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": true,
+ "creationDate": "2013-05-02T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 11,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": true,
+ "creationDate": "2013-05-02T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 7,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": true,
+ "creationDate": "2013-05-02T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 8,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": true,
+ "creationDate": "2013-05-02T00:00:00+0200"
+ }
+ ],
+ "components": [
+ {
+ "key": "sample"
+ },
+ {
+ "key": "sample:src/main/xoo/sample",
+ "path": "src/main/xoo/sample",
+ "moduleKey": "sample"
+ },
+ {
+ "key": "sample:src/main/xoo/sample/Sample.xoo",
+ "path": "src/main/xoo/sample/Sample.xoo",
+ "moduleKey": "sample",
+ "status": "ADDED"
+ }
+ ],
+ "rules": [
+ {
+ "key": "xoo:OneIssuePerLine",
+ "rule": "OneIssuePerLine",
+ "repository": "xoo",
+ "name": "One Issue Per Line"
+ }
+ ],
+ "users": [ ]
+
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?><!-- Generated by Sonar -->
+<profile>
+ <name>one-issue-per-line</name>
+ <language>xoo</language>
+ <rules>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>OneIssuePerLine</key>
+ <priority>MAJOR</priority>
+ </rule>
+ </rules>
+</profile>
\ No newline at end of file
--- /dev/null
+{
+ "version": "5.2-SNAPSHOT",
+ "issues": [
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 4,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 11,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 2,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 5,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 1,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 15,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 16,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 13,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 9,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 12,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 3,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 8,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 14,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 6,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 10,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 7,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
+ "line": 2,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
+ "line": 12,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
+ "line": 8,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
+ "line": 17,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
+ "line": 19,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
+ "line": 4,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
+ "line": 3,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
+ "line": 21,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
+ "line": 6,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
+ "line": 9,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
+ "line": 18,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
+ "line": 5,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
+ "line": 20,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
+ "line": 15,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
+ "line": 7,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
+ "line": 16,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
+ "line": 13,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
+ "line": 10,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
+ "line": 1,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
+ "line": 14,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
+ "line": 11,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
+ "line": 9,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
+ "line": 10,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
+ "line": 2,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
+ "line": 1,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
+ "line": 8,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
+ "line": 5,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
+ "line": 7,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
+ "line": 3,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
+ "line": 4,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
+ "line": 6,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
+ "line": 12,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
+ "line": 11,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
+ "line": 12,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
+ "line": 5,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
+ "line": 4,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
+ "line": 1,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
+ "line": 8,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
+ "line": 3,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
+ "line": 10,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
+ "line": 6,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
+ "line": 7,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
+ "line": 11,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
+ "line": 2,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
+ "line": 9,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ }
+ ],
+ "components": [
+ {
+ "key": "com.sonarsource.it.samples:multi-modules-sample"
+ },
+ {
+ "key": "com.sonarsource.it.samples:multi-modules-sample:module_a",
+ "path": "module_a"
+ },
+ {
+ "key": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1",
+ "path": "module_a1"
+ },
+ {
+ "key": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2",
+ "path": "module_a2"
+ },
+ {
+ "key": "com.sonarsource.it.samples:multi-modules-sample:module_b",
+ "path": "module_b"
+ },
+ {
+ "key": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1",
+ "path": "module_b1"
+ },
+ {
+ "key": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2",
+ "path": "module_b2"
+ },
+ {
+ "key": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "path": "src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "moduleKey": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1",
+ "status": "SAME"
+ },
+ {
+ "key": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
+ "path": "src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
+ "moduleKey": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2",
+ "status": "SAME"
+ },
+ {
+ "key": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
+ "path": "src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
+ "moduleKey": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1",
+ "status": "SAME"
+ },
+ {
+ "key": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
+ "path": "src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
+ "moduleKey": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2",
+ "status": "SAME"
+ },
+ {
+ "key": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1",
+ "path": "src/main/xoo/com/sonar/it/samples/modules/a1",
+ "moduleKey": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1"
+ },
+ {
+ "key": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2",
+ "path": "src/main/xoo/com/sonar/it/samples/modules/a2",
+ "moduleKey": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2"
+ },
+ {
+ "key": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1",
+ "path": "src/main/xoo/com/sonar/it/samples/modules/b1",
+ "moduleKey": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1"
+ },
+ {
+ "key": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2",
+ "path": "src/main/xoo/com/sonar/it/samples/modules/b2",
+ "moduleKey": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2"
+ }
+ ],
+ "rules": [
+ {
+ "key": "xoo:OneIssuePerLine",
+ "rule": "OneIssuePerLine",
+ "repository": "xoo",
+ "name": "One Issue Per Line"
+ }
+ ],
+ "users": []
+}
--- /dev/null
+{
+ "version": "<SONAR_VERSION>",
+ "issues": [
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
+ "line": 2,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
+ "line": 10,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
+ "line": 13,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
+ "line": 15,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
+ "line": 4,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
+ "line": 3,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
+ "line": 12,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
+ "line": 11,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": true,
+ "creationDate": "2013-05-02T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
+ "line": 5,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
+ "line": 7,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": true,
+ "creationDate": "2013-05-02T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
+ "line": 9,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
+ "line": 6,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
+ "line": 8,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
+ "line": 1,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
+ "line": 14,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ }
+ ],
+ "components": [
+ {
+ "key": "sample:mybranch"
+ },
+ {
+ "key": "sample:mybranch:src/main/xoo/sample",
+ "path": "src/main/xoo/sample",
+ "moduleKey": "sample:mybranch"
+ },
+ {
+ "key": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
+ "path": "src/main/xoo/sample/Sample.xoo",
+ "moduleKey": "sample:mybranch",
+ "status": "CHANGED"
+ }
+ ],
+ "rules": [
+ {
+ "key": "xoo:OneIssuePerLine",
+ "rule": "OneIssuePerLine",
+ "repository": "xoo",
+ "name": "One Issue Per Line"
+ }
+ ],
+ "users": [ ]
+
+}
--- /dev/null
+{
+ "version": "<SONAR_VERSION>",
+ "issues": [
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 6,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 5,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 13,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 1,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 3,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 4,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 12,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 10,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 2,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 9,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 11,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": true,
+ "creationDate": "2013-05-02T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 7,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": true,
+ "creationDate": "2013-05-02T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 8,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 14,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "sample:src/main/xoo/sample/Sample.xoo",
+ "line": 15,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ }
+ ],
+ "components": [
+ {
+ "key": "sample"
+ },
+ {
+ "key": "sample:src/main/xoo/sample",
+ "path": "src/main/xoo/sample",
+ "moduleKey": "sample"
+ },
+ {
+ "key": "sample:src/main/xoo/sample/Sample.xoo",
+ "path": "src/main/xoo/sample/Sample.xoo",
+ "moduleKey": "sample",
+ "status": "CHANGED"
+ }
+ ],
+ "rules": [
+ {
+ "key": "xoo:OneIssuePerLine",
+ "rule": "OneIssuePerLine",
+ "repository": "xoo",
+ "name": "One Issue Per Line"
+ }
+ ],
+ "users": []
+}
--- /dev/null
+{
+
+ "version": "<SONAR_VERSION>",
+ "issues": [
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 4,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 7,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 6,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 1,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 8,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 15,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 14,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 10,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 3,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 2,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 16,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 9,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 5,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 12,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 13,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ },
+ {
+ "key": "<ISSUE_KEY>",
+ "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "line": 11,
+ "message": "This issue is generated on each line",
+ "severity": "MAJOR",
+ "rule": "xoo:OneIssuePerLine",
+ "status": "OPEN",
+ "isNew": false,
+ "creationDate": "2013-05-01T00:00:00+0200"
+ }
+ ],
+ "components": [
+ {
+ "key": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1"
+ },
+ {
+ "key": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1",
+ "path": "src/main/xoo/com/sonar/it/samples/modules/a1",
+ "moduleKey": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1"
+ },
+ {
+ "key": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "path": "src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
+ "moduleKey": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1",
+ "status": "SAME"
+ }
+ ],
+ "rules": [
+ {
+ "key": "xoo:OneIssuePerLine",
+ "rule": "OneIssuePerLine",
+ "repository": "xoo",
+ "name": "One Issue Per Line"
+ }
+ ],
+ "users": [ ]
+
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?><!-- Generated by Sonar -->
+<profile>
+ <name>empty</name>
+ <language>xoo</language>
+ <rules>
+ </rules>
+</profile>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?><!-- Generated by Sonar -->
+<profile>
+ <name>one-issue-per-line</name>
+ <language>xoo</language>
+ <rules>
+ </rules>
+</profile>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?><!-- Generated by Sonar -->
+<profile>
+ <name>one-issue-per-line</name>
+ <language>xoo</language>
+ <rules>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>OneIssuePerLine</key>
+ <priority>MAJOR</priority>
+ </rule>
+ </rules>
+</profile>
\ No newline at end of file
--- /dev/null
+<profile>
+ <name>with-many-rules</name>
+ <language>xoo</language>
+ <rules>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>OneIssuePerLine</key>
+ <priority>MINOR</priority>
+ </rule>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>OneIssuePerFile</key>
+ <priority>MAJOR</priority>
+ </rule>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>OneIssuePerModule</key>
+ <priority>CRITICAL</priority>
+ </rule>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>HasTag</key>
+ <priority>INFO</priority>
+ <parameters>
+ <parameter>
+ <key>tag</key>
+ <value>xoo</value>
+ </parameter>
+ </parameters>
+ </rule>
+ </rules>
+</profile>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?><!-- Generated by Sonar -->
+<profile>
+ <name>one-issue-per-line-xoo2</name>
+ <language>xoo2</language>
+ <rules>
+ <rule>
+ <repositoryKey>xoo2</repositoryKey>
+ <key>OneIssuePerLine</key>
+ <priority>MAJOR</priority>
+ </rule>
+ </rules>
+</profile>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?><!-- Generated by Sonar -->
+<profile>
+ <name>one-issue-per-line</name>
+ <language>xoo</language>
+ <rules>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>OneIssuePerLine</key>
+ <priority>MAJOR</priority>
+ </rule>
+ </rules>
+</profile>
\ No newline at end of file
--- /dev/null
+0PZz+G+f8mjr3sPn4+AhHg==
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?><!-- Generated by Sonar -->
+<profile>
+ <name>one-issue-per-line</name>
+ <language>xoo</language>
+ <rules>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>OneIssuePerLine</key>
+ <priority>MAJOR</priority>
+ </rule>
+ </rules>
+</profile>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?><!-- Generated by Sonar -->
-<profile>
- <name>one-issue-per-line</name>
- <language>xoo</language>
- <rules>
- <rule>
- <repositoryKey>xoo</repositoryKey>
- <key>OneIssuePerLine</key>
- <priority>MAJOR</priority>
- </rule>
- </rules>
-</profile>
\ No newline at end of file
+++ /dev/null
-{
- "version": "<SONAR_VERSION>",
- "issues": [
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 6,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": true,
- "creationDate": "2013-05-02T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 5,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": true,
- "creationDate": "2013-05-02T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 13,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": true,
- "creationDate": "2013-05-02T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 1,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": true,
- "creationDate": "2013-05-02T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 3,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": true,
- "creationDate": "2013-05-02T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 4,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": true,
- "creationDate": "2013-05-02T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 12,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": true,
- "creationDate": "2013-05-02T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 10,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": true,
- "creationDate": "2013-05-02T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 2,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": true,
- "creationDate": "2013-05-02T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 9,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": true,
- "creationDate": "2013-05-02T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 11,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": true,
- "creationDate": "2013-05-02T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 7,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": true,
- "creationDate": "2013-05-02T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 8,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": true,
- "creationDate": "2013-05-02T00:00:00+0200"
- }
- ],
- "components": [
- {
- "key": "sample"
- },
- {
- "key": "sample:src/main/xoo/sample",
- "path": "src/main/xoo/sample",
- "moduleKey": "sample"
- },
- {
- "key": "sample:src/main/xoo/sample/Sample.xoo",
- "path": "src/main/xoo/sample/Sample.xoo",
- "moduleKey": "sample",
- "status": "ADDED"
- }
- ],
- "rules": [
- {
- "key": "xoo:OneIssuePerLine",
- "rule": "OneIssuePerLine",
- "repository": "xoo",
- "name": "One Issue Per Line"
- }
- ],
- "users": [ ]
-
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?><!-- Generated by Sonar -->
-<profile>
- <name>one-issue-per-line</name>
- <language>xoo</language>
- <rules>
- <rule>
- <repositoryKey>xoo</repositoryKey>
- <key>OneIssuePerLine</key>
- <priority>MAJOR</priority>
- </rule>
- </rules>
-</profile>
\ No newline at end of file
+++ /dev/null
-{
- "version": "5.2-SNAPSHOT",
- "issues": [
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 4,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 11,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 2,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 5,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 1,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 15,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 16,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 13,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 9,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 12,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 3,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 8,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 14,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 6,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 10,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 7,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
- "line": 2,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
- "line": 12,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
- "line": 8,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
- "line": 17,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
- "line": 19,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
- "line": 4,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
- "line": 3,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
- "line": 21,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
- "line": 6,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
- "line": 9,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
- "line": 18,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
- "line": 5,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
- "line": 20,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
- "line": 15,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
- "line": 7,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
- "line": 16,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
- "line": 13,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
- "line": 10,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
- "line": 1,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
- "line": 14,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
- "line": 11,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
- "line": 9,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
- "line": 10,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
- "line": 2,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
- "line": 1,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
- "line": 8,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
- "line": 5,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
- "line": 7,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
- "line": 3,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
- "line": 4,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
- "line": 6,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
- "line": 12,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
- "line": 11,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
- "line": 12,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
- "line": 5,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
- "line": 4,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
- "line": 1,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
- "line": 8,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
- "line": 3,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
- "line": 10,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
- "line": 6,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
- "line": 7,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
- "line": 11,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
- "line": 2,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
- "line": 9,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- }
- ],
- "components": [
- {
- "key": "com.sonarsource.it.samples:multi-modules-sample"
- },
- {
- "key": "com.sonarsource.it.samples:multi-modules-sample:module_a",
- "path": "module_a"
- },
- {
- "key": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1",
- "path": "module_a1"
- },
- {
- "key": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2",
- "path": "module_a2"
- },
- {
- "key": "com.sonarsource.it.samples:multi-modules-sample:module_b",
- "path": "module_b"
- },
- {
- "key": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1",
- "path": "module_b1"
- },
- {
- "key": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2",
- "path": "module_b2"
- },
- {
- "key": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "path": "src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "moduleKey": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1",
- "status": "SAME"
- },
- {
- "key": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
- "path": "src/main/xoo/com/sonar/it/samples/modules/a2/HelloA2.xoo",
- "moduleKey": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2",
- "status": "SAME"
- },
- {
- "key": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
- "path": "src/main/xoo/com/sonar/it/samples/modules/b1/HelloB1.xoo",
- "moduleKey": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1",
- "status": "SAME"
- },
- {
- "key": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
- "path": "src/main/xoo/com/sonar/it/samples/modules/b2/HelloB2.xoo",
- "moduleKey": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2",
- "status": "SAME"
- },
- {
- "key": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1",
- "path": "src/main/xoo/com/sonar/it/samples/modules/a1",
- "moduleKey": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1"
- },
- {
- "key": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2:src/main/xoo/com/sonar/it/samples/modules/a2",
- "path": "src/main/xoo/com/sonar/it/samples/modules/a2",
- "moduleKey": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a2"
- },
- {
- "key": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1:src/main/xoo/com/sonar/it/samples/modules/b1",
- "path": "src/main/xoo/com/sonar/it/samples/modules/b1",
- "moduleKey": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1"
- },
- {
- "key": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2:src/main/xoo/com/sonar/it/samples/modules/b2",
- "path": "src/main/xoo/com/sonar/it/samples/modules/b2",
- "moduleKey": "com.sonarsource.it.samples:multi-modules-sample:module_b:module_b2"
- }
- ],
- "rules": [
- {
- "key": "xoo:OneIssuePerLine",
- "rule": "OneIssuePerLine",
- "repository": "xoo",
- "name": "One Issue Per Line"
- }
- ],
- "users": []
-}
+++ /dev/null
-{
- "version": "<SONAR_VERSION>",
- "issues": [
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
- "line": 2,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
- "line": 10,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
- "line": 13,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
- "line": 15,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
- "line": 4,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
- "line": 3,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
- "line": 12,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
- "line": 11,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": true,
- "creationDate": "2013-05-02T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
- "line": 5,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
- "line": 7,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": true,
- "creationDate": "2013-05-02T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
- "line": 9,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
- "line": 6,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
- "line": 8,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
- "line": 1,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
- "line": 14,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- }
- ],
- "components": [
- {
- "key": "sample:mybranch"
- },
- {
- "key": "sample:mybranch:src/main/xoo/sample",
- "path": "src/main/xoo/sample",
- "moduleKey": "sample:mybranch"
- },
- {
- "key": "sample:mybranch:src/main/xoo/sample/Sample.xoo",
- "path": "src/main/xoo/sample/Sample.xoo",
- "moduleKey": "sample:mybranch",
- "status": "CHANGED"
- }
- ],
- "rules": [
- {
- "key": "xoo:OneIssuePerLine",
- "rule": "OneIssuePerLine",
- "repository": "xoo",
- "name": "One Issue Per Line"
- }
- ],
- "users": [ ]
-
-}
+++ /dev/null
-{
- "version": "<SONAR_VERSION>",
- "issues": [
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 6,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 5,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 13,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 1,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 3,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 4,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 12,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 10,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 2,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 9,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 11,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": true,
- "creationDate": "2013-05-02T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 7,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": true,
- "creationDate": "2013-05-02T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 8,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 14,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "sample:src/main/xoo/sample/Sample.xoo",
- "line": 15,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- }
- ],
- "components": [
- {
- "key": "sample"
- },
- {
- "key": "sample:src/main/xoo/sample",
- "path": "src/main/xoo/sample",
- "moduleKey": "sample"
- },
- {
- "key": "sample:src/main/xoo/sample/Sample.xoo",
- "path": "src/main/xoo/sample/Sample.xoo",
- "moduleKey": "sample",
- "status": "CHANGED"
- }
- ],
- "rules": [
- {
- "key": "xoo:OneIssuePerLine",
- "rule": "OneIssuePerLine",
- "repository": "xoo",
- "name": "One Issue Per Line"
- }
- ],
- "users": [ ]
-
-}
+++ /dev/null
-{
-
- "version": "<SONAR_VERSION>",
- "issues": [
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 4,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 7,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 6,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 1,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 8,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 15,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 14,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 10,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 3,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 2,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 16,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 9,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 5,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 12,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 13,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- },
- {
- "key": "<ISSUE_KEY>",
- "component": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "line": 11,
- "message": "This issue is generated on each line",
- "severity": "MAJOR",
- "rule": "xoo:OneIssuePerLine",
- "status": "OPEN",
- "isNew": false,
- "creationDate": "2013-05-01T00:00:00+0200"
- }
- ],
- "components": [
- {
- "key": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1"
- },
- {
- "key": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1",
- "path": "src/main/xoo/com/sonar/it/samples/modules/a1",
- "moduleKey": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1"
- },
- {
- "key": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "path": "src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo",
- "moduleKey": "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1",
- "status": "SAME"
- }
- ],
- "rules": [
- {
- "key": "xoo:OneIssuePerLine",
- "rule": "OneIssuePerLine",
- "repository": "xoo",
- "name": "One Issue Per Line"
- }
- ],
- "users": [ ]
-
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?><!-- Generated by Sonar -->
-<profile>
- <name>empty</name>
- <language>xoo</language>
- <rules>
- </rules>
-</profile>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?><!-- Generated by Sonar -->
-<profile>
- <name>one-issue-per-line</name>
- <language>xoo</language>
- <rules>
- </rules>
-</profile>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?><!-- Generated by Sonar -->
-<profile>
- <name>one-issue-per-line</name>
- <language>xoo</language>
- <rules>
- <rule>
- <repositoryKey>xoo</repositoryKey>
- <key>OneIssuePerLine</key>
- <priority>MAJOR</priority>
- </rule>
- </rules>
-</profile>
\ No newline at end of file
+++ /dev/null
-<profile>
- <name>with-many-rules</name>
- <language>xoo</language>
- <rules>
- <rule>
- <repositoryKey>xoo</repositoryKey>
- <key>OneIssuePerLine</key>
- <priority>MINOR</priority>
- </rule>
- <rule>
- <repositoryKey>xoo</repositoryKey>
- <key>OneIssuePerFile</key>
- <priority>MAJOR</priority>
- </rule>
- <rule>
- <repositoryKey>xoo</repositoryKey>
- <key>OneIssuePerModule</key>
- <priority>CRITICAL</priority>
- </rule>
- <rule>
- <repositoryKey>xoo</repositoryKey>
- <key>HasTag</key>
- <priority>INFO</priority>
- <parameters>
- <parameter>
- <key>tag</key>
- <value>xoo</value>
- </parameter>
- </parameters>
- </rule>
- </rules>
-</profile>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?><!-- Generated by Sonar -->
-<profile>
- <name>one-issue-per-line-xoo2</name>
- <language>xoo2</language>
- <rules>
- <rule>
- <repositoryKey>xoo2</repositoryKey>
- <key>OneIssuePerLine</key>
- <priority>MAJOR</priority>
- </rule>
- </rules>
-</profile>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?><!-- Generated by Sonar -->
-<profile>
- <name>one-issue-per-line</name>
- <language>xoo</language>
- <rules>
- <rule>
- <repositoryKey>xoo</repositoryKey>
- <key>OneIssuePerLine</key>
- <priority>MAJOR</priority>
- </rule>
- </rules>
-</profile>
\ No newline at end of file
+++ /dev/null
-0PZz+G+f8mjr3sPn4+AhHg==
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?><!-- Generated by Sonar -->
-<profile>
- <name>one-issue-per-line</name>
- <language>xoo</language>
- <rules>
- <rule>
- <repositoryKey>xoo</repositoryKey>
- <key>OneIssuePerLine</key>
- <priority>MAJOR</priority>
- </rule>
- </rules>
-</profile>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+ <title>default_locale_is_english</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <thead>
+ <tr>
+ <td rowspan="1" colspan="3">default_locale_is_english</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/dashboard/index?id=sample&locale=foo</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>css=#content</td>
+ <td>regexp:.*Jan.*|.*Feb.*|.*Mar.*|.*Apr.*|.*May.*|.*Jun.*|.*Jul.*|.*Aug.*|.*Sep.*|.*Oct.*|.*Nov.*|.*Dec.*</td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>css=#content</td>
+ <td>*0.0%*</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+ <title>french</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <thead>
+ <tr>
+ <td rowspan="1" colspan="3">french</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/dashboard/index?id=sample&locale=fr</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>css=#content</td>
+ <td>regexp:.*jan.*|.*fév.*|.*mar.*|.*avr.*|.*mai.*|.*juin.*|.*juil.*|.*août.*|.*sept.*|.*oct.*|.*nov.*|.*déc.*</td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>css=#content</td>
+ <td>*0,0%*</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+ <title>french-pack</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <thead>
+ <tr>
+ <td rowspan="1" colspan="3">french-pack</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/?locale=fr</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>css=.navbar</td>
+ <td>glob:*Se connecter*</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+ <title>french-france</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <thead>
+ <tr>
+ <td rowspan="1" colspan="3">french-france</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/dashboard/index?id=sample&locale=fr-FR</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>css=#content</td>
+ <td>regexp:.*jan.*|.*fév.*|.*mar.*|.*avr.*|.*mai.*|.*juin.*|.*juil.*|.*août.*|.*sept.*|.*oct.*|.*nov.*|.*déc.*</td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>css=#content</td>
+ <td>*0,0%*</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+ <title>french-switzerland</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <thead>
+ <tr>
+ <td rowspan="1" colspan="3">french-switzerland</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/dashboard/index?id=sample&locale=fr-CH</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>css=#content</td>
+ <td>regexp:.*jan.*|.*fév.*|.*mar.*|.*avr.*|.*mai.*|.*juin.*|.*juil.*|.*août.*|.*sept.*|.*oct.*|.*nov.*|.*déc.*</td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>css=#content</td>
+ <td>*0.0%*</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?xml version="1.0"?><!-- Generated by Sonar -->
+<profile>
+ <name>xoo-common-rules</name>
+ <language>xoo</language>
+ <rules>
+ <rule>
+ <repositoryKey>common-xoo</repositoryKey>
+ <key>DuplicatedBlocks</key>
+ <priority>CRITICAL</priority>
+ </rule>
+ <rule>
+ <repositoryKey>common-xoo</repositoryKey>
+ <key>InsufficientBranchCoverage</key>
+ <priority>CRITICAL</priority>
+ <parameters>
+ <parameter>
+ <key>minimumBranchCoverageRatio</key>
+ <value>90</value>
+ </parameter>
+ </parameters>
+ </rule>
+ <rule>
+ <repositoryKey>common-xoo</repositoryKey>
+ <key>InsufficientCommentDensity</key>
+ <priority>CRITICAL</priority>
+ <parameters>
+ <parameter>
+ <key>minimumCommentDensity</key>
+ <value>90.0</value>
+ </parameter>
+ </parameters>
+ </rule>
+ <rule>
+ <repositoryKey>common-xoo</repositoryKey>
+ <key>InsufficientLineCoverage</key>
+ <priority>CRITICAL</priority>
+ <parameters>
+ <parameter>
+ <key>minimumLineCoverageRatio</key>
+ <value>90</value>
+ </parameter>
+ </parameters>
+ </rule>
+ <rule>
+ <repositoryKey>common-xoo</repositoryKey>
+ <key>FailedUnitTests</key>
+ <priority>CRITICAL</priority>
+ </rule>
+ <rule>
+ <repositoryKey>common-xoo</repositoryKey>
+ <key>SkippedUnitTests</key>
+ <priority>CRITICAL</priority>
+ </rule>
+ </rules>
+</profile>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?><!-- Generated by Sonar -->
+<profile>
+ <name>Custom</name>
+ <language>xoo</language>
+ <rules>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>MyCustomRule</key>
+ <priority>CRITICAL</priority>
+ </rule>
+ </rules>
+</profile>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0"?><!-- Generated by Sonar -->
+<profile>
+ <name>xoo-one-issue-per-line-profile</name>
+ <language>xoo</language>
+ <rules>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>OneIssuePerLine</key>
+ <priority>CRITICAL</priority>
+ </rule>
+ </rules>
+</profile>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<profile>
+ <name>one-issue-per-line</name>
+ <language>xoo</language>
+ <rules>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>OneIssuePerLine</key>
+ <priority>MINOR</priority>
+ </rule>
+ </rules>
+</profile>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<profile>
+ <name>one-issue-per-line</name>
+ <language>xoo</language>
+ <rules>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>OneIssuePerLine</key>
+ <priority>MINOR</priority>
+ </rule>
+ </rules>
+</profile>
--- /dev/null
+<profile>
+ <name>with-many-rules</name>
+ <language>xoo</language>
+ <rules>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>OneIssuePerLine</key>
+ <priority>MINOR</priority>
+ </rule>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>OneIssuePerFile</key>
+ <priority>MAJOR</priority>
+ </rule>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>OneIssuePerModule</key>
+ <priority>CRITICAL</priority>
+ </rule>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>HasTag</key>
+ <priority>INFO</priority>
+ <parameters>
+ <parameter>
+ <key>tag</key>
+ <value>xoo</value>
+ </parameter>
+ </parameters>
+ </rule>
+ </rules>
+</profile>
--- /dev/null
+<profile>
+ <name>with-many-rules</name>
+ <language>xoo</language>
+ <rules>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>OneIssuePerLine</key>
+ <priority>MINOR</priority>
+ </rule>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>OneIssuePerFile</key>
+ <priority>MAJOR</priority>
+ </rule>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>OneIssuePerModule</key>
+ <priority>CRITICAL</priority>
+ </rule>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>HasTag</key>
+ <priority>INFO</priority>
+ <parameters>
+ <parameter>
+ <key>tag</key>
+ <value>xoo</value>
+ </parameter>
+ </parameters>
+ </rule>
+ </rules>
+</profile>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0"?><!-- Generated by Sonar -->
+<profile>
+ <name>xoo-one-issue-per-line-profile</name>
+ <language>xoo</language>
+ <rules>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>OneIssuePerLine</key>
+ <priority>CRITICAL</priority>
+ </rule>
+ </rules>
+</profile>
--- /dev/null
+<?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_edit_delete_manual_rule</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/coding_rules</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>css=.js-create-manual-rule</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>css=.js-create-manual-rule</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVisible</td>
+ <td>coding-rules-manual-rule-creation-create</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>name=name</td>
+ <td>New rule</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>name=key</td>
+ <td>New_rule</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>name=markdown_description</td>
+ <td>This is a new rule</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>coding-rules-manual-rule-creation-create</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>css=.coding-rules-detail-header</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>css=.coding-rule-details</td>
+ <td>glob:*New rule*This is a new rule*</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>coding-rules-detail-manual-rule-change</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVisible</td>
+ <td>coding-rules-manual-rule-creation-create</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>name=markdown_description</td>
+ <td>Description updated</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>coding-rules-manual-rule-creation-create</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForText</td>
+ <td>css=.coding-rule-details</td>
+ <td>glob:*New rule*Description updated*</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>coding-rules-detail-rule-delete</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVisible</td>
+ <td>css=[data-confirm="yes"]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>css=[data-confirm="yes"]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForNotText</td>
+ <td>css=.search-navigator-workspace-list</td>
+ <td>glob:*New rule*</td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
+++ /dev/null
-<?xml version="1.0"?><!-- Generated by Sonar -->
-<profile>
- <name>xoo-common-rules</name>
- <language>xoo</language>
- <rules>
- <rule>
- <repositoryKey>common-xoo</repositoryKey>
- <key>DuplicatedBlocks</key>
- <priority>CRITICAL</priority>
- </rule>
- <rule>
- <repositoryKey>common-xoo</repositoryKey>
- <key>InsufficientBranchCoverage</key>
- <priority>CRITICAL</priority>
- <parameters>
- <parameter>
- <key>minimumBranchCoverageRatio</key>
- <value>90</value>
- </parameter>
- </parameters>
- </rule>
- <rule>
- <repositoryKey>common-xoo</repositoryKey>
- <key>InsufficientCommentDensity</key>
- <priority>CRITICAL</priority>
- <parameters>
- <parameter>
- <key>minimumCommentDensity</key>
- <value>90.0</value>
- </parameter>
- </parameters>
- </rule>
- <rule>
- <repositoryKey>common-xoo</repositoryKey>
- <key>InsufficientLineCoverage</key>
- <priority>CRITICAL</priority>
- <parameters>
- <parameter>
- <key>minimumLineCoverageRatio</key>
- <value>90</value>
- </parameter>
- </parameters>
- </rule>
- <rule>
- <repositoryKey>common-xoo</repositoryKey>
- <key>FailedUnitTests</key>
- <priority>CRITICAL</priority>
- </rule>
- <rule>
- <repositoryKey>common-xoo</repositoryKey>
- <key>SkippedUnitTests</key>
- <priority>CRITICAL</priority>
- </rule>
- </rules>
-</profile>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?><!-- Generated by Sonar -->
-<profile>
- <name>Custom</name>
- <language>xoo</language>
- <rules>
- <rule>
- <repositoryKey>xoo</repositoryKey>
- <key>MyCustomRule</key>
- <priority>CRITICAL</priority>
- </rule>
- </rules>
-</profile>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?><!-- Generated by Sonar -->
-<profile>
- <name>xoo-one-issue-per-line-profile</name>
- <language>xoo</language>
- <rules>
- <rule>
- <repositoryKey>xoo</repositoryKey>
- <key>OneIssuePerLine</key>
- <priority>CRITICAL</priority>
- </rule>
- </rules>
-</profile>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<profile>
- <name>one-issue-per-line</name>
- <language>xoo</language>
- <rules>
- <rule>
- <repositoryKey>xoo</repositoryKey>
- <key>OneIssuePerLine</key>
- <priority>MINOR</priority>
- </rule>
- </rules>
-</profile>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<profile>
- <name>one-issue-per-line</name>
- <language>xoo</language>
- <rules>
- <rule>
- <repositoryKey>xoo</repositoryKey>
- <key>OneIssuePerLine</key>
- <priority>MINOR</priority>
- </rule>
- </rules>
-</profile>
+++ /dev/null
-<profile>
- <name>with-many-rules</name>
- <language>xoo</language>
- <rules>
- <rule>
- <repositoryKey>xoo</repositoryKey>
- <key>OneIssuePerLine</key>
- <priority>MINOR</priority>
- </rule>
- <rule>
- <repositoryKey>xoo</repositoryKey>
- <key>OneIssuePerFile</key>
- <priority>MAJOR</priority>
- </rule>
- <rule>
- <repositoryKey>xoo</repositoryKey>
- <key>OneIssuePerModule</key>
- <priority>CRITICAL</priority>
- </rule>
- <rule>
- <repositoryKey>xoo</repositoryKey>
- <key>HasTag</key>
- <priority>INFO</priority>
- <parameters>
- <parameter>
- <key>tag</key>
- <value>xoo</value>
- </parameter>
- </parameters>
- </rule>
- </rules>
-</profile>
+++ /dev/null
-<profile>
- <name>with-many-rules</name>
- <language>xoo</language>
- <rules>
- <rule>
- <repositoryKey>xoo</repositoryKey>
- <key>OneIssuePerLine</key>
- <priority>MINOR</priority>
- </rule>
- <rule>
- <repositoryKey>xoo</repositoryKey>
- <key>OneIssuePerFile</key>
- <priority>MAJOR</priority>
- </rule>
- <rule>
- <repositoryKey>xoo</repositoryKey>
- <key>OneIssuePerModule</key>
- <priority>CRITICAL</priority>
- </rule>
- <rule>
- <repositoryKey>xoo</repositoryKey>
- <key>HasTag</key>
- <priority>INFO</priority>
- <parameters>
- <parameter>
- <key>tag</key>
- <value>xoo</value>
- </parameter>
- </parameters>
- </rule>
- </rules>
-</profile>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?><!-- Generated by Sonar -->
-<profile>
- <name>xoo-one-issue-per-line-profile</name>
- <language>xoo</language>
- <rules>
- <rule>
- <repositoryKey>xoo</repositoryKey>
- <key>OneIssuePerLine</key>
- <priority>CRITICAL</priority>
- </rule>
- </rules>
-</profile>
+++ /dev/null
-<?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_edit_delete_manual_rule</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/coding_rules</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>css=.js-create-manual-rule</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>css=.js-create-manual-rule</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>coding-rules-manual-rule-creation-create</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>name=name</td>
- <td>New rule</td>
-</tr>
-<tr>
- <td>type</td>
- <td>name=key</td>
- <td>New_rule</td>
-</tr>
-<tr>
- <td>type</td>
- <td>name=markdown_description</td>
- <td>This is a new rule</td>
-</tr>
-<tr>
- <td>click</td>
- <td>coding-rules-manual-rule-creation-create</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>css=.coding-rules-detail-header</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>css=.coding-rule-details</td>
- <td>glob:*New rule*This is a new rule*</td>
-</tr>
-<tr>
- <td>click</td>
- <td>coding-rules-detail-manual-rule-change</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>coding-rules-manual-rule-creation-create</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>name=markdown_description</td>
- <td>Description updated</td>
-</tr>
-<tr>
- <td>click</td>
- <td>coding-rules-manual-rule-creation-create</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>css=.coding-rule-details</td>
- <td>glob:*New rule*Description updated*</td>
-</tr>
-<tr>
- <td>click</td>
- <td>coding-rules-detail-rule-delete</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>css=[data-confirm="yes"]</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>css=[data-confirm="yes"]</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForNotText</td>
- <td>css=.search-navigator-workspace-list</td>
- <td>glob:*New rule*</td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<profile>
+ <name>one-issue-per-file</name>
+ <language>xoo</language>
+ <rules>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>OneIssuePerFile</key>
+ <priority>MINOR</priority>
+ </rule>
+ </rules>
+</profile>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<profile>
+ <name>one-issue-per-line</name>
+ <language>xoo</language>
+ <rules>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>OneIssuePerLine</key>
+ <priority>MINOR</priority>
+ </rule>
+ </rules>
+</profile>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<profile>
- <name>one-issue-per-line</name>
- <language>xoo</language>
- <rules>
- <rule>
- <repositoryKey>xoo</repositoryKey>
- <key>OneIssuePerLine</key>
- <priority>MINOR</priority>
- </rule>
- </rules>
-</profile>
\ No newline at end of file
+++ /dev/null
-<?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>copy_measure_filter</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>storeEval</td>
- <td>'list_'+(new Date()).getTime()</td>
- <td>FILTER_NAME</td>
-</tr>
-<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>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>open</td>
- <td>/sonar/measures</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>css=.navigator-filter[title='Components: Any']</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>css=label[title='Files']</td>
- <td></td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=save-as</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>save-as-filter-form</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=name</td>
- <td>${FILTER_NAME}</td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=save-as-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>filter-title</td>
- <td>*${FILTER_NAME}*</td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=copy</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>copy-filter-form</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=name</td>
- <td>copy of ${FILTER_NAME}</td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=description</td>
- <td>description of copy</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>id=copy-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>filter-title</td>
- <td>*copy of ${FILTER_NAME}*</td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>filter-description</td>
- <td>*description of copy*</td>
-</tr>
-<tr>
- <td>click</td>
- <td>css=.navigator-filter[title='Components: Files']</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>css=label[title='Files']</td>
- <td></td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>copy_uniqueness_of_name</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>store</td>
- <td>javascript{'list_'+(new Date()).getTime()}</td>
- <td>FILTER_NAME</td>
-</tr>
-<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>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>open</td>
- <td>/sonar/measures</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>css=.navigator-filter[title='Components: Any']</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>css=label[title='Files']</td>
- <td></td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=save-as</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>save-as-filter-form</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=name</td>
- <td>${FILTER_NAME}</td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=save-as-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>filter-title</td>
- <td>*${FILTER_NAME}*</td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=copy</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>copy-filter-form</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=name</td>
- <td>${FILTER_NAME}</td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=copy-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>copy-filter-form</td>
- <td>*Name already exists*</td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=name</td>
- <td>copy of ${FILTER_NAME}</td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=copy-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>filter-title</td>
- <td>*copy of ${FILTER_NAME}*</td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>empty_filter</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/measures/search</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*No data*</td>
- </tr>
- <tr>
- <td>assertNotText</td>
- <td>measures-table</td>
- <td>*Struts*</td>
- </tr>
-
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>initial_search_form</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForElementPresent</td>
- <td>name=qualifiers[]</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>class=navigator-filters</td>
- <td>*More Criteria*</td>
- </tr>
- <tr>
- <td>assertElementNotPresent</td>
- <td>measures-table</td>
- <td></td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>link_from_main_header</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForElementPresent</td>
- <td>link=Measures</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>link=Measures</td>
- <td></td>
- </tr>
- <tr>
- <td>assertLocation</td>
- <td>*/measures*</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementPresent</td>
- <td>class=navigator-filters</td>
- <td></td>
- </tr>
-
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>configure-table-columns</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/sessions/new</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>open</td>
- <td>/sonar/measures</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=.navigator-filter[title='Components: Any']</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=label[title='Files']</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>id=change-display</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>class=select2-choice</td>
- <td></td>
- </tr>
- <tr>
- <td>type</td>
- <td>css=.select2-with-searchbox .select2-input</td>
- <td>Complexity</td>
- </tr>
- <tr>
- <td>keyPressAndWait</td>
- <td>css=.select2-with-searchbox .select2-input</td>
- <td>\13</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>id=add-metric</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*Name*Cmpx*</td>
- </tr>
- <tr>
- <td>click</td>
- <td>class=select2-choice</td>
- <td></td>
- </tr>
- <tr>
- <td>type</td>
- <td>css=.select2-with-searchbox .select2-input</td>
- <td>Comment lines</td>
- </tr>
- <tr>
- <td>keyPressAndWait</td>
- <td>css=.select2-with-searchbox .select2-input</td>
- <td>\13</td>
- </tr>
- <tr>
- <td>select</td>
- <td>id=select-period</td>
- <td>label=since previous analysis</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>id=add-metric</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*Name*Cmpx*Comment lines*last*</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>id=exit-edit</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*Name*Cmpx*Comment lines*last*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>delete_column</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=.navigator-filter[title='Components: Any']</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=label[title='Files']</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>id=change-display</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*Name*Last Analysis*LOC*</td>
- </tr>
- <tr>
- <td>click</td>
- <td>delete-date</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>measures-table</td>
- <td>*Name*LOC*</td>
- </tr>
- <tr>
- <td>assertNotText</td>
- <td>measures-table</td>
- <td>*Last Analysis*</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>id=exit-edit</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*Name*LOC*</td>
- </tr>
- <tr>
- <td>assertNotText</td>
- <td>measures-table</td>
- <td>*Last Analysis*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>move_columns</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=.navigator-filter[title='Components: Any']</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=label[title='Files']</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>id=change-display</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*Name*Last Analysis*LOC*</td>
- </tr>
- <tr>
- <td>click</td>
- <td>left-date</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>measures-table</td>
- <td>*Last Analysis*Name*LOC*</td>
- </tr>
- <tr>
- <td>click</td>
- <td>right-name</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>measures-table</td>
- <td>*Last Analysis*LOC*Name*</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>id=exit-edit</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*Last Analysis*LOC*Name*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ SonarQube, open source software quality management tool.
- ~ Copyright (C) 2008-2014 SonarSource
- ~ mailto:contact AT sonarsource DOT com
- ~
- ~ SonarQube is free software; you can redistribute it and/or
- ~ modify it under the terms of the GNU Lesser General Public
- ~ License as published by the Free Software Foundation; either
- ~ version 3 of the License, or (at your option) any later version.
- ~
- ~ SonarQube is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public License
- ~ along with this program; if not, write to the Free Software Foundation,
- ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- -->
-
-<!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>list_sort_by_descending_name</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=.navigator-filter[title='Components: Any']</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=label[title='Files']</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementPresent</td>
- <td>measures-table</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>link=NAME</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*b2/HelloB2.xoo*b1/HelloB1.xoo*a2/HelloA2.xoo*a1/HelloA1.xoo*</td>
- </tr>
-
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ SonarQube, open source software quality management tool.
- ~ Copyright (C) 2008-2014 SonarSource
- ~ mailto:contact AT sonarsource DOT com
- ~
- ~ SonarQube is free software; you can redistribute it and/or
- ~ modify it under the terms of the GNU Lesser General Public
- ~ License as published by the Free Software Foundation; either
- ~ version 3 of the License, or (at your option) any later version.
- ~
- ~ SonarQube is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public License
- ~ along with this program; if not, write to the Free Software Foundation,
- ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- -->
-
-<!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>list_sort_by_ncloc</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=.navigator-filter[title='Components: Any']</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=label[title='Files']</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementPresent</td>
- <td>measures-table</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>css=#measures-table tfoot</td>
- <td>*4 results*</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>link=LOC</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*a2/HelloA2.xoo*a1/HelloA1.xoo*b1/HelloB1.xoo*b2/HelloB2.xoo*</td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>css=#measures-table tfoot</td>
- <td>*4 results*</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>link=LOC</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>css=#measures-table tfoot</td>
- <td>*4 results*</td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*a1/HelloA1.xoo*b1/HelloB1.xoo*b2/HelloB2.xoo*a2/HelloA2.xoo*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ SonarQube, open source software quality management tool.
- ~ Copyright (C) 2008-2014 SonarSource
- ~ mailto:contact AT sonarsource DOT com
- ~
- ~ SonarQube is free software; you can redistribute it and/or
- ~ modify it under the terms of the GNU Lesser General Public
- ~ License as published by the Free Software Foundation; either
- ~ version 3 of the License, or (at your option) any later version.
- ~
- ~ SonarQube is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public License
- ~ along with this program; if not, write to the Free Software Foundation,
- ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- -->
-
-<!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>list_widget</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/measures/manage</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>clickAndWait</td>
- <td>xpath=(//table[contains(@id, 'shared-filters')]//a[contains(text(),'Projects')])</td>
- <td></td>
- </tr>
- <tr>
- <td>storeEval</td>
- <td>window.location.pathname.split('/')[4]</td>
- <td>FILTER_ID</td>
- </tr>
- <tr>
- <td>open</td>
- <td>/sonar/widget?id=measure_filter_list&filter=${FILTER_ID}</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>block_1</td>
- <td>*Name*Version*LOC*Last Analysis*</td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>block_1</td>
- <td>*Multi-modules Sample*1.0-SNAPSHOT*</td>
- </tr>
- <tr>
- <td>assertNotText</td>
- <td>block_1</td>
- <td>*Module A*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ SonarQube, open source software quality management tool.
- ~ Copyright (C) 2008-2014 SonarSource
- ~ mailto:contact AT sonarsource DOT com
- ~
- ~ SonarQube is free software; you can redistribute it and/or
- ~ modify it under the terms of the GNU Lesser General Public
- ~ License as published by the Free Software Foundation; either
- ~ version 3 of the License, or (at your option) any later version.
- ~
- ~ SonarQube is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public License
- ~ along with this program; if not, write to the Free Software Foundation,
- ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- -->
-
-<!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>list_widget_sort</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>storeEval</td>
- <td>'sort_widget_'+(new Date()).getTime()</td>
- <td>FILTER_NAME</td>
-</tr>
-<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>name=commit</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>class=navigator-filters</td>
- <td>*More Criteria*</td>
-</tr>
- <tr>
- <td>click</td>
- <td>css=.navigator-filter[title='Components: Any']</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=label[title='Files']</td>
- <td></td>
- </tr>
-<tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=save-as</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>save-as-filter-form</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>name</td>
- <td>${FILTER_NAME}</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>id=save-as-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>storeEval</td>
- <td>window.location.pathname.split('/')[4]</td>
- <td>FILTER_ID</td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/widget?id=measure_filter_list&filter=${FILTER_ID}</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>block_1</td>
- <td>*Name*LOC*</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>block_1</td>
- <td>*a1/HelloA1.xoo*a2/HelloA2.xoo*b1/HelloB1.xoo*b2/HelloB2.xoo*</td>
-</tr>
-<tr>
- <td>click</td>
- <td>link=LOC</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>block_1</td>
- <td>*a2/HelloA2.xoo*a1/HelloA1.xoo*b1/HelloB1.xoo*b2/HelloB2.xoo*</td>
-</tr>
-<tr>
- <td>click</td>
- <td>link=LOC</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>block_1</td>
- <td>*HelloA1*HelloB1*HelloB2*HelloA2*</td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>list_widget</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/widget?id=measure_filter_list</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>block_1</td>
- <td>*This widget is configured to display a measure filter that does not exist anymore.*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>save_with_special_characters</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/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/measures</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForElementPresent</td>
- <td>name=qualifiers[]</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>id=save-as</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForElementPresent</td>
- <td>save-as-filter-form</td>
- <td></td>
- </tr>
- <tr>
- <td>type</td>
- <td>id=name</td>
- <td>special $àé'@"</td>
- </tr>
- <tr>
- <td>type</td>
- <td>id=description</td>
- <td>description with special characters " ' éà</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>id=save-as-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>filter-description</td>
- <td>*description with special characters " ' éà*</td>
- </tr>
- <tr>
- <td>click</td>
- <td>class=navigator-filter-favorite</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>id=manage-favorites</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>my-filters</td>
- <td>*special $àé'@"*description with special characters " ' éà*</td>
- </tr>
- <tr>
- <td>click</td>
- <td>id=delete_special-ae</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForElementPresent</td>
- <td>confirm-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>id=confirm-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForNotText</td>
- <td>my-filters</td>
- <td>*special $àé'@"*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
-
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ SonarQube, open source software quality management tool.
- ~ Copyright (C) 2008-2014 SonarSource
- ~ mailto:contact AT sonarsource DOT com
- ~
- ~ SonarQube is free software; you can redistribute it and/or
- ~ modify it under the terms of the GNU Lesser General Public
- ~ License as published by the Free Software Foundation; either
- ~ version 3 of the License, or (at your option) any later version.
- ~
- ~ SonarQube is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public License
- ~ along with this program; if not, write to the Free Software Foundation,
- ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- -->
-
-<!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>search-by-key</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=.navigator-filter[title='Components: Any']</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=label[title='Projects']</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>class=navigator-filter-more-criteria</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=label[data-property='keySearch']</td>
- <td></td>
- </tr>
- <tr>
- <td>type</td>
- <td>css=#filter-keySearch input[name='keySearch']</td>
- <td>multi-modules</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*Sonar :: Integration Tests :: Multi-modules Sample*</td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>css=#measures-table tfoot</td>
- <td>*1 results*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ SonarQube, open source software quality management tool.
- ~ Copyright (C) 2008-2014 SonarSource
- ~ mailto:contact AT sonarsource DOT com
- ~
- ~ SonarQube is free software; you can redistribute it and/or
- ~ modify it under the terms of the GNU Lesser General Public
- ~ License as published by the Free Software Foundation; either
- ~ version 3 of the License, or (at your option) any later version.
- ~
- ~ SonarQube is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public License
- ~ along with this program; if not, write to the Free Software Foundation,
- ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- -->
-
-<!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>search-by-name</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=.navigator-filter[title='Components: Any']</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=label[title='Projects']</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>class=navigator-filter-more-criteria</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=label[data-property='nameSearch']</td>
- <td></td>
- </tr>
- <tr>
- <td>type</td>
- <td>css=#filter-nameSearch input[name='nameSearch']</td>
- <td>Integration</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*Sonar :: Integration Tests :: Multi-modules Sample*</td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>css=#measures-table tfoot</td>
- <td>*1 results*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>search_for_files</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=.navigator-filter[title='Components: Any']</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=label[title='Files']</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*a1/HelloA1.xoo*a2/HelloA2.xoo*b1/HelloB1.xoo*b2/HelloB2.xoo*</td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>css=#measures-table tfoot</td>
- <td>*4 results*</td>
- </tr>
- <tr>
- <td>assertNotText</td>
- <td>measures-table</td>
- <td>*Module A*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ SonarQube, open source software quality management tool.
- ~ Copyright (C) 2008-2014 SonarSource
- ~ mailto:contact AT sonarsource DOT com
- ~
- ~ SonarQube is free software; you can redistribute it and/or
- ~ modify it under the terms of the GNU Lesser General Public
- ~ License as published by the Free Software Foundation; either
- ~ version 3 of the License, or (at your option) any later version.
- ~
- ~ SonarQube is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public License
- ~ along with this program; if not, write to the Free Software Foundation,
- ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- -->
-
-<!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>search_for_projects_by_default</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=.navigator-filter[title='Components: Any']</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>css=label[title='Projects']</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementPresent</td>
- <td>measures-table</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*Sonar :: Integration Tests :: Multi-modules Sample*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>should_save_issue_filters</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<tbody>
-<tr>
- <td>storeEval</td>
- <td>'filter_'+(new Date()).getTime()</td>
- <td>FILTER_NAME</td>
-</tr>
-<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>user-measures-filter-with-no-share-perm</td>
-</tr>
-<tr>
- <td>type</td>
- <td>password</td>
- <td>password</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>commit</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>css=.navigator-filter[title='Components: Any']</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>css=label[title='Projects']</td>
- <td></td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=save-as</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>save-as-filter-form</td>
- <td>*Save Filter*</td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=name</td>
- <td>user_${FILTER_NAME}</td>
-</tr>
-<tr>
- <td>assertNotText</td>
- <td>save-as-filter-form</td>
- <td>*Shared with all users*</td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=save-as-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>filter-title</td>
- <td>*user_${FILTER_NAME}*Private*</td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>should_save_issue_filters</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<tbody>
-<tr>
- <td>storeEval</td>
- <td>'filter_'+(new Date()).getTime()</td>
- <td>FILTER_NAME</td>
-</tr>
-<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>user-measures-filter-with-sharing-perm</td>
-</tr>
-<tr>
- <td>type</td>
- <td>password</td>
- <td>password</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>commit</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>css=.navigator-filter[title='Components: Any']</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>css=label[title='Projects']</td>
- <td></td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=save-as</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>save-as-filter-form</td>
- <td>*Save Filter*</td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=name</td>
- <td>user_${FILTER_NAME}</td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=shared</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=save-as-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>filter-title</td>
- <td>*user_${FILTER_NAME}*Shared with all users*</td>
-</tr>
-<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/measures/manage</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>content</td>
- <td>*My Measures Filters*</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>shared-filters</td>
- <td>*user_${FILTER_NAME}*</td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=star-user_${FILTER_NAME}</td>
- <td></td>
-</tr>
-<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>user-measures-filter-with-sharing-perm</td>
-</tr>
-<tr>
- <td>type</td>
- <td>password</td>
- <td>password</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>commit</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>class=navigator-filter-favorite</td>
- <td></td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>id=manage-favorites</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>my-filters</td>
- <td>*user_${FILTER_NAME}*</td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=edit_user_${FILTER_NAME}</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>edit-filter-form</td>
- <td>*Edit Filter*</td>
-</tr>
-<tr>
- <td>click</td>
- <td>shared</td>
- <td></td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>id=save-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>filter-title</td>
- <td>*user_${FILTER_NAME}*Private*</td>
-</tr>
-<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/measures/manage</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>content</td>
- <td>*My Measures Filters*</td>
-</tr>
-<tr>
- <td>assertNotText</td>
- <td>shared-filters</td>
- <td>*user_${FILTER_NAME}*</td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<profile>
- <name>one-issue-per-file</name>
- <language>xoo</language>
- <rules>
- <rule>
- <repositoryKey>xoo</repositoryKey>
- <key>OneIssuePerFile</key>
- <priority>MINOR</priority>
- </rule>
- </rules>
-</profile>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<profile>
- <name>one-issue-per-line</name>
- <language>xoo</language>
- <rules>
- <rule>
- <repositoryKey>xoo</repositoryKey>
- <key>OneIssuePerLine</key>
- <priority>MINOR</priority>
- </rule>
- </rules>
-</profile>
--- /dev/null
+<?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>copy_measure_filter</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <tbody>
+ <tr>
+ <td>storeEval</td>
+ <td>'list_'+(new Date()).getTime()</td>
+ <td>FILTER_NAME</td>
+</tr>
+<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>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>open</td>
+ <td>/sonar/measures</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>css=.navigator-filter[title='Components: Any']</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>css=label[title='Files']</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>class=navigator-filter-submit</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=save-as</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>save-as-filter-form</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>id=name</td>
+ <td>${FILTER_NAME}</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=save-as-submit</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForText</td>
+ <td>filter-title</td>
+ <td>*${FILTER_NAME}*</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=copy</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>copy-filter-form</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>id=name</td>
+ <td>copy of ${FILTER_NAME}</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>id=description</td>
+ <td>description of copy</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>id=copy-submit</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForText</td>
+ <td>filter-title</td>
+ <td>*copy of ${FILTER_NAME}*</td>
+</tr>
+<tr>
+ <td>waitForText</td>
+ <td>filter-description</td>
+ <td>*description of copy*</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>css=.navigator-filter[title='Components: Files']</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>css=label[title='Files']</td>
+ <td></td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>copy_uniqueness_of_name</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <tbody>
+ <tr>
+ <td>store</td>
+ <td>javascript{'list_'+(new Date()).getTime()}</td>
+ <td>FILTER_NAME</td>
+</tr>
+<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>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>open</td>
+ <td>/sonar/measures</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>css=.navigator-filter[title='Components: Any']</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>css=label[title='Files']</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>class=navigator-filter-submit</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=save-as</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>save-as-filter-form</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>id=name</td>
+ <td>${FILTER_NAME}</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=save-as-submit</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForText</td>
+ <td>filter-title</td>
+ <td>*${FILTER_NAME}*</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=copy</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>copy-filter-form</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>id=name</td>
+ <td>${FILTER_NAME}</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=copy-submit</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForText</td>
+ <td>copy-filter-form</td>
+ <td>*Name already exists*</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>id=name</td>
+ <td>copy of ${FILTER_NAME}</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=copy-submit</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForText</td>
+ <td>filter-title</td>
+ <td>*copy of ${FILTER_NAME}*</td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>empty_filter</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/measures/search</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>measures-table</td>
+ <td>*No data*</td>
+ </tr>
+ <tr>
+ <td>assertNotText</td>
+ <td>measures-table</td>
+ <td>*Struts*</td>
+ </tr>
+
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>initial_search_form</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/measures</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForElementPresent</td>
+ <td>name=qualifiers[]</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>class=navigator-filters</td>
+ <td>*More Criteria*</td>
+ </tr>
+ <tr>
+ <td>assertElementNotPresent</td>
+ <td>measures-table</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>link_from_main_header</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForElementPresent</td>
+ <td>link=Measures</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>link=Measures</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertLocation</td>
+ <td>*/measures*</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementPresent</td>
+ <td>class=navigator-filters</td>
+ <td></td>
+ </tr>
+
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>configure-table-columns</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/sessions/new</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>open</td>
+ <td>/sonar/measures</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=.navigator-filter[title='Components: Any']</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=label[title='Files']</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>class=navigator-filter-submit</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>id=change-display</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>class=select2-choice</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>css=.select2-with-searchbox .select2-input</td>
+ <td>Complexity</td>
+ </tr>
+ <tr>
+ <td>keyPressAndWait</td>
+ <td>css=.select2-with-searchbox .select2-input</td>
+ <td>\13</td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>id=add-metric</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>measures-table</td>
+ <td>*Name*Cmpx*</td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>class=select2-choice</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>css=.select2-with-searchbox .select2-input</td>
+ <td>Comment lines</td>
+ </tr>
+ <tr>
+ <td>keyPressAndWait</td>
+ <td>css=.select2-with-searchbox .select2-input</td>
+ <td>\13</td>
+ </tr>
+ <tr>
+ <td>select</td>
+ <td>id=select-period</td>
+ <td>label=since previous analysis</td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>id=add-metric</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>measures-table</td>
+ <td>*Name*Cmpx*Comment lines*last*</td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>id=exit-edit</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>measures-table</td>
+ <td>*Name*Cmpx*Comment lines*last*</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>delete_column</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/measures</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=.navigator-filter[title='Components: Any']</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=label[title='Files']</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>class=navigator-filter-submit</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>id=change-display</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>measures-table</td>
+ <td>*Name*Last Analysis*LOC*</td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>delete-date</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>measures-table</td>
+ <td>*Name*LOC*</td>
+ </tr>
+ <tr>
+ <td>assertNotText</td>
+ <td>measures-table</td>
+ <td>*Last Analysis*</td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>id=exit-edit</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>measures-table</td>
+ <td>*Name*LOC*</td>
+ </tr>
+ <tr>
+ <td>assertNotText</td>
+ <td>measures-table</td>
+ <td>*Last Analysis*</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>move_columns</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/measures</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=.navigator-filter[title='Components: Any']</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=label[title='Files']</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>class=navigator-filter-submit</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>id=change-display</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>measures-table</td>
+ <td>*Name*Last Analysis*LOC*</td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>left-date</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>measures-table</td>
+ <td>*Last Analysis*Name*LOC*</td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>right-name</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>measures-table</td>
+ <td>*Last Analysis*LOC*Name*</td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>id=exit-edit</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>measures-table</td>
+ <td>*Last Analysis*LOC*Name*</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ SonarQube, open source software quality management tool.
+ ~ Copyright (C) 2008-2014 SonarSource
+ ~ mailto:contact AT sonarsource DOT com
+ ~
+ ~ SonarQube is free software; you can redistribute it and/or
+ ~ modify it under the terms of the GNU Lesser General Public
+ ~ License as published by the Free Software Foundation; either
+ ~ version 3 of the License, or (at your option) any later version.
+ ~
+ ~ SonarQube is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this program; if not, write to the Free Software Foundation,
+ ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ -->
+
+<!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>list_sort_by_descending_name</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/measures</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=.navigator-filter[title='Components: Any']</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=label[title='Files']</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>class=navigator-filter-submit</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementPresent</td>
+ <td>measures-table</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>link=NAME</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>measures-table</td>
+ <td>*b2/HelloB2.xoo*b1/HelloB1.xoo*a2/HelloA2.xoo*a1/HelloA1.xoo*</td>
+ </tr>
+
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ SonarQube, open source software quality management tool.
+ ~ Copyright (C) 2008-2014 SonarSource
+ ~ mailto:contact AT sonarsource DOT com
+ ~
+ ~ SonarQube is free software; you can redistribute it and/or
+ ~ modify it under the terms of the GNU Lesser General Public
+ ~ License as published by the Free Software Foundation; either
+ ~ version 3 of the License, or (at your option) any later version.
+ ~
+ ~ SonarQube is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this program; if not, write to the Free Software Foundation,
+ ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ -->
+
+<!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>list_sort_by_ncloc</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/measures</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=.navigator-filter[title='Components: Any']</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=label[title='Files']</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>class=navigator-filter-submit</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementPresent</td>
+ <td>measures-table</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>css=#measures-table tfoot</td>
+ <td>*4 results*</td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>link=LOC</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>measures-table</td>
+ <td>*a2/HelloA2.xoo*a1/HelloA1.xoo*b1/HelloB1.xoo*b2/HelloB2.xoo*</td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>css=#measures-table tfoot</td>
+ <td>*4 results*</td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>link=LOC</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>css=#measures-table tfoot</td>
+ <td>*4 results*</td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>measures-table</td>
+ <td>*a1/HelloA1.xoo*b1/HelloB1.xoo*b2/HelloB2.xoo*a2/HelloA2.xoo*</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ SonarQube, open source software quality management tool.
+ ~ Copyright (C) 2008-2014 SonarSource
+ ~ mailto:contact AT sonarsource DOT com
+ ~
+ ~ SonarQube is free software; you can redistribute it and/or
+ ~ modify it under the terms of the GNU Lesser General Public
+ ~ License as published by the Free Software Foundation; either
+ ~ version 3 of the License, or (at your option) any later version.
+ ~
+ ~ SonarQube is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this program; if not, write to the Free Software Foundation,
+ ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ -->
+
+<!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>list_widget</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/measures/manage</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>clickAndWait</td>
+ <td>xpath=(//table[contains(@id, 'shared-filters')]//a[contains(text(),'Projects')])</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>storeEval</td>
+ <td>window.location.pathname.split('/')[4]</td>
+ <td>FILTER_ID</td>
+ </tr>
+ <tr>
+ <td>open</td>
+ <td>/sonar/widget?id=measure_filter_list&filter=${FILTER_ID}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>block_1</td>
+ <td>*Name*Version*LOC*Last Analysis*</td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>block_1</td>
+ <td>*Multi-modules Sample*1.0-SNAPSHOT*</td>
+ </tr>
+ <tr>
+ <td>assertNotText</td>
+ <td>block_1</td>
+ <td>*Module A*</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ SonarQube, open source software quality management tool.
+ ~ Copyright (C) 2008-2014 SonarSource
+ ~ mailto:contact AT sonarsource DOT com
+ ~
+ ~ SonarQube is free software; you can redistribute it and/or
+ ~ modify it under the terms of the GNU Lesser General Public
+ ~ License as published by the Free Software Foundation; either
+ ~ version 3 of the License, or (at your option) any later version.
+ ~
+ ~ SonarQube is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this program; if not, write to the Free Software Foundation,
+ ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ -->
+
+<!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>list_widget_sort</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <tbody>
+ <tr>
+ <td>storeEval</td>
+ <td>'sort_widget_'+(new Date()).getTime()</td>
+ <td>FILTER_NAME</td>
+</tr>
+<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>name=commit</td>
+ <td></td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>/sonar/measures</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForText</td>
+ <td>class=navigator-filters</td>
+ <td>*More Criteria*</td>
+</tr>
+ <tr>
+ <td>click</td>
+ <td>css=.navigator-filter[title='Components: Any']</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=label[title='Files']</td>
+ <td></td>
+ </tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>class=navigator-filter-submit</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=save-as</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>save-as-filter-form</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>name</td>
+ <td>${FILTER_NAME}</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>id=save-as-submit</td>
+ <td></td>
+</tr>
+<tr>
+ <td>storeEval</td>
+ <td>window.location.pathname.split('/')[4]</td>
+ <td>FILTER_ID</td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>/sonar/widget?id=measure_filter_list&filter=${FILTER_ID}</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>block_1</td>
+ <td>*Name*LOC*</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>block_1</td>
+ <td>*a1/HelloA1.xoo*a2/HelloA2.xoo*b1/HelloB1.xoo*b2/HelloB2.xoo*</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=LOC</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForText</td>
+ <td>block_1</td>
+ <td>*a2/HelloA2.xoo*a1/HelloA1.xoo*b1/HelloB1.xoo*b2/HelloB2.xoo*</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=LOC</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForText</td>
+ <td>block_1</td>
+ <td>*HelloA1*HelloB1*HelloB2*HelloA2*</td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>list_widget</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/widget?id=measure_filter_list</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>block_1</td>
+ <td>*This widget is configured to display a measure filter that does not exist anymore.*</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>save_with_special_characters</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/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/measures</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForElementPresent</td>
+ <td>name=qualifiers[]</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>class=navigator-filter-submit</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>id=save-as</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForElementPresent</td>
+ <td>save-as-filter-form</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>id=name</td>
+ <td>special $àé'@"</td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>id=description</td>
+ <td>description with special characters " ' éà</td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>id=save-as-submit</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>filter-description</td>
+ <td>*description with special characters " ' éà*</td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>class=navigator-filter-favorite</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>id=manage-favorites</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>my-filters</td>
+ <td>*special $àé'@"*description with special characters " ' éà*</td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>id=delete_special-ae</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForElementPresent</td>
+ <td>confirm-submit</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>id=confirm-submit</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForNotText</td>
+ <td>my-filters</td>
+ <td>*special $àé'@"*</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ SonarQube, open source software quality management tool.
+ ~ Copyright (C) 2008-2014 SonarSource
+ ~ mailto:contact AT sonarsource DOT com
+ ~
+ ~ SonarQube is free software; you can redistribute it and/or
+ ~ modify it under the terms of the GNU Lesser General Public
+ ~ License as published by the Free Software Foundation; either
+ ~ version 3 of the License, or (at your option) any later version.
+ ~
+ ~ SonarQube is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this program; if not, write to the Free Software Foundation,
+ ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ -->
+
+<!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>search-by-key</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/measures</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=.navigator-filter[title='Components: Any']</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=label[title='Projects']</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>class=navigator-filter-more-criteria</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=label[data-property='keySearch']</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>css=#filter-keySearch input[name='keySearch']</td>
+ <td>multi-modules</td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>class=navigator-filter-submit</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>measures-table</td>
+ <td>*Sonar :: Integration Tests :: Multi-modules Sample*</td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>css=#measures-table tfoot</td>
+ <td>*1 results*</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ SonarQube, open source software quality management tool.
+ ~ Copyright (C) 2008-2014 SonarSource
+ ~ mailto:contact AT sonarsource DOT com
+ ~
+ ~ SonarQube is free software; you can redistribute it and/or
+ ~ modify it under the terms of the GNU Lesser General Public
+ ~ License as published by the Free Software Foundation; either
+ ~ version 3 of the License, or (at your option) any later version.
+ ~
+ ~ SonarQube is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this program; if not, write to the Free Software Foundation,
+ ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ -->
+
+<!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>search-by-name</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/measures</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=.navigator-filter[title='Components: Any']</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=label[title='Projects']</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>class=navigator-filter-more-criteria</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=label[data-property='nameSearch']</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>css=#filter-nameSearch input[name='nameSearch']</td>
+ <td>Integration</td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>class=navigator-filter-submit</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>measures-table</td>
+ <td>*Sonar :: Integration Tests :: Multi-modules Sample*</td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>css=#measures-table tfoot</td>
+ <td>*1 results*</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>search_for_files</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/measures</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=.navigator-filter[title='Components: Any']</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=label[title='Files']</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>class=navigator-filter-submit</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>measures-table</td>
+ <td>*a1/HelloA1.xoo*a2/HelloA2.xoo*b1/HelloB1.xoo*b2/HelloB2.xoo*</td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>css=#measures-table tfoot</td>
+ <td>*4 results*</td>
+ </tr>
+ <tr>
+ <td>assertNotText</td>
+ <td>measures-table</td>
+ <td>*Module A*</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ SonarQube, open source software quality management tool.
+ ~ Copyright (C) 2008-2014 SonarSource
+ ~ mailto:contact AT sonarsource DOT com
+ ~
+ ~ SonarQube is free software; you can redistribute it and/or
+ ~ modify it under the terms of the GNU Lesser General Public
+ ~ License as published by the Free Software Foundation; either
+ ~ version 3 of the License, or (at your option) any later version.
+ ~
+ ~ SonarQube is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this program; if not, write to the Free Software Foundation,
+ ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ -->
+
+<!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>search_for_projects_by_default</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/measures</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=.navigator-filter[title='Components: Any']</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=label[title='Projects']</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>class=navigator-filter-submit</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementPresent</td>
+ <td>measures-table</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>measures-table</td>
+ <td>*Sonar :: Integration Tests :: Multi-modules Sample*</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>should_save_issue_filters</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<tbody>
+<tr>
+ <td>storeEval</td>
+ <td>'filter_'+(new Date()).getTime()</td>
+ <td>FILTER_NAME</td>
+</tr>
+<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>user-measures-filter-with-no-share-perm</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>password</td>
+ <td>password</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>commit</td>
+ <td></td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>/sonar/measures</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>css=.navigator-filter[title='Components: Any']</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>css=label[title='Projects']</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>class=navigator-filter-submit</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=save-as</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForText</td>
+ <td>save-as-filter-form</td>
+ <td>*Save Filter*</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>id=name</td>
+ <td>user_${FILTER_NAME}</td>
+</tr>
+<tr>
+ <td>assertNotText</td>
+ <td>save-as-filter-form</td>
+ <td>*Shared with all users*</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=save-as-submit</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForText</td>
+ <td>filter-title</td>
+ <td>*user_${FILTER_NAME}*Private*</td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>should_save_issue_filters</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<tbody>
+<tr>
+ <td>storeEval</td>
+ <td>'filter_'+(new Date()).getTime()</td>
+ <td>FILTER_NAME</td>
+</tr>
+<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>user-measures-filter-with-sharing-perm</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>password</td>
+ <td>password</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>commit</td>
+ <td></td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>/sonar/measures</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>css=.navigator-filter[title='Components: Any']</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>css=label[title='Projects']</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>class=navigator-filter-submit</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=save-as</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForText</td>
+ <td>save-as-filter-form</td>
+ <td>*Save Filter*</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>id=name</td>
+ <td>user_${FILTER_NAME}</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=shared</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=save-as-submit</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForText</td>
+ <td>filter-title</td>
+ <td>*user_${FILTER_NAME}*Shared with all users*</td>
+</tr>
+<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/measures/manage</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForText</td>
+ <td>content</td>
+ <td>*My Measures Filters*</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>shared-filters</td>
+ <td>*user_${FILTER_NAME}*</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=star-user_${FILTER_NAME}</td>
+ <td></td>
+</tr>
+<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>user-measures-filter-with-sharing-perm</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>password</td>
+ <td>password</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>commit</td>
+ <td></td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>/sonar/measures</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>class=navigator-filter-favorite</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>id=manage-favorites</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForText</td>
+ <td>my-filters</td>
+ <td>*user_${FILTER_NAME}*</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=edit_user_${FILTER_NAME}</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForText</td>
+ <td>edit-filter-form</td>
+ <td>*Edit Filter*</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>shared</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>id=save-submit</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForText</td>
+ <td>filter-title</td>
+ <td>*user_${FILTER_NAME}*Private*</td>
+</tr>
+<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/measures/manage</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForText</td>
+ <td>content</td>
+ <td>*My Measures Filters*</td>
+</tr>
+<tr>
+ <td>assertNotText</td>
+ <td>shared-filters</td>
+ <td>*user_${FILTER_NAME}*</td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<profile>
+ <name>one-issue-per-line</name>
+ <language>xoo</language>
+ <rules>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>OneIssuePerLine</key>
+ <priority>MINOR</priority>
+ </rule>
+ </rules>
+</profile>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<profile>
+ <name>one-issue-per-line</name>
+ <language>xoo</language>
+ <rules>
+ <rule>
+ <repositoryKey>xoo</repositoryKey>
+ <key>OneIssuePerLine</key>
+ <priority>MINOR</priority>
+ </rule>
+ </rules>
+</profile>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<profile>
- <name>one-issue-per-line</name>
- <language>xoo</language>
- <rules>
- <rule>
- <repositoryKey>xoo</repositoryKey>
- <key>OneIssuePerLine</key>
- <priority>MINOR</priority>
- </rule>
- </rules>
-</profile>
\ No newline at end of file
--- /dev/null
+<?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>bulk-delete-filter-projects</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/sessions/login</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/projects</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForText</td>
+ <td>content</td>
+ <td>*Bar-Sonar-Plugin*Foo-Application*Sample-Project*</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>css=.search-box-input</td>
+ <td>s</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>css=.search-box-submit</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForText</td>
+ <td>content</td>
+ <td>*Bar-Sonar-Plugin*Sample-Project*</td>
+</tr>
+<tr>
+ <td>waitForText</td>
+ <td>content</td>
+ <td>*cameleon-3*cameleon-1*</td>
+</tr>
+<tr>
+ <td>assertTextNotPresent</td>
+ <td>content</td>
+ <td>*Foo-Application*</td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>should-display-alerts-correctly-history-page</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <thead>
+ <tr>
+ <td rowspan="1" colspan="3">should-display-alerts-correctly-history-page</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/sessions/login</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/dashboard/index/sample</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=#context-navigation .navbar-admin-link</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForElementPresent</td>
+ <td>link=History</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>link=History</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementPresent</td>
+ <td>//img[@title='Quality Gate Status: Green (was Orange). ']</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementPresent</td>
+ <td>//img[@title='Quality Gate Status: Orange. Lines > 5']</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>should-display-alerts-correctly-history-page</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <thead>
+ <tr>
+ <td rowspan="1" colspan="3">should-display-alerts-correctly-history-page</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/sessions/login</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/widget?id=alerts&resource=sample</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>class=alerts</td>
+ <td>glob:*Lines*0 < 10*since previous analysis*</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>class=alert_ERROR</td>
+ <td>0</td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>override-global-settings</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <thead>
+ <tr>
+ <td rowspan="1" colspan="3">override-global-settings</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/sessions/logout</td>
+ <td></td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>/sonar/project/settings/com.sonarsource.it.samples%3Amulti-modules-sample%3Amodule_a</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>plugins</td>
+ <td>*Settings*</td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ SonarQube, open source software quality management tool.
+ ~ Copyright (C) 2008-2014 SonarSource
+ ~ mailto:contact AT sonarsource DOT com
+ ~
+ ~ SonarQube is free software; you can redistribute it and/or
+ ~ modify it under the terms of the GNU Lesser General Public
+ ~ License as published by the Free Software Foundation; either
+ ~ version 3 of the License, or (at your option) any later version.
+ ~
+ ~ SonarQube is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this program; if not, write to the Free Software Foundation,
+ ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ -->
+
+<!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>multimodule-project-delete-version</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <thead>
+ <tr>
+ <td rowspan="1" colspan="3">project-modify-versions</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/sessions/logout</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>open</td>
+ <td>/sonar/sessions/login</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/project/history/com.sonarsource.it.samples:multi-modules-sample</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>link=Remove</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertConfirmation</td>
+ <td>Are you sure you want to remove "RELEASE" from this snapshot?</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>infomsg</td>
+ <td>glob:*Version "RELEASE" was removed from current project and all its sub-projects*</td>
+ </tr>
+ <tr>
+ <td>assertNotText</td>
+ <td>version_1</td>
+ <td>glob:*RELEASE*</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ SonarQube, open source software quality management tool.
+ ~ Copyright (C) 2008-2014 SonarSource
+ ~ mailto:contact AT sonarsource DOT com
+ ~
+ ~ SonarQube is free software; you can redistribute it and/or
+ ~ modify it under the terms of the GNU Lesser General Public
+ ~ License as published by the Free Software Foundation; either
+ ~ version 3 of the License, or (at your option) any later version.
+ ~
+ ~ SonarQube is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this program; if not, write to the Free Software Foundation,
+ ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ -->
+
+<!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>multimodule-project-modify-version</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <thead>
+ <tr>
+ <td rowspan="1" colspan="3">project-modify-versions</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/sessions/logout</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>open</td>
+ <td>/sonar/sessions/login</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/project/history/com.sonarsource.it.samples:multi-modules-sample</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementNotPresent</td>
+ <td>link=Remove</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>version_1_change</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>version_name_1</td>
+ <td>RELEASE</td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>save_version_1</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForElementPresent</td>
+ <td>infomsg</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>infomsg</td>
+ <td>Version "RELEASE" was created for current project and all its sub-projects.</td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>version_1</td>
+ <td>glob:*RELEASE*</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>project-deletion</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <thead>
+ <tr>
+ <td rowspan="1" colspan="3">project-deletion</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/sessions/logout</td>
+ <td></td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>/sonar/sessions/login</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>login</td>
+ <td>project-deletion-with-admin-permission-on-project</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>password</td>
+ <td>password</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>commit</td>
+ <td></td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>/sonar/</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTextPresent</td>
+ <td>Sample</td>
+ <td></td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>/sonar/dashboard/index/sample</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>css=#context-navigation .navbar-admin-link</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Deletion</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>link=Deletion</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>delete_resource</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForText</td>
+ <td>delete-project-form</td>
+ <td>*Delete Project*</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>delete-project-submit</td>
+ <td></td>
+</tr>
+<tr>
+ <td>pause</td>
+ <td>3000</td>
+ <td>NOTE: necessary as the deletion is asynchronous</td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>/sonar/</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTextNotPresent</td>
+ <td>content</td>
+ <td>*Sample*</td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>override-global-settings</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <thead>
+ <tr>
+ <td rowspan="1" colspan="3">override-global-settings</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/sessions/logout</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>open</td>
+ <td>/sonar/project/settings/sample?category=project-only</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_prop_only_on_project</td>
+ <td>foo</td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>id=submit_settings</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertValue</td>
+ <td>id=input_prop_only_on_project</td>
+ <td>foo</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>override-global-settings</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <thead>
+ <tr>
+ <td rowspan="1" colspan="3">override-global-settings</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/sessions/logout</td>
+ <td></td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>/sonar/project/settings/sample?category=exclusions&subcategory=files</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_sonar.skippedModules</td>
+ <td>my-excluded-module</td>
+</tr>
+ <tr>
+ <td>click</td>
+ <td>id=submit_settings</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>id=input_sonar.skippedModules</td>
+ <td>my-excluded-module</td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>bulk-update-impossible-because-duplicate-keys</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/sessions/login</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/dashboard/index/com.sonarsource.it.samples:multi-modules-sample</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>css=#context-navigation .navbar-admin-link</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>link=Update Key</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>id=string_to_replace</td>
+ <td>com.sonarsource.it.samples:multi-modules-sample:module_a </td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>id=replacement_string</td>
+ <td>com.sonarsource.it.samples:multi-modules-sample:module_b </td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>id=bulk_update_button</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>content</td>
+ <td>*Bulk update can not be performed*The replacement of "com.sonarsource.it.samples:multi-modules-sample:module_a" by "com.sonarsource.it.samples:multi-modules-sample:module_b" is impossible as it would result in duplicate keys (in red below):*</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>content</td>
+ <td>*Duplicate key*</td>
+</tr>
+<tr>
+ <td>assertElementNotPresent</td>
+ <td>id=bulk_update_button</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>Link=Back</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>content</td>
+ <td>*Update Key*com.sonarsource.it.samples:multi-modules-sample*</td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>bulk-update-impossible-because-no-input</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/sessions/login</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/dashboard/index/com.sonarsource.it.samples:multi-modules-sample</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=#context-navigation .navbar-admin-link</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForElementPresent</td>
+ <td>link=Update Key</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>link=Update Key</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>id=bulk_update_button</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>content</td>
+ <td>*The two fields can not be blank for the bulk update.*</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>bulk-update-impossible-because-no-match</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/sessions/login</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/dashboard/index/com.sonarsource.it.samples:multi-modules-sample</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=#context-navigation .navbar-admin-link</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForElementPresent</td>
+ <td>link=Update Key</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>link=Update Key</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>id=string_to_replace</td>
+ <td>foo</td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>id=replacement_string</td>
+ <td>org.sonar</td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>id=bulk_update_button</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>content</td>
+ <td>*Bulk update can not be performed*No key contains the string to replace ("foo").*</td>
+ </tr>
+ <tr>
+ <td>assertElementNotPresent</td>
+ <td>id=bulk_update_button</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>Link=Back</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>content</td>
+ <td>*Update Key*com.sonarsource.it.samples:multi-modules-sample*</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>bulk-update-success</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/sessions/login</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/dashboard/index/com.sonarsource.it.samples:multi-modules-sample</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>css=#context-navigation .navbar-admin-link</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Update Key</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>link=Update Key</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>id=string_to_replace</td>
+ <td>com.sonarsource</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>id=replacement_string</td>
+ <td>org.sonar</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>id=bulk_update_button</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>content</td>
+ <td>*Do you really want to perform the bulk update on project keys?*</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>content</td>
+ <td>*com.sonarsource.it.samples:multi-modules-sample*org.sonar.it.samples:multi-modules-sample*</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>content</td>
+ <td>*com.sonarsource.it.samples:multi-modules-sample:module_a*org.sonar.it.samples:multi-modules-sample:module_a*</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>id=bulk_update_button</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>content</td>
+ <td>*The key has successfully been updated for all required resources.*</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>content</td>
+ <td>*org.sonar.it.samples:multi-modules-sample*</td>
+</tr>
+<tr>
+ <td>assertTextNotPresent</td>
+ <td>content</td>
+ <td>*com.sonarsource.it.samples:multi-modules-sample*</td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>fine-grained-update-impossible</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/sessions/login</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/dashboard/index/com.sonarsource.it.samples:multi-modules-sample</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=#context-navigation .navbar-admin-link</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForElementPresent</td>
+ <td>link=Update Key</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>link=Update Key</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>id=key_05</td>
+ <td>com.sonarsource.it.samples:multi-modules-sample:module_b</td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>id=update_key_05</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertConfirmation</td>
+ <td>*Are you sure you want to rename "com.sonarsource.it.samples:multi-modules-sample:module_*", as well as all its modules and resources?*</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>id=error</td>
+ <td>*"com.sonarsource.it.samples:multi-modules-sample:module_*" can not be renamed because "com.sonarsource.it.samples:multi-modules-sample:module_b" is the key of an existing resource. The update has been canceled.*</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>fine-grained-update-success</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/sessions/login</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/dashboard/index/com.sonarsource.it.samples:multi-modules-sample</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=#context-navigation .navbar-admin-link</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForElementPresent</td>
+ <td>link=Update Key</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>link=Update Key</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>id=key_02</td>
+ <td>com.sonarsource.it.samples:module_c1</td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>id=update_key_02</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertConfirmation</td>
+ <td>*Are you sure you want to rename "com.sonarsource.it.samples:multi-modules-sample:module_*", as well as all its modules and resources?*</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>content</td>
+ <td>*The key has successfully been updated for all required resources.*</td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>content</td>
+ <td>*com.sonarsource.it.samples:module_c1*</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
+++ /dev/null
-keytool -genkey -alias tests -keyalg RSA -keystore keystore.jks
-keystore password: thepassword
-key password for <tests>: thetests
\ No newline at end of file
+++ /dev/null
-<?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>system_info</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <thead>
- <tr>
- <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>
- <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/system/index</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>id=content</td>
- <td>*Version*.*-SNAPSHOT*</td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>id=content</td>
- <td>*Database Version*</td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>id=content</td>
- <td>*Pool Active Connections*</td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>id=content</td>
- <td>*Start Time*</td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>id=content</td>
- <td>*Processors*</td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>id=content</td>
- <td>*java.class.path*java.specification.version*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>open</td>
- <td>/sonar/system</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>id=content</td>
- <td>glob:*Server ID*${server_id}*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>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>
- <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>
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>property-relocation</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/index?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>assertText</td>
- <td>properties</td>
- <td>*sonar.newKey*</td>
-</tr>
-<tr>
- <td>assertNotText</td>
- <td>properties</td>
- <td>*sonar.deprecatedKey*</td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?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>
+++ /dev/null
-0PZz+G+f8mjr3sPn4+AhHg==
\ No newline at end of file
+++ /dev/null
-<?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>waitForElementPresent</td>
- <td>css=#dashboard</td>
- <td></td>
- </tr>
-</table>
-</body>
-</html>
--- /dev/null
+keytool -genkey -alias tests -keyalg RSA -keystore keystore.jks
+keystore password: thepassword
+key password for <tests>: thetests
\ No newline at end of file
--- /dev/null
+<?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>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ SonarQube, open source software quality management tool.
+ ~ Copyright (C) 2008-2014 SonarSource
+ ~ mailto:contact AT sonarsource DOT com
+ ~
+ ~ SonarQube is free software; you can redistribute it and/or
+ ~ modify it under the terms of the GNU Lesser General Public
+ ~ License as published by the Free Software Foundation; either
+ ~ version 3 of the License, or (at your option) any later version.
+ ~
+ ~ SonarQube is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this program; if not, write to the Free Software Foundation,
+ ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ -->
+
+<!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>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ SonarQube, open source software quality management tool.
+ ~ Copyright (C) 2008-2014 SonarSource
+ ~ mailto:contact AT sonarsource DOT com
+ ~
+ ~ SonarQube is free software; you can redistribute it and/or
+ ~ modify it under the terms of the GNU Lesser General Public
+ ~ License as published by the Free Software Foundation; either
+ ~ version 3 of the License, or (at your option) any later version.
+ ~
+ ~ SonarQube is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this program; if not, write to the Free Software Foundation,
+ ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ -->
+
+<!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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>system_info</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <thead>
+ <tr>
+ <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>
+ <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/system/index</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>id=content</td>
+ <td>*Version*.*-SNAPSHOT*</td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>id=content</td>
+ <td>*Database Version*</td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>id=content</td>
+ <td>*Pool Active Connections*</td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>id=content</td>
+ <td>*Start Time*</td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>id=content</td>
+ <td>*Processors*</td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>id=content</td>
+ <td>*java.class.path*java.specification.version*</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ SonarQube, open source software quality management tool.
+ ~ Copyright (C) 2008-2014 SonarSource
+ ~ mailto:contact AT sonarsource DOT com
+ ~
+ ~ SonarQube is free software; you can redistribute it and/or
+ ~ modify it under the terms of the GNU Lesser General Public
+ ~ License as published by the Free Software Foundation; either
+ ~ version 3 of the License, or (at your option) any later version.
+ ~
+ ~ SonarQube is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this program; if not, write to the Free Software Foundation,
+ ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ -->
+
+<!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>waitForElementPresent</td>
+ <td>css=#dashboard</td>
+ <td></td>
+ </tr>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>open</td>
+ <td>/sonar/system</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>id=content</td>
+ <td>glob:*Server ID*${server_id}*</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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</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?category=DEV</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForValue</td>
+ <td>name=page_version</td>
+ <td>1</td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>id=input_value</td>
+ <td>FIRST</td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=button.add_value</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>xpath=(//input[@id='input_value'])[2]</td>
+ <td>SECOND</td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=button.add_value</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>xpath=(//input[@id='input_value'])[3]</td>
+ <td>THIRD</td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>id=submit_settings</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForValue</td>
+ <td>name=page_version</td>
+ <td>2</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>update</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?category=DEV</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForValue</td>
+ <td>name=page_version</td>
+ <td>1</td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>link=Delete</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>id=submit_settings</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForValue</td>
+ <td>name=page_version</td>
+ <td>2</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>all_types</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?category=DEV</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForValue</td>
+ <td>name=page_version</td>
+ <td>1</td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>id=input_text</td>
+ <td>text</td>
+ </tr>
+ <tr>
+ <td>select</td>
+ <td>id=input_boolean</td>
+ <td>label=True</td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>id=input_float</td>
+ <td>42.0</td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>id=input_license</td>
+ <td>abc</td>
+ </tr>
+ <tr>
+ <td>select</td>
+ <td>id=input_metric</td>
+ <td>label=Overall condition coverage</td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>id=input_password</td>
+ <td>abcde</td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>id=input_regexp</td>
+ <td>.*</td>
+ </tr>
+ <tr>
+ <td>select</td>
+ <td>id=input_list</td>
+ <td>label=AAA</td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>id=submit_settings</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForValue</td>
+ <td>name=page_version</td>
+ <td>2</td>
+ </tr>
+ <tr>
+ <td>assertValue</td>
+ <td>id=input_text</td>
+ <td>text</td>
+ </tr>
+ <tr>
+ <td>assertValue</td>
+ <td>id=input_boolean</td>
+ <td>true</td>
+ </tr>
+ <tr>
+ <td>assertValue</td>
+ <td>id=input_float</td>
+ <td>42.0</td>
+ </tr>
+ <tr>
+ <td>assertValue</td>
+ <td>id=input_license</td>
+ <td>abc</td>
+ </tr>
+ <tr>
+ <td>assertValue</td>
+ <td>id=input_metric</td>
+ <td>overall_branch_coverage</td>
+ </tr>
+ <tr>
+ <td>assertValue</td>
+ <td>id=input_password</td>
+ <td>{{*******************}}</td>
+ </tr>
+ <tr>
+ <td>assertValue</td>
+ <td>id=input_regexp</td>
+ <td>exact:.*</td>
+ </tr>
+ <tr>
+ <td>assertValue</td>
+ <td>id=input_list</td>
+ <td>AAA</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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</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?category=DEV</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForValue</td>
+ <td>name=page_version</td>
+ <td>1</td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>id=input_key</td>
+ <td>jira1</td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>id=input_url</td>
+ <td>http://jira</td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>id=input_port</td>
+ <td>12345</td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>id=submit_settings</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForValue</td>
+ <td>name=page_version</td>
+ <td>2</td>
+ </tr>
+ <tr>
+ <td>assertValue</td>
+ <td>id=input_key</td>
+ <td>jira1</td>
+ </tr>
+ <tr>
+ <td>assertValue</td>
+ <td>id=input_url</td>
+ <td>exact:http://jira</td>
+ </tr>
+ <tr>
+ <td>assertValue</td>
+ <td>id=input_port</td>
+ <td>12345</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>delete</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?category=DEV</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForValue</td>
+ <td>name=page_version</td>
+ <td>1</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>id=input_key</td>
+ <td>jira1</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>id=input_url</td>
+ <td>http://jira1</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>css=#block_sonar\.test\.jira\.servers .add_value</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>xpath=(//input[@id='input_key'])[2]</td>
+ <td>jira2</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>xpath=(//input[@id='input_url'])[2]</td>
+ <td>http://jira2</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=submit_settings</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForValue</td>
+ <td>name=page_version</td>
+ <td>2</td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>xpath=(//input[@id='input_key'])[1]</td>
+ <td>jira1</td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>xpath=(//input[@id='input_key'])[2]</td>
+ <td>jira2</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>xpath=(//a[contains(text(),'Delete')])[3]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>id=submit_settings</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForValue</td>
+ <td>name=page_version</td>
+ <td>3</td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>xpath=(//input[@id='input_key'])[1]</td>
+ <td>jira1</td>
+</tr>
+<tr>
+ <td>waitForNotText</td>
+ <td>xpath=(//input[@id='input_key'])</td>
+ <td>*jira2*</td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>reference</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?category=DEV</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForValue</td>
+ <td>name=page_version</td>
+ <td>1</td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>xpath=(//input[@id='input_key'])[1]</td>
+ <td>jira1</td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=#block_sonar\.test\.jira\.servers .add_value</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>xpath=(//input[@id='input_key'])[2]</td>
+ <td>jira2</td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>id=submit_settings</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForValue</td>
+ <td>name=page_version</td>
+ <td>2</td>
+ </tr>
+ <tr>
+ <td>assertSelectOptions</td>
+ <td>id=input_sonar.test.jira</td>
+ <td>Default,jira1,jira2</td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>xpath=(//a[contains(text(),'Delete')])[2]</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>id=submit_settings</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForValue</td>
+ <td>name=page_version</td>
+ <td>3</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>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>
+ <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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>property-relocation</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/index?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>assertText</td>
+ <td>properties</td>
+ <td>*sonar.newKey*</td>
+</tr>
+<tr>
+ <td>assertNotText</td>
+ <td>properties</td>
+ <td>*sonar.deprecatedKey*</td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>
--- /dev/null
+0PZz+G+f8mjr3sPn4+AhHg==
\ No newline at end of file
--- /dev/null
+<?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>
--- /dev/null
+<?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>global-subcategories</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?category=Category 2</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForValue</td>
+ <td>name=page_version</td>
+ <td>1</td>
+ </tr>
+ <!-- First subcategory should be selected by default -->
+ <tr>
+ <td>assertElementPresent</td>
+ <td>id=input_prop2_1</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementNotPresent</td>
+ <td>id=input_prop2_2</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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>global-subcategories</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?category=Category 1</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForValue</td>
+ <td>name=page_version</td>
+ <td>1</td>
+ </tr>
+ <tr>
+ <td>assertElementNotPresent</td>
+ <td>id=input_prop1</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementNotPresent</td>
+ <td>id=input_prop2</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementNotPresent</td>
+ <td>id=input_prop3</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementPresent</td>
+ <td>id=input_prop4</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>link=Sub category 1</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementPresent</td>
+ <td>id=input_prop1</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementPresent</td>
+ <td>id=input_prop2</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementNotPresent</td>
+ <td>id=input_prop3</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementNotPresent</td>
+ <td>id=input_prop4</td>
+ <td></td>
+ </tr>
+ <!-- Verify index attribute is taken into account -->
+ <tr>
+ <td>assertElementPresent</td>
+ <td>xpath=//.[@id='input_prop2']/following::input[@id='input_prop1']</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>link=Sub category 2</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>id=input_prop3</td>
+ <td>myValue</td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>id=submit_settings</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForValue</td>
+ <td>name=page_version</td>
+ <td>2</td>
+ </tr>
+ <tr>
+ <td>assertElementNotPresent</td>
+ <td>id=input_prop1</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementNotPresent</td>
+ <td>id=input_prop2</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementPresent</td>
+ <td>id=input_prop3</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementNotPresent</td>
+ <td>id=input_prop4</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertValue</td>
+ <td>id=input_prop3</td>
+ <td>myValue</td>
+ </tr>
+ <!-- SONAR-4473 -->
+ <tr>
+ <td>clickAndWait</td>
+ <td>link=Sub category 1</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementPresent</td>
+ <td>id=input_prop1</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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</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/project/settings/sample?category=Category 2</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForValue</td>
+ <td>name=page_version</td>
+ <td>1</td>
+ </tr>
+ <!-- First subcategory should be selected by default -->
+ <tr>
+ <td>assertElementPresent</td>
+ <td>id=input_prop2_1</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementNotPresent</td>
+ <td>id=input_prop2_2</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+<?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</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/project/settings/sample?category=Category 1</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForValue</td>
+ <td>name=page_version</td>
+ <td>1</td>
+ </tr>
+ <tr>
+ <td>assertElementNotPresent</td>
+ <td>id=input_prop1</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementNotPresent</td>
+ <td>id=input_prop2</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementNotPresent</td>
+ <td>id=input_prop3</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementPresent</td>
+ <td>id=input_prop4</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>link=Sub category 1</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementPresent</td>
+ <td>id=input_prop1</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementPresent</td>
+ <td>id=input_prop2</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementNotPresent</td>
+ <td>id=input_prop3</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementNotPresent</td>
+ <td>id=input_prop4</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>clickAndWait</td>
+ <td>link=Sub category 2</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>id=input_prop3</td>
+ <td>myValue2</td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>id=submit_settings</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForValue</td>
+ <td>name=page_version</td>
+ <td>2</td>
+ </tr>
+ <tr>
+ <td>assertElementNotPresent</td>
+ <td>id=input_prop1</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementNotPresent</td>
+ <td>id=input_prop2</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementPresent</td>
+ <td>id=input_prop3</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementNotPresent</td>
+ <td>id=input_prop4</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertValue</td>
+ <td>id=input_prop3</td>
+ <td>myValue2</td>
+ </tr>
+ <!-- SONAR-4473 -->
+ <tr>
+ <td>clickAndWait</td>
+ <td>link=Sub category 1</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>assertElementPresent</td>
+ <td>id=input_prop1</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null
+{
+ "sources": [
+ {
+ "line": 1,
+ "code": "package sample;",
+ },
+ {
+ "line": 2,
+ "code": "",
+ },
+ {
+ "line": 3,
+ "code": "public class Sample {",
+ },
+ {
+ "line": 4,
+ "code": "\t",
+ },
+ {
+ "line": 5,
+ "code": "\tpublic Sample(int i) {",
+ },
+ {
+ "line": 6,
+ "code": "\t\tint j = i++;",
+ "itLineHits": 1
+ },
+ {
+ "line": 7,
+ "code": "\t}",
+ },
+ {
+ "line": 8,
+ "code": "\t",
+ },
+ {
+ "line": 9,
+ "code": "\tprivate String myMethod() {",
+ },
+ {
+ "line": 10,
+ "code": "\t\tif (foo == bar) {",
+ "itLineHits": 0
+ },
+ {
+ "line": 11,
+ "code": "\t\t\treturn \"hello\";",
+ "itLineHits": 1
+ },
+ {
+ "line": 12,
+ "code": "\t\t} else {",
+ },
+ {
+ "line": 13,
+ "code": "\t\t\tthrow new IllegalStateException();",
+ "itLineHits": 0
+ },
+ {
+ "line": 14,
+ "code": "\t\t}",
+ },
+ {
+ "line": 15,
+ "code": "\t}",
+ },
+ {
+ "line": 16,
+ "code": "}",
+ },
+ {
+ "line": 17,
+ "code": "",
+ }
+ ]
+}
--- /dev/null
+{
+ "sources":[
+ {
+ "line": 1,
+ "code": "package sample;",
+ },
+ {
+ "line": 2,
+ "code": "",
+ },
+ {
+ "line": 3,
+ "code": "public class Sample {",
+ },
+ {
+ "line": 4,
+ "code": "\t",
+ },
+ {
+ "line": 5,
+ "code": "\tpublic Sample(int i) {",
+ },
+ {
+ "line": 6,
+ "code": "\t\tint j = i++;",
+ "utLineHits": 1
+ },
+ {
+ "line": 7,
+ "code": "\t}",
+ },
+ {
+ "line": 8,
+ "code": "\t",
+ },
+ {
+ "line": 9,
+ "code": "\tprivate String myMethod() {",
+ },
+ {
+ "line": 10,
+ "code": "\t\tif (foo == bar) {",
+ "utLineHits": 0,
+ "utConditions": 2,
+ "utCoveredConditions": 1
+ },
+ {
+ "line": 11,
+ "code": "\t\t\treturn \"hello\";",
+ "utLineHits": 1
+ },
+ {
+ "line": 12,
+ "code": "\t\t} else {",
+ },
+ {
+ "line": 13,
+ "code": "\t\t\tthrow new IllegalStateException();",
+ "utLineHits": 0
+ },
+ {
+ "line": 14,
+ "code": "\t\t}",
+ },
+ {
+ "line": 15,
+ "code": "\t}",
+ },
+ {
+ "line": 16,
+ "code": "}",
+ },
+ {
+ "line": 17,
+ "code": "",
+ }
+ ]
+}
--- /dev/null
+{
+ "sources": [
+ {
+ "line": 1,
+ "code": "package sample;",
+ },
+ {
+ "line": 2,
+ "code": "",
+ },
+ {
+ "line": 3,
+ "code": "public class Sample {",
+ },
+ {
+ "line": 4,
+ "code": "\t",
+ },
+ {
+ "line": 5,
+ "code": "\tpublic Sample(int i) {",
+ },
+ {
+ "line": 6,
+ "code": "\t\tint j = i++;",
+ "utLineHits": 1
+ },
+ {
+ "line": 7,
+ "code": "\t}",
+ },
+ {
+ "line": 8,
+ "code": "\t",
+ },
+ {
+ "line": 9,
+ "code": "\tprivate String myMethod() {",
+ },
+ {
+ "line": 10,
+ "code": "\t\tif (foo == bar) {",
+ "utLineHits": 0
+ },
+ {
+ "line": 11,
+ "code": "\t\t\treturn \"hello\";",
+ "utLineHits": 1
+ },
+ {
+ "line": 12,
+ "code": "\t\t} else {",
+ },
+ {
+ "line": 13,
+ "code": "\t\t\tthrow new IllegalStateException();",
+ "utLineHits": 0
+ },
+ {
+ "line": 14,
+ "code": "\t\t}",
+ },
+ {
+ "line": 15,
+ "code": "\t}",
+ },
+ {
+ "line": 16,
+ "code": "}",
+ },
+ {
+ "line": 17,
+ "code": "",
+ }
+ ]
+}
--- /dev/null
+{
+ "sources": [
+ {
+ "line": 1,
+ "code": "package sample;",
+ },
+ {
+ "line": 2,
+ "code": "",
+ },
+ {
+ "line": 3,
+ "code": "public class Sample {",
+ },
+ {
+ "line": 4,
+ "code": "\t",
+ },
+ {
+ "line": 5,
+ "code": "\tpublic Sample(int i) {",
+ },
+ {
+ "line": 6,
+ "code": "\t\tint j = i++;",
+ "utLineHits": 1,
+ "itLineHits": 1
+ },
+ {
+ "line": 7,
+ "code": "\t}",
+ },
+ {
+ "line": 8,
+ "code": "\t",
+ },
+ {
+ "line": 9,
+ "code": "\tprivate String myMethod() {",
+ },
+ {
+ "line": 10,
+ "code": "\t\tif (foo == bar && biz > 1) {",
+ "utLineHits": 0,
+ "utConditions": 4,
+ "utCoveredConditions": 1,
+ "itLineHits": 0,
+ "itConditions": 4,
+ "itCoveredConditions": 1
+ },
+ {
+ "line": 11,
+ "code": "\t\t\treturn \"hello\";",
+ "utLineHits": 1,
+ "itLineHits": 0
+ },
+ {
+ "line": 12,
+ "code": "\t\t} else {",
+ },
+ {
+ "line": 13,
+ "code": "\t\t\tthrow new IllegalStateException();",
+ "utLineHits": 0,
+ "itLineHits": 1
+ },
+ {
+ "line": 14,
+ "code": "\t\t}",
+ },
+ {
+ "line": 15,
+ "code": "\t}",
+ },
+ {
+ "line": 16,
+ "code": "}",
+ },
+ {
+ "line": 17,
+ "code": "",
+ }
+ ]
+
+}
--- /dev/null
+{
+ "files": [
+ {
+ "key": "sample-with-tests:src/main/xoo/sample/Sample.xoo",
+ "longName": "src/main/xoo/sample/Sample.xoo",
+ "coveredLines": 2
+ },
+ {
+ "key": "sample-with-tests:src/main/xoo/sample/Sample2.xoo",
+ "longName": "src/main/xoo/sample/Sample2.xoo",
+ "coveredLines": 1
+ }
+ ]
+}
--- /dev/null
+{
+ "tests": [
+ {
+ "name": "success",
+ "status": "OK",
+ "durationInMs": 4,
+ "coveredLines": 3,
+ "message": "",
+ "stacktrace": ""
+ },
+ {
+ "name": "error",
+ "status": "ERROR",
+ "durationInMs": 2,
+ "coveredLines": 0,
+ "message": "Error",
+ "stacktrace": "The stack"
+ },
+ {
+ "name": "failure",
+ "status": "FAILURE",
+ "durationInMs": 2,
+ "coveredLines": 1,
+ "message": "Failure",
+ "stacktrace": ""
+ },
+ {
+ "name": "skipped",
+ "status": "SKIPPED",
+ "coveredLines": 0,
+ "message": "",
+ "stacktrace": ""
+ }
+ ]
+}
--- /dev/null
+{
+ "tests": [
+ {
+ "name": "success",
+ "status": "OK",
+ "durationInMs": 4,
+ "coveredLines": 0,
+ "message": "",
+ "stacktrace": ""
+ },
+ {
+ "name": "error",
+ "status": "ERROR",
+ "durationInMs": 2,
+ "coveredLines": 0,
+ "message": "Error",
+ "stacktrace": "The stack"
+ },
+ {
+ "name": "failure",
+ "status": "FAILURE",
+ "durationInMs": 2,
+ "coveredLines": 0,
+ "message": "Failure",
+ "stacktrace": ""
+ },
+ {
+ "name": "skipped",
+ "status": "SKIPPED",
+ "coveredLines": 0,
+ "message": "",
+ "stacktrace": ""
+ }
+ ]
+}
+++ /dev/null
-{
- "sources": [
- {
- "line": 1,
- "code": "package sample;",
- },
- {
- "line": 2,
- "code": "",
- },
- {
- "line": 3,
- "code": "public class Sample {",
- },
- {
- "line": 4,
- "code": "\t",
- },
- {
- "line": 5,
- "code": "\tpublic Sample(int i) {",
- },
- {
- "line": 6,
- "code": "\t\tint j = i++;",
- "itLineHits": 1
- },
- {
- "line": 7,
- "code": "\t}",
- },
- {
- "line": 8,
- "code": "\t",
- },
- {
- "line": 9,
- "code": "\tprivate String myMethod() {",
- },
- {
- "line": 10,
- "code": "\t\tif (foo == bar) {",
- "itLineHits": 0
- },
- {
- "line": 11,
- "code": "\t\t\treturn \"hello\";",
- "itLineHits": 1
- },
- {
- "line": 12,
- "code": "\t\t} else {",
- },
- {
- "line": 13,
- "code": "\t\t\tthrow new IllegalStateException();",
- "itLineHits": 0
- },
- {
- "line": 14,
- "code": "\t\t}",
- },
- {
- "line": 15,
- "code": "\t}",
- },
- {
- "line": 16,
- "code": "}",
- },
- {
- "line": 17,
- "code": "",
- }
- ]
-
-}
+++ /dev/null
-{
- "sources":[
- {
- "line": 1,
- "code": "package sample;",
- },
- {
- "line": 2,
- "code": "",
- },
- {
- "line": 3,
- "code": "public class Sample {",
- },
- {
- "line": 4,
- "code": "\t",
- },
- {
- "line": 5,
- "code": "\tpublic Sample(int i) {",
- },
- {
- "line": 6,
- "code": "\t\tint j = i++;",
- "utLineHits": 1
- },
- {
- "line": 7,
- "code": "\t}",
- },
- {
- "line": 8,
- "code": "\t",
- },
- {
- "line": 9,
- "code": "\tprivate String myMethod() {",
- },
- {
- "line": 10,
- "code": "\t\tif (foo == bar) {",
- "utLineHits": 0,
- "utConditions": 2,
- "utCoveredConditions": 1
- },
- {
- "line": 11,
- "code": "\t\t\treturn \"hello\";",
- "utLineHits": 1
- },
- {
- "line": 12,
- "code": "\t\t} else {",
- },
- {
- "line": 13,
- "code": "\t\t\tthrow new IllegalStateException();",
- "utLineHits": 0
- },
- {
- "line": 14,
- "code": "\t\t}",
- },
- {
- "line": 15,
- "code": "\t}",
- },
- {
- "line": 16,
- "code": "}",
- },
- {
- "line": 17,
- "code": "",
- }
- ]
-}
+++ /dev/null
-{
- "sources": [
- {
- "line": 1,
- "code": "package sample;",
- },
- {
- "line": 2,
- "code": "",
- },
- {
- "line": 3,
- "code": "public class Sample {",
- },
- {
- "line": 4,
- "code": "\t",
- },
- {
- "line": 5,
- "code": "\tpublic Sample(int i) {",
- },
- {
- "line": 6,
- "code": "\t\tint j = i++;",
- "utLineHits": 1
- },
- {
- "line": 7,
- "code": "\t}",
- },
- {
- "line": 8,
- "code": "\t",
- },
- {
- "line": 9,
- "code": "\tprivate String myMethod() {",
- },
- {
- "line": 10,
- "code": "\t\tif (foo == bar) {",
- "utLineHits": 0
- },
- {
- "line": 11,
- "code": "\t\t\treturn \"hello\";",
- "utLineHits": 1
- },
- {
- "line": 12,
- "code": "\t\t} else {",
- },
- {
- "line": 13,
- "code": "\t\t\tthrow new IllegalStateException();",
- "utLineHits": 0
- },
- {
- "line": 14,
- "code": "\t\t}",
- },
- {
- "line": 15,
- "code": "\t}",
- },
- {
- "line": 16,
- "code": "}",
- },
- {
- "line": 17,
- "code": "",
- }
- ]
-}
+++ /dev/null
-{
- "sources": [
- {
- "line": 1,
- "code": "package sample;",
- },
- {
- "line": 2,
- "code": "",
- },
- {
- "line": 3,
- "code": "public class Sample {",
- },
- {
- "line": 4,
- "code": "\t",
- },
- {
- "line": 5,
- "code": "\tpublic Sample(int i) {",
- },
- {
- "line": 6,
- "code": "\t\tint j = i++;",
- "utLineHits": 1,
- "itLineHits": 1
- },
- {
- "line": 7,
- "code": "\t}",
- },
- {
- "line": 8,
- "code": "\t",
- },
- {
- "line": 9,
- "code": "\tprivate String myMethod() {",
- },
- {
- "line": 10,
- "code": "\t\tif (foo == bar && biz > 1) {",
- "utLineHits": 0,
- "utConditions": 4,
- "utCoveredConditions": 1,
- "itLineHits": 0,
- "itConditions": 4,
- "itCoveredConditions": 1
- },
- {
- "line": 11,
- "code": "\t\t\treturn \"hello\";",
- "utLineHits": 1,
- "itLineHits": 0
- },
- {
- "line": 12,
- "code": "\t\t} else {",
- },
- {
- "line": 13,
- "code": "\t\t\tthrow new IllegalStateException();",
- "utLineHits": 0,
- "itLineHits": 1
- },
- {
- "line": 14,
- "code": "\t\t}",
- },
- {
- "line": 15,
- "code": "\t}",
- },
- {
- "line": 16,
- "code": "}",
- },
- {
- "line": 17,
- "code": "",
- }
- ]
-
-}
+++ /dev/null
-{
- "files": [
- {
- "key": "sample-with-tests:src/main/xoo/sample/Sample.xoo",
- "longName": "src/main/xoo/sample/Sample.xoo",
- "coveredLines": 2
- },
- {
- "key": "sample-with-tests:src/main/xoo/sample/Sample2.xoo",
- "longName": "src/main/xoo/sample/Sample2.xoo",
- "coveredLines": 1
- }
- ]
-}
+++ /dev/null
-{
- "tests": [
- {
- "name": "success",
- "status": "OK",
- "durationInMs": 4,
- "coveredLines": 3,
- "message": "",
- "stacktrace": ""
- },
- {
- "name": "error",
- "status": "ERROR",
- "durationInMs": 2,
- "coveredLines": 0,
- "message": "Error",
- "stacktrace": "The stack"
- },
- {
- "name": "failure",
- "status": "FAILURE",
- "durationInMs": 2,
- "coveredLines": 1,
- "message": "Failure",
- "stacktrace": ""
- },
- {
- "name": "skipped",
- "status": "SKIPPED",
- "coveredLines": 0,
- "message": "",
- "stacktrace": ""
- }
- ]
-}
+++ /dev/null
-{
- "tests": [
- {
- "name": "success",
- "status": "OK",
- "durationInMs": 4,
- "coveredLines": 0,
- "message": "",
- "stacktrace": ""
- },
- {
- "name": "error",
- "status": "ERROR",
- "durationInMs": 2,
- "coveredLines": 0,
- "message": "Error",
- "stacktrace": "The stack"
- },
- {
- "name": "failure",
- "status": "FAILURE",
- "durationInMs": 2,
- "coveredLines": 0,
- "message": "Failure",
- "stacktrace": ""
- },
- {
- "name": "skipped",
- "status": "SKIPPED",
- "coveredLines": 0,
- "message": "",
- "stacktrace": ""
- }
- ]
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>default_locale_is_english</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <thead>
- <tr>
- <td rowspan="1" colspan="3">default_locale_is_english</td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/dashboard/index?id=sample&locale=foo</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>css=#content</td>
- <td>regexp:.*Jan.*|.*Feb.*|.*Mar.*|.*Apr.*|.*May.*|.*Jun.*|.*Jul.*|.*Aug.*|.*Sep.*|.*Oct.*|.*Nov.*|.*Dec.*</td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>css=#content</td>
- <td>*0.0%*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>french</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <thead>
- <tr>
- <td rowspan="1" colspan="3">french</td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/dashboard/index?id=sample&locale=fr</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>css=#content</td>
- <td>regexp:.*jan.*|.*fév.*|.*mar.*|.*avr.*|.*mai.*|.*juin.*|.*juil.*|.*août.*|.*sept.*|.*oct.*|.*nov.*|.*déc.*</td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>css=#content</td>
- <td>*0,0%*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>french-pack</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <thead>
- <tr>
- <td rowspan="1" colspan="3">french-pack</td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/?locale=fr</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>css=.navbar</td>
- <td>glob:*Se connecter*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>french-france</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <thead>
- <tr>
- <td rowspan="1" colspan="3">french-france</td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/dashboard/index?id=sample&locale=fr-FR</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>css=#content</td>
- <td>regexp:.*jan.*|.*fév.*|.*mar.*|.*avr.*|.*mai.*|.*juin.*|.*juil.*|.*août.*|.*sept.*|.*oct.*|.*nov.*|.*déc.*</td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>css=#content</td>
- <td>*0,0%*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>french-switzerland</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <thead>
- <tr>
- <td rowspan="1" colspan="3">french-switzerland</td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/dashboard/index?id=sample&locale=fr-CH</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>css=#content</td>
- <td>regexp:.*jan.*|.*fév.*|.*mar.*|.*avr.*|.*mai.*|.*juin.*|.*juil.*|.*août.*|.*sept.*|.*oct.*|.*nov.*|.*déc.*</td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>css=#content</td>
- <td>*0.0%*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
--- /dev/null
+# THIS FILE IS USED BY THE UPDATE CENTER
+# DO NOT REMOVE OR RENAME
+#
+# Note : prefix all : by \
+#
+
+publicVersions=3.0,100.0
+
+3.0.description=Encryption of database password, TimeMachine available as widgets, New algorithm for tracking violations, 40 bugs and 40 improvements
+3.0.downloadUrl=http\://dist.sonar.codehaus.org/sonar-3.0.zip
+3.0.changelogUrl=http\://www.sonarsource.org/downloads/#3.0
+3.0.date=2012-04-17
+
+100.0.description=Hundred dot zero!
+100.0.downloadUrl=http\://dist.sonar.codehaus.org/sonar-100.0.zip
+100.0.changelogUrl=http\://www.sonarsource.org/downloads/#100.0
+100.0.date=2112-06-13
+
+
+plugins=fake,abap
+
+#--------------------------------------------------------------------------------------------------------------------------
+abap.homepageUrl=http\://www.sonarsource.com/products/plugins/languages/abap/
+abap.name=ABAP
+abap.category=Additional Languages
+abap.publicVersions=1.0,1.0.1,1.1,2.0.1
+
+abap.1.0.description=Initial version of the product
+abap.1.0.sqVersions=2.7,2.8,2.9,2.10,2.11,2.12,2.13,2.13.1,2.14,3.0,3.0.1,3.1,3.1.1
+abap.1.0.downloadUrl=
+abap.1.0.date=2011-07-29
+
+abap.1.0.1.description=Adjust computation of certain metrics
+abap.1.0.1.sqVersions=2.7,2.8,2.9,2.10,2.11,2.12,2.13,2.13.1,2.14,3.0,3.0.1,3.1,3.1.1
+abap.1.0.1.downloadUrl=
+abap.1.0.1.date=2011-08-28
+
+abap.1.1.description=Adjust computation of certain metrics
+abap.1.1.sqVersions=2.7,2.8,2.9,2.10,2.11,2.12,2.13,2.13.1,2.14,3.0,3.0.1,3.1,3.1.1
+abap.1.1.downloadUrl=
+abap.1.1.date=2012-01-05
+
+abap.2.0.1.description=This new version provides an ABAP source code extractor, adds 5 new rules and improves others
+abap.2.0.1.sqVersions=3.2,3.3,3.4,3.5,3.6,3.7,3.7.1,3.7.2,3.7.3,3.7.4,3.7.5,3.7.6,3.7.7,4.0,4.0.1,4.1,4.2,4.3,4.4,4.5,4.6,4.7,5.0,5.1,5.2,5.3,5.4,5.5,5.6,5.7,6.0,6.1,6.2,6.3,6.4,6.5,6.6
+abap.2.0.1.downloadUrl=
+abap.2.0.1.date=2012-06-25
+
+#--------------------------------------------------------------------------------------------------------------------------
+fake.category=Additional Metrics
+fake.publicVersions=1.0,1.1
+fake.name=Fake
+fake.description=Fake plugin for integration tests
+
+fake.1.0.description=Initial release
+fake.1.0.sqVersions=3.2,3.3,3.4,3.5,3.6,3.7
+fake.1.0.downloadUrl=
+fake.1.0.date=2011-05-06
+
+fake.1.1.description=Support sonarqube v100.0
+fake.1.1.sqVersions=3.2,3.3,3.4,3.5,3.6,3.7,3.7.1,3.7.2,3.7.3,3.7.4,3.7.5,3.7.6,3.7.7,4.0,4.0.1,4.1,4.2,4.3,4.4,4.5,4.6,4.7,5.0,5.1,5.2,5.3,5.4,5.5,5.6,5.7,6.0,6.1,6.2,6.3,6.4,6.5,6.6,100.0
+fake.1.1.downloadUrl=
+fake.1.1.date=2012-04-27
--- /dev/null
+<?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>installed-plugins</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</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>open</td>
+ <td>/sonar/updatecenter</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>content</td>
+ <td>*Fake*</td>
+ </tr>
+ <tr>
+ <td>assertText</td>
+ <td>id=update-center-plugins</td>
+ <td>*Fake*1.0-SNAPSHOT*</td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
+++ /dev/null
-# THIS FILE IS USED BY THE UPDATE CENTER
-# DO NOT REMOVE OR RENAME
-#
-# Note : prefix all : by \
-#
-
-publicVersions=3.0,100.0
-
-3.0.description=Encryption of database password, TimeMachine available as widgets, New algorithm for tracking violations, 40 bugs and 40 improvements
-3.0.downloadUrl=http\://dist.sonar.codehaus.org/sonar-3.0.zip
-3.0.changelogUrl=http\://www.sonarsource.org/downloads/#3.0
-3.0.date=2012-04-17
-
-100.0.description=Hundred dot zero!
-100.0.downloadUrl=http\://dist.sonar.codehaus.org/sonar-100.0.zip
-100.0.changelogUrl=http\://www.sonarsource.org/downloads/#100.0
-100.0.date=2112-06-13
-
-
-plugins=fake,abap
-
-#--------------------------------------------------------------------------------------------------------------------------
-abap.homepageUrl=http\://www.sonarsource.com/products/plugins/languages/abap/
-abap.name=ABAP
-abap.category=Additional Languages
-abap.publicVersions=1.0,1.0.1,1.1,2.0.1
-
-abap.1.0.description=Initial version of the product
-abap.1.0.sqVersions=2.7,2.8,2.9,2.10,2.11,2.12,2.13,2.13.1,2.14,3.0,3.0.1,3.1,3.1.1
-abap.1.0.downloadUrl=
-abap.1.0.date=2011-07-29
-
-abap.1.0.1.description=Adjust computation of certain metrics
-abap.1.0.1.sqVersions=2.7,2.8,2.9,2.10,2.11,2.12,2.13,2.13.1,2.14,3.0,3.0.1,3.1,3.1.1
-abap.1.0.1.downloadUrl=
-abap.1.0.1.date=2011-08-28
-
-abap.1.1.description=Adjust computation of certain metrics
-abap.1.1.sqVersions=2.7,2.8,2.9,2.10,2.11,2.12,2.13,2.13.1,2.14,3.0,3.0.1,3.1,3.1.1
-abap.1.1.downloadUrl=
-abap.1.1.date=2012-01-05
-
-abap.2.0.1.description=This new version provides an ABAP source code extractor, adds 5 new rules and improves others
-abap.2.0.1.sqVersions=3.2,3.3,3.4,3.5,3.6,3.7,3.7.1,3.7.2,3.7.3,3.7.4,3.7.5,3.7.6,3.7.7,4.0,4.0.1,4.1,4.2,4.3,4.4,4.5,4.6,4.7,5.0,5.1,5.2,5.3,5.4,5.5,5.6,5.7,6.0,6.1,6.2,6.3,6.4,6.5,6.6
-abap.2.0.1.downloadUrl=
-abap.2.0.1.date=2012-06-25
-
-#--------------------------------------------------------------------------------------------------------------------------
-fake.category=Additional Metrics
-fake.publicVersions=1.0,1.1
-fake.name=Fake
-fake.description=Fake plugin for integration tests
-
-fake.1.0.description=Initial release
-fake.1.0.sqVersions=3.2,3.3,3.4,3.5,3.6,3.7
-fake.1.0.downloadUrl=
-fake.1.0.date=2011-05-06
-
-fake.1.1.description=Support sonarqube v100.0
-fake.1.1.sqVersions=3.2,3.3,3.4,3.5,3.6,3.7,3.7.1,3.7.2,3.7.3,3.7.4,3.7.5,3.7.6,3.7.7,4.0,4.0.1,4.1,4.2,4.3,4.4,4.5,4.6,4.7,5.0,5.1,5.2,5.3,5.4,5.5,5.6,5.7,6.0,6.1,6.2,6.3,6.4,6.5,6.6,100.0
-fake.1.1.downloadUrl=
-fake.1.1.date=2012-04-27
+++ /dev/null
-<?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>installed-plugins</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</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>open</td>
- <td>/sonar/updatecenter</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>content</td>
- <td>*Fake*</td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>id=update-center-plugins</td>
- <td>*Fake*1.0-SNAPSHOT*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
;;
ITS)
- if [ "$IT_CATEGORY" == "plugins" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
+ if [ "$IT_CATEGORY" == "Plugins" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo "Ignore this job since it needs access to private test licenses."
else
installTravisTools
- start_xvfb
+ build "SonarSource/orchestrator" "2268bba9acbf699a00adc7c5f1dce8d96b0426ff"
- CATEGORIES=($(echo "$IT_CATEGORY" | tr '_' '\n'))
- CATEGORY1=${CATEGORIES[0]:-'NONE'}
- CATEGORY2=${CATEGORIES[1]:-'NONE'}
+ start_xvfb
- mvn install -Pit,dev -DskipTests -Dcategory1="$CATEGORY1" -Dcategory2="$CATEGORY2" -Dmaven.test.redirectTestOutputToFile=false -e -Dsource.skip=true
+ mvn install -Pit,dev -DskipTests -Dcategory=$IT_CATEGORY -Dmaven.test.redirectTestOutputToFile=false -e -Dsource.skip=true
fi
;;