Updated CMS_STORAGE interface.

Added test cased for MySQL implementation.
This commit is contained in:
jvelilla
2014-09-20 19:55:43 -03:00
parent ce05da15b5
commit fb9157dbb4
7 changed files with 317 additions and 139 deletions

View File

@@ -19,7 +19,6 @@ feature -- Access: user
do
end
all_users: LIST [CMS_USER]
do
create {ARRAYED_LIST[CMS_USER]} Result.make (0)
@@ -119,36 +118,26 @@ feature -- Node
do
end
update_node (a_node: CMS_NODE)
update_node (a_id: like {CMS_NODE}.id; a_node: CMS_NODE)
-- <Precursor>
do
end
update_node_title (a_id: INTEGER_64; a_title: READABLE_STRING_32)
update_node_title (a_id: like {CMS_NODE}.id; a_node_id: like {CMS_NODE}.id; a_title: READABLE_STRING_32)
-- <Precursor>
do
end
update_node_summary (a_id: INTEGER_64; a_summary: READABLE_STRING_32)
update_node_summary (a_id: like {CMS_NODE}.id; a_node_id: like {CMS_NODE}.id; a_summary: READABLE_STRING_32)
-- <Precursor>
do
end
update_node_content (a_id: INTEGER_64; a_content: READABLE_STRING_32)
update_node_content (a_id: like {CMS_NODE}.id; a_node_id: like {CMS_NODE}.id; a_content: READABLE_STRING_32)
-- <Precursor>
do
end
add_node_author (a_node_id: like {CMS_NODE}.id; a_user_id: like {CMS_USER}.id)
-- Add author `a_user_id' to the node `a_node_id'.
do
end
add_node_collaborator (a_node_id: like {CMS_NODE}.id; a_user_id: like {CMS_USER}.id)
-- Add/Update collaborator with `a_user_id' to the node `a_node_id'.
do
end
feature -- User
new_user (a_user: CMS_USER)

View File

@@ -38,7 +38,6 @@ feature -- Access: user
post_user_provider_execution
end
all_users: LIST [CMS_USER]
do
to_implement("Not implemented!!!")
@@ -132,7 +131,7 @@ feature -- Change: user
then
user_provider.new_user (a_user.name, l_password, l_email)
else
-- set error
set_last_error ("User or Password not attached", generator + ".save_user")
end
end
@@ -165,25 +164,24 @@ feature -- Access: node
post_node_provider_execution
end
node_author (a_id: like {CMS_NODE}.id): detachable CMS_USER
-- <Precursor>
do
fixme ("Not implemented")
Result := node_provider.node_author (a_id)
post_node_provider_execution
end
node_collaborators (a_id: like {CMS_NODE}.id): LIST [CMS_USER]
-- Possible list of node's collaborator.
do
fixme ("Not implemented")
create {ARRAYED_LIST[CMS_USER]} Result.make (0)
across node_provider.node_collaborators (a_id) as c loop Result.force (c.item) end
end
feature -- Node
save_node (a_node: CMS_NODE)
-- Add a new node
-- <Precursor>
do
node_provider.new_node (a_node)
post_node_provider_execution
@@ -195,42 +193,48 @@ feature -- Node
post_node_provider_execution
end
update_node (a_node: CMS_NODE)
update_node (a_id: like {CMS_USER}.id; a_node: CMS_NODE)
-- <Precursor>
do
node_provider.update_node (a_node)
node_provider.update_node (a_id, a_node)
post_node_provider_execution
end
update_node_title (a_id: INTEGER_64; a_title: READABLE_STRING_32)
update_node_title (a_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_title: READABLE_STRING_32)
-- <Precursor>
do
node_provider.update_node_title (a_id, a_title)
node_provider.update_node_title (a_node_id, a_title)
internal_node_update (a_id, a_node_id)
post_node_provider_execution
end
update_node_summary (a_id: INTEGER_64; a_summary: READABLE_STRING_32)
update_node_summary (a_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_summary: READABLE_STRING_32)
-- <Precursor>
do
node_provider.update_node_summary (a_id, a_summary)
node_provider.update_node_summary (a_node_id, a_summary)
internal_node_update (a_id, a_node_id)
post_node_provider_execution
end
update_node_content (a_id: INTEGER_64; a_content: READABLE_STRING_32)
update_node_content (a_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_content: READABLE_STRING_32)
-- <Precursor>
do
node_provider.update_node_content (a_id, a_content)
node_provider.update_node_content (a_node_id, a_content)
internal_node_update (a_id, a_node_id)
post_node_provider_execution
end
feature {NONE} -- NODE Implemenation
add_node_author (a_node_id: like {CMS_NODE}.id; a_user_id: like {CMS_USER}.id)
-- Add author `a_user_id' to the node `a_node_id'.
do
fixme ("Not Implemented")
end
add_node_collaborator (a_node_id: like {CMS_NODE}.id; a_user_id: like {CMS_USER}.id)
-- Add/Update collaborator with `a_user_id' to the node `a_node_id'.
do
fixme ("Not implemented")
end
internal_node_update (a_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id)
-- Update node editor or add collaborator.
do
if not node_provider.is_collaborator (a_id, a_node_id) then
node_provider.add_collaborator (a_id, a_node_id)
else
node_provider.update_node_last_editor (a_id, a_node_id)
end
end
feature -- User

