Package dev.galasa.zos3270.spi
Class Terminal
java.lang.Object
dev.galasa.zos3270.spi.Terminal
- All Implemented Interfaces:
ITerminal
- Direct Known Subclasses:
Zos3270TerminalImpl
-
Field Summary
-
Constructor Summary
ConstructorDescriptionTerminal
(String id, String host, int port, boolean ssl, int primaryColumns, int primaryRows, int alternateColumns, int alternateRows, ITextScannerManagerSpi textScan) Deprecated, for removal: This API element is subject to removal in a future version.Terminal
(String id, String host, int port, boolean ssl, ITextScannerManagerSpi textScan) Deprecated, for removal: This API element is subject to removal in a future version.Terminal
(String id, String host, int port, boolean ssl, TerminalSize primarySize, TerminalSize alternateSize, ITextScannerManagerSpi textScan, Charset codePage) Terminal
(String id, String host, int port, ITextScannerManagerSpi textScan) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionbackTab()
clear()
void
connect()
cursorUp()
void
enter()
eraseEof()
getId()
home()
boolean
boolean
boolean
boolean
isTextInField
(String text) boolean
isTextInField
(String text, long timeoutInMilliseconds) void
newLine()
pa1()
pa2()
pa3()
pf1()
pf10()
pf11()
pf12()
pf13()
pf14()
pf15()
pf16()
pf17()
pf18()
pf19()
pf2()
pf20()
pf21()
pf22()
pf23()
pf24()
pf3()
pf4()
pf5()
pf6()
pf7()
pf8()
pf9()
positionCursorToFieldContaining
(@NotNull String text) void
reportExtendedScreen
(boolean printCursor, boolean printColour, boolean printHighlight, boolean printIntensity, boolean printProtected, boolean printNumeric, boolean printModified) Report to the log the current state of the terminal with optional extended datastream settingsTemporary Print to consoleReturn the colour of the character at the cursor positionretrieveColourAtPosition
(int row, int col) Return the colour of the character at the cursor positionReturn a String of the contents of the current Field.retrieveFieldTextAfterFieldWithString
(String fieldName) Returns a String of text in a Field with a given name.Return the highlighting of the character at the cursor positionretrieveHighlightAtPosition
(int row, int col) Return the highlighting of the character at the cursor positionReturns the screen print out as a String.retrieveText
(int row, int col, int length) Retrieve text from the screen.retrieveTextAtCursor
(int length) Retrieve text from the screen.boolean
searchText
(String text) Perform a search on a String to check whether or not it is on the terminal screen.boolean
searchText
(String text, int occurrences) Perform a search on a String to check whether or not it is on the terminal screen.boolean
searchText
(String text, int occurrences, long milliTimeout) Perform a search on a String to check whether or not it is on the terminal screen.boolean
searchText
(String text, long milliTimeout) Perform a search on a String to check whether or not it is on the terminal screen.void
setAutoReconnect
(boolean newAutoReconnect) void
setCursorPosition
(int row, int col) Set the position of the Cursorvoid
setDeviceTypes
(List<String> deviceTypes) void
setDoStartTls
(boolean doStartTls) tab()
void
verifyTextInField
(String text) waitForTextInField
(String text) int
waitForTextInField
(String[] ok, String[] error) int
waitForTextInField
(String[] ok, String[] error, long timeoutInMilliseconds) wfk()
-
Field Details
-
textScan
-
-
Constructor Details
-
Terminal
@Deprecated(since="0.28.0", forRemoval=true) public Terminal(String id, String host, int port, ITextScannerManagerSpi textScan) throws TerminalInterruptedException Deprecated, for removal: This API element is subject to removal in a future version.- Throws:
TerminalInterruptedException
-
Terminal
@Deprecated(since="0.28.0", forRemoval=true) public Terminal(String id, String host, int port, boolean ssl, ITextScannerManagerSpi textScan) throws TerminalInterruptedException Deprecated, for removal: This API element is subject to removal in a future version.- Throws:
TerminalInterruptedException
-
Terminal
@Deprecated(since="0.28.0", forRemoval=true) public Terminal(String id, String host, int port, boolean ssl, int primaryColumns, int primaryRows, int alternateColumns, int alternateRows, ITextScannerManagerSpi textScan) throws TerminalInterruptedException Deprecated, for removal: This API element is subject to removal in a future version.- Throws:
TerminalInterruptedException
-
Terminal
public Terminal(String id, String host, int port, boolean ssl, TerminalSize primarySize, TerminalSize alternateSize, ITextScannerManagerSpi textScan, Charset codePage) throws TerminalInterruptedException - Throws:
TerminalInterruptedException
-
-
Method Details
-
setAutoReconnect
public void setAutoReconnect(boolean newAutoReconnect) -
setDeviceTypes
-
connect
- Specified by:
connect
in interfaceITerminal
- Throws:
NetworkException
-
disconnect
- Specified by:
disconnect
in interfaceITerminal
- Throws:
TerminalInterruptedException
-
networkClosed
public void networkClosed() -
isConnected
public boolean isConnected()- Specified by:
isConnected
in interfaceITerminal
-
waitForKeyboard
public ITerminal waitForKeyboard() throws TimeoutException, KeyboardLockedException, TerminalInterruptedException- Specified by:
waitForKeyboard
in interfaceITerminal
- Throws:
TimeoutException
KeyboardLockedException
TerminalInterruptedException
-
wfk
public ITerminal wfk() throws TimeoutException, KeyboardLockedException, TerminalInterruptedException- Specified by:
wfk
in interfaceITerminal
- Throws:
TimeoutException
KeyboardLockedException
TerminalInterruptedException
-
getScreen
-
positionCursorToFieldContaining
public ITerminal positionCursorToFieldContaining(@NotNull @NotNull String text) throws TextNotFoundException, KeyboardLockedException - Specified by:
positionCursorToFieldContaining
in interfaceITerminal
- Throws:
TextNotFoundException
KeyboardLockedException
-
verifyTextInField
- Specified by:
verifyTextInField
in interfaceITerminal
- Throws:
TextNotFoundException
-
isTextInField
- Specified by:
isTextInField
in interfaceITerminal
-
isTextInField
public boolean isTextInField(String text, long timeoutInMilliseconds) throws TerminalInterruptedException - Specified by:
isTextInField
in interfaceITerminal
- Throws:
TerminalInterruptedException
-
searchText
Description copied from interface:ITerminal
Perform a search on a String to check whether or not it is on the terminal screen. If after a timeout the String is not found on the terminal, the method will return false to the caller.- Specified by:
searchText
in interfaceITerminal
- Returns:
- if the text was found
-
searchText
Description copied from interface:ITerminal
Perform a search on a String to check whether or not it is on the terminal screen. If after a timeout the String is not found on the terminal, the method will return false to the caller. The returned boolean will depend on if the amount of occurrences is found.- Specified by:
searchText
in interfaceITerminal
- Returns:
- if the text was found
-
searchText
Description copied from interface:ITerminal
Perform a search on a String to check whether or not it is on the terminal screen. If after a timeout the String is not found on the terminal, the method will return false to the caller.- Specified by:
searchText
in interfaceITerminal
- Returns:
- if the text was found
-
searchText
Description copied from interface:ITerminal
Perform a search on a String to check whether or not it is on the terminal screen. If after a timeout the String is not found on the terminal with at least the amount of occurrences input the method will return false to the caller.- Specified by:
searchText
in interfaceITerminal
- Returns:
- if the text was found
-
waitForTextInField
public ITerminal waitForTextInField(String text) throws TerminalInterruptedException, TextNotFoundException, Zos3270Exception - Specified by:
waitForTextInField
in interfaceITerminal
- Returns:
- Throws:
TerminalInterruptedException
TextNotFoundException
ErrorTextFoundException
Zos3270Exception
-
waitForTextInField
public int waitForTextInField(String[] ok, String[] error) throws TerminalInterruptedException, TextNotFoundException, ErrorTextFoundException, Zos3270Exception - Specified by:
waitForTextInField
in interfaceITerminal
- Parameters:
ok
- - An array of text strings to find on the screenerror
- - An array of text strings deemed to be errors- Returns:
- the index of the ok string that was found
- Throws:
TerminalInterruptedException
- - If the wait was interrupted for some reasonTextNotFoundException
- - None of the ok or error strings were found before the timeoutErrorTextFoundException
- - One of the error strings were found, index of which is in the exceptionZos3270Exception
- - general zos 3270 error
-
waitForTextInField
public int waitForTextInField(String[] ok, String[] error, long timeoutInMilliseconds) throws TerminalInterruptedException, TextNotFoundException, ErrorTextFoundException, Zos3270Exception - Specified by:
waitForTextInField
in interfaceITerminal
- Parameters:
ok
- - An array of text strings to find on the screenerror
- - An array of text strings deemed to be errorstimeoutInMilliseconds
- - timeout- Returns:
- the index of the ok string that was found
- Throws:
TerminalInterruptedException
- - If the wait was interrupted for some reasonTextNotFoundException
- - None of the ok or error strings were found before the timeoutErrorTextFoundException
- - One of the error strings were foundZos3270Exception
- - general zos 3270 error
-
type
- Specified by:
type
in interfaceITerminal
- Throws:
KeyboardLockedException
FieldNotFoundException
-
eraseEof
- Specified by:
eraseEof
in interfaceITerminal
- Throws:
KeyboardLockedException
FieldNotFoundException
-
eraseInput
- Specified by:
eraseInput
in interfaceITerminal
- Throws:
KeyboardLockedException
FieldNotFoundException
-
tab
- Specified by:
tab
in interfaceITerminal
- Throws:
KeyboardLockedException
FieldNotFoundException
-
backTab
- Specified by:
backTab
in interfaceITerminal
- Throws:
KeyboardLockedException
FieldNotFoundException
-
cursorUp
- Specified by:
cursorUp
in interfaceITerminal
- Throws:
KeyboardLockedException
FieldNotFoundException
-
cursorDown
- Specified by:
cursorDown
in interfaceITerminal
- Throws:
KeyboardLockedException
FieldNotFoundException
-
cursorLeft
- Specified by:
cursorLeft
in interfaceITerminal
- Throws:
KeyboardLockedException
FieldNotFoundException
-
cursorRight
- Specified by:
cursorRight
in interfaceITerminal
- Throws:
KeyboardLockedException
FieldNotFoundException
-
home
- Specified by:
home
in interfaceITerminal
- Throws:
KeyboardLockedException
FieldNotFoundException
-
newLine
- Specified by:
newLine
in interfaceITerminal
- Throws:
KeyboardLockedException
FieldNotFoundException
-
backSpace
- Specified by:
backSpace
in interfaceITerminal
- Throws:
KeyboardLockedException
FieldNotFoundException
-
enter
public ITerminal enter() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
enter
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
clear
public ITerminal clear() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
clear
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pf1
public ITerminal pf1() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pf1
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pf2
public ITerminal pf2() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pf2
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pf3
public ITerminal pf3() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pf3
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pf4
public ITerminal pf4() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pf4
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pf5
public ITerminal pf5() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pf5
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pf6
public ITerminal pf6() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pf6
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pf7
public ITerminal pf7() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pf7
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pf8
public ITerminal pf8() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pf8
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pf9
public ITerminal pf9() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pf9
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pf10
public ITerminal pf10() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pf10
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pf11
public ITerminal pf11() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pf11
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pf12
public ITerminal pf12() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pf12
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pf13
public ITerminal pf13() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pf13
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pf14
public ITerminal pf14() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pf14
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pf15
public ITerminal pf15() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pf15
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pf16
public ITerminal pf16() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pf16
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pf17
public ITerminal pf17() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pf17
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pf18
public ITerminal pf18() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pf18
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pf19
public ITerminal pf19() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pf19
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pf20
public ITerminal pf20() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pf20
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pf21
public ITerminal pf21() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pf21
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pf22
public ITerminal pf22() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pf22
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pf23
public ITerminal pf23() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pf23
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pf24
public ITerminal pf24() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pf24
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pa1
public ITerminal pa1() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pa1
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pa2
public ITerminal pa2() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pa2
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
pa3
public ITerminal pa3() throws KeyboardLockedException, NetworkException, TerminalInterruptedException- Specified by:
pa3
in interfaceITerminal
- Throws:
KeyboardLockedException
NetworkException
TerminalInterruptedException
-
reportScreen
Description copied from interface:ITerminal
Temporary Print to console- Specified by:
reportScreen
in interfaceITerminal
- Returns:
- ITerminal for chaining
-
reportScreenWithCursor
- Specified by:
reportScreenWithCursor
in interfaceITerminal
-
reportExtendedScreen
public ITerminal reportExtendedScreen(boolean printCursor, boolean printColour, boolean printHighlight, boolean printIntensity, boolean printProtected, boolean printNumeric, boolean printModified) throws Zos3270Exception Description copied from interface:ITerminal
Report to the log the current state of the terminal with optional extended datastream settings- Specified by:
reportExtendedScreen
in interfaceITerminal
- Parameters:
printCursor
- - report cursor positionprintColour
- - report the colourprintHighlight
- - report highlightingprintIntensity
- - report intensityprintProtected
- - report field protectionprintNumeric
- - report numeric restrictionsprintModified
- - report field modification- Returns:
- the ITerminal for fluent API
- Throws:
Zos3270Exception
-
getId
-
retrieveScreen
Returns the screen print out as a String. For use in edge testing cases.- Specified by:
retrieveScreen
in interfaceITerminal
- Returns:
- Screen as String
-
retrieveFieldAtCursor
Return a String of the contents of the current Field. Current field is the one which the cursor is at.- Specified by:
retrieveFieldAtCursor
in interfaceITerminal
- Returns:
- Current Field as String
-
retrieveFieldTextAfterFieldWithString
Returns a String of text in a Field with a given name.- Specified by:
retrieveFieldTextAfterFieldWithString
in interfaceITerminal
- Parameters:
fieldName
- Name of the field to be extracted from- Returns:
- String which has been extracted from the field
- Throws:
TextNotFoundException
-
getHostPort
-
registerDatastreamListener
- Specified by:
registerDatastreamListener
in interfaceITerminal
-
unregisterDatastreamListener
- Specified by:
unregisterDatastreamListener
in interfaceITerminal
-
isSwitchedSSL
public boolean isSwitchedSSL()- Specified by:
isSwitchedSSL
in interfaceITerminal
-
setDoStartTls
public void setDoStartTls(boolean doStartTls) - Specified by:
setDoStartTls
in interfaceITerminal
-
isClearScreen
public boolean isClearScreen()- Specified by:
isClearScreen
in interfaceITerminal
-
setCursorPosition
Description copied from interface:ITerminal
Set the position of the Cursor- Specified by:
setCursorPosition
in interfaceITerminal
- Parameters:
row
- - The row on the screen to set the cursorcol
- - the column on the screen to set the cursor- Throws:
KeyboardLockedException
- - If an attempt is made to move the cursor whilst the screen is lockedZos3270Exception
- - If the position exceeds the boundaries of the screen
-
retrieveText
Description copied from interface:ITerminal
Retrieve text from the screen. Null characters and field attribute positions are replaced with spaces. If there are not enough characters on the row to satisfy the length requirement, the retrieve will wrap to the next row, unless it is the last row, in which case an exception will be thrown.- Specified by:
retrieveText
in interfaceITerminal
- Parameters:
row
- - The row on the screen to start the extractcol
- - The column on the screen to start the extractlength
- - The number of characters to extract- Returns:
- The contents extracted
- Throws:
Zos3270Exception
- - If the position exceeds the boundaries of the screen or the length causes the extract to overflow the end of the screen buffer
-
retrieveTextAtCursor
Description copied from interface:ITerminal
Retrieve text from the screen. Null characters and field attribute positions are replaced with spaces. If there are not enough characters on the row to satisfy the length requirement, the retrieve will wrap to the next row, unless it is the last row, in which case an exception will be thrown.- Specified by:
retrieveTextAtCursor
in interfaceITerminal
- Parameters:
length
- - The number of characters to extract- Returns:
- The contents extracted
- Throws:
Zos3270Exception
- - If the length causes the extract to overflow the end of the screen buffer
-
retrieveColourAtCursor
Description copied from interface:ITerminal
Return the colour of the character at the cursor position- Specified by:
retrieveColourAtCursor
in interfaceITerminal
- Returns:
- - if position is not in an extended field, null us returned
-
retrieveColourAtPosition
Description copied from interface:ITerminal
Return the colour of the character at the cursor position- Specified by:
retrieveColourAtPosition
in interfaceITerminal
- Parameters:
row
- of the screen, index 1 basedcol
- of the screen, index 1 based- Returns:
- - if position is not in an extended field, null us returned
- Throws:
Zos3270Exception
-
retrieveHighlightAtCursor
Description copied from interface:ITerminal
Return the highlighting of the character at the cursor position- Specified by:
retrieveHighlightAtCursor
in interfaceITerminal
- Returns:
- - if position is not in an extended field, null us returned
-
retrieveHighlightAtPosition
Description copied from interface:ITerminal
Return the highlighting of the character at the cursor position- Specified by:
retrieveHighlightAtPosition
in interfaceITerminal
- Parameters:
row
- of the screen, index 1 basedcol
- of the screen, index 1 based- Returns:
- - if position is not in an extended field, null us returned
- Throws:
Zos3270Exception
-
Terminal(String id, String host, int port, boolean ssl, TerminalSize primarySize, TerminalSize alternateSize, ITextScannerManagerSpi textScan, Charset codePage)
constructor instead.