Search in sources :

Example 6 with InstallSourceProperty

use of hudson.tools.InstallSourceProperty in project nodejs-plugin by jenkinsci.

the class NodeJSInstallationTest method verify.

private void verify() throws Exception {
    NodeJSInstallation[] l = r.get(DescriptorImpl.class).getInstallations();
    assertEquals(1, l.length);
    r.assertEqualBeans(l[0], new NodeJSInstallation("myNode", "/tmp/foo", JenkinsRule.NO_PROPERTIES), "name,home");
    // by default we should get the auto installer
    DescribableList<ToolProperty<?>, ToolPropertyDescriptor> props = l[0].getProperties();
    assertEquals(1, props.size());
    InstallSourceProperty isp = props.get(InstallSourceProperty.class);
    assertEquals(1, isp.installers.size());
    assertNotNull(isp.installers.get(NodeJSInstaller.class));
}
Also used : DescriptorImpl(jenkins.plugins.nodejs.tools.NodeJSInstallation.DescriptorImpl) InstallSourceProperty(hudson.tools.InstallSourceProperty) ToolPropertyDescriptor(hudson.tools.ToolPropertyDescriptor) ToolProperty(hudson.tools.ToolProperty)

Example 7 with InstallSourceProperty

use of hudson.tools.InstallSourceProperty in project configuration-as-code-plugin by jenkinsci.

the class JdkConfiguratorTest method configure_jdk_tool.

@Test
public void configure_jdk_tool() {
    final JDK.DescriptorImpl descriptor = ExtensionList.lookupSingleton(JDK.DescriptorImpl.class);
    assertEquals(1, descriptor.getInstallations().length);
    JDK jdk = descriptor.getInstallations()[0];
    assertEquals("jdk11", jdk.getName());
    assertEquals("/jdk", jdk.getHome());
    InstallSourceProperty installSourceProperty = jdk.getProperties().get(InstallSourceProperty.class);
    assertEquals(1, installSourceProperty.installers.size());
    AdoptOpenJDKInstaller installer = installSourceProperty.installers.get(AdoptOpenJDKInstaller.class);
    assertEquals("jdk-11.0.14+9", installer.id);
}
Also used : JDK(hudson.model.JDK) AdoptOpenJDKInstaller(io.jenkins.plugins.adoptopenjdk.AdoptOpenJDKInstaller) InstallSourceProperty(hudson.tools.InstallSourceProperty) Test(org.junit.Test)

Example 8 with InstallSourceProperty

use of hudson.tools.InstallSourceProperty in project configuration-as-code-plugin by jenkinsci.

the class MercurialTest method should_configure_maven_tools_and_global_config.

@Test
@ConfiguredWithReadme("mercurial/README.md")
public void should_configure_maven_tools_and_global_config() {
    final Object descriptor = j.jenkins.getDescriptorOrDie(MercurialInstallation.class);
    Assert.assertNotNull(descriptor);
    Assert.assertEquals(1, ((MercurialInstallation.DescriptorImpl) descriptor).getInstallations().length);
    MercurialInstallation mercurial = ((MercurialInstallation.DescriptorImpl) descriptor).getInstallations()[0];
    Assert.assertEquals("Mercurial 3", mercurial.getName());
    Assert.assertEquals("/mercurial", mercurial.getHome());
    Assert.assertEquals("[defaults]\n" + "clone = --uncompressed\n" + "bundle = --type none", mercurial.getConfig());
    Assert.assertEquals("INSTALLATION/bin/hg", mercurial.getExecutable());
    Assert.assertTrue(mercurial.isUseCaches());
    Assert.assertFalse(mercurial.getDebug());
    Assert.assertFalse(mercurial.getDebug());
    Assert.assertEquals("/cache/root", mercurial.getMasterCacheRoot());
    Assert.assertFalse(mercurial.isUseSharing());
    InstallSourceProperty installSourceProperty = mercurial.getProperties().get(InstallSourceProperty.class);
    Assert.assertEquals(1, installSourceProperty.installers.size());
    CommandInstaller installer = installSourceProperty.installers.get(CommandInstaller.class);
    Assert.assertEquals("mercurial", installer.getToolHome());
    Assert.assertEquals("SomeLabel", installer.getLabel());
    Assert.assertEquals("[ -d mercurial ] || wget -q -O - http://www.archlinux.org/packages/extra/x86_64/mercurial/download/ | xzcat | tar xvf -", installer.getCommand());
}
Also used : CommandInstaller(hudson.tools.CommandInstaller) InstallSourceProperty(hudson.tools.InstallSourceProperty) MercurialInstallation(hudson.plugins.mercurial.MercurialInstallation) Test(org.junit.Test) ConfiguredWithReadme(io.jenkins.plugins.casc.misc.ConfiguredWithReadme)

Example 9 with InstallSourceProperty

use of hudson.tools.InstallSourceProperty 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

InstallSourceProperty (hudson.tools.InstallSourceProperty)9 Test (org.junit.Test)8 ConfiguredWithReadme (io.jenkins.plugins.casc.misc.ConfiguredWithReadme)3 Maven (hudson.tasks.Maven)2 CommandInstaller (hudson.tools.CommandInstaller)2 ConfiguredWithCode (io.jenkins.plugins.casc.misc.ConfiguredWithCode)2 CustomTool (com.cloudbees.jenkins.plugins.customtools.CustomTool)1 DescriptorImpl (com.cloudbees.jenkins.plugins.customtools.CustomTool.DescriptorImpl)1 JDK (hudson.model.JDK)1 MercurialInstallation (hudson.plugins.mercurial.MercurialInstallation)1 MavenInstaller (hudson.tasks.Maven.MavenInstaller)1 ToolProperty (hudson.tools.ToolProperty)1 ToolPropertyDescriptor (hudson.tools.ToolPropertyDescriptor)1 AdoptOpenJDKInstaller (io.jenkins.plugins.adoptopenjdk.AdoptOpenJDKInstaller)1 FilePathSettingsProvider (jenkins.mvn.FilePathSettingsProvider)1 SettingsProvider (jenkins.mvn.SettingsProvider)1 NodeJSInstallation (jenkins.plugins.nodejs.tools.NodeJSInstallation)1 DescriptorImpl (jenkins.plugins.nodejs.tools.NodeJSInstallation.DescriptorImpl)1 NodeJSInstaller (jenkins.plugins.nodejs.tools.NodeJSInstaller)1 TerraformInstallation (org.jenkinsci.plugins.terraform.TerraformInstallation)1