_acs-service-contract__acs_sc_impl_new_from_spec (private)

 _acs-service-contract__acs_sc_impl_new_from_spec

Defined in packages/acs-service-contract/tcl/test/acs-service-contract-procs.tcl

Partial Call Graph (max 5 caller/called nodes):
%3 aa_equals aa_equals (public) aa_false aa_false (public) aa_log aa_log (public) aa_log_result aa_log_result (public) aa_run_with_teardown aa_run_with_teardown (public) _acs-service-contract__acs_sc_impl_new_from_spec _acs-service-contract__acs_sc_impl_new_from_spec _acs-service-contract__acs_sc_impl_new_from_spec->aa_equals _acs-service-contract__acs_sc_impl_new_from_spec->aa_false _acs-service-contract__acs_sc_impl_new_from_spec->aa_log _acs-service-contract__acs_sc_impl_new_from_spec->aa_log_result _acs-service-contract__acs_sc_impl_new_from_spec->aa_run_with_teardown

Testcases:
No testcase defined.
Source code:
        
        set _aa_export {}
        set body_count 1
        foreach testcase_body {{
    aa_run_with_teardown  -rollback  -test_code {

            set spec {
                name "foo_contract"
                description "Blah blah blah blah"
                operations {
                    Authenticate {
                        description {
                            Validate this username/password combination, and return the result.
                            Valid auth_status codes are 'ok', 'no_account', 'bad_password', 'auth_error', 'failed_to_connect'.
                            The last, 'failed_to_connect', is reserved for communications or implementation errors.
                            auth_message is a human-readable explanation of what went wrong, may contain HTML.
                            Only checked if auth_status is not ok.
                            Valid account_status codes are 'ok' and 'closed'.
                            account_message may be supplied regardless of account_status, and may contain HTML.
                        }
                        input {
                            username:string
                            password:string
                            parameters:string,multiple
                        }
                        output {
                            auth_status:string
                            auth_message:string
                            account_status:string
                            account_message:string
                        }
                    }
                    GetParameters {
                        description {
                            Get an arraay-list of the parameters required by this service contract implementation.
                        }
                        output {
                            parameters:string,multiple
                        }
                    }
                }
            }

            set contract_id [acs_sc::contract::new_from_spec -spec $spec]

            set spec {
                contract_name "foo_contract"
                owner "acs-service-contract"
                name "foo"
                pretty_name "Foo Driver"
                aliases {
                    Authenticate auth::local::authentication::Authenticate
                    GetParameters auth::local::authentication::GetParameters
                }
            }

            set impl_id [acs_sc::impl::new_from_spec -spec $spec]

            acs_sc::impl::get -impl_id $impl_id -array impl

            aa_equals "pretty_name did not get inserted correctly" $impl(impl_pretty_name) "Foo Driver"

            aa_equals "acs_sc::contract::get_operations returns expected"  [lsort [acs_sc::contract::get_operations -contract_name "foo_contract"]]  {Authenticate GetParameters}

            aa_log "Delete Authenticate operation"
            acs_sc::contract::operation::delete  -contract_name foo_contract  -operation_name Authenticate

            aa_equals "acs_sc::contract::get_operations returns expected"  [acs_sc::contract::get_operations -contract_name "foo_contract"]  {GetParameters}

            aa_log "Recreate Authenticate operation"
            acs_sc::contract::operation::new  -contract_name foo_contract  -operation Authenticate  -description {
                    Validate this username/password combination, and return the result.
                    Valid auth_status codes are 'ok', 'no_account', 'bad_password', 'auth_error', 'failed_to_connect'.
                    The last, 'failed_to_connect', is reserved for communications or implementation errors.
                    auth_message is a human-readable explanation of what went wrong, may contain HTML.
                    Only checked if auth_status is not ok.
                    Valid account_status codes are 'ok' and 'closed'.
                    account_message may be supplied regardless of account_status, and may contain HTML.
                }  -input {
                    username:string
                    password:string
                    parameters:string,multiple
                }  -output {
                    auth_status:string
                    auth_message:string
                    account_status:string
                    account_message:string
                }
            aa_equals "acs_sc::contract::get_operations returns expected"  [lsort [acs_sc::contract::get_operations -contract_name "foo_contract"]]  {Authenticate GetParameters}

            aa_log "Create Authenticate2 operation"
            acs_sc::contract::operation::new  -contract_name foo_contract  -operation Authenticate2  -description {
                    Validate this username/password combination, and return the result.
                    Valid auth_status codes are 'ok', 'no_account', 'bad_password', 'auth_error', 'failed_to_connect'.
                    The last, 'failed_to_connect', is reserved for communications or implementation errors.
                    auth_message is a human-readable explanation of what went wrong, may contain HTML.
                    Only checked if auth_status is not ok.
                    Valid account_status codes are 'ok' and 'closed'.
                    account_message may be supplied regardless of account_status, and may contain HTML.
                }  -input {
                    username:string
                    password:string
                    parameters:string,multiple
                }  -output {
                    auth_status:string
                    auth_message:string
                    account_status:string
                    account_message:string
                }
            aa_equals "acs_sc::contract::get_operations returns expected"  [lsort [acs_sc::contract::get_operations -contract_name "foo_contract"]]  {Authenticate Authenticate2 GetParameters}

            aa_equals "Getting the implementation options returns expected"  [lsort [acs_sc::impl::get_options  -contract_name foo_contract  -empty_label AAA]]  [list [list "AAA" ""] [list "Foo Driver" $impl_id]]

            aa_equals "Getting the implementation options returns expected (excluded)"  [acs_sc::impl::get_options  -contract_name foo_contract  -empty_label AAA  -exclude_names [list "Foo Driver"]]  [list [list "AAA" ""]]

            aa_true "acs_sc_binding_exists_p is true" [acs_sc_binding_exists_p foo_contract foo]

            aa_log "Delete implementation '$impl_id'"
            acs_sc::impl::delete -contract_name foo_contract -impl_name foo
            aa_false "Deletion succeeded" [db_0or1row check {
                select 1 from acs_sc_impls where impl_id = :impl_id
            }]

            aa_false "acs_sc_binding_exists_p is false" [acs_sc_binding_exists_p foo_contract foo]

            aa_log "Delete contract"
            acs_sc::contract::delete -name foo_contract
            aa_false "Contract was deleted" [db_0or1row check {
                select 1 from acs_sc_contracts
                where contract_id = :contract_id
            }]

        }
}} {
          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" "acs_sc_impl_new_from_spec (body $body_count): Error during execution: $msg, stack trace: \n$::errorInfo"
          }
          incr body_count
        }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ]
Show another procedure: