01: package hero.client.test;
02:
03: /*
04: *
05: * NodeTests.java -
06: * Copyright (C) 2002 Ecoo Team
07: * charoy@loria.fr
08: *
09: *
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;
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: public class TestRmi {
48:
49: public TestRmi() {
50: try {
51: UserSessionHome userh = UserSessionUtil.getHome();
52: UserSession userSession = userh.create();
53: userSession.getUser();
54: System.out.println("getUser");
55: userSession.getUserPassword();
56: System.out.println("getPassword");
57: BnUserLightValue ulv = userSession.getUserLightValue();
58: System.out.println("getUserLightValue");
59:
60: ProjectSessionHome projecth = ProjectSessionUtil.getHome();
61: String projectName = "BnProject-"
62: + System.currentTimeMillis();
63: ProjectSession projectSession = projecth.create();
64: projectSession.initProject(projectName);
65: System.out.println("initProject");
66: String node1 = projectName + "-node1-"
67: + System.currentTimeMillis();
68: projectSession.addNode(node1, Constants.Nd.AND_JOIN_NODE);
69: System.out.println("addNode");
70: String node2 = projectName + "-node2-"
71: + System.currentTimeMillis();
72: projectSession.addNode(node2, Constants.Nd.AND_JOIN_NODE);
73: System.out.println("addNode");
74: projectSession.addEdge(node1, node2);
75: System.out.println("addEdge");
76: userSession.startActivity(projectName, node1);
77: System.out.println("startActivity");
78:
79: } catch (Exception e) {
80: e.printStackTrace();
81: }
82: }
83:
84: static public void main(String[] args) {
85: try {
86: char[] password = { 't', 'o', 't', 'o' };
87: SimpleCallbackHandler handler = new SimpleCallbackHandler(
88: "admin", password);
89: LoginContext lc = new LoginContext("TestClient", handler);
90: lc.login();
91: TestRmi tr = new TestRmi();
92: } catch (Exception e) {
93: e.printStackTrace();
94: }
95:
96: }
97: }
|