]> SALOME platform Git repositories - modules/yacs.git/blob - src/yacsorb/CORBAEngineTest.py
Salome HOME
merge from branch DEV tag mergeto_trunk_04apr08
[modules/yacs.git] / src / yacsorb / CORBAEngineTest.py
1 import time
2
3 import salome
4 salome.salome_init()
5
6 import YACS_ORB
7 comp = salome.lcc.FindOrLoadComponent( "YACSContainer","YACS" )
8 yacsgen = comp._narrow(YACS_ORB.YACS_Gen)
9
10 # -----------------------------------------------------------------------------
11 # --- schema OK
12
13 procEx = yacsgen.LoadProc("samples/legendre7.xml")
14 procEx.setExecMode(YACS_ORB.CONTINUE)
15 procEx.Run()
16
17 # --- wait until executor is paused, finished or stopped
18
19 isRunning = 1
20 while isRunning:
21     time.sleep(0.5)
22     state = procEx.getExecutorState()
23     isRunning = (state < 304)
24     print "executorState: ", state
25     pass
26
27 procEx.saveState("res.xml")
28 numids,names = procEx.getIds()
29
30 dico = {}
31 i=0
32 for name in names:
33     dico[name] = numids[i]
34     i+=1
35     pass
36
37 print procEx.getOutPortValue(dico["poly_7"],"Pn")
38 print procEx.getInPortValue(dico["poly_7"],"x")
39 print procEx.getInPortValue(dico["poly_7"],"notAPort")
40 print procEx.getInPortValue(dico["Legendre.loopIter"],"nsteps")
41
42 # -----------------------------------------------------------------------------
43 # --- schema with errors (echoSrv must be launched)
44
45 procEx = yacsgen.LoadProc("samples/aschema.xml")
46 procEx.setExecMode(YACS_ORB.CONTINUE)
47 procEx.Run()
48
49 # --- wait until executor is paused, finised or stopped
50
51 isRunning = 1
52 while isRunning:
53     time.sleep(0.5)
54     state = procEx.getExecutorState()
55     isRunning = (state < 304)
56     print "executorState: ", state
57     pass
58
59 procEx.saveState("res2.xml")
60 numids,names = procEx.getIds()
61
62 dico = {}
63 i=0
64 for name in names:
65     dico[name] = numids[i]
66     i+=1
67     pass
68
69 print procEx.getErrorDetails(dico["c1"])
70 print procEx.getErrorDetails(dico["node13"])
71
72 # -----------------------------------------------------------------------------
73 # --- schema with errors
74
75 procEx = yacsgen.LoadProc("samples/triangle5error.xml")
76 procEx.setExecMode(YACS_ORB.CONTINUE)
77 procEx.setStopOnError(1,"execError2.xml")
78 #procEx.unsetStopOnError()
79 procEx.Run()
80
81 isRunning = 1
82 while isRunning:
83     time.sleep(0.5)
84     state = procEx.getExecutorState()
85     isRunning = (state < 304)
86     print "executorState: ", state
87     pass
88
89 #procEx.resumeCurrentBreakPoint()
90
91 procEx.saveState("res3.xml")
92
93 # -----------------------------------------------------------------------------
94 # --- schema with breakpoints
95
96 procEx = yacsgen.LoadProc("samples/legendre7.xml")
97 procEx.setListOfBreakPoints(["Legendre.loopIter.deuxIter.iter2"])
98 procEx.setExecMode(YACS_ORB.STOPBEFORENODES)
99 procEx.Run()
100
101 isRunning = 1
102 while isRunning:
103     time.sleep(0.5)
104     state = procEx.getExecutorState()
105     isRunning = (state < 304)
106     print "executorState: ", state
107     pass
108
109 procEx.saveState("partialExec.xml")
110
111 procEx = yacsgen.LoadProc("samples/legendre7.xml")
112 procEx.setExecMode(YACS_ORB.CONTINUE)
113 procEx.RunFromState("partialExec.xml")
114
115 isRunning = 1
116 while isRunning:
117     time.sleep(0.5)
118     state = procEx.getExecutorState()
119     isRunning = (state < 304)
120     print "executorState: ", state
121     pass
122
123 procEx.saveState("finishExec.xml")
124