/** * 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; }
/** * 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; }
/** * 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; }
/** * Create a new slave on the local host and wait for it to come online * before returning */ @SuppressWarnings("deprecation") 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; }
@SuppressWarnings("deprecation") public Slave createSlave(JenkinsRule r) throws Exception { DumbSlave slave = new DumbSlave("slave" + r.jenkins.getNodes().size(), "dummy", "/home/test/slave", "1", Node.Mode.NORMAL, "mercurial", new SSHLauncher(ipBound(22), port(22), "test", "test", "", ""), RetentionStrategy.INSTANCE, Collections.<NodeProperty<?>>emptyList()); r.jenkins.addNode(slave); // Copied from JenkinsRule: final CountDownLatch latch = new CountDownLatch(1); ComputerListener waiter = new ComputerListener() { @Override public void onOnline(Computer C, TaskListener t) { latch.countDown(); unregister(); } }; waiter.register(); latch.await(); return slave; }