From 52cc566e15af795bbd1140da3776550b107deb90 Mon Sep 17 00:00:00 2001 From: jvelilla Date: Wed, 1 Oct 2014 14:11:17 -0300 Subject: [PATCH] Added SQLite ODBC example under test/APPLICATION.e class. Fixed compilation issues with SQLite implemenation. (need to be updated) --- .../sqlite/persistence_sqlite.ecf | 1 + .../sqlite/src/cms_storage_sqlite.e | 62 ++++++++++++++++-- .../implementation/sqlite/tests/application.e | 3 +- .../implementation/sqlite/tests/cms_lite.db | Bin 0 -> 18432 bytes .../sqlite/tests/storage/storage_test_set.e | 8 +-- 5 files changed, 65 insertions(+), 9 deletions(-) create mode 100644 persistence/implementation/sqlite/tests/cms_lite.db diff --git a/persistence/implementation/sqlite/persistence_sqlite.ecf b/persistence/implementation/sqlite/persistence_sqlite.ecf index d93e74c..c4c203c 100644 --- a/persistence/implementation/sqlite/persistence_sqlite.ecf +++ b/persistence/implementation/sqlite/persistence_sqlite.ecf @@ -17,6 +17,7 @@ + diff --git a/persistence/implementation/sqlite/src/cms_storage_sqlite.e b/persistence/implementation/sqlite/src/cms_storage_sqlite.e index 2a580af..849685e 100644 --- a/persistence/implementation/sqlite/src/cms_storage_sqlite.e +++ b/persistence/implementation/sqlite/src/cms_storage_sqlite.e @@ -100,6 +100,46 @@ feature -- Change: user end end +feature -- User Nodes + + user_collaborator_nodes (a_id: like {CMS_USER}.id): LIST[CMS_NODE] + -- Possible list of nodes where the user identified by `a_id', is a collaborator. + do + create {ARRAYED_LIST[CMS_NODE]} Result.make (0) + to_implement ("Not implemented") + end + + user_author_nodes (a_id: like {CMS_USER}.id): LIST[CMS_NODE] + -- Possible list of nodes where the user identified by `a_id', is the author. + do + create {ARRAYED_LIST[CMS_NODE]} Result.make (0) + to_implement ("Not implemented") + end + +feature -- Users roles and permissions + + user_role_by_id (a_id: like {CMS_USER_ROLE}.id): detachable CMS_USER_ROLE + -- User role by id `a_id', if any. + do + to_implement ("Not implemented") + end + + user_roles: LIST [CMS_USER_ROLE] + -- Possible list of user roles. + do + create {ARRAYED_LIST[CMS_USER_ROLE]} Result.make (0) + to_implement ("Not implemented") + end + +feature -- Change: roles and permissions + + save_user_role (a_user_role: CMS_USER_ROLE) + -- Save user role `a_user_role' + do + to_implement ("Not implemented") + end + + feature -- Access: node nodes: LIST[CMS_NODE] @@ -145,31 +185,45 @@ 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) do node_provider.update_node (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) do node_provider.update_node_title (a_id, a_title) 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) do node_provider.update_node_summary (a_id, a_summary) 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) do node_provider.update_node_content (a_id, a_content) post_node_provider_execution end + node_author (a_id: like {CMS_NODE}.id): detachable CMS_USER + -- Node's author. if any. + do + to_implement ("Not implemented") + end + + node_collaborators (a_id: like {CMS_NODE}.id): LIST [CMS_USER] + -- Possible list of node's collaborator. + do + create {ARRAYED_LIST[CMS_USER]} Result.make (0) + to_implement ("Not implemented") + end + + feature -- User new_user (a_user: CMS_USER) diff --git a/persistence/implementation/sqlite/tests/application.e b/persistence/implementation/sqlite/tests/application.e index fc10bf5..82c32f0 100644 --- a/persistence/implementation/sqlite/tests/application.e +++ b/persistence/implementation/sqlite/tests/application.e @@ -21,7 +21,8 @@ feature {NONE} -- Initialization node: NODE_DATA_PROVIDER l_security: SECURITY_PROVIDER do - create connection.make_basic ("cms_dev") + -- Change the path. + create connection.login_with_connection_string ("Driver=SQLite3 ODBC Driver;Database=./cms_lite.db;LongNames=0;Timeout=1000;NoTXN=0;SyncPragma=NORMAL;StepAPI=0;") create user.make (connection) user.new_user ("test", "test", "test") end diff --git a/persistence/implementation/sqlite/tests/cms_lite.db b/persistence/implementation/sqlite/tests/cms_lite.db new file mode 100644 index 0000000000000000000000000000000000000000..cad98d57c65c91c5eab1bed25255d9c8ad40c714 GIT binary patch literal 18432 zcmeHO-EJC36rN%EF(f2yRC{k)X}Z1v#jU_DL6%C|?Xtuu_JY??$EqT-F-uCrPs}cg zdsX4Iy-(FA=o92MdQtVNPf)3k5Vh(}=LePrV=xU8b$8Zb*_}Ca=A3V4n9+Am4)%BJ zwux%(PSdc_7VrZI!KVlT0DSm!3x5Vz7(e(2FZdg}o-cazfe-!&25_xUcui#968;um z!xAiA)ZqV69uEe^j0i!!RW(nolLiL3Vsz~`eXn#avtw0~^efc+SO|%t2+s~}<8j06 zv>T>HZ+=Br<&ug@@@Km$l4zL}i$)NV>QxElwUT;I)lpH;@5%ZRy00D~xm+sbHQa7b z)k;V!;7@sX7b!ccaz92|-OVK88&m~RC!x<}UD=WKSTd1_JMvUODQE{JUBf_Dz+dzQ#oM>x5%skXjAfp5&DOCw_9~3{KUNuQ z8BKEow~U|Ng%rPUzo0r>?W$?fn{TAOM9UV3-?Q%HM*Y~Z>+M#hYSOM0Z$-6)<491Guxg$;WBrUBj9laR-hn;=?RqY{~n(T+MG6Gvm?dvVxR zvWy0f)J+jEn?}7cl-Nv7i`+VPjYe;sViLjS{Ga=`jz4n*yoCVg|GYKc+*^)-8v(Na z`(X{h8hj}vgeTxv@FV_P>Xo`46!YuT^XK}xW%MLhp)WUyC%tzfA@Sil?4@Y39jm6v zUmw<<_EYb^G^`3O>c7{kr!Ki@|EQSPvg!jQxoW0rkWfJzk(Ofpwm9)FK1W92i+4jI zaeWp4S%$fSuIBG)B&RXv(!&n1x|&mURa4XhG)U?rsg0NFg}OYc69)@? zA|`o`?oL=Enm6}~xhLlJxhCdN#iW_Z zEF`$`{eP)Hb-Z(qz)}(5>wl^6^UgT}OGSY5e@lg*cg_)5Dgu1}Un=~(bB@4L5n%EE zM*#ldiwi%4zrdr#n$ugmah~{~eBCIW#`ru+wj_td2Q9rdiTJpL3ODgV#YZT)-dc1H z!)W_)!``0Du%U`chS6Hem;Fa6%op!nqrBwz(8Wtqs~LMnA8$(1nY^SUIfF4|a`ZltmmKOjPZ`oWJlSURl1vMm^>0c{{yWl~@BfSaz2n+A0#^wE QzW%S$XmMLP0*gi9AA}@d5C8xG literal 0 HcmV?d00001 diff --git a/persistence/implementation/sqlite/tests/storage/storage_test_set.e b/persistence/implementation/sqlite/tests/storage/storage_test_set.e index 521d78b..4d893ed 100644 --- a/persistence/implementation/sqlite/tests/storage/storage_test_set.e +++ b/persistence/implementation/sqlite/tests/storage/storage_test_set.e @@ -231,7 +231,7 @@ feature -- Test routines l_node.set_summary ("New Summary") l_node.set_title("New Title") - storage.update_node (l_node) +-- 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)) end end @@ -243,7 +243,7 @@ feature -- Test routines do storage.save_node (custom_node ("Content", "Summary", "Title")) if attached {CMS_NODE} storage.node (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 (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 @@ -255,7 +255,7 @@ feature -- Test routines do storage.save_node (custom_node ("Content", "Summary", "Title")) if attached {CMS_NODE} storage.node (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 (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 @@ -267,7 +267,7 @@ feature -- Test routines do storage.save_node (custom_node ("Content", "Summary", "Title")) if attached {CMS_NODE} storage.node (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 (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