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
712ca93f
There was a problem fetching the pipeline summary.
Commit
712ca93f
authored
8 years ago
by
Lars Erik Blümke
Browse files
Options
Downloads
Patches
Plain Diff
First test case for MemSwapUtilizationDisplayFilter
parent
c2628d1f
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/MemSwapUtilizationDisplayFilterTest.java
+69
-0
69 additions, 0 deletions
...ugin/filter/sink/MemSwapUtilizationDisplayFilterTest.java
with
69 additions
and
0 deletions
src/test/java/kieker/analysis/plugin/filter/sink/MemSwapUtilizationDisplayFilterTest.java
0 → 100644
+
69
−
0
View file @
712ca93f
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.MemSwapUsageRecord
;
/**
* Test cases for MemSwapUtilizationDisplayFilterTest
*
* @author Lars Erik Bluemke
*/
public
class
MemSwapUtilizationDisplayFilterTest
{
private
MemSwapUsageRecord
record
;
private
MemSwapUtilizationDisplayFilter
memSwapUtilFilter
;
private
final
int
numberOfEntries
=
3
;
private
final
TimeUnit
recordsTimeUnit
=
TimeUnit
.
MILLISECONDS
;
private
final
long
timestamp
=
1L
;
private
final
String
hostname
=
"test_host"
;
private
final
long
memTotal
=
2097152000L
;
private
final
long
memUsed
=
1572864000L
;
private
final
long
memFree
=
524288000L
;
private
final
long
swapTotal
=
20971520L
;
private
final
long
swapUsed
=
15728640L
;
private
final
long
swapFree
=
5242880L
;
@Before
public
void
initializeMemSwapUtilizationDisplayFilter
()
{
record
=
new
MemSwapUsageRecord
(
timestamp
,
hostname
,
memTotal
,
memUsed
,
memFree
,
swapTotal
,
swapUsed
,
swapFree
);
memSwapUtilFilter
=
new
MemSwapUtilizationDisplayFilter
(
numberOfEntries
,
recordsTimeUnit
);
}
@Test
public
void
xyPlotEntriesShouldBeCorrect
()
{
test
(
memSwapUtilFilter
).
and
().
send
(
record
).
to
(
memSwapUtilFilter
.
getInputPort
()).
start
();
final
Date
date
=
new
Date
(
TimeUnit
.
MILLISECONDS
.
convert
(
record
.
getLoggingTimestamp
(),
recordsTimeUnit
));
final
String
minutesAndSeconds
=
date
.
toString
().
substring
(
14
,
19
);
final
String
id
=
record
.
getHostname
();
long
actualMemTotal
=
(
long
)
memSwapUtilFilter
.
getXYPlot
().
getEntries
(
id
+
" - "
+
MemSwapUtilizationDisplayFilter
.
MEM_TOTAL
).
get
(
minutesAndSeconds
);
long
actualMemUsed
=
(
long
)
memSwapUtilFilter
.
getXYPlot
().
getEntries
(
id
+
" - "
+
MemSwapUtilizationDisplayFilter
.
MEM_USED
).
get
(
minutesAndSeconds
);
long
actualMemFree
=
(
long
)
memSwapUtilFilter
.
getXYPlot
().
getEntries
(
id
+
" - "
+
MemSwapUtilizationDisplayFilter
.
MEM_FREE
).
get
(
minutesAndSeconds
);
long
actualSwapTotal
=
(
long
)
memSwapUtilFilter
.
getXYPlot
().
getEntries
(
id
+
" - "
+
MemSwapUtilizationDisplayFilter
.
SWAP_TOTAL
).
get
(
minutesAndSeconds
);
long
actualSwapUsed
=
(
long
)
memSwapUtilFilter
.
getXYPlot
().
getEntries
(
id
+
" - "
+
MemSwapUtilizationDisplayFilter
.
SWAP_USED
).
get
(
minutesAndSeconds
);
long
actualSwapFree
=
(
long
)
memSwapUtilFilter
.
getXYPlot
().
getEntries
(
id
+
" - "
+
MemSwapUtilizationDisplayFilter
.
SWAP_FREE
).
get
(
minutesAndSeconds
);
// Converting back form MB to Byte
assertThat
(
actualMemTotal
*
1048576
,
is
(
memTotal
));
assertThat
(
actualMemUsed
*
1048576
,
is
(
memUsed
));
assertThat
(
actualMemFree
*
1048576
,
is
(
memFree
));
assertThat
(
actualSwapTotal
*
1048576
,
is
(
swapTotal
));
assertThat
(
actualSwapUsed
*
1048576
,
is
(
swapUsed
));
assertThat
(
actualSwapFree
*
1048576
,
is
(
swapFree
));
}
}
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