Search in sources :

Example 1 with TestComponentFamilyDefinition

use of org.talend.components.api.service.common.testcomponent.TestComponentFamilyDefinition 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 2 with TestComponentFamilyDefinition

use of org.talend.components.api.service.common.testcomponent.TestComponentFamilyDefinition 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)2 ComponentFamilyDefinition (org.talend.components.api.ComponentFamilyDefinition)2 TestComponentFamilyDefinition (org.talend.components.api.service.common.testcomponent.TestComponentFamilyDefinition)2 ComponentDefinition (org.talend.components.api.component.ComponentDefinition)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 Definition (org.talend.daikon.definition.Definition)1