]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-1450: Add project for IT
authorGodin <mandrikov@gmail.com>
Thu, 2 Dec 2010 21:35:04 +0000 (21:35 +0000)
committerGodin <mandrikov@gmail.com>
Thu, 2 Dec 2010 21:35:04 +0000 (21:35 +0000)
tests/integration/tests/build.xml
tests/integration/tests/custom-projects/violations-timemachine/README.txt [new file with mode: 0644]
tests/integration/tests/custom-projects/violations-timemachine/v1/pom.xml [new file with mode: 0644]
tests/integration/tests/custom-projects/violations-timemachine/v1/src/main/java/org/sonar/tests/violationstimemachine/FileRemovedInV2.java [new file with mode: 0644]
tests/integration/tests/custom-projects/violations-timemachine/v1/src/main/java/org/sonar/tests/violationstimemachine/Hello.java [new file with mode: 0644]
tests/integration/tests/custom-projects/violations-timemachine/v2/pom.xml [new file with mode: 0644]
tests/integration/tests/custom-projects/violations-timemachine/v2/src/main/java/org/sonar/tests/violationstimemachine/FileAddedInV2.java [new file with mode: 0644]
tests/integration/tests/custom-projects/violations-timemachine/v2/src/main/java/org/sonar/tests/violationstimemachine/Hello.java [new file with mode: 0644]

index 72c069bf9913a48c8d0d26d27a87070c745573aa..9edf580f6c613e459fb0afa18d2fdb8d7a5253e9 100644 (file)
@@ -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/"/>
               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"/>
     </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 (file)
index 0000000..23df016
--- /dev/null
@@ -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 (file)
index 0000000..6362642
--- /dev/null
@@ -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 (file)
index 0000000..6666868
--- /dev/null
@@ -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 (file)
index 0000000..4bbc1fc
--- /dev/null
@@ -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 (file)
index 0000000..6362642
--- /dev/null
@@ -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 (file)
index 0000000..51636a4
--- /dev/null
@@ -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 (file)
index 0000000..473f9b0
--- /dev/null
@@ -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;
+  }
+}