Search in sources :

Example 1 with IKinesisDatasetRuntime

use of org.talend.components.kinesis.runtime.IKinesisDatasetRuntime in project components by Talend.

the class KinesisDatasetRuntimeTestIT method listStreams.

// Can't use localstack to list streams by region
@Test
public void listStreams() {
    KinesisDatasetProperties props = getDatasetForListStreams(getDatastore(), KinesisRegion.DEFAULT, null);
    RuntimeInfo ri = def.getRuntimeInfo(props);
    try (SandboxedInstance si = RuntimeUtil.createRuntimeClass(ri, getClass().getClassLoader())) {
        IKinesisDatasetRuntime runtime = (IKinesisDatasetRuntime) si.getInstance();
        runtime.initialize(null, props);
        Set<String> streams = runtime.listStreams();
        // no exception is ok
        assertTrue(true);
    }
}
Also used : SandboxedInstance(org.talend.daikon.sandbox.SandboxedInstance) RuntimeInfo(org.talend.daikon.runtime.RuntimeInfo) KinesisDatasetProperties(org.talend.components.kinesis.KinesisDatasetProperties) IKinesisDatasetRuntime(org.talend.components.kinesis.runtime.IKinesisDatasetRuntime) Test(org.junit.Test)

Example 2 with IKinesisDatasetRuntime

use of org.talend.components.kinesis.runtime.IKinesisDatasetRuntime in project components by Talend.

the class KinesisDatasetProperties method afterRegion.

public void afterRegion() {
    refreshLayout(getForm(Form.MAIN));
    KinesisDatasetDefinition definition = new KinesisDatasetDefinition();
    RuntimeInfo ri = definition.getRuntimeInfo(this);
    try (SandboxedInstance si = RuntimeUtil.createRuntimeClass(ri, getClass().getClassLoader())) {
        IKinesisDatasetRuntime runtime = (IKinesisDatasetRuntime) si.getInstance();
        runtime.initialize(null, this);
        this.streamName.setPossibleValues(new ArrayList<String>(runtime.listStreams()));
    } catch (Exception e) {
        TalendRuntimeException.build(ComponentsErrorCode.IO_EXCEPTION, e).throwIt();
    }
}
Also used : SandboxedInstance(org.talend.daikon.sandbox.SandboxedInstance) RuntimeInfo(org.talend.daikon.runtime.RuntimeInfo) TalendRuntimeException(org.talend.daikon.exception.TalendRuntimeException) IKinesisDatasetRuntime(org.talend.components.kinesis.runtime.IKinesisDatasetRuntime)

Aggregations

IKinesisDatasetRuntime (org.talend.components.kinesis.runtime.IKinesisDatasetRuntime)2 RuntimeInfo (org.talend.daikon.runtime.RuntimeInfo)2 SandboxedInstance (org.talend.daikon.sandbox.SandboxedInstance)2 Test (org.junit.Test)1 KinesisDatasetProperties (org.talend.components.kinesis.KinesisDatasetProperties)1 TalendRuntimeException (org.talend.daikon.exception.TalendRuntimeException)1