Package com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data

Examples of com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.TriggerContext


        when(project.getTrigger(GerritTrigger.class)).thenReturn(trigger);
        trigger.setGerritProjects(Collections.EMPTY_LIST);
        trigger.setEscapeQuotes(false);
        trigger.setSilentMode(false);

        TriggerContext context = new TriggerContext(build, event, Collections.EMPTY_LIST);

        trigger.retriggerThisBuild(context);

        verify(listener).onRetriggered(same(project), same(event), anyListOf(AbstractBuild.class));
View Full Code Here


        GerritTrigger trigger = Setup.createDefaultTrigger(null);
        when(project.getTrigger(GerritTrigger.class)).thenReturn(trigger);
        trigger.setGerritProjects(Collections.EMPTY_LIST);

        TriggerContext context = new TriggerContext(build, event, Collections.EMPTY_LIST);

        trigger.retriggerThisBuild(context);

        verify(listener, never()).onRetriggered(isA(AbstractProject.class),
                isA(PatchsetCreated.class),
View Full Code Here

        AbstractBuild otherBuild = mock(AbstractBuild.class);
        when(otherBuild.getNumber()).thenReturn(1);
        when(otherBuild.getProject()).thenReturn(otherProject);

        TriggerContext context = new TriggerContext(event);
        context.setThisBuild(thisBuild);
        context.addOtherBuild(otherBuild);

        thisTrigger.retriggerAllBuilds(context);

        verify(listener).onRetriggered(thisProject, event, null);
View Full Code Here

     */
    public GerritCause(GerritTriggeredEvent event, boolean silentMode) {
        super("");
        this.tEvent = event;
        this.silentMode = silentMode;
        this.context = new TriggerContext(event);
        this.url = getUrlFromEvent();
    }
View Full Code Here

     * @param cause the cause.
     * @param r     the build the cause is in.
     */
    public synchronized void updateTriggerContext(GerritCause cause, AbstractBuild r) {
        MemoryImprint imprint = getMemoryImprint(cause.getEvent());
        TriggerContext context = cause.getContext();
        context.setThisBuild(r);
        for (MemoryImprint.Entry entry : imprint.getEntries()) {
            if (entry.getBuild() != null && !entry.getBuild().equals(r)) {
                context.addOtherBuild(entry.getBuild());
                updateTriggerContext(entry, imprint);
            } else if (entry.getBuild() == null && !entry.getProject().equals(r.getProject())) {
                context.addOtherProject(entry.getProject());
            }
        }
        if (!r.hasntStartedYet() && !r.isBuilding()) {
            try {
                r.save();
View Full Code Here

     */
    private synchronized void updateTriggerContext(Entry entryToUpdate, MemoryImprint imprint) {
        if (entryToUpdate.getBuild() != null) {
            GerritCause cause = (GerritCause)entryToUpdate.getBuild().getCause(GerritCause.class);
            if (cause != null) {
                TriggerContext context = cause.getContext();
                for (MemoryImprint.Entry ent : imprint.getEntries()) {
                    if (ent.getBuild() != null && !ent.getBuild().equals(entryToUpdate.getBuild())) {
                        context.addOtherBuild(ent.getBuild());
                    } else if (ent.getBuild() == null && !ent.getProject().equals(entryToUpdate.getProject())) {
                        context.addOtherProject(ent.getProject());
                    }
                }
                if (!entryToUpdate.getBuild().hasntStartedYet() && !entryToUpdate.getBuild().isBuilding()) {
                    try {
                        entryToUpdate.getBuild().save();
View Full Code Here

TOP

Related Classes of com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.TriggerContext

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.