提交 3e7181d9 编写于 作者: K Kohsuke Kawaguchi

Merge remote-tracking branch 'origin/master'

......@@ -73,7 +73,11 @@ done
JAVA_CMD="$JENKINS_JAVA_CMD $JENKINS_JAVA_OPTIONS -DJENKINS_HOME=$JENKINS_HOME -jar $JENKINS_WAR"
PARAMS="--logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war --daemon"
[ -n "$JENKINS_PORT" ] && PARAMS="$PARAMS --httpPort=$JENKINS_PORT"
[ -n "$JENKINS_LISTEN_ADDRESS" ] && PARAMS="$PARAMS --httpListenAddress=$JENKINS_LISTEN_ADDRESS"
[ -n "$JENKINS_HTTPS_PORT" ] && PARAMS="$PARAMS --httpsPort=$JENKINS_HTTPS_PORT"
[ -n "$JENKINS_HTTPS_LISTEN_ADDRESS" ] && PARAMS="$PARAMS --httpsListenAddress=$JENKINS_HTTPS_LISTEN_ADDRESS"
[ -n "$JENKINS_AJP_PORT" ] && PARAMS="$PARAMS --ajp13Port=$JENKINS_AJP_PORT"
[ -n "$JENKINS_AJP_LISTEN_ADDRESS" ] && PARAMS="$PARAMS --ajp13ListenAddress=$JENKINS_AJP_LISTEN_ADDRESS"
[ -n "$JENKINS_DEBUG_LEVEL" ] && PARAMS="$PARAMS --debug=$JENKINS_DEBUG_LEVEL"
[ -n "$JENKINS_HANDLER_STARTUP" ] && PARAMS="$PARAMS --handlerCountStartup=$JENKINS_HANDLER_STARTUP"
[ -n "$JENKINS_HANDLER_MAX" ] && PARAMS="$PARAMS --handlerCountMax=$JENKINS_HANDLER_MAX"
......
......@@ -45,6 +45,33 @@ JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true"
#
JENKINS_PORT="8080"
## Type: string
## Default: ""
## ServiceRestart: jenkins
#
# IP address Jenkins listens on for HTTP requests.
# Default is all interfaces (0.0.0.0).
#
JENKINS_LISTEN_ADDRESS=""
## Type: integer(0:65535)
## Default: ""
## ServiceRestart: jenkins
#
# HTTPS port Jenkins is listening on.
# Default is disabled.
#
JENKINS_HTTPS_PORT=""
## Type: string
## Default: ""
## ServiceRestart: jenkins
#
# IP address Jenkins listens on for HTTPS requests.
# Default is disabled.
#
JENKINS_HTTPS_LISTEN_ADDRESS=""
## Type: integer(0:65535)
## Default: 8009
## ServiceRestart: jenkins
......@@ -54,6 +81,15 @@ JENKINS_PORT="8080"
#
JENKINS_AJP_PORT="8009"
## Type: string
## Default: ""
## ServiceRestart: jenkins
#
# IP address Jenkins listens on for Ajp13 requests.
# Default is all interfaces (0.0.0.0).
#
JENKINS_AJP_LISTEN_ADDRESS=""
## Type: integer(1:9)
## Default: 5
## ServiceRestart: jenkins
......
......@@ -81,9 +81,10 @@ public class ConsoleAnnotatorTest extends HudsonTestCase {
};
public static class DemoAnnotator extends ConsoleAnnotator<Object> {
private static final String ANNOTATE_TEXT = "ooo" + System.getProperty("line.separator");
@Override
public ConsoleAnnotator annotate(Object build, MarkupText text) {
if (text.getText().equals("ooo\n")) {
if (text.getText().equals(ANNOTATE_TEXT)) {
text.addMarkup(0,3,"<b class=demo>","</b>");
return null;
}
......
......@@ -282,7 +282,8 @@ public class QueueTest extends HudsonTestCase {
// View for build should group duplicates
WebClient wc = new WebClient();
String buildPage = wc.getPage(build, "").asText().replace('\n',' ');
String nl = System.getProperty("line.separator");
String buildPage = wc.getPage(build, "").asText().replace(nl," ");
assertTrue("Build page should combine duplicates and show counts: " + buildPage,
buildPage.contains("Started by user SYSTEM (2 times) "
+ "Started by an SCM change (3 times) "
......
......@@ -27,22 +27,86 @@ package hudson.model;
import hudson.model.UpdateSite.Data;
import hudson.util.FormValidation;
import hudson.util.PersistedList;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Arrays;
import java.util.HashSet;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import static org.junit.Assert.*;
import org.apache.commons.io.FileUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;
import org.mortbay.jetty.HttpConnection;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.bio.SocketConnector;
import org.mortbay.jetty.handler.AbstractHandler;
public class UpdateSiteTest {
@Rule public JenkinsRule j = new JenkinsRule();
private final String RELATIVE_BASE = "/_relative/";
private Server server;
private URL baseUrl;
private String getResource(String resourceName) throws IOException {
try {
URL url = UpdateSiteTest.class.getResource(resourceName);
return (url != null)?FileUtils.readFileToString(new File(url.toURI())):null;
} catch(URISyntaxException e) {
return null;
}
}
/**
* Startup a web server to access resources via HTTP.
* @throws Exception
*/
@Before
public void setUpWebServer() throws Exception {
server = new Server();
SocketConnector connector = new SocketConnector();
server.addConnector(connector);
server.setHandler(new AbstractHandler() {
public void handle(String target, HttpServletRequest request,
HttpServletResponse response, int dispatch) throws IOException,
ServletException {
if (target.startsWith(RELATIVE_BASE)) {
target = target.substring(RELATIVE_BASE.length());
}
String responseBody = getResource(target);
if (responseBody != null) {
HttpConnection.getCurrentConnection().getRequest().setHandled(true);
response.setContentType("text/plain; charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
response.getOutputStream().write(responseBody.getBytes());
}
}
});
server.start();
baseUrl = new URL("http", "localhost", connector.getLocalPort(), RELATIVE_BASE);
}
@After
public void shutdownWebserver() throws Exception {
server.stop();
}
@Test public void relativeURLs() throws Exception {
PersistedList<UpdateSite> sites = j.jenkins.getUpdateCenter().getSites();
sites.clear();
URL url = UpdateSiteTest.class.getResource("/plugins/tasks-update-center.json");
URL url = new URL(baseUrl, "/plugins/tasks-update-center.json");
UpdateSite site = new UpdateSite(UpdateCenter.ID_DEFAULT, url.toString());
sites.add(site);
assertEquals(FormValidation.ok(), site.updateDirectly(false).get());
......@@ -55,14 +119,14 @@ public class UpdateSiteTest {
}
@Test public void updateDirectlyWithJson() throws Exception {
UpdateSite us = new UpdateSite("default", UpdateSiteTest.class.getResource("update-center.json").toExternalForm());
UpdateSite us = new UpdateSite("default", new URL(baseUrl, "update-center.json").toExternalForm());
assertNull(us.getPlugin("AdaptivePlugin"));
assertEquals(FormValidation.ok(), us.updateDirectly(true).get());
assertNotNull(us.getPlugin("AdaptivePlugin"));
}
@Test public void updateDirectlyWithHtml() throws Exception {
UpdateSite us = new UpdateSite("default", UpdateSiteTest.class.getResource("update-center.json.html").toExternalForm());
UpdateSite us = new UpdateSite("default", new URL(baseUrl, "update-center.json.html").toExternalForm());
assertNull(us.getPlugin("AdaptivePlugin"));
assertEquals(FormValidation.ok(), us.updateDirectly(true).get());
assertNotNull(us.getPlugin("AdaptivePlugin"));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册