Fixed WSF_REQUEST.script_url (..) for clean path
Added related autotests
This commit is contained in:
91
library/server/wsf/tests/src/test_wsf_request_script_url.e
Normal file
91
library/server/wsf/tests/src/test_wsf_request_script_url.e
Normal file
@@ -0,0 +1,91 @@
|
||||
note
|
||||
description: "[
|
||||
Eiffel tests that can be executed by testing tool.
|
||||
]"
|
||||
author: "EiffelStudio test wizard"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
testing: "type/manual"
|
||||
|
||||
class
|
||||
TEST_WSF_REQUEST_SCRIPT_URL
|
||||
|
||||
inherit
|
||||
EQA_TEST_SET
|
||||
|
||||
WSF_SERVICE
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
|
||||
feature {NONE} -- Events
|
||||
|
||||
port_number: INTEGER
|
||||
base_url: detachable STRING
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
--| do nothing
|
||||
end
|
||||
|
||||
feature -- Tests
|
||||
|
||||
test_script_url
|
||||
local
|
||||
req: WSF_REQUEST
|
||||
s: READABLE_STRING_8
|
||||
do
|
||||
--| Case #1
|
||||
req := new_request (<<
|
||||
["REQUEST_METHOD", "GET"],
|
||||
["QUERY_STRING", ""],
|
||||
["REQUEST_URI", "/foo/bar/test/home"],
|
||||
["SCRIPT_NAME", "/foo/bar/app.ext"],
|
||||
["PATH_INFO", "/test/home"]
|
||||
>>
|
||||
)
|
||||
s := req.script_url ("/new/path/")
|
||||
assert ("script_url (/new/path/) = %""+s+"%" but should be %"/foo/bar/new/path/%"", s.same_string ("/foo/bar/new/path/"))
|
||||
|
||||
--| Case #2
|
||||
req := new_request (<<
|
||||
["REQUEST_METHOD", "GET"],
|
||||
["QUERY_STRING", ""],
|
||||
["REQUEST_URI", "/foo/bar/abc/DEF"],
|
||||
["SCRIPT_NAME", "/foo/bar/app.ext"],
|
||||
["PATH_INFO", "/abc/DEF"]
|
||||
>>
|
||||
)
|
||||
s := req.script_url ("/new/path/")
|
||||
assert ("script_url (/new/path/) = %""+s+"%" but should be %"/foo/bar/new/path/%"", s.same_string ("/foo/bar/new/path/"))
|
||||
|
||||
--| Case #3
|
||||
req := new_request (<<
|
||||
["REQUEST_METHOD", "GET"],
|
||||
["QUERY_STRING", ""],
|
||||
["REQUEST_URI", "/intranet/collab/cms/home"],
|
||||
["SCRIPT_NAME", "/intranet/collab/collab.ews"],
|
||||
["PATH_INFO", "/home"]
|
||||
>>
|
||||
)
|
||||
s := req.script_url ("/new/path/")
|
||||
assert ("script_url (/new/path/) = %""+s+"%" but should be %"/intranet/collab/cms/new/path/%"", s.same_string ("/intranet/collab/cms/new/path/"))
|
||||
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
new_request (a_meta: ARRAY [TUPLE [name: READABLE_STRING_8; value: READABLE_STRING_8]]): WSF_REQUEST
|
||||
local
|
||||
wgi_req: WGI_REQUEST
|
||||
req: WSF_REQUEST
|
||||
do
|
||||
create {WGI_REQUEST_NULL} wgi_req.make (Current, a_meta)
|
||||
create Result.make_from_wgi (wgi_req)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
49
library/server/wsf/tests/src/wgi_request_null.e
Normal file
49
library/server/wsf/tests/src/wgi_request_null.e
Normal file
@@ -0,0 +1,49 @@
|
||||
note
|
||||
description: "Summary description for {WGI_REQUEST_NULL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WGI_REQUEST_NULL
|
||||
|
||||
inherit
|
||||
WGI_REQUEST_FROM_TABLE
|
||||
rename
|
||||
make as wgi_request_from_table_make
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (s: WSF_SERVICE; a_meta: ARRAY [TUPLE [name: READABLE_STRING_8; value: READABLE_STRING_8]])
|
||||
local
|
||||
ht: HASH_TABLE [READABLE_STRING_8, READABLE_STRING_8]
|
||||
i: WGI_NULL_INPUT_STREAM
|
||||
c: WGI_NULL_CONNECTOR
|
||||
do
|
||||
create c.make (s)
|
||||
create i.make
|
||||
create ht.make (a_meta.count)
|
||||
across
|
||||
a_meta as curs
|
||||
loop
|
||||
ht.force (curs.item.value, curs.item.name)
|
||||
end
|
||||
wgi_request_from_table_make (ht, i, c)
|
||||
end
|
||||
|
||||
|
||||
note
|
||||
copyright: "2011-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
Reference in New Issue
Block a user