Examples of GerritCause


Examples of com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritCause

        annotateAndVerify(b,
            "test\ntest\nChange-Id: I1234567890123456789012345678901234567890",
            "test\ntest\nChange-Id: I1234567890123456789012345678901234567890");

        PatchsetCreated patchsetCreated = Setup.createPatchsetCreated();
        GerritCause gerritCause = new GerritCause();
        gerritCause.setEvent(patchsetCreated);
        when(b.getCause(GerritCause.class)).thenReturn(gerritCause);
        annotateAndVerify(b,
                          "test\ntest\nChange-Id: <a href='http://gerrit/r/I1234567890123456789012345678901234567890'>"
                                + "I1234567890123456789012345678901234567890</a>",
                          "test\ntest\nChange-Id: I1234567890123456789012345678901234567890");
View Full Code Here

Examples of com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritCause

     * Not sure this is a valid use case under normal use but GerritCause have
     * an empty constructor that do not value to GerritEvent so, let's test it.
     */
    @Test
    public void shouldNotBlockItemWithGerritCauseWithoutGerritEvent() {
        assertNull("Build should not be blocked", dispatcher.canRun(createItem(new GerritCause(), null)));
    }
View Full Code Here

Examples of com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritCause

     * @param gerritEvent The gerritEvent
     * @param dependency The dependency project list in a comma-separated string to add to the queue item.
     * @return the queue item
     */
    private Queue.Item createItem(GerritTriggeredEvent gerritEvent, String dependency) {
        GerritCause gerritCause;
        if (gerritEvent instanceof ManualPatchsetCreated) {
            gerritCause = new GerritManualCause();
        } else {
            gerritCause = new GerritCause();
        }
        gerritCause.setEvent(gerritEvent);
        return createItem(gerritCause, dependency);
    }
View Full Code Here

Examples of com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritCause

        assertTrue(obj instanceof MatrixRun);
        MatrixRun run = (MatrixRun)obj;

        Cause.UpstreamCause upCause = run.getCause(Cause.UpstreamCause.class);
        List upstreamCauses = Whitebox.getInternalState(upCause, "upstreamCauses");
        GerritCause cause = (GerritCause)upstreamCauses.get(0);
        assertNotNull(cause.getEvent());
        assertThat("Event is not a ChangeBasedEvent", cause.getEvent(), instanceOf(ChangeBasedEvent.class));
        ChangeBasedEvent changeBasedEvent = (ChangeBasedEvent)cause.getEvent();
        assertEquals("platform/project", changeBasedEvent.getChange().getProject());
        assertNotNull(cause.getContext());
        assertNotNull(cause.getContext().getThisBuild());

        assertEquals("Gerrit_master-theme_matrix", cause.getContext().getThisBuild().getProjectId());
        assertEquals(102, cause.getContext().getThisBuild().getBuildNumber().intValue());

        assertNotNull(cause.getContext().getOthers());
        assertEquals(1, cause.getContext().getOthers().size());

        TriggeredItemEntity entity = cause.getContext().getOthers().get(0);
        assertEquals("master-theme", entity.getProjectId());
        assertNull(entity.getBuildNumber());
    }
View Full Code Here

Examples of com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritCause

     * Not sure this is a valid use case under normal use but GerritCause have
     * an empty constructor that do not value to GerritEvent so, let's test it.
     */
    @Test
    public void shouldNotBlockItemWithGerritCauseWithoutGerritEvent() {
        assertNull("Build should not be blocked", dispatcher.canRun(createItemWithOneSlave(new GerritCause())));
    }
View Full Code Here

Examples of com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritCause

     * @param gerritEvent The gerritEvent
     * @param slaves The slaves
     * @return the queue item
     */
    private Item createItem(GerritTriggeredEvent gerritEvent, String[] slaves) {
        GerritCause gerritCause;
        if (gerritEvent instanceof ManualPatchsetCreated) {
            gerritCause = new GerritManualCause();
        } else {
            gerritCause = new GerritCause();
        }
        gerritCause.setEvent(gerritEvent);
        return createItem(gerritCause, slaves);
    }
View Full Code Here

Examples of com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritCause

     * @param filepath The filepath glob string
     * @return ToGerritRunListener mock (spy)
     */
    public static ToGerritRunListener createFailureMessageRunListener(final AbstractBuild build,
            final PatchsetCreated event, final String filepath) {
        GerritCause cause = new GerritCause(event, false);
        when(build.getCause(GerritCause.class)).thenReturn(cause);
        CauseAction causeAction = mock(CauseAction.class);
        when(causeAction.getCauses()).thenReturn(Collections.<Cause>singletonList(cause));
        when(build.getAction(CauseAction.class)).thenReturn(causeAction);
        when(build.getResult()).thenReturn(Result.FAILURE);
View Full Code Here

Examples of com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritCause

    @Test
    public void testOnCompleted() throws Exception {
        AbstractBuild build = mockBuild("projectX", 2);
        ManualPatchsetCreated event = Setup.createManualPatchsetCreated();
        event = spy(event);
        GerritCause cause = new GerritCause(event, false);
        when(build.getCause(GerritCause.class)).thenReturn(cause);
        CauseAction causeAction = mock(CauseAction.class);
        when(causeAction.getCauses()).thenReturn(Collections.<Cause>singletonList(cause));
        when(build.getAction(CauseAction.class)).thenReturn(causeAction);
        when(build.getResult()).thenReturn(Result.SUCCESS);
View Full Code Here

Examples of com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritCause

    @Test
    public void testOnCompletedSilentMode() throws Exception {
        AbstractBuild build = mockBuild("projectX", 2);
        ManualPatchsetCreated event = Setup.createManualPatchsetCreated();
        event = spy(event);
        GerritCause cause = new GerritCause(event, true);
        when(build.getCause(GerritCause.class)).thenReturn(cause);
        CauseAction causeAction = mock(CauseAction.class);
        when(causeAction.getCauses()).thenReturn(Collections.<Cause>singletonList(cause));
        when(build.getAction(CauseAction.class)).thenReturn(causeAction);
        when(build.getResult()).thenReturn(Result.SUCCESS);
View Full Code Here

Examples of com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritCause

    @Test
    public void testOnStarted() throws Exception {
        AbstractBuild build = mockBuild("projectX", 2);
        ManualPatchsetCreated event = Setup.createManualPatchsetCreated();
        event = spy(event);
        GerritCause cause = new GerritCause(event, false);
        when(build.getCause(GerritCause.class)).thenReturn(cause);
        CauseAction causeAction = mock(CauseAction.class);
        when(causeAction.getCauses()).thenReturn(Collections.<Cause>singletonList(cause));
        when(build.getAction(CauseAction.class)).thenReturn(causeAction);
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.