web/client: start to work with real client (context) class

This commit is contained in:
Helmut Merz 2024-06-21 15:35:07 +02:00
parent cec817b03a
commit 5a4797416b
4 changed files with 15 additions and 12 deletions

View file

@ -4,7 +4,7 @@
(:use :common-lisp)
(:local-nicknames (:config :scopes/config)
(:message :scopes/core/message))
(:export #:root-config #:add-config #:add-action
(:export #:root-config #:service-config #:add-config #:add-action
#:default-setup #:setup-services
#:context #:*root* #:find-service #:config #:name #:send
#:printer))

View file

@ -19,19 +19,20 @@
(*config* nil)
(server:*listener* nil))
(load (t:test-path "config-web" "etc"))
(core:setup-services *config*)
(let ((cfg (cadr (config:children *config*))))
(test-server-config cfg)
(server:start cfg))
(test-server-config cfg))
(sleep 0.1)
(let ((cfg (car (config:children *config*))))
(test-client cfg))
(test-client)
(sleep 0.1)
(server:stop)
(t:show-result)))
(t:deftest test-server-config (cfg)
;(let ((cfg (core:config (core:find-service :server))))
(== (parse-integer (server:port cfg)) 8899))
(t:deftest test-client (cfg)
(== (client:url cfg) "http://localhost:8899")
(== (dexador:get (client:url cfg)) "Hello World!"))
(t:deftest test-client ()
(let ((cfg (core:config (core:find-service :client))))
(== (client:url cfg) "http://localhost:8899")
(== (dexador:get (client:url cfg)) "Hello World!")))

View file

@ -2,11 +2,12 @@
(defpackage :scopes/web/client
(:use :common-lisp)
(:local-nicknames (:config :scopes/config))
(:local-nicknames (:config :scopes/config)
(:core :scopes/core))
(:export #:config #:url))
(in-package :scopes/web/client)
(defclass config (config:base)
(defclass config (core:service-config)
((url :reader url :initarg :url :initform "http://localhost:8899")))

View file

@ -2,13 +2,14 @@
(defpackage :scopes/web/server
(:use :common-lisp)
(:local-nicknames (:config :scopes/config))
(:local-nicknames (:config :scopes/config)
(:core :scopes/core))
(:export #:config #:address #:port
#:*listener* #:start #:stop))
(in-package :scopes/web/server)
(defclass config (config:base)
(defclass config (core:service-config)
((config:env-slots :initform '(address port))
(address :reader address :initarg :address :initform "localhost")
(port :reader port :initarg :port :initform "8888")))