Package org.picocontainer.defaults

Examples of org.picocontainer.defaults.ConstructorInjectionComponentAdapterFactory


        assertTrue(newMan.wasKissed());

    }

    public void testBigamy() {
        DefaultPicoContainer pico = new DefaultPicoContainer(new HotSwappingComponentAdapterFactory(new ConstructorInjectionComponentAdapterFactory()));
        pico.registerComponentImplementation(Woman.class, Wife.class);
        Woman firstWife = (Woman) pico.getComponentInstance(Woman.class);
        Woman secondWife = (Woman) pico.getComponentInstance(Woman.class);
        assertNotSame(firstWife, secondWife);
View Full Code Here


        }
    }

    // TODO: Fails with versions of cglib >= 2.0.1
    public void testShouldBeAbleToHandleMutualDependenciesWithoutInterfaceImplSeparation() {
        MutablePicoContainer pico = new DefaultPicoContainer(new CachingComponentAdapterFactory(new HotSwappingComponentAdapterFactory(new ConstructorInjectionComponentAdapterFactory(),
                new CglibProxyFactory())));

        pico.registerComponentImplementation(Yin.class);
        pico.registerComponentImplementation(Yang.class);
View Full Code Here

            final Parameter[] parameters = new Parameter[size];
            parameters[0] = new ConstantParameter(iter.next());
            for (int i = 1; i < parameters.length; i++) {
                parameters[i] = new ConstantParameter(wrapperDependencies[i - 1]);
            }
            final MutablePicoContainer instantiatingPicoContainer = new DefaultPicoContainer(new ConstructorInjectionComponentAdapterFactory());
            instantiatingPicoContainer.registerComponentImplementation("decorator", decoratingComponentAdapterClass, parameters);
            mutablePicoContainer.registerComponent((ComponentAdapter) instantiatingPicoContainer.getComponentInstance("decorator"));
        }
        return mutablePicoContainer;
    }
View Full Code Here

    }

    public void testUsageOfADifferentComponentAdapterFactory() {
        // Jira bug 212
        MutablePicoContainer parent = new DefaultPicoContainer();
        ImplementationHidingPicoContainer pico = new ImplementationHidingPicoContainer(new ConstructorInjectionComponentAdapterFactory(), parent);
        pico.registerComponentImplementation(List.class, ArrayList.class);
        List list1 = (List) pico.getComponentInstanceOfType(List.class);
        List list2 = (List) pico.getComponentInstanceOfType(List.class);
        assertNotNull(list1);
        assertNotNull(list2);
View Full Code Here

    }

    public void testUsageOfADifferentComponentAdapterFactory() {
        // Jira bug 212 - logical opposite
        MutablePicoContainer parent = new DefaultPicoContainer();
        ImplementationHidingCachingPicoContainer pico = new ImplementationHidingCachingPicoContainer(new ConstructorInjectionComponentAdapterFactory(), parent);
        pico.registerComponentImplementation(List.class, ArrayList.class);
        List list1 = (List) pico.getComponentInstanceOfType(List.class);
        List list2 = (List) pico.getComponentInstanceOfType(List.class);
        assertNotNull(list1);
        assertNotNull(list2);
View Full Code Here

    protected MutablePicoContainer createImplementationHidingPicoContainer() {
        return createPicoContainer(null);
    }

    protected MutablePicoContainer createPicoContainer(PicoContainer parent) {
        return new DefaultPicoContainer(new CachingComponentAdapterFactory(new ImplementationHidingComponentAdapterFactory(new ConstructorInjectionComponentAdapterFactory(), false)), parent);
    }
View Full Code Here

    protected MutablePicoContainer createPicoContainer(PicoContainer parent) {
        return new DefaultPicoContainer(new CachingComponentAdapterFactory(new ImplementationHidingComponentAdapterFactory(new ConstructorInjectionComponentAdapterFactory(), false)), parent);
    }

    protected MutablePicoContainer createPicoContainer(PicoContainer parent, LifecycleManager lifecycleManager) {
        return new DefaultPicoContainer(new CachingComponentAdapterFactory(new ImplementationHidingComponentAdapterFactory(new ConstructorInjectionComponentAdapterFactory(), false)), parent, lifecycleManager);
    }
View Full Code Here

    }

    public void testUsageOfADifferentComponentAdapterFactory() {
        // Jira bug 212 - logical opposite
        MutablePicoContainer parent = new DefaultPicoContainer();
        CachingPicoContainer pico = new CachingPicoContainer(new ConstructorInjectionComponentAdapterFactory(), parent);
        pico.registerComponentImplementation(List.class, ArrayList.class);
        List list1 = (List) pico.getComponentInstanceOfType(List.class);
        List list2 = (List) pico.getComponentInstanceOfType(List.class);
        assertNotNull(list1);
        assertNotNull(list2);
View Full Code Here

public class HotSwappingComponentAdapterFactoryTestCase extends AbstractComponentAdapterFactoryTestCase {
    private HotSwappingComponentAdapterFactory implementationHidingComponentAdapterFactory = new HotSwappingComponentAdapterFactory(new DefaultComponentAdapterFactory());
    private CachingComponentAdapterFactory cachingComponentAdapterFactory = new CachingComponentAdapterFactory(implementationHidingComponentAdapterFactory);

    public void testComponentRegisteredWithInterfaceKeyOnlyImplementsThatInterfaceUsingStandardProxyfactory() {
        DefaultPicoContainer pico = new DefaultPicoContainer(new HotSwappingComponentAdapterFactory(new ConstructorInjectionComponentAdapterFactory()));
        pico.registerComponentImplementation(Collection.class, ArrayList.class);
        Object collection = pico.getComponentInstance(Collection.class);
        assertTrue(collection instanceof Collection);
        assertFalse(collection instanceof List);
        assertFalse(collection instanceof ArrayList);
View Full Code Here

    }

    private DefaultPicoContainer createContainer() {
        return new DefaultPicoContainer(
                new SynchronizedComponentAdapterFactory(
                        new ConstructorInjectionComponentAdapterFactory()));
    }
View Full Code Here

TOP

Related Classes of org.picocontainer.defaults.ConstructorInjectionComponentAdapterFactory

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.