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
ba601cc9
Commit
ba601cc9
authored
8 years ago
by
Sören Henning
Browse files
Options
Downloads
Patches
Plain Diff
worked on ConfigurationFactory for dot export
parent
2c8bf8b2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/kieker/analysis/dev/dependencygraphs/DotDependencyGraphConfigurationFactory.java
+99
-0
99 additions, 0 deletions
...endencygraphs/DotDependencyGraphConfigurationFactory.java
with
99 additions
and
0 deletions
src/main/java/kieker/analysis/dev/dependencygraphs/DotDependencyGraphConfigurationFactory.java
+
99
−
0
View file @
ba601cc9
package
kieker.analysis.dev.dependencygraphs
;
package
kieker.analysis.dev.dependencygraphs
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
kieker.analysis.util.graph.Vertex
;
import
kieker.analysis.util.graph.export.dot.DotExportConfiguration
;
import
kieker.analysis.util.graph.export.dot.DotExportConfiguration
;
import
kieker.analysis.util.graph.util.dot.attributes.DotClusterAttribute
;
import
kieker.analysis.util.graph.util.dot.attributes.DotEdgeAttribute
;
import
kieker.analysis.util.graph.util.dot.attributes.DotGraphAttribute
;
import
kieker.analysis.util.graph.util.dot.attributes.DotGraphAttribute
;
import
kieker.analysis.util.graph.util.dot.attributes.DotNodeAttribute
;
public
class
DotDependencyGraphConfigurationFactory
{
public
class
DotDependencyGraphConfigurationFactory
{
...
@@ -10,6 +20,8 @@ public class DotDependencyGraphConfigurationFactory {
...
@@ -10,6 +20,8 @@ public class DotDependencyGraphConfigurationFactory {
configuration
.
addGraphAttribute
(
DotGraphAttribute
.
RANKDIR
,
g
->
"LR"
);
configuration
.
addGraphAttribute
(
DotGraphAttribute
.
RANKDIR
,
g
->
"LR"
);
configuration
.
addNodeAttribute
(
DotNodeAttribute
.
LABEL
,
new
VertexLabelMapper
(
"<<assembly component>>"
));
return
configuration
;
return
configuration
;
}
}
...
@@ -18,6 +30,9 @@ public class DotDependencyGraphConfigurationFactory {
...
@@ -18,6 +30,9 @@ public class DotDependencyGraphConfigurationFactory {
configuration
.
addGraphAttribute
(
DotGraphAttribute
.
RANKDIR
,
g
->
"LR"
);
configuration
.
addGraphAttribute
(
DotGraphAttribute
.
RANKDIR
,
g
->
"LR"
);
configuration
.
addClusterAttribute
(
DotClusterAttribute
.
LABEL
,
new
ClusterLabelMapper
(
"<<assembly component>>"
));
configuration
.
addNodeAttribute
(
DotNodeAttribute
.
LABEL
,
new
VertexLabelMapper
());
return
configuration
;
return
configuration
;
}
}
...
@@ -25,6 +40,10 @@ public class DotDependencyGraphConfigurationFactory {
...
@@ -25,6 +40,10 @@ public class DotDependencyGraphConfigurationFactory {
DotExportConfiguration
configuration
=
new
DotExportConfiguration
();
DotExportConfiguration
configuration
=
new
DotExportConfiguration
();
configuration
.
addGraphAttribute
(
DotGraphAttribute
.
RANKDIR
,
g
->
"LR"
);
configuration
.
addGraphAttribute
(
DotGraphAttribute
.
RANKDIR
,
g
->
"LR"
);
configuration
.
addEdgeAttribute
(
DotEdgeAttribute
.
LABEL
,
(
e
->
e
.
getProperty
(
"calls"
).
toString
()));
configuration
.
addDefaultNodeAttribute
(
DotNodeAttribute
.
SHAPE
,
g
->
"box3d"
);
configuration
.
addNodeAttribute
(
DotNodeAttribute
.
LABEL
,
new
VertexLabelMapper
(
"<<execution container>>"
));
return
configuration
;
return
configuration
;
}
}
...
@@ -33,6 +52,11 @@ public class DotDependencyGraphConfigurationFactory {
...
@@ -33,6 +52,11 @@ public class DotDependencyGraphConfigurationFactory {
DotExportConfiguration
configuration
=
new
DotExportConfiguration
();
DotExportConfiguration
configuration
=
new
DotExportConfiguration
();
configuration
.
addGraphAttribute
(
DotGraphAttribute
.
RANKDIR
,
g
->
"LR"
);
configuration
.
addGraphAttribute
(
DotGraphAttribute
.
RANKDIR
,
g
->
"LR"
);
configuration
.
addEdgeAttribute
(
DotEdgeAttribute
.
LABEL
,
(
e
->
e
.
getProperty
(
"calls"
).
toString
()));
configuration
.
addDefaultNodeAttribute
(
DotNodeAttribute
.
SHAPE
,
g
->
"box"
);
configuration
.
addClusterAttribute
(
DotClusterAttribute
.
LABEL
,
new
ClusterLabelMapper
(
"<<execution container>>"
));
configuration
.
addNodeAttribute
(
DotNodeAttribute
.
LABEL
,
new
VertexLabelMapper
(
"<<deployment component>>"
));
return
configuration
;
return
configuration
;
}
}
...
@@ -41,8 +65,83 @@ public class DotDependencyGraphConfigurationFactory {
...
@@ -41,8 +65,83 @@ public class DotDependencyGraphConfigurationFactory {
DotExportConfiguration
configuration
=
new
DotExportConfiguration
();
DotExportConfiguration
configuration
=
new
DotExportConfiguration
();
configuration
.
addGraphAttribute
(
DotGraphAttribute
.
RANKDIR
,
g
->
"LR"
);
configuration
.
addGraphAttribute
(
DotGraphAttribute
.
RANKDIR
,
g
->
"LR"
);
configuration
.
addEdgeAttribute
(
DotEdgeAttribute
.
LABEL
,
(
e
->
e
.
getProperty
(
"calls"
).
toString
()));
configuration
.
addDefaultNodeAttribute
(
DotNodeAttribute
.
SHAPE
,
g
->
"oval"
);
configuration
.
addClusterAttribute
(
DotClusterAttribute
.
LABEL
,
new
ClusterLabelMapper
(
"<<execution container>>"
,
"<<deployment component>>"
));
configuration
.
addNodeAttribute
(
DotNodeAttribute
.
LABEL
,
new
VertexLabelMapper
());
return
configuration
;
return
configuration
;
}
}
private
class
VertexLabelMapper
implements
Function
<
Vertex
,
String
>
{
private
final
String
annotation
;
public
VertexLabelMapper
()
{
this
.
annotation
=
""
;
}
public
VertexLabelMapper
(
final
String
annotation
)
{
this
.
annotation
=
annotation
;
}
@Override
public
String
apply
(
final
Vertex
vertex
)
{
final
StringBuilder
statistics
=
new
StringBuilder
();
statistics
.
append
(
this
.
annotation
);
statistics
.
append
(
"\\n"
);
statistics
.
append
(
vertex
.
getProperty
(
"Name"
).
toString
());
statistics
.
append
(
"\\n"
);
statistics
.
append
(
generateStatistics
(
vertex
));
return
statistics
.
toString
();
}
private
String
generateStatistics
(
final
Vertex
vertex
)
{
final
String
temporalUnit
=
"xs"
;
// TODO temp
final
List
<
String
>
statisticStrings
=
new
ArrayList
<>(
5
);
if
(
vertex
.
getProperty
(
"MinDuration"
)
!=
null
)
{
statisticStrings
.
add
(
"min: "
+
vertex
.
getProperty
(
"MinDuration"
).
toString
()
+
temporalUnit
);
}
if
(
vertex
.
getProperty
(
"MaxDuration"
)
!=
null
)
{
statisticStrings
.
add
(
"max: "
+
vertex
.
getProperty
(
"MaxDuration"
).
toString
()
+
temporalUnit
);
}
if
(
vertex
.
getProperty
(
"TotalDuration"
)
!=
null
)
{
statisticStrings
.
add
(
"total: "
+
vertex
.
getProperty
(
"TotalDuration"
).
toString
()
+
temporalUnit
);
}
if
(
vertex
.
getProperty
(
"MeanDuration"
)
!=
null
)
{
statisticStrings
.
add
(
"avg: "
+
vertex
.
getProperty
(
"MeanDuration"
).
toString
()
+
temporalUnit
);
}
if
(
vertex
.
getProperty
(
"MedianDuration"
)
!=
null
)
{
statisticStrings
.
add
(
"med: "
+
vertex
.
getProperty
(
"MedianDuration"
).
toString
()
+
temporalUnit
);
}
// If there are more than 3 statistics elements add a line break after the 3rd last
if
(
statisticStrings
.
size
()
>
3
)
{
final
int
thirdLast
=
statisticStrings
.
size
()
-
3
;
statisticStrings
.
set
(
thirdLast
,
statisticStrings
.
get
(
thirdLast
).
concat
(
"\\n"
));
}
return
statisticStrings
.
stream
().
collect
(
Collectors
.
joining
(
", "
));
}
}
private
class
ClusterLabelMapper
implements
Function
<
Vertex
,
String
>
{
private
final
List
<
String
>
annotations
;
public
ClusterLabelMapper
(
final
String
...
annotations
)
{
this
.
annotations
=
Arrays
.
asList
(
annotations
);
}
@Override
public
String
apply
(
final
Vertex
vertex
)
{
// TODO Get "level" of this vertex
return
this
.
annotations
.
get
(
0
)
+
"\\n"
+
vertex
.
getProperty
(
"Name"
).
toString
();
}
}
}
}
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