Package ghidra.test
Class AbstractGhidraHeadlessIntegrationTest
- java.lang.Object
- 
- generic.test.AbstractGTest
- 
- generic.test.AbstractGenericTest
- 
- docking.test.AbstractDockingTest
- 
- ghidra.test.AbstractGhidraHeadlessIntegrationTest
 
 
 
 
- 
- Direct Known Subclasses:
- AbstractGhidraHeadedIntegrationTest
 
 public abstract class AbstractGhidraHeadlessIntegrationTest extends AbstractDockingTest 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class generic.test.AbstractGenericTestAbstractGenericTest.ExceptionHandlingRunner
 
- 
 - 
Field SummaryFields Modifier and Type Field Description static java.lang.StringPROJECT_NAME- 
Fields inherited from class generic.test.AbstractGenericTestconcurrentTestExceptionRule, DEFAULT_TEST_TOOL_NAME, DEFAULT_TOOL_NAME, ruleChain, TESTDATA_DIRECTORY_NAME, watchman
 - 
Fields inherited from class generic.test.AbstractGTestBATCH_MODE, DEFAULT_WAIT_DELAY, DEFAULT_WAIT_TIMEOUT, DEFAULT_WINDOW_TIMEOUT, PARALLEL_MODE, PRIVATE_LONG_WAIT_TIMEOUT, testName
 
- 
 - 
Constructor SummaryConstructors Constructor Description AbstractGhidraHeadlessIntegrationTest()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanapplyCmd(Program program, Command cmd)Run a command against the specified program within a transaction.protected ApplicationConfigurationcreateApplicationConfiguration()protected ApplicationLayoutcreateApplicationLayout()static ProgramDBcreateDefaultProgram(java.lang.String name, java.lang.String languageString, java.lang.Object consumer)Creates an in-memory program with the given languagestatic ProgramDBcreateDefaultProgram(java.lang.String name, java.lang.String languageString, java.lang.String compilerSpecID, java.lang.Object consumer)Creates an in-memory program with the given language<R,E extends java.lang.Exception>
 RcreateInProgram(Program program, ExceptionalFunction<Program,R,E> f)Provides a convenient method for modifying the current program, handling the transaction logic and returning a new item as a resultvoiddebugProgramInTool(Program p, java.lang.String address)A convenience method that allows you to open the given program in a default tool, navigating to the given address.static booleandeleteProject(java.lang.String directory, java.lang.String name)static LanguageCompilerSpecPairgetLanguageCompilerSpecPair(java.lang.String oldLanguageName)Get the language and compiler spec associated with an old language name string.static LanguageServicegetLanguageService()Get language service used for testing.static <T extends Plugin>
 TgetPlugin(PluginTool tool, java.lang.Class<T> c)static LanguagegetSLEIGH_8051_LANGUAGE()static LanguagegetSLEIGH_X86_64_LANGUAGE()static LanguagegetSLEIGH_X86_LANGUAGE()SymbolgetUniqueSymbol(Program program, java.lang.String name)Returns the global symbol with the given name if and only if it is the only global symbol with that name.SymbolgetUniqueSymbol(Program program, java.lang.String name, Namespace namespace)Returns the symbol in the given namespace with the given name if and only if it is the only symbol in that namespace with that name.static LanguagegetZ80_LANGUAGE()voidgoTo(PluginTool tool, Program p, Address addr)voidgoTo(PluginTool tool, Program p, java.lang.String addrString)protected voidinitializeSystemProperties()A place to initialize and needed static propertiesvoidmakeSelection(PluginTool tool, Program p, Address... addrs)voidmakeSelection(PluginTool tool, Program p, AddressRange... ranges)voidmakeSelection(PluginTool tool, Program p, Address from, Address to)voidmakeSelection(PluginTool tool, Program p, AddressSetView addresses)voidmakeSelection(PluginTool tool, Program p, java.util.List<Address> addrs)<E extends java.lang.Exception>
 voidmodifyProgram(Program program, ExceptionalConsumer<Program,E> callback)Provides a convenient method for modifying the current program, handling the transaction logicstatic voidredo(UndoableDomainObject dobj)Redo the last undone transaction on domain object and wait for all events to be flushed.static voidredo(UndoableDomainObject dobj, boolean wait)Redo the last undone transaction on the domain object and wait for all events to be flushed.static voidredo(UndoableDomainObject dobj, int count)Redo the last 'count' undone transactions on the domain object and wait for all events to be flushed.static <T> voidreplaceService(PluginTool tool, java.lang.Class<? extends T> service, T replacement)Replaces the given implementations of the provided service class with the given class.AddressSettoAddressSet(AddressRange... ranges)AddressSettoAddressSet(Address start, Address end)AddressSettoAddressSet(java.util.List<Address> addrs)static <E extends java.lang.Exception>
 voidtx(Program p, ExceptionalCallback<E> c)static voidundo(UndoableDomainObject dobj)Undo the last transaction on the domain object and wait for all events to be flushed.static voidundo(UndoableDomainObject dobj, boolean wait)Undo the last transaction on the domain object and wait for all events to be flushed.static voidundo(UndoableDomainObject dobj, int count)Undo the last 'count' transactions on the domain object and wait for all events to be flushed.voidwaitForScriptCompletion(ScriptTaskListener listener, long timeoutMS)Waits for a launched script to complete by using the given listener.- 
