1   /*
2    * Created on Mar 16, 2004
3    *
4    * To change the template for this generated file go to
5    * Window>Preferences>Java>Code Generation>Code and Comments
6    */
7   package functional.dumchat;
8   
9   import java.net.InetAddress;
10  
11  import org.neo.swarm.SwarmContainer;
12  import org.neo.swarm.config.JMXConfig;
13  
14  import junit.framework.TestCase;
15  
16  /***
17   * This object does..
18   *  @author navery
19   */
20  public class ViewJMXConsole extends TestCase {
21      static int time = 3  * 1000;
22      
23  	public static void main(String[] args) {
24  		
25  		try {
26  		new ViewJMXConsole().doStuff(time);
27  		} catch (Exception e) {
28  			e.printStackTrace();
29  		}
30  	}
31  
32  	public void testStuff() throws Exception {
33  		doStuff(time);
34  	}
35  	private void doStuff(int time) throws Exception {
36  		
37  		try {
38  			SwarmContainer silc1 = new JMXConfig("swarm1", InetAddress.getLocalHost(), 8081, 8090, true).setup();
39  			SwarmContainer silc2 = new JMXConfig("swarm2", InetAddress.getLocalHost(), 8080, 8091, true).setup();			
40  		
41  			silc1.getAppContext("ac").addComponent("userFred", DumUser.class, new Object[]{"userFred"});
42  			silc1.getAppContext("ac").addComponent("userBloggs", DumUser.class, new Object[]{"userBloggs"});
43  			silc1.start();
44  			silc2.start();
45  			silc1.getComponent("userFred");
46  			silc1.getComponent("userBloggs");
47  			Thread.sleep(time);
48  			silc1.stop();
49  			silc2.stop();
50  
51  		} catch (Exception e) {
52  			e.printStackTrace();
53  			throw e;
54  		}
55  	}
56  }