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