Methods inherited from class docking.test.AbstractDockingTestassertEnabled, assertToggleButtonSelected, capture, checkMessageDisplay, clickComponentProvider, clickComponentProvider, close, close, closeAllWindows, closeAllWindows, closeAllWindowsAndFrames, closeProvider, closeSaveChangesDialog, createContext, createContext, createRenderedImage, createScreenImage, disposeErrorGUI, dockingSetUp, dockingTearDown, expandPath, expandTree, findButtonByActionName, findButtonByIcon, findButtonByText, findComponent, findComponentByName, getAction, getAction, getAction, getActionsByName, getActionsByOwner, getActionsByOwnerAndName, getClipboardText, getComponentProvider, getDialogComponent, getDialogComponentProvider, getDockableComponent, getLocalAction, getNode, getOpenWindowsAsString, getStatusText, getTitleForWindow, getWindow, getWindowByTitle, getWindowByTitleContaining, getWindows, isEnabled, isEnabled, isSelected, isUseErrorGUI, performAction, performAction, performAction, performAction, performDialogAction, pressButtonByText, pressButtonByText, printOpenWindows, selectPath, selectTabIfAvailable, setErrorGUIEnabled, setErrorsExpected, setToggleActionSelected, setToggleActionSelected, setToggleButtonSelected, setToggleButtonSelected, showProvider, triggerActionKey, triggerActionKey, triggerBackspaceKey, triggerEnter, triggerEscapeKey, triggerKey, triggerKey, triggerText, triggerText, waitForComponentProvider, waitForComponentProvider, waitForDialogComponent, waitForDialogComponent, waitForDialogComponent, waitForJDialog, waitForJDialog, waitForTableModel, waitForTree, waitForUpdateOnChooser, waitForWindow, waitForWindow, waitForWindow, waitForWindow, waitForWindowByName, waitForWindowByTitleContaining, waitForWindowByTitleContaining, writeImage, writeImage
 - 
Methods inherited from class generic.test.AbstractGenericTestclickMouse, clickMouse, clickTableCell, createStackTraceForAllThreads, createTempDirectory, createTempFile, createTempFile, createTempFileForTest, createTempFileForTest, createTempFilePath, createTempFilePath, deleteMatchingTempFiles, deleteSimilarTempFiles, doubleClick, dragMouse, editCell, executeOnSwingWithoutBlocking, findAbstractButtonByName, findAbstractButtonByText, findButtonByIcon, findButtonByText, findComponent, findComponent, findComponentByName, findComponentByName, findComponentsByName, findOwnedWindows, findPathToText, findTestDataFile, findTreePathToText, fixupGUI, getAllWindows, getDebugFileDirectory, getInstanceField, getInstanceFieldByClassType, getLocalResourceFile, getRenderedTableCellValue, getTestDataDir, getTestDataDirectory, getTestDataFile, getText, hasTestFailed, initializeLayout, invokeConstructor, invokeInstanceMethod, invokeInstanceMethod, leftClick, loadTextResource, loadTextResource, middleClick, moveMouse, postEvent, pressButton, pressButton, pressButtonByName, pressButtonByName, pressButtonByText, pressButtonByText, printMemory, privateWaitForPostedSwingRunnables_SwingSafe, rightClick, runSwing, runSwing, runSwing, runSwingWithExceptions, setComboBoxSelection, setInstanceField, setText, testFailed, toString, waitForPostedSwingRunnables, waitForSwing, waitForTasks, windowForComponent, yieldToSwing
 - 
