module Pione::TestHelper::TupleSpace

Public Class Methods

check_exceptions(tuple_space) click to toggle source

Check exceptions in tuple space.

# 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) click to toggle source

Create a customized tuple space.

# 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