blob: c0d7b59f4422b610cbae47724f9c8eee795549b1 [file] [log] [blame]
Mark Slee02d1edc2007-03-07 05:17:25 +00001#!/usr/bin/env ruby
Mark Slee157d9f72007-02-07 06:03:53 +00002
3$:.push('gen-rb')
4$:.push('../../lib/rb/lib')
5
6require 'thrift/transport/tsocket'
7require 'thrift/protocol/tbinaryprotocol'
8require 'thrift/server/tserver'
9require 'ThriftTest'
10
11class TestHandler
12 include ThriftTest::Iface
13
14 def testVoid()
15 print "testVoid()\n"
16 end
17
18 def testString(thing)
19 print "testString(#{thing})\n"
20 return thing
21 end
22
23 def testByte(thing)
24 print "testByte(#{thing})\n"
25 return thing
26 end
27
28 def testI32(thing)
29 print "testI32(#{thing})\n"
30 return thing
31 end
32
33 def testI64(thing)
34 print "testI64(#{thing})\n"
35 return thing
36 end
37
38 def testDouble(thing)
39 print "testDouble(#{thing})\n"
40 return thing
41 end
42
43 def testStruct(thing)
44 print "testStruct(#{thing})\n"
45 return thing
46 end
47
48 def testMap(thing)
49 print "testMap(#{thing})\n"
50 return thing
51 end
52
53 def testSet(thing)
54 print "testSet(#{thing})\n"
55 return thing
56 end
57
58 def testList(thing)
59 print "testList(#{thing})\n"
60 return thing
61 end
62
Mark Slee477a5802007-06-30 01:18:12 +000063 def testNest(thing)
64 print "testNest(#{thing})\n"
65 puts " i32_thing: #{thing.i32_thing}"
66 puts " with struct: "
67 %w{ string_thing byte_thing i32_thing }.each do |t|
68 puts " #{t}: #{thing.struct_thing.send(t)}"
69 end
70 return thing
71 end
72
Mark Slee157d9f72007-02-07 06:03:53 +000073end
74
75handler = TestHandler.new()
76processor = ThriftTest::Processor.new(handler)
77transport = TServerSocket.new(9090)
78server = TSimpleServer.new(processor, transport)
79server.serve()