blob: 6b029ba3eb2e7fcd010dc57472f30d544d780fa4 [file] [log] [blame]
Kevin Clark4bd89162008-07-08 00:47:49 +00001$:.push File.dirname(__FILE__) + '/../gen-rb'
2$:.push File.join(File.dirname(__FILE__), '../../../lib/rb/lib')
3
4require 'thrift'
5require 'thrift/protocol/binaryprotocol'
6require 'ThriftTest'
7
8class SimpleHandler
9 [:testString, :testByte, :testI32, :testI64, :testDouble,
10 :testStruct, :testMap, :testSet, :testList, :testNest,
11 :testEnum, :testTypedef].each do |meth|
12
13 define_method(meth) do |thing|
14 thing
15 end
16
17 end
18
19 def testInsanity(thing)
20 num, uid = thing.userMap.find { true }
21 return {uid => {num => thing}}
22 end
23
24 def testMapMap(thing)
25 return {thing => {thing => thing}}
26 end
27
28 def testEnum(thing)
29 return thing
30 end
31
32 def testTypedef(thing)
33 return thing
34 end
35
36 def testException(thing)
37 raise Thrift::Test::Xception, :message => 'error'
38 end
39end
40
41@handler = SimpleHandler.new
42@processor = Thrift::Test::ThriftTest::Processor.new(@handler)
43@transport = Thrift::ServerSocket.new(9090)
44@server = Thrift::ThreadedServer.new(@processor, @transport)
45
46@server.serve