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

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


      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();
View Full Code Here


      System.out.println("maxConnectionsInUseCount \n" + maxConnectionsInUseCount);
   }
  
   public void testTimeoutRemoval() throws Exception
   {
      StatefulTimeout sfsb = (StatefulTimeout)getInitialContext().lookup("StatefulTimeoutBean/remote");
      sfsb.test();
      Thread.sleep(5 * 1000);
     
      try
      {
         sfsb.test();
         fail("SFSB should have been removed via timeout");
      } catch (javax.ejb.NoSuchEJBException e)
      {
      }
     
      sfsb = (StatefulTimeout)getInitialContext().lookup("StatefulTimeoutBean2/remote");
      sfsb.test();
      Thread.sleep(10 * 1000);
     
      try
      {
         sfsb.test();
         fail("SFSB should have been removed via timeout");
      } catch (javax.ejb.NoSuchEJBException e)
      {
      }
   }
View Full Code Here

      }
   }
  
   public void testClusteredTimeoutRemoval() throws Exception
   {
      StatefulTimeout sfsb = (StatefulTimeout)getInitialContext().lookup("StatefulClusteredTimeoutBean/remote");
      sfsb.test();
      Thread.sleep(5 * 1000);
     
      try
      {
         sfsb.test();
         fail("SFSB should have been removed via timeout");
      } catch (javax.ejb.NoSuchEJBException e)
      {
      }
     
      sfsb = (StatefulTimeout)getInitialContext().lookup("StatefulClusteredTimeoutBean2/remote");
      sfsb.test();
      Thread.sleep(10 * 1000);
     
      try
      {
         sfsb.test();
         fail("SFSB should have been removed via timeout");
      } catch (javax.ejb.NoSuchEJBException e)
      {
      }
   }
View Full Code Here

   {
      SecurityClient client = SecurityClientFactory.getSecurityClient();
      client.setSimple("somebody", "password");
      client.login();
     
      StatefulTx stateful = (StatefulTx)getInitialContext().lookup("StatefulTxBean/remote");
      assertNotNull(stateful);
     
      boolean transacted = stateful.isLocalTransacted();
      assertTrue(transacted);
      transacted = stateful.isGlobalTransacted();
      assertFalse(transacted);
      transacted = stateful.testNewTx();
      assertTrue(transacted);
     
      try
      {
         stateful.testTxRollback();
         fail("should have caught exception");
      }
      catch (javax.ejb.EJBException e)
      {
      }
View Full Code Here

   {
      SecurityClient client = SecurityClientFactory.getSecurityClient();
      client.setSimple("somebody", "password");
      client.login();
     
      StatefulTx stateful = (StatefulTx)getInitialContext().lookup("StatefulTxBean/remote");
      assertNotNull(stateful);
     
      try
      {
         stateful.testMandatoryTx(new State("test"));
         fail("should have caught exception");
      }
      catch (javax.ejb.EJBTransactionRequiredException e)
      {
      }
View Full Code Here

      SecurityClient client = SecurityClientFactory.getSecurityClient();
      client.setSimple("somebody", "password");
      client.login();
     
      System.out.println("testPassivation");
      Stateless stateless = (Stateless)getInitialContext().lookup("Stateless");
      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();
     
      stateless.testInjection();
     
      service.testInjection();
   }
View Full Code Here

      SecurityClient client = SecurityClientFactory.getSecurityClient();
      client.setSimple("somebody", "password");
      client.login();
     
      System.out.println("testPassivation");
      Stateless stateless = (Stateless)getInitialContext().lookup("Stateless");
      stateless.testInjection();
     
      ServiceRemote service = (ServiceRemote) getInitialContext().lookup("ServiceBean/remote");
      service.testInjection();
     
      ClusteredStateful stateful = (ClusteredStateful)getInitialContext().lookup("ClusteredStateful");
      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();
     
      stateless.testInjection();
     
      service.testInjection();
   }
View Full Code Here

   {
      SecurityClient client = SecurityClientFactory.getSecurityClient();
      client.setSimple("somebody", "password");
      client.login();
     
      Tester test = (Tester) getInitialContext().lookup("TesterBean/remote");
      test.testSessionSynchronization();

   }
View Full Code Here

      assertEquals(3, beansRemoved - startingRemoveCount);
   }

   public void testRemoveWithRollback() throws Exception
   {
      Tester test = (Tester) getInitialContext().lookup("TesterBean/remote");
      test.testRollback1();
      test.testRollback2();
   }
View Full Code Here

     
      // We want a colocated SLSB and SFSB to test passivation/destruction
      // VMIDTrackerBean is not clustered, so once we have it's VMID
      // we can keep creating SFSBs until we get one we want
      getLog().debug("Looking up VMTrackerBean...");
      VMTracker tracker = (VMTracker) getInitialContext(0).lookup("VMTrackerBean/remote");
      VMID monitorVM = tracker.getVMID();
     
      NodeAnswer node0 = null;
      boolean vmMatch = false;
      for (int i = 0; i < 10 && !vmMatch; i++)
      {
View Full Code Here

TOP

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

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.