當前位置: 首頁>>代碼示例>>Java>>正文


Java FreeStyleProject.setAssignedNode方法代碼示例

本文整理匯總了Java中hudson.model.FreeStyleProject.setAssignedNode方法的典型用法代碼示例。如果您正苦於以下問題:Java FreeStyleProject.setAssignedNode方法的具體用法?Java FreeStyleProject.setAssignedNode怎麽用?Java FreeStyleProject.setAssignedNode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在hudson.model.FreeStyleProject的用法示例。


在下文中一共展示了FreeStyleProject.setAssignedNode方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: shouldGenerateLivingDocumentatationOnSlaveNode

import hudson.model.FreeStyleProject; //導入方法依賴的package包/類
@Test
public void shouldGenerateLivingDocumentatationOnSlaveNode() throws Exception{
	DumbSlave slave = jenkins.createOnlineSlave();
	FreeStyleProject project = jenkins.createFreeStyleProject("test");
	project.setAssignedNode(slave);
	
	SingleFileSCM scm = new SingleFileSCM("asciidoctor.json",
			CucumberLivingDocumentationIT.class.getResource("/json-output/asciidoctor/asciidoctor.json").toURI().toURL());
	
	project.setScm(scm);
	CukedoctorPublisher publisher = new CukedoctorPublisher(null, FormatType.HTML, TocType.RIGHT, true, true, "Living Documentation",false,false,false,false,false);
	project.getPublishersList().add(publisher);
	project.save();

	FreeStyleBuild build = jenkins.buildAndAssertSuccess(project);
	jenkins.assertLogContains("Format: html" + NEW_LINE + "Toc: right"+NEW_LINE +
			"Title: Living Documentation"+NEW_LINE+"Numbered: true"+NEW_LINE +
			"Section anchors: true", build);
	jenkins.assertLogContains("Found 4 feature(s)...",build);
	jenkins.assertLogContains("Documentation generated successfully!",build);
	Assert.assertTrue("It should run on slave",build.getBuiltOn().equals(slave));
	
}
 
開發者ID:jenkinsci,項目名稱:cucumber-living-documentation-plugin,代碼行數:24,代碼來源:CucumberLivingDocumentationIT.java

示例2: lockSlaveExecutors

import hudson.model.FreeStyleProject; //導入方法依賴的package包/類
/**
 * Used to lock the executors for each available slave assigned to this
 * build. <br />
 * <br />
 * <b>(Can be modified to get the auto-generated projects and their
 * builds)</b>
 * 
 * @param availableNodes
 *            the available nodes
 * @param build
 *            the current build
 * @param stream
 *            the printing stream
 * @return the locked set of nodes
 * @throws Exception
 */
private Set<Node> lockSlaveExecutors(Set<Node> availableNodes,
		AbstractBuild<?, ?> build, PrintStream stream) throws Exception {
	ArrayList<Future<FreeStyleBuild>> futureBuildList = new ArrayList<Future<FreeStyleBuild>>();

	ArrayList<FreeStyleProject> projectList = new ArrayList<FreeStyleProject>();

	Set<Node> nodeSet = new HashSet<Node>();

	Computer c = null;

	for (Node n : availableNodes) {

		c = n.toComputer();

		nodeSet.add(n);

		for (Executor e : c.getExecutors()) {

			if (e.isIdle()) {
				String lockProjectName = NodeUtils.getLockedProjectName(
						build.getProject().getName(), n, e);

				Jenkins jenkins = Jenkins.getInstance();

				NodeUtils.deleteLockingProject(lockProjectName, stream);

				FreeStyleProject project = jenkins.createProject(
						FreeStyleProject.class, lockProjectName);

				final String projectName = build.getProject().getName();

				project.getBuildersList().add(
						new DTDumbBuilder(projectName));

				project.setAssignedNode(n);

				QueueTaskFuture<FreeStyleBuild> buildFuture = project
						.scheduleBuild2(0);

				futureBuildList.add(buildFuture);
				projectList.add(project);

			}
		}
	}

	return nodeSet;
}
 
開發者ID:bombardier-transportation,項目名稱:distributed-test-job,代碼行數:65,代碼來源:DTBuilder.java


注:本文中的hudson.model.FreeStyleProject.setAssignedNode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。