diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2014-06-09 15:16:10 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2014-06-10 12:36:10 +0200 |
commit | da92c49827337bd34fbf077d5d74c9fbfb8ec287 (patch) | |
tree | 8e53db0de00d84dc712ad69904105430e65f8e6f /sonar-batch/src/test/java/org/sonar/batch/bootstrap/TaskContainerTest.java | |
parent | 5d0730e2be1a25c186049a3255c50772818ae4c1 (diff) | |
download | sonarqube-da92c49827337bd34fbf077d5d74c9fbfb8ec287.tar.gz sonarqube-da92c49827337bd34fbf077d5d74c9fbfb8ec287.zip |
Separate bootstrap settings and task settings
Diffstat (limited to 'sonar-batch/src/test/java/org/sonar/batch/bootstrap/TaskContainerTest.java')
-rw-r--r-- | sonar-batch/src/test/java/org/sonar/batch/bootstrap/TaskContainerTest.java | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/TaskContainerTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/TaskContainerTest.java new file mode 100644 index 00000000000..41616656012 --- /dev/null +++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/TaskContainerTest.java @@ -0,0 +1,61 @@ +/* + * 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 org.sonar.batch.bootstrap; + +import com.google.common.collect.Lists; +import org.junit.Test; +import org.sonar.batch.bootstrapper.EnvironmentInformation; +import org.sonar.batch.scan.DeprecatedProjectReactorBuilder; +import org.sonar.batch.scan.ProjectReactorBuilder; + +import java.util.Collections; + +import static org.fest.assertions.Assertions.assertThat; + +public class TaskContainerTest { + + @Test + public void should_add_project_reactor_builder_by_default() { + BootstrapContainer container = BootstrapContainer.create(Collections.<String, String>emptyMap(), + Lists.newArrayList(new BootstrapProperties(Collections.<String, String>emptyMap()))); + TaskContainer taskContainer = new TaskContainer(container, Collections.<String, String>emptyMap()); + taskContainer.installCoreTasks(); + + assertThat(taskContainer.getComponentByType(ProjectReactorBuilder.class)).isNotNull().isInstanceOf(ProjectReactorBuilder.class); + + container = BootstrapContainer.create(Collections.<String, String>emptyMap(), + Lists.newArrayList(new BootstrapProperties(Collections.<String, String>emptyMap()), new EnvironmentInformation("SonarQubeRunner", "2.4"))); + taskContainer = new TaskContainer(container, Collections.<String, String>emptyMap()); + taskContainer.installCoreTasks(); + + assertThat(taskContainer.getComponentByType(ProjectReactorBuilder.class)).isNotNull().isInstanceOf(ProjectReactorBuilder.class); + } + + @Test + public void should_add_deprecated_project_reactor_builder_if_old_runner() { + BootstrapContainer container = BootstrapContainer.create(Collections.<String, String>emptyMap(), + Lists.newArrayList(new BootstrapProperties(Collections.<String, String>emptyMap()), new EnvironmentInformation("SonarRunner", "2.3"))); + TaskContainer taskContainer = new TaskContainer(container, Collections.<String, String>emptyMap()); + taskContainer.installCoreTasks(); + + assertThat(taskContainer.getComponentByType(DeprecatedProjectReactorBuilder.class)).isNotNull().isInstanceOf(DeprecatedProjectReactorBuilder.class); + } + +} |