Package org.jboss.test.cluster.ejb3.stateful

Examples of org.jboss.test.cluster.ejb3.stateful.Stateless


   {
      SecurityClient client = SecurityClientFactory.getSecurityClient();
      client.setSimple("somebody", "password");
      client.login();
     
      Stateful stateful = (Stateful)getInitialContext().lookup("Stateful");
      assertNotNull(stateful);
      stateful.lookupStateful();
      Thread.sleep(10 * 1000);
      stateful.testStateful();
     
      stateful.lookupStateful();
      stateful.testStateful();
      Thread.sleep(10 * 1000);
      stateful.testStateful();
   }
View Full Code Here


      stateless.testInjection();
     
      ServiceRemote service = (ServiceRemote) getInitialContext().lookup("ServiceBean/remote");
      service.testInjection();
     
      Stateful stateful = (Stateful)getInitialContext().lookup("Stateful");
      assertNotNull(stateful);
      stateful.setState("state");
      assertEquals("state", stateful.getState());
      stateful.testSerializedState("state");
      assertEquals(null, stateful.getInterceptorState());
      stateful.setInterceptorState("hello world");
      assertFalse(stateful.testSessionContext());
      Thread.sleep(10 * 1000);
      assertTrue(stateful.wasPassivated());
     
      assertEquals("state", stateful.getState());
      assertEquals("hello world", stateful.getInterceptorState());

      Stateful another = (Stateful)getInitialContext().lookup("Stateful");
      assertEquals(null, another.getInterceptorState());
      another.setInterceptorState("foo");
      assertEquals("foo", another.getInterceptorState());
      assertEquals("hello world", stateful.getInterceptorState());
     
      assertFalse(stateful.testSessionContext());
     
      stateful.testResources();
View Full Code Here

      assertTrue(stateful.wasPassivated());
     
      assertEquals("state", stateful.getState());
      assertEquals("hello world", stateful.getInterceptorState());

      Stateful another = (Stateful)getInitialContext().lookup("Stateful");
      assertEquals(null, another.getInterceptorState());
      another.setInterceptorState("foo");
      assertEquals("foo", another.getInterceptorState());
      assertEquals("hello world", stateful.getInterceptorState());
     
      assertFalse(stateful.testSessionContext());
     
      stateful.testResources();
View Full Code Here

   {
      SecurityClient client = SecurityClientFactory.getSecurityClient();
      client.setSimple("somebody", "password");
      client.login();
     
      Stateful stateful = (Stateful)getInitialContext().lookup("Stateful");
      assertNotNull(stateful);
     
      int startingRemoveCount = stateful.beansRemoved();
     
      stateful.removeMe();
      try
      {
         stateful.getState();
         fail("Bean should have been removed");
      } catch (NoSuchEJBException e)
      {
        
      }
     
      stateful = (Stateful)getInitialContext().lookup("Stateful");
      assertNotNull(stateful);
      stateful.setState("InMyTimeOfDying");
     
      stateful.removeMe();
      try
      {
         stateful.getState();
         fail("Bean should have been removed");
      } catch (NoSuchEJBException e)
      {
        
      }
     
      StatefulHome home = (StatefulHome)getInitialContext().lookup("StatefulBean/home");
      assertNotNull(home);
      Stateful21 stateful21 = (Stateful21)home.create();
      assertNotNull(stateful21);
      stateful21.removeMe();
     
      try
      {
         stateful.getState();
         fail("Bean should have been removed");
      } catch (NoSuchEJBException e)
      {
        
      }
     
      stateful = (Stateful)getInitialContext().lookup("Stateful");
      int beansRemoved = stateful.beansRemoved();
      assertEquals(3, beansRemoved - startingRemoveCount);
   }
