Skip to content
Permalink
Browse files
[FIXED JENKINS-18771]
... with a test case. The fix is in Stapler.
  • Loading branch information
kohsuke committed Jul 16, 2013
1 parent 5a3d877 commit fc836c135e2bba4fa66239ef42e8b542298cdbd9
@@ -58,6 +58,9 @@
<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>
@@ -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.

Copy link
@kohsuke

kohsuke Jul 17, 2013

Author Member

Yes, still chasing down what turns out to be a pretty deep rabbit hole.

@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")
}
}
}
}
@@ -0,0 +1,5 @@
def f= namespace(lib.FormTagLib)

f.entry(field:"abc") {
f.select()
}
@@ -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

@oleg-nenashev

This comment has been minimized.

Copy link
Member

@oleg-nenashev oleg-nenashev commented on fc836c1 Jul 29, 2013

Seems that you have specified wrong JIRA issue.

https://issues.jenkins-ci.org/browse/JENKINS-18771 is related to the "custom-tools" plugin

Please sign in to comment.