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
public class BaseComponentsHandler extends Object implements ComponentsHandler
 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBaseComponentsHandler.EmbeddedComponentManagerstatic classBaseComponentsHandler.Outputsprotected static classBaseComponentsHandler.State 
- 
Field Summary
Fields Modifier and Type Field Description protected Collection<String>isolatedPackagesprotected StringpackageNameprotected static org.talend.sdk.component.junit.BaseComponentsHandler.Local<BaseComponentsHandler.State>STATE 
- 
Constructor Summary
Constructors Constructor Description BaseComponentsHandler() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ComponentManagerasManager()<T> List<T>collect(Class<T> recordType, String family, String component, int version, Map<String,String> configuration)<T> Stream<T>collect(Class<T> recordType, org.talend.sdk.component.runtime.input.Mapper mapper, int maxRecords)<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.BaseComponentsHandler.Outputscollect(org.talend.sdk.component.runtime.output.Processor processor, ControllableInputFactory inputs)BaseComponentsHandler.Outputscollect(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)Set<String>getTestPlugins()<T> TinjectServices(T instance)<T> voidprocess(Iterable<T> inputs, String family, String component, int version, Map<String,String> configuration)voidresetState()<T> voidsetInputData(Iterable<T> data)BaseComponentsHandler.EmbeddedComponentManagerstart()BaseComponentsHandlerwithIsolatedPackage(String packageName, String... packages) 
 - 
 
- 
- 
Field Detail
- 
STATE
protected static final org.talend.sdk.component.junit.BaseComponentsHandler.Local<BaseComponentsHandler.State> STATE
 
- 
packageName
protected String packageName
 
- 
isolatedPackages
protected Collection<String> isolatedPackages
 
 - 
 
- 
Constructor Detail
- 
BaseComponentsHandler
public BaseComponentsHandler()
 
 - 
 
- 
Method Detail
- 
injectServices
public <T> T injectServices(T instance)
- Specified by:
 injectServicesin interfaceComponentsHandler
 
- 
withIsolatedPackage
public BaseComponentsHandler withIsolatedPackage(String packageName, String... packages)
 
- 
start
public BaseComponentsHandler.EmbeddedComponentManager 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
public ComponentManager asManager()
- Specified by:
 asManagerin interfaceComponentsHandler
 
- 
findService
public <T> T findService(String plugin, Class<T> serviceClass)
- Specified by:
 findServicein interfaceComponentsHandler
 
- 
findService
public <T> T findService(Class<T> serviceClass)
- Specified by:
 findServicein interfaceComponentsHandler
 
- 
getTestPlugins
public Set<String> getTestPlugins()
 
- 
setInputData
public <T> void setInputData(Iterable<T> data)
- Specified by:
 setInputDatain interfaceComponentsHandler
 
- 
getCollectedData
public <T> List<T> getCollectedData(Class<T> recordType)
- Specified by:
 getCollectedDatain interfaceComponentsHandler
 
- 
resetState
public void resetState()
 
 - 
 
 -