Search in sources :

Example 1 with TestComponentProperties

use of org.talend.components.api.service.common.testcomponent.TestComponentProperties in project components by Talend.

the class ComponentServiceTest method testGetSchema.

@Test
public void testGetSchema() {
    TestComponentProperties componentProperties = (TestComponentProperties) getComponentService().getComponentProperties(TestComponentDefinition.COMPONENT_NAME);
    Schema aSchema = SchemaBuilder.builder().booleanType();
    componentProperties.mainOutput.setValue(aSchema);
    Schema schema = getComponentService().getSchema(componentProperties, componentProperties.getAllConnectors().iterator().next(), true);
    assertEquals(aSchema, schema);
    schema = getComponentService().getSchema(componentProperties, new Connector() {

        @Override
        public String getDisplayName() {
            return null;
        }

        @Override
        public String getTitle() {
            return null;
        }

        @Override
        public void setI18nMessageFormatter(I18nMessages i18nMessages) {
        }

        @Override
        public String getI18nMessage(String key, Object... arguments) {
            return null;
        }

        @Override
        public String getName() {
            return "foo";
        }
    }, true);
    assertNull(schema);
}
Also used : Connector(org.talend.components.api.component.Connector) TestComponentProperties(org.talend.components.api.service.common.testcomponent.TestComponentProperties) Schema(org.apache.avro.Schema) I18nMessages(org.talend.daikon.i18n.I18nMessages) Test(org.junit.Test) AbstractComponentTest(org.talend.components.api.test.AbstractComponentTest)

Example 2 with TestComponentProperties

use of org.talend.components.api.service.common.testcomponent.TestComponentProperties in project components by Talend.

the class ComponentServiceTest method testAvailalbleConnectors.

@Test
public void testAvailalbleConnectors() {
    TestComponentProperties componentProperties = (TestComponentProperties) getComponentService().getComponentProperties(TestComponentDefinition.COMPONENT_NAME);
    Set<? extends Connector> availableConnectors = getComponentService().getAvailableConnectors(componentProperties, Collections.EMPTY_SET, true);
    assertThat(availableConnectors, not(is(empty())));
    Connector mainConnector = componentProperties.getAllConnectors().iterator().next();
    assertEquals(availableConnectors.iterator().next(), mainConnector);
    availableConnectors = getComponentService().getAvailableConnectors(componentProperties, Collections.singleton(mainConnector), true);
    assertThat(availableConnectors, is(empty()));
}
Also used : Connector(org.talend.components.api.component.Connector) TestComponentProperties(org.talend.components.api.service.common.testcomponent.TestComponentProperties) Test(org.junit.Test) AbstractComponentTest(org.talend.components.api.test.AbstractComponentTest)

Example 3 with TestComponentProperties

use of org.talend.components.api.service.common.testcomponent.TestComponentProperties in project components by Talend.

the class ComponentServiceTest method testGetWizardWithProps.

@Test
public void testGetWizardWithProps() {
    TestComponentWizard wizard = (TestComponentWizard) getComponentService().getComponentWizard(TestComponentWizardDefinition.COMPONENT_WIZARD_NAME, "userdata");
    wizard.props = new TestComponentProperties("props").init();
    ComponentProperties props = (ComponentProperties) wizard.props;
    List<ComponentWizard> wizards = getComponentService().getComponentWizardsForProperties(props, "userdata");
    assertTrue(props == ((TestComponentWizard) wizards.get(0)).props);
}
Also used : NestedComponentProperties(org.talend.components.api.service.common.testcomponent.nestedprop.NestedComponentProperties) TestComponentProperties(org.talend.components.api.service.common.testcomponent.TestComponentProperties) ComponentProperties(org.talend.components.api.properties.ComponentProperties) TestComponentWizard(org.talend.components.api.service.common.testcomponent.TestComponentWizard) ComponentWizard(org.talend.components.api.wizard.ComponentWizard) TestComponentProperties(org.talend.components.api.service.common.testcomponent.TestComponentProperties) TestComponentWizard(org.talend.components.api.service.common.testcomponent.TestComponentWizard) Test(org.junit.Test) AbstractComponentTest(org.talend.components.api.test.AbstractComponentTest)

Aggregations

Test (org.junit.Test)3 TestComponentProperties (org.talend.components.api.service.common.testcomponent.TestComponentProperties)3 AbstractComponentTest (org.talend.components.api.test.AbstractComponentTest)3 Connector (org.talend.components.api.component.Connector)2 Schema (org.apache.avro.Schema)1 ComponentProperties (org.talend.components.api.properties.ComponentProperties)1 TestComponentWizard (org.talend.components.api.service.common.testcomponent.TestComponentWizard)1 NestedComponentProperties (org.talend.components.api.service.common.testcomponent.nestedprop.NestedComponentProperties)1 ComponentWizard (org.talend.components.api.wizard.ComponentWizard)1 I18nMessages (org.talend.daikon.i18n.I18nMessages)1