Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
LinuxSuRen
jenkins
提交
0bc7b460
J
jenkins
项目概览
LinuxSuRen
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
0bc7b460
编写于
12月 08, 2017
作者:
J
Jesse Glick
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Last trace of gmaven gone!
上级
26e2001c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
129 addition
and
49 deletion
+129
-49
test/pom.xml
test/pom.xml
+0
-49
test/src/test/java/jenkins/bugs/Jenkins41511Test.java
test/src/test/java/jenkins/bugs/Jenkins41511Test.java
+0
-0
test/src/test/java/lib/form/TextAreaTest.java
test/src/test/java/lib/form/TextAreaTest.java
+129
-0
未找到文件。
test/pom.xml
浏览文件 @
0bc7b460
...
...
@@ -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>
...
...
test/src/test/
groovy
/jenkins/bugs/Jenkins41511Test.java
→
test/src/test/
java
/jenkins/bugs/Jenkins41511Test.java
浏览文件 @
0bc7b460
文件已移动
test/src/test/
groovy/lib/form/TextAreaTest.groovy
→
test/src/test/
java/lib/form/TextAreaTest.java
浏览文件 @
0bc7b460
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
te
stText
()
{
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
te
xt
()
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录