Fixed compilation of autotests suites for sqlite and mysql.

TODO: reintroduce tests for node management.
This commit is contained in:
2015-05-04 23:17:06 +02:00
parent 1603086905
commit fdff2bef36
8 changed files with 289 additions and 282 deletions

View File

@@ -29,13 +29,13 @@ feature {NONE} -- Initialization
storage.new_user (default_user) storage.new_user (default_user)
storage.new_user (custom_user ("u2", "p2", "e2")) storage.new_user (custom_user ("u2", "p2", "e2"))
l_node.set_author (storage.user_by_email (default_user.email)) l_node.set_author (storage.user_by_email (default_user.email))
storage.new_node (l_node) -- storage.new_node (l_node)
if attached {CMS_NODE} storage.node_by_id (1) as ll_node then -- if attached {CMS_NODE} storage.node_by_id (1) as ll_node then
storage.update_node_title (2,ll_node.id, "New Title") -- storage.update_node_title (2,ll_node.id, "New Title")
check -- check
attached {CMS_NODE} storage.node_by_id (1) as u_node and then not (u_node.title ~ ll_node.title) and then u_node.content ~ ll_node.content and then u_node.summary ~ ll_node.summary -- attached {CMS_NODE} storage.node_by_id (1) as u_node and then not (u_node.title ~ ll_node.title) and then u_node.content ~ ll_node.content and then u_node.summary ~ ll_node.summary
end -- end
end -- end
end end
@@ -64,9 +64,10 @@ feature {NONE} -- Implementation
Result := custom_node ("Default content", "default summary", "Default") Result := custom_node ("Default content", "default summary", "Default")
end end
custom_node (a_content, a_summary, a_title: READABLE_STRING_32): CMS_NODE custom_node (a_content, a_summary, a_title: READABLE_STRING_32): CMS_PAGE
do do
create Result.make (a_content, a_summary, a_title) create Result.make (a_title)
Result.set_content (a_content, a_summary, Void)
end end
end end

View File

