Search in sources :

Example 1 with ComponentFamilyDefinition

use of org.talend.components.api.ComponentFamilyDefinition in project components by Talend.

the class ServiceSpiFactoryTest method testGetComponentService.

@Test
public void testGetComponentService() throws Exception {
    ComponentService cs = ServiceSpiFactory.getComponentService();
    assertThat(cs, not(nullValue()));
    DefinitionRegistry defReg = ServiceSpiFactory.getDefinitionRegistry();
    assertThat(cs, not(nullValue()));
    Map<String, ComponentFamilyDefinition> families = defReg.getComponentFamilies();
    assertThat(families, hasEntry(is("LocalIO"), isA((Class) LocalIOComponentFamilyDefinition.class)));
    assertThat(families, hasEntry(is("SimpleFileIo"), isA((Class) SimpleFileIOComponentFamilyDefinition.class)));
    Map<String, Definition> definitions = defReg.getDefinitions();
    assertThat(definitions, hasEntry(is("FixedFlowInput"), isA((Class) FixedFlowInputDefinition.class)));
    assertThat(definitions, hasEntry(is("SimpleFileIoDatastore"), isA((Class) SimpleFileIODatastoreDefinition.class)));
    assertThat(definitions, hasEntry(is("SimpleFileIoDataset"), isA((Class) SimpleFileIODatasetDefinition.class)));
    assertThat(definitions, hasEntry(is("SimpleFileIoInput"), isA((Class) SimpleFileIOInputDefinition.class)));
    assertThat(definitions, hasEntry(is("SimpleFileIoOutput"), isA((Class) SimpleFileIOOutputDefinition.class)));
}
Also used : FixedFlowInputDefinition(org.talend.components.localio.fixedflowinput.FixedFlowInputDefinition) SimpleFileIOInputDefinition(org.talend.components.simplefileio.input.SimpleFileIOInputDefinition) ComponentFamilyDefinition(org.talend.components.api.ComponentFamilyDefinition) SimpleFileIODatastoreDefinition(org.talend.components.simplefileio.SimpleFileIODatastoreDefinition) Definition(org.talend.daikon.definition.Definition) SimpleFileIOComponentFamilyDefinition(org.talend.components.simplefileio.SimpleFileIOComponentFamilyDefinition) SimpleFileIODatasetDefinition(org.talend.components.simplefileio.SimpleFileIODatasetDefinition) SimpleFileIOInputDefinition(org.talend.components.simplefileio.input.SimpleFileIOInputDefinition) SimpleFileIOOutputDefinition(org.talend.components.simplefileio.output.SimpleFileIOOutputDefinition) LocalIOComponentFamilyDefinition(org.talend.components.localio.LocalIOComponentFamilyDefinition) FixedFlowInputDefinition(org.talend.components.localio.fixedflowinput.FixedFlowInputDefinition) SimpleFileIOOutputDefinition(org.talend.components.simplefileio.output.SimpleFileIOOutputDefinition) SimpleFileIOComponentFamilyDefinition(org.talend.components.simplefileio.SimpleFileIOComponentFamilyDefinition) ComponentFamilyDefinition(org.talend.components.api.ComponentFamilyDefinition) SimpleFileIOComponentFamilyDefinition(org.talend.components.simplefileio.SimpleFileIOComponentFamilyDefinition) LocalIOComponentFamilyDefinition(org.talend.components.localio.LocalIOComponentFamilyDefinition) SimpleFileIODatasetDefinition(org.talend.components.simplefileio.SimpleFileIODatasetDefinition) LocalIOComponentFamilyDefinition(org.talend.components.localio.LocalIOComponentFamilyDefinition) SimpleFileIODatastoreDefinition(org.talend.components.simplefileio.SimpleFileIODatastoreDefinition) ComponentService(org.talend.components.api.service.ComponentService) DefinitionRegistry(org.talend.components.api.service.common.DefinitionRegistry) Test(org.junit.Test)

Example 2 with ComponentFamilyDefinition

use of org.talend.components.api.ComponentFamilyDefinition in project components by Talend.

the class DefintitionRegistryTest method testLock.