View Full Code Here

      // Establish how many beans are already active
      int prevCount = (Integer)server.getAttribute(testerName, "CreateCount");
      System.out.println("prevCount = " + prevCount);
      assertTrue("can't have negative creation count", prevCount >= 0);
     
      Stateful stateful = (Stateful)getInitialContext().lookup(jndiBinding);
      assertNotNull(stateful);
      stateful.setState("state");
     
      int createCount = (Integer)server.getAttribute(testerName, "CreateCount");
      assertEquals(1, createCount - prevCount);
     
      // Ensure cache is incremented
      int newCacheSize = (Integer)server.getAttribute(testerName, "CacheSize");
      assertEquals(startCacheSize+1, newCacheSize);
     
      int totalSize = (Integer)server.getAttribute(testerName, "TotalSize");
      assertEquals(startTotalSize+1, totalSize);
     
      assertEquals("state", stateful.getState());
      stateful.testSerializedState("state");
      stateful.clearPassivated();
      assertEquals(null, stateful.getInterceptorState());
      stateful.setInterceptorState("hello world");
      assertFalse(stateful.testSessionContext());
      Thread.sleep(10 * 1000);
     
      int cacheSize = (Integer)server.getAttribute(testerName, "CacheSize");
      assertEquals(0, cacheSize);
     
      int passivatedCount = (Integer)server.getAttribute(testerName, "PassivatedCount");
      assertEquals(1, passivatedCount - prevCount);
      assertTrue(stateful.wasPassivated());
     
      totalSize = (Integer)server.getAttribute(testerName, "TotalSize");
      assertEquals(cacheSize + passivatedCount, totalSize);
     
      assertEquals("state", stateful.getState());
      assertEquals("hello world", stateful.getInterceptorState());
     
      passivatedCount = (Integer)server.getAttribute(testerName, "PassivatedCount");
      assertEquals(0, passivatedCount - prevCount);

      Stateful another = (Stateful)getInitialContext().lookup(jndiBinding);
      assertEquals(null, another.getInterceptorState());
      another.setInterceptorState("foo");
      assertEquals("foo", another.getInterceptorState());
      assertEquals("hello world", stateful.getInterceptorState());
     
      assertFalse(stateful.testSessionContext());
     
      stateful.testResources();
     
      createCount = (Integer)server.getAttribute(testerName, "CreateCount");
      assertEquals(2, createCount - prevCount);
     
      // the injected beans are passivated at this point in time
     
      cacheSize = (Integer)server.getAttribute(testerName, "CacheSize");
      assertEquals(2, cacheSize);
     
      // keep in mind, we're not removing already injected beans
     
      int removeCount = (Integer)server.getAttribute(testerName, "RemoveCount");
      assertEquals(0, removeCount);
     
      another.removeMe();
      cacheSize = (Integer)server.getAttribute(testerName, "CacheSize");
      assertEquals(1, cacheSize);
     
      removeCount = (Integer)server.getAttribute(testerName, "RemoveCount");
      assertEquals(1, removeCount);
View Full Code Here

        
      }
     
      StatefulHome home = (StatefulHome)getInitialContext().lookup("StatefulBean/home");
      assertNotNull(home);
      Stateful21 stateful21 = (Stateful21)home.create();
      assertNotNull(stateful21);
      stateful21.removeMe();
     
      try
      {
         stateful.getState();
         fail("Bean should have been removed");
View Full Code Here

   {
      SecurityClient client = SecurityClientFactory.getSecurityClient();
      client.setSimple("somebody", "password");
      client.login();
     
      StatefulHome home = (StatefulHome)getInitialContext().lookup("StatefulBean/home");
      assertNotNull(home);
      javax.ejb.EJBObject stateful = (javax.ejb.EJBObject)home.create();
      assertNotNull(stateful);
   }
View Full Code Here

   {
      SecurityClient client = SecurityClientFactory.getSecurityClient();
      client.setSimple("somebody", "password");
      client.login();
     
      StatefulHome home = (StatefulHome)getInitialContext().lookup("StatefulBean/home");
      assertNotNull(home);
      ExtendedState state = new ExtendedState("init");
      Stateful stateful = home.create(state);
      assertNotNull(stateful);
      String s = stateful.getState();
      assertEquals("Extended_init", s);
   }
View Full Code Here

      } catch (NoSuchEJBException e)
      {
        
      }
     
      StatefulHome home = (StatefulHome)getInitialContext().lookup("StatefulBean/home");
      assertNotNull(home);
      Stateful21 stateful21 = (Stateful21)home.create();
      assertNotNull(stateful21);
      stateful21.removeMe();
     
      try
      {
View Full Code Here

      stateful.getState();
     
      StatefulInvoker[] invokers = new StatefulInvoker[2];
      for (int i = 0; i < 2 ; ++i)
      {
         invokers[i] = new StatefulInvoker(stateful);
      }
     
      for (StatefulInvoker invoker: invokers)
      {
         invoker.start();
      }
     
      Thread.sleep(10000);
     
      for (StatefulInvoker invoker: invokers)
      {
         if (invoker.getException() != null)
            throw invoker.getException();
      }
     
      stateful = (ConcurrentStateful) new InitialContext().lookup("Stateful");
     
      invokers = new StatefulInvoker[2];
      for (int i = 0; i < 2 ; ++i)
      {
         invokers[i] = new StatefulInvoker(stateful);
      }
     
      for (StatefulInvoker invoker: invokers)
      {
         invoker.start();
View Full Code Here

TOP

Related Classes of org.jboss.test.cluster.ejb3.stateful.Stateless

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.