Sha256: c6913d3c25257922fc7a6864de3fb46fccf32ee09438ba103956ae58305367bb

Contents?: true

Size: 1.36 KB

Versions: 1

Compression:

Stored size: 1.36 KB

Contents

# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
# License:   Apache License, Version 2.0

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), "/../../rtm-majortom/lib")
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), "/../../rtm-tmql/lib")

require 'spec'
require 'rtm/majortom'
require 'rtm/revision'

def implementation_for_spec
  ENV['RTM_IMPLEMENTATION'] && ENV['RTM_IMPLEMENTATION'].to_sym || :ontopia # if env is nil, the "normal progress will go on" # TODO: remove ontopia, as it should be chosen by connect by default
end

def get_used_tm_sys
  if implementation_for_spec == :majortom_db
    begin
      $database_params ||= YAML.load_file(File.join(File.dirname(__FILE__), "/../../rtm/spec/database_config.yml"))["database_params"]
    rescue
      raise("You need to define the database_config.yml in rtm/spec.")
    end
    connection = RTM.connect($database_params)
  else
    connection = RTM.connect(:implementation => :majortom)
  end
  return connection
end

def get_used_tm_sys_tm
  engine = get_used_tm_sys
  begin
    tm = engine.create("http://www.topicmapslab.de/")
  rescue Exception => e
    print_stack_trace(e)
    raise(e.message)
  end
  return tm
end

def print_stack_trace(e)
  puts "\nError because of:"
  puts e.message
  while e.cause
    puts "and because of:"
    e = e.cause
    puts e.message
    puts e.printStackTrace
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rtm-majortom-0.3.1-java spec/spec_helper.rb