Search in sources :

Example 6 with TestComponentDefinition

use of org.talend.components.api.testcomponent.TestComponentDefinition in project components by Talend.

the class ComponentDefinitionTest method testi18NForComponentDefintion.

@Test
public void testi18NForComponentDefintion() {
    TestComponentDefinition tcd = new TestComponentDefinition();
    assertEquals("Test Component", tcd.getDisplayName());
    assertEquals("Ze Test Component Title", tcd.getTitle());
}
Also used : TestComponentDefinition(org.talend.components.api.testcomponent.TestComponentDefinition) Test(org.junit.Test)

Example 7 with TestComponentDefinition

use of org.talend.components.api.testcomponent.TestComponentDefinition in project components by Talend.

the class ComponentDefinitionTest method test.

@Test
public void test() {
    TestComponentDefinition cd = new TestComponentDefinition();
    TestComponentProperties prop = (TestComponentProperties) cd.createRuntimeProperties();
    assertNotNull(prop.initLater);
    assertNull(prop.mainForm);
}
Also used : TestComponentProperties(org.talend.components.api.testcomponent.TestComponentProperties) TestComponentDefinition(org.talend.components.api.testcomponent.TestComponentDefinition) Test(org.junit.Test)

Example 8 with TestComponentDefinition

use of org.talend.components.api.testcomponent.TestComponentDefinition in project components by Talend.

the class ComponentDefinitionTest method testConnectorTopologyEngine_Error2.

@Test(expected = TalendRuntimeException.class)
public void testConnectorTopologyEngine_Error2() {
    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.NONE);
}
Also used : TestComponentDefinition(org.talend.components.api.testcomponent.TestComponentDefinition) Test(org.junit.Test)

Example 9 with TestComponentDefinition

use of org.talend.components.api.testcomponent.TestComponentDefinition in project components by Talend.

the class ComponentDefinitionTest method testNoExecutionEngine.

@Test
public void testNoExecutionEngine() {
    // A component that supports no execution engines.
    TestComponentDefinition cd = new TestComponentDefinition(false);
    assertThat(cd.getSupportedExecutionEngines(), hasSize(0));
}
Also used : TestComponentDefinition(org.talend.components.api.testcomponent.TestComponentDefinition) Test(org.junit.Test)

Example 10 with TestComponentDefinition

use of org.talend.components.api.testcomponent.TestComponentDefinition in project components by Talend.

the class ComponentDefinitionTest method testReturnProperties.

@Test
public void testReturnProperties() {
    TestComponentDefinition tcd = new TestComponentDefinition();
    Property[] props = tcd.getReturnProperties();
    assertEquals("return1", props[0].getName());
    assertEquals(5, props.length);
    // Make sure i18N works
    assertEquals("Error Message", props[1].getDisplayName());
    assertEquals("Number of line", props[2].getDisplayName());
    assertEquals("Number of success", props[3].getDisplayName());
    assertEquals("Number of reject", props[4].getDisplayName());
}
Also used : TestComponentDefinition(org.talend.components.api.testcomponent.TestComponentDefinition) Property(org.talend.daikon.properties.property.Property) Matchers.hasProperty(org.hamcrest.Matchers.hasProperty) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)10 TestComponentDefinition (org.talend.components.api.testcomponent.TestComponentDefinition)10 TestComponentProperties (org.talend.components.api.testcomponent.TestComponentProperties)2 RuntimeInfo (org.talend.daikon.runtime.RuntimeInfo)2 PerfTest (org.databene.contiperf.PerfTest)1 Required (org.databene.contiperf.Required)1 Matchers.hasProperty (org.hamcrest.Matchers.hasProperty)1 Ignore (org.junit.Ignore)1 ExecutionEngine (org.talend.components.api.component.runtime.ExecutionEngine)1 Property (org.talend.daikon.properties.property.Property)1