@@ -0,0 +1,2414 @@
+package test.getactiveobjects;%0A%0Aimport org.objectweb.proactive.core.node.Node;%0Aimport org.objectweb.proactive.core.node.NodeFactory;%0Aimport test.getactiveobjects.Agent;%0A%0A/**%0A * @author rquilici%0A *%0A * To change this generated comment edit the template variable %22typecomment%22:%0A * Window%3EPreferences%3EJava%3ETemplates.%0A * To enable and disable the creation of type comments go to%0A * Window%3EPreferences%3EJava%3ECode Generation.%0A */%0Apublic class Test%0A%7B%0A%0A%09public static void main(String%5B%5D args)%0A%09%7B try%7B%0A%09%09//first launch the node on sea...%0A%09%09Node node1 = NodeFactory.createNode(%22//palliata/bob%22);%0A%09%09Node node2 = NodeFactory.getNode(%22//sea.inria.fr/tata%22);%0A%09%09Node node3 = NodeFactory.createNode(%22//palliata/kit%22);%0A%09%09%0A%09%09//create two active Agent of different type.%0A%09%09Agent agent = (Agent)org.objectweb.proactive.ProActive.newActive(Agent.class.getName(), new Object%5B%5D%7B%22local%22%7D, node1);%0A%09%09org.objectweb.proactive.examples.migration.Agent agent5 = (org.objectweb.proactive.examples.migration.Agent)org.objectweb.proactive.ProActive.newActive(org.objectweb.proactive.examples.migration.Agent.class.getName(), new Object%5B%5D%7B%22local%22%7D, node1);%0A%09%09%0A%09%09//call method on this agent%0A%09%09System.out.println(%22hostname: %22+ agent.getName());%0A%09%09System.out.println(%22nodename: %22+ agent.getNodeName());%0A%09%09agent.setMyName(%22toto%22);%0A%09%09System.out.println(%22myname: %22+ agent.getMyName());%0A%09%09agent.moveTo(%22//sea.inria.fr/tata%22);%0A%09%09Thread.sleep(5000);%0A%09%09node1.getActiveObjects();%0A%09%09//call getActiveObject method%0A%09%09Agent agent2 = (Agent)((node2.getActiveObject(%22test.getactiveobjects.Agent%22))%5B0%5D);%0A%09%09System.out.println(%22hostname: %22+ agent2.getName());%0A%09%09System.out.println(%22nodename: %22+ agent2.getNodeName());%0A%09%09System.out.println(%22myname: %22+ agent2.getMyName());%0A%09%09agent.setMyName(%22titi%22);%0A%09%09agent.moveTo(%22//palliata/kit%22);%0A%09%09Thread.sleep(10000);%0A%09%09%0A%09%09%0A%09%09%0A%09%09Agent agent3 = (Agent)((node3.getActiveObjects())%5B0%5D);%0A%09%09System.out.println(%22hostname: %22+ agent3.getName());%0A%09%09System.out.println(%22nodename: %22+ agent3.getNodeName());%0A%09%09System.out.println(%22myname: %22+ agent3.getMyName());%0A%09%09%0A%09%09//following lines are useful to activate tensionning after body migration%0A%09%09agent.setMyName(%22roqui%22);%0A%09%09System.out.println(%22myname: %22+agent3.getMyName());%0A%09%09System.out.println(%22myname: %22+agent2.getMyName());%0A%09%09System.out.println(%22myname: %22+agent.getMyName());%0A%09%09%0A%09%09//should throw an exception%0A%09%09node2.getActiveObjects();%0A%09%09%7Dcatch(Exception e)%7B%0A%09%09%09e.printStackTrace();%0A%09%7D%0A%09%7D%0A%7D%0A

Test getActiveObjects methods