Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose virtual host settings [IMMUTANT-73]
- Loading branch information
Showing
11 changed files
with
166 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
integration-tests/src/test/clojure/immutant/integs/vhosts.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
;; Copyright 2008-2012 Red Hat, Inc, and individual contributors. | ||
;; | ||
;; This is free software; you can redistribute it and/or modify it | ||
;; under the terms of the GNU Lesser General Public License as | ||
;; published by the Free Software Foundation; either version 2.1 of | ||
;; the License, or (at your option) any later version. | ||
;; | ||
;; This software is distributed in the hope that it will be useful, | ||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
;; Lesser General Public License for more details. | ||
;; | ||
;; You should have received a copy of the GNU Lesser General Public | ||
;; License along with this software; if not, write to the Free | ||
;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
;; 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
|
||
(ns immutant.integs.vhosts | ||
(:use fntest.core | ||
clojure.test) | ||
(:require [clj-http.client :as client])) | ||
|
||
(use-fixtures :once | ||
(with-deployments {"vhost-app1" | ||
'{ | ||
:root "target/apps/ring/basic-ring/" | ||
:init basic-ring.core/init-web | ||
:context-path "/basic-ring" | ||
:virtual-host "integ-app1.torquebox.org" | ||
} | ||
"vhost-app2" | ||
'{ | ||
:root "target/apps/ring/basic-ring/" | ||
:init basic-ring.core/init-web | ||
:context-path "/basic-ring" | ||
:virtual-host ["integ-app2.torquebox.org" | ||
"integ-app3.torquebox.org"] | ||
}})) | ||
|
||
(deftest simple "it should work" | ||
(let [result (client/get "http://integ-app1.torquebox.org:8080/basic-ring" )] | ||
;;(println "RESPONSE" result) | ||
(is (.contains (result :body) "integ-app1.torquebox.org")) | ||
(is (not (.contains (result :body) "integ-app2.torquebox.org")))) | ||
|
||
(let [result (client/get "http://integ-app2.torquebox.org:8080/basic-ring" )] | ||
;;(println "RESPONSE" result) | ||
(is (.contains (result :body) "integ-app2.torquebox.org")) | ||
(is (.contains (result :body) "integ-app3.torquebox.org")) | ||
(is (not (.contains (result :body) "integ-app1.torquebox.org"))))) | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
modules/web/src/test/clojure/org/immutant/web/ring/test/RingMetaData.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
;; Copyright 2008-2012 Red Hat, Inc, and individual contributors. | ||
;; | ||
;; This is free software; you can redistribute it and/or modify it | ||
;; under the terms of the GNU Lesser General Public License as | ||
;; published by the Free Software Foundation; either version 2.1 of | ||
;; the License, or (at your option) any later version. | ||
;; | ||
;; This software is distributed in the hope that it will be useful, | ||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
;; Lesser General Public License for more details. | ||
;; | ||
;; You should have received a copy of the GNU Lesser General Public | ||
;; License along with this software; if not, write to the Free | ||
;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
;; 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
|
||
(ns org.immutant.web.ring.test.RingMetaData | ||
(:use clojure.test | ||
midje.sweet) | ||
(:import org.immutant.core.ClojureMetaData | ||
org.immutant.web.ring.RingMetaData) | ||
(:require [clojure.java.io :as io] | ||
[immutant.runtime.bootstrap :as bootstrap])) | ||
|
||
(deftest all-tests | ||
|
||
(fact "multiple hosts should come through as a list" | ||
(let [descriptor (ClojureMetaData/parse (io/file (io/resource "multi-host-descriptor.clj"))) | ||
md (RingMetaData. (ClojureMetaData. "app-name" descriptor))] | ||
(.getHosts md) => ["ham.biscuit", "gravy.biscuit"])) | ||
|
||
(fact "a single host should come through as a list" | ||
(let [descriptor (ClojureMetaData/parse (io/file (io/resource "single-host-descriptor.clj"))) | ||
md (RingMetaData. (ClojureMetaData. "app-name" descriptor))] | ||
(.getHosts md) => ["ham.biscuit"])) | ||
|
||
(fact "a no host should come through as an empty list" | ||
(let [descriptor (ClojureMetaData/parse (io/file (io/resource "no-host-descriptor.clj"))) | ||
md (RingMetaData. (ClojureMetaData. "app-name" descriptor))] | ||
(.getHosts md) => []))) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ :virtual-host ["ham.biscuit", "gravy.biscuit"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ :virtual-host "ham.biscuit" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters