Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into upgrade-htmlunit
* master: commons-compress -> 1.10 Noting #1788 Remove hardcode in tar test [FIXED JENKINS-10629] Unbroke stream with new tar implementation. Revert "Revert "FIXED JENKINS-10629] - Enable BigNumber mode to support archiving of files with size >8Gb"" Revert "Revert "[JENKINS-10629] - Migrate the Tar archives handling code to commons-compress"" Fix at-since from PR #1788 Merge PR #1788: Make plugin manager pluggable
- Loading branch information
Showing
11 changed files
with
159 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
core/src/main/java/hudson/PluginManagerStaplerOverride.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package hudson; | ||
|
||
import jenkins.model.Jenkins; | ||
|
||
import javax.annotation.CheckForNull; | ||
import javax.annotation.Nonnull; | ||
|
||
/** | ||
* Extension point for selectively overriding parts of the {@link PluginManager} views | ||
* Anything extending this and registered with an @Extension can replace existing views and define new views. | ||
* | ||
* It is also possible to add/modify API calls coming via Stapler, but this requires caution. | ||
* | ||
* In both cases, this is simply done by defining a resource or method that matches the existing one | ||
* | ||
* @author Sam Van Oort | ||
* @since 1.627 | ||
*/ | ||
public abstract class PluginManagerStaplerOverride implements ExtensionPoint { | ||
|
||
/** | ||
* Return all implementations of this extension point | ||
* @return All implementations of this extension point | ||
*/ | ||
public static @Nonnull ExtensionList<PluginManagerStaplerOverride> all() { | ||
return ExtensionList.lookup(PluginManagerStaplerOverride.class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
test/src/main/java/hudson/core/PluginManagerOverrideTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package hudson.core; | ||
|
||
import com.gargoylesoftware.htmlunit.html.HtmlPage; | ||
import hudson.PluginManagerStaplerOverride; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.jvnet.hudson.test.JenkinsRule; | ||
import org.jvnet.hudson.test.TestExtension; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
|
||
/** | ||
* Verify that the PluginManagerStaplerOverride extensions register and allow safely modifying PluginManager views | ||
* @author Sam Van Oort | ||
*/ | ||
public class PluginManagerOverrideTest { | ||
|
||
@Rule | ||
public JenkinsRule j = new JenkinsRule(); | ||
|
||
@Test | ||
public void testViewOverrides() throws Exception { | ||
// Verify extension registered correctly and comes back in overrides | ||
assertEquals(1,PluginManagerStaplerOverride.all().size()); | ||
assertTrue(PluginManagerStaplerOverride.all().get(0) instanceof BasicPluginManagerOverride); | ||
|
||
// Verify we can load untouched resources | ||
JenkinsRule.WebClient client = j.createWebClient(); | ||
assertEquals(200, client.goTo("self/pluginManager/available").getWebResponse().getStatusCode()); | ||
|
||
// Verify new view loads | ||
HtmlPage p = j.createWebClient().goTo("self/pluginManager/newview"); | ||
assertEquals("LoremIpsum", p.getElementById("dummyElement").getTextContent()); | ||
} | ||
|
||
/** Micro-implementation simply to allow adding a view resource */ | ||
@TestExtension("testViewOverrides") | ||
public static class BasicPluginManagerOverride extends PluginManagerStaplerOverride { | ||
} | ||
} |
Oops, something went wrong.