@@ -167,192 +167,192 @@ feature -- Test routines
assert ("Valid password", storage.is_valid_credential ("test", "password")) assert ("Valid password", storage.is_valid_credential ("test", "password"))
end end
test_recent_nodes_empty -- test_recent_nodes_empty
do -- do
assert ("No recent nodes", storage.recent_nodes (0, 10).is_empty) -- assert ("No recent nodes", storage.recent_nodes (0, 10).is_empty)
end -- end
test_recent_nodes -- test_recent_nodes
local -- local
l_nodes: LIST[CMS_NODE] -- l_nodes: LIST[CMS_NODE]
l_node: CMS_NODE -- l_node: CMS_NODE
do -- do
storage.new_user (default_user) -- storage.new_user (default_user)
across 1 |..| 10 as c loop -- across 1 |..| 10 as c loop
l_node := custom_node ("Content_" + c.item.out, "Summary_" + c.item.out, "Title_" + c.item.out) -- l_node := custom_node ("Content_" + c.item.out, "Summary_" + c.item.out, "Title_" + c.item.out)
l_node.set_author (storage.user_by_email (default_user.email)) -- l_node.set_author (storage.user_by_email (default_user.email))
storage.new_node (l_node) -- storage.new_node (l_node)
end -- end
l_nodes := storage.recent_nodes (0, 10) -- l_nodes := storage.recent_nodes (0, 10)
assert ("10 recent nodes", l_nodes.count = 10) -- assert ("10 recent nodes", l_nodes.count = 10)
assert ("First node id=10", l_nodes.first.id = 10) -- assert ("First node id=10", l_nodes.first.id = 10)
assert ("Last node id=1", l_nodes.last.id = 1) -- assert ("Last node id=1", l_nodes.last.id = 1)
l_nodes := storage.recent_nodes (5, 10) -- l_nodes := storage.recent_nodes (5, 10)
assert ("5 recent nodes", l_nodes.count = 5) -- assert ("5 recent nodes", l_nodes.count = 5)
assert ("First node id=5", l_nodes.first.id = 5) -- assert ("First node id=5", l_nodes.first.id = 5)
assert ("Last node id=1", l_nodes.last.id = 1) -- assert ("Last node id=1", l_nodes.last.id = 1)
l_nodes := storage.recent_nodes (9, 10) -- l_nodes := storage.recent_nodes (9, 10)
assert ("1 recent nodes", l_nodes.count = 1) -- assert ("1 recent nodes", l_nodes.count = 1)
assert ("First node id=1", l_nodes.first.id = 1) -- assert ("First node id=1", l_nodes.first.id = 1)
assert ("Last node id=1", l_nodes.last.id = 1) -- assert ("Last node id=1", l_nodes.last.id = 1)
l_nodes := storage.recent_nodes (10, 10) -- l_nodes := storage.recent_nodes (10, 10)
assert ("Is empty", l_nodes.is_empty) -- assert ("Is empty", l_nodes.is_empty)
end -- end
test_node_does_not_exist -- test_node_does_not_exist
local -- local
l_node: CMS_NODE -- l_node: CMS_NODE
do -- do
storage.new_user (default_user) -- storage.new_user (default_user)
across 1 |..| 10 as c loop -- across 1 |..| 10 as c loop
l_node := custom_node ("Content_" + c.item.out, "Summary_" + c.item.out, "Title_" + c.item.out) -- l_node := custom_node ("Content_" + c.item.out, "Summary_" + c.item.out, "Title_" + c.item.out)
l_node.set_author (storage.user_by_email (default_user.email)) -- l_node.set_author (storage.user_by_email (default_user.email))
storage.new_node (l_node) -- storage.new_node (l_node)
end -- end
assert ("Not exist node id: 12", storage.node_by_id (12) = Void) -- assert ("Not exist node id: 12", storage.node_by_id (12) = Void)
end -- end
test_node -- test_node
local -- local
l_node: CMS_NODE -- l_node: CMS_NODE
do -- do
storage.new_user (default_user) -- storage.new_user (default_user)
across 1 |..| 10 as c loop -- across 1 |..| 10 as c loop
l_node := custom_node ("Content_" + c.item.out, "Summary_" + c.item.out, "Title_" + c.item.out) -- l_node := custom_node ("Content_" + c.item.out, "Summary_" + c.item.out, "Title_" + c.item.out)
l_node.set_author (storage.user_by_email (default_user.email)) -- l_node.set_author (storage.user_by_email (default_user.email))
storage.new_node (l_node) -- storage.new_node (l_node)
end -- end
assert ("Node id: 10", attached storage.node_by_id (10) as ll_node and then ll_node.title ~ "Title_10" ) -- assert ("Node id: 10", attached storage.node_by_id (10) as ll_node and then ll_node.title ~ "Title_10" )
end -- end
test_update_node -- test_update_node
local -- local
l_node: CMS_NODE -- l_node: CMS_NODE
do -- do
l_node := custom_node ("Content", "Summary", "Title") -- l_node := custom_node ("Content", "Summary", "Title")
storage.new_user (default_user) -- storage.new_user (default_user)
l_node.set_author (storage.user_by_email (default_user.email)) -- l_node.set_author (storage.user_by_email (default_user.email))
storage.new_node (l_node) -- storage.new_node (l_node)
if attached {CMS_NODE} storage.node_by_id (1) as ll_node then -- if attached {CMS_NODE} storage.node_by_id (1) as ll_node then
l_node := ll_node.twin -- l_node := ll_node.twin
l_node.set_content ("New Content") -- l_node.set_content ("New Content")
l_node.set_summary ("New Summary") -- l_node.set_summary ("New Summary")
l_node.set_title("New Title") -- l_node.set_title("New Title")
if attached storage.user_by_email (default_user.email) as l_user then -- if attached storage.user_by_email (default_user.email) as l_user then
l_node.set_author (l_user) -- l_node.set_author (l_user)
storage.update_node (l_node) -- storage.update_node (l_node)
assert ("Updated", attached {CMS_NODE} storage.node_by_id (1) as u_node and then not (u_node.title ~ ll_node.title) and then not (u_node.content ~ ll_node.content) and then not (u_node.summary ~ ll_node.summary)) -- assert ("Updated", attached {CMS_NODE} storage.node_by_id (1) as u_node and then not (u_node.title ~ ll_node.title) and then not (u_node.content ~ ll_node.content) and then not (u_node.summary ~ ll_node.summary))
end -- end
end -- end
end -- end
test_update_node_title -- test_update_node_title
local -- local
l_node: CMS_NODE -- l_node: CMS_NODE
do -- do
l_node := custom_node ("Content", "Summary", "Title") -- l_node := custom_node ("Content", "Summary", "Title")
storage.new_user (default_user) -- storage.new_user (default_user)
storage.new_user (custom_user ("u2", "p2", "e2")) -- storage.new_user (custom_user ("u2", "p2", "e2"))
l_node.set_author (storage.user_by_email (default_user.email)) -- l_node.set_author (storage.user_by_email (default_user.email))
storage.new_node (l_node) -- storage.new_node (l_node)
if attached {CMS_NODE} storage.node_by_id (1) as ll_node then -- if attached {CMS_NODE} storage.node_by_id (1) as ll_node then
storage.update_node_title (2,ll_node.id, "New Title") -- storage.update_node_title (2,ll_node.id, "New Title")
assert ("Updated", attached {CMS_NODE} storage.node_by_id (1) as u_node and then not (u_node.title ~ ll_node.title) and then u_node.content ~ ll_node.content and then u_node.summary ~ ll_node.summary) -- assert ("Updated", attached {CMS_NODE} storage.node_by_id (1) as u_node and then not (u_node.title ~ ll_node.title) and then u_node.content ~ ll_node.content and then u_node.summary ~ ll_node.summary)
end -- end
end -- end
test_update_node_summary -- test_update_node_summary
local -- local
l_node: CMS_NODE -- l_node: CMS_NODE
do -- do
l_node := custom_node ("Content", "Summary", "Title") -- l_node := custom_node ("Content", "Summary", "Title")
storage.new_user (default_user) -- storage.new_user (default_user)
storage.new_user (custom_user ("u2", "p2", "e2")) -- storage.new_user (custom_user ("u2", "p2", "e2"))
l_node.set_author (storage.user_by_email (default_user.email)) -- l_node.set_author (storage.user_by_email (default_user.email))
storage.new_node (l_node) -- storage.new_node (l_node)
if attached {CMS_NODE} storage.node_by_id (1) as ll_node then -- if attached {CMS_NODE} storage.node_by_id (1) as ll_node then
storage.update_node_summary (2,ll_node.id, "New Summary") -- storage.update_node_summary (2,ll_node.id, "New Summary")
assert ("Updated", attached {CMS_NODE} storage.node_by_id (1) as u_node and then u_node.title ~ ll_node.title and then u_node.content ~ ll_node.content and then not (u_node.summary ~ ll_node.summary)) -- assert ("Updated", attached {CMS_NODE} storage.node_by_id (1) as u_node and then u_node.title ~ ll_node.title and then u_node.content ~ ll_node.content and then not (u_node.summary ~ ll_node.summary))
end -- end
end -- end
test_update_node_content -- test_update_node_content
local -- local
l_node: CMS_NODE -- l_node: CMS_NODE
do -- do
l_node := custom_node ("Content", "Summary", "Title") -- l_node := custom_node ("Content", "Summary", "Title")
storage.new_user (default_user) -- storage.new_user (default_user)
storage.new_user (custom_user ("u2", "p2", "e2")) -- storage.new_user (custom_user ("u2", "p2", "e2"))
l_node.set_author (storage.user_by_email (default_user.email)) -- l_node.set_author (storage.user_by_email (default_user.email))
storage.new_node (l_node) -- storage.new_node (l_node)
if attached {CMS_NODE} storage.node_by_id (1) as ll_node then -- if attached {CMS_NODE} storage.node_by_id (1) as ll_node then
storage.update_node_content (2,ll_node.id, "New Content") -- storage.update_node_content (2,ll_node.id, "New Content")
assert ("Updated", attached {CMS_NODE} storage.node_by_id (1) as u_node and then u_node.title ~ ll_node.title and then not (u_node.content ~ ll_node.content) and then u_node.summary ~ ll_node.summary) -- assert ("Updated", attached {CMS_NODE} storage.node_by_id (1) as u_node and then u_node.title ~ ll_node.title and then not (u_node.content ~ ll_node.content) and then u_node.summary ~ ll_node.summary)
end -- end
end -- end
test_update_node_title_by_author -- test_update_node_title_by_author
local -- local
l_node: CMS_NODE -- l_node: CMS_NODE
do -- do
l_node := custom_node ("Content", "Summary", "Title") -- l_node := custom_node ("Content", "Summary", "Title")
storage.new_user (default_user) -- storage.new_user (default_user)
l_node.set_author (storage.user_by_email (default_user.email)) -- l_node.set_author (storage.user_by_email (default_user.email))
storage.new_node (l_node) -- storage.new_node (l_node)
if attached {CMS_NODE} storage.node_by_id (1) as ll_node then -- if attached {CMS_NODE} storage.node_by_id (1) as ll_node then
storage.update_node_title (1,ll_node.id, "New Title") -- storage.update_node_title (1,ll_node.id, "New Title")
assert ("Updated", attached {CMS_NODE} storage.node_by_id (1) as u_node and then not (u_node.title ~ ll_node.title) and then u_node.content ~ ll_node.content and then u_node.summary ~ ll_node.summary) -- assert ("Updated", attached {CMS_NODE} storage.node_by_id (1) as u_node and then not (u_node.title ~ ll_node.title) and then u_node.content ~ ll_node.content and then u_node.summary ~ ll_node.summary)
end -- end
end -- end
test_update_node_summary_by_author -- test_update_node_summary_by_author
local -- local
l_node: CMS_NODE -- l_node: CMS_NODE
do -- do
l_node := custom_node ("Content", "Summary", "Title") -- l_node := custom_node ("Content", "Summary", "Title")
storage.new_user (default_user) -- storage.new_user (default_user)
l_node.set_author (storage.user_by_email (default_user.email)) -- l_node.set_author (storage.user_by_email (default_user.email))
storage.new_node (l_node) -- storage.new_node (l_node)
if attached {CMS_NODE} storage.node_by_id (1) as ll_node then -- if attached {CMS_NODE} storage.node_by_id (1) as ll_node then
storage.update_node_summary (1,ll_node.id, "New Summary") -- storage.update_node_summary (1,ll_node.id, "New Summary")
assert ("Updated", attached {CMS_NODE} storage.node_by_id (1) as u_node and then u_node.title ~ ll_node.title and then u_node.content ~ ll_node.content and then not (u_node.summary ~ ll_node.summary)) -- assert ("Updated", attached {CMS_NODE} storage.node_by_id (1) as u_node and then u_node.title ~ ll_node.title and then u_node.content ~ ll_node.content and then not (u_node.summary ~ ll_node.summary))
end -- end
end -- end
test_update_node_content_by_author -- test_update_node_content_by_author
local -- local
l_node: CMS_NODE -- l_node: CMS_NODE
do -- do
l_node := custom_node ("Content", "Summary", "Title") -- l_node := custom_node ("Content", "Summary", "Title")
storage.new_user (default_user) -- storage.new_user (default_user)
l_node.set_author (storage.user_by_email (default_user.email)) -- l_node.set_author (storage.user_by_email (default_user.email))
storage.new_node (l_node) -- storage.new_node (l_node)
if attached {CMS_NODE} storage.node_by_id (1) as ll_node then -- if attached {CMS_NODE} storage.node_by_id (1) as ll_node then
storage.update_node_content (1,ll_node.id, "New Content") -- storage.update_node_content (1,ll_node.id, "New Content")
assert ("Updated", attached {CMS_NODE} storage.node_by_id (1) as u_node and then u_node.title ~ ll_node.title and then not (u_node.content ~ ll_node.content) and then u_node.summary ~ ll_node.summary) -- assert ("Updated", attached {CMS_NODE} storage.node_by_id (1) as u_node and then u_node.title ~ ll_node.title and then not (u_node.content ~ ll_node.content) and then u_node.summary ~ ll_node.summary)
end -- end
end -- end
test_delete_node -- test_delete_node
local -- local
l_node: CMS_NODE -- l_node: CMS_NODE
l_user: like {CMS_NODE}.author -- l_user: like {CMS_NODE}.author
do -- do
storage.new_user (custom_user ("test_delete", "testu", "email")) -- storage.new_user (custom_user ("test_delete", "testu", "email"))
l_user := storage.user_by_name ("test_delete") -- l_user := storage.user_by_name ("test_delete")
across 1 |..| 10 as c loop -- across 1 |..| 10 as c loop
l_node := custom_node ("Content_" + c.item.out, "Summary_" + c.item.out, "Title_" + c.item.out) -- l_node := custom_node ("Content_" + c.item.out, "Summary_" + c.item.out, "Title_" + c.item.out)
l_node.set_author (l_user) -- l_node.set_author (l_user)
storage.new_node (l_node) -- storage.new_node (l_node)
end -- end
assert ("Exist node id: 10", attached storage.node_by_id (10) as ll_node and then ll_node.title ~ "Title_10" ) -- assert ("Exist node id: 10", attached storage.node_by_id (10) as ll_node and then ll_node.title ~ "Title_10" )
storage.delete_node_by_id (10) -- storage.delete_node_by_id (10)
assert ("Not exist node id: 10", storage.node_by_id (10) = Void) -- assert ("Not exist node id: 10", storage.node_by_id (10) = Void)
end -- end
end end

