Search in sources :

Example 1 with CommandInstaller

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

the class CustomToolsTest method configure_custom_tools.

@Test
@Issue("#97")
@Ignore
@ConfiguredWithCode(value = "CustomToolsTest.yml")
public void configure_custom_tools() {
    DescriptorImpl descriptor = (DescriptorImpl) j.jenkins.getDescriptorOrDie(CustomTool.class);
    assertEquals(1, descriptor.getInstallations().length);
    final CustomTool customTool = descriptor.getInstallations()[0];
    final InstallSourceProperty source = customTool.getProperties().get(InstallSourceProperty.class);
    assertNotNull(source);
    final CommandInstaller installer = source.installers.get(CommandInstaller.class);
    assertNotNull(installer);
    assertEquals("/bin/my-tool", installer.getToolHome());
}
Also used : CustomTool(com.cloudbees.jenkins.plugins.customtools.CustomTool) DescriptorImpl(com.cloudbees.jenkins.plugins.customtools.CustomTool.DescriptorImpl) CommandInstaller(hudson.tools.CommandInstaller) InstallSourceProperty(hudson.tools.InstallSourceProperty) Ignore(org.junit.Ignore) Issue(org.jvnet.hudson.test.Issue) Test(org.junit.Test) ConfiguredWithCode(io.jenkins.plugins.casc.misc.ConfiguredWithCode)

Example 2 with CommandInstaller

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

Aggregations

CommandInstaller (hudson.tools.CommandInstaller)2 InstallSourceProperty (hudson.tools.InstallSourceProperty)2 Test (org.junit.Test)2 CustomTool (com.cloudbees.jenkins.plugins.customtools.CustomTool)1 DescriptorImpl (com.cloudbees.jenkins.plugins.customtools.CustomTool.DescriptorImpl)1 MercurialInstallation (hudson.plugins.mercurial.MercurialInstallation)1 ConfiguredWithCode (io.jenkins.plugins.casc.misc.ConfiguredWithCode)1 ConfiguredWithReadme (io.jenkins.plugins.casc.misc.ConfiguredWithReadme)1 Ignore (org.junit.Ignore)1 Issue (org.jvnet.hudson.test.Issue)1