diff options
author | Godin <mandrikov@gmail.com> | 2010-12-02 21:35:04 +0000 |
---|---|---|
committer | Godin <mandrikov@gmail.com> | 2010-12-02 21:35:04 +0000 |
commit | 0853bc889c30602733a4520327ee3fb6c8dacd92 (patch) | |
tree | 171bfdfbc06516244ce1d627beae0d773518ea6e /tests | |
parent | d68565f7ad394a80fa70729211c2bc373a4492d1 (diff) | |
download | sonarqube-0853bc889c30602733a4520327ee3fb6c8dacd92.tar.gz sonarqube-0853bc889c30602733a4520327ee3fb6c8dacd92.zip |
SONAR-1450: Add project for IT
Diffstat (limited to 'tests')
8 files changed, 122 insertions, 3 deletions
diff --git a/tests/integration/tests/build.xml b/tests/integration/tests/build.xml index 72c069bf991..9edf580f6c6 100644 --- a/tests/integration/tests/build.xml +++ b/tests/integration/tests/build.xml @@ -32,7 +32,7 @@ <target name="build-extensions"> <mkdir dir="${basedir}/target"/> - + <mvn dir="target" args="archetype:generate -B -DarchetypeGroupId=org.codehaus.sonar.archetypes -DarchetypeArtifactId=sonar-basic-plugin-archetype -DarchetypeVersion=${sonar.runtimeVersion} -DgroupId=com.mycompany.sonar -DartifactId=sonar-basic-sample-plugin -Dversion=0.1-SNAPSHOT"/> <mvn args="install" dir="${basedir}/target/sonar-basic-sample-plugin"/> @@ -45,7 +45,7 @@ <target name="analyze-custom-projects" - depends="ant-static,ant-dynamic-clover,ant-dynamic-cobertura,ant-dynamic-junit,deprecated-sonar-light,struts,timemachine,reuse-coverage-reports"/> + depends="ant-static,ant-dynamic-clover,ant-dynamic-cobertura,ant-dynamic-junit,deprecated-sonar-light,struts,timemachine,violations-timemachine,reuse-coverage-reports"/> <target name="ant-static"> <execant dir="${projects.dir}/ant-static/"/> @@ -110,6 +110,18 @@ pom="${projects.dir}/timemachine/pom.xml"/> </target> + <target name="violations-timemachine"> + <mvn args="clean install -DskiptTests" dir="${projects.dir}/violations-timemachine/v1"/> + <mvnsonar failonerror="false" + args="-Dsonar.projectDate=2010-10-19" + pom="${projects.dir}/violations-timemachine/v1/pom.xml"/> + + <mvn args="clean install -DskiptTests" dir="${projects.dir}/violations-timemachine/v2"/> + <mvnsonar failonerror="false" + args="-Dsonar.projectDate=2010-11-13" + pom="${projects.dir}/violations-timemachine/v2/pom.xml"/> + </target> + <target name="big-project"> <exec executable="ruby" failonerror="true" dir="${projects.dir}/big-project"> <arg line="generate-sources.rb 20 50"/> @@ -181,4 +193,4 @@ </sequential> </macrodef> -</project>
\ No newline at end of file +</project> diff --git a/tests/integration/tests/custom-projects/violations-timemachine/README.txt b/tests/integration/tests/custom-projects/violations-timemachine/README.txt new file mode 100644 index 00000000000..23df016b9db --- /dev/null +++ b/tests/integration/tests/custom-projects/violations-timemachine/README.txt @@ -0,0 +1,4 @@ +Use-cases to check: +* File added +* File removed +* File with new/fixed violations diff --git a/tests/integration/tests/custom-projects/violations-timemachine/v1/pom.xml b/tests/integration/tests/custom-projects/violations-timemachine/v1/pom.xml new file mode 100644 index 00000000000..6362642d2a1 --- /dev/null +++ b/tests/integration/tests/custom-projects/violations-timemachine/v1/pom.xml @@ -0,0 +1,21 @@ +<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>org.sonar.tests</groupId> + <artifactId>violations-timemachine</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>jar</packaging> + <name>Violations timemachine</name> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/tests/integration/tests/custom-projects/violations-timemachine/v1/src/main/java/org/sonar/tests/violationstimemachine/FileRemovedInV2.java b/tests/integration/tests/custom-projects/violations-timemachine/v1/src/main/java/org/sonar/tests/violationstimemachine/FileRemovedInV2.java new file mode 100644 index 00000000000..6666868b5c8 --- /dev/null +++ b/tests/integration/tests/custom-projects/violations-timemachine/v1/src/main/java/org/sonar/tests/violationstimemachine/FileRemovedInV2.java @@ -0,0 +1,10 @@ +package org.sonar.tests.violationstimemachine; + +public class FileRemovedInV2 { + + protected void methodOne() { + int i = 0; // unused local variable + i++; + } + +} diff --git a/tests/integration/tests/custom-projects/violations-timemachine/v1/src/main/java/org/sonar/tests/violationstimemachine/Hello.java b/tests/integration/tests/custom-projects/violations-timemachine/v1/src/main/java/org/sonar/tests/violationstimemachine/Hello.java new file mode 100644 index 00000000000..4bbc1fc2ec1 --- /dev/null +++ b/tests/integration/tests/custom-projects/violations-timemachine/v1/src/main/java/org/sonar/tests/violationstimemachine/Hello.java @@ -0,0 +1,20 @@ +package org.sonar.tests.violationstimemachine; + +public class Hello { + + // We need two similar violations here to check that they would be associated correctly + + protected void methodOne() { // design for extension + int i = 0; // unused local variable + i++; + } + + protected void methodTwo() { // design for extension + int i = 0; // unused local variable + i++; + } + + public int methodReturnThree() { // design for extension + return 3; + } +} diff --git a/tests/integration/tests/custom-projects/violations-timemachine/v2/pom.xml b/tests/integration/tests/custom-projects/violations-timemachine/v2/pom.xml new file mode 100644 index 00000000000..6362642d2a1 --- /dev/null +++ b/tests/integration/tests/custom-projects/violations-timemachine/v2/pom.xml @@ -0,0 +1,21 @@ +<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>org.sonar.tests</groupId> + <artifactId>violations-timemachine</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>jar</packaging> + <name>Violations timemachine</name> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/tests/integration/tests/custom-projects/violations-timemachine/v2/src/main/java/org/sonar/tests/violationstimemachine/FileAddedInV2.java b/tests/integration/tests/custom-projects/violations-timemachine/v2/src/main/java/org/sonar/tests/violationstimemachine/FileAddedInV2.java new file mode 100644 index 00000000000..51636a431da --- /dev/null +++ b/tests/integration/tests/custom-projects/violations-timemachine/v2/src/main/java/org/sonar/tests/violationstimemachine/FileAddedInV2.java @@ -0,0 +1,10 @@ +package org.sonar.tests.violationstimemachine; + +public class FileAddedInV2 { + + protected void methodOne() { + int i = 0; // unused local variable + i++; + } + +} diff --git a/tests/integration/tests/custom-projects/violations-timemachine/v2/src/main/java/org/sonar/tests/violationstimemachine/Hello.java b/tests/integration/tests/custom-projects/violations-timemachine/v2/src/main/java/org/sonar/tests/violationstimemachine/Hello.java new file mode 100644 index 00000000000..473f9b07773 --- /dev/null +++ b/tests/integration/tests/custom-projects/violations-timemachine/v2/src/main/java/org/sonar/tests/violationstimemachine/Hello.java @@ -0,0 +1,21 @@ +package org.sonar.tests.violationstimemachine; + +public class Hello { + + // We need two similar violations here to check that they would be associated correctly + + protected void methodOne() { + int i = 0; // unused local variable + i++; + } + + protected void methodTwo() { + int i = 0; // unused local variable + i++; + } + + public final int methodReturnThree() { // fixed - design for extension + int j = 0; // new - unused local variable + return 3; + } +} |