Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  
  package examples.cancel;
  
  import java.util.Timer;
 
 
 
 import  junit.framework.TestCase;

Author(s):
M. Ranganathan
 
 public abstract class AbstractCancelTest extends TestCase implements SipListener {
 
     private Hashtable providerTable;
 
     protected Shootist shootist;
 
     private static Logger logger = Logger.getLogger(AbstractCancelTest.class);
 
     static {
         if (.getAllAppenders() instanceof NullEnumeration )
             PropertyConfigurator.configure("log4j.properties");
 
 
 
     }
 
     //private Appender appender;
 
     private SipListener getSipListener(EventObject sipEvent) {
         SipProvider source = (SipProvidersipEvent.getSource();
         SipListener listener = (SipListener.get(source);
         assertTrue(listener != null);
         return listener;
     }
 
     public AbstractCancelTest() {
 
         try {
             . = "logs/";
             ProtocolObjects.init("canceltest");
              = new Hashtable();
              = new Shootist();
             SipProvider shootistProvider = .createSipProvider();
             .put(shootistProvider);
             Shootme shootme = new Shootme();
             SipProvider shootmeProvider = shootme.createProvider();
             .put(shootmeProvidershootme);
             shootistProvider.addSipListener(this);
             shootmeProvider.addSipListener(this);
             ProtocolObjects.start();
         } catch (Exception ex) {
             fail("unexpected exception ");
         }
     }
 
     public void setUp() {
 
             try {
                 //appender = new ConsoleAppender(new SimpleLayout());
                 //logger.addAppender(appender);
 
             } catch (Exception ex) {
                 throw new RuntimeException("Unexpected error initializing logging",
                         ex);
             }
 
 
     }
 
     public void tearDown() {
 
         ProtocolObjects.destroy();
         //logger.removeAppender(appender);
 
     }
 
    public void processRequest(RequestEvent requestEvent) {
        getSipListener(requestEvent).processRequest(requestEvent);
    }
    public void processResponse(ResponseEvent responseEvent) {
        getSipListener(responseEvent).processResponse(responseEvent);
    }
    public void processTimeout(TimeoutEvent timeoutEvent) {
        getSipListener(timeoutEvent).processTimeout(timeoutEvent);
    }
    public void processIOException(IOExceptionEvent exceptionEvent) {
        fail("unexpected exception");
    }
    public void processTransactionTerminated(
            TransactionTerminatedEvent transactionTerminatedEvent) {
        getSipListener(transactionTerminatedEvent)
                .processTransactionTerminated(transactionTerminatedEvent);
    }
    public void processDialogTerminated(
            DialogTerminatedEvent dialogTerminatedEvent) {
        getSipListener(dialogTerminatedEvent).processDialogTerminated(
                dialogTerminatedEvent);
    }
New to GrepCode? Check out our FAQ X