From f14fdc2a69e1f71db8a894eb0e3903289e21abfb Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Mon, 1 Dec 2014 15:44:49 +0100 Subject: [PATCH] Added assertions on router helpers, and also agent handler. Closes issue #159 --- .../wsf_starts_with_context_router_helper.e | 14 +++++++++++++- .../uri/helpers/wsf_uri_context_router_helper.e | 14 +++++++++++++- .../wsf_uri_template_context_router_helper.e | 14 +++++++++++++- .../wsf/router_context/wsf_agent_context_handler.e | 4 +++- 4 files changed, 42 insertions(+), 4 deletions(-) diff --git a/library/server/wsf/router_context/support/starts_with/helpers/wsf_starts_with_context_router_helper.e b/library/server/wsf/router_context/support/starts_with/helpers/wsf_starts_with_context_router_helper.e index 32fd3f62..330ceb49 100644 --- a/library/server/wsf/router_context/support/starts_with/helpers/wsf_starts_with_context_router_helper.e +++ b/library/server/wsf/router_context/support/starts_with/helpers/wsf_starts_with_context_router_helper.e @@ -16,11 +16,17 @@ feature -- Access feature -- Mapping helper: starts_with map_starts_with (a_uri: READABLE_STRING_8; h: WSF_STARTS_WITH_CONTEXT_HANDLER [C]) + require + a_uri_attached: a_uri /= Void + h_attached: h /= Void do map_starts_with_request_methods (a_uri, h, Void) end map_starts_with_request_methods (a_uri: READABLE_STRING_8; h: WSF_STARTS_WITH_CONTEXT_HANDLER [C]; rqst_methods: detachable WSF_REQUEST_METHODS) + require + a_uri_attached: a_uri /= Void + h_attached: h /= Void do router.map_with_request_methods (create {WSF_STARTS_WITH_CONTEXT_MAPPING [C]}.make (a_uri, h), rqst_methods) end @@ -28,17 +34,23 @@ feature -- Mapping helper: starts_with feature -- Mapping helper: starts_with agent map_starts_with_agent (a_uri: READABLE_STRING_8; proc: PROCEDURE [ANY, TUPLE [start_path: READABLE_STRING_8; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE]]) + require + a_uri_attached: a_uri /= Void + proc_attached: proc /= Void do map_starts_with_agent_with_request_methods (a_uri, proc, Void) end map_starts_with_agent_with_request_methods (a_uri: READABLE_STRING_8; proc: PROCEDURE [ANY, TUPLE [start_path: READABLE_STRING_8; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE]]; rqst_methods: detachable WSF_REQUEST_METHODS) + require + a_uri_attached: a_uri /= Void + proc_attached: proc /= Void do map_starts_with_request_methods (a_uri, create {WSF_STARTS_WITH_AGENT_CONTEXT_HANDLER [C] }.make (proc), rqst_methods) end note - copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others" + copyright: "2011-2014, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software diff --git a/library/server/wsf/router_context/support/uri/helpers/wsf_uri_context_router_helper.e b/library/server/wsf/router_context/support/uri/helpers/wsf_uri_context_router_helper.e index db9734cf..b52d8096 100644 --- a/library/server/wsf/router_context/support/uri/helpers/wsf_uri_context_router_helper.e +++ b/library/server/wsf/router_context/support/uri/helpers/wsf_uri_context_router_helper.e @@ -16,11 +16,17 @@ feature -- Access feature -- Mapping helper: uri map_uri (a_uri: READABLE_STRING_8; h: WSF_URI_CONTEXT_HANDLER [C]) + require + a_uri_attached: a_uri /= Void + h_attached: h /= Void do map_uri_with_request_methods (a_uri, h, Void) end map_uri_with_request_methods (a_uri: READABLE_STRING_8; h: WSF_URI_CONTEXT_HANDLER [C]; rqst_methods: detachable WSF_REQUEST_METHODS) + require + a_uri_attached: a_uri /= Void + h_attached: h /= Void do router.map_with_request_methods (create {WSF_URI_CONTEXT_MAPPING [C]}.make (a_uri, h), rqst_methods) end @@ -28,17 +34,23 @@ feature -- Mapping helper: uri feature -- Mapping helper: uri agent map_uri_agent (a_uri: READABLE_STRING_8; proc: PROCEDURE [ANY, TUPLE [ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE]]) + require + a_uri_attached: a_uri /= Void + proc_attached: proc /= Void do map_uri_agent_with_request_methods (a_uri, proc, Void) end map_uri_agent_with_request_methods (a_uri: READABLE_STRING_8; proc: PROCEDURE [ANY, TUPLE [ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE]]; rqst_methods: detachable WSF_REQUEST_METHODS) + require + a_uri_attached: a_uri /= Void + proc_attached: proc /= Void do map_uri_with_request_methods (a_uri, create {WSF_URI_AGENT_CONTEXT_HANDLER [C] }.make (proc), rqst_methods) end note - copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others" + copyright: "2011-2014, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software diff --git a/library/server/wsf/router_context/support/uri_template/helpers/wsf_uri_template_context_router_helper.e b/library/server/wsf/router_context/support/uri_template/helpers/wsf_uri_template_context_router_helper.e index d67c4db2..a744719e 100644 --- a/library/server/wsf/router_context/support/uri_template/helpers/wsf_uri_template_context_router_helper.e +++ b/library/server/wsf/router_context/support/uri_template/helpers/wsf_uri_template_context_router_helper.e @@ -16,11 +16,17 @@ feature -- Access feature -- Mapping helper: uri map_uri_template (a_tpl: READABLE_STRING_8; h: WSF_URI_TEMPLATE_CONTEXT_HANDLER [C]) + require + a_tpl_attached: a_tpl /= Void + h_attached: h /= Void do map_uri_template_with_request_methods (a_tpl, h, Void) end map_uri_template_with_request_methods (a_tpl: READABLE_STRING_8; h: WSF_URI_TEMPLATE_CONTEXT_HANDLER [C]; rqst_methods: detachable WSF_REQUEST_METHODS) + require + a_tpl_attached: a_tpl /= Void + h_attached: h /= Void do router.map_with_request_methods (create {WSF_URI_TEMPLATE_CONTEXT_MAPPING [C]}.make (a_tpl, h), rqst_methods) end @@ -28,17 +34,23 @@ feature -- Mapping helper: uri feature -- Mapping helper: uri agent map_uri_template_agent (a_tpl: READABLE_STRING_8; proc: PROCEDURE [ANY, TUPLE [ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE]]) + require + a_tpl_attached: a_tpl /= Void + proc_attached: proc /= Void do map_uri_template_agent_with_request_methods (a_tpl, proc, Void) end map_uri_template_agent_with_request_methods (a_tpl: READABLE_STRING_8; proc: PROCEDURE [ANY, TUPLE [ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE]]; rqst_methods: detachable WSF_REQUEST_METHODS) + require + a_tpl_attached: a_tpl /= Void + proc_attached: proc /= Void do map_uri_template_with_request_methods (a_tpl, create {WSF_URI_TEMPLATE_AGENT_CONTEXT_HANDLER [C] }.make (proc), rqst_methods) end note - copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others" + copyright: "2011-2014, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software diff --git a/library/server/wsf/router_context/wsf_agent_context_handler.e b/library/server/wsf/router_context/wsf_agent_context_handler.e index 91dab372..f8522c1a 100644 --- a/library/server/wsf/router_context/wsf_agent_context_handler.e +++ b/library/server/wsf/router_context/wsf_agent_context_handler.e @@ -13,6 +13,8 @@ inherit feature -- Change set_action (a_action: like action) + require + a_action_attached: a_action /= Void do action := a_action end @@ -29,7 +31,7 @@ feature -- Execution end note - copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others" + copyright: "2011-2014, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software