Package hudson.model

Examples of hudson.model.Hudson


        /**
         * If there's no distributed build set up, it's pointless to provide this axis.
         */
        @Override
        public boolean isInstantiable() {
            Hudson h = Hudson.getInstance();
            return !h.getNodes().isEmpty() || !h.clouds.isEmpty();
        }
View Full Code Here


    public void init(FilterConfig filterConfig) throws ServletException {
        this.filterConfig = filterConfig;
        // this is how we make us available to the rest of Hudson.
        filterConfig.getServletContext().setAttribute(HudsonFilter.class.getName(),this);
        try {
            Hudson hudson = Hudson.getInstance();
            if (hudson != null) {
                // looks like we are initialized after Hudson came into being. initialize it now. See #3069
                LOGGER.fine("Security wasn't initialized; Initializing it...");
                SecurityRealm securityRealm = hudson.getSecurityRealm();
                reset(securityRealm);
                LOGGER.fine("securityRealm is " + securityRealm);
                LOGGER.fine("Security initialized");
            }
        } catch (ExceptionInInitializerError e) {
View Full Code Here

        PatchsetCreated event = Setup.createPatchsetCreated();
        BuildsStartedStats stats = Setup.createBuildStartedStats(event);
        IGerritHudsonTriggerConfig config = Setup.createConfig();

        Hudson hudson = PowerMockito.mock(Hudson.class);
        when(hudson.getRootUrl()).thenReturn("http://localhost/");

        PowerMockito.mockStatic(GerritMessageProvider.class);
        List<GerritMessageProvider> messageProviderExtensionList = new LinkedList<GerritMessageProvider>();
        messageProviderExtensionList.add(new GerritMessageProviderExtension());
        messageProviderExtensionList.add(new GerritMessageProviderExtensionReturnNull());
View Full Code Here

            int expectedCodeReviewVote)
                    throws IOException, InterruptedException {

        IGerritHudsonTriggerConfig config = Setup.createConfig();

        Hudson hudson = PowerMockito.mock(Hudson.class);
        when(hudson.getRootUrl()).thenReturn("http://localhost/");

        TaskListener taskListener = mock(TaskListener.class);

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

        EnvVars env = Setup.createEnvVars();
        AbstractBuild r = Setup.createBuild(project, taskListener, env);
        env.put("BUILD_URL", hudson.getRootUrl() + r.getUrl());

        when(r.getResult()).thenReturn(Result.SUCCESS);

        MemoryImprint memoryImprint = mock(MemoryImprint.class);
        when(memoryImprint.getEvent()).thenReturn(event);
View Full Code Here

     * @throws Exception if so
     */
    public void tryBuildStatsFailureCommand(String failureMessage, String expectedBuildStats) throws Exception {
        IGerritHudsonTriggerConfig config = Setup.createConfig();

        Hudson hudson = PowerMockito.mock(Hudson.class);
        when(hudson.getRootUrl()).thenReturn("http://localhost/");

        TaskListener taskListener = mock(TaskListener.class);

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

        EnvVars env = Setup.createEnvVars();
        AbstractBuild r = Setup.createBuild(project, taskListener, env);
        env.put("BUILD_URL", hudson.getRootUrl() + r.getUrl());

        when(r.getResult()).thenReturn(Result.FAILURE);

        PatchsetCreated event = Setup.createPatchsetCreated();

View Full Code Here

     */
    @Test
    public void shouldCallGerritWithVerifiedOkFlagWhenBuildWasSuccessful()
            throws IOException, InterruptedException {

        Hudson hudson = PowerMockito.mock(Hudson.class);
        when(hudson.getRootUrl()).thenReturn("http://localhost/");

        PowerMockito.mockStatic(GerritMessageProvider.class);
        when(GerritMessageProvider.all()).thenReturn(null);

        TaskListener taskListener = mock(TaskListener.class);
View Full Code Here

     */
    @Test
    public void shouldCallGerritWithVerifiedRejectFlagWhenBuildWasNotSuccessful()
            throws IOException, InterruptedException {

        Hudson hudson = PowerMockito.mock(Hudson.class);
        when(hudson.getRootUrl()).thenReturn("http://localhost/");

        PowerMockito.mockStatic(GerritMessageProvider.class);
        when(GerritMessageProvider.all()).thenReturn(null);

        TaskListener taskListener = mock(TaskListener.class);
View Full Code Here

     * @throws InterruptedException InterruptedException
     */
    @Test
    public void shouldCallGerritWithVerifiedFailedFlagWhenBuildOneBuildFailedAndAnotherSuccessful()
            throws IOException, InterruptedException {
        Hudson hudson = PowerMockito.mock(Hudson.class);
        when(hudson.getRootUrl()).thenReturn("http://localhost/");

        PowerMockito.mockStatic(GerritMessageProvider.class);
        when(GerritMessageProvider.all()).thenReturn(null);

        TaskListener taskListener = mock(TaskListener.class);
View Full Code Here

TOP

Related Classes of hudson.model.Hudson

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.