Package org.sonar.api.batch.bootstrap

Examples of org.sonar.api.batch.bootstrap.ProjectReactor


  @Test(expected = IllegalArgumentException.class)
  public void shouldFailIfExcludingRoot() {
    Settings settings = new Settings();
    settings.setProperty("sonar.skippedModules", "sub1,root");

    ProjectReactor reactor = newReactor("root", "sub1", "sub2");
    ProjectExclusions exclusions = new ProjectExclusions(settings, reactor, null);
    exclusions.apply();
  }
View Full Code Here


    exclusions.apply();
  }

  @Test
  public void shouldIgnoreMavenGroupId() {
    ProjectReactor reactor = newReactor("org.apache.struts:struts", "org.apache.struts:struts-core", "org.apache.struts:struts-taglib");

    Settings settings = new Settings();
    settings.setProperty("sonar.skippedModules", "struts-taglib");

    ProjectExclusions exclusions = new ProjectExclusions(settings, reactor, null);
    exclusions.apply();

    assertThat(reactor.getProject("org.apache.struts:struts")).isNotNull();
    assertThat(reactor.getProject("org.apache.struts:struts-core")).isNotNull();
    assertThat(reactor.getProject("org.apache.struts:struts-taglib")).isNull();
  }
View Full Code Here

  @Test
  public void should_load_project_props() {
    project.setProperty("project.prop", "project");

    ProjectSettings batchSettings = new ProjectSettings(new ProjectReactor(project), bootstrapProps, new PropertyDefinitions(), projectRef, mode);

    assertThat(batchSettings.getString("project.prop")).isEqualTo("project");
  }
View Full Code Here

  @Test
  public void should_load_project_root_settings() {
    projectRef.addSettings("struts", ImmutableMap.of("sonar.cpd.cross", "true", "sonar.java.coveragePlugin", "jacoco"));

    ProjectSettings batchSettings = new ProjectSettings(new ProjectReactor(project), bootstrapProps, new PropertyDefinitions(), projectRef, mode);

    assertThat(batchSettings.getString("sonar.java.coveragePlugin")).isEqualTo("jacoco");
  }
View Full Code Here

  public void should_load_project_root_settings_on_branch() {
    project.setProperty(CoreProperties.PROJECT_BRANCH_PROPERTY, "mybranch");

    projectRef.addSettings("struts:mybranch", ImmutableMap.of("sonar.cpd.cross", "true", "sonar.java.coveragePlugin", "jacoco"));

    ProjectSettings batchSettings = new ProjectSettings(new ProjectReactor(project), bootstrapProps, new PropertyDefinitions(), projectRef, mode);

    assertThat(batchSettings.getString("sonar.java.coveragePlugin")).isEqualTo("jacoco");
  }
View Full Code Here

  @Test
  public void should_not_fail_when_accessing_secured_properties() {
    projectRef.addSettings("struts", ImmutableMap.of("sonar.foo.secured", "bar", "sonar.foo.license.secured", "bar2"));

    ProjectSettings batchSettings = new ProjectSettings(new ProjectReactor(project), bootstrapProps, new PropertyDefinitions(), projectRef, mode);

    assertThat(batchSettings.getString("sonar.foo.license.secured")).isEqualTo("bar2");
    assertThat(batchSettings.getString("sonar.foo.secured")).isEqualTo("bar");
  }
View Full Code Here

  public void should_fail_when_accessing_secured_properties_in_dryrun() {
    projectRef.addSettings("struts", ImmutableMap.of("sonar.foo.secured", "bar", "sonar.foo.license.secured", "bar2"));

    when(mode.isPreview()).thenReturn(true);

    ProjectSettings batchSettings = new ProjectSettings(new ProjectReactor(project), bootstrapProps, new PropertyDefinitions(), projectRef, mode);

    assertThat(batchSettings.getString("sonar.foo.license.secured")).isEqualTo("bar2");
    thrown.expect(MessageException.class);
    thrown
      .expectMessage("Access to the secured property 'sonar.foo.secured' is not possible in preview mode. The SonarQube plugin which requires this property must be deactivated in preview mode.");
View Full Code Here

  @Test
  public void not_fail_if_provisioning_enforced_and_project_exists() throws Exception {
    String key = "project-key";
    settings.setProperty(CoreProperties.CORE_PREVENT_AUTOMATIC_PROJECT_CREATION, true);
    when(resourceDao.findByKey(key)).thenReturn(mock(Component.class));
    ProjectReactor reactor = createProjectReactor(key);
    validator.validate(reactor);
  }
View Full Code Here

  @Test
  public void not_fail_if_provisioning_enforced_and_project_with_branch_exists() throws Exception {
    String key = "project-key";
    settings.setProperty(CoreProperties.CORE_PREVENT_AUTOMATIC_PROJECT_CREATION, true);
    when(resourceDao.findByKey(key + ":branch")).thenReturn(mock(Component.class));
    ProjectReactor reactor = createProjectReactor(key, "branch");
    validator.validate(reactor);
  }
View Full Code Here

  @Test(expected = SonarException.class)
  public void fail_if_provisioning_enforced_and_project_not_provisioned() throws Exception {
    String key = "project-key";
    settings.setProperty(CoreProperties.CORE_PREVENT_AUTOMATIC_PROJECT_CREATION, true);
    when(resourceDao.findByKey(key)).thenReturn(null);
    ProjectReactor reactor = createProjectReactor(key);
    validator.validate(reactor);
  }
View Full Code Here

TOP

Related Classes of org.sonar.api.batch.bootstrap.ProjectReactor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.