# sub-do-send-document.test - subroutine to do and check Send-Document # Version 0.3 # Last revised by Xerox Corporation on 99-03-11 23:00 PST. # Copyright (c) 1998, 1999 by Xerox Corporation. All rights reserved. # User is granted the right to modify this file for use with # the IPP Server Test Tool, as described in the file # LICENSE-IppTest.txt. # Input parameters (defined symbols): # first-job-id REQUIRED global [error if not defined] # requestingUserName OPTIONAL [defaults to 'IPP Bake-off User 1'] # lastDocument true | false OPTIONAL [defaults to true] # fileToPrint OPTIONAL [defaults to 'data: $test-print-file'] # caller can define as ' ' if no file to print. # expectedNumberOfDocuments OPTIONAL [defaults to 1] # # Output parameters: # none. # # Local variables: # expectedJobState # IfNDef first-job-id Echo "SCRIPT ERROR: first-job-id not defined by caller of:" Echo "sub-do-send-document.test - it is REQUIRED." Else IfNDef requestingUserName Define Symbol requestingUserName 'IPP Bake-off User 1' EndIf IfNDef lastDocument Define Symbol lastDocument true EndIf # Set to value for true as a default (in case neither true nor false). # No way to test for lastDocument string being true or false. Define Symbol expectedJobState pending | processing If [$lastDocument: false] Define Symbol expectedJobState pending-held EndIf IfNDef fileToPrint Define Symbol fileToPrint $test-print-file EndIf IfNDef expectedNumberOfDocuments Define Symbol expectedNumberOfDocuments 1 EndIf @ @ Do Send-Document - don't specify document-format @ Send-Document \ target: $target, \ attributes: ( \ Operation: ( \ attributes-charset: utf-8, \ attributes-natural-language: en-us, \ printer-uri: $target, \ job-id: $first-job-id, \ requesting-user-name: $requestingUserName, \ document-name: 'The File To Print', \ last-document: $lastDocument \ ) \ ), \ $fileToPrint Expect Response \ status-code: successful-ok, \ attributes: ( \ Operation: ( \ attributes-charset: utf-8, \ attributes-natural-language: *, \ ... \ ), \ Job: ( \ job-uri: *, \ job-id: *, \ job-state: $expectedJobState, \ ... \ ) \ ) # Get number-of-documents - be forgiving Get-Job-Attributes \ target: $target, \ attributes: ( \ Operation: ( \ attributes-charset: utf-8, \ attributes-natural-language: en-us, \ printer-uri: $target, \ job-id: $first-job-id, \ requested-attributes: \ ) \ ) \ @ @ Check that the number-of-documents is as expected. @ Support for the "number-of-documents" job attribute is RECOMMENDED @ when Create-Job is supported. @ # Be forgiving, we're only interested in the number-of-documents. Expect Response \ status-code: *, \ attributes: ( \ Operation: ( \ ... \ ), \ Job: ( \ job-id: $first-job-id, \ number-of-documents: $expectedNumberOfDocuments \ ), \ ... ) # Undefine input parameters before returning, lest they become stale: # Don't undefine first-job-id and first-job-uri, they are global Define Symbol lastDocument Define Symbol fileToPrint Define Symbol expectedNumberOfDocuments # Undefine local variables as well: Define expectedJobState EndIf