Package hudson.model

Examples of hudson.model.CauseAction


   
    @Override
    public String evaluate(AbstractBuild<?, ?> build, TaskListener listener, String macroName)
            throws MacroEvaluationException, IOException, InterruptedException {
        List<Cause> causes = new LinkedList<Cause>();
        CauseAction causeAction = build.getAction(CauseAction.class);
        if (causeAction != null) {
            causes = causeAction.getCauses();
        }

        return formatCauses(causes);
    }
View Full Code Here


    }

    @Test
    public void shouldReturnNA_whenThereIsNoCause()
        throws Exception {
        CauseAction causeAction = mock(CauseAction.class);
        when(build.getAction(CauseAction.class)).thenReturn(causeAction);

        assertEquals("N/A", causeContent.evaluate(build, listener, CauseContent.MACRO_NAME));
    }
View Full Code Here

    }

    @Test
    public void shouldReturnSingleCause()
        throws Exception {
        CauseAction causeAction = new CauseAction(new CauseStub("Cause1"));
        when(build.getAction(CauseAction.class)).thenReturn(causeAction);

        assertEquals("Cause1", causeContent.evaluate(build, listener, CauseContent.MACRO_NAME));
    }
View Full Code Here

    }

    @Test
    public void shouldReturnMultipleCausesSeperatedByCommas()
        throws Exception {
        CauseAction causeAction = mock(CauseAction.class);
        when(causeAction.getCauses()).thenReturn(new LinkedList<Cause>() {{
            add(new CauseStub("Cause1"));
            add(new CauseStub("Cause2"));
            add(new CauseStub("Cause3"));
        }});
        when(build.getAction(CauseAction.class)).thenReturn(causeAction);
View Full Code Here

     *
     * @param parameters
     *      Can be null.
     */
    public boolean scheduleBuild(ParametersAction parameters, Cause c) {
        return Jenkins.getInstance().getQueue().schedule(this, getQuietPeriod(), parameters, new CauseAction(c))!=null;
    }
View Full Code Here

    @Override
    protected DynamicSubBuild newBuild() throws IOException {
        List<Action> actions = Executor.currentExecutor().getCurrentWorkUnit().context.actions;
        DynamicBuild parentBuild = getParent().getLastBuild();
        CauseAction causeAction = null;
        for (Action a : actions) {
            if (a instanceof ParentBuildAction) {
                parentBuild = ((ParentBuildAction) a).getParent();
            }
            if (a instanceof CauseAction) {
View Full Code Here

        List<Action> allActions = new ArrayList<Action>();
        if (actions != null) {
            allActions.addAll(actions);
        }

        allActions.add(new CauseAction(c));

        return Jenkins.getInstance().getQueue().schedule(this, getQuietPeriod(), allActions) != null;
    }
View Full Code Here

            throw new AbortException("No parameterized job named " + job + " found");
        }
        node.addAction(new LabelAction(Messages.BuildTriggerStepExecution_building_(project.getFullDisplayName())));
        List<Action> actions = new ArrayList<Action>();
        actions.add(new BuildTriggerAction(getContext()));
        actions.add(new CauseAction(new Cause.UpstreamCause(invokingRun)));
        List<ParameterValue> parameters = step.getParameters();
        if (parameters != null) {
            actions.add(new ParametersAction(parameters));
        }
        new ParameterizedJobMixIn() {
View Full Code Here

     *
     * @param parameters
     *      Can be null.
     */
    public boolean scheduleBuild(ParametersAction parameters, Cause c) {
        return Hudson.getInstance().getQueue().schedule(this, getQuietPeriod(), parameters, new CauseAction(c))!=null;
    }
View Full Code Here

     * @param slaves The slaves
     * @return the queue item
     */
    private Item createItem(GerritCause gerritCause, String[] slaves) {
        List<Action> actions = new ArrayList<Action>();
        actions.add(new CauseAction(gerritCause));

        abstractProjectMock = mock(AbstractProject.class);
        when(abstractProjectMock.getTrigger(GerritTrigger.class)).thenReturn(gerritTriggerMock);
        if (slaves != null && slaves.length > 0) {
            List<GerritSlave> gerritSlaves = new ArrayList<GerritSlave>();
View Full Code Here

TOP

Related Classes of hudson.model.CauseAction

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.