提交 52b9e14a 编写于 作者: K Kohsuke Kawaguchi

Merge branch 'rc'

......@@ -296,6 +296,9 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
AbstractProject.WORKSPACE.toString();
User.clear();
// just in case tearDown failed in the middle, make sure to really clean them up so that there's no left-over from earlier tests
ExtensionList.clearLegacyInstances();
DescriptorExtensionList.clearLegacyInstances();
try {
jenkins = hudson = newHudson();
......
......@@ -4,23 +4,12 @@ import hudson.model.FreeStyleProject;
import hudson.model.Queue.Item;
import org.jvnet.hudson.test.HudsonTestCase;
import org.jvnet.hudson.test.TestExtension;
public class QueueTaskDispatcherTest extends HudsonTestCase {
@SuppressWarnings("deprecation")
public void testCanRunBlockageIsDisplayed() throws Exception {
QueueTaskDispatcher.all().add(new QueueTaskDispatcher() {
@Override
public CauseOfBlockage canRun(Item item) {
return new CauseOfBlockage() {
@Override
public String getShortDescription() {
return "blocked by canRun";
}
};
}
});
FreeStyleProject project = createFreeStyleProject();
jenkins.getQueue().schedule(project);
......@@ -32,4 +21,17 @@ public class QueueTaskDispatcherTest extends HudsonTestCase {
assertTrue("Not blocked after 60 seconds", item.isBlocked());
assertEquals("Expected CauseOfBlockage to be returned", "blocked by canRun", item.getWhy());
}
@TestExtension
public static class MyQueueTaskDispatcher extends QueueTaskDispatcher {
@Override
public CauseOfBlockage canRun(Item item) {
return new CauseOfBlockage() {
@Override
public String getShortDescription() {
return "blocked by canRun";
}
};
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册