Package org.osgi.service.blueprint.container

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


    }
   
    @Test
    public void testJsseUtilNamespace() throws Exception {
        getInstalledBundle("CamelBlueprintTestBundle18").start();
        BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle18)", 10000);
       
        SSLContextParameters scp = (SSLContextParameters) ctn.getComponentInstance("sslContextParameters");
       
        assertEquals("TLS", scp.getSecureSocketProtocol());
       
        assertNotNull(scp.getKeyManagers());
        assertEquals("changeit", scp.getKeyManagers().getKeyPassword());
View Full Code Here


    Activator a = new Activator();
    a.start(bc);
    a.serviceFound();
   
    // Register a BlueprintContainer mock that will answer getComponentInstance(String id) calls
    BlueprintContainer bpc = Skeleton.newMock(new BlueprintContainerStub(), BlueprintContainer.class);
    bc.registerService("org.osgi.service.blueprint.container.BlueprintContainer", bpc, new Hashtable<String, String>());
   
  }
View Full Code Here

   
    public BlueprintComponentNamingEnumeration (Bundle callersBundle, ComponentProcessor<T> p) throws ServiceUnavailableException
    {
      ServiceReference blueprintContainerRef = getBlueprintContainerRef(callersBundle);
      try {
        BlueprintContainer blueprintContainer = (BlueprintContainer) callersBundle.getBundleContext().getService(blueprintContainerRef);
        @SuppressWarnings("unchecked")
        Set<String> componentIds = blueprintContainer.getComponentIds();
        blueprintIdToComponentBindings = new Binding[componentIds.size()];
        Iterator<String> idIterator= componentIds.iterator();
        for (int i=0; i < blueprintIdToComponentBindings.length; i++) {
          String id = idIterator.next();
          Object o = blueprintContainer.getComponentInstance(id);
          blueprintIdToComponentBindings[i] = new Binding (id, o);
        }
        processor = p;
      } finally {
        callersBundle.getBundleContext().ungetService(blueprintContainerRef);
View Full Code Here

  public Object lookup(Name name) throws NamingException, ServiceUnavailableException
  {
    ServiceReference blueprintContainerRef = getBlueprintContainerRef(_callersBundle);
    Object result;
    try {
      BlueprintContainer blueprintContainer = (BlueprintContainer)
          _callersBundle.getBundleContext().getService(blueprintContainerRef);
      BlueprintName bpName;
      if (name instanceof BlueprintName) {
        bpName = (BlueprintName) name;
      } else if (_parentName != null) {
        bpName = new BlueprintName(_parentName.toString() + "/" + name.toString());
      } else {
        bpName = (BlueprintName) _parser.parse(name.toString());
      }

      if (bpName.hasComponent()) {
        String componentId = bpName.getComponentId();
        try {
          result = blueprintContainer.getComponentInstance(componentId);
        } catch (NoSuchComponentException nsce) {
          throw new NameNotFoundException(nsce.getMessage());
        }
      } else {
        result = new BlueprintURLContext(_callersBundle, bpName, _env);
View Full Code Here

    public CXFBlueprintServlet() {
    }

    @Override
    protected void loadBus(ServletConfig servletConfig) {
        BlueprintContainer container =
            (BlueprintContainer)servletConfig.getServletContext().getAttribute(CONTAINER_ATTRIBUTE);
       
        if (container != null) {
            Object busComponent = container.getComponentInstance("cxf");
            setBus((Bus)busComponent);
        } else {
            busCreated = true;
            setBus(BusFactory.newInstance().createBus());
        }
View Full Code Here

public class CamelBlueprint8Test extends OSGiBlueprintTestSupport {

    @Test
    public void testEndpointInjection() throws Exception {
        getInstalledBundle("CamelBlueprintTestBundle10").start();
        BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.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

    }

    @Test
    public void testJsseUtilNamespace() throws Exception {
        getInstalledBundle("CamelBlueprintTestBundle18").start();
        BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle18)", 10000);
       
        SSLContextParameters scp = (SSLContextParameters) ctn.getComponentInstance("sslContextParameters");
       
        assertEquals("TLS", scp.getSecureSocketProtocol());
       
        assertNotNull(scp.getKeyManagers());
        assertEquals("changeit", scp.getKeyManagers().getKeyPassword());
View Full Code Here

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

    @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);
        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

    }

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

TOP

Related Classes of org.osgi.service.blueprint.container.BlueprintContainer

Copyright © 2018 www.massapicom. 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.