_news__db_check_news_archive (private)

 _news__db_check_news_archive

Defined in packages/news/tcl/test/news-db-test-init.tcl

Partial Call Graph (max 5 caller/called nodes):
%3 aa_call_component aa_call_component (public) aa_equals aa_equals (public) aa_error aa_error (public) aa_log aa_log (public) aa_log_result aa_log_result (public) _news__db_check_news_archive _news__db_check_news_archive _news__db_check_news_archive->aa_call_component _news__db_check_news_archive->aa_equals _news__db_check_news_archive->aa_error _news__db_check_news_archive->aa_log _news__db_check_news_archive->aa_log_result

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_revisions table to get item_id
        #
        set p_revision_id $news_id
        aa_call_component db-get-cr-revisions-row

        #
        # Call make_permanent to nullify the archive_date.
        #
        set p_item_id $item_id
        aa_call_component db-news-make-permanent

        #
        # Retrieve the news row to check its archive date.
        #
        set p_news_id $news_id
        aa_call_component db-get-cr-news-row
        aa_equals "Check the archive_date is null" $archive_date ""

        #
        # Set the archive period, providing an explicit archive date.
        #
        set p_item_id $item_id
        set p_archive_date "2005-11-05"
        aa_call_component db-news-archive

        #
        # Retrieve the news row to check its archive date.
        #
        set p_news_id $news_id
        aa_call_component db-get-cr-news-row
        aa_equals "Check the explicitly set archive_date is $p_archive_date"  [string range $archive_date 0 [string length $p_archive_date]-1]  $p_archive_date

        #
        # Set the archive period, relying on the overloaded "default" function for
        # archive_date.
        #
        set p_item_id $item_id
        set p_archive_date ""
        aa_call_component db-news-archive

        #
        # Retrieve the news row to check its archive date.
        #
        # Note, this could potentially fail if for some reason it executes over
        # midnight......
        #
        set p_news_id $news_id
        aa_call_component db-get-cr-news-row
        aa_true "Check the cr_news row was found" $retrieval_ok_p
        set todays_date [clock format [clock seconds] -format "%Y-%m-%d"]
        aa_equals "Check the explicitly set archive_date is $todays_date"  [string range $archive_date 0 [string length $todays_date]-1]  $todays_date
    }
} {
    #
    # 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 "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_archive (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:
packages/news/tcl/test/news-db-test-init-postgresql.xql

Oracle XQL file:
packages/news/tcl/test/news-db-test-init-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: