T - the record typeRecords - record type-specific GenericTestRecordspublic abstract class GenericTestPlan<T,Records extends GenericTestRecords<T>> extends Object implements Closeable
TestPlan for the core Record implementation.| Constructor and Description |
|---|
GenericTestPlan(TypeConfig<T> defaultConfig,
Collection<? extends eu.stratosphere.api.common.operators.Operator> contracts)
Initializes TestPlan with the given
Operators. |
GenericTestPlan(TypeConfig<T> defaultConfig,
eu.stratosphere.api.common.operators.Operator... contracts)
Initializes TestPlan with the given
Operators. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
static eu.stratosphere.api.common.operators.FileDataSink |
createDefaultSink(String name,
TypeConfig<?> typeConfig)
Creates a default sink with the given name.
|
static eu.stratosphere.api.common.operators.FileDataSource |
createDefaultSource(String name,
TypeConfig<?> typeConfig)
Creates a default source with the given name.
|
protected eu.stratosphere.api.common.Plan |
createPlan(Collection<eu.stratosphere.api.common.operators.GenericDataSink> wrappedSinks)
Creates the actual plan for the given sinks.
|
protected abstract Records |
createTestRecords(TypeConfig<T> typeConfig)
Creates the concrete implementation of
GenericTestRecords for this plan. |
Records |
getActualOutput()
Returns the first output
GenericTestRecords of the TestPlan associated with the
given sink. |
Records |
getActualOutput(eu.stratosphere.api.common.operators.GenericDataSink sink)
Returns the output
GenericTestRecords of the TestPlan associated with the
given sink. |
Records |
getActualOutput(eu.stratosphere.api.common.operators.GenericDataSink sink,
TypeConfig<T> typeConfig)
Returns the output
GenericTestRecords of the TestPlan associated with the
given sink. |
Records |
getActualOutput(int number)
Returns the output
GenericTestRecords associated with the ith
output of the TestPlan. |
Records |
getActualOutput(int sinkNumber,
TypeConfig<T> typeConfig)
Returns the output
GenericTestRecords of the TestPlan associated with the
ith sink.The values are only meaningful after a run(). |
Records |
getActualOutput(TypeConfig<T> typeConfig)
Returns the first output
GenericTestRecords of the TestPlan associated with the
given sink. |
protected TypeConfig<T> |
getDefaultConfig()
Returns the defaultConfig.
|
int |
getDegreeOfParallelism()
Returns the degreeOfParallelism.
|
Records |
getExpectedOutput(eu.stratosphere.api.common.operators.GenericDataSink sink,
TypeConfig<T> typeConfig)
Returns the expected output
GenericTestRecords with the given TypeConfig of the TestPlan
associated with the given sink. |
Records |
getExpectedOutput(int number,
TypeConfig<T> typeConfig)
Returns the expected output
GenericTestRecords associated with the
ith expected output of the TestPlan. |
Records |
getExpectedOutput(TypeConfig<T> typeConfig)
Returns the first expected output
GenericTestRecords of the TestPlan. |
Records |
getInput()
Returns the first input
GenericTestRecords of the TestPlan. |
Records |
getInput(eu.stratosphere.api.common.operators.GenericDataSource<?> source)
Returns the input
GenericTestRecords of the TestPlan associated with the
given source. |
Records |
getInput(eu.stratosphere.api.common.operators.GenericDataSource<?> source,
TypeConfig<T> typeConfig)
Returns the input
GenericTestRecords of the TestPlan associated with the
given source. |
Records |
getInput(int number)
Returns the input
GenericTestRecords associated with the ith input
of the TestPlan. |
Records |
getInput(int number,
TypeConfig<T> typeConfig)
Returns the input
GenericTestRecords associated with the ith input
of the TestPlan. |
eu.stratosphere.api.common.operators.Operator |
getOutputOfOperator(eu.stratosphere.api.common.operators.Operator contract)
Traverses the test plan and returns the first contracts that process the
data of the given contract.
|
eu.stratosphere.api.common.operators.Operator[] |
getOutputsOfOperator(eu.stratosphere.api.common.operators.Operator contract)
Traverses the test plan and returns all contracts that process the data
of the given contract.
|
List<eu.stratosphere.api.common.operators.GenericDataSink> |
getSinks()
Returns all
GenericDataSinks of this test plan. |
List<eu.stratosphere.api.common.operators.GenericDataSource<?>> |
getSources()
Returns the sources.
|
void |
run()
Compiles the plan to an
Plan and executes it. |
protected void |
setDefaultConfig(TypeConfig<T> defaultConfig)
Sets the defaultConfig to the specified value.
|
void |
setDegreeOfParallelism(int degreeOfParallelism)
Sets the degreeOfParallelism to the specified value.
|
public GenericTestPlan(TypeConfig<T> defaultConfig, Collection<? extends eu.stratosphere.api.common.operators.Operator> contracts)
Operators. Like the original Plan, the contracts may be
GenericDataSinks. However, it
is also possible to add arbitrary Operators, to which GenericDataSinkOperators
are automatically added.defaultConfig - the TypeConfig that is used for the plan if no specific config is givencontracts - a list of Operators with at least one element.public GenericTestPlan(TypeConfig<T> defaultConfig, eu.stratosphere.api.common.operators.Operator... contracts)
Operators. Like the original Plan, the contracts may be
GenericDataSinks. However, it
is also possible to add arbitrary Operators, to which GenericDataSinkOperators
are automatically added.defaultConfig - the TypeConfig that is used for the plan if no specific config is givencontracts - a list of Operators with at least one element.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic Records getActualOutput()
GenericTestRecords of the TestPlan associated with the
given sink. This is the recommended method to get output records for more
complex TestPlans.run().GenericTestRecords of the TestPlan associated with the
first sinkpublic Records getActualOutput(eu.stratosphere.api.common.operators.GenericDataSink sink)
GenericTestRecords of the TestPlan associated with the
given sink. This is the recommended method to get output records for more
complex TestPlans.run().sink - the sink of which the associated output GenericTestRecords should be
returnedGenericTestRecords of the TestPlan associated with the
given sinkpublic Records getActualOutput(eu.stratosphere.api.common.operators.GenericDataSink sink, TypeConfig<T> typeConfig)
GenericTestRecords of the TestPlan associated with the
given sink. This is the recommended method to get output records for more
complex TestPlans.run().typeConfig - the TypeConfig that is used for this outputsink - the sink of which the associated output GenericTestRecords should be
returnedGenericTestRecords of the TestPlan associated with the
given sinkpublic Records getActualOutput(int number)
GenericTestRecords associated with the ith
output of the TestPlan. If multiple contracts are tested in the TestPlan,
it is recommended to use the getActualOutput(GenericDataSink) method to unambiguously get the
values.run().number - the number of the output.public Records getActualOutput(int sinkNumber, TypeConfig<T> typeConfig)
GenericTestRecords of the TestPlan associated with the
ith sink.run().typeConfig - the TypeConfig that is used for this outputsinkNumber - the ith sink of which the associated output GenericTestRecords should be
returnedpublic Records getActualOutput(TypeConfig<T> typeConfig)
GenericTestRecords of the TestPlan associated with the
given sink. This is the recommended method to get output records for more
complex TestPlans.run().typeConfig - the TypeConfig that is used for this outputGenericTestRecords of the TestPlan associated with the
first sinkpublic int getDegreeOfParallelism()
public Records getExpectedOutput(eu.stratosphere.api.common.operators.GenericDataSink sink, TypeConfig<T> typeConfig)
GenericTestRecords with the given TypeConfig of the TestPlan
associated with the given sink. This is the recommended method to set expected
output records for more complex TestPlans.sink - the sink of which the associated expected output GenericTestRecords
should be returnedtypeConfig - the TypeConfig that should be used to create a new GenericTestRecords if neededGenericTestRecords of the TestPlan associated
with the given sinkpublic Records getExpectedOutput(int number, TypeConfig<T> typeConfig)
GenericTestRecords associated with the
ith expected output of the TestPlan. If multiple contracts are
tested in the TestPlan, it is recommended to use the getExpectedOutput(GenericDataSink, TypeConfig)
method to
unambiguously set the values.typeConfig - the TypeConfig that should be used to create a new GenericTestRecords if needednumber - the number of the expected output.public Records getExpectedOutput(TypeConfig<T> typeConfig)
GenericTestRecords of the TestPlan. If
multiple contracts are tested in the TestPlan, it is recommended to use
the getExpectedOutput(GenericDataSink, TypeConfig) method to unambiguously
set the values.typeConfig - public Records getInput()
GenericTestRecords of the TestPlan. If multiple
contracts are tested in the TestPlan, it is recommended to use the getInput(GenericDataSource) method
to unambiguously set the
values.public Records getInput(eu.stratosphere.api.common.operators.GenericDataSource<?> source)
GenericTestRecords of the TestPlan associated with the
given source. This is the recommended method to set input records for more
complex TestPlans.source - the source of which the associated input GenericTestRecords should be
returnedGenericTestRecords of the TestPlan associated with the
given sourcepublic Records getInput(eu.stratosphere.api.common.operators.GenericDataSource<?> source, TypeConfig<T> typeConfig)
GenericTestRecords of the TestPlan associated with the
given source. This is the recommended method to set input records for more
complex TestPlans.typeConfig - the TypeConfig that should be used to create a new GenericTestRecords if neededsource - the source of which the associated input GenericTestRecords should be
returnedGenericTestRecords of the TestPlan associated with the
given sourcepublic Records getInput(int number)
GenericTestRecords associated with the ith input
of the TestPlan. If multiple contracts are tested in the TestPlan, it is
recommended to use the getInput(GenericDataSource) method to
unambiguously set the values.number - the number of the input.public Records getInput(int number, TypeConfig<T> typeConfig)
GenericTestRecords associated with the ith input
of the TestPlan. If multiple contracts are tested in the TestPlan, it is
recommended to use the getInput(GenericDataSource, TypeConfig) method to
unambiguously set the values.number - the number of the input.typeConfig - the TypeConfig that should be used to create a new GenericTestRecords if neededpublic eu.stratosphere.api.common.operators.Operator getOutputOfOperator(eu.stratosphere.api.common.operators.Operator contract)
contract - the contract of which one preceding contracts should be
returnedpublic eu.stratosphere.api.common.operators.Operator[] getOutputsOfOperator(eu.stratosphere.api.common.operators.Operator contract)
contract - the contract of which preceding contracts should be returnedpublic List<eu.stratosphere.api.common.operators.GenericDataSink> getSinks()
GenericDataSinks of this test plan.public List<eu.stratosphere.api.common.operators.GenericDataSource<?>> getSources()
public void run()
Plan and executes it. If
expected values have been specified, the actual outputs values are
compared to the expected values.public void setDegreeOfParallelism(int degreeOfParallelism)
degreeOfParallelism - the degreeOfParallelism to setprotected eu.stratosphere.api.common.Plan createPlan(Collection<eu.stratosphere.api.common.operators.GenericDataSink> wrappedSinks)
wrappedSinks - the sinksprotected abstract Records createTestRecords(TypeConfig<T> typeConfig)
GenericTestRecords for this plan.typeConfig - the TypeConfig to useprotected TypeConfig<T> getDefaultConfig()
protected void setDefaultConfig(TypeConfig<T> defaultConfig)
defaultConfig - the defaultConfig to setpublic static eu.stratosphere.api.common.operators.FileDataSink createDefaultSink(String name, TypeConfig<?> typeConfig)
GenericTestRecords.name - the name of the sinktypeConfig - the TypeConfig used in SequentialOutputFormatpublic static eu.stratosphere.api.common.operators.FileDataSource createDefaultSource(String name, TypeConfig<?> typeConfig)
GenericTestRecords.name - the name of the sourcetypeConfig - the TypeConfig used in SequentialInputFormatCopyright © 2014. All rights reserved.