]> source.dussan.org Git - sonar-scanner-cli.git/commitdiff
Fix ITs
authorJulien HENRY <julien.henry@sonarsource.com>
Fri, 8 Apr 2016 14:44:18 +0000 (16:44 +0200)
committerJulien HENRY <julien.henry@sonarsource.com>
Fri, 8 Apr 2016 14:44:18 +0000 (16:44 +0200)
it/projects/java-sample-non-associated/sonar-project.properties [deleted file]
it/projects/java-sample-non-associated/src/basic/Hello.java [deleted file]
it/projects/java-sample-non-associated/src/basic/World.java [deleted file]
it/src/test/java/com/sonar/runner/it/CacheTest.java [deleted file]
it/src/test/java/com/sonar/runner/it/SonarScannerTestSuite.java
pom.xml

diff --git a/it/projects/java-sample-non-associated/sonar-project.properties b/it/projects/java-sample-non-associated/sonar-project.properties
deleted file mode 100644 (file)
index bd17a41..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-# Note that the format of project key is still groupId:artifactId in order to support test with sonar 2.6.
-#sonar.projectKey=java:sample
-sonar.projectName=Java Sample, with comma
-sonar.projectDescription=This is a Java sample
-sonar.projectVersion=1.2.3
-
-sonar.sources=src
diff --git a/it/projects/java-sample-non-associated/src/basic/Hello.java b/it/projects/java-sample-non-associated/src/basic/Hello.java
deleted file mode 100644 (file)
index b9db5a0..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-package basic;
-
-public class Hello {
-
-  public void hello() {
-    int i=356;
-    if (true) i=5658;
-  }
-}
diff --git a/it/projects/java-sample-non-associated/src/basic/World.java b/it/projects/java-sample-non-associated/src/basic/World.java
deleted file mode 100644 (file)
index c65d91c..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-package basic;
-
-public final class World {
-
-  public void world() {
-    System.out.println("hello world");
-  }
-}
diff --git a/it/src/test/java/com/sonar/runner/it/CacheTest.java b/it/src/test/java/com/sonar/runner/it/CacheTest.java
deleted file mode 100644 (file)
index a226521..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * SonarSource :: IT :: SonarQube Scanner
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program 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.
- *
- * This program 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 com.sonar.runner.it;
-
-import com.sonar.orchestrator.build.BuildFailureException;
-import com.sonar.orchestrator.build.BuildResult;
-import com.sonar.orchestrator.build.SonarRunner;
-import com.sonar.orchestrator.locator.ResourceLocation;
-import java.io.File;
-import java.io.IOException;
-import org.junit.AfterClass;
-import org.junit.Assume;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class CacheTest extends ScannerTestCase {
-  @Rule
-  public TemporaryFolder temp = new TemporaryFolder();
-
-  private File currentTemp = null;
-  private static boolean serverRunning = false;
-
-  @BeforeClass
-  public static void setUpClass() {
-    orchestrator.resetData();
-    orchestrator.getServer().restoreProfile(ResourceLocation.create("/sonar-way-profile.xml"));
-    orchestrator.getServer().provisionProject("java:sample", "Java Sample, with comma");
-    orchestrator.getServer().associateProjectToQualityProfile("java:sample", "java", "sonar-way");
-    serverRunning = true;
-  }
-
-  @AfterClass
-  public static void restartForOtherTests() {
-    ensureStarted();
-  }
-
-  private static void ensureStarted() {
-    if (!serverRunning) {
-      orchestrator.start();
-      serverRunning = true;
-    }
-  }
-
-  private static void ensureStopped() {
-    if (serverRunning) {
-      orchestrator.stop();
-      serverRunning = false;
-    }
-  }
-
-  @Test
-  public void testIssuesMode() throws IOException {
-    Assume.assumeTrue(orchestrator.getServer().version().isGreaterThanOrEquals("5.3"));
-
-    // online, cache empty -> should sync
-    ensureStarted();
-    SonarRunner build = createRunner("issues", true, "java-sample");
-    BuildResult result = orchestrator.executeBuild(build, false);
-    assertThat(result.isSuccess()).isTrue();
-
-    // offline, don't use cache by default -> should fail
-    ensureStopped();
-    build = createRunner("issues", false, "java-sample");
-    result = orchestrator.executeBuildQuietly(build, false);
-    assertThat(result.isSuccess()).isFalse();
-
-    // offline, don't use cache -> should run from cache
-    build = createRunner("issues", false, "java-sample");
-    build.setProperty("sonar.useWsCache", "true");
-    result = orchestrator.executeBuild(build, false);
-    assertThat(result.isSuccess()).isTrue();
-
-    // offline, cache empty -> should fail
-    build = createRunner("issues", true, "java-sample");
-    build.setProperty("sonar.useWsCache", "true");
-    result = orchestrator.executeBuildQuietly(build, false);
-    assertThat(result.isSuccess()).isFalse();
-    // this message is specific to the server_first cache strategy
-    assertThat(result.getLogs()).contains("can not be reached, trying cache");
-    assertThat(result.getLogs()).contains("can not be reached and data is not cached");
-  }
-
-  @Test
-  public void testNonAssociatedMode() throws IOException {
-    Assume.assumeTrue(orchestrator.getServer().version().isGreaterThanOrEquals("5.2"));
-
-    // online, without cache -> should sync
-    ensureStarted();
-    SonarRunner build = createRunner("issues", true, "java-sample-non-associated");
-    BuildResult result = orchestrator.executeBuild(build, false);
-    assertThat(result.isSuccess()).isTrue();
-
-    // offline, with cache -> should run from cache
-    ensureStopped();
-    build = createRunner("issues", false, "java-sample-non-associated");
-    build.setProperty("sonar.useWsCache", "true");
-    result = orchestrator.executeBuild(build, false);
-    assertThat(result.isSuccess()).isTrue();
-  }
-
-  @Test
-  public void testPublishModeOffline() throws IOException {
-    Assume.assumeTrue(orchestrator.getServer().version().isGreaterThanOrEquals("5.2"));
-
-    // online (cache not used)
-    ensureStarted();
-    SonarRunner build = createRunner("publish", "java-sample");
-    BuildResult result = orchestrator.executeBuild(build, false);
-    assertThat(result.isSuccess()).isTrue();
-
-    // offline (cache not used) -> should fail
-    ensureStopped();
-    build = createRunner("publish", false, "java-sample");
-    try {
-      result = orchestrator.executeBuild(build);
-    } catch (BuildFailureException e) {
-      assertThat(e.getResult().getLogs()).contains("Fail to download libraries from server");
-    }
-
-  }
-
-  private SonarRunner createRunner(String mode, String project) throws IOException {
-    return createRunner(mode, false, project);
-  }
-
-  private SonarRunner createRunner(String mode, boolean refreshCache, String project) throws IOException {
-    if (refreshCache || currentTemp == null) {
-      currentTemp = temp.newFolder();
-    }
-
-    SonarRunner runner = newScanner(new File("projects/" + project))
-      .setProperty("sonar.analysis.mode", mode)
-      .setProperty("sonar.userHome", currentTemp.getAbsolutePath());
-
-    return runner;
-  }
-
-}
index 1cb56cc6fddc77e926b5ee2ec7a182394bec2544..b835e67014a467168b1590647195f98cb6f0995e 100644 (file)
@@ -26,7 +26,7 @@ import org.junit.runners.Suite;
 import org.junit.runners.Suite.SuiteClasses;
 
 @RunWith(Suite.class)
-@SuiteClasses({JavaTest.class, MultimoduleTest.class, CacheTest.class})
+@SuiteClasses({JavaTest.class, MultimoduleTest.class})
 public class SonarScannerTestSuite {
 
   @ClassRule
diff --git a/pom.xml b/pom.xml
index d490039c7fb1aa63df2206df8b7835dade771713..a8c73cedb597fa2a824dacf056fbf4c45335ba8b 100644 (file)
--- a/pom.xml
+++ b/pom.xml
             <configuration>
               <rules>
                 <requireFilesSize>
-                  <minsize>490000</minsize>
-                  <maxsize>500000</maxsize>
+                  <minsize>500000</minsize>
+                  <maxsize>510000</maxsize>
                   <files>
                     <file>${project.build.directory}/sonar-scanner-${project.version}.zip</file>
                   </files>