Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
822de8e9
J
jenkins
项目概览
xxadev
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
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,发现更多精彩内容 >>
提交
822de8e9
编写于
3月 25, 2012
作者:
C
Christoph Kutzinski
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed compiler warnings
上级
585db80d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
14 addition
and
20 deletion
+14
-20
test/src/test/java/hudson/model/QueueTest.java
test/src/test/java/hudson/model/QueueTest.java
+11
-14
test/src/test/java/hudson/model/RunTest.java
test/src/test/java/hudson/model/RunTest.java
+0
-3
test/src/test/java/hudson/model/SimpleJobTest.java
test/src/test/java/hudson/model/SimpleJobTest.java
+3
-3
未找到文件。
test/src/test/java/hudson/model/QueueTest.java
浏览文件 @
822de8e9
...
...
@@ -29,7 +29,6 @@ import com.gargoylesoftware.htmlunit.html.HtmlPage;
import
hudson.matrix.AxisList
;
import
hudson.matrix.MatrixBuild
;
import
hudson.matrix.MatrixProject
;
import
hudson.matrix.MatrixRun
;
import
hudson.matrix.TextAxis
;
import
hudson.model.Cause.*
;
import
hudson.tasks.Shell
;
...
...
@@ -38,16 +37,13 @@ import hudson.triggers.TimerTrigger.TimerTriggerCause;
import
hudson.util.XStream2
;
import
hudson.util.OneShotEvent
;
import
hudson.Launcher
;
import
net.sf.json.JSONObject
;
import
org.apache.commons.fileupload.FileUploadException
;
import
org.apache.commons.fileupload.disk.DiskFileItemFactory
;
import
org.apache.commons.fileupload.servlet.ServletFileUpload
;
import
org.apache.commons.io.FileUtils
;
import
org.jvnet.hudson.test.Bug
;
import
org.jvnet.hudson.test.HudsonTestCase
;
import
org.jvnet.hudson.test.SleepBuilder
;
import
org.jvnet.hudson.test.TestBuilder
;
import
org.kohsuke.stapler.StaplerRequest
;
import
org.mortbay.jetty.Server
;
import
org.mortbay.jetty.bio.SocketConnector
;
import
org.mortbay.jetty.servlet.ServletHandler
;
...
...
@@ -78,7 +74,7 @@ public class QueueTest extends HudsonTestCase {
hudson
.
setNodes
(
hudson
.
getNodes
());
FreeStyleProject
testProject
=
createFreeStyleProject
(
"test"
);
testProject
.
scheduleBuild
(
new
UserCause
());
testProject
.
scheduleBuild
(
new
User
Id
Cause
());
q
.
save
();
System
.
out
.
println
(
FileUtils
.
readFileToString
(
new
File
(
hudson
.
getRootDir
(),
"queue.xml"
)));
...
...
@@ -106,7 +102,7 @@ public class QueueTest extends HudsonTestCase {
hudson
.
setNodes
(
hudson
.
getNodes
());
FreeStyleProject
testProject
=
createFreeStyleProject
(
"test"
);
testProject
.
scheduleBuild
(
new
UserCause
());
testProject
.
scheduleBuild
(
new
User
Id
Cause
());
q
.
save
();
System
.
out
.
println
(
FileUtils
.
readFileToString
(
new
File
(
hudson
.
getRootDir
(),
"queue.xml"
)));
...
...
@@ -122,6 +118,7 @@ public class QueueTest extends HudsonTestCase {
}
public
static
final
class
FileItemPersistenceTestServlet
extends
HttpServlet
{
private
static
final
long
serialVersionUID
=
1L
;
@Override
protected
void
doGet
(
HttpServletRequest
req
,
HttpServletResponse
resp
)
throws
ServletException
,
IOException
{
resp
.
setContentType
(
"text/html"
);
resp
.
getWriter
().
println
(
...
...
@@ -134,7 +131,7 @@ public class QueueTest extends HudsonTestCase {
@Override
protected
void
doPost
(
HttpServletRequest
req
,
HttpServletResponse
resp
)
throws
ServletException
,
IOException
{
try
{
ServletFileUpload
f
=
new
ServletFileUpload
(
new
DiskFileItemFactory
());
List
v
=
f
.
parseRequest
(
req
);
List
<?>
v
=
f
.
parseRequest
(
req
);
assertEquals
(
1
,
v
.
size
());
XStream2
xs
=
new
XStream2
();
System
.
out
.
println
(
xs
.
toXML
(
v
.
get
(
0
)));
...
...
@@ -190,21 +187,21 @@ public class QueueTest extends HudsonTestCase {
});
// Start one build to block others
assertTrue
(
project
.
scheduleBuild
(
new
UserCause
()));
assertTrue
(
project
.
scheduleBuild
(
new
User
Id
Cause
()));
buildStarted
.
block
();
// wait for the build to really start
// Schedule a new build, and trigger it many ways while it sits in queue
Future
<
FreeStyleBuild
>
fb
=
project
.
scheduleBuild2
(
0
,
new
UserCause
());
Future
<
FreeStyleBuild
>
fb
=
project
.
scheduleBuild2
(
0
,
new
User
Id
Cause
());
assertNotNull
(
fb
);
assertFalse
(
project
.
scheduleBuild
(
new
SCMTriggerCause
()));
assertFalse
(
project
.
scheduleBuild
(
new
UserCause
()));
assertFalse
(
project
.
scheduleBuild
(
new
SCMTriggerCause
(
""
)));
assertFalse
(
project
.
scheduleBuild
(
new
User
Id
Cause
()));
assertFalse
(
project
.
scheduleBuild
(
new
TimerTriggerCause
()));
assertFalse
(
project
.
scheduleBuild
(
new
RemoteCause
(
"1.2.3.4"
,
"test"
)));
assertFalse
(
project
.
scheduleBuild
(
new
RemoteCause
(
"4.3.2.1"
,
"test"
)));
assertFalse
(
project
.
scheduleBuild
(
new
SCMTriggerCause
()));
assertFalse
(
project
.
scheduleBuild
(
new
SCMTriggerCause
(
""
)));
assertFalse
(
project
.
scheduleBuild
(
new
RemoteCause
(
"1.2.3.4"
,
"test"
)));
assertFalse
(
project
.
scheduleBuild
(
new
RemoteCause
(
"1.2.3.4"
,
"foo"
)));
assertFalse
(
project
.
scheduleBuild
(
new
SCMTriggerCause
()));
assertFalse
(
project
.
scheduleBuild
(
new
SCMTriggerCause
(
""
)));
assertFalse
(
project
.
scheduleBuild
(
new
TimerTriggerCause
()));
// Wait for 2nd build to finish
...
...
@@ -251,7 +248,7 @@ public class QueueTest extends HudsonTestCase {
List
<
Future
<
MatrixBuild
>>
r
=
new
ArrayList
<
Future
<
MatrixBuild
>>();
for
(
int
i
=
0
;
i
<
3
;
i
++)
r
.
add
(
m
.
scheduleBuild2
(
0
,
new
LegacyCode
Cause
(),
new
ParametersAction
(
new
StringParameterValue
(
"FOO"
,
"value"
+
i
))));
r
.
add
(
m
.
scheduleBuild2
(
0
,
new
UserId
Cause
(),
new
ParametersAction
(
new
StringParameterValue
(
"FOO"
,
"value"
+
i
))));
for
(
Future
<
MatrixBuild
>
f
:
r
)
assertBuildStatusSuccess
(
f
);
...
...
test/src/test/java/hudson/model/RunTest.java
浏览文件 @
822de8e9
...
...
@@ -23,11 +23,8 @@
*/
package
hudson.model
;
import
junit.framework.TestCase
;
import
org.jvnet.hudson.test.HudsonTestCase
;
import
java.io.IOException
;
import
java.util.GregorianCalendar
;
import
java.util.List
;
/**
...
...
test/src/test/java/hudson/model/SimpleJobTest.java
浏览文件 @
822de8e9
...
...
@@ -5,13 +5,12 @@ import java.util.SortedMap;
import
java.util.TreeMap
;
import
junit.framework.Assert
;
import
junit.framework.TestCase
;
import
org.jvnet.hudson.test.HudsonTestCase
;
import
org.mockito.Mockito
;
/**
* Unit test for {@link Job}.
*/
@SuppressWarnings
(
"rawtypes"
)
public
class
SimpleJobTest
extends
HudsonTestCase
{
public
void
testGetEstimatedDuration
()
throws
IOException
{
...
...
@@ -97,7 +96,8 @@ public class SimpleJobTest extends HudsonTestCase {
private
Job
createMockProject
(
final
SortedMap
<
Integer
,
TestBuild
>
runs
)
{
return
new
TestJob
(
runs
);
}
@SuppressWarnings
(
"unchecked"
)
private
static
class
TestBuild
extends
Run
{
public
TestBuild
(
Job
project
,
Result
result
,
long
duration
,
TestBuild
previousBuild
)
throws
IOException
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录