Search in sources :

Example 1 with MavenSettingsConfig

use of org.jenkinsci.test.acceptance.plugins.config_file_provider.MavenSettingsConfig in project acceptance-test-harness by jenkinsci.

the class ConfigFileProviderTest method createMavenSettingsConfig.

private MavenSettingsConfig createMavenSettingsConfig(final String serverId, final String credId) {
    final MavenSettingsConfig mvnConfig = new ConfigFileProvider(jenkins).addFile(MavenSettingsConfig.class);
    mvnConfig.content(String.format("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<settings xmlns=\"http://maven.apache.org/SETTINGS/1.0.0\" \n" + "          xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n" + "          xsi:schemaLocation=\"http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd\">\n" + "  \n" + "  <servers>\n" + "    <server>\n" + "      <id>%s</id>\n" + "    </server>\n" + "  </servers>\n" + "\n" + "</settings>", serverId));
    final ServerCredentialMapping serverCred = mvnConfig.addServerCredentialMapping();
    serverCred.serverId(serverId);
    serverCred.credentialsId(credId);
    mvnConfig.save();
    return mvnConfig;
}
Also used : MavenSettingsConfig(org.jenkinsci.test.acceptance.plugins.config_file_provider.MavenSettingsConfig) ServerCredentialMapping(org.jenkinsci.test.acceptance.plugins.config_file_provider.ServerCredentialMapping) ConfigFileProvider(org.jenkinsci.test.acceptance.plugins.config_file_provider.ConfigFileProvider)

Example 2 with MavenSettingsConfig

use of org.jenkinsci.test.acceptance.plugins.config_file_provider.MavenSettingsConfig in project acceptance-test-harness by jenkinsci.

the class ConfigFileProviderTest method testMavenSettingsConfigFile.

@Test
public void testMavenSettingsConfigFile() {
    final MavenSettingsConfig mvnConfig = this.createMavenSettingsConfig(SERVER_ID, CRED_ID);
    final String jobLog = this.createPipelineAndGetConsole(mvnConfig);
    assertThat(jobLog, containsString(SERVER_ID));
    assertThat(jobLog, containsString(CRED_USR));
    assertThat(jobLog, containsString(CRED_PWD));
}
Also used : MavenSettingsConfig(org.jenkinsci.test.acceptance.plugins.config_file_provider.MavenSettingsConfig) Matchers.containsString(org.hamcrest.Matchers.containsString) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Aggregations

MavenSettingsConfig (org.jenkinsci.test.acceptance.plugins.config_file_provider.MavenSettingsConfig)2 Matchers.containsString (org.hamcrest.Matchers.containsString)1 AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)1 ConfigFileProvider (org.jenkinsci.test.acceptance.plugins.config_file_provider.ConfigFileProvider)1 ServerCredentialMapping (org.jenkinsci.test.acceptance.plugins.config_file_provider.ServerCredentialMapping)1 Test (org.junit.Test)1