Package org.jboss.cdi.tck.literals

Examples of org.jboss.cdi.tck.literals.DefaultLiteral


    @SpecAssertions({ @SpecAssertion(section = PRODUCER_METHOD, id = "c"), @SpecAssertion(section = DECLARING_PRODUCER_METHOD, id = "a"),
            @SpecAssertion(section = BUILTIN_QUALIFIERS, id = "a0"), @SpecAssertion(section = BUILTIN_QUALIFIERS, id = "aa") })
    public void testDefaultBindingType() throws Exception {
        assert getCurrentManager().getBeans(Tarantula.class).size() == 1;
        assert getCurrentManager().getBeans(Tarantula.class).iterator().next().getQualifiers().size() == 2;
        assert getCurrentManager().getBeans(Tarantula.class).iterator().next().getQualifiers().contains(new DefaultLiteral());
        assert getCurrentManager().getBeans(Tarantula.class).iterator().next().getQualifiers().contains(AnyLiteral.INSTANCE);
    }
View Full Code Here


    @Test
    @SpecAssertions({ @SpecAssertion(section = BM_OBTAIN_BEAN_BY_TYPE, id = "c") })
    public void testNoBindingImpliesCurrent() {
        Set<Bean<?>> beans = getCurrentManager().getBeans(SimpleBean.class);
        assertEquals(beans.size(), 1);
        assertTrue(beans.iterator().next().getQualifiers().contains(new DefaultLiteral()));
    }
View Full Code Here

    @Test
    @SpecAssertion(section = DYNAMIC_LOOKUP, id = "da")
    public void testDuplicateBindingsThrowsException() {
        try {
            ObtainsInstanceBean injectionPoint = getInstanceByType(ObtainsInstanceBean.class);
            injectionPoint.getAnyPaymentProcessor().select(new DefaultLiteral(), new DefaultLiteral());
        } catch (Throwable t) {
            assert isThrowablePresent(IllegalArgumentException.class, t);
            return;
        }
        assert false;
View Full Code Here

        assert getBeans(LoggerConsumer.class).size() == 1;
        Bean<LoggerConsumer> bean = getBeans(LoggerConsumer.class).iterator().next();
        InjectionPoint loggerInjectionPoint = null;
        for (InjectionPoint ip : bean.getInjectionPoints()) {
            if (ip.getAnnotated().getTypeClosure().contains(Logger.class) && ip.getQualifiers().size() == 1
                    && ip.getQualifiers().contains(new DefaultLiteral())) {
                loggerInjectionPoint = ip;
            }
        }

        // Now lookup an injectable reference and check that it is of type Logger
View Full Code Here

    @Test
    @SpecAssertion(section = BEANMANAGER, id = "ac")
    public void testManagerBeanHasCurrentBinding() {
        Bean<BeanManager> beanManager = getBeans(BeanManager.class).iterator().next();
        assert beanManager.getQualifiers().contains(new DefaultLiteral());
    }
View Full Code Here

        Bean<?> simpleExtensionBean = beans.iterator().next();
        // Bean scope is @ApplicationScoped
        assertEquals(simpleExtensionBean.getScope(), ApplicationScoped.class);
        // Bean has two qualifiers @Default and @Any
        assertEquals(simpleExtensionBean.getQualifiers().size(), 2);
        assertTrue(simpleExtensionBean.getQualifiers().contains(new DefaultLiteral()));
        assertTrue(simpleExtensionBean.getQualifiers().contains(AnyLiteral.INSTANCE));
        // Bean types include the class of the service provider and all superclases and interfaces
        Set<Type> types = simpleExtensionBean.getTypes();
        assertEquals(types.size(), 4);
        assertTrue(types.contains(SuperExtension.class));
View Full Code Here

    @SpecAssertions({ @SpecAssertion(section = PRODUCER_METHOD, id = "c"), @SpecAssertion(section = DECLARING_PRODUCER_METHOD, id = "a"),
            @SpecAssertion(section = BUILTIN_QUALIFIERS, id = "a0"), @SpecAssertion(section = BUILTIN_QUALIFIERS, id = "aa") })
    public void testDefaultBindingType() throws Exception {
        assert getCurrentManager().getBeans(Tarantula.class).size() == 1;
        assert getCurrentManager().getBeans(Tarantula.class).iterator().next().getQualifiers().size() == 2;
        assert getCurrentManager().getBeans(Tarantula.class).iterator().next().getQualifiers().contains(new DefaultLiteral());
        assert getCurrentManager().getBeans(Tarantula.class).iterator().next().getQualifiers().contains(AnyLiteral.INSTANCE);
    }
View Full Code Here

        Bean<OrderLocal> orderBean = getBeans(OrderLocal.class).iterator().next();
        Set<Bean<OrderLocal>> newOrderBeans = getBeans(OrderLocal.class, new NewLiteral(Order.class));
        assert newOrderBeans.size() == 1;
        Bean<OrderLocal> newOrderBean = newOrderBeans.iterator().next();
        assert orderBean.getQualifiers().size() == 2;
        assert orderBean.getQualifiers().contains(new DefaultLiteral());
        assert orderBean.getQualifiers().contains(AnyLiteral.INSTANCE);
        assert orderBean.getTypes().equals(newOrderBean.getTypes());
        assert orderBean.getBeanClass().equals(newOrderBean.getBeanClass());
        assert newOrderBean.getQualifiers().size() == 1;
        assert newOrderBean.getQualifiers().iterator().next().annotationType().equals(New.class);
View Full Code Here

    @Test
    @SpecAssertions({ @SpecAssertion(section = BUILTIN_QUALIFIERS, id = "aa") })
    public void testDefaultBindingType() {
        Set<Bean<Tarantula>> tarantulaBeans = getBeans(Tarantula.class);
        assert tarantulaBeans.size() == 2;
        assert tarantulaBeans.iterator().next().getQualifiers().contains(new DefaultLiteral());
    }
View Full Code Here

        assert Method.class.isAssignableFrom(beanWithInjectionPoint.getInjectedMetadata().getMember().getClass());

        // Since the type and bindings must correspond to the parameter, check
        // them
        assert beanWithInjectionPoint.getInjectedMetadata().getType().equals(BeanWithInjectionPointMetadata.class);
        assert beanWithInjectionPoint.getInjectedMetadata().getQualifiers().contains(new DefaultLiteral());
    }
View Full Code Here

TOP

Related Classes of org.jboss.cdi.tck.literals.DefaultLiteral

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.