Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
e3f7f826
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,发现更多精彩内容 >>
提交
e3f7f826
编写于
2月 27, 2016
作者:
K
Kohsuke Kawaguchi
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2067 from jenkinsci/jetty9.2
Integrate newer version of test-harness
上级
679da79f
de8b391c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
59 addition
and
21 deletion
+59
-21
test/pom.xml
test/pom.xml
+1
-1
test/src/test/java/hudson/model/ComputerConfigDotXmlTest.java
.../src/test/java/hudson/model/ComputerConfigDotXmlTest.java
+27
-3
test/src/test/java/hudson/model/QueueTest.java
test/src/test/java/hudson/model/QueueTest.java
+6
-8
test/src/test/java/hudson/model/UpdateSiteTest.java
test/src/test/java/hudson/model/UpdateSiteTest.java
+9
-9
test/src/test/java/hudson/util/XStream2Security247Test.java
test/src/test/java/hudson/util/XStream2Security247Test.java
+16
-0
未找到文件。
test/pom.xml
浏览文件 @
e3f7f826
...
...
@@ -63,7 +63,7 @@ THE SOFTWARE.
<dependency>
<groupId>
${project.groupId}
</groupId>
<artifactId>
jenkins-test-harness
</artifactId>
<version>
2.
0
</version>
<version>
2.
5
</version>
<scope>
test
</scope>
</dependency>
<dependency>
...
...
test/src/test/java/hudson/model/ComputerConfigDotXmlTest.java
浏览文件 @
e3f7f826
...
...
@@ -38,8 +38,10 @@ import java.io.IOException;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
javax.servlet.ReadListener
;
import
javax.servlet.ServletInputStream
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.WriteListener
;
import
org.acegisecurity.context.SecurityContext
;
import
org.acegisecurity.context.SecurityContextHolder
;
...
...
@@ -147,9 +149,18 @@ public class ComputerConfigDotXmlTest {
@Override
public
void
write
(
int
b
)
throws
IOException
{
baos
.
write
(
b
);
}
@Override
public
boolean
isReady
()
{
return
true
;
}
@Override
public
void
setWriteListener
(
WriteListener
writeListener
)
{
throw
new
UnsupportedOperationException
();
}
});
return
baos
;
...
...
@@ -162,15 +173,28 @@ public class ComputerConfigDotXmlTest {
private
final
InputStream
inner
;
public
Stream
(
final
InputStream
inner
)
{
this
.
inner
=
inner
;
}
@Override
public
int
read
()
throws
IOException
{
return
inner
.
read
();
}
@Override
public
boolean
isFinished
()
{
return
false
;
}
@Override
public
boolean
isReady
()
{
return
true
;
}
@Override
public
void
setReadListener
(
ReadListener
readListener
)
{
throw
new
UnsupportedOperationException
();
}
}
return
new
Stream
(
Computer
.
class
.
getResourceAsStream
(
name
));
...
...
test/src/test/java/hudson/model/QueueTest.java
浏览文件 @
e3f7f826
...
...
@@ -103,6 +103,10 @@ import org.apache.commons.io.FileUtils;
import
static
org
.
hamcrest
.
Matchers
.
nullValue
;
import
static
org
.
junit
.
Assert
.*;
import
org.eclipse.jetty.server.Server
;
import
org.eclipse.jetty.server.ServerConnector
;
import
org.eclipse.jetty.servlet.ServletHandler
;
import
org.eclipse.jetty.servlet.ServletHolder
;
import
org.junit.Assert
;
import
org.junit.Rule
;
import
org.junit.Test
;
...
...
@@ -114,10 +118,6 @@ import org.jvnet.hudson.test.SleepBuilder;
import
org.jvnet.hudson.test.TestBuilder
;
import
org.jvnet.hudson.test.TestExtension
;
import
org.jvnet.hudson.test.recipes.LocalData
;
import
org.mortbay.jetty.Server
;
import
org.mortbay.jetty.bio.SocketConnector
;
import
org.mortbay.jetty.servlet.ServletHandler
;
import
org.mortbay.jetty.servlet.ServletHolder
;
/**
* @author Kohsuke Kawaguchi
...
...
@@ -283,12 +283,12 @@ public class QueueTest {
Server
server
=
new
Server
();
S
ocketConnector
connector
=
new
SocketConnector
(
);
S
erverConnector
connector
=
new
ServerConnector
(
server
);
server
.
addConnector
(
connector
);
ServletHandler
handler
=
new
ServletHandler
();
handler
.
addServletWithMapping
(
new
ServletHolder
(
new
FileItemPersistenceTestServlet
()),
"/"
);
server
.
add
Handler
(
handler
);
server
.
set
Handler
(
handler
);
server
.
start
();
...
...
@@ -581,7 +581,6 @@ public class QueueTest {
* Make sure that the running build actually carries an credential.
*/
@Test
public
void
accessControl
()
throws
Exception
{
r
.
configureUserRealm
();
FreeStyleProject
p
=
r
.
createFreeStyleProject
();
QueueItemAuthenticatorConfiguration
.
get
().
getAuthenticators
().
add
(
new
MockQueueItemAuthenticator
(
Collections
.
singletonMap
(
p
.
getFullName
(),
alice
)));
p
.
getBuildersList
().
add
(
new
TestBuilder
()
{
...
...
@@ -608,7 +607,6 @@ public class QueueTest {
DumbSlave
s1
=
r
.
createSlave
();
DumbSlave
s2
=
r
.
createSlave
();
r
.
configureUserRealm
();
FreeStyleProject
p
=
r
.
createFreeStyleProject
();
QueueItemAuthenticatorConfiguration
.
get
().
getAuthenticators
().
add
(
new
MockQueueItemAuthenticator
(
Collections
.
singletonMap
(
p
.
getFullName
(),
alice
)));
p
.
getBuildersList
().
add
(
new
TestBuilder
()
{
...
...
test/src/test/java/hudson/model/UpdateSiteTest.java
浏览文件 @
e3f7f826
...
...
@@ -42,15 +42,16 @@ import javax.servlet.http.HttpServletResponse;
import
static
org
.
junit
.
Assert
.*;
import
org.apache.commons.io.FileUtils
;
import
org.eclipse.jetty.server.HttpConnection
;
import
org.eclipse.jetty.server.Request
;
import
org.eclipse.jetty.server.Server
;
import
org.eclipse.jetty.server.ServerConnector
;
import
org.eclipse.jetty.server.handler.AbstractHandler
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.jvnet.hudson.test.JenkinsRule
;
import
org.mortbay.jetty.HttpConnection
;
import
org.mortbay.jetty.Server
;
import
org.mortbay.jetty.bio.SocketConnector
;
import
org.mortbay.jetty.handler.AbstractHandler
;
public
class
UpdateSiteTest
{
...
...
@@ -76,18 +77,17 @@ public class UpdateSiteTest {
@Before
public
void
setUpWebServer
()
throws
Exception
{
server
=
new
Server
();
S
ocketConnector
connector
=
new
SocketConnector
(
);
S
erverConnector
connector
=
new
ServerConnector
(
server
);
server
.
addConnector
(
connector
);
server
.
setHandler
(
new
AbstractHandler
()
{
public
void
handle
(
String
target
,
HttpServletRequest
request
,
HttpServletResponse
response
,
int
dispatch
)
throws
IOException
,
ServletException
{
@Override
public
void
handle
(
String
target
,
Request
baseRequest
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
IOException
,
ServletException
{
if
(
target
.
startsWith
(
RELATIVE_BASE
))
{
target
=
target
.
substring
(
RELATIVE_BASE
.
length
());
}
String
responseBody
=
getResource
(
target
);
if
(
responseBody
!=
null
)
{
HttpConnection
.
getCurrentConnection
().
getRequest
()
.
setHandled
(
true
);
baseRequest
.
setHandled
(
true
);
response
.
setContentType
(
"text/plain; charset=utf-8"
);
response
.
setStatus
(
HttpServletResponse
.
SC_OK
);
response
.
getOutputStream
().
write
(
responseBody
.
getBytes
());
...
...
test/src/test/java/hudson/util/XStream2Security247Test.java
浏览文件 @
e3f7f826
...
...
@@ -14,6 +14,7 @@ import org.kohsuke.stapler.StaplerResponse;
import
org.mockito.Mock
;
import
org.mockito.MockitoAnnotations
;
import
javax.servlet.ReadListener
;
import
javax.servlet.ServletInputStream
;
import
java.io.File
;
import
java.io.IOException
;
...
...
@@ -116,5 +117,20 @@ public class XStream2Security247Test {
public
int
read
()
throws
IOException
{
return
inner
.
read
();
}
@Override
public
boolean
isFinished
()
{
return
false
;
}
@Override
public
boolean
isReady
()
{
return
true
;
}
@Override
public
void
setReadListener
(
ReadListener
readListener
)
{
throw
new
UnsupportedOperationException
();
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录