View File

@@ -10,6 +10,7 @@
<library name="cms" location="..\..\..\..\cms-safe.ecf" readonly="false"/> <library name="cms" location="..\..\..\..\cms-safe.ecf" readonly="false"/>
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/> <library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/>
<library name="model" location="..\..\..\model\cms_model-safe.ecf"/> <library name="model" location="..\..\..\model\cms_model-safe.ecf"/>
<library name="module_node" location="..\..\..\..\modules\node\node-safe.ecf"/>
<library name="persitence_mysql" location="..\persistence_mysql-safe.ecf" readonly="false"/> <library name="persitence_mysql" location="..\persistence_mysql-safe.ecf" readonly="false"/>
<library name="process" location="$ISE_LIBRARY\library\process\process-safe.ecf"/> <library name="process" location="$ISE_LIBRARY\library\process\process-safe.ecf"/>
<library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/> <library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/>
@@ -18,6 +19,7 @@
<exclude>/EIFGENs$</exclude> <exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude> <exclude>/CVS$</exclude>
<exclude>/.svn$</exclude> <exclude>/.svn$</exclude>
<exclude>/nodes$</exclude>
</file_rule> </file_rule>
</cluster> </cluster>
</target> </target>

View File

@@ -75,11 +75,11 @@ feature -- Test routines
connection.begin_transaction connection.begin_transaction
u.set_email ("test@example.com") u.set_email ("test@example.com")
assert ("Has user:", storage.user_by_email ("test@example.com") /= Void) assert ("Has user:", storage.user_by_email ("test@example.com") /= Void)
storage.new_node (default_node) -- storage.new_node (default_node)
assert ("Has one node:", storage.nodes_count = 1) -- assert ("Has one node:", storage.nodes_count = 1)
connection.rollback connection.rollback
assert ("Not has user:", storage.user_by_email ("test@example.com") = Void) assert ("Not has user:", storage.user_by_email ("test@example.com") = Void)
assert ("Has no node:", storage.nodes_count = 0) -- assert ("Has no node:", storage.nodes_count = 0)
end end
end end

