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
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classprotected static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Collection<String>protected Stringprotected static final org.talend.sdk.component.junit.BaseComponentsHandler.Local<BaseComponentsHandler.State> -
Constructor Summary
Constructors -
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.MappercreateMapper(Class<?> componentType, Object configuration) org.talend.sdk.component.runtime.output.ProcessorcreateProcessor(Class<?> componentType, Object configuration) <T> TfindService(Class<T> serviceClass) <T> TfindService(String plugin, Class<T> serviceClass) <T> List<T>getCollectedData(Class<T> recordType) <T> TinjectServices(T instance) <T> voidprocess(Iterable<T> inputs, String family, String component, int version, Map<String, String> configuration) void<T> voidsetInputData(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:
injectServicesin interfaceComponentsHandler
-
withIsolatedPackage
-
start
-
collect
public BaseComponentsHandler.Outputs collect(org.talend.sdk.component.runtime.output.Processor processor, ControllableInputFactory inputs) - Specified by:
collectin 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:
collectin 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:
collectin 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:
collectin 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:
collectAsListin interfaceComponentsHandler
-
collectAsList
public <T> List<T> collectAsList(Class<T> recordType, org.talend.sdk.component.runtime.input.Mapper mapper, int maxRecords) - Specified by:
collectAsListin interfaceComponentsHandler
-
createMapper
public org.talend.sdk.component.runtime.input.Mapper createMapper(Class<?> componentType, Object configuration) - Specified by:
createMapperin interfaceComponentsHandler
-
createProcessor
public org.talend.sdk.component.runtime.output.Processor createProcessor(Class<?> componentType, Object configuration) - Specified by:
createProcessorin interfaceComponentsHandler
-
collect
public <T> List<T> collect(Class<T> recordType, String family, String component, int version, Map<String, String> configuration) - Specified by:
collectin interfaceComponentsHandler
-
process
public <T> void process(Iterable<T> inputs, String family, String component, int version, Map<String, String> configuration) - Specified by:
processin interfaceComponentsHandler
-
asManager
- Specified by:
asManagerin interfaceComponentsHandler
-
findService
- Specified by:
findServicein interfaceComponentsHandler
-
findService
- Specified by:
findServicein interfaceComponentsHandler
-
getTestPlugins
-
setInputData
- Specified by:
setInputDatain interfaceComponentsHandler
-
getCollectedData
- Specified by:
getCollectedDatain interfaceComponentsHandler
-
resetState
-