_acs-content-repository__cr_item_search_triggers (private)
_acs-content-repository__cr_item_search_triggers
Defined in packages/acs-content-repository/tcl/test/content-search-procs.tcl
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set _aa_export {} set body_count 1 foreach testcase_body {{ if {![string match -nocase "oracle*" [db_name]]} { aa_run_with_teardown -rollback -test_code { set folder_id [cr_item_search::test_setup] set item_name [ad_tmpnam cr_itemXXXXXX] # test new item, not live set item_id [content::item::new -name $item_name -title $item_name -parent_id $folder_id -is_live f] # make sure the item exists first aa_true "Item exists" {[content::item::get_id -item_path $item_name -root_folder_id $folder_id] ne ""} aa_equals "Item can be retrieved by name" [content::item::get_id_by_name -name $item_name -parent_id $folder_id] $item_id aa_equals "Folder is correct" [content::item::get_parent_folder -item_id $item_id] $folder_id aa_log "Create a child for this nonfolder item" set child_item_id [content::item::new -name "$item_name child" -title "$item_name child" -parent_id $item_id -is_live f] aa_equals "Folder for the child is correct" [content::item::get_parent_folder -item_id $child_item_id] $folder_id aa_true "Item is NOT live" {[content::item::get_live_revision -item_id $item_id] eq ""} set latest_revision [content::item::get_latest_revision -item_id $item_id] aa_true "But a revision exists" {$latest_revision ne ""} aa_false "Item is NOT queued for search indexing" [db_string check_queue { select 1 from search_observer_queue where object_id = :latest_revision } -default 0] set best_revision [content::item::get_best_revision -item_id $item_id] aa_true "Best revision exists" {$best_revision ne ""} aa_true "Best revision is the latest revision" {$best_revision == $latest_revision} aa_log "Update Item, still no live revision" content::item::update -item_id $item_id -attributes [list [list name $item_name]] cr_item_search::assert_not_in_queue -revision_id $latest_revision -events [list INSERT UPDATE] aa_log "Add a new non-live revision" set new_revision [content::revision::new -item_id $item_id -title "$item_name 2" -is_live f] set best_revision [content::item::get_best_revision -item_id $item_id] aa_true "Best revision is now the new revision" {$best_revision == $new_revision} aa_log "Set live revision no publish date" content::item::set_live_revision -revision_id $latest_revision cr_item_search::assert_in_queue -revision_id $latest_revision -events [list INSERT UPDATE] set best_revision [content::item::get_best_revision -item_id $item_id] aa_true "Best revision is now the live revision" {$best_revision == $latest_revision} content::item::unset_live_revision -item_id $item_id cr_item_search::assert_in_queue -revision_id $latest_revision -events [list DELETE] cr_item_search::remove_from_queue -revision_id $latest_revision set next_date [clock format [clock scan "tomorrow"] -format "%Y-%m-%d"] db_dml set_publish_date "update cr_revisions set publish_date=:next_date where revision_id=:latest_revision" aa_log "Publish Date in future, live revision not set" cr_item_search::assert_not_in_queue -revision_id $latest_revision -events [list INSERT UPDATE] # NOTE set live revision without pl/sql proc which also set # publish date to right now! It should be impossible to have # a live revision with publish date in the future # but the point here is to never search an unpublished item db_dml set_live_revision "update cr_items set live_revision=latest_revision where item_id=:item_id" aa_log "Publish date in future, live revision set" cr_item_search::assert_not_in_queue -revision_id $latest_revision -events [list INSERT UPDATE] } } }} { 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" "cr_item_search_triggers (body $body_count): Error during execution: $msg, stack trace: \n$::errorInfo" } incr body_count }XQL Not present: Generic, PostgreSQL, Oracle