thrift/test/rb/TestClient-nb.rb
Mark Slee 3f14d3ebec Merge Ruby framed transport
Summary: Submitted by Jake Luciani

Reviewed By: mcslee

Test Plan: Test code included in this commit


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665385 13f79535-47bb-0310-9956-ffa450edef68
2007-12-05 23:13:11 +00:00

36 lines
1.0 KiB
Ruby

#!/usr/bin/env ruby
$:.push('gen-rb')
$:.push('../../lib/rb/lib')
require 'thrift/transport/tsocket'
require 'thrift/protocol/tbinaryprotocol'
require 'ThriftTest'
t = TFramedTransport.new(TSocket.new('localhost', 9090))
p = TBinaryProtocol.new(t)
c = Thrift::Test::ThriftTest::Client.new(p)
t.open()
puts c.testString('string')
puts c.testByte(8)
puts c.testByte(-8)
puts c.testI32(32)
puts c.testI32(-32)
puts c.testI64(64)
puts c.testI64(-64)
puts c.testDouble(3.14)
puts c.testDouble(-3.14)
puts c.testMap({1 => 1, 2 => 2, 3 => 3})
puts c.testList([1,2,3,4,5])
puts c.testSet({1 => true, 2 => true, 3 => true})
struct = Thrift::Test::Xtruct.new({'string_thing' => 'hi!', 'i32_thing' => 4 })
puts c.testStruct(struct)
puts c.testNest(Thrift::Test::Xtruct2.new({'struct_thing' => struct, 'i32_thing' => 10}))
insane = Thrift::Test::Insanity.new({'userMap' => { Thrift::Test::Numberz::ONE => 44 }, 'xtructs' => [struct, Thrift::Test::Xtruct.new({'string_thing' => 'hi again', 'i32_thing' => 12})]})
puts c.testInsanity(insane)
puts c.testMapMap(4).inspect
t.close()