Examples of CdiTestContainer


Examples of org.apache.myfaces.extensions.cdi.test.spi.CdiTestContainer

                    {
                        return CdiTestContainer.class;
                    }
                });

        CdiTestContainer standaloneTestContainer = null;
        for(CdiTestContainer testContainer : testContainers)
        {
            if(createServletContext && isServletContextAwareContainer(testContainer))
            {
                return testContainer;
View Full Code Here

Examples of org.apache.myfaces.extensions.cdi.test.spi.CdiTestContainer

                    {
                        return CdiTestContainer.class;
                    }
                });

        CdiTestContainer standaloneTestContainer = null;
        for(CdiTestContainer testContainer : testContainers)
        {
            if(createServletContext && isServletContextAwareContainer(testContainer))
            {
                return testContainer;
View Full Code Here

Examples of org.apache.webbeans.cditest.CdiTestContainer

    private static final int DEFAULT_VAL = 42;

    @Test
    public void testInstanceRetrieval() throws Exception
    {
        CdiTestContainer cdi = CdiTestContainerLoader.getCdiContainer();
        cdi.bootContainer();
        cdi.startContexts();

        assertAll(cdi, 0);

        cdi.stopContexts();
        cdi.startContexts();

        assertAll(cdi, 0);

        cdi.stopRequestScope();
        cdi.stopSessionScope();
        cdi.stopApplicationScope();
        cdi.startRequestScope();
        cdi.startSessionScope();
        cdi.startApplicationScope();

        assertAll(cdi, 0);

        cdi.stopRequestScope();
        cdi.startRequestScope();

        assertReq(cdi, 0);
        assertSess(cdi, DEFAULT_VAL);
        assertApp(cdi, DEFAULT_VAL);

        cdi.shutdownContainer();
    }
View Full Code Here

Examples of org.apache.webbeans.cditest.CdiTestContainer

public class BeanManagerProviderTest
{
    @Test
    public void testBeanManagerProvider() throws Exception {
        CdiTestContainer cdiContainer = CdiTestContainerLoader.getCdiContainer();
        Assert.assertNotNull(cdiContainer);
        cdiContainer.bootContainer();
        try
        {
            BeanManagerProvider bmp = BeanManagerProvider.getInstance();
            Assert.assertNotNull(bmp);

            BeanManager bm = bmp.getBeanManager();
            Assert.assertNotNull(bm);

            TestBean tb1 = bmp.getContextualReference(TestBean.class);
            Assert.assertNotNull(tb1);

            TestBean tb2 = bmp.getContextualReference(TestBean.class, "extraNameBean");
            Assert.assertNotNull(tb2);
        }
        finally
        {
            cdiContainer.shutdownContainer();
        }
    }
View Full Code Here

Examples of org.apache.webbeans.cditest.CdiTestContainer

import static org.junit.Assert.assertNotNull;

public abstract class SironaExtensionTestBase {
    @Test
    public void checkMeasures() throws Exception {
        final CdiTestContainer container = CdiTestContainerLoader.getCdiContainer();
        container.bootContainer();
        container.startApplicationScope();

        final BeanManager beanManager = container.getBeanManager();
        final Class<?> type = type();
        final TwoSeconds bean = TwoSeconds.class.cast(beanManager.getReference(beanManager.resolve(beanManager.getBeans(type)), type, null));

        bean.twoSeconds();

        container.stopApplicationScope();
        container.shutdownContainer();

        final Counter perf = Repository.INSTANCE.getCounter(new Counter.Key(Role.PERFORMANCES, type.getName() + ".twoSeconds"));
        assertNotNull(perf);
        assertEquals(2000, TimeUnit.NANOSECONDS.toMillis((int) perf.getMax()), 200);
    }
View Full Code Here

Examples of org.apache.webbeans.cditest.CdiTestContainer

public class TestOwbTestContainer extends TestCase {

    @Test
    public void testInstanceRetrieval() throws Exception
    {
        CdiTestContainer cdi = CdiTestContainerLoader.getCdiContainer();
        cdi.bootContainer();

        SessionScopedTestBean testReference = cdi.getInstance(SessionScopedTestBean.class);
        Assert.assertNotNull(testReference);

        cdi.shutdownContainer();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.