Package org.jboss.ejb3.test.mc.bootstrap

Examples of org.jboss.ejb3.test.mc.bootstrap.EmbeddedTestMcBootstrap


   @BeforeClass
   public static void setUpBeforeClass() throws Throwable
   {
      // Start up MC
      bootstrap = new EmbeddedTestMcBootstrap();
      bootstrap.run();

      // Bind the Registrar
      Ejb3RegistrarLocator.bindRegistrar(new Ejb3McRegistrar(bootstrap.getKernel()));
View Full Code Here


    * @throws Throwable
    */
   @BeforeClass
   public static void setUpBeforeClass() throws Throwable
   {
      bootstrap = new EmbeddedTestMcBootstrap();
      bootstrap.run();

      // Bind the Registrar
      Ejb3RegistrarLocator.bindRegistrar(new Ejb3McRegistrar(bootstrap.getKernel()));

View Full Code Here

   // Lifecycle Methods --------------------------------------------------------------||
   // --------------------------------------------------------------------------------||

   public static void setUpBeforeClass() throws Throwable
   {
      bootstrap = new EmbeddedTestMcBootstrap();
      bootstrap.run();

      // Bind the Registrar
      Ejb3RegistrarLocator.bindRegistrar(new Ejb3McRegistrar(bootstrap.getKernel()));
View Full Code Here

    * @throws Throwable
    */
   @BeforeClass
   public static void setUpBeforeClass() throws Throwable
   {
      bootstrap = new EmbeddedTestMcBootstrap();
      bootstrap.run();

      // Bind the Registrar
      Ejb3RegistrarLocator.bindRegistrar(new Ejb3McRegistrar(bootstrap.getKernel()));

View Full Code Here

     
      DummyTransactionManager tm = new DummyTransactionManager();
      InitialContext ic = new InitialContext(ctxProperties);
      ic.bind("java:/TransactionManager", tm);
     
      EmbeddedTestMcBootstrap bootstrap = EmbeddedTestMcBootstrap.createEmbeddedMcBootstrap();
      Ejb3RegistrarLocator.bindRegistrar(new Ejb3McRegistrar(bootstrap.getKernel()));
     
      ClassLoader cl = Thread.currentThread().getContextClassLoader();
      Class<?> beanClass = MockBean.class;
      String beanClassName = beanClass.getName();
      String ejbName = beanClass.getSimpleName();
      Domain domain = new Domain(new AspectManager(), "Test", false);
      Map<String, Class<? extends PersistenceManagerFactory>> factories = new HashMap<String, Class<? extends PersistenceManagerFactory>>();
      factories.put("MyStatefulSessionFilePersistenceManager", MyStatefulSessionFilePersistenceManagerFactory.class);
      PersistenceManagerFactoryRegistry persistenceManagerFactoryRegistry = new PersistenceManagerFactoryRegistry();
      persistenceManagerFactoryRegistry.setFactories(factories);
      Ejb3Deployment deployment = new MockEjb3Deployment(new MockDeploymentUnit());
      deployment.setPersistenceManagerFactoryRegistry(persistenceManagerFactoryRegistry);
      MockStatefulContainer container = new MockStatefulContainer(cl, beanClassName, ejbName, domain, ctxProperties,
            deployment);
      container.instantiated();
      container.processMetadata();
      System.out.println("injectors = " + container.getInjectors());
      Ejb3Registry.register(container);
      try
      {
         container.create();
         container.setJaccContextId("none");
         container.start();
        
         Object id = container.createSession();
        
         StatefulBeanContext ctx = container.getCache().get(id, false);
        
         System.out.println("inUse = " + ctx.isInUse());
         MockBean bean = (MockBean) ctx.getInstance();
         System.out.println(bean.ctx);
         ctx.setInUse(false);
         ctx = null;
        
         synchronized (MockBean.notification)
         {
            MockBean.notification.wait(5000);
         }
         Thread.sleep(500);
        
         ctx = container.getCache().get(id, false);
         bean = (MockBean) ctx.getInstance();
        
         String a = ctx.getEJBContext().toString();
         String b = bean.ctx.toString();
         System.out.println(ctx.getEJBContext());
         System.out.println(bean.ctx);
         assertTrue(a.regionMatches(a.indexOf('{'), b, b.indexOf('{'), a.length() - a.indexOf('{')));
      }
      finally
      {
         bootstrap.shutdown();
//         container.stop();
//         container.destroy();
//         Ejb3Registry.unregister(container);
      }
   }
View Full Code Here

   @BeforeClass
   public static void beforeClass() throws Throwable
   {
      // Create and run a new Bootstrap
      bootstrap = new EmbeddedTestMcBootstrap();
      bootstrap.run();

      // Dig into MC
      Kernel kernel = bootstrap.getKernel();
View Full Code Here

    * @return
    */
   private TimerService createTimerService()
   {
      // get the TimedObjectInvoker
      TimedObjectInvoker timedObjectInvoker = this.getTimedObjectInvoker();
      // if there's no TimedObjectInvoker, we can't do anything, so just
      // throw an exception
      if (timedObjectInvoker == null)
      {
         throw new IllegalStateException("Cannot create timerservice for EJB " + this.getEjbName()
View Full Code Here

      try
      {
         Thread.currentThread().setContextClassLoader(classloader);
         try
         {
            Util.rebind(getEnc(), "UserTransaction", new UserTransactionImpl());
         }
         catch (NamingException e)
         {
            NamingException namingException = new NamingException("Could not bind user transaction for ejb name " + ejbName + " into JNDI under jndiName: " + getEnc().getNameInNamespace() + "/" + "UserTransaction");
            namingException.setRootCause(e);
View Full Code Here

      this.metadataBasedAnnotationRepo.addComponentMetaDataLoaderFactory(new InterceptorComponentMetaDataLoaderFactory(interceptorBridges));
      this.metadataBasedAnnotationRepo.addMetaDataBridge(new AdditiveBeanInterceptorMetaDataBridge(this.beanClass, this.classloader, this.xml));
     
      List<MetaDataBridge<ApplicationExceptionMetaData>> appExceptionBridges = new ArrayList<MetaDataBridge<ApplicationExceptionMetaData>>();
      appExceptionBridges.add(new ApplicationExceptionMetaDataBridge());
      this.metadataBasedAnnotationRepo.addComponentMetaDataLoaderFactory(new ApplicationExceptionComponentMetaDataLoaderFactory(appExceptionBridges));
     
      this.metadataBasedAnnotationRepo.addMetaDataBridge(new RunAsMetaDataBridge());
      //Add a security domain bridge
      this.metadataBasedAnnotationRepo.addMetaDataBridge(new SecurityDomainMetaDataBridge());
      // Ensure that an @Clustered annotation is visible to AOP if the XML says the bean is  clustered.
View Full Code Here

      interceptorBridges.add(new InterceptorMetaDataBridge());
      this.metadataBasedAnnotationRepo.addComponentMetaDataLoaderFactory(new InterceptorComponentMetaDataLoaderFactory(interceptorBridges));
      this.metadataBasedAnnotationRepo.addMetaDataBridge(new AdditiveBeanInterceptorMetaDataBridge(this.beanClass, this.classloader, this.xml));
     
      List<MetaDataBridge<ApplicationExceptionMetaData>> appExceptionBridges = new ArrayList<MetaDataBridge<ApplicationExceptionMetaData>>();
      appExceptionBridges.add(new ApplicationExceptionMetaDataBridge());
      this.metadataBasedAnnotationRepo.addComponentMetaDataLoaderFactory(new ApplicationExceptionComponentMetaDataLoaderFactory(appExceptionBridges));
     
      this.metadataBasedAnnotationRepo.addMetaDataBridge(new RunAsMetaDataBridge());
      //Add a security domain bridge
      this.metadataBasedAnnotationRepo.addMetaDataBridge(new SecurityDomainMetaDataBridge());
View Full Code Here

TOP

Related Classes of org.jboss.ejb3.test.mc.bootstrap.EmbeddedTestMcBootstrap

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.