Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[FIXED JENKINS-18771]
... with a test case. The fix is in Stapler.
- Loading branch information
Showing
6 changed files
with
114 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package hudson | ||
|
||
import hudson.model.AbstractDescribableImpl | ||
import hudson.model.Describable | ||
import hudson.model.Descriptor | ||
import hudson.util.ListBoxModel | ||
import org.jvnet.hudson.test.Bug | ||
import org.jvnet.hudson.test.HudsonTestCase | ||
import org.jvnet.hudson.test.TestExtension | ||
import org.kohsuke.stapler.QueryParameter | ||
|
||
/** | ||
* Regression test for JENKINS-18776 | ||
* | ||
* @author Kohsuke Kawaguchi | ||
*/ | ||
class RelativePathTest extends HudsonTestCase implements Describable<RelativePathTest> { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
kohsuke
Author
Member
|
||
@Bug(18776) | ||
void testRelativePath() { | ||
// I was having trouble causing annotation processing on test stubs | ||
jenkins.getDescriptorOrDie(RelativePathTest.class) | ||
jenkins.getDescriptorOrDie(Model.class) | ||
|
||
createWebClient().goTo("/self/"); | ||
assert jenkins.getDescriptorOrDie(Model.class).touched | ||
} | ||
|
||
String getName() { | ||
return "Alice"; | ||
} | ||
|
||
Model getModel() { | ||
return new Model(); | ||
} | ||
|
||
DescriptorImpl getDescriptor() { | ||
return jenkins.getDescriptorOrDie(getClass()); | ||
} | ||
|
||
@TestExtension | ||
static class DescriptorImpl extends Descriptor<RelativePathTest> { | ||
@Override | ||
String getDisplayName() { | ||
return ""; | ||
} | ||
} | ||
|
||
static class Model extends AbstractDescribableImpl<Model> { | ||
@TestExtension | ||
static class DescriptorImpl extends Descriptor<Model> { | ||
boolean touched; | ||
|
||
@Override | ||
String getDisplayName() { | ||
return "test"; | ||
} | ||
|
||
ListBoxModel doFillAbcItems(@RelativePath("..") @QueryParameter String name) { | ||
assert name=="Alice"; | ||
touched = true; | ||
return new ListBoxModel().add("foo").add("bar") | ||
} | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
test/src/test/resources/hudson/RelativePathTest/Model/config.groovy
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,5 @@ | ||
def f= namespace(lib.FormTagLib) | ||
|
||
f.entry(field:"abc") { | ||
f.select() | ||
} |
18 changes: 18 additions & 0 deletions
18
test/src/test/resources/hudson/RelativePathTest/index.groovy
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,18 @@ | ||
package hudson.RelativePathTest | ||
|
||
def l = namespace(lib.LayoutTagLib) | ||
def j = namespace("jelly:core") | ||
def f= namespace(lib.FormTagLib) | ||
|
||
l.layout { | ||
l.main_panel { | ||
set("instance",my) | ||
set("descriptor",my.descriptor) | ||
f.form() { | ||
f.entry(field:"name") { | ||
f.textbox() | ||
} | ||
f.property(field:"model") | ||
} | ||
} | ||
} |
1 comment
on commit fc836c1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems that you have specified wrong JIRA issue.
https://issues.jenkins-ci.org/browse/JENKINS-18771 is related to the "custom-tools" plugin
Test fails: https://ci.jenkins-ci.org/job/jenkins_main_trunk/2724/testReport/hudson/RelativePathTest/Alice/