iproctor | ff8eb92 | 2007-07-25 19:06:13 +0000 | [diff] [blame] | 1 | module Server where |
| 2 | import Thrift |
| 3 | import ThriftTest |
| 4 | import ThriftTest_Iface |
| 5 | import Data.Map as Map |
| 6 | import TServer |
| 7 | import Control.Exception |
| 8 | import ThriftTest_Types |
| 9 | |
| 10 | |
| 11 | data TestHandler = TestHandler |
| 12 | instance 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) |
iproctor | 8361bf0 | 2008-04-10 00:31:55 +0000 | [diff] [blame^] | 31 | testAsync a (Just i) = do print i |
iproctor | ff8eb92 | 2007-07-25 19:06:13 +0000 | [diff] [blame] | 32 | |
| 33 | |
| 34 | main = do (run_basic_server TestHandler process 9090) `catchDyn` (\(TransportExn s t) -> print s) |