PageRenderTime 56ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/TDDBC_Yokohama2_PCUnit/Ruby/doc/ruby/ruby-1.9.2/test/drb/test_drbssl.rb

https://bitbucket.org/aetos/tddbc_yokohama2
Ruby | 62 lines | 48 code | 13 blank | 1 comment | 4 complexity | 4fb3dce5504367c0dd51d10d0d5e1db4 MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-2.0, AGPL-3.0, 0BSD, Unlicense
  1. require_relative 'drbtest'
  2. begin
  3. require 'drb/ssl'
  4. rescue LoadError
  5. end
  6. if Object.const_defined?("OpenSSL")
  7. class DRbSSLService < DRbService
  8. %w(ut_drb_drbssl.rb ut_array_drbssl.rb).each do |nm|
  9. add_service_command(nm)
  10. end
  11. config = Hash.new
  12. config[:SSLVerifyMode] = OpenSSL::SSL::VERIFY_PEER
  13. config[:SSLVerifyCallback] = lambda{ |ok,x509_store|
  14. true
  15. }
  16. begin
  17. data = open("sample.key"){|io| io.read }
  18. config[:SSLPrivateKey] = OpenSSL::PKey::RSA.new(data)
  19. data = open("sample.crt"){|io| io.read }
  20. config[:SSLCertificate] = OpenSSL::X509::Certificate.new(data)
  21. rescue
  22. # $stderr.puts "Switching to use self-signed certificate"
  23. config[:SSLCertName] =
  24. [ ["C","JP"], ["O","Foo.DRuby.Org"], ["CN", "Sample"] ]
  25. end
  26. uri = ARGV.shift if $0 == __FILE__
  27. @server = DRb::DRbServer.new(uri || 'drbssl://:0', self.manager, config)
  28. end
  29. class TestDRbSSLCore < Test::Unit::TestCase
  30. include DRbCore
  31. def setup
  32. @ext = DRbSSLService.ext_service('ut_drb_drbssl.rb')
  33. @there = @ext.front
  34. end
  35. def test_02_unknown
  36. end
  37. def test_01_02_loop
  38. end
  39. def test_05_eq
  40. end
  41. end
  42. class TestDRbSSLAry < Test::Unit::TestCase
  43. include DRbAry
  44. def setup
  45. @ext = DRbSSLService.ext_service('ut_array_drbssl.rb')
  46. @there = @ext.front
  47. end
  48. end
  49. end