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

Jenkins!

上级 9ff1da3d
......@@ -131,8 +131,6 @@ import net.sourceforge.htmlunit.corejs.javascript.ContextFactory.Listener;
import org.acegisecurity.AuthenticationException;
import org.acegisecurity.BadCredentialsException;
import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.context.SecurityContext;
import org.acegisecurity.context.SecurityContextHolder;
import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.apache.commons.beanutils.PropertyUtils;
......@@ -309,30 +307,30 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
f.set(null,null);
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);
hudson.servletContext.setAttribute("version","?");
WebAppMain.installExpressionFactory(new ServletContextEvent(hudson.servletContext));
jenkins.servletContext.setAttribute("app", jenkins);
jenkins.servletContext.setAttribute("version","?");
WebAppMain.installExpressionFactory(new ServletContextEvent(jenkins.servletContext));
Mailer.descriptor().setHudsonUrl(getURL().toExternalForm());
// 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();
// expose the test instance as a part of URL tree.
// 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.
// ideally we'd like to reset them to properly emulate the behavior, but that's not possible.
DescriptorImpl desc = Mailer.descriptor();
// prevent NPE with eclipse
if (desc != null) Mailer.descriptor().setHudsonUrl(null);
for( Descriptor d : hudson.getExtensionList(Descriptor.class) )
for( Descriptor d : jenkins.getExtensionList(Descriptor.class) )
d.load();
// allow the test class to inject Jenkins components
......@@ -352,7 +350,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
DownloadService.neverUpdate = true;
UpdateSite.neverUpdate = true;
PersistedList<UpdateSite> sites = hudson.getUpdateCenter().getSites();
PersistedList<UpdateSite> sites = jenkins.getUpdateCenter().getSites();
sites.clear();
sites.add(new UpdateSite("default", updateCenterUrl));
}
......@@ -381,7 +379,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
for (LenientRunnable r : tearDowns)
r.run();
hudson.cleanUp();
jenkins.cleanUp();
env.dispose();
ExtensionList.clearLegacyInstances();
DescriptorExtensionList.clearLegacyInstances();
......@@ -454,7 +452,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
public void setPluginManager(PluginManager pluginManager) {
this.useLocalPluginManager = false;
this.pluginManager = pluginManager;
if (hudson!=null)
if (jenkins !=null)
throw new IllegalStateException("Too late to override the plugin manager");
}
......@@ -548,7 +546,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
MavenInstallation mvn = configureDefaultMaven("apache-maven-3.0.1", MavenInstallation.MAVEN_30);
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;
}
......@@ -562,7 +560,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
File mavenAlreadyInstalled = new File(buildDirectory, mavenVersion);
if (mavenAlreadyInstalled.exists()) {
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;
}
......@@ -571,7 +569,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
if(home!=null) {
MavenInstallation mavenInstallation = new MavenInstallation("default",home, NO_PROPERTIES);
if (mavenInstallation.meetsMavenReqVersion(createLocalLauncher(), mavenReqVersion)) {
hudson.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(mavenInstallation);
jenkins.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(mavenInstallation);
return mavenInstallation;
}
}
......@@ -580,7 +578,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
// this happens when a test is invoked from an IDE, for example.
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.");
FilePath mvn = hudson.getRootPath().createTempFile("maven", "zip");
FilePath mvn = jenkins.getRootPath().createTempFile("maven", "zip");
mvn.copyFrom(HudsonTestCase.class.getClassLoader().getResource(mavenVersion + "-bin.zip"));
File mvnHome = new File(buildDirectory);
mvn.unzip(new FilePath(mvnHome));
......@@ -590,7 +588,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
MavenInstallation mavenInstallation = new MavenInstallation("default",
new File(mvnHome,mavenVersion).getAbsolutePath(), NO_PROPERTIES);
hudson.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(mavenInstallation);
jenkins.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(mavenInstallation);
return mavenInstallation;
}
......@@ -604,7 +602,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
} else {
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.");
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"));
File antHome = createTmpDir();
ant.unzip(new FilePath(antHome));
......@@ -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);
}
hudson.getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(antInstallation);
jenkins.getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(antInstallation);
return antInstallation;
}
......@@ -627,7 +625,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
}
protected FreeStyleProject createFreeStyleProject(String name) throws IOException {
return hudson.createProject(FreeStyleProject.class, name);
return jenkins.createProject(FreeStyleProject.class, name);
}
protected MatrixProject createMatrixProject() throws IOException {
......@@ -635,7 +633,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
}
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 {
* @see #configureDefaultMaven()
*/
protected MavenModuleSet createMavenProject(String name) throws IOException {
MavenModuleSet mavenModuleSet = hudson.createProject(MavenModuleSet.class,name);
MavenModuleSet mavenModuleSet = jenkins.createProject(MavenModuleSet.class,name);
mavenModuleSet.setRunHeadless( true );
return mavenModuleSet;
}
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 {
* Creates a slave with certain additional environment variables
*/
public DumbSlave createSlave(String labels, EnvVars env) throws Exception {
synchronized (hudson) {
int sz = hudson.getNodes().size();
synchronized (jenkins) {
int sz = jenkins.getNodes().size();
return createSlave("slave" + sz,labels,env);
}
}
public DumbSlave createSlave(String nodeName, String labels, EnvVars env) throws Exception {
synchronized (hudson) {
synchronized (jenkins) {
DumbSlave slave = new DumbSlave(nodeName, "dummy",
createTmpDir().getPath(), "1", Mode.NORMAL, labels==null?"":labels, createComputerLauncher(env),
RetentionStrategy.NOOP, Collections.<NodeProperty<?>>emptyList());
hudson.addNode(slave);
jenkins.addNode(slave);
return slave;
}
}
public PretendSlave createPretendSlave(FakeLauncher faker) throws Exception {
synchronized (hudson) {
int sz = hudson.getNodes().size();
synchronized (jenkins) {
int sz = jenkins.getNodes().size();
PretendSlave slave = new PretendSlave("slave" + sz, createTmpDir().getPath(), "", createComputerLauncher(null), faker);
hudson.addNode(slave);
jenkins.addNode(slave);
return slave;
}
}
......@@ -763,12 +761,12 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
* Environment variables to add to the slave process. Can be null.
*/
public CommandLauncher createComputerLauncher(EnvVars env) throws URISyntaxException, MalformedURLException {
int sz = hudson.getNodes().size();
int sz = jenkins.getNodes().size();
return new CommandLauncher(
String.format("\"%s/bin/java\" %s -jar \"%s\"",
System.getProperty("java.home"),
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);
}
......@@ -903,7 +901,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
@SuppressWarnings("unchecked")
protected <N extends Node> N configRoundtrip(N node) throws Exception {
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 {
......@@ -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 {
executeOnServer(new Callable<Object>() {
public Object call() throws Exception {
Descriptor d = hudson.getDescriptor(type);
Descriptor d = jenkins.getDescriptor(type);
WebClient wc = createWebClient();
for (String property : listProperties(properties)) {
String url = d.getHelpFile(property);
......@@ -1231,7 +1229,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
}
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 {
* Gets the descriptor instance of the current Hudson by its type.
*/
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 {
* Returns true if Hudson is building something or going to build something.
*/
protected boolean isSomethingHappening() {
if (!hudson.getQueue().isEmpty())
if (!jenkins.getQueue().isEmpty())
return true;
for (Computer n : hudson.getComputers())
for (Computer n : jenkins.getComputers())
if (!n.isIdle())
return true;
return false;
......@@ -1351,14 +1349,14 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
if (System.currentTimeMillis()-startTime > timeout) {
List<Executable> building = new ArrayList<Executable>();
for (Computer c : hudson.getComputers()) {
for (Computer c : jenkins.getComputers()) {
for (Executor e : c.getExecutors()) {
if (e.isBusy())
building.add(e.getCurrentExecutable());
}
}
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 {
final Exception[] t = new Exception[1];
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();
cea.add(id,new Runnable() {
public void run() {
......@@ -1823,8 +1821,8 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
public WebRequestSettings addCrumb(WebRequestSettings req) {
NameValuePair crumb[] = { new NameValuePair() };
crumb[0].setName(hudson.getCrumbIssuer().getDescriptor().getCrumbRequestField());
crumb[0].setValue(hudson.getCrumbIssuer().getCrumb( null ));
crumb[0].setName(jenkins.getCrumbIssuer().getDescriptor().getCrumbRequestField());
crumb[0].setValue(jenkins.getCrumbIssuer().getCrumb( null ));
req.setRequestParameters(Arrays.asList( crumb ));
return req;
......@@ -1834,7 +1832,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
* Creates a URL with crumb parameters relative to {{@link #getContextPath()}
*/
public URL createCrumbedUrl(String relativePath) throws IOException {
CrumbIssuer issuer = hudson.getCrumbIssuer();
CrumbIssuer issuer = jenkins.getCrumbIssuer();
String crumbName = issuer.getDescriptor().getCrumbRequestField();
String crumb = issuer.getCrumb(null);
......@@ -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.
*/
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();
cea.add(id,requestHandler);
return goTo("closures/?uuid="+id);
......
......@@ -53,8 +53,7 @@ import hudson.model.FileParameterDefinition
import hudson.model.Cause.LegacyCodeCause
import hudson.model.ParametersAction
import hudson.model.FileParameterValue
import org.jvnet.hudson.test.MockBuilder
import org.jvnet.hudson.test.SleepBuilder
import java.util.concurrent.CountDownLatch
/**
......@@ -209,7 +208,7 @@ public class MatrixProjectTest extends HudsonTestCase {
* Makes sure that the configuration correctly roundtrips.
*/
public void testConfigRoundtrip() {
hudson.getJDKs().addAll([
jenkins.getJDKs().addAll([
new JDK("jdk1.7","somewhere"),
new JDK("jdk1.6","here"),
new JDK("jdk1.5","there")]);
......@@ -255,10 +254,10 @@ public class MatrixProjectTest extends HudsonTestCase {
System.out.println(p.labels);
assertEquals(4,p.labels.size());
assertTrue(p.labels.contains(hudson.getLabel("slave0&&slave2")));
assertTrue(p.labels.contains(hudson.getLabel("slave1&&slave2")));
assertTrue(p.labels.contains(hudson.getLabel("slave0&&slave3")));
assertTrue(p.labels.contains(hudson.getLabel("slave1&&slave3")));
assertTrue(p.labels.contains(jenkins.getLabel("slave0&&slave2")));
assertTrue(p.labels.contains(jenkins.getLabel("slave1&&slave2")));
assertTrue(p.labels.contains(jenkins.getLabel("slave0&&slave3")));
assertTrue(p.labels.contains(jenkins.getLabel("slave1&&slave3")));
}
/**
......@@ -283,7 +282,7 @@ public class MatrixProjectTest extends HudsonTestCase {
// have foo=1 block to make sure the 2nd configuration is in the queue
firstStarted.block();
// enter into the quiet down while foo=2 is still in the queue
hudson.doQuietDown();
jenkins.doQuietDown();
buildCanProceed.signal();
// make sure foo=2 still completes. use time out to avoid hang
......
......@@ -24,13 +24,13 @@
package hudson.model
import com.gargoylesoftware.htmlunit.Page
import hudson.model.BuildListener
import hudson.slaves.EnvironmentVariablesNodeProperty
import hudson.slaves.EnvironmentVariablesNodeProperty.Entry
import junit.framework.Assert
import org.jvnet.hudson.test.CaptureEnvironmentBuilder
import org.jvnet.hudson.test.GroovyHudsonTestCase
import org.jvnet.hudson.test.ExtractResourceWithChangesSCM
import org.jvnet.hudson.test.FakeChangeLogSCM
import org.jvnet.hudson.test.FailureBuilder
import org.jvnet.hudson.test.UnstableBuilder
......@@ -38,7 +38,7 @@ import org.jvnet.hudson.test.UnstableBuilder
public class AbstractBuildTest extends GroovyHudsonTestCase {
void testVariablesResolved() {
def project = createFreeStyleProject();
hudson.nodeProperties.replaceBy([
jenkins.nodeProperties.replaceBy([
new EnvironmentVariablesNodeProperty(new Entry("KEY1", "value"), new Entry("KEY2",'$KEY1'))]);
def builder = new CaptureEnvironmentBuilder();
project.buildersList.add(builder);
......
......@@ -39,7 +39,7 @@ public class SlaveTest extends GroovyHudsonTestCase {
*/
void testFormValidation() {
executeOnServer {
assertNotNull(hudson.getDescriptor(DumbSlave.class).getCheckUrl("remoteFS"))
assertNotNull(jenkins.getDescriptor(DumbSlave.class).getCheckUrl("remoteFS"))
}
}
......
......@@ -38,7 +38,7 @@ public class UpdateCenter2Test extends HudsonTestCase {
void testInstall() {
UpdateSite.neverUpdate = false;
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;
assertTrue(job.status instanceof Success)
}
......
......@@ -24,7 +24,6 @@
*/
package hudson;
import hudson.PluginWrapper;
import org.jvnet.hudson.test.HudsonTestCase;
import org.jvnet.hudson.test.recipes.LocalData;
......@@ -49,7 +48,7 @@ public class ClassicPluginStrategyTest extends HudsonTestCase {
public void testDependencyClassLoader() throws Exception {
// Test data has: foo3 depends on foo2,foo1; foo2 depends on foo1
// (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();
assertTrue(res + "should be foo3", res.contains("/foo3/"));
......
......@@ -32,7 +32,7 @@ public class ExtensionListTest extends HudsonTestCase {
public void testAutoDiscovery() throws Exception {
ExtensionList<Animal> list = hudson.getExtensionList(Animal.class);
ExtensionList<Animal> list = jenkins.getExtensionList(Animal.class);
assertEquals(2,list.size());
assertNotNull(list.get(Dog.class));
assertNotNull(list.get(Cat.class));
......@@ -98,17 +98,17 @@ public class ExtensionListTest extends HudsonTestCase {
public void testDescriptorLookup() throws Exception {
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,hudson.getDescriptor(Sishamo.class));
assertSame(d, jenkins.getDescriptor(Sishamo.class));
}
public void testFishDiscovery() throws Exception {
// 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);
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());
assertNotNull(list.get(Tai.DescriptorImpl.class));
assertNotNull(list.get(Saba.DescriptorImpl.class));
......@@ -175,7 +175,7 @@ public class ExtensionListTest extends HudsonTestCase {
* Makes sure sorting of the components work as expected.
*/
public void testOrdinals() {
ExtensionList<Car> list = hudson.getExtensionList(Car.class);
ExtensionList<Car> list = jenkins.getExtensionList(Car.class);
assertEquals("honda",list.get(0).name);
assertEquals("mazda",list.get(1).name);
assertEquals("toyota",list.get(2).name);
......
......@@ -60,7 +60,7 @@ public class PluginManagerTest extends HudsonTestCase {
f.getInputByName("name").setValueAttribute(plugin.getAbsolutePath());
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 {
submit(f);
// 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 {
*/
@WithPlugin("tasks.jpi")
public void testWithRecipeJpi() throws Exception {
assertNotNull(hudson.getPlugin("tasks"));
assertNotNull(jenkins.getPlugin("tasks"));
}
/**
......@@ -92,7 +92,7 @@ public class PluginManagerTest extends HudsonTestCase {
*/
@WithPlugin("legacy.hpi")
public void testWithRecipeHpi() throws Exception {
assertNotNull(hudson.getPlugin("legacy"));
assertNotNull(jenkins.getPlugin("legacy"));
}
/**
......@@ -101,7 +101,7 @@ public class PluginManagerTest extends HudsonTestCase {
@WithPlugin("tasks.jpi")
public void testOptionalMavenDependency() throws Exception {
PluginWrapper.Dependency m2=null;
PluginWrapper tasks = hudson.getPluginManager().getPlugin("tasks");
PluginWrapper tasks = jenkins.getPluginManager().getPlugin("tasks");
for( PluginWrapper.Dependency d : tasks.getOptionalDependencies() ) {
if(d.shortName.equals("maven-plugin")) {
assertNull(m2);
......@@ -125,7 +125,7 @@ public class PluginManagerTest extends HudsonTestCase {
@WithPlugin("tasks.jpi")
@WithPluginManager(PluginManagerImpl_for_testUberClassLoaderIsAvailableDuringStart.class)
public void testUberClassLoaderIsAvailableDuringStart() {
assertTrue(((PluginManagerImpl_for_testUberClassLoaderIsAvailableDuringStart)hudson.pluginManager).tested);
assertTrue(((PluginManagerImpl_for_testUberClassLoaderIsAvailableDuringStart) jenkins.pluginManager).tested);
}
public class PluginManagerImpl_for_testUberClassLoaderIsAvailableDuringStart extends LocalPluginManager {
......@@ -163,7 +163,7 @@ public class PluginManagerTest extends HudsonTestCase {
public void testUberClassLoaderDoesntUseContextClassLoader() throws Exception {
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();
t.setContextClassLoader(ucl);
......
......@@ -31,13 +31,13 @@ public class PluginManagerTest2 extends HudsonTestCase {
@WithPlugin("tasks.jpi")
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 pinned before update",tasks.isPinned());
uploadPlugin("tasks.jpi", false);
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());
assertFalse("cvs shouldn't be pinned before update",cvs.isPinned());
uploadPlugin("cvs.hpi", true);
......
......@@ -61,7 +61,7 @@ public class JnlpAccessWithSecuredHudsonTest extends HudsonTestCase {
@PresetData(DataSet.NO_ANONYMOUS_READACCESS)
@Email("http://www.nabble.com/Launching-slave-by-JNLP-with-Active-Directory-plugin-and-matrix-security-problem-td18980323.html")
public void test() throws Exception {
hudson.setNodes(Collections.singletonList(createNewJnlpSlave("test")));
jenkins.setNodes(Collections.singletonList(createNewJnlpSlave("test")));
HudsonTestCase.WebClient wc = new WebClient();
HtmlPage p = wc.login("alice").goTo("computer/test/");
......
......@@ -60,7 +60,7 @@ public class TooManyJobsButNoViewTest extends HudsonTestCase {
assertNotNull(p.getFormByName(mon.id));
// once we create a view, the message should disappear
hudson.addView(new ListView("test"));
jenkins.addView(new ListView("test"));
verifyNoForm();
}
......
......@@ -37,12 +37,12 @@ import java.io.Writer;
*/
public class MarkupFormatterTest extends HudsonTestCase {
public void testConfigRoundtrip() throws Exception {
hudson.setSecurityRealm(new HudsonPrivateSecurityRealm(false));
hudson.setAuthorizationStrategy(new Unsecured());
hudson.setMarkupFormatter(new DummyMarkupImpl("hello"));
jenkins.setSecurityRealm(new HudsonPrivateSecurityRealm(false));
jenkins.setAuthorizationStrategy(new Unsecured());
jenkins.setMarkupFormatter(new DummyMarkupImpl("hello"));
configRoundtrip();
assertEquals("hello", ((DummyMarkupImpl)hudson.getMarkupFormatter()).prefix);
assertEquals("hello", ((DummyMarkupImpl) jenkins.getMarkupFormatter()).prefix);
}
public static class DummyMarkupImpl extends MarkupFormatter {
......
......@@ -25,7 +25,7 @@ public class MatrixProjectDependencyTest extends HudsonTestCase {
FreeStyleProject freestyleProject = createFreeStyleProject();
matrixProject.getPublishersList().add(new BuildTrigger(freestyleProject.getName(), false));
hudson.rebuildDependencyGraph();
jenkins.rebuildDependencyGraph();
buildAndAssertSuccess(matrixProject);
waitUntilNoActivity();
......@@ -34,7 +34,7 @@ public class MatrixProjectDependencyTest extends HudsonTestCase {
assertEquals("There should only be one FreestyleBuild", 1, builds.size());
FreeStyleBuild build = builds.iterator().next();
assertEquals(Result.SUCCESS, build.getResult());
List<AbstractProject> downstream = hudson.getDependencyGraph().getDownstream(matrixProject);
List<AbstractProject> downstream = jenkins.getDependencyGraph().getDownstream(matrixProject);
assertTrue(downstream.contains(freestyleProject));
}
......
......@@ -54,7 +54,7 @@ public class MatrixTest extends HudsonTestCase {
*/
@Bug(9293)
public void testConfigurationACL() throws Exception {
hudson.setAuthorizationStrategy(new ProjectMatrixAuthorizationStrategy());
jenkins.setAuthorizationStrategy(new ProjectMatrixAuthorizationStrategy());
MatrixProject mp = createMatrixProject();
mp.setAxes(new AxisList(new Axis("foo", "a", "b")));
MatrixConfiguration mc = mp.getItem("foo=a");
......
......@@ -54,7 +54,7 @@ import org.apache.commons.io.FileUtils;
public class AbstractProjectTest extends HudsonTestCase {
public void testConfigRoundtrip() throws Exception {
FreeStyleProject project = createFreeStyleProject();
Label l = hudson.getLabel("foo && bar");
Label l = jenkins.getLabel("foo && bar");
project.setAssignedLabel(l);
configRoundtrip((Item)project);
......@@ -112,14 +112,14 @@ public class AbstractProjectTest extends HudsonTestCase {
*/
@PresetData(DataSet.ANONYMOUS_READONLY)
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
testWipeWorkspaceProtected();
// there shouldn't be any "wipe out workspace" link for anonymous user
WebClient webClient = new WebClient();
HtmlPage page = webClient.getPage(hudson.getItem("test0"));
HtmlPage page = webClient.getPage(jenkins.getItem("test0"));
page = (HtmlPage)page.getFirstAnchorByText("Workspace").click();
try {
......
......@@ -71,9 +71,9 @@ public class ApiTest extends HudsonTestCase {
}
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");
assertEquals(hudson.getSystemMessage(), page.getWebResponse().getContentAsString());
assertEquals(jenkins.getSystemMessage(), page.getWebResponse().getContentAsString());
}
public void testUnwrappedMultipleItems() throws Exception {
......
......@@ -30,7 +30,6 @@ import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.acegisecurity.context.SecurityContext;
import org.acegisecurity.context.SecurityContextHolder;
import org.jvnet.hudson.test.HudsonTestCase;
import org.jvnet.hudson.test.Bug;
......@@ -54,15 +53,15 @@ public class DependencyGraphTest extends HudsonTestCase {
new BuildTrigger(Collections.singletonList(down1), Result.SUCCESS));
// Add one downstream job with custom Dependency impl:
p.getBuildersList().add(new TestDeclarer(Result.UNSTABLE, down2));
hudson.rebuildDependencyGraph();
jenkins.rebuildDependencyGraph();
// First build won't trigger down1 (Unstable doesn't meet threshold)
// but will trigger down2 (build #1 is odd).
Build b = (Build)p.scheduleBuild2(0, new Cause.UserCause()).get();
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, down1.getLastBuild());
q = hudson.getQueue().getItem(down2);
q = jenkins.getQueue().getItem(down2);
assertNotNull("down2 should be in queue (quiet period): " + log, q);
Run r = (Run)q.getFuture().get(6, TimeUnit.SECONDS);
assertNotNull("down2 should be triggered: " + log, r);
......@@ -70,16 +69,16 @@ public class DependencyGraphTest extends HudsonTestCase {
r.getAction(MailMessageIdAction.class));
// Now change to success result..
p.getBuildersList().replace(new TestDeclarer(Result.SUCCESS, down2));
hudson.rebuildDependencyGraph();
jenkins.rebuildDependencyGraph();
// ..and next build will trigger down1 (Success meets threshold),
// but not down2 (build #2 is even)
b = (Build)p.scheduleBuild2(0, new Cause.UserCause()).get();
log = getLog(b);
q = hudson.getQueue().getItem(down2);
q = jenkins.getQueue().getItem(down2);
assertNull("down2 should not be triggered: " + log, q);
assertEquals("down2 should not be triggered: " + log, 1,
down2.getLastBuild().getNumber());
q = hudson.getQueue().getItem(down1);
q = jenkins.getQueue().getItem(down1);
assertNotNull("down1 should be in queue (quiet period): " + log, q);
r = (Run)q.getFuture().get(6, TimeUnit.SECONDS);
assertNotNull("down1 should be triggered", r);
......@@ -113,14 +112,14 @@ public class DependencyGraphTest extends HudsonTestCase {
@LocalData @Bug(5265)
public void testItemReadPermission() throws Exception {
// Rebuild dependency graph as anonymous user:
hudson.rebuildDependencyGraph();
jenkins.rebuildDependencyGraph();
try {
// Switch to full access to check results:
ACL.impersonate(ACL.SYSTEM);
// @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);
List<AbstractProject> down = hudson.getDependencyGraph().getDownstream(up);
List<AbstractProject> down = jenkins.getDependencyGraph().getDownstream(up);
assertEquals("Should have one downstream project", 1, down.size());
} finally {
SecurityContextHolder.clearContext();
......
......@@ -40,7 +40,7 @@ public class ExecutorTest extends HudsonTestCase {
@Bug(4756)
public void testWhenAnExecuterIsYankedANewExecuterTakesItsPlace() throws Exception {
Computer c = hudson.toComputer();
Computer c = jenkins.toComputer();
Executor e = getExecutorByNumber(c, 0);
kill(e);
......
......@@ -79,18 +79,18 @@ public class HudsonTest extends HudsonTestCase {
submit(form);
// make sure all the pieces are intact
assertEquals(2,hudson.getNumExecutors());
assertSame(Mode.NORMAL,hudson.getMode());
assertSame(SecurityRealm.NO_AUTHENTICATION,hudson.getSecurityRealm());
assertSame(AuthorizationStrategy.UNSECURED,hudson.getAuthorizationStrategy());
assertEquals(5,hudson.getQuietPeriod());
assertEquals(2, jenkins.getNumExecutors());
assertSame(Mode.NORMAL, jenkins.getMode());
assertSame(SecurityRealm.NO_AUTHENTICATION, jenkins.getSecurityRealm());
assertSame(AuthorizationStrategy.UNSECURED, jenkins.getAuthorizationStrategy());
assertEquals(5, jenkins.getQuietPeriod());
List<JDK> jdks = hudson.getJDKs();
List<JDK> jdks = jenkins.getJDKs();
assertEquals(3,jdks.size()); // Hudson adds one more
assertJDK(jdks.get(0),"jdk1","/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);
assertAnt(ants[0],"ant1","/tmp");
assertAnt(ants[1],"ant2","/tmp");
......@@ -174,10 +174,10 @@ public class HudsonTest extends HudsonTestCase {
};
BuildStep.PUBLISHERS.addRecorder(dummy);
assertSame(dummy,hudson.getDescriptor(HudsonTest.class.getName()));
assertSame(dummy, jenkins.getDescriptor(HudsonTest.class.getName()));
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 {
Field pv = Jenkins.class.getDeclaredField("primaryView");
pv.setAccessible(true);
String value = null;
pv.set(hudson, value);
assertNull("null primaryView", hudson.getView(value));
pv.set(jenkins, value);
assertNull("null primaryView", jenkins.getView(value));
value = "some bogus name";
pv.set(hudson, value);
assertNull("invalid primaryView", hudson.getView(value));
pv.set(jenkins, value);
assertNull("invalid primaryView", jenkins.getView(value));
}
}
......@@ -53,7 +53,7 @@ public class JobPropertyTest extends HudsonTestCase {
private void assertJobPropertySummaryIsShownInIndexPage(TopLevelItemDescriptor type) throws Exception {
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);
HtmlPage page = new WebClient().goTo("job/job-test-case");
......
......@@ -47,10 +47,10 @@ public class JobQueueTest extends HudsonTestCase {
assertTrue(project.isInQueue());
//Cancel the project from queue
hudson.getQueue().cancel(project.getQueueItem());
jenkins.getQueue().cancel(project.getQueueItem());
//Verify the project is removed from Queue
assertTrue(hudson.getQueue().isEmpty());
assertTrue(jenkins.getQueue().isEmpty());
}
public void testBuildPendingWhenBuildInPostProduction() throws Exception {
......@@ -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
project.scheduleBuild2(0);
assertTrue(project.isInQueue()); //That means its pending or its waiting or blocked
hudson.getQueue().maintain();
while(hudson.getQueue().getItem(project) instanceof WaitingItem) {
System.out.println(hudson.getQueue().getItem(project));
hudson.getQueue().maintain();
jenkins.getQueue().maintain();
while(jenkins.getQueue().getItem(project) instanceof WaitingItem) {
System.out.println(jenkins.getQueue().getItem(project));
jenkins.getQueue().maintain();
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 {
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 {
if(JobQueueTest.fireFinalizeFlag) {
//Verify the build is removed from Queue since now it is in Completed state
//it should be scheduled for run
hudson.getQueue().maintain();
assertFalse(hudson.getQueue().getItem(project) instanceof BlockedItem);
jenkins.getQueue().maintain();
assertFalse(jenkins.getQueue().getItem(project) instanceof BlockedItem);
}
else {
fail("The maximum attemps for checking if the job is in COMPLETED State have reached");
......
......@@ -34,7 +34,6 @@ import java.util.concurrent.CountDownLatch;
import jenkins.model.ProjectNamingStrategy;
import org.junit.Test;
import org.jvnet.hudson.test.Bug;
import org.jvnet.hudson.test.HudsonTestCase;
import org.jvnet.hudson.test.recipes.LocalData;
......@@ -185,7 +184,7 @@ public class JobTest extends HudsonTestCase {
@LocalData
public void testConfigDotXmlPermission() throws Exception {
hudson.setCrumbIssuer(null);
jenkins.setCrumbIssuer(null);
WebClient wc = new WebClient();
boolean saveEnabled = Item.EXTENDED_READ.getEnabled();
Item.EXTENDED_READ.setEnabled(true);
......@@ -226,7 +225,7 @@ public class JobTest extends HudsonTestCase {
public void testGetArtifactsUpTo() throws Exception {
// There was a bug where intermediate directories were counted,
// 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.getArtifactsUpTo(3).size());
assertEquals(2, r.getArtifactsUpTo(2).size());
......@@ -245,7 +244,7 @@ public class JobTest extends HudsonTestCase {
}
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");
assertNotNull("no project created", p);
try {
......@@ -255,7 +254,7 @@ public class JobTest extends HudsonTestCase {
// OK, expected
}finally{
// 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");
}
......
......@@ -63,14 +63,14 @@ public class ParametersTest extends HudsonTestCase {
assertEquals("run", ((HtmlElement) element.selectSingleNode("td[@class='setting-name']")).getTextContent());
submit(form);
Queue.Item q = hudson.getQueue().getItem(project);
Queue.Item q = jenkins.getQueue().getItem(project);
if (q != null) q.getFuture().get();
else Thread.sleep(1000);
assertEquals("newValue", builder.getEnvVars().get("STRING"));
assertEquals("true", builder.getEnvVars().get("BOOLEAN"));
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 {
......@@ -96,7 +96,7 @@ public class ParametersTest extends HudsonTestCase {
opt.setSelected(true);
submit(form);
Queue.Item q = hudson.getQueue().getItem(project);
Queue.Item q = jenkins.getQueue().getItem(project);
if (q != null) q.getFuture().get();
else Thread.sleep(1000);
......
......@@ -32,7 +32,6 @@ import hudson.matrix.MatrixProject;
import hudson.matrix.TextAxis;
import hudson.model.Cause.*;
import hudson.model.Queue.*;
import hudson.model.Queue.*;
import hudson.tasks.Shell;
import hudson.triggers.SCMTrigger.SCMTriggerCause;
import hudson.triggers.TimerTrigger.TimerTriggerCause;
......@@ -70,17 +69,17 @@ public class QueueTest extends HudsonTestCase {
* Checks the persistence of queue.
*/
public void testPersistence() throws Exception {
Queue q = hudson.getQueue();
Queue q = jenkins.getQueue();
// prevent execution to push stuff into the queue
hudson.setNumExecutors(0);
hudson.setNodes(hudson.getNodes());
jenkins.setNumExecutors(0);
jenkins.setNodes(jenkins.getNodes());
FreeStyleProject testProject = createFreeStyleProject("test");
testProject.scheduleBuild(new UserIdCause());
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);
q.clear();
......@@ -98,17 +97,17 @@ public class QueueTest extends HudsonTestCase {
* Can {@link Queue} successfully recover removal?
*/
public void testPersistence2() throws Exception {
Queue q = hudson.getQueue();
Queue q = jenkins.getQueue();
// prevent execution to push stuff into the queue
hudson.setNumExecutors(0);
hudson.setNodes(hudson.getNodes());
jenkins.setNumExecutors(0);
jenkins.setNodes(jenkins.getNodes());
FreeStyleProject testProject = createFreeStyleProject("test");
testProject.scheduleBuild(new UserIdCause());
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);
q.clear();
......
......@@ -38,7 +38,7 @@ import org.kohsuke.stapler.StaplerRequest;
public class ViewPropertyTest extends HudsonTestCase {
public void testRoundtrip() throws Exception {
ListView foo = new ListView("foo");
hudson.addView(foo);
jenkins.addView(foo);
// make sure it renders as optionalBlock
HtmlForm f = createWebClient().getPage(foo, "configure").getFormByName("viewConfig");
......@@ -74,7 +74,7 @@ public class ViewPropertyTest extends HudsonTestCase {
public void testInvisibleProperty() throws Exception {
ListView foo = new ListView("foo");
hudson.addView(foo);
jenkins.addView(foo);
// test the rendering (or the lack thereof) of an invisible property
configRoundtrip(foo);
......
......@@ -51,13 +51,13 @@ public class ViewTest extends HudsonTestCase {
*/
@Email("http://d.hatena.ne.jp/ssogabe/20090101/1230744150")
public void testConflictingName() throws Exception {
assertNull(hudson.getView("foo"));
assertNull(jenkins.getView("foo"));
HtmlForm form = new WebClient().goTo("newView").getFormByName("createItem");
form.getInputByName("name").setValueAttribute("foo");
form.getRadioButtonsByName("mode").get(0).setChecked(true);
submit(form);
assertNotNull(hudson.getView("foo"));
assertNotNull(jenkins.getView("foo"));
// do it again and verify an error
try {
......@@ -82,8 +82,8 @@ public class ViewTest extends HudsonTestCase {
Text viewLabel = (Text) privateViewsPage.getFirstByXPath("//table[@id='viewList']//td[@class='active']/text()");
assertTrue("'All' view should be selected", viewLabel.getTextContent().contains(Hudson_ViewName()));
View listView = new ListView("listView", hudson);
hudson.addView(listView);
View listView = new ListView("listView", jenkins);
jenkins.addView(listView);
HtmlPage newViewPage = wc.goTo("/user/me/my-views/newView");
HtmlForm form = newViewPage.getFormByName("createItem");
......@@ -104,11 +104,11 @@ public class ViewTest extends HudsonTestCase {
public void testDeleteView() throws Exception {
WebClient wc = new WebClient();
ListView v = new ListView("list", hudson);
hudson.addView(v);
ListView v = new ListView("list", jenkins);
jenkins.addView(v);
HtmlPage delete = wc.getPage(v, "delete");
submit(delete.getFormByName("delete"));
assertNull(hudson.getView("list"));
assertNull(jenkins.getView("list"));
User user = User.get("user", true);
MyViewsProperty p = user.getProperty(MyViewsProperty.class);
......@@ -122,8 +122,8 @@ public class ViewTest extends HudsonTestCase {
@Bug(9367)
public void testPersistence() throws Exception {
ListView view = new ListView("foo", hudson);
hudson.addView(view);
ListView view = new ListView("foo", jenkins);
jenkins.addView(view);
ListView v = (ListView) Jenkins.XSTREAM.fromXML(Jenkins.XSTREAM.toXML(view));
System.out.println(v.getProperties());
......
......@@ -52,7 +52,7 @@ public class LabelAtomPropertyTest extends HudsonTestCase {
* Tests the configuration persistence between disk, memory, and UI.
*/
public void testConfigRoundtrip() throws Exception {
LabelAtom foo = hudson.getLabelAtom("foo");
LabelAtom foo = jenkins.getLabelAtom("foo");
LabelAtomPropertyImpl old = new LabelAtomPropertyImpl("value");
foo.getProperties().add(old);
assertTrue(foo.getConfigFile().exists());
......
......@@ -68,13 +68,13 @@ public class LabelExpressionTest extends HudsonTestCase {
return true;
}
});
p1.setAssignedLabel(hudson.getLabel("win && 32bit"));
p1.setAssignedLabel(jenkins.getLabel("win && 32bit"));
FreeStyleProject p2 = createFreeStyleProject();
p2.setAssignedLabel(hudson.getLabel("win && 32bit"));
p2.setAssignedLabel(jenkins.getLabel("win && 32bit"));
FreeStyleProject p3 = createFreeStyleProject();
p3.setAssignedLabel(hudson.getLabel("win"));
p3.setAssignedLabel(jenkins.getLabel("win"));
Future<FreeStyleBuild> f1 = p1.scheduleBuild2(0);
......@@ -107,17 +107,17 @@ public class LabelExpressionTest extends HudsonTestCase {
FreeStyleProject p = createFreeStyleProject();
p.setAssignedLabel(hudson.getLabel("!win"));
p.setAssignedLabel(jenkins.getLabel("!win"));
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));
assertSame(s,b.getBuiltOn());
p.setAssignedLabel(hudson.getLabel("!win"));
p.setAssignedLabel(jenkins.getLabel("!win"));
b = assertBuildStatusSuccess(p.scheduleBuild2(0));
assertSame(hudson,b.getBuiltOn());
assertSame(jenkins,b.getBuiltOn());
}
/**
......@@ -153,7 +153,7 @@ public class LabelExpressionTest extends HudsonTestCase {
public void testLaxParsing() {
// 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.getExpression(),"\"lucene.zones.apache.org (Solaris 10)\"");
}
......@@ -161,11 +161,11 @@ public class LabelExpressionTest extends HudsonTestCase {
public void testDataCompatibilityWithHostNameWithWhitespace() throws Exception {
DumbSlave slave = new DumbSlave("abc def (xyz) : test", "dummy",
createTmpDir().getPath(), "1", Mode.NORMAL, "", createComputerLauncher(null), RetentionStrategy.NOOP, Collections.EMPTY_LIST);
hudson.addNode(slave);
jenkins.addNode(slave);
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().getExpression());
......@@ -180,7 +180,7 @@ public class LabelExpressionTest extends HudsonTestCase {
}
public void testQuote() {
Label l = hudson.getLabel("\"abc\\\\\\\"def\"");
Label l = jenkins.getLabel("\"abc\\\\\\\"def\"");
assertEquals("abc\\\"def",l.getName());
}
......@@ -188,14 +188,14 @@ public class LabelExpressionTest extends HudsonTestCase {
* The name should have parenthesis at the right place to preserve the tree structure.
*/
public void testComposite() {
LabelAtom x = hudson.getLabelAtom("x");
LabelAtom x = jenkins.getLabelAtom("x");
assertEquals("!!x",x.not().not().getName());
assertEquals("(x||x)&&x",x.or(x).and(x).getName());
assertEquals("x&&x||x",x.and(x).or(x).getName());
}
public void testDash() {
hudson.getLabelAtom("solaris-x86");
jenkins.getLabelAtom("solaris-x86");
}
private void parseShouldFail(String expr) {
......
......@@ -63,7 +63,7 @@ public class ItemListenerTest extends HudsonTestCase {
+ "<buildWrappers/></project>").getBytes()),
out, out);
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());
} finally {
cli.close();
......
......@@ -18,7 +18,7 @@ import junit.framework.Assert;
public class CliAuthenticationTest extends HudsonTestCase {
public void test1() throws Exception {
// dummy security realm that authenticates when username==password
hudson.setSecurityRealm(createDummySecurityRealm());
jenkins.setSecurityRealm(createDummySecurityRealm());
successfulCommand("test","--username","abc","--password","abc");
}
......@@ -69,7 +69,7 @@ public class CliAuthenticationTest extends HudsonTestCase {
@For({LoginCommand.class, LogoutCommand.class, ClientAuthenticationCache.class})
public void testLogin() throws Exception {
hudson.setSecurityRealm(createDummySecurityRealm());
jenkins.setSecurityRealm(createDummySecurityRealm());
successfulCommand("login","--username","abc","--password","abc");
successfulCommand("test"); // now we can run without an explicit credential
......
......@@ -42,7 +42,7 @@ public class ExtendedReadPermissionTest extends HudsonTestCase {
public void testReadOnlyConfigAccessWithPermissionEnabled() throws Exception {
setPermissionEnabled(true);
AuthorizationStrategy as = hudson.getAuthorizationStrategy();
AuthorizationStrategy as = jenkins.getAuthorizationStrategy();
assertTrue("Expecting GlobalMatrixAuthorizationStrategy", (as instanceof GlobalMatrixAuthorizationStrategy));
GlobalMatrixAuthorizationStrategy gas = (GlobalMatrixAuthorizationStrategy)as;
assertTrue("Charlie should have extended read for this test", gas.hasExplicitPermission("charlie",Item.EXTENDED_READ));
......@@ -58,7 +58,7 @@ public class ExtendedReadPermissionTest extends HudsonTestCase {
public void testReadOnlyConfigAccessWithPermissionDisabled() throws Exception {
setPermissionEnabled(false);
AuthorizationStrategy as = hudson.getAuthorizationStrategy();
AuthorizationStrategy as = jenkins.getAuthorizationStrategy();
assertTrue("Expecting GlobalMatrixAuthorizationStrategy", (as instanceof GlobalMatrixAuthorizationStrategy));
GlobalMatrixAuthorizationStrategy gas = (GlobalMatrixAuthorizationStrategy)as;
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 {
public void testNoConfigAccessWithPermissionEnabled() throws Exception {
setPermissionEnabled(true);
AuthorizationStrategy as = hudson.getAuthorizationStrategy();
AuthorizationStrategy as = jenkins.getAuthorizationStrategy();
assertTrue("Expecting GlobalMatrixAuthorizationStrategy", (as instanceof GlobalMatrixAuthorizationStrategy));
GlobalMatrixAuthorizationStrategy gas = (GlobalMatrixAuthorizationStrategy)as;
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;
public class DefaultCrumbIssuerTest extends HudsonTestCase {
protected void setUp() throws Exception {
super.setUp();
assertNotNull(hudson);
assertNotNull(jenkins);
CrumbIssuer issuer = new DefaultCrumbIssuer(false);
assertNotNull(issuer);
hudson.setCrumbIssuer(issuer);
jenkins.setCrumbIssuer(issuer);
}
private static final String[] testData = {
......@@ -85,7 +85,7 @@ public class DefaultCrumbIssuerTest extends HudsonTestCase {
public void testProxyCompatibilityMode() throws Exception {
CrumbIssuer issuer = new DefaultCrumbIssuer(true);
assertNotNull(issuer);
hudson.setCrumbIssuer(issuer);
jenkins.setCrumbIssuer(issuer);
WebClient wc = new WebClient();
wc.addRequestHeader(HEADER_NAME, testData[0]);
......
......@@ -43,11 +43,11 @@ public class EnvironmentVariableNodePropertyTest extends HudsonTestCase {
* Master properties are available
*/
public void testMasterPropertyOnMaster() throws Exception {
hudson.getGlobalNodeProperties().replaceBy(
jenkins.getGlobalNodeProperties().replaceBy(
Collections.singleton(new EnvironmentVariablesNodeProperty(
new Entry("KEY", "masterValue"))));
Map<String, String> envVars = executeBuild(hudson);
Map<String, String> envVars = executeBuild(jenkins);
Assert.assertEquals("masterValue", envVars.get("KEY"));
}
......@@ -56,7 +56,7 @@ public class EnvironmentVariableNodePropertyTest extends HudsonTestCase {
* Both slave and master properties are available, but slave properties have priority
*/
public void testSlaveAndMasterPropertyOnSlave() throws Exception {
hudson.getGlobalNodeProperties().replaceBy(
jenkins.getGlobalNodeProperties().replaceBy(
Collections.singleton(new EnvironmentVariablesNodeProperty(
new Entry("KEY", "masterValue"))));
setVariables(slave, new Entry("KEY", "slaveValue"));
......@@ -77,7 +77,7 @@ public class EnvironmentVariableNodePropertyTest extends HudsonTestCase {
new StringParameterDefinition("KEY", "parameterValue"));
project.addProperty(pdp);
setVariables(hudson, new Entry("KEY", "masterValue"));
setVariables(jenkins, new Entry("KEY", "masterValue"));
setVariables(slave, new Entry("KEY", "slaveValue"));
Map<String, String> envVars = executeBuild(slave);
......@@ -86,27 +86,27 @@ public class EnvironmentVariableNodePropertyTest extends HudsonTestCase {
}
public void testVariableResolving() throws Exception {
hudson.getGlobalNodeProperties().replaceBy(
jenkins.getGlobalNodeProperties().replaceBy(
Collections.singleton(new EnvironmentVariablesNodeProperty(
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("KEY2"));
}
public void testFormRoundTripForMaster() throws Exception {
hudson.getGlobalNodeProperties().replaceBy(
jenkins.getGlobalNodeProperties().replaceBy(
Collections.singleton(new EnvironmentVariablesNodeProperty(
new Entry("KEY", "value"))));
WebClient webClient = new WebClient();
HtmlPage page = webClient.getPage(hudson, "configure");
HtmlPage page = webClient.getPage(jenkins, "configure");
HtmlForm form = page.getFormByName("config");
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("value", prop.getEnvVars().get("KEY"));
}
......
......@@ -31,7 +31,6 @@ import hudson.model.Computer;
import hudson.model.Node;
import hudson.model.Node.Mode;
import hudson.model.Slave;
import hudson.model.TaskListener;
import hudson.remoting.Callable;
import hudson.remoting.Which;
import hudson.util.ArgumentListBuilder;
......@@ -41,7 +40,6 @@ import org.jvnet.hudson.test.TestExtension;
import javax.inject.Inject;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
......@@ -146,12 +144,12 @@ public class JNLPLauncherTest extends HudsonTestCase {
* Adds a JNLP {@link Slave} to the system and returns it.
*/
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();
slaves.add(new DumbSlave("test","dummy",dir.getAbsolutePath(),"1", Mode.NORMAL, "",
new JNLPLauncher(), RetentionStrategy.INSTANCE, new ArrayList<NodeProperty<?>>()));
hudson.setNodes(slaves);
Computer c = hudson.getComputer("test");
jenkins.setNodes(slaves);
Computer c = jenkins.getComputer("test");
assertNotNull(c);
return c;
}
......
......@@ -49,7 +49,7 @@ public class NodeCanTakeTaskTest extends HudsonTestCase {
super.setUp();
// Set master executor count to zero to force all jobs to slaves
hudson.setNumExecutors(0);
jenkins.setNumExecutors(0);
}
public void testTakeBlockedByProperty() throws Exception {
......@@ -68,7 +68,7 @@ public class NodeCanTakeTaskTest extends HudsonTestCase {
build.get(10, TimeUnit.SECONDS);
fail("Expected timeout exception");
} catch (TimeoutException e) {
List<BuildableItem> buildables = hudson.getQueue().getBuildableItems();
List<BuildableItem> buildables = jenkins.getQueue().getBuildableItems();
Assert.assertNotNull(buildables);
Assert.assertEquals(1, buildables.size());
......
......@@ -51,13 +51,13 @@ public class NodePropertyTest extends HudsonTestCase {
HtmlForm f = createWebClient().goTo("/computer/" + s.getNodeName() + "/configure").getFormByName("config");
((HtmlLabel)f.selectSingleNode(".//LABEL[text()='Some Property']")).click();
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);
p.name = "Kohsuke";
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);
assertEqualDataBoundBeans(p,p2);
}
......
......@@ -28,7 +28,6 @@ import hudson.Launcher;
import hudson.model.*;
import hudson.slaves.NodeProvisioner.NodeProvisionerInvoker;
import hudson.tasks.Builder;
import hudson.util.TimeUnit2;
import org.jvnet.hudson.test.HudsonTestCase;
import org.jvnet.hudson.test.SleepBuilder;
......@@ -104,7 +103,7 @@ public class NodeProvisionerTest extends HudsonTestCase {
* Scenario: schedule a build and see if one slave is provisioned.
*/
public void _testAutoProvision() throws Exception {// excluded since it's fragile
BulkChange bc = new BulkChange(hudson);
BulkChange bc = new BulkChange(jenkins);
try {
DummyCloudImpl cloud = initHudson(10);
......@@ -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.
*/
public void _testLoadSpike() throws Exception {// excluded since it's fragile
BulkChange bc = new BulkChange(hudson);
BulkChange bc = new BulkChange(jenkins);
try {
DummyCloudImpl cloud = initHudson(0);
......@@ -143,7 +142,7 @@ public class NodeProvisionerTest extends HudsonTestCase {
* Scenario: make sure we take advantage of statically configured slaves.
*/
public void _testBaselineSlaveUsage() throws Exception {// excluded since it's fragile
BulkChange bc = new BulkChange(hudson);
BulkChange bc = new BulkChange(jenkins);
try {
DummyCloudImpl cloud = initHudson(0);
// add slaves statically upfront
......@@ -163,11 +162,11 @@ public class NodeProvisionerTest extends HudsonTestCase {
* Scenario: loads on one label shouldn't translate to load on another label.
*/
public void _testLabels() throws Exception {// excluded since it's fragile
BulkChange bc = new BulkChange(hudson);
BulkChange bc = new BulkChange(jenkins);
try {
DummyCloudImpl cloud = initHudson(0);
Label blue = hudson.getLabel("blue");
Label red = hudson.getLabel("red");
Label blue = jenkins.getLabel("blue");
Label red = jenkins.getLabel("red");
cloud.label = red;
// red jobs
......@@ -206,11 +205,11 @@ public class NodeProvisionerTest extends HudsonTestCase {
private DummyCloudImpl initHudson(int delay) throws IOException {
// start a dummy service
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
hudson.setNumExecutors(0);
hudson.setNodes(Collections.<Node>emptyList());
jenkins.setNumExecutors(0);
jenkins.setNodes(Collections.<Node>emptyList());
return cloud;
}
......
......@@ -62,7 +62,7 @@ public class BuildTriggerTest extends HudsonTestCase {
dp = createDownstreamProject();
p.getPublishersList().add(new BuildTrigger("downstream", evenWhenUnstable));
p.getBuildersList().add(new MockBuilder(dontTriggerResult));
hudson.rebuildDependencyGraph();
jenkins.rebuildDependencyGraph();
// First build should not trigger downstream job
FreeStyleBuild b = p.scheduleBuild2(0).get();
......
......@@ -27,22 +27,22 @@ public class EnvVarsInConfigTasksTest extends HudsonTestCase {
public void setUp() throws Exception {
super.setUp();
JDK defaultJDK = hudson.getJDK(null);
JDK defaultJDK = jenkins.getJDK(null);
JDK varJDK = new JDK("varJDK", withVariable(defaultJDK.getHome()));
hudson.getJDKs().add(varJDK);
jenkins.getJDKs().add(varJDK);
// Maven with a variable in its path
configureDefaultMaven();
MavenInstallation defaultMaven = hudson.getDescriptorByType(Maven.DescriptorImpl.class).getInstallations()[0];
MavenInstallation defaultMaven = jenkins.getDescriptorByType(Maven.DescriptorImpl.class).getInstallations()[0];
MavenInstallation varMaven = new MavenInstallation("varMaven",
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
AntInstallation ant = configureDefaultAnt();
AntInstallation antInstallation = new AntInstallation("varAnt",
withVariable(ant.getHome()),NO_PROPERTIES);
hudson.getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(antInstallation);
jenkins.getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(antInstallation);
// create slaves
EnvVars additionalEnv = new EnvVars(DUMMY_LOCATION_VARNAME, "");
......@@ -61,7 +61,7 @@ public class EnvVarsInConfigTasksTest extends HudsonTestCase {
} else {
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
project.setScm(new ExtractResourceSCM(getClass().getResource(
......@@ -92,12 +92,12 @@ public class EnvVarsInConfigTasksTest extends HudsonTestCase {
}
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");
return;
}
FreeStyleProject project = createFreeStyleProject();
project.setJDK(hudson.getJDK("varJDK"));
project.setJDK(jenkins.getJDK("varJDK"));
project.setScm(new ExtractResourceSCM(getClass().getResource(
"/simple-projects.zip")));
......@@ -137,7 +137,7 @@ public class EnvVarsInConfigTasksTest extends HudsonTestCase {
public void testFreeStyleMavenOnSlave() throws Exception {
FreeStyleProject project = createFreeStyleProject();
project.setJDK(hudson.getJDK("varJDK"));
project.setJDK(jenkins.getJDK("varJDK"));
project.setScm(new ExtractResourceSCM(getClass().getResource(
"/simple-projects.zip")));
......@@ -172,7 +172,7 @@ public class EnvVarsInConfigTasksTest extends HudsonTestCase {
public void testNativeMavenOnSlave() throws Exception {
MavenModuleSet project = createMavenProject();
project.setJDK(hudson.getJDK("varJDK"));
project.setJDK(jenkins.getJDK("varJDK"));
project.setScm(new ExtractResourceSCM(getClass().getResource(
"/simple-projects.zip")));
......
......@@ -173,7 +173,7 @@ public class FingerprinterTest extends HudsonTestCase {
FreeStyleProject freestyleProject = createFreeStyleProjectWithFingerprints(singleContents, singleFiles);
addFingerprinterToProject(matrixProject, singleContents, singleFiles);
hudson.rebuildDependencyGraph();
jenkins.rebuildDependencyGraph();
buildAndAssertSuccess(matrixProject);
buildAndAssertSuccess(freestyleProject);
......@@ -183,9 +183,9 @@ public class FingerprinterTest extends HudsonTestCase {
assertEquals("There should only be one FreestyleBuild", 1, builds.size());
FreeStyleBuild build = builds.iterator().next();
assertEquals(Result.SUCCESS, build.getResult());
List<AbstractProject> downstream = hudson.getDependencyGraph().getDownstream(matrixProject);
List<AbstractProject> downstream = jenkins.getDependencyGraph().getDownstream(matrixProject);
assertTrue(downstream.contains(freestyleProject));
List<AbstractProject> upstream = hudson.getDependencyGraph().getUpstream(freestyleProject);
List<AbstractProject> upstream = jenkins.getDependencyGraph().getUpstream(freestyleProject);
assertTrue(upstream.contains(matrixProject));
}
......
......@@ -64,7 +64,7 @@ public class MavenTest extends HudsonTestCase {
* Tests the round-tripping of the configuration.
*/
public void testConfigRoundtrip() throws Exception {
hudson.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(); // reset
jenkins.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(); // reset
FreeStyleProject p = createFreeStyleProject();
p.getBuildersList().add(new Maven("a", null, "b.pom", "c=d", "-e", true));
......@@ -91,14 +91,14 @@ public class MavenTest extends HudsonTestCase {
String mavenHomeVar = "${VAR_MAVEN}" + mavenHome.substring(3);
String mavenVar = mavenHome.substring(0, 3);
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 javaHomeVar = "${VAR_JAVA}" + javaHome.substring(3);
String javaVar = javaHome.substring(0, 3);
JDK varJDK = new JDK("varJDK", javaHomeVar);
hudson.getJDKs().add(varJDK);
jenkins.getJDKs().add(varJDK);
Jenkins.getInstance().getNodeProperties().replaceBy(
Collections.singleton(new EnvironmentVariablesNodeProperty(
new Entry("VAR_MAVEN", mavenVar), new Entry("VAR_JAVA",
......@@ -120,14 +120,14 @@ public class MavenTest extends HudsonTestCase {
String mavenHomeVar = "${VAR_MAVEN}" + mavenHome.substring(3);
String mavenVar = mavenHome.substring(0, 3);
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 javaHomeVar = "${VAR_JAVA}" + javaHome.substring(3);
String javaVar = javaHome.substring(0, 3);
JDK varJDK = new JDK("varJDK", javaHomeVar);
hudson.getJDKs().add(varJDK);
jenkins.getJDKs().add(varJDK);
FreeStyleProject project = createFreeStyleProject();
project.addProperty(new ParametersDefinitionProperty(
......
......@@ -42,7 +42,7 @@ public class HistoryTest extends HudsonTestCase {
protected void setUp() throws Exception {
super.setUp();
List<Project> projects = this.hudson.getProjects();
List<Project> projects = this.jenkins.getProjects();
Project theProject = null;
for (Project p : projects) {
if (p.getName().equals(PROJECT_NAME)) theProject = p;
......
......@@ -75,7 +75,7 @@ public class JUnitResultArchiverTest extends HudsonTestCase {
DumbSlave s = createOnlineSlave();
project.setAssignedLabel(s.getSelfLabel());
FilePath src = new FilePath(hudson.getRootPath(), "jobs/junit/workspace/");
FilePath src = new FilePath(jenkins.getRootPath(), "jobs/junit/workspace/");
assertNotNull(src);
FilePath dest = s.getWorkspaceFor(project);
assertNotNull(dest);
......@@ -110,8 +110,8 @@ public class JUnitResultArchiverTest extends HudsonTestCase {
}
private void reloadJenkins() throws Exception {
hudson.reload();
project = (FreeStyleProject) hudson.getItem("junit");
jenkins.reload();
project = (FreeStyleProject) jenkins.getItem("junit");
}
@LocalData
......
......@@ -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.
// 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 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 );
}
}
......@@ -79,7 +79,7 @@ public class TestResultPublishingTest extends HudsonTestCase {
DumbSlave s = createOnlineSlave();
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);
FilePath dest = s.getWorkspaceFor(project);
assertNotNull(dest);
......@@ -99,7 +99,7 @@ public class TestResultPublishingTest extends HudsonTestCase {
*/
@LocalData
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
Project proj = null;
for (Project p : projects) {
......@@ -208,7 +208,7 @@ public class TestResultPublishingTest extends HudsonTestCase {
@Bug(5246)
@LocalData
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
Project proj = null;
for (Project p : projects) {
......@@ -235,7 +235,7 @@ public class TestResultPublishingTest extends HudsonTestCase {
*/
@LocalData
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
Project proj = null;
for (Project p : projects) {
......
......@@ -86,12 +86,12 @@ public class JDKInstallerTest extends HudsonTestCase {
File tmp = env.temporaryDirectoryAllocator.allocate();
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)))));
submit(new WebClient().goTo("configure").getFormByName("config"));
JDK jdk = hudson.getJDK("test");
JDK jdk = jenkins.getJDK("test");
InstallSourceProperty isp = jdk.getProperties().get(InstallSourceProperty.class);
assertEquals(1,isp.installers.size());
assertEqualBeans(installer,isp.installers.get(JDKInstaller.class),"id,acceptLicense");
......@@ -153,7 +153,7 @@ public class JDKInstallerTest extends HudsonTestCase {
JDK jdk = new JDK("test", tmp.getAbsolutePath(), Arrays.asList(
new InstallSourceProperty(Arrays.<ToolInstaller>asList(installer))));
hudson.getJDKs().add(jdk);
jenkins.getJDKs().add(jdk);
FreeStyleProject p = createFreeStyleProject();
p.setJDK(jdk);
......@@ -185,7 +185,7 @@ public class JDKInstallerTest extends HudsonTestCase {
File d = env.temporaryDirectoryAllocator.allocate();
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());
} finally {
......
......@@ -61,11 +61,11 @@ public class ToolLocationNodePropertyTest extends HudsonTestCase {
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));
AntInstallation.DescriptorImpl antDescriptor = hudson.getDescriptorByType(AntInstallation.DescriptorImpl.class);
AntInstallation.DescriptorImpl antDescriptor = jenkins.getDescriptorByType(AntInstallation.DescriptorImpl.class);
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"));
ToolLocationNodeProperty property = new ToolLocationNodeProperty(
......@@ -112,7 +112,7 @@ public class ToolLocationNodePropertyTest extends HudsonTestCase {
assertBuildStatus(Result.FAILURE, build);
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);
build = project.scheduleBuild2(0).get();
......@@ -139,7 +139,7 @@ public class ToolLocationNodePropertyTest extends HudsonTestCase {
assertBuildStatus(Result.FAILURE, build);
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);
build = project.scheduleBuild2(0).get();
......@@ -156,7 +156,7 @@ public class ToolLocationNodePropertyTest extends HudsonTestCase {
project.setScm(new ExtractResourceSCM(getClass().getResource(
"/simple-projects.zip")));
project.setAssignedLabel(slave.getSelfLabel());
project.setJDK(hudson.getJDK("default"));
project.setJDK(jenkins.getJDK("default"));
project.setMaven("maven");
project.setGoals("clean");
......@@ -165,7 +165,7 @@ public class ToolLocationNodePropertyTest extends HudsonTestCase {
assertBuildStatus(Result.FAILURE, build);
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);
build = project.scheduleBuild2(0).get();
......
......@@ -8,7 +8,7 @@ import org.jvnet.hudson.test.HudsonTestCase;
*/
public class ListViewColumnTest extends HudsonTestCase {
public void testCreateView() throws Exception {
hudson.addView(new ListView("test"));
jenkins.addView(new ListView("test"));
submit(createWebClient().goTo("view/test/configure").getFormByName("viewConfig"));
}
}
......@@ -38,13 +38,13 @@ public class ExpandableTextboxTest extends HudsonTestCase {
@Bug(2816)
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.
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>");
// System.out.println(page.getWebResponse().getContentAsString());
NodeList textareas = page.getElementsByTagName("textarea");
assertEquals(1, textareas.getLength());
assertEquals(hudson.getSystemMessage(),textareas.item(0).getTextContent());
assertEquals(jenkins.getSystemMessage(),textareas.item(0).getTextContent());
}
/**
......
......@@ -23,9 +23,7 @@
*/
package lib.form;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import hudson.util.FormValidation;
import net.sf.json.JSONObject;
import org.jvnet.hudson.test.HudsonTestCase;
import org.kohsuke.stapler.HttpResponse;
......@@ -39,7 +37,7 @@ import org.kohsuke.stapler.StaplerRequest;
*/
public class NameRefTest extends HudsonTestCase {
public void test1() throws Exception {
hudson.setCrumbIssuer(null);
jenkins.setCrumbIssuer(null);
HtmlPage p = createWebClient().goTo("self/test1");
submit(p.getFormByName("config"));
}
......
......@@ -46,7 +46,7 @@ public class PasswordTest extends HudsonTestCase implements Describable<Password
}
public DescriptorImpl getDescriptor() {
return hudson.getDescriptorByType(DescriptorImpl.class);
return jenkins.getDescriptorByType(DescriptorImpl.class);
}
@Extension
......
......@@ -103,7 +103,7 @@ public class RepeatablePropertyTest extends HudsonTestCase implements Describabl
}
public DescriptorImpl getDescriptor() {
return hudson.getDescriptorByType(DescriptorImpl.class);
return jenkins.getDescriptorByType(DescriptorImpl.class);
}
@Extension
......
......@@ -296,7 +296,7 @@ public class RepeatableTest extends HudsonTestCase {
}
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 {
......
......@@ -110,7 +110,7 @@ public class RowVisibilityGroupTest extends HudsonTestCase implements Describabl
}
public DescriptorImpl getDescriptor() {
return hudson.getDescriptorByType(DescriptorImpl.class);
return jenkins.getDescriptorByType(DescriptorImpl.class);
}
@TestExtension
......
......@@ -47,7 +47,7 @@ public class ValidateButtonTest extends HudsonTestCase implements Describable<Va
}
public DescriptorImpl getDescriptor() {
return hudson.getDescriptorByType(DescriptorImpl.class);
return jenkins.getDescriptorByType(DescriptorImpl.class);
}
@Extension
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册