public class SopremoTestPlan extends Object
Operators. It is created in a unit test and performs the
following operations.
SopremoTestPlan.MockupSources and SopremoTestPlan.MockupSinks if not explicitly specified,
Operators,
getExpectedOutput(int), and
getActualOutput(int).
Source source = new Source(...);
Identity projection = new Identity();
projection.setInputs(source);
Sink sink = new Sink(...);
sink.setInputs(projection);
SopremoTestPlan testPlan = new SopremoTestPlan(sink);
testPlan.run();
SopremoTestPlan with MockupSource and MockupSink
Identity identity = new Identity();
SopremoTestPlan testPlan = new SopremoTestPlan(identity);
testPlan.getInput(0).
addValue(value1).
addValue(value2);
testPlan.getExpectedOutput(0).
addValue(value1).
addValue(value2);
testPlan.run();
| Modifier and Type | Class and Description |
|---|---|
static class |
SopremoTestPlan.ActualOutput
Represents the actual output of a
SopremoTestPlan. |
static class |
SopremoTestPlan.ExpectedOutput
Represents the expected output of a
GenericTestPlan. |
static class |
SopremoTestPlan.Input
Represents the input of a
SopremoTestPlan. |
static class |
SopremoTestPlan.MockupSink
Creates a mocked
Sink. |
static class |
SopremoTestPlan.MockupSource
Creates a mocked
Source. |
class |
SopremoTestPlan.SopremoRecordTestPlan |
| Constructor and Description |
|---|
SopremoTestPlan(int numInputs,
int numOutputs)
Initializes a SopremoTestPlan with the given number of in/outputs.
|
SopremoTestPlan(List<Operator<?>> sinks)
Initializes a SopremoTestPlan with the given
Operators. |
SopremoTestPlan(Operator<?>... sinks)
Initializes a SopremoTestPlan with the given
Operators. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
SopremoTestPlan.ActualOutput |
getActualOutput(int index)
Returns the output of the operator that is associated with the given index.
|
SopremoTestPlan.ActualOutput |
getActualOutputForStream(JsonStream stream)
Returns the output of the operator that is associated with the given
JsonStream. |
EvaluationContext |
getCompilationContext()
Returns the
EvaluationContext of this plan. |
SopremoTestPlan.ExpectedOutput |
getExpectedOutput(int index)
Returns the expected output of the operator that is associated with the given index.
|
SopremoTestPlan.ExpectedOutput |
getExpectedOutputForStream(JsonStream stream)
Returns the expected output of the operator that is associated with the given
JsonStream. |
SopremoTestPlan.Input |
getInput(int index)
Returns the input for the given index.
|
SopremoTestPlan.Input |
getInputForStream(JsonStream stream)
Returns the input that is associated with the given stream.
|
Source |
getInputOperator(int index)
Returns the input operator for the given index.
|
Source[] |
getInputOperators(int from,
int to)
Returns all input operators for the given range of indices.
|
Sink |
getOutputOperator(int index)
Returns the output operator for the given index.
|
Sink[] |
getOutputOperators(int from,
int to)
Returns alls output operators for the given range of indices.
|
int |
hashCode() |
protected void |
initInputsAndOutputs(int numInputs,
int numOutputs)
Initializes the given number of in-/outputs.
|
void |
run()
Executes all operators.
|
void |
setDegreeOfParallelism(int dop)
Returns the degree of parallelism of the
test plan.
|
void |
setInputOperator(int index,
Source operator)
Sets the input operator of the specified index.
|
void |
setOutputOperator(int index,
Sink operator)
Sets the output operator of the specified index.
|
String |
toString() |
void |
trace()
If called, the execution of the Operators will be traced by
SopremoUtil. |
public SopremoTestPlan(int numInputs,
int numOutputs)
SopremoTestPlan.Inputs
and all expected/actual outputs are initialized with SopremoTestPlan.ExpectedOutputs/SopremoTestPlan.ActualOutputs.numInputs - the number of inputs that should be initializednumOutputs - the number of outputs that should be initializedpublic SopremoTestPlan(List<Operator<?>> sinks)
Operators. For each Operator that has no source or no sink,
SopremoTestPlan.MockupSources and SopremoTestPlan.MockupSinks are automatically set.sinks - the Operators that should be executedpublic SopremoTestPlan(Operator<?>... sinks)
Operators. For each Operator that has no source or no sink,
SopremoTestPlan.MockupSources and SopremoTestPlan.MockupSinks are automatically set.sinks - the Operators that should be executedpublic SopremoTestPlan.ActualOutput getActualOutput(int index)
run().index - the index of the operatorpublic SopremoTestPlan.ActualOutput getActualOutputForStream(JsonStream stream)
JsonStream. The return value is only
meaningful
after a run(). Should no operator have an association with the given stream: null will be returned.stream - the streampublic EvaluationContext getCompilationContext()
EvaluationContext of this plan.public SopremoTestPlan.ExpectedOutput getExpectedOutput(int index)
index - the index of the operatorpublic SopremoTestPlan.ExpectedOutput getExpectedOutputForStream(JsonStream stream)
JsonStream.stream - the streampublic SopremoTestPlan.Input getInput(int index)
index - the indexpublic SopremoTestPlan.Input getInputForStream(JsonStream stream)
stream - the streampublic Source getInputOperator(int index)
index - the indexpublic Source[] getInputOperators(int from, int to)
from - the start index (inclusive)to - the end index (exclusive)public Sink getOutputOperator(int index)
index - the indexpublic Sink[] getOutputOperators(int from, int to)
from - the start index (inclusive)to - the end index (exclusive)public void run()
public void setDegreeOfParallelism(int dop)
public void setInputOperator(int index,
Source operator)
index - the index where the operator should be savedoperator - the new operatorpublic void setOutputOperator(int index,
Sink operator)
index - the index where the operator should be savedoperator - the new operatorpublic void trace()
SopremoUtil.protected void initInputsAndOutputs(int numInputs,
int numOutputs)
numInputs - the number of inputsnumOutputs - the number of outputsCopyright © 2011–2014. All rights reserved.