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
401b1018
Commit
401b1018
authored
9 years ago
by
Nelson Tavares de Sousa
Browse files
Options
Downloads
Patches
Plain Diff
removed error in traversor; finished corresponding test
parent
6efde3a2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/teetime/framework/Traversor.java
+6
-5
6 additions, 5 deletions
src/main/java/teetime/framework/Traversor.java
src/test/java/teetime/framework/TraversorTest.java
+15
-4
15 additions, 4 deletions
src/test/java/teetime/framework/TraversorTest.java
with
21 additions
and
9 deletions
src/main/java/teetime/framework/Traversor.java
+
6
−
5
View file @
401b1018
...
@@ -31,17 +31,18 @@ public class Traversor {
...
@@ -31,17 +31,18 @@ public class Traversor {
}
}
public
void
traverse
(
final
Stage
stage
,
final
IPipe
inputPipe
)
{
public
void
traverse
(
final
Stage
stage
,
final
IPipe
inputPipe
)
{
if
(!
visitedStage
.
contains
(
stage
))
{
visitedStage
.
add
(
stage
);
}
else
{
return
;
}
VisitorBehavior
visitorBehavior
=
stageVisitor
.
visit
(
stage
,
inputPipe
);
VisitorBehavior
visitorBehavior
=
stageVisitor
.
visit
(
stage
,
inputPipe
);
if
(
visitorBehavior
==
VisitorBehavior
.
STOP
)
{
if
(
visitorBehavior
==
VisitorBehavior
.
STOP
)
{
return
;
return
;
}
}
if
(!
visitedStage
.
contains
(
stage
))
{
visitedStage
.
add
(
stage
);
}
else
{
return
;
}
OutputPort
<?>[]
outputPorts
=
stage
.
getOutputPorts
();
OutputPort
<?>[]
outputPorts
=
stage
.
getOutputPorts
();
for
(
OutputPort
<?>
outputPort
:
outputPorts
)
{
for
(
OutputPort
<?>
outputPort
:
outputPorts
)
{
IPipe
pipe
=
outputPort
.
getPipe
();
IPipe
pipe
=
outputPort
.
getPipe
();
...
...
This diff is collapsed.
Click to expand it.
src/test/java/teetime/framework/TraversorTest.java
+
15
−
4
View file @
401b1018
package
teetime.framework
;
package
teetime.framework
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
java.io.File
;
import
java.io.File
;
import
java.util.HashSet
;
import
java.util.Set
;
import
org.junit.Test
;
import
org.junit.Test
;
...
@@ -24,21 +28,28 @@ public class TraversorTest {
...
@@ -24,21 +28,28 @@ public class TraversorTest {
@Test
@Test
public
void
traverse
()
{
public
void
traverse
()
{
TestConfiguration
tc
=
new
TestConfiguration
();
TestConfiguration
tc
=
new
TestConfiguration
();
new
Analysis
(
tc
).
execute
();
traversor
.
traverse
(
tc
.
init
,
tc
.
init
.
getOutputPort
().
getPipe
());
traversor
.
traverse
(
tc
.
init
,
tc
.
init
.
getOutputPort
().
getPipe
());
System
.
out
.
println
(
traversor
.
getVisitedStage
());
Set
<
Stage
>
comparingSet
=
new
HashSet
<
Stage
>();
comparingSet
.
add
(
tc
.
init
);
comparingSet
.
add
(
tc
.
f2b
);
comparingSet
.
add
(
tc
.
distributor
);
assertTrue
(
comparingSet
.
equals
(
traversor
.
getVisitedStage
()));
}
}
private
class
TestConfiguration
extends
AnalysisConfiguration
{
private
class
TestConfiguration
extends
AnalysisConfiguration
{
public
final
CountingMapMerger
<
String
>
result
=
new
CountingMapMerger
<
String
>();
public
final
CountingMapMerger
<
String
>
result
=
new
CountingMapMerger
<
String
>();
public
final
InitialElementProducer
<
File
>
init
;
public
final
InitialElementProducer
<
File
>
init
;
public
final
File2SeqOfWords
f2b
;
public
Distributor
<
String
>
distributor
;
public
TestConfiguration
()
{
public
TestConfiguration
()
{
int
threads
=
1
;
int
threads
=
2
;
init
=
new
InitialElementProducer
<
File
>(
new
File
(
""
));
init
=
new
InitialElementProducer
<
File
>(
new
File
(
""
));
// final File2Lines f2b = new File2Lines();
// final File2Lines f2b = new File2Lines();
final
File2SeqOfWords
f2b
=
new
File2SeqOfWords
(
"UTF-8"
,
512
);
f2b
=
new
File2SeqOfWords
(
"UTF-8"
,
512
);
Distributor
<
String
>
distributor
=
new
Distributor
<
String
>(
new
RoundRobinStrategy2
());
distributor
=
new
Distributor
<
String
>(
new
RoundRobinStrategy2
());
// last part
// last part
final
Merger
<
CountingMap
<
String
>>
merger
=
new
Merger
<
CountingMap
<
String
>>();
final
Merger
<
CountingMap
<
String
>>
merger
=
new
Merger
<
CountingMap
<
String
>>();
...
...
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