TestUtils.resetRedis(config);
}
@Test
public void testAdminAndWorkerPool() {
final WorkerPool workerPool = new WorkerPool(new Callable<WorkerImpl>() {
public WorkerImpl call() {
return new WorkerImpl(config, set(testQueue),
new MapBasedJobFactory(map(entry("TestAction", TestAction.class))));
}
}, 2);
final Admin admin = new AdminImpl(config);
admin.setWorker(workerPool);
workerPool.run();
final Thread adminThread = new Thread(admin);
adminThread.start();
Assert.assertFalse(workerPool.isPaused());
try {
// TODO: Do client stuff here
} finally {
TestUtils.stopWorker(admin, adminThread);
try {
workerPool.endAndJoin(false, 1000);
} catch (Exception e) {
log.warn("Exception while waiting for workerThread to join", e);
}
}
}