未验证 提交 1b2ca8a7 编写于 作者: B Basil Crow 提交者: GitHub

EOL dependency on Maven Integration (#5156)

上级 8781a24f
......@@ -91,38 +91,6 @@ THE SOFTWARE.
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>maven-plugin</artifactId>
<version>2.14</version>
<exclusions>
<exclusion> <!-- perhaps unnecessary as of JENKINS-35445? -->
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</exclusion>
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
</exclusion>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<!-- maven-plugin 2.14 (above) pulls in mailer 1.7, but then HelpCommandTest fails due to moved localized resources -->
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>mailer</artifactId>
<version>1.23</version>
......@@ -302,23 +270,6 @@ THE SOFTWARE.
<skip>true</skip>
</configuration>
</plugin>
<plugin> <!-- TODO pending JENKINS-45271 fix, would be best to finish moving MavenModuleSet-specific tests to maven-plugin and delete the test dep here -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<configuration>
<rules>
<requireUpperBoundDeps>
<excludes combine.children="append">
<exclude>org.apache.maven:maven-embedder</exclude>
<exclude>org.codehaus.plexus:plexus-classworlds</exclude>
<exclude>org.apache.maven:maven-core</exclude>
<exclude>org.apache.maven:maven-aether-provider</exclude>
<exclude>org.codehaus.plexus:plexus-utils</exclude>
</excludes>
</requireUpperBoundDeps>
</rules>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
......
......@@ -79,7 +79,7 @@ public class CustomPluginManagerTest {
private void check(Class<? extends CustomPluginManager> klass) {
assertTrue("Correct plugin manager installed", klass.isAssignableFrom(r.getPluginManager().getClass()));
assertNotNull("Plugin 'tasks' installed", r.jenkins.getPlugin("tasks"));
assertNotNull("Plugin 'htmlpublisher' installed", r.jenkins.getPlugin("htmlpublisher"));
}
// An interface not to override every constructor.
......@@ -87,7 +87,7 @@ public class CustomPluginManagerTest {
}
@Issue("JENKINS-34681")
@WithPlugin("tasks.jpi")
@WithPlugin("htmlpublisher.jpi")
@WithCustomLocalPluginManager(CustomPluginManager1.class)
@Test public void customPluginManager1() {
check(CustomPluginManager1.class);
......@@ -100,7 +100,7 @@ public class CustomPluginManagerTest {
}
@Issue("JENKINS-34681")
@WithPlugin("tasks.jpi")
@WithPlugin("htmlpublisher.jpi")
@WithCustomLocalPluginManager(CustomPluginManager2.class)
@Test public void customPluginManager2() {
check(CustomPluginManager2.class);
......@@ -113,7 +113,7 @@ public class CustomPluginManagerTest {
}
@Issue("JENKINS-34681")
@WithPlugin("tasks.jpi")
@WithPlugin("htmlpublisher.jpi")
@WithCustomLocalPluginManager(CustomPluginManager3.class)
@Test public void customPluginManager3() {
check(CustomPluginManager3.class);
......@@ -126,7 +126,7 @@ public class CustomPluginManagerTest {
}
@Issue("JENKINS-34681")
@WithPlugin("tasks.jpi")
@WithPlugin("htmlpublisher.jpi")
@WithCustomLocalPluginManager(BadCustomPluginManager.class)
@Test public void badCustomPluginManager() {
assertFalse("Custom plugin manager not installed", r.getPluginManager() instanceof CustomPluginManager);
......
......@@ -88,12 +88,12 @@ public class PluginManagerTest {
HtmlPage page = r.createWebClient().goTo("pluginManager/advanced");
HtmlForm f = page.getFormByName("uploadPlugin");
File dir = tmp.newFolder();
File plugin = new File(dir, "tasks.jpi");
FileUtils.copyURLToFile(getClass().getClassLoader().getResource("plugins/tasks.jpi"),plugin);
File plugin = new File(dir, "htmlpublisher.jpi");
FileUtils.copyURLToFile(getClass().getClassLoader().getResource("plugins/htmlpublisher.jpi"),plugin);
f.getInputByName("name").setValueAttribute(plugin.getAbsolutePath());
r.submit(f);
assertTrue( new File(r.jenkins.getRootDir(),"plugins/tasks.jpi").exists() );
assertTrue( new File(r.jenkins.getRootDir(),"plugins/htmlpublisher.jpi").exists() );
}
/**
......@@ -115,9 +115,9 @@ public class PluginManagerTest {
/**
* Tests the effect of {@link WithPlugin}.
*/
@WithPlugin("tasks.jpi")
@WithPlugin("htmlpublisher.jpi")
@Test public void withRecipeJpi() {
assertNotNull(r.jenkins.getPlugin("tasks"));
assertNotNull(r.jenkins.getPlugin("htmlpublisher"));
}
/**
......@@ -128,34 +128,13 @@ public class PluginManagerTest {
assertNotNull(r.jenkins.getPlugin("legacy"));
}
/**
* Makes sure that plugins can see Maven2 plugin that's refactored out in 1.296.
*/
@WithPlugin("tasks.jpi")
@Test public void optionalMavenDependency() throws Exception {
PluginWrapper.Dependency m2=null;
PluginWrapper tasks = r.jenkins.getPluginManager().getPlugin("tasks");
for( PluginWrapper.Dependency d : tasks.getOptionalDependencies() ) {
if(d.shortName.equals("maven-plugin")) {
assertNull(m2);
m2 = d;
}
}
assertNotNull(m2);
// this actually doesn't really test what we need, though, because
// I thought test harness is loading the maven classes by itself.
// TODO: write a separate test that tests the optional dependency loading
tasks.classLoader.loadClass(hudson.maven.agent.AbortException.class.getName());
}
/**
* Verifies that by the time {@link Plugin#start()} is called, uber classloader is fully functioning.
* This is necessary as plugin start method can engage in XStream loading activities, and they should
* resolve all the classes in the system (for example, a plugin X can define an extension point
* other plugins implement, so when X loads its config it better sees all the implementations defined elsewhere)
*/
@WithPlugin("tasks.jpi")
@WithPlugin("htmlpublisher.jpi")
@WithPluginManager(PluginManagerImpl_for_testUberClassLoaderIsAvailableDuringStart.class)
@Test public void uberClassLoaderIsAvailableDuringStart() {
assertTrue(((PluginManagerImpl_for_testUberClassLoaderIsAvailableDuringStart) r.jenkins.pluginManager).tested);
......@@ -227,20 +206,20 @@ public class PluginManagerTest {
assumeFalse("TODO: Implement this test on Windows", Functions.isWindows());
PersistedList<UpdateSite> sites = r.jenkins.getUpdateCenter().getSites();
sites.clear();
URL url = PluginManagerTest.class.getResource("/plugins/tasks-update-center.json");
URL url = PluginManagerTest.class.getResource("/plugins/htmlpublisher-update-center.json");
UpdateSite site = new UpdateSite(UpdateCenter.ID_DEFAULT, url.toString());
sites.add(site);
assertEquals(FormValidation.ok(), site.updateDirectly(false).get());
assertNotNull(site.getData());
assertEquals(Collections.emptyList(), r.jenkins.getPluginManager().prevalidateConfig(new StringInputStream("<whatever><runant plugin=\"ant@1.1\"/></whatever>")));
assertNull(r.jenkins.getPluginManager().getPlugin("tasks"));
List<Future<UpdateCenterJob>> jobs = r.jenkins.getPluginManager().prevalidateConfig(new StringInputStream("<whatever><tasks plugin=\"tasks@2.23\"/></whatever>"));
assertNull(r.jenkins.getPluginManager().getPlugin("htmlpublisher"));
List<Future<UpdateCenterJob>> jobs = r.jenkins.getPluginManager().prevalidateConfig(new StringInputStream("<whatever><htmlpublisher plugin=\"htmlpublisher@0.7\"/></whatever>"));
assertEquals(1, jobs.size());
UpdateCenterJob job = jobs.get(0).get(); // blocks for completion
assertEquals("InstallationJob", job.getType());
UpdateCenter.InstallationJob ijob = (UpdateCenter.InstallationJob) job;
assertEquals("tasks", ijob.plugin.name);
assertNotNull(r.jenkins.getPluginManager().getPlugin("tasks"));
assertEquals("htmlpublisher", ijob.plugin.name);
assertNotNull(r.jenkins.getPluginManager().getPlugin("htmlpublisher"));
// TODO restart scheduled (SuccessButRequiresRestart) after upgrade or Support-Dynamic-Loading: false
// TODO dependencies installed or upgraded too
// TODO required plugin installed but inactive
......@@ -454,12 +433,12 @@ public class PluginManagerTest {
}
@Issue("JENKINS-12753")
@WithPlugin("tasks.jpi")
@WithPlugin("htmlpublisher.jpi")
@Test public void dynamicLoadRestartRequiredException() throws Exception {
File jpi = new File(r.jenkins.getRootDir(), "plugins/tasks.jpi");
File jpi = new File(r.jenkins.getRootDir(), "plugins/htmlpublisher.jpi");
assertTrue(jpi.isFile());
FileUtils.touch(jpi);
File timestamp = new File(r.jenkins.getRootDir(), "plugins/tasks/.timestamp2");
File timestamp = new File(r.jenkins.getRootDir(), "plugins/htmlpublisher/.timestamp2");
assertTrue(timestamp.isFile());
long lastMod = timestamp.lastModified();
try {
......@@ -471,7 +450,7 @@ public class PluginManagerTest {
assertEquals("should not have tried to delete & unpack", lastMod, timestamp.lastModified());
}
@WithPlugin("tasks.jpi")
@WithPlugin("htmlpublisher.jpi")
@Test public void pluginListJSONApi() throws IOException {
JSONObject response = r.getJSON("pluginManager/plugins").getJSONObject();
......
/*
* The MIT License
*
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package hudson.bugs.seasar;
import hudson.maven.MavenModuleSet;
import hudson.model.Item;
import hudson.model.FreeStyleProject;
import hudson.tasks.BuildTrigger;
import java.util.Collections;
import org.jvnet.hudson.test.HudsonTestCase;
/**
* See http://ml.seasar.org/archives/operation/2008-November/004003.html
*
* @author Kohsuke Kawaguchi
*/
public class Operation2174Test extends HudsonTestCase {
/**
* Tests that configuring a dependency from a freestyle to a maven project actually works.
*/
public void testBuildChains() throws Exception {
FreeStyleProject up = createFreeStyleProject("up");
MavenModuleSet dp = jenkins.createProject(MavenModuleSet.class, "dp");
// designate 'dp' as the downstream in 'up'
WebClient webClient = new WebClient();
webClient.getPage(up,"configure");
// configure downstream build
up.getPublishersList().add(new BuildTrigger("dp",false));
configRoundtrip((Item)up);
// verify that the relationship is set up
BuildTrigger trigger = up.getPublishersList().get(BuildTrigger.class);
assertEquals(trigger.getChildProjects(up), Collections.singletonList(dp));
// now go ahead and edit the downstream
configRoundtrip((Item)dp);
// verify that the relationship is set up
trigger = up.getPublishersList().get(BuildTrigger.class);
assertNotNull(trigger);
assertEquals(trigger.getChildProjects(up), Collections.singletonList(dp));
}
}
......@@ -27,7 +27,6 @@ package hudson.cli;
import hudson.matrix.Axis;
import hudson.matrix.AxisList;
import hudson.matrix.MatrixProject;
import hudson.maven.MavenModuleSet;
import hudson.model.DirectlyModifiableView;
import hudson.model.FreeStyleProject;
import hudson.model.Label;
......@@ -115,21 +114,6 @@ public class ListJobsCommandTest {
assertThat(result.stdout(), containsString("mp"));
}
@Issue("JENKINS-18393")
@Test public void getAllJobsFromFolderWithMavenModuleSet() throws Exception {
MockFolder folder = j.createFolder("Folder");
FreeStyleProject job1 = folder.createProject(FreeStyleProject.class, "job1");
FreeStyleProject job2 = folder.createProject(FreeStyleProject.class, "job2");
MavenModuleSet mavenProject = folder.createProject(MavenModuleSet.class, "mvn");
CLICommandInvoker.Result result = command.invokeWithArgs("Folder");
assertThat(result, CLICommandInvoker.Matcher.succeeded());
assertThat(result.stdout(), containsString("job1"));
assertThat(result.stdout(), containsString("job2"));
assertThat(result.stdout(), containsString("mvn"));
}
@Issue("JENKINS-18393")
@Test public void failForMatrixProject() throws Exception {
MatrixProject matrixProject = j.createProject(MatrixProject.class, "mp");
......
......@@ -5,17 +5,12 @@ import java.io.IOException;
import hudson.EnvVars;
import hudson.matrix.MatrixBuild;
import hudson.matrix.MatrixProject;
import hudson.maven.MavenModuleSet;
import hudson.maven.MavenModuleSetBuild;
import hudson.tasks.Maven.MavenInstallation;
import hudson.util.StreamTaskListener;
import jenkins.model.Jenkins;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.ExtractResourceSCM;
import org.jvnet.hudson.test.HudsonTestCase;
import org.jvnet.hudson.test.ToolInstallations;
/**
* Tests that getEnvironment() calls outside of builds are safe.
......@@ -50,29 +45,11 @@ public class GetEnvironmentOutsideBuildTest extends HudsonTestCase {
assertNotNull(Jenkins.get().toComputer());
}
private MavenModuleSet createSimpleMavenProject() throws Exception {
MavenModuleSet project = jenkins.createProject(MavenModuleSet.class, "mms");
MavenInstallation mi = ToolInstallations.configureMaven3();
project.setScm(new ExtractResourceSCM(getClass().getResource(
"/simple-projects.zip")));
project.setMaven(mi.getName());
project.setGoals("validate");
return project;
}
private void whenJenkinsMasterHasNoExecutors() throws IOException {
Jenkins.get().setNumExecutors(0);
assertNull(Jenkins.get().toComputer());
}
public void testMaven() throws Exception {
MavenModuleSet m = createSimpleMavenProject();
final MavenModuleSetBuild build = buildAndAssertSuccess(m);
assertGetEnvironmentWorks(build);
}
public void testFreestyle() throws Exception {
FreeStyleProject project = createFreeStyleProject();
......
......@@ -13,7 +13,6 @@ import org.junit.Test;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
import hudson.matrix.MatrixProject;
import hudson.maven.MavenModuleSet;
import java.util.List;
......@@ -81,11 +80,6 @@ public class HelpLinkTest {
clickAllHelpLinks(j.createFreeStyleProject());
}
@Test
public void mavenConfig() throws Exception {
clickAllHelpLinks(j.jenkins.createProject(MavenModuleSet.class, "mms"));
}
@Test
public void matrixConfig() throws Exception {
clickAllHelpLinks(j.jenkins.createProject(MatrixProject.class, "mp"));
......
......@@ -30,7 +30,6 @@ import static org.junit.Assert.assertSame;
import com.gargoylesoftware.htmlunit.WebAssert;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import hudson.matrix.MatrixProject;
import hudson.maven.MavenModuleSet;
import hudson.model.Descriptor.FormException;
import java.util.logging.Level;
import net.sf.json.JSONObject;
......@@ -51,12 +50,6 @@ public class JobPropertyTest {
@Rule
public LoggerRule logs = new LoggerRule();
@Test
@Issue("JENKINS-2398")
public void jobPropertySummaryIsShownInMavenModuleSetIndexPage() throws Exception {
assertJobPropertySummaryIsShownInIndexPage(MavenModuleSet.class);
}
@Test
@Issue("JENKINS-2398")
public void jobPropertySummaryIsShownInMatrixProjectIndexPage() throws Exception {
......
......@@ -28,7 +28,6 @@ import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.WebRequest;
import hudson.EnvVars;
import hudson.FilePath;
import hudson.maven.MavenModuleSet;
import hudson.model.Node.Mode;
import hudson.model.Queue.WaitingItem;
import hudson.model.labels.*;
......@@ -48,7 +47,6 @@ import hudson.util.TagCloud;
import java.net.HttpURLConnection;
import java.util.*;
import java.util.concurrent.Callable;
import jenkins.model.Jenkins;
import jenkins.security.QueueItemAuthenticatorConfiguration;
......@@ -67,7 +65,6 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.RunLoadCounter;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.MockQueueItemAuthenticator;
import org.jvnet.hudson.test.TestExtension;
......@@ -282,31 +279,6 @@ public class NodeTest {
assertNotNull("Slave which is added into Jenkins list nodes should have assigned computer.", slave.toComputer());
}
/**
* Verify that the Label#getTiedJobCount does not perform a lazy loading operation.
*/
@Issue("JENKINS-26391")
@Test
public void testGetAssignedLabelWithJobs() throws Exception {
final Node node = j.createOnlineSlave();
node.setLabelString("label1 label2");
MavenModuleSet mavenProject = j.jenkins.createProject(MavenModuleSet.class, "p");
mavenProject.setAssignedLabel(j.jenkins.getLabel("label1"));
RunLoadCounter.prepare(mavenProject);
j.assertBuildStatus(Result.FAILURE, mavenProject.scheduleBuild2(0).get());
Integer labelCount = RunLoadCounter.assertMaxLoads(mavenProject, 0, new Callable<Integer>() {
@Override
public Integer call() throws Exception {
final Label label = j.jenkins.getLabel("label1");
label.reset(); // Make sure cached value is not used
return label.getTiedJobCount();
}
});
assertEquals("Should have only one job tied to label.",
1, labelCount.intValue());
}
@Issue("JENKINS-27188")
@Test public void envPropertiesImmutable() throws Exception {
Slave slave = j.createSlave();
......@@ -320,51 +292,6 @@ public class NodeTest {
assertNotSame(slave.getComputer().getEnvironment(), slave.getComputer().getEnvironment());
}
/**
* Create two projects which have the same label and verify that both are accounted for when getting a count
* of the jobs tied to the current label.
*
*/
@Issue("JENKINS-26391")
@Test
public void testGetAssignedLabelMultipleSlaves() throws Exception {
final Node node1 = j.createOnlineSlave();
node1.setLabelString("label1");
final Node node2 = j.createOnlineSlave();
node1.setLabelString("label1");
MavenModuleSet project = j.jenkins.createProject(MavenModuleSet.class, "p1");
final Label label = j.jenkins.getLabel("label1");
project.setAssignedLabel(label);
j.assertBuildStatus(Result.FAILURE, project.scheduleBuild2(0).get());
MavenModuleSet project2 = j.jenkins.createProject(MavenModuleSet.class, "p2");
project2.setAssignedLabel(label);
j.assertBuildStatus(Result.FAILURE, project2.scheduleBuild2(0).get());
label.reset(); // Make sure cached value is not used
assertEquals("Two jobs should be tied to this label.", 2, label.getTiedJobCount());
}
/**
* Verify that when a label is removed from a job that the tied job count does not include the removed job.
*/
@Issue("JENKINS-26391")
@Test
public void testGetAssignedLabelWhenLabelRemoveFromProject() throws Exception {
final Node node = j.createOnlineSlave();
node.setLabelString("label1");
MavenModuleSet project = j.jenkins.createProject(MavenModuleSet.class, "p");
final Label label = j.jenkins.getLabel("label1");
project.setAssignedLabel(label);
j.assertBuildStatus(Result.FAILURE, project.scheduleBuild2(0).get());
project.setAssignedLabel(null);
label.reset(); // Make sure cached value is not used
assertEquals("Label1 should have no tied jobs after the job label was removed.", 0, label.getTiedJobCount());
}
/**
* Create a project with the OR label expression.
*/
......
......@@ -117,38 +117,38 @@ public class UpdateSiteTest {
}
@Test public void relativeURLs() throws Exception {
URL url = new URL(baseUrl, "/plugins/tasks-update-center.json");
URL url = new URL(baseUrl, "/plugins/htmlpublisher-update-center.json");
UpdateSite site = new UpdateSite(UpdateCenter.ID_DEFAULT, url.toString());
overrideUpdateSite(site);
assertEquals(FormValidation.ok(), site.updateDirectly(false).get());
Data data = site.getData();
assertNotNull(data);
assertEquals(new URL(url, "jenkins.war").toString(), data.core.url);
assertEquals(new HashSet<>(Arrays.asList("tasks", "dummy")), data.plugins.keySet());
assertEquals(new URL(url, "tasks.jpi").toString(), data.plugins.get("tasks").url);
assertEquals(new HashSet<>(Arrays.asList("htmlpublisher", "dummy")), data.plugins.keySet());
assertEquals(new URL(url, "htmlpublisher.jpi").toString(), data.plugins.get("htmlpublisher").url);
assertEquals("http://nowhere.net/dummy.hpi", data.plugins.get("dummy").url);
UpdateSite.Plugin tasksPlugin = data.plugins.get("tasks");
assertEquals("Wrong name of plugin found", "Task Scanner Plug-in", tasksPlugin.getDisplayName());
UpdateSite.Plugin htmlPublisherPlugin = data.plugins.get("htmlpublisher");
assertEquals("Wrong name of plugin found", "HTML Publisher", htmlPublisherPlugin.getDisplayName());
}
@Test public void wikiUrlFromSingleSite() throws Exception {
UpdateSite site = getUpdateSite("/plugins/tasks-update-center.json");
UpdateSite site = getUpdateSite("/plugins/htmlpublisher-update-center.json");
overrideUpdateSite(site);
PluginWrapper wrapper = buildPluginWrapper("dummy", "https://wiki.jenkins.io/display/JENKINS/dummy");
assertEquals("https://plugins.jenkins.io/dummy", wrapper.getUrl());
}
@Test public void wikiUrlFromMoreSites() throws Exception {
UpdateSite site = getUpdateSite("/plugins/tasks-update-center.json");
UpdateSite site = getUpdateSite("/plugins/htmlpublisher-update-center.json");
UpdateSite alternativeSite = getUpdateSite("/plugins/alternative-update-center.json", "alternative");
overrideUpdateSite(site, alternativeSite);
// sites use different Wiki URL for dummy -> use URL from manifest
PluginWrapper wrapper = buildPluginWrapper("dummy", "https://wiki.jenkins.io/display/JENKINS/dummy");
assertEquals("https://wiki.jenkins.io/display/JENKINS/dummy", wrapper.getUrl());
// sites use the same Wiki URL for tasks -> use it
wrapper = buildPluginWrapper("tasks", "https://wiki.jenkins.io/display/JENKINS/tasks");
assertEquals("https://plugins.jenkins.io/tasks", wrapper.getUrl());
// sites use the same Wiki URL for HTML Publisher -> use it
wrapper = buildPluginWrapper("htmlpublisher", "https://plugins.jenkins.io/htmlpublisher");
assertEquals("https://plugins.jenkins.io/htmlpublisher", wrapper.getUrl());
// only one site has it
wrapper = buildPluginWrapper("foo", "https://wiki.jenkins.io/display/JENKINS/foo");
assertEquals("https://plugins.jenkins.io/foo", wrapper.getUrl());
......
......@@ -29,8 +29,6 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import hudson.Launcher;
import hudson.maven.MavenModuleSet;
import hudson.maven.MavenModuleSetBuild;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.Action;
......@@ -53,7 +51,6 @@ import hudson.security.Permission;
import hudson.security.ProjectMatrixAuthorizationStrategy;
import hudson.util.FormValidation;
import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
......@@ -68,23 +65,17 @@ import jenkins.model.Jenkins;
import jenkins.security.QueueItemAuthenticatorConfiguration;
import jenkins.triggers.ReverseBuildTriggerTest;
import org.dom4j.DocumentException;
import org.dom4j.io.SAXReader;
import org.junit.Assume;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.BuildWatcher;
import org.jvnet.hudson.test.ExtractResourceSCM;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.JenkinsRule.WebClient;
import org.jvnet.hudson.test.TestBuilder;
import org.jvnet.hudson.test.MockBuilder;
import org.jvnet.hudson.test.MockQueueItemAuthenticator;
import org.jvnet.hudson.test.ToolInstallations;
import org.xml.sax.SAXException;
public class BuildTriggerTest {
......@@ -149,56 +140,6 @@ public class BuildTriggerTest {
doTriggerTest(true, Result.UNSTABLE, Result.FAILURE);
}
private void doMavenTriggerTest(boolean evenWhenUnstable) throws Exception {
File problematic = new File(System.getProperty("user.home"), ".m2/repository/org/apache/maven/plugins/maven-surefire-plugin/2.4.3/maven-surefire-plugin-2.4.3.pom");
if (problematic.isFile()) {
try {
new SAXReader().read(problematic);
} catch (DocumentException x) {
x.printStackTrace();
// somehow maven-surefire-plugin-2.4.3.pom got corrupted on CI builders
Assume.assumeNoException(x);
}
}
FreeStyleProject dp = createDownstreamProject();
ToolInstallations.configureMaven3();
MavenModuleSet m = j.jenkins.createProject(MavenModuleSet.class, "p");
m.getPublishersList().add(new BuildTrigger("downstream", evenWhenUnstable));
if (!evenWhenUnstable) {
// Configure for UNSTABLE
m.setGoals("clean test");
m.setScm(new ExtractResourceSCM(getClass().getResource("maven-test-failure.zip")));
} // otherwise do nothing which gets FAILURE
// First build should not trigger downstream project
MavenModuleSetBuild b = m.scheduleBuild2(0).get();
assertNoDownstreamBuild(dp, b);
if (evenWhenUnstable) {
// Configure for UNSTABLE
m.setGoals("clean test");
m.setScm(new ExtractResourceSCM(getClass().getResource("maven-test-failure.zip")));
} else {
// Configure for SUCCESS
m.setGoals("clean");
m.setScm(new ExtractResourceSCM(getClass().getResource("maven-empty.zip")));
}
// Next build should trigger downstream project
b = m.scheduleBuild2(0).get();
assertDownstreamBuild(dp, b);
}
@Test
@Ignore("Fails on CI due to maven trying to download from maven central on http, which is no longer supported")
public void mavenBuildTrigger() throws Exception {
doMavenTriggerTest(false);
}
@Test
@Ignore("Fails on CI due to maven trying to download from maven central on http, which is no longer supported")
public void mavenTriggerEvenWhenUnstable() throws Exception {
doMavenTriggerTest(true);
}
/** @see ReverseBuildTriggerTest#upstreamProjectSecurity */
@Test
public void downstreamProjectSecurity() throws Exception {
......
......@@ -180,39 +180,6 @@ public class EnvVarsInConfigTasksTest extends HudsonTestCase {
assertFalse(buildLogEnv.contains(DUMMY_LOCATION_VARNAME));
}
// @Ignore("Fails on CI due to maven trying to download from maven central on http, which is no longer supported")
// public void testNativeMavenOnSlave() throws Exception {
// MavenModuleSet project = jenkins.createProject(MavenModuleSet.class, "p");
// project.setJDK(jenkins.getJDK("varJDK"));
// project.setScm(new ExtractResourceSCM(getClass().getResource(
// "/simple-projects.zip")));
//
// project.setMaven("varMaven");
// project.setGoals("clean${" + DUMMY_LOCATION_VARNAME + "}");
//
// // test the regular agent - variable not expanded
// project.setAssignedLabel(slaveRegular.getSelfLabel());
// MavenModuleSetBuild build = project.scheduleBuild2(0).get();
// System.out.println(build.getDisplayName() + " completed");
//
// assertBuildStatus(Result.FAILURE, build);
//
// String buildLogRegular = getBuildLog(build);
// System.out.println(buildLogRegular);
//
// // test the agent with prepared environment
// project.setAssignedLabel(slaveEnv.getSelfLabel());
// build = project.scheduleBuild2(0).get();
// System.out.println(build.getDisplayName() + " completed");
//
// assertBuildStatusSuccess(build);
//
// // Check variable was expanded
// String buildLogEnv = getBuildLog(build);
// System.out.println(buildLogEnv);
// assertFalse(buildLogEnv.contains(DUMMY_LOCATION_VARNAME));
// }
@SuppressWarnings("deprecation") // it's okay to use it in tests
private String getBuildLog(AbstractBuild<?,?> build) throws Exception {
return build.getLog();
......
......@@ -29,27 +29,23 @@ import hudson.Functions;
import hudson.model.*;
import hudson.model.labels.LabelAtom;
import hudson.slaves.DumbSlave;
import hudson.tasks.Maven;
import hudson.tasks.BatchFile;
import hudson.tasks.Ant;
import hudson.tasks.Shell;
import hudson.tasks.Ant.AntInstallation;
import hudson.tasks.Maven.MavenInstallation;
import hudson.EnvVars;
import hudson.maven.MavenModuleSet;
import java.io.IOException;
import jenkins.model.Jenkins;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.JenkinsRule.WebClient;
import org.jvnet.hudson.test.SingleFileSCM;
import org.jvnet.hudson.test.ExtractResourceSCM;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
......@@ -112,26 +108,6 @@ public class ToolLocationNodePropertyTest {
assertEquals("zotfoo", location.getHome());
}
@Test
public void maven() throws Exception {
MavenInstallation maven = ToolInstallations.configureDefaultMaven();
String mavenPath = maven.getHome();
Jenkins.get().getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(new MavenInstallation("maven", "THIS IS WRONG", JenkinsRule.NO_PROPERTIES));
project.getBuildersList().add(new Maven("--version", "maven"));
configureDumpEnvBuilder();
Build build = project.scheduleBuild2(0).get();
j.assertBuildStatus(Result.FAILURE, build);
ToolLocationNodeProperty property = new ToolLocationNodeProperty(
new ToolLocationNodeProperty.ToolLocation(j.jenkins.getDescriptorByType(MavenInstallation.DescriptorImpl.class), "maven", mavenPath));
slave.getNodeProperties().add(property);
build = project.scheduleBuild2(0).get();
j.assertBuildStatus(Result.SUCCESS, build);
}
private void configureDumpEnvBuilder() throws IOException {
if(Functions.isWindows())
project.getBuildersList().add(new BatchFile("set"));
......@@ -161,34 +137,6 @@ public class ToolLocationNodePropertyTest {
j.assertBuildStatus(Result.SUCCESS, build);
}
@Test
@Ignore("Fails on CI due to maven trying to download from maven central on http, which is no longer supported")
public void nativeMaven() throws Exception {
MavenInstallation maven = ToolInstallations.configureDefaultMaven();
String mavenPath = maven.getHome();
Jenkins.get().getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(new MavenInstallation("maven", "THIS IS WRONG", JenkinsRule.NO_PROPERTIES));
MavenModuleSet project = j.jenkins.createProject(MavenModuleSet.class, "p");
project.setScm(new ExtractResourceSCM(getClass().getResource(
"/simple-projects.zip")));
project.setAssignedLabel(slave.getSelfLabel());
project.setJDK(j.jenkins.getJDK("default"));
project.setMaven("maven");
project.setGoals("clean");
Run build = project.scheduleBuild2(0).get();
j.assertBuildStatus(Result.FAILURE, build);
ToolLocationNodeProperty property = new ToolLocationNodeProperty(
new ToolLocationNodeProperty.ToolLocation(j.jenkins.getDescriptorByType(MavenInstallation.DescriptorImpl.class), "maven", mavenPath));
slave.getNodeProperties().add(property);
build = project.scheduleBuild2(0).get();
System.out.println(build.getLog());
j.assertBuildStatus(Result.SUCCESS, build);
}
@Before
public void setUp() throws Exception {
EnvVars env = new EnvVars();
......
......@@ -47,7 +47,6 @@ public class FormFieldValidatorTest {
@Test
@Issue("JENKINS-2771")
@WithPlugin("tasks.jpi")
public void configure() throws Exception {
FreeStyleProject p = j.createFreeStyleProject();
j.createWebClient().getPage(p, "configure");
......
......@@ -2,8 +2,6 @@ package jenkins.model;
import hudson.Functions;
import hudson.init.InitMilestone;
import hudson.maven.MavenModuleSet;
import hudson.maven.MavenModuleSetBuild;
import hudson.model.FreeStyleBuild;
import hudson.model.FreeStyleProject;
import org.apache.commons.io.FileUtils;
......@@ -12,7 +10,6 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Ignore;
import org.junit.Test;
import org.jvnet.hudson.test.ExtractResourceSCM;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.LoggerRule;
import org.jvnet.hudson.test.MockFolder;
......@@ -289,37 +286,6 @@ public class JenkinsBuildsAndWorkspacesDirectoriesTest {
.filter(record -> record.getMessage().contains(searched)).anyMatch(record -> record.getLevel().equals(level));
}
@Test
@Issue("JENKINS-12251")
public void testItemFullNameExpansion() throws Exception {
loggerRule.record(Jenkins.class, Level.WARNING)
.record(Jenkins.class, Level.INFO)
.capture(1000);
story.then(steps -> {
assertTrue(story.j.getInstance().isDefaultBuildDir());
assertTrue(story.j.getInstance().isDefaultWorkspaceDir());
setBuildsDirProperty("${JENKINS_HOME}/test12251_builds/${ITEM_FULL_NAME}");
setWorkspacesDirProperty("${JENKINS_HOME}/test12251_ws/${ITEM_FULL_NAME}");
});
story.then(steps -> {
assertTrue(JenkinsBuildsAndWorkspacesDirectoriesTest.this.logWasFound("Changing builds directories from "));
assertFalse(story.j.getInstance().isDefaultBuildDir());
assertFalse(story.j.getInstance().isDefaultWorkspaceDir());
// build a dummy project
MavenModuleSet m = story.j.jenkins.createProject(MavenModuleSet.class, "p");
m.setScm(new ExtractResourceSCM(getClass().getResource("/simple-projects.zip")));
MavenModuleSetBuild b = m.scheduleBuild2(0).get();
// make sure these changes are effective
assertTrue(b.getWorkspace().getRemote().contains("test12251_ws"));
assertTrue(b.getRootDir().toString().contains("test12251_builds"));
});
}
@Test
@Issue("JENKINS-17138")
public void externalBuildDirectoryRenameDelete() throws Exception {
......
......@@ -45,7 +45,7 @@ import hudson.slaves.ComputerLauncher;
import hudson.tasks.BatchFile;
import hudson.tasks.Shell;
import jenkins.security.MasterToSlaveCallable;
import org.codehaus.plexus.util.FileUtils;
import org.apache.commons.io.FileUtils;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
......
......@@ -30,8 +30,6 @@ import hudson.Functions;
import hudson.Launcher;
import hudson.console.ConsoleLogFilter;
import hudson.console.LineTransformationOutputStream;
import hudson.maven.MavenModuleSet;
import hudson.maven.MavenModuleSetBuild;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.BuildListener;
......@@ -51,9 +49,7 @@ import hudson.slaves.ComputerLauncher;
import hudson.slaves.RetentionStrategy;
import hudson.slaves.SlaveComputer;
import hudson.tasks.BuildWrapperDescriptor;
import hudson.tasks.Maven;
import hudson.tasks.Shell;
import hudson.tasks.Maven.MavenInstallation;
import java.io.File;
import java.io.IOException;
......@@ -71,13 +67,11 @@ import org.junit.Rule;
import org.junit.rules.TemporaryFolder;
import org.jvnet.hudson.test.BuildWatcher;
import org.jvnet.hudson.test.CaptureEnvironmentBuilder;
import org.jvnet.hudson.test.ExtractResourceSCM;
import org.jvnet.hudson.test.FailureBuilder;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.TestBuilder;
import org.jvnet.hudson.test.TestExtension;
import org.jvnet.hudson.test.ToolInstallations;
public class SimpleBuildWrapperTest {
......@@ -165,18 +159,6 @@ public class SimpleBuildWrapperTest {
r.assertLogContains("ran DisposerImpl #1", b);
r.assertLogNotContains("ran DisposerImpl #2", b);
}
@Test public void disposerWithMaven() throws Exception {
MavenInstallation maven = ToolInstallations.configureDefaultMaven();
r.jenkins.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(maven);
MavenModuleSet p = r.createProject(MavenModuleSet.class, "p");
p.getBuildWrappersList().add(new PreCheckoutWrapperWithDisposer());
p.setIsFingerprintingDisabled(true);
p.setIsArchivingDisabled(true);
p.setScm(new ExtractResourceSCM(getClass().getResource("/simple-projects.zip")));
MavenModuleSetBuild b = p.scheduleBuild2(0).get();
r.assertLogContains("ran DisposerImpl #1", b);
r.assertLogNotContains("ran DisposerImpl #2", b);
}
public static class WrapperWithDisposer extends SimpleBuildWrapper {
@Override public void setUp(Context context, Run<?,?> build, FilePath workspace, Launcher launcher, TaskListener listener, EnvVars initialEnvironment) throws IOException, InterruptedException {
context.setDisposer(new DisposerImpl());
......
......@@ -7,7 +7,6 @@ import com.gargoylesoftware.htmlunit.html.HtmlOption;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSelect;
import hudson.matrix.MatrixProject;
import hudson.maven.MavenModuleSet;
import hudson.model.Item;
import org.junit.Rule;
import org.junit.Test;
......@@ -32,11 +31,6 @@ public class ListScmBrowsersTest {
check(j.createFreeStyleProject());
}
@Test
public void selectBoxesUnique_MavenProject() throws Exception {
check(j.jenkins.createProject(MavenModuleSet.class, "p"));
}
@Test
public void selectBoxesUnique_MatrixProject() throws Exception {
check(j.jenkins.createProject(MatrixProject.class, "p"));
......
{"com-cloudbees-hudson-plugins-folder-Folder":0,"hudson-matrix-MatrixProject":0,"hudson-maven-MavenModuleSet":0,"hudson-model-FreeStyleProject":0,"org-jvnet-hudson-test-MockFolder":0,"org-jvnet-hudson-test-SecuredMockFolder":0}
\ No newline at end of file
{"com-cloudbees-hudson-plugins-folder-Folder":0,"hudson-matrix-MatrixProject":0,"hudson-model-FreeStyleProject":0,"org-jvnet-hudson-test-MockFolder":0,"org-jvnet-hudson-test-SecuredMockFolder":0}
\ No newline at end of file
......@@ -8,18 +8,23 @@ updateCenter.post(
},
"id": "default",
"plugins": {
"tasks": {
"htmlpublisher": {
"buildDate": "Dec 17, 2008",
"dependencies": [],
"developers": [{"name": "lokadm"}],
"excerpt": " This plug-in scans for open tasks in a specified set of files in the project modules and visualizes the results. ",
"name": "tasks",
"wiki": "https://plugins.jenkins.io/tasks",
"requiredCore": "1.264",
"sha1": "wtzlciUKiMcg90H5CTYkGX6+r8Y=",
"title": "Jenkins Task Scanner Plug-in",
"url": "tasks.jpi",
"version": "2.23"
"developers": [
{
"developerId": "mcrooney",
"name": "Michael Rooney"
}
],
"excerpt": "This plugin publishes HTML reports.",
"name": "htmlpublisher",
"wiki": "https://plugins.jenkins.io/htmlpublisher",
"requiredCore": "1.398",
"sha1": "tVSI0DVK02k9R3KV1M3A451Da3c=",
"title": "HTML Publisher",
"url": "htmlpublisher.jpi",
"version": "0.7"
},
"dummy": {
"buildDate": "Dec 17, 2008",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册