_news__db_check_news_create (private)
_news__db_check_news_create
Defined in packages/news/tcl/test/news-db-test-init.tcl
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: upvar 2 _aa_exports _aa_exports foreach init_class mount-news-package { if {[llength $init_class] == 2} { lassign $init_class init_class init_package_key } else { set init_package_key news } foreach v $_aa_exports([list $init_package_key $init_class]) { upvar 2 $v $v } foreach logpair $::aa_init_class_logs([list $init_package_key $init_class]) { aa_log_result [lindex $logpair 0] [lindex $logpair 1] } } set _aa_export {} set body_count 1 foreach testcase_body {{ set news_id -1 if {!$_news_package_mounted_p} { aa_error "News package not mounted, error from initializer: $_news_package_mounted_err" } else { # # Attempt to create the article # set p_title "My title" set p_text "My text" set p_package_id $_news_package_id set p_is_live "t" set p_full_details "t" aa_call_component db-news-globals aa_call_component db-news-item-create } } { aa_true "Check the news_id is populated" {$news_id != -1} set item_id -1 if {$news_id != -1} { aa_log "News id: $news_id" # # Retrieve the row from cr_news table and check its contents. Notice that we # only check the date portion of the date strings. # aa_log "Retrieve cr_news row and check its contents" set p_news_id $news_id aa_call_component db-get-cr-news-row if {!$retrieval_ok_p} { aa_error "cr_news column not found for news_id $news_id" } else { aa_equals "Check package_id correct" $package_id $_news_package_id aa_equals "Check archive_date correct" [string range $archive_date 0 [string length $p_archive_date]-1] $p_archive_date aa_equals "Check approval_user correct" $approval_user $p_approval_user aa_equals "Check approval_date correct" [string range $approval_date 0 [string length $p_approval_date]-1] $p_approval_date aa_equals "Check approval_ip correct" $approval_ip $p_approval_ip } # # Retrieve the row from cr_revisions table and check its contents. # NB: The get_cr_revisions_row populates item_id # aa_log "Retrieve cr_revisions row and check its contents" set p_revision_id $news_id aa_call_component db-get-cr-revisions-row if {!$retrieval_ok_p} { aa_error "cr_revisions row not found for news_id (revision_id) $news_id" } else { aa_equals "Check title correct" $title $p_title aa_equals "Check description correct" $description "initial submission" aa_equals "Check mime_type correct" $mime_type "text/plain" # # Retrieve the row from cr_items table and check its contents. # aa_log "Retrieve cr_items row and check its contents" set p_item_id $item_id aa_call_component db-get-cr-items-row if {!$retrieval_ok_p} { aa_error "cr_items row not found for item_id (revision_id) $news_id" } else { aa_equals "Check parent_id correct" $parent_id $_news_cr_news_root_folder_id aa_equals "Check live_revision correct" $live_revision $news_id aa_equals "Check latest_revision correct" $latest_revision $news_id aa_equals "Check publish_status correct" $publish_status "ready" aa_equals "Check content_type correct" $content_type "news" # # Call the news.name function to retrieve the item name. # aa_log "Call news.name function to retrieve title of content revision" set p_news_id $news_id set name [db_exec_plsql news-name {}] aa_equals "Check the return from news.name is correct" $name $p_title } } } } { # # Delete the item. # if {$item_id != -1} { aa_log "Deleting the item." set p_item_id $item_id aa_call_component db-news-item-delete aa_log "Checking all table data removed." set p_news_id $news_id aa_call_component db-get-cr-news-row aa_false "Check the cr_news row was deleted" {$retrieval_ok_p} set p_item_id $item_id aa_call_component db-get-cr-items-row aa_false "Check the cr_items row was deleted" {$retrieval_ok_p} set p_revision_id $news_id aa_call_component db-get-cr-revisions-row aa_false "Check the cr_revisions row was deleted" {$retrieval_ok_p} } }} { aa_log "Running testcase body $body_count" set ::__aa_test_indent [info level] set catch_val [catch $testcase_body msg] if {$catch_val != 0 && $catch_val != 2} { aa_log_result "fail" "db_check_news_create (body $body_count): Error during execution: $msg, stack trace: \n$::errorInfo" } incr body_count }Generic XQL file: packages/news/tcl/test/news-db-test-init.xql
PostgreSQL XQL file: <fullquery name="_news__db_check_news_create.news-name"> <querytext> select news__name(:p_news_id); </querytext> </fullquery>packages/news/tcl/test/news-db-test-init-postgresql.xql
Oracle XQL file: <fullquery name="_news__db_check_news_create.news-name"> <querytext> begin :1 := news.name(news_id => :p_news_id); end; </querytext> </fullquery>packages/news/tcl/test/news-db-test-init-oracle.xql