Package org.jboss.ejb3.core.test.ejbthree1549.unit

Examples of org.jboss.ejb3.core.test.ejbthree1549.unit.PassivationDoesNotPreventNewActivityUnitTestCase


   @Override
   public void undeploy(VFSDeploymentUnit unit, JBossClientMetaData metaData)
   {
      log.debug("undeploy " + unit.getName());

      ClientENCInjectionContainer container = unit.getAttachment(ClientENCInjectionContainer.class);
      if(container != null)
         getKernelAbstraction().uninstall(container.getObjectName().getCanonicalName());

      String appClientName = getJndiName(metaData);
      String deploymentClientName = null;
      if(appClientName == null)
         appClientName = getDeploymentJndiName(unit);
View Full Code Here


     
      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.
      this.metadataBasedAnnotationRepo.addMetaDataBridge(new ClusteredMetaDataBridge());
   }
View Full Code Here

         Kernel sanders = this.kernel;
         assert sanders != null : Kernel.class.getSimpleName() + " must be provided in order to bind "
               + Ejb3Registrar.class.getSimpleName();

         // Create an EJB3 Registrar
         Ejb3Registrar registrar = new Ejb3McRegistrar(sanders);

         // Bind Registrar to the Locator
         Ejb3RegistrarLocator.bindRegistrar(registrar);
        
         // Log
View Full Code Here

      {
         SessionProxyInvocationHandler handler = (SessionProxyInvocationHandler) Proxy.getInvocationHandler(reference);
         id = (Serializable) handler.getTarget();
      }

      @Deprecated
      Ejb3Registrar registrar = Ejb3RegistrarLocator.locateRegistrar();

      // Get the resolver
      EndpointResolver resolver = registrar.lookup(MC_BIND_NAME_ENDPOINT_RESOLVER, EndpointResolver.class);
      this.ejbClassName = descriptor.getBeanClass().getSimpleName();
      endpointMcBindName = resolver.resolve(deploymentUnit, ejbClassName);
      this.stateful = descriptor.isStateful();
   }
View Full Code Here

      }
   }

   private Endpoint getEndpoint()
   {
      @Deprecated
      Ejb3Registrar registrar = Ejb3RegistrarLocator.locateRegistrar();
      return registrar.lookup(endpointMcBindName, Endpoint.class);
   }
View Full Code Here

         Kernel sanders = this.kernel;
         assert sanders != null : Kernel.class.getSimpleName() + " must be provided in order to bind "
               + Ejb3Registrar.class.getSimpleName();

         // Create an EJB3 Registrar
         Ejb3Registrar registrar = new Ejb3McRegistrar(sanders);

         // Bind Registrar to the Locator
         Ejb3RegistrarLocator.bindRegistrar(registrar);
        
         // Log
View Full Code Here

      /*
       * Mark this session as eligible for removal
       */

      // Get the cache
      ForceEventsCache cache = (ForceEventsCache) container.getCache();

      // Get the Session ID
      Serializable sessionId = this.getSessionId(sfsb);

      // Mark
      cache.makeSessionEligibleForRemoval(sessionId);

      /*
       * All's OK with traditional invocation, so define a task to force removal
       * of the SFSB, but don't invoke it yet (we're going to fire this off
       * *during* passivation
 
View Full Code Here

      int next = bean.getNextCounter();
      log.info("Got counter from " + sessionId + ": " + next);
      TestCase.assertEquals("SFSB did not return expected next counter", 0, next);

      // Get the Cache
      ForceEventsCache cache = (ForceEventsCache) container.getCache();

      // Get the lock to block the PM, now
      boolean gotLock = BlockingPersistenceManager.PASSIVATION_LOCK.tryLock();

      Future<Integer> result;
      // Once PM lock is acquired, everything is in "try" so we release in "finally"
      try
      {
         // Ensure we got the PM lock, else fail the test
         TestCase.assertTrue("Test was not able to immediately get the lock to block the PersistenceManager", gotLock);
         log.info("Locked " + BlockingPersistenceManager.class.getSimpleName());

         // Mark
         cache.makeSessionEligibleForPassivation(sessionId);

         /*
          * Passivate
          */

 
