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 Originally-Committed-As: 3f98011bd4aae0ee6956d264c952782452389f79
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
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 { | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
.../resources/hudson/core/PluginManagerOverrideTest/BasicPluginManagerOverride/newview.jelly
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,6 @@ | ||
<!-- Trivial dummy view with a dummy element to demonstrate adding view --> | ||
<?jelly escape-by-default='true'?> | ||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"> | ||
<st:contentType value="text/html;charset=UTF-8" /> | ||
<div style="margin-top:1em" id="dummyElement">LoremIpsum</div> | ||
</j:jelly> |