use of hudson.plugins.sonar.SonarPublisher in project sonar-scanner-jenkins by SonarSource.
the class SonarPublisherBranchSlicerTest method changeJobAdditionalProperties.
@Test
public void changeJobAdditionalProperties() throws IOException {
final MavenModuleSet project = j.jenkins.createProject(MavenModuleSet.class, "random-name");
project.getPublishersList().add(new SonarPublisher("MySonar", null, null, null, null, null, null, null, null, null, false));
final SonarPublisherBranchSlicer.SonarPublisherBranchSlicerSpec branchSpec = new SonarPublisherBranchSlicer.SonarPublisherBranchSlicerSpec();
final List<String> values = branchSpec.getValues(project);
assertThat(values.get(0)).isEqualTo("(Empty)");
final List<String> newValues = new ArrayList<String>();
newValues.add("branchName");
branchSpec.setValues(project, newValues);
final SonarPublisher publisher = project.getPublishersList().get(SonarPublisher.class);
assertThat(publisher.getBranch()).isEqualTo("branchName");
}
use of hudson.plugins.sonar.SonarPublisher in project sonar-scanner-jenkins by SonarSource.
the class SonarPublisherJdkSlicerTest method changeJobAdditionalProperties.
@Test
public void changeJobAdditionalProperties() throws Exception {
final MavenModuleSet project = j.jenkins.createProject(MavenModuleSet.class, "random-name");
final SonarPublisher mySonar = new SonarPublisher("MySonar", null, null, null, null, null, null, "1.7", null, null, false);
project.getPublishersList().add(mySonar);
final SonarPublisherJdkSlicer.SonarPublisherJdkSlicerSpec spec = new SonarPublisherJdkSlicer.SonarPublisherJdkSlicerSpec();
final List<String> values = spec.getValues(project);
assertThat(values.get(0)).isEqualTo("1.7");
final List<String> newValues = new ArrayList<String>();
newValues.add("1.7");
spec.setValues(project, newValues);
assertThat(mySonar.getJdkName()).isEqualTo("1.7");
}
use of hudson.plugins.sonar.SonarPublisher in project sonar-scanner-jenkins by SonarSource.
the class SonarPublisherAdditionalPropertiesSlicerTest method availableMavenProjectsWithSonarPublisher.
@Test
public void availableMavenProjectsWithSonarPublisher() throws IOException {
final MavenModuleSet project = j.jenkins.createProject(MavenModuleSet.class, "random-name");
assertThat(new SonarPublisherAdditionalPropertiesSlicer().getWorkDomain().size()).isZero();
project.getPublishersList().add(new SonarPublisher("MySonar", null, null, "-Dsonar.verbose", null, null, null, null, null, null, false));
assertThat(new SonarPublisherAdditionalPropertiesSlicer().getWorkDomain().size()).isEqualTo(1);
}
use of hudson.plugins.sonar.SonarPublisher in project sonar-scanner-jenkins by SonarSource.
the class SonarPublisherAdditionalPropertiesSlicerTest method changeJobAdditionalProperties.
@Test
public void changeJobAdditionalProperties() throws IOException {
final MavenModuleSet project = j.jenkins.createProject(MavenModuleSet.class, "random-name");
project.getPublishersList().add(new SonarPublisher("MySonar", null, null, "-Dsonar.verbose", null, null, null, null, null, null, false));
final SonarPublisherAdditionalPropertiesSlicer.SonarPublisherAdditionalPropertiesSlicerSpec propertiesSpec = new SonarPublisherAdditionalPropertiesSlicer.SonarPublisherAdditionalPropertiesSlicerSpec();
final List<String> values = propertiesSpec.getValues(project);
assertThat(values.get(0)).isEqualTo("-Dsonar.verbose");
final List<String> newValues = new ArrayList<String>();
newValues.add("-Dsonar.showSql");
propertiesSpec.setValues(project, newValues);
final SonarPublisher publisher = project.getPublishersList().get(SonarPublisher.class);
assertThat(publisher.getJobAdditionalProperties()).isEqualTo("-Dsonar.showSql");
}
use of hudson.plugins.sonar.SonarPublisher in project sonar-scanner-jenkins by SonarSource.
the class SonarPublisherBranchSlicerTest method availableMavenProjectsWithSonarPublisher.
@Test
public void availableMavenProjectsWithSonarPublisher() throws IOException {
final MavenModuleSet project = j.jenkins.createProject(MavenModuleSet.class, "random-name");
assertThat(new SonarPublisherBranchSlicer().getWorkDomain().size()).isZero();
project.getPublishersList().add(new SonarPublisher("MySonar", null, null, null, null, null, null, null, null, null, false));
assertThat(new SonarPublisherBranchSlicer().getWorkDomain().size()).isEqualTo(1);
}
Aggregations