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

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


      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


     
      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

     
      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

      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();
     
      Stateful stateful = (Stateful)getInitialContext().lookup("Stateful");
      assertNotNull(stateful);
      stateful.setState("state");
      stateful.removeMe();
     
      ObjectName deployment = new ObjectName("test.ejb3:name=Bill,service=EJB3");

      ClientKernelAbstraction kernel = KernelAbstractionFactory.getClientInstance();
      kernel.invoke(deployment, "stop", new Object[0], new String[0]);
      kernel.invoke(deployment, "start", new Object[0], new String[0]);
     
      stateful = (Stateful)getInitialContext().lookup("Stateful");
      assertNotNull(stateful);
      stateful.setState("state");
      stateful.removeMe();
   }
View Full Code Here

   {
      SecurityClient client = SecurityClientFactory.getSecurityClient();
      client.setSimple("somebody", "password");
      client.login();
     
      Stateful stateful = (Stateful)getInitialContext().lookup("Stateful");
      assertNotNull(stateful);
      stateful.setState("state");
      String state = stateful.getState();
      assertEquals("state", state);
   }
View Full Code Here

      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

   {
      SecurityClient client = SecurityClientFactory.getSecurityClient();
      client.setSimple("somebody", "password");
      client.login();
     
      Stateful stateful = (Stateful)getInitialContext().lookup("Stateful");
      assertNotNull(stateful);
     
      try
      {
         stateful.testThrownException();
         fail("no exception caught");
      }
      catch (Exception e)
      {
         StackTraceElement[] stackTrace = e.getStackTrace();
View Full Code Here

   {
      SecurityClient client = SecurityClientFactory.getSecurityClient();
      client.setSimple("somebody", "password");
      client.login();
     
      Stateful stateful = (Stateful)getInitialContext().lookup("Stateful");
      assertNotNull(stateful);
     
      try
      {
         stateful.testExceptionCause();
         fail("no exception caught");
      }
      catch (Exception e)
      {
         Throwable cause = e.getCause();
View Full Code Here

   {
      SecurityClient client = SecurityClientFactory.getSecurityClient();
      client.setSimple("somebody", "password");
      client.login();
     
      Stateful stateful = (Stateful)getInitialContext().lookup("Stateful");
      assertNotNull(stateful);
      assertFalse(stateful.interceptorAccessed());
      assertTrue(RemoteBindingInterceptor.accessed);
   }
View Full Code Here

TOP

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

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.