Search in sources :

Example 1 with DumbSlave

use of hudson.slaves.DumbSlave in project hudson-2.x by hudson.

the class HudsonTestCase method createOnlineSlave.

/**
     * Create a new slave on the local host and wait for it to come online
     * before returning
     */
public DumbSlave createOnlineSlave(Label l, EnvVars env) throws Exception {
    final CountDownLatch latch = new CountDownLatch(1);
    ComputerListener waiter = new ComputerListener() {

        @Override
        public void onOnline(Computer C, TaskListener t) {
            latch.countDown();
            unregister();
        }
    };
    waiter.register();
    DumbSlave s = createSlave(l, env);
    latch.await();
    return s;
}
Also used : ComputerListener(hudson.slaves.ComputerListener) StreamTaskListener(hudson.util.StreamTaskListener) CountDownLatch(java.util.concurrent.CountDownLatch) DumbSlave(hudson.slaves.DumbSlave)

Example 2 with DumbSlave

use of hudson.slaves.DumbSlave in project hudson-2.x by hudson.

the class HudsonTestCase method createSlave.

/**
     * Creates a slave with certain additional environment variables
     */
public DumbSlave createSlave(String labels, EnvVars env) throws Exception {
    synchronized (hudson) {
        // this synchronization block is so that we don't end up adding the same slave name more than once.
        int sz = hudson.getNodes().size();
        DumbSlave slave = new DumbSlave("slave" + sz, "dummy", createTmpDir().getPath(), "1", Mode.NORMAL, labels == null ? "" : labels, createComputerLauncher(env), RetentionStrategy.NOOP, Collections.EMPTY_LIST);
        hudson.addNode(slave);
        return slave;
    }
}
Also used : DumbSlave(hudson.slaves.DumbSlave)

Aggregations

DumbSlave (hudson.slaves.DumbSlave)2 ComputerListener (hudson.slaves.ComputerListener)1 StreamTaskListener (hudson.util.StreamTaskListener)1 CountDownLatch (java.util.concurrent.CountDownLatch)1