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

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


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

        AbstractProject project = mock(AbstractProject.class);
        SkipVote skipVote = new SkipVote(true, 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);

        AbstractProject project2 = mock(AbstractProject.class);
        skipVote = new SkipVote(false, false, true, 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);
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(true, 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.SUCCESS);
        instance.started(event, build2);
View Full Code Here

            String projectName, String serverName) throws Exception {
        FreeStyleProject p = rule.createFreeStyleProject(projectName);
        List<GerritProject> projects = new LinkedList<GerritProject>();
        projects.add(new GerritProject(CompareType.ANT, "**",
                Collections.singletonList(new Branch(CompareType.ANT, "**")), null, null, null));
        p.addTrigger(new GerritTrigger(projects, null,
                null, null, null, null, null, null, null, null, null, null,
                false, false, true, false, false, null, null, null, null, null, null, null,
                null, serverName, null, null, false, false, null, null));
        rule.submit(rule.createWebClient().getPage(p, "configure").getFormByName("config"));
        return p;
View Full Code Here

        fw.write("b=branch");
        fw.close();
        List<PluginGerritEvent> list = new LinkedList<PluginGerritEvent>();
        URI uri = file.toURI();
        String filepath = uri.toURL().toString();
        GerritTrigger trigger = new GerritTrigger(projects, null,
                null, null, null, null, null, null, null, null, null, null, false, false,
                false, false, false, null, null, null, null, null, null, null, null,
                PluginImpl.DEFAULT_SERVER_NAME, null, list, true, false, filepath, null);
        p.addTrigger(trigger);
        rule.submit(rule.createWebClient().getPage(p, "configure").getFormByName("config"));
View Full Code Here

        projects.add(new GerritProject(CompareType.ANT, "**",
                Collections.singletonList(new Branch(CompareType.ANT, "**")), null, null, null));
        PluginCommentAddedEvent event = new PluginCommentAddedEvent("CRVW", "1");
        List<PluginGerritEvent> list = new LinkedList<PluginGerritEvent>();
        list.add(event);
        p.addTrigger(new GerritTrigger(projects, null,
                null, null, null, null, null, null, null, null, null, null,
                false, false, true, false, false, null, null, null, null, null, null, null,
                null, serverName, null, list, false, false, null, null));
        rule.submit(rule.createWebClient().getPage(p, "configure").getFormByName("config"));
        return p;
View Full Code Here

        //SUCCESS, FAILURE, ABORTED, UNSTABLE, other
        //not overridden, overridden

        //SUCCESS Not overridden
        GerritTrigger trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildSuccessfulCodeReviewValue()).thenReturn(null);
        when(trigger.getGerritBuildSuccessfulVerifiedValue()).thenReturn(null);
        list.add(new TestParameters[]{new TestParameters(config, Result.SUCCESS, trigger, 4, 3)});
        //SUCCESS overridden
        trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildSuccessfulCodeReviewValue()).thenReturn(21);
        when(trigger.getGerritBuildSuccessfulVerifiedValue()).thenReturn(22);
        list.add(new TestParameters[]{new TestParameters(config, Result.SUCCESS, trigger, 21, 22)});
        //FAILURE Not overridden
        trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildFailedCodeReviewValue()).thenReturn(null);
        when(trigger.getGerritBuildFailedVerifiedValue()).thenReturn(null);
        list.add(new TestParameters[]{new TestParameters(config, Result.FAILURE, trigger, -2, -1)});
        //FAILURE overridden
        trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildFailedCodeReviewValue()).thenReturn(31);
        when(trigger.getGerritBuildFailedVerifiedValue()).thenReturn(32);
        list.add(new TestParameters[]{new TestParameters(config, Result.FAILURE, trigger, 31, 32)});
        //ABORTED Not overridden
        trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildFailedCodeReviewValue()).thenReturn(null);
        when(trigger.getGerritBuildFailedVerifiedValue()).thenReturn(null);
        list.add(new TestParameters[]{new TestParameters(config, Result.ABORTED, trigger, -2, -1)});
        //ABORTED overridden
        trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildFailedCodeReviewValue()).thenReturn(41);
        when(trigger.getGerritBuildFailedVerifiedValue()).thenReturn(42);
        list.add(new TestParameters[]{new TestParameters(config, Result.ABORTED, trigger, 41, 42)});
        //UNSTABLE Not overridden
        trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildUnstableCodeReviewValue()).thenReturn(null);
        when(trigger.getGerritBuildUnstableVerifiedValue()).thenReturn(null);
        list.add(new TestParameters[]{new TestParameters(config, Result.UNSTABLE, trigger, -4, -3)});
        //UNSTABLE overridden
        trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildUnstableCodeReviewValue()).thenReturn(-21);
        when(trigger.getGerritBuildUnstableVerifiedValue()).thenReturn(-22);
        list.add(new TestParameters[]{new TestParameters(config, Result.UNSTABLE, trigger, -21, -22)});
        //OTHER Not overridden
        trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildNotBuiltCodeReviewValue()).thenReturn(null);
        when(trigger.getGerritBuildNotBuiltVerifiedValue()).thenReturn(null);
        list.add(new TestParameters[]{new TestParameters(config, Result.NOT_BUILT, trigger, -6, -5)});
        //OTHER overridden
        trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildNotBuiltCodeReviewValue()).thenReturn(-51);
        when(trigger.getGerritBuildNotBuiltVerifiedValue()).thenReturn(-52);
        list.add(new TestParameters[]{new TestParameters(config, Result.NOT_BUILT, trigger, -51, -52)});

        return list;
    }
