_xowf__create_workflow_with_instance (private)

 _xowf__create_workflow_with_instance

Defined in packages/xowf/tcl/test/xowf-test-procs.tcl

Partial Call Graph (max 5 caller/called nodes):
%3 _ _ (public) aa_log aa_log (public) aa_log_result aa_log_result (public) aa_section aa_section (public) aa_true aa_true (public) _xowf__create_workflow_with_instance _xowf__create_workflow_with_instance _xowf__create_workflow_with_instance->_ _xowf__create_workflow_with_instance->aa_log _xowf__create_workflow_with_instance->aa_log_result _xowf__create_workflow_with_instance->aa_section _xowf__create_workflow_with_instance->aa_true

Testcases:
No testcase defined.
Source code:
        
            upvar 2 _aa_exports _aa_exports
            foreach init_class xowf_require_test_instance {
                if {[llength $init_class] == 2} {
                    lassign $init_class init_class init_package_key
                } else {
                    set init_package_key xowf
                }
                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 instance $_xowf_test_instance_name
        set testfolder .testfolder
        set locale [lang::system::locale]
        set lang [string range $locale 0 1]

        #
        # Setup of test user_id and login
        #
        set user_info [::acs::test::user::create -email xowf@acs-testing.test -admin]
        set d [::acs::test::login $user_info]

        try {

            ###########################################################
            aa_section "Require test folder"
            ###########################################################

            set folder_info [::xowiki::test::require_test_folder  -last_request $d  -instance $instance  -folder_name $testfolder  -fresh  ]

            set folder_id  [dict get $folder_info folder_id]
            set package_id [dict get $folder_info package_id]

            aa_true "folder_id '$folder_id' is not 0" {$folder_id != 0}
            set locale [lang::system::locale]
            set lang [string range $locale 0 1]
            ::xowiki::test::create_form  -last_request $d  -instance $instance  -path $testfolder  -parent_id $folder_id  -name $lang:tip.form  -update [subst {
                    title "TIP Form"
                    nls_language $locale
                    text {<p>@_text@</p>
                        <p>State: @wf_current_state@</p>
                    }
                    text.format text/html
                    form {<form> @_text@ @wf_current_state@ @_description@</form>}
                    form.format text/html
                    form_constraints {
                        {wf_current_state:current_state}
                        _page_order:hidden
                    }
                }]
            aa_log "Form  $lang:tip.form created"

            ###########################################################
            aa_section "Create the TIP workflow"
            ###########################################################

            ::xowiki::test::create_form_page  -last_request $d  -instance $instance  -path $testfolder  -parent_id $folder_id  -form_name Workflow.form  -update [subst -nocommands {
                    _title "TIP Workflow"
                    _name tip.wf
                    _nls_language $locale
                    workflow_definition {
                        # Actions are used here with the following parameters:
                        #   next_state: state after activation of action
                        #   roles: a list of roles; if the current user has one of these
                        #          roles, he is allowed to perform the action
                        #          Currently implemented roles:
                        #            all, swa, registered_user, unregistered user, admin,
                        #            creator, app_group_member, community_member
                        #
                        Action save -roles admin
                        Action propose -next_state proposed -proc activate {obj} {
                            :log "\$obj is going to state [:next_state]"
                        }
                        Action accept -next_state accepted
                        Action reject -next_state rejected
                        Action mark_implemented -next_state implemented

                        # States
                        #   - form: the form to be used in a state
                        #   - view_method: Typically "view" (default) or "edit"
                        # State parameter {{form "$lang:tip-form"} {view_method edit}}
                        # assigns the specified form to all states

                        State parameter {{form "$lang:tip.form"} {extra_js 1.js}}

                        State initial  -actions {save propose}
                        State proposed -actions {save accept reject}
                        State accepted -actions {save mark_implemented}
                        State rejected -actions {save}
                        State implemented -actions {save}
                    }
                    form_constraints {@table:_name,wf_current_state,_creator,_last_modified}
                }]

            aa_log "Workflow $lang:tip.wf created"

            ###########################################################
            aa_section "Create an instance of the TIP workflow and save it."
            # The workflow name is provided via "-form_name"
            ###########################################################

            ::xowiki::test::create_form_page  -last_request $d  -instance $instance  -path $testfolder  -parent_id $folder_id  -form_name $lang:tip.wf  -update [subst {
                    _title "TIP 1"
                    _name tip1
                    _text {Should we create a tip?}
                    __action_save ""
                    _nls_language $locale
                }]

            aa_log "Workflow instance tip1 created"

            ###########################################################
            aa_section "Edit the workflow instance and propose the TIP"
            # (call the workflow action "propose")
            ###########################################################

            ::xowiki::test::edit_form_page  -last_request $d  -instance $instance  -path $testfolder/tip1  -update {
                    __action_propose ""
                }


        } on error {errorMsg} {
            aa_true "Error msg: $errorMsg" 0
        } finally {
            #
            # In case something has to be cleaned manually, do it here.
            #
        }
    }} {
          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" "create_workflow_with_instance (body $body_count): Error during execution: $msg, stack trace: \n$::errorInfo"
          }
          incr body_count
        }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: