KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hero > client > test > TestRmi


1 package hero.client.test;
2
3 /*
4 *
5 * NodeTests.java -
6 * Copyright (C) 2002 Ecoo Team
7 * charoy@loria.fr
8 *
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 */

24
25 import hero.interfaces.BnUserLightValue;
26 import hero.interfaces.Constants;
27 import hero.interfaces.ProjectSession;
28 import hero.interfaces.ProjectSessionHome;
29 import hero.interfaces.ProjectSessionUtil;
30 import hero.interfaces.UserSession;
31 import hero.interfaces.UserSessionHome;
32 import hero.interfaces.UserSessionUtil;
33
34 import javax.security.auth.login.LoginContext JavaDoc;
35
36 /*
37   UserSession.getName();
38   UserSession.getPassword();
39   UserSession.getUserLightValue();
40   ProjectSession.initProject();
41   ProjectSession.addNode();
42   ProjectSession.addNode();
43   ProjectSession.addEdge();
44   UserSession.startActivity();
45 */

46
47
48 public class TestRmi {
49
50     public TestRmi() {
51     try{
52         UserSessionHome userh=UserSessionUtil.getHome();
53         UserSession userSession = userh.create();
54         userSession.getUser();
55         System.out.println("getUser");
56         userSession.getUserPassword();
57         System.out.println("getPassword");
58         BnUserLightValue ulv = userSession.getUserLightValue();
59         System.out.println("getUserLightValue");
60         
61         ProjectSessionHome projecth=ProjectSessionUtil.getHome();
62         String JavaDoc projectName= "BnProject-"+System.currentTimeMillis();
63         ProjectSession projectSession = projecth.create();
64         projectSession.initProject(projectName);
65         System.out.println("initProject");
66             String JavaDoc node1=projectName+"-node1-"+System.currentTimeMillis();
67         projectSession.addNode(node1,Constants.Nd.AND_JOIN_NODE);
68         System.out.println("addNode");
69             String JavaDoc node2=projectName+"-node2-"+System.currentTimeMillis();
70         projectSession.addNode(node2,Constants.Nd.AND_JOIN_NODE);
71         System.out.println("addNode");
72         projectSession.addEdge(node1,node2);
73         System.out.println("addEdge");
74         userSession.startActivity(projectName,node1);
75         System.out.println("startActivity");
76         
77
78     }catch(Exception JavaDoc e){e.printStackTrace();}
79     }
80     
81     
82     static public void main(String JavaDoc[] args)
83     {
84     try{
85         char[] password={'t','o','t','o'};
86         SimpleCallbackHandler handler = new SimpleCallbackHandler("admin",password);
87         LoginContext JavaDoc lc = new LoginContext JavaDoc("TestClient", handler);
88         lc.login();
89         TestRmi tr = new TestRmi();
90     }catch(Exception JavaDoc e){e.printStackTrace();}
91     
92     }
93 }
94
Popular Tags