@@ -0,0 +1,2514 @@
+package hudson.model.label;%0A%0Aimport hudson.Launcher;%0Aimport hudson.model.AbstractBuild;%0Aimport hudson.model.BuildListener;%0Aimport hudson.model.FreeStyleBuild;%0Aimport hudson.model.FreeStyleProject;%0Aimport hudson.slaves.DumbSlave;%0Aimport org.jvnet.hudson.test.HudsonTestCase;%0Aimport org.jvnet.hudson.test.SequenceLock;%0Aimport org.jvnet.hudson.test.TestBuilder;%0A%0Aimport java.io.IOException;%0Aimport java.util.concurrent.Future;%0A%0A/**%0A * @author Kohsuke Kawaguchi%0A */%0Apublic class LabelExpressionTest extends HudsonTestCase %7B%0A    /**%0A     * Verifies the queueing behavior in the presence of the expression.%0A     */%0A    public void testQueueBehavior() throws Exception %7B%0A        DumbSlave w32 = createSlave(hudson.getLabel(%22win 32bit%22));%0A        DumbSlave w64 = createSlave(hudson.getLabel(%22win 64bit%22));%0A        DumbSlave l32 = createSlave(hudson.getLabel(%22linux 32bit%22));%0A%0A        final SequenceLock seq = new SequenceLock();%0A%0A        FreeStyleProject p1 = createFreeStyleProject();%0A        p1.getBuildersList().add(new TestBuilder() %7B%0A            public boolean perform(AbstractBuild%3C?, ?%3E build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException %7B%0A                seq.phase(0); // first, make sure the w32 slave is occupied%0A                seq.phase(2);%0A                seq.done();%0A                return true;%0A            %7D%0A        %7D);%0A        p1.setAssignedLabel(hudson.getLabel(%22win&&32bit%22));%0A%0A        FreeStyleProject p2 = createFreeStyleProject();%0A        p2.setAssignedLabel(hudson.getLabel(%22win&&32bit%22));%0A%0A        FreeStyleProject p3 = createFreeStyleProject();%0A        p3.setAssignedLabel(hudson.getLabel(%22win%22));%0A%0A        Future%3CFreeStyleBuild%3E f1 = p1.scheduleBuild2(0);%0A%0A        seq.phase(1); // we schedule p2 build after w32 slave is occupied%0A        Future%3CFreeStyleBuild%3E f2 = p2.scheduleBuild2(0);%0A%0A        Thread.sleep(1000); // time window to ensure queue has tried to assign f2 build%0A%0A        // p3 is tied to 'win', so even though p1 is busy, this should still go ahead and complete%0A        FreeStyleBuild b3 = assertBuildStatusSuccess(p3.scheduleBuild2(0));%0A        assertSame(w64,b3.getBuiltOn());%0A%0A        seq.phase(3);   // once we confirm that p3 build is over, we let p1 proceed%0A%0A        // p1 should have been built on w32%0A        FreeStyleBuild b1 = assertBuildStatusSuccess(f1);%0A        assertSame(w32,b1.getBuiltOn());%0A%0A        // and so is p2%0A        FreeStyleBuild b2 = assertBuildStatusSuccess(f2);%0A        assertSame(w32,b2.getBuiltOn());%0A    %7D%0A%7D%0A

added a test case for a boolean expression over queue.