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
}
}
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()));
}
Aggregations