View Full Code Here

      int next = bean.getNextCounter();
      log.info("Got counter from " + sessionId + ": " + next);
      TestCase.assertEquals("SFSB did not return expected next counter", 0, next);

      // Get the Cache
      ForceEventsCache cache = (ForceEventsCache) container.getCache();

      // Get the lock to block the PM, now
      boolean gotLock = BlockingPersistenceManager.PASSIVATION_LOCK.tryLock();

      Future<Integer> result;
      // Once PM lock is acquired, everything is in "try" so we release in "finally"
      try
      {
         // Ensure we got the PM lock, else fail the test
         TestCase.assertTrue("Test was not able to immediately get the lock to block the PersistenceManager", gotLock);
         log.info("Locked " + BlockingPersistenceManager.class.getSimpleName());

         // Mark
         cache.makeSessionEligibleForPassivation(sessionId);

         /*
          * Passivate
          */

 
View Full Code Here

      // Get our bean's Session ID
      Serializable sessionId = this.getSessionId(bean1);

      // Get the Cache
      ForceEventsCache cache = (ForceEventsCache) container.getCache();

      // Get the lock to block the PM, now
      boolean gotLock = BlockingPersistenceManager.PASSIVATION_LOCK.tryLock();

      // Once PM lock is acquired, everything is in "try" so we release in "finally"
      try
      {
         // Ensure we got the PM lock, else fail the test
         TestCase.assertTrue("Test was not able to immediately get the lock to block the PersistenceManager", gotLock);
         log.info("Locked " + BlockingPersistenceManager.class.getSimpleName());

         /*
          * Mark our session as expired
          */

         // Mark
         cache.makeSessionEligibleForPassivation(sessionId);

         /*
          * Passivate
          */

         // Trigger Passivation
         ForceEventsCache.forcePassivation();
         log.info("Passivation forced, carrying out test");

         ForceEventsCache.PRE_PASSIVATE_BARRIER.await(5, TimeUnit.SECONDS);

         // Block until the PM is ready to passivate
         log.info("Waiting on common barrier for PM to run...");
         BlockingPersistenceManager.BARRIER.await(5, TimeUnit.SECONDS);
         log.info("PM and test have met barrier, passivation running (but will be blocked to complete by test)");

         /*
          * At this point, we've told the passivation Thread to start, and have
          * locked it from completing.  So let's try our test in another Thread
          * so we can detect a deadlock or permanent blocking after a timeout
          */
         ExecutorService executor = Executors.newFixedThreadPool(1);
         Future<Boolean> futureResult = executor.submit(testThread);
         boolean result = futureResult.get(5, TimeUnit.SECONDS);

         /*
          * Assert on the result
          */

         // If the test has not succeeded
         if (!result)
         {
            // Fail
            TestCase.fail("The test has completed without success");
         }

         // If the test has been successful
         else
         {
            log.info("Test Succeeded");
            testSucceeded = true;
         }
      }
      finally
      {

         // Allow the Persistence Manager to finish up
         log.info("Letting the PM perform passivation...");
         BlockingPersistenceManager.PASSIVATION_LOCK.unlock();
      }

      // We need to allow time to let the Cache finish passivation, so block until it's done
      log.info("Waiting on Cache to tell us passivation is completed...");
      ForceEventsCache.POST_PASSIVATE_BARRIER.await(5, TimeUnit.SECONDS);
      log.info("Test sees Cache reports passivation completed.");

      /*
       * Here we ensure that the session was removed from the internal cacheMap
       */
      boolean beanIsInCache = cache.doesCacheMapContainKey(sessionId);
      assertFalse("bean " + sessionId + " was not removed from cache", beanIsInCache);

      // Ensure we're good
      TestCase.assertTrue("The test did not succeed", testSucceeded);
   }
View Full Code Here

TOP

Related Classes of org.jboss.ejb3.core.test.ejbthree1549.unit.PassivationDoesNotPreventNewActivityUnitTestCase

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.