1
2
3
4
5 package functional.agent.controller;
6
7 import java.net.InetAddress;
8
9 import junit.framework.TestCase;
10
11 import org.neo.swarm.ApplicationContext;
12 import org.neo.swarm.SwarmContainer;
13 import org.neo.swarm.config.DynamicConfig;
14
15 import functional.agent.MobileAgent;
16 import functional.agent.MobileAgentImpl;
17
18
19 /***
20 * Creates the initial agent instance and place it into a local container.
21 * @author navery
22 */
23 public class MobileAgentTest extends TestCase {
24 public void testDeploymentToRemoteNodes() throws Exception {
25
26 String startNode = "startNode";
27 SwarmContainer container = new DynamicConfig(startNode, InetAddress.getLocalHost(), 8081, false).setup();
28
29 container.start();
30
31 Thread.sleep(6000);
32
33 MobileAgent ai = new MobileAgentImpl();
34 ApplicationContext context = container.getAppContext(startNode);
35 context.addPreConstructedComponent("myagent", ai);
36 ai.execute();
37 Thread.sleep(1000);
38 }
39 }