Protected cms service from registering many time the same module type.
Moved library/persistence/implementation/* under library/persistence/.
Moved site/www/themes to site/themes
For SQLite storage driver, auto create sqlite db file using associated sql script (to be completed).
Added code in demo module to reuse storage for module purpose.
Always call sql_post_execution in sql_query and sql_change, and not anymore by the callers.
Removed is_web and is_html from {CMS_SETUP}, it was not used.
Reused SHARED_*_ENCODER in CMS_ENCODERS
Added CMS_API.logger rather than using directly the SHARED_LOGGER.log ...
Centralize the implementation of current_user in CMS_REQUEST_UTIL
Removed the inheritance on WSF_FILTER for node handlers, since it is useless and unused.
Added CMS_NODE_API and CMS_USER_API
Prefix html id for block generated html items with "block-", to avoid css name conflict on "main", "content" or similar.
Code cleaning
67 lines
2.3 KiB
Plaintext
67 lines
2.3 KiB
Plaintext
note
|
|
description: "[
|
|
Setting up database tests
|
|
1. Put the database in a known state before running your test suite.
|
|
2. Data reinitialization. For testing in developer sandboxes, something that you should do every time you rebuild the system, you may want to forgo dropping and rebuilding the database in favor of simply reinitializing the source data.
|
|
You can do this either by erasing all existing data and then inserting the initial data vales back into the database, or you can simple run updates to reset the data values.
|
|
The first approach is less risky and may even be faster for large amounts of data. - See more at: http://www.agiledata.org/essays/databaseTesting.html#sthash.6yVp35g8.dpuf
|
|
]"
|
|
|
|
date: "$Date$"
|
|
revision: "$Revision$"
|
|
EIS: "name=Database Testing", "src=http://www.agiledata.org/essays/databaseTesting.html", "protocol=uri"
|
|
|
|
class
|
|
CLEAN_DB
|
|
|
|
feature
|
|
|
|
clean_db (a_connection: DATABASE_CONNECTION)
|
|
-- Clean db test.
|
|
local
|
|
l_parameters: STRING_TABLE[STRING]
|
|
do
|
|
create l_parameters.make (0)
|
|
|
|
db_handler(a_connection).set_query (create {DATABASE_QUERY}.data_reader (Sql_delete_nodes, l_parameters))
|
|
db_handler(a_connection).execute_change
|
|
|
|
-- Clean Users
|
|
db_handler(a_connection).set_query (create {DATABASE_QUERY}.data_reader (Sql_delete_users, l_parameters))
|
|
db_handler(a_connection).execute_change
|
|
|
|
-- -- Reset Autoincremente
|
|
-- db_handler(a_connection).set_query (create {DATABASE_QUERY}.data_reader (Rest_users_autoincrement, l_parameters))
|
|
-- db_handler(a_connection).execute_change
|
|
|
|
-- db_handler(a_connection).set_query (create {DATABASE_QUERY}.data_reader (Rest_nodes_autoincrement, l_parameters))
|
|
-- db_handler(a_connection).execute_change
|
|
end
|
|
|
|
|
|
|
|
feature -- Database Hanlder
|
|
|
|
db_handler (a_connection: DATABASE_CONNECTION): DATABASE_HANDLER
|
|
-- Db handler
|
|
once
|
|
create {DATABASE_HANDLER_IMPL} Result.make (a_connection)
|
|
end
|
|
|
|
|
|
feature -- Sql delete queries
|
|
|
|
Sql_delete_users: STRING = "delete from Users"
|
|
-- Clean Users.
|
|
|
|
Sql_delete_nodes: STRING = "delete from Nodes"
|
|
-- Clean Nodes.
|
|
|
|
Rest_users_autoincrement: STRING = "ALTER TABLE Users AUTO_INCREMENT = 1"
|
|
-- reset autoincrement
|
|
|
|
Rest_nodes_autoincrement: STRING = "ALTER TABLE Nodes AUTO_INCREMENT = 1"
|
|
-- reset autoincrement.
|
|
|
|
end
|