Search in sources :

Example 1 with DefinitionRegistry

use of org.talend.components.api.service.common.DefinitionRegistry in project components by Talend.

the class MarkLogicInputTestBase method getDefinitionRegistry.

@Override
public DefinitionRegistryService getDefinitionRegistry() {
    if (definitionRegistry == null) {
        definitionRegistry = new DefinitionRegistry();
        definitionRegistry.registerComponentFamilyDefinition(new MarkLogicFamilyDefinition());
    }
    return definitionRegistry;
}
Also used : DefinitionRegistry(org.talend.components.api.service.common.DefinitionRegistry)

Example 2 with DefinitionRegistry

use of org.talend.components.api.service.common.DefinitionRegistry 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 3 with DefinitionRegistry

use of org.talend.components.api.service.common.DefinitionRegistry in project components by Talend.

the class ServiceSpiFactoryTest method testCreateClassLoaderService.

@Test
public void testCreateClassLoaderService() throws MalformedURLException {
    // this will check that create a new registry with the new url
    // given
    DefinitionRegistry definitionRegistry = ServiceSpiFactory.getDefinitionRegistry();
    assertThat(definitionRegistry.getComponentFamilies(), not(hasKey(is("MultiRuntimeExample"))));
    // when
    DefinitionRegistry definitionRegistry2 = ServiceSpiFactory.createDefinitionRegistry(new URL[] { new URL("mvn:org.talend.components/multiple-runtime-comp/0.18.0") });
    // then
    assertThat(definitionRegistry2.getComponentFamilies(), hasKey(is("MultiRuntimeExample")));
    assertThat(definitionRegistry, not(equalTo(definitionRegistry2)));
    // this will check that same registry is returned if no classpath is passed
    assertThat(definitionRegistry2, equalTo(ServiceSpiFactory.createDefinitionRegistry(null)));
    assertThat(definitionRegistry2, equalTo(ServiceSpiFactory.createDefinitionRegistry(new URL[0])));
}
Also used : DefinitionRegistry(org.talend.components.api.service.common.DefinitionRegistry) URL(java.net.URL) Test(org.junit.Test)

Example 4 with DefinitionRegistry

use of org.talend.components.api.service.common.DefinitionRegistry in project components by Talend.

the class AzureStorageBaseTestIT method getComponentService.

// default implementation for pure java test. Shall be overriden of Spring or OSGI tests
public ComponentService getComponentService() {
    if (componentService == null) {
        DefinitionRegistry testComponentRegistry = new DefinitionRegistry();
        // register component
        testComponentRegistry.registerComponentFamilyDefinition(new AzureStorageFamilyDefinition());
        componentService = new ComponentServiceImpl(testComponentRegistry);
    }
    return componentService;
}
Also used : ComponentServiceImpl(org.talend.components.api.service.common.ComponentServiceImpl) DefinitionRegistry(org.talend.components.api.service.common.DefinitionRegistry)

Example 5 with DefinitionRegistry

use of org.talend.components.api.service.common.DefinitionRegistry in project components by Talend.

the class SalesforceTestBase method getComponentService.

// default implementation for pure java test. Shall be overriden of Spring or OSGI tests
@Override
public ComponentService getComponentService() {
    if (componentService == null) {
        DefinitionRegistry testComponentRegistry = new DefinitionRegistry();
        // register component
        testComponentRegistry.registerComponentFamilyDefinition(new SalesforceFamilyDefinition());
        componentService = new ComponentServiceImpl(testComponentRegistry);
    }
    return componentService;
}
Also used : SalesforceFamilyDefinition(org.talend.components.salesforce.SalesforceFamilyDefinition) ComponentServiceImpl(org.talend.components.api.service.common.ComponentServiceImpl) DefinitionRegistry(org.talend.components.api.service.common.DefinitionRegistry)

Aggregations

DefinitionRegistry (org.talend.components.api.service.common.DefinitionRegistry)27 ComponentServiceImpl (org.talend.components.api.service.common.ComponentServiceImpl)12 Test (org.junit.Test)5 URL (java.net.URL)3 ComponentInstaller (org.talend.components.api.ComponentInstaller)3 SalesforceFamilyDefinition (org.talend.components.salesforce.SalesforceFamilyDefinition)3 BeforeClass (org.junit.BeforeClass)2 TJiraInputDefinition (org.talend.components.jira.tjirainput.TJiraInputDefinition)2 SnowflakeFamilyDefinition (org.talend.components.snowflake.SnowflakeFamilyDefinition)2 ComponentFamilyDefinition (org.talend.components.api.ComponentFamilyDefinition)1 ComponentService (org.talend.components.api.service.ComponentService)1 SimpleComponentDefinition (org.talend.components.api.test.SimpleComponentDefinition)1 AbstractTestFormatProperties (org.talend.components.common.format.instances.AbstractTestFormatProperties)1 TestFormatDefinition1Impl (org.talend.components.common.format.instances.TestFormatDefinition1Impl)1 TestFormatDefinition2Impl (org.talend.components.common.format.instances.TestFormatDefinition2Impl)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