本文整理汇总了Java中hudson.tools.ToolProperty类的典型用法代码示例。如果您正苦于以下问题:Java ToolProperty类的具体用法?Java ToolProperty怎么用?Java ToolProperty使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ToolProperty类属于hudson.tools包,在下文中一共展示了ToolProperty类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: withTool
import hudson.tools.ToolProperty; //导入依赖的package包/类
@Test public void withTool() {
story.addStep(new Statement() {
@Override public void evaluate() throws Throwable {
assumeDocker();
assumeTrue(new File("/usr/bin/docker").canExecute()); // TODO generalize to find docker in $PATH
story.j.jenkins.getDescriptorByType(DockerTool.DescriptorImpl.class).setInstallations(new DockerTool("default", "/usr", Collections.<ToolProperty<?>>emptyList()));
WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "prj");
p.setDefinition(new CpsFlowDefinition(
"docker.withTool('default') {\n" +
" docker.image('httpd:2.4.12').withRun {}\n" +
" sh 'echo PATH=$PATH'\n" +
"}", true));
story.j.assertLogContains("PATH=/usr/bin:", story.j.assertBuildStatusSuccess(p.scheduleBuild2(0)));
}
});
}
示例2: onLoaded
import hudson.tools.ToolProperty; //导入依赖的package包/类
/**
* Creates a default tool installation if needed. Uses "ninja" or migrates
* data from previous versions
*
*/
@Initializer(after = InitMilestone.EXTENSIONS_AUGMENTED)
public static void onLoaded() {
Jenkins jenkinsInstance = Jenkins.getInstance();
if (jenkinsInstance == null) {
return;
}
DescriptorImpl descriptor = (DescriptorImpl) jenkinsInstance
.getDescriptor(NinjaTool.class);
NinjaTool[] installations = getInstallations(descriptor);
if (installations != null && installations.length > 0) {
// No need to initialize if there's already something
return;
}
NinjaTool tool = new NinjaTool(DEFAULT, "ninja",
Collections.<ToolProperty<?>> emptyList());
descriptor.setInstallations(new NinjaTool[] { tool });
descriptor.save();
}
示例3: PackerInstallation
import hudson.tools.ToolProperty; //导入依赖的package包/类
@DataBoundConstructor
public PackerInstallation(String name, String home, String params,
JSONObject templateMode,
List<PackerFileEntry> fileEntries,
List<? extends ToolProperty<?>> properties) {
super(name, launderHome(home), properties);
this.packerHome = super.getHome();
this.params = params;
this.fileEntries = fileEntries;
this.templateModeJsonObj = templateMode;
this.jsonTemplate = templateModeJsonObj.optString("jsonTemplate", null);
this.jsonTemplateText = templateModeJsonObj.optString("jsonTemplateText", null);
if (!Strings.isNullOrEmpty(templateModeJsonObj.optString("value", null))) {
this.templateMode = templateModeJsonObj.getString("value");
}
}
示例4: onLoaded
import hudson.tools.ToolProperty; //导入依赖的package包/类
@Initializer(after=EXTENSIONS_AUGMENTED)
public static void onLoaded() {
//Creates default tool installation if needed. Uses "git" or migrates data from previous versions
Jenkins jenkinsInstance = Jenkins.getInstance();
DescriptorImpl descriptor = (DescriptorImpl) jenkinsInstance.getDescriptor(GitTool.class);
GitTool[] installations = getInstallations(descriptor);
if (installations != null && installations.length > 0) {
//No need to initialize if there's already something
return;
}
String defaultGitExe = isWindows() ? "git.exe" : "git";
GitTool tool = new GitTool(DEFAULT, defaultGitExe, Collections.<ToolProperty<?>>emptyList());
descriptor.setInstallations(new GitTool[] { tool });
descriptor.save();
}
示例5: onLoaded
import hudson.tools.ToolProperty; //导入依赖的package包/类
@Initializer(after = PLUGINS_STARTED)
public static void onLoaded()
{
// Creates default tool installation if needed. Uses "tx" or migrates
// data from previous versions
DescriptorImpl descriptor = (DescriptorImpl) Jenkins.getInstance().getDescriptor(TransifexTool.class);
TransifexTool[] installations = getInstallations(descriptor);
if (installations != null && installations.length > 0)
{
// No need to initialize if there's already something
return;
}
String defaultTxExe = Functions.isWindows() ? "tx.exe" : "tx";
TransifexTool tool = new TransifexTool(DEFAULT, defaultTxExe, Collections.<ToolProperty<?>> emptyList());
descriptor.setInstallations(new TransifexTool[] { tool });
descriptor.save();
}
示例6: getInstallations
import hudson.tools.ToolProperty; //导入依赖的package包/类
private static List<ChrootToolset> getInstallations() throws InterruptedException {
LinkedList<List<String>> candidates = getCandidates();
List<ChrootToolset> installations = new LinkedList<ChrootToolset>();
for (List<String> properties : candidates) {
try {
List<String> command = new ArrayList<String>();
command.add("command");
command.add("-v");
command.add(properties.get(1));
Process proc = Runtime.getRuntime().exec(command.toArray(new String[0]));
proc.waitFor();
BufferedReader read = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String location;
if ((location = read.readLine()) != null) {
installations.add(new ChrootToolset(properties.get(0) + "-" + properties.get(1), "", properties.get(1), Collections.<ToolProperty<?>>emptyList()));
}
} catch (IOException ex) {
continue;
}
}
return installations;
}
示例7: testConfigChanged
import hudson.tools.ToolProperty; //导入依赖的package包/类
public void testConfigChanged(){
ToolProperty<ChrootToolset> toolProperty = new ChrootToolsetProperty("", "wget", "test-tool","", null);
List<ToolProperty<ChrootToolset> > properties = new ArrayList<ToolProperty<ChrootToolset>>();
properties.add(toolProperty);
ChrootToolset tool = new ChrootToolset("test-tool", "./", "mock", properties);
ChrootToolset.DescriptorImpl descriptor = new ChrootToolset.DescriptorImpl();
long timestamp = tool.getLastModified();
descriptor.setInstallations(tool);
assertEquals(timestamp, tool.getLastModified());
tool = new ChrootToolset("test-tool", "./", "mock", properties);
descriptor.setInstallations(tool);
assertEquals(timestamp, tool.getLastModified());
tool = new ChrootToolset("test-tool", "./a", "mock1", properties);
descriptor.setInstallations(tool);
assertFalse(tool.getLastModified() == timestamp);
timestamp = tool.getLastModified();
toolProperty = new ChrootToolsetProperty("", "wget", "test-tool1","", null);
properties = new ArrayList<ToolProperty<ChrootToolset>>();
properties.add(toolProperty);
tool = new ChrootToolset("test-tool", "./a", "mock", properties);
descriptor.setInstallations(tool);
assertFalse(tool.getLastModified() == timestamp);
}
示例8: configRoundTrip
import hudson.tools.ToolProperty; //导入依赖的package包/类
@Test public void configRoundTrip() {
story.addStep(new Statement() {
@Override public void evaluate() throws Throwable {
WithContainerStep s1 = new WithContainerStep("java");
s1.setArgs("--link db:db");
story.j.assertEqualDataBoundBeans(s1, new StepConfigTester(story.j).configRoundTrip(s1));
story.j.jenkins.getDescriptorByType(DockerTool.DescriptorImpl.class).setInstallations(new DockerTool("docker15", "/usr/local/docker15", Collections.<ToolProperty<?>>emptyList()));
s1.setToolName("docker15");
story.j.assertEqualDataBoundBeans(s1, new StepConfigTester(story.j).configRoundTrip(s1));
}
});
}
示例9: getExecutable
import hudson.tools.ToolProperty; //导入依赖的package包/类
@Test public void getExecutable() throws Exception {
assertEquals(DockerTool.COMMAND, DockerTool.getExecutable(null, null, null, null));
DockerTool.DescriptorImpl descriptor = r.jenkins.getDescriptorByType(DockerTool.DescriptorImpl.class);
String name = "docker15";
descriptor.setInstallations(new DockerTool(name, "/usr/local/docker15", Collections.<ToolProperty<?>>emptyList()));
// TODO r.jenkins.restart() does not reproduce need for get/setInstallations; use RestartableJenkinsRule in 1.567+
assertEquals("/usr/local/docker15/bin/docker", DockerTool.getExecutable(name, null, null, null));
DumbSlave slave = r.createOnlineSlave();
slave.getNodeProperties().add(new ToolLocationNodeProperty(new ToolLocationNodeProperty.ToolLocation(descriptor, name, "/opt/docker")));
assertEquals("/usr/local/docker15/bin/docker", DockerTool.getExecutable(name, null, null, null));
assertEquals("/opt/docker/bin/docker", DockerTool.getExecutable(name, slave, StreamTaskListener.fromStderr(), null));
}
示例10: configRoundTrip
import hudson.tools.ToolProperty; //导入依赖的package包/类
@Test public void configRoundTrip() throws Exception {
CredentialsStore store = CredentialsProvider.lookupStores(r.jenkins).iterator().next();
IdCredentials serverCredentials = new DockerServerCredentials(CredentialsScope.GLOBAL, "serverCreds", null, "clientKey", "clientCertificate", "serverCaCertificate");
store.addCredentials(Domain.global(), serverCredentials);
IdCredentials registryCredentials = new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, "registryCreds", null, "me", "pass");
store.addCredentials(Domain.global(), registryCredentials);
SampleDockerBuilder b1 = new SampleDockerBuilder(new DockerServerEndpoint("", ""), new DockerRegistryEndpoint("http://dhe.mycorp.com/", registryCredentials.getId()));
r.assertEqualDataBoundBeans(b1, r.configRoundtrip(b1));
b1 = new SampleDockerBuilder(new DockerServerEndpoint("tcp://192.168.1.104:8333", serverCredentials.getId()), new DockerRegistryEndpoint("", ""));
r.assertEqualDataBoundBeans(b1, r.configRoundtrip(b1));
r.jenkins.getDescriptorByType(DockerTool.DescriptorImpl.class).setInstallations(new DockerTool("Docker 1.5", "/usr/local/docker15", Collections.<ToolProperty<?>>emptyList()));
b1.setToolName("Docker 1.5");
r.assertEqualDataBoundBeans(b1, r.configRoundtrip(b1));
}
示例11: onLoaded
import hudson.tools.ToolProperty; //导入依赖的package包/类
@Initializer(after=EXTENSIONS_AUGMENTED)
public static void onLoaded() {
// Create default tool installation if needed.
DescriptorImpl descriptor = (DescriptorImpl) Jenkins.getInstance().getDescriptor(DrushInstallation.class);
DrushInstallation[] installations = descriptor.getInstallations();
// No need to initialize if there's already something.
if (installations != null && installations.length > 0) {
return;
}
DrushInstallation tool = new DrushInstallation("Default", "", Collections.<ToolProperty<?>>emptyList());
descriptor.setInstallations(new DrushInstallation[] { tool });
descriptor.save();
}
示例12: FauxPasAppToolInstallation
import hudson.tools.ToolProperty; //导入依赖的package包/类
@DataBoundConstructor
public FauxPasAppToolInstallation(
String name,
String home,
List<? extends ToolProperty<?>> properties
)
{
super(Util.fixEmptyAndTrim(name),
FauxPasUtils.pathByRemovingTrailingSlash(Util.fixEmptyAndTrim(home)),
properties);
}
示例13: OpenShiftClientTools
import hudson.tools.ToolProperty; //导入依赖的package包/类
@DataBoundConstructor
public OpenShiftClientTools(String name, String home,
List<? extends ToolProperty<?>> properties) {
super(name, home, properties);
}
示例14: MockToolWithSymbol
import hudson.tools.ToolProperty; //导入依赖的package包/类
public MockToolWithSymbol(String name, String home, List<? extends ToolProperty<?>> properties) {
super(name, home, properties);
}
示例15: MockToolWithoutSymbol
import hudson.tools.ToolProperty; //导入依赖的package包/类
public MockToolWithoutSymbol(String name, String home, List<? extends ToolProperty<?>> properties) {
super(name, home, properties);
}