Examples of BlueprintContainer


Examples of org.osgi.service.blueprint.container.BlueprintContainer

            String filter = "(osgi.blueprint.container.symbolicname=" + targetBundleSymbolicName + ")";           
            String clazz = "org.osgi.service.blueprint.container.BlueprintContainer";           
            ServiceReference[] references = bundleContext.getServiceReferences(clazz, filter);
            if (references != null) {
                for (ServiceReference reference: references) {
                    BlueprintContainer container = (BlueprintContainer) bundleContext.getService(reference);
                    Set<String> ids = (Set<String>) container.getComponentIds();
                    for (Object id: ids) {
                        Object object = container.getComponentInstance((String)id);
                        if (object instanceof BrokerService) {
                            brokerServices.add((BrokerService)object);
                        }
                    }
                }
View Full Code Here

Examples of org.osgi.service.blueprint.container.BlueprintContainer

            BundleContext context = kernel.getBundleFor(kernel.getKernelName()).getBundleContext();
            String clazz = "org.osgi.service.blueprint.container.BlueprintContainer";
            String filter = "(osgi.blueprint.container.symbolicname=org.apache.geronimo.configs.activemq-broker-blueprint)";
            ServiceReference[] references = context.getServiceReferences(clazz, filter);
            for (ServiceReference reference: references) {
                BlueprintContainer container = (BlueprintContainer) context.getService(reference);
                @SuppressWarnings("unchecked")
                Set<String> ids = (Set<String>) container.getComponentIds();
                for (Object id: ids) {
                    Object object = container.getComponentInstance((String)id);
                    if (object instanceof BrokerService) {
                        BrokerService brokerService = (BrokerService) object;
                        String brokerName = brokerService.getBrokerName();
                        String brokerURI = brokerService.getMasterConnectorURI();
                        State state = brokerService.isStarted() ? State.RUNNING : State.STOPPED;
View Full Code Here

Examples of org.osgi.service.blueprint.container.BlueprintContainer

public class CamelBlueprint3Test extends OSGiBlueprintTestSupport {

    @Test
    public void testRouteWithComponentFromBlueprint() throws Exception {
        getInstalledBundle("CamelBlueprintTestBundle6").start();
        BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle6)", 10000);
        CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTestBundle6)", 10000);
        assertEquals(1, ctx.getRoutes().size());
        assertSame(ctn.getComponentInstance("seda"), ctx.getComponent("seda"));
    }
View Full Code Here

Examples of org.osgi.service.blueprint.container.BlueprintContainer

    }

    @Test
    public void testRouteWithInterceptStrategy() throws Exception {
        getInstalledBundle("CamelBlueprintTestBundle7").start();
        BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle7)", 10000);
        CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTestBundle7)", 10000);
        assertEquals(1, ctx.getRoutes().size());
        assertEquals(1, ctx.getInterceptStrategies().size());
        assertEquals(TestInterceptStrategy.class.getName(), ctx.getInterceptStrategies().get(0).getClass().getName());
    }
View Full Code Here

Examples of org.osgi.service.blueprint.container.BlueprintContainer

    }

    @Test
    public void testComponentProperties() throws Exception {
        getInstalledBundle("CamelBlueprintTestBundle8").start();
        BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle8)", 10000);
        CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTestBundle8)", 10000);
        assertEquals(1, ctx.getRoutes().size());
        assertEquals("direct://start", ctx.getRoutes().get(0).getEndpoint().getEndpointUri());
    }
View Full Code Here

Examples of org.osgi.service.blueprint.container.BlueprintContainer

    }

    @Test
    public void testRouteBuilderRef() throws Exception {
        getInstalledBundle("CamelBlueprintTestBundle9").start();
        BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle9)", 10000);
        CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTestBundle9)", 10000);
        assertEquals(1, ctx.getRoutes().size());
    }
View Full Code Here

Examples of org.osgi.service.blueprint.container.BlueprintContainer

public class CamelBlueprint2Test extends OSGiBlueprintTestSupport {

    @Test
    public void testEndpointInjection() throws Exception {
        getInstalledBundle("CamelBlueprintTestBundle10").start();
        BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle10)", 10000);
        CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTestBundle10)", 10000);
        Object producer = ctn.getComponentInstance("producer");
        assertNotNull(producer);
        assertEquals(TestProducer.class.getName(), producer.getClass().getName());
        Method mth = producer.getClass().getMethod("getTestEndpoint");
        assertNotNull(mth.invoke(producer));
    }
View Full Code Here

Examples of org.osgi.service.blueprint.container.BlueprintContainer

    }

    @Test
    public void testRouteContext() throws Exception {
        getInstalledBundle("CamelBlueprintTestBundle11").start();
        BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle11)", 10000);
        CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTestBundle11)", 10000);
        assertEquals(3, ctx.getRoutes().size());
    }
View Full Code Here

Examples of org.osgi.service.blueprint.container.BlueprintContainer

    @Test
    @Ignore("TODO: Does not work")
    public void testProxy() throws Exception {
        getInstalledBundle("CamelBlueprintTestBundle12").start();
        BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle12)", 10000);
        CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTestBundle12)", 10000);
        Object proxy = ctn.getComponentInstance("myProxySender");
        assertNotNull(proxy);
        assertEquals(1, proxy.getClass().getInterfaces().length);
        assertEquals(TestProxySender.class.getName(), proxy.getClass().getInterfaces()[0].getName());
    }
View Full Code Here

Examples of org.osgi.service.blueprint.container.BlueprintContainer

    }

    @Test
    public void testErrorHandler() throws Exception {
        getInstalledBundle("CamelBlueprintTestBundle14").start();
        BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle14)", 10000);
        CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTestBundle14)", 10000);
        assertEquals(1, ctx.getRoutes().size());
        RouteDefinition rd = ctx.getRouteDefinitions().get(0);
        assertNotNull(rd.getErrorHandlerRef());
        Object eh = ctx.getRegistry().lookup(rd.getErrorHandlerRef());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.