当前位置: 首页>>代码示例>>Java>>正文


Java CdiContainerLoader.getCdiContainer方法代码示例

本文整理汇总了Java中org.apache.deltaspike.cdise.api.CdiContainerLoader.getCdiContainer方法的典型用法代码示例。如果您正苦于以下问题:Java CdiContainerLoader.getCdiContainer方法的具体用法?Java CdiContainerLoader.getCdiContainer怎么用?Java CdiContainerLoader.getCdiContainer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.deltaspike.cdise.api.CdiContainerLoader的用法示例。


在下文中一共展示了CdiContainerLoader.getCdiContainer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: applyBeforeFeatureConfig

import org.apache.deltaspike.cdise.api.CdiContainerLoader; //导入方法依赖的package包/类
void applyBeforeFeatureConfig(Class testClass) {
    CdiContainer container = CdiContainerLoader.getCdiContainer();

    if (!isContainerStarted()) {
        container.boot(CdiTestSuiteRunner.getTestContainerConfig());
        containerStarted = true;
        bootExternalContainers(testClass);
    }

    List<Class<? extends Annotation>> restrictedScopes = new ArrayList<Class<? extends Annotation>>();

    //controlled by the container and not supported by weld:
    restrictedScopes.add(ApplicationScoped.class);
    restrictedScopes.add(Singleton.class);

    if (this.parent == null && this.testControl.getClass().equals(TestControlLiteral.class)) {
        //skip scope-handling if @TestControl isn't used explicitly on the test-class -> TODO re-visit it
        restrictedScopes.add(RequestScoped.class);
        restrictedScopes.add(SessionScoped.class);
    }

    this.previousProjectStage = ProjectStageProducer.getInstance().getProjectStage();
    ProjectStageProducer.setProjectStage(this.projectStage);

    startScopes(container, testClass, null, restrictedScopes.toArray(new Class[restrictedScopes.size()]));
}
 
开发者ID:database-rider,项目名称:database-rider,代码行数:27,代码来源:CdiCucumberTestRunner.java

示例2: applyAfterFeatureConfig

import org.apache.deltaspike.cdise.api.CdiContainerLoader; //导入方法依赖的package包/类
void applyAfterFeatureConfig() {
    ProjectStageProducer.setProjectStage(previousProjectStage);
    previousProjectStage = null;

    CdiContainer container = CdiContainerLoader.getCdiContainer();

    stopStartedScopes(container);

    if (this.containerStarted) {
        if (isStopContainerAllowed()) {
            shutdownExternalContainers();

            container.shutdown(); //stop the container on the same level which started it
            containerStarted = false;
        }
    }
}
 
开发者ID:database-rider,项目名称:database-rider,代码行数:18,代码来源:CdiCucumberTestRunner.java

示例3: main

import org.apache.deltaspike.cdise.api.CdiContainerLoader; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
	final CdiContainer container = CdiContainerLoader.getCdiContainer();
	try {
		container.boot();

        ContextControl contextControl = container.getContextControl();
        contextControl.startContext(ApplicationScoped.class);

		Quickstart quickstart = CDI.current().select(Quickstart.class).get();
		quickstart.run();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		container.shutdown();
		System.out.println("Shutting down...");
		System.exit(0);
	}
}
 
开发者ID:kamaladafrica,项目名称:axon-cdi-quickstart,代码行数:19,代码来源:Main.java

示例4: shouldWork

import org.apache.deltaspike.cdise.api.CdiContainerLoader; //导入方法依赖的package包/类
@Test
public void shouldWork() {
    // this will give you a CdiContainer for Weld or OWB, depending on the jar you added
    CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();

// now we gonna boot the CDI container. This will trigger the classpath scan, etc
    cdiContainer.boot();

    // and finally we like to start all built-in contexts
    cdiContainer.getContextControl().startContexts();

    // No specific JBoss Weld or Open Web Beans included in the test code

    // finally we gonna stop the container
    cdiContainer.shutdown();
}
 
开发者ID:peterpilgrim,项目名称:javaee7-developer-handbook,代码行数:17,代码来源:ExampleCdiContainerTest.java

示例5: applyAfterClassConfig