View File

@@ -100,6 +100,22 @@ feature -- Access
post_execution
end
last_inserted_node_id: INTEGER
-- Last insert node id.
local
l_parameters: STRING_TABLE [ANY]
do
log.write_information (generator + ".last_inserted_node_id")
create l_parameters.make (0)
db_handler.set_query (create {DATABASE_QUERY}.data_reader (Sql_last_insert_node_id, l_parameters))
db_handler.execute_query
if db_handler.count = 1 then
Result := db_handler.read_integer_32 (1)
end
post_execution
end
feature -- Basic operations
new_node (a_node: CMS_NODE)
@@ -108,16 +124,27 @@ feature -- Basic operations
l_parameters: STRING_TABLE [ANY]
do
log.write_information (generator + ".new_node")
create l_parameters.make (6)
create l_parameters.make (7)
l_parameters.put (a_node.title, "title")
l_parameters.put (a_node.summary, "summary")
l_parameters.put (a_node.content, "content")
l_parameters.put (a_node.publication_date, "publication_date")
l_parameters.put (a_node.creation_date, "creation_date")
l_parameters.put (a_node.modification_date, "modification_date")
if
attached a_node.author as l_author and then
l_author.id > 0
then
l_parameters.put (l_author.id, "author_id")
end
db_handler.set_query (create {DATABASE_QUERY}.data_reader (sql_insert_node, l_parameters))
db_handler.execute_change
a_node.set_id (last_inserted_node_id)
post_execution
end
update_node_title (a_id: INTEGER_64; a_title: READABLE_STRING_32)
@@ -165,7 +192,7 @@ feature -- Basic operations
post_execution
end
update_node (a_node: CMS_NODE)
update_node (a_id: like {CMS_USER}.id; a_node: CMS_NODE)
-- Update node.
local
l_parameters: STRING_TABLE [ANY]
@@ -176,9 +203,9 @@ feature -- Basic operations
l_parameters.put (a_node.summary, "summary")
l_parameters.put (a_node.content, "content")
l_parameters.put (a_node.publication_date, "publication_date")
l_parameters.put (a_node.creation_date, "creation_date")
l_parameters.put (create {DATE_TIME}.make_now_utc, "modification_date")
l_parameters.put (a_node.id, "id")
l_parameters.put (a_id, "editor")
db_handler.set_query (create {DATABASE_QUERY}.data_reader (sql_update_node, l_parameters))
db_handler.execute_change
post_execution
@@ -227,6 +254,21 @@ feature -- Basic Operations: User_Nodes
post_execution
end
update_node_last_editor (a_user_id: INTEGER_64; a_node_id: INTEGER_64)
-- Update node last editor.
local
l_parameters: STRING_TABLE [detachable ANY]
do
log.write_information (generator + ".add_collaborator")
create l_parameters.make (2)
l_parameters.put (a_user_id,"users_id")
l_parameters.put (a_node_id,"nodes_id")
db_handler.set_query (create {DATABASE_QUERY}.data_reader (Slq_update_editor, l_parameters))
db_handler.execute_change
post_execution
end
author_nodes (a_id:INTEGER_64): DATABASE_ITERATION_CURSOR [CMS_NODE]
-- List of Nodes for the given user `a_id'. (the user is the author of the node)
local
@@ -286,6 +328,24 @@ feature -- Basic Operations: User_Nodes
post_execution
end
is_collaborator (a_user_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id): BOOLEAN
-- Is the user `a_user_id' a collaborator of node `a_node_id'
local
l_parameters: STRING_TABLE [ANY]
do
log.write_information (generator + ".node_collaborators")
create l_parameters.make (2)
l_parameters.put (a_user_id, "user_id")
l_parameters.put (a_node_id, "node_id")
db_handler.set_query (create {DATABASE_QUERY}.data_reader (select_exist_user_node, l_parameters))
db_handler.execute_query
if db_handler.count = 1 then
Result := db_handler.read_integer_32 (1) = 1
end
post_execution
end
feature -- Connection
connect
@@ -315,7 +375,7 @@ feature {NONE} -- Queries
Select_recent_nodes: STRING = "select * from Nodes order by id desc, publication_date desc Limit $offset , :rows "
SQL_Insert_node: STRING = "insert into nodes (title, summary, content, publication_date, creation_date, modification_date) values (:title, :summary, :content, :publication_date, :creation_date, :modification_date);"
SQL_Insert_node: STRING = "insert into nodes (title, summary, content, publication_date, creation_date, modification_date, author_id) values (:title, :summary, :content, :publication_date, :creation_date, :modification_date, :author_id);"
-- SQL Insert to add a new node.
SQL_Update_node_title: STRING ="update nodes SET title=:title, modification_date=:modification_date, version = version + 1 where id=:id;"
@@ -327,13 +387,18 @@ feature {NONE} -- Queries
SQL_Update_node_content: STRING ="update nodes SET content=:content, modification_date=:modification_date, version = version + 1 where id=:id;"
-- SQL node content.
SQL_Update_node : STRING = "update nodes SET title=:title, summary=:summary, content=:content, publication_date=:publication_date, creation_date=:creation_date, modification_date=:modification_date where id=:id;"
Slq_update_editor: STRING ="update nodes SET editor_id=:users_id where id=:nodes_id;"
-- SQL node content.
SQL_Update_node : STRING = "update nodes SET title=:title, summary=:summary, content=:content, publication_date=:publication_date, modification_date=:modification_date, version = version + 1, editor_id=:editor where id=:id;"
-- SQL node.
SQL_Delete_node: STRING = "delete from nodes where id=:id;"
Sql_update_node_author: STRING = "update nodes SET author_id=:user_id where id=:id;"
Sql_last_insert_node_id: STRING = "SELECT MAX(id) from nodes;"
feature {NONE} -- Sql Queries: USER_ROLES collaborators, author
Sql_insert_users_nodes: STRING = "insert into users_nodes (users_id, nodes_id) values (:users_id, :nodes_id);"
@@ -346,6 +411,9 @@ feature {NONE} -- Sql Queries: USER_ROLES collaborators, author
Select_user_collaborator: STRING = "SELECT * FROM Nodes INNER JOIN users_nodes ON users_nodes.nodes_id = nodes.id and users_nodes.users_id = :user_id;"
Select_exist_user_node: STRING= "Select Count(*) from Users_nodes where users_id=:user_id and nodes_id=:node_id;"
feature --

