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

Examples of com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger$DescriptorImpl


    public void testTriggeredSilentStartModeBuild() throws Exception {
        GerritServer gerritServer = PluginImpl.getInstance().getServer(PluginImpl.DEFAULT_SERVER_NAME);
        ((Config)gerritServer.getConfig()).setDynamicConfigRefreshInterval(1);
        FreeStyleProject project = DuplicatesUtil.createGerritDynamicTriggeredJob(j, "projectX");

        GerritTrigger trigger = project.getTrigger(GerritTrigger.class);
        trigger.setSilentStartMode(true);

        server.waitForCommand(GERRIT_STREAM_EVENTS, 2000);
        waitForDynamicTimer(project, 5000);
        gerritServer.triggerEvent(Setup.createPatchsetCreated());
        TestUtils.waitForBuilds(project, 1, 5000);
View Full Code Here


    public void testTriggeredNoSilentStartModeBuild() throws Exception {
        GerritServer gerritServer = PluginImpl.getInstance().getServer(PluginImpl.DEFAULT_SERVER_NAME);
        ((Config)gerritServer.getConfig()).setDynamicConfigRefreshInterval(1);
        FreeStyleProject project = DuplicatesUtil.createGerritDynamicTriggeredJob(j, "projectX");

        GerritTrigger trigger = project.getTrigger(GerritTrigger.class);
        trigger.setSilentStartMode(false);

        server.waitForCommand(GERRIT_STREAM_EVENTS, 2000);
        waitForDynamicTimer(project, 5000);
        gerritServer.triggerEvent(Setup.createPatchsetCreated());
        TestUtils.waitForBuilds(project, 1, 5000);
View Full Code Here

     * @param timeoutMs th amount of milliseconds to wait.
     */
    private void waitForDynamicTimer(FreeStyleProject project, int timeoutMs) {
        long startTime = System.currentTimeMillis();
        while (System.currentTimeMillis() - startTime <= timeoutMs) {
            GerritTrigger trigger = project.getTrigger(GerritTrigger.class);
            List<GerritProject> dynamicGerritProjects = trigger.getDynamicGerritProjects();
            if (dynamicGerritProjects != null && !dynamicGerritProjects.isEmpty()) {
                return;
            }
        }
        throw new RuntimeException("Timeout!");
View Full Code Here

     */
    @LocalData
    public void testDynamicTriggerLoading() {
        FreeStyleProject project = (FreeStyleProject)jenkins.getItem("DynamicTrigger");
        assertNotNull(project);
        GerritTrigger trigger = GerritTrigger.getTrigger(project);
        assertNotNull(trigger);
        assertTrue(trigger.isDynamicTriggerConfiguration());
        assertEquals("file://tmp/some.txt", trigger.getTriggerConfigURL());
    }
View Full Code Here

    public void testFreeStyleJob() {
        TopLevelItem freestyleJobItem = Hudson.getInstance().getItem("freestyleJob");
        assertThat(freestyleJobItem, instanceOf(AbstractProject.class));
        AbstractProject freestyleJob = (AbstractProject)freestyleJobItem;
        assertNotNull(freestyleJob);
        GerritTrigger trigger = GerritTrigger.getTrigger(freestyleJob);
        assertNotNull(trigger);
        List<GerritProject> gerritProjects = trigger.getGerritProjects();
        assertNotNull(gerritProjects);
        assertThat(gerritProjects.size(), equalTo(1));
        GerritProject gerritProject = gerritProjects.get(0);
        assertThat(gerritProject.getPattern(), equalTo("project"));
        List<Branch> branches = gerritProject.getBranches();
        assertThat(branches.size(), equalTo(1));
        Branch branch = branches.get(0);
        assertThat(branch.getPattern(), equalTo("bra.*"));
        List<PluginGerritEvent> triggerOnEvents = trigger.getTriggerOnEvents();
        assertThat(triggerOnEvents.size(), equalTo(2));
        assertEquals(triggerOnEvents.get(0).getCorrespondingEventClass(), PatchsetCreated.class);
        assertEquals(triggerOnEvents.get(1).getCorrespondingEventClass(), DraftPublished.class);
    }
View Full Code Here

    public void testMatrixJob() {
        TopLevelItem matrixJobItem = Hudson.getInstance().getItem("matrixJob");
        assertThat(matrixJobItem, instanceOf(AbstractProject.class));
        AbstractProject matrixJob = (AbstractProject)matrixJobItem;
        assertNotNull(matrixJob);
        GerritTrigger trigger = GerritTrigger.getTrigger(matrixJob);
        assertNotNull(trigger);
        List<GerritProject> gerritProjects = trigger.getGerritProjects();
        assertNotNull(gerritProjects);
        assertThat(gerritProjects.size(), equalTo(1));
        GerritProject gerritProject = gerritProjects.get(0);
        assertThat(gerritProject.getPattern(), equalTo("project"));
        List<Branch> branches = gerritProject.getBranches();
        assertThat(branches.size(), equalTo(1));
        Branch branch = branches.get(0);
        assertThat(branch.getPattern(), equalTo(".*er"));
        List<PluginGerritEvent> triggerOnEvents = trigger.getTriggerOnEvents();
        assertThat(triggerOnEvents.size(), equalTo(2));
        assertEquals(triggerOnEvents.get(0).getCorrespondingEventClass(), PatchsetCreated.class);
        assertEquals(triggerOnEvents.get(1).getCorrespondingEventClass(), DraftPublished.class);
    }
View Full Code Here

        PatchsetCreated event = Setup.createPatchsetCreated();
        BuildMemory instance = new BuildMemory();

        AbstractProject project = mock(AbstractProject.class);
        SkipVote skipVote = new SkipVote(false, false, false, false);
        GerritTrigger trigger = mock(GerritTrigger.class);
        when(trigger.getSkipVote()).thenReturn(skipVote);
        when(project.getTrigger(eq(GerritTrigger.class))).thenReturn(trigger);
        AbstractBuild build = mock(AbstractBuild.class);
        when(build.getProject()).thenReturn(project);
        when(build.getResult()).thenReturn(Result.UNSTABLE);
        instance.started(event, build);

        AbstractProject project2 = mock(AbstractProject.class);
        skipVote = new SkipVote(false, false, false, false);
        trigger = mock(GerritTrigger.class);
        when(trigger.getSkipVote()).thenReturn(skipVote);
        when(project2.getTrigger(eq(GerritTrigger.class))).thenReturn(trigger);
        AbstractBuild build2 = mock(AbstractBuild.class);
        when(build2.getProject()).thenReturn(project2);
        when(build2.getResult()).thenReturn(Result.UNSTABLE);
        instance.started(event, build2);

        AbstractProject project3 = mock(AbstractProject.class);
        skipVote = new SkipVote(true, false, false, false);
        trigger = mock(GerritTrigger.class);
        when(trigger.getSkipVote()).thenReturn(skipVote);
        when(project3.getTrigger(eq(GerritTrigger.class))).thenReturn(trigger);
        AbstractBuild build3 = mock(AbstractBuild.class);
        when(build3.getProject()).thenReturn(project3);
        when(build3.getResult()).thenReturn(Result.SUCCESS);
        instance.started(event, build3);
View Full Code Here

        PatchsetCreated event = Setup.createPatchsetCreated();
        BuildMemory instance = new BuildMemory();

        AbstractProject project = mock(AbstractProject.class);
        SkipVote skipVote = new SkipVote(true, false, false, false);
        GerritTrigger trigger = mock(GerritTrigger.class);
        when(trigger.getSkipVote()).thenReturn(skipVote);
        when(project.getTrigger(eq(GerritTrigger.class))).thenReturn(trigger);
        AbstractBuild build = mock(AbstractBuild.class);
        when(build.getProject()).thenReturn(project);
        when(build.getResult()).thenReturn(Result.SUCCESS);
        instance.started(event, build);

        AbstractProject project2 = mock(AbstractProject.class);
        skipVote = new SkipVote(false, false, false, false);
        trigger = mock(GerritTrigger.class);
        when(trigger.getSkipVote()).thenReturn(skipVote);
        when(project2.getTrigger(eq(GerritTrigger.class))).thenReturn(trigger);
        AbstractBuild build2 = mock(AbstractBuild.class);
        when(build2.getProject()).thenReturn(project2);
        when(build2.getResult()).thenReturn(Result.UNSTABLE);
        instance.started(event, build2);

        AbstractProject project3 = mock(AbstractProject.class);
        skipVote = new SkipVote(false, false, false, false);
        trigger = mock(GerritTrigger.class);
        when(trigger.getSkipVote()).thenReturn(skipVote);
        when(project3.getTrigger(eq(GerritTrigger.class))).thenReturn(trigger);
        AbstractBuild build3 = mock(AbstractBuild.class);
        when(build3.getProject()).thenReturn(project3);
        when(build3.getResult()).thenReturn(Result.SUCCESS);
        instance.started(event, build3);
View Full Code Here

        PatchsetCreated event = Setup.createPatchsetCreated();
        BuildMemory instance = new BuildMemory();

        AbstractProject project = mock(AbstractProject.class);
        SkipVote skipVote = new SkipVote(true, false, false, false);
        GerritTrigger trigger = mock(GerritTrigger.class);
        when(trigger.getSkipVote()).thenReturn(skipVote);
        when(project.getTrigger(eq(GerritTrigger.class))).thenReturn(trigger);
        AbstractBuild build = mock(AbstractBuild.class);
        when(build.getProject()).thenReturn(project);
        when(build.getResult()).thenReturn(Result.SUCCESS);
        instance.started(event, build);
View Full Code Here

        PatchsetCreated event = Setup.createPatchsetCreated();
        BuildMemory instance = new BuildMemory();

        AbstractProject project = mock(AbstractProject.class);
        SkipVote skipVote = new SkipVote(false, false, true, false);
        GerritTrigger trigger = mock(GerritTrigger.class);
        when(trigger.getSkipVote()).thenReturn(skipVote);
        when(project.getTrigger(eq(GerritTrigger.class))).thenReturn(trigger);
        AbstractBuild build = mock(AbstractBuild.class);
        when(build.getProject()).thenReturn(project);
        when(build.getResult()).thenReturn(Result.UNSTABLE);
        instance.started(event, build);
View Full Code Here

TOP

Related Classes of com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger$DescriptorImpl

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.