steps: starting with send, message
This commit is contained in:
		
							parent
							
								
									bf263cfb37
								
							
						
					
					
						commit
						f9f0d6b43d
					
				
					 2 changed files with 28 additions and 7 deletions
				
			
		|  | @ -4,12 +4,27 @@ | ||||||
|   (:use :common-lisp) |   (:use :common-lisp) | ||||||
|   (:local-nicknames (:config :scopes/config)) |   (:local-nicknames (:config :scopes/config)) | ||||||
|   (:export #:config  |   (:export #:config  | ||||||
|            #:name #:process)) |            #:message | ||||||
|  |            #:service #:name #:send)) | ||||||
| 
 | 
 | ||||||
| (in-package :scopes/steps) | (in-package :scopes/steps) | ||||||
| 
 | 
 | ||||||
| (defclass config (config:base)  | (defclass config (config:base)  | ||||||
|   ()) |   (services)) | ||||||
| 
 | 
 | ||||||
| (defclass process ()  | (defclass message () | ||||||
|  |   ((domain) | ||||||
|  |    (action) | ||||||
|  |    (class) | ||||||
|  |    (item) | ||||||
|  |    (sender) | ||||||
|  |    (timestamp) | ||||||
|  |    (data))) | ||||||
|  | 
 | ||||||
|  | (defclass service ()  | ||||||
|   ((name :initarg :name :reader name))) |   ((name :initarg :name :reader name))) | ||||||
|  | 
 | ||||||
|  | (defgeneric send (rcvr msg) | ||||||
|  |   (:method ((rcvr service) msg) | ||||||
|  |     rcvr | ||||||
|  |     msg)) | ||||||
|  |  | ||||||
|  | @ -12,15 +12,21 @@ | ||||||
| (in-package :scopes/test-steps) | (in-package :scopes/test-steps) | ||||||
| 
 | 
 | ||||||
| (defvar *config* nil) | (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 () | (defun run () | ||||||
|   (let ((*config* nil) |   (let ((*config* nil) | ||||||
|         (t:*test-suite* (t:test-suite "steps")) |         (t:*test-suite* (make-instance 'test-suite :name "steps"))) | ||||||
|         (*test-process* (make-instance 'steps:process :name "test-process"))) |  | ||||||
|     (load (t:test-path "config-steps" "etc")) |     (load (t:test-path "config-steps" "etc")) | ||||||
|     (test-send) |     (test-send) | ||||||
|     (t:show-result))) |     (t:show-result))) | ||||||
| 
 | 
 | ||||||
| (t:deftest test-send () | (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) | ||||||
|  |     )) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue