Ejemplo n.º 1
0
  /** Manages unused conversations */
  public OpenEJBLifecycle(final WebBeansContext webBeansContext) {
    this.webBeansContext = webBeansContext;

    this.beanManager = webBeansContext.getBeanManagerImpl();
    this.deployer = new BeansDeployer(webBeansContext);
    this.jndiService = webBeansContext.getService(JNDIService.class);
    this.scannerService = webBeansContext.getScannerService();
    this.contextsService = webBeansContext.getContextsService();
  }
Ejemplo n.º 2
0
 @Test
 public void run() {
   WebBeansFinder.clearInstances(WebBeansUtil.getCurrentClassLoader());
   final OpenWebBeansTestLifeCycle testLifecycle = new OpenWebBeansTestLifeCycle();
   final WebBeansContext ctx = WebBeansContext.currentInstance();
   final OpenWebBeansTestMetaDataDiscoveryService discoveryService =
       OpenWebBeansTestMetaDataDiscoveryService.class.cast(ctx.getScannerService());
   discoveryService.deployClasses(asList(Service.class, ModelAdapter.class));
   testLifecycle.startApplication(null);
   try {
     Jsonb jsonb = JsonbBuilder.create();
     assertEquals("{\"model\":\"5\"}", jsonb.toJson(new Root(new Model(5))));
     try {
       AutoCloseable.class.cast(jsonb).close();
     } catch (final Exception e) {
       fail(e.getMessage());
     }
   } finally {
     testLifecycle.stopApplication(null);
   }
 }