/vendor/plugins/active_rdf/activerdf-redland/test/test_redland_adapter.rb
Ruby | 80 lines | 30 code | 13 blank | 37 comment | 0 complexity | 033ea5fce9f7209a2175059a45c924b3 MD5 | raw file
Possible License(s): MIT, BSD-3-Clause, LGPL-2.1, CC-BY-SA-3.0
- # Author:: Eyal Oren
- # Copyright:: (c) 2005-2006
- # License:: LGPL
- require 'test/unit'
- require 'tmpdir'
- require 'fileutils'
- common_test_dir = File.dirname(File.expand_path(__FILE__)) + '/../../test'
- require "#{common_test_dir}/adapters/test_writable_adapter"
- require "#{common_test_dir}/adapters/test_persistent_adapter"
- require "#{common_test_dir}/adapters/test_network_aware_adapter"
- module TestRedlandAdapter
- include TestWritableAdapter
- include TestNetworkAwareAdapter
- def test_sparql_query
- @adapter.add(@@eyal, @@age, @@ageval)
- @adapter.flush
- query = Query.new.distinct(:s).where(:s,:p,:o)
- sparql_query = @adapter.get_query_results(query)
- assert sparql_query.include?(TEST::eyal.uri)
- end
- end
- class TestRedlandAdapterMemory < Test::Unit::TestCase
- include TestRedlandAdapter
- # not persistent
- def setup
- super(:type => :redland, :location => "memory")
- end
- end
- #class TestRedlandAdapterFile < Test::Unit::TestCase
- # include TestRedlandAdapter
- # include TestPersistentAdapter
- #
- # def setup
- # super(:type => :redland, :location => @location)
- # @location = File.join(Dir.tmpdir,"redland-temp")
- # end
- # def teardown
- # FileUtils.rm Dir.glob(@location + '-*')
- # end
- #end
- class TestRedlandAdapterSqlite < Test::Unit::TestCase
- include TestRedlandAdapter
- # not persistent
- def setup
- super(:type => :redland, :location => 'sqlite')
- end
- end
- #class TestRedlandAdapterMySQL < Test::Unit::TestCase
- # include TestRedlandAdapter
- # include TestPersistentAdapter
- #
- # def setup
- # super(:type => :redland, :name => 'db1', :location => 'mysql',
- # :host => 'localhost', :database => 'redland_test',
- # :user => '', :password => '', :new => 'yes')
- # end
- #end
- #class TestRedlandAdapterPostgres < Test::Unit::TestCase
- # include TestPersistentAdapter
- # include TestRedlandAdapter
- #
- # def setup
- # super(:type => :redland, :name => 'db1', :location => 'postgresql',
- # :host => 'localhost', :database => 'redland_test',
- # :user => '', :password => '', :new => 'yes')
- # end
- #end