未验证 提交 0bc7b460 编写于 作者: J Jesse Glick

Last trace of gmaven gone!

上级 26e2001c
......@@ -241,55 +241,6 @@ THE SOFTWARE.
<forkCount>${concurrency}</forkCount>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.5-jenkins-3</version>
<executions>
<execution>
<id>default</id>
<!-- compile and process annotations in Groovy test code -->
<goals>
<goal>generateTestStubs</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.8.0</version>
</dependency>
<!-- Usually a dependency of ant, but some people seem to have an incomplete ant POM. See JENKINS-11416 -->
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
<version>1.8.0</version>
</dependency>
<dependency><!-- this needs to be visible to Ant inside GMaven, so has to be a plugin dependency -->
<groupId>org.apache.ant</groupId>
<artifactId>ant-junit</artifactId>
<version>1.7.0</version>
</dependency>
<dependency>
<!-- this provided scope dependency doesn't get added to GMaven unless explicitly added here -->
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.gmaven.runtime</groupId>
<artifactId>gmaven-runtime-2.0</artifactId>
<version>1.5-jenkins-3</version>
</dependency>
</dependencies>
<configuration>
<!-- 2.4 not yet supported by plugin but 2.0 works
here so long as we provide explicit version -->
<providerSelection>2.0</providerSelection>
</configuration>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
......
package lib.form
import hudson.model.AbstractProject
import hudson.tasks.BuildStepDescriptor
import hudson.tasks.Builder
import hudson.util.FormValidation
import org.junit.Rule
import org.junit.Test
import org.jvnet.hudson.test.Issue
import org.jvnet.hudson.test.JenkinsRule
import org.jvnet.hudson.test.TestExtension
import org.kohsuke.stapler.DataBoundConstructor
import org.kohsuke.stapler.QueryParameter
import javax.inject.Inject
import static org.junit.Assert.*
/**
*
*
* @author Kohsuke Kawaguchi
*/
class TextAreaTest {
package lib.form;
import hudson.model.AbstractProject;
import hudson.model.FreeStyleProject;
import hudson.tasks.BuildStepDescriptor;
import hudson.tasks.Builder;
import hudson.util.FormValidation;
import javax.inject.Inject;
import static org.junit.Assert.*;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.TestExtension;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.QueryParameter;
public class TextAreaTest {
@Rule
public JenkinsRule j = new JenkinsRule();
@Inject
TestBuilder.DescriptorImpl d;
@Test @Issue("JENKINS-19457")
public void validation() {
j.jenkins.injector.injectMembers(this)
def p = j.createFreeStyleProject()
p.buildersList.add(new TestBuilder())
j.configRoundtrip(p)
assert d.text1=="This is text1"
assert d.text2=="Received This is text1"
public TestBuilder.DescriptorImpl d;
@Test
@Issue("JENKINS-19457")
public void validation() throws Exception {
j.jenkins.getInjector().injectMembers(this);
FreeStyleProject p = j.createFreeStyleProject();
p.getBuildersList().add(new TestBuilder());
j.configRoundtrip(p);
assertEquals("This is text1", d.text1);
assertEquals("Received This is text1", d.text2);
}
public static class TestBuilder extends Builder {
@DataBoundConstructor
TestBuilder() {
}
public TestBuilder() {}
public String getText1() { return "This is text1" }
public String getText2() { return "This is text2" }
public String getText1() {
return "This is text1";
}
public String getText2() {
return "This is text2";
}
@TestExtension
public static class DescriptorImpl extends BuildStepDescriptor<Builder> {
def text1,text2;
String text1, text2;
@Override
boolean isApplicable(Class<? extends AbstractProject> jobType) {
public boolean isApplicable(Class<? extends AbstractProject> jobType) {
return true;
}
FormValidation doCheckText1(@QueryParameter String value) {
public FormValidation doCheckText1(@QueryParameter String value) {
this.text1 = value;
return FormValidation.ok();
}
FormValidation doCheckText2(@QueryParameter String text1) {
this.text2 = "Received "+text1;
public FormValidation doCheckText2(@QueryParameter String text1) {
this.text2 = "Received " + text1;
return FormValidation.ok();
}
}
}
@Issue("JENKINS-27505")
@Test
public void testText() {
T1:{
def TEXT_TO_TEST = "some\nvalue\n";
def p = j.createFreeStyleProject();
def target = new TextareaTestBuilder(TEXT_TO_TEST);
p.buildersList.add(target);
public void text() throws Exception {
T1: {
String TEXT_TO_TEST = "some\nvalue\n";
FreeStyleProject p = j.createFreeStyleProject();
TextareaTestBuilder target = new TextareaTestBuilder(TEXT_TO_TEST);
p.getBuildersList().add(target);
j.configRoundtrip(p);
j.assertEqualDataBoundBeans(target, p.getBuildersList().get(TextareaTestBuilder.class));
}
// test for a textarea beginning with a empty line.
T2:{
def TEXT_TO_TEST = "\nbegin\n\nwith\nempty\nline\n\n";
def p = j.createFreeStyleProject();
def target = new TextareaTestBuilder(TEXT_TO_TEST);
p.buildersList.add(target);
T2: {
String TEXT_TO_TEST = "\nbegin\n\nwith\nempty\nline\n\n";
FreeStyleProject p = j.createFreeStyleProject();
TextareaTestBuilder target = new TextareaTestBuilder(TEXT_TO_TEST);
p.getBuildersList().add(target);
j.configRoundtrip(p);
j.assertEqualDataBoundBeans(target, p.getBuildersList().get(TextareaTestBuilder.class));
}
// test for a textarea beginning with two empty lines.
T3:{
def TEXT_TO_TEST = "\n\nbegin\n\nwith\ntwo\nempty\nline\n\n";
def p = j.createFreeStyleProject();
def target = new TextareaTestBuilder(TEXT_TO_TEST);
p.buildersList.add(target);
T3: {
String TEXT_TO_TEST = "\n\nbegin\n\nwith\ntwo\nempty\nline\n\n";
FreeStyleProject p = j.createFreeStyleProject();
TextareaTestBuilder target = new TextareaTestBuilder(TEXT_TO_TEST);
p.getBuildersList().add(target);
j.configRoundtrip(p);
j.assertEqualDataBoundBeans(target, p.getBuildersList().get(TextareaTestBuilder.class));
}
}
public static class TextareaTestBuilder extends Builder {
private text;
private String text;
@DataBoundConstructor
TextareaTestBuilder(String text) {
public TextareaTestBuilder(String text) {
this.text = text;
}
public String getText() { return text; }
public String getText() {
return text;
}
@TestExtension
public static class DescriptorImpl extends BuildStepDescriptor<Builder> {
@Override
boolean isApplicable(Class<? extends AbstractProject> jobType) {
public boolean isApplicable(Class<? extends AbstractProject> jobType) {
return true;
}
@Override
String getDisplayName() {
return this.class.name;
}
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册