use of hudson.plugins.sonar.SonarPublisher in project sonar-scanner-jenkins by SonarSource.
the class SonarPublisherJdkSlicerTest method availableMavenProjectsWithSonarPublisher.
@Test
public void availableMavenProjectsWithSonarPublisher() throws IOException {
final MavenModuleSet project = j.jenkins.createProject(MavenModuleSet.class, "random-name");
assertThat(new SonarPublisherJdkSlicer().getWorkDomain().size()).isZero();
project.getPublishersList().add(new SonarPublisher("MySonar", null, null, null, null, null, null, null, null, null, false));
assertThat(new SonarPublisherJdkSlicer().getWorkDomain().size()).isEqualTo(1);
}
use of hudson.plugins.sonar.SonarPublisher in project sonar-scanner-jenkins by SonarSource.
the class SonarPublisherSQServerSlicerTest method availableMavenProjectsWithSonarPublisher.
@Test
public void availableMavenProjectsWithSonarPublisher() throws IOException {
final MavenModuleSet project = j.jenkins.createProject(MavenModuleSet.class, "random-name");
assertThat(new SonarPublisherSQServerSlicer().getWorkDomain().size()).isZero();
project.getPublishersList().add(new SonarPublisher("MySonar", null, null, null, null, null, null, null, null, null, false));
assertThat(new SonarPublisherSQServerSlicer().getWorkDomain().size()).isEqualTo(1);
}
use of hudson.plugins.sonar.SonarPublisher in project sonar-scanner-jenkins by SonarSource.
the class SonarPublisherSQServerSlicerTest 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, null, null, null, false);
project.getPublishersList().add(mySonar);
final SonarPublisherSQServerSlicer.SonarPublisherSQInstallSlicerSpec spec = new SonarPublisherSQServerSlicer.SonarPublisherSQInstallSlicerSpec();
final List<String> values = spec.getValues(project);
assertThat(values.get(0)).isEqualTo("MySonar");
final List<String> newValues = new ArrayList<String>();
newValues.add("MySonar 2");
spec.setValues(project, newValues);
assertThat(mySonar.getInstallationName()).isEqualTo("MySonar 2");
}
use of hudson.plugins.sonar.SonarPublisher in project sonar-scanner-jenkins by SonarSource.
the class SonarMavenTest method shouldWrapUpArguments.
@Test
public void shouldWrapUpArguments() throws Exception {
SonarPublisher publisher = mock(SonarPublisher.class);
SonarInstallation installation = mock(SonarInstallation.class);
when(installation.getServerUrl()).thenReturn("hostUrl");
when(installation.getServerAuthenticationToken()).thenReturn("xyz");
when(publisher.getInstallation()).thenReturn(installation);
when(publisher.getBranch()).thenReturn("branch");
ArgumentListBuilder args = new ArgumentListBuilder();
SonarMaven sonarMaven = new SonarMaven("-Dprop=value", "Default Maven", "pom.xml", "", new DefaultLocalRepositoryLocator(), publisher, mock(BuildListener.class), null, null, null);
sonarMaven.wrapUpArguments(args, "sonar:sonar", mock(AbstractBuild.class), mock(Launcher.class), mock(BuildListener.class));
List<String> result = args.toList();
assertThat(result).contains("-Dprop=value");
assertThat(result).contains("-Dsonar.host.url=hostUrl");
assertThat(result).contains("-Dsonar.branch=branch");
assertThat(result).contains("-Dsonar.login=xyz");
}
Aggregations