web/client: start to work with real client (context) class
This commit is contained in:
parent
cec817b03a
commit
5a4797416b
4 changed files with 15 additions and 12 deletions
|
@ -4,7 +4,7 @@
|
||||||
(:use :common-lisp)
|
(:use :common-lisp)
|
||||||
(:local-nicknames (:config :scopes/config)
|
(:local-nicknames (:config :scopes/config)
|
||||||
(:message :scopes/core/message))
|
(:message :scopes/core/message))
|
||||||
(:export #:root-config #:add-config #:add-action
|
(:export #:root-config #:service-config #:add-config #:add-action
|
||||||
#:default-setup #:setup-services
|
#:default-setup #:setup-services
|
||||||
#:context #:*root* #:find-service #:config #:name #:send
|
#:context #:*root* #:find-service #:config #:name #:send
|
||||||
#:printer))
|
#:printer))
|
||||||
|
|
|
@ -19,19 +19,20 @@
|
||||||
(*config* nil)
|
(*config* nil)
|
||||||
(server:*listener* nil))
|
(server:*listener* nil))
|
||||||
(load (t:test-path "config-web" "etc"))
|
(load (t:test-path "config-web" "etc"))
|
||||||
|
(core:setup-services *config*)
|
||||||
(let ((cfg (cadr (config:children *config*))))
|
(let ((cfg (cadr (config:children *config*))))
|
||||||
(test-server-config cfg)
|
(test-server-config cfg))
|
||||||
(server:start cfg))
|
|
||||||
(sleep 0.1)
|
(sleep 0.1)
|
||||||
(let ((cfg (car (config:children *config*))))
|
(test-client)
|
||||||
(test-client cfg))
|
|
||||||
(sleep 0.1)
|
(sleep 0.1)
|
||||||
(server:stop)
|
(server:stop)
|
||||||
(t:show-result)))
|
(t:show-result)))
|
||||||
|
|
||||||
(t:deftest test-server-config (cfg)
|
(t:deftest test-server-config (cfg)
|
||||||
|
;(let ((cfg (core:config (core:find-service :server))))
|
||||||
(== (parse-integer (server:port cfg)) 8899))
|
(== (parse-integer (server:port cfg)) 8899))
|
||||||
|
|
||||||
(t:deftest test-client (cfg)
|
(t:deftest test-client ()
|
||||||
(== (client:url cfg) "http://localhost:8899")
|
(let ((cfg (core:config (core:find-service :client))))
|
||||||
(== (dexador:get (client:url cfg)) "Hello World!"))
|
(== (client:url cfg) "http://localhost:8899")
|
||||||
|
(== (dexador:get (client:url cfg)) "Hello World!")))
|
||||||
|
|
|
@ -2,11 +2,12 @@
|
||||||
|
|
||||||
(defpackage :scopes/web/client
|
(defpackage :scopes/web/client
|
||||||
(:use :common-lisp)
|
(:use :common-lisp)
|
||||||
(:local-nicknames (:config :scopes/config))
|
(:local-nicknames (:config :scopes/config)
|
||||||
|
(:core :scopes/core))
|
||||||
(:export #:config #:url))
|
(:export #:config #:url))
|
||||||
|
|
||||||
(in-package :scopes/web/client)
|
(in-package :scopes/web/client)
|
||||||
|
|
||||||
(defclass config (config:base)
|
(defclass config (core:service-config)
|
||||||
((url :reader url :initarg :url :initform "http://localhost:8899")))
|
((url :reader url :initarg :url :initform "http://localhost:8899")))
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,14 @@
|
||||||
|
|
||||||
(defpackage :scopes/web/server
|
(defpackage :scopes/web/server
|
||||||
(:use :common-lisp)
|
(:use :common-lisp)
|
||||||
(:local-nicknames (:config :scopes/config))
|
(:local-nicknames (:config :scopes/config)
|
||||||
|
(:core :scopes/core))
|
||||||
(:export #:config #:address #:port
|
(:export #:config #:address #:port
|
||||||
#:*listener* #:start #:stop))
|
#:*listener* #:start #:stop))
|
||||||
|
|
||||||
(in-package :scopes/web/server)
|
(in-package :scopes/web/server)
|
||||||
|
|
||||||
(defclass config (config:base)
|
(defclass config (core:service-config)
|
||||||
((config:env-slots :initform '(address port))
|
((config:env-slots :initform '(address port))
|
||||||
(address :reader address :initarg :address :initform "localhost")
|
(address :reader address :initarg :address :initform "localhost")
|
||||||
(port :reader port :initarg :port :initform "8888")))
|
(port :reader port :initarg :port :initform "8888")))
|
||||||
|
|
Loading…
Add table
Reference in a new issue