Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
3a2def79
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,发现更多精彩内容 >>
提交
3a2def79
编写于
3月 26, 2011
作者:
K
Kohsuke Kawaguchi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
CLI connection needs to be shut down at the end of the test to release resources
上级
a1003269
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
56 addition
and
21 deletion
+56
-21
cli/src/main/java/hudson/cli/CLI.java
cli/src/main/java/hudson/cli/CLI.java
+3
-0
test/src/test/groovy/hudson/cli/BuildCommandTest.groovy
test/src/test/groovy/hudson/cli/BuildCommandTest.groovy
+27
-9
test/src/test/groovy/hudson/cli/EnableJobCommandTest.groovy
test/src/test/groovy/hudson/cli/EnableJobCommandTest.groovy
+8
-4
test/src/test/java/hudson/model/listeners/ItemListenerTest.java
...rc/test/java/hudson/model/listeners/ItemListenerTest.java
+12
-7
test/src/test/java/hudson/security/CliAuthenticationTest.java
.../src/test/java/hudson/security/CliAuthenticationTest.java
+6
-1
未找到文件。
cli/src/main/java/hudson/cli/CLI.java
浏览文件 @
3a2def79
...
...
@@ -121,6 +121,9 @@ public class CLI {
return
Integer
.
parseInt
(
p
);
}
/**
* Shuts down the channel and closes the underlying connection.
*/
public
void
close
()
throws
IOException
,
InterruptedException
{
channel
.
close
();
channel
.
join
();
...
...
test/src/test/groovy/hudson/cli/BuildCommandTest.groovy
浏览文件 @
3a2def79
...
...
@@ -54,10 +54,16 @@ public class BuildCommandTest extends HudsonTestCase {
}]
as
TestBuilder
);
// this should be asynchronous
assertEquals
(
0
,
new
CLI
(
getURL
()).
execute
([
"build"
,
p
.
name
]))
started
.
block
();
assertTrue
(
p
.
getBuildByNumber
(
1
).
isBuilding
())
completed
.
signal
();
def
cli
=
new
CLI
(
getURL
())
try
{
assertEquals
(
0
,
cli
.
execute
([
"build"
,
p
.
name
]))
started
.
block
()
assertTrue
(
p
.
getBuildByNumber
(
1
).
isBuilding
())
completed
.
signal
()
}
finally
{
cli
.
close
();
}
}
/**
...
...
@@ -67,16 +73,28 @@ public class BuildCommandTest extends HudsonTestCase {
def
p
=
createFreeStyleProject
();
p
.
buildersList
.
add
(
new
Shell
(
"sleep 3"
));
new
CLI
(
getURL
()).
execute
([
"build"
,
"-s"
,
p
.
name
])
assertFalse
(
p
.
getBuildByNumber
(
1
).
isBuilding
())
def
cli
=
new
CLI
(
getURL
())
try
{
cli
.
execute
([
"build"
,
"-s"
,
p
.
name
])
assertFalse
(
p
.
getBuildByNumber
(
1
).
isBuilding
())
}
finally
{
cli
.
close
();
}
}
void
testParameters
()
{
def
p
=
createFreeStyleProject
();
p
.
addProperty
(
new
ParametersDefinitionProperty
([
new
StringParameterDefinition
(
"key"
,
null
)]));
new
CLI
(
getURL
()).
execute
([
"build"
,
"-s"
,
"-p"
,
"key=foobar"
,
p
.
name
]);
def
b
=
assertBuildStatusSuccess
(
p
.
getBuildByNumber
(
1
));
assertEquals
(
"foobar"
,
b
.
getAction
(
ParametersAction
.
class
).
getParameter
(
"key"
).
value
);
def
cli
=
new
CLI
(
getURL
())
try
{
cli
.
execute
([
"build"
,
"-s"
,
"-p"
,
"key=foobar"
,
p
.
name
])
def
b
=
assertBuildStatusSuccess
(
p
.
getBuildByNumber
(
1
))
assertEquals
(
"foobar"
,
b
.
getAction
(
ParametersAction
.
class
).
getParameter
(
"key"
).
value
)
}
finally
{
cli
.
close
();
};
}
}
\ No newline at end of file
test/src/test/groovy/hudson/cli/EnableJobCommandTest.groovy
浏览文件 @
3a2def79
...
...
@@ -36,10 +36,14 @@ public class EnableJobCommandTest extends HudsonTestCase {
def
cli
=
new
CLI
(
getURL
())
cli
.
execute
([
"disable-job"
,
p
.
name
])
assertTrue
(
p
.
disabled
)
cli
.
execute
([
"enable-job"
,
p
.
name
])
assertFalse
(
p
.
disabled
)
try
{
cli
.
execute
([
"disable-job"
,
p
.
name
])
assertTrue
(
p
.
disabled
)
cli
.
execute
([
"enable-job"
,
p
.
name
])
assertFalse
(
p
.
disabled
)
}
finally
{
cli
.
close
();
}
}
}
\ No newline at end of file
test/src/test/java/hudson/model/listeners/ItemListenerTest.java
浏览文件 @
3a2def79
...
...
@@ -56,12 +56,17 @@ public class ItemListenerTest extends HudsonTestCase {
public
void
testOnCreatedViaCLI
()
throws
Exception
{
ByteArrayOutputStream
buf
=
new
ByteArrayOutputStream
();
PrintStream
out
=
new
PrintStream
(
buf
);
new
CLI
(
getURL
()).
execute
(
Arrays
.
asList
(
"create-job"
,
"testJob"
),
new
ByteArrayInputStream
((
"<project><actions/><builders/><publishers/>"
+
"<buildWrappers/></project>"
).
getBytes
()),
out
,
out
);
out
.
flush
();
assertNotNull
(
"job should be created: "
+
buf
,
hudson
.
getItem
(
"testJob"
));
assertEquals
(
"onCreated event should be triggered: "
+
buf
,
"C"
,
events
.
toString
());
CLI
cli
=
new
CLI
(
getURL
());
try
{
cli
.
execute
(
Arrays
.
asList
(
"create-job"
,
"testJob"
),
new
ByteArrayInputStream
((
"<project><actions/><builders/><publishers/>"
+
"<buildWrappers/></project>"
).
getBytes
()),
out
,
out
);
out
.
flush
();
assertNotNull
(
"job should be created: "
+
buf
,
hudson
.
getItem
(
"testJob"
));
assertEquals
(
"onCreated event should be triggered: "
+
buf
,
"C"
,
events
.
toString
());
}
finally
{
cli
.
close
();
}
}
}
test/src/test/java/hudson/security/CliAuthenticationTest.java
浏览文件 @
3a2def79
...
...
@@ -28,7 +28,12 @@ public class CliAuthenticationTest extends HudsonTestCase {
}
private
int
command
(
String
...
args
)
throws
Exception
{
return
new
CLI
(
getURL
()).
execute
(
args
);
CLI
cli
=
new
CLI
(
getURL
());
try
{
return
cli
.
execute
(
args
);
}
finally
{
cli
.
close
();
}
}
@TestExtension
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录