Module: Pione::TestHelper::TupleSpace

Defined in:
lib/pione/test-helper/tuple-space-helper.rb

Class Method Summary collapse

Class Method Details

.check_exceptions(tuple_space) ⇒ Object

Check exceptions in tuple space.



19
20
21
22
23
24
25
26
27
28
# File 'lib/pione/test-helper/tuple-space-helper.rb', line 19

def self.check_exceptions(tuple_space)
  exceptions = tuple_space.read_all(Pione::TupleSpace::ExceptionTuple.any)
  exceptions.each do |tuple|
    e = tuple.value
    Bacon::ErrorLog << "#{e.class}: #{e.message}\n"
    e.backtrace.each_with_index { |line, i| Bacon::ErrorLog << "\t#{line}\n" }
    Bacon::ErrorLog << "\n"
  end
  exceptions.should.be.empty
end

.create(context = nil) ⇒ Object

Create a customized tuple space.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/pione/test-helper/tuple-space-helper.rb', line 5

def self.create(context=nil)
  # make drb server and it's connection
  tuple_space = Pione::TupleSpace::TupleSpaceServer.new({}, false)

  # base location
  base_location = Pione::Location[Temppath.create]
  tuple_space.write(Pione::TupleSpace::BaseLocationTuple.new(base_location))

  context.set_tuple_space(tuple_space) if context

  return tuple_space
end