01: package test.tck.msgflow.callflows.recroute;
02:
03: import java.util.Hashtable;
04:
05: import javax.sip.SipListener;
06: import javax.sip.SipProvider;
07:
08: import org.apache.log4j.Logger;
09:
10: import test.tck.msgflow.callflows.ScenarioHarness;
11:
12: /**
13: * @author M. Ranganathan
14: * @author Jeroen van Bemmel
15: *
16: */
17: public class AbstractRecRouteTestCase extends ScenarioHarness implements
18: SipListener {
19:
20: protected Shootist shootist;
21:
22: private static Logger logger = Logger.getLogger("test.tck");
23:
24: protected Shootme shootme;
25:
26: private Proxy proxy;
27:
28: static {
29: if (!logger.isAttached(console))
30: logger.addAppender(console);
31: }
32:
33: // private Appender appender;
34:
35: public AbstractRecRouteTestCase() {
36:
37: super ("TCPRecRouteTest", true);
38:
39: try {
40: providerTable = new Hashtable();
41:
42: } catch (Exception ex) {
43: logger.error("unexpected exception", ex);
44: fail("unexpected exception ");
45: }
46: }
47:
48: public void setUp() {
49:
50: try {
51: super .setUp(false);
52: shootist = new Shootist(5060, 5070, tiProtocolObjects);
53: SipProvider shootistProvider = shootist.createSipProvider();
54: providerTable.put(shootistProvider, shootist);
55: shootistProvider.addSipListener(this );
56:
57: this .shootme = new Shootme(5080, tiProtocolObjects);
58: SipProvider shootmeProvider = shootme.createProvider();
59: providerTable.put(shootmeProvider, shootme);
60: shootmeProvider.addSipListener(this );
61:
62: this .proxy = new Proxy(5070, riProtocolObjects);
63: SipProvider provider = proxy.createSipProvider();
64: //provider.setAutomaticDialogSupportEnabled(false);
65: providerTable.put(provider, proxy);
66: provider.addSipListener(this );
67:
68: tiProtocolObjects.start();
69: if (tiProtocolObjects != riProtocolObjects)
70: riProtocolObjects.start();
71: } catch (Exception ex) {
72: logger.error("Unexpected exception", ex);
73: fail("unexpected exception ");
74: }
75: }
76:
77: public void tearDown() {
78: try {
79: Thread.sleep(5000);
80: this .shootist.checkState();
81: this .shootme.checkState();
82: this .proxy.checkState();
83: tiProtocolObjects.destroy();
84: if (riProtocolObjects != tiProtocolObjects)
85: riProtocolObjects.destroy();
86: Thread.sleep(4000);
87: this .providerTable.clear();
88:
89: super .logTestCompleted();
90: } catch (Exception ex) {
91: logger.error("unexpected exception", ex);
92: fail("unexpected exception ");
93: }
94: }
95:
96: }
|