This commit is contained in:
Kohsuke Kawaguchi committed 2011-04-21 13:53:31 -07:00
1 parent d305c80bca
commit 0d0e011d7e
1 file changed
+14 -12
@@ -47,6 +47,7 @@ import hudson.maven.MavenEmbedder;
import hudson.maven.MavenModule;
import hudson.maven.MavenModuleSet;
import hudson.maven.MavenModuleSetBuild;
import hudson.maven.MavenUtil;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.BuildListener;
@@ -118,6 +119,7 @@ import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -435,7 +437,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
WebAppContext context = new WebAppContext(WarExploder.getExplodedDir().getPath(), contextPath);
context.setClassLoader(getClass().getClassLoader());
context.setConfigurations(new Configuration[]{new WebXmlConfiguration(),new NoListenerConfiguration()});
context.setConfigurations(new Configuration[]{new WebXmlConfiguration(), new NoListenerConfiguration()});
server.setHandler(context);
context.setMimeTypes(MIME_TYPES);
@@ -582,7 +584,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
}
protected FreeStyleProject createFreeStyleProject(String name) throws IOException {
return hudson.createProject(FreeStyleProject.class,name);
return hudson.createProject(FreeStyleProject.class, name);
}
protected MatrixProject createMatrixProject() throws IOException {
@@ -590,7 +592,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
}
protected MatrixProject createMatrixProject(String name) throws IOException {
return hudson.createProject(MatrixProject.class,name);
return hudson.createProject(MatrixProject.class, name);
}
/**
@@ -813,7 +815,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
}
protected <P extends Item> P configRoundtrip(P job) throws Exception {
submit(createWebClient().getPage(job,"configure").getFormByName("config"));
submit(createWebClient().getPage(job, "configure").getFormByName("config"));
return job;
}
@@ -833,7 +835,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
protected <P extends Publisher> P configRoundtrip(P before) throws Exception {
FreeStyleProject p = createFreeStyleProject();
p.getPublishersList().add(before);
configRoundtrip((Item)p);
configRoundtrip((Item) p);
return (P)p.getPublishersList().get(before.getClass());
}
@@ -849,7 +851,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
}
protected <N extends Node> N configRoundtrip(N node) throws Exception {
submit(createWebClient().goTo("/computer/"+node.getNodeName()+"/configure").getFormByName("config"));
submit(createWebClient().goTo("/computer/" + node.getNodeName() + "/configure").getFormByName("config"));
return (N)hudson.getNode(node.getNodeName());
}
@@ -899,7 +901,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
public <R extends Run> R assertBuildStatusSuccess(R r) throws Exception {
assertBuildStatus(Result.SUCCESS,r);
assertBuildStatus(Result.SUCCESS, r);
return r;
}
@@ -949,7 +951,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
* Asserts that the XPath matches.
*/
public void assertXPath(HtmlPage page, String xpath) {
assertNotNull("There should be an object that matches XPath:"+xpath,
assertNotNull("There should be an object that matches XPath:" + xpath,
page.getDocumentElement().selectSingleNode(xpath));
}
@@ -961,7 +963,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
*/
public void assertXPath(DomNode page, String xpath) {
List< ? extends Object> nodes = page.getByXPath(xpath);
assertFalse("There should be an object that matches XPath:"+xpath, nodes.isEmpty());
assertFalse("There should be an object that matches XPath:" + xpath, nodes.isEmpty());
}
public void assertXPathValue(DomNode page, String xpath, String expectedValue) {
@@ -1326,8 +1328,8 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
}
/**
* If this test harness is launched for a Hudson plugin, locate the <tt>target/test-classes/the.hpl</tt>
* and add a recipe to install that to the new Hudson.
* If this test harness is launched for a Jenkins plugin, locate the <tt>target/test-classes/the.hpl</tt>
* and add a recipe to install that to the new Jenkins.
*
* <p>
* This file is created by <tt>maven-hpi-plugin</tt> at the testCompile phase when the current
@@ -1362,7 +1364,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
String dependencies = m.getMainAttributes().getValue("Plugin-Dependencies");
if(dependencies!=null) {
MavenEmbedder embedder = new MavenEmbedder(getClass().getClassLoader(), null);
MavenEmbedder embedder = MavenUtil.createEmbedder(new StreamTaskListener(System.out,Charset.defaultCharset()),(File)null,null);
for( String dep : dependencies.split(",")) {
String[] tokens = dep.split(":");
String artifactId = tokens[0];