Java Code Examples for hudson.util.PersistedList#add()

The following examples show how to use hudson.util.PersistedList#add() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JenkinsRule.java    From jenkins-test-harness with MIT License 6 votes vote down vote up
/**
 * Internal method used to configure update center to avoid network traffic.
 * @param jenkins the Jenkins to configure
 * @since 2.50
 */
public static void _configureUpdateCenter(Jenkins jenkins) throws Exception {
    final String updateCenterUrl;
    jettyLevel(Level.WARNING);
    try {
        updateCenterUrl = "http://localhost:"+ JavaNetReverseProxy.getInstance().localPort+"/update-center.json";
    } finally {
        jettyLevel(Level.INFO);
    }

    // don't waste bandwidth talking to the update center
    DownloadService.neverUpdate = true;
    UpdateSite.neverUpdate = true;

    PersistedList<UpdateSite> sites = jenkins.getUpdateCenter().getSites();
    sites.clear();
    sites.add(new UpdateSite("default", updateCenterUrl));
}
 
Example 2
Source File: HudsonTestCase.java    From jenkins-test-harness with MIT License 5 votes vote down vote up
/**
 * Configures the update center setting for the test.
 * By default, we load updates from local proxy to avoid network traffic as much as possible.
 */
protected void configureUpdateCenter() throws Exception {
    final String updateCenterUrl = "http://localhost:"+ JavaNetReverseProxy.getInstance().localPort+"/update-center.json";

    // don't waste bandwidth talking to the update center
    DownloadService.neverUpdate = true;
    UpdateSite.neverUpdate = true;

    PersistedList<UpdateSite> sites = jenkins.getUpdateCenter().getSites();
    sites.clear();
    sites.add(new UpdateSite("default", updateCenterUrl));
}