Examples of TriggerContext


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

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

        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

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

        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

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

     */
    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

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

     * @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

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

     */
    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

Examples of org.springframework.scheduling.TriggerContext

  public void testSpecificDayOfMonthSecond() throws Exception {
    CronTrigger trigger = new CronTrigger("55 * * 3 * *", timeZone);
    calendar.set(Calendar.DAY_OF_MONTH, 2);
    calendar.set(Calendar.SECOND, 54);
    Date date = calendar.getTime();
    TriggerContext context1 = getTriggerContext(date);
    calendar.add(Calendar.DAY_OF_MONTH, 1);
    calendar.set(Calendar.HOUR_OF_DAY, 0);
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.SECOND, 55);
    assertEquals(calendar.getTime(), date = trigger.nextExecutionTime(context1));
    calendar.add(Calendar.MINUTE, 1);
    TriggerContext context2 = getTriggerContext(date);
    assertEquals(calendar.getTime(), date = trigger.nextExecutionTime(context2));
  }
View Full Code Here

Examples of org.springframework.scheduling.TriggerContext

  public void testSpecificDate() throws Exception {
    CronTrigger trigger = new CronTrigger("* * * 3 11 *", timeZone);
    calendar.set(Calendar.DAY_OF_MONTH, 2);
    calendar.set(Calendar.MONTH, 9);
    Date date = calendar.getTime();
    TriggerContext context1 = getTriggerContext(date);
    calendar.add(Calendar.DAY_OF_MONTH, 1);
    calendar.set(Calendar.HOUR_OF_DAY, 0);
    calendar.set(Calendar.MONTH, 10); // 10=November
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.SECOND, 0);
    assertEquals(calendar.getTime(), date = trigger.nextExecutionTime(context1));
    calendar.add(Calendar.SECOND, 1);
    TriggerContext context2 = getTriggerContext(date);
    assertEquals(calendar.getTime(), date = trigger.nextExecutionTime(context2));
  }
View Full Code Here

Examples of org.springframework.scheduling.TriggerContext

    // TODO: maybe try and detect this as a special case in parser?
    CronTrigger trigger = new CronTrigger("0 0 0 31 6 *", timeZone);
    calendar.set(Calendar.DAY_OF_MONTH, 10);
    calendar.set(Calendar.MONTH, 2);
    Date date = calendar.getTime();
    TriggerContext context1 = getTriggerContext(date);
    trigger.nextExecutionTime(context1);
    // new CronTrigger("0 0 0 30 1 ?", timeZone);
  }
View Full Code Here

Examples of org.springframework.scheduling.TriggerContext

    CronTrigger trigger = new CronTrigger("0 0 0 29 2 *", timeZone);
    calendar.set(Calendar.YEAR, 2007);
    calendar.set(Calendar.DAY_OF_MONTH, 10);
    calendar.set(Calendar.MONTH, 1); // 2=February
    Date date = calendar.getTime();
    TriggerContext context1 = getTriggerContext(date);
    calendar.set(Calendar.YEAR, 2008);
    calendar.set(Calendar.DAY_OF_MONTH, 29);
    calendar.set(Calendar.HOUR_OF_DAY, 0);
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.SECOND, 0);
    assertEquals(calendar.getTime(), date = trigger.nextExecutionTime(context1));
    calendar.add(Calendar.YEAR, 4);
    TriggerContext context2 = getTriggerContext(date);
    assertEquals(calendar.getTime(), date = trigger.nextExecutionTime(context2));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.