use of hudson.plugins.sonar.model.TriggersConfig in project configuration-as-code-plugin by jenkinsci.
the class SonarQubeTest method configure_sonar_globalconfig.
@Test
@ConfiguredWithReadme("sonarqube/README.md")
public void configure_sonar_globalconfig() {
final SonarGlobalConfiguration configuration = GlobalConfiguration.all().get(SonarGlobalConfiguration.class);
assertTrue(configuration.isBuildWrapperEnabled());
final SonarInstallation installation = configuration.getInstallations()[0];
assertEquals("TEST", installation.getName());
assertEquals("http://url:9000", installation.getServerUrl());
assertEquals("token", installation.getCredentialsId());
assertEquals("mojoVersion", installation.getMojoVersion());
assertEquals("additionalAnalysisProperties", installation.getAdditionalAnalysisProperties());
final TriggersConfig triggers = installation.getTriggers();
assertTrue(triggers.isSkipScmCause());
assertTrue(triggers.isSkipUpstreamCause());
assertEquals("envVar", triggers.getEnvVar());
}
use of hudson.plugins.sonar.model.TriggersConfig in project sonar-scanner-jenkins by SonarSource.
the class SonarBuildWrapperTest method maskAuthToken.
@Test
public void maskAuthToken() throws IOException, InterruptedException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
configureSonar(new SonarInstallation("local", "http://localhost:9001", MYTOKEN, null, null, new TriggersConfig(), null));
OutputStream os = wrapper.decorateLogger(mock(AbstractBuild.class), bos);
IOUtils.write("test sonar\ntest mytoken\n", os);
assertThat(new String(bos.toByteArray())).isEqualTo("test sonar\ntest ******\n");
}
use of hudson.plugins.sonar.model.TriggersConfig in project sonar-scanner-jenkins by SonarSource.
the class SonarInstallationTest method testRoundtrip.
@Test
public void testRoundtrip() throws IOException {
TriggersConfig triggers = new TriggersConfig();
SonarGlobalConfiguration d = new SonarGlobalConfiguration();
d.setInstallations(new SonarInstallation("Name", "server.url", "token", "mojoVersion", "props", triggers, "key=value"));
d.save();
SonarInstallation i = new SonarGlobalConfiguration().getInstallations()[0];
String storedConfig = Util.loadFile(new File(Jenkins.getInstance().getRootDir(), d.getId() + ".xml"));
assertThat(i.getName()).isEqualTo("Name");
assertThat(i.getServerUrl()).isEqualTo("server.url");
assertThat(i.getServerAuthenticationToken()).isEqualTo("token");
assertThat(i.getMojoVersion()).isEqualTo("mojoVersion");
assertThat(i.getAdditionalProperties()).isEqualTo("props");
assertThat(i.getAdditionalAnalysisProperties()).isEqualTo("key=value");
assertThat(storedConfig).doesNotContain("dbPasswd");
assertThat(storedConfig).doesNotContain("sonarPasswd");
}
Aggregations