Replace Nino by Standalone whenever it is relevant.
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
<library name="http_auth" location="..\http_authorization-safe.ecf"/>
|
||||
<library name="encoders" location="..\..\..\..\text\encoder\encoder-safe.ecf"/>
|
||||
<library name="wsf" location="..\..\..\wsf\wsf-safe.ecf"/>
|
||||
<library name="default_nino" location="..\..\..\wsf\default\nino-safe.ecf"/>
|
||||
<library name="default_standalone" location="..\..\..\wsf\default\standalone-safe.ecf"/>
|
||||
<cluster name="src" location=".\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
## Overview
|
||||
The main goal of this library is to provide a common layer on top of many different connectors.
|
||||
A connector is a library used for the integration of Eiffel web server application with an underlying httpd server technology such as CGI, libFCGI, or even standalone Eiffel Web Nino (which is a httpd server written in Eiffel).
|
||||
A connector is a library used for the integration of Eiffel web server application with an underlying httpd server technology such as CGI, libFCGI, or even standalone Eiffel Web Standalone (which is a httpd server written in Eiffel).
|
||||
|
||||
Then one can build an Eiffel web service compliant with EWSGI specification, and thus with the same code (or almost), this could be compiled to run on any available connectors.
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</option>
|
||||
<setting name="concurrency" value="thread"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="connector_nino" location="..\..\connectors\nino\nino-safe.ecf" readonly="false"/>
|
||||
<library name="connector_standalone" location="..\..\connectors\standalone\standalone-safe.ecf" readonly="false"/>
|
||||
<library name="ewsgi" location="..\..\ewsgi-safe.ecf" readonly="false"/>
|
||||
<cluster name="src" location="src\" recursive="true"/>
|
||||
</target>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</option>
|
||||
<setting name="concurrency" value="thread"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="connector_nino" location="..\..\connectors\nino\nino.ecf" readonly="false"/>
|
||||
<library name="connector_standalone" location="..\..\connectors\standalone\standalone.ecf" readonly="false"/>
|
||||
<library name="ewsgi" location="..\..\ewsgi.ecf" readonly="false"/>
|
||||
<cluster name="src" location="src\" recursive="true"/>
|
||||
</target>
|
||||
|
||||
@@ -14,8 +14,8 @@ feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
print ("Example: start a Nino web server on port " + port_number.out + ", %Nand reply Hello World for any request such as http://localhost:8123/%N")
|
||||
(create {NINO_SERVICE [HELLO_WORLD_EXECUTION]}.make_custom ("")).listen (port_number)
|
||||
print ("Example: start a Standalone web server on port " + port_number.out + ", %Nand reply Hello World for any request such as http://localhost:8123/%N")
|
||||
(create {STANDALONE_SERVICE [HELLO_WORLD_EXECUTION]}.make_custom ("")).listen (port_number)
|
||||
end
|
||||
|
||||
port_number: INTEGER = 8123
|
||||
|
||||
@@ -12,11 +12,12 @@
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="connector_cgi" location="..\..\ewsgi\connectors\cgi\cgi-safe.ecf"/>
|
||||
<library name="connector_libfcgi" location="..\..\ewsgi\connectors\libfcgi\libfcgi-safe.ecf"/>
|
||||
<library name="connector_nino" location="..\..\ewsgi\connectors\nino\nino-safe.ecf"/>
|
||||
<library name="connector_standalone" location="..\..\ewsgi\connectors\standalone\standalone-safe.ecf"/>
|
||||
<library name="encoder" location="..\..\..\text\encoder\encoder-safe.ecf" readonly="false"/>
|
||||
<library name="error" location="..\..\..\utility\general\error\error-safe.ecf"/>
|
||||
<library name="ewsgi" location="..\..\ewsgi\ewsgi-safe.ecf"/>
|
||||
<library name="http" location="..\..\..\network\protocol\http\http-safe.ecf"/>
|
||||
<library name="standalone" location="standalone-safe.ecf" readonly="false"/>
|
||||
<library name="nino" location="nino-safe.ecf" readonly="false">
|
||||
<renaming old_name="HTTP_CONSTANTS" new_name="NINO_HTTP_CONSTANTS"/>
|
||||
</library>
|
||||
@@ -24,6 +25,6 @@
|
||||
<library name="wsf" location="..\wsf-safe.ecf"/>
|
||||
<cluster name="wsf_cgi" location=".\cgi\" recursive="true"/>
|
||||
<cluster name="wsf_libfcgi" location=".\libfcgi\" recursive="true"/>
|
||||
<cluster name="wsf_nino" location=".\nino\" recursive="true"/>
|
||||
<cluster name="wsf_standalone" location=".\standalone\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="ewsgi" location="..\..\ewsgi\ewsgi-safe.ecf"/>
|
||||
<library name="wsf" location="..\wsf-safe.ecf"/>
|
||||
<library name="wsf_connector_nino" location="nino-safe.ecf"/>
|
||||
<library name="wsf_connector_standalone" location="standalone-safe.ecf"/>
|
||||
<cluster name="wsf_openshift" location=".\openshift\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
|
||||
@@ -2,13 +2,12 @@ note
|
||||
description: "[
|
||||
Component to launch the service using the default connector
|
||||
|
||||
Eiffel Web Nino customized for OpenShift
|
||||
EiffelWeb standalone customized for OpenShift
|
||||
|
||||
|
||||
This default connector support options:
|
||||
base: base_url (very specific to standalone server)
|
||||
verbose: to display verbose output, useful for Nino
|
||||
force_single_threaded: use only one thread, useful for Nino
|
||||
verbose: to display verbose output, useful for standalone
|
||||
|
||||
check WSF_SERVICE_LAUNCHER for more documentation
|
||||
]"
|
||||
@@ -19,7 +18,7 @@ class
|
||||
WSF_OPENSHIFT_SERVICE_LAUNCHER [G -> WSF_EXECUTION create make end]
|
||||
|
||||
inherit
|
||||
WSF_NINO_SERVICE_LAUNCHER [G]
|
||||
WSF_STANDALONE_SERVICE_LAUNCHER [G]
|
||||
redefine
|
||||
initialize
|
||||
end
|
||||
|
||||
@@ -2,11 +2,10 @@ note
|
||||
description: "[
|
||||
Options used by WSF_SERVICE_LAUNCHER
|
||||
|
||||
For instance options supported by Nino as default connector::
|
||||
For instance options supported by Standalone as default connector::
|
||||
port: numeric such as 8099 (or equivalent string as "8099")
|
||||
base: base_url (very specific to standalone server)
|
||||
force_single_threaded: use only one thread, useful for Nino
|
||||
verbose: to display verbose output, useful for Nino
|
||||
verbose: to display verbose output, useful for Standalone
|
||||
]"
|
||||
date: "$Date: 2016-08-06 13:34:52 +0200 (sam., 06 août 2016) $"
|
||||
revision: "$Revision: 99106 $"
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
</option>
|
||||
<setting name="concurrency" value="thread"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="connector_nino" location="..\..\..\ewsgi\connectors\nino\nino-safe.ecf" readonly="false"/>
|
||||
<library name="connector_standalone" location="..\..\..\ewsgi\connectors\standalone\standalone-safe.ecf" readonly="false"/>
|
||||
<library name="connector_null" location="..\..\..\ewsgi\connectors\null\null-safe.ecf" readonly="false"/>
|
||||
<library name="dft_nino" location="..\..\default\nino-safe.ecf"/>
|
||||
<library name="dft_standalone" location="..\..\default\standalone-safe.ecf"/>
|
||||
<library name="ewsgi" location="..\..\..\ewsgi\ewsgi-safe.ecf" readonly="false"/>
|
||||
<library name="thread" location="$ISE_LIBRARY\library\thread\thread-safe.ecf"/>
|
||||
<library name="wsf" location="..\..\wsf-safe.ecf" readonly="false"/>
|
||||
|
||||
@@ -13,11 +13,17 @@ feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Initialize `Current'.
|
||||
local
|
||||
base_url: detachable READABLE_STRING_8
|
||||
do
|
||||
print ("Test Server that could be used for autotest%N")
|
||||
-- base_url := "/test/"
|
||||
base_url := {TEST_SETTINGS}.base_url
|
||||
if base_url.is_whitespace then
|
||||
base_url := Void
|
||||
end
|
||||
|
||||
set_service_option ("port", 9091)
|
||||
set_service_option ("port", {TEST_SETTINGS}.port_number)
|
||||
set_service_option ("base", base_url)
|
||||
set_service_option ("verbose", True)
|
||||
make_and_launch
|
||||
end
|
||||
|
||||
@@ -35,6 +35,13 @@ feature -- Helper
|
||||
end
|
||||
|
||||
base_url: detachable STRING
|
||||
once
|
||||
Result := {TEST_SETTINGS}.base_url
|
||||
|
||||
if Result.is_whitespace then
|
||||
Result := Void
|
||||
end
|
||||
end
|
||||
|
||||
test_url (a_query_url: READABLE_STRING_8): READABLE_STRING_8
|
||||
local
|
||||
|
||||
16
library/server/wsf/tests/server/test_settings.e
Normal file
16
library/server/wsf/tests/server/test_settings.e
Normal file
@@ -0,0 +1,16 @@
|
||||
note
|
||||
description: "Summary description for {TEST_SETTINGS}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
TEST_SETTINGS
|
||||
|
||||
feature -- Access
|
||||
|
||||
port_number: INTEGER = 9091
|
||||
|
||||
base_url: STRING = "" --"/test/"
|
||||
|
||||
end
|
||||
@@ -19,33 +19,49 @@ inherit
|
||||
|
||||
feature {NONE} -- Events
|
||||
|
||||
web_app: detachable NINO_SERVICE [TEST_EXECUTION]
|
||||
web_connector: detachable separate WGI_STANDALONE_CONNECTOR [TEST_EXECUTION]
|
||||
|
||||
port_number: INTEGER
|
||||
base_url: detachable STRING
|
||||
base_url: detachable separate STRING
|
||||
once
|
||||
if attached local_base_url as b and then not b.is_whitespace then
|
||||
create Result.make_from_separate (b)
|
||||
end
|
||||
end
|
||||
|
||||
local_base_url: detachable STRING
|
||||
once
|
||||
create Result.make_from_string ({TEST_SETTINGS}.base_url)
|
||||
if Result.is_whitespace then
|
||||
Result := Void
|
||||
end
|
||||
end
|
||||
|
||||
on_prepare
|
||||
-- <Precursor>
|
||||
local
|
||||
app: NINO_SERVICE [TEST_EXECUTION]
|
||||
wt: WORKER_THREAD
|
||||
conn: separate WGI_STANDALONE_CONNECTOR [TEST_EXECUTION]
|
||||
e: EXECUTION_ENVIRONMENT
|
||||
do
|
||||
create e
|
||||
-- port_number := 9091 -- Uncomment to use with server outside this process
|
||||
-- port_number := {TEST_SETTINGS}.port_number -- Uncomment to use with server outside this process
|
||||
if port_number = 0 then
|
||||
server_log ("== Current directory: " + e.current_working_directory)
|
||||
|
||||
port_number := 0
|
||||
base_url := "/test/"
|
||||
create app.make_custom (base_url)
|
||||
web_app := app
|
||||
|
||||
create wt.make (agent app.listen (port_number))
|
||||
wt.launch
|
||||
e.sleep (1_000_000_000 * 5)
|
||||
port_number := app.port
|
||||
server_log ("Server port=" + port_number.out)
|
||||
if attached base_url as b then
|
||||
create conn.make_with_base (b)
|
||||
else
|
||||
create conn.make
|
||||
end
|
||||
web_connector := conn
|
||||
setup_connector (conn)
|
||||
launch_connector (conn)
|
||||
|
||||
-- e.sleep (1_000_000_000 * 5)
|
||||
get_port_number (conn)
|
||||
|
||||
-- get_port_number (app.connector)
|
||||
else
|
||||
server_log ("Use existing server")
|
||||
server_log ("== Current directory: " + e.current_working_directory)
|
||||
@@ -53,6 +69,26 @@ feature {NONE} -- Events
|
||||
end
|
||||
end
|
||||
|
||||
setup_connector (conn: attached like web_connector)
|
||||
do
|
||||
conn.set_is_verbose (True)
|
||||
conn.set_port_number (port_number)
|
||||
conn.set_socket_recv_timeout (5)
|
||||
end
|
||||
|
||||
launch_connector (conn: attached like web_connector)
|
||||
do
|
||||
conn.launch
|
||||
end
|
||||
|
||||
get_port_number (conn: attached like web_connector)
|
||||
require
|
||||
conn.port > 0
|
||||
do
|
||||
port_number := conn.port
|
||||
server_log ("Server port=" + port_number.out)
|
||||
end
|
||||
|
||||
server_log_name: STRING
|
||||
local
|
||||
fn: FILE_NAME
|
||||
@@ -78,9 +114,9 @@ feature {NONE} -- Events
|
||||
|
||||
test_url (a_query_url: READABLE_STRING_8): READABLE_STRING_8
|
||||
local
|
||||
b: like base_url
|
||||
b: like local_base_url
|
||||
do
|
||||
b := base_url
|
||||
b := local_base_url
|
||||
if b = Void then
|
||||
b := ""
|
||||
end
|
||||
@@ -90,24 +126,29 @@ feature {NONE} -- Events
|
||||
on_clean
|
||||
-- <Precursor>
|
||||
do
|
||||
if attached web_app as app then
|
||||
app.shutdown
|
||||
if attached web_connector as conn then
|
||||
shutdown_server (conn)
|
||||
end
|
||||
end
|
||||
|
||||
shutdown_server (conn: attached like web_connector)
|
||||
do
|
||||
conn.shutdown_server
|
||||
end
|
||||
|
||||
http_session: detachable HTTP_CLIENT_SESSION
|
||||
|
||||
get_http_session
|
||||
local
|
||||
h: LIBCURL_HTTP_CLIENT
|
||||
b: like base_url
|
||||
h: DEFAULT_HTTP_CLIENT
|
||||
b: like local_base_url
|
||||
do
|
||||
create h.make
|
||||
b := base_url
|
||||
create h
|
||||
b := local_base_url
|
||||
if b = Void then
|
||||
b := "/"
|
||||
end
|
||||
if attached {HTTP_CLIENT_SESSION} h.new_session ("localhost:" + port_number.out + b) as sess then
|
||||
if attached {HTTP_CLIENT_SESSION} h.new_session ("http://localhost:" + port_number.out + b) as sess then
|
||||
http_session := sess
|
||||
sess.set_timeout (-1)
|
||||
sess.set_is_debug (True)
|
||||
@@ -120,15 +161,24 @@ feature {NONE} -- Events
|
||||
do
|
||||
get_http_session
|
||||
if attached http_session as sess then
|
||||
print ("Request: " + a_url + " ...%N")
|
||||
if attached sess.get (a_url, adapted_context (ctx)) as res then
|
||||
if attached res.body as l_body then
|
||||
if res.error_occurred then
|
||||
assert ("Request %""+a_url+"%" failed, got=[" + l_body + "]", False)
|
||||
if attached res.error_message as err_msg then
|
||||
assert ("Request %""+a_url+"%" failed, got=[" + l_body + "] error:" + err_msg, False)
|
||||
else
|
||||
assert ("Request %""+a_url+"%" failed, got=[" + l_body + "] error:N/A", False)
|
||||
end
|
||||
else
|
||||
assert ("Good answer got=%""+l_body+"%" expected=%""+a_expected_body+"%"", l_body.same_string (a_expected_body))
|
||||
end
|
||||
else
|
||||
assert ("Request %""+a_url+"%" failed, no body, status=" + res.status.out , False)
|
||||
if attached res.error_message as err_msg then
|
||||
assert ("Request %""+a_url+"%" failed, no body, status=" + res.status.out + " error:" + err_msg, False)
|
||||
else
|
||||
assert ("Request %""+a_url+"%" failed, no body, status=" + res.status.out + " error:N/A", False)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -146,18 +196,34 @@ feature {NONE} -- Events
|
||||
end
|
||||
end
|
||||
|
||||
test_post_request_with_filename (a_url: READABLE_STRING_8; ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT; a_fn: STRING; a_expected_body: READABLE_STRING_8)
|
||||
test_post_request_with_filename (a_url: READABLE_STRING_8; ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT; a_fn: STRING; a_expected_body: detachable READABLE_STRING_8; a_expected_starting_body: detachable READABLE_STRING_8)
|
||||
do
|
||||
get_http_session
|
||||
if attached http_session as sess then
|
||||
if attached sess.post_file (a_url, adapted_context (ctx), a_fn) as res and then not res.error_occurred and then attached res.body as l_body then
|
||||
assert ("Good answer got=%""+l_body+"%" expected=%""+a_expected_body+"%"", l_body.same_string (a_expected_body))
|
||||
if
|
||||
attached sess.post_file (a_url, adapted_context (ctx), a_fn) as res and then
|
||||
not res.error_occurred and then
|
||||
attached res.body as l_body
|
||||
then
|
||||
assert ("Good answer got=%""+l_body+"%" expected=%""+ safe_out (a_expected_body) +"%"",
|
||||
(a_expected_body /= Void implies l_body.same_string (a_expected_body))
|
||||
and (a_expected_starting_body /= Void implies l_body.starts_with (a_expected_starting_body))
|
||||
)
|
||||
else
|
||||
assert ("Request %""+a_url+"%" failed", False)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
safe_out (s: detachable READABLE_STRING_8): STRING
|
||||
do
|
||||
if s = Void then
|
||||
Result := "Void"
|
||||
else
|
||||
Result := s.out
|
||||
end
|
||||
end
|
||||
|
||||
adapted_context (ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT): HTTP_CLIENT_REQUEST_CONTEXT
|
||||
do
|
||||
if ctx /= Void then
|
||||
@@ -173,6 +239,7 @@ feature -- Test routines
|
||||
test_get_request_01
|
||||
-- New test routine
|
||||
do
|
||||
assert ("has port", port_number > 0)
|
||||
get_http_session
|
||||
if attached http_session as sess then
|
||||
test_get_request ("get/01", Void, "get-01")
|
||||
@@ -199,11 +266,11 @@ feature -- Test routines
|
||||
s := "This is an uploaded file%NTesting purpose%N"
|
||||
f.put_string (s)
|
||||
f.close
|
||||
test_post_request_with_filename ("post/file/01", Void, fn.string, "post-file-01%N" + s)
|
||||
test_post_request_with_filename ("post/file/01 #1", Void, fn.string, "post-file-01", "post-file-01")
|
||||
|
||||
create ctx.make
|
||||
ctx.add_form_parameter ("foo", "bar")
|
||||
test_post_request_with_filename ("post/file/01", ctx, fn.string, "post-file-01%N" + s)
|
||||
test_post_request_with_filename ("post/file/01 #2", ctx, fn.string, Void, "post-file-01")
|
||||
else
|
||||
assert ("not_implemented", False)
|
||||
end
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="wsf_tests" uuid="C4FF9CDA-B4E4-4841-97E0-7F799B85B657">
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-15-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-15-0 http://www.eiffel.com/developers/xml/configuration-1-15-0.xsd" name="wsf_tests" uuid="C4FF9CDA-B4E4-4841-97E0-7F799B85B657">
|
||||
<target name="server">
|
||||
<root class="TEST" feature="make"/>
|
||||
<file_rule>
|
||||
<exclude>/.git$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
</file_rule>
|
||||
<option debug="true" warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="provisional">
|
||||
<option debug="true" warning="true" full_class_checking="true" is_attached_by_default="true" is_obsolete_routine_type="true" void_safety="all" syntax="provisional">
|
||||
<assertions precondition="true" postcondition="true" check="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<setting name="concurrency" value="thread"/>
|
||||
<setting name="concurrency" value="scoop"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="connector_nino" location="..\..\ewsgi\connectors\nino\nino-safe.ecf" readonly="false"/>
|
||||
<library name="connector_null" location="..\..\ewsgi\connectors\null\null-safe.ecf" readonly="false"/>
|
||||
<library name="dft_nino" location="..\default\nino-safe.ecf"/>
|
||||
<library name="connector_standalone" location="..\..\ewsgi\connectors\standalone\standalone-safe.ecf" readonly="false"/>
|
||||
<library name="dft_standalone" location="..\default\standalone-safe.ecf"/>
|
||||
<library name="ewsgi" location="..\..\ewsgi\ewsgi-safe.ecf" readonly="false">
|
||||
<option>
|
||||
<assertions precondition="true" postcondition="true" check="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
</library>
|
||||
<library name="http" location="..\..\..\network\protocol\http\http-safe.ecf" readonly="false"/>
|
||||
<library name="http_client" location="..\..\..\network\http_client\http_client-safe.ecf" readonly="false"/>
|
||||
<library name="http_client" location="..\..\..\network\http_client\net_http_client-safe.ecf" readonly="false"/>
|
||||
<library name="thread" location="$ISE_LIBRARY\library\thread\thread-safe.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||
<library name="wsf" location="..\wsf-safe.ecf" readonly="false">
|
||||
@@ -29,6 +29,7 @@
|
||||
<assertions precondition="true" postcondition="true" check="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
</library>
|
||||
<library name="wsf_standalone" location="..\..\wsf\connector\standalone-safe.ecf" readonly="false"/>
|
||||
<cluster name="server" location=".\server\" recursive="true"/>
|
||||
</target>
|
||||
<target name="wsf_tests" extends="server">
|
||||
|
||||
Reference in New Issue
Block a user