Fixed feature typo, improved commands, added AutoTest

This commit is contained in:
jvelilla
2013-04-16 17:31:33 -03:00
parent c63e307179
commit ce2ca051f6
9 changed files with 194 additions and 38 deletions

View File

@@ -96,7 +96,7 @@ feature -- Commands
check_response (response)
if not has_error then
if attached response.json_response as r_value then
Result := build_session (r_value, "session")
Result := new_session (r_value, "session")
end
end
end
@@ -127,7 +127,7 @@ feature -- Commands
index > l_json_array.count
loop
if attached {JSON_OBJECT} l_json_array.i_th (index) as json_obj then
if attached build_session (json_obj.representation, "sessions") as l_session then
if attached new_session (json_obj.representation, "sessions") as l_session then
Result.force (l_session)
end
end
@@ -153,7 +153,7 @@ feature -- Commands
check_response (response)
if not has_error then
if attached response.json_response as r_value then
Result := build_session (r_value, "session")
Result := new_session (r_value, "session")
end
end
end
@@ -1602,18 +1602,24 @@ feature {NONE} -- Implementation
commnad_executor: COMMAND_EXECUTOR
build_session (value: STRING_32; to: STRING_32): detachable SE_SESSION
new_session (value: STRING_32; to: STRING_32): detachable SE_SESSION
local
l_rep : STRING_32
do
if to.is_case_insensitive_equal ("session") then
if attached {JSON_OBJECT} string_to_json (value) as l_value then
if attached l_value.item ("sessionId") as ls and then attached l_value.item ("value") as lv and then attached json_to_se_capabilities (lv.representation) as lc then
create Result.make (ls.representation, lc)
l_rep := ls.representation
l_rep.replace_substring_all ("%"", "")
create Result.make (l_rep, lc)
end
end
elseif to.is_case_insensitive_equal ("sessions") then
if attached {JSON_OBJECT} string_to_json (value) as l_value then
if attached l_value.item ("id") as ls and then attached l_value.item ("capabilities") as lv and then attached json_to_se_capabilities (lv.representation) as lc then
create Result.make (ls.representation, lc)
l_rep := ls.representation
l_rep.replace_substring_all ("%"", "")
create Result.make (l_rep, lc)
end
end
end

View File

@@ -7,8 +7,8 @@ note
class
SE_JSON_WIRE_PROTOCOL_COMMANDS
feature
cmd_ping : STRING = ""
--GET / expected a 200 ok
@@ -29,12 +29,14 @@ feature
end
cmd_session_timeouts_tmpl : STRING ="session/$id/timeouts"
cmd_session_timeouts_tmpl : STRING_32 ="[
session/$id/timeouts
]"
cmd_session_timeouts (id: STRING_32): STRING_32
cmd_session_timeouts (id: STRING_32):STRING_32
do
create Result.make_from_string (cmd_session_timeouts_tmpl)
Result.replace_substring_all ("$id", id)
Result.replace_substring_all ("$id",id)
end
cmd_session_timeouts_async_script_tmpl : STRING ="session/$id/timeouts/async_script"