Refactor rename error_500_cms_response to internal_server_error_cms_response

Added bad_request_error_cms_response
Updated code example to use the new internal_server_error_cms_response instead of error_500_cms_response class.
Removed class error_500_cms_response.

Updated cms setup and configuration design:
  Removed CMS_SETUP.configuration: CMS_CONFIGURATION
  Removed CMS_CONFIGURATION and replaced it by using the configuration library.
  Added CMS_DEFAULT_SETUP.configuration: CONFIG_READER
  Addec CMS_SETUP.text_item (name): detachable READABLE_STRING_32 ...
    in order to access option not publish by the CMS_SETUP interface.
Removed CMS_SERVICE.configuration: CMS_CONFIGURATION since it was not used.

Moved configuration library from eiffel-lang to cms libraries.
Fixed issue related to ini config when parsing from string content,
  and also issue related to section included in file via @include.
Updated cms setup and configuration design:
  Removed CMS_SETUP.configuration: CMS_CONFIGURATION
  Removed CMS_CONFIGURATION and replaced it by using the configuration library.
  Added CMS_DEFAULT_SETUP.configuration: CONFIG_READER
  Addec CMS_SETUP.text_item (name): detachable READABLE_STRING_32 ...
    in order to access option not publish by the CMS_SETUP interface.
Removed CMS_SERVICE.configuration: CMS_CONFIGURATION since it was not used.
Improved the email service and related.
This commit is contained in:
jvelilla
2014-12-19 18:03:52 -03:00
parent bd26deb6c1
commit e2f02953f4
22 changed files with 1117 additions and 363 deletions

View File

@@ -0,0 +1,18 @@
<?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="config_tests" uuid="AD1DE0F7-BC8A-4A17-9A44-56C917BD5604">
<target name="config_tests">
<root class="TEST_CONFIG_READER_SET" feature="default_create"/>
<file_rule>
<exclude>/.git$</exclude>
<exclude>/EIFGENs$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="transitional" syntax="standard">
</option>
<setting name="concurrency" value="none"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="config" location="..\config-safe.ecf" readonly="false"/>
<library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/>
<tests name="src" location=".\"/>
</target>
</system>

View File

@@ -0,0 +1,18 @@
<?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="config_tests" uuid="AD1DE0F7-BC8A-4A17-9A44-56C917BD5604">
<target name="config_tests">
<root class="TEST_CONFIG_READER_SET" feature="default_create"/>
<file_rule>
<exclude>/.git$</exclude>
<exclude>/EIFGENs$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" void_safety="none" syntax="standard">
</option>
<setting name="concurrency" value="none"/>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="config" location="..\config.ecf" readonly="false"/>
<library name="testing" location="$ISE_LIBRARY\library\testing\testing.ecf"/>
<tests name="src" location=".\"/>
</target>
</system>

View File

