summaryrefslogtreecommitdiff
path: root/test/cl/implementation.lisp
blob: 0caf7beb565c3ea22125656c11411b15c278b66e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
(in-package #:thrift.test-implementation)

;;;; Licensed under the Apache License, Version 2.0 (the "License");
;;;; you may not use this file except in compliance with the License.
;;;; You may obtain a copy of the License at
;;;;
;;;;     http://www.apache.org/licenses/LICENSE-2.0
;;;;
;;;; Unless required by applicable law or agreed to in writing, software
;;;; distributed under the License is distributed on an "AS IS" BASIS,
;;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;;;; See the License for the specific language governing permissions and
;;;; limitations under the License.

(defun thrift.test.thrift-test-implementation:test-void ()
  (format t "testVoid()~%"))

(defun thrift.test.thrift-test-implementation:test-string (thing)
  (format t "testString(~a)~%" thing)
  thing)

(defun thrift.test.thrift-test-implementation:test-bool (thing)
  (format t "testBool(~a)~%" (if thing "true" "false"))
  thing)

(defun thrift.test.thrift-test-implementation:test-byte (thing)
  (format t "testByte(~a)~%" thing)
  thing)

(defun thrift.test.thrift-test-implementation:test-i32 (thing)
  (format t "testI32(~a)~%" thing)
  thing)

(defun thrift.test.thrift-test-implementation:test-i64 (thing)
  (format t "testI64(~a)~%" thing)
  thing)

(defun thrift.test.thrift-test-implementation:test-double (thing)
  (format t "testDouble(~a)~%" thing)
  thing)

(defun thrift.test.thrift-test-implementation:test-binary (thing)
  (format t "testBinary(~a)~%" thing)
  thing)

(defun thrift.test.thrift-test-implementation:test-struct (thing)
  (format t "testStruct(~a)~%" thing)
  thing)

(defun thrift.test.thrift-test-implementation:test-nest (thing)
  (format t "testNest(~a)~%" thing)
  thing)

(defun thrift.test.thrift-test-implementation:test-map (thing)
  (format t "testMap(~a)~%" thing)
  thing)

(defun thrift.test.thrift-test-implementation:test-string-map (thing)
  (format t "testStringMap(~a)~%" thing)
  thing)

(defun thrift.test.thrift-test-implementation:test-set (thing)
  (format t "testSet(~a)~%" thing)
  thing)

(defun thrift.test.thrift-test-implementation:test-list (thing)
  (format t "testList(~a)~%" thing)
  thing)

(defun thrift.test.thrift-test-implementation:test-enum (thing)
  (format t "testEnum(~a)~%" thing)
  thing)

(defun thrift.test.thrift-test-implementation:test-typedef (thing)
  (format t "testTypedef(~a)~%" thing)
  thing)

(defun thrift.test.thrift-test-implementation:test-map-map (hello)
  (format t "testMapMap(~a)~%" hello)
  '((-4 . ((-4 . -4) (-3 . -3) (-2 . -2) (-1 . -1))) (4 . ((1 . 1) (2 . 2) (3 . 3) (4 . 4)))))

(defun thrift.test.thrift-test-implementation:test-insanity (argument)
  (let ((result `((1 . ((2 . ,argument) (3 . ,argument)))
                  (2 . ((6 . ,(thrift.test::make-insanity :user-map nil :xtructs nil)))))))
    (format t "~a~%" result)
    result))

(defun thrift.test.thrift-test-implementation:test-multi (arg0 arg1 arg2 arg3 arg4 arg5)
  (declare (ignorable arg3 arg4 arg5))
  (format t "testMulti()~%")
  (thrift.test:make-xtruct :string-thing "Hello2"
                           :byte-thing arg0
                           :i32-thing arg1
                           :i64-thing arg2))

(defun thrift.test.thrift-test-implementation:test-exception (arg)
  (format t "testException(~a)~%" arg)
  (cond
    ((string= arg "Xception") (error 'thrift.test:xception
                                     :error-code 1001
                                     :message arg))
    ((string= arg "TException") (error 'thrift.test:xception
                                       :error-code 0
                                       :message "Stuff!"))))

(defun thrift.test.thrift-test-implementation:test-multi-exception (arg0 arg1)
  (format t "testMultiException(~a, ~a)~%" arg0 arg1)
  (cond
    ((string= arg0 "Xception") (error 'thrift.test:xception
                                     :error-code 1001
                                     :message "This is an Xception"))
    ((string= arg0 "Xception2") (error 'thrift.test:xception2
                                     :error-code 2002
                                     :struct-thing (thrift.test:make-xtruct :string-thing "This is an Xception2"
                                                                            :byte-thing 0
                                                                            :i32-thing 0
                                                                            :i64-thing 0))))
  (thrift.test:make-xtruct :string-thing arg1
                           :byte-thing 0
                           :i32-thing 0
                           :i64-thing 0))

(defun thrift.test.thrift-test-implementation:test-oneway (seconds)
  (format t "testOneway(~a): Sleeping...~%" seconds)
  (sleep seconds)
  (format t "testOneway(~a): done sleeping!~%" seconds))

;;; Removed from the IDL definition.
#+(or)
(defun thrift.test.second-service-implementation:blah-blah ()
  (format t "blahBlah()~%"))

(defun thrift.test.second-service-implementation:secondtest-string (thing)
  (format t "secondtestString(~a)~%" thing)
  (concatenate 'string "testString(\"" thing "\")"))