@@ -0,0 +1,2209 @@
+package test.nodefactory;%0A%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 */%0A%0A%0Aimport org.objectweb.proactive.core.node.NodeException;%0Aimport org.objectweb.proactive.core.node.NodeFactory;%0Aimport org.objectweb.proactive.core.node.Node;%0Aimport org.objectweb.proactive.ProActive;%0A%0A%0Apublic class TestFactoryWithRuntime%0A%7B%0A%09public static void main(String args%5B%5D) throws NodeException %7B%0A%0Aif (args.length %3C 1) %0A    %7B%0A%09System.err.println(%22Usage: java %22 + TestFactory.class.getName() + %22 node%22 );%0A%09System.exit(-1);%0A    %7D%0A%09%09Node defaultNode =null;%0A    try %7B%0A        NodeFactory.createNode(%22jini://sea.inria.fr/Node1%22);%0A        defaultNode = NodeFactory.getDefaultNode();%0A%09%09%09%09//NodeFactory.createNode(%22Node1%22);%0A    %7D catch (Exception e) %7B%0A    %09e.printStackTrace();%0A    %7D%0A    System.out.println(%22Trying to find the node%22);%0A%0A    Node node = NodeFactory.getNode(%22jini://sea.inria.fr/Node1%22);%0A    System.out.println(%22node1 url %22+ node.getNodeInformation().getURL());%0A    System.out.println(%22defaultnode url %22+ defaultNode.getNodeInformation().getURL());%0A    //System.out.println( %22The node is %22 + NodeFactory.getNode(%22//tuba/Node1%22));%0A%0A    System.out.println(%22TestFactory: Creating agent%22);%0A    // %09try %7B%0A    // %09    SimpleAgent agent = (SimpleAgent) ProActive.newActive(%22test.nodefactory.SimpleAgent%22, null);%0A    // %09    System.out.println(%22TestFactory: trying migration%22);%0A    // %09    agent.migrateTo(%22//tuba/Node2%22);%0A    // %09    agent.echo();%0A    // %09%7D catch (Exception e) %7Be.printStackTrace();%7D%0A    System.out.println(%22Trying remote creation on node //localhost/Node2%22);%0A%0A    try %7B%0A      SimpleAgent agent = (SimpleAgent)ProActive.newActive(%22test.nodefactory.SimpleAgent%22, null, node);%0A      agent.echo();%0A    %7D catch (Exception e) %7B%0A      e.printStackTrace();%0A    %7D%0A%0A    System.out.println(%22Waiting 5 seconds, then try to create a new Node%22);%0A    System.out.println(%22Should throw a NodeException%22);%0A    try %7B%0A      NodeFactory.createNode(args%5B0%5D);%0A    %7D catch (Exception e) %7B%0A      e.printStackTrace();%0A    %7D%0A%0A  %7D%0A%7D%0A

Test Factory with Runtime