提交 fc836c13 编写于 作者: K Kohsuke Kawaguchi

[FIXED JENKINS-18771]

... with a test case. The fix is in Stapler.
上级 5a3d8771
......@@ -58,6 +58,9 @@ Upcoming changes</a>
<li class=bug>
Provided maven settings.xml in maven builder is lost.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-15976">issue 15976</a>)
<li class=bug>
Fixed a regression that broke some plugins' form validation
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-18776">issue 18776</a>)
</ul>
</div><!--=TRUNK-END=-->
......
......@@ -42,7 +42,7 @@ THE SOFTWARE.
<properties>
<staplerFork>true</staplerFork>
<stapler.version>1.213</stapler.version>
<stapler.version>1.214</stapler.version>
<spring.version>2.5.6.SEC03</spring.version>
</properties>
......
......@@ -193,6 +193,28 @@ THE SOFTWARE.
<redirectTestOutputToFile>true</redirectTestOutputToFile>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<!-- version specified in grandparent pom -->
<executions>
<execution>
<id>test-in-groovy</id>
<!-- compile and process annotations in Groovy test code -->
<goals>
<goal>generateTestStubs</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
<version>1.6.5</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.kohsuke.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
......@@ -208,13 +230,6 @@ THE SOFTWARE.
<source>${pom.basedir}/src/main/preset-data/package.groovy</source>
</configuration>
</execution>
<execution>
<id>test-in-groovy</id>
<!-- allow tests written in Groovy -->
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
......
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> {
@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")
}
}
}
}
def f= namespace(lib.FormTagLib)
f.entry(field:"abc") {
f.select()
}
\ No newline at end of file
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")
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册