blob: 0caf7beb565c3ea22125656c11411b15c278b66e [file] [log] [blame]
Tomek Kurcze93a9012017-09-19 09:16:43 +02001(in-package #:thrift.test-implementation)
2
3;;;; Licensed under the Apache License, Version 2.0 (the "License");
4;;;; you may not use this file except in compliance with the License.
5;;;; You may obtain a copy of the License at
6;;;;
7;;;; http://www.apache.org/licenses/LICENSE-2.0
8;;;;
9;;;; Unless required by applicable law or agreed to in writing, software
10;;;; distributed under the License is distributed on an "AS IS" BASIS,
11;;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12;;;; See the License for the specific language governing permissions and
13;;;; limitations under the License.
14
15(defun thrift.test.thrift-test-implementation:test-void ()
16 (format t "testVoid()~%"))
17
18(defun thrift.test.thrift-test-implementation:test-string (thing)
19 (format t "testString(~a)~%" thing)
20 thing)
21
22(defun thrift.test.thrift-test-implementation:test-bool (thing)
23 (format t "testBool(~a)~%" (if thing "true" "false"))
24 thing)
25
26(defun thrift.test.thrift-test-implementation:test-byte (thing)
27 (format t "testByte(~a)~%" thing)
28 thing)
29
30(defun thrift.test.thrift-test-implementation:test-i32 (thing)
31 (format t "testI32(~a)~%" thing)
32 thing)
33
34(defun thrift.test.thrift-test-implementation:test-i64 (thing)
35 (format t "testI64(~a)~%" thing)
36 thing)
37
38(defun thrift.test.thrift-test-implementation:test-double (thing)
39 (format t "testDouble(~a)~%" thing)
40 thing)
41
42(defun thrift.test.thrift-test-implementation:test-binary (thing)
43 (format t "testBinary(~a)~%" thing)
44 thing)
45
46(defun thrift.test.thrift-test-implementation:test-struct (thing)
47 (format t "testStruct(~a)~%" thing)
48 thing)
49
50(defun thrift.test.thrift-test-implementation:test-nest (thing)
51 (format t "testNest(~a)~%" thing)
52 thing)
53
54(defun thrift.test.thrift-test-implementation:test-map (thing)
55 (format t "testMap(~a)~%" thing)
56 thing)
57
58(defun thrift.test.thrift-test-implementation:test-string-map (thing)
59 (format t "testStringMap(~a)~%" thing)
60 thing)
61
62(defun thrift.test.thrift-test-implementation:test-set (thing)
63 (format t "testSet(~a)~%" thing)
64 thing)
65
66(defun thrift.test.thrift-test-implementation:test-list (thing)
67 (format t "testList(~a)~%" thing)
68 thing)
69
70(defun thrift.test.thrift-test-implementation:test-enum (thing)
71 (format t "testEnum(~a)~%" thing)
72 thing)
73
74(defun thrift.test.thrift-test-implementation:test-typedef (thing)
75 (format t "testTypedef(~a)~%" thing)
76 thing)
77
78(defun thrift.test.thrift-test-implementation:test-map-map (hello)
79 (format t "testMapMap(~a)~%" hello)
80 '((-4 . ((-4 . -4) (-3 . -3) (-2 . -2) (-1 . -1))) (4 . ((1 . 1) (2 . 2) (3 . 3) (4 . 4)))))
81
82(defun thrift.test.thrift-test-implementation:test-insanity (argument)
83 (let ((result `((1 . ((2 . ,argument) (3 . ,argument)))
84 (2 . ((6 . ,(thrift.test::make-insanity :user-map nil :xtructs nil)))))))
85 (format t "~a~%" result)
86 result))
87
88(defun thrift.test.thrift-test-implementation:test-multi (arg0 arg1 arg2 arg3 arg4 arg5)
89 (declare (ignorable arg3 arg4 arg5))
90 (format t "testMulti()~%")
91 (thrift.test:make-xtruct :string-thing "Hello2"
92 :byte-thing arg0
93 :i32-thing arg1
94 :i64-thing arg2))
95
96(defun thrift.test.thrift-test-implementation:test-exception (arg)
97 (format t "testException(~a)~%" arg)
98 (cond
99 ((string= arg "Xception") (error 'thrift.test:xception
100 :error-code 1001
101 :message arg))
102 ((string= arg "TException") (error 'thrift.test:xception
103 :error-code 0
104 :message "Stuff!"))))
105
106(defun thrift.test.thrift-test-implementation:test-multi-exception (arg0 arg1)
107 (format t "testMultiException(~a, ~a)~%" arg0 arg1)
108 (cond
109 ((string= arg0 "Xception") (error 'thrift.test:xception
110 :error-code 1001
111 :message "This is an Xception"))
112 ((string= arg0 "Xception2") (error 'thrift.test:xception2
113 :error-code 2002
114 :struct-thing (thrift.test:make-xtruct :string-thing "This is an Xception2"
115 :byte-thing 0
116 :i32-thing 0
117 :i64-thing 0))))
118 (thrift.test:make-xtruct :string-thing arg1
119 :byte-thing 0
120 :i32-thing 0
121 :i64-thing 0))
122
123(defun thrift.test.thrift-test-implementation:test-oneway (seconds)
124 (format t "testOneway(~a): Sleeping...~%" seconds)
125 (sleep seconds)
126 (format t "testOneway(~a): done sleeping!~%" seconds))
127
128;;; Removed from the IDL definition.
129#+(or)
130(defun thrift.test.second-service-implementation:blah-blah ()
131 (format t "blahBlah()~%"))
132
133(defun thrift.test.second-service-implementation:secondtest-string (thing)
134 (format t "secondtestString(~a)~%" thing)
James E. King III6aa4c0f2018-03-02 16:14:54 -0500135 (concatenate 'string "testString(\"" thing "\")"))
136