blob: 511d01e477137b3d08181247db3487c138e9c40c [file] [log] [blame]
iproctorff8eb922007-07-25 19:06:13 +00001module Server where
2import Thrift
3import ThriftTest
4import ThriftTest_Iface
5import Data.Map as Map
6import TServer
7import Control.Exception
8import ThriftTest_Types
9
10
11data TestHandler = TestHandler
12instance ThriftTest_Iface TestHandler where
13 testVoid a = return ()
14 testString a (Just s) = do print s; return s
15 testByte a (Just x) = do print x; return x
16 testI32 a (Just x) = do print x; return x
17 testI64 a (Just x) = do print x; return x
18 testDouble a (Just x) = do print x; return x
19 testStruct a (Just x) = do print x; return x
20 testNest a (Just x) = do print x; return x
21 testMap a (Just x) = do print x; return x
22 testSet a (Just x) = do print x; return x
23 testList a (Just x) = do print x; return x
24 testEnum a (Just x) = do print x; return x
25 testTypedef a (Just x) = do print x; return x
26 testMapMap a (Just x) = return (Map.fromList [(1,Map.fromList [(2,2)])])
27 testInsanity a (Just x) = return (Map.fromList [(1,Map.fromList [(ONE,x)])])
28 testMulti a a1 a2 a3 a4 a5 a6 = return (Xtruct Nothing Nothing Nothing Nothing)
29 testException a c = throwDyn (Xception (Just 1) (Just "bya"))
30 testMultiException a c1 c2 = return (Xtruct Nothing Nothing Nothing Nothing)
iproctor8361bf02008-04-10 00:31:55 +000031 testAsync a (Just i) = do print i
iproctorff8eb922007-07-25 19:06:13 +000032
33
34main = do (run_basic_server TestHandler process 9090) `catchDyn` (\(TransportExn s t) -> print s)