Search in sources :

Example 66 with RuntimeInfo

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

the class ComponentDefinitionTest method testRuntimeEngine.

@Test
public void testRuntimeEngine() {
    TestComponentDefinition cd = new TestComponentDefinition();
    assertThat(cd.getSupportedExecutionEngines(), containsInAnyOrder(ExecutionEngine.DI));
    assertTrue(cd.isSupportingExecutionEngines(ExecutionEngine.DI));
    // Nothing is returned, but there isn't any exception.
    RuntimeInfo ri = cd.getRuntimeInfo(ExecutionEngine.DI, null, null);
    assertThat(ri, nullValue());
    // Requesting a wrong execution engine causes an exception.
    thrown.expect(TalendRuntimeException.class);
    thrown.expect(hasProperty("code", is(ComponentsErrorCode.WRONG_EXECUTION_ENGINE)));
    thrown.expectMessage("WRONG_EXECUTION_ENGINE:{component=TestComponent, requested=BEAM, available=[DI]}");
    ri = cd.getRuntimeInfo(ExecutionEngine.BEAM, null, null);
    fail("An exception must have been thrown.");
}
Also used : RuntimeInfo(org.talend.daikon.runtime.RuntimeInfo) TestComponentDefinition(org.talend.components.api.testcomponent.TestComponentDefinition) Test(org.junit.Test)

Example 67 with RuntimeInfo

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

the class NetSuiteInputDefinitionTest method testRuntimeInfo.

@Test
public void testRuntimeInfo() {
    NetSuiteInputProperties properties = new NetSuiteInputProperties("test");
    properties.initForRuntime();
    RuntimeInfo runtimeInfo = definition.getRuntimeInfo(ExecutionEngine.DI, properties, ConnectorTopology.OUTGOING);
    assertNotNull(runtimeInfo);
    assertThat(runtimeInfo, instanceOf(JarRuntimeInfo.class));
    JarRuntimeInfo jarRuntimeInfo = (JarRuntimeInfo) runtimeInfo;
    assertThat(jarRuntimeInfo.getRuntimeClassName(), endsWith(".NetSuiteSourceImpl"));
}
Also used : RuntimeInfo(org.talend.daikon.runtime.RuntimeInfo) JarRuntimeInfo(org.talend.components.api.component.runtime.JarRuntimeInfo) JarRuntimeInfo(org.talend.components.api.component.runtime.JarRuntimeInfo) Test(org.junit.Test)

Example 68 with RuntimeInfo

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

the class NetSuiteRuntimeInfoTest method testRuntimeVersion.

public void testRuntimeVersion(String apiVersion) throws Exception {
    NetSuiteConnectionProperties connProps = new NetSuiteConnectionProperties("test");
    connProps.setupProperties();
    connProps.endpoint.setValue("https://webservices.netsuite.com/services/NetSuitePort_" + apiVersion);
    connProps.apiVersion.setValue(NetSuiteVersion.detectVersion(connProps.endpoint.getStringValue()).getMajorAsString("."));
    RuntimeInfo runtimeInfo = NetSuiteComponentDefinition.getRuntimeInfo(connProps, NetSuiteComponentDefinition.RUNTIME_CLASS);
    assertNotNull(runtimeInfo);
    assertThat(runtimeInfo, instanceOf(JarRuntimeInfo.class));
    JarRuntimeInfo jarRuntimeInfo = (JarRuntimeInfo) runtimeInfo;
    assertNotNull(jarRuntimeInfo.getJarUrl());
    assertNotNull(jarRuntimeInfo.getDepTxtPath());
    assertEquals(jarRuntimeInfo.getRuntimeClassName(), "org.talend.components.netsuite.v" + apiVersion + ".NetSuiteRuntimeImpl");
}
Also used : RuntimeInfo(org.talend.daikon.runtime.RuntimeInfo) JarRuntimeInfo(org.talend.components.api.component.runtime.JarRuntimeInfo) NetSuiteConnectionProperties(org.talend.components.netsuite.connection.NetSuiteConnectionProperties) JarRuntimeInfo(org.talend.components.api.component.runtime.JarRuntimeInfo)

Example 69 with RuntimeInfo

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

the class TSnowflakeRowDefinitionTest method testGetRuntimeInfo.

@Test
public void testGetRuntimeInfo() {
    TSnowflakeRowProperties properties = new TSnowflakeRowProperties("rowProperties");
    RuntimeInfo runtimeInfo = definition.getRuntimeInfo(ExecutionEngine.DI, properties, ConnectorTopology.INCOMING);
    Assert.assertEquals(SnowflakeRowSink.class.getName(), runtimeInfo.getRuntimeClassName());
    runtimeInfo = definition.getRuntimeInfo(ExecutionEngine.DI, properties, ConnectorTopology.INCOMING_AND_OUTGOING);
    Assert.assertEquals(SnowflakeRowSink.class.getName(), runtimeInfo.getRuntimeClassName());
    runtimeInfo = definition.getRuntimeInfo(ExecutionEngine.DI, properties, ConnectorTopology.NONE);
    Assert.assertEquals(SnowflakeRowStandalone.class.getName(), runtimeInfo.getRuntimeClassName());
    runtimeInfo = definition.getRuntimeInfo(ExecutionEngine.DI, properties, ConnectorTopology.OUTGOING);
    Assert.assertEquals(SnowflakeRowSource.class.getName(), runtimeInfo.getRuntimeClassName());
}
Also used : SnowflakeRowSink(org.talend.components.snowflake.runtime.SnowflakeRowSink) RuntimeInfo(org.talend.daikon.runtime.RuntimeInfo) SnowflakeRowSource(org.talend.components.snowflake.runtime.SnowflakeRowSource) SnowflakeRowStandalone(org.talend.components.snowflake.runtime.SnowflakeRowStandalone) Test(org.junit.Test)

Example 70 with RuntimeInfo

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

the class TSnowflakeOutputDefinitionTest method testGetRuntimeInfo.

@Test
public void testGetRuntimeInfo() {
    RuntimeInfo runtimeInfoForIncomingTopology;
    RuntimeInfo runtimeInfoForIncomingAndOutgoingTopology;
    runtimeInfoForIncomingTopology = outputDefinition.getRuntimeInfo(ExecutionEngine.DI, null, ConnectorTopology.INCOMING);
    runtimeInfoForIncomingAndOutgoingTopology = outputDefinition.getRuntimeInfo(ExecutionEngine.DI, null, ConnectorTopology.INCOMING_AND_OUTGOING);
    assertNotNull(runtimeInfoForIncomingTopology);
    assertNotNull(runtimeInfoForIncomingAndOutgoingTopology);
}
Also used : RuntimeInfo(org.talend.daikon.runtime.RuntimeInfo) 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