View File

@@ -41,8 +41,9 @@ feature {NONE} -- Fixture Factories: Nodes
Result := custom_node ("Default content", "default summary", "Default") Result := custom_node ("Default content", "default summary", "Default")
end end
custom_node (a_content, a_summary, a_title: READABLE_STRING_32): CMS_NODE custom_node (a_content, a_summary, a_title: READABLE_STRING_32): CMS_PAGE
do do
create Result.make (a_content, a_summary, a_title) create Result.make (a_title)
Result.set_content (a_content, a_summary, Void)
end end
end end

View File

@@ -167,107 +167,107 @@ feature -- Test routines
assert ("Valid password", storage.is_valid_credential ("test", "password")) assert ("Valid password", storage.is_valid_credential ("test", "password"))
end end
test_recent_nodes_empty -- test_recent_nodes_empty
do -- do
assert ("No recent nodes", storage.recent_nodes (0, 10).is_empty) -- assert ("No recent nodes", storage.recent_nodes (0, 10).is_empty)
end -- end
test_recent_nodes -- test_recent_nodes
local -- local
l_nodes: LIST[CMS_NODE] -- l_nodes: LIST[CMS_NODE]
do -- do
across 1 |..| 10 as c loop -- across 1 |..| 10 as c loop
storage.new_node (custom_node ("Content_" + c.item.out, "Summary_" + c.item.out, "Title_" + c.item.out)) -- storage.new_node (custom_node ("Content_" + c.item.out, "Summary_" + c.item.out, "Title_" + c.item.out))
end -- end
l_nodes := storage.recent_nodes (0, 10) -- l_nodes := storage.recent_nodes (0, 10)
assert ("10 recent nodes", l_nodes.count = 10) -- assert ("10 recent nodes", l_nodes.count = 10)
assert ("First node id=10", l_nodes.first.id = 10) -- assert ("First node id=10", l_nodes.first.id = 10)
assert ("Last node id=1", l_nodes.last.id = 1) -- assert ("Last node id=1", l_nodes.last.id = 1)
l_nodes := storage.recent_nodes (5, 10) -- l_nodes := storage.recent_nodes (5, 10)
assert ("5 recent nodes", l_nodes.count = 5) -- assert ("5 recent nodes", l_nodes.count = 5)
assert ("First node id=5", l_nodes.first.id = 5) -- assert ("First node id=5", l_nodes.first.id = 5)
assert ("Last node id=1", l_nodes.last.id = 1) -- assert ("Last node id=1", l_nodes.last.id = 1)
l_nodes := storage.recent_nodes (9, 10) -- l_nodes := storage.recent_nodes (9, 10)
assert ("1 recent nodes", l_nodes.count = 1) -- assert ("1 recent nodes", l_nodes.count = 1)
assert ("First node id=1", l_nodes.first.id = 1) -- assert ("First node id=1", l_nodes.first.id = 1)
assert ("Last node id=1", l_nodes.last.id = 1) -- assert ("Last node id=1", l_nodes.last.id = 1)
l_nodes := storage.recent_nodes (10, 10) -- l_nodes := storage.recent_nodes (10, 10)
assert ("Is empty", l_nodes.is_empty) -- assert ("Is empty", l_nodes.is_empty)
end -- end
test_node_does_not_exist -- test_node_does_not_exist
do -- do
across 1 |..| 10 as c loop -- across 1 |..| 10 as c loop
storage.new_node (custom_node ("Content_" + c.item.out, "Summary_" + c.item.out, "Title_" + c.item.out)) -- storage.new_node (custom_node ("Content_" + c.item.out, "Summary_" + c.item.out, "Title_" + c.item.out))
end -- end
assert ("Not exist node id: 12", storage.node_by_id (12) = Void) -- assert ("Not exist node id: 12", storage.node_by_id (12) = Void)
end -- end
test_node -- test_node
do -- do
across 1 |..| 10 as c loop -- across 1 |..| 10 as c loop
storage.new_node (custom_node ("Content_" + c.item.out, "Summary_" + c.item.out, "Title_" + c.item.out)) -- storage.new_node (custom_node ("Content_" + c.item.out, "Summary_" + c.item.out, "Title_" + c.item.out))
end -- end
assert ("has nodes", storage.nodes.count > 5) -- assert ("has nodes", storage.nodes.count > 5)
assert ("Node id: 10", attached storage.node_by_id (10) as l_node and then l_node.title ~ "Title_10" ) -- assert ("Node id: 10", attached storage.node_by_id (10) as l_node and then l_node.title ~ "Title_10" )
end -- end
test_update_node -- test_update_node
local -- local
l_node: CMS_NODE -- l_node: CMS_NODE
do -- do
storage.new_node (custom_node ("Content", "Summary", "Title")) -- storage.new_node (custom_node ("Content", "Summary", "Title"))
if attached {CMS_NODE} storage.node_by_id (1) as ll_node then -- if attached {CMS_NODE} storage.node_by_id (1) as ll_node then
l_node := ll_node.twin -- l_node := ll_node.twin
l_node.set_content ("New Content") -- l_node.set_content ("New Content")
l_node.set_summary ("New Summary") -- l_node.set_summary ("New Summary")
l_node.set_title("New Title") -- l_node.set_title("New Title")
-- storage.update_node (l_node) ---- storage.update_node (l_node)
assert ("Updated", attached {CMS_NODE} storage.node_by_id (1) as u_node and then not (u_node.title ~ ll_node.title) and then not (u_node.content ~ ll_node.content) and then not (u_node.summary ~ ll_node.summary)) -- assert ("Updated", attached {CMS_NODE} storage.node_by_id (1) as u_node and then not (u_node.title ~ ll_node.title) and then not (u_node.content ~ ll_node.content) and then not (u_node.summary ~ ll_node.summary))
end -- end
end -- end
test_update_node_title -- test_update_node_title
do -- do
storage.new_node (custom_node ("Content", "Summary", "Title")) -- storage.new_node (custom_node ("Content", "Summary", "Title"))
if attached {CMS_NODE} storage.node_by_id (1) as ll_node then -- if attached {CMS_NODE} storage.node_by_id (1) as ll_node then
-- storage.update_node_title (ll_node.id, "New Title") ---- storage.update_node_title (ll_node.id, "New Title")
assert ("Updated", attached {CMS_NODE} storage.node_by_id (1) as u_node and then not (u_node.title ~ ll_node.title) and then u_node.content ~ ll_node.content and then u_node.summary ~ ll_node.summary) -- assert ("Updated", attached {CMS_NODE} storage.node_by_id (1) as u_node and then not (u_node.title ~ ll_node.title) and then u_node.content ~ ll_node.content and then u_node.summary ~ ll_node.summary)
end -- end
end -- end
test_update_node_summary -- test_update_node_summary
do -- do
storage.new_node (custom_node ("Content", "Summary", "Title")) -- storage.new_node (custom_node ("Content", "Summary", "Title"))
if attached {CMS_NODE} storage.node_by_id (1) as ll_node then -- if attached {CMS_NODE} storage.node_by_id (1) as ll_node then
-- storage.update_node_summary (ll_node.id, "New Summary") ---- storage.update_node_summary (ll_node.id, "New Summary")
assert ("Updated", attached {CMS_NODE} storage.node_by_id (1) as u_node and then u_node.title ~ ll_node.title and then u_node.content ~ ll_node.content and then not (u_node.summary ~ ll_node.summary)) -- assert ("Updated", attached {CMS_NODE} storage.node_by_id (1) as u_node and then u_node.title ~ ll_node.title and then u_node.content ~ ll_node.content and then not (u_node.summary ~ ll_node.summary))
end -- end
end -- end
test_update_node_content -- test_update_node_content
do -- do
storage.new_node (custom_node ("Content", "Summary", "Title")) -- storage.new_node (custom_node ("Content", "Summary", "Title"))
if attached {CMS_NODE} storage.node_by_id (1) as ll_node then -- if attached {CMS_NODE} storage.node_by_id (1) as ll_node then
-- storage.update_node_content (ll_node.id, "New Content") ---- storage.update_node_content (ll_node.id, "New Content")
assert ("Updated", attached {CMS_NODE} storage.node_by_id (1) as u_node and then u_node.title ~ ll_node.title and then not (u_node.content ~ ll_node.content) and then u_node.summary ~ ll_node.summary) -- assert ("Updated", attached {CMS_NODE} storage.node_by_id (1) as u_node and then u_node.title ~ ll_node.title and then not (u_node.content ~ ll_node.content) and then u_node.summary ~ ll_node.summary)
end -- end
end -- end
test_delete_node -- test_delete_node
do -- do
across 1 |..| 10 as c loop -- across 1 |..| 10 as c loop
storage.new_node (custom_node ("Content_" + c.item.out, "Summary_" + c.item.out, "Title_" + c.item.out)) -- storage.new_node (custom_node ("Content_" + c.item.out, "Summary_" + c.item.out, "Title_" + c.item.out))
end -- end
assert ("Exist node id: 10", attached storage.node_by_id (10) as l_node and then l_node.title ~ "Title_10" ) -- assert ("Exist node id: 10", attached storage.node_by_id (10) as l_node and then l_node.title ~ "Title_10" )
storage.delete_node_by_id (10) -- storage.delete_node_by_id (10)
assert ("Not exist node id: 10", storage.node_by_id (10) = Void) -- assert ("Not exist node id: 10", storage.node_by_id (10) = Void)
end -- end
end end

