Search in sources :

Example 16 with RuntimeInfo

use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.

the class RowGeneratorDefinitionTest method testRuntimeInfo.

/**
 * Checks the {@link RuntimeInfo} of the definition.
 */
@Test
public void testRuntimeInfo() {
    RuntimeInfo runtimeInfo = def.getRuntimeInfo(ExecutionEngine.BEAM, null, ConnectorTopology.OUTGOING);
    assertThat(runtimeInfo.getRuntimeClassName(), is("org.talend.components.localio.runtime.rowgenerator.RowGeneratorRuntime"));
// The integration module tests things that aren't available in the RuntimeInfo module until after it is
// installed in the local maven repository.
}
Also used : RuntimeInfo(org.talend.daikon.runtime.RuntimeInfo) Test(org.junit.Test)

Example 17 with RuntimeInfo

use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.

the class SalesforceBulkExecReaderTestIT method executeBulkInsert.

/**
 * Test runtime of tSalesforceOutputBulk
 */
private void executeBulkInsert(TSalesforceBulkExecProperties bulkExecProperties, String random, int count) throws Throwable {
    TSalesforceBulkExecDefinition definition = (TSalesforceBulkExecDefinition) getComponentService().getComponentDefinition(TSalesforceBulkExecDefinition.COMPONENT_NAME);
    RuntimeInfo runtimeInfo = definition.getRuntimeInfo(ExecutionEngine.DI, bulkExecProperties, ConnectorTopology.OUTGOING);
    try (SandboxedInstance sandboxedInstance = RuntimeUtil.createRuntimeClass(runtimeInfo, definition.getClass().getClassLoader())) {
        SalesforceSource boundedSource = (SalesforceSource) sandboxedInstance.getInstance();
        boundedSource.initialize(null, bulkExecProperties);
        BoundedReader boundedReader = boundedSource.createReader(null);
        try {
            boolean hasRecord = boundedReader.start();
            List<IndexedRecord> rows = new ArrayList<>();
            while (hasRecord) {
                rows.add((IndexedRecord) boundedReader.getCurrent());
                hasRecord = boundedReader.advance();
            }
            checkRows(random, rows, count);
        } finally {
            boundedReader.close();
        }
    }
}
Also used : SandboxedInstance(org.talend.daikon.sandbox.SandboxedInstance) RuntimeInfo(org.talend.daikon.runtime.RuntimeInfo) IndexedRecord(org.apache.avro.generic.IndexedRecord) TSalesforceBulkExecDefinition(org.talend.components.salesforce.tsalesforcebulkexec.TSalesforceBulkExecDefinition) ArrayList(java.util.ArrayList) BoundedReader(org.talend.components.api.component.runtime.BoundedReader)

Example 18 with RuntimeInfo

use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.

the class TSalesforceInputDefinitionTest method testRuntimeInfo.

@Test
public void testRuntimeInfo() {
    RuntimeInfo runtimeInfo = definition.getRuntimeInfo(ExecutionEngine.DI, properties, ConnectorTopology.OUTGOING);
    assertRuntimeInfo(runtimeInfo);
    runtimeInfo = definition.getRuntimeInfo(ExecutionEngine.DI, properties, ConnectorTopology.NONE);
    assertThat(runtimeInfo, nullValue(RuntimeInfo.class));
}
Also used : RuntimeInfo(org.talend.daikon.runtime.RuntimeInfo) JarRuntimeInfo(org.talend.components.api.component.runtime.JarRuntimeInfo) Test(org.junit.Test)

Example 19 with RuntimeInfo

use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.

the class SalesforceDatasetDefinitionTest method testRuntimeInfo.

@Test
public void testRuntimeInfo() {
    RuntimeInfo runtimeInfo = definition.getRuntimeInfo(properties);
    assertRuntimeInfo(runtimeInfo);
}
Also used : RuntimeInfo(org.talend.daikon.runtime.RuntimeInfo) JarRuntimeInfo(org.talend.components.api.component.runtime.JarRuntimeInfo) Test(org.junit.Test)

Example 20 with RuntimeInfo

use of org.talend.daikon.runtime.RuntimeInfo in project components by Talend.

the class TSalesforceBulkExecDefinitionTest method testRuntimeInfo.

@Test
public void testRuntimeInfo() {
    RuntimeInfo runtimeInfo = definition.getRuntimeInfo(ExecutionEngine.DI, properties, ConnectorTopology.OUTGOING);
    assertRuntimeInfo(runtimeInfo, SOURCE_CLASS);
    runtimeInfo = definition.getRuntimeInfo(ExecutionEngine.DI, properties, ConnectorTopology.NONE);
    assertRuntimeInfo(runtimeInfo, BULK_EXEC_RUNTIME_CLASS);
    runtimeInfo = definition.getRuntimeInfo(ExecutionEngine.DI, properties, ConnectorTopology.INCOMING);
    assertThat(runtimeInfo, nullValue(RuntimeInfo.class));
}
Also used : RuntimeInfo(org.talend.daikon.runtime.RuntimeInfo) JarRuntimeInfo(org.talend.components.api.component.runtime.JarRuntimeInfo) Test(org.junit.Test)

Aggregations

RuntimeInfo (org.talend.daikon.runtime.RuntimeInfo)131 Test (org.junit.Test)120 SandboxedInstance (org.talend.daikon.sandbox.SandboxedInstance)27 Ignore (org.junit.Ignore)21 JarRuntimeInfo (org.talend.components.api.component.runtime.JarRuntimeInfo)17 ArrayList (java.util.ArrayList)13 AllSetting (org.talend.components.jdbc.runtime.setting.AllSetting)11 IndexedRecord (org.apache.avro.generic.IndexedRecord)8 ExecutionEngine (org.talend.components.api.component.runtime.ExecutionEngine)8 DatasetRuntime (org.talend.components.common.dataset.runtime.DatasetRuntime)7 URL (java.net.URL)6 Schema (org.apache.avro.Schema)6 ComponentException (org.talend.components.api.exception.ComponentException)5 ValidationResult (org.talend.daikon.properties.ValidationResult)5 File (java.io.File)3 NamedThing (org.talend.daikon.NamedThing)3 SimpleNamedThing (org.talend.daikon.SimpleNamedThing)3 TalendRuntimeException (org.talend.daikon.exception.TalendRuntimeException)3 FileWriter (java.io.FileWriter)2 GenericRecord (org.apache.avro.generic.GenericRecord)2