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
90994950
Commit
90994950
authored
9 years ago
by
Christian Wulf
Browse files
Options
Downloads
Patches
Plain Diff
fixed some indent issues
parent
9bc7c20f
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/test/java/teetime/examples/tokenizer/TokenizerConfiguration.java
+6
-13
6 additions, 13 deletions
...va/teetime/examples/tokenizer/TokenizerConfiguration.java
src/test/java/teetime/stage/InstanceOfFilterTest.java
+55
-4
55 additions, 4 deletions
src/test/java/teetime/stage/InstanceOfFilterTest.java
with
61 additions
and
17 deletions
src/test/java/teetime/examples/tokenizer/TokenizerConfiguration.java
+
6
−
13
View file @
90994950
...
...
@@ -47,20 +47,13 @@ public class TokenizerConfiguration extends AnalysisConfiguration {
final
Tokenizer
tokenizer
=
new
Tokenizer
(
" "
);
this
.
counter
=
new
Counter
<
String
>();
INTRA_PIPE_FACTORY
.
create
(
init
.
getOutputPort
(),
f2b
.
getInputPort
());
INTRA_PIPE_FACTORY
.
create
(
f2b
.
getOutputPort
(),
decomp
.
getInputPort
());
INTRA_PIPE_FACTORY
.
create
(
decomp
.
getOutputPort
(),
decrypt
.
getInputPort
());
INTRA_PIPE_FACTORY
.
create
(
decrypt
.
getOutputPort
(),
b2s
.
getInputPort
());
INTRA_PIPE_FACTORY
.
create
(
b2s
.
getOutputPort
(),
tokenizer
.
getInputPort
());
INTRA_PIPE_FACTORY
.
create
(
tokenizer
.
getOutputPort
(),
this
.
counter
.
getInputPort
());
INTRA_PIPE_FACTORY
.
create
(
init
.
getOutputPort
(),
f2b
.
getInputPort
());
INTRA_PIPE_FACTORY
.
create
(
f2b
.
getOutputPort
(),
decomp
.
getInputPort
());
INTRA_PIPE_FACTORY
.
create
(
decomp
.
getOutputPort
(),
decrypt
.
getInputPort
());
INTRA_PIPE_FACTORY
.
create
(
decrypt
.
getOutputPort
(),
b2s
.
getInputPort
());
INTRA_PIPE_FACTORY
.
create
(
b2s
.
getOutputPort
(),
tokenizer
.
getInputPort
());
INTRA_PIPE_FACTORY
.
create
(
tokenizer
.
getOutputPort
(),
this
.
counter
.
getInputPort
());
// this.getFiniteProducerStages().add(init);
this
.
addThreadableStage
(
init
);
}
...
...
This diff is collapsed.
Click to expand it.
src/test/java/teetime/stage/InstanceOfFilterTest.java
+
55
−
4
View file @
90994950
...
...
@@ -23,11 +23,20 @@ import static org.junit.Assert.assertThat;
import
static
teetime
.
framework
.
test
.
StageTester
.
test
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.List
;
import
org.junit.Before
;
import
org.junit.Test
;
import
teetime.framework.Analysis
;
import
teetime.framework.AnalysisConfiguration
;
import
teetime.framework.AnalysisException
;
import
teetime.framework.pipe.IPipeFactory
;
import
teetime.framework.pipe.PipeFactoryRegistry.PipeOrdering
;
import
teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication
;
import
teetime.util.Pair
;
/**
* @author Nils Christian Ehmke
*/
...
...
@@ -45,7 +54,10 @@ public class InstanceOfFilterTest {
final
List
<
Clazz
>
results
=
new
ArrayList
<
InstanceOfFilterTest
.
Clazz
>();
final
Object
clazz
=
new
Clazz
();
test
(
filter
).
and
().
send
(
clazz
).
to
(
filter
.
getInputPort
()).
and
().
receive
(
results
).
from
(
filter
.
getMatchedOutputPort
()).
start
();
test
(
filter
)
.
and
().
send
(
clazz
).
to
(
filter
.
getInputPort
())
.
and
().
receive
(
results
).
from
(
filter
.
getMatchedOutputPort
())
.
start
();
assertThat
(
results
,
contains
(
clazz
));
}
...
...
@@ -55,7 +67,10 @@ public class InstanceOfFilterTest {
final
List
<
Clazz
>
results
=
new
ArrayList
<
InstanceOfFilterTest
.
Clazz
>();
final
Object
clazz
=
new
SubClazz
();
test
(
filter
).
and
().
send
(
clazz
).
to
(
filter
.
getInputPort
()).
and
().
receive
(
results
).
from
(
filter
.
getMatchedOutputPort
()).
start
();
test
(
filter
)
.
and
().
send
(
clazz
).
to
(
filter
.
getInputPort
())
.
and
().
receive
(
results
).
from
(
filter
.
getMatchedOutputPort
())
.
start
();
assertThat
(
results
,
contains
(
clazz
));
}
...
...
@@ -65,7 +80,10 @@ public class InstanceOfFilterTest {
final
List
<
Clazz
>
results
=
new
ArrayList
<
InstanceOfFilterTest
.
Clazz
>();
final
Object
object
=
new
Object
();
test
(
filter
).
and
().
send
(
object
).
to
(
filter
.
getInputPort
()).
and
().
receive
(
results
).
from
(
filter
.
getMatchedOutputPort
()).
start
();
test
(
filter
)
.
and
().
send
(
object
).
to
(
filter
.
getInputPort
())
.
and
().
receive
(
results
).
from
(
filter
.
getMatchedOutputPort
())
.
start
();
assertThat
(
results
,
is
(
empty
()));
}
...
...
@@ -81,7 +99,10 @@ public class InstanceOfFilterTest {
input
.
add
(
new
SubClazz
());
input
.
add
(
new
Object
());
test
(
filter
).
and
().
send
(
input
).
to
(
filter
.
getInputPort
()).
and
().
receive
(
results
).
from
(
filter
.
getMatchedOutputPort
()).
start
();
test
(
filter
)
.
and
().
send
(
input
).
to
(
filter
.
getInputPort
())
.
and
().
receive
(
results
).
from
(
filter
.
getMatchedOutputPort
())
.
start
();
assertThat
(
results
,
hasSize
(
2
));
}
...
...
@@ -92,4 +113,34 @@ public class InstanceOfFilterTest {
private
static
class
SubClazz
extends
Clazz
{
}
@Test
public
void
filterShouldSendToBothOutputPorts
()
throws
Exception
{
InstanceOfFilterTestConfig
config
=
new
InstanceOfFilterTestConfig
();
Analysis
analysis
=
new
Analysis
(
config
);
try
{
analysis
.
execute
();
}
catch
(
AnalysisException
e
)
{
Collection
<
Pair
<
Thread
,
Throwable
>>
thrownExceptions
=
e
.
getThrownExceptions
();
// TODO: handle exception
}
}
private
static
class
InstanceOfFilterTestConfig
extends
AnalysisConfiguration
{
private
final
IPipeFactory
pipeFactory
=
PIPE_FACTORY_REGISTRY
.
getPipeFactory
(
ThreadCommunication
.
INTRA
,
PipeOrdering
.
ARBITRARY
,
false
);
public
InstanceOfFilterTestConfig
()
{
InitialElementProducer
<
Object
>
elementProducer
=
new
InitialElementProducer
<
Object
>();
InstanceOfFilter
<
Object
,
Clazz
>
instanceOfFilter
=
new
InstanceOfFilter
<
Object
,
Clazz
>(
Clazz
.
class
);
CollectorSink
<
Clazz
>
clazzCollector
=
new
CollectorSink
<
Clazz
>();
CollectorSink
<
Object
>
mismatchedCollector
=
new
CollectorSink
<
Object
>();
pipeFactory
.
create
(
elementProducer
.
getOutputPort
(),
instanceOfFilter
.
getInputPort
());
pipeFactory
.
create
(
instanceOfFilter
.
getMatchedOutputPort
(),
clazzCollector
.
getInputPort
());
pipeFactory
.
create
(
instanceOfFilter
.
getMismatchedOutputPort
(),
mismatchedCollector
.
getInputPort
());
addThreadableStage
(
elementProducer
);
}
}
}
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