Package org.apache.webbeans.newtests.concepts.alternatives.common

Examples of org.apache.webbeans.newtests.concepts.alternatives.common.SimpleInjectionTarget


        startContainer(beanClasses, beanXmls);

        Bean<?> simpleInjectionTargetBean = getBeanManager().getBeans(SimpleInjectionTarget.class).iterator().next();
        CreationalContext<?> context = getBeanManager().createCreationalContext(simpleInjectionTargetBean);
        SimpleInjectionTarget target = (SimpleInjectionTarget) getBeanManager().getReference(simpleInjectionTargetBean, SimpleInjectionTarget.class, context);
       
        Assert.assertFalse(target.isSimpleInterfaceAmbiguous());
        Iterator<SimpleInterface> simpleInterfaceInstances = target.getSimpleInterfaceInstances();
        Assert.assertTrue(simpleInterfaceInstances.hasNext());
        Assert.assertEquals(SimpleBean.class, simpleInterfaceInstances.next().getImplementationType());
        Assert.assertFalse(simpleInterfaceInstances.hasNext());
        Assert.assertEquals(SimpleBean.class, target.getSimpleInterface1().getImplementationType());
        Assert.assertEquals(SimpleBean.class, target.getSimpleInterface2().getImplementationType());
       
        shutDownContainer();
    }
View Full Code Here


        startContainer(beanClasses, beanXmls);

        Bean<?> simpleInjectionTargetBean = getBeanManager().getBeans(SimpleInjectionTarget.class).iterator().next();
        CreationalContext<?> context = getBeanManager().createCreationalContext(simpleInjectionTargetBean);
        SimpleInjectionTarget target = (SimpleInjectionTarget) getBeanManager().getReference(simpleInjectionTargetBean, SimpleInjectionTarget.class, context);
       
        Assert.assertFalse(target.isSimpleInterfaceAmbiguous());
        Iterator<SimpleInterface> simpleInterfaceInstances = target.getSimpleInterfaceInstances();
        Assert.assertTrue(simpleInterfaceInstances.hasNext());
        Assert.assertEquals(AlternativeBean.class, simpleInterfaceInstances.next().getImplementationType());
        Assert.assertFalse(simpleInterfaceInstances.hasNext());
        Assert.assertEquals(AlternativeBean.class, target.getSimpleInterface1().getImplementationType());
        Assert.assertEquals(AlternativeBean.class, target.getSimpleInterface2().getImplementationType());
       
        shutDownContainer();
    }
View Full Code Here

TOP

Related Classes of org.apache.webbeans.newtests.concepts.alternatives.common.SimpleInjectionTarget

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.