Package org.picocontainer.defaults

Examples of org.picocontainer.defaults.ConstructorInjectionComponentAdapter


        }
    }
   
    public void testCreateWithDeps() throws Exception
    {
        ConstructorInjectionComponentAdapter ca = new ConstructorInjectionComponentAdapter(Service.class, DecoratedService.class);
        ComponentAdapter[] localCAs = new ComponentAdapter[] {new ConstructorInjectionComponentAdapter(DefaultService.class, DefaultService.class)};
       
        picoContainer_.registerComponent(new LocalParameterComponentAdapter(ca, localCAs));
       
        assertNotNull(picoContainer_.getComponentInstanceOfType(Service.class));
    }
View Full Code Here


        assertNotNull(picoContainer_.getComponentInstanceOfType(Service.class));
    }

    public void testLocalCAsAreNotAccessible() throws Exception
    {
        ConstructorInjectionComponentAdapter ca = new ConstructorInjectionComponentAdapter(Service.class, DecoratedService.class);
        ComponentAdapter[] localCAs = new ComponentAdapter[] {new ConstructorInjectionComponentAdapter(DefaultService.class, DefaultService.class)};
       
        picoContainer_.registerComponent(new LocalParameterComponentAdapter(ca, localCAs));
       
        assertNull(picoContainer_.getComponentInstanceOfType(DefaultService.class));
        assertNull(picoContainer_.getComponentAdapterOfType(DefaultService.class));
View Full Code Here

        assertNull(picoContainer_.getComponentAdapterOfType(DefaultService.class));
    }
   
    public void testInContainer() throws Exception
    {
        ConstructorInjectionComponentAdapter ca = new ConstructorInjectionComponentAdapter(Service.class, DecoratedService.class);
        ComponentAdapter[] localCAs = new ComponentAdapter[] {new ConstructorInjectionComponentAdapter(DefaultService.class, DefaultService.class)};
       
        picoContainer_.registerComponent(new LocalParameterComponentAdapter(ca, localCAs));
        picoContainer_.registerComponentImplementation(DependsOnService.class);
       
        assertNotNull(picoContainer_.getComponentInstance(DependsOnService.class));
View Full Code Here

            Class classType = loader.loadClass(type);
            if (key == null)
            {
               if (component.isMultiInstance())
               {
                  container.registerComponent(new ConstructorInjectionComponentAdapter(classType, classType));
                  System.out.println("===>>> Thread local component " + classType.getName() + " registered.");
               }
               else
               {
                  container.registerComponentImplementation(classType);
               }
            }
            else
            {
               try
               {
                  Class keyType = loader.loadClass(key);
                  if (component.isMultiInstance())
                  {
                     container.registerComponent(new ConstructorInjectionComponentAdapter(keyType, classType));
                     System.out.println("===>>> Thread local component " + classType.getName() + " registered.");
                  }
                  else
                  {
                     container.registerComponentImplementation(keyType, classType);
View Full Code Here

            Class classType = loader.loadClass(type);
            if (key == null)
            {
               if (component.isMultiInstance())
               {
                  container.registerComponent(new ConstructorInjectionComponentAdapter(classType, classType));
                  log.debug("===>>> Thread local component " + classType.getName() + " registered.");
               }
               else
               {
                  container.registerComponentImplementation(classType);
               }
            }
            else
            {
               try
               {
                  Class keyType = loader.loadClass(key);
                  if (component.isMultiInstance())
                  {
                     container.registerComponent(new ConstructorInjectionComponentAdapter(keyType, classType));
                     log.debug("===>>> Thread local component " + classType.getName() + " registered.");
                  }
                  else
                  {
                     container.registerComponentImplementation(keyType, classType);
View Full Code Here

    private DefaultPicoContainer picoContainer_;
   
    @Test
    public void testCreateWithoutDeps() throws Exception
    {
        ConstructorInjectionComponentAdapter ca = new ConstructorInjectionComponentAdapter(Service.class, DefaultService.class);
       
        picoContainer_.registerComponent(new LocalParameterComponentAdapter(ca, new ComponentAdapter[0]));
       
        assertNotNull(picoContainer_.getComponentInstanceOfType(Service.class));
    }
View Full Code Here

    }
   
    @Test
    public void testCreateFailsWhenDepsNotResolvable() throws Exception
    {
        ConstructorInjectionComponentAdapter ca = new ConstructorInjectionComponentAdapter(Service.class, DecoratedService.class);
       
        picoContainer_.registerComponent(new LocalParameterComponentAdapter(ca, new ComponentAdapter[0]));
       
        try
        {
View Full Code Here

    }
   
    @Test
    public void testCreateWithDeps() throws Exception
    {
        ConstructorInjectionComponentAdapter ca = new ConstructorInjectionComponentAdapter(Service.class, DecoratedService.class);
        ComponentAdapter[] localCAs = new ComponentAdapter[] {new ConstructorInjectionComponentAdapter(DefaultService.class, DefaultService.class)};
       
        picoContainer_.registerComponent(new LocalParameterComponentAdapter(ca, localCAs));
       
        assertNotNull(picoContainer_.getComponentInstanceOfType(Service.class));
    }
View Full Code Here

    }

    @Test
    public void testLocalCAsAreNotAccessible() throws Exception
    {
        ConstructorInjectionComponentAdapter ca = new ConstructorInjectionComponentAdapter(Service.class, DecoratedService.class);
        ComponentAdapter[] localCAs = new ComponentAdapter[] {new ConstructorInjectionComponentAdapter(DefaultService.class, DefaultService.class)};
       
        picoContainer_.registerComponent(new LocalParameterComponentAdapter(ca, localCAs));
       
        assertNull(picoContainer_.getComponentInstanceOfType(DefaultService.class));
        assertNull(picoContainer_.getComponentAdapterOfType(DefaultService.class));
View Full Code Here

    }
   
    @Test
    public void testInContainer() throws Exception
    {
        ConstructorInjectionComponentAdapter ca = new ConstructorInjectionComponentAdapter(Service.class, DecoratedService.class);
        ComponentAdapter[] localCAs = new ComponentAdapter[] {new ConstructorInjectionComponentAdapter(DefaultService.class, DefaultService.class)};
       
        picoContainer_.registerComponent(new LocalParameterComponentAdapter(ca, localCAs));
        picoContainer_.registerComponentImplementation(DependsOnService.class);
       
        assertNotNull(picoContainer_.getComponentInstance(DependsOnService.class));
View Full Code Here

TOP

Related Classes of org.picocontainer.defaults.ConstructorInjectionComponentAdapter

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.