本文整理汇总了Java中hudson.model.labels.LabelAtom类的典型用法代码示例。如果您正苦于以下问题:Java LabelAtom类的具体用法?Java LabelAtom怎么用?Java LabelAtom使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LabelAtom类属于hudson.model.labels包,在下文中一共展示了LabelAtom类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: call
import hudson.model.labels.LabelAtom; //导入依赖的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: verifyMinimumBuildQueue
import hudson.model.labels.LabelAtom; //导入依赖的package包/类
@Ignore("Unit test fails when performing a release. The queue has a race condition" +
"which is resolved in 1.607+ (TODO).")
@Test
public void verifyMinimumBuildQueue() throws Exception {
// Given
QueueTaskFuture<FreeStyleBuild> build;
String assignedLabel = "foo";
FreeStyleProject p = j.createFreeStyleProject("bar");
p.setAssignedLabel(new LabelAtom(assignedLabel));
BuildQueue queue = new BuildQueue();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
// When
build = p.scheduleBuild2(0);
queue.addContents(createContainer(baos));
// Then
build.cancel(true);
List<String> output = new ArrayList<String>(Arrays.asList(baos.toString().split("\n")));
assertContains(output, "1 item");
assertContains(output, p.getDisplayName());
assertContains(output, "Waiting for next available executor");
}
示例3: setUp
import hudson.model.labels.LabelAtom; //导入依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
super.setUp();
slave = createOnlineSlave(new LabelAtom("oneiric-10"));
// poll to make sure test slave is online before continuing
long timeoutExpiredMs = System.currentTimeMillis() + 3000;
while (true) {
if (slave.getChannel() != null) {
break;
}
this.wait(timeoutExpiredMs - System.currentTimeMillis());
if (System.currentTimeMillis() >= timeoutExpiredMs) {
fail("Could not start test slave");
}
}
slave.setLabelString("ubuntu gcc python-2.4 linux");
}
示例4: testRegisterJobs_ProjectSingleLabel
import hudson.model.labels.LabelAtom; //导入依赖的package包/类
@Test
public void testRegisterJobs_ProjectSingleLabel() throws Exception {
Project<?, ?> lemon = createFreeStyleProject("lemon");
lemon.setAssignedLabel(new LabelAtom("linux"));
AbstractWorkerThread oneiric = new ExecutorWorkerThread("GearmanServer", 4730, "MyWorker", slave.toComputer(), "master", new NoopAvailabilityMonitor());
oneiric.testInitWorker();
oneiric.registerJobs();
Set<String> functions = oneiric.worker.getRegisteredFunctions();
assertEquals(2, functions.size());
assertTrue(functions.contains("build:lemon"));
assertTrue(functions.contains("build:lemon:linux"));
}
示例5: testRegisterJobs_ProjectNoLabel_Exclusive
import hudson.model.labels.LabelAtom; //导入依赖的package包/类
@Test
public void testRegisterJobs_ProjectNoLabel_Exclusive() throws Exception {
Project<?, ?> lemon = createFreeStyleProject("lemon");
DumbSlave exclusive_slave = createOnlineSlave(new LabelAtom("foo"));
exclusive_slave.setMode(Mode.EXCLUSIVE);
AbstractWorkerThread oneiric = new ExecutorWorkerThread(
"GearmanServer",
4730,
"MyWorker",
exclusive_slave.toComputer(),
"master",
new NoopAvailabilityMonitor());
oneiric.testInitWorker();
oneiric.registerJobs();
Set<String> functions = oneiric.worker.getRegisteredFunctions();
assertEquals(0, functions.size());
}
示例6: testRegisterJobs_SlaveOffline
import hudson.model.labels.LabelAtom; //导入依赖的package包/类
@Test
public void testRegisterJobs_SlaveOffline() throws Exception {
DumbSlave offlineSlave = createSlave(new LabelAtom("oneiric-10"));
offlineSlave.setLabelString("ubuntu gcc python-2.4 linux");
Project<?, ?> lemon = createFreeStyleProject("lemon");
lemon.setAssignedLabel(new LabelAtom("linux"));
AbstractWorkerThread oneiric = new ExecutorWorkerThread("GearmanServer", 4730, "MyWorker", offlineSlave.toComputer(), "master", new NoopAvailabilityMonitor());
oneiric.testInitWorker();
oneiric.registerJobs();
Set<String> functions = oneiric.worker.getRegisteredFunctions();
assertEquals(0, functions.size());
}
示例7: testRegisterJobs_MavenProject
import hudson.model.labels.LabelAtom; //导入依赖的package包/类
@Test
public void testRegisterJobs_MavenProject() throws Exception {
MavenModuleSet lemon = createMavenProject("lemon");
lemon.setAssignedLabel(new LabelAtom("linux"));
AbstractWorkerThread oneiric = new ExecutorWorkerThread("GearmanServer", 4730, "MyWorker", slave.toComputer(), "master", new NoopAvailabilityMonitor());
oneiric.testInitWorker();
oneiric.registerJobs();
Set<String> functions = oneiric.worker.getRegisteredFunctions();
assertEquals(2, functions.size());
assertTrue(functions.contains("build:lemon"));
assertTrue(functions.contains("build:lemon:linux"));
}
示例8: setup
import hudson.model.labels.LabelAtom; //导入依赖的package包/类
@Before
public void setup() {
Set<LabelAtom> labels = Collections.singleton(label);
Mockito.when(label.matches(Mockito.anyCollectionOf(LabelAtom.class))).thenReturn(true);
Mockito.when(slaveTemplate.createSlaveName()).thenReturn("slave-1", "slave-2", "slave-3");
Mockito.when(slaveTemplate.getNumExecutors()).thenReturn(1);
Mockito.when(slaveTemplate.getLabelSet()).thenReturn(labels);
}
示例9: testLabelAtom
import hudson.model.labels.LabelAtom; //导入依赖的package包/类
public void testLabelAtom() throws Exception{
setUpCloud(LABEL1 + " " + LABEL2);
assertEquals(true, ac.canProvision(new LabelAtom(LABEL1)));
assertEquals(true, ac.canProvision(new LabelAtom(LABEL2)));
assertEquals(false, ac.canProvision(new LabelAtom("aaa")));
assertEquals(true, ac.canProvision(null));
}
示例10: testExclusiveMode
import hudson.model.labels.LabelAtom; //导入依赖的package包/类
public void testExclusiveMode() throws Exception{
setUpCloud(LABEL1 + " " + LABEL2, Node.Mode.EXCLUSIVE);
assertEquals(true, ac.canProvision(new LabelAtom(LABEL1)));
assertEquals(true, ac.canProvision(new LabelAtom(LABEL2)));
assertEquals(false, ac.canProvision(new LabelAtom("aaa")));
assertEquals(false, ac.canProvision(null));
}
示例11: getLabelsMap
import hudson.model.labels.LabelAtom; //导入依赖的package包/类
Map<String, String> getLabelsMap(Set<LabelAtom> labelSet) {
ImmutableMap.Builder<String, String> builder = ImmutableMap.<String, String> builder();
builder.putAll(getLabels());
if (!labelSet.isEmpty()) {
for (LabelAtom label: labelSet) {
builder.put(getIdForLabel(label), "true");
}
}
return builder.build();
}
示例12: getLabels
import hudson.model.labels.LabelAtom; //导入依赖的package包/类
public Set<LabelAtom> getLabels() {
if (_labels == null) {
// Do not do this in readResolve as it can result in a recursive dependency load that
// makes jenkins startup slow and unstable.
_labels = Label.parse(this.labelString);
}
return _labels;
}
示例13: DockerJobSlave
import hudson.model.labels.LabelAtom; //导入依赖的package包/类
public DockerJobSlave(@Nonnull String nodeName, String nodeDescription, String jobName, String remoteFS, Set<LabelAtom> labels, DockerJobComputerLauncher launcher) throws Descriptor.FormException, IOException {
super(nodeName,
nodeDescription,
remoteFS,
1,
Mode.NORMAL,
LABEL_JOINER.join(labels),
launcher,
new DockerJobRetentionStrategy(),
ImmutableList.<NodeProperty<?>>of());
this.jobName = jobName;
}
示例14: getLabelCloud
import hudson.model.labels.LabelAtom; //导入依赖的package包/类
@Override
public TagCloud<LabelAtom> getLabelCloud() {
initPython();
if (pexec.isImplemented(3)) {
return (TagCloud) pexec.execPython("get_label_cloud");
} else {
return super.getLabelCloud();
}
}
示例15: getAssignedLabels
import hudson.model.labels.LabelAtom; //导入依赖的package包/类
@Override
@Exported
public Set<LabelAtom> getAssignedLabels() {
initPython();
if (pexec.isImplemented(4)) {
return (Set) pexec.execPython("get_assigned_labels");
} else {
return super.getAssignedLabels();
}
}