@@ -0,0 +1,177 @@
note
description: "[
Testing suite for CONFIG_READER .
]"
author: "$Author: jfiat $"
date: "$Date: 2014-12-18 12:37:11 -0300 (ju. 18 de dic. de 2014) $"
revision: "$Revision: 96383 $"
class
TEST_CONFIG_READER_SET
inherit
EQA_TEST_SET
feature -- Test
test_ini
local
cfg: CONFIG_READER
do
create {INI_CONFIG} cfg.make_from_string ("[
foo = bar
[first]
abc = 1
def = and so on
ghi = "path"
[ second ]
this = 1
is = 2
the = 3
end = 4
]")
assert ("is valid", not cfg.has_error)
assert ("has_item (foo)", cfg.has_item ("foo"))
assert ("has_item (abc)", cfg.has_item ("abc"))
assert ("has_item (def)", cfg.has_item ("def"))
assert ("has_item (ghi)", cfg.has_item ("ghi"))
assert ("has_item (this)", cfg.has_item ("this"))
assert ("has_item (is)", cfg.has_item ("is"))
assert ("has_item (the)", cfg.has_item ("the"))
assert ("has_item (end)", cfg.has_item ("end"))
assert ("item (foo)", attached cfg.text_item ("foo") as v and then v.same_string_general ("bar"))
assert ("item (abc)", attached cfg.text_item ("abc") as v and then v.same_string_general ("1"))
assert ("item (def)", attached cfg.text_item ("def") as v and then v.same_string_general ("and so on"))
assert ("item (ghi)", attached cfg.text_item ("ghi") as v and then v.same_string_general ("%"path%""))
assert ("item (this)", attached cfg.text_item ("this") as v and then v.same_string_general ("1"))
assert ("item (is)", attached cfg.text_item ("is") as v and then v.same_string_general ("2"))
assert ("item (the)", attached cfg.text_item ("the") as v and then v.same_string_general ("3"))
assert ("item (end)", attached cfg.text_item ("end") as v and then v.same_string_general ("4"))
assert ("has_item (first.abc)", cfg.has_item ("first.abc"))
assert ("item (first.abc)", attached cfg.text_item ("first.abc") as v and then v.same_string_general ("1"))
assert ("has_item (second.is)", cfg.has_item ("second.is"))
assert ("item (second.is)", attached cfg.text_item ("second.is") as v and then v.same_string_general ("2"))
if attached cfg.sub_config ("second") as cfg_second then
assert ("has_item (is)", cfg_second.has_item ("is"))
assert ("item (is)", attached cfg_second.text_item ("is") as v and then v.same_string_general ("2"))
else
assert ("has second", False)
end
end
test_resolver_ini
local
cfg: CONFIG_READER
do
create {INI_CONFIG} cfg.make_from_string ("[
foo = bar
[extra]
a.b.c = abc
[expression]
text = ${foo}/${a.b.c}
]")
assert ("is valid", not cfg.has_error)
assert ("has_item (extra.a.b.c)", cfg.has_item ("extra.a.b.c"))
assert ("has_item (extra.a.b.c)", cfg.has_item ("extra.a.b.c"))
assert ("has_item (expression.text)", cfg.has_item ("expression.text"))
assert ("item (expression.text)", attached cfg.resolved_text_item ("expression.text") as s and then s.same_string_general ("bar/abc"))
end
test_deep_ini
local
cfg: CONFIG_READER
f: RAW_FILE
do
create f.make_with_name ("test_deep.ini")
f.create_read_write
f.put_string ("[
test = extra
[new]
enabled = true
]"
)
f.close
create {INI_CONFIG} cfg.make_from_string ("[
foo = bar
[extra]
a.b.c = abc
[outside]
before = include
@include=test_deep.ini
]")
f.delete
assert ("is valid", not cfg.has_error)
assert ("has_item (extra.a.b.c)", cfg.has_item ("extra.a.b.c"))
assert ("has_item (extra.a.b.c)", cfg.has_item ("extra.a.b.c"))
assert ("has_item (outside.new.enabled)", cfg.has_item ("outside.new.enabled"))
end
test_json
local
cfg: CONFIG_READER
do
create {JSON_CONFIG} cfg.make_from_string ("[
{
"foo": "bar",
"first": {
"abc": 1,
"def": "and so on",
"ghi": "\"path\""
},
"second": {
"this": 1,
"is": 2,
"the": 3,
"end": 4
}
}
]")
assert ("is valid", not cfg.has_error)
assert ("has_item (foo)", cfg.has_item ("foo"))
assert ("has_item (first.abc)", cfg.has_item ("first.abc"))
assert ("has_item (first.def)", cfg.has_item ("first.def"))
assert ("has_item (first.ghi)", cfg.has_item ("first.ghi"))
assert ("has_item (second.this)", cfg.has_item ("second.this"))
assert ("has_item (second.is)", cfg.has_item ("second.is"))
assert ("has_item (second.the)", cfg.has_item ("second.the"))
assert ("has_item (second.end)", cfg.has_item ("second.end"))
assert ("item (foo)", attached cfg.text_item ("foo") as v and then v.same_string_general ("bar"))
assert ("item (first.abc)", attached cfg.text_item ("first.abc") as v and then v.same_string_general ("1"))
assert ("item (first.def)", attached cfg.text_item ("first.def") as v and then v.same_string_general ("and so on"))
assert ("item (first.ghi)", attached cfg.text_item ("first.ghi") as v and then v.same_string_general ("%"path%""))
assert ("item (second.this)", attached cfg.text_item ("second.this") as v and then v.same_string_general ("1"))
assert ("item (second.is)", attached cfg.text_item ("second.is") as v and then v.same_string_general ("2"))
assert ("item (second.the)", attached cfg.text_item ("second.the") as v and then v.same_string_general ("3"))
assert ("item (second.end)", attached cfg.text_item ("second.end") as v and then v.same_string_general ("4"))
if attached cfg.sub_config ("second") as cfg_second then
assert ("has_item (is)", cfg_second.has_item ("is"))
assert ("item (is)", attached cfg_second.text_item ("is") as v and then v.same_string_general ("2"))
else
assert ("has second", False)
end
end
end