Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TeeTime-Framework
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
Nelson Tavares de Sousa
TeeTime-Framework
Commits
103c706a
Commit
103c706a
authored
10 years ago
by
Nelson Tavares de Sousa
Browse files
Options
Downloads
Patches
Plain Diff
modified stage naming
parent
3868f2c9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/teetime/framework/Stage.java
+18
-2
18 additions, 2 deletions
src/main/java/teetime/framework/Stage.java
src/test/java/teetime/framework/StageTest.java
+24
-0
24 additions, 0 deletions
src/test/java/teetime/framework/StageTest.java
with
42 additions
and
2 deletions
src/main/java/teetime/framework/Stage.java
+
18
−
2
View file @
103c706a
package
teetime.framework
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.UUID
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -12,13 +12,15 @@ import teetime.framework.validation.InvalidPortConnection;
public
abstract
class
Stage
{
private
final
String
id
;
private
static
HashMap
<
String
,
Integer
>
instancesCounter
=
new
HashMap
<
String
,
Integer
>();
/**
* A unique logger instance per stage instance
*/
protected
final
Logger
logger
;
// NOPMD
protected
Stage
()
{
this
.
id
=
UUID
.
randomUUID
().
toString
();
// the id should only be represented by a UUID, not additionally by the class name
this
.
id
=
this
.
nameInstance
();
// this.id = UUID.randomUUID().toString(); // the id should only be represented by a UUID, not additionally by the class name
this
.
logger
=
LoggerFactory
.
getLogger
(
this
.
getClass
().
getName
()
+
"("
+
this
.
id
+
")"
);
}
...
...
@@ -31,6 +33,20 @@ public abstract class Stage {
return
this
.
getClass
().
getName
()
+
": "
+
this
.
getId
();
}
private
String
nameInstance
()
{
int
instances
=
0
;
String
id
;
String
simpleName
=
this
.
getClass
().
getSimpleName
();
if
(
instancesCounter
.
containsKey
(
simpleName
))
{
instances
=
instancesCounter
.
get
(
simpleName
);
}
id
=
simpleName
+
"-"
+
instances
;
instancesCounter
.
put
(
simpleName
,
++
instances
);
return
id
;
}
// public abstract Stage getParentStage();
//
// public abstract void setParentStage(Stage parentStage, int index);
...
...
This diff is collapsed.
Click to expand it.
src/test/java/teetime/framework/StageTest.java
0 → 100644
+
24
−
0
View file @
103c706a
package
teetime.framework
;
import
org.junit.Assert
;
import
org.junit.Test
;
import
teetime.stage.Cache
;
import
teetime.stage.Counter
;
public
class
StageTest
{
@Test
public
void
testId
()
{
Counter
<
Object
>
counter0
=
new
Counter
<
Object
>();
Counter
<
Object
>
counter1
=
new
Counter
<
Object
>();
Assert
.
assertEquals
(
"Counter-0"
,
counter0
.
getId
());
Assert
.
assertEquals
(
"Counter-1"
,
counter1
.
getId
());
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
Cache
<
Object
>
cache
=
new
Cache
<
Object
>();
Assert
.
assertEquals
(
"Cache-"
+
i
,
cache
.
getId
());
}
}
}
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