Search in sources :

Example 1 with SimpleComponentDefinition

use of org.talend.components.api.test.SimpleComponentDefinition in project components by Talend.

the class TestFixedConnectorComponentProperties method getComponentService.

// default implementation for pure java test. Shall be overriden of Spring or OSGI tests
public ComponentService getComponentService() {
    DefinitionRegistry testComponentRegistry = new DefinitionRegistry();
    SimpleComponentDefinition componentDef = new SimpleComponentDefinition("foo", ExecutionEngine.DI);
    componentDef.setPropertyClass(TestProperties.class);
    testComponentRegistry.registerDefinition(Arrays.asList(componentDef));
    return new ComponentServiceImpl(testComponentRegistry);
}
Also used : SimpleComponentDefinition(org.talend.components.api.test.SimpleComponentDefinition) ComponentServiceImpl(org.talend.components.api.service.common.ComponentServiceImpl) DefinitionRegistry(org.talend.components.api.service.common.DefinitionRegistry)

Example 2 with SimpleComponentDefinition

use of org.talend.components.api.test.SimpleComponentDefinition in project components by Talend.

the class DefintitionRegistryTest method testGetDefinitionForPropertiesType.

@Test
public void testGetDefinitionForPropertiesType() {
    // we'll check that 2 derived Properties have thier definition returned.
    SimpleComponentDefinition compDef = new SimpleComponentDefinition("def", ExecutionEngine.DI);
    compDef.setPropertyClass(NestedComponentProperties.class);
    SimpleComponentDefinition inheritedDef = new SimpleComponentDefinition("DefOfinherited", ExecutionEngine.DI);
    inheritedDef.setPropertyClass(InheritedComponentProperties.class);
    DefinitionRegistry definitionRegistry = new DefinitionRegistry();
    definitionRegistry.registerDefinition(Arrays.asList(compDef, inheritedDef, new TestComponentDefinition()));
    Iterable<Definition> definitionForPropertiesType = definitionRegistry.getDefinitionForPropertiesType(NestedComponentProperties.class);
    assertThat(definitionForPropertiesType, contains((Definition) compDef, inheritedDef));
}
Also used : SimpleComponentDefinition(org.talend.components.api.test.SimpleComponentDefinition) ComponentFamilyDefinition(org.talend.components.api.ComponentFamilyDefinition) TestComponentDefinition(org.talend.components.api.service.common.testcomponent.TestComponentDefinition) TestComponentFamilyDefinition(org.talend.components.api.service.common.testcomponent.TestComponentFamilyDefinition) Definition(org.talend.daikon.definition.Definition) ComponentDefinition(org.talend.components.api.component.ComponentDefinition) TestInjectComponentDefinition(org.talend.components.api.service.common.testcomponent.inject.TestInjectComponentDefinition) SimpleComponentDefinition(org.talend.components.api.test.SimpleComponentDefinition) TestComponentWizardDefinition(org.talend.components.api.service.common.testcomponent.TestComponentWizardDefinition) TestNestedInjectComponentDefinition(org.talend.components.api.service.common.testcomponent.inject.TestNestedInjectComponentDefinition) ComponentWizardDefinition(org.talend.components.api.wizard.ComponentWizardDefinition) TestComponentDefinition(org.talend.components.api.service.common.testcomponent.TestComponentDefinition) Test(org.junit.Test)

Aggregations

SimpleComponentDefinition (org.talend.components.api.test.SimpleComponentDefinition)2 Test (org.junit.Test)1 ComponentFamilyDefinition (org.talend.components.api.ComponentFamilyDefinition)1 ComponentDefinition (org.talend.components.api.component.ComponentDefinition)1 ComponentServiceImpl (org.talend.components.api.service.common.ComponentServiceImpl)1 DefinitionRegistry (org.talend.components.api.service.common.DefinitionRegistry)1 TestComponentDefinition (org.talend.components.api.service.common.testcomponent.TestComponentDefinition)1 TestComponentFamilyDefinition (org.talend.components.api.service.common.testcomponent.TestComponentFamilyDefinition)1 TestComponentWizardDefinition (org.talend.components.api.service.common.testcomponent.TestComponentWizardDefinition)1 TestInjectComponentDefinition (org.talend.components.api.service.common.testcomponent.inject.TestInjectComponentDefinition)1 TestNestedInjectComponentDefinition (org.talend.components.api.service.common.testcomponent.inject.TestNestedInjectComponentDefinition)1 ComponentWizardDefinition (org.talend.components.api.wizard.ComponentWizardDefinition)1 Definition (org.talend.daikon.definition.Definition)1