View File

@@ -23,62 +23,92 @@ feature {NONE} -- Initialization
l_profile, l_db_profile: CMS_USER_PROFILE
l_cursor: TABLE_ITERATION_CURSOR [READABLE_STRING_8, READABLE_STRING_8]
l_list: LIST[CMS_NODE]
storage: CMS_STORAGE
l_node: CMS_NODE
do
create connection.login_with_schema ("cms_dev", "root", "")
create user.make (connection)
create node.make (connection)
-- create user.make (connection)
-- create node.make (connection)
(create {CLEAN_DB}).clean_db(connection)
user.new_user ("test", "test","test@admin.com")
if attached {CMS_USER} user.user_by_name ("test") as l_user then
create l_profile.make
l_profile.force ("Eiffel", "language")
l_profile.force ("Argentina", "country")
l_profile.force ("GMT-3", "time zone")
user.save_profile (l_user.id, l_profile)
l_db_profile := user.user_profile (l_user.id)
from
l_cursor := l_db_profile.new_cursor
until
l_cursor.after
loop
print (l_cursor.item + " - " + l_cursor.key + "%N")
l_cursor.forth
create {CMS_STORAGE_MYSQL} storage.make (connection)
l_node := custom_node ("Content", "Summary", "Title")
storage.save_user (default_user)
storage.save_user (custom_user ("u2", "p2", "e2"))
l_node.set_author (storage.user_by_email (default_user.email))
storage.save_node (l_node)
if attached {CMS_NODE} storage.node (1) as ll_node then
storage.update_node_title (2,ll_node.id, "New Title")
check
attached {CMS_NODE} storage.node (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
create {ARRAYED_LIST[CMS_NODE]} l_list.make (0)
node.new_node (default_node)
node.new_node (custom_node ("content1", "summary1", "title1"))
node.new_node (custom_node ("content2", "summary2", "title2"))
node.new_node (custom_node ("content3", "summary3", "title3"))
user.new_user ("u1", "u1", "email")
if attached user.user_by_name ("u1") as ll_user then
node.add_collaborator (l_user.id, 1)
node.add_collaborator (l_user.id, 2)
node.add_collaborator (l_user.id, 3)
node.add_collaborator (l_user.id, 4)
across node.node_collaborators (1) as c loop
print (c.item.name)
end
end
if attached user.user_by_name ("u1") as ll_user then
node.add_author (ll_user.id, 1)
if attached node.node_author (1) as l_author then
print (l_author.name)
end
end
end
-- user.new_user ("test", "test","test@admin.com")
-- if attached {CMS_USER} user.user_by_name ("test") as l_user then
-- create l_profile.make
-- l_profile.force ("Eiffel", "language")
-- l_profile.force ("Argentina", "country")
-- l_profile.force ("GMT-3", "time zone")
-- user.save_profile (l_user.id, l_profile)
-- l_db_profile := user.user_profile (l_user.id)
-- from
-- l_cursor := l_db_profile.new_cursor
-- until
-- l_cursor.after
-- loop
-- print (l_cursor.item + " - " + l_cursor.key + "%N")
-- l_cursor.forth
-- end
-- create {ARRAYED_LIST[CMS_NODE]} l_list.make (0)
-- node.new_node (default_node)
-- node.new_node (custom_node ("content1", "summary1", "title1"))
-- node.new_node (custom_node ("content2", "summary2", "title2"))
-- node.new_node (custom_node ("content3", "summary3", "title3"))
-- user.new_user ("u1", "u1", "email")
-- if attached user.user_by_name ("u1") as ll_user then
-- node.add_collaborator (ll_user.id, 1)
-- node.add_collaborator (ll_user.id, 2)
-- node.add_collaborator (ll_user.id, 3)
-- node.add_collaborator (ll_user.id, 4)
-- across node.collaborator_nodes (l_user.id) as c loop
-- print (c.item.title)
-- end
-- end
-- if attached user.user_by_name ("u1") as ll_user then
-- node.add_author (ll_user.id, 1)
-- if attached node.node_author (1) as l_author then
-- print (l_author.name)
-- end
-- end
-- end
end
feature {NONE} -- Fixture Factory: Users
default_user: CMS_USER
do
Result := custom_user ("test", "password", "test@test.com")
end
custom_user (a_name, a_password, a_email: READABLE_STRING_32): CMS_USER
do
create Result.make (a_name)
Result.set_password (a_password)
Result.set_email (a_email)
end
feature {NONE} -- Implementation
connection: DATABASE_CONNECTION_MYSQL

View File

@@ -68,7 +68,7 @@ feature -- Test routines
if attached {CMS_NODE} node_provider.node (1) as l_un then
l_un.set_content ("<h1>Updating test node udpate </h1>")
l_un.set_summary ("updating summary")
node_provider.update_node (l_un)
node_provider.update_node (0,l_un)
assert ("Exist node with id 1", attached {CMS_NODE} node_provider.node (1) as ll_node and then not (ll_node.content ~ l_node.content) and then not (ll_node.summary ~ l_node.summary) and then ll_node.title ~ l_node.title )
assert ("Exist node with id 1", attached {CMS_NODE} node_provider.node (1) as ll_node and then ll_node.content ~ l_un.content and then ll_node.summary ~ l_un.summary and then ll_node.title ~ l_un.title )
end
@@ -78,7 +78,7 @@ feature -- Test routines
l_un.set_content ("<h1>Updating test node udpate </h1>")
l_un.set_summary ("updating summary")
l_un.set_title ("Updating Test case")
node_provider.update_node (l_un)
node_provider.update_node (0,l_un)
assert ("Exist node with id 1", attached {CMS_NODE} node_provider.node (1) as ll_node and then not (ll_node.content ~ l_node.content) and then not (ll_node.summary ~ l_node.summary) and then not (ll_node.title ~ l_node.title) )
assert ("Exist node with id 1", attached {CMS_NODE} node_provider.node (1) as ll_node and then ll_node.content ~ l_un.content and then ll_node.summary ~ l_un.summary and then ll_node.title ~ l_un.title )
end

View File

@@ -175,9 +175,13 @@ feature -- Test routines
test_recent_nodes
local
l_nodes: LIST[CMS_NODE]
l_node: CMS_NODE
do
storage.save_user (default_user)
across 1 |..| 10 as c loop
storage.save_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))
storage.save_node (l_node)
end
l_nodes := storage.recent_nodes (0, 10)
assert ("10 recent nodes", l_nodes.count = 10)
@@ -200,70 +204,152 @@ feature -- Test routines
end
test_node_does_not_exist
local
l_node: CMS_NODE
do
storage.save_user (default_user)
across 1 |..| 10 as c loop
storage.save_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))
storage.save_node (l_node)
end
assert ("Not exist node id: 12", storage.node (12) = Void)
end
test_node
local
l_node: CMS_NODE
do
storage.save_user (default_user)
across 1 |..| 10 as c loop
storage.save_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))
storage.save_node (l_node)
end
assert ("Node id: 10", attached storage.node (10) as l_node and then l_node.title ~ "Title_10" )
assert ("Node id: 10", attached storage.node (10) as ll_node and then ll_node.title ~ "Title_10" )
end
test_update_node
local
l_node: CMS_NODE
do
storage.save_node (custom_node ("Content", "Summary", "Title"))
l_node := custom_node ("Content", "Summary", "Title")
storage.save_user (default_user)
l_node.set_author (storage.user_by_email (default_user.email))
storage.save_node (l_node)
if attached {CMS_NODE} storage.node (1) as ll_node then
l_node := ll_node.twin
l_node.set_content ("New Content")
l_node.set_summary ("New Summary")
l_node.set_title("New Title")
storage.update_node (l_node)
assert ("Updated", attached {CMS_NODE} storage.node (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))
if attached storage.user_by_email (default_user.email) as l_user then
storage.update_node (l_user.id,l_node)
assert ("Updated", attached {CMS_NODE} storage.node (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
test_update_node_title
local
l_node: CMS_NODE
do
storage.save_node (custom_node ("Content", "Summary", "Title"))
l_node := custom_node ("Content", "Summary", "Title")
storage.save_user (default_user)
storage.save_user (custom_user ("u2", "p2", "e2"))
l_node.set_author (storage.user_by_email (default_user.email))
storage.save_node (l_node)
if attached {CMS_NODE} storage.node (1) as ll_node then
storage.update_node_title (ll_node.id, "New Title")
storage.update_node_title (2,ll_node.id, "New Title")
assert ("Updated", attached {CMS_NODE} storage.node (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
test_update_node_summary
local
l_node: CMS_NODE
do
storage.save_node (custom_node ("Content", "Summary", "Title"))
l_node := custom_node ("Content", "Summary", "Title")
storage.save_user (default_user)
storage.save_user (custom_user ("u2", "p2", "e2"))
l_node.set_author (storage.user_by_email (default_user.email))
storage.save_node (l_node)
if attached {CMS_NODE} storage.node (1) as ll_node then
storage.update_node_summary (ll_node.id, "New Summary")
storage.update_node_summary (2,ll_node.id, "New Summary")
assert ("Updated", attached {CMS_NODE} storage.node (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
test_update_node_content
local
l_node: CMS_NODE
do
storage.save_node (custom_node ("Content", "Summary", "Title"))
l_node := custom_node ("Content", "Summary", "Title")
storage.save_user (default_user)
storage.save_user (custom_user ("u2", "p2", "e2"))
l_node.set_author (storage.user_by_email (default_user.email))
storage.save_node (l_node)
if attached {CMS_NODE} storage.node (1) as ll_node then
storage.update_node_content (ll_node.id, "New Content")
storage.update_node_content (2,ll_node.id, "New Content")
assert ("Updated", attached {CMS_NODE} storage.node (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
test_update_node_title_by_author
local
l_node: CMS_NODE
do
l_node := custom_node ("Content", "Summary", "Title")
storage.save_user (default_user)
l_node.set_author (storage.user_by_email (default_user.email))
storage.save_node (l_node)
if attached {CMS_NODE} storage.node (1) as ll_node then
storage.update_node_title (1,ll_node.id, "New Title")
assert ("Updated", attached {CMS_NODE} storage.node (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
test_update_node_summary_by_author
local
l_node: CMS_NODE
do
l_node := custom_node ("Content", "Summary", "Title")
storage.save_user (default_user)
l_node.set_author (storage.user_by_email (default_user.email))
storage.save_node (l_node)
if attached {CMS_NODE} storage.node (1) as ll_node then
storage.update_node_summary (1,ll_node.id, "New Summary")
assert ("Updated", attached {CMS_NODE} storage.node (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
test_update_node_content_by_author
local
l_node: CMS_NODE
do
l_node := custom_node ("Content", "Summary", "Title")
storage.save_user (default_user)
l_node.set_author (storage.user_by_email (default_user.email))
storage.save_node (l_node)
if attached {CMS_NODE} storage.node (1) as ll_node then
storage.update_node_content (1,ll_node.id, "New Content")
assert ("Updated", attached {CMS_NODE} storage.node (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
test_delete_node
local
l_node: CMS_NODE
l_user: like {CMS_NODE}.author
do
storage.save_user (custom_user ("test_delete", "testu", "email"))
l_user := storage.user_by_name ("test_delete")
across 1 |..| 10 as c loop
storage.save_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)
storage.save_node (l_node)
end
assert ("Exist node id: 10", attached storage.node (10) as l_node and then l_node.title ~ "Title_10" )
assert ("Exist node id: 10", attached storage.node (10) as ll_node and then ll_node.title ~ "Title_10" )
storage.delete_node (10)
assert ("Not exist node id: 10", storage.node (10) = Void)
end