iotas 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog +4 -9
- data/Gemfile.lock +1 -1
- data/README.md +4 -14
- data/iotas.gemspec +1 -1
- data/lib/version.rb +1 -1
- metadata +4 -30
- data/lib/iotas.rb +0 -51
- data/lib/iotas/board.rb +0 -69
- data/lib/iotas/door.rb +0 -93
- data/lib/iotas/iota.rb +0 -67
- data/lib/iotas/link.rb +0 -70
- data/lib/iotas/particle.rb +0 -226
- data/lib/iotas/room.rb +0 -192
- data/lib/iotas/spin.rb +0 -159
- data/spec/board_spec.rb +0 -95
- data/spec/door_spec.rb +0 -98
- data/spec/link_spec.rb +0 -38
- data/spec/particle_spec.rb +0 -257
- data/spec/room_spec.rb +0 -303
- data/spec/spec_helper.rb +0 -38
- data/spec/spin_spec.rb +0 -129
- data/spec/spot_spec.rb +0 -26
- data/test/test_iotas.rb +0 -168
data/spec/room_spec.rb
DELETED
@@ -1,303 +0,0 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
|
-
# -*- coding: UTF-8 -*-
|
3
|
-
#
|
4
|
-
|
5
|
-
require 'spec_helper'
|
6
|
-
#
|
7
|
-
describe Iotas::Room do
|
8
|
-
#
|
9
|
-
before (:all) do
|
10
|
-
@spin = Iotas::Spin.new 'dom0'
|
11
|
-
end
|
12
|
-
#
|
13
|
-
before(:each) do
|
14
|
-
@spin.clear!
|
15
|
-
end
|
16
|
-
#
|
17
|
-
it "add_iota and add_link correctly" do
|
18
|
-
r0 = Iotas::Room.new 'room0', @spin
|
19
|
-
d0 = Iotas::Door.new 'door0', r0
|
20
|
-
lambda { Iotas::Door.new('door0', r0) }.should raise_error(Iotas::Exception)
|
21
|
-
lambda { r0.add_iota Iotas::Door.new('door1', r0) }.should raise_error(Iotas::Exception)
|
22
|
-
r0.add_link Iotas::Link.new 'door0', 'somewhere'
|
23
|
-
lambda { r0.add_link(Iotas::Link.new('nowhere', 'somewhere')) }.should raise_error(Iotas::Exception)
|
24
|
-
end
|
25
|
-
#
|
26
|
-
it "start! and stop! should work" do
|
27
|
-
r0 = Iotas::Room.new 'room0', @spin
|
28
|
-
d0 = Fake.new 'fake', r0
|
29
|
-
d0.start.should be_nil
|
30
|
-
d0.stop.should be_nil
|
31
|
-
r0.start!
|
32
|
-
d0.start.should be_true
|
33
|
-
d0.stop.should be_nil
|
34
|
-
r0.stop!
|
35
|
-
d0.start.should be_true
|
36
|
-
d0.stop.should be_true
|
37
|
-
end
|
38
|
-
#
|
39
|
-
it "parent, spin and search_down should be ok" do
|
40
|
-
r0 = Iotas::Room.new 'r0', @spin
|
41
|
-
r1 = Iotas::Room.new 'r1', r0
|
42
|
-
r2 = Iotas::Room.new 'r2', r1
|
43
|
-
r3 = Iotas::Room.new 'r3', @spin
|
44
|
-
r4 = Iotas::Room.new 'r4', r3
|
45
|
-
r2.parent.should be r1
|
46
|
-
r1.parent.should be r0
|
47
|
-
r0.parent.should be @spin
|
48
|
-
r0.spin.should be @spin
|
49
|
-
r1.spin.should be @spin
|
50
|
-
r2.spin.should be @spin
|
51
|
-
r3.spin.should be @spin
|
52
|
-
@spin.search_down('dom0/r0/r1/r2').should be r2
|
53
|
-
r0.search_down('dom0/r0/r1/r2').should be r2
|
54
|
-
r1.search_down('dom0/r0/r1/r2').should be r2
|
55
|
-
r2.search_down('dom0/r0/r1/r2').should be r2
|
56
|
-
r1.search_down('dom0/r0/r1/r9').should be nil
|
57
|
-
r3.search_down('dom0/r0/r1/r2').should be nil
|
58
|
-
r4.search_down('dom0/r0/r1/r2').should be nil
|
59
|
-
end
|
60
|
-
#
|
61
|
-
it "routing success (direct add_dst)" do
|
62
|
-
room0 = Iotas::Room.new 'room0', @spin
|
63
|
-
door0 = Iotas::Door.new 'door0', room0
|
64
|
-
p = @spin.require_p Iotas::Particle
|
65
|
-
p.init! Fake.new( 'fake', @spin)
|
66
|
-
p.add_dst 'get', 'door0'
|
67
|
-
room0.send_p p
|
68
|
-
p.action.should eql 'get'
|
69
|
-
p.dst.should be door0
|
70
|
-
end
|
71
|
-
#
|
72
|
-
it "routing success (direct send)" do
|
73
|
-
room0 = Iotas::Room.new 'room0', @spin
|
74
|
-
door0 = Iotas::Door.new 'door0', room0
|
75
|
-
p = @spin.require_p Iotas::Particle
|
76
|
-
p.init! Fake.new( 'fake', @spin)
|
77
|
-
door0.send_p p, 'get'
|
78
|
-
p.action.should eql 'get'
|
79
|
-
p.dst.should be door0
|
80
|
-
end
|
81
|
-
#
|
82
|
-
it "routing success through Spin@world" do
|
83
|
-
room0 = Iotas::Room.new 'room0', @spin
|
84
|
-
room1 = Iotas::Room.new 'room1', room0
|
85
|
-
door0 = Iotas::Door.new 'door0', room1
|
86
|
-
p = @spin.require_p Iotas::Particle
|
87
|
-
p.init! Fake.new('fake', @spin)
|
88
|
-
p.add_dst 'get', 'dom0/room0/room1/door0'
|
89
|
-
room0.send_p p
|
90
|
-
p.action.should eql 'get'
|
91
|
-
p.dst.should be door0
|
92
|
-
end
|
93
|
-
#
|
94
|
-
it "route error: no source" do
|
95
|
-
room = Iotas::Room.new 'room', @spin
|
96
|
-
p = @spin.require_p Iotas::Particle
|
97
|
-
p.add_dst 'get', 'room/door'
|
98
|
-
room.send_p p
|
99
|
-
p.action.should eql Iotas::ACT_ERROR
|
100
|
-
p[Iotas::FIELD_ERROR_MSG].should eql Iotas::ERROR_ROUTE_NS
|
101
|
-
p.dst.should be room.spin
|
102
|
-
end
|
103
|
-
#
|
104
|
-
it "route error: no destination no links" do
|
105
|
-
room = Iotas::Room.new 'room', @spin
|
106
|
-
p = @spin.require_p Iotas::Particle
|
107
|
-
p.init! Fake.new('fake', @spin)
|
108
|
-
room.send_p p
|
109
|
-
p.action.should eql Iotas::ACT_ERROR
|
110
|
-
p[Iotas::FIELD_ERROR_MSG].should eql Iotas::ERROR_ROUTE_NDNL
|
111
|
-
p.dst.should be p.src
|
112
|
-
end
|
113
|
-
#
|
114
|
-
it "route error: no rooom, wrong door -> right room wrong door" do
|
115
|
-
room0 = Iotas::Room.new 'room0', @spin
|
116
|
-
p = @spin.require_p Iotas::Particle
|
117
|
-
p.init! Fake.new('fake', @spin)
|
118
|
-
p.add_dst 'get', 'nodoor'
|
119
|
-
room0.send_p p
|
120
|
-
p.action.should eql Iotas::ACT_ERROR
|
121
|
-
p[Iotas::FIELD_ERROR_MSG].should eql Iotas::ERROR_ROUTE_RRWD
|
122
|
-
p.dst.should be p.src
|
123
|
-
end
|
124
|
-
#
|
125
|
-
it "route error: right rooom, wrong door -> right room wrong door" do
|
126
|
-
room0 = Iotas::Room.new 'room0', @spin
|
127
|
-
p = @spin.require_p Iotas::Particle
|
128
|
-
p.init! Fake.new('fake', @spin)
|
129
|
-
p.add_dst 'get', 'dom0/room0/nodoor'
|
130
|
-
room0.send_p p
|
131
|
-
p.action.should eql Iotas::ACT_ERROR
|
132
|
-
p[Iotas::FIELD_ERROR_MSG].should eql Iotas::ERROR_ROUTE_RRWD
|
133
|
-
p.dst.should be p.src
|
134
|
-
end
|
135
|
-
#
|
136
|
-
it "route error: right room, wrong door through Spin@world -> does not exists" do
|
137
|
-
room0 = Iotas::Room.new 'room0', @spin
|
138
|
-
room1 = Iotas::Room.new 'room1', room0
|
139
|
-
p = @spin.require_p Iotas::Particle
|
140
|
-
p.init! Fake.new('fake', room0)
|
141
|
-
p.add_dst 'get', 'dom0/room0/nodoor'
|
142
|
-
room1.send_p p
|
143
|
-
p.action.should eql Iotas::ACT_ERROR
|
144
|
-
p[Iotas::FIELD_ERROR_MSG].should eql Iotas::ERROR_ROUTE_DNE
|
145
|
-
p.dst.should be p.src
|
146
|
-
end
|
147
|
-
#
|
148
|
-
it "route error: wrong room, right door through Spin@world -> does not exists" do
|
149
|
-
room0 = Iotas::Room.new 'room0', @spin
|
150
|
-
room1 = Iotas::Room.new 'room1', room0
|
151
|
-
p = @spin.require_p Iotas::Particle
|
152
|
-
p.init! Fake.new('fake', @spin)
|
153
|
-
p.add_dst 'get', 'dom0/noroom/fake'
|
154
|
-
room1.send_p p
|
155
|
-
p.action.should eql Iotas::ACT_ERROR
|
156
|
-
p[Iotas::FIELD_ERROR_MSG].should eql Iotas::ERROR_ROUTE_DNE
|
157
|
-
p.dst.should be p.src
|
158
|
-
end
|
159
|
-
#
|
160
|
-
it "routing ~failure: no door name -> src" do
|
161
|
-
room0 = Iotas::Room.new 'room0', @spin
|
162
|
-
door0 = Iotas::Door.new 'door0', room0
|
163
|
-
p = @spin.require_p Iotas::Particle
|
164
|
-
p.init! door0
|
165
|
-
p.add_dst 'get'
|
166
|
-
room0.send_p p
|
167
|
-
p.action.should eql 'get'
|
168
|
-
p.dst.should be door0
|
169
|
-
end
|
170
|
-
#
|
171
|
-
it "routing success: unconditional link" do
|
172
|
-
room0 = Iotas::Room.new 'room0', @spin
|
173
|
-
door0 = Iotas::Door.new 'door0', room0
|
174
|
-
door1 = Iotas::Door.new 'door1', room0
|
175
|
-
room0.add_link Iotas::Link.new('door0', 'door1')
|
176
|
-
p = @spin.require_p Iotas::Particle
|
177
|
-
door0.send_p p
|
178
|
-
p.action.should be_nil
|
179
|
-
p.dst.should be door1
|
180
|
-
end
|
181
|
-
#
|
182
|
-
it "routing success: conditional link" do
|
183
|
-
room0 = Iotas::Room.new 'room0', @spin
|
184
|
-
door0 = Iotas::Door.new 'door0', room0
|
185
|
-
door1 = Iotas::Door.new 'door1', room0
|
186
|
-
room0.add_link Iotas::Link.new('door0', 'door1', 'fields', 'f0,f1', 'v0v1')
|
187
|
-
p = @spin.require_p Iotas::Particle
|
188
|
-
p['f0']='v0'
|
189
|
-
p['f1']='v1'
|
190
|
-
door0.send_p p
|
191
|
-
p.action.should be_nil
|
192
|
-
p.src.should be door0
|
193
|
-
p.dst.should be door1
|
194
|
-
end
|
195
|
-
#
|
196
|
-
it "routing success: more then one matching link" do
|
197
|
-
room0 = Iotas::Room.new 'room0', @spin
|
198
|
-
door0 = Iotas::Door.new 'door0', room0
|
199
|
-
class Out < Iotas::Door
|
200
|
-
attr_reader :ps
|
201
|
-
def receive_p p
|
202
|
-
@ps||=[]
|
203
|
-
@ps << p
|
204
|
-
end
|
205
|
-
end
|
206
|
-
door1 = Out.new 'door1', room0
|
207
|
-
room0.add_link Iotas::Link.new('door0', 'door1')
|
208
|
-
room0.add_link Iotas::Link.new('door0', 'door1', 'fields', 'f0,f1', 'v0v1')
|
209
|
-
p = @spin.require_p Iotas::Particle
|
210
|
-
p['f0']='v0'
|
211
|
-
p['f1']='v1'
|
212
|
-
door0.send_p p
|
213
|
-
@spin.spin!
|
214
|
-
door1.ps.length.should eql 2
|
215
|
-
p0 = door1.ps[0]
|
216
|
-
p0.action.should be_nil
|
217
|
-
p0.src.should be door0
|
218
|
-
p0.dst.should be_nil
|
219
|
-
p1 = door1.ps[1]
|
220
|
-
p1.action.should be_nil
|
221
|
-
p1.src.should be door0
|
222
|
-
p1.dst.should be_nil
|
223
|
-
p1.should be p
|
224
|
-
end
|
225
|
-
#
|
226
|
-
it "system route error: system no destination" do
|
227
|
-
room0 = Iotas::Room.new 'room0', @spin
|
228
|
-
p = @spin.require_p Iotas::Particle
|
229
|
-
room0.send_sys_p p
|
230
|
-
p.action.should eql Iotas::ACT_ERROR
|
231
|
-
p[Iotas::FIELD_ERROR_MSG].should eql Iotas::ERROR_ROUTE_SND
|
232
|
-
end
|
233
|
-
#
|
234
|
-
it "system routing success: action only" do
|
235
|
-
room0 = Iotas::Room.new 'room0', @spin
|
236
|
-
p = @spin.require_p Iotas::Particle
|
237
|
-
p.add_dst Iotas::SYS_ACT_ADD_LINK
|
238
|
-
room0.send_sys_p p
|
239
|
-
p.action.should eql Iotas::SYS_ACT_ADD_LINK
|
240
|
-
p.dst.should be room0.spin
|
241
|
-
end
|
242
|
-
#
|
243
|
-
it "system routing success (add_dst)" do
|
244
|
-
room0 = Iotas::Room.new 'room0', @spin
|
245
|
-
door0 = Iotas::Door.new 'door0', room0
|
246
|
-
p = @spin.require_p Iotas::Particle
|
247
|
-
p.add_dst Iotas::SYS_ACT_ADD_LINK, 'dom0/room0/door0'
|
248
|
-
room0.send_sys_p p
|
249
|
-
p.action.should eql Iotas::SYS_ACT_ADD_LINK
|
250
|
-
p.dst.should be door0
|
251
|
-
end
|
252
|
-
#
|
253
|
-
it "system routing success (send_sys_p)" do
|
254
|
-
room0 = Iotas::Room.new 'room0', @spin
|
255
|
-
door0 = Iotas::Door.new 'door0', room0
|
256
|
-
p = @spin.require_p Iotas::Particle
|
257
|
-
door0.send_sys_p p, Iotas::SYS_ACT_ADD_LINK
|
258
|
-
p.action.should eql Iotas::SYS_ACT_ADD_LINK
|
259
|
-
p.dst.should be door0
|
260
|
-
end
|
261
|
-
#
|
262
|
-
it "SYS_ACT_ADD_LINK" do
|
263
|
-
room0 = Iotas::Room.new 'room0', @spin
|
264
|
-
door0 = Iotas::Door.new 'door0', room0
|
265
|
-
door1 = Iotas::Door.new 'door1', room0
|
266
|
-
p0 = @spin.require_p Iotas::Particle
|
267
|
-
p0.set_data Iotas::LNK_SRC, 'door0'
|
268
|
-
p0.set_data Iotas::LNK_DSTS, 'door1'
|
269
|
-
p0.set_data Iotas::LNK_FIELDS, 'fields'
|
270
|
-
p0.set_data Iotas::LNK_CONDF, 'f0,f1'
|
271
|
-
p0.set_data Iotas::LNK_CONDV, 'v0v1'
|
272
|
-
p0.add_dst Iotas::SYS_ACT_ADD_LINK, room0.path
|
273
|
-
room0.send_sys_p p0
|
274
|
-
@spin.spin!
|
275
|
-
p = @spin.require_p Iotas::Particle
|
276
|
-
p['f0']='v0'
|
277
|
-
p['f1']='v1'
|
278
|
-
door0.send_p p
|
279
|
-
p.action.should be_nil
|
280
|
-
p.src.should be door0
|
281
|
-
p.dst.should be door1
|
282
|
-
end
|
283
|
-
#
|
284
|
-
it "room->json->room" do
|
285
|
-
r0 = Iotas::Room.new 'r0', @spin
|
286
|
-
r1 = Iotas::Room.new 'r1', r0
|
287
|
-
r2 = Iotas::Room.new 'r2', r1
|
288
|
-
r3 = Iotas::Room.new 'r3', r1
|
289
|
-
r4 = Iotas::Room.new 'r4', r3
|
290
|
-
d0 = Iotas::Door.new 'd0', r1
|
291
|
-
d1 = Iotas::Door.new 'd1', r1
|
292
|
-
d2 = Iotas::Door.new 'd2', r2
|
293
|
-
r1.add_link Iotas::Link.new('d0', 'd1', 'fields', 'f0,f1', 'v0v1')
|
294
|
-
r1.add_link Iotas::Link.new('d0', 'd2')
|
295
|
-
r1.add_link Iotas::Link.new('d1', 'd0')
|
296
|
-
r2.add_link Iotas::Link.new('d2', 'd1', 'fies', 'f5,f1', 'v9v1')
|
297
|
-
rx = Iotas::Room.json_create( JSON.load( JSON.generate(r0) ) )
|
298
|
-
JSON.generate(r0).should eql JSON.generate(rx)
|
299
|
-
end#
|
300
|
-
#
|
301
|
-
end
|
302
|
-
#
|
303
|
-
# EOF
|
data/spec/spec_helper.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
|
-
# -*- coding: UTF-8 -*-
|
3
|
-
#
|
4
|
-
begin
|
5
|
-
require 'simplecov'
|
6
|
-
SimpleCov.start do
|
7
|
-
add_filter 'spec'
|
8
|
-
end
|
9
|
-
rescue LoadError
|
10
|
-
end
|
11
|
-
#
|
12
|
-
require 'iotas'
|
13
|
-
#
|
14
|
-
class Fake < Iotas::Iota
|
15
|
-
attr_reader :p, :sp, :start, :stop
|
16
|
-
def process_p p
|
17
|
-
@p = p
|
18
|
-
end
|
19
|
-
def process_sys_p p
|
20
|
-
@sp = p
|
21
|
-
end
|
22
|
-
def send_p p
|
23
|
-
@p = p
|
24
|
-
end
|
25
|
-
def send_sys_p p
|
26
|
-
@sp = p
|
27
|
-
end
|
28
|
-
def add_iota p
|
29
|
-
end
|
30
|
-
def start!
|
31
|
-
@start=true
|
32
|
-
end
|
33
|
-
def stop!
|
34
|
-
@stop=true
|
35
|
-
end
|
36
|
-
end
|
37
|
-
#
|
38
|
-
# EOF
|
data/spec/spin_spec.rb
DELETED
@@ -1,129 +0,0 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
|
-
# -*- coding: UTF-8 -*-
|
3
|
-
#
|
4
|
-
|
5
|
-
require 'spec_helper'
|
6
|
-
#
|
7
|
-
describe Iotas::Spin do
|
8
|
-
#
|
9
|
-
class MyP < Iotas::Particle; end
|
10
|
-
#
|
11
|
-
it "Particles pool" do
|
12
|
-
spin = Iotas::Spin.new 'dom0'
|
13
|
-
p0 = spin.require_p Iotas::Particle
|
14
|
-
p1 = spin.require_p Iotas::Particle
|
15
|
-
(p0===p1).should be_false
|
16
|
-
spin.release_p p0
|
17
|
-
p2 = spin.require_p Iotas::Particle
|
18
|
-
(p0===p2).should be_true
|
19
|
-
end
|
20
|
-
#
|
21
|
-
it "different Particles classes in pool" do
|
22
|
-
spin = Iotas::Spin.new 'dom0'
|
23
|
-
p0 = spin.require_p Iotas::Particle
|
24
|
-
p1 = spin.require_p Iotas::Particle
|
25
|
-
(p0===p1).should be_false
|
26
|
-
spin.release_p p0
|
27
|
-
p2 = spin.require_p MyP
|
28
|
-
p3 = spin.require_p MyP
|
29
|
-
(p2===p3).should be_false
|
30
|
-
spin.release_p p2
|
31
|
-
p4 = spin.require_p MyP
|
32
|
-
(p2===p4).should be_true
|
33
|
-
end
|
34
|
-
#
|
35
|
-
it "release of merged particles" do
|
36
|
-
spin = Iotas::Spin.new 'dom0'
|
37
|
-
p0 = spin.require_p Iotas::Particle
|
38
|
-
p1 = spin.require_p Iotas::Particle
|
39
|
-
(p0===p1).should be_false
|
40
|
-
p0.merge! p1
|
41
|
-
spin.release_p p0
|
42
|
-
p2 = spin.require_p Iotas::Particle
|
43
|
-
(p2===p0).should be_true
|
44
|
-
p3 = spin.require_p Iotas::Particle
|
45
|
-
(p3===p1).should be_true
|
46
|
-
end
|
47
|
-
#
|
48
|
-
it "clear!" do
|
49
|
-
spin = Iotas::Spin.new 'dom0'
|
50
|
-
p0 = spin.require_p Iotas::Particle
|
51
|
-
p1 = spin.require_p Iotas::Particle
|
52
|
-
spin.send_p p0
|
53
|
-
spin.release_p p1
|
54
|
-
spin.clear!
|
55
|
-
p2 = spin.require_p Iotas::Particle
|
56
|
-
(p2==p0).should be_false
|
57
|
-
(p2==p1).should be_false
|
58
|
-
end
|
59
|
-
#
|
60
|
-
it "post_p post_sys_p spin!" do
|
61
|
-
spin = Iotas::Spin.new 'dom0'
|
62
|
-
f = Fake.new 'fake', spin
|
63
|
-
p0 = spin.require_p Iotas::Particle
|
64
|
-
p0.dst_routed! f
|
65
|
-
p1 = spin.require_p Iotas::Particle
|
66
|
-
p1.dst_routed! f
|
67
|
-
spin.post_p p0
|
68
|
-
spin.post_sys_p p1
|
69
|
-
spin.run = true
|
70
|
-
spin.spin!
|
71
|
-
f.p.should be p0
|
72
|
-
f.sp.should be p1
|
73
|
-
spin.stop!
|
74
|
-
end
|
75
|
-
#
|
76
|
-
it "process_sys" do
|
77
|
-
spin = Iotas::Spin.new 'dom0'
|
78
|
-
p0 = spin.require_p Iotas::Particle
|
79
|
-
p0.add_dst 'unknown'
|
80
|
-
spin.send_sys_p p0
|
81
|
-
spin.spin!
|
82
|
-
p1 = spin.require_p Iotas::Particle
|
83
|
-
p0.should be p0
|
84
|
-
end
|
85
|
-
#
|
86
|
-
it "option debug" do
|
87
|
-
spin = Iotas::Spin.new 'dom0'
|
88
|
-
spin.debug_routing.should be false
|
89
|
-
spin.debug_errors.should be false
|
90
|
-
spin = Iotas::Spin.new 'dom0', :debug_routing=>true, :debug_errors=>true
|
91
|
-
spin.debug_routing.should be true
|
92
|
-
spin.debug_errors.should be true
|
93
|
-
end
|
94
|
-
#
|
95
|
-
it "spin->json->spin" do
|
96
|
-
spin = Iotas::Spin.new 'dom0', :debug_routing=>true
|
97
|
-
r0 = Iotas::Room.new 'r0', spin
|
98
|
-
r1 = Iotas::Room.new 'r1', r0
|
99
|
-
r2 = Iotas::Room.new 'r2', r1
|
100
|
-
r3 = Iotas::Room.new 'r3', r1
|
101
|
-
r4 = Iotas::Room.new 'r4', r3
|
102
|
-
d0 = Iotas::Door.new 'd0', r1
|
103
|
-
d1 = Iotas::Door.new 'd1', r1
|
104
|
-
d2 = Iotas::Door.new 'd2', r2
|
105
|
-
p0 = spin.require_p Iotas::Particle
|
106
|
-
p1 = spin.require_p Iotas::Particle
|
107
|
-
p2 = spin.require_p Iotas::Particle
|
108
|
-
spin.post_p p0
|
109
|
-
spin.post_p p1
|
110
|
-
spin.post_sys_p p2
|
111
|
-
json = JSON.generate spin
|
112
|
-
dom0 = Iotas::Spin.json_create( JSON.load( json ) )
|
113
|
-
json.should eql JSON.generate(dom0)
|
114
|
-
end
|
115
|
-
#
|
116
|
-
it "hibernate! resume!" do
|
117
|
-
spin = Iotas::Spin.new 'dom0'
|
118
|
-
p0 = spin.require_p Iotas::Particle
|
119
|
-
p0.add_dst Iotas::SYS_ACT_HIBERNATE
|
120
|
-
spin.send_sys_p p0
|
121
|
-
spin.spin!
|
122
|
-
dom0 = Iotas::Spin.resume! spin.hibernate_path
|
123
|
-
dom0.name.should eql spin.name
|
124
|
-
File.unlink dom0.hibernate_path
|
125
|
-
end
|
126
|
-
#
|
127
|
-
end
|
128
|
-
#
|
129
|
-
#EOF
|