import org.apache.deltaspike.cdise.api.CdiContainerLoader; //导入方法依赖的package包/类
void applyAfterClassConfig()
{
    CdiContainer container = CdiContainerLoader.getCdiContainer();

    stopStartedScopes(container);

    if (this.containerStarted)
    {
        if (CdiTestSuiteRunner.isStopContainerAllowed())
        {
            shutdownExternalContainers();

            container.shutdown(); //stop the container on the same level which started it
            CdiTestSuiteRunner.setContainerStarted(false);
        }
    }
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:18,代码来源:CdiTestRunner.java

示例6: main

import org.apache.deltaspike.cdise.api.CdiContainerLoader; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException
{
    CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
    cdiContainer.boot();

    ContextControl contextControl = cdiContainer.getContextControl();
    contextControl.startContext(ApplicationScoped.class);

    GlobalResultHolder globalResultHolder =
        BeanProvider.getContextualReference(GlobalResultHolder.class);

    while (globalResultHolder.getCount() < 100)
    {
        Thread.sleep(500);
        LOG.info("current count: " + globalResultHolder.getCount());
    }
    LOG.info("completed!");

    contextControl.stopContext(ApplicationScoped.class);
    cdiContainer.shutdown();
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:22,代码来源:SimpleSchedulerExample.java

示例7: main

import org.apache.deltaspike.cdise.api.CdiContainerLoader; //导入方法依赖的package包/类
public static void main(String[] args)
{
    CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
    cdiContainer.boot();

    ContextControl contextControl = cdiContainer.getContextControl();
    contextControl.startContext(ApplicationScoped.class);

    SettingsBean settingsBean = BeanProvider.getContextualReference(SettingsBean.class, false);

    LOG.info("configured int-value #1: " + settingsBean.getIntProperty1());
    LOG.info("configured long-value #2: " + settingsBean.getProperty2());
    LOG.info("configured inverse-value #2: " + settingsBean.getInverseProperty());
    LOG.info("configured location (custom config): " + settingsBean.getLocationId().name());
    
    cdiContainer.shutdown();
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:18,代码来源:ConfigExample.java

示例8: testBootRequest

import org.apache.deltaspike.cdise.api.CdiContainerLoader; //导入方法依赖的package包/类
@Test
public void testBootRequest() throws Exception
{
    CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
    cdiContainer.boot();
    cdiContainer.getContextControl().startContexts();
    int port = createServer();
    testRead(port);

    try
    {
        shutdown();
    }
    finally
    {
        cdiContainer.shutdown(); //also calls #stopContexts
    }
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:19,代码来源:EmbeddedServletContainer.java

示例9: testContainerBoot

import org.apache.deltaspike.cdise.api.CdiContainerLoader; //导入方法依赖的package包/类
@Test
public void testContainerBoot()
{
    CdiContainer cc = CdiContainerLoader.getCdiContainer();
    Assert.assertNotNull(cc);

    cc.boot();
    cc.getContextControl().startContexts();

    BeanManager bm = cc.getBeanManager();
    Assert.assertNotNull(bm);
    
    Set<Bean<?>> beans = bm.getBeans(CarRepair.class);
    Bean<?> bean = bm.resolve(beans);
    
    CarRepair carRepair = (CarRepair) bm.getReference(bean, CarRepair.class, bm.createCreationalContext(bean));
    Assert.assertNotNull(carRepair);

    Assert.assertNotNull(carRepair.getCar());
    Assert.assertNotNull(carRepair.getCar().getUser());

    cc.shutdown();
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:24,代码来源:ContainerCtrlTckTest.java

示例10: basicInjection

import org.apache.deltaspike.cdise.api.CdiContainerLoader; //导入方法依赖的package包/类
@Test
public void basicInjection() // useless because of tcks but nice to have when working on this specific container
{
    final CdiContainer container = CdiContainerLoader.getCdiContainer();
    container.boot();

    try
    {
        final BeanManager beanManager = container.getBeanManager();
        assertEquals("foo", Foo.class.cast(beanManager.getReference(beanManager.resolve(beanManager.getBeans(Foo.class)), Foo.class, null)).name());
    }
    finally
    {
        container.shutdown();
    }
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:17,代码来源:OpenEJbContainerControlConfigurationTest.java

示例11: doStart

import org.apache.deltaspike.cdise.api.CdiContainerLoader; //导入方法依赖的package包/类
protected void doStart() throws Exception {

        CdiContainer container = CdiContainerLoader.getCdiContainer();
        container.boot();
        container.getContextControl().startContexts();
        this.cdiContainer = container;
    }
 
开发者ID:drinkwater-io,项目名称:drinkwater-java,代码行数:8,代码来源:Main.java

示例12: run

import org.apache.deltaspike.cdise.api.CdiContainerLoader; //导入方法依赖的package包/类
@Override
public void run(RunNotifier runNotifier)
{
    CdiContainer container = CdiContainerLoader.getCdiContainer();

    if (!containerStarted)
    {
        container.boot(CdiTestSuiteRunner.getTestContainerConfig());
        containerStarted = true;
    }

    super.run(runNotifier);
}
 
开发者ID:database-rider,项目名称:database-rider,代码行数:14,代码来源:CdiCucumberTestRunner.java

示例13: start

import org.apache.deltaspike.cdise.api.CdiContainerLoader; //导入方法依赖的package包/类
public void start() {
    CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
    cdiContainer.boot();
    cdiContainer.getContextControl().startContexts();

    registerShutdownHook(cdiContainer);

    CDI.current().getBeanManager().fireEvent(new ApplicationStartupEvent());
}
 
开发者ID:johnament,项目名称:restful-and-beyond-tut2184,代码行数:10,代码来源:Startup.java

示例14: initCDI

import org.apache.deltaspike.cdise.api.CdiContainerLoader; //导入方法依赖的package包/类
@BeforeClass
public static void initCDI() {
    cdiContainer = CdiContainerLoader.getCdiContainer();
    cdiContainer.boot();
    contextControl = cdiContainer.getContextControl();
    contextControl.startContexts();
}
 
开发者ID:johnament,项目名称:restful-and-beyond-tut2184,代码行数:8,代码来源:CourseCrudTest.java

示例15: bootstrapCdiContainer

import org.apache.deltaspike.cdise.api.CdiContainerLoader; //导入方法依赖的package包/类
/**
 * Starts the CDI Container and initializes its contexts.
 */
private void bootstrapCdiContainer() {
    cdiContainer = CdiContainerLoader.getCdiContainer();
    cdiContainer.boot();
    cdiContainer.getContextControl().startContexts();

}
 
开发者ID:NovaTecConsulting,项目名称:BeanTest,代码行数:10,代码来源:BeanProviderHelper.java


注:本文中的org.apache.deltaspike.cdise.api.CdiContainerLoader.getCdiContainer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。