$:.unshift(File.dirname(__FILE__) + '/../lib') require 'test/unit' require 'luruju' require 'fileutils' class Test::Unit::TestCase if am_i_jruby? java_class_path = java.lang.System.getProperty "java.class.path" jude_product = "community-5.0.2" if java_class_path.include? "Community" jude_product = "professional-5.1" if java_class_path.include? "Professional" else jude_product = "community-5.0.2" end TEST_JUDE_DIR = File.dirname(__FILE__) + '/jude/' + jude_product include Luruju @@test_jude_model_dir = {} def self.test_jude_model_dir(dir_sym) @@test_jude_model_dir[self] = dir_sym.to_s end def setup Luruju::Configuration.install end def teardown Luruju::Configuration.install end protected def jude_api_load jude_file, options={} jude_path = "#{jude_dir}/#{jude_file}.jude" Luruju::JudeApiLoader.load jude_path, options end def jude_dir() if @@test_jude_model_dir[self.class] "#{TEST_JUDE_DIR}/#{@@test_jude_model_dir[self.class]}" else File.dirname(__FILE__) + '/jude/' end end end class Object def jude_methods self.class.ancestors.inject(self.methods) do |result,item| result -= item.methods unless item.parent == Luruju::JudeApi result end.sort end end