Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fyakm
jenkins
提交
83835770
J
jenkins
项目概览
fyakm
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
1
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,发现更多精彩内容 >>
提交
83835770
编写于
3月 21, 2017
作者:
J
Jesse Glick
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[FIXED JENKINS-42969] UnsupportedOperationException from Computer.addAction.
上级
4948d6c5
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
30 addition
and
2 deletion
+30
-2
core/src/main/java/hudson/model/AbstractProject.java
core/src/main/java/hudson/model/AbstractProject.java
+2
-0
core/src/main/java/hudson/model/Computer.java
core/src/main/java/hudson/model/Computer.java
+13
-0
core/src/main/java/hudson/model/labels/LabelAtom.java
core/src/main/java/hudson/model/labels/LabelAtom.java
+2
-0
test/src/test/java/hudson/model/ComputerTest.java
test/src/test/java/hudson/model/ComputerTest.java
+13
-2
未找到文件。
core/src/main/java/hudson/model/AbstractProject.java
浏览文件 @
83835770
...
...
@@ -1046,6 +1046,8 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
return
Collections
.
unmodifiableList
(
actions
);
}
// TODO implement addAction, addOrReplaceAction, removeAction, removeActions, replaceActions
/**
* Gets the {@link Node} where this project was last built on.
*
...
...
core/src/main/java/hudson/model/Computer.java
浏览文件 @
83835770
...
...
@@ -25,6 +25,7 @@
*/
package
hudson.model
;
import
edu.umd.cs.findbugs.annotations.SuppressFBWarnings
;
import
hudson.EnvVars
;
import
hudson.Extension
;
import
hudson.Launcher.ProcStarter
;
...
...
@@ -268,6 +269,18 @@ public /*transient*/ abstract class Computer extends Actionable implements Acces
return
Collections
.
unmodifiableList
(
result
);
}
@SuppressWarnings
({
"ConstantConditions"
,
"deprecation"
})
@SuppressFBWarnings
(
"RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"
)
@Override
public
void
addAction
(
@Nonnull
Action
a
)
{
if
(
a
==
null
)
{
throw
new
IllegalArgumentException
(
"Action must be non-null"
);
}
super
.
getActions
().
add
(
a
);
}
// TODO implement addOrReplaceAction, removeAction, removeActions, replaceActions
/**
* This is where the log from the remote agent goes.
* The method also creates a log directory if required.
...
...
core/src/main/java/hudson/model/labels/LabelAtom.java
浏览文件 @
83835770
...
...
@@ -106,6 +106,8 @@ public class LabelAtom extends Label implements Saveable {
return
Collections
.
unmodifiableList
(
actions
);
}
// TODO implement addAction, addOrReplaceAction, removeAction, removeActions, replaceActions
protected
void
updateTransientActions
()
{
Vector
<
Action
>
ta
=
new
Vector
<
Action
>();
...
...
test/src/test/java/hudson/model/ComputerTest.java
浏览文件 @
83835770
...
...
@@ -31,7 +31,6 @@ import static org.junit.Assert.*;
import
com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException
;
import
com.gargoylesoftware.htmlunit.html.HtmlForm
;
import
com.gargoylesoftware.htmlunit.html.HtmlPage
;
import
com.gargoylesoftware.htmlunit.xml.XmlPage
;
import
java.io.File
;
...
...
@@ -40,7 +39,6 @@ import jenkins.model.Jenkins;
import
hudson.slaves.DumbSlave
;
import
hudson.slaves.OfflineCause
;
import
org.junit.Before
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.jvnet.hudson.test.Issue
;
...
...
@@ -114,4 +112,17 @@ public class ComputerTest {
assertThat
(
content
,
not
(
containsString
(
"ApiTokenProperty"
)));
assertThat
(
content
,
not
(
containsString
(
"apiToken"
)));
}
@Issue
(
"JENKINS-42969"
)
@Test
public
void
addAction
()
throws
Exception
{
Computer
c
=
j
.
createSlave
().
toComputer
();
class
A
extends
InvisibleAction
{}
assertEquals
(
0
,
c
.
getActions
(
A
.
class
).
size
());
c
.
addAction
(
new
A
());
assertEquals
(
1
,
c
.
getActions
(
A
.
class
).
size
());
c
.
addAction
(
new
A
());
assertEquals
(
2
,
c
.
getActions
(
A
.
class
).
size
());
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录