Search in sources :

Example 6 with RuntimeInfo

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

the class TSalesforceOutputBulkDefinitionTest method testRuntimeInfo.

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

Example 7 with RuntimeInfo

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

the class TSalesforceOutputBulkExecDefinitionTest method testRuntimeInfo.

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

Example 8 with RuntimeInfo

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

the class ComponentServiceTest method testGetRuntimeInfo.

@Test
public void testGetRuntimeInfo() throws MalformedURLException {
    // check the comp def return the proper stream for the pom
    RuntimeInfo runtimeInfo = getComponentService().getRuntimeInfo(TestComponentDefinition.COMPONENT_NAME, ExecutionEngine.DI, null, null);
    assertEquals(5, runtimeInfo.getMavenUrlDependencies().size());
    assertThat(runtimeInfo.getMavenUrlDependencies(), containsInAnyOrder(// 
    new URL("mvn:org.apache.maven/maven-core/3.3.3/jar"), // 
    new URL("mvn:org.eclipse.sisu/org.eclipse.sisu.plexus/0.0.0.M2a/jar"), // 
    new URL("mvn:org.apache.maven/maven-artifact/3.3.3/jar"), // 
    new URL("mvn:org.eclipse.aether/aether-transport-file/1.0.0.v20140518/jar"), // 
    new URL("mvn:org.talend.components/file-input/0.1.0.SNAPSHOT/jar")));
}
Also used : RuntimeInfo(org.talend.daikon.runtime.RuntimeInfo) URL(java.net.URL) Test(org.junit.Test) AbstractComponentTest(org.talend.components.api.test.AbstractComponentTest)

Example 9 with RuntimeInfo

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

the class SandboxedFixedInputRuntimeTest method testDatasetGetSample.

@Test
public void testDatasetGetSample() throws Exception {
    // The two records to use as values.
    GenericRecord r1 = new GenericData.Record(SampleSchemas.recordSimple());
    r1.put("id", 1);
    r1.put("name", "one");
    GenericRecord r2 = new GenericData.Record(SampleSchemas.recordSimple());
    r2.put("id", 2);
    r2.put("name", "two");
    final FixedDatasetProperties props = createComponentProperties().getDatasetProperties();
    props.format.setValue(FixedDatasetProperties.RecordFormat.AVRO);
    props.schema.setValue(SampleSchemas.recordSimple().toString());
    props.values.setValue(r1.toString() + r2.toString());
    final List<IndexedRecord> consumed = new ArrayList<>();
    RuntimeInfo ri = new FixedDatasetDefinition().getRuntimeInfo(props);
    try (SandboxedInstance si = RuntimeUtil.createRuntimeClass(ri, getClass().getClassLoader())) {
        DatasetRuntime<FixedDatasetProperties> runtime = (DatasetRuntime<FixedDatasetProperties>) si.getInstance();
        runtime.initialize(null, props);
        // The functionality of the runtime is tested in its own module.
        runtime.getSample(100, new Consumer<IndexedRecord>() {

            @Override
            public void accept(IndexedRecord ir) {
                consumed.add(ir);
            }
        });
    }
    assertThat(consumed, hasSize(2));
}
Also used : IndexedRecord(org.apache.avro.generic.IndexedRecord) RuntimeInfo(org.talend.daikon.runtime.RuntimeInfo) DatasetRuntime(org.talend.components.common.dataset.runtime.DatasetRuntime) ArrayList(java.util.ArrayList) SandboxedInstance(org.talend.daikon.sandbox.SandboxedInstance) FixedDatasetDefinition(org.talend.components.localio.fixed.FixedDatasetDefinition) GenericRecord(org.apache.avro.generic.GenericRecord) IndexedRecord(org.apache.avro.generic.IndexedRecord) GenericRecord(org.apache.avro.generic.GenericRecord) FixedDatasetProperties(org.talend.components.localio.fixed.FixedDatasetProperties) Test(org.junit.Test)

Example 10 with RuntimeInfo

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

the class SandboxedFixedInputRuntimeTest method testRuntimeInfo.

@Test
public void testRuntimeInfo() {
    RuntimeInfo ri = def.getRuntimeInfo(ExecutionEngine.BEAM, createComponentProperties(), ConnectorTopology.OUTGOING);
    List<URL> dependencies = ri.getMavenUrlDependencies();
    // The important part of the test is that no exceptions are thrown while creating the RuntimeInfo.
    assertThat(dependencies, hasSize(greaterThan(40)));
}
Also used : RuntimeInfo(org.talend.daikon.runtime.RuntimeInfo) URL(java.net.URL) 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