1   package jgroup.relacs.mss;
2   
3   import java.net.InetAddress;
4   
5   import jgroup.core.ConfigManager;
6   import jgroup.relacs.config.TransportConfig;
7   import jgroup.relacs.types.EndPointImpl;
8   import junit.framework.TestCase;
9   
10  public class MssHostTest extends TestCase
11  {
12  
13    private MssHost mssHost;
14  
15    protected void setUp() throws Exception
16    {
17      super.setUp();
18      // Do init without activating the logging
19      ConfigManager.init("file:target/classes/siteconfig/partition-config.xml");
20      TransportConfig config = (TransportConfig) ConfigManager.getConfig(TransportConfig.class);
21      EndPointImpl endpoint = new EndPointImpl(InetAddress.getByName("ba3.ux.uis.no"), 2121);
22      mssHost = new MssHost(config, endpoint, null, null, null);
23    }
24  
25    /*
26     * Test method for 'jgroup.relacs.mss.MssHost.getTimeout()'
27     */
28    public final void testGetTimeout()
29    {
30      assertTrue(mssHost.getTimeout() == 56);
31    }
32  
33    /*
34     * Test method for 'jgroup.relacs.mss.MssHost.updateTimeout(int)'
35     */
36    public final void testUpdateTimeout()
37    {
38      mssHost.updateTimeout(100);
39      assertTrue(mssHost.getTimeout() == 99);
40      mssHost.updateTimeout(100);
41      assertTrue(mssHost.getTimeout() == 132);
42      mssHost.updateTimeout(100);
43      assertTrue(mssHost.getTimeout() == 156);
44      mssHost.updateTimeout(100);
45      assertTrue(mssHost.getTimeout() == 175);
46    }
47  
48  }