本文整理匯總了Java中hudson.model.FreeStyleProject.setAssignedLabel方法的典型用法代碼示例。如果您正苦於以下問題:Java FreeStyleProject.setAssignedLabel方法的具體用法?Java FreeStyleProject.setAssignedLabel怎麽用?Java FreeStyleProject.setAssignedLabel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類hudson.model.FreeStyleProject
的用法示例。
在下文中一共展示了FreeStyleProject.setAssignedLabel方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: call
import hudson.model.FreeStyleProject; //導入方法依賴的package包/類
@Override
public Boolean call() throws Throwable {
final Jenkins jenkins = Jenkins.getInstance();
// prepare job
final FreeStyleProject project = jenkins.createProject(FreeStyleProject.class, "freestyle-project");
final Shell env = new Shell("env");
project.getBuildersList().add(env);
project.setAssignedLabel(new LabelAtom(DOCKER_CLOUD_LABEL));
project.save();
LOG.trace("trace test.");
project.scheduleBuild(new TestCause());
// image pull may take time
waitUntilNoActivityUpTo(jenkins, 10 * 60 * 1000);
final FreeStyleBuild lastBuild = project.getLastBuild();
assertThat(lastBuild, not(nullValue()));
assertThat(lastBuild.getResult(), is(Result.SUCCESS));
assertThat(getLog(lastBuild), Matchers.containsString(TEST_VALUE));
assertThat(getLog(lastBuild), Matchers.containsString(CLOUD_ID + "=" + DOCKER_CLOUD_NAME));
return true;
}
示例2: testNonDefaultJob
import hudson.model.FreeStyleProject; //導入方法依賴的package包/類
@Test public void testNonDefaultJob() throws Exception {
FreeStyleProject project = j.createFreeStyleProject();
j.createSlave("abc", null);
project.setAssignedLabel(j.jenkins.getLabel("abc"));
project.save();
assertFalse(checker.executeCheck(project));
}
示例3: testWithAssignedLabel
import hudson.model.FreeStyleProject; //導入方法依賴的package包/類
@Test public void testWithAssignedLabel() throws Exception {
FreeStyleProject project = j.createFreeStyleProject();
j.createSlave("test",null);
project.setAssignedLabel(j.jenkins.getLabel("test"));
project.save();
assertFalse(checker.executeCheck(project));
}
示例4: provisionAndLaunch
import hudson.model.FreeStyleProject; //導入方法依賴的package包/類
@Test
public void provisionAndLaunch() throws Exception {
FreeStyleProject p = j.createFreeStyleProject();
p.setAssignedLabel(Label.get("label"));
QueueTaskFuture<FreeStyleBuild> build = p.scheduleBuild2(0);
j.jenkins.clouds.add(new TestCloud("dummy", j, new LaunchSuccessfully()));
triggerProvisioning();
List<ProvisioningActivity> activities;
for (;;) {
activities = CloudStatistics.get().getActivities();
if (activities.size() > 0) break;
}
for (ProvisioningActivity a : activities) {
assertEquals(activities.toString(), "dummy", a.getId().getCloudName());
assertThat(activities.toString(), a.getId().getNodeName(), startsWith("dummy-slave-"));
assertThat(activities.toString(), a.getName(), startsWith("dummy-slave-"));
}
ProvisioningActivity activity = activities.get(0);
assertNotNull(activity.getPhaseExecution(PROVISIONING));
assertEquals(activity.getPhaseExecution(PROVISIONING).getAttachments().toString(), OK, activity.getStatus());
// It can take a bit
while (j.jenkins.getComputer(activity.getId().getNodeName()) == null) {
System.out.println("Waiting for node");
Thread.sleep(100);
}
Computer computer = j.jenkins.getComputer(activity.getId().getNodeName());
assertNotNull(computer);
while (activity.getPhaseExecution(LAUNCHING) == null) {
System.out.println("Waiting for launch to start");
Thread.sleep(100);
}
while (activity.getPhaseExecution(OPERATING) == null) {
System.out.println("Waiting for slave to launch");
Thread.sleep(100);
}
System.out.println("Waiting for slave to launch");
computer.waitUntilOnline();
assertNull(activity.getPhaseExecution(COMPLETED));
System.out.println("Waiting for build to complete");
Computer builtOn = build.get().getBuiltOn().toComputer();
assertEquals(computer, builtOn);
computer.doDoDelete();
assertEquals(OK, activity.getStatus());
detectCompletionNow();
assertNotNull(activity.getCurrentPhase().toString(), activity.getPhaseExecution(COMPLETED));
}
示例5: testWithAssignedLabel
import hudson.model.FreeStyleProject; //導入方法依賴的package包/類
@Test public void testWithAssignedLabel() throws Exception {
FreeStyleProject project = j.createFreeStyleProject();
project.setAssignedLabel(j.jenkins.getLabel("master"));
project.save();
assertTrue(checker.executeCheck(project));
}