Package org.talend.sdk.component.junit
Class BaseComponentsHandler
java.lang.Object
org.talend.sdk.component.junit.BaseComponentsHandler
- All Implemented Interfaces:
ComponentsHandler
- Direct Known Subclasses:
ComponentExtension
,SimpleComponentRule
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
protected static class
-
Field Summary
Modifier and TypeFieldDescriptionprotected Collection<String>
protected String
protected static final org.talend.sdk.component.junit.BaseComponentsHandler.Local<BaseComponentsHandler.State>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T> List<T>
collect
(Class<T> recordType, String family, String component, int version, Map<String, String> configuration) <T> Stream<T>
<T> Stream<T>
collect
(Class<T> recordType, org.talend.sdk.component.runtime.input.Mapper mapper, int maxRecords, int concurrency) Collects data emitted from this mapper.collect
(org.talend.sdk.component.runtime.output.Processor processor, ControllableInputFactory inputs) collect
(org.talend.sdk.component.runtime.output.Processor processor, ControllableInputFactory inputs, int bundleSize) Collects all outputs of a processor.<T> List<T>
collectAsList
(Class<T> recordType, org.talend.sdk.component.runtime.input.Mapper mapper) <T> List<T>
collectAsList
(Class<T> recordType, org.talend.sdk.component.runtime.input.Mapper mapper, int maxRecords) org.talend.sdk.component.runtime.input.Mapper
createMapper
(Class<?> componentType, Object configuration) org.talend.sdk.component.runtime.output.Processor
createProcessor
(Class<?> componentType, Object configuration) <T> T
findService
(Class<T> serviceClass) <T> T
findService
(String plugin, Class<T> serviceClass) <T> List<T>
getCollectedData
(Class<T> recordType) <T> T
injectServices
(T instance) <T> void
process
(Iterable<T> inputs, String family, String component, int version, Map<String, String> configuration) void
<T> void
setInputData
(Iterable<T> data) start()
withIsolatedPackage
(String packageName, String... packages)
-
Field Details
-
STATE
protected static final org.talend.sdk.component.junit.BaseComponentsHandler.Local<BaseComponentsHandler.State> STATE -
packageName
-
isolatedPackages
-
-
Constructor Details
-
BaseComponentsHandler
public BaseComponentsHandler()
-
-
Method Details
-
injectServices
- Specified by:
injectServices
in interfaceComponentsHandler
-
withIsolatedPackage
-
start
-
collect
public BaseComponentsHandler.Outputs collect(org.talend.sdk.component.runtime.output.Processor processor, ControllableInputFactory inputs) - Specified by:
collect
in interfaceComponentsHandler
-
collect
public BaseComponentsHandler.Outputs collect(org.talend.sdk.component.runtime.output.Processor processor, ControllableInputFactory inputs, int bundleSize) Collects all outputs of a processor.- Specified by:
collect
in interfaceComponentsHandler
- Parameters:
processor
- the processor to run while there are inputs.inputs
- the input factory, when an input will return null it will stop the processing.bundleSize
- the bundle size to use.- Returns:
- a map where the key is the output name and the value a stream of the output values.
-
collect
public <T> Stream<T> collect(Class<T> recordType, org.talend.sdk.component.runtime.input.Mapper mapper, int maxRecords) - Specified by:
collect
in interfaceComponentsHandler
-
collect
public <T> Stream<T> collect(Class<T> recordType, org.talend.sdk.component.runtime.input.Mapper mapper, int maxRecords, int concurrency) Collects data emitted from this mapper. If the split creates more than one mapper, it will create as much threads as mappers otherwise it will use the caller thread. IMPORTANT: don't forget to consume all the stream to ensure the underlying { @see org.talend.sdk.component.runtime.input.Input} is closed.- Specified by:
collect
in interfaceComponentsHandler
- Type Parameters:
T
- the returned type of the records of the mapper.- Parameters:
recordType
- the record type to use to type the returned type.mapper
- the mapper to go through.maxRecords
- maximum number of records, allows to stop the source when infinite.concurrency
- requested (1 can be used instead if <= 0) concurrency for the reader execution.- Returns:
- all the records emitted by the mapper.
-
collectAsList
public <T> List<T> collectAsList(Class<T> recordType, org.talend.sdk.component.runtime.input.Mapper mapper) - Specified by:
collectAsList
in interfaceComponentsHandler
-
collectAsList
public <T> List<T> collectAsList(Class<T> recordType, org.talend.sdk.component.runtime.input.Mapper mapper, int maxRecords) - Specified by:
collectAsList
in interfaceComponentsHandler
-
createMapper
public org.talend.sdk.component.runtime.input.Mapper createMapper(Class<?> componentType, Object configuration) - Specified by:
createMapper
in interfaceComponentsHandler
-
createProcessor
public org.talend.sdk.component.runtime.output.Processor createProcessor(Class<?> componentType, Object configuration) - Specified by:
createProcessor
in interfaceComponentsHandler
-
collect
public <T> List<T> collect(Class<T> recordType, String family, String component, int version, Map<String, String> configuration) - Specified by:
collect
in interfaceComponentsHandler
-
process
public <T> void process(Iterable<T> inputs, String family, String component, int version, Map<String, String> configuration) - Specified by:
process
in interfaceComponentsHandler
-
asManager
- Specified by:
asManager
in interfaceComponentsHandler
-
findService
- Specified by:
findService
in interfaceComponentsHandler
-
findService
- Specified by:
findService
in interfaceComponentsHandler
-
getTestPlugins
-
setInputData
- Specified by:
setInputData
in interfaceComponentsHandler
-
getCollectedData
- Specified by:
getCollectedData
in interfaceComponentsHandler
-
resetState
-