Package hudson.model

Examples of hudson.model.Hudson


     *
     * @throws Exception if so.
     */
    @Test()
    public void testGetContainerNoMetadataOnBuildCreate() throws Exception {
        Hudson hudson = MockUtils.mockHudson();
        FreeStyleProject project = mock(FreeStyleProject.class);
        when(hudson.getItem("theJob")).thenReturn(project);
        FreeStyleBuild build = mock(FreeStyleBuild.class);
        when(project.getBuildByNumber(1)).thenReturn(build);
        when(build.getAction(MetadataBuildAction.class)).thenReturn(null);

        MetadataParent container = CliUtils.getContainer(null, "theJob", 1, true);
View Full Code Here


      when(mockedUser.getId()).thenReturn("fcamblor");
     
    // Mocking Hudson singleton instance ...
      // Warning : this line will only work on Objenesis supported VMs :
      // http://code.google.com/p/objenesis/wiki/ListOfCurrentlySupportedVMs
      Hudson hudsonMockedInstance = spy((Hudson) new ObjenesisStd().getInstantiatorOf(Hudson.class).newInstance());
    PowerMockito.doReturn(currentHudsonRootDirectory).when(hudsonMockedInstance).getRootDir();
    PowerMockito.doReturn(mockedUser).when(hudsonMockedInstance).getMe();
    PowerMockito.doReturn(scmSyncConfigPluginInstance).when(hudsonMockedInstance).getPlugin(ScmSyncConfigurationPlugin.class);
   
      PowerMockito.mockStatic(Hudson.class);
View Full Code Here

    super(new ScmUnderTestSubversion());
  }
 
  @Test
  public void shouldRetrieveMockedHudsonInstanceCorrectly() throws Throwable {
    Hudson hudsonInstance = Hudson.getInstance();
    assertThat(hudsonInstance, is(notNullValue()));
    assertThat(hudsonInstance.toString().split("@")[0], is(not(equalTo("hudson.model.Hudson"))));
  }
View Full Code Here

  }
 
  @Test
  public void shouldVerifyIfHudsonRootDirectoryExists() throws Throwable {
   
    Hudson hudsonInstance = Hudson.getInstance();
    File hudsonRootDir = hudsonInstance.getRootDir();
    assertThat(hudsonRootDir, is(not(equalTo(null))));
    assertThat(hudsonRootDir.exists(), is(true));
  }
View Full Code Here

     * {@link ISVNAdminAreaFactorySelector}).
     */
    public static volatile int workspaceFormat = SVNAdminArea14.WC_FORMAT;

    public static void syncWorkspaceFormatFromMaster() {
        Hudson h = Hudson.getInstance();
        if (h!=null)
            workspaceFormat = h.getDescriptorByType(SubversionSCM.DescriptorImpl.class).getWorkspaceFormat();
        else {
            Channel c = Channel.current();
            if (c!=null)    // just being defensive. cannot be null.
                try {
                    workspaceFormat = c.call(new Callable<Integer, RuntimeException>() {
View Full Code Here

                        listener.getLogger().println("Updated failed due to working copy corruption. Getting a fresh workspace");
                        return delegateTo(new CheckoutUpdater());
                    }
                    // trouble-shooting probe for #591
                    if (errorCode == SVNErrorCode.WC_NOT_LOCKED) {
                        Hudson instance = Hudson.getInstance();
                        if (instance != null) {
                            listener.getLogger().println("Polled jobs are " + instance.getDescriptorByType(SCMTrigger.DescriptorImpl.class).getItemsBeingPolled());
                        }
                        return delegateTo(new CheckoutUpdater());
                    }

                  // recurse as long as we encounter nested SVNException
View Full Code Here

            return prefix + Messages.FindBugs_Bug_cloudInfo_reviewer_plural(reviewCount);
        }
    }

    private String getImage(final String image) {
        Hudson hudson = Hudson.getInstance();
        String rootUrl;
        if (hudson == null) {
            rootUrl = StringUtils.EMPTY;
        }
        else {
            rootUrl = hudson.getRootUrl();
        }

        return rootUrl + "/plugin/findbugs/icons/" + image;
    }
View Full Code Here

public class CrowdMailAddressResolver extends MailAddressResolver {

    @Override
    public String findMailAddressFor(User u) {
        // LDAP not active
        Hudson hudson = Hudson.getInstance();
        if (!(hudson.getSecurityRealm() instanceof CrowdSecurityRealm))
            return null;
        try {
            CrowdUserDetails details = (CrowdUserDetails) hudson.getSecurityRealm()
                    .getSecurityComponents().userDetails.loadUserByUsername(u.getId());
            String mail = details.getEmail();
            if (mail == null)
                return null; // not found
            return mail;
View Full Code Here

     * @param shortName
     *            the plug-in to check
     * @return <code>true</code> if the specified plug-in is installed, <code>false</code> if not.
     */
    public static boolean isPluginInstalled(final String shortName) {
        Hudson instance = Hudson.getInstance();
        if (instance != null) {
            return instance.getPlugin(shortName) != null;
        }
        return true;
    }
View Full Code Here

        p3 = new FreeStyleProjectMock("p3");
        p2.setCascadingProject(p1);
        CascadingUtil.linkCascadingProjectsToChild(p1, "p2");
        p3.setCascadingProject(p2);
        CascadingUtil.linkCascadingProjectsToChild(p2, "p3");
        Hudson hudson = createMock(Hudson.class);
        expect(hudson.getItem("p2")).andReturn(p2).anyTimes();
        expect(hudson.getItem("p3")).andReturn(p3).anyTimes();
        mockStatic(Hudson.class);
        expect(Hudson.getInstance()).andReturn(hudson).anyTimes();
        replay(Hudson.class, hudson);
        propertyKey = Job.PARAMETERS_DEFINITION_JOB_PROPERTY_PROPERTY_NAME;
        List<ParameterDefinition> parameterDefinitionList = new ArrayList<ParameterDefinition>();
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.