Search in sources :

Example 41 with Hudson

use of hudson.model.Hudson in project hudson-2.x by hudson.

the class LabelAtom method doConfigSubmit.

/**
     * Accepts the update to the node configuration.
     */
public void doConfigSubmit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, FormException {
    final Hudson app = Hudson.getInstance();
    app.checkPermission(Hudson.ADMINISTER);
    properties.rebuild(req, req.getSubmittedForm(), getApplicablePropertyDescriptors());
    updateTransientActions();
    save();
    // take the user back to the label top page.
    rsp.sendRedirect2(".");
}
Also used : Hudson(hudson.model.Hudson)

Example 42 with Hudson

use of hudson.model.Hudson in project hudson-2.x by hudson.

the class ScriptServiceImplTest method setUp.

@Before
public void setUp() throws Exception {
    // static methods
    mockStatic(Hudson.class);
    // final and native
    hudson = mock(Hudson.class);
    mockStatic(RemotingDiagnostics.class);
    mockStatic(MasterComputer.class);
    MockitoAnnotations.initMocks(this);
    scriptService = new ScriptServiceImpl(security);
    scriptService.setHudson(hudson);
}
Also used : ScriptServiceImpl(org.hudsonci.service.internal.ScriptServiceImpl) Hudson(hudson.model.Hudson) Before(org.junit.Before)

Example 43 with Hudson

use of hudson.model.Hudson in project hudson-2.x by hudson.

the class SystemServiceImplTest method setUp.

@Before
public void setUp() throws Exception {
    mockStatic(Hudson.class);
    hudson = mock(Hudson.class);
    SecurityService security = mock(SecurityService.class);
    system = new SystemServiceImpl(security);
    system.setHudson(hudson);
}
Also used : SecurityService(org.hudsonci.service.SecurityService) Hudson(hudson.model.Hudson) SystemServiceImpl(org.hudsonci.service.internal.SystemServiceImpl) Before(org.junit.Before)

Aggregations

Hudson (hudson.model.Hudson)43 FreeStyleProjectMock (hudson.model.FreeStyleProjectMock)8 ArrayList (java.util.ArrayList)8 Test (org.junit.Test)8 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)8 Job (hudson.model.Job)7 IOException (java.io.IOException)7 Before (org.junit.Before)7 FreeStyleProject (hudson.model.FreeStyleProject)5 AbstractProject (hudson.model.AbstractProject)4 File (java.io.File)3 Descriptor (hudson.model.Descriptor)2 TopLevelItem (hudson.model.TopLevelItem)2 UpdateSite (hudson.model.UpdateSite)2 CrumbIssuer (hudson.security.csrf.CrumbIssuer)2 Publisher (hudson.tasks.Publisher)2 JSONObject (net.sf.json.JSONObject)2 CmdLineException (org.kohsuke.args4j.CmdLineException)2 StaplerRequest (org.kohsuke.stapler.StaplerRequest)2 Provides (com.google.inject.Provides)1