PageRenderTime 52ms CodeModel.GetById 4ms RepoModel.GetById 1ms app.codeStats 0ms

/vendor/plugins/active_rdf/activerdf-redland/test/test_redland_adapter.rb

https://github.com/mrxrsd/synth
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
  1. # Author:: Eyal Oren
  2. # Copyright:: (c) 2005-2006
  3. # License:: LGPL
  4. require 'test/unit'
  5. require 'tmpdir'
  6. require 'fileutils'
  7. common_test_dir = File.dirname(File.expand_path(__FILE__)) + '/../../test'
  8. require "#{common_test_dir}/adapters/test_writable_adapter"
  9. require "#{common_test_dir}/adapters/test_persistent_adapter"
  10. require "#{common_test_dir}/adapters/test_network_aware_adapter"
  11. module TestRedlandAdapter
  12. include TestWritableAdapter
  13. include TestNetworkAwareAdapter
  14. def test_sparql_query
  15. @adapter.add(@@eyal, @@age, @@ageval)
  16. @adapter.flush
  17. query = Query.new.distinct(:s).where(:s,:p,:o)
  18. sparql_query = @adapter.get_query_results(query)
  19. assert sparql_query.include?(TEST::eyal.uri)
  20. end
  21. end
  22. class TestRedlandAdapterMemory < Test::Unit::TestCase
  23. include TestRedlandAdapter
  24. # not persistent
  25. def setup
  26. super(:type => :redland, :location => "memory")
  27. end
  28. end
  29. #class TestRedlandAdapterFile < Test::Unit::TestCase
  30. # include TestRedlandAdapter
  31. # include TestPersistentAdapter
  32. #
  33. # def setup
  34. # super(:type => :redland, :location => @location)
  35. # @location = File.join(Dir.tmpdir,"redland-temp")
  36. # end
  37. # def teardown
  38. # FileUtils.rm Dir.glob(@location + '-*')
  39. # end
  40. #end
  41. class TestRedlandAdapterSqlite < Test::Unit::TestCase
  42. include TestRedlandAdapter
  43. # not persistent
  44. def setup
  45. super(:type => :redland, :location => 'sqlite')
  46. end
  47. end
  48. #class TestRedlandAdapterMySQL < Test::Unit::TestCase
  49. # include TestRedlandAdapter
  50. # include TestPersistentAdapter
  51. #
  52. # def setup
  53. # super(:type => :redland, :name => 'db1', :location => 'mysql',
  54. # :host => 'localhost', :database => 'redland_test',
  55. # :user => '', :password => '', :new => 'yes')
  56. # end
  57. #end
  58. #class TestRedlandAdapterPostgres < Test::Unit::TestCase
  59. # include TestPersistentAdapter
  60. # include TestRedlandAdapter
  61. #
  62. # def setup
  63. # super(:type => :redland, :name => 'db1', :location => 'postgresql',
  64. # :host => 'localhost', :database => 'redland_test',
  65. # :user => '', :password => '', :new => 'yes')
  66. # end
  67. #end