View File

@@ -10,6 +10,7 @@
<library name="cms" location="..\..\..\..\cms-safe.ecf" readonly="false"/> <library name="cms" location="..\..\..\..\cms-safe.ecf" readonly="false"/>
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/> <library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/>
<library name="model" location="..\..\..\model\cms_model-safe.ecf"/> <library name="model" location="..\..\..\model\cms_model-safe.ecf"/>
<library name="module_node" location="..\..\..\..\modules\node\node-safe.ecf"/>
<library name="persitence_sqlite" location="..\persistence_sqlite-safe.ecf" readonly="false"/> <library name="persitence_sqlite" location="..\persistence_sqlite-safe.ecf" readonly="false"/>
<library name="process" location="$ISE_LIBRARY\library\process\process-safe.ecf"/> <library name="process" location="$ISE_LIBRARY\library\process\process-safe.ecf"/>
<library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/> <library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/>
@@ -18,6 +19,7 @@
<exclude>/EIFGENs$</exclude> <exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude> <exclude>/CVS$</exclude>
<exclude>/.svn$</exclude> <exclude>/.svn$</exclude>
<exclude>/nodes$</exclude>
</file_rule> </file_rule>
</cluster> </cluster>
</target> </target>

View File

@@ -38,17 +38,18 @@ feature {NONE} -- Fixture Factory: Users
Result.set_email (a_email) Result.set_email (a_email)
end end
feature {NONE} -- Fixture Factories: Nodes --feature {NONE} -- Fixture Factories: Nodes
default_node: CMS_NODE -- default_node: CMS_NODE
do -- do
Result := custom_node ("Default content", "default summary", "Default") -- Result := custom_node ("Default content", "default summary", "Default")
end -- end
custom_node (a_content, a_summary, a_title: READABLE_STRING_32): CMS_NODE -- custom_node (a_content, a_summary, a_title: READABLE_STRING_32): CMS_PAGE
do -- do
create Result.make (a_content, a_summary, a_title) -- create Result.make (a_title)
end -- Result.set_content (a_content, a_summary, Void)
-- end
end end