;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- ;;; $Header: dojo/tests/main.lisp $ ;;; Copyright (c) 2008, Andrea Chiumenti. All rights reserved. ;;; Redistribution and use in source and binary forms, with or without ;;; modification, are permitted provided that the following conditions ;;; are met: ;;; * Redistributions of source code must retain the above copyright ;;; notice, this list of conditions and the following disclaimer. ;;; * Redistributions in binary form must reproduce the above ;;; copyright notice, this list of conditions and the following ;;; disclaimer in the documentation and/or other materials ;;; provided with the distribution. ;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED ;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY ;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. (in-package :claw-dojo-tests) (setf hunchentoot:*default-content-type* "text/html; charset=UTF-8") (defvar *main-file* (load-time-value (or #.*compile-file-pathname* *load-pathname*))) (defvar *dojo-test-lisplet*) (defvar *dojo-test-lisplet2*) (setf *dojo-test-lisplet* (make-instance 'lisplet :realm "test1" :base-path "/test")) (setf *dojo-test-lisplet2* (make-instance 'lisplet :realm "test2" :base-path "/test2")) (defparameter *clawserver* (make-instance 'clawserver :port 4242 :mod-lisp-p nil :base-path "/claw")) ;;;(defparameter *clawserver* (make-instance 'clawserver :port 4242 :sslport 4445 :base-path "/claw" ;;; :ssl-certificate-file #P"/home/kiuma/pem/cacert.pem" ;;; :ssl-privatekey-file #P"/home/kiuma/pem/privkey.pem")) (clawserver-register-lisplet *clawserver* *dojo-test-lisplet*) (clawserver-register-lisplet *clawserver* *dojo-test-lisplet2*) (defun test-image-file () (make-pathname :directory (append (pathname-directory *main-file*) '("img")) :name "matrix" :type "jpg")) (let ((path (make-pathname :directory (append (pathname-directory *main-file*) '("docroot"))))) (lisplet-register-resource-location *dojo-test-lisplet* path "docroot/") (lisplet-register-resource-location *dojo-test-lisplet2* path "docroot/")) (defun djstart () (clawserver-start *clawserver*) *clawserver*) (defun djstop () (clawserver-stop *clawserver*) *clawserver*) (defun debug-mode () (setf hunchentoot:*catch-errors-p* nil hunchentoot::*log-lisp-backtraces-p* t hunchentoot::*log-lisp-errors-p* t hunchentoot::*log-lisp-warnings-p* t hunchentoot::*show-lisp-errors-p* t hunchentoot::*show-lisp-backtraces-p* t)) (defun production-mode () (setf hunchentoot:*catch-errors-p* t hunchentoot::*log-lisp-backtraces-p* nil hunchentoot::*log-lisp-errors-p* t hunchentoot::*log-lisp-warnings-p* t hunchentoot::*show-lisp-errors-p* nil hunchentoot::*show-lisp-backtraces-p* nil))