Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
e6756d53
M
metersphere
项目概览
MeterSphere
/
metersphere
上一次同步 3 年多
通知
25
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
metersphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e6756d53
编写于
4月 16, 2020
作者:
C
chenjianxing
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' of
https://github.com/fit2cloudrd/metersphere-server
into dev
上级
cc458710
23fecbb2
变更
10
展开全部
隐藏空白更改
内联
并排
Showing
10 changed file
with
1469 addition
and
14 deletion
+1469
-14
backend/pom.xml
backend/pom.xml
+6
-0
backend/src/main/java/io/metersphere/service/PerformanceTestService.java
...n/java/io/metersphere/service/PerformanceTestService.java
+1
-1
backend/src/main/resources/org/apache/jmeter/jmeter.properties
...nd/src/main/resources/org/apache/jmeter/jmeter.properties
+1348
-0
backend/src/test/java/io/metersphere/GraphConsumerTest.java
backend/src/test/java/io/metersphere/GraphConsumerTest.java
+101
-0
frontend/src/business/App.vue
frontend/src/business/App.vue
+2
-2
frontend/src/business/components/api/ApiTest.vue
frontend/src/business/components/api/ApiTest.vue
+2
-2
frontend/src/business/components/common/head/HeaderUser.vue
frontend/src/business/components/common/head/HeaderUser.vue
+1
-1
frontend/src/business/components/performance/PerformanceTest.vue
...d/src/business/components/performance/PerformanceTest.vue
+2
-2
frontend/src/business/components/project/MsProject.vue
frontend/src/business/components/project/MsProject.vue
+3
-3
frontend/src/business/components/track/TestTrack.vue
frontend/src/business/components/track/TestTrack.vue
+3
-3
未找到文件。
backend/pom.xml
浏览文件 @
e6756d53
...
...
@@ -128,6 +128,12 @@
<artifactId>
opencsv
</artifactId>
<version>
5.1
</version>
</dependency>
<!-- jmeter -->
<dependency>
<groupId>
org.apache.jmeter
</groupId>
<artifactId>
ApacheJMeter_core
</artifactId>
<version>
${jmeter.version}
</version>
</dependency>
<!-- easyexcel -->
<dependency>
...
...
backend/src/main/java/io/metersphere/service/PerformanceTestService.java
浏览文件 @
e6756d53
...
...
@@ -31,7 +31,7 @@ import java.util.stream.Collectors;
@Service
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
class
PerformanceTestService
{
p
rivate
static
final
String
HEADERS
=
"times
tamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,URL,Latency,IdleTime,Connect"
;
p
ublic
static
final
String
HEADERS
=
"timeS
tamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,URL,Latency,IdleTime,Connect"
;
@Resource
private
LoadTestMapper
loadTestMapper
;
...
...
backend/src/main/resources/org/apache/jmeter/jmeter.properties
0 → 100644
浏览文件 @
e6756d53
此差异已折叠。
点击以展开。
backend/src/test/java/io/metersphere/GraphConsumerTest.java
0 → 100644
浏览文件 @
e6756d53
package
io.metersphere
;
import
io.metersphere.base.domain.LoadTestReportWithBLOBs
;
import
io.metersphere.base.mapper.LoadTestReportMapper
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.jmeter.report.core.Sample
;
import
org.apache.jmeter.report.core.SampleMetadata
;
import
org.apache.jmeter.report.processor.SampleContext
;
import
org.apache.jmeter.report.processor.graph.AbstractOverTimeGraphConsumer
;
import
org.apache.jmeter.report.processor.graph.impl.LatencyOverTimeGraphConsumer
;
import
org.apache.jmeter.util.JMeterUtils
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
javax.annotation.Resource
;
import
java.io.File
;
import
java.util.StringTokenizer
;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
)
public
class
GraphConsumerTest
{
@Resource
private
LoadTestReportMapper
loadTestReportMapper
;
private
AbstractOverTimeGraphConsumer
timeGraphConsumer
;
// data array can't be initialized in the init()
private
static
String
[]
data
=
{
"1527089951383"
,
"0"
,
"Read-compute"
,
"200"
,
"OK"
,
"setupRegion 1-1"
,
"true"
,
""
,
"492"
,
"0"
,
"1"
,
"1"
,
"null"
,
"0"
,
"0"
,
"0"
};
private
SampleMetadata
sampleMetaData
=
createTestMetaData
();
@Before
public
void
init
()
{
timeGraphConsumer
=
new
LatencyOverTimeGraphConsumer
();
timeGraphConsumer
.
setTitle
(
"graph title"
);
timeGraphConsumer
.
setGranularity
(
60000
);
JMeterUtils
.
loadJMeterProperties
(
"jmeter.properties"
);
// 这个路径不存在
}
@Test
public
void
test
()
{
SampleContext
sampleContext
=
new
SampleContext
();
sampleContext
.
setWorkingDirectory
(
FileUtils
.
getTempDirectory
());
timeGraphConsumer
.
setSampleContext
(
sampleContext
);
Sample
sample
=
new
Sample
(
0
,
sampleMetaData
,
data
);
timeGraphConsumer
.
initialize
();
timeGraphConsumer
.
startConsuming
();
timeGraphConsumer
.
consume
(
sample
,
0
);
timeGraphConsumer
.
stopConsuming
();
System
.
out
.
println
(
sampleContext
.
getData
());
}
@Test
public
void
test2
()
{
SampleContext
sampleContext
=
new
SampleContext
();
sampleContext
.
setWorkingDirectory
(
new
File
(
"/tmp/test_report/"
));
timeGraphConsumer
.
setSampleContext
(
sampleContext
);
timeGraphConsumer
.
initialize
();
timeGraphConsumer
.
startConsuming
();
LoadTestReportWithBLOBs
report
=
loadTestReportMapper
.
selectByPrimaryKey
(
"7fa4dd2d-d42a-46de-92bf-10feec4c6ccf"
);
String
content
=
report
.
getContent
();
StringTokenizer
tokenizer
=
new
StringTokenizer
(
content
,
"\n"
);
// 去掉第一行
tokenizer
.
nextToken
();
while
(
tokenizer
.
hasMoreTokens
())
{
String
line
=
tokenizer
.
nextToken
();
String
[]
data
=
line
.
split
(
","
,
-
1
);
Sample
sample
=
new
Sample
(
0
,
sampleMetaData
,
data
);
timeGraphConsumer
.
consume
(
sample
,
0
);
}
timeGraphConsumer
.
stopConsuming
();
System
.
out
.
println
(
sampleContext
.
getData
());
}
// Create a static SampleMetadataObject
private
SampleMetadata
createTestMetaData
()
{
String
columnsString
=
"timeStamp,elapsed,label,responseCode,responseMessage,threadName,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,URL,Latency,IdleTime,Connect"
;
columnsString
=
"timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,URL,Latency,IdleTime,Connect"
;
String
[]
columns
=
new
String
[
17
];
int
lastComa
=
0
;
int
columnIndex
=
0
;
for
(
int
i
=
0
;
i
<
columnsString
.
length
();
i
++)
{
if
(
columnsString
.
charAt
(
i
)
==
','
)
{
columns
[
columnIndex
]
=
columnsString
.
substring
(
lastComa
,
i
);
lastComa
=
i
+
1
;
columnIndex
++;
}
else
if
(
i
+
1
==
columnsString
.
length
())
{
columns
[
columnIndex
]
=
columnsString
.
substring
(
lastComa
,
i
+
1
);
}
}
return
new
SampleMetadata
(
','
,
columns
);
}
}
frontend/src/business/App.vue
浏览文件 @
e6756d53
<
template
>
<el-col
v-if=
"auth"
>
<el-row
id=
"header-top"
type=
"flex"
justify=
"space-between"
align=
"middle"
>
<el-col
:span=
"
3
"
>
<el-col
:span=
"
2
"
>
<a
class=
"logo"
/>
</el-col>
<el-col
:span=
"
9
"
>
<el-col
:span=
"
10
"
>
<ms-top-menus/>
</el-col>
<el-col
:span=
"12"
>
...
...
frontend/src/business/components/api/ApiTest.vue
浏览文件 @
e6756d53
...
...
@@ -4,7 +4,7 @@
<div>
<transition>
<keep-alive>
<router-view
:b
easeUrl=
"be
aseUrl"
/>
<router-view
:b
aseUrl=
"b
aseUrl"
/>
</keep-alive>
</transition>
</div>
...
...
@@ -19,7 +19,7 @@
components
:
{
MsApiHeaderMenus
},
data
()
{
return
{
b
e
aseUrl
:
"
api
"
baseUrl
:
"
api
"
}
}
}
...
...
frontend/src/business/components/common/head/HeaderUser.vue
浏览文件 @
e6756d53
<
template
>
<el-row
type=
"flex"
justify=
"end"
>
<el-col
:span=
"
15"
:offset=
"3
"
>
<el-col
:span=
"
21
"
>
<el-menu
:unique-opened=
"true"
mode=
"horizontal"
router
class=
"header-user-menu align-right"
background-color=
"#2c2a48"
...
...
frontend/src/business/components/performance/PerformanceTest.vue
浏览文件 @
e6756d53
...
...
@@ -4,7 +4,7 @@
<div>
<transition>
<keep-alive>
<router-view
:b
easeUrl=
"be
aseUrl"
/>
<router-view
:b
aseUrl=
"b
aseUrl"
/>
</keep-alive>
</transition>
</div>
...
...
@@ -20,7 +20,7 @@
components
:
{
PerformanceHeaderMenus
},
data
()
{
return
{
b
e
aseUrl
:
"
performance
"
baseUrl
:
"
performance
"
}
}
}
...
...
frontend/src/business/components/project/MsProject.vue
浏览文件 @
e6756d53
...
...
@@ -82,7 +82,7 @@
}
},
props
:
{
b
e
aseUrl
:
{
baseUrl
:
{
type
:
String
}
},
...
...
@@ -90,7 +90,7 @@
if
(
this
.
$route
.
path
.
split
(
'
/
'
)[
2
]
===
'
project
'
&&
this
.
$route
.
path
.
split
(
'
/
'
)[
3
]
===
'
create
'
)
{
this
.
create
();
this
.
$router
.
push
(
'
/
'
+
this
.
b
e
aseUrl
+
'
/project/all
'
);
this
.
$router
.
push
(
'
/
'
+
this
.
baseUrl
+
'
/project/all
'
);
}
this
.
list
();
},
...
...
@@ -99,7 +99,7 @@
if
(
this
.
$route
.
path
.
split
(
'
/
'
)[
2
]
===
'
project
'
&&
to
.
path
.
split
(
'
/
'
)[
3
]
===
'
create
'
)
{
this
.
create
();
this
.
$router
.
push
(
'
/
'
+
this
.
b
e
aseUrl
+
'
/project/all
'
);
this
.
$router
.
push
(
'
/
'
+
this
.
baseUrl
+
'
/project/all
'
);
}
}
},
...
...
frontend/src/business/components/track/TestTrack.vue
浏览文件 @
e6756d53
...
...
@@ -4,7 +4,7 @@
<div>
<transition>
<keep-alive>
<router-view
:b
easeUrl=
"be
aseUrl"
/>
<router-view
:b
aseUrl=
"b
aseUrl"
/>
</keep-alive>
</transition>
</div>
...
...
@@ -15,12 +15,12 @@
import
TrackHeaderMenus
from
"
./head/TrackHeaderMenus
"
;
export
default
{
export
default
{
name
:
"
TrackHome
"
,
components
:
{
TrackHeaderMenus
},
data
()
{
return
{
b
e
aseUrl
:
"
track
"
baseUrl
:
"
track
"
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录