Skip to content

Commit

Permalink
[FIXED JENKINS-18776]
Browse files Browse the repository at this point in the history
This reverts commit c9eb236.
  • Loading branch information
olivergondza committed Sep 19, 2013
1 parent 998dc0d commit 9335c44
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 8 deletions.
17 changes: 9 additions & 8 deletions test/pom.xml
Expand Up @@ -195,10 +195,18 @@ THE SOFTWARE.
</configuration>
</plugin>
<plugin>
<groupId>org.kohsuke.gmaven</groupId>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<!-- version specified in grandparent pom -->
<executions>
<execution>
<id>default</id>
<!-- compile and process annotations in Groovy test code -->
<goals>
<goal>generateTestStubs</goal>
<goal>testCompile</goal>
</goals>
</execution>
<execution>
<id>preset-packager</id>
<phase>process-resources</phase>
Expand All @@ -209,13 +217,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>
Expand Down
65 changes: 65 additions & 0 deletions test/src/test/groovy/hudson/RelativePathTest.groovy
@@ -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> {
@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()
}
18 changes: 18 additions & 0 deletions test/src/test/resources/hudson/RelativePathTest/index.groovy
@@ -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")
}
}
}

0 comments on commit 9335c44

Please sign in to comment.