Methods inherited from class generic.test.AbstractGTestassertArraysEqualOrdered, assertArraysEqualUnordered, assertArraysEqualUnordered, assertContainsExactly, assertContainsExactly, assertListEqualOrdered, assertListEqualOrdered, assertListEqualsArrayOrdered, assertListEqualsArrayUnordered, assertListEqualUnordered, failWithException, getName, getRandomInt, getRandomInt, getRandomString, getRandomString, getTestDirectoryPath, sleep, waitFor, waitFor, waitFor, waitFor, waitForCondition, waitForCondition, waitForCondition, waitForConditionWithoutFailing, waitForValue, waitForValueWithoutFailing
 
- 
 
- 
- 
- 
Method Detail- 
createApplicationLayoutprotected ApplicationLayout createApplicationLayout() - Overrides:
- createApplicationLayoutin class- AbstractDockingTest
 
 - 
createApplicationConfigurationprotected ApplicationConfiguration createApplicationConfiguration() - Overrides:
- createApplicationConfigurationin class- AbstractDockingTest
 
 - 
initializeSystemPropertiesprotected void initializeSystemProperties() Description copied from class:AbstractGenericTestA place to initialize and needed static properties- Overrides:
- initializeSystemPropertiesin class- AbstractGenericTest
 
 - 
deleteProjectpublic static boolean deleteProject(java.lang.String directory, java.lang.String name)
 - 
getLanguageCompilerSpecPairpublic static LanguageCompilerSpecPair getLanguageCompilerSpecPair(java.lang.String oldLanguageName) throws LanguageNotFoundException Get the language and compiler spec associated with an old language name string. If the language no longer exists, and suitable replacement language will be returned if found. If no language is found, an exception will be thrown.- Parameters:
- oldLanguageName- old language name string
- Returns:
- the language compiler and spec
- Throws:
- LanguageNotFoundException
 
 - 
createDefaultProgrampublic static ProgramDB createDefaultProgram(java.lang.String name, java.lang.String languageString, java.lang.Object consumer) throws java.lang.Exception Creates an in-memory program with the given language- Parameters:
- name- the program name
- languageString- a language string of the format x86:LE:32:default
- consumer- a consumer for the program
- Returns:
- a new program
- Throws:
- java.lang.Exception- if there is any issue creating the language
 
 - 
createDefaultProgrampublic static ProgramDB createDefaultProgram(java.lang.String name, java.lang.String languageString, java.lang.String compilerSpecID, java.lang.Object consumer) throws java.lang.Exception Creates an in-memory program with the given language- Parameters:
- name- the program name
- languageString- a language string of the format x86:LE:32:default
- compilerSpecID- the ID
- consumer- a consumer for the program
- Returns:
- a new program
- Throws:
- java.lang.Exception- if there is any issue creating the language
 
 - 
applyCmdpublic static boolean applyCmd(Program program, Command cmd) throws RollbackException Run a command against the specified program within a transaction. The transaction will be committed unless the command throws a RollbackException.- Parameters:
- program- the program
- cmd- the command to apply
- Returns:
- result of command applyTo method
- Throws:
- RollbackException- thrown if thrown by command applyTo method
 
 - 
txpublic static <E extends java.lang.Exception> void tx(Program p, ExceptionalCallback<E> c) throws E extends java.lang.Exception - Throws:
- E extends java.lang.Exception
 
 - 
modifyProgrampublic <E extends java.lang.Exception> void modifyProgram(Program program, ExceptionalConsumer<Program,E> callback) Provides a convenient method for modifying the current program, handling the transaction logic- Parameters:
- program- the program
- callback- the code to execute
 
 - 
createInProgrampublic <R,E extends java.lang.Exception> R createInProgram(Program program, ExceptionalFunction<Program,R,E> f) Provides a convenient method for modifying the current program, handling the transaction logic and returning a new item as a result- Parameters:
- program- the program
- f- the function for modifying the program and creating the desired result
- Returns:
- the result
 
 - 
undopublic static void undo(UndoableDomainObject dobj, boolean wait) Undo the last transaction on the domain object and wait for all events to be flushed.- Parameters:
- dobj- The domain object upon which to perform the undo.
- wait- if true, wait for undo to fully complete in Swing thread. If a modal dialog may result from this undo, wait should be set false.
 
 - 
redopublic static void redo(UndoableDomainObject dobj, boolean wait) Redo the last undone transaction on the domain object and wait for all events to be flushed.- Parameters:
- dobj- The domain object upon which to perform the redo.
- wait- if true, wait for redo to fully complete in Swing thread. If a modal dialog may result from this redo, wait should be set false.
 
 - 
