Index: openacs-4/packages/acs-authentication/tcl/test/sync-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/test/sync-test-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/acs-authentication/tcl/test/sync-test-procs.tcl 9 Sep 2003 12:31:59 -0000 1.5 +++ openacs-4/packages/acs-authentication/tcl/test/sync-test-procs.tcl 10 Sep 2003 09:09:47 -0000 1.6 @@ -34,7 +34,6 @@ auth::sync::job::create_entry \ -job_id $job_id \ -operation "insert" \ - -authority_id [auth::authority::local] \ -username "foobar" \ -user_id [ad_conn user_id] \ -success @@ -43,7 +42,6 @@ auth::sync::job::create_entry \ -job_id $job_id \ -operation "insert" \ - -authority_id [auth::authority::local] \ -username "foobar" \ -user_id [ad_conn user_id] \ -message "A problem" \ @@ -111,7 +109,6 @@ set entry_id [auth::sync::job::action \ -job_id $job_id \ -operation "insert" \ - -authority_id [auth::authority::local] \ -username $username1 \ -first_names $first_names1 \ -last_name $last_name1 \ @@ -152,7 +149,6 @@ set entry_id [auth::sync::job::action \ -job_id $job_id \ -operation "insert" \ - -authority_id [auth::authority::local] \ -username $username1 \ -first_names [ad_generate_random_string] \ -last_name [ad_generate_random_string] \ @@ -190,7 +186,6 @@ set entry_id [auth::sync::job::action \ -job_id $job_id \ -operation "update" \ - -authority_id [auth::authority::local] \ -username $username1 \ -first_names $first_names2 \ -last_name $last_name2 \ @@ -232,7 +227,6 @@ set entry_id [auth::sync::job::action \ -job_id $job_id \ -operation "insert" \ - -authority_id [auth::authority::local] \ -username $username2 \ -first_names {} \ -last_name {Foobar} \ @@ -264,7 +258,6 @@ set entry_id [auth::sync::job::action \ -job_id $job_id \ -operation "delete" \ - -authority_id [auth::authority::local] \ -username $username1] array unset entry @@ -332,7 +325,6 @@ set entry_id [auth::sync::job::action \ -job_id $job_id \ -operation "snapshot" \ - -authority_id [auth::authority::local] \ -username $username1 \ -first_names $first_names1 \ -last_name $last_name1 \ @@ -378,7 +370,6 @@ set entry_id [auth::sync::job::action \ -job_id $job_id \ -operation "snapshot" \ - -authority_id [auth::authority::local] \ -username $username1 \ -first_names $first_names2 \ -last_name $last_name2 \ @@ -427,8 +418,7 @@ }] auth::sync::job::snapshot_delete_remaining \ - -job_id $job_id \ - -authority_id [auth::authority::local] + -job_id $job_id ##### # @@ -464,6 +454,192 @@ auth::sync::job::get -job_id $job_id -array job aa_log "job.message = '$job(message)'" + aa_true "job.message not empty when called for local authority" [exists_and_not_null job(message)] + } +} + +aa_register_case job_batch_ims_dummy { + Test a batch job for the local authority +} { + aa_stub acs_sc::invoke { + acs_sc::invoke__arg_parser + + if { [string equal $contract GetDocument] && [string equal $operation GetDocument] } { + array set result { + doc_status ok + doc_message {} + document {} + } + + # Example document grabbed pulled from + # http://www.imsglobal.org/enterprise/entv1p1/imsent_bestv1p1.html#1404584 + set result(document) { + + + Dunelm Services Limited + Telecommunications LMS + DATABASE UPDATE + 2001-08-08 + + + Add a new Person record. + + Dunelm Services Limited + CK1 + + + Clark Kent + Kent, C + Superman + + + 2 + + + The Daily Planet + Metropolis + USA + + + + Update a previously created record. + + Dunelm Services Limited + CS1 + + + Colin Smythe + Smythe, C + Colin + + Smythe + Colin + Manfred + Wingarde + Dr. + C.Eng + C.M.W. + + + + 2 + 1958-02-18 + None. + + colin@dunelm.com + http://www.dunelm.com + 4477932335019 + + Dunelm Services Limited + 34 Acorn Drive + Stannington + Sheffield + S.Yorks + S7 6WA + UK + + + http://www.dunelm.com/staff/colin2.gif + + + dunelm:colinsmythe:1 + + + Delete this record. + + Dunelm Services Limited + LL1 + + + Lois Lane + Lane, L + + + +} + + return [array get result] + } else { + acs_sc::invoke_unstubbed \ + -contract $contract \ + -operation $operation \ + -impl $impl \ + -impl_id $impl_id \ + -call_args $call_args \ + -error=$error_p } + } + + aa_run_with_teardown \ + -rollback \ + -test_code { + + # Create a new dummy authority with the dummy IMS get-document driver and the IMS Enterprise 1.1 process driver. + array set new_auth { + short_name dummy-test + pretty_name dummy-test + enabled_p t + sort_order 999 + auth_impl_id {} + pwd_impl_id {} + forgotten_pwd_url {} + change_pwd_url {} + register_impl_id {} + register_url {} + help_contact_text {} + snapshot_p f + batch_sync_enabled_p f + } + set new_auth(get_doc_impl_id) 1 + set new_auth(process_doc_impl_id) [acs_sc::impl::get_id -owner "acs-authentication" -name "IMS Enterprise 1.1"] + + set new_auth(get_doc_impl_id) [acs_sc::impl::get_id -owner "acs-authentication" -name "HTTPGet"] + + set authority_id [auth::authority::create \ + -array new_auth] + + set job_id [auth::authority::batch_sync -authority_id $authority_id] + + auth::sync::job::get -job_id $job_id -array job + + aa_equals "Number of actions" $job(num_actions) 3 + + aa_equals "Number of problems" $job(num_problems) 3 + + foreach entry_id [auth::sync::job::get_entries -job_id $job_id] { + array unset entry + auth::sync::job::get_entry \ + -entry_id $entry_id \ + -array entry + + aa_false "Success_p is false" [template::util::is_true $entry(success_p)] + + array unset elm_msgs + array set elm_msgs $entry(element_messages) + + aa_log "entry.operation = '$entry(operation)'" + aa_log "entry.username = '$entry(username)'" + aa_log "entry.message = '$entry(message)'" + aa_log "array names elm_msgs = '[array names elm_msgs]'" + + switch $entry(operation) { + insert { + aa_true "email has a problem (email missing)" [util_sets_equal_p { email } [array names elm_msgs]] + } + update { + aa_true "username has a problem (don't have this user)" [util_sets_equal_p { username } [array names elm_msgs]] + } + delete { + aa_false "Message is not empty" [empty_string_p $entry(message)] + } + } + } + + aa_log "job.message = '$job(message)'" + aa_log "job.document = '$job(document)'" + + } } + +