@Test
public void testLock() {
    DefinitionRegistry registry = new DefinitionRegistry();
    ComponentFamilyDefinition def = new TestComponentFamilyDefinition();
    registry.registerComponentFamilyDefinition(def);
    registry.lock();
    try {
        registry.registerComponentFamilyDefinition(def);
        fail("registry should be locked hence not def should be added");
    } catch (UnsupportedOperationException e) {
    // all is good if we are here
    }
}
Also used : ComponentFamilyDefinition(org.talend.components.api.ComponentFamilyDefinition) TestComponentFamilyDefinition(org.talend.components.api.service.common.testcomponent.TestComponentFamilyDefinition) TestComponentFamilyDefinition(org.talend.components.api.service.common.testcomponent.TestComponentFamilyDefinition) Test(org.junit.Test)

Example 3 with ComponentFamilyDefinition

use of org.talend.components.api.ComponentFamilyDefinition in project components by Talend.

the class DefintitionRegistryTest method testAddComponentFamilyDefinition.

@SuppressWarnings("rawtypes")
@Test
public void testAddComponentFamilyDefinition() {
    DefinitionRegistry registry = new DefinitionRegistry();
    ComponentFamilyDefinition def = new TestComponentFamilyDefinition();
    registry.registerComponentFamilyDefinition(def);
    assertThat(registry.getComponentFamilies().keySet(), hasSize(1));
    assertThat(registry.getComponentFamilies(), hasEntry(def.getName(), def));
    // All of the nested definitions were added.
    Iterator<? extends Definition> iterator = def.getDefinitions().iterator();
    assertThat(registry.getDefinitionsMapByType(ComponentDefinition.class).values(), contains((Definition) iterator.next()));
    assertThat(registry.getDefinitionsMapByType(ComponentWizardDefinition.class).values(), contains((ComponentWizardDefinition) iterator.next()));
}
Also used : ComponentFamilyDefinition(org.talend.components.api.ComponentFamilyDefinition) TestComponentFamilyDefinition(org.talend.components.api.service.common.testcomponent.TestComponentFamilyDefinition) 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) TestComponentWizardDefinition(org.talend.components.api.service.common.testcomponent.TestComponentWizardDefinition) ComponentWizardDefinition(org.talend.components.api.wizard.ComponentWizardDefinition) TestComponentFamilyDefinition(org.talend.components.api.service.common.testcomponent.TestComponentFamilyDefinition) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 ComponentFamilyDefinition (org.talend.components.api.ComponentFamilyDefinition)3 TestComponentFamilyDefinition (org.talend.components.api.service.common.testcomponent.TestComponentFamilyDefinition)2 Definition (org.talend.daikon.definition.Definition)2 ComponentDefinition (org.talend.components.api.component.ComponentDefinition)1 ComponentService (org.talend.components.api.service.ComponentService)1 DefinitionRegistry (org.talend.components.api.service.common.DefinitionRegistry)1 TestComponentDefinition (org.talend.components.api.service.common.testcomponent.TestComponentDefinition)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 SimpleComponentDefinition (org.talend.components.api.test.SimpleComponentDefinition)1 ComponentWizardDefinition (org.talend.components.api.wizard.ComponentWizardDefinition)1 LocalIOComponentFamilyDefinition (org.talend.components.localio.LocalIOComponentFamilyDefinition)1 FixedFlowInputDefinition (org.talend.components.localio.fixedflowinput.FixedFlowInputDefinition)1 SimpleFileIOComponentFamilyDefinition (org.talend.components.simplefileio.SimpleFileIOComponentFamilyDefinition)1 SimpleFileIODatasetDefinition (org.talend.components.simplefileio.SimpleFileIODatasetDefinition)1 SimpleFileIODatastoreDefinition (org.talend.components.simplefileio.SimpleFileIODatastoreDefinition)1 SimpleFileIOInputDefinition (org.talend.components.simplefileio.input.SimpleFileIOInputDefinition)1 SimpleFileIOOutputDefinition (org.talend.components.simplefileio.output.SimpleFileIOOutputDefinition)1