提交 6d3a1f5f 编写于 作者: K Kohsuke Kawaguchi

Jenkins!

上级 9ff1da3d
...@@ -131,8 +131,6 @@ import net.sourceforge.htmlunit.corejs.javascript.ContextFactory.Listener; ...@@ -131,8 +131,6 @@ import net.sourceforge.htmlunit.corejs.javascript.ContextFactory.Listener;
import org.acegisecurity.AuthenticationException; import org.acegisecurity.AuthenticationException;
import org.acegisecurity.BadCredentialsException; import org.acegisecurity.BadCredentialsException;
import org.acegisecurity.GrantedAuthority; import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.context.SecurityContext;
import org.acegisecurity.context.SecurityContextHolder;
import org.acegisecurity.userdetails.UserDetails; import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.userdetails.UsernameNotFoundException; import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.beanutils.PropertyUtils;
...@@ -309,30 +307,30 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -309,30 +307,30 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
f.set(null,null); f.set(null,null);
throw e; throw e;
} }
hudson.setNoUsageStatistics(true); // collecting usage stats from tests are pointless. jenkins.setNoUsageStatistics(true); // collecting usage stats from tests are pointless.
hudson.setCrumbIssuer(new TestCrumbIssuer()); jenkins.setCrumbIssuer(new TestCrumbIssuer());
hudson.servletContext.setAttribute("app",hudson); jenkins.servletContext.setAttribute("app", jenkins);
hudson.servletContext.setAttribute("version","?"); jenkins.servletContext.setAttribute("version","?");
WebAppMain.installExpressionFactory(new ServletContextEvent(hudson.servletContext)); WebAppMain.installExpressionFactory(new ServletContextEvent(jenkins.servletContext));
Mailer.descriptor().setHudsonUrl(getURL().toExternalForm()); Mailer.descriptor().setHudsonUrl(getURL().toExternalForm());
// set a default JDK to be the one that the harness is using. // set a default JDK to be the one that the harness is using.
hudson.getJDKs().add(new JDK("default",System.getProperty("java.home"))); jenkins.getJDKs().add(new JDK("default",System.getProperty("java.home")));
configureUpdateCenter(); configureUpdateCenter();
// expose the test instance as a part of URL tree. // expose the test instance as a part of URL tree.
// this allows tests to use a part of the URL space for itself. // this allows tests to use a part of the URL space for itself.
hudson.getActions().add(this); jenkins.getActions().add(this);
// cause all the descriptors to reload. // cause all the descriptors to reload.
// ideally we'd like to reset them to properly emulate the behavior, but that's not possible. // ideally we'd like to reset them to properly emulate the behavior, but that's not possible.
DescriptorImpl desc = Mailer.descriptor(); DescriptorImpl desc = Mailer.descriptor();
// prevent NPE with eclipse // prevent NPE with eclipse
if (desc != null) Mailer.descriptor().setHudsonUrl(null); if (desc != null) Mailer.descriptor().setHudsonUrl(null);
for( Descriptor d : hudson.getExtensionList(Descriptor.class) ) for( Descriptor d : jenkins.getExtensionList(Descriptor.class) )
d.load(); d.load();
// allow the test class to inject Jenkins components // allow the test class to inject Jenkins components
...@@ -352,7 +350,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -352,7 +350,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
DownloadService.neverUpdate = true; DownloadService.neverUpdate = true;
UpdateSite.neverUpdate = true; UpdateSite.neverUpdate = true;
PersistedList<UpdateSite> sites = hudson.getUpdateCenter().getSites(); PersistedList<UpdateSite> sites = jenkins.getUpdateCenter().getSites();
sites.clear(); sites.clear();
sites.add(new UpdateSite("default", updateCenterUrl)); sites.add(new UpdateSite("default", updateCenterUrl));
} }
...@@ -381,7 +379,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -381,7 +379,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
for (LenientRunnable r : tearDowns) for (LenientRunnable r : tearDowns)
r.run(); r.run();
hudson.cleanUp(); jenkins.cleanUp();
env.dispose(); env.dispose();
ExtensionList.clearLegacyInstances(); ExtensionList.clearLegacyInstances();
DescriptorExtensionList.clearLegacyInstances(); DescriptorExtensionList.clearLegacyInstances();
...@@ -454,7 +452,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -454,7 +452,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
public void setPluginManager(PluginManager pluginManager) { public void setPluginManager(PluginManager pluginManager) {
this.useLocalPluginManager = false; this.useLocalPluginManager = false;
this.pluginManager = pluginManager; this.pluginManager = pluginManager;
if (hudson!=null) if (jenkins !=null)
throw new IllegalStateException("Too late to override the plugin manager"); throw new IllegalStateException("Too late to override the plugin manager");
} }
...@@ -548,7 +546,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -548,7 +546,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
MavenInstallation mvn = configureDefaultMaven("apache-maven-3.0.1", MavenInstallation.MAVEN_30); MavenInstallation mvn = configureDefaultMaven("apache-maven-3.0.1", MavenInstallation.MAVEN_30);
MavenInstallation m3 = new MavenInstallation("apache-maven-3.0.1",mvn.getHome(), NO_PROPERTIES); MavenInstallation m3 = new MavenInstallation("apache-maven-3.0.1",mvn.getHome(), NO_PROPERTIES);
hudson.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(m3); jenkins.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(m3);
return m3; return m3;
} }
...@@ -562,7 +560,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -562,7 +560,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
File mavenAlreadyInstalled = new File(buildDirectory, mavenVersion); File mavenAlreadyInstalled = new File(buildDirectory, mavenVersion);
if (mavenAlreadyInstalled.exists()) { if (mavenAlreadyInstalled.exists()) {
MavenInstallation mavenInstallation = new MavenInstallation("default",mavenAlreadyInstalled.getAbsolutePath(), NO_PROPERTIES); MavenInstallation mavenInstallation = new MavenInstallation("default",mavenAlreadyInstalled.getAbsolutePath(), NO_PROPERTIES);
hudson.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(mavenInstallation); jenkins.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(mavenInstallation);
return mavenInstallation; return mavenInstallation;
} }
...@@ -571,7 +569,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -571,7 +569,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
if(home!=null) { if(home!=null) {
MavenInstallation mavenInstallation = new MavenInstallation("default",home, NO_PROPERTIES); MavenInstallation mavenInstallation = new MavenInstallation("default",home, NO_PROPERTIES);
if (mavenInstallation.meetsMavenReqVersion(createLocalLauncher(), mavenReqVersion)) { if (mavenInstallation.meetsMavenReqVersion(createLocalLauncher(), mavenReqVersion)) {
hudson.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(mavenInstallation); jenkins.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(mavenInstallation);
return mavenInstallation; return mavenInstallation;
} }
} }
...@@ -580,7 +578,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -580,7 +578,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
// this happens when a test is invoked from an IDE, for example. // this happens when a test is invoked from an IDE, for example.
LOGGER.warning("Extracting a copy of Maven bundled in the test harness. " + LOGGER.warning("Extracting a copy of Maven bundled in the test harness. " +
"To avoid a performance hit, set the system property 'maven.home' to point to a Maven2 installation."); "To avoid a performance hit, set the system property 'maven.home' to point to a Maven2 installation.");
FilePath mvn = hudson.getRootPath().createTempFile("maven", "zip"); FilePath mvn = jenkins.getRootPath().createTempFile("maven", "zip");
mvn.copyFrom(HudsonTestCase.class.getClassLoader().getResource(mavenVersion + "-bin.zip")); mvn.copyFrom(HudsonTestCase.class.getClassLoader().getResource(mavenVersion + "-bin.zip"));
File mvnHome = new File(buildDirectory); File mvnHome = new File(buildDirectory);
mvn.unzip(new FilePath(mvnHome)); mvn.unzip(new FilePath(mvnHome));
...@@ -590,7 +588,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -590,7 +588,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
MavenInstallation mavenInstallation = new MavenInstallation("default", MavenInstallation mavenInstallation = new MavenInstallation("default",
new File(mvnHome,mavenVersion).getAbsolutePath(), NO_PROPERTIES); new File(mvnHome,mavenVersion).getAbsolutePath(), NO_PROPERTIES);
hudson.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(mavenInstallation); jenkins.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(mavenInstallation);
return mavenInstallation; return mavenInstallation;
} }
...@@ -604,7 +602,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -604,7 +602,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
} else { } else {
LOGGER.warning("Extracting a copy of Ant bundled in the test harness. " + LOGGER.warning("Extracting a copy of Ant bundled in the test harness. " +
"To avoid a performance hit, set the environment variable ANT_HOME to point to an Ant installation."); "To avoid a performance hit, set the environment variable ANT_HOME to point to an Ant installation.");
FilePath ant = hudson.getRootPath().createTempFile("ant", "zip"); FilePath ant = jenkins.getRootPath().createTempFile("ant", "zip");
ant.copyFrom(HudsonTestCase.class.getClassLoader().getResource("apache-ant-1.8.1-bin.zip")); ant.copyFrom(HudsonTestCase.class.getClassLoader().getResource("apache-ant-1.8.1-bin.zip"));
File antHome = createTmpDir(); File antHome = createTmpDir();
ant.unzip(new FilePath(antHome)); ant.unzip(new FilePath(antHome));
...@@ -614,7 +612,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -614,7 +612,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
antInstallation = new AntInstallation("default", new File(antHome,"apache-ant-1.8.1").getAbsolutePath(),NO_PROPERTIES); antInstallation = new AntInstallation("default", new File(antHome,"apache-ant-1.8.1").getAbsolutePath(),NO_PROPERTIES);
} }
hudson.getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(antInstallation); jenkins.getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(antInstallation);
return antInstallation; return antInstallation;
} }
...@@ -627,7 +625,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -627,7 +625,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
} }
protected FreeStyleProject createFreeStyleProject(String name) throws IOException { protected FreeStyleProject createFreeStyleProject(String name) throws IOException {
return hudson.createProject(FreeStyleProject.class, name); return jenkins.createProject(FreeStyleProject.class, name);
} }
protected MatrixProject createMatrixProject() throws IOException { protected MatrixProject createMatrixProject() throws IOException {
...@@ -635,7 +633,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -635,7 +633,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
} }
protected MatrixProject createMatrixProject(String name) throws IOException { protected MatrixProject createMatrixProject(String name) throws IOException {
return hudson.createProject(MatrixProject.class, name); return jenkins.createProject(MatrixProject.class, name);
} }
/** /**
...@@ -653,13 +651,13 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -653,13 +651,13 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
* @see #configureDefaultMaven() * @see #configureDefaultMaven()
*/ */
protected MavenModuleSet createMavenProject(String name) throws IOException { protected MavenModuleSet createMavenProject(String name) throws IOException {
MavenModuleSet mavenModuleSet = hudson.createProject(MavenModuleSet.class,name); MavenModuleSet mavenModuleSet = jenkins.createProject(MavenModuleSet.class,name);
mavenModuleSet.setRunHeadless( true ); mavenModuleSet.setRunHeadless( true );
return mavenModuleSet; return mavenModuleSet;
} }
protected String createUniqueProjectName() { protected String createUniqueProjectName() {
return "test"+hudson.getItems().size(); return "test"+ jenkins.getItems().size();
} }
/** /**
...@@ -731,27 +729,27 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -731,27 +729,27 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
* Creates a slave with certain additional environment variables * Creates a slave with certain additional environment variables
*/ */
public DumbSlave createSlave(String labels, EnvVars env) throws Exception { public DumbSlave createSlave(String labels, EnvVars env) throws Exception {
synchronized (hudson) { synchronized (jenkins) {
int sz = hudson.getNodes().size(); int sz = jenkins.getNodes().size();
return createSlave("slave" + sz,labels,env); return createSlave("slave" + sz,labels,env);
} }
} }
public DumbSlave createSlave(String nodeName, String labels, EnvVars env) throws Exception { public DumbSlave createSlave(String nodeName, String labels, EnvVars env) throws Exception {
synchronized (hudson) { synchronized (jenkins) {
DumbSlave slave = new DumbSlave(nodeName, "dummy", DumbSlave slave = new DumbSlave(nodeName, "dummy",
createTmpDir().getPath(), "1", Mode.NORMAL, labels==null?"":labels, createComputerLauncher(env), createTmpDir().getPath(), "1", Mode.NORMAL, labels==null?"":labels, createComputerLauncher(env),
RetentionStrategy.NOOP, Collections.<NodeProperty<?>>emptyList()); RetentionStrategy.NOOP, Collections.<NodeProperty<?>>emptyList());
hudson.addNode(slave); jenkins.addNode(slave);
return slave; return slave;
} }
} }
public PretendSlave createPretendSlave(FakeLauncher faker) throws Exception { public PretendSlave createPretendSlave(FakeLauncher faker) throws Exception {
synchronized (hudson) { synchronized (jenkins) {
int sz = hudson.getNodes().size(); int sz = jenkins.getNodes().size();
PretendSlave slave = new PretendSlave("slave" + sz, createTmpDir().getPath(), "", createComputerLauncher(null), faker); PretendSlave slave = new PretendSlave("slave" + sz, createTmpDir().getPath(), "", createComputerLauncher(null), faker);
hudson.addNode(slave); jenkins.addNode(slave);
return slave; return slave;
} }
} }
...@@ -763,12 +761,12 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -763,12 +761,12 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
* Environment variables to add to the slave process. Can be null. * Environment variables to add to the slave process. Can be null.
*/ */
public CommandLauncher createComputerLauncher(EnvVars env) throws URISyntaxException, MalformedURLException { public CommandLauncher createComputerLauncher(EnvVars env) throws URISyntaxException, MalformedURLException {
int sz = hudson.getNodes().size(); int sz = jenkins.getNodes().size();
return new CommandLauncher( return new CommandLauncher(
String.format("\"%s/bin/java\" %s -jar \"%s\"", String.format("\"%s/bin/java\" %s -jar \"%s\"",
System.getProperty("java.home"), System.getProperty("java.home"),
SLAVE_DEBUG_PORT>0 ? " -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address="+(SLAVE_DEBUG_PORT+sz): "", SLAVE_DEBUG_PORT>0 ? " -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address="+(SLAVE_DEBUG_PORT+sz): "",
new File(hudson.getJnlpJars("slave.jar").getURL().toURI()).getAbsolutePath()), new File(jenkins.getJnlpJars("slave.jar").getURL().toURI()).getAbsolutePath()),
env); env);
} }
...@@ -903,7 +901,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -903,7 +901,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
protected <N extends Node> N configRoundtrip(N node) throws Exception { 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()); return (N) jenkins.getNode(node.getNodeName());
} }
protected <V extends View> V configRoundtrip(V view) throws Exception { protected <V extends View> V configRoundtrip(V view) throws Exception {
...@@ -1092,7 +1090,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -1092,7 +1090,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
public void assertHelpExists(final Class<? extends Describable> type, final String properties) throws Exception { public void assertHelpExists(final Class<? extends Describable> type, final String properties) throws Exception {
executeOnServer(new Callable<Object>() { executeOnServer(new Callable<Object>() {
public Object call() throws Exception { public Object call() throws Exception {
Descriptor d = hudson.getDescriptor(type); Descriptor d = jenkins.getDescriptor(type);
WebClient wc = createWebClient(); WebClient wc = createWebClient();
for (String property : listProperties(properties)) { for (String property : listProperties(properties)) {
String url = d.getHelpFile(property); String url = d.getHelpFile(property);
...@@ -1231,7 +1229,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -1231,7 +1229,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
} }
protected void setQuietPeriod(int qp) { protected void setQuietPeriod(int qp) {
JenkinsAdaptor.setQuietPeriod(hudson, qp); JenkinsAdaptor.setQuietPeriod(jenkins, qp);
} }
/** /**
...@@ -1306,7 +1304,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -1306,7 +1304,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
* Gets the descriptor instance of the current Hudson by its type. * Gets the descriptor instance of the current Hudson by its type.
*/ */
protected <T extends Descriptor<?>> T get(Class<T> d) { protected <T extends Descriptor<?>> T get(Class<T> d) {
return hudson.getDescriptorByType(d); return jenkins.getDescriptorByType(d);
} }
...@@ -1314,9 +1312,9 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -1314,9 +1312,9 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
* Returns true if Hudson is building something or going to build something. * Returns true if Hudson is building something or going to build something.
*/ */
protected boolean isSomethingHappening() { protected boolean isSomethingHappening() {
if (!hudson.getQueue().isEmpty()) if (!jenkins.getQueue().isEmpty())
return true; return true;
for (Computer n : hudson.getComputers()) for (Computer n : jenkins.getComputers())
if (!n.isIdle()) if (!n.isIdle())
return true; return true;
return false; return false;
...@@ -1351,14 +1349,14 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -1351,14 +1349,14 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
if (System.currentTimeMillis()-startTime > timeout) { if (System.currentTimeMillis()-startTime > timeout) {
List<Executable> building = new ArrayList<Executable>(); List<Executable> building = new ArrayList<Executable>();
for (Computer c : hudson.getComputers()) { for (Computer c : jenkins.getComputers()) {
for (Executor e : c.getExecutors()) { for (Executor e : c.getExecutors()) {
if (e.isBusy()) if (e.isBusy())
building.add(e.getCurrentExecutable()); building.add(e.getCurrentExecutable());
} }
} }
throw new AssertionError(String.format("Jenkins is still doing something after %dms: queue=%s building=%s", throw new AssertionError(String.format("Jenkins is still doing something after %dms: queue=%s building=%s",
timeout, Arrays.asList(hudson.getQueue().getItems()), building)); timeout, Arrays.asList(jenkins.getQueue().getItems()), building));
} }
} }
} }
...@@ -1689,7 +1687,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -1689,7 +1687,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
final Exception[] t = new Exception[1]; final Exception[] t = new Exception[1];
final List<V> r = new ArrayList<V>(1); // size 1 list final List<V> r = new ArrayList<V>(1); // size 1 list
ClosureExecuterAction cea = hudson.getExtensionList(RootAction.class).get(ClosureExecuterAction.class); ClosureExecuterAction cea = jenkins.getExtensionList(RootAction.class).get(ClosureExecuterAction.class);
UUID id = UUID.randomUUID(); UUID id = UUID.randomUUID();
cea.add(id,new Runnable() { cea.add(id,new Runnable() {
public void run() { public void run() {
...@@ -1823,8 +1821,8 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -1823,8 +1821,8 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
public WebRequestSettings addCrumb(WebRequestSettings req) { public WebRequestSettings addCrumb(WebRequestSettings req) {
NameValuePair crumb[] = { new NameValuePair() }; NameValuePair crumb[] = { new NameValuePair() };
crumb[0].setName(hudson.getCrumbIssuer().getDescriptor().getCrumbRequestField()); crumb[0].setName(jenkins.getCrumbIssuer().getDescriptor().getCrumbRequestField());
crumb[0].setValue(hudson.getCrumbIssuer().getCrumb( null )); crumb[0].setValue(jenkins.getCrumbIssuer().getCrumb( null ));
req.setRequestParameters(Arrays.asList( crumb )); req.setRequestParameters(Arrays.asList( crumb ));
return req; return req;
...@@ -1834,7 +1832,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -1834,7 +1832,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
* Creates a URL with crumb parameters relative to {{@link #getContextPath()} * Creates a URL with crumb parameters relative to {{@link #getContextPath()}
*/ */
public URL createCrumbedUrl(String relativePath) throws IOException { public URL createCrumbedUrl(String relativePath) throws IOException {
CrumbIssuer issuer = hudson.getCrumbIssuer(); CrumbIssuer issuer = jenkins.getCrumbIssuer();
String crumbName = issuer.getDescriptor().getCrumbRequestField(); String crumbName = issuer.getDescriptor().getCrumbRequestField();
String crumb = issuer.getCrumb(null); String crumb = issuer.getCrumb(null);
...@@ -1845,7 +1843,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { ...@@ -1845,7 +1843,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
* Makes an HTTP request, process it with the given request handler, and returns the response. * Makes an HTTP request, process it with the given request handler, and returns the response.
*/ */
public HtmlPage eval(final Runnable requestHandler) throws IOException, SAXException { public HtmlPage eval(final Runnable requestHandler) throws IOException, SAXException {
ClosureExecuterAction cea = hudson.getExtensionList(RootAction.class).get(ClosureExecuterAction.class); ClosureExecuterAction cea = jenkins.getExtensionList(RootAction.class).get(ClosureExecuterAction.class);
UUID id = UUID.randomUUID(); UUID id = UUID.randomUUID();
cea.add(id,requestHandler); cea.add(id,requestHandler);
return goTo("closures/?uuid="+id); return goTo("closures/?uuid="+id);
......
...@@ -53,8 +53,7 @@ import hudson.model.FileParameterDefinition ...@@ -53,8 +53,7 @@ import hudson.model.FileParameterDefinition
import hudson.model.Cause.LegacyCodeCause import hudson.model.Cause.LegacyCodeCause
import hudson.model.ParametersAction import hudson.model.ParametersAction
import hudson.model.FileParameterValue import hudson.model.FileParameterValue
import org.jvnet.hudson.test.MockBuilder
import org.jvnet.hudson.test.SleepBuilder
import java.util.concurrent.CountDownLatch import java.util.concurrent.CountDownLatch
/** /**
...@@ -209,7 +208,7 @@ public class MatrixProjectTest extends HudsonTestCase { ...@@ -209,7 +208,7 @@ public class MatrixProjectTest extends HudsonTestCase {
* Makes sure that the configuration correctly roundtrips. * Makes sure that the configuration correctly roundtrips.
*/ */
public void testConfigRoundtrip() { public void testConfigRoundtrip() {
hudson.getJDKs().addAll([ jenkins.getJDKs().addAll([
new JDK("jdk1.7","somewhere"), new JDK("jdk1.7","somewhere"),
new JDK("jdk1.6","here"), new JDK("jdk1.6","here"),
new JDK("jdk1.5","there")]); new JDK("jdk1.5","there")]);
...@@ -255,10 +254,10 @@ public class MatrixProjectTest extends HudsonTestCase { ...@@ -255,10 +254,10 @@ public class MatrixProjectTest extends HudsonTestCase {
System.out.println(p.labels); System.out.println(p.labels);
assertEquals(4,p.labels.size()); assertEquals(4,p.labels.size());
assertTrue(p.labels.contains(hudson.getLabel("slave0&&slave2"))); assertTrue(p.labels.contains(jenkins.getLabel("slave0&&slave2")));
assertTrue(p.labels.contains(hudson.getLabel("slave1&&slave2"))); assertTrue(p.labels.contains(jenkins.getLabel("slave1&&slave2")));
assertTrue(p.labels.contains(hudson.getLabel("slave0&&slave3"))); assertTrue(p.labels.contains(jenkins.getLabel("slave0&&slave3")));
assertTrue(p.labels.contains(hudson.getLabel("slave1&&slave3"))); assertTrue(p.labels.contains(jenkins.getLabel("slave1&&slave3")));
} }
/** /**
...@@ -283,7 +282,7 @@ public class MatrixProjectTest extends HudsonTestCase { ...@@ -283,7 +282,7 @@ public class MatrixProjectTest extends HudsonTestCase {
// have foo=1 block to make sure the 2nd configuration is in the queue // have foo=1 block to make sure the 2nd configuration is in the queue
firstStarted.block(); firstStarted.block();
// enter into the quiet down while foo=2 is still in the queue // enter into the quiet down while foo=2 is still in the queue
hudson.doQuietDown(); jenkins.doQuietDown();
buildCanProceed.signal(); buildCanProceed.signal();
// make sure foo=2 still completes. use time out to avoid hang // make sure foo=2 still completes. use time out to avoid hang
......
...@@ -24,13 +24,13 @@ ...@@ -24,13 +24,13 @@
package hudson.model package hudson.model
import com.gargoylesoftware.htmlunit.Page import com.gargoylesoftware.htmlunit.Page
import hudson.model.BuildListener
import hudson.slaves.EnvironmentVariablesNodeProperty import hudson.slaves.EnvironmentVariablesNodeProperty
import hudson.slaves.EnvironmentVariablesNodeProperty.Entry import hudson.slaves.EnvironmentVariablesNodeProperty.Entry
import junit.framework.Assert
import org.jvnet.hudson.test.CaptureEnvironmentBuilder import org.jvnet.hudson.test.CaptureEnvironmentBuilder
import org.jvnet.hudson.test.GroovyHudsonTestCase import org.jvnet.hudson.test.GroovyHudsonTestCase
import org.jvnet.hudson.test.ExtractResourceWithChangesSCM
import org.jvnet.hudson.test.FakeChangeLogSCM import org.jvnet.hudson.test.FakeChangeLogSCM
import org.jvnet.hudson.test.FailureBuilder import org.jvnet.hudson.test.FailureBuilder
import org.jvnet.hudson.test.UnstableBuilder import org.jvnet.hudson.test.UnstableBuilder
...@@ -38,7 +38,7 @@ import org.jvnet.hudson.test.UnstableBuilder ...@@ -38,7 +38,7 @@ import org.jvnet.hudson.test.UnstableBuilder
public class AbstractBuildTest extends GroovyHudsonTestCase { public class AbstractBuildTest extends GroovyHudsonTestCase {
void testVariablesResolved() { void testVariablesResolved() {
def project = createFreeStyleProject(); def project = createFreeStyleProject();
hudson.nodeProperties.replaceBy([ jenkins.nodeProperties.replaceBy([
new EnvironmentVariablesNodeProperty(new Entry("KEY1", "value"), new Entry("KEY2",'$KEY1'))]); new EnvironmentVariablesNodeProperty(new Entry("KEY1", "value"), new Entry("KEY2",'$KEY1'))]);
def builder = new CaptureEnvironmentBuilder(); def builder = new CaptureEnvironmentBuilder();
project.buildersList.add(builder); project.buildersList.add(builder);
......
...@@ -39,7 +39,7 @@ public class SlaveTest extends GroovyHudsonTestCase { ...@@ -39,7 +39,7 @@ public class SlaveTest extends GroovyHudsonTestCase {
*/ */
void testFormValidation() { void testFormValidation() {
executeOnServer { executeOnServer {
assertNotNull(hudson.getDescriptor(DumbSlave.class).getCheckUrl("remoteFS")) assertNotNull(jenkins.getDescriptor(DumbSlave.class).getCheckUrl("remoteFS"))
} }
} }
......
...@@ -38,7 +38,7 @@ public class UpdateCenter2Test extends HudsonTestCase { ...@@ -38,7 +38,7 @@ public class UpdateCenter2Test extends HudsonTestCase {
void testInstall() { void testInstall() {
UpdateSite.neverUpdate = false; UpdateSite.neverUpdate = false;
createWebClient().goTo("/") // load the metadata createWebClient().goTo("/") // load the metadata
def job = hudson.updateCenter.getPlugin("changelog-history").deploy().get(); // this seems like one of the smallest plugin def job = jenkins.updateCenter.getPlugin("changelog-history").deploy().get(); // this seems like one of the smallest plugin
println job.status; println job.status;
assertTrue(job.status instanceof Success) assertTrue(job.status instanceof Success)
} }
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
*/ */
package hudson; package hudson;
import hudson.PluginWrapper;
import org.jvnet.hudson.test.HudsonTestCase; import org.jvnet.hudson.test.HudsonTestCase;
import org.jvnet.hudson.test.recipes.LocalData; import org.jvnet.hudson.test.recipes.LocalData;
...@@ -49,7 +48,7 @@ public class ClassicPluginStrategyTest extends HudsonTestCase { ...@@ -49,7 +48,7 @@ public class ClassicPluginStrategyTest extends HudsonTestCase {
public void testDependencyClassLoader() throws Exception { public void testDependencyClassLoader() throws Exception {
// Test data has: foo3 depends on foo2,foo1; foo2 depends on foo1 // Test data has: foo3 depends on foo2,foo1; foo2 depends on foo1
// (thus findResources from foo3 can find foo1 resources via 2 dependency paths) // (thus findResources from foo3 can find foo1 resources via 2 dependency paths)
PluginWrapper p = hudson.getPluginManager().getPlugin("foo3"); PluginWrapper p = jenkins.getPluginManager().getPlugin("foo3");
String res = p.getIndexPage().toString(); String res = p.getIndexPage().toString();
assertTrue(res + "should be foo3", res.contains("/foo3/")); assertTrue(res + "should be foo3", res.contains("/foo3/"));
......
...@@ -32,7 +32,7 @@ public class ExtensionListTest extends HudsonTestCase { ...@@ -32,7 +32,7 @@ public class ExtensionListTest extends HudsonTestCase {
public void testAutoDiscovery() throws Exception { public void testAutoDiscovery() throws Exception {
ExtensionList<Animal> list = hudson.getExtensionList(Animal.class); ExtensionList<Animal> list = jenkins.getExtensionList(Animal.class);
assertEquals(2,list.size()); assertEquals(2,list.size());
assertNotNull(list.get(Dog.class)); assertNotNull(list.get(Dog.class));
assertNotNull(list.get(Cat.class)); assertNotNull(list.get(Cat.class));
...@@ -98,17 +98,17 @@ public class ExtensionListTest extends HudsonTestCase { ...@@ -98,17 +98,17 @@ public class ExtensionListTest extends HudsonTestCase {
public void testDescriptorLookup() throws Exception { public void testDescriptorLookup() throws Exception {
Descriptor<Fish> d = new Sishamo().getDescriptor(); Descriptor<Fish> d = new Sishamo().getDescriptor();
DescriptorExtensionList<Fish,Descriptor<Fish>> list = hudson.<Fish,Descriptor<Fish>>getDescriptorList(Fish.class); DescriptorExtensionList<Fish,Descriptor<Fish>> list = jenkins.<Fish,Descriptor<Fish>>getDescriptorList(Fish.class);
assertSame(d,list.get(Sishamo.DescriptorImpl.class)); assertSame(d,list.get(Sishamo.DescriptorImpl.class));
assertSame(d,hudson.getDescriptor(Sishamo.class)); assertSame(d, jenkins.getDescriptor(Sishamo.class));
} }
public void testFishDiscovery() throws Exception { public void testFishDiscovery() throws Exception {
// imagine that this is a static instance, like it is in many LIST static field in Hudson. // imagine that this is a static instance, like it is in many LIST static field in Hudson.
DescriptorList<Fish> LIST = new DescriptorList<Fish>(Fish.class); DescriptorList<Fish> LIST = new DescriptorList<Fish>(Fish.class);
DescriptorExtensionList<Fish,Descriptor<Fish>> list = hudson.<Fish,Descriptor<Fish>>getDescriptorList(Fish.class); DescriptorExtensionList<Fish,Descriptor<Fish>> list = jenkins.<Fish,Descriptor<Fish>>getDescriptorList(Fish.class);
assertEquals(2,list.size()); assertEquals(2,list.size());
assertNotNull(list.get(Tai.DescriptorImpl.class)); assertNotNull(list.get(Tai.DescriptorImpl.class));
assertNotNull(list.get(Saba.DescriptorImpl.class)); assertNotNull(list.get(Saba.DescriptorImpl.class));
...@@ -175,7 +175,7 @@ public class ExtensionListTest extends HudsonTestCase { ...@@ -175,7 +175,7 @@ public class ExtensionListTest extends HudsonTestCase {
* Makes sure sorting of the components work as expected. * Makes sure sorting of the components work as expected.
*/ */
public void testOrdinals() { public void testOrdinals() {
ExtensionList<Car> list = hudson.getExtensionList(Car.class); ExtensionList<Car> list = jenkins.getExtensionList(Car.class);
assertEquals("honda",list.get(0).name); assertEquals("honda",list.get(0).name);
assertEquals("mazda",list.get(1).name); assertEquals("mazda",list.get(1).name);
assertEquals("toyota",list.get(2).name); assertEquals("toyota",list.get(2).name);
......
...@@ -60,7 +60,7 @@ public class PluginManagerTest extends HudsonTestCase { ...@@ -60,7 +60,7 @@ public class PluginManagerTest extends HudsonTestCase {
f.getInputByName("name").setValueAttribute(plugin.getAbsolutePath()); f.getInputByName("name").setValueAttribute(plugin.getAbsolutePath());
submit(f); submit(f);
assertTrue( new File(hudson.getRootDir(),"plugins/tasks.jpi").exists() ); assertTrue( new File(jenkins.getRootDir(),"plugins/tasks.jpi").exists() );
} }
/** /**
...@@ -76,7 +76,7 @@ public class PluginManagerTest extends HudsonTestCase { ...@@ -76,7 +76,7 @@ public class PluginManagerTest extends HudsonTestCase {
submit(f); submit(f);
// uploaded legacy plugins get renamed to *.jpi // uploaded legacy plugins get renamed to *.jpi
assertTrue( new File(hudson.getRootDir(),"plugins/legacy.jpi").exists() ); assertTrue( new File(jenkins.getRootDir(),"plugins/legacy.jpi").exists() );
} }
/** /**
...@@ -84,7 +84,7 @@ public class PluginManagerTest extends HudsonTestCase { ...@@ -84,7 +84,7 @@ public class PluginManagerTest extends HudsonTestCase {
*/ */
@WithPlugin("tasks.jpi") @WithPlugin("tasks.jpi")
public void testWithRecipeJpi() throws Exception { public void testWithRecipeJpi() throws Exception {
assertNotNull(hudson.getPlugin("tasks")); assertNotNull(jenkins.getPlugin("tasks"));
} }
/** /**
...@@ -92,7 +92,7 @@ public class PluginManagerTest extends HudsonTestCase { ...@@ -92,7 +92,7 @@ public class PluginManagerTest extends HudsonTestCase {
*/ */
@WithPlugin("legacy.hpi") @WithPlugin("legacy.hpi")
public void testWithRecipeHpi() throws Exception { public void testWithRecipeHpi() throws Exception {
assertNotNull(hudson.getPlugin("legacy")); assertNotNull(jenkins.getPlugin("legacy"));
} }
/** /**
...@@ -101,7 +101,7 @@ public class PluginManagerTest extends HudsonTestCase { ...@@ -101,7 +101,7 @@ public class PluginManagerTest extends HudsonTestCase {
@WithPlugin("tasks.jpi") @WithPlugin("tasks.jpi")
public void testOptionalMavenDependency() throws Exception { public void testOptionalMavenDependency() throws Exception {
PluginWrapper.Dependency m2=null; PluginWrapper.Dependency m2=null;
PluginWrapper tasks = hudson.getPluginManager().getPlugin("tasks"); PluginWrapper tasks = jenkins.getPluginManager().getPlugin("tasks");
for( PluginWrapper.Dependency d : tasks.getOptionalDependencies() ) { for( PluginWrapper.Dependency d : tasks.getOptionalDependencies() ) {
if(d.shortName.equals("maven-plugin")) { if(d.shortName.equals("maven-plugin")) {
assertNull(m2); assertNull(m2);
...@@ -125,7 +125,7 @@ public class PluginManagerTest extends HudsonTestCase { ...@@ -125,7 +125,7 @@ public class PluginManagerTest extends HudsonTestCase {
@WithPlugin("tasks.jpi") @WithPlugin("tasks.jpi")
@WithPluginManager(PluginManagerImpl_for_testUberClassLoaderIsAvailableDuringStart.class) @WithPluginManager(PluginManagerImpl_for_testUberClassLoaderIsAvailableDuringStart.class)
public void testUberClassLoaderIsAvailableDuringStart() { public void testUberClassLoaderIsAvailableDuringStart() {
assertTrue(((PluginManagerImpl_for_testUberClassLoaderIsAvailableDuringStart)hudson.pluginManager).tested); assertTrue(((PluginManagerImpl_for_testUberClassLoaderIsAvailableDuringStart) jenkins.pluginManager).tested);
} }
public class PluginManagerImpl_for_testUberClassLoaderIsAvailableDuringStart extends LocalPluginManager { public class PluginManagerImpl_for_testUberClassLoaderIsAvailableDuringStart extends LocalPluginManager {
...@@ -163,7 +163,7 @@ public class PluginManagerTest extends HudsonTestCase { ...@@ -163,7 +163,7 @@ public class PluginManagerTest extends HudsonTestCase {
public void testUberClassLoaderDoesntUseContextClassLoader() throws Exception { public void testUberClassLoaderDoesntUseContextClassLoader() throws Exception {
Thread t = Thread.currentThread(); Thread t = Thread.currentThread();
URLClassLoader ucl = new URLClassLoader(new URL[0],hudson.pluginManager.uberClassLoader); URLClassLoader ucl = new URLClassLoader(new URL[0], jenkins.pluginManager.uberClassLoader);
ClassLoader old = t.getContextClassLoader(); ClassLoader old = t.getContextClassLoader();
t.setContextClassLoader(ucl); t.setContextClassLoader(ucl);
......
...@@ -31,13 +31,13 @@ public class PluginManagerTest2 extends HudsonTestCase { ...@@ -31,13 +31,13 @@ public class PluginManagerTest2 extends HudsonTestCase {
@WithPlugin("tasks.jpi") @WithPlugin("tasks.jpi")
public void testPinned() throws Exception { public void testPinned() throws Exception {
PluginWrapper tasks = hudson.getPluginManager().getPlugin("tasks"); PluginWrapper tasks = jenkins.getPluginManager().getPlugin("tasks");
assertFalse("tasks shouldn't be bundled",tasks.isBundled()); assertFalse("tasks shouldn't be bundled",tasks.isBundled());
assertFalse("tasks shouldn't be pinned before update",tasks.isPinned()); assertFalse("tasks shouldn't be pinned before update",tasks.isPinned());
uploadPlugin("tasks.jpi", false); uploadPlugin("tasks.jpi", false);
assertFalse("tasks shouldn't be pinned after update",tasks.isPinned()); assertFalse("tasks shouldn't be pinned after update",tasks.isPinned());
PluginWrapper cvs = hudson.getPluginManager().getPlugin("cvs"); PluginWrapper cvs = jenkins.getPluginManager().getPlugin("cvs");
assertTrue("cvs should be bundled",cvs.isBundled()); assertTrue("cvs should be bundled",cvs.isBundled());
assertFalse("cvs shouldn't be pinned before update",cvs.isPinned()); assertFalse("cvs shouldn't be pinned before update",cvs.isPinned());
uploadPlugin("cvs.hpi", true); uploadPlugin("cvs.hpi", true);
......
...@@ -61,7 +61,7 @@ public class JnlpAccessWithSecuredHudsonTest extends HudsonTestCase { ...@@ -61,7 +61,7 @@ public class JnlpAccessWithSecuredHudsonTest extends HudsonTestCase {
@PresetData(DataSet.NO_ANONYMOUS_READACCESS) @PresetData(DataSet.NO_ANONYMOUS_READACCESS)
@Email("http://www.nabble.com/Launching-slave-by-JNLP-with-Active-Directory-plugin-and-matrix-security-problem-td18980323.html") @Email("http://www.nabble.com/Launching-slave-by-JNLP-with-Active-Directory-plugin-and-matrix-security-problem-td18980323.html")
public void test() throws Exception { public void test() throws Exception {
hudson.setNodes(Collections.singletonList(createNewJnlpSlave("test"))); jenkins.setNodes(Collections.singletonList(createNewJnlpSlave("test")));
HudsonTestCase.WebClient wc = new WebClient(); HudsonTestCase.WebClient wc = new WebClient();
HtmlPage p = wc.login("alice").goTo("computer/test/"); HtmlPage p = wc.login("alice").goTo("computer/test/");
......
...@@ -60,7 +60,7 @@ public class TooManyJobsButNoViewTest extends HudsonTestCase { ...@@ -60,7 +60,7 @@ public class TooManyJobsButNoViewTest extends HudsonTestCase {
assertNotNull(p.getFormByName(mon.id)); assertNotNull(p.getFormByName(mon.id));
// once we create a view, the message should disappear // once we create a view, the message should disappear
hudson.addView(new ListView("test")); jenkins.addView(new ListView("test"));
verifyNoForm(); verifyNoForm();
} }
......
...@@ -37,12 +37,12 @@ import java.io.Writer; ...@@ -37,12 +37,12 @@ import java.io.Writer;
*/ */
public class MarkupFormatterTest extends HudsonTestCase { public class MarkupFormatterTest extends HudsonTestCase {
public void testConfigRoundtrip() throws Exception { public void testConfigRoundtrip() throws Exception {
hudson.setSecurityRealm(new HudsonPrivateSecurityRealm(false)); jenkins.setSecurityRealm(new HudsonPrivateSecurityRealm(false));
hudson.setAuthorizationStrategy(new Unsecured()); jenkins.setAuthorizationStrategy(new Unsecured());
hudson.setMarkupFormatter(new DummyMarkupImpl("hello")); jenkins.setMarkupFormatter(new DummyMarkupImpl("hello"));
configRoundtrip(); configRoundtrip();
assertEquals("hello", ((DummyMarkupImpl)hudson.getMarkupFormatter()).prefix); assertEquals("hello", ((DummyMarkupImpl) jenkins.getMarkupFormatter()).prefix);
} }
public static class DummyMarkupImpl extends MarkupFormatter { public static class DummyMarkupImpl extends MarkupFormatter {
......
...@@ -25,7 +25,7 @@ public class MatrixProjectDependencyTest extends HudsonTestCase { ...@@ -25,7 +25,7 @@ public class MatrixProjectDependencyTest extends HudsonTestCase {
FreeStyleProject freestyleProject = createFreeStyleProject(); FreeStyleProject freestyleProject = createFreeStyleProject();
matrixProject.getPublishersList().add(new BuildTrigger(freestyleProject.getName(), false)); matrixProject.getPublishersList().add(new BuildTrigger(freestyleProject.getName(), false));
hudson.rebuildDependencyGraph(); jenkins.rebuildDependencyGraph();
buildAndAssertSuccess(matrixProject); buildAndAssertSuccess(matrixProject);
waitUntilNoActivity(); waitUntilNoActivity();
...@@ -34,7 +34,7 @@ public class MatrixProjectDependencyTest extends HudsonTestCase { ...@@ -34,7 +34,7 @@ public class MatrixProjectDependencyTest extends HudsonTestCase {
assertEquals("There should only be one FreestyleBuild", 1, builds.size()); assertEquals("There should only be one FreestyleBuild", 1, builds.size());
FreeStyleBuild build = builds.iterator().next(); FreeStyleBuild build = builds.iterator().next();
assertEquals(Result.SUCCESS, build.getResult()); assertEquals(Result.SUCCESS, build.getResult());
List<AbstractProject> downstream = hudson.getDependencyGraph().getDownstream(matrixProject); List<AbstractProject> downstream = jenkins.getDependencyGraph().getDownstream(matrixProject);
assertTrue(downstream.contains(freestyleProject)); assertTrue(downstream.contains(freestyleProject));
} }
......
...@@ -54,7 +54,7 @@ public class MatrixTest extends HudsonTestCase { ...@@ -54,7 +54,7 @@ public class MatrixTest extends HudsonTestCase {
*/ */
@Bug(9293) @Bug(9293)
public void testConfigurationACL() throws Exception { public void testConfigurationACL() throws Exception {
hudson.setAuthorizationStrategy(new ProjectMatrixAuthorizationStrategy()); jenkins.setAuthorizationStrategy(new ProjectMatrixAuthorizationStrategy());
MatrixProject mp = createMatrixProject(); MatrixProject mp = createMatrixProject();
mp.setAxes(new AxisList(new Axis("foo", "a", "b"))); mp.setAxes(new AxisList(new Axis("foo", "a", "b")));
MatrixConfiguration mc = mp.getItem("foo=a"); MatrixConfiguration mc = mp.getItem("foo=a");
......
...@@ -54,7 +54,7 @@ import org.apache.commons.io.FileUtils; ...@@ -54,7 +54,7 @@ import org.apache.commons.io.FileUtils;
public class AbstractProjectTest extends HudsonTestCase { public class AbstractProjectTest extends HudsonTestCase {
public void testConfigRoundtrip() throws Exception { public void testConfigRoundtrip() throws Exception {
FreeStyleProject project = createFreeStyleProject(); FreeStyleProject project = createFreeStyleProject();
Label l = hudson.getLabel("foo && bar"); Label l = jenkins.getLabel("foo && bar");
project.setAssignedLabel(l); project.setAssignedLabel(l);
configRoundtrip((Item)project); configRoundtrip((Item)project);
...@@ -112,14 +112,14 @@ public class AbstractProjectTest extends HudsonTestCase { ...@@ -112,14 +112,14 @@ public class AbstractProjectTest extends HudsonTestCase {
*/ */
@PresetData(DataSet.ANONYMOUS_READONLY) @PresetData(DataSet.ANONYMOUS_READONLY)
public void testWipeWorkspaceProtected2() throws Exception { public void testWipeWorkspaceProtected2() throws Exception {
((GlobalMatrixAuthorizationStrategy)hudson.getAuthorizationStrategy()).add(AbstractProject.WORKSPACE,"anonymous"); ((GlobalMatrixAuthorizationStrategy) jenkins.getAuthorizationStrategy()).add(AbstractProject.WORKSPACE,"anonymous");
// make sure that the deletion is protected in the same way // make sure that the deletion is protected in the same way
testWipeWorkspaceProtected(); testWipeWorkspaceProtected();
// there shouldn't be any "wipe out workspace" link for anonymous user // there shouldn't be any "wipe out workspace" link for anonymous user
WebClient webClient = new WebClient(); WebClient webClient = new WebClient();
HtmlPage page = webClient.getPage(hudson.getItem("test0")); HtmlPage page = webClient.getPage(jenkins.getItem("test0"));
page = (HtmlPage)page.getFirstAnchorByText("Workspace").click(); page = (HtmlPage)page.getFirstAnchorByText("Workspace").click();
try { try {
......
...@@ -71,9 +71,9 @@ public class ApiTest extends HudsonTestCase { ...@@ -71,9 +71,9 @@ public class ApiTest extends HudsonTestCase {
} }
public void testUnwrappedLongString() throws Exception { public void testUnwrappedLongString() throws Exception {
hudson.setSystemMessage("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."); jenkins.setSystemMessage("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.");
Page page = new WebClient().goTo("api/xml?xpath=/hudson/description/text()", "text/plain"); Page page = new WebClient().goTo("api/xml?xpath=/hudson/description/text()", "text/plain");
assertEquals(hudson.getSystemMessage(), page.getWebResponse().getContentAsString()); assertEquals(jenkins.getSystemMessage(), page.getWebResponse().getContentAsString());
} }
public void testUnwrappedMultipleItems() throws Exception { public void testUnwrappedMultipleItems() throws Exception {
......
...@@ -30,7 +30,6 @@ import java.util.Collections; ...@@ -30,7 +30,6 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.acegisecurity.context.SecurityContext;
import org.acegisecurity.context.SecurityContextHolder; import org.acegisecurity.context.SecurityContextHolder;
import org.jvnet.hudson.test.HudsonTestCase; import org.jvnet.hudson.test.HudsonTestCase;
import org.jvnet.hudson.test.Bug; import org.jvnet.hudson.test.Bug;
...@@ -54,15 +53,15 @@ public class DependencyGraphTest extends HudsonTestCase { ...@@ -54,15 +53,15 @@ public class DependencyGraphTest extends HudsonTestCase {
new BuildTrigger(Collections.singletonList(down1), Result.SUCCESS)); new BuildTrigger(Collections.singletonList(down1), Result.SUCCESS));
// Add one downstream job with custom Dependency impl: // Add one downstream job with custom Dependency impl:
p.getBuildersList().add(new TestDeclarer(Result.UNSTABLE, down2)); p.getBuildersList().add(new TestDeclarer(Result.UNSTABLE, down2));
hudson.rebuildDependencyGraph(); jenkins.rebuildDependencyGraph();
// First build won't trigger down1 (Unstable doesn't meet threshold) // First build won't trigger down1 (Unstable doesn't meet threshold)
// but will trigger down2 (build #1 is odd). // but will trigger down2 (build #1 is odd).
Build b = (Build)p.scheduleBuild2(0, new Cause.UserCause()).get(); Build b = (Build)p.scheduleBuild2(0, new Cause.UserCause()).get();
String log = getLog(b); String log = getLog(b);
Queue.Item q = hudson.getQueue().getItem(down1); Queue.Item q = jenkins.getQueue().getItem(down1);
assertNull("down1 should not be triggered: " + log, q); assertNull("down1 should not be triggered: " + log, q);
assertNull("down1 should not be triggered: " + log, down1.getLastBuild()); assertNull("down1 should not be triggered: " + log, down1.getLastBuild());
q = hudson.getQueue().getItem(down2); q = jenkins.getQueue().getItem(down2);
assertNotNull("down2 should be in queue (quiet period): " + log, q); assertNotNull("down2 should be in queue (quiet period): " + log, q);
Run r = (Run)q.getFuture().get(6, TimeUnit.SECONDS); Run r = (Run)q.getFuture().get(6, TimeUnit.SECONDS);
assertNotNull("down2 should be triggered: " + log, r); assertNotNull("down2 should be triggered: " + log, r);
...@@ -70,16 +69,16 @@ public class DependencyGraphTest extends HudsonTestCase { ...@@ -70,16 +69,16 @@ public class DependencyGraphTest extends HudsonTestCase {
r.getAction(MailMessageIdAction.class)); r.getAction(MailMessageIdAction.class));
// Now change to success result.. // Now change to success result..
p.getBuildersList().replace(new TestDeclarer(Result.SUCCESS, down2)); p.getBuildersList().replace(new TestDeclarer(Result.SUCCESS, down2));
hudson.rebuildDependencyGraph(); jenkins.rebuildDependencyGraph();
// ..and next build will trigger down1 (Success meets threshold), // ..and next build will trigger down1 (Success meets threshold),
// but not down2 (build #2 is even) // but not down2 (build #2 is even)
b = (Build)p.scheduleBuild2(0, new Cause.UserCause()).get(); b = (Build)p.scheduleBuild2(0, new Cause.UserCause()).get();
log = getLog(b); log = getLog(b);
q = hudson.getQueue().getItem(down2); q = jenkins.getQueue().getItem(down2);
assertNull("down2 should not be triggered: " + log, q); assertNull("down2 should not be triggered: " + log, q);
assertEquals("down2 should not be triggered: " + log, 1, assertEquals("down2 should not be triggered: " + log, 1,
down2.getLastBuild().getNumber()); down2.getLastBuild().getNumber());
q = hudson.getQueue().getItem(down1); q = jenkins.getQueue().getItem(down1);
assertNotNull("down1 should be in queue (quiet period): " + log, q); assertNotNull("down1 should be in queue (quiet period): " + log, q);
r = (Run)q.getFuture().get(6, TimeUnit.SECONDS); r = (Run)q.getFuture().get(6, TimeUnit.SECONDS);
assertNotNull("down1 should be triggered", r); assertNotNull("down1 should be triggered", r);
...@@ -113,14 +112,14 @@ public class DependencyGraphTest extends HudsonTestCase { ...@@ -113,14 +112,14 @@ public class DependencyGraphTest extends HudsonTestCase {
@LocalData @Bug(5265) @LocalData @Bug(5265)
public void testItemReadPermission() throws Exception { public void testItemReadPermission() throws Exception {
// Rebuild dependency graph as anonymous user: // Rebuild dependency graph as anonymous user:
hudson.rebuildDependencyGraph(); jenkins.rebuildDependencyGraph();
try { try {
// Switch to full access to check results: // Switch to full access to check results:
ACL.impersonate(ACL.SYSTEM); ACL.impersonate(ACL.SYSTEM);
// @LocalData for this test has jobs w/o anonymous Item.READ // @LocalData for this test has jobs w/o anonymous Item.READ
AbstractProject up = (AbstractProject)hudson.getItem("hiddenUpstream"); AbstractProject up = (AbstractProject) jenkins.getItem("hiddenUpstream");
assertNotNull("hiddenUpstream project not found", up); assertNotNull("hiddenUpstream project not found", up);
List<AbstractProject> down = hudson.getDependencyGraph().getDownstream(up); List<AbstractProject> down = jenkins.getDependencyGraph().getDownstream(up);
assertEquals("Should have one downstream project", 1, down.size()); assertEquals("Should have one downstream project", 1, down.size());
} finally { } finally {
SecurityContextHolder.clearContext(); SecurityContextHolder.clearContext();
......
...@@ -40,7 +40,7 @@ public class ExecutorTest extends HudsonTestCase { ...@@ -40,7 +40,7 @@ public class ExecutorTest extends HudsonTestCase {
@Bug(4756) @Bug(4756)
public void testWhenAnExecuterIsYankedANewExecuterTakesItsPlace() throws Exception { public void testWhenAnExecuterIsYankedANewExecuterTakesItsPlace() throws Exception {
Computer c = hudson.toComputer(); Computer c = jenkins.toComputer();
Executor e = getExecutorByNumber(c, 0); Executor e = getExecutorByNumber(c, 0);
kill(e); kill(e);
......
...@@ -79,18 +79,18 @@ public class HudsonTest extends HudsonTestCase { ...@@ -79,18 +79,18 @@ public class HudsonTest extends HudsonTestCase {
submit(form); submit(form);
// make sure all the pieces are intact // make sure all the pieces are intact
assertEquals(2,hudson.getNumExecutors()); assertEquals(2, jenkins.getNumExecutors());
assertSame(Mode.NORMAL,hudson.getMode()); assertSame(Mode.NORMAL, jenkins.getMode());
assertSame(SecurityRealm.NO_AUTHENTICATION,hudson.getSecurityRealm()); assertSame(SecurityRealm.NO_AUTHENTICATION, jenkins.getSecurityRealm());
assertSame(AuthorizationStrategy.UNSECURED,hudson.getAuthorizationStrategy()); assertSame(AuthorizationStrategy.UNSECURED, jenkins.getAuthorizationStrategy());
assertEquals(5,hudson.getQuietPeriod()); assertEquals(5, jenkins.getQuietPeriod());
List<JDK> jdks = hudson.getJDKs(); List<JDK> jdks = jenkins.getJDKs();
assertEquals(3,jdks.size()); // Hudson adds one more assertEquals(3,jdks.size()); // Hudson adds one more
assertJDK(jdks.get(0),"jdk1","/tmp"); assertJDK(jdks.get(0),"jdk1","/tmp");
assertJDK(jdks.get(1),"jdk2","/tmp"); assertJDK(jdks.get(1),"jdk2","/tmp");
AntInstallation[] ants = hudson.getDescriptorByType(Ant.DescriptorImpl.class).getInstallations(); AntInstallation[] ants = jenkins.getDescriptorByType(Ant.DescriptorImpl.class).getInstallations();
assertEquals(2,ants.length); assertEquals(2,ants.length);
assertAnt(ants[0],"ant1","/tmp"); assertAnt(ants[0],"ant1","/tmp");
assertAnt(ants[1],"ant2","/tmp"); assertAnt(ants[1],"ant2","/tmp");
...@@ -174,10 +174,10 @@ public class HudsonTest extends HudsonTestCase { ...@@ -174,10 +174,10 @@ public class HudsonTest extends HudsonTestCase {
}; };
BuildStep.PUBLISHERS.addRecorder(dummy); BuildStep.PUBLISHERS.addRecorder(dummy);
assertSame(dummy,hudson.getDescriptor(HudsonTest.class.getName())); assertSame(dummy, jenkins.getDescriptor(HudsonTest.class.getName()));
BuildStep.PUBLISHERS.remove(dummy); BuildStep.PUBLISHERS.remove(dummy);
assertNull(hudson.getDescriptor(HudsonTest.class.getName())); assertNull(jenkins.getDescriptor(HudsonTest.class.getName()));
} }
/** /**
...@@ -188,10 +188,10 @@ public class HudsonTest extends HudsonTestCase { ...@@ -188,10 +188,10 @@ public class HudsonTest extends HudsonTestCase {
Field pv = Jenkins.class.getDeclaredField("primaryView"); Field pv = Jenkins.class.getDeclaredField("primaryView");
pv.setAccessible(true); pv.setAccessible(true);
String value = null; String value = null;
pv.set(hudson, value); pv.set(jenkins, value);
assertNull("null primaryView", hudson.getView(value)); assertNull("null primaryView", jenkins.getView(value));
value = "some bogus name"; value = "some bogus name";
pv.set(hudson, value); pv.set(jenkins, value);
assertNull("invalid primaryView", hudson.getView(value)); assertNull("invalid primaryView", jenkins.getView(value));
} }
} }
...@@ -53,7 +53,7 @@ public class JobPropertyTest extends HudsonTestCase { ...@@ -53,7 +53,7 @@ public class JobPropertyTest extends HudsonTestCase {
private void assertJobPropertySummaryIsShownInIndexPage(TopLevelItemDescriptor type) throws Exception { private void assertJobPropertySummaryIsShownInIndexPage(TopLevelItemDescriptor type) throws Exception {
JobPropertyImpl jp = new JobPropertyImpl("NeedleInPage"); JobPropertyImpl jp = new JobPropertyImpl("NeedleInPage");
Job<?,?> project = (Job<?, ?>) hudson.createProject(type, "job-test-case"); Job<?,?> project = (Job<?, ?>) jenkins.createProject(type, "job-test-case");
project.addProperty(jp); project.addProperty(jp);
HtmlPage page = new WebClient().goTo("job/job-test-case"); HtmlPage page = new WebClient().goTo("job/job-test-case");
......
...@@ -47,10 +47,10 @@ public class JobQueueTest extends HudsonTestCase { ...@@ -47,10 +47,10 @@ public class JobQueueTest extends HudsonTestCase {
assertTrue(project.isInQueue()); assertTrue(project.isInQueue());
//Cancel the project from queue //Cancel the project from queue
hudson.getQueue().cancel(project.getQueueItem()); jenkins.getQueue().cancel(project.getQueueItem());
//Verify the project is removed from Queue //Verify the project is removed from Queue
assertTrue(hudson.getQueue().isEmpty()); assertTrue(jenkins.getQueue().isEmpty());
} }
public void testBuildPendingWhenBuildInPostProduction() throws Exception { public void testBuildPendingWhenBuildInPostProduction() throws Exception {
...@@ -70,13 +70,13 @@ public class JobQueueTest extends HudsonTestCase { ...@@ -70,13 +70,13 @@ public class JobQueueTest extends HudsonTestCase {
//Schedule the build for the project and this build should be in Queue since the state is POST_PRODUCTION //Schedule the build for the project and this build should be in Queue since the state is POST_PRODUCTION
project.scheduleBuild2(0); project.scheduleBuild2(0);
assertTrue(project.isInQueue()); //That means its pending or its waiting or blocked assertTrue(project.isInQueue()); //That means its pending or its waiting or blocked
hudson.getQueue().maintain(); jenkins.getQueue().maintain();
while(hudson.getQueue().getItem(project) instanceof WaitingItem) { while(jenkins.getQueue().getItem(project) instanceof WaitingItem) {
System.out.println(hudson.getQueue().getItem(project)); System.out.println(jenkins.getQueue().getItem(project));
hudson.getQueue().maintain(); jenkins.getQueue().maintain();
Thread.sleep(10); Thread.sleep(10);
} }
assertTrue(hudson.getQueue().getItem(project) instanceof BlockedItem); //check is it is blocked assertTrue(jenkins.getQueue().getItem(project) instanceof BlockedItem); //check is it is blocked
} }
else { else {
fail("The maximum attemps for checking if the job is in POST_PRODUCTION State have reached"); fail("The maximum attemps for checking if the job is in POST_PRODUCTION State have reached");
...@@ -90,8 +90,8 @@ public class JobQueueTest extends HudsonTestCase { ...@@ -90,8 +90,8 @@ public class JobQueueTest extends HudsonTestCase {
if(JobQueueTest.fireFinalizeFlag) { if(JobQueueTest.fireFinalizeFlag) {
//Verify the build is removed from Queue since now it is in Completed state //Verify the build is removed from Queue since now it is in Completed state
//it should be scheduled for run //it should be scheduled for run
hudson.getQueue().maintain(); jenkins.getQueue().maintain();
assertFalse(hudson.getQueue().getItem(project) instanceof BlockedItem); assertFalse(jenkins.getQueue().getItem(project) instanceof BlockedItem);
} }
else { else {
fail("The maximum attemps for checking if the job is in COMPLETED State have reached"); fail("The maximum attemps for checking if the job is in COMPLETED State have reached");
......
...@@ -34,7 +34,6 @@ import java.util.concurrent.CountDownLatch; ...@@ -34,7 +34,6 @@ import java.util.concurrent.CountDownLatch;
import jenkins.model.ProjectNamingStrategy; import jenkins.model.ProjectNamingStrategy;
import org.junit.Test;
import org.jvnet.hudson.test.Bug; import org.jvnet.hudson.test.Bug;
import org.jvnet.hudson.test.HudsonTestCase; import org.jvnet.hudson.test.HudsonTestCase;
import org.jvnet.hudson.test.recipes.LocalData; import org.jvnet.hudson.test.recipes.LocalData;
...@@ -185,7 +184,7 @@ public class JobTest extends HudsonTestCase { ...@@ -185,7 +184,7 @@ public class JobTest extends HudsonTestCase {
@LocalData @LocalData
public void testConfigDotXmlPermission() throws Exception { public void testConfigDotXmlPermission() throws Exception {
hudson.setCrumbIssuer(null); jenkins.setCrumbIssuer(null);
WebClient wc = new WebClient(); WebClient wc = new WebClient();
boolean saveEnabled = Item.EXTENDED_READ.getEnabled(); boolean saveEnabled = Item.EXTENDED_READ.getEnabled();
Item.EXTENDED_READ.setEnabled(true); Item.EXTENDED_READ.setEnabled(true);
...@@ -226,7 +225,7 @@ public class JobTest extends HudsonTestCase { ...@@ -226,7 +225,7 @@ public class JobTest extends HudsonTestCase {
public void testGetArtifactsUpTo() throws Exception { public void testGetArtifactsUpTo() throws Exception {
// There was a bug where intermediate directories were counted, // There was a bug where intermediate directories were counted,
// so too few artifacts were returned. // so too few artifacts were returned.
Run r = hudson.getItemByFullName("testJob", Job.class).getLastCompletedBuild(); Run r = jenkins.getItemByFullName("testJob", Job.class).getLastCompletedBuild();
assertEquals(3, r.getArtifacts().size()); assertEquals(3, r.getArtifacts().size());
assertEquals(3, r.getArtifactsUpTo(3).size()); assertEquals(3, r.getArtifactsUpTo(3).size());
assertEquals(2, r.getArtifactsUpTo(2).size()); assertEquals(2, r.getArtifactsUpTo(2).size());
...@@ -245,7 +244,7 @@ public class JobTest extends HudsonTestCase { ...@@ -245,7 +244,7 @@ public class JobTest extends HudsonTestCase {
} }
public void testProjectNamingStrategy() throws Exception { public void testProjectNamingStrategy() throws Exception {
hudson.setProjectNamingStrategy(new ProjectNamingStrategy.PatternProjectNamingStrategy("DUMMY.*", false)); jenkins.setProjectNamingStrategy(new ProjectNamingStrategy.PatternProjectNamingStrategy("DUMMY.*", false));
final FreeStyleProject p = createFreeStyleProject("DUMMY_project"); final FreeStyleProject p = createFreeStyleProject("DUMMY_project");
assertNotNull("no project created", p); assertNotNull("no project created", p);
try { try {
...@@ -255,7 +254,7 @@ public class JobTest extends HudsonTestCase { ...@@ -255,7 +254,7 @@ public class JobTest extends HudsonTestCase {
// OK, expected // OK, expected
}finally{ }finally{
// set it back to the default naming strategy, otherwise all other tests would fail to create jobs! // set it back to the default naming strategy, otherwise all other tests would fail to create jobs!
hudson.setProjectNamingStrategy(ProjectNamingStrategy.DEFAULT_NAMING_STRATEGY); jenkins.setProjectNamingStrategy(ProjectNamingStrategy.DEFAULT_NAMING_STRATEGY);
} }
createFreeStyleProject("project"); createFreeStyleProject("project");
} }
......
...@@ -63,14 +63,14 @@ public class ParametersTest extends HudsonTestCase { ...@@ -63,14 +63,14 @@ public class ParametersTest extends HudsonTestCase {
assertEquals("run", ((HtmlElement) element.selectSingleNode("td[@class='setting-name']")).getTextContent()); assertEquals("run", ((HtmlElement) element.selectSingleNode("td[@class='setting-name']")).getTextContent());
submit(form); submit(form);
Queue.Item q = hudson.getQueue().getItem(project); Queue.Item q = jenkins.getQueue().getItem(project);
if (q != null) q.getFuture().get(); if (q != null) q.getFuture().get();
else Thread.sleep(1000); else Thread.sleep(1000);
assertEquals("newValue", builder.getEnvVars().get("STRING")); assertEquals("newValue", builder.getEnvVars().get("STRING"));
assertEquals("true", builder.getEnvVars().get("BOOLEAN")); assertEquals("true", builder.getEnvVars().get("BOOLEAN"));
assertEquals("Choice 1", builder.getEnvVars().get("CHOICE")); assertEquals("Choice 1", builder.getEnvVars().get("CHOICE"));
assertEquals(hudson.getRootUrl() + otherProject.getLastBuild().getUrl(), builder.getEnvVars().get("RUN")); assertEquals(jenkins.getRootUrl() + otherProject.getLastBuild().getUrl(), builder.getEnvVars().get("RUN"));
} }
public void testChoiceWithLTGT() throws Exception { public void testChoiceWithLTGT() throws Exception {
...@@ -96,7 +96,7 @@ public class ParametersTest extends HudsonTestCase { ...@@ -96,7 +96,7 @@ public class ParametersTest extends HudsonTestCase {
opt.setSelected(true); opt.setSelected(true);
submit(form); submit(form);
Queue.Item q = hudson.getQueue().getItem(project); Queue.Item q = jenkins.getQueue().getItem(project);
if (q != null) q.getFuture().get(); if (q != null) q.getFuture().get();
else Thread.sleep(1000); else Thread.sleep(1000);
......
...@@ -32,7 +32,6 @@ import hudson.matrix.MatrixProject; ...@@ -32,7 +32,6 @@ import hudson.matrix.MatrixProject;
import hudson.matrix.TextAxis; import hudson.matrix.TextAxis;
import hudson.model.Cause.*; import hudson.model.Cause.*;
import hudson.model.Queue.*; import hudson.model.Queue.*;
import hudson.model.Queue.*;
import hudson.tasks.Shell; import hudson.tasks.Shell;
import hudson.triggers.SCMTrigger.SCMTriggerCause; import hudson.triggers.SCMTrigger.SCMTriggerCause;
import hudson.triggers.TimerTrigger.TimerTriggerCause; import hudson.triggers.TimerTrigger.TimerTriggerCause;
...@@ -70,17 +69,17 @@ public class QueueTest extends HudsonTestCase { ...@@ -70,17 +69,17 @@ public class QueueTest extends HudsonTestCase {
* Checks the persistence of queue. * Checks the persistence of queue.
*/ */
public void testPersistence() throws Exception { public void testPersistence() throws Exception {
Queue q = hudson.getQueue(); Queue q = jenkins.getQueue();
// prevent execution to push stuff into the queue // prevent execution to push stuff into the queue
hudson.setNumExecutors(0); jenkins.setNumExecutors(0);
hudson.setNodes(hudson.getNodes()); jenkins.setNodes(jenkins.getNodes());
FreeStyleProject testProject = createFreeStyleProject("test"); FreeStyleProject testProject = createFreeStyleProject("test");
testProject.scheduleBuild(new UserIdCause()); testProject.scheduleBuild(new UserIdCause());
q.save(); q.save();
System.out.println(FileUtils.readFileToString(new File(hudson.getRootDir(), "queue.xml"))); System.out.println(FileUtils.readFileToString(new File(jenkins.getRootDir(), "queue.xml")));
assertEquals(1,q.getItems().length); assertEquals(1,q.getItems().length);
q.clear(); q.clear();
...@@ -98,17 +97,17 @@ public class QueueTest extends HudsonTestCase { ...@@ -98,17 +97,17 @@ public class QueueTest extends HudsonTestCase {
* Can {@link Queue} successfully recover removal? * Can {@link Queue} successfully recover removal?
*/ */
public void testPersistence2() throws Exception { public void testPersistence2() throws Exception {
Queue q = hudson.getQueue(); Queue q = jenkins.getQueue();
// prevent execution to push stuff into the queue // prevent execution to push stuff into the queue
hudson.setNumExecutors(0); jenkins.setNumExecutors(0);
hudson.setNodes(hudson.getNodes()); jenkins.setNodes(jenkins.getNodes());
FreeStyleProject testProject = createFreeStyleProject("test"); FreeStyleProject testProject = createFreeStyleProject("test");
testProject.scheduleBuild(new UserIdCause()); testProject.scheduleBuild(new UserIdCause());
q.save(); q.save();
System.out.println(FileUtils.readFileToString(new File(hudson.getRootDir(), "queue.xml"))); System.out.println(FileUtils.readFileToString(new File(jenkins.getRootDir(), "queue.xml")));
assertEquals(1,q.getItems().length); assertEquals(1,q.getItems().length);
q.clear(); q.clear();
......
...@@ -38,7 +38,7 @@ import org.kohsuke.stapler.StaplerRequest; ...@@ -38,7 +38,7 @@ import org.kohsuke.stapler.StaplerRequest;
public class ViewPropertyTest extends HudsonTestCase { public class ViewPropertyTest extends HudsonTestCase {
public void testRoundtrip() throws Exception { public void testRoundtrip() throws Exception {
ListView foo = new ListView("foo"); ListView foo = new ListView("foo");
hudson.addView(foo); jenkins.addView(foo);
// make sure it renders as optionalBlock // make sure it renders as optionalBlock
HtmlForm f = createWebClient().getPage(foo, "configure").getFormByName("viewConfig"); HtmlForm f = createWebClient().getPage(foo, "configure").getFormByName("viewConfig");
...@@ -74,7 +74,7 @@ public class ViewPropertyTest extends HudsonTestCase { ...@@ -74,7 +74,7 @@ public class ViewPropertyTest extends HudsonTestCase {
public void testInvisibleProperty() throws Exception { public void testInvisibleProperty() throws Exception {
ListView foo = new ListView("foo"); ListView foo = new ListView("foo");
hudson.addView(foo); jenkins.addView(foo);
// test the rendering (or the lack thereof) of an invisible property // test the rendering (or the lack thereof) of an invisible property
configRoundtrip(foo); configRoundtrip(foo);
......
...@@ -51,13 +51,13 @@ public class ViewTest extends HudsonTestCase { ...@@ -51,13 +51,13 @@ public class ViewTest extends HudsonTestCase {
*/ */
@Email("http://d.hatena.ne.jp/ssogabe/20090101/1230744150") @Email("http://d.hatena.ne.jp/ssogabe/20090101/1230744150")
public void testConflictingName() throws Exception { public void testConflictingName() throws Exception {
assertNull(hudson.getView("foo")); assertNull(jenkins.getView("foo"));
HtmlForm form = new WebClient().goTo("newView").getFormByName("createItem"); HtmlForm form = new WebClient().goTo("newView").getFormByName("createItem");
form.getInputByName("name").setValueAttribute("foo"); form.getInputByName("name").setValueAttribute("foo");
form.getRadioButtonsByName("mode").get(0).setChecked(true); form.getRadioButtonsByName("mode").get(0).setChecked(true);
submit(form); submit(form);
assertNotNull(hudson.getView("foo")); assertNotNull(jenkins.getView("foo"));
// do it again and verify an error // do it again and verify an error
try { try {
...@@ -82,8 +82,8 @@ public class ViewTest extends HudsonTestCase { ...@@ -82,8 +82,8 @@ public class ViewTest extends HudsonTestCase {
Text viewLabel = (Text) privateViewsPage.getFirstByXPath("//table[@id='viewList']//td[@class='active']/text()"); Text viewLabel = (Text) privateViewsPage.getFirstByXPath("//table[@id='viewList']//td[@class='active']/text()");
assertTrue("'All' view should be selected", viewLabel.getTextContent().contains(Hudson_ViewName())); assertTrue("'All' view should be selected", viewLabel.getTextContent().contains(Hudson_ViewName()));
View listView = new ListView("listView", hudson); View listView = new ListView("listView", jenkins);
hudson.addView(listView); jenkins.addView(listView);
HtmlPage newViewPage = wc.goTo("/user/me/my-views/newView"); HtmlPage newViewPage = wc.goTo("/user/me/my-views/newView");
HtmlForm form = newViewPage.getFormByName("createItem"); HtmlForm form = newViewPage.getFormByName("createItem");
...@@ -104,11 +104,11 @@ public class ViewTest extends HudsonTestCase { ...@@ -104,11 +104,11 @@ public class ViewTest extends HudsonTestCase {
public void testDeleteView() throws Exception { public void testDeleteView() throws Exception {
WebClient wc = new WebClient(); WebClient wc = new WebClient();
ListView v = new ListView("list", hudson); ListView v = new ListView("list", jenkins);
hudson.addView(v); jenkins.addView(v);
HtmlPage delete = wc.getPage(v, "delete"); HtmlPage delete = wc.getPage(v, "delete");
submit(delete.getFormByName("delete")); submit(delete.getFormByName("delete"));
assertNull(hudson.getView("list")); assertNull(jenkins.getView("list"));
User user = User.get("user", true); User user = User.get("user", true);
MyViewsProperty p = user.getProperty(MyViewsProperty.class); MyViewsProperty p = user.getProperty(MyViewsProperty.class);
...@@ -122,8 +122,8 @@ public class ViewTest extends HudsonTestCase { ...@@ -122,8 +122,8 @@ public class ViewTest extends HudsonTestCase {
@Bug(9367) @Bug(9367)
public void testPersistence() throws Exception { public void testPersistence() throws Exception {
ListView view = new ListView("foo", hudson); ListView view = new ListView("foo", jenkins);
hudson.addView(view); jenkins.addView(view);
ListView v = (ListView) Jenkins.XSTREAM.fromXML(Jenkins.XSTREAM.toXML(view)); ListView v = (ListView) Jenkins.XSTREAM.fromXML(Jenkins.XSTREAM.toXML(view));
System.out.println(v.getProperties()); System.out.println(v.getProperties());
......
...@@ -52,7 +52,7 @@ public class LabelAtomPropertyTest extends HudsonTestCase { ...@@ -52,7 +52,7 @@ public class LabelAtomPropertyTest extends HudsonTestCase {
* Tests the configuration persistence between disk, memory, and UI. * Tests the configuration persistence between disk, memory, and UI.
*/ */
public void testConfigRoundtrip() throws Exception { public void testConfigRoundtrip() throws Exception {
LabelAtom foo = hudson.getLabelAtom("foo"); LabelAtom foo = jenkins.getLabelAtom("foo");
LabelAtomPropertyImpl old = new LabelAtomPropertyImpl("value"); LabelAtomPropertyImpl old = new LabelAtomPropertyImpl("value");
foo.getProperties().add(old); foo.getProperties().add(old);
assertTrue(foo.getConfigFile().exists()); assertTrue(foo.getConfigFile().exists());
......
...@@ -68,13 +68,13 @@ public class LabelExpressionTest extends HudsonTestCase { ...@@ -68,13 +68,13 @@ public class LabelExpressionTest extends HudsonTestCase {
return true; return true;
} }
}); });
p1.setAssignedLabel(hudson.getLabel("win && 32bit")); p1.setAssignedLabel(jenkins.getLabel("win && 32bit"));
FreeStyleProject p2 = createFreeStyleProject(); FreeStyleProject p2 = createFreeStyleProject();
p2.setAssignedLabel(hudson.getLabel("win && 32bit")); p2.setAssignedLabel(jenkins.getLabel("win && 32bit"));
FreeStyleProject p3 = createFreeStyleProject(); FreeStyleProject p3 = createFreeStyleProject();
p3.setAssignedLabel(hudson.getLabel("win")); p3.setAssignedLabel(jenkins.getLabel("win"));
Future<FreeStyleBuild> f1 = p1.scheduleBuild2(0); Future<FreeStyleBuild> f1 = p1.scheduleBuild2(0);
...@@ -107,17 +107,17 @@ public class LabelExpressionTest extends HudsonTestCase { ...@@ -107,17 +107,17 @@ public class LabelExpressionTest extends HudsonTestCase {
FreeStyleProject p = createFreeStyleProject(); FreeStyleProject p = createFreeStyleProject();
p.setAssignedLabel(hudson.getLabel("!win")); p.setAssignedLabel(jenkins.getLabel("!win"));
FreeStyleBuild b = assertBuildStatusSuccess(p.scheduleBuild2(0)); FreeStyleBuild b = assertBuildStatusSuccess(p.scheduleBuild2(0));
assertSame(hudson,b.getBuiltOn()); assertSame(jenkins,b.getBuiltOn());
p.setAssignedLabel(hudson.getLabel("win")); p.setAssignedLabel(jenkins.getLabel("win"));
b = assertBuildStatusSuccess(p.scheduleBuild2(0)); b = assertBuildStatusSuccess(p.scheduleBuild2(0));
assertSame(s,b.getBuiltOn()); assertSame(s,b.getBuiltOn());
p.setAssignedLabel(hudson.getLabel("!win")); p.setAssignedLabel(jenkins.getLabel("!win"));
b = assertBuildStatusSuccess(p.scheduleBuild2(0)); b = assertBuildStatusSuccess(p.scheduleBuild2(0));
assertSame(hudson,b.getBuiltOn()); assertSame(jenkins,b.getBuiltOn());
} }
/** /**
...@@ -153,7 +153,7 @@ public class LabelExpressionTest extends HudsonTestCase { ...@@ -153,7 +153,7 @@ public class LabelExpressionTest extends HudsonTestCase {
public void testLaxParsing() { public void testLaxParsing() {
// this should parse as an atom // this should parse as an atom
LabelAtom l = (LabelAtom)hudson.getLabel("lucene.zones.apache.org (Solaris 10)"); LabelAtom l = (LabelAtom) jenkins.getLabel("lucene.zones.apache.org (Solaris 10)");
assertEquals(l.getName(),"lucene.zones.apache.org (Solaris 10)"); assertEquals(l.getName(),"lucene.zones.apache.org (Solaris 10)");
assertEquals(l.getExpression(),"\"lucene.zones.apache.org (Solaris 10)\""); assertEquals(l.getExpression(),"\"lucene.zones.apache.org (Solaris 10)\"");
} }
...@@ -161,11 +161,11 @@ public class LabelExpressionTest extends HudsonTestCase { ...@@ -161,11 +161,11 @@ public class LabelExpressionTest extends HudsonTestCase {
public void testDataCompatibilityWithHostNameWithWhitespace() throws Exception { public void testDataCompatibilityWithHostNameWithWhitespace() throws Exception {
DumbSlave slave = new DumbSlave("abc def (xyz) : test", "dummy", DumbSlave slave = new DumbSlave("abc def (xyz) : test", "dummy",
createTmpDir().getPath(), "1", Mode.NORMAL, "", createComputerLauncher(null), RetentionStrategy.NOOP, Collections.EMPTY_LIST); createTmpDir().getPath(), "1", Mode.NORMAL, "", createComputerLauncher(null), RetentionStrategy.NOOP, Collections.EMPTY_LIST);
hudson.addNode(slave); jenkins.addNode(slave);
FreeStyleProject p = createFreeStyleProject(); FreeStyleProject p = createFreeStyleProject();
p.setAssignedLabel(hudson.getLabel("abc def")); p.setAssignedLabel(jenkins.getLabel("abc def"));
assertEquals("abc def",p.getAssignedLabel().getName()); assertEquals("abc def",p.getAssignedLabel().getName());
assertEquals("\"abc def\"",p.getAssignedLabel().getExpression()); assertEquals("\"abc def\"",p.getAssignedLabel().getExpression());
...@@ -180,7 +180,7 @@ public class LabelExpressionTest extends HudsonTestCase { ...@@ -180,7 +180,7 @@ public class LabelExpressionTest extends HudsonTestCase {
} }
public void testQuote() { public void testQuote() {
Label l = hudson.getLabel("\"abc\\\\\\\"def\""); Label l = jenkins.getLabel("\"abc\\\\\\\"def\"");
assertEquals("abc\\\"def",l.getName()); assertEquals("abc\\\"def",l.getName());
} }
...@@ -188,14 +188,14 @@ public class LabelExpressionTest extends HudsonTestCase { ...@@ -188,14 +188,14 @@ public class LabelExpressionTest extends HudsonTestCase {
* The name should have parenthesis at the right place to preserve the tree structure. * The name should have parenthesis at the right place to preserve the tree structure.
*/ */
public void testComposite() { public void testComposite() {
LabelAtom x = hudson.getLabelAtom("x"); LabelAtom x = jenkins.getLabelAtom("x");
assertEquals("!!x",x.not().not().getName()); assertEquals("!!x",x.not().not().getName());
assertEquals("(x||x)&&x",x.or(x).and(x).getName()); assertEquals("(x||x)&&x",x.or(x).and(x).getName());
assertEquals("x&&x||x",x.and(x).or(x).getName()); assertEquals("x&&x||x",x.and(x).or(x).getName());
} }
public void testDash() { public void testDash() {
hudson.getLabelAtom("solaris-x86"); jenkins.getLabelAtom("solaris-x86");
} }
private void parseShouldFail(String expr) { private void parseShouldFail(String expr) {
......
...@@ -63,7 +63,7 @@ public class ItemListenerTest extends HudsonTestCase { ...@@ -63,7 +63,7 @@ public class ItemListenerTest extends HudsonTestCase {
+ "<buildWrappers/></project>").getBytes()), + "<buildWrappers/></project>").getBytes()),
out, out); out, out);
out.flush(); out.flush();
assertNotNull("job should be created: " + buf, hudson.getItem("testJob")); assertNotNull("job should be created: " + buf, jenkins.getItem("testJob"));
assertEquals("onCreated event should be triggered: " + buf, "C", events.toString()); assertEquals("onCreated event should be triggered: " + buf, "C", events.toString());
} finally { } finally {
cli.close(); cli.close();
......
...@@ -18,7 +18,7 @@ import junit.framework.Assert; ...@@ -18,7 +18,7 @@ import junit.framework.Assert;
public class CliAuthenticationTest extends HudsonTestCase { public class CliAuthenticationTest extends HudsonTestCase {
public void test1() throws Exception { public void test1() throws Exception {
// dummy security realm that authenticates when username==password // dummy security realm that authenticates when username==password
hudson.setSecurityRealm(createDummySecurityRealm()); jenkins.setSecurityRealm(createDummySecurityRealm());
successfulCommand("test","--username","abc","--password","abc"); successfulCommand("test","--username","abc","--password","abc");
} }
...@@ -69,7 +69,7 @@ public class CliAuthenticationTest extends HudsonTestCase { ...@@ -69,7 +69,7 @@ public class CliAuthenticationTest extends HudsonTestCase {
@For({LoginCommand.class, LogoutCommand.class, ClientAuthenticationCache.class}) @For({LoginCommand.class, LogoutCommand.class, ClientAuthenticationCache.class})
public void testLogin() throws Exception { public void testLogin() throws Exception {
hudson.setSecurityRealm(createDummySecurityRealm()); jenkins.setSecurityRealm(createDummySecurityRealm());
successfulCommand("login","--username","abc","--password","abc"); successfulCommand("login","--username","abc","--password","abc");
successfulCommand("test"); // now we can run without an explicit credential successfulCommand("test"); // now we can run without an explicit credential
......
...@@ -42,7 +42,7 @@ public class ExtendedReadPermissionTest extends HudsonTestCase { ...@@ -42,7 +42,7 @@ public class ExtendedReadPermissionTest extends HudsonTestCase {
public void testReadOnlyConfigAccessWithPermissionEnabled() throws Exception { public void testReadOnlyConfigAccessWithPermissionEnabled() throws Exception {
setPermissionEnabled(true); setPermissionEnabled(true);
AuthorizationStrategy as = hudson.getAuthorizationStrategy(); AuthorizationStrategy as = jenkins.getAuthorizationStrategy();
assertTrue("Expecting GlobalMatrixAuthorizationStrategy", (as instanceof GlobalMatrixAuthorizationStrategy)); assertTrue("Expecting GlobalMatrixAuthorizationStrategy", (as instanceof GlobalMatrixAuthorizationStrategy));
GlobalMatrixAuthorizationStrategy gas = (GlobalMatrixAuthorizationStrategy)as; GlobalMatrixAuthorizationStrategy gas = (GlobalMatrixAuthorizationStrategy)as;
assertTrue("Charlie should have extended read for this test", gas.hasExplicitPermission("charlie",Item.EXTENDED_READ)); assertTrue("Charlie should have extended read for this test", gas.hasExplicitPermission("charlie",Item.EXTENDED_READ));
...@@ -58,7 +58,7 @@ public class ExtendedReadPermissionTest extends HudsonTestCase { ...@@ -58,7 +58,7 @@ public class ExtendedReadPermissionTest extends HudsonTestCase {
public void testReadOnlyConfigAccessWithPermissionDisabled() throws Exception { public void testReadOnlyConfigAccessWithPermissionDisabled() throws Exception {
setPermissionEnabled(false); setPermissionEnabled(false);
AuthorizationStrategy as = hudson.getAuthorizationStrategy(); AuthorizationStrategy as = jenkins.getAuthorizationStrategy();
assertTrue("Expecting GlobalMatrixAuthorizationStrategy", (as instanceof GlobalMatrixAuthorizationStrategy)); assertTrue("Expecting GlobalMatrixAuthorizationStrategy", (as instanceof GlobalMatrixAuthorizationStrategy));
GlobalMatrixAuthorizationStrategy gas = (GlobalMatrixAuthorizationStrategy)as; GlobalMatrixAuthorizationStrategy gas = (GlobalMatrixAuthorizationStrategy)as;
assertFalse("Charlie should not have extended read for this test", gas.hasExplicitPermission("charlie",Item.EXTENDED_READ)); assertFalse("Charlie should not have extended read for this test", gas.hasExplicitPermission("charlie",Item.EXTENDED_READ));
...@@ -79,7 +79,7 @@ public class ExtendedReadPermissionTest extends HudsonTestCase { ...@@ -79,7 +79,7 @@ public class ExtendedReadPermissionTest extends HudsonTestCase {
public void testNoConfigAccessWithPermissionEnabled() throws Exception { public void testNoConfigAccessWithPermissionEnabled() throws Exception {
setPermissionEnabled(true); setPermissionEnabled(true);
AuthorizationStrategy as = hudson.getAuthorizationStrategy(); AuthorizationStrategy as = jenkins.getAuthorizationStrategy();
assertTrue("Expecting GlobalMatrixAuthorizationStrategy", (as instanceof GlobalMatrixAuthorizationStrategy)); assertTrue("Expecting GlobalMatrixAuthorizationStrategy", (as instanceof GlobalMatrixAuthorizationStrategy));
GlobalMatrixAuthorizationStrategy gas = (GlobalMatrixAuthorizationStrategy)as; GlobalMatrixAuthorizationStrategy gas = (GlobalMatrixAuthorizationStrategy)as;
assertFalse("Bob should not have extended read for this test", gas.hasExplicitPermission("bob",Item.EXTENDED_READ)); assertFalse("Bob should not have extended read for this test", gas.hasExplicitPermission("bob",Item.EXTENDED_READ));
......
...@@ -18,10 +18,10 @@ import org.jvnet.hudson.test.HudsonTestCase; ...@@ -18,10 +18,10 @@ import org.jvnet.hudson.test.HudsonTestCase;
public class DefaultCrumbIssuerTest extends HudsonTestCase { public class DefaultCrumbIssuerTest extends HudsonTestCase {
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp(); super.setUp();
assertNotNull(hudson); assertNotNull(jenkins);
CrumbIssuer issuer = new DefaultCrumbIssuer(false); CrumbIssuer issuer = new DefaultCrumbIssuer(false);
assertNotNull(issuer); assertNotNull(issuer);
hudson.setCrumbIssuer(issuer); jenkins.setCrumbIssuer(issuer);
} }
private static final String[] testData = { private static final String[] testData = {
...@@ -85,7 +85,7 @@ public class DefaultCrumbIssuerTest extends HudsonTestCase { ...@@ -85,7 +85,7 @@ public class DefaultCrumbIssuerTest extends HudsonTestCase {
public void testProxyCompatibilityMode() throws Exception { public void testProxyCompatibilityMode() throws Exception {
CrumbIssuer issuer = new DefaultCrumbIssuer(true); CrumbIssuer issuer = new DefaultCrumbIssuer(true);
assertNotNull(issuer); assertNotNull(issuer);
hudson.setCrumbIssuer(issuer); jenkins.setCrumbIssuer(issuer);
WebClient wc = new WebClient(); WebClient wc = new WebClient();
wc.addRequestHeader(HEADER_NAME, testData[0]); wc.addRequestHeader(HEADER_NAME, testData[0]);
......
...@@ -43,11 +43,11 @@ public class EnvironmentVariableNodePropertyTest extends HudsonTestCase { ...@@ -43,11 +43,11 @@ public class EnvironmentVariableNodePropertyTest extends HudsonTestCase {
* Master properties are available * Master properties are available
*/ */
public void testMasterPropertyOnMaster() throws Exception { public void testMasterPropertyOnMaster() throws Exception {
hudson.getGlobalNodeProperties().replaceBy( jenkins.getGlobalNodeProperties().replaceBy(
Collections.singleton(new EnvironmentVariablesNodeProperty( Collections.singleton(new EnvironmentVariablesNodeProperty(
new Entry("KEY", "masterValue")))); new Entry("KEY", "masterValue"))));
Map<String, String> envVars = executeBuild(hudson); Map<String, String> envVars = executeBuild(jenkins);
Assert.assertEquals("masterValue", envVars.get("KEY")); Assert.assertEquals("masterValue", envVars.get("KEY"));
} }
...@@ -56,7 +56,7 @@ public class EnvironmentVariableNodePropertyTest extends HudsonTestCase { ...@@ -56,7 +56,7 @@ public class EnvironmentVariableNodePropertyTest extends HudsonTestCase {
* Both slave and master properties are available, but slave properties have priority * Both slave and master properties are available, but slave properties have priority
*/ */
public void testSlaveAndMasterPropertyOnSlave() throws Exception { public void testSlaveAndMasterPropertyOnSlave() throws Exception {
hudson.getGlobalNodeProperties().replaceBy( jenkins.getGlobalNodeProperties().replaceBy(
Collections.singleton(new EnvironmentVariablesNodeProperty( Collections.singleton(new EnvironmentVariablesNodeProperty(
new Entry("KEY", "masterValue")))); new Entry("KEY", "masterValue"))));
setVariables(slave, new Entry("KEY", "slaveValue")); setVariables(slave, new Entry("KEY", "slaveValue"));
...@@ -77,7 +77,7 @@ public class EnvironmentVariableNodePropertyTest extends HudsonTestCase { ...@@ -77,7 +77,7 @@ public class EnvironmentVariableNodePropertyTest extends HudsonTestCase {
new StringParameterDefinition("KEY", "parameterValue")); new StringParameterDefinition("KEY", "parameterValue"));
project.addProperty(pdp); project.addProperty(pdp);
setVariables(hudson, new Entry("KEY", "masterValue")); setVariables(jenkins, new Entry("KEY", "masterValue"));
setVariables(slave, new Entry("KEY", "slaveValue")); setVariables(slave, new Entry("KEY", "slaveValue"));
Map<String, String> envVars = executeBuild(slave); Map<String, String> envVars = executeBuild(slave);
...@@ -86,27 +86,27 @@ public class EnvironmentVariableNodePropertyTest extends HudsonTestCase { ...@@ -86,27 +86,27 @@ public class EnvironmentVariableNodePropertyTest extends HudsonTestCase {
} }
public void testVariableResolving() throws Exception { public void testVariableResolving() throws Exception {
hudson.getGlobalNodeProperties().replaceBy( jenkins.getGlobalNodeProperties().replaceBy(
Collections.singleton(new EnvironmentVariablesNodeProperty( Collections.singleton(new EnvironmentVariablesNodeProperty(
new Entry("KEY1", "value"), new Entry("KEY2", "$KEY1")))); new Entry("KEY1", "value"), new Entry("KEY2", "$KEY1"))));
Map<String,String> envVars = executeBuild(hudson); Map<String,String> envVars = executeBuild(jenkins);
Assert.assertEquals("value", envVars.get("KEY1")); Assert.assertEquals("value", envVars.get("KEY1"));
Assert.assertEquals("value", envVars.get("KEY2")); Assert.assertEquals("value", envVars.get("KEY2"));
} }
public void testFormRoundTripForMaster() throws Exception { public void testFormRoundTripForMaster() throws Exception {
hudson.getGlobalNodeProperties().replaceBy( jenkins.getGlobalNodeProperties().replaceBy(
Collections.singleton(new EnvironmentVariablesNodeProperty( Collections.singleton(new EnvironmentVariablesNodeProperty(
new Entry("KEY", "value")))); new Entry("KEY", "value"))));
WebClient webClient = new WebClient(); WebClient webClient = new WebClient();
HtmlPage page = webClient.getPage(hudson, "configure"); HtmlPage page = webClient.getPage(jenkins, "configure");
HtmlForm form = page.getFormByName("config"); HtmlForm form = page.getFormByName("config");
submit(form); submit(form);
Assert.assertEquals(1, hudson.getGlobalNodeProperties().toList().size()); Assert.assertEquals(1, jenkins.getGlobalNodeProperties().toList().size());
EnvironmentVariablesNodeProperty prop = hudson.getGlobalNodeProperties().get(EnvironmentVariablesNodeProperty.class); EnvironmentVariablesNodeProperty prop = jenkins.getGlobalNodeProperties().get(EnvironmentVariablesNodeProperty.class);
Assert.assertEquals(1, prop.getEnvVars().size()); Assert.assertEquals(1, prop.getEnvVars().size());
Assert.assertEquals("value", prop.getEnvVars().get("KEY")); Assert.assertEquals("value", prop.getEnvVars().get("KEY"));
} }
......
...@@ -31,7 +31,6 @@ import hudson.model.Computer; ...@@ -31,7 +31,6 @@ import hudson.model.Computer;
import hudson.model.Node; import hudson.model.Node;
import hudson.model.Node.Mode; import hudson.model.Node.Mode;
import hudson.model.Slave; import hudson.model.Slave;
import hudson.model.TaskListener;
import hudson.remoting.Callable; import hudson.remoting.Callable;
import hudson.remoting.Which; import hudson.remoting.Which;
import hudson.util.ArgumentListBuilder; import hudson.util.ArgumentListBuilder;
...@@ -41,7 +40,6 @@ import org.jvnet.hudson.test.TestExtension; ...@@ -41,7 +40,6 @@ import org.jvnet.hudson.test.TestExtension;
import javax.inject.Inject; import javax.inject.Inject;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -146,12 +144,12 @@ public class JNLPLauncherTest extends HudsonTestCase { ...@@ -146,12 +144,12 @@ public class JNLPLauncherTest extends HudsonTestCase {
* Adds a JNLP {@link Slave} to the system and returns it. * Adds a JNLP {@link Slave} to the system and returns it.
*/ */
private Computer addTestSlave() throws Exception { private Computer addTestSlave() throws Exception {
List<Node> slaves = new ArrayList<Node>(hudson.getNodes()); List<Node> slaves = new ArrayList<Node>(jenkins.getNodes());
File dir = Util.createTempDir(); File dir = Util.createTempDir();
slaves.add(new DumbSlave("test","dummy",dir.getAbsolutePath(),"1", Mode.NORMAL, "", slaves.add(new DumbSlave("test","dummy",dir.getAbsolutePath(),"1", Mode.NORMAL, "",
new JNLPLauncher(), RetentionStrategy.INSTANCE, new ArrayList<NodeProperty<?>>())); new JNLPLauncher(), RetentionStrategy.INSTANCE, new ArrayList<NodeProperty<?>>()));
hudson.setNodes(slaves); jenkins.setNodes(slaves);
Computer c = hudson.getComputer("test"); Computer c = jenkins.getComputer("test");
assertNotNull(c); assertNotNull(c);
return c; return c;
} }
......
...@@ -49,7 +49,7 @@ public class NodeCanTakeTaskTest extends HudsonTestCase { ...@@ -49,7 +49,7 @@ public class NodeCanTakeTaskTest extends HudsonTestCase {
super.setUp(); super.setUp();
// Set master executor count to zero to force all jobs to slaves // Set master executor count to zero to force all jobs to slaves
hudson.setNumExecutors(0); jenkins.setNumExecutors(0);
} }
public void testTakeBlockedByProperty() throws Exception { public void testTakeBlockedByProperty() throws Exception {
...@@ -68,7 +68,7 @@ public class NodeCanTakeTaskTest extends HudsonTestCase { ...@@ -68,7 +68,7 @@ public class NodeCanTakeTaskTest extends HudsonTestCase {
build.get(10, TimeUnit.SECONDS); build.get(10, TimeUnit.SECONDS);
fail("Expected timeout exception"); fail("Expected timeout exception");
} catch (TimeoutException e) { } catch (TimeoutException e) {
List<BuildableItem> buildables = hudson.getQueue().getBuildableItems(); List<BuildableItem> buildables = jenkins.getQueue().getBuildableItems();
Assert.assertNotNull(buildables); Assert.assertNotNull(buildables);
Assert.assertEquals(1, buildables.size()); Assert.assertEquals(1, buildables.size());
......
...@@ -51,13 +51,13 @@ public class NodePropertyTest extends HudsonTestCase { ...@@ -51,13 +51,13 @@ public class NodePropertyTest extends HudsonTestCase {
HtmlForm f = createWebClient().goTo("/computer/" + s.getNodeName() + "/configure").getFormByName("config"); HtmlForm f = createWebClient().goTo("/computer/" + s.getNodeName() + "/configure").getFormByName("config");
((HtmlLabel)f.selectSingleNode(".//LABEL[text()='Some Property']")).click(); ((HtmlLabel)f.selectSingleNode(".//LABEL[text()='Some Property']")).click();
submit(f); submit(f);
PropertyImpl p = hudson.getNode(s.getNodeName()).getNodeProperties().get(PropertyImpl.class); PropertyImpl p = jenkins.getNode(s.getNodeName()).getNodeProperties().get(PropertyImpl.class);
assertEquals("Duke",p.name); assertEquals("Duke",p.name);
p.name = "Kohsuke"; p.name = "Kohsuke";
configRoundtrip(s); configRoundtrip(s);
PropertyImpl p2 = hudson.getNode(s.getNodeName()).getNodeProperties().get(PropertyImpl.class); PropertyImpl p2 = jenkins.getNode(s.getNodeName()).getNodeProperties().get(PropertyImpl.class);
assertNotSame(p,p2); assertNotSame(p,p2);
assertEqualDataBoundBeans(p,p2); assertEqualDataBoundBeans(p,p2);
} }
......
...@@ -28,7 +28,6 @@ import hudson.Launcher; ...@@ -28,7 +28,6 @@ import hudson.Launcher;
import hudson.model.*; import hudson.model.*;
import hudson.slaves.NodeProvisioner.NodeProvisionerInvoker; import hudson.slaves.NodeProvisioner.NodeProvisionerInvoker;
import hudson.tasks.Builder; import hudson.tasks.Builder;
import hudson.util.TimeUnit2;
import org.jvnet.hudson.test.HudsonTestCase; import org.jvnet.hudson.test.HudsonTestCase;
import org.jvnet.hudson.test.SleepBuilder; import org.jvnet.hudson.test.SleepBuilder;
...@@ -104,7 +103,7 @@ public class NodeProvisionerTest extends HudsonTestCase { ...@@ -104,7 +103,7 @@ public class NodeProvisionerTest extends HudsonTestCase {
* Scenario: schedule a build and see if one slave is provisioned. * Scenario: schedule a build and see if one slave is provisioned.
*/ */
public void _testAutoProvision() throws Exception {// excluded since it's fragile public void _testAutoProvision() throws Exception {// excluded since it's fragile
BulkChange bc = new BulkChange(hudson); BulkChange bc = new BulkChange(jenkins);
try { try {
DummyCloudImpl cloud = initHudson(10); DummyCloudImpl cloud = initHudson(10);
...@@ -125,7 +124,7 @@ public class NodeProvisionerTest extends HudsonTestCase { ...@@ -125,7 +124,7 @@ public class NodeProvisionerTest extends HudsonTestCase {
* Scenario: we got a lot of jobs all of the sudden, and we need to fire up a few nodes. * Scenario: we got a lot of jobs all of the sudden, and we need to fire up a few nodes.
*/ */
public void _testLoadSpike() throws Exception {// excluded since it's fragile public void _testLoadSpike() throws Exception {// excluded since it's fragile
BulkChange bc = new BulkChange(hudson); BulkChange bc = new BulkChange(jenkins);
try { try {
DummyCloudImpl cloud = initHudson(0); DummyCloudImpl cloud = initHudson(0);
...@@ -143,7 +142,7 @@ public class NodeProvisionerTest extends HudsonTestCase { ...@@ -143,7 +142,7 @@ public class NodeProvisionerTest extends HudsonTestCase {
* Scenario: make sure we take advantage of statically configured slaves. * Scenario: make sure we take advantage of statically configured slaves.
*/ */
public void _testBaselineSlaveUsage() throws Exception {// excluded since it's fragile public void _testBaselineSlaveUsage() throws Exception {// excluded since it's fragile
BulkChange bc = new BulkChange(hudson); BulkChange bc = new BulkChange(jenkins);
try { try {
DummyCloudImpl cloud = initHudson(0); DummyCloudImpl cloud = initHudson(0);
// add slaves statically upfront // add slaves statically upfront
...@@ -163,11 +162,11 @@ public class NodeProvisionerTest extends HudsonTestCase { ...@@ -163,11 +162,11 @@ public class NodeProvisionerTest extends HudsonTestCase {
* Scenario: loads on one label shouldn't translate to load on another label. * Scenario: loads on one label shouldn't translate to load on another label.
*/ */
public void _testLabels() throws Exception {// excluded since it's fragile public void _testLabels() throws Exception {// excluded since it's fragile
BulkChange bc = new BulkChange(hudson); BulkChange bc = new BulkChange(jenkins);
try { try {
DummyCloudImpl cloud = initHudson(0); DummyCloudImpl cloud = initHudson(0);
Label blue = hudson.getLabel("blue"); Label blue = jenkins.getLabel("blue");
Label red = hudson.getLabel("red"); Label red = jenkins.getLabel("red");
cloud.label = red; cloud.label = red;
// red jobs // red jobs
...@@ -206,11 +205,11 @@ public class NodeProvisionerTest extends HudsonTestCase { ...@@ -206,11 +205,11 @@ public class NodeProvisionerTest extends HudsonTestCase {
private DummyCloudImpl initHudson(int delay) throws IOException { private DummyCloudImpl initHudson(int delay) throws IOException {
// start a dummy service // start a dummy service
DummyCloudImpl cloud = new DummyCloudImpl(this, delay); DummyCloudImpl cloud = new DummyCloudImpl(this, delay);
hudson.clouds.add(cloud); jenkins.clouds.add(cloud);
// no build on the master, to make sure we get everything from the cloud // no build on the master, to make sure we get everything from the cloud
hudson.setNumExecutors(0); jenkins.setNumExecutors(0);
hudson.setNodes(Collections.<Node>emptyList()); jenkins.setNodes(Collections.<Node>emptyList());
return cloud; return cloud;
} }
......
...@@ -62,7 +62,7 @@ public class BuildTriggerTest extends HudsonTestCase { ...@@ -62,7 +62,7 @@ public class BuildTriggerTest extends HudsonTestCase {
dp = createDownstreamProject(); dp = createDownstreamProject();
p.getPublishersList().add(new BuildTrigger("downstream", evenWhenUnstable)); p.getPublishersList().add(new BuildTrigger("downstream", evenWhenUnstable));
p.getBuildersList().add(new MockBuilder(dontTriggerResult)); p.getBuildersList().add(new MockBuilder(dontTriggerResult));
hudson.rebuildDependencyGraph(); jenkins.rebuildDependencyGraph();
// First build should not trigger downstream job // First build should not trigger downstream job
FreeStyleBuild b = p.scheduleBuild2(0).get(); FreeStyleBuild b = p.scheduleBuild2(0).get();
......
...@@ -27,22 +27,22 @@ public class EnvVarsInConfigTasksTest extends HudsonTestCase { ...@@ -27,22 +27,22 @@ public class EnvVarsInConfigTasksTest extends HudsonTestCase {
public void setUp() throws Exception { public void setUp() throws Exception {
super.setUp(); super.setUp();
JDK defaultJDK = hudson.getJDK(null); JDK defaultJDK = jenkins.getJDK(null);
JDK varJDK = new JDK("varJDK", withVariable(defaultJDK.getHome())); JDK varJDK = new JDK("varJDK", withVariable(defaultJDK.getHome()));
hudson.getJDKs().add(varJDK); jenkins.getJDKs().add(varJDK);
// Maven with a variable in its path // Maven with a variable in its path
configureDefaultMaven(); configureDefaultMaven();
MavenInstallation defaultMaven = hudson.getDescriptorByType(Maven.DescriptorImpl.class).getInstallations()[0]; MavenInstallation defaultMaven = jenkins.getDescriptorByType(Maven.DescriptorImpl.class).getInstallations()[0];
MavenInstallation varMaven = new MavenInstallation("varMaven", MavenInstallation varMaven = new MavenInstallation("varMaven",
withVariable(defaultMaven.getHome()), NO_PROPERTIES); withVariable(defaultMaven.getHome()), NO_PROPERTIES);
hudson.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(varMaven); jenkins.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(varMaven);
// Ant with a variable in its path // Ant with a variable in its path
AntInstallation ant = configureDefaultAnt(); AntInstallation ant = configureDefaultAnt();
AntInstallation antInstallation = new AntInstallation("varAnt", AntInstallation antInstallation = new AntInstallation("varAnt",
withVariable(ant.getHome()),NO_PROPERTIES); withVariable(ant.getHome()),NO_PROPERTIES);
hudson.getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(antInstallation); jenkins.getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(antInstallation);
// create slaves // create slaves
EnvVars additionalEnv = new EnvVars(DUMMY_LOCATION_VARNAME, ""); EnvVars additionalEnv = new EnvVars(DUMMY_LOCATION_VARNAME, "");
...@@ -61,7 +61,7 @@ public class EnvVarsInConfigTasksTest extends HudsonTestCase { ...@@ -61,7 +61,7 @@ public class EnvVarsInConfigTasksTest extends HudsonTestCase {
} else { } else {
project.getBuildersList().add(new Shell("echo \"$JAVA_HOME\"")); project.getBuildersList().add(new Shell("echo \"$JAVA_HOME\""));
} }
project.setJDK(hudson.getJDK("varJDK")); project.setJDK(jenkins.getJDK("varJDK"));
// set appropriate SCM to get the necessary build files // set appropriate SCM to get the necessary build files
project.setScm(new ExtractResourceSCM(getClass().getResource( project.setScm(new ExtractResourceSCM(getClass().getResource(
...@@ -92,12 +92,12 @@ public class EnvVarsInConfigTasksTest extends HudsonTestCase { ...@@ -92,12 +92,12 @@ public class EnvVarsInConfigTasksTest extends HudsonTestCase {
} }
public void testFreeStyleAntOnSlave() throws Exception { public void testFreeStyleAntOnSlave() throws Exception {
if (hudson.getDescriptorByType(Ant.DescriptorImpl.class).getInstallations().length == 0) { if (jenkins.getDescriptorByType(Ant.DescriptorImpl.class).getInstallations().length == 0) {
System.out.println("Cannot do testFreeStyleAntOnSlave without ANT_HOME"); System.out.println("Cannot do testFreeStyleAntOnSlave without ANT_HOME");
return; return;
} }
FreeStyleProject project = createFreeStyleProject(); FreeStyleProject project = createFreeStyleProject();
project.setJDK(hudson.getJDK("varJDK")); project.setJDK(jenkins.getJDK("varJDK"));
project.setScm(new ExtractResourceSCM(getClass().getResource( project.setScm(new ExtractResourceSCM(getClass().getResource(
"/simple-projects.zip"))); "/simple-projects.zip")));
...@@ -137,7 +137,7 @@ public class EnvVarsInConfigTasksTest extends HudsonTestCase { ...@@ -137,7 +137,7 @@ public class EnvVarsInConfigTasksTest extends HudsonTestCase {
public void testFreeStyleMavenOnSlave() throws Exception { public void testFreeStyleMavenOnSlave() throws Exception {
FreeStyleProject project = createFreeStyleProject(); FreeStyleProject project = createFreeStyleProject();
project.setJDK(hudson.getJDK("varJDK")); project.setJDK(jenkins.getJDK("varJDK"));
project.setScm(new ExtractResourceSCM(getClass().getResource( project.setScm(new ExtractResourceSCM(getClass().getResource(
"/simple-projects.zip"))); "/simple-projects.zip")));
...@@ -172,7 +172,7 @@ public class EnvVarsInConfigTasksTest extends HudsonTestCase { ...@@ -172,7 +172,7 @@ public class EnvVarsInConfigTasksTest extends HudsonTestCase {
public void testNativeMavenOnSlave() throws Exception { public void testNativeMavenOnSlave() throws Exception {
MavenModuleSet project = createMavenProject(); MavenModuleSet project = createMavenProject();
project.setJDK(hudson.getJDK("varJDK")); project.setJDK(jenkins.getJDK("varJDK"));
project.setScm(new ExtractResourceSCM(getClass().getResource( project.setScm(new ExtractResourceSCM(getClass().getResource(
"/simple-projects.zip"))); "/simple-projects.zip")));
......
...@@ -173,7 +173,7 @@ public class FingerprinterTest extends HudsonTestCase { ...@@ -173,7 +173,7 @@ public class FingerprinterTest extends HudsonTestCase {
FreeStyleProject freestyleProject = createFreeStyleProjectWithFingerprints(singleContents, singleFiles); FreeStyleProject freestyleProject = createFreeStyleProjectWithFingerprints(singleContents, singleFiles);
addFingerprinterToProject(matrixProject, singleContents, singleFiles); addFingerprinterToProject(matrixProject, singleContents, singleFiles);
hudson.rebuildDependencyGraph(); jenkins.rebuildDependencyGraph();
buildAndAssertSuccess(matrixProject); buildAndAssertSuccess(matrixProject);
buildAndAssertSuccess(freestyleProject); buildAndAssertSuccess(freestyleProject);
...@@ -183,9 +183,9 @@ public class FingerprinterTest extends HudsonTestCase { ...@@ -183,9 +183,9 @@ public class FingerprinterTest extends HudsonTestCase {
assertEquals("There should only be one FreestyleBuild", 1, builds.size()); assertEquals("There should only be one FreestyleBuild", 1, builds.size());
FreeStyleBuild build = builds.iterator().next(); FreeStyleBuild build = builds.iterator().next();
assertEquals(Result.SUCCESS, build.getResult()); assertEquals(Result.SUCCESS, build.getResult());
List<AbstractProject> downstream = hudson.getDependencyGraph().getDownstream(matrixProject); List<AbstractProject> downstream = jenkins.getDependencyGraph().getDownstream(matrixProject);
assertTrue(downstream.contains(freestyleProject)); assertTrue(downstream.contains(freestyleProject));
List<AbstractProject> upstream = hudson.getDependencyGraph().getUpstream(freestyleProject); List<AbstractProject> upstream = jenkins.getDependencyGraph().getUpstream(freestyleProject);
assertTrue(upstream.contains(matrixProject)); assertTrue(upstream.contains(matrixProject));
} }
......
...@@ -64,7 +64,7 @@ public class MavenTest extends HudsonTestCase { ...@@ -64,7 +64,7 @@ public class MavenTest extends HudsonTestCase {
* Tests the round-tripping of the configuration. * Tests the round-tripping of the configuration.
*/ */
public void testConfigRoundtrip() throws Exception { public void testConfigRoundtrip() throws Exception {
hudson.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(); // reset jenkins.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(); // reset
FreeStyleProject p = createFreeStyleProject(); FreeStyleProject p = createFreeStyleProject();
p.getBuildersList().add(new Maven("a", null, "b.pom", "c=d", "-e", true)); p.getBuildersList().add(new Maven("a", null, "b.pom", "c=d", "-e", true));
...@@ -91,14 +91,14 @@ public class MavenTest extends HudsonTestCase { ...@@ -91,14 +91,14 @@ public class MavenTest extends HudsonTestCase {
String mavenHomeVar = "${VAR_MAVEN}" + mavenHome.substring(3); String mavenHomeVar = "${VAR_MAVEN}" + mavenHome.substring(3);
String mavenVar = mavenHome.substring(0, 3); String mavenVar = mavenHome.substring(0, 3);
MavenInstallation varMaven = new MavenInstallation("varMaven", mavenHomeVar, NO_PROPERTIES); MavenInstallation varMaven = new MavenInstallation("varMaven", mavenHomeVar, NO_PROPERTIES);
hudson.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(maven, varMaven); jenkins.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(maven, varMaven);
JDK jdk = hudson.getJDK("default"); JDK jdk = jenkins.getJDK("default");
String javaHome = jdk.getHome(); String javaHome = jdk.getHome();
String javaHomeVar = "${VAR_JAVA}" + javaHome.substring(3); String javaHomeVar = "${VAR_JAVA}" + javaHome.substring(3);
String javaVar = javaHome.substring(0, 3); String javaVar = javaHome.substring(0, 3);
JDK varJDK = new JDK("varJDK", javaHomeVar); JDK varJDK = new JDK("varJDK", javaHomeVar);
hudson.getJDKs().add(varJDK); jenkins.getJDKs().add(varJDK);
Jenkins.getInstance().getNodeProperties().replaceBy( Jenkins.getInstance().getNodeProperties().replaceBy(
Collections.singleton(new EnvironmentVariablesNodeProperty( Collections.singleton(new EnvironmentVariablesNodeProperty(
new Entry("VAR_MAVEN", mavenVar), new Entry("VAR_JAVA", new Entry("VAR_MAVEN", mavenVar), new Entry("VAR_JAVA",
...@@ -120,14 +120,14 @@ public class MavenTest extends HudsonTestCase { ...@@ -120,14 +120,14 @@ public class MavenTest extends HudsonTestCase {
String mavenHomeVar = "${VAR_MAVEN}" + mavenHome.substring(3); String mavenHomeVar = "${VAR_MAVEN}" + mavenHome.substring(3);
String mavenVar = mavenHome.substring(0, 3); String mavenVar = mavenHome.substring(0, 3);
MavenInstallation varMaven = new MavenInstallation("varMaven",mavenHomeVar,NO_PROPERTIES); MavenInstallation varMaven = new MavenInstallation("varMaven",mavenHomeVar,NO_PROPERTIES);
hudson.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(maven, varMaven); jenkins.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(maven, varMaven);
JDK jdk = hudson.getJDK("default"); JDK jdk = jenkins.getJDK("default");
String javaHome = jdk.getHome(); String javaHome = jdk.getHome();
String javaHomeVar = "${VAR_JAVA}" + javaHome.substring(3); String javaHomeVar = "${VAR_JAVA}" + javaHome.substring(3);
String javaVar = javaHome.substring(0, 3); String javaVar = javaHome.substring(0, 3);
JDK varJDK = new JDK("varJDK", javaHomeVar); JDK varJDK = new JDK("varJDK", javaHomeVar);
hudson.getJDKs().add(varJDK); jenkins.getJDKs().add(varJDK);
FreeStyleProject project = createFreeStyleProject(); FreeStyleProject project = createFreeStyleProject();
project.addProperty(new ParametersDefinitionProperty( project.addProperty(new ParametersDefinitionProperty(
......
...@@ -42,7 +42,7 @@ public class HistoryTest extends HudsonTestCase { ...@@ -42,7 +42,7 @@ public class HistoryTest extends HudsonTestCase {
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp(); super.setUp();
List<Project> projects = this.hudson.getProjects(); List<Project> projects = this.jenkins.getProjects();
Project theProject = null; Project theProject = null;
for (Project p : projects) { for (Project p : projects) {
if (p.getName().equals(PROJECT_NAME)) theProject = p; if (p.getName().equals(PROJECT_NAME)) theProject = p;
......
...@@ -75,7 +75,7 @@ public class JUnitResultArchiverTest extends HudsonTestCase { ...@@ -75,7 +75,7 @@ public class JUnitResultArchiverTest extends HudsonTestCase {
DumbSlave s = createOnlineSlave(); DumbSlave s = createOnlineSlave();
project.setAssignedLabel(s.getSelfLabel()); project.setAssignedLabel(s.getSelfLabel());
FilePath src = new FilePath(hudson.getRootPath(), "jobs/junit/workspace/"); FilePath src = new FilePath(jenkins.getRootPath(), "jobs/junit/workspace/");
assertNotNull(src); assertNotNull(src);
FilePath dest = s.getWorkspaceFor(project); FilePath dest = s.getWorkspaceFor(project);
assertNotNull(dest); assertNotNull(dest);
...@@ -110,8 +110,8 @@ public class JUnitResultArchiverTest extends HudsonTestCase { ...@@ -110,8 +110,8 @@ public class JUnitResultArchiverTest extends HudsonTestCase {
} }
private void reloadJenkins() throws Exception { private void reloadJenkins() throws Exception {
hudson.reload(); jenkins.reload();
project = (FreeStyleProject) hudson.getItem("junit"); project = (FreeStyleProject) jenkins.getItem("junit");
} }
@LocalData @LocalData
......
...@@ -105,7 +105,7 @@ public class TestResultLinksTest extends HudsonTestCase { ...@@ -105,7 +105,7 @@ public class TestResultLinksTest extends HudsonTestCase {
// I know that in a HudsonTestCase we don't have a meaningful root url, so I expect an empty string here. // I know that in a HudsonTestCase we don't have a meaningful root url, so I expect an empty string here.
// If somehow we start being able to produce a root url, then I'll also tolerate a url that starts with that. // If somehow we start being able to produce a root url, then I'll also tolerate a url that starts with that.
boolean pathIsEmptyOrNull = relativePath2 == null || relativePath2.isEmpty(); boolean pathIsEmptyOrNull = relativePath2 == null || relativePath2.isEmpty();
boolean pathStartsWithRootUrl = !pathIsEmptyOrNull && relativePath2.startsWith(hudson.getRootUrl()); boolean pathStartsWithRootUrl = !pathIsEmptyOrNull && relativePath2.startsWith(jenkins.getRootUrl());
assertTrue("relative path is empty OR begins with the app root", pathIsEmptyOrNull || pathStartsWithRootUrl ); assertTrue("relative path is empty OR begins with the app root", pathIsEmptyOrNull || pathStartsWithRootUrl );
} }
} }
...@@ -79,7 +79,7 @@ public class TestResultPublishingTest extends HudsonTestCase { ...@@ -79,7 +79,7 @@ public class TestResultPublishingTest extends HudsonTestCase {
DumbSlave s = createOnlineSlave(); DumbSlave s = createOnlineSlave();
project.setAssignedLabel(s.getSelfLabel()); project.setAssignedLabel(s.getSelfLabel());
FilePath src = new FilePath(hudson.getRootPath(), "jobs/" + BASIC_TEST_PROJECT + "/workspace/"); FilePath src = new FilePath(jenkins.getRootPath(), "jobs/" + BASIC_TEST_PROJECT + "/workspace/");
assertNotNull(src); assertNotNull(src);
FilePath dest = s.getWorkspaceFor(project); FilePath dest = s.getWorkspaceFor(project);
assertNotNull(dest); assertNotNull(dest);
...@@ -99,7 +99,7 @@ public class TestResultPublishingTest extends HudsonTestCase { ...@@ -99,7 +99,7 @@ public class TestResultPublishingTest extends HudsonTestCase {
*/ */
@LocalData @LocalData
public void testOpenJUnitPublishing() throws IOException, SAXException { public void testOpenJUnitPublishing() throws IOException, SAXException {
List<Project> projects = this.hudson.getProjects(); List<Project> projects = this.jenkins.getProjects();
// Make sure there's a project named TEST_PROJECT_WITH_HISTORY // Make sure there's a project named TEST_PROJECT_WITH_HISTORY
Project proj = null; Project proj = null;
for (Project p : projects) { for (Project p : projects) {
...@@ -208,7 +208,7 @@ public class TestResultPublishingTest extends HudsonTestCase { ...@@ -208,7 +208,7 @@ public class TestResultPublishingTest extends HudsonTestCase {
@Bug(5246) @Bug(5246)
@LocalData @LocalData
public void testInterBuildDiffs() throws IOException, SAXException { public void testInterBuildDiffs() throws IOException, SAXException {
List<Project> projects = this.hudson.getProjects(); List<Project> projects = this.jenkins.getProjects();
// Make sure there's a project named TEST_PROJECT_WITH_HISTORY // Make sure there's a project named TEST_PROJECT_WITH_HISTORY
Project proj = null; Project proj = null;
for (Project p : projects) { for (Project p : projects) {
...@@ -235,7 +235,7 @@ public class TestResultPublishingTest extends HudsonTestCase { ...@@ -235,7 +235,7 @@ public class TestResultPublishingTest extends HudsonTestCase {
*/ */
@LocalData @LocalData
public void testHistoryPageOpenJunit() throws IOException, SAXException { public void testHistoryPageOpenJunit() throws IOException, SAXException {
List<Project> projects = this.hudson.getProjects(); List<Project> projects = this.jenkins.getProjects();
// Make sure there's a project named breakable // Make sure there's a project named breakable
Project proj = null; Project proj = null;
for (Project p : projects) { for (Project p : projects) {
......
...@@ -86,12 +86,12 @@ public class JDKInstallerTest extends HudsonTestCase { ...@@ -86,12 +86,12 @@ public class JDKInstallerTest extends HudsonTestCase {
File tmp = env.temporaryDirectoryAllocator.allocate(); File tmp = env.temporaryDirectoryAllocator.allocate();
JDKInstaller installer = new JDKInstaller("jdk-6u13-oth-JPR@CDS-CDS_Developer", true); JDKInstaller installer = new JDKInstaller("jdk-6u13-oth-JPR@CDS-CDS_Developer", true);
hudson.getJDKs().add(new JDK("test",tmp.getAbsolutePath(), Arrays.asList( jenkins.getJDKs().add(new JDK("test",tmp.getAbsolutePath(), Arrays.asList(
new InstallSourceProperty(Arrays.<ToolInstaller>asList(installer))))); new InstallSourceProperty(Arrays.<ToolInstaller>asList(installer)))));
submit(new WebClient().goTo("configure").getFormByName("config")); submit(new WebClient().goTo("configure").getFormByName("config"));
JDK jdk = hudson.getJDK("test"); JDK jdk = jenkins.getJDK("test");
InstallSourceProperty isp = jdk.getProperties().get(InstallSourceProperty.class); InstallSourceProperty isp = jdk.getProperties().get(InstallSourceProperty.class);
assertEquals(1,isp.installers.size()); assertEquals(1,isp.installers.size());
assertEqualBeans(installer,isp.installers.get(JDKInstaller.class),"id,acceptLicense"); assertEqualBeans(installer,isp.installers.get(JDKInstaller.class),"id,acceptLicense");
...@@ -153,7 +153,7 @@ public class JDKInstallerTest extends HudsonTestCase { ...@@ -153,7 +153,7 @@ public class JDKInstallerTest extends HudsonTestCase {
JDK jdk = new JDK("test", tmp.getAbsolutePath(), Arrays.asList( JDK jdk = new JDK("test", tmp.getAbsolutePath(), Arrays.asList(
new InstallSourceProperty(Arrays.<ToolInstaller>asList(installer)))); new InstallSourceProperty(Arrays.<ToolInstaller>asList(installer))));
hudson.getJDKs().add(jdk); jenkins.getJDKs().add(jdk);
FreeStyleProject p = createFreeStyleProject(); FreeStyleProject p = createFreeStyleProject();
p.setJDK(jdk); p.setJDK(jdk);
...@@ -185,7 +185,7 @@ public class JDKInstallerTest extends HudsonTestCase { ...@@ -185,7 +185,7 @@ public class JDKInstallerTest extends HudsonTestCase {
File d = env.temporaryDirectoryAllocator.allocate(); File d = env.temporaryDirectoryAllocator.allocate();
new JDKInstaller("",true).install(new LocalLauncher(l),Platform.LINUX, new JDKInstaller("",true).install(new LocalLauncher(l),Platform.LINUX,
new JDKInstaller.FilePathFileSystem(hudson),l,d.getPath(),bundle.getPath()); new JDKInstaller.FilePathFileSystem(jenkins),l,d.getPath(),bundle.getPath());
assertTrue(new File(d,"bin/java").exists()); assertTrue(new File(d,"bin/java").exists());
} finally { } finally {
......
...@@ -61,11 +61,11 @@ public class ToolLocationNodePropertyTest extends HudsonTestCase { ...@@ -61,11 +61,11 @@ public class ToolLocationNodePropertyTest extends HudsonTestCase {
public void testFormRoundTrip() throws Exception { public void testFormRoundTrip() throws Exception {
MavenInstallation.DescriptorImpl mavenDescriptor = hudson.getDescriptorByType(MavenInstallation.DescriptorImpl.class); MavenInstallation.DescriptorImpl mavenDescriptor = jenkins.getDescriptorByType(MavenInstallation.DescriptorImpl.class);
mavenDescriptor.setInstallations(new MavenInstallation("maven", "XXX", NO_PROPERTIES)); mavenDescriptor.setInstallations(new MavenInstallation("maven", "XXX", NO_PROPERTIES));
AntInstallation.DescriptorImpl antDescriptor = hudson.getDescriptorByType(AntInstallation.DescriptorImpl.class); AntInstallation.DescriptorImpl antDescriptor = jenkins.getDescriptorByType(AntInstallation.DescriptorImpl.class);
antDescriptor.setInstallations(new AntInstallation("ant", "XXX", NO_PROPERTIES)); antDescriptor.setInstallations(new AntInstallation("ant", "XXX", NO_PROPERTIES));
JDK.DescriptorImpl jdkDescriptor = hudson.getDescriptorByType(JDK.DescriptorImpl.class); JDK.DescriptorImpl jdkDescriptor = jenkins.getDescriptorByType(JDK.DescriptorImpl.class);
jdkDescriptor.setInstallations(new JDK("jdk", "XXX")); jdkDescriptor.setInstallations(new JDK("jdk", "XXX"));
ToolLocationNodeProperty property = new ToolLocationNodeProperty( ToolLocationNodeProperty property = new ToolLocationNodeProperty(
...@@ -112,7 +112,7 @@ public class ToolLocationNodePropertyTest extends HudsonTestCase { ...@@ -112,7 +112,7 @@ public class ToolLocationNodePropertyTest extends HudsonTestCase {
assertBuildStatus(Result.FAILURE, build); assertBuildStatus(Result.FAILURE, build);
ToolLocationNodeProperty property = new ToolLocationNodeProperty( ToolLocationNodeProperty property = new ToolLocationNodeProperty(
new ToolLocationNodeProperty.ToolLocation(hudson.getDescriptorByType(MavenInstallation.DescriptorImpl.class), "maven", mavenPath)); new ToolLocationNodeProperty.ToolLocation(jenkins.getDescriptorByType(MavenInstallation.DescriptorImpl.class), "maven", mavenPath));
slave.getNodeProperties().add(property); slave.getNodeProperties().add(property);
build = project.scheduleBuild2(0).get(); build = project.scheduleBuild2(0).get();
...@@ -139,7 +139,7 @@ public class ToolLocationNodePropertyTest extends HudsonTestCase { ...@@ -139,7 +139,7 @@ public class ToolLocationNodePropertyTest extends HudsonTestCase {
assertBuildStatus(Result.FAILURE, build); assertBuildStatus(Result.FAILURE, build);
ToolLocationNodeProperty property = new ToolLocationNodeProperty( ToolLocationNodeProperty property = new ToolLocationNodeProperty(
new ToolLocationNodeProperty.ToolLocation(hudson.getDescriptorByType(AntInstallation.DescriptorImpl.class), "ant", antPath)); new ToolLocationNodeProperty.ToolLocation(jenkins.getDescriptorByType(AntInstallation.DescriptorImpl.class), "ant", antPath));
slave.getNodeProperties().add(property); slave.getNodeProperties().add(property);
build = project.scheduleBuild2(0).get(); build = project.scheduleBuild2(0).get();
...@@ -156,7 +156,7 @@ public class ToolLocationNodePropertyTest extends HudsonTestCase { ...@@ -156,7 +156,7 @@ public class ToolLocationNodePropertyTest extends HudsonTestCase {
project.setScm(new ExtractResourceSCM(getClass().getResource( project.setScm(new ExtractResourceSCM(getClass().getResource(
"/simple-projects.zip"))); "/simple-projects.zip")));
project.setAssignedLabel(slave.getSelfLabel()); project.setAssignedLabel(slave.getSelfLabel());
project.setJDK(hudson.getJDK("default")); project.setJDK(jenkins.getJDK("default"));
project.setMaven("maven"); project.setMaven("maven");
project.setGoals("clean"); project.setGoals("clean");
...@@ -165,7 +165,7 @@ public class ToolLocationNodePropertyTest extends HudsonTestCase { ...@@ -165,7 +165,7 @@ public class ToolLocationNodePropertyTest extends HudsonTestCase {
assertBuildStatus(Result.FAILURE, build); assertBuildStatus(Result.FAILURE, build);
ToolLocationNodeProperty property = new ToolLocationNodeProperty( ToolLocationNodeProperty property = new ToolLocationNodeProperty(
new ToolLocationNodeProperty.ToolLocation(hudson.getDescriptorByType(MavenInstallation.DescriptorImpl.class), "maven", mavenPath)); new ToolLocationNodeProperty.ToolLocation(jenkins.getDescriptorByType(MavenInstallation.DescriptorImpl.class), "maven", mavenPath));
slave.getNodeProperties().add(property); slave.getNodeProperties().add(property);
build = project.scheduleBuild2(0).get(); build = project.scheduleBuild2(0).get();
......
...@@ -8,7 +8,7 @@ import org.jvnet.hudson.test.HudsonTestCase; ...@@ -8,7 +8,7 @@ import org.jvnet.hudson.test.HudsonTestCase;
*/ */
public class ListViewColumnTest extends HudsonTestCase { public class ListViewColumnTest extends HudsonTestCase {
public void testCreateView() throws Exception { public void testCreateView() throws Exception {
hudson.addView(new ListView("test")); jenkins.addView(new ListView("test"));
submit(createWebClient().goTo("view/test/configure").getFormByName("viewConfig")); submit(createWebClient().goTo("view/test/configure").getFormByName("viewConfig"));
} }
} }
...@@ -38,13 +38,13 @@ public class ExpandableTextboxTest extends HudsonTestCase { ...@@ -38,13 +38,13 @@ public class ExpandableTextboxTest extends HudsonTestCase {
@Bug(2816) @Bug(2816)
public void testMultiline() throws Exception { public void testMultiline() throws Exception {
// because attribute values are normalized, it's not very easy to encode multi-line string as @value. So let's use the system message here. // because attribute values are normalized, it's not very easy to encode multi-line string as @value. So let's use the system message here.
hudson.setSystemMessage("foo\nbar\nzot"); jenkins.setSystemMessage("foo\nbar\nzot");
HtmlPage page = evaluateAsHtml("<l:layout><l:main-panel><table><j:set var='instance' value='${it}'/><f:expandableTextbox field='systemMessage' /></table></l:main-panel></l:layout>"); HtmlPage page = evaluateAsHtml("<l:layout><l:main-panel><table><j:set var='instance' value='${it}'/><f:expandableTextbox field='systemMessage' /></table></l:main-panel></l:layout>");
// System.out.println(page.getWebResponse().getContentAsString()); // System.out.println(page.getWebResponse().getContentAsString());
NodeList textareas = page.getElementsByTagName("textarea"); NodeList textareas = page.getElementsByTagName("textarea");
assertEquals(1, textareas.getLength()); assertEquals(1, textareas.getLength());
assertEquals(hudson.getSystemMessage(),textareas.item(0).getTextContent()); assertEquals(jenkins.getSystemMessage(),textareas.item(0).getTextContent());
} }
/** /**
......
...@@ -23,9 +23,7 @@ ...@@ -23,9 +23,7 @@
*/ */
package lib.form; package lib.form;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.html.HtmlPage;
import hudson.util.FormValidation;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.jvnet.hudson.test.HudsonTestCase; import org.jvnet.hudson.test.HudsonTestCase;
import org.kohsuke.stapler.HttpResponse; import org.kohsuke.stapler.HttpResponse;
...@@ -39,7 +37,7 @@ import org.kohsuke.stapler.StaplerRequest; ...@@ -39,7 +37,7 @@ import org.kohsuke.stapler.StaplerRequest;
*/ */
public class NameRefTest extends HudsonTestCase { public class NameRefTest extends HudsonTestCase {
public void test1() throws Exception { public void test1() throws Exception {
hudson.setCrumbIssuer(null); jenkins.setCrumbIssuer(null);
HtmlPage p = createWebClient().goTo("self/test1"); HtmlPage p = createWebClient().goTo("self/test1");
submit(p.getFormByName("config")); submit(p.getFormByName("config"));
} }
......
...@@ -46,7 +46,7 @@ public class PasswordTest extends HudsonTestCase implements Describable<Password ...@@ -46,7 +46,7 @@ public class PasswordTest extends HudsonTestCase implements Describable<Password
} }
public DescriptorImpl getDescriptor() { public DescriptorImpl getDescriptor() {
return hudson.getDescriptorByType(DescriptorImpl.class); return jenkins.getDescriptorByType(DescriptorImpl.class);
} }
@Extension @Extension
......
...@@ -103,7 +103,7 @@ public class RepeatablePropertyTest extends HudsonTestCase implements Describabl ...@@ -103,7 +103,7 @@ public class RepeatablePropertyTest extends HudsonTestCase implements Describabl
} }
public DescriptorImpl getDescriptor() { public DescriptorImpl getDescriptor() {
return hudson.getDescriptorByType(DescriptorImpl.class); return jenkins.getDescriptorByType(DescriptorImpl.class);
} }
@Extension @Extension
......
...@@ -296,7 +296,7 @@ public class RepeatableTest extends HudsonTestCase { ...@@ -296,7 +296,7 @@ public class RepeatableTest extends HudsonTestCase {
} }
public DescriptorExtensionList<Fruit,Descriptor<Fruit>> getFruitDescriptors() { public DescriptorExtensionList<Fruit,Descriptor<Fruit>> getFruitDescriptors() {
return hudson.<Fruit,Descriptor<Fruit>>getDescriptorList(Fruit.class); return jenkins.<Fruit,Descriptor<Fruit>>getDescriptorList(Fruit.class);
} }
public void testDropdownList() throws Exception { public void testDropdownList() throws Exception {
......
...@@ -110,7 +110,7 @@ public class RowVisibilityGroupTest extends HudsonTestCase implements Describabl ...@@ -110,7 +110,7 @@ public class RowVisibilityGroupTest extends HudsonTestCase implements Describabl
} }
public DescriptorImpl getDescriptor() { public DescriptorImpl getDescriptor() {
return hudson.getDescriptorByType(DescriptorImpl.class); return jenkins.getDescriptorByType(DescriptorImpl.class);
} }
@TestExtension @TestExtension
......
...@@ -47,7 +47,7 @@ public class ValidateButtonTest extends HudsonTestCase implements Describable<Va ...@@ -47,7 +47,7 @@ public class ValidateButtonTest extends HudsonTestCase implements Describable<Va
} }
public DescriptorImpl getDescriptor() { public DescriptorImpl getDescriptor() {
return hudson.getDescriptorByType(DescriptorImpl.class); return jenkins.getDescriptorByType(DescriptorImpl.class);
} }
@Extension @Extension
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册