View Full Code Here

     */
    @Test
    public void testGetBuildStartedCommand() throws Exception {
        TaskListener taskListener = mock(TaskListener.class);

        GerritTrigger trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildStartedVerifiedValue()).thenReturn(null);
        when(trigger.getGerritBuildStartedCodeReviewValue()).thenReturn(32);
        AbstractProject project = mock(AbstractProject.class);
        when(project.getTrigger(GerritTrigger.class)).thenReturn(trigger);

        AbstractBuild r = Setup.createBuild(project, taskListener, Setup.createEnvVars());

View Full Code Here

        ParameterExpander instance = new ParameterExpander(config);
        MemoryImprint memoryImprint = mock(MemoryImprint.class);
        MemoryImprint.Entry[] entries = new MemoryImprint.Entry[4];

        GerritTrigger trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildSuccessfulVerifiedValue()).thenReturn(3);
        entries[0] = Setup.createAndSetupMemoryImprintEntry(trigger, Result.SUCCESS);

        trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildUnstableVerifiedValue()).thenReturn(1);
        entries[1] = Setup.createAndSetupMemoryImprintEntry(trigger, Result.UNSTABLE);

        trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildUnstableVerifiedValue()).thenReturn(-1);
        entries[2] = Setup.createAndSetupMemoryImprintEntry(trigger, Result.UNSTABLE);

        trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildNotBuiltVerifiedValue()).thenReturn(-4);
        entries[3] = Setup.createAndSetupMemoryImprintEntry(trigger, Result.NOT_BUILT);

        when(memoryImprint.getEntries()).thenReturn(entries);

        // When not all results are NOT_BUILT, we should ignore NOT_BUILT.
View Full Code Here

        ParameterExpander instance = new ParameterExpander(config);
        MemoryImprint memoryImprint = mock(MemoryImprint.class);
        MemoryImprint.Entry[] entries = new MemoryImprint.Entry[4];

        GerritTrigger trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildSuccessfulCodeReviewValue()).thenReturn(3);
        entries[0] = Setup.createAndSetupMemoryImprintEntry(trigger, Result.SUCCESS);

        trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildUnstableCodeReviewValue()).thenReturn(1);
        entries[1] = Setup.createAndSetupMemoryImprintEntry(trigger, Result.UNSTABLE);

        trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildUnstableCodeReviewValue()).thenReturn(-1);
        entries[2] = Setup.createAndSetupMemoryImprintEntry(trigger, Result.UNSTABLE);

        trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildNotBuiltCodeReviewValue()).thenReturn(-4);
        entries[3] = Setup.createAndSetupMemoryImprintEntry(trigger, Result.NOT_BUILT);

        when(memoryImprint.getEntries()).thenReturn(entries);

        // When not all results are NOT_BUILT, we should ignore NOT_BUILT.
View Full Code Here

        ParameterExpander instance = new ParameterExpander(config);
        MemoryImprint memoryImprint = mock(MemoryImprint.class);
        MemoryImprint.Entry[] entries = new MemoryImprint.Entry[3];

        GerritTrigger trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildSuccessfulCodeReviewValue()).thenReturn(1);
        entries[0] = Setup.createAndSetupMemoryImprintEntry(trigger, Result.SUCCESS);

        trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildUnstableCodeReviewValue()).thenReturn(-1);
        SkipVote skipVote = new SkipVote(false, false, true, false);
        when(trigger.getSkipVote()).thenReturn(skipVote);
        entries[1] = Setup.createAndSetupMemoryImprintEntry(trigger, Result.UNSTABLE);

        trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildSuccessfulCodeReviewValue()).thenReturn(2);
        entries[2] = Setup.createAndSetupMemoryImprintEntry(trigger, Result.SUCCESS);


        when(memoryImprint.getEntries()).thenReturn(entries);
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.