Package ghidra.test
Class ProjectTestUtils
- java.lang.Object
- 
- ghidra.test.ProjectTestUtils
 
- 
 public class ProjectTestUtils extends java.lang.ObjectGhidra framework and program test utilities
- 
- 
Constructor SummaryConstructors Constructor Description ProjectTestUtils()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static DomainFilecreateProgramFile(Project proj, java.lang.String progName, Language language, CompilerSpec compilerSpec, DomainFolder folder)Create an empty program file within the specified project folder.static booleandeleteProject(java.lang.String directory, java.lang.String name)Remove entire project.static booleandeleteTool(Project project, java.lang.String toolName)Remove the specified tool if it exists.static ProjectgetProject(java.lang.String directory, java.lang.String name)Open the project for the given directory and name.static ToolgetTool(Project project, java.lang.String toolName)Launch a tool.static ToolTemplatesaveTool(Project project, Tool tool)Save a tool to the project tool chest.
 
- 
- 
- 
Method Detail- 
getProjectpublic static Project getProject(java.lang.String directory, java.lang.String name) throws java.io.IOException, LockException Open the project for the given directory and name. If the project does not exist, create one. Only once instance of a given project may be open at any given point in time. Be sure to close the project if you will be re-opening.- Parameters:
- directory- directory for the project
- name- name of the project
- Returns:
- the project
- Throws:
- java.io.IOException- if there was a problem creating the project
- LockException- if the project is already open
- java.lang.IllegalArgumentException- if the name has illegal characters such that a URL could not be created
 
 - 
deleteProjectpublic static boolean deleteProject(java.lang.String directory, java.lang.String name)Remove entire project. Note: this will not remove the parentdirectoryof the project.- Parameters:
- directory- directory of the project.
- name- The name of the project to delete
- Returns:
- True if the project was deleted.
 
 - 
createProgramFilepublic static DomainFile createProgramFile(Project proj, java.lang.String progName, Language language, CompilerSpec compilerSpec, DomainFolder folder) throws InvalidNameException, CancelledException, LanguageNotFoundException, java.io.IOException Create an empty program file within the specified project folder.- Parameters:
- proj- active project.
- progName- name of program and domain file to be created.
- langType- a specified language, or 0 if it does not matter.
- folder- domain folder within the specified project which the user has permission to write. If null, the root data folder will be used.
- Returns:
- new domain file.
- Throws:
- InvalidNameException
- CancelledException
- LanguageNotFoundException
- java.io.IOException
 
 - 
getToolpublic static Tool getTool(Project project, java.lang.String toolName) Launch a tool.- Parameters:
- project- the project to which the tool belongs
- toolName- name of the tool to get from the active workspace. If null, launch a new empty tool in the active workspace.
 
 - 
saveToolpublic static ToolTemplate saveTool(Project project, Tool tool) Save a tool to the project tool chest.- Parameters:
- project- The project which with the tool is associated.
- tool- The tool to be saved
- Returns:
- The tool template for the given tool.
- Throws:
- DuplicateNameException
 
 - 
deleteToolpublic static boolean deleteTool(Project project, java.lang.String toolName) Remove the specified tool if it exists.- Parameters:
- project-
- toolName-
- Returns:
- true if it existed and was removed from the local tool chest.
 
 
- 
 
-