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

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


        EnvVars env = Setup.createEnvVars();
        when(build.getEnvironment(taskListener)).thenReturn(env);
        AbstractProject project = mock(AbstractProject.class);
        when(build.getProject()).thenReturn(project);

        GerritTrigger trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildSuccessfulCodeReviewValue()).thenReturn(null);
        when(trigger.getGerritBuildSuccessfulVerifiedValue()).thenReturn(null);
        when(project.getTrigger(GerritTrigger.class)).thenReturn(trigger);

        PatchsetCreated event = Setup.createPatchsetCreated();

        BuildMemory memory = new BuildMemory();
View Full Code Here


        EnvVars env = Setup.createEnvVars();
        when(build.getEnvironment(taskListener)).thenReturn(env);
        AbstractProject project = mock(AbstractProject.class);
        when(build.getProject()).thenReturn(project);

        GerritTrigger trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildFailedCodeReviewValue()).thenReturn(null);
        when(trigger.getGerritBuildFailedVerifiedValue()).thenReturn(null);
        when(project.getTrigger(GerritTrigger.class)).thenReturn(trigger);

        PatchsetCreated event = Setup.createPatchsetCreated();

        BuildMemory memory = new BuildMemory();
View Full Code Here

        EnvVars env = Setup.createEnvVars();
        when(build.getEnvironment(taskListener)).thenReturn(env);
        AbstractProject project = mock(AbstractProject.class);
        when(build.getProject()).thenReturn(project);

        GerritTrigger trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildSuccessfulCodeReviewValue()).thenReturn(null);
        when(trigger.getGerritBuildSuccessfulVerifiedValue()).thenReturn(null);
        when(project.getTrigger(GerritTrigger.class)).thenReturn(trigger);

        PatchsetCreated event = Setup.createPatchsetCreated();

        BuildMemory memory = new BuildMemory();
        memory.completed(event, build);

        build = mock(AbstractBuild.class);
        when(build.getResult()).thenReturn(Result.FAILURE);
        env = Setup.createEnvVars();
        when(build.getEnvironment(taskListener)).thenReturn(env);
        project = mock(AbstractProject.class);
        when(build.getProject()).thenReturn(project);

        trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildFailedCodeReviewValue()).thenReturn(null);
        when(trigger.getGerritBuildFailedVerifiedValue()).thenReturn(null);
        when(project.getTrigger(GerritTrigger.class)).thenReturn(trigger);

        memory.completed(event, build);

        IGerritHudsonTriggerConfig config = mock(IGerritHudsonTriggerConfig.class);
View Full Code Here

        if (item.isBuildable()) {
            logger.debug("Item is already buildable");
            return null;
        }
        AbstractProject p = (AbstractProject)item.task;
        GerritTrigger trigger = GerritTrigger.getTrigger(p);
        //The project being checked has no Gerrit Trigger
        if (trigger == null) {
            logger.debug("Project does not contain a trigger");
            return null;
        }
        //Dependency projects in the build queue
        List<AbstractProject> dependencies = getProjectsFromString(trigger.getDependencyJobsNames(),
                (Item)p);
        if ((dependencies == null) || (dependencies.size() == 0)) {
            logger.debug("No dependencies on project: {}", p);
            return null;
        }
View Full Code Here

            //TODO show error to user?
            return;
        }

        TriggeredItemEntity entity = context.getThisBuild();
        GerritTrigger trigger = (GerritTrigger)entity.getProject().getTrigger(GerritTrigger.class);
        if (trigger == null) {
            //TODO show config error to user?
            return;
        }

        trigger.retriggerThisBuild(context);
        response.sendRedirect2(entity.getProject().getAbsoluteUrl());
    }
View Full Code Here

            //There is no reason to run this action on a lonely project.
            return;
        }

        TriggeredItemEntity entity = context.getThisBuild();
        GerritTrigger trigger = (GerritTrigger)entity.getProject().getTrigger(GerritTrigger.class);
        if (trigger == null) {
            //TODO show config error to user?
            return;
        }

        trigger.retriggerAllBuilds(context);
        response.sendRedirect2(entity.getProject().getAbsoluteUrl());
    }
View Full Code Here

        server1.start();

        PatchsetCreated event = Setup.createPatchsetCreated(server1.getName());

        FreeStyleProject project = createFreeStyleProject();
        GerritTrigger trigger = Setup.createDefaultTrigger(project);
        trigger.setGerritProjects(Collections.singletonList(
                new GerritProject(CompareType.PLAIN, event.getChange().getProject(),
                        Collections.singletonList(new Branch(CompareType.PLAIN, event.getChange().getBranch())),
                        null, null, null)
        ));
        trigger.setSilentMode(false);
        trigger.setGerritBuildSuccessfulCodeReviewValue(1);
        trigger.setGerritBuildSuccessfulVerifiedValue(1);

        PluginImpl.getInstance().getHandler().post(event);

        //CS IGNORE MagicNumber FOR NEXT 9 LINES. REASON: TestData
        long startedWait = System.currentTimeMillis();
View Full Code Here

     * @return the list of jobs configured with this server.
     */
    public List<AbstractProject> getConfiguredJobs(String serverName) {
        LinkedList<AbstractProject> configuredJobs = new LinkedList<AbstractProject>();
        for (AbstractProject<?, ?> project : Hudson.getInstance().getItems(AbstractProject.class)) { //get the jobs
            GerritTrigger gerritTrigger = project.getTrigger(GerritTrigger.class);

            //if the job has a gerrit trigger, check whether the trigger has selected this server:
            if (gerritTrigger != null && gerritTrigger.getServerName().equals(serverName)) {
                configuredJobs.add(project); //job has selected this server, add it to the list
            }
        }
        return configuredJobs;
    }
View Full Code Here

     * @return the "expanded" command string.
     */
    public String getBuildStartedCommand(AbstractBuild r, TaskListener taskListener,
            ChangeBasedEvent event, BuildsStartedStats stats) {

        GerritTrigger trigger = GerritTrigger.getTrigger(r.getProject());
        String gerritCmd = config.getGerritCmdBuildStarted();
        Map<String, String> parameters = createStandardParameters(r, event,
                getBuildStartedCodeReviewValue(r),
                getBuildStartedVerifiedValue(r),
                Notify.ALL.name());
        StringBuilder startedStats = new StringBuilder();
        if (stats.getTotalBuildsToStart() > 1) {
            startedStats.append(stats.toString());
        }
        String buildStartMessage = trigger.getBuildStartMessage();
        if (buildStartMessage != null && !buildStartMessage.isEmpty()) {
            startedStats.append("\n\n").append(buildStartMessage);
        }

        if (config.isEnablePluginMessages()) {
View Full Code Here

     * {@link IGerritHudsonTriggerConfig#getGerritBuildStartedVerifiedValue()} will be used.
     * @param r the build.
     * @return the value.
     */
    private int getBuildStartedVerifiedValue(AbstractBuild r) {
        GerritTrigger trigger = GerritTrigger.getTrigger(r.getProject());
        if (trigger == null) {
            logger.warn("Unable to get trigger config for build {} will use global value.");
            return config.getGerritBuildStartedVerifiedValue();
        } else if (trigger.getGerritBuildStartedVerifiedValue() != null) {
            final Integer value = trigger.getGerritBuildStartedVerifiedValue();
            logger.trace("BuildStartedVerified overridden in project config. returning {}", value);
            return value;
        } else {
            final int value = config.getGerritBuildStartedVerifiedValue();
            logger.trace("BuildStartedVerified standard value used {}", value);
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.