Added weight into to the CMS_LINK and provide a `sort' feature for CMS_MENU and related.

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
This commit is contained in:
2015-02-16 13:01:06 +01:00
parent a810b1176c
commit 8d59d25ace
165 changed files with 1430 additions and 2206 deletions

View File

@@ -0,0 +1,54 @@
note
description: "Summary description for {ABSTRACT_DB_TEST}."
date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $"
revision: "$Revision: 96542 $"
class
ABSTRACT_DB_TEST
feature -- Database connection
connection: DATABASE_CONNECTION_ODBC
-- odbc database connection
once
create Result.login_with_connection_string ("Driver=SQLite3 ODBC Driver;Database=cms_lite.db;LongNames=0;Timeout=1000;NoTXN=0;SyncPragma=NORMAL;StepAPI=0;")
-- create Result.make_basic ("cms_lite.db")
end
feature {NONE} -- Implementation
storage: CMS_STORAGE
-- node provider.
once
create {CMS_STORAGE_SQLITE} Result.make (connection)
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} -- Fixture Factories: Nodes
default_node: CMS_NODE
do
Result := custom_node ("Default content", "default summary", "Default")
end
custom_node (a_content, a_summary, a_title: READABLE_STRING_32): CMS_NODE
do
create Result.make (a_content, a_summary, a_title)
end
end

View File

@@ -0,0 +1,66 @@
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