Class: NetworkTestBed
- Inherits:
-
Object
- Object
- NetworkTestBed
- Defined in:
- lib/appswarm/test_bed.rb
Instance Method Summary collapse
- #app(appName, i) ⇒ Object
- #eachApp(appName, &block) ⇒ Object
- #first(appName) ⇒ Object
-
#initialize(count = 10) ⇒ NetworkTestBed
constructor
A new instance of NetworkTestBed.
- #length ⇒ Object
- #log(*x) ⇒ Object
- #p_eachApp(appName, &block) ⇒ Object
- #run(*klasses) ⇒ Object
- #runOnOne(*klasses) ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(count = 10) ⇒ NetworkTestBed
Returns a new instance of NetworkTestBed.
163 164 165 |
# File 'lib/appswarm/test_bed.rb', line 163 def initialize(count=10) @testbeds=(1..count).to_a.map{|i|TestBed.new} end |
Instance Method Details
#app(appName, i) ⇒ Object
183 184 185 |
# File 'lib/appswarm/test_bed.rb', line 183 def app(appName,i) @testbeds[i].getApp(appName) end |
#eachApp(appName, &block) ⇒ Object
192 193 194 |
# File 'lib/appswarm/test_bed.rb', line 192 def eachApp(appName,&block) @testbeds.each{|b|block.call(b.getApp(appName))} end |
#first(appName) ⇒ Object
199 200 201 |
# File 'lib/appswarm/test_bed.rb', line 199 def first(appName) @testbeds[0].getApp(appName) end |
#length ⇒ Object
179 180 181 |
# File 'lib/appswarm/test_bed.rb', line 179 def length @testbeds.length end |
#log(*x) ⇒ Object
187 188 189 |
# File 'lib/appswarm/test_bed.rb', line 187 def log(*x) pp x end |
#p_eachApp(appName, &block) ⇒ Object
195 196 197 |
# File 'lib/appswarm/test_bed.rb', line 195 def p_eachApp(appName,&block) @testbeds.p_each{|b|block.call(b.getApp(appName))} end |
#run(*klasses) ⇒ Object
167 168 169 170 171 |
# File 'lib/appswarm/test_bed.rb', line 167 def run(*klasses) klasses.each{|klass| @testbeds.p_each{|b|b.run(klass)} } end |
#runOnOne(*klasses) ⇒ Object
173 174 175 176 177 |
# File 'lib/appswarm/test_bed.rb', line 173 def runOnOne(*klasses) klasses.each{|klass| @testbeds[0].run(klass) } end |
#stop ⇒ Object
202 203 204 205 206 |
# File 'lib/appswarm/test_bed.rb', line 202 def stop @testbeds.p_each{|b|b.stop} killOtherThreads! end |