From f9f0d6b43d3bc39edebf430c012f91bcbac19cf2 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Fri, 7 Jun 2024 08:33:29 +0200 Subject: [PATCH] steps: starting with send, message --- steps/steps.lisp | 21 ++++++++++++++++++--- test/test-steps.lisp | 14 ++++++++++---- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/steps/steps.lisp b/steps/steps.lisp index 62e0d4b..98dc226 100644 --- a/steps/steps.lisp +++ b/steps/steps.lisp @@ -4,12 +4,27 @@ (:use :common-lisp) (:local-nicknames (:config :scopes/config)) (:export #:config - #:name #:process)) + #:message + #:service #:name #:send)) (in-package :scopes/steps) (defclass config (config:base) - ()) + (services)) -(defclass process () +(defclass message () + ((domain) + (action) + (class) + (item) + (sender) + (timestamp) + (data))) + +(defclass service () ((name :initarg :name :reader name))) + +(defgeneric send (rcvr msg) + (:method ((rcvr service) msg) + rcvr + msg)) diff --git a/test/test-steps.lisp b/test/test-steps.lisp index 8bea1f9..52f3ee7 100644 --- a/test/test-steps.lisp +++ b/test/test-steps.lisp @@ -12,15 +12,21 @@ (in-package :scopes/test-steps) (defvar *config* nil) -(defvar *test-process* nil) + +(defclass test-suite (t:test-suite) + ((receiver :initform (make-instance 'steps:service :name :test-rcvr) + :reader receiver))) (defun run () (let ((*config* nil) - (t:*test-suite* (t:test-suite "steps")) - (*test-process* (make-instance 'steps:process :name "test-process"))) + (t:*test-suite* (make-instance 'test-suite :name "steps"))) (load (t:test-path "config-steps" "etc")) (test-send) (t:show-result))) (t:deftest test-send () - (== (steps:name *test-process*) "test-process")) + (let ((rcvr (receiver t:*test-suite*)) + (msg nil)) + (== (steps:name rcvr) :test-rcvr) + (steps:send rcvr msg) + ))