Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package test.tck.msgflow.callflows.refer;
  
  import java.util.Timer;
  
 
 
 
 import  junit.framework.TestCase;

Implements common setup and tearDown sequence for Refer tests

Author(s):
M. Ranganathan
Ivelin Ivanov
 
 public abstract class AbstractReferTestCase extends ScenarioHarness implements
         SipListener {
 
 
     protected Referee referee;
 
     protected Referrer referrer;
 
     private static Logger logger = Logger.getLogger("test.tck");
 
     static {
         if (!.isAttached()) {
 
             .addAppender();
 
         }
     }
 
     public AbstractReferTestCase() {
         super("refer"true);
     }
 
     public void setUp() throws Exception {
         try {
             super.setUp();
 
             .info("ReferTest: setup()");
              = new Referee(getTiProtocolObjects());
             SipProvider refereeProvider = .createProvider();
             .put(refereeProvider);
 
              = new Referrer(getRiProtocolObjects());
             SipProvider referrerProvider = .createProvider();
             .put(referrerProvider);
 
             refereeProvider.addSipListener(this);
             referrerProvider.addSipListener(this);
 
             if (getTiProtocolObjects() != getRiProtocolObjects())
                 getTiProtocolObjects().start();
             getRiProtocolObjects().start();
         } catch (Exception ex) {
             .error("unexpected excecption "ex);
             fail("unexpected exception");
         }
     }
 
     public void tearDown() throws Exception {
         try {
             Thread.sleep(4000);
             super.tearDown();
             Thread.sleep(1000);
             this..clear();
 
             assertEquals( 3, . );  // Should have 3 NOTIFYs
 
             logTestCompleted();
         } catch (Exception ex) {
             .error("unexpected exception"ex);
             fail("unexpected exception ");
         }
         super.tearDown();
    }
New to GrepCode? Check out our FAQ X