/*
 *
 * JBoss, the OpenSource J2EE webOS
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */

package org.jboss.ejb3.test.timer.unit;

//import java.rmi.*;


import junit.framework.Test;
import org.jboss.ejb3.test.timer.TimerTester;
import org.jboss.test.JBossTestCase;

/**
 * Sample client for the jboss container.
 *
 * @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
 * @version $Id: RemoteUnitTestCase.java,v 1.1.2.5 2005/09/14 22:19:18 bill Exp $
 */

public class RemoteUnitTestCase
extends JBossTestCase
{
   org.apache.log4j.Category log = getLog();

   static boolean deployed = false;
   static int test = 0;

   public RemoteUnitTestCase(String name)
   {

      super(name);

   }

   public void testSimple() throws Exception
   {
      TimerTester test = (TimerTester) this.getInitialContext().lookup(TimerTester.class.getName());
      test.startTimer(5000);
      test.accessTimer();
      Thread.sleep(6000);
      assertTrue(test.isTimerCalled());
      test.startTimerViaEJBContext(5000);
      test.accessTimer();
      Thread.sleep(6000);
      assertTrue(test.isTimerCalled());
   }
   
   public void testSimple21() throws Exception
   {
      TimerTester test = (TimerTester) this.getInitialContext().lookup("TimerTesterBean21");
      test.startTimer(5000);
      test.accessTimer();
      Thread.sleep(6000);
      assertTrue(test.isTimerCalled());
      test.startTimerViaEJBContext(5000);
      test.accessTimer();
      Thread.sleep(6000);
      assertTrue(test.isTimerCalled());
   }

   public static Test suite() throws Exception
   {
      return getDeploySetup(RemoteUnitTestCase.class, "timer-test.ejb3");
   }

}
