import { AbstractSession , ImperativeExpect , TextUtils } from "@zowe/imperative" ; import { noSessionTso , noTsoIssueInput , noTsoStartInput , noTsoStopInput , noZosmfResponse } from "./TsoConstants" ; import { IStartTsoParms } from "./doc/input/IStartTsoParms" ; import { IStopTsoParms } from "./doc/input/IStopTsoParms" ; import { IIssueTsoParms } from "./doc/input/IIssueTsoParms" ; import { IZosmfPingResponse } from "./doc/zosmf/IZosmfPingResponse" ; import { IZosmfTsoResponse } from "./doc/zosmf/IZosmfTsoResponse" ; export class export class TsoValidator { static param { AbstractSession } session memberOf public static validateSession ( session ) { ImperativeExpect . toNotBeNullOrUndefined ( session , TextUtils . formatMessage ( noSessionTso . message ) ) ; } param { IStartTsoParms } parms see { IStartTsoParms } memberOf public static validateStartParams ( parms ) { ImperativeExpect . toNotBeNullOrUndefined ( parms , noTsoStartInput . message ) ; } param { IStartTsoParms } parms see { IIssueTsoParms } memberOf public static validateIssueParams ( parms ) { ImperativeExpect . toNotBeNullOrUndefined ( parms , noTsoIssueInput . message ) ; } param { IStopTsoParms } parms see { IStopTsoParms } memberOf public static validateStopParams ( parms ) { ImperativeExpect . toNotBeNullOrUndefined ( parms , noTsoStopInput . message ) ; } param { IZosmfTsoResponse } parms see { IZosmfTsoResponse } memberOf public static validateStartZosmfResponse ( parms ) { ImperativeExpect . toNotBeNullOrUndefined ( parms , noZosmfResponse . message ) ; } static param { AbstractSession } session param { string } text param { string } errorMsg memberof public static validatePingParms ( session , text , errorMsg ) { this . validateSession ( session ) ; this . validateNotEmptyString ( text , errorMsg ) ; } static param { string } text param { string } errorMsg memberof public static validateString ( text , errorMsg ) { ImperativeExpect . toNotBeNullOrUndefined ( text , errorMsg ) ; } static param { string } text param { string } errorMsg memberof public static validateNotEmptyString ( text , errorMsg ) { ImperativeExpect . toNotBeEqual ( "" , text , errorMsg ) ; TsoValidator . validateString ( text , errorMsg ) ; } param { IZosmfPingResponse } parms see { IZosmfPingResponse } memberOf public static validatePingZosmfResponse ( parms ) { ImperativeExpect . toNotBeNullOrUndefined ( parms , noZosmfResponse . message ) ; } param { IZosmfTsoResponse } zosmfResponse see { IZosmfTsoResponse } memberOf public static validateErrorMessageFromZosmf ( zosmfResponse ) { if ( zosmfResponse . msgData ) { ImperativeExpect . toBeEqual ( zosmfResponse . msgData , "undefined" , zosmfResponse . msgData [ 0 ] . messageText ) ; } } }