Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
roginluo
Jenkins
提交
5a08cf48
J
Jenkins
项目概览
roginluo
/
Jenkins
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
Jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5a08cf48
编写于
7月 23, 2015
作者:
T
tfennelly
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Dependency exclusions for http commons + some test fixes
上级
f189af85
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
31 addition
and
16 deletion
+31
-16
test/pom.xml
test/pom.xml
+10
-0
test/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFormUtil.java
...java/com/gargoylesoftware/htmlunit/html/HtmlFormUtil.java
+16
-11
test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java
test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java
+2
-2
test/src/main/java/org/jvnet/hudson/test/JenkinsRule.java
test/src/main/java/org/jvnet/hudson/test/JenkinsRule.java
+2
-2
test/src/test/java/hudson/bugs/LoginRedirectTest.java
test/src/test/java/hudson/bugs/LoginRedirectTest.java
+1
-1
未找到文件。
test/pom.xml
浏览文件 @
5a08cf48
...
@@ -64,6 +64,16 @@ THE SOFTWARE.
...
@@ -64,6 +64,16 @@ THE SOFTWARE.
<groupId>
${project.groupId}
</groupId>
<groupId>
${project.groupId}
</groupId>
<artifactId>
maven-plugin
</artifactId>
<artifactId>
maven-plugin
</artifactId>
<version>
${maven-plugin.version}
</version>
<version>
${maven-plugin.version}
</version>
<exclusions>
<exclusion>
<groupId>
org.apache.httpcomponents
</groupId>
<artifactId>
httpclient
</artifactId>
</exclusion>
<exclusion>
<groupId>
org.apache.httpcomponents
</groupId>
<artifactId>
httpcore
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.jenkins-ci.plugins
</groupId>
<groupId>
org.jenkins-ci.plugins
</groupId>
...
...
test/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFormUtil.java
浏览文件 @
5a08cf48
...
@@ -38,14 +38,14 @@ public class HtmlFormUtil {
...
@@ -38,14 +38,14 @@ public class HtmlFormUtil {
* Plain {@link com.gargoylesoftware.htmlunit.html.HtmlForm#submit()} doesn't work correctly due to the use of YUI in Hudson.
* Plain {@link com.gargoylesoftware.htmlunit.html.HtmlForm#submit()} doesn't work correctly due to the use of YUI in Hudson.
*/
*/
public
static
Page
submit
(
final
HtmlForm
htmlForm
)
throws
IOException
{
public
static
Page
submit
(
final
HtmlForm
htmlForm
)
throws
IOException
{
final
Html
SubmitInput
submitElement
=
getSubmitButton
(
htmlForm
);
final
Html
Button
submitElement
=
getSubmitButton
(
htmlForm
);
return
submit
(
htmlForm
,
submitElement
);
return
submit
(
htmlForm
,
submitElement
);
}
}
/**
/**
* Plain {@link com.gargoylesoftware.htmlunit.html.HtmlForm#submit()} doesn't work correctly due to the use of YUI in Hudson.
* Plain {@link com.gargoylesoftware.htmlunit.html.HtmlForm#submit()} doesn't work correctly due to the use of YUI in Hudson.
*/
*/
public
static
Page
submit
(
HtmlForm
htmlForm
,
Html
SubmitInput
submitElement
)
throws
IOException
{
public
static
Page
submit
(
HtmlForm
htmlForm
,
Html
Button
submitElement
)
throws
IOException
{
if
(
submitElement
!=
null
)
{
if
(
submitElement
!=
null
)
{
// To make YUI event handling work, this combo seems to be necessary
// To make YUI event handling work, this combo seems to be necessary
// the click will trigger _onClick in buton-*.js, but it doesn't submit the form
// the click will trigger _onClick in buton-*.js, but it doesn't submit the form
...
@@ -63,13 +63,13 @@ public class HtmlFormUtil {
...
@@ -63,13 +63,13 @@ public class HtmlFormUtil {
/**
/**
* Returns all the <input type="submit"> elements in this form.
* Returns all the <input type="submit"> elements in this form.
*/
*/
public
static
List
<
Html
SubmitInput
>
getSubmitButtons
(
final
HtmlForm
htmlForm
)
throws
ElementNotFoundException
{
public
static
List
<
Html
Button
>
getSubmitButtons
(
final
HtmlForm
htmlForm
)
throws
ElementNotFoundException
{
final
List
<
Html
SubmitInput
>
list
=
htmlForm
.
getElementsByAttribute
(
"input"
,
"type"
,
"submit"
);
final
List
<
Html
Button
>
list
=
htmlForm
.
getElementsByAttribute
(
"input"
,
"type"
,
"submit"
);
// collect inputs from lost children
// collect inputs from lost children
for
(
final
HtmlElement
elt
:
htmlForm
.
getLostChildren
())
{
for
(
final
HtmlElement
elt
:
htmlForm
.
getLostChildren
())
{
if
(
elt
instanceof
Html
SubmitInput
)
{
if
(
elt
instanceof
Html
Button
)
{
list
.
add
((
Html
SubmitInput
)
elt
);
list
.
add
((
Html
Button
)
elt
);
}
}
}
}
return
list
;
return
list
;
...
@@ -78,14 +78,19 @@ public class HtmlFormUtil {
...
@@ -78,14 +78,19 @@ public class HtmlFormUtil {
/**
/**
* Gets the first <input type="submit"> element in this form.
* Gets the first <input type="submit"> element in this form.
*/
*/
public
static
HtmlSubmitInput
getSubmitButton
(
final
HtmlForm
htmlForm
)
throws
ElementNotFoundException
{
public
static
HtmlButton
getSubmitButton
(
final
HtmlForm
htmlForm
)
throws
ElementNotFoundException
{
return
getSubmitButtons
(
htmlForm
).
get
(
0
);
List
<
HtmlButton
>
submitButtons
=
getSubmitButtons
(
htmlForm
);
if
(!
submitButtons
.
isEmpty
())
{
return
submitButtons
.
get
(
0
);
}
return
null
;
}
}
public
static
Html
SubmitInput
getButtonByCaption
(
final
HtmlForm
htmlForm
,
final
String
caption
)
throws
ElementNotFoundException
{
public
static
Html
Button
getButtonByCaption
(
final
HtmlForm
htmlForm
,
final
String
caption
)
throws
ElementNotFoundException
{
for
(
HtmlElement
b
:
htmlForm
.
getHtmlElementsByTagName
(
"button"
))
{
for
(
HtmlElement
b
:
htmlForm
.
getHtmlElementsByTagName
(
"button"
))
{
if
(
b
.
getTextContent
().
trim
().
equals
(
caption
))
if
(
b
instanceof
HtmlButton
&&
b
.
getTextContent
().
trim
().
equals
(
caption
))
{
return
(
HtmlSubmitInput
)
b
;
return
(
HtmlButton
)
b
;
}
}
}
throw
new
ElementNotFoundException
(
"button"
,
"caption"
,
caption
);
throw
new
ElementNotFoundException
(
"button"
,
"caption"
,
caption
);
}
}
...
...
test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java
浏览文件 @
5a08cf48
...
@@ -1175,8 +1175,8 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
...
@@ -1175,8 +1175,8 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
public
HtmlPage
submit
(
HtmlForm
form
,
String
name
)
throws
Exception
{
public
HtmlPage
submit
(
HtmlForm
form
,
String
name
)
throws
Exception
{
for
(
HtmlElement
e
:
form
.
getHtmlElementsByTagName
(
"button"
))
{
for
(
HtmlElement
e
:
form
.
getHtmlElementsByTagName
(
"button"
))
{
HtmlElement
p
=
(
HtmlElement
)
e
.
getParentNode
().
getParentNode
();
HtmlElement
p
=
(
HtmlElement
)
e
.
getParentNode
().
getParentNode
();
if
(
p
.
getAttribute
(
"name"
).
equals
(
name
))
{
if
(
e
instanceof
HtmlButton
&&
p
.
getAttribute
(
"name"
).
equals
(
name
))
{
return
(
HtmlPage
)
HtmlFormUtil
.
submit
(
form
,
(
Html
SubmitInput
)
e
);
return
(
HtmlPage
)
HtmlFormUtil
.
submit
(
form
,
(
Html
Button
)
e
);
}
}
}
}
throw
new
AssertionError
(
"No such submit button with the name "
+
name
);
throw
new
AssertionError
(
"No such submit button with the name "
+
name
);
...
...
test/src/main/java/org/jvnet/hudson/test/JenkinsRule.java
浏览文件 @
5a08cf48
...
@@ -1315,8 +1315,8 @@ public class JenkinsRule implements TestRule, MethodRule, RootAction {
...
@@ -1315,8 +1315,8 @@ public class JenkinsRule implements TestRule, MethodRule, RootAction {
public
HtmlPage
submit
(
HtmlForm
form
,
String
name
)
throws
Exception
{
public
HtmlPage
submit
(
HtmlForm
form
,
String
name
)
throws
Exception
{
for
(
HtmlElement
e
:
form
.
getHtmlElementsByTagName
(
"button"
))
{
for
(
HtmlElement
e
:
form
.
getHtmlElementsByTagName
(
"button"
))
{
HtmlElement
p
=
(
HtmlElement
)
e
.
getParentNode
().
getParentNode
();
HtmlElement
p
=
(
HtmlElement
)
e
.
getParentNode
().
getParentNode
();
if
(
p
.
getAttribute
(
"name"
).
equals
(
name
))
{
if
(
e
instanceof
HtmlButton
&&
p
.
getAttribute
(
"name"
).
equals
(
name
))
{
return
(
HtmlPage
)
HtmlFormUtil
.
submit
(
form
,
(
Html
SubmitInput
)
e
);
return
(
HtmlPage
)
HtmlFormUtil
.
submit
(
form
,
(
Html
Button
)
e
);
}
}
}
}
throw
new
AssertionError
(
"No such submit button with the name "
+
name
);
throw
new
AssertionError
(
"No such submit button with the name "
+
name
);
...
...
test/src/test/java/hudson/bugs/LoginRedirectTest.java
浏览文件 @
5a08cf48
...
@@ -51,7 +51,7 @@ public class LoginRedirectTest extends HudsonTestCase {
...
@@ -51,7 +51,7 @@ public class LoginRedirectTest extends HudsonTestCase {
wc
.
getOptions
().
setThrowExceptionOnFailingStatusCode
(
false
);
wc
.
getOptions
().
setThrowExceptionOnFailingStatusCode
(
false
);
HtmlPage
p
=
wc
.
goTo
(
"/"
);
HtmlPage
p
=
wc
.
goTo
(
"/"
);
System
.
out
.
println
(
p
.
getDocumentURI
());
//
System.out.println(p.getDocumentURI());
assertEquals
(
200
,
p
.
getWebResponse
().
getStatusCode
());
assertEquals
(
200
,
p
.
getWebResponse
().
getStatusCode
());
HtmlForm
form
=
p
.
getFormByName
(
"login"
);
HtmlForm
form
=
p
.
getFormByName
(
"login"
);
form
.
getInputByName
(
"j_username"
).
setValueAttribute
(
"alice"
);
form
.
getInputByName
(
"j_username"
).
setValueAttribute
(
"alice"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录