Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EOL dependency on Maven Integration #5156

Merged
merged 6 commits into from
Jan 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 0 additions & 49 deletions test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
10 changes: 5 additions & 5 deletions test/src/test/java/hudson/CustomPluginManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ public void tearDown(JenkinsRule jenkinsRule, WithCustomLocalPluginManager recip

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.
interface CustomPluginManager {
}

@Issue("JENKINS-34681")
@WithPlugin("tasks.jpi")
@WithPlugin("htmlpublisher.jpi")
@WithCustomLocalPluginManager(CustomPluginManager1.class)
@Test public void customPluginManager1() {
check(CustomPluginManager1.class);
Expand All @@ -100,7 +100,7 @@ public CustomPluginManager1(Jenkins jenkins) {
}

@Issue("JENKINS-34681")
@WithPlugin("tasks.jpi")
@WithPlugin("htmlpublisher.jpi")
@WithCustomLocalPluginManager(CustomPluginManager2.class)
@Test public void customPluginManager2() {
check(CustomPluginManager2.class);
Expand All @@ -113,7 +113,7 @@ public CustomPluginManager2(ServletContext ctx, File root) {
}

@Issue("JENKINS-34681")
@WithPlugin("tasks.jpi")
@WithPlugin("htmlpublisher.jpi")
@WithCustomLocalPluginManager(CustomPluginManager3.class)
@Test public void customPluginManager3() {
check(CustomPluginManager3.class);
Expand All @@ -126,7 +126,7 @@ public CustomPluginManager3(File root) {
}

@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);
Expand Down
51 changes: 15 additions & 36 deletions test/src/test/java/hudson/PluginManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
}

/**
Expand All @@ -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"));
}

/**
Expand All @@ -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);
Expand Down Expand Up @@ -227,20 +206,20 @@ public void startPlugin(PluginWrapper plugin) throws Exception {
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
Expand Down Expand Up @@ -454,12 +433,12 @@ private String callDependerValue() throws Exception {
}

@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 {
Expand All @@ -471,7 +450,7 @@ private String callDependerValue() throws Exception {
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();

Expand Down
68 changes: 0 additions & 68 deletions test/src/test/java/hudson/bugs/seasar/Operation2174Test.java

This file was deleted.

16 changes: 0 additions & 16 deletions test/src/test/java/hudson/cli/ListJobsCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
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;
Expand Down Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@
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.
Expand Down Expand Up @@ -50,29 +45,11 @@ private void restoreOldNumExecutors() throws IOException {
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();

Expand Down
6 changes: 0 additions & 6 deletions test/src/test/java/hudson/model/HelpLinkTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
import hudson.matrix.MatrixProject;
import hudson.maven.MavenModuleSet;

import java.util.List;

Expand Down Expand Up @@ -81,11 +80,6 @@ public void freestyleConfig() throws Exception {
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"));
Expand Down
Loading