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
7 ;;;; http://www.apache.org/licenses/LICENSE-2.0
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.
15 #+(or) (when (not (boundp 'sb-impl::default-external-format)
16 (setf sb-impl::default-external-format :UTF-8)))
19 (load (merge-pathnames "../../lib/cl/load-locally.lisp" *load-truename*))
20 (asdf:load-system :net.didierverna.clon)
21 (asdf:load-system :fiasco)
22 (asdf:load-asd (merge-pathnames "gen-cl/ThriftTest/thrift-gen-ThriftTest.asd" *load-truename*))
23 (asdf:load-system :thrift-gen-thrifttest)
25 (net.didierverna.clon:nickname-package)
27 (defpackage #:thrift-cross
28 (:use #:common-lisp #:fiasco)
29 (:export #:cross-test))
31 (in-package #:thrift-cross)
33 (defparameter *prot* nil)
35 (load (merge-pathnames "tests.lisp" *load-truename*) :external-format :UTF-8)
38 (text :contents "The Common Lisp client for Thrift's cross-language test suite.")
39 (group (:header "Allowed options:")
40 (flag :short-name "h" :long-name "help"
41 :description "Print this help and exit.")
42 (stropt :long-name "host"
43 :description "The host to connect to."
44 :default-value "localhost"
46 (stropt :long-name "port"
47 :description "Number of the port to listen for connections on."
50 :argument-type :optional)
51 (stropt :long-name "transport"
52 :description "Transport: transport to use (\"buffered\", \"framed\")"
53 :default-value "buffered"
55 (stropt :long-name "protocol"
56 :description "Protocol: protocol to use (\"binary\", \"multi\")"
57 :default-value "binary"
58 :argument-name "ARG")))
61 "Entry point for our standalone application."
63 (when (clon:getopt :short-name "h")
70 (clon:do-cmdline-options (option name value source)
71 (print (list option name value source))
72 (if (string= name "host")
74 (if (string= name "port")
76 (if (string= name "transport")
77 (cond ((string= value "buffered") (setf framed nil))
78 ((string= value "framed") (setf framed t))
79 (t (error "Unsupported transport."))))
80 (if (string= name "protocol")
81 (cond ((string= value "binary") (setf multiplexed nil))
82 ((string= value "multi") (setf multiplexed t))
83 (t (error "Unsupported protocol.")))))
85 (setf *prot* (thrift.implementation::client (puri:parse-uri
86 (concatenate 'string "thrift://" host ":" port))
88 :multiplexed multiplexed))
89 (let ((result (cross-test :multiplexed multiplexed)))
90 (thrift.implementation::close *prot*)
93 (clon:dump "TestClient" main)