hudson.tools.ToolInstaller Java Examples

The following examples show how to use hudson.tools.ToolInstaller. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GitToolConfiguratorJenkinsRuleTest.java    From git-client-plugin with MIT License 5 votes vote down vote up
@Test
public void testDescribeGitTool() throws Exception {
    String gitName = "git-2.19.1-name";
    String gitHome = "/opt/git-2.19.1/bin/git";

    ConfiguratorRegistry registry = ConfiguratorRegistry.get();
    ConfigurationContext context = new ConfigurationContext(registry);

    List<ToolProperty<ToolInstallation>> gitToolProperties = new ArrayList<>();
    List<ToolInstaller> toolInstallers = new ArrayList<>();
    ToolInstaller toolInstaller = new ZipExtractionInstaller("tool-label", "tool-url", "tool-subdir");
    toolInstallers.add(toolInstaller);
    InstallSourceProperty installSourceProperty = new InstallSourceProperty(toolInstallers);
    gitToolProperties.add(installSourceProperty);

    GitTool gitTool = new GitTool(gitName, gitHome, gitToolProperties);

    CNode cNode = gitToolConfigurator.describe(gitTool, context);

    assertThat(cNode, is(notNullValue()));
    assertThat(cNode.getType(), is(CNode.Type.MAPPING));
    Mapping cNodeMapping = cNode.asMapping();
    assertThat(cNodeMapping.getScalarValue("name"), is(gitName));
    assertThat(cNodeMapping.getScalarValue("home"), is(gitHome));

    //         properties:
    //          - installSource:
    //              installers:
    //                - zip:
    //                    label: "tool-label"
    //                    subdir: "tool-subdir"
    //                    url: "tool-url"
    Sequence propertiesSequence = cNodeMapping.get("properties").asSequence();                             // properties:
    Mapping installSourceMapping = propertiesSequence.get(0).asMapping().get("installSource").asMapping(); //  - installSource:
    Sequence installersSequence = installSourceMapping.get("installers").asSequence();                     //      installers:
    Mapping zipMapping = installersSequence.get(0).asMapping().get("zip").asMapping();                     //        - zip:
    assertThat(zipMapping.getScalarValue("label"), is("tool-label"));
    assertThat(zipMapping.getScalarValue("subdir"), is("tool-subdir"));
    assertThat(zipMapping.getScalarValue("url"), is("tool-url"));
}
 
Example #2
Source File: OpenShiftClientTools.java    From jenkins-client-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public List<? extends ToolInstaller> getDefaultInstallers() {
    return super.getDefaultInstallers();
}
 
Example #3
Source File: OpenShiftClientTools.java    From jenkins-client-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public List<? extends ToolInstaller> getDefaultInstallers() {
    return super.getDefaultInstallers();
}
 
Example #4
Source File: DockerTool.java    From docker-commons-plugin with MIT License 4 votes vote down vote up
@Override public List<? extends ToolInstaller> getDefaultInstallers() {
    return super.getDefaultInstallers();
}
 
Example #5
Source File: PackerInstallation.java    From packer-plugin with MIT License 4 votes vote down vote up
@Override
public List<? extends ToolInstaller> getDefaultInstallers() {
    return Collections.singletonList(new PackerInstaller(null));
}