From b69c9535ee7abef287dfd9dd53332620cfe3a54a Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Fri, 26 Jun 2015 19:56:08 +0200 Subject: [PATCH] Add integration tests on updatecenter and testing categories --- it/it-plugins/pom.xml | 6 + it/it-plugins/sonar-fake-plugin/pom.xml | 41 ++++ .../src/main/java/FakePlugin.java | 12 ++ it/it-tests/pom.xml | 12 ++ .../QualityGateNotificationTest.java | 4 +- .../test/java/testing/suite/CoverageTest.java | 184 ++++++++++++++++++ .../testing/suite/CoverageTrackingTest.java | 49 +++++ .../java/testing/suite/TestExecutionTest.java | 47 +++++ .../java/testing/suite/TestingTestSuite.java | 26 +++ .../UpdateCenterSystemUpdateTest.java | 71 +++++++ .../java/updatecenter/UpdateCenterTest.java | 61 ++++++ it/it-tests/src/test/java/util/ItUtils.java | 14 ++ .../activate_notification_channels.html | 0 .../notifications/email_configuration.html | 0 .../CoverageTest/it_coverage-expected.json | 77 ++++++++ .../unit_test_coverage-expected.json | 78 ++++++++ ...t_test_coverage_no_condition-expected.json | 76 ++++++++ .../ut_and_it_coverage-expected.json | 85 ++++++++ .../covered_files-expected.json | 14 ++ .../CoverageTrackingTest/tests-expected.json | 35 ++++ .../suite/TestExecutionTest/expected.json | 35 ++++ .../update-center-dependencies.properties | 83 ++++++++ ...with-already-compatible-plugins.properties | 32 +++ ...ter-with-missing-plugin-version.properties | 30 +++ .../UpdateCenterTest/update-center.properties | 62 ++++++ .../updatecenter/available-plugins.html | 85 ++++++++ .../updatecenter/installed-plugins.html | 54 +++++ .../updatecenter/plugin-updates.html | 70 +++++++ .../updatecenter/refresh-update-center.html | 66 +++++++ ...with-missing-installed-plugin-version.html | 50 +++++ ...system-updates-without-plugin-updates.html | 55 ++++++ .../updatecenter/system-updates.html | 55 ++++++ it/pom.xml | 14 -- 33 files changed, 1567 insertions(+), 16 deletions(-) create mode 100644 it/it-plugins/sonar-fake-plugin/pom.xml create mode 100644 it/it-plugins/sonar-fake-plugin/src/main/java/FakePlugin.java create mode 100644 it/it-tests/src/test/java/testing/suite/CoverageTest.java create mode 100644 it/it-tests/src/test/java/testing/suite/CoverageTrackingTest.java create mode 100644 it/it-tests/src/test/java/testing/suite/TestExecutionTest.java create mode 100644 it/it-tests/src/test/java/testing/suite/TestingTestSuite.java create mode 100644 it/it-tests/src/test/java/updatecenter/UpdateCenterSystemUpdateTest.java create mode 100644 it/it-tests/src/test/java/updatecenter/UpdateCenterTest.java rename it/it-tests/src/test/resources/{selenium => }/qualitygate/notifications/activate_notification_channels.html (100%) rename it/it-tests/src/test/resources/{selenium => }/qualitygate/notifications/email_configuration.html (100%) create mode 100644 it/it-tests/src/test/resources/testing/suite/CoverageTest/it_coverage-expected.json create mode 100644 it/it-tests/src/test/resources/testing/suite/CoverageTest/unit_test_coverage-expected.json create mode 100644 it/it-tests/src/test/resources/testing/suite/CoverageTest/unit_test_coverage_no_condition-expected.json create mode 100644 it/it-tests/src/test/resources/testing/suite/CoverageTest/ut_and_it_coverage-expected.json create mode 100644 it/it-tests/src/test/resources/testing/suite/CoverageTrackingTest/covered_files-expected.json create mode 100644 it/it-tests/src/test/resources/testing/suite/CoverageTrackingTest/tests-expected.json create mode 100644 it/it-tests/src/test/resources/testing/suite/TestExecutionTest/expected.json create mode 100644 it/it-tests/src/test/resources/updatecenter/UpdateCenterTest/update-center-dependencies.properties create mode 100644 it/it-tests/src/test/resources/updatecenter/UpdateCenterTest/update-center-system-update-with-already-compatible-plugins.properties create mode 100644 it/it-tests/src/test/resources/updatecenter/UpdateCenterTest/update-center-with-missing-plugin-version.properties create mode 100644 it/it-tests/src/test/resources/updatecenter/UpdateCenterTest/update-center.properties create mode 100644 it/it-tests/src/test/resources/updatecenter/available-plugins.html create mode 100644 it/it-tests/src/test/resources/updatecenter/installed-plugins.html create mode 100644 it/it-tests/src/test/resources/updatecenter/plugin-updates.html create mode 100644 it/it-tests/src/test/resources/updatecenter/refresh-update-center.html create mode 100644 it/it-tests/src/test/resources/updatecenter/system-updates-with-missing-installed-plugin-version.html create mode 100644 it/it-tests/src/test/resources/updatecenter/system-updates-without-plugin-updates.html create mode 100644 it/it-tests/src/test/resources/updatecenter/system-updates.html diff --git a/it/it-plugins/pom.xml b/it/it-plugins/pom.xml index d901ff66a44..8fb85d96e95 100644 --- a/it/it-plugins/pom.xml +++ b/it/it-plugins/pom.xml @@ -25,5 +25,11 @@ + + ${project.parent.version} + + + sonar-fake-plugin + diff --git a/it/it-plugins/sonar-fake-plugin/pom.xml b/it/it-plugins/sonar-fake-plugin/pom.xml new file mode 100644 index 00000000000..c2ce047c495 --- /dev/null +++ b/it/it-plugins/sonar-fake-plugin/pom.xml @@ -0,0 +1,41 @@ + + + 4.0.0 + + + org.sonarsource.it + it-plugins + 5.2-SNAPSHOT + + + sonar-fake-plugin + 1.0-SNAPSHOT + sonar-plugin + Plugins :: Fake + SonarQube Integration Tests :: Fake Plugin + + + + org.codehaus.sonar + sonar-plugin-api + ${apiVersion} + provided + + + + + + + org.codehaus.sonar + sonar-packaging-maven-plugin + true + 1.12.1 + + FakePlugin + fake + + + + + diff --git a/it/it-plugins/sonar-fake-plugin/src/main/java/FakePlugin.java b/it/it-plugins/sonar-fake-plugin/src/main/java/FakePlugin.java new file mode 100644 index 00000000000..ef57a7acfe1 --- /dev/null +++ b/it/it-plugins/sonar-fake-plugin/src/main/java/FakePlugin.java @@ -0,0 +1,12 @@ +import org.sonar.api.SonarPlugin; + +import java.util.Collections; +import java.util.List; + +public final class FakePlugin extends SonarPlugin { + + public List getExtensions() { + return Collections.emptyList(); + } + +} diff --git a/it/it-tests/pom.xml b/it/it-tests/pom.xml index b24d0a74dbc..171bdf86b99 100644 --- a/it/it-tests/pom.xml +++ b/it/it-tests/pom.xml @@ -18,6 +18,18 @@ + + org.codehaus.sonar.plugins + sonar-xoo-plugin + ${project.version} + provided + + + org.codehaus.sonar + sonar-application + ${project.version} + provided + org.sonarsource.it it-plugins diff --git a/it/it-tests/src/test/java/qualitygate/QualityGateNotificationTest.java b/it/it-tests/src/test/java/qualitygate/QualityGateNotificationTest.java index 12e3ca3da91..582cb58fd0b 100644 --- a/it/it-tests/src/test/java/qualitygate/QualityGateNotificationTest.java +++ b/it/it-tests/src/test/java/qualitygate/QualityGateNotificationTest.java @@ -62,8 +62,8 @@ public class QualityGateNotificationTest { Selenese selenese = Selenese .builder() .setHtmlTestsInClasspath("notifications", - "/selenium/qualitygate/notifications/email_configuration.html", - "/selenium/qualitygate/notifications/activate_notification_channels.html").build(); + "/qualitygate/notifications/email_configuration.html", + "/qualitygate/notifications/activate_notification_channels.html").build(); orchestrator.executeSelenese(selenese); // Create quality gate with conditions on variations diff --git a/it/it-tests/src/test/java/testing/suite/CoverageTest.java b/it/it-tests/src/test/java/testing/suite/CoverageTest.java new file mode 100644 index 00000000000..16c0be3945a --- /dev/null +++ b/it/it-tests/src/test/java/testing/suite/CoverageTest.java @@ -0,0 +1,184 @@ +/* + * Copyright (C) 2009-2014 SonarSource SA + * All rights reserved + * mailto:contact AT sonarsource DOT com + */ +package testing.suite; + +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.Ignore; +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 = TestingTestSuite.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("CoverageTest/unit_test_coverage-expected.json"), "UTF-8"), coverage, false); + } + + @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("CoverageTest/unit_test_coverage_no_condition-expected.json"), "UTF-8"), coverage, false); + } + + @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("CoverageTest/it_coverage-expected.json"), "UTF-8"), coverage, false); + } + + @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("CoverageTest/ut_and_it_coverage-expected.json"), "UTF-8"), coverage, false); + } + + /** + * 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); + } + + /** + * SONAR-766 + */ + @Test + @Ignore("TODO") + 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); + } + + /** + * SONAR-766 + */ + @Test + @Ignore("TODO") + 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); + } + + /** + * 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(); + } + +} diff --git a/it/it-tests/src/test/java/testing/suite/CoverageTrackingTest.java b/it/it-tests/src/test/java/testing/suite/CoverageTrackingTest.java new file mode 100644 index 00000000000..5af286745a5 --- /dev/null +++ b/it/it-tests/src/test/java/testing/suite/CoverageTrackingTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2009-2014 SonarSource SA + * All rights reserved + * mailto:contact AT sonarsource DOT com + */ +package testing.suite; + +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 util.ItUtils.projectDir; + +public class CoverageTrackingTest { + + @ClassRule + public static Orchestrator orchestrator = TestingTestSuite.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("CoverageTrackingTest/tests-expected.json"), "UTF-8"), tests, false); + + String covered_files = orchestrator.getServer().adminWsClient() + .get("api/tests/covered_files", "testUuid", extractSuccessfulTestUuid(tests)); + JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("CoverageTrackingTest/covered_files-expected.json"), "UTF-8"), covered_files, false); + } + + private String extractSuccessfulTestUuid(String json) { + Matcher jsonObjectMatcher = Pattern.compile(".*\\{((.*?)success(.*?))\\}.*", Pattern.MULTILINE).matcher(json); + jsonObjectMatcher.find(); + + Matcher uuidMatcher = Pattern.compile(".*\"testUuid\"\\s*?:\\s*?\"(\\S*?)\".*", Pattern.MULTILINE).matcher(jsonObjectMatcher.group(1)); + return uuidMatcher.find() ? uuidMatcher.group(1) : ""; + } +} diff --git a/it/it-tests/src/test/java/testing/suite/TestExecutionTest.java b/it/it-tests/src/test/java/testing/suite/TestExecutionTest.java new file mode 100644 index 00000000000..a6ac069fbf9 --- /dev/null +++ b/it/it-tests/src/test/java/testing/suite/TestExecutionTest.java @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2009-2014 SonarSource SA + * All rights reserved + * mailto:contact AT sonarsource DOT com + */ +package testing.suite; + +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 org.assertj.core.api.Assertions.assertThat; +import static util.ItUtils.projectDir; + +public class TestExecutionTest { + + @ClassRule + public static Orchestrator orchestrator = TestingTestSuite.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("TestExecutionTest/expected.json"), "UTF-8"), json, false); + } +} diff --git a/it/it-tests/src/test/java/testing/suite/TestingTestSuite.java b/it/it-tests/src/test/java/testing/suite/TestingTestSuite.java new file mode 100644 index 00000000000..bb6ebdc05d1 --- /dev/null +++ b/it/it-tests/src/test/java/testing/suite/TestingTestSuite.java @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2009-2014 SonarSource SA + * All rights reserved + * mailto:contact AT sonarsource DOT com + */ +package testing.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({ + CoverageTrackingTest.class, + CoverageTest.class, + TestExecutionTest.class +}) +public class TestingTestSuite { + + @ClassRule + public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv() + .addPlugin(ItUtils.xooPlugin()) + .build(); +} diff --git a/it/it-tests/src/test/java/updatecenter/UpdateCenterSystemUpdateTest.java b/it/it-tests/src/test/java/updatecenter/UpdateCenterSystemUpdateTest.java new file mode 100644 index 00000000000..20ed430e207 --- /dev/null +++ b/it/it-tests/src/test/java/updatecenter/UpdateCenterSystemUpdateTest.java @@ -0,0 +1,71 @@ +/* + * 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.io.File; +import java.io.IOException; +import org.apache.commons.io.FileUtils; +import org.junit.After; +import org.junit.Test; + +import static org.assertj.core.api.Assertions.assertThat; +import static util.ItUtils.pluginArtifact; + +public class UpdateCenterSystemUpdateTest { + + Orchestrator orchestrator; + + @After + public void stop() { + if (orchestrator != null) { + orchestrator.stop(); + } + } + + /** + * SONAR-4279 + */ + @Test + public void should_not_display_already_compatible_plugins_on_system_update() { + orchestrator = Orchestrator.builderEnv() + .setServerProperty("sonar.updatecenter.url", + UpdateCenterSystemUpdateTest.class.getResource("UpdateCenterTest/update-center-system-update-with-already-compatible-plugins.properties").toString()) + .addPlugin(pluginArtifact("sonar-fake-plugin")) + .build(); + + orchestrator.start(); + Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("system-updates-without-plugin-updates", + "/updatecenter/system-updates-without-plugin-updates.html" + ).build(); + orchestrator.executeSelenese(selenese); + } + + /** + * SONAR-4585 + */ + @Test + public void should_system_update_page_not_fail_when_installed_plugin_version_not_found_in_update_center_definitions() throws IOException { + orchestrator = Orchestrator.builderEnv() + .setServerProperty("sonar.updatecenter.url", + UpdateCenterSystemUpdateTest.class.getResource("UpdateCenterTest/update-center-with-missing-plugin-version.properties").toString()) + .addPlugin(pluginArtifact("sonar-fake-plugin")) + .build(); + + orchestrator.start(); + + Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("system-updates-with-missing-installed-plugin-version", + "/updatecenter/system-updates-with-missing-installed-plugin-version.html" + ).build(); + orchestrator.executeSelenese(selenese); + + // Exception stacktrace should not be in logs + File logs = orchestrator.getServer().getLogs(); + assertThat(FileUtils.readFileToString(logs)).doesNotContain("NoSuchElementException"); + } + +} diff --git a/it/it-tests/src/test/java/updatecenter/UpdateCenterTest.java b/it/it-tests/src/test/java/updatecenter/UpdateCenterTest.java new file mode 100644 index 00000000000..12f214ab069 --- /dev/null +++ b/it/it-tests/src/test/java/updatecenter/UpdateCenterTest.java @@ -0,0 +1,61 @@ +/* + * 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 static junit.framework.Assert.assertNotNull; +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 plugins = orchestrator.getServer().getAdminWsClient().findAll(UpdateCenterQuery.createForInstalledPlugins()); + assertThat(plugins.size()).isGreaterThan(0); + + Plugin installedPlugin = findPlugin(plugins, "fake"); + assertNotNull(installedPlugin); + 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", + "/updatecenter/plugin-updates.html", + "/updatecenter/refresh-update-center.html", + "/updatecenter/system-updates.html", + "/updatecenter/available-plugins.html" + ).build(); + orchestrator.executeSelenese(selenese); + } + + private Plugin findPlugin(List plugins, String pluginKey) { + for (Plugin plugin : plugins) { + if (StringUtils.equals(pluginKey, plugin.getKey())) { + return plugin; + } + } + return null; + } + +} diff --git a/it/it-tests/src/test/java/util/ItUtils.java b/it/it-tests/src/test/java/util/ItUtils.java index 09124d89ac8..f0392cf732c 100644 --- a/it/it-tests/src/test/java/util/ItUtils.java +++ b/it/it-tests/src/test/java/util/ItUtils.java @@ -52,4 +52,18 @@ public class ItUtils { } return dir; } + + /** + * Locate the artifact of a fake plugin stored in it/it-plugins. + * + * @param dirName the directory of it/it-plugins, for example "sonar-fake-plugin". + * It assumes that version is 1.0-SNAPSHOT + */ + public static FileLocation pluginArtifact(String dirName) { + File file = new File(HOME_DIR.get(), "it/it-plugins/" + dirName + "/target/" + dirName + "-1.0-SNAPSHOT.jar"); + if (!file.exists()) { + throw new IllegalStateException(String.format("Plugin [%s]for integration tests is not built. File not found:%s", dirName, file)); + } + return FileLocation.of(file); + } } diff --git a/it/it-tests/src/test/resources/selenium/qualitygate/notifications/activate_notification_channels.html b/it/it-tests/src/test/resources/qualitygate/notifications/activate_notification_channels.html similarity index 100% rename from it/it-tests/src/test/resources/selenium/qualitygate/notifications/activate_notification_channels.html rename to it/it-tests/src/test/resources/qualitygate/notifications/activate_notification_channels.html diff --git a/it/it-tests/src/test/resources/selenium/qualitygate/notifications/email_configuration.html b/it/it-tests/src/test/resources/qualitygate/notifications/email_configuration.html similarity index 100% rename from it/it-tests/src/test/resources/selenium/qualitygate/notifications/email_configuration.html rename to it/it-tests/src/test/resources/qualitygate/notifications/email_configuration.html diff --git a/it/it-tests/src/test/resources/testing/suite/CoverageTest/it_coverage-expected.json b/it/it-tests/src/test/resources/testing/suite/CoverageTest/it_coverage-expected.json new file mode 100644 index 00000000000..1bf11e70671 --- /dev/null +++ b/it/it-tests/src/test/resources/testing/suite/CoverageTest/it_coverage-expected.json @@ -0,0 +1,77 @@ +{ + "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": "", + } + ] + +} diff --git a/it/it-tests/src/test/resources/testing/suite/CoverageTest/unit_test_coverage-expected.json b/it/it-tests/src/test/resources/testing/suite/CoverageTest/unit_test_coverage-expected.json new file mode 100644 index 00000000000..ae72588b5b0 --- /dev/null +++ b/it/it-tests/src/test/resources/testing/suite/CoverageTest/unit_test_coverage-expected.json @@ -0,0 +1,78 @@ +{ + "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": "", + } + ] +} diff --git a/it/it-tests/src/test/resources/testing/suite/CoverageTest/unit_test_coverage_no_condition-expected.json b/it/it-tests/src/test/resources/testing/suite/CoverageTest/unit_test_coverage_no_condition-expected.json new file mode 100644 index 00000000000..6f5d2f7cd10 --- /dev/null +++ b/it/it-tests/src/test/resources/testing/suite/CoverageTest/unit_test_coverage_no_condition-expected.json @@ -0,0 +1,76 @@ +{ + "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": "", + } + ] +} diff --git a/it/it-tests/src/test/resources/testing/suite/CoverageTest/ut_and_it_coverage-expected.json b/it/it-tests/src/test/resources/testing/suite/CoverageTest/ut_and_it_coverage-expected.json new file mode 100644 index 00000000000..9d12abbba9c --- /dev/null +++ b/it/it-tests/src/test/resources/testing/suite/CoverageTest/ut_and_it_coverage-expected.json @@ -0,0 +1,85 @@ +{ + "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": "", + } + ] + +} diff --git a/it/it-tests/src/test/resources/testing/suite/CoverageTrackingTest/covered_files-expected.json b/it/it-tests/src/test/resources/testing/suite/CoverageTrackingTest/covered_files-expected.json new file mode 100644 index 00000000000..5dda4f3dd11 --- /dev/null +++ b/it/it-tests/src/test/resources/testing/suite/CoverageTrackingTest/covered_files-expected.json @@ -0,0 +1,14 @@ +{ + "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 + } + ] +} diff --git a/it/it-tests/src/test/resources/testing/suite/CoverageTrackingTest/tests-expected.json b/it/it-tests/src/test/resources/testing/suite/CoverageTrackingTest/tests-expected.json new file mode 100644 index 00000000000..f957eca7bc2 --- /dev/null +++ b/it/it-tests/src/test/resources/testing/suite/CoverageTrackingTest/tests-expected.json @@ -0,0 +1,35 @@ +{ + "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": "" + } + ] +} diff --git a/it/it-tests/src/test/resources/testing/suite/TestExecutionTest/expected.json b/it/it-tests/src/test/resources/testing/suite/TestExecutionTest/expected.json new file mode 100644 index 00000000000..8ad71d649bc --- /dev/null +++ b/it/it-tests/src/test/resources/testing/suite/TestExecutionTest/expected.json @@ -0,0 +1,35 @@ +{ + "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": "" + } + ] +} diff --git a/it/it-tests/src/test/resources/updatecenter/UpdateCenterTest/update-center-dependencies.properties b/it/it-tests/src/test/resources/updatecenter/UpdateCenterTest/update-center-dependencies.properties new file mode 100644 index 00000000000..65baf118f43 --- /dev/null +++ b/it/it-tests/src/test/resources/updatecenter/UpdateCenterTest/update-center-dependencies.properties @@ -0,0 +1,83 @@ +# 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=dotnet,fxcop,csharp,visualstudio + +#-------------------------------------------------------------------------------------------------------------------------- +dotnet.name=DotNet +dotnet.category=Additional Languages +dotnet.publicVersions=1.0,1.1 + +dotnet.1.0.description=Dot Net 1.0 +dotnet.1.0.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 +dotnet.1.0.downloadUrl= +dotnet.1.0.date=2011-07-29 + +dotnet.1.1.description=Dot Net 1.1 +dotnet.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 +dotnet.1.1.downloadUrl= +dotnet.1.1.date=2011-08-28 + +fxcop.name=FxCop +fxcop.category=Additional Languages +fxcop.publicVersions=1.0,1.1 + +fxcop.1.0.description=FxCop 1.0 +fxcop.1.0.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 +fxcop.1.0.downloadUrl= +fxcop.1.0.date=2012-01-05 +fxcop.1.0.parent=dotnet + +fxcop.1.1.description=FxCop 1.1 +fxcop.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 +fxcop.1.1.downloadUrl= +fxcop.1.1.date=2012-06-25 +fxcop.1.1.parent=dotnet + +csharp.name=C Sharp +csharp.category=Additional Languages +csharp.publicVersions=1.0,1.1 + +csharp.1.0.description=C Sharp 1.0 +csharp.1.0.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 +csharp.1.0.downloadUrl= +csharp.1.0.date=2012-01-05 +csharp.1.0.requirePlugins=dotnet:1.0 + +csharp.1.1.description=C Sharp 1.1 +csharp.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 +csharp.1.1.downloadUrl= +csharp.1.1.date=2012-06-25 +csharp.1.1.requirePlugins=dotnet:1.1 + +visualstudio.name=Visual Studio +visualstudio.category=Additional Languages +visualstudio.publicVersions=1.0,1.1 + +visualstudio.1.0.description=Visual Studio 1.0 +visualstudio.1.0.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 +visualstudio.1.0.downloadUrl= +visualstudio.1.0.date=2012-01-05 +visualstudio.1.0.requirePlugins=csharp:1.0 + +visualstudio.1.1.description=Visual Studio 1.1 +visualstudio.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 +visualstudio.1.1.downloadUrl= +visualstudio.1.1.date=2012-06-25 +visualstudio.1.1.requirePlugins=csharp:1.1 diff --git a/it/it-tests/src/test/resources/updatecenter/UpdateCenterTest/update-center-system-update-with-already-compatible-plugins.properties b/it/it-tests/src/test/resources/updatecenter/UpdateCenterTest/update-center-system-update-with-already-compatible-plugins.properties new file mode 100644 index 00000000000..50c8c2b5204 --- /dev/null +++ b/it/it-tests/src/test/resources/updatecenter/UpdateCenterTest/update-center-system-update-with-already-compatible-plugins.properties @@ -0,0 +1,32 @@ +# 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 + +#-------------------------------------------------------------------------------------------------------------------------- +fake.category=Additional Metrics +fake.publicVersions=1.0 +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,3.8,3.9,3.10,3.11,3.12,3.13,3.14,3.15,3.16,100.0 +fake.1.0.downloadUrl= +fake.1.0.date=2011-05-06 + diff --git a/it/it-tests/src/test/resources/updatecenter/UpdateCenterTest/update-center-with-missing-plugin-version.properties b/it/it-tests/src/test/resources/updatecenter/UpdateCenterTest/update-center-with-missing-plugin-version.properties new file mode 100644 index 00000000000..11d35d2f1b8 --- /dev/null +++ b/it/it-tests/src/test/resources/updatecenter/UpdateCenterTest/update-center-with-missing-plugin-version.properties @@ -0,0 +1,30 @@ +# 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 + +#-------------------------------------------------------------------------------------------------------------------------- +fake.category=Additional Metrics +fake.publicVersions=1.1 +fake.name=Fake +fake.description=Fake plugin for integration tests + +fake.1.1.description=Support sonar 100.0 +fake.1.1.sqVersions=3.2,3.3,3.4,3.5,3.6,3.7,3.8,3.9,3.10,3.11,3.12,3.13,3.14,3.15,3.16,100.0 +fake.1.1.downloadUrl= +fake.1.1.date=2012-04-27 diff --git a/it/it-tests/src/test/resources/updatecenter/UpdateCenterTest/update-center.properties b/it/it-tests/src/test/resources/updatecenter/UpdateCenterTest/update-center.properties new file mode 100644 index 00000000000..5882d43188f --- /dev/null +++ b/it/it-tests/src/test/resources/updatecenter/UpdateCenterTest/update-center.properties @@ -0,0 +1,62 @@ +# 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 diff --git a/it/it-tests/src/test/resources/updatecenter/available-plugins.html b/it/it-tests/src/test/resources/updatecenter/available-plugins.html new file mode 100644 index 00000000000..04f2b6240b7 --- /dev/null +++ b/it/it-tests/src/test/resources/updatecenter/available-plugins.html @@ -0,0 +1,85 @@ + + + + + + available-plugins + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
open/sonar/sessions/logout
open/sonar/settings
typeid=loginadmin
typeid=passwordadmin
clickAndWaitname=commit
open/sonar/updatecenter
clickAndWaitlink=Available Plugins
assertTextcontent*ABAP*
assertNotTextcontent*fake*
assertNotTextcontent*Fake*
clicklink=ABAP
assertTextdetail-abap*2.0.1 (Jun 25, 2012)*
clickAndWaitid=submit-abap
waitForTexterrormsg*Fail to download the plugin (abap, version 2.0.1)*
+ + diff --git a/it/it-tests/src/test/resources/updatecenter/installed-plugins.html b/it/it-tests/src/test/resources/updatecenter/installed-plugins.html new file mode 100644 index 00000000000..e691f40e3dd --- /dev/null +++ b/it/it-tests/src/test/resources/updatecenter/installed-plugins.html @@ -0,0 +1,54 @@ + + + + + + installed-plugins + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
open/sonar/sessions/logout
open/sonar/settings
typeid=loginadmin
typeid=passwordadmin
clickAndWaitname=commit
open/sonar/updatecenter
assertTextcontent*Installed Plugins*
assertTextuser-plugins*Plugins :: Fake*1.0-SNAPSHOT*
+ + diff --git a/it/it-tests/src/test/resources/updatecenter/plugin-updates.html b/it/it-tests/src/test/resources/updatecenter/plugin-updates.html new file mode 100644 index 00000000000..a70e257f25a --- /dev/null +++ b/it/it-tests/src/test/resources/updatecenter/plugin-updates.html @@ -0,0 +1,70 @@ + + + + + + plugin-updates + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
open/sonar/sessions/logout
open/sonar/settings
typeid=loginadmin
typeid=passwordadmin
clickAndWaitname=commit
open/sonar/updatecenter
clickAndWaitlink=Plugin Updates
assertTextplugin-updates*Fake*1.0-SNAPSHOT*1.1*Support sonarqube v100.0*
assertValueupgrade-submit-fakeUpgrade to 1.1
clickAndWaitid=upgrade-submit-fake
assertTexterrormsg*Fail to download the plugin (fake, version 1.1)*
+ + diff --git a/it/it-tests/src/test/resources/updatecenter/refresh-update-center.html b/it/it-tests/src/test/resources/updatecenter/refresh-update-center.html new file mode 100644 index 00000000000..31806663c5f --- /dev/null +++ b/it/it-tests/src/test/resources/updatecenter/refresh-update-center.html @@ -0,0 +1,66 @@ + + + + + + installed-plugins + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
open/sonar/sessions/logout
open/sonar/settings
typeid=loginadmin
typeid=passwordadmin
clickAndWaitname=commit
open/sonar/updatecenter
clickAndWaitlink=Available Plugins
assertTextcontent*Updated on*
clickAndWaitlink=Refresh
assertTextcontent*Updated on*
+ + diff --git a/it/it-tests/src/test/resources/updatecenter/system-updates-with-missing-installed-plugin-version.html b/it/it-tests/src/test/resources/updatecenter/system-updates-with-missing-installed-plugin-version.html new file mode 100644 index 00000000000..63b3789c24c --- /dev/null +++ b/it/it-tests/src/test/resources/updatecenter/system-updates-with-missing-installed-plugin-version.html @@ -0,0 +1,50 @@ + + + + + + installed-plugins + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
open/sonar/sessions/logout
open/sonar/settings
typeid=loginadmin
typeid=passwordadmin
clickAndWaitname=commit
open/sonar/updatecenter/system_updates?reload=true
assertTextcontent*SonarQube 100.0*
+ + diff --git a/it/it-tests/src/test/resources/updatecenter/system-updates-without-plugin-updates.html b/it/it-tests/src/test/resources/updatecenter/system-updates-without-plugin-updates.html new file mode 100644 index 00000000000..9c51ab2cfc5 --- /dev/null +++ b/it/it-tests/src/test/resources/updatecenter/system-updates-without-plugin-updates.html @@ -0,0 +1,55 @@ + + + + + + installed-plugins + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
open/sonar/sessions/logout
open/sonar/settings
typeid=loginadmin
typeid=passwordadmin
clickAndWaitname=commit
open/sonar/updatecenter/system_updates?reload=true
assertTextcontent*SonarQube 100.0*
assertNotTextcontent*SonarQube 100.0*Fake*1.1*
+ + diff --git a/it/it-tests/src/test/resources/updatecenter/system-updates.html b/it/it-tests/src/test/resources/updatecenter/system-updates.html new file mode 100644 index 00000000000..188a97cb331 --- /dev/null +++ b/it/it-tests/src/test/resources/updatecenter/system-updates.html @@ -0,0 +1,55 @@ + + + + + + installed-plugins + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
open/sonar/sessions/logout
open/sonar/settings
typeid=loginadmin
typeid=passwordadmin
clickAndWaitname=commit
open/sonar/updatecenter
clickAndWaitlink=System Updates
assertTextcontent*SonarQube 100.0*Fake*1.1*
+ + diff --git a/it/pom.xml b/it/pom.xml index 5dbedb1715d..01377ab9bf9 100644 --- a/it/pom.xml +++ b/it/pom.xml @@ -20,18 +20,4 @@ it-tests - - - org.codehaus.sonar.plugins - sonar-xoo-plugin - ${project.version} - provided - - - org.codehaus.sonar - sonar-application - ${project.version} - provided - - -- 2.39.5