Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kieker-TeeTime-Stages
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeeTime
Kieker-TeeTime-Stages
Commits
0b1c3427
There was a problem fetching the pipeline summary.
Commit
0b1c3427
authored
8 years ago
by
Lars Erik Blümke
Browse files
Options
Downloads
Patches
Plain Diff
Test cases for GPUUtilization Filter
parent
66b69838
No related branches found
No related tags found
No related merge requests found
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/kieker/analysis/plugin/filter/sink/CPUUtilizationDisplayFilterTest.java
+78
-0
78 additions, 0 deletions
...s/plugin/filter/sink/CPUUtilizationDisplayFilterTest.java
with
78 additions
and
0 deletions
src/test/java/kieker/analysis/plugin/filter/sink/CPUUtilizationDisplayFilterTest.java
0 → 100644
+
78
−
0
View file @
0b1c3427
package
kieker.analysis.plugin.filter.sink
;
import
static
org
.
hamcrest
.
core
.
Is
.
is
;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
static
teetime
.
framework
.
test
.
StageTester
.
test
;
import
java.util.Date
;
import
java.util.concurrent.TimeUnit
;
import
org.junit.Before
;
import
org.junit.Test
;
import
kieker.common.record.system.CPUUtilizationRecord
;
/**
* Test cases for CPUUtilizationDisplayFilter
*
* @author Lars Erik Bluemke
*/
public
class
CPUUtilizationDisplayFilterTest
{
private
CPUUtilizationRecord
record
;
private
CPUUtilizationDisplayFilter
cpuUtilFilter
;
private
String
id
;
// Constructor arguments for filter
private
final
int
numberOfEntries
=
3
;
private
final
TimeUnit
recordsTimeUnit
=
TimeUnit
.
MILLISECONDS
;
private
final
Number
[]
warningIntervals
=
{
1
,
2
,
3
};
// Record data
private
final
long
timestamp
=
1L
;
private
final
String
hostname
=
"hostname"
;
private
final
String
cpuID
=
"cpu_1"
;
private
final
double
user
=
2.0
;
private
final
double
system
=
3.0
;
private
final
double
wait
=
4.0
;
private
final
double
nice
=
5.0
;
private
final
double
irq
=
6.0
;
private
final
double
totalUtilisation
=
7.0
;
private
final
double
idle
=
8.0
;
@Before
public
void
initializeCPUUtilizationDisplayFilter
()
{
record
=
new
CPUUtilizationRecord
(
timestamp
,
hostname
,
cpuID
,
user
,
system
,
wait
,
nice
,
irq
,
totalUtilisation
,
idle
);
cpuUtilFilter
=
new
CPUUtilizationDisplayFilter
(
numberOfEntries
,
warningIntervals
,
recordsTimeUnit
);
id
=
record
.
getHostname
()
+
" - "
+
record
.
getCpuID
();
}
@Test
public
void
meterGaugeValueShouldBeCorrect
()
{
test
(
cpuUtilFilter
).
and
().
send
(
record
).
to
(
cpuUtilFilter
.
getInputPort
()).
start
();
assertThat
((
double
)
cpuUtilFilter
.
getMeterGauge
().
getValue
(
id
)
/
100
,
is
(
totalUtilisation
));
}
@Test
public
void
xyPlotEntriesShouldBeCorrect
()
{
test
(
cpuUtilFilter
).
and
().
send
(
record
).
to
(
cpuUtilFilter
.
getInputPort
()).
start
();
final
Date
date
=
new
Date
(
TimeUnit
.
MILLISECONDS
.
convert
(
record
.
getLoggingTimestamp
(),
recordsTimeUnit
));
final
String
minutesAndSeconds
=
date
.
toString
().
substring
(
14
,
19
);
double
actualUser
=
(
double
)
cpuUtilFilter
.
getXYPlot
().
getEntries
(
id
+
" - "
+
"user"
).
get
(
minutesAndSeconds
);
double
actualSystem
=
(
double
)
cpuUtilFilter
.
getXYPlot
().
getEntries
(
id
+
" - "
+
"system"
).
get
(
minutesAndSeconds
);
double
actualNice
=
(
double
)
cpuUtilFilter
.
getXYPlot
().
getEntries
(
id
+
" - "
+
"nice"
).
get
(
minutesAndSeconds
);
double
actualIrq
=
(
double
)
cpuUtilFilter
.
getXYPlot
().
getEntries
(
id
+
" - "
+
"irq"
).
get
(
minutesAndSeconds
);
double
actualTotalUtilization
=
(
double
)
cpuUtilFilter
.
getXYPlot
().
getEntries
(
id
+
" - "
+
"totalUtilization"
).
get
(
minutesAndSeconds
);
double
actualIdle
=
(
double
)
cpuUtilFilter
.
getXYPlot
().
getEntries
(
id
+
" - "
+
"idle"
).
get
(
minutesAndSeconds
);
assertThat
(
actualUser
/
100
,
is
(
user
));
assertThat
(
actualSystem
/
100
,
is
(
system
));
assertThat
(
actualNice
/
100
,
is
(
nice
));
assertThat
(
actualIrq
/
100
,
is
(
irq
));
assertThat
(
actualTotalUtilization
/
100
,
is
(
totalUtilisation
));
assertThat
(
actualIdle
/
100
,
is
(
idle
));
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment