Search in sources :

Example 1 with DefinitionRegistryService

use of org.talend.daikon.definition.service.DefinitionRegistryService in project components by Talend.

the class OsgiComponentServiceTest method testRegistryServiceDynamicLoadOfComponent.

@Test
public void testRegistryServiceDynamicLoadOfComponent() throws BundleException, MalformedURLException, URISyntaxException {
    // inside eclipse the bundle context can be retrieved from the Activator.start method or using the FrameworkUtil
    // class.
    BundleContext bundleContext = FrameworkUtil.getBundle(getClass()).getBundleContext();
    ServiceReference<DefinitionRegistryService> compServiceRef = bundleContext.getServiceReference(DefinitionRegistryService.class);
    if (compServiceRef != null) {
        DefinitionRegistryService defService = bundleContext.getService(compServiceRef);
        assertNotNull(defService);
        assertEquals(0, defService.getDefinitionsMapByType(Definition.class).size());
        installNewComponentBundle(bundleContext);
        assertEquals(1, defService.getDefinitionsMapByType(Definition.class).size());
    } else {
        fail("Failed to retrieve the Component service");
    }
}
Also used : DefinitionRegistryService(org.talend.daikon.definition.service.DefinitionRegistryService) BundleContext(org.osgi.framework.BundleContext) Test(org.junit.Test)

Example 2 with DefinitionRegistryService

use of org.talend.daikon.definition.service.DefinitionRegistryService in project components by Talend.

the class DefintitionRegistryTest method testCreateNewPropertiesWithNestedInjected.

@Test
public void testCreateNewPropertiesWithNestedInjected() {
    DefinitionRegistryService registry = new DefinitionRegistry();
    TestNestedInjectComponentDefinition def = new TestNestedInjectComponentDefinition();
    TestNestedInjectComponentProperties testProps = (TestNestedInjectComponentProperties) registry.createProperties(def, "testProps");
    assertThat(testProps.getNestedProperties().getDefinitionRegistry(), equalTo(registry));
}
Also used : TestNestedInjectComponentProperties(org.talend.components.api.service.common.testcomponent.inject.TestNestedInjectComponentProperties) TestNestedInjectComponentDefinition(org.talend.components.api.service.common.testcomponent.inject.TestNestedInjectComponentDefinition) DefinitionRegistryService(org.talend.daikon.definition.service.DefinitionRegistryService) Test(org.junit.Test)

Example 3 with DefinitionRegistryService

use of org.talend.daikon.definition.service.DefinitionRegistryService in project components by Talend.

the class DefintitionRegistryTest method testCreateNewPropertiesWithInjected.

@Test
public void testCreateNewPropertiesWithInjected() {
    DefinitionRegistryService registry = new DefinitionRegistry();
    TestInjectComponentDefinition def = new TestInjectComponentDefinition();
    TestInjectComponentProperties testProps = (TestInjectComponentProperties) registry.createProperties(def, "testProps");
    assertThat(testProps.getDefinitionRegistry(), equalTo(registry));
}
Also used : TestInjectComponentDefinition(org.talend.components.api.service.common.testcomponent.inject.TestInjectComponentDefinition) DefinitionRegistryService(org.talend.daikon.definition.service.DefinitionRegistryService) TestInjectComponentProperties(org.talend.components.api.service.common.testcomponent.inject.TestInjectComponentProperties) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 DefinitionRegistryService (org.talend.daikon.definition.service.DefinitionRegistryService)3 BundleContext (org.osgi.framework.BundleContext)1 TestInjectComponentDefinition (org.talend.components.api.service.common.testcomponent.inject.TestInjectComponentDefinition)1 TestInjectComponentProperties (org.talend.components.api.service.common.testcomponent.inject.TestInjectComponentProperties)1 TestNestedInjectComponentDefinition (org.talend.components.api.service.common.testcomponent.inject.TestNestedInjectComponentDefinition)1 TestNestedInjectComponentProperties (org.talend.components.api.service.common.testcomponent.inject.TestNestedInjectComponentProperties)1