undopublic static void undo(UndoableDomainObject dobj) Undo the last transaction on the domain object and wait for all events to be flushed.- Parameters:
- dobj- The domain object upon which to perform the undo.
 
 - 
redopublic static void redo(UndoableDomainObject dobj) Redo the last undone transaction on domain object and wait for all events to be flushed.- Parameters:
- dobj- The domain object upon which to perform the redo.
 
 - 
undopublic static void undo(UndoableDomainObject dobj, int count) Undo the last 'count' transactions on the domain object and wait for all events to be flushed.- Parameters:
- dobj- The domain object upon which to perform the undo.
- count- number of transactions to undo
 
 - 
redopublic static void redo(UndoableDomainObject dobj, int count) Redo the last 'count' undone transactions on the domain object and wait for all events to be flushed.- Parameters:
- dobj- The domain object upon which to perform the redo.
- count- number of transactions to redo
 
 - 
getPluginpublic static <T extends Plugin> T getPlugin(PluginTool tool, java.lang.Class<T> c) 
 - 
toAddressSetpublic AddressSet toAddressSet(java.util.List<Address> addrs) 
 - 
toAddressSetpublic AddressSet toAddressSet(Address start, Address end) 
 - 
toAddressSetpublic AddressSet toAddressSet(AddressRange... ranges) 
 - 
goTopublic void goTo(PluginTool tool, Program p, Address addr) 
 - 
goTopublic void goTo(PluginTool tool, Program p, java.lang.String addrString) 
 - 
makeSelectionpublic void makeSelection(PluginTool tool, Program p, java.util.List<Address> addrs) 
 - 
makeSelectionpublic void makeSelection(PluginTool tool, Program p, Address from, Address to) 
 - 
makeSelectionpublic void makeSelection(PluginTool tool, Program p, Address... addrs) 
 - 
makeSelectionpublic void makeSelection(PluginTool tool, Program p, AddressRange... ranges) 
 - 
makeSelectionpublic void makeSelection(PluginTool tool, Program p, AddressSetView addresses) 
 - 
getUniqueSymbolpublic Symbol getUniqueSymbol(Program program, java.lang.String name) Returns the global symbol with the given name if and only if it is the only global symbol with that name.- Parameters:
- program- the program to search.
- name- the name of the global symbol to find.
- Returns:
- the global symbol with the given name if and only if it is the only one.
 
 - 
getUniqueSymbolpublic Symbol getUniqueSymbol(Program program, java.lang.String name, Namespace namespace) Returns the symbol in the given namespace with the given name if and only if it is the only symbol in that namespace with that name.- Parameters:
- program- the program to search.
- name- the name of the symbol to find.
- namespace- the parent namespace; may be null
- Returns:
- the symbol with the given name if and only if it is the only one in that namespace
 
 - 
debugProgramInToolpublic void debugProgramInTool(Program p, java.lang.String address) throws java.lang.Exception A convenience method that allows you to open the given program in a default tool, navigating to the given address.Note: this is a blocking operation. Your test will not proceed while this method is sleeping. Do not leave this call in your test when committing changes. - Parameters:
- p- the program
- address- the address
- Throws:
- java.lang.Exception- if there is an issue create a- TestEnv
 
 - 
waitForScriptCompletionpublic void waitForScriptCompletion(ScriptTaskListener listener, long timeoutMS) Waits for a launched script to complete by using the given listener.- Parameters:
- listener- the listener used to track script progress
- timeoutMS- the max time to wait; failing if exceeded
 
 - 
replaceServicepublic static <T> void replaceService(PluginTool tool, java.lang.Class<? extends T> service, T replacement) Replaces the given implementations of the provided service class with the given class.- Type Parameters:
- T- the service type
- Parameters:
- tool- the tool whose services to update (optional)
- service- the service to override
- replacement- the new version of the service
 
 - 
getLanguageServicepublic static LanguageService getLanguageService() Get language service used for testing.- Returns:
- language service.
 
 - 
getSLEIGH_X86_LANGUAGEpublic static Language getSLEIGH_X86_LANGUAGE() 
 - 
getSLEIGH_X86_64_LANGUAGEpublic static Language getSLEIGH_X86_64_LANGUAGE() 
 - 
getSLEIGH_8051_LANGUAGEpublic static Language getSLEIGH_8051_LANGUAGE() 
 - 
getZ80_LANGUAGEpublic static Language getZ80_LANGUAGE() 
 
- 
 
-