Search in sources :

Example 1 with FilePathSettingsProvider

use of jenkins.mvn.FilePathSettingsProvider in project configuration-as-code-plugin by jenkinsci.

the class MavenConfiguratorTest method configure_maven_global_config_specific_files.

@Test
@ConfiguredWithReadme("maven/README.md#2")
public void configure_maven_global_config_specific_files() {
    final GlobalMavenConfig descriptor = ExtensionList.lookupSingleton(GlobalMavenConfig.class);
    assertThat(descriptor.getGlobalSettingsProvider(), instanceOf(FilePathGlobalSettingsProvider.class));
    FilePathGlobalSettingsProvider globalProvider = (FilePathGlobalSettingsProvider) descriptor.getGlobalSettingsProvider();
    assertThat(globalProvider.getPath(), is("/conf/maven/global-settings.xml"));
    assertThat(descriptor.getSettingsProvider(), instanceOf(FilePathSettingsProvider.class));
    FilePathSettingsProvider provider = (FilePathSettingsProvider) descriptor.getSettingsProvider();
    assertThat(provider.getPath(), is("/conf/maven/settings.xml"));
}
Also used : GlobalMavenConfig(jenkins.mvn.GlobalMavenConfig) FilePathGlobalSettingsProvider(jenkins.mvn.FilePathGlobalSettingsProvider) FilePathSettingsProvider(jenkins.mvn.FilePathSettingsProvider) Test(org.junit.Test) ConfiguredWithReadme(io.jenkins.plugins.casc.misc.ConfiguredWithReadme)

Example 2 with FilePathSettingsProvider

use of jenkins.mvn.FilePathSettingsProvider in project configuration-as-code-plugin by jenkinsci.

the class MavenConfiguratorTest method should_configure_maven_tools_and_global_config.

@Test
@ConfiguredWithCode("MavenConfiguratorTest.yml")
public void should_configure_maven_tools_and_global_config() {
    final Maven.DescriptorImpl descriptor = (Maven.DescriptorImpl) j.jenkins.getDescriptorOrDie(Maven.class);
    Assert.assertEquals(1, descriptor.getInstallations().length);
    Assert.assertEquals("/usr/share/maven", descriptor.getInstallations()[0].getHome());
    InstallSourceProperty installSourceProperty = descriptor.getInstallations()[0].getProperties().get(InstallSourceProperty.class);
    Assert.assertEquals("3.5.0", installSourceProperty.installers.get(Maven.MavenInstaller.class).id);
    final SettingsProvider provider = GlobalMavenConfig.get().getSettingsProvider();
    Assert.assertTrue(provider instanceof FilePathSettingsProvider);
    Assert.assertEquals("/usr/share/maven-settings.xml", ((FilePathSettingsProvider) provider).getPath());
}
Also used : SettingsProvider(jenkins.mvn.SettingsProvider) FilePathSettingsProvider(jenkins.mvn.FilePathSettingsProvider) Maven(hudson.tasks.Maven) InstallSourceProperty(hudson.tools.InstallSourceProperty) FilePathSettingsProvider(jenkins.mvn.FilePathSettingsProvider) Test(org.junit.Test) ConfiguredWithCode(io.jenkins.plugins.casc.misc.ConfiguredWithCode)

Aggregations

FilePathSettingsProvider (jenkins.mvn.FilePathSettingsProvider)2 Test (org.junit.Test)2 Maven (hudson.tasks.Maven)1 InstallSourceProperty (hudson.tools.InstallSourceProperty)1 ConfiguredWithCode (io.jenkins.plugins.casc.misc.ConfiguredWithCode)1 ConfiguredWithReadme (io.jenkins.plugins.casc.misc.ConfiguredWithReadme)1 FilePathGlobalSettingsProvider (jenkins.mvn.FilePathGlobalSettingsProvider)1 GlobalMavenConfig (jenkins.mvn.GlobalMavenConfig)1 SettingsProvider (jenkins.mvn.SettingsProvider)1