Package hudson.model.queue

Examples of hudson.model.queue.CauseOfBlockage


            return CauseOfBlockage.fromMessage(Messages._Node_BecauseNodeIsReserved(getNodeName()));   // this node is reserved for tasks that are tied to it

        // Check each NodeProperty to see whether they object to this node
        // taking the task
        for (NodeProperty prop: getNodeProperties()) {
            CauseOfBlockage c = prop.canTake(task);
            if (c!=null)    return c;
        }

        // Looks like we can take the task
        return null;
View Full Code Here


        /**
         * Gets a human-readable status message describing why it's in the queue.
         */
        @Exported
        public final String getWhy() {
            CauseOfBlockage cob = getCauseOfBlockage();
            return cob!=null ? cob.getShortDescription() : null;
        }
View Full Code Here

    public boolean isBuildBlocked() {
        return getCauseOfBlockage()!=null;
    }

    public String getWhyBlocked() {
        CauseOfBlockage cb = getCauseOfBlockage();
        return cb!=null ? cb.getShortDescription() : null;
    }
View Full Code Here

     */
    @Test
    public void shouldNotBlockNonAbstractProjects() {
        List<Action> actions = new ArrayList<Action>();
        Queue.Item item = new WaitingItem(Calendar.getInstance(), null, actions);
        CauseOfBlockage cause = dispatcher.canRun(new Queue.BuildableItem((WaitingItem)item));
        assertNull("Build should not be blocked", cause);
    }
View Full Code Here

    public void shouldNotBlockBuildableItem() {
        PatchsetCreated patchsetCreated = Setup.createPatchsetCreated("someGerritServer", "someProject",
            "refs/changes/1/1/1");
        Queue.Item item = createItem(patchsetCreated, null);

        CauseOfBlockage cause = dispatcher.canRun(new Queue.BuildableItem((WaitingItem)item));
        assertNull("Build should not be blocked", cause);
    }
View Full Code Here

    public void shouldBlockTriggeringEvents() {
        PatchsetCreated patchsetCreated = Setup.createPatchsetCreated("someGerritServer", "someProject",
            "refs/changes/1/1/1");
        dispatcher.onTriggeringAll(patchsetCreated);
        Queue.Item item = createItem(patchsetCreated, "upstream");
        CauseOfBlockage cause = dispatcher.canRun(item);
        assertNotNull("Build should be blocked", cause);
        dispatcher.onDoneTriggeringAll(patchsetCreated);
        //Setting the dependency as "triggered but not built"
        doReturn(true).when(toGerritRunListenerMock).
            isProjectTriggeredAndIncomplete(abstractProjectDependencyMock, patchsetCreated);
View Full Code Here

            "refs/changes/1/1/1");
        Queue.Item item = createItem(patchsetCreated, "upstream");
        //Setting the dependency as "triggered and built"
        doReturn(false).when(toGerritRunListenerMock).
            isProjectTriggeredAndIncomplete(abstractProjectDependencyMock, patchsetCreated);
        CauseOfBlockage cause = dispatcher.canRun(item);
        assertNull("Build should not be blocked", cause);
    }
View Full Code Here

        //Event notification
        dispatcher.gerritEvent(manualPatchsetCreated);
        //Lifecycle handler should be notified of listening intent
        verify(manualPatchsetCreated, times(1)).addListener(dispatcher);
        Queue.Item item = createItem(manualPatchsetCreated, "upstream");
        CauseOfBlockage cause = dispatcher.canRun(item);
        assertNotNull("Build should be blocked", cause);
        dispatcher.triggerScanDone(manualPatchsetCreated);
        //Lifecycle handler should be notified of remove listener
        verify(manualPatchsetCreated, times(1)).removeListener(dispatcher);
        //Setting the dependency as "triggered but not built"
View Full Code Here

    public void shouldNotBlockBuildableItem() {
        PatchsetCreated patchsetCreated = Setup.createPatchsetCreated("someGerritServer", "someProject",
                "refs/changes/1/1/1");
        Item item = createItem(patchsetCreated, new String[] {"slaveA", "slaveB", "slaveC"});

        CauseOfBlockage cause = dispatcher.canRun(new Queue.BuildableItem((WaitingItem)item));
        assertNull("Build should not be blocked", cause);
    }
View Full Code Here

        PatchsetCreated patchsetCreated = Setup.createPatchsetCreated("someGerritServer", "someProject",
                "refs/changes/1/1/1");
        Item item = createItem(patchsetCreated, new String[] {"slaveA"});

        //item is blocked
        CauseOfBlockage cause = dispatcher.canRun(item);
        assertNotNull("The item should be blocked", cause);
        assertTrue("Should have returned a WaitingForReplication as CauseOfBlockage",
                cause instanceof WaitingForReplication);
        assertTrue(cause.getShortDescription().contains("slaveA"));

        //send an unrelated event (not RefReplicated)
        dispatcher.gerritEvent(new ChangeAbandoned());
        assertNotNull("the item should be blocked", dispatcher.canRun(item));
View Full Code Here

TOP

Related Classes of hudson.model.queue.CauseOfBlockage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.