use of org.talend.components.api.testcomponent.TestComponentDefinition in project components by Talend.
the class ComponentDefinitionTest method testAllExecutionEngine.
@Test
public void testAllExecutionEngine() {
// A component that supports all execution engines.
TestComponentDefinition cd = new TestComponentDefinition(true);
for (ExecutionEngine engine : ExecutionEngine.values()) {
assertThat(cd.getSupportedExecutionEngines(), hasItem(engine));
assertTrue(cd.isSupportingExecutionEngines(engine));
// Nothing is returned, but there isn't any exception.
RuntimeInfo ri = cd.getRuntimeInfo(engine, null, null);
assertThat(ri, nullValue());
}
}
use of org.talend.components.api.testcomponent.TestComponentDefinition in project components by Talend.
the class ComponentDefinitionTest method testConnectorTopologyEngine_Error1.
@Test(expected = TalendRuntimeException.class)
public void testConnectorTopologyEngine_Error1() {
TestComponentDefinition cd = new TestComponentDefinition() {
@Override
public Set<ConnectorTopology> getSupportedConnectorTopologies() {
return EnumSet.of(ConnectorTopology.INCOMING, ConnectorTopology.OUTGOING);
}
};
// The assert will throw an exception on this cases
cd.assertConnectorTopologyCompatibility(ConnectorTopology.INCOMING_AND_OUTGOING);
}
use of org.talend.components.api.testcomponent.TestComponentDefinition 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.");
}
use of org.talend.components.api.testcomponent.TestComponentDefinition in project components by Talend.
the class ComponentDefinitionTest method testConnectorTopologyEngine_ok.
@Test
public void testConnectorTopologyEngine_ok() {
TestComponentDefinition cd = new TestComponentDefinition() {
@Override
public Set<ConnectorTopology> getSupportedConnectorTopologies() {
return EnumSet.of(ConnectorTopology.INCOMING, ConnectorTopology.OUTGOING);
}
};
// The assert will no thorw an exception on these two cases
cd.assertConnectorTopologyCompatibility(ConnectorTopology.INCOMING);
cd.assertConnectorTopologyCompatibility(ConnectorTopology.OUTGOING);
}
use of org.talend.components.api.testcomponent.TestComponentDefinition in project components by Talend.
the class ComponentPropertiesInitializationTest method test.
@Test
@Ignore("This is just an example of how performance tests can be written")
@PerfTest(invocations = 5, threads = 1)
@Required(max = 200, average = 100)
public void test() {
TestComponentDefinition cd = new TestComponentDefinition();
TestComponentProperties prop = (TestComponentProperties) cd.createRuntimeProperties();
